TxParamsBase
Transaction fields shared by every build* function in this package: fee, nonce, network, and optional post conditions. You pass them through SingleSigTxParams or MultiSigTxParams, which both extend TxParamsBase.
Usage
import { buildStake } from '@stacks/bitcoin-staking';
import { Pc, fetchNonce } from '@stacks/transactions';
const tx = await buildStake({
signerManager: 'SP2C2YFP12AJZB4MABJBAJ55XECVS7E4PMMZ89YZR.my-signer-manager',
amountUstx,
numCycles: 6,
startBurnHt,
publicKey,
// TxParamsBase fields
fee: 10_000n, // micro-STX
nonce: await fetchNonce({ address: stakerAddress, network: 'mainnet' }),
network: 'mainnet',
postConditions: [Pc.principal(stakerAddress).willSendEq(amountUstx).ustxToLock()],
});Notes
Builders attach no post conditions of their own and default to
'deny'mode. A call that moves an asset, locks STX, or performs a PoX action (unstake,unstake-sbtc,update-bond-registration,announce-l1-early-exit) aborts withabort_by_post_conditionunless you pass matchingpostConditionsor setpostConditionMode: 'allow'.Builders neither estimate
feenor fetchnonce. Read the nonce with fetchNonce.networkalso sets the contract address: builders callpox-5on the network'sbootAddress,SP000000000000000000002Q6VF78on mainnet andST000000000000000000002AMW42Hon testnet. An unknown network name throwsUnknown network name: <name>.
Definition
Properties
fee
IntegerType
Transaction fee in micro-STX
nonce
IntegerType
Nonce of the origin account
network
StacksNetworkName | StacksNetwork
A name such as 'mainnet' or 'testnet', or a StacksNetwork object
postConditionMode
PostConditionModeName (optional)
'allow', 'deny' or 'originator'. See PostConditionMode. Defaults to 'deny'
Was this helpful?