@armada/sdk / tx / TransactDecoder
Interface: TransactDecoder
Defined in: src/tx/index.ts:178
Native decode for verifiers — understands bare transact() and the wrapper entry points, replacing the relayer's synthetic-calldata normalization (§4.6). A transact() call carries a Transaction[], so the decoder returns one DecodedTransact per bundled transaction.
extractFeeOutput recovers the in-band fee note addressed to the broadcaster. It takes the FULL broadcaster identity (not just the viewing key) and is async because it must bind the decrypted value to the transaction: decrypting a ciphertext with the viewing key alone yields an untrusted claimed value — a malicious sender could attach a ciphertext claiming a large fee while the actual on-chain commitment encodes zero or is addressed elsewhere. Binding requires recomputing npk = poseidon(broadcasterMasterPublicKey, random) and confirming the note's commitment hash appears in decoded.commitments, which needs the master public key.
Methods
decodeTransact()
decodeTransact(
calldata):DecodedTransact[]
Defined in: src/tx/index.ts:179
Parameters
calldata
`0x${string}`
Returns
extractFeeOutput()
extractFeeOutput(
decoded,broadcaster,tokenDataGetter,chain?,expected?):Promise<{tokenAddress:`0x${string}`;value:bigint; } |undefined>
Defined in: src/tx/index.ts:180
Parameters
decoded
broadcaster
tokenDataGetter
chain?
expected?
Optional guard: require the fee note be in this token and ≥ this value, else skip it.
tokenAddress?
`0x${string}`
minValue?
bigint
Returns
Promise<{ tokenAddress: `0x${string}`; value: bigint; } | undefined>