PostCondition
Union type representing every kind of post-condition: STX, fungible token, non-fungible token, staking, and PoX.
Usage
import { Pc, PostCondition } from '@stacks/transactions';
// Build post conditions with the Pc builder
const stxPc: PostCondition = Pc.principal('STB44HYPYAT2BB2QE513NSP81HTMYWBJP02HPGK6')
.willSendEq(10000)
.ustx();
const ftPc: PostCondition = Pc.principal('STB44HYPYAT2BB2QE513NSP81HTMYWBJP02HPGK6')
.willSendGte(100)
.ft('ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM.token', 'token-name');
// Staking post condition
const stakingPc: PostCondition = Pc.principal('STB44HYPYAT2BB2QE513NSP81HTMYWBJP02HPGK6')
.willSendLte(1000000)
.ustxToLock();
// PoX post condition
const poxPc: PostCondition = Pc.principal(
'STB44HYPYAT2BB2QE513NSP81HTMYWBJP02HPGK6'
).willNotPerformPox();Definition
See PostConditionType for the wire value each of these serializes to.
Availability
maybe-sent on NonFungiblePostCondition (SIP-040)
@stacks/transactions 7.4.0, Stacks epoch 3.4
StakingPostCondition and PoxPostCondition (SIP-045)
@stacks/transactions 7.5.0, Stacks epoch 4.0
StxPostCondition
FungiblePostCondition
NonFungiblePostCondition
maybe-sent was added by SIP-040. It always passes, and still counts as covering that NFT instance under Deny or Originator mode.
StakingPostCondition
Guards staking STX or modifying staked STX for a principal. For example, the pox-5 stake, register-for-bond, and stake-update calls. Uses the same comparators as StxPostCondition.
PoxPostCondition
Guards PoX state changes that do not alter locking status. For example, the pox-5 unstake, unstake-sbtc, update-bond-registration, and announce-l1-early-exit calls. Carries only a principal and a condition code.
will-not-perform
The principal must not perform a gated PoX action
may-perform
The principal may or may not perform one; always passes
will-perform
The principal must perform a gated PoX action
Last updated
Was this helpful?