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

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 with abort_by_post_condition unless you pass matching postConditions or set postConditionMode: 'allow'.

  • Builders neither estimate fee nor fetch nonce. Read the nonce with fetchNonce.

  • network also sets the contract address: builders call pox-5 on the network's bootAddress, SP000000000000000000002Q6VF78 on mainnet and ST000000000000000000002AMW42H on testnet. An unknown network name throws Unknown network name: <name>.


Definition


Properties

Property
Type
Description

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

postConditions

PostCondition[] (optional)

Post conditions to attach to the transaction

postConditionMode

PostConditionModeName (optional)

'allow', 'deny' or 'originator'. See PostConditionMode. Defaults to 'deny'

Was this helpful?