@secondlayer/stacks 2.16.0 → 2.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -217,6 +217,20 @@ declare function assertPox5Active(client: Client): Promise<void>;
217
217
  */
218
218
  /** Boot contract name; deployer is the chain's boot address. */
219
219
  declare const POX5_CONTRACT_NAME = "pox-5";
220
+ /** Fully-qualified mainnet contract id (boot address + `pox-5`). */
221
+ declare const POX5_CONTRACT_ID_MAINNET: string;
222
+ /**
223
+ * All print-event topic strings emitted by `pox-5.clar`. Unlike pox-2/3/4,
224
+ * pox-5 has NO node-synthesized events — every event is a real `(print ...)`
225
+ * with these `topic` values and the remaining tuple fields flattened at the
226
+ * top level via `merge` (not nested under a `data` key).
227
+ *
228
+ * `add-to-allowlist` and `bond-distribution` are emitted per-item inside
229
+ * folds (`setup-bond` / `calculate-rewards`), so one transaction can carry
230
+ * many prints.
231
+ */
232
+ declare const POX5_EVENT_TOPICS: readonly ["set-bond-admin", "set-pause-admin", "pause-rewards", "setup-bond", "add-to-allowlist", "register-for-bond", "update-bond-registration", "register-signer", "stake", "stake-update", "announce-l1-early-exit", "unstake-sbtc", "unstake", "calculate-rewards", "bond-distribution", "claim-rewards", "claim-staker-rewards-for-signer", "grant-signer-key", "revoke-signer-grant"];
233
+ type Pox5EventTopic = (typeof POX5_EVENT_TOPICS)[number];
220
234
  /**
221
235
  * Epoch 4.0 hard-fork activation height on mainnet — Bitcoin block 960,230
222
236
  * (expected ~2026-07-29 03:00 UTC, per the stacks-core 4.0.0 release).
@@ -407,6 +421,15 @@ declare function verifySignerGrant(opts: SignerGrantOptions & {
407
421
  publicKey: Uint8Array | string
408
422
  signature: Uint8Array | string
409
423
  }): boolean;
424
+ type IntegerType = number | string | bigint | Uint8Array;
425
+ /**
426
+ * Named fee tiers. `'low' | 'mid' | 'high'` map to the node's three fee
427
+ * estimations; `'min'` is the node's minimum relay fee — 1 uSTX per byte of
428
+ * the serialized transaction, computable offline.
429
+ */
430
+ type FeeTier = "min" | "low" | "mid" | "high";
431
+ /** Fee input accepted by wallet actions: an explicit amount or a named tier. */
432
+ type FeeParam = IntegerType | FeeTier;
410
433
  type FungibleComparator = "eq" | "gt" | "gte" | "lt" | "lte";
411
434
  type NonFungibleComparator = "sent" | "not-sent";
412
435
  type StxPostCondition = {
@@ -442,24 +465,37 @@ type PoxPostCondition = {
442
465
  condition: PoxComparator
443
466
  };
444
467
  type PostCondition = StxPostCondition | FtPostCondition | NftPostCondition | StakingPostCondition | PoxPostCondition;
445
- type IntegerType = number | string | bigint | Uint8Array;
446
468
  /**
447
- * Named fee tiers. `'low' | 'mid' | 'high'` map to the node's three fee
448
- * estimations; `'min'` is the node's minimum relay fee — 1 uSTX per byte of
449
- * the serialized transaction, computable offline.
469
+ * Mapped read-return types for the pox-5 contract — the JS shapes
470
+ * `getContract` produces from the ABI (camelCase keys, `uint` → `bigint`,
471
+ * `buff` → `Uint8Array`, `none` → `null`, response ok auto-unwrapped).
450
472
  */
451
- type FeeTier = "min" | "low" | "mid" | "high";
452
- /** Fee input accepted by wallet actions: an explicit amount or a named tier. */
453
- type FeeParam = IntegerType | FeeTier;
454
- type CallContractParams = {
455
- contract: string
456
- functionName: string
457
- functionArgs?: ClarityValue[]
458
- fee?: FeeParam
459
- nonce?: IntegerType
460
- postConditionMode?: "allow" | "deny"
461
- postConditions?: PostCondition[]
462
- };
473
+ /** Staker info from `get-staker-info`; `null` when expired/absent. */
474
+ type StakerInfo = {
475
+ amountUstx: bigint
476
+ firstRewardCycle: bigint
477
+ numCycles: bigint
478
+ signer: string
479
+ } | null;
480
+ /** Bond membership from `get-bond-membership`; `null` when not in a bond. */
481
+ type BondMembership = {
482
+ amountSats: bigint
483
+ amountUstx: bigint
484
+ bondIndex: bigint
485
+ isL1Lock: boolean
486
+ signer: string
487
+ } | null;
488
+ /** Bond parameters from `get-protocol-bond`; `null` for an unknown bond. */
489
+ type ProtocolBond = {
490
+ earlyUnlockBytes: Uint8Array
491
+ minUstxRatio: bigint
492
+ stxValueRatio: bigint
493
+ targetRate: bigint
494
+ } | null;
495
+ /** Allowlisted max sats from `get-bond-allowance`; `null` when not allowlisted. */
496
+ type BondAllowance = bigint | null;
497
+ /** Signer key from `get-signer-info`; `null` for an unknown signer. */
498
+ type SignerInfo = Uint8Array | null;
463
499
  /**
464
500
  * PoX-5 contract calls and reads, pinned against the final contract in
465
501
  * stacks-core 4.0.0. Wallet actions route through `callContract`, so they
@@ -473,7 +509,12 @@ type CallContractParams = {
473
509
  */
474
510
  /** Resolve the boot `pox-5` contract id for the client's chain. */
475
511
  declare function pox5ContractId(client: Client): string;
476
- type TxOptions = Pick<CallContractParams, "fee" | "nonce" | "postConditions" | "postConditionMode">;
512
+ type TxOptions = {
513
+ fee?: FeeParam
514
+ nonce?: IntegerType
515
+ postConditions?: PostCondition[]
516
+ postConditionMode?: "allow" | "deny"
517
+ };
477
518
  /**
478
519
  * One proven L1 timelock output — a Bitcoin SPV inclusion proof of the lockup
479
520
  * tx plus which output is the lockup. `@secondlayer/stacks/bitcoin`'s
@@ -597,18 +638,18 @@ type Pox5Actions = {
597
638
  getActivation: () => Promise<Pox5Activation | undefined>
598
639
  contractId: () => string
599
640
  getStakerState: (staker: string) => Promise<StakerState>
600
- getStakerInfo: (staker: string) => Promise<ClarityValue>
601
- getBondMembership: (staker: string) => Promise<ClarityValue>
602
- getProtocolBond: (bondIndex: IntegerType) => Promise<ClarityValue>
603
- getBondAllowance: (bondIndex: IntegerType, staker: string) => Promise<ClarityValue>
604
- getTotalSbtcStakedForBond: (bondIndex: IntegerType) => Promise<ClarityValue>
605
- getStakerCustodiedSbtc: (staker: string) => Promise<ClarityValue>
606
- hasAnnouncedL1EarlyExit: (bondIndex: IntegerType, staker: string) => Promise<ClarityValue>
607
- getBondL1UnlockHeight: (bondIndex: IntegerType) => Promise<ClarityValue>
608
- getSignerInfo: (signer: string) => Promise<ClarityValue>
609
- verifySignerKeyGrant: (signerManager: string, signerKey: Uint8Array | string) => Promise<ClarityValue>
610
- getCurrentRewardCycle: () => Promise<ClarityValue>
611
- getFirstRewardCycle: () => Promise<ClarityValue>
641
+ getStakerInfo: (staker: string) => Promise<StakerInfo>
642
+ getBondMembership: (staker: string) => Promise<BondMembership>
643
+ getProtocolBond: (bondIndex: IntegerType) => Promise<ProtocolBond>
644
+ getBondAllowance: (bondIndex: IntegerType, staker: string) => Promise<BondAllowance>
645
+ getTotalSbtcStakedForBond: (bondIndex: IntegerType) => Promise<bigint>
646
+ getStakerCustodiedSbtc: (staker: string) => Promise<bigint>
647
+ hasAnnouncedL1EarlyExit: (bondIndex: IntegerType, staker: string) => Promise<boolean>
648
+ getBondL1UnlockHeight: (bondIndex: IntegerType) => Promise<bigint>
649
+ getSignerInfo: (signer: string) => Promise<SignerInfo>
650
+ verifySignerKeyGrant: (signerManager: string, signerKey: Uint8Array | string) => Promise<boolean>
651
+ getCurrentRewardCycle: () => Promise<bigint>
652
+ getFirstRewardCycle: () => Promise<bigint>
612
653
  setupBond: (params: SetupBondParams) => Promise<string>
613
654
  registerForBond: (params: RegisterForBondParams) => Promise<string>
614
655
  updateBondRegistration: (params: UpdateBondRegistrationParams) => Promise<string>
@@ -643,4 +684,4 @@ type Pox5Actions = {
643
684
  * }
644
685
  */
645
686
  declare function pox5(): (client: Client) => Pox5Actions;
646
- export { verifySignerGrant, stakerPreimage, stakerConsensusBuff, signSignerGrant, serializeCScriptNum, rewardCycleToBurnHeight, pushScriptBytes, pushCScriptNum, pox5ContractId, pox5, isPox5Active, isInPreparePhase, getPox5Activation, computeSignerGrantHash, burnHeightToRewardCycle, burnHeightToDistributionIndex, buildLockupScript, buildLockupOutputScript, buildLockupAddress, buildDefaultStakerUnlockBytes, bondUnlockCycle, bondPhaseAtHeight, bondPeriodToRewardCycle, bondPeriodToBurnHeight, assertPox5Active, UpdateBondRegistrationParams, UnstakeSbtcParams, UnstakeParams, StakerState, StakeUpdateParams, StakeParams, SignerGrantOptions, SetupBondParams, RevokeSignerGrantParams, RegisterForBondParams, PoxCycleParams, Pox5Activation, Pox5Actions, POX5_SIGNER_DOMAIN, POX5_CONTRACT_NAME, POX5_ACTIVATION_BURN_HEIGHT_MAINNET, MAX_NUM_CYCLES, L1LockupOutput, GrantSignerKeyParams, ClaimStakerRewardsForSignerParams, ClaimRewardsParams, CalculateRewardsParams, C_SCRIPT_NUM_MAX, BuildLockupScriptOptions, BtcLockup, BondPhase, BondCycleParams, BOND_LENGTH_CYCLES, BOND_GAP_CYCLES, BITCOIN_LOCKTIME_THRESHOLD, AnnounceL1EarlyExitParams };
687
+ export { verifySignerGrant, stakerPreimage, stakerConsensusBuff, signSignerGrant, serializeCScriptNum, rewardCycleToBurnHeight, pushScriptBytes, pushCScriptNum, pox5ContractId, pox5, isPox5Active, isInPreparePhase, getPox5Activation, computeSignerGrantHash, burnHeightToRewardCycle, burnHeightToDistributionIndex, buildLockupScript, buildLockupOutputScript, buildLockupAddress, buildDefaultStakerUnlockBytes, bondUnlockCycle, bondPhaseAtHeight, bondPeriodToRewardCycle, bondPeriodToBurnHeight, assertPox5Active, UpdateBondRegistrationParams, UnstakeSbtcParams, UnstakeParams, StakerState, StakeUpdateParams, StakeParams, SignerGrantOptions, SetupBondParams, RevokeSignerGrantParams, RegisterForBondParams, PoxCycleParams, Pox5EventTopic, Pox5Activation, Pox5Actions, POX5_SIGNER_DOMAIN, POX5_EVENT_TOPICS, POX5_CONTRACT_NAME, POX5_CONTRACT_ID_MAINNET, POX5_ACTIVATION_BURN_HEIGHT_MAINNET, MAX_NUM_CYCLES, L1LockupOutput, GrantSignerKeyParams, ClaimStakerRewardsForSignerParams, ClaimRewardsParams, CalculateRewardsParams, C_SCRIPT_NUM_MAX, BuildLockupScriptOptions, BtcLockup, BondPhase, BondCycleParams, BOND_LENGTH_CYCLES, BOND_GAP_CYCLES, BITCOIN_LOCKTIME_THRESHOLD, AnnounceL1EarlyExitParams };