/** @internal PoX-5 contract name (on boot address, null address) */ export const POX5_CONTRACT_NAME = 'pox-5'; /** @internal Length of a paired-BTC bond in reward cycles (~6 months). */ export const BOND_LENGTH_CYCLES = 12; /** @internal Gap between consecutive bond starts, in reward cycles. */ export const BOND_GAP_CYCLES = 2; /** @internal Hard cap for STX-only stake duration. */ export const MAX_NUM_CYCLES = 96; /** * Address versions corresponding to the pox-5 contract `pox-addr` tuple. * Used for client-side address parsing in `btc-address.ts`. */ export enum PoXAddressVersion { // Taken from https://github.com/stx-labs/stacks.js/blob/efd2255f979ed64b90ac33246d99cd4809620400/packages/stacking/src/constants.ts#L1-L17 /** p2pkh — 20-byte hash160 of a single public key */ P2PKH = 0x00, /** p2sh — 20-byte hash160 of a redeemScript */ P2SH = 0x01, /** p2wpkh-p2sh (indistinguishable from P2SH on-chain) */ P2SHP2WPKH = 0x02, /** p2wsh-p2sh (indistinguishable from P2SH on-chain) */ P2SHP2WSH = 0x03, /** p2wpkh — 20-byte witness program */ P2WPKH = 0x04, /** p2wsh — 32-byte witness program */ P2WSH = 0x05, /** p2tr — 32-byte witness program */ P2TR = 0x06, } /** @internal Expected `hashbytes` length (bytes) for each {@link PoXAddressVersion}. */ export const POX_ADDR_DATA_LENGTH: Record = { [PoXAddressVersion.P2PKH]: 20, [PoXAddressVersion.P2SH]: 20, [PoXAddressVersion.P2SHP2WPKH]: 20, [PoXAddressVersion.P2SHP2WSH]: 20, [PoXAddressVersion.P2WPKH]: 20, [PoXAddressVersion.P2WSH]: 32, [PoXAddressVersion.P2TR]: 32, }; /** @internal Bitcoin base58 address version bytes per network */ export const BitcoinNetworkVersion = { mainnet: { P2PKH: 0x00, P2SH: 0x05 }, testnet: { P2PKH: 0x6f, P2SH: 0xc4 }, devnet: { P2PKH: 0x6f, P2SH: 0xc4 }, mocknet: { P2PKH: 0x6f, P2SH: 0xc4 }, } as const; /** @internal Regex matching base58 (legacy) BTC address prefixes */ export const B58_ADDR_PREFIXES = /^(1|3|m|n|2)/; /** @internal Regex matching any segwit BTC address prefix (mainnet, testnet, regtest) */ export const SEGWIT_ADDR_PREFIXES = /^(bc|tb|bcrt)/i; /** @internal Segwit v0 address prefix regex */ export const SEGWIT_V0_ADDR_PREFIX = /^(bc1q|tb1q|bcrt1q)/i; /** @internal Segwit v1 (taproot) address prefix regex */ export const SEGWIT_V1_ADDR_PREFIX = /^(bc1p|tb1p|bcrt1p)/i; /** @internal Bech32 human-readable part per network */ export const SegwitPrefix = { mainnet: 'bc', testnet: 'tb', devnet: 'bcrt', mocknet: 'bcrt', } as const; /** @internal Segwit v0 */ export const SEGWIT_V0 = 0; /** @internal Segwit v1 */ export const SEGWIT_V1 = 1;