@secondlayer/stacks 4.0.0 → 4.1.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.
Files changed (100) hide show
  1. package/README.md +4 -0
  2. package/dist/shared/stacks-1arrcd11.js +48 -0
  3. package/dist/shared/stacks-1arrcd11.js.map +10 -0
  4. package/dist/shared/stacks-9mqveyjv.cjs.map +2 -2
  5. package/dist/shared/{stacks-dr5en54r.cjs → stacks-9qcr921s.cjs} +42 -5
  6. package/dist/shared/stacks-9qcr921s.cjs.map +10 -0
  7. package/dist/shared/{stacks-thkhfwz8.js → stacks-bw8qvqd1.js} +18 -22
  8. package/dist/shared/{stacks-thkhfwz8.js.map → stacks-bw8qvqd1.js.map} +5 -5
  9. package/dist/shared/stacks-enpj9krt.cjs +38 -0
  10. package/dist/shared/stacks-enpj9krt.cjs.map +10 -0
  11. package/dist/shared/{stacks-90jcxs98.js → stacks-fb75yew8.js} +8 -6
  12. package/dist/shared/{stacks-90jcxs98.js.map → stacks-fb75yew8.js.map} +3 -3
  13. package/dist/shared/{stacks-rw2xbtdv.js → stacks-gxq2pbky.js} +2 -2
  14. package/dist/shared/{stacks-rw2xbtdv.js.map → stacks-gxq2pbky.js.map} +1 -1
  15. package/dist/shared/{stacks-jx146qf1.js → stacks-hnqt5rz4.js} +27 -377
  16. package/dist/shared/stacks-hnqt5rz4.js.map +13 -0
  17. package/dist/shared/{stacks-z3vztaz1.js → stacks-jpt52csy.js} +3 -3
  18. package/dist/shared/stacks-jpt52csy.js.map +10 -0
  19. package/dist/shared/{stacks-fse1f76h.js → stacks-rpqtgpyj.js} +42 -8
  20. package/dist/shared/stacks-rpqtgpyj.js.map +10 -0
  21. package/dist/shared/{stacks-g2qnr5qn.cjs → stacks-rryme9bv.cjs} +11 -364
  22. package/dist/shared/stacks-rryme9bv.cjs.map +13 -0
  23. package/dist/shared/{stacks-byyex2zk.cjs → stacks-ta1gar0b.cjs} +7 -2
  24. package/dist/shared/{stacks-byyex2zk.cjs.map → stacks-ta1gar0b.cjs.map} +2 -2
  25. package/dist/shared/stacks-tdsp5gsb.cjs.map +2 -2
  26. package/dist/shared/stacks-vea7nde7.cjs +731 -0
  27. package/dist/shared/stacks-vea7nde7.cjs.map +13 -0
  28. package/dist/shared/stacks-w23294am.js +760 -0
  29. package/dist/shared/stacks-w23294am.js.map +13 -0
  30. package/dist/shared/{stacks-zwgsbbb2.cjs → stacks-y4f7fm03.cjs} +7 -13
  31. package/dist/shared/{stacks-zwgsbbb2.cjs.map → stacks-y4f7fm03.cjs.map} +5 -5
  32. package/dist/src/accounts/index.d.cts +1 -1
  33. package/dist/src/accounts/index.d.ts +1 -1
  34. package/dist/src/actions/index.d.cts +15 -11
  35. package/dist/src/actions/index.d.ts +15 -11
  36. package/dist/src/actions/index.js +7 -6
  37. package/dist/src/actions/index.js.map +1 -1
  38. package/dist/src/bitcoin/index.d.cts +29 -29
  39. package/dist/src/bitcoin/index.d.ts +29 -29
  40. package/dist/src/bitcoin/index.js +3 -2
  41. package/dist/src/bitcoin/index.js.map +2 -2
  42. package/dist/src/bns/index.d.cts +1 -1
  43. package/dist/src/bns/index.d.ts +1 -1
  44. package/dist/src/bns/index.js +8 -6
  45. package/dist/src/bns/index.js.map +2 -2
  46. package/dist/src/clarity/index.d.cts +37 -1
  47. package/dist/src/clarity/index.d.ts +37 -1
  48. package/dist/src/clarity/index.js +14 -2
  49. package/dist/src/clarity/index.js.map +1 -1
  50. package/dist/src/index.cjs.map +2 -2
  51. package/dist/src/index.d.cts +18 -14
  52. package/dist/src/index.d.ts +18 -14
  53. package/dist/src/index.js +6 -5
  54. package/dist/src/index.js.map +3 -3
  55. package/dist/src/postconditions/index.d.cts +66 -3
  56. package/dist/src/postconditions/index.d.ts +66 -3
  57. package/dist/src/postconditions/index.js +13 -2
  58. package/dist/src/postconditions/index.js.map +1 -1
  59. package/dist/src/pox/index.d.cts +1 -1
  60. package/dist/src/pox/index.d.ts +1 -1
  61. package/dist/src/pox/index.js +6 -5
  62. package/dist/src/pox/index.js.map +2 -2
  63. package/dist/src/pox5/index.cjs +213 -14
  64. package/dist/src/pox5/index.cjs.map +8 -7
  65. package/dist/src/pox5/index.d.cts +88 -5
  66. package/dist/src/pox5/index.d.ts +88 -5
  67. package/dist/src/pox5/index.js +220 -17
  68. package/dist/src/pox5/index.js.map +8 -7
  69. package/dist/src/sbtc/index.d.cts +1 -1
  70. package/dist/src/sbtc/index.d.ts +1 -1
  71. package/dist/src/sbtc/index.js +5 -4
  72. package/dist/src/sbtc/index.js.map +2 -2
  73. package/dist/src/stackingdao/index.d.cts +1 -1
  74. package/dist/src/stackingdao/index.d.ts +1 -1
  75. package/dist/src/stackingdao/index.js +6 -5
  76. package/dist/src/stackingdao/index.js.map +2 -2
  77. package/dist/src/subscriptions/index.d.cts +1 -1
  78. package/dist/src/subscriptions/index.d.ts +1 -1
  79. package/dist/src/tools/index.cjs +494 -367
  80. package/dist/src/tools/index.cjs.map +11 -9
  81. package/dist/src/tools/index.d.cts +1 -1
  82. package/dist/src/tools/index.d.ts +1 -1
  83. package/dist/src/tools/index.js +494 -367
  84. package/dist/src/tools/index.js.map +11 -9
  85. package/dist/src/transactions/index.cjs +3 -1
  86. package/dist/src/transactions/index.cjs.map +1 -1
  87. package/dist/src/transactions/index.d.cts +16 -9
  88. package/dist/src/transactions/index.d.ts +16 -9
  89. package/dist/src/transactions/index.js +31 -27
  90. package/dist/src/transactions/index.js.map +1 -1
  91. package/package.json +2 -2
  92. package/dist/shared/stacks-dr5en54r.cjs.map +0 -10
  93. package/dist/shared/stacks-fse1f76h.js.map +0 -10
  94. package/dist/shared/stacks-g2qnr5qn.cjs.map +0 -15
  95. package/dist/shared/stacks-gkf9tsws.js +0 -285
  96. package/dist/shared/stacks-gkf9tsws.js.map +0 -10
  97. package/dist/shared/stacks-jx146qf1.js.map +0 -15
  98. package/dist/shared/stacks-qjgh6pqr.cjs +0 -258
  99. package/dist/shared/stacks-qjgh6pqr.cjs.map +0 -10
  100. package/dist/shared/stacks-z3vztaz1.js.map +0 -10
@@ -0,0 +1,13 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/transactions/types.ts", "../src/transactions/wire/serialize.ts", "../src/transactions/wire/deserialize.ts", "../src/postconditions/convert.ts"],
4
+ "sourcesContent": [
5
+ "import type { ClarityValue } from \"../clarity/types.ts\";\n\n// Auth types\nexport const AuthType = {\n\tStandard: 0x04,\n\tSponsored: 0x05,\n} as const;\nexport type AuthType = (typeof AuthType)[keyof typeof AuthType];\n\n// Payload types\nexport const PayloadType = {\n\tTokenTransfer: 0x00,\n\tSmartContract: 0x01,\n\tContractCall: 0x02,\n\tPoisonMicroblock: 0x03,\n\tCoinbase: 0x04,\n\tCoinbaseToAltRecipient: 0x05,\n\tVersionedSmartContract: 0x06,\n\tTenureChange: 0x07,\n\tNakamotoCoinbase: 0x08,\n} as const;\nexport type PayloadType = (typeof PayloadType)[keyof typeof PayloadType];\n\n// Clarity version\nexport const ClarityVersion = {\n\tClarity1: 1,\n\tClarity2: 2,\n\tClarity3: 3,\n\tClarity4: 4,\n\tClarity5: 5,\n\tClarity6: 6, // SIP-044, Epoch 4.0\n} as const;\nexport type ClarityVersion =\n\t(typeof ClarityVersion)[keyof typeof ClarityVersion];\n\n// Anchor mode (deprecated post-Nakamoto, but needed for wire format)\nexport const AnchorMode = {\n\tOnChainOnly: 0x01,\n\tOffChainOnly: 0x02,\n\tAny: 0x03,\n} as const;\nexport type AnchorMode = (typeof AnchorMode)[keyof typeof AnchorMode];\n\n// Post condition mode\nexport const PostConditionModeWire = {\n\tAllow: 0x01,\n\tDeny: 0x02,\n\tOriginator: 0x03, // SIP-040, Epoch 3.4\n} as const;\nexport type PostConditionModeWire =\n\t(typeof PostConditionModeWire)[keyof typeof PostConditionModeWire];\n\n// Address hash modes\nexport const AddressHashMode = {\n\tP2PKH: 0x00,\n\tP2SH: 0x01,\n\tP2WPKH: 0x02,\n\tP2WSH: 0x03,\n\tP2SH_NonSequential: 0x05, // SIP-027\n\tP2WSH_P2SH_NonSequential: 0x07, // SIP-027\n} as const;\nexport type AddressHashMode =\n\t(typeof AddressHashMode)[keyof typeof AddressHashMode];\n\n// Pub key encoding\nexport const PubKeyEncoding = {\n\tCompressed: 0x00,\n\tUncompressed: 0x01,\n} as const;\nexport type PubKeyEncoding =\n\t(typeof PubKeyEncoding)[keyof typeof PubKeyEncoding];\n\n// Fungible condition codes (wire format)\nexport const FungibleConditionCode = {\n\tEqual: 0x01,\n\tGreater: 0x02,\n\tGreaterEqual: 0x03,\n\tLess: 0x04,\n\tLessEqual: 0x05,\n} as const;\n\n// Non-fungible condition codes (wire format)\nexport const NonFungibleConditionCode = {\n\tSends: 0x10,\n\tDoesNotSend: 0x11,\n\tMaybeSent: 0x12, // SIP-040, Epoch 3.4\n} as const;\n\n// PoX condition codes (wire format, SIP-045)\nexport const PoxConditionCode = {\n\tWillNotPerform: 0x30,\n\tMayPerform: 0x31,\n\tWillPerform: 0x32,\n} as const;\nexport type PoxConditionCode =\n\t(typeof PoxConditionCode)[keyof typeof PoxConditionCode];\n\n// Post condition principal types\nexport const PostConditionPrincipalId = {\n\tOrigin: 0x01,\n\tStandard: 0x02,\n\tContract: 0x03,\n} as const;\n\n// Post condition asset types\nexport const AssetType = {\n\tSTX: 0x00,\n\tFungible: 0x01,\n\tNonFungible: 0x02,\n\tStaking: 0x03, // SIP-045\n\tPox: 0x04, // SIP-045\n} as const;\n\n// Auth field types\nexport const AuthFieldType = {\n\tPublicKeyCompressed: 0x00,\n\tPublicKeyUncompressed: 0x01,\n\tSignatureCompressed: 0x02,\n\tSignatureUncompressed: 0x03,\n} as const;\n\nexport const RECOVERABLE_ECDSA_SIG_LENGTH_BYTES = 65;\nexport const MEMO_MAX_LENGTH_BYTES = 34;\nexport const MAX_STRING_LENGTH_BYTES = 128;\nexport const COINBASE_BYTES_LENGTH = 32;\nexport const VRF_PROOF_BYTES_LENGTH = 80;\nexport const MICROBLOCK_HEADER_BYTES_LENGTH = 132; // 1 + 2 + 32 + 32 + 65\n\n// Tenure change cause\nexport const TenureChangeCause = {\n\tBlockFound: 0x00,\n\tExtended: 0x01,\n\tExtendedRuntime: 0x02,\n\tExtendedReadCount: 0x03,\n\tExtendedReadLength: 0x04,\n\tExtendedWriteCount: 0x05,\n\tExtendedWriteLength: 0x06,\n} as const;\nexport type TenureChangeCause =\n\t(typeof TenureChangeCause)[keyof typeof TenureChangeCause];\n\n// Token transfer payload\nexport type TokenTransferPayload = {\n\tpayloadType: typeof PayloadType.TokenTransfer;\n\trecipient: ClarityValue; // PrincipalCV\n\tamount: bigint;\n\tmemo: string;\n};\n\n// Contract call payload\nexport type ContractCallPayload = {\n\tpayloadType: typeof PayloadType.ContractCall;\n\tcontractAddress: string;\n\tcontractName: string;\n\tfunctionName: string;\n\tfunctionArgs: ClarityValue[];\n};\n\n// Smart contract deploy payload\nexport type SmartContractPayload = {\n\tpayloadType:\n\t\t| typeof PayloadType.SmartContract\n\t\t| typeof PayloadType.VersionedSmartContract;\n\tclarityVersion?: ClarityVersion;\n\tcontractName: string;\n\tcodeBody: string;\n};\n\n// Coinbase payload (appears in every pre-Nakamoto block)\nexport type CoinbasePayload = {\n\tpayloadType: typeof PayloadType.Coinbase;\n\tcoinbaseBuffer: string; // 32 bytes hex\n};\n\n// Coinbase to alt recipient payload\nexport type CoinbaseToAltRecipientPayload = {\n\tpayloadType: typeof PayloadType.CoinbaseToAltRecipient;\n\tcoinbaseBuffer: string; // 32 bytes hex\n\trecipient: ClarityValue; // PrincipalCV\n};\n\n// Poison microblock payload\nexport type PoisonMicroblockPayload = {\n\tpayloadType: typeof PayloadType.PoisonMicroblock;\n\theader1: string; // 132 bytes hex (raw microblock header)\n\theader2: string; // 132 bytes hex (raw microblock header)\n};\n\n// Tenure change payload (Nakamoto)\nexport type TenureChangePayload = {\n\tpayloadType: typeof PayloadType.TenureChange;\n\ttenureConsensusHash: string; // 20 bytes hex\n\tprevTenureConsensusHash: string; // 20 bytes hex\n\tburnViewConsensusHash: string; // 20 bytes hex\n\tpreviousTenureEnd: string; // 32 bytes hex\n\tpreviousTenureBlocks: number; // u32\n\tcause: TenureChangeCause;\n\tpubkeyHash: string; // 20 bytes hex\n};\n\n// Nakamoto coinbase payload\nexport type NakamotoCoinbasePayload = {\n\tpayloadType: typeof PayloadType.NakamotoCoinbase;\n\tcoinbaseBuffer: string; // 32 bytes hex\n\trecipient: ClarityValue | null; // Optional PrincipalCV\n\tvrfProof: string; // 80 bytes hex\n};\n\nexport type TransactionPayload =\n\t| TokenTransferPayload\n\t| ContractCallPayload\n\t| SmartContractPayload\n\t| CoinbasePayload\n\t| CoinbaseToAltRecipientPayload\n\t| PoisonMicroblockPayload\n\t| TenureChangePayload\n\t| NakamotoCoinbasePayload;\n\n// Spending condition\nexport type SingleSigSpendingCondition = {\n\thashMode: typeof AddressHashMode.P2PKH | typeof AddressHashMode.P2WPKH;\n\tsigner: string; // hash160 hex\n\tnonce: bigint;\n\tfee: bigint;\n\tkeyEncoding: PubKeyEncoding;\n\tsignature: string; // 65-byte recoverable sig hex\n};\n\nexport type TransactionAuthField = {\n\tpubKeyEncoding: PubKeyEncoding;\n\ttype: \"publicKey\" | \"signature\";\n\tdata: string; // hex\n};\n\nexport type MultiSigHashMode =\n\t| typeof AddressHashMode.P2SH\n\t| typeof AddressHashMode.P2WSH\n\t| typeof AddressHashMode.P2SH_NonSequential\n\t| typeof AddressHashMode.P2WSH_P2SH_NonSequential;\n\nexport type MultiSigSpendingCondition = {\n\thashMode: MultiSigHashMode;\n\tsigner: string;\n\tnonce: bigint;\n\tfee: bigint;\n\tfields: TransactionAuthField[];\n\tsignaturesRequired: number;\n};\n\nexport type SpendingCondition =\n\t| SingleSigSpendingCondition\n\t| MultiSigSpendingCondition;\n\nexport type StandardAuthorization = {\n\tauthType: typeof AuthType.Standard;\n\tspendingCondition: SpendingCondition;\n};\n\nexport type SponsoredAuthorization = {\n\tauthType: typeof AuthType.Sponsored;\n\tspendingCondition: SpendingCondition;\n\tsponsorSpendingCondition: SpendingCondition;\n};\n\nexport type Authorization = StandardAuthorization | SponsoredAuthorization;\n\n// Full transaction\nexport type StacksTransaction = {\n\tversion: number;\n\tchainId: number;\n\tauth: Authorization;\n\tanchorMode: AnchorMode;\n\tpostConditionMode: PostConditionModeWire;\n\tpostConditions: PostConditionWire[];\n\tpayload: TransactionPayload;\n\t/** Multi-sig signer metadata — not part of the wire format, preserved\n\t * through serialize/deserialize round-trip for auto-detection. */\n\t_multisig?: { publicKeys: string[] };\n};\n\n// Wire post condition types\nexport type PostConditionWire =\n\t| StxPostConditionWire\n\t| FtPostConditionWire\n\t| NftPostConditionWire\n\t| StakingPostConditionWire\n\t| PoxPostConditionWire;\n\nexport type StxPostConditionWire = {\n\ttype: \"stx\";\n\tprincipal: PostConditionPrincipalWire;\n\tconditionCode: number;\n\tamount: bigint;\n};\n\nexport type FtPostConditionWire = {\n\ttype: \"ft\";\n\tprincipal: PostConditionPrincipalWire;\n\tasset: AssetInfoWire;\n\tconditionCode: number;\n\tamount: bigint;\n};\n\nexport type NftPostConditionWire = {\n\ttype: \"nft\";\n\tprincipal: PostConditionPrincipalWire;\n\tasset: AssetInfoWire;\n\tconditionCode: number;\n\tassetId: ClarityValue;\n};\n\n// SIP-045: gates stake/register-for-bond/stake-update; same shape as STX\nexport type StakingPostConditionWire = {\n\ttype: \"staking\";\n\tprincipal: PostConditionPrincipalWire;\n\tconditionCode: number;\n\tamount: bigint;\n};\n\n// SIP-045: gates non-locking PoX state changes (unstake, announce-l1-early-exit, …); no amount\nexport type PoxPostConditionWire = {\n\ttype: \"pox\";\n\tprincipal: PostConditionPrincipalWire;\n\tconditionCode: PoxConditionCode;\n};\n\nexport type PostConditionPrincipalWire =\n\t| { type: \"origin\" }\n\t| { type: \"standard\"; address: string }\n\t| { type: \"contract\"; address: string; contractName: string };\n\nexport type AssetInfoWire = {\n\taddress: string;\n\tcontractName: string;\n\tassetName: string;\n};\n",
6
+ "import { serializeCVBytes } from \"../../clarity/serialize.ts\";\nimport { c32addressDecode } from \"../../utils/c32.ts\";\nimport {\n\tasciiToBytes,\n\tbytesToHex,\n\tconcatBytes,\n\thexToBytes,\n\tintToBytes,\n\tintToHex,\n\tutf8ToBytes,\n\twriteUInt8,\n\twriteUInt16BE,\n\twriteUInt32BE,\n} from \"../../utils/encoding.ts\";\nimport {\n\ttype AssetInfoWire,\n\tAssetType,\n\tAuthType,\n\ttype Authorization,\n\ttype CoinbasePayload,\n\ttype CoinbaseToAltRecipientPayload,\n\tMEMO_MAX_LENGTH_BYTES,\n\ttype MultiSigSpendingCondition,\n\ttype NakamotoCoinbasePayload,\n\tPayloadType,\n\ttype PoisonMicroblockPayload,\n\tPostConditionPrincipalId,\n\ttype PostConditionPrincipalWire,\n\ttype PostConditionWire,\n\ttype SingleSigSpendingCondition,\n\ttype SpendingCondition,\n\ttype StacksTransaction,\n\ttype TenureChangePayload as TenureChangePayloadType,\n\ttype TransactionAuthField,\n\ttype TransactionPayload,\n} from \"../types.ts\";\n\n// Address serialization: version (1 byte) + hash160 (20 bytes)\nfunction serializeAddress(c32Address: string): Uint8Array {\n\tconst [version, hash160] = c32addressDecode(c32Address);\n\treturn concatBytes(new Uint8Array([version]), hexToBytes(hash160));\n}\n\n// LP string: length prefix (n bytes) + content bytes\nfunction serializeLPString(str: string, prefixBytes = 1): Uint8Array {\n\tconst content = utf8ToBytes(str);\n\tconst prefix = hexToBytes(intToHex(content.byteLength, prefixBytes));\n\treturn concatBytes(prefix, content);\n}\n\n// LP string for code body (4-byte prefix)\nfunction serializeLPStringLong(str: string): Uint8Array {\n\treturn serializeLPString(str, 4);\n}\n\n// Memo: flat 34-byte field (no length prefix) per SIP-005\nfunction serializeMemo(memo: string): Uint8Array {\n\tconst content = asciiToBytes(memo);\n\tconst padded = new Uint8Array(MEMO_MAX_LENGTH_BYTES);\n\tpadded.set(content.slice(0, MEMO_MAX_LENGTH_BYTES));\n\treturn padded;\n}\n\nfunction serializeSpendingCondition(condition: SpendingCondition): Uint8Array {\n\tconst parts: Uint8Array[] = [\n\t\twriteUInt8(condition.hashMode),\n\t\thexToBytes(condition.signer), // 20 bytes\n\t\tintToBytes(condition.nonce, 8),\n\t\tintToBytes(condition.fee, 8),\n\t];\n\n\tif (\"signature\" in condition) {\n\t\t// Single sig\n\t\tconst sc = condition as SingleSigSpendingCondition;\n\t\tparts.push(writeUInt8(sc.keyEncoding));\n\t\tparts.push(hexToBytes(sc.signature)); // 65 bytes\n\t} else {\n\t\t// Multi sig\n\t\tconst mc = condition as MultiSigSpendingCondition;\n\t\t// Fields as LP list\n\t\tparts.push(writeUInt32BE(mc.fields.length));\n\t\tfor (const field of mc.fields) {\n\t\t\tparts.push(serializeAuthField(field));\n\t\t}\n\t\tparts.push(writeUInt16BE(mc.signaturesRequired));\n\t}\n\n\treturn concatBytes(...parts);\n}\n\nfunction serializeAuthField(field: TransactionAuthField): Uint8Array {\n\tif (field.type === \"publicKey\") {\n\t\tconst typeId = field.pubKeyEncoding === 0x00 ? 0x00 : 0x01;\n\t\treturn concatBytes(writeUInt8(typeId), hexToBytes(field.data));\n\t}\n\tconst typeId = field.pubKeyEncoding === 0x00 ? 0x02 : 0x03;\n\treturn concatBytes(writeUInt8(typeId), hexToBytes(field.data));\n}\n\nfunction serializeAuthorization(auth: Authorization): Uint8Array {\n\tconst parts: Uint8Array[] = [writeUInt8(auth.authType)];\n\tparts.push(serializeSpendingCondition(auth.spendingCondition));\n\tif (auth.authType === AuthType.Sponsored) {\n\t\tparts.push(serializeSpendingCondition(auth.sponsorSpendingCondition));\n\t}\n\treturn concatBytes(...parts);\n}\n\nfunction serializePrincipal(principal: PostConditionPrincipalWire): Uint8Array {\n\tswitch (principal.type) {\n\t\tcase \"origin\":\n\t\t\treturn writeUInt8(PostConditionPrincipalId.Origin);\n\t\tcase \"standard\":\n\t\t\treturn concatBytes(\n\t\t\t\twriteUInt8(PostConditionPrincipalId.Standard),\n\t\t\t\tserializeAddress(principal.address),\n\t\t\t);\n\t\tcase \"contract\":\n\t\t\treturn concatBytes(\n\t\t\t\twriteUInt8(PostConditionPrincipalId.Contract),\n\t\t\t\tserializeAddress(principal.address),\n\t\t\t\tserializeLPString(principal.contractName),\n\t\t\t);\n\t}\n}\n\nfunction serializeAssetInfo(asset: AssetInfoWire): Uint8Array {\n\treturn concatBytes(\n\t\tserializeAddress(asset.address),\n\t\tserializeLPString(asset.contractName),\n\t\tserializeLPString(asset.assetName),\n\t);\n}\n\nexport function serializePostConditionWire(pc: PostConditionWire): Uint8Array {\n\t// Wire order: asset_type first, then principal (per SIP-005)\n\tconst parts: Uint8Array[] = [];\n\n\tswitch (pc.type) {\n\t\tcase \"stx\":\n\t\t\tparts.push(writeUInt8(AssetType.STX));\n\t\t\tparts.push(serializePrincipal(pc.principal));\n\t\t\tparts.push(writeUInt8(pc.conditionCode));\n\t\t\tparts.push(intToBytes(pc.amount, 8));\n\t\t\tbreak;\n\t\tcase \"ft\":\n\t\t\tparts.push(writeUInt8(AssetType.Fungible));\n\t\t\tparts.push(serializePrincipal(pc.principal));\n\t\t\tparts.push(serializeAssetInfo(pc.asset));\n\t\t\tparts.push(writeUInt8(pc.conditionCode));\n\t\t\tparts.push(intToBytes(pc.amount, 8));\n\t\t\tbreak;\n\t\tcase \"nft\":\n\t\t\tparts.push(writeUInt8(AssetType.NonFungible));\n\t\t\tparts.push(serializePrincipal(pc.principal));\n\t\t\tparts.push(serializeAssetInfo(pc.asset));\n\t\t\tparts.push(serializeCVBytes(pc.assetId));\n\t\t\tparts.push(writeUInt8(pc.conditionCode));\n\t\t\tbreak;\n\t\tcase \"staking\":\n\t\t\t// SIP-045: same body as STX (fungible condition code + amount)\n\t\t\tparts.push(writeUInt8(AssetType.Staking));\n\t\t\tparts.push(serializePrincipal(pc.principal));\n\t\t\tparts.push(writeUInt8(pc.conditionCode));\n\t\t\tparts.push(intToBytes(pc.amount, 8));\n\t\t\tbreak;\n\t\tcase \"pox\":\n\t\t\t// SIP-045: PoX condition code only, no amount\n\t\t\tparts.push(writeUInt8(AssetType.Pox));\n\t\t\tparts.push(serializePrincipal(pc.principal));\n\t\t\tparts.push(writeUInt8(pc.conditionCode));\n\t\t\tbreak;\n\t}\n\n\treturn concatBytes(...parts);\n}\n\nfunction serializePostConditions(pcs: PostConditionWire[]): Uint8Array {\n\tconst parts: Uint8Array[] = [writeUInt32BE(pcs.length)];\n\tfor (const pc of pcs) parts.push(serializePostConditionWire(pc));\n\treturn concatBytes(...parts);\n}\n\nexport function serializePayload(payload: TransactionPayload): Uint8Array {\n\tconst parts: Uint8Array[] = [writeUInt8(payload.payloadType)];\n\n\tswitch (payload.payloadType) {\n\t\tcase PayloadType.TokenTransfer:\n\t\t\tparts.push(serializeCVBytes(payload.recipient));\n\t\t\tparts.push(intToBytes(payload.amount, 8));\n\t\t\tparts.push(serializeMemo(payload.memo));\n\t\t\tbreak;\n\n\t\tcase PayloadType.ContractCall:\n\t\t\tparts.push(serializeAddress(payload.contractAddress));\n\t\t\tparts.push(serializeLPString(payload.contractName));\n\t\t\tparts.push(serializeLPString(payload.functionName));\n\t\t\tparts.push(writeUInt32BE(payload.functionArgs.length));\n\t\t\tfor (const arg of payload.functionArgs) {\n\t\t\t\tparts.push(serializeCVBytes(arg));\n\t\t\t}\n\t\t\tbreak;\n\n\t\tcase PayloadType.SmartContract:\n\t\t\tparts.push(serializeLPString(payload.contractName));\n\t\t\tparts.push(serializeLPStringLong(payload.codeBody));\n\t\t\tbreak;\n\n\t\tcase PayloadType.VersionedSmartContract:\n\t\t\tparts.push(writeUInt8(payload.clarityVersion ?? 2));\n\t\t\tparts.push(serializeLPString(payload.contractName));\n\t\t\tparts.push(serializeLPStringLong(payload.codeBody));\n\t\t\tbreak;\n\n\t\tcase PayloadType.Coinbase:\n\t\t\tparts.push(hexToBytes((payload as CoinbasePayload).coinbaseBuffer));\n\t\t\tbreak;\n\n\t\tcase PayloadType.CoinbaseToAltRecipient: {\n\t\t\tconst cbAlt = payload as CoinbaseToAltRecipientPayload;\n\t\t\tparts.push(hexToBytes(cbAlt.coinbaseBuffer));\n\t\t\tparts.push(serializeCVBytes(cbAlt.recipient));\n\t\t\tbreak;\n\t\t}\n\n\t\tcase PayloadType.PoisonMicroblock: {\n\t\t\tconst pm = payload as PoisonMicroblockPayload;\n\t\t\tparts.push(hexToBytes(pm.header1));\n\t\t\tparts.push(hexToBytes(pm.header2));\n\t\t\tbreak;\n\t\t}\n\n\t\tcase PayloadType.TenureChange: {\n\t\t\tconst tc = payload as TenureChangePayloadType;\n\t\t\tparts.push(hexToBytes(tc.tenureConsensusHash));\n\t\t\tparts.push(hexToBytes(tc.prevTenureConsensusHash));\n\t\t\tparts.push(hexToBytes(tc.burnViewConsensusHash));\n\t\t\tparts.push(hexToBytes(tc.previousTenureEnd));\n\t\t\tparts.push(writeUInt32BE(tc.previousTenureBlocks));\n\t\t\tparts.push(writeUInt8(tc.cause));\n\t\t\tparts.push(hexToBytes(tc.pubkeyHash));\n\t\t\tbreak;\n\t\t}\n\n\t\tcase PayloadType.NakamotoCoinbase: {\n\t\t\tconst nc = payload as NakamotoCoinbasePayload;\n\t\t\tparts.push(hexToBytes(nc.coinbaseBuffer));\n\t\t\tif (nc.recipient) {\n\t\t\t\tparts.push(serializeCVBytes({ type: \"some\", value: nc.recipient }));\n\t\t\t} else {\n\t\t\t\tparts.push(serializeCVBytes({ type: \"none\" }));\n\t\t\t}\n\t\t\tparts.push(hexToBytes(nc.vrfProof));\n\t\t\tbreak;\n\t\t}\n\t}\n\n\treturn concatBytes(...parts);\n}\n\n// Memoization cache: transactions are immutable in practice (fields are set\n// once during build/signing), so the serialized bytes for a given transaction\n// object never change. The signing flow serializes the same object several\n// times (txid, sighash, sponsor sighash); caching avoids that redundant work.\n// Any in-place mutation MUST call clearTxCache — see setUnsignedFee.\nconst _txCache = new WeakMap<StacksTransaction, Uint8Array>();\n\n/** Invalidate the memoized serialization of a mutated transaction */\nexport function clearTxCache(tx: StacksTransaction): void {\n\t_txCache.delete(tx);\n}\n\nexport function serializeTransaction(tx: StacksTransaction): Uint8Array {\n\tconst cached = _txCache.get(tx);\n\tif (cached) return cached;\n\tconst bytes = concatBytes(\n\t\twriteUInt8(tx.version),\n\t\twriteUInt32BE(tx.chainId),\n\t\tserializeAuthorization(tx.auth),\n\t\twriteUInt8(tx.anchorMode),\n\t\twriteUInt8(tx.postConditionMode),\n\t\tserializePostConditions(tx.postConditions),\n\t\tserializePayload(tx.payload),\n\t);\n\t_txCache.set(tx, bytes);\n\treturn bytes;\n}\n\nexport function serializeTransactionHex(tx: StacksTransaction): string {\n\treturn bytesToHex(serializeTransaction(tx));\n}\n\n/** Serialize a transaction, returning the wire bytes plus the out-of-band\n * `_multisig` metadata so callers can preserve it across a round-trip\n * (the wire format itself does not carry it). */\nexport function serializeTransactionWithMeta(tx: StacksTransaction): {\n\tbytes: Uint8Array;\n\t_multisig?: { publicKeys: string[] };\n} {\n\treturn { bytes: serializeTransaction(tx), _multisig: tx._multisig };\n}\n",
7
+ "import {\n\treadAddress,\n\treadCV,\n\treadLPString,\n} from \"../../clarity/deserialize.ts\";\nimport type { ClarityValue } from \"../../clarity/types.ts\";\nimport { BytesReader } from \"../../utils/bytes-reader.ts\";\nimport {\n\tbytesToAscii,\n\tbytesToHex,\n\thexToBytes,\n\twithout0x,\n} from \"../../utils/encoding.ts\";\nimport {\n\tAddressHashMode,\n\ttype AnchorMode,\n\ttype AssetInfoWire,\n\tAssetType,\n\tAuthType,\n\ttype Authorization,\n\tCOINBASE_BYTES_LENGTH,\n\ttype ClarityVersion,\n\tMEMO_MAX_LENGTH_BYTES,\n\tMICROBLOCK_HEADER_BYTES_LENGTH,\n\tPayloadType,\n\ttype PostConditionModeWire,\n\tPostConditionPrincipalId,\n\ttype PostConditionPrincipalWire,\n\ttype PostConditionWire,\n\ttype PoxConditionCode,\n\tRECOVERABLE_ECDSA_SIG_LENGTH_BYTES,\n\ttype SpendingCondition,\n\ttype StacksTransaction,\n\ttype TenureChangeCause,\n\ttype TransactionAuthField,\n\ttype TransactionPayload,\n\tVRF_PROOF_BYTES_LENGTH,\n} from \"../types.ts\";\n\nfunction readSpendingCondition(r: BytesReader): SpendingCondition {\n\tconst hashMode = r.readUInt8();\n\tconst signer = bytesToHex(r.readBytes(20));\n\tconst nonce = r.readBigUInt64BE();\n\tconst fee = r.readBigUInt64BE();\n\n\tif (\n\t\thashMode === AddressHashMode.P2PKH ||\n\t\thashMode === AddressHashMode.P2WPKH\n\t) {\n\t\tconst keyEncoding = r.readUInt8();\n\t\tconst signature = bytesToHex(\n\t\t\tr.readBytes(RECOVERABLE_ECDSA_SIG_LENGTH_BYTES),\n\t\t);\n\t\treturn {\n\t\t\thashMode,\n\t\t\tsigner,\n\t\t\tnonce,\n\t\t\tfee,\n\t\t\tkeyEncoding,\n\t\t\tsignature,\n\t\t} as SpendingCondition;\n\t}\n\n\tconst fieldCount = r.readUInt32BE();\n\tconst fields: TransactionAuthField[] = [];\n\tfor (let i = 0; i < fieldCount; i++) {\n\t\tconst fieldType = r.readUInt8();\n\t\tif (fieldType <= 0x01) {\n\t\t\tconst keyLen = fieldType === 0x00 ? 33 : 65;\n\t\t\tfields.push({\n\t\t\t\ttype: \"publicKey\",\n\t\t\t\tpubKeyEncoding: fieldType as 0x00 | 0x01,\n\t\t\t\tdata: bytesToHex(r.readBytes(keyLen)),\n\t\t\t});\n\t\t} else {\n\t\t\tfields.push({\n\t\t\t\ttype: \"signature\",\n\t\t\t\tpubKeyEncoding: (fieldType === 0x02 ? 0x00 : 0x01) as 0x00 | 0x01,\n\t\t\t\tdata: bytesToHex(r.readBytes(RECOVERABLE_ECDSA_SIG_LENGTH_BYTES)),\n\t\t\t});\n\t\t}\n\t}\n\tconst signaturesRequired = r.readUInt16BE();\n\n\treturn {\n\t\thashMode,\n\t\tsigner,\n\t\tnonce,\n\t\tfee,\n\t\tfields,\n\t\tsignaturesRequired,\n\t} as SpendingCondition;\n}\n\nfunction readAuthorization(r: BytesReader): Authorization {\n\tconst authType = r.readUInt8();\n\tconst spendingCondition = readSpendingCondition(r);\n\n\tif (authType === AuthType.Standard) {\n\t\treturn { authType: AuthType.Standard, spendingCondition };\n\t}\n\n\tconst sponsorSpendingCondition = readSpendingCondition(r);\n\treturn {\n\t\tauthType: AuthType.Sponsored,\n\t\tspendingCondition,\n\t\tsponsorSpendingCondition,\n\t};\n}\n\nfunction readAssetInfo(r: BytesReader): AssetInfoWire {\n\treturn {\n\t\taddress: readAddress(r),\n\t\tcontractName: readLPString(r),\n\t\tassetName: readLPString(r),\n\t};\n}\n\nfunction readPostConditionPrincipal(\n\tr: BytesReader,\n): PostConditionPrincipalWire {\n\tconst type = r.readUInt8();\n\tswitch (type) {\n\t\tcase PostConditionPrincipalId.Origin:\n\t\t\treturn { type: \"origin\" };\n\t\tcase PostConditionPrincipalId.Standard:\n\t\t\treturn { type: \"standard\", address: readAddress(r) };\n\t\tcase PostConditionPrincipalId.Contract:\n\t\t\treturn {\n\t\t\t\ttype: \"contract\",\n\t\t\t\taddress: readAddress(r),\n\t\t\t\tcontractName: readLPString(r),\n\t\t\t};\n\t\tdefault:\n\t\t\t// Some legacy transactions may have unexpected principal types.\n\t\t\t// Treat as origin to allow deserialization to continue.\n\t\t\treturn { type: \"origin\" };\n\t}\n}\n\nfunction readPostCondition(r: BytesReader): PostConditionWire {\n\t// Wire order: asset_type, then principal (per SIP-005 and stacks.js)\n\tconst assetType = r.readUInt8();\n\tconst principal = readPostConditionPrincipal(r);\n\tswitch (assetType) {\n\t\tcase AssetType.STX:\n\t\t\treturn {\n\t\t\t\ttype: \"stx\",\n\t\t\t\tprincipal,\n\t\t\t\tconditionCode: r.readUInt8(),\n\t\t\t\tamount: r.readBigUInt64BE(),\n\t\t\t};\n\t\tcase AssetType.Fungible:\n\t\t\treturn {\n\t\t\t\ttype: \"ft\",\n\t\t\t\tprincipal,\n\t\t\t\tasset: readAssetInfo(r),\n\t\t\t\tconditionCode: r.readUInt8(),\n\t\t\t\tamount: r.readBigUInt64BE(),\n\t\t\t};\n\t\tcase AssetType.NonFungible:\n\t\t\treturn {\n\t\t\t\ttype: \"nft\",\n\t\t\t\tprincipal,\n\t\t\t\tasset: readAssetInfo(r),\n\t\t\t\tassetId: readCV(r),\n\t\t\t\tconditionCode: r.readUInt8(),\n\t\t\t};\n\t\tcase AssetType.Staking:\n\t\t\treturn {\n\t\t\t\ttype: \"staking\",\n\t\t\t\tprincipal,\n\t\t\t\tconditionCode: r.readUInt8(),\n\t\t\t\tamount: r.readBigUInt64BE(),\n\t\t\t};\n\t\tcase AssetType.Pox:\n\t\t\treturn {\n\t\t\t\ttype: \"pox\",\n\t\t\t\tprincipal,\n\t\t\t\tconditionCode: r.readUInt8() as PoxConditionCode,\n\t\t\t};\n\t\tdefault:\n\t\t\tthrow new Error(\n\t\t\t\t`Unknown post-condition asset type: 0x${assetType.toString(16).padStart(2, \"0\")}`,\n\t\t\t);\n\t}\n}\n\nfunction readPostConditions(r: BytesReader): PostConditionWire[] {\n\tconst count = r.readUInt32BE();\n\tconst pcs: PostConditionWire[] = [];\n\tfor (let i = 0; i < count; i++) {\n\t\ttry {\n\t\t\tpcs.push(readPostCondition(r));\n\t\t} catch (e) {\n\t\t\tif (\n\t\t\t\te instanceof Error &&\n\t\t\t\te.message.startsWith(\"Unknown post-condition asset type:\")\n\t\t\t) {\n\t\t\t\tthrow new Error(`${e.message} (post-condition ${i + 1}/${count})`);\n\t\t\t}\n\t\t\tthrow e;\n\t\t}\n\t}\n\treturn pcs;\n}\n\nfunction readPayload(r: BytesReader): TransactionPayload {\n\tconst payloadType = r.readUInt8();\n\n\tswitch (payloadType) {\n\t\tcase PayloadType.TokenTransfer: {\n\t\t\tconst recipient = readCV(r);\n\t\t\tconst amount = r.readBigUInt64BE();\n\t\t\t// Memo is a flat 34-byte field (no length prefix) per SIP-005\n\t\t\tconst memoBytes = r.readBytes(MEMO_MAX_LENGTH_BYTES);\n\t\t\tconst memo = bytesToAscii(memoBytes).replace(/\\0+$/, \"\");\n\t\t\treturn {\n\t\t\t\tpayloadType: PayloadType.TokenTransfer,\n\t\t\t\trecipient,\n\t\t\t\tamount,\n\t\t\t\tmemo,\n\t\t\t};\n\t\t}\n\t\tcase PayloadType.ContractCall: {\n\t\t\tconst contractAddress = readAddress(r);\n\t\t\tconst contractName = readLPString(r);\n\t\t\tconst functionName = readLPString(r);\n\t\t\tconst numArgs = r.readUInt32BE();\n\t\t\tconst functionArgs: ClarityValue[] = [];\n\t\t\tfor (let i = 0; i < numArgs; i++) functionArgs.push(readCV(r));\n\t\t\treturn {\n\t\t\t\tpayloadType: PayloadType.ContractCall,\n\t\t\t\tcontractAddress,\n\t\t\t\tcontractName,\n\t\t\t\tfunctionName,\n\t\t\t\tfunctionArgs,\n\t\t\t};\n\t\t}\n\t\tcase PayloadType.SmartContract: {\n\t\t\tconst contractName = readLPString(r);\n\t\t\tconst codeBody = readLPString(r, 4);\n\t\t\treturn { payloadType: PayloadType.SmartContract, contractName, codeBody };\n\t\t}\n\t\tcase PayloadType.VersionedSmartContract: {\n\t\t\tconst clarityVersion = r.readUInt8() as ClarityVersion;\n\t\t\tconst contractName = readLPString(r);\n\t\t\tconst codeBody = readLPString(r, 4);\n\t\t\treturn {\n\t\t\t\tpayloadType: PayloadType.VersionedSmartContract,\n\t\t\t\tclarityVersion,\n\t\t\t\tcontractName,\n\t\t\t\tcodeBody,\n\t\t\t};\n\t\t}\n\t\tcase PayloadType.Coinbase: {\n\t\t\tconst coinbaseBuffer = bytesToHex(r.readBytes(COINBASE_BYTES_LENGTH));\n\t\t\treturn { payloadType: PayloadType.Coinbase, coinbaseBuffer };\n\t\t}\n\t\tcase PayloadType.CoinbaseToAltRecipient: {\n\t\t\tconst coinbaseBuffer = bytesToHex(r.readBytes(COINBASE_BYTES_LENGTH));\n\t\t\tconst recipient = readCV(r);\n\t\t\treturn {\n\t\t\t\tpayloadType: PayloadType.CoinbaseToAltRecipient,\n\t\t\t\tcoinbaseBuffer,\n\t\t\t\trecipient,\n\t\t\t};\n\t\t}\n\t\tcase PayloadType.PoisonMicroblock: {\n\t\t\tconst header1 = bytesToHex(r.readBytes(MICROBLOCK_HEADER_BYTES_LENGTH));\n\t\t\tconst header2 = bytesToHex(r.readBytes(MICROBLOCK_HEADER_BYTES_LENGTH));\n\t\t\treturn { payloadType: PayloadType.PoisonMicroblock, header1, header2 };\n\t\t}\n\t\tcase PayloadType.TenureChange: {\n\t\t\tconst tenureConsensusHash = bytesToHex(r.readBytes(20));\n\t\t\tconst prevTenureConsensusHash = bytesToHex(r.readBytes(20));\n\t\t\tconst burnViewConsensusHash = bytesToHex(r.readBytes(20));\n\t\t\tconst previousTenureEnd = bytesToHex(r.readBytes(32));\n\t\t\tconst previousTenureBlocks = r.readUInt32BE();\n\t\t\tconst cause = r.readUInt8() as TenureChangeCause;\n\t\t\tconst pubkeyHash = bytesToHex(r.readBytes(20));\n\t\t\treturn {\n\t\t\t\tpayloadType: PayloadType.TenureChange,\n\t\t\t\ttenureConsensusHash,\n\t\t\t\tprevTenureConsensusHash,\n\t\t\t\tburnViewConsensusHash,\n\t\t\t\tpreviousTenureEnd,\n\t\t\t\tpreviousTenureBlocks,\n\t\t\t\tcause,\n\t\t\t\tpubkeyHash,\n\t\t\t};\n\t\t}\n\t\tcase PayloadType.NakamotoCoinbase: {\n\t\t\tconst coinbaseBuffer = bytesToHex(r.readBytes(COINBASE_BYTES_LENGTH));\n\t\t\tconst optionalCV = readCV(r);\n\t\t\tconst recipient =\n\t\t\t\toptionalCV.type === \"none\"\n\t\t\t\t\t? null\n\t\t\t\t\t: optionalCV.type === \"some\"\n\t\t\t\t\t\t? optionalCV.value\n\t\t\t\t\t\t: optionalCV;\n\t\t\tconst vrfProof = bytesToHex(r.readBytes(VRF_PROOF_BYTES_LENGTH));\n\t\t\treturn {\n\t\t\t\tpayloadType: PayloadType.NakamotoCoinbase,\n\t\t\t\tcoinbaseBuffer,\n\t\t\t\trecipient,\n\t\t\t\tvrfProof,\n\t\t\t};\n\t\t}\n\t\tdefault:\n\t\t\tthrow new Error(`Unknown payload type: ${payloadType}`);\n\t}\n}\n\nexport function deserializePostConditionWire(\n\tinput: string | Uint8Array,\n): PostConditionWire {\n\tconst bytes =\n\t\ttypeof input === \"string\" ? hexToBytes(without0x(input)) : input;\n\treturn readPostCondition(new BytesReader(bytes));\n}\n\nexport function deserializeTransaction(\n\tinput: string | Uint8Array,\n\tmeta?: { _multisig?: { publicKeys: string[] } },\n): StacksTransaction {\n\tconst bytes =\n\t\ttypeof input === \"string\" ? hexToBytes(without0x(input)) : input;\n\tconst r = new BytesReader(bytes);\n\n\tconst tx: StacksTransaction = {\n\t\tversion: r.readUInt8(),\n\t\tchainId: r.readUInt32BE(),\n\t\tauth: readAuthorization(r),\n\t\tanchorMode: r.readUInt8() as AnchorMode,\n\t\tpostConditionMode: r.readUInt8() as PostConditionModeWire,\n\t\tpostConditions: readPostConditions(r),\n\t\tpayload: readPayload(r),\n\t};\n\tif (meta?._multisig) {\n\t\ttx._multisig = meta._multisig;\n\t}\n\treturn tx;\n}\n",
8
+ "import {\n\tFungibleConditionCode,\n\tNonFungibleConditionCode,\n\ttype PostConditionPrincipalWire,\n\ttype PostConditionWire,\n\tPoxConditionCode,\n} from \"../transactions/types.ts\";\nimport { deserializePostConditionWire } from \"../transactions/wire/deserialize.ts\";\nimport { serializePostConditionWire } from \"../transactions/wire/serialize.ts\";\nimport { parseContractId } from \"../utils/address.ts\";\nimport {\n\ttype IntegerType,\n\tbytesToHex,\n\tintToBigInt,\n} from \"../utils/encoding.ts\";\nimport type {\n\tFungibleComparator,\n\tNonFungibleComparator,\n\tPostCondition,\n\tPoxComparator,\n} from \"./types.ts\";\n\nconst MAX_U64 = 18446744073709551615n; // 2^64 - 1\n\n/** Parse a PC amount; throw if outside the u64 the wire can carry. */\nexport function parsePostConditionAmount(amount: IntegerType): bigint {\n\tconst value = intToBigInt(amount);\n\tif (value < 0n || value > MAX_U64) {\n\t\tthrow new RangeError(\n\t\t\t`Post-condition amount must be between 0 and ${MAX_U64} (u64 max), received: ${value}`,\n\t\t);\n\t}\n\treturn value;\n}\n\nexport const FUNGIBLE_CODE_MAP: Record<FungibleComparator, number> = {\n\teq: FungibleConditionCode.Equal,\n\tgt: FungibleConditionCode.Greater,\n\tgte: FungibleConditionCode.GreaterEqual,\n\tlt: FungibleConditionCode.Less,\n\tlte: FungibleConditionCode.LessEqual,\n};\n\nconst FUNGIBLE_CODE_REVERSE: Record<number, FungibleComparator> = {\n\t[FungibleConditionCode.Equal]: \"eq\",\n\t[FungibleConditionCode.Greater]: \"gt\",\n\t[FungibleConditionCode.GreaterEqual]: \"gte\",\n\t[FungibleConditionCode.Less]: \"lt\",\n\t[FungibleConditionCode.LessEqual]: \"lte\",\n};\n\nexport const NFT_CODE_MAP: Record<NonFungibleComparator, number> = {\n\tsent: NonFungibleConditionCode.Sends,\n\t\"not-sent\": NonFungibleConditionCode.DoesNotSend,\n\t\"maybe-sent\": NonFungibleConditionCode.MaybeSent,\n};\n\nconst NFT_CODE_REVERSE: Record<number, NonFungibleComparator> = {\n\t[NonFungibleConditionCode.Sends]: \"sent\",\n\t[NonFungibleConditionCode.DoesNotSend]: \"not-sent\",\n\t[NonFungibleConditionCode.MaybeSent]: \"maybe-sent\",\n};\n\nexport const POX_CODE_MAP: Record<PoxComparator, PoxConditionCode> = {\n\t\"will-not-perform\": PoxConditionCode.WillNotPerform,\n\t\"may-perform\": PoxConditionCode.MayPerform,\n\t\"will-perform\": PoxConditionCode.WillPerform,\n};\n\nconst POX_CODE_REVERSE: Record<number, PoxComparator> = {\n\t[PoxConditionCode.WillNotPerform]: \"will-not-perform\",\n\t[PoxConditionCode.MayPerform]: \"may-perform\",\n\t[PoxConditionCode.WillPerform]: \"will-perform\",\n};\n\nexport function resolvePrincipal(address: string): PostConditionPrincipalWire {\n\tif (address === \"origin\") return { type: \"origin\" };\n\tconst [addr, name] = address.split(\".\");\n\tif (name) {\n\t\t// biome-ignore lint/style/noNonNullAssertion: split yields address when name is present\n\t\treturn { type: \"contract\", address: addr!, contractName: name };\n\t}\n\t// biome-ignore lint/style/noNonNullAssertion: address is the whole string\n\treturn { type: \"standard\", address: addr! };\n}\n\nfunction principalToString(principal: PostConditionPrincipalWire): string {\n\tif (principal.type === \"origin\") return \"origin\";\n\tif (principal.type === \"contract\") {\n\t\treturn `${principal.address}.${principal.contractName}`;\n\t}\n\treturn principal.address;\n}\n\nfunction assetToString(asset: {\n\taddress: string;\n\tcontractName: string;\n\tassetName: string;\n}): string {\n\treturn `${asset.address}.${asset.contractName}::${asset.assetName}`;\n}\n\nfunction parseAsset(asset: string): {\n\taddress: string;\n\tcontractName: string;\n\tassetName: string;\n} {\n\tconst [contractId, tokenName] = asset.split(\"::\");\n\t// biome-ignore lint/style/noNonNullAssertion: callers validate `::` form\n\tconst [addr, name] = parseContractId(contractId!);\n\t// biome-ignore lint/style/noNonNullAssertion: split of `addr.contract::token`\n\treturn { address: addr, contractName: name, assetName: tokenName! };\n}\n\nexport function convertPostCondition(pc: PostCondition): PostConditionWire {\n\tswitch (pc.type) {\n\t\tcase \"stx-postcondition\":\n\t\t\treturn {\n\t\t\t\ttype: \"stx\",\n\t\t\t\tprincipal: resolvePrincipal(pc.address),\n\t\t\t\tconditionCode: FUNGIBLE_CODE_MAP[pc.condition],\n\t\t\t\tamount: parsePostConditionAmount(pc.amount),\n\t\t\t};\n\t\tcase \"ft-postcondition\":\n\t\t\treturn {\n\t\t\t\ttype: \"ft\",\n\t\t\t\tprincipal: resolvePrincipal(pc.address),\n\t\t\t\tasset: parseAsset(pc.asset),\n\t\t\t\tconditionCode: FUNGIBLE_CODE_MAP[pc.condition],\n\t\t\t\tamount: parsePostConditionAmount(pc.amount),\n\t\t\t};\n\t\tcase \"nft-postcondition\":\n\t\t\treturn {\n\t\t\t\ttype: \"nft\",\n\t\t\t\tprincipal: resolvePrincipal(pc.address),\n\t\t\t\tasset: parseAsset(pc.asset),\n\t\t\t\tconditionCode: NFT_CODE_MAP[pc.condition],\n\t\t\t\tassetId: pc.assetId,\n\t\t\t};\n\t\tcase \"staking-postcondition\":\n\t\t\treturn {\n\t\t\t\ttype: \"staking\",\n\t\t\t\tprincipal: resolvePrincipal(pc.address),\n\t\t\t\tconditionCode: FUNGIBLE_CODE_MAP[pc.condition],\n\t\t\t\tamount: parsePostConditionAmount(pc.amount),\n\t\t\t};\n\t\tcase \"pox-postcondition\":\n\t\t\treturn {\n\t\t\t\ttype: \"pox\",\n\t\t\t\tprincipal: resolvePrincipal(pc.address),\n\t\t\t\tconditionCode: POX_CODE_MAP[pc.condition],\n\t\t\t};\n\t}\n}\n\nexport function wireToPostCondition(wire: PostConditionWire): PostCondition {\n\tswitch (wire.type) {\n\t\tcase \"stx\":\n\t\t\treturn {\n\t\t\t\ttype: \"stx-postcondition\",\n\t\t\t\taddress: principalToString(wire.principal),\n\t\t\t\tcondition: fungibleName(wire.conditionCode),\n\t\t\t\tamount: wire.amount.toString(),\n\t\t\t};\n\t\tcase \"ft\":\n\t\t\treturn {\n\t\t\t\ttype: \"ft-postcondition\",\n\t\t\t\taddress: principalToString(wire.principal),\n\t\t\t\tcondition: fungibleName(wire.conditionCode),\n\t\t\t\tamount: wire.amount.toString(),\n\t\t\t\tasset: assetToString(wire.asset),\n\t\t\t};\n\t\tcase \"nft\":\n\t\t\treturn {\n\t\t\t\ttype: \"nft-postcondition\",\n\t\t\t\taddress: principalToString(wire.principal),\n\t\t\t\tcondition: nftName(wire.conditionCode),\n\t\t\t\tasset: assetToString(wire.asset),\n\t\t\t\tassetId: wire.assetId,\n\t\t\t};\n\t\tcase \"staking\":\n\t\t\treturn {\n\t\t\t\ttype: \"staking-postcondition\",\n\t\t\t\taddress: principalToString(wire.principal),\n\t\t\t\tcondition: fungibleName(wire.conditionCode),\n\t\t\t\tamount: wire.amount.toString(),\n\t\t\t};\n\t\tcase \"pox\":\n\t\t\treturn {\n\t\t\t\ttype: \"pox-postcondition\",\n\t\t\t\taddress: principalToString(wire.principal),\n\t\t\t\tcondition: poxName(wire.conditionCode),\n\t\t\t};\n\t}\n}\n\nfunction fungibleName(code: number): FungibleComparator {\n\tconst name = FUNGIBLE_CODE_REVERSE[code];\n\tif (!name) throw new Error(`Unknown fungible post-condition code: ${code}`);\n\treturn name;\n}\n\nfunction nftName(code: number): NonFungibleComparator {\n\tconst name = NFT_CODE_REVERSE[code];\n\tif (!name) throw new Error(`Unknown nft post-condition code: ${code}`);\n\treturn name;\n}\n\nfunction poxName(code: number): PoxComparator {\n\tconst name = POX_CODE_REVERSE[code];\n\tif (!name) throw new Error(`Unknown pox post-condition code: ${code}`);\n\treturn name;\n}\n\n/** Decode a serialized post-condition (stacks.js `Pc.fromHex`). */\nexport function fromHex(hex: string): PostCondition {\n\treturn wireToPostCondition(deserializePostConditionWire(hex));\n}\n\n/** Encode a post-condition to hex (stacks.js `postConditionToHex`). */\nexport function postConditionToHex(pc: PostCondition): string {\n\treturn bytesToHex(serializePostConditionWire(convertPostCondition(pc)));\n}\n"
9
+ ],
10
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGO,IAAM,WAAW;AAAA,EACvB,UAAU;AAAA,EACV,WAAW;AACZ;AAIO,IAAM,cAAc;AAAA,EAC1B,eAAe;AAAA,EACf,eAAe;AAAA,EACf,cAAc;AAAA,EACd,kBAAkB;AAAA,EAClB,UAAU;AAAA,EACV,wBAAwB;AAAA,EACxB,wBAAwB;AAAA,EACxB,cAAc;AAAA,EACd,kBAAkB;AACnB;AAIO,IAAM,iBAAiB;AAAA,EAC7B,UAAU;AAAA,EACV,UAAU;AAAA,EACV,UAAU;AAAA,EACV,UAAU;AAAA,EACV,UAAU;AAAA,EACV,UAAU;AACX;AAKO,IAAM,aAAa;AAAA,EACzB,aAAa;AAAA,EACb,cAAc;AAAA,EACd,KAAK;AACN;AAIO,IAAM,wBAAwB;AAAA,EACpC,OAAO;AAAA,EACP,MAAM;AAAA,EACN,YAAY;AACb;AAKO,IAAM,kBAAkB;AAAA,EAC9B,OAAO;AAAA,EACP,MAAM;AAA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AAM,OAAO,iBAAiB;AAAA,EAC9B,IAAI,CAAC;AAAA,IAAM,MAAM,IAAI,MAAM,oCAAoC,MAAM;AAAA,EACrE,OAAO;AAAA;AAID,SAAS,OAAO,CAAC,KAA4B;AAAA,EACnD,OAAO,oBAAoB,6BAA6B,GAAG,CAAC;AAAA;AAItD,SAAS,kBAAkB,CAAC,IAA2B;AAAA,EAC7D,OAAO,WAAW,2BAA2B,qBAAqB,EAAE,CAAC,CAAC;AAAA;",
11
+ "debugId": "0727B877F1BE3A9864756E2164756E21",
12
+ "names": []
13
+ }
@@ -215,7 +215,6 @@ async function deployContract(client, params) {
215
215
 
216
216
  // src/actions/wallet/signMessage.ts
217
217
  var import_sha2 = require("@noble/hashes/sha2.js");
218
- var SIP018_PREFIX = new Uint8Array([83, 73, 80, 48, 49, 56]);
219
218
  async function signMessage(client, params) {
220
219
  const account = client.account;
221
220
  if (!account)
@@ -229,19 +228,14 @@ async function signMessage(client, params) {
229
228
  return result.signature;
230
229
  }
231
230
  const cv = typeof params.message === "string" ? Cl.stringAscii(params.message) : params.message;
232
- const serializedMsg = serializeCVBytes(cv);
233
- let hash;
234
- if (params.domain) {
235
- const domainCV = Cl.tuple({
231
+ const hash = params.domain ? structuredDataHash({
232
+ message: cv,
233
+ domain: Cl.tuple({
236
234
  name: Cl.stringAscii(params.domain.name),
237
235
  version: Cl.stringAscii(params.domain.version),
238
236
  "chain-id": Cl.uint(params.domain.chainId)
239
- });
240
- const serializedDomain = serializeCVBytes(domainCV);
241
- hash = import_sha2.sha256(concatBytes(SIP018_PREFIX, serializedDomain, serializedMsg));
242
- } else {
243
- hash = import_sha2.sha256(serializedMsg);
244
- }
237
+ })
238
+ }) : import_sha2.sha256(serializeCVBytes(cv));
245
239
  const sigBytes = await account.sign(hash);
246
240
  return bytesToHex(sigBytes);
247
241
  }
@@ -335,5 +329,5 @@ async function transferStx(client, params) {
335
329
  });
336
330
  }
337
331
 
338
- //# debugId=081A1AEFB156F7E964756E2164756E21
339
- //# sourceMappingURL=stacks-zwgsbbb2.cjs.map
332
+ //# debugId=D48AB5673D94998464756E2164756E21
333
+ //# sourceMappingURL=stacks-y4f7fm03.cjs.map
@@ -15,13 +15,13 @@
15
15
  "import { BaseError } from \"./base.ts\";\n\nexport class SimulationError extends BaseError {\n\toverride name = \"SimulationError\";\n\twritesDetected: boolean;\n\n\tconstructor(\n\t\tmessage: string,\n\t\toptions: { writesDetected: boolean; details?: string },\n\t) {\n\t\tsuper(message, { details: options.details });\n\t\tthis.writesDetected = options.writesDetected;\n\t}\n}\n",
16
16
  "import { deserializeCVBytes } from \"../../clarity/deserialize.ts\";\nimport { serializeCVBytes } from \"../../clarity/serialize.ts\";\nimport type { ClarityValue } from \"../../clarity/types.ts\";\nimport type { Client } from \"../../clients/types.ts\";\nimport { SimulationError } from \"../../errors/simulation.ts\";\nimport { parseContractId } from \"../../utils/address.ts\";\nimport { bytesToHex, with0x } from \"../../utils/encoding.ts\";\n\nexport type SimulateCallParams = {\n\tcontract: string;\n\tfunctionName: string;\n\targs?: ClarityValue[];\n\tsender?: string;\n\ttip?: string;\n};\n\nexport type SimulateCallSuccess = { success: true; result: ClarityValue };\nexport type SimulateCallFailure = { success: false; error: SimulationError };\nexport type SimulateCallResult = SimulateCallSuccess | SimulateCallFailure;\n\nexport async function simulateCall(\n\tclient: Client,\n\tparams: SimulateCallParams,\n): Promise<SimulateCallResult> {\n\tconst [address, name] = parseContractId(params.contract);\n\tconst sender = params.sender ?? address;\n\n\tconst serializedArgs = (params.args ?? []).map((arg) =>\n\t\twith0x(bytesToHex(serializeCVBytes(arg))),\n\t);\n\n\tlet path = `/v2/contracts/call-read/${address}/${name}/${params.functionName}`;\n\tif (params.tip) {\n\t\tpath += `?tip=${params.tip}`;\n\t}\n\n\tconst data = await client.request(path, {\n\t\tmethod: \"POST\",\n\t\tbody: {\n\t\t\tsender,\n\t\t\targuments: serializedArgs,\n\t\t},\n\t});\n\n\tif (data.okay) {\n\t\treturn { success: true, result: deserializeCVBytes(data.result) };\n\t}\n\n\tconst cause: string = data.cause ?? \"Simulation failed\";\n\tconst writesDetected =\n\t\tcause.includes(\"NotReadOnly\") || cause.includes(\"CostBalanceExceeded\");\n\n\treturn {\n\t\tsuccess: false,\n\t\terror: new SimulationError(\n\t\t\twritesDetected\n\t\t\t\t? \"Function mutates state and cannot be simulated\"\n\t\t\t\t: \"Simulation failed\",\n\t\t\t{ writesDetected, details: cause },\n\t\t),\n\t};\n}\n",
17
17
  "import type { Client } from \"../../clients/types.ts\";\nimport type { StacksTransaction } from \"../../transactions/types.ts\";\nimport { AddressHashMode, PayloadType } from \"../../transactions/types.ts\";\nimport { c32address } from \"../../utils/address.ts\";\nimport { type FeeEstimation, estimateFee } from \"./estimateFee.ts\";\nimport { type SimulateCallResult, simulateCall } from \"./simulateCall.ts\";\n\nexport type SimulateTransactionParams = {\n\ttransaction: StacksTransaction;\n\tsender?: string;\n\ttip?: string;\n};\n\nexport type SimulateContractCallResult = {\n\ttype: \"contract-call\";\n\texecution: SimulateCallResult;\n\tfees: FeeEstimation[];\n};\n\nexport type SimulateTransferResult = {\n\ttype: \"token-transfer\";\n\tfees: FeeEstimation[];\n};\n\nexport type SimulateDeployResult = {\n\ttype: \"contract-deploy\";\n\tfees: FeeEstimation[];\n};\n\nexport type SimulateTransactionResult =\n\t| SimulateContractCallResult\n\t| SimulateTransferResult\n\t| SimulateDeployResult;\n\nfunction isMultiSig(hashMode: number): boolean {\n\treturn (\n\t\thashMode === AddressHashMode.P2SH ||\n\t\thashMode === AddressHashMode.P2WSH ||\n\t\thashMode === AddressHashMode.P2SH_NonSequential ||\n\t\thashMode === AddressHashMode.P2WSH_P2SH_NonSequential\n\t);\n}\n\nfunction extractSender(tx: StacksTransaction, client: Client): string {\n\tconst { hashMode, signer } = tx.auth.spendingCondition;\n\tconst chain = client.chain;\n\tconst version = isMultiSig(hashMode)\n\t\t? (chain?.addressVersion.multiSig ?? 20)\n\t\t: (chain?.addressVersion.singleSig ?? 22);\n\treturn c32address(version, signer);\n}\n\nexport async function simulateTransaction(\n\tclient: Client,\n\tparams: SimulateTransactionParams,\n): Promise<SimulateTransactionResult> {\n\tconst { transaction, tip } = params;\n\tconst { payload } = transaction;\n\n\tif (payload.payloadType === PayloadType.ContractCall) {\n\t\tconst sender = params.sender ?? extractSender(transaction, client);\n\t\tconst contract = `${payload.contractAddress}.${payload.contractName}`;\n\n\t\tconst [execution, fees] = await Promise.all([\n\t\t\tsimulateCall(client, {\n\t\t\t\tcontract,\n\t\t\t\tfunctionName: payload.functionName,\n\t\t\t\targs: payload.functionArgs,\n\t\t\t\tsender,\n\t\t\t\ttip,\n\t\t\t}),\n\t\t\testimateFee(client, { transaction }),\n\t\t]);\n\n\t\treturn { type: \"contract-call\", execution, fees };\n\t}\n\n\tconst fees = await estimateFee(client, { transaction });\n\n\tif (\n\t\tpayload.payloadType === PayloadType.SmartContract ||\n\t\tpayload.payloadType === PayloadType.VersionedSmartContract\n\t) {\n\t\treturn { type: \"contract-deploy\", fees };\n\t}\n\n\treturn { type: \"token-transfer\", fees };\n}\n",
18
- "import type { Client } from \"../../clients/types.ts\";\nimport type { PostCondition } from \"../../postconditions/types.ts\";\nimport { buildContractDeploy } from \"../../transactions/build.ts\";\nimport { signTransactionWithAccount } from \"../../transactions/signer.ts\";\nimport type { ClarityVersion } from \"../../transactions/types.ts\";\nimport { isClarityName } from \"../../utils/address.ts\";\nimport type { IntegerType } from \"../../utils/encoding.ts\";\nimport { broadcastWithNonceReset, resolveNonce } from \"./nonceManager.ts\";\nimport {\n\ttype FeeParam,\n\tassertNoFeeTierForProvider,\n\tisFeeTier,\n\tisProviderAccount,\n\tresolveFee,\n\tsetUnsignedFee,\n} from \"./utils.ts\";\n\nexport type DeployContractParams = {\n\tcontractName: string;\n\tcodeBody: string;\n\tclarityVersion?: ClarityVersion;\n\tfee?: FeeParam;\n\tnonce?: IntegerType;\n\tpostConditionMode?: \"allow\" | \"deny\";\n\tpostConditions?: PostCondition[];\n};\n\n/** Build, sign, and broadcast a contract deploy */\nexport async function deployContract(\n\tclient: Client,\n\tparams: DeployContractParams,\n): Promise<string> {\n\tconst account = client.account;\n\tif (!account) throw new Error(\"Account required\");\n\n\tif (!isClarityName(params.contractName))\n\t\tthrow new Error(`Invalid contract name: ${params.contractName}`);\n\n\t// Provider: delegate to wallet\n\tif (isProviderAccount(account)) {\n\t\tassertNoFeeTierForProvider(params.fee);\n\t\tconst result = await account.provider.request(\"stx_deployContract\", {\n\t\t\tcontractName: params.contractName,\n\t\t\tcodeBody: params.codeBody,\n\t\t\tclarityVersion: params.clarityVersion,\n\t\t});\n\t\treturn result.txid;\n\t}\n\n\t// Local/Custom: build → sign → broadcast\n\tconst nonce = params.nonce ?? (await resolveNonce(client, account.address));\n\n\tconst needsFeeResolution = params.fee === undefined || isFeeTier(params.fee);\n\n\tconst unsigned = buildContractDeploy({\n\t\tcontractName: params.contractName,\n\t\tcodeBody: params.codeBody,\n\t\tclarityVersion: params.clarityVersion,\n\t\tfee: needsFeeResolution ? 0n : (params.fee as IntegerType),\n\t\tnonce,\n\t\tpublicKey: account.publicKey,\n\t\tchain: client.chain,\n\t\tpostConditionMode: params.postConditionMode,\n\t\tpostConditions: params.postConditions,\n\t});\n\n\tif (needsFeeResolution) {\n\t\tsetUnsignedFee(unsigned, await resolveFee(client, unsigned, params.fee));\n\t}\n\n\tconst signed = await signTransactionWithAccount(unsigned, account);\n\treturn broadcastWithNonceReset(client, {\n\t\ttransaction: signed,\n\t\taddress: account.address,\n\t});\n}\n",
19
- "import { sha256 } from \"@noble/hashes/sha2.js\";\nimport { serializeCVBytes } from \"../../clarity/serialize.ts\";\nimport type { ClarityValue } from \"../../clarity/types.ts\";\nimport { Cl } from \"../../clarity/values.ts\";\nimport type { Client } from \"../../clients/types.ts\";\nimport { bytesToHex, concatBytes } from \"../../utils/encoding.ts\";\nimport { isProviderAccount } from \"./utils.ts\";\n\nexport type SignMessageParams = {\n\tmessage: string | ClarityValue;\n\tdomain?: {\n\t\tname: string;\n\t\tversion: string;\n\t\tchainId: number;\n\t};\n};\n\nconst SIP018_PREFIX = new Uint8Array([0x53, 0x49, 0x50, 0x30, 0x31, 0x38]); // \"SIP018\"\n\n/** Sign a structured message per SIP-018 */\nexport async function signMessage(\n\tclient: Client,\n\tparams: SignMessageParams,\n): Promise<string> {\n\tconst account = client.account;\n\tif (!account) throw new Error(\"Account required\");\n\n\t// Provider: delegate to wallet\n\tif (isProviderAccount(account)) {\n\t\tconst method = params.domain\n\t\t\t? \"stx_signStructuredMessage\"\n\t\t\t: \"stx_signMessage\";\n\t\tconst result = await account.provider.request(method, {\n\t\t\tmessage: params.message,\n\t\t\tdomain: params.domain,\n\t\t});\n\t\treturn result.signature;\n\t}\n\n\t// Local/Custom: sign locally\n\tconst cv =\n\t\ttypeof params.message === \"string\"\n\t\t\t? Cl.stringAscii(params.message)\n\t\t\t: params.message;\n\n\tconst serializedMsg = serializeCVBytes(cv);\n\n\tlet hash: Uint8Array;\n\n\tif (params.domain) {\n\t\tconst domainCV = Cl.tuple({\n\t\t\tname: Cl.stringAscii(params.domain.name),\n\t\t\tversion: Cl.stringAscii(params.domain.version),\n\t\t\t\"chain-id\": Cl.uint(params.domain.chainId),\n\t\t});\n\t\tconst serializedDomain = serializeCVBytes(domainCV);\n\t\thash = sha256(concatBytes(SIP018_PREFIX, serializedDomain, serializedMsg));\n\t} else {\n\t\thash = sha256(serializedMsg);\n\t}\n\n\tconst sigBytes = await account.sign(hash);\n\treturn bytesToHex(sigBytes);\n}\n",
18
+ "import type { Client } from \"../../clients/types.ts\";\nimport type {\n\tPostConditionInput,\n\tPostConditionMode,\n} from \"../../postconditions/types.ts\";\nimport { buildContractDeploy } from \"../../transactions/build.ts\";\nimport { signTransactionWithAccount } from \"../../transactions/signer.ts\";\nimport type { ClarityVersion } from \"../../transactions/types.ts\";\nimport { isClarityName } from \"../../utils/address.ts\";\nimport type { IntegerType } from \"../../utils/encoding.ts\";\nimport { broadcastWithNonceReset, resolveNonce } from \"./nonceManager.ts\";\nimport {\n\ttype FeeParam,\n\tassertNoFeeTierForProvider,\n\tisFeeTier,\n\tisProviderAccount,\n\tresolveFee,\n\tsetUnsignedFee,\n} from \"./utils.ts\";\n\nexport type DeployContractParams = {\n\tcontractName: string;\n\tcodeBody: string;\n\tclarityVersion?: ClarityVersion;\n\tfee?: FeeParam;\n\tnonce?: IntegerType;\n\tpostConditionMode?: PostConditionMode;\n\tpostConditions?: PostConditionInput[];\n};\n\n/** Build, sign, and broadcast a contract deploy */\nexport async function deployContract(\n\tclient: Client,\n\tparams: DeployContractParams,\n): Promise<string> {\n\tconst account = client.account;\n\tif (!account) throw new Error(\"Account required\");\n\n\tif (!isClarityName(params.contractName))\n\t\tthrow new Error(`Invalid contract name: ${params.contractName}`);\n\n\t// Provider: delegate to wallet\n\tif (isProviderAccount(account)) {\n\t\tassertNoFeeTierForProvider(params.fee);\n\t\tconst result = await account.provider.request(\"stx_deployContract\", {\n\t\t\tcontractName: params.contractName,\n\t\t\tcodeBody: params.codeBody,\n\t\t\tclarityVersion: params.clarityVersion,\n\t\t});\n\t\treturn result.txid;\n\t}\n\n\t// Local/Custom: build → sign → broadcast\n\tconst nonce = params.nonce ?? (await resolveNonce(client, account.address));\n\n\tconst needsFeeResolution = params.fee === undefined || isFeeTier(params.fee);\n\n\tconst unsigned = buildContractDeploy({\n\t\tcontractName: params.contractName,\n\t\tcodeBody: params.codeBody,\n\t\tclarityVersion: params.clarityVersion,\n\t\tfee: needsFeeResolution ? 0n : (params.fee as IntegerType),\n\t\tnonce,\n\t\tpublicKey: account.publicKey,\n\t\tchain: client.chain,\n\t\tpostConditionMode: params.postConditionMode,\n\t\tpostConditions: params.postConditions,\n\t});\n\n\tif (needsFeeResolution) {\n\t\tsetUnsignedFee(unsigned, await resolveFee(client, unsigned, params.fee));\n\t}\n\n\tconst signed = await signTransactionWithAccount(unsigned, account);\n\treturn broadcastWithNonceReset(client, {\n\t\ttransaction: signed,\n\t\taddress: account.address,\n\t});\n}\n",
19
+ "import { sha256 } from \"@noble/hashes/sha2.js\";\nimport { serializeCVBytes } from \"../../clarity/serialize.ts\";\nimport { structuredDataHash } from \"../../clarity/structuredData.ts\";\nimport type { ClarityValue } from \"../../clarity/types.ts\";\nimport { Cl } from \"../../clarity/values.ts\";\nimport type { Client } from \"../../clients/types.ts\";\nimport { bytesToHex } from \"../../utils/encoding.ts\";\nimport { isProviderAccount } from \"./utils.ts\";\n\nexport type SignMessageParams = {\n\tmessage: string | ClarityValue;\n\tdomain?: {\n\t\tname: string;\n\t\tversion: string;\n\t\tchainId: number;\n\t};\n};\n\n/** Sign a message. With `domain`, hashes per SIP-018; without, hashes the serialized CV. */\nexport async function signMessage(\n\tclient: Client,\n\tparams: SignMessageParams,\n): Promise<string> {\n\tconst account = client.account;\n\tif (!account) throw new Error(\"Account required\");\n\n\t// Provider: delegate to wallet\n\tif (isProviderAccount(account)) {\n\t\tconst method = params.domain\n\t\t\t? \"stx_signStructuredMessage\"\n\t\t\t: \"stx_signMessage\";\n\t\tconst result = await account.provider.request(method, {\n\t\t\tmessage: params.message,\n\t\t\tdomain: params.domain,\n\t\t});\n\t\treturn result.signature;\n\t}\n\n\tconst cv =\n\t\ttypeof params.message === \"string\"\n\t\t\t? Cl.stringAscii(params.message)\n\t\t\t: params.message;\n\n\tconst hash = params.domain\n\t\t? structuredDataHash({\n\t\t\t\tmessage: cv,\n\t\t\t\tdomain: Cl.tuple({\n\t\t\t\t\tname: Cl.stringAscii(params.domain.name),\n\t\t\t\t\tversion: Cl.stringAscii(params.domain.version),\n\t\t\t\t\t\"chain-id\": Cl.uint(params.domain.chainId),\n\t\t\t\t}),\n\t\t\t})\n\t\t: sha256(serializeCVBytes(cv));\n\n\tconst sigBytes = await account.sign(hash);\n\treturn bytesToHex(sigBytes);\n}\n",
20
20
  "import type { Client } from \"../../clients/types.ts\";\nimport { signMultiSigWithAccount } from \"../../transactions/multisig.ts\";\nimport { signTransactionWithAccount } from \"../../transactions/signer.ts\";\nimport type { StacksTransaction } from \"../../transactions/types.ts\";\nimport { deserializeTransaction } from \"../../transactions/wire/deserialize.ts\";\nimport { serializeTransactionHex } from \"../../transactions/wire/serialize.ts\";\nimport { isProviderAccount } from \"./utils.ts\";\n\nexport type SignTransactionParams = {\n\ttransaction: StacksTransaction;\n\t/** Public keys for multi-sig signing (auto-detected from _multisig metadata if omitted) */\n\tsigners?: string[];\n};\n\n/** Sign a transaction using the client's account */\nexport async function signTransactionAction(\n\tclient: Client,\n\tparams: SignTransactionParams,\n): Promise<StacksTransaction> {\n\tconst account = client.account;\n\tif (!account) throw new Error(\"Account required\");\n\n\t// Provider: send hex to wallet, get signed hex back\n\tif (isProviderAccount(account)) {\n\t\tconst hex = serializeTransactionHex(params.transaction);\n\t\tconst result = await account.provider.request(\"stx_signTransaction\", {\n\t\t\ttransaction: hex,\n\t\t});\n\t\treturn deserializeTransaction(result.transaction, {\n\t\t\t_multisig: params.transaction._multisig,\n\t\t});\n\t}\n\n\t// Multi-sig: auto-detect from fields or _multisig metadata\n\tconst condition = params.transaction.auth.spendingCondition;\n\tif (\"fields\" in condition) {\n\t\tconst publicKeys =\n\t\t\tparams.signers ?? params.transaction._multisig?.publicKeys;\n\t\tif (!publicKeys)\n\t\t\tthrow new Error(\"Multi-sig signing requires signers (publicKeys)\");\n\t\treturn signMultiSigWithAccount(params.transaction, account, publicKeys);\n\t}\n\n\t// Local/Custom: sign with account\n\treturn signTransactionWithAccount(params.transaction, account);\n}\n",
21
21
  "import type { Client } from \"../../clients/types.ts\";\nimport { createSingleSigSpendingCondition } from \"../../transactions/authorization.ts\";\nimport { signSponsorWithAccount } from \"../../transactions/signer.ts\";\nimport {\n\tAuthType,\n\ttype SponsoredAuthorization,\n\ttype StacksTransaction,\n} from \"../../transactions/types.ts\";\nimport type { IntegerType } from \"../../utils/encoding.ts\";\nimport { intToBigInt } from \"../../utils/encoding.ts\";\nimport { resolveNonce } from \"./nonceManager.ts\";\nimport { type FeeParam, isProviderAccount, resolveFee } from \"./utils.ts\";\n\nexport type SponsorTransactionParams = {\n\ttransaction: StacksTransaction;\n\tfee?: FeeParam;\n\tnonce?: IntegerType;\n};\n\n/** Sponsor a transaction: set sponsor spending condition, sign as sponsor */\nexport async function sponsorTransaction(\n\tclient: Client,\n\tparams: SponsorTransactionParams,\n): Promise<StacksTransaction> {\n\tconst { transaction } = params;\n\n\tif (transaction.auth.authType !== AuthType.Sponsored) {\n\t\tthrow new Error(\"Transaction must have sponsored authorization\");\n\t}\n\n\tconst account = client.account;\n\tif (!account) throw new Error(\"Account required\");\n\tif (isProviderAccount(account)) {\n\t\tthrow new Error(\"Provider accounts cannot sponsor transactions\");\n\t}\n\n\t// Resolve sponsor nonce\n\tconst nonce =\n\t\tparams.nonce != null\n\t\t\t? intToBigInt(params.nonce)\n\t\t\t: await resolveNonce(client, account.address);\n\n\t// Resolve sponsor fee. Estimation failure falls back to the minimum relay\n\t// fee instead of 0 (a 0-fee tx would be rejected at broadcast).\n\tconst fee = await resolveFee(client, transaction, params.fee);\n\n\t// Create sponsor spending condition\n\tconst sponsorCondition = createSingleSigSpendingCondition(\n\t\taccount.publicKey,\n\t\tnonce,\n\t\tfee,\n\t);\n\n\t// Set sponsor spending condition on the tx\n\tconst auth = transaction.auth as SponsoredAuthorization;\n\tconst sponsored: StacksTransaction = {\n\t\t...transaction,\n\t\tauth: {\n\t\t\t...auth,\n\t\t\tsponsorSpendingCondition: sponsorCondition,\n\t\t},\n\t};\n\n\t// Sign as sponsor\n\treturn signSponsorWithAccount(sponsored, account);\n}\n",
22
- "import type { Client } from \"../../clients/types.ts\";\nimport type { PostCondition } from \"../../postconditions/types.ts\";\nimport { buildTokenTransfer } from \"../../transactions/build.ts\";\nimport { signTransactionWithAccount } from \"../../transactions/signer.ts\";\nimport { validateStacksAddress } from \"../../utils/address.ts\";\nimport type { IntegerType } from \"../../utils/encoding.ts\";\nimport { broadcastWithNonceReset, resolveNonce } from \"./nonceManager.ts\";\nimport {\n\ttype FeeParam,\n\tassertNoFeeTierForProvider,\n\tisFeeTier,\n\tisProviderAccount,\n\tresolveFee,\n\tsetUnsignedFee,\n} from \"./utils.ts\";\n\nexport type TransferStxParams = {\n\tto: string;\n\tamount: IntegerType;\n\tmemo?: string;\n\tfee?: FeeParam;\n\tnonce?: IntegerType;\n\tpostConditionMode?: \"allow\" | \"deny\";\n\tpostConditions?: PostCondition[];\n};\n\n/** Build, sign, and broadcast an STX transfer */\nexport async function transferStx(\n\tclient: Client,\n\tparams: TransferStxParams,\n): Promise<string> {\n\tconst account = client.account;\n\tif (!account) throw new Error(\"Account required\");\n\n\tif (!validateStacksAddress(params.to))\n\t\tthrow new Error(`Invalid recipient address: ${params.to}`);\n\n\t// Provider: delegate to wallet\n\tif (isProviderAccount(account)) {\n\t\tassertNoFeeTierForProvider(params.fee);\n\t\tconst result = await account.provider.request(\"stx_transferStx\", {\n\t\t\trecipient: params.to,\n\t\t\tamount: String(params.amount),\n\t\t\tmemo: params.memo,\n\t\t});\n\t\treturn result.txid;\n\t}\n\n\t// Local/Custom: build → sign → broadcast\n\tconst nonce = params.nonce ?? (await resolveNonce(client, account.address));\n\n\tconst needsFeeResolution = params.fee === undefined || isFeeTier(params.fee);\n\n\tconst unsigned = buildTokenTransfer({\n\t\trecipient: params.to,\n\t\tamount: params.amount,\n\t\tmemo: params.memo,\n\t\tfee: needsFeeResolution ? 0n : (params.fee as IntegerType),\n\t\tnonce,\n\t\tpublicKey: account.publicKey,\n\t\tchain: client.chain,\n\t\tpostConditionMode: params.postConditionMode,\n\t\tpostConditions: params.postConditions,\n\t});\n\n\tif (needsFeeResolution) {\n\t\tsetUnsignedFee(unsigned, await resolveFee(client, unsigned, params.fee));\n\t}\n\n\tconst signed = await signTransactionWithAccount(unsigned, account);\n\treturn broadcastWithNonceReset(client, {\n\t\ttransaction: signed,\n\t\taddress: account.address,\n\t});\n}\n"
22
+ "import type { Client } from \"../../clients/types.ts\";\nimport type {\n\tPostConditionInput,\n\tPostConditionMode,\n} from \"../../postconditions/types.ts\";\nimport { buildTokenTransfer } from \"../../transactions/build.ts\";\nimport { signTransactionWithAccount } from \"../../transactions/signer.ts\";\nimport { validateStacksAddress } from \"../../utils/address.ts\";\nimport type { IntegerType } from \"../../utils/encoding.ts\";\nimport { broadcastWithNonceReset, resolveNonce } from \"./nonceManager.ts\";\nimport {\n\ttype FeeParam,\n\tassertNoFeeTierForProvider,\n\tisFeeTier,\n\tisProviderAccount,\n\tresolveFee,\n\tsetUnsignedFee,\n} from \"./utils.ts\";\n\nexport type TransferStxParams = {\n\tto: string;\n\tamount: IntegerType;\n\tmemo?: string;\n\tfee?: FeeParam;\n\tnonce?: IntegerType;\n\tpostConditionMode?: PostConditionMode;\n\tpostConditions?: PostConditionInput[];\n};\n\n/** Build, sign, and broadcast an STX transfer */\nexport async function transferStx(\n\tclient: Client,\n\tparams: TransferStxParams,\n): Promise<string> {\n\tconst account = client.account;\n\tif (!account) throw new Error(\"Account required\");\n\n\tif (!validateStacksAddress(params.to))\n\t\tthrow new Error(`Invalid recipient address: ${params.to}`);\n\n\t// Provider: delegate to wallet\n\tif (isProviderAccount(account)) {\n\t\tassertNoFeeTierForProvider(params.fee);\n\t\tconst result = await account.provider.request(\"stx_transferStx\", {\n\t\t\trecipient: params.to,\n\t\t\tamount: String(params.amount),\n\t\t\tmemo: params.memo,\n\t\t});\n\t\treturn result.txid;\n\t}\n\n\t// Local/Custom: build → sign → broadcast\n\tconst nonce = params.nonce ?? (await resolveNonce(client, account.address));\n\n\tconst needsFeeResolution = params.fee === undefined || isFeeTier(params.fee);\n\n\tconst unsigned = buildTokenTransfer({\n\t\trecipient: params.to,\n\t\tamount: params.amount,\n\t\tmemo: params.memo,\n\t\tfee: needsFeeResolution ? 0n : (params.fee as IntegerType),\n\t\tnonce,\n\t\tpublicKey: account.publicKey,\n\t\tchain: client.chain,\n\t\tpostConditionMode: params.postConditionMode,\n\t\tpostConditions: params.postConditions,\n\t});\n\n\tif (needsFeeResolution) {\n\t\tsetUnsignedFee(unsigned, await resolveFee(client, unsigned, params.fee));\n\t}\n\n\tconst signed = await signTransactionWithAccount(unsigned, account);\n\treturn broadcastWithNonceReset(client, {\n\t\ttransaction: signed,\n\t\taddress: account.address,\n\t});\n}\n"
23
23
  ],
24
- "mappings": ";AAcA,eAAsB,iBAAiB,CACtC,QACA,QACkC;AAAA,EAClC,MAAM,QAAQ,KAAK,IAAI,OAAO,SAAS,IAAI,EAAE;AAAA,EAC7C,OAAO,OAAO,QACb,0BAA0B,OAAO,8BAA8B,SAC/D,EAAE,QAAQ,MAAM,CACjB;AAAA;;;ACRD,eAAsB,cAAc,CACnC,QACA,QACuB;AAAA,EACvB,MAAM,OAAO,MAAM,OAAO,QAAQ,gBAAgB,OAAO,mBAAmB;AAAA,IAC3E,QAAQ;AAAA,EACT,CAAC;AAAA,EACD,MAAM,UAAW,MAAgC;AAAA,EACjD,MAAM,QAAS,MAA8B;AAAA,EAC7C,IACE,OAAO,YAAY,YAAY,OAAO,YAAY,YAClD,OAAO,UAAU,YAAY,OAAO,UAAU,UAC9C;AAAA,IACD,MAAM,IAAI,uBACT,gCAAgC,OAAO,kDACxC;AAAA,EACD;AAAA,EACA,OAAO;AAAA,IACN,SAAS,OAAO,OAAO;AAAA,IACvB,OAAO,OAAO,KAAK;AAAA,IACnB,cAAc,KAAK,iBAAiB;AAAA,IACpC,YAAY,KAAK,eAAe;AAAA,EACjC;AAAA;;;AC7BD,eAAsB,UAAU,CAC/B,QACA,QACkB;AAAA,EAClB,MAAM,OAAO,MAAM,OAAO,QAAQ,gBAAgB,OAAO,WAAW;AAAA,IACnE,QAAQ;AAAA,EACT,CAAC;AAAA,EACD,MAAM,UAAW,MAAgC;AAAA,EACjD,IAAI,OAAO,YAAY,YAAY,OAAO,YAAY,UAAU;AAAA,IAC/D,MAAM,IAAI,uBACT,4BAA4B,OAAO,uCACpC;AAAA,EACD;AAAA,EACA,OAAO,OAAO,OAAO;AAAA;;;ACbtB,eAAsB,QAAQ,CAC7B,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SAAS,QAAQ;AAAA,EAClB,CAAC;AAAA;",
25
+ "debugId": "D48AB5673D94998464756E2164756E21",
26
26
  "names": []
27
27
  }
@@ -6,7 +6,7 @@ type LocalAccount = {
6
6
  publicKey: string
7
7
  /** Raw ECDSA sign over a hash */
8
8
  sign(hash: Uint8Array): Uint8Array
9
- /** Sign a structured message (SIP-018) */
9
+ /** Sign a raw UTF-8 / byte message (`sha256(bytes)`). Not SIP-018. */
10
10
  signMessage(message: string | Uint8Array): string
11
11
  };
12
12
  /** Account with a user-provided signing function (sync or async). */
@@ -6,7 +6,7 @@ type LocalAccount = {
6
6
  publicKey: string
7
7
  /** Raw ECDSA sign over a hash */
8
8
  sign(hash: Uint8Array): Uint8Array
9
- /** Sign a structured message (SIP-018) */
9
+ /** Sign a raw UTF-8 / byte message (`sha256(bytes)`). Not SIP-018. */
10
10
  signMessage(message: string | Uint8Array): string
11
11
  };
12
12
  /** Account with a user-provided signing function (sync or async). */
@@ -6,7 +6,7 @@ type LocalAccount = {
6
6
  publicKey: string
7
7
  /** Raw ECDSA sign over a hash */
8
8
  sign(hash: Uint8Array): Uint8Array
9
- /** Sign a structured message (SIP-018) */
9
+ /** Sign a raw UTF-8 / byte message (`sha256(bytes)`). Not SIP-018. */
10
10
  signMessage(message: string | Uint8Array): string
11
11
  };
12
12
  /** Account with a user-provided signing function (sync or async). */
@@ -124,6 +124,7 @@ type AnchorMode = (typeof AnchorMode)[keyof typeof AnchorMode];
124
124
  declare const PostConditionModeWire: {
125
125
  readonly Allow: 0x01
126
126
  readonly Deny: 0x02
127
+ readonly Originator: 0x03
127
128
  };
128
129
  type PostConditionModeWire = (typeof PostConditionModeWire)[keyof typeof PostConditionModeWire];
129
130
  declare const AddressHashMode: {
@@ -864,7 +865,7 @@ type SignTransactionParams = {
864
865
  /** Sign a transaction using the client's account */
865
866
  declare function signTransactionAction(client: Client, params: SignTransactionParams): Promise<StacksTransaction>;
866
867
  type FungibleComparator = "eq" | "gt" | "gte" | "lt" | "lte";
867
- type NonFungibleComparator = "sent" | "not-sent";
868
+ type NonFungibleComparator = "sent" | "not-sent" | "maybe-sent";
868
869
  type StxPostCondition = {
869
870
  type: "stx-postcondition"
870
871
  address: string
@@ -898,6 +899,9 @@ type PoxPostCondition = {
898
899
  condition: PoxComparator
899
900
  };
900
901
  type PostCondition = StxPostCondition | FtPostCondition | NftPostCondition | StakingPostCondition | PoxPostCondition;
902
+ /** Serialized PC hex is accepted anywhere a `PostCondition` object is. */
903
+ type PostConditionInput = PostCondition | string;
904
+ type PostConditionMode = "allow" | "deny" | "originator";
901
905
  type IntegerType = number | string | bigint | Uint8Array;
902
906
  declare function isProviderAccount(account: Account): account is ProviderAccount;
903
907
  /**
@@ -929,8 +933,8 @@ type TransferStxParams = {
929
933
  memo?: string
930
934
  fee?: FeeParam
931
935
  nonce?: IntegerType
932
- postConditionMode?: "allow" | "deny"
933
- postConditions?: PostCondition[]
936
+ postConditionMode?: PostConditionMode
937
+ postConditions?: PostConditionInput[]
934
938
  };
935
939
  /** Build, sign, and broadcast an STX transfer */
936
940
  declare function transferStx(client: Client, params: TransferStxParams): Promise<string>;
@@ -940,8 +944,8 @@ type CallContractParams = {
940
944
  functionArgs?: ClarityValue[]
941
945
  fee?: FeeParam
942
946
  nonce?: IntegerType
943
- postConditionMode?: "allow" | "deny"
944
- postConditions?: PostCondition[]
947
+ postConditionMode?: PostConditionMode
948
+ postConditions?: PostConditionInput[]
945
949
  };
946
950
  /** Build, sign, and broadcast a contract call */
947
951
  declare function callContract(client: Client, params: CallContractParams): Promise<string>;
@@ -951,8 +955,8 @@ type DeployContractParams = {
951
955
  clarityVersion?: ClarityVersion
952
956
  fee?: FeeParam
953
957
  nonce?: IntegerType
954
- postConditionMode?: "allow" | "deny"
955
- postConditions?: PostCondition[]
958
+ postConditionMode?: PostConditionMode
959
+ postConditions?: PostConditionInput[]
956
960
  };
957
961
  /** Build, sign, and broadcast a contract deploy */
958
962
  declare function deployContract(client: Client, params: DeployContractParams): Promise<string>;
@@ -964,7 +968,7 @@ type SignMessageParams = {
964
968
  chainId: number
965
969
  }
966
970
  };
967
- /** Sign a structured message per SIP-018 */
971
+ /** Sign a message. With `domain`, hashes per SIP-018; without, hashes the serialized CV. */
968
972
  declare function signMessage2(client: Client, params: SignMessageParams): Promise<string>;
969
973
  type SponsorTransactionParams = {
970
974
  transaction: StacksTransaction
@@ -1210,8 +1214,8 @@ type MapMethods<C extends AbiContract> = [AbiTypesOf<C>] extends [never] ? { [N
1210
1214
  type ContractCallOptions = {
1211
1215
  fee?: IntegerType
1212
1216
  nonce?: IntegerType
1213
- postConditionMode?: "allow" | "deny"
1214
- postConditions?: PostCondition[]
1217
+ postConditionMode?: PostConditionMode
1218
+ postConditions?: PostConditionInput[]
1215
1219
  };
1216
1220
  /**
1217
1221
  * Options for `buildCall.*` — building an unsigned transaction for
@@ -6,7 +6,7 @@ type LocalAccount = {
6
6
  publicKey: string
7
7
  /** Raw ECDSA sign over a hash */
8
8
  sign(hash: Uint8Array): Uint8Array
9
- /** Sign a structured message (SIP-018) */
9
+ /** Sign a raw UTF-8 / byte message (`sha256(bytes)`). Not SIP-018. */
10
10
  signMessage(message: string | Uint8Array): string
11
11
  };
12
12
  /** Account with a user-provided signing function (sync or async). */
@@ -124,6 +124,7 @@ type AnchorMode = (typeof AnchorMode)[keyof typeof AnchorMode];
124
124
  declare const PostConditionModeWire: {
125
125
  readonly Allow: 0x01
126
126
  readonly Deny: 0x02
127
+ readonly Originator: 0x03
127
128
  };
128
129
  type PostConditionModeWire = (typeof PostConditionModeWire)[keyof typeof PostConditionModeWire];
129
130
  declare const AddressHashMode: {
@@ -864,7 +865,7 @@ type SignTransactionParams = {
864
865
  /** Sign a transaction using the client's account */
865
866
  declare function signTransactionAction(client: Client, params: SignTransactionParams): Promise<StacksTransaction>;
866
867
  type FungibleComparator = "eq" | "gt" | "gte" | "lt" | "lte";
867
- type NonFungibleComparator = "sent" | "not-sent";
868
+ type NonFungibleComparator = "sent" | "not-sent" | "maybe-sent";
868
869
  type StxPostCondition = {
869
870
  type: "stx-postcondition"
870
871
  address: string
@@ -898,6 +899,9 @@ type PoxPostCondition = {
898
899
  condition: PoxComparator
899
900
  };
900
901
  type PostCondition = StxPostCondition | FtPostCondition | NftPostCondition | StakingPostCondition | PoxPostCondition;
902
+ /** Serialized PC hex is accepted anywhere a `PostCondition` object is. */
903
+ type PostConditionInput = PostCondition | string;
904
+ type PostConditionMode = "allow" | "deny" | "originator";
901
905
  type IntegerType = number | string | bigint | Uint8Array;
902
906
  declare function isProviderAccount(account: Account): account is ProviderAccount;
903
907
  /**
@@ -929,8 +933,8 @@ type TransferStxParams = {
929
933
  memo?: string
930
934
  fee?: FeeParam
931
935
  nonce?: IntegerType
932
- postConditionMode?: "allow" | "deny"
933
- postConditions?: PostCondition[]
936
+ postConditionMode?: PostConditionMode
937
+ postConditions?: PostConditionInput[]
934
938
  };
935
939
  /** Build, sign, and broadcast an STX transfer */
936
940
  declare function transferStx(client: Client, params: TransferStxParams): Promise<string>;
@@ -940,8 +944,8 @@ type CallContractParams = {
940
944
  functionArgs?: ClarityValue[]
941
945
  fee?: FeeParam
942
946
  nonce?: IntegerType
943
- postConditionMode?: "allow" | "deny"
944
- postConditions?: PostCondition[]
947
+ postConditionMode?: PostConditionMode
948
+ postConditions?: PostConditionInput[]
945
949
  };
946
950
  /** Build, sign, and broadcast a contract call */
947
951
  declare function callContract(client: Client, params: CallContractParams): Promise<string>;
@@ -951,8 +955,8 @@ type DeployContractParams = {
951
955
  clarityVersion?: ClarityVersion
952
956
  fee?: FeeParam
953
957
  nonce?: IntegerType
954
- postConditionMode?: "allow" | "deny"
955
- postConditions?: PostCondition[]
958
+ postConditionMode?: PostConditionMode
959
+ postConditions?: PostConditionInput[]
956
960
  };
957
961
  /** Build, sign, and broadcast a contract deploy */
958
962
  declare function deployContract(client: Client, params: DeployContractParams): Promise<string>;
@@ -964,7 +968,7 @@ type SignMessageParams = {
964
968
  chainId: number
965
969
  }
966
970
  };
967
- /** Sign a structured message per SIP-018 */
971
+ /** Sign a message. With `domain`, hashes per SIP-018; without, hashes the serialized CV. */
968
972
  declare function signMessage2(client: Client, params: SignMessageParams): Promise<string>;
969
973
  type SponsorTransactionParams = {
970
974
  transaction: StacksTransaction
@@ -1210,8 +1214,8 @@ type MapMethods<C extends AbiContract> = [AbiTypesOf<C>] extends [never] ? { [N
1210
1214
  type ContractCallOptions = {
1211
1215
  fee?: IntegerType
1212
1216
  nonce?: IntegerType
1213
- postConditionMode?: "allow" | "deny"
1214
- postConditions?: PostCondition[]
1217
+ postConditionMode?: PostConditionMode
1218
+ postConditions?: PostConditionInput[]
1215
1219
  };
1216
1220
  /**
1217
1221
  * Options for `buildCall.*` — building an unsigned transaction for
@@ -3,7 +3,7 @@ import {
3
3
  buildFunctionArgs,
4
4
  getContract,
5
5
  isResponseOutput
6
- } from "../../shared/stacks-z3vztaz1.js";
6
+ } from "../../shared/stacks-jpt52csy.js";
7
7
  import {
8
8
  deployContract,
9
9
  getAccountHistory,
@@ -22,7 +22,7 @@ import {
22
22
  simulateTransaction,
23
23
  sponsorTransaction,
24
24
  transferStx
25
- } from "../../shared/stacks-thkhfwz8.js";
25
+ } from "../../shared/stacks-bw8qvqd1.js";
26
26
  import {
27
27
  multicall
28
28
  } from "../../shared/stacks-2evvn48s.js";
@@ -40,7 +40,7 @@ import {
40
40
  resolveFee,
41
41
  sendTransaction,
42
42
  waitForTransactionReceipt
43
- } from "../../shared/stacks-90jcxs98.js";
43
+ } from "../../shared/stacks-fb75yew8.js";
44
44
  import {
45
45
  readContract
46
46
  } from "../../shared/stacks-27fmgajb.js";
@@ -54,8 +54,9 @@ import {
54
54
  } from "../../shared/stacks-tjjnkt3r.js";
55
55
  import"../../shared/stacks-709tra19.js";
56
56
  import"../../shared/stacks-4z72akdf.js";
57
- import"../../shared/stacks-gkf9tsws.js";
58
- import"../../shared/stacks-jx146qf1.js";
57
+ import"../../shared/stacks-1arrcd11.js";
58
+ import"../../shared/stacks-hnqt5rz4.js";
59
+ import"../../shared/stacks-w23294am.js";
59
60
  import"../../shared/stacks-ttdk2g2f.js";
60
61
  import"../../shared/stacks-bfan7ex7.js";
61
62
  import"../../shared/stacks-qs5fzts5.js";
@@ -104,5 +105,5 @@ export {
104
105
  ContractResponseError
105
106
  };
106
107
 
107
- //# debugId=8921AFBA530211C464756E2164756E21
108
+ //# debugId=018983BC8CE0083264756E2164756E21
108
109
  //# sourceMappingURL=index.js.map
@@ -4,6 +4,6 @@
4
4
  "sourcesContent": [
5
5
  ],
6
6
  "mappings": "",
7
- "debugId": "8921AFBA530211C464756E2164756E21",
7
+ "debugId": "018983BC8CE0083264756E2164756E21",
8
8
  "names": []
9
9
  }
@@ -60,6 +60,35 @@ type StringUtf8CV = {
60
60
  readonly value: string
61
61
  };
62
62
  type ClarityValue = IntCV | UIntCV | BooleanCV | BufferCV | NoneCV | SomeCV | ResponseOkCV | ResponseErrorCV | StandardPrincipalCV | ContractPrincipalCV | ListCV | TupleCV | StringAsciiCV | StringUtf8CV;
63
+ /** Account derived from a local private key (mnemonic or raw key). */
64
+ type LocalAccount = {
65
+ type: "local"
66
+ address: string
67
+ /** Compressed public key (hex) */
68
+ publicKey: string
69
+ /** Raw ECDSA sign over a hash */
70
+ sign(hash: Uint8Array): Uint8Array
71
+ /** Sign a raw UTF-8 / byte message (`sha256(bytes)`). Not SIP-018. */
72
+ signMessage(message: string | Uint8Array): string
73
+ };
74
+ /** Account with a user-provided signing function (sync or async). */
75
+ type CustomAccount = {
76
+ type: "custom"
77
+ address: string
78
+ publicKey: string
79
+ sign(hash: Uint8Array): Promise<Uint8Array> | Uint8Array
80
+ };
81
+ /** Browser wallet provider interface (e.g. Leather, Xverse). */
82
+ type StacksProvider = {
83
+ request(method: string, params?: any): Promise<any>
84
+ };
85
+ /** Account backed by a browser wallet {@link StacksProvider}. */
86
+ type ProviderAccount = {
87
+ type: "provider"
88
+ address: string
89
+ publicKey: string
90
+ provider: StacksProvider
91
+ };
63
92
  /**
64
93
  * Bitcoin double-SHA256: `sha256(sha256(bytes))`. This is the hash Bitcoin uses
65
94
  * for txids, block headers, and merkle nodes — NOT the same as the Stacks
@@ -485,35 +514,6 @@ declare const SPV_ADAPTER_ABI: {
485
514
  }
486
515
  }]
487
516
  };
488
- /** Account derived from a local private key (mnemonic or raw key). */
489
- type LocalAccount = {
490
- type: "local"
491
- address: string
492
- /** Compressed public key (hex) */
493
- publicKey: string
494
- /** Raw ECDSA sign over a hash */
495
- sign(hash: Uint8Array): Uint8Array
496
- /** Sign a structured message (SIP-018) */
497
- signMessage(message: string | Uint8Array): string
498
- };
499
- /** Account with a user-provided signing function (sync or async). */
500
- type CustomAccount = {
501
- type: "custom"
502
- address: string
503
- publicKey: string
504
- sign(hash: Uint8Array): Promise<Uint8Array> | Uint8Array
505
- };
506
- /** Browser wallet provider interface (e.g. Leather, Xverse). */
507
- type StacksProvider = {
508
- request(method: string, params?: any): Promise<any>
509
- };
510
- /** Account backed by a browser wallet {@link StacksProvider}. */
511
- type ProviderAccount = {
512
- type: "provider"
513
- address: string
514
- publicKey: string
515
- provider: StacksProvider
516
- };
517
517
  /** Allocates mempool-safe sequential nonces across rapid broadcasts from one account. */
518
518
  type NonceManager = {
519
519
  consume(params: {