parseSignerCalldata
Decodes signerCalldata bytes from buildSignerCalldata back into the payout address and maximum fee. Pure computation.
Usage
import { BtcAddress, buildSignerCalldata, parseSignerCalldata } from '@stacks/bitcoin-staking';
const signerCalldata = buildSignerCalldata({
poxAddress: 'bc1qw508d6qejxtdg4y5r3zarvary0c5xw7kv8f3t4',
maxFeeSats: 1_000n,
});
const { poxAddress, maxFeeSats } = parseSignerCalldata(signerCalldata);
BtcAddress.stringify(poxAddress, 'mainnet'); // 'bc1qw508d6qejxtdg4y5r3zarvary0c5xw7kv8f3t4'
maxFeeSats; // 1000nNotes
Accepts the bytes or their hex encoding.
Throws an
Errorwhose message starts withInvalid signer calldata:when the value is not a tuple withpox-addrandmax-feekeys, whenpox-addris not a tuple, or whenmax-feeis not auint. Bytes that are not a Clarity value throw while decoding, and ahashbyteslength that does not match the version throws.The result carries no network. Render the address with BtcAddress.stringify for the network you expect.
Signature
Returns
{ poxAddress: BtcAddressRepr; maxFeeSats: bigint }
maxFeeSats
bigint
Largest sBTC fee the staker accepts, in sats
Parameters
calldata (required)
Type:
Uint8Array | string
Serialized calldata, as bytes or hex.
Was this helpful?