import {
verifyMandateOnchain,
verifyReceiptOnchain,
verifyMerkleProof,
receiptLeafBytes32,
canonicalize,
} from '@abstraxn/warrant-verifier';
// Offline Merkle (no RPC)
const leaf = receiptLeafBytes32(canonicalize(unsignedReceipt));
const merkleOk = verifyMerkleProof({
leaf,
proof: receipt.onchain.proof,
root: receipt.onchain.root,
});
// MandateRegistry — mandate hash matches on-chain record
const mandate = await verifyMandateOnchain({
rpcUrl: process.env.RPC_URL!,
mandateRegistry: '0x9f13744Cd7ca5b7851Aa21C9607617a83904A3b5',
mandateId: 'mnd_sha256:…',
contentHashHex: '…',
chainId: receipt.onchain.chainId,
});
// ReceiptLog — batch root published on-chain
const anchored = await verifyReceiptOnchain({
rpcUrl: process.env.RPC_URL!,
receiptLog: '0x65eDCae32a92eCCC47b7f0CBa06f2F924ce3A45E',
leaf,
proof: receipt.onchain.proof,
batchId: receipt.onchain.batchId,
root: receipt.onchain.root,
chainId: receipt.onchain.chainId,
});