For the complete documentation index, see llms.txt. This page is also available as Markdown.

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; // 1000n

Notes

  • Accepts the bytes or their hex encoding.

  • Throws an Error whose message starts with Invalid signer calldata: when the value is not a tuple with pox-addr and max-fee keys, when pox-addr is not a tuple, or when max-fee is not a uint. Bytes that are not a Clarity value throw while decoding, and a hashbytes length 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 }

Field
Type
Meaning

poxAddress

Payout address version and hash bytes

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?