@secondlayer/stacks 0.2.1 → 0.3.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 (171) hide show
  1. package/dist/shared/stacks-02actsrx.cjs.map +2 -2
  2. package/dist/shared/{stacks-vyb9rx8q.js → stacks-09wa7ewe.js} +125 -115
  3. package/dist/shared/stacks-09wa7ewe.js.map +15 -0
  4. package/dist/shared/{stacks-ky14tdf6.cjs → stacks-0nfexv24.cjs} +20 -8
  5. package/dist/shared/stacks-0nfexv24.cjs.map +14 -0
  6. package/dist/shared/{stacks-an5k8n4t.cjs → stacks-14pgpkrr.cjs} +82 -73
  7. package/dist/shared/stacks-14pgpkrr.cjs.map +23 -0
  8. package/dist/shared/{stacks-vbke9mqw.cjs → stacks-17sdtaxg.cjs} +120 -106
  9. package/dist/shared/stacks-17sdtaxg.cjs.map +15 -0
  10. package/dist/shared/{stacks-wrb1es85.js → stacks-1s5w4ncf.js} +46 -34
  11. package/dist/shared/stacks-1s5w4ncf.js.map +17 -0
  12. package/dist/shared/stacks-24h5k94q.cjs.map +3 -3
  13. package/dist/shared/{stacks-evnzth1q.cjs → stacks-4vzmhw3q.cjs} +3 -3
  14. package/dist/shared/stacks-4vzmhw3q.cjs.map +10 -0
  15. package/dist/shared/{stacks-vd9jcp0b.js → stacks-4x2bcc2k.js} +89 -80
  16. package/dist/shared/stacks-4x2bcc2k.js.map +23 -0
  17. package/dist/shared/stacks-5tprhns9.cjs.map +3 -3
  18. package/dist/shared/stacks-709tra19.js.map +2 -2
  19. package/dist/shared/{stacks-qcx67vqa.js → stacks-70p84bgg.js} +3 -3
  20. package/dist/shared/stacks-70p84bgg.js.map +10 -0
  21. package/dist/shared/{stacks-k2p5tv6x.js → stacks-913a2rx7.js} +3 -3
  22. package/dist/shared/stacks-913a2rx7.js.map +10 -0
  23. package/dist/shared/{stacks-qyt8m5v0.js → stacks-96d6m1zy.js} +16 -7
  24. package/dist/shared/stacks-96d6m1zy.js.map +11 -0
  25. package/dist/shared/stacks-9g0jhab3.cjs.map +2 -2
  26. package/dist/shared/stacks-dr5en54r.cjs.map +2 -2
  27. package/dist/shared/stacks-fcaefc5b.cjs.map +2 -2
  28. package/dist/shared/stacks-gck1sq7h.cjs.map +2 -2
  29. package/dist/shared/{stacks-yfveb68e.js → stacks-je937aas.js} +3 -3
  30. package/dist/shared/stacks-je937aas.js.map +10 -0
  31. package/dist/shared/{stacks-k58k970n.js → stacks-kg1npstf.js} +5 -3
  32. package/dist/shared/stacks-kg1npstf.js.map +10 -0
  33. package/dist/shared/{stacks-qvg7c24g.cjs → stacks-n98w7g57.cjs} +5 -3
  34. package/dist/shared/stacks-n98w7g57.cjs.map +10 -0
  35. package/dist/shared/{stacks-9mdk86wp.js → stacks-nqae5amn.cjs} +77 -159
  36. package/dist/shared/stacks-nqae5amn.cjs.map +10 -0
  37. package/dist/shared/stacks-qcae5852.js.map +2 -2
  38. package/dist/shared/stacks-qt8ehebn.js.map +3 -3
  39. package/dist/shared/{stacks-r1t6g3c3.cjs → stacks-ra02bpny.cjs} +8 -3
  40. package/dist/shared/stacks-ra02bpny.cjs.map +11 -0
  41. package/dist/shared/{stacks-bycy6t9k.js → stacks-rwfgts3s.js} +2 -2
  42. package/dist/shared/{stacks-bycy6t9k.js.map → stacks-rwfgts3s.js.map} +2 -2
  43. package/dist/shared/{stacks-gjvbq6w7.js → stacks-s10yb9gz.js} +2 -2
  44. package/dist/shared/stacks-s10yb9gz.js.map +10 -0
  45. package/dist/shared/{stacks-v3zy6zds.cjs → stacks-s30kkvm8.js} +104 -117
  46. package/dist/shared/stacks-s30kkvm8.js.map +10 -0
  47. package/dist/shared/{stacks-nqytwfcc.js → stacks-s7z5q8be.js} +8 -3
  48. package/dist/shared/stacks-s7z5q8be.js.map +11 -0
  49. package/dist/shared/stacks-v9jqcpd4.js.map +2 -2
  50. package/dist/shared/stacks-vdfag81a.cjs.map +2 -2
  51. package/dist/shared/{stacks-fedzr2ka.js → stacks-wjem3xw9.js} +23 -11
  52. package/dist/shared/stacks-wjem3xw9.js.map +14 -0
  53. package/dist/shared/{stacks-k08tgzyp.cjs → stacks-wyxj879g.cjs} +3 -3
  54. package/dist/shared/stacks-wyxj879g.cjs.map +13 -0
  55. package/dist/shared/stacks-y3dh7hv1.js.map +3 -3
  56. package/dist/shared/{stacks-2ar4prfz.cjs → stacks-y5262j0z.cjs} +14 -5
  57. package/dist/shared/stacks-y5262j0z.cjs.map +11 -0
  58. package/dist/shared/stacks-ya3x01yd.cjs.map +2 -2
  59. package/dist/shared/{stacks-9avax1yf.js → stacks-zf7rbpzp.js} +5 -5
  60. package/dist/shared/stacks-zf7rbpzp.js.map +13 -0
  61. package/dist/shared/{stacks-61rvzkz1.cjs → stacks-znrb59ce.cjs} +41 -29
  62. package/dist/shared/stacks-znrb59ce.cjs.map +17 -0
  63. package/dist/src/accounts/index.cjs +2 -2
  64. package/dist/src/accounts/index.cjs.map +5 -5
  65. package/dist/src/accounts/index.js +4 -8
  66. package/dist/src/accounts/index.js.map +5 -5
  67. package/dist/src/actions/index.d.cts +36 -29
  68. package/dist/src/actions/index.d.ts +36 -29
  69. package/dist/src/actions/index.js +10 -10
  70. package/dist/src/bns/index.cjs +55 -43
  71. package/dist/src/bns/index.cjs.map +9 -9
  72. package/dist/src/bns/index.d.cts +29 -29
  73. package/dist/src/bns/index.d.ts +29 -29
  74. package/dist/src/bns/index.js +66 -54
  75. package/dist/src/bns/index.js.map +9 -9
  76. package/dist/src/clarity/index.js +6 -6
  77. package/dist/src/connect/index.cjs +114 -112
  78. package/dist/src/connect/index.cjs.map +13 -13
  79. package/dist/src/connect/index.js +114 -112
  80. package/dist/src/connect/index.js.map +13 -13
  81. package/dist/src/connect/walletconnect/index.cjs +3 -3
  82. package/dist/src/connect/walletconnect/index.cjs.map +10 -10
  83. package/dist/src/connect/walletconnect/index.js +3 -3
  84. package/dist/src/connect/walletconnect/index.js.map +10 -10
  85. package/dist/src/index.cjs +108 -2
  86. package/dist/src/index.cjs.map +19 -15
  87. package/dist/src/index.d.cts +298 -112
  88. package/dist/src/index.d.ts +298 -112
  89. package/dist/src/index.js +125 -12
  90. package/dist/src/index.js.map +19 -15
  91. package/dist/src/postconditions/index.js +3 -3
  92. package/dist/src/pox/index.cjs.map +6 -6
  93. package/dist/src/pox/index.d.cts +29 -29
  94. package/dist/src/pox/index.d.ts +29 -29
  95. package/dist/src/pox/index.js +9 -9
  96. package/dist/src/pox/index.js.map +6 -6
  97. package/dist/src/stackingdao/index.cjs +31 -6
  98. package/dist/src/stackingdao/index.cjs.map +6 -6
  99. package/dist/src/stackingdao/index.d.cts +29 -29
  100. package/dist/src/stackingdao/index.d.ts +29 -29
  101. package/dist/src/stackingdao/index.js +41 -16
  102. package/dist/src/stackingdao/index.js.map +6 -6
  103. package/dist/src/subscriptions/index.d.cts +29 -29
  104. package/dist/src/subscriptions/index.d.ts +29 -29
  105. package/dist/src/tools/btc/index.cjs +130 -0
  106. package/dist/src/tools/btc/index.cjs.map +10 -0
  107. package/dist/src/tools/btc/index.d.cts +8 -0
  108. package/dist/src/tools/btc/index.d.ts +8 -0
  109. package/dist/src/tools/btc/index.js +89 -0
  110. package/dist/src/tools/btc/index.js.map +10 -0
  111. package/dist/src/tools/index.cjs +2470 -0
  112. package/dist/src/tools/index.cjs.map +61 -0
  113. package/dist/src/tools/index.d.cts +144 -0
  114. package/dist/src/tools/index.d.ts +144 -0
  115. package/dist/src/tools/index.js +2435 -0
  116. package/dist/src/tools/index.js.map +61 -0
  117. package/dist/src/transactions/index.d.cts +7 -0
  118. package/dist/src/transactions/index.d.ts +7 -0
  119. package/dist/src/transactions/index.js +6 -6
  120. package/dist/src/triggers/index.cjs +66 -0
  121. package/dist/src/triggers/index.cjs.map +10 -0
  122. package/dist/src/triggers/index.d.cts +116 -0
  123. package/dist/src/triggers/index.d.ts +116 -0
  124. package/dist/src/triggers/index.js +25 -0
  125. package/dist/src/triggers/index.js.map +10 -0
  126. package/dist/src/tx/index.cjs +65 -0
  127. package/dist/src/tx/index.cjs.map +10 -0
  128. package/dist/src/tx/index.d.cts +42 -0
  129. package/dist/src/tx/index.d.ts +42 -0
  130. package/dist/src/tx/index.js +22 -0
  131. package/dist/src/tx/index.js.map +10 -0
  132. package/dist/src/ui/index.cjs +431 -0
  133. package/dist/src/ui/index.cjs.map +27 -0
  134. package/dist/src/ui/index.d.cts +107 -0
  135. package/dist/src/ui/index.d.ts +107 -0
  136. package/dist/src/ui/index.js +391 -0
  137. package/dist/src/ui/index.js.map +27 -0
  138. package/dist/src/ui/schemas.cjs +134 -0
  139. package/dist/src/ui/schemas.cjs.map +18 -0
  140. package/dist/src/ui/schemas.d.cts +83 -0
  141. package/dist/src/ui/schemas.d.ts +83 -0
  142. package/dist/src/ui/schemas.js +91 -0
  143. package/dist/src/ui/schemas.js.map +18 -0
  144. package/dist/src/utils/index.cjs +3 -3
  145. package/dist/src/utils/index.cjs.map +4 -4
  146. package/dist/src/utils/index.js +7 -7
  147. package/dist/src/utils/index.js.map +4 -4
  148. package/package.json +157 -105
  149. package/dist/shared/stacks-2ar4prfz.cjs.map +0 -11
  150. package/dist/shared/stacks-61rvzkz1.cjs.map +0 -17
  151. package/dist/shared/stacks-9avax1yf.js.map +0 -13
  152. package/dist/shared/stacks-9mdk86wp.js.map +0 -10
  153. package/dist/shared/stacks-an5k8n4t.cjs.map +0 -23
  154. package/dist/shared/stacks-evnzth1q.cjs.map +0 -10
  155. package/dist/shared/stacks-fedzr2ka.js.map +0 -13
  156. package/dist/shared/stacks-gjvbq6w7.js.map +0 -10
  157. package/dist/shared/stacks-k08tgzyp.cjs.map +0 -13
  158. package/dist/shared/stacks-k2p5tv6x.js.map +0 -10
  159. package/dist/shared/stacks-k58k970n.js.map +0 -10
  160. package/dist/shared/stacks-ky14tdf6.cjs.map +0 -13
  161. package/dist/shared/stacks-nqytwfcc.js.map +0 -11
  162. package/dist/shared/stacks-qcx67vqa.js.map +0 -10
  163. package/dist/shared/stacks-qvg7c24g.cjs.map +0 -10
  164. package/dist/shared/stacks-qyt8m5v0.js.map +0 -11
  165. package/dist/shared/stacks-r1t6g3c3.cjs.map +0 -11
  166. package/dist/shared/stacks-v3zy6zds.cjs.map +0 -10
  167. package/dist/shared/stacks-vbke9mqw.cjs.map +0 -15
  168. package/dist/shared/stacks-vd9jcp0b.js.map +0 -23
  169. package/dist/shared/stacks-vyb9rx8q.js.map +0 -15
  170. package/dist/shared/stacks-wrb1es85.js.map +0 -17
  171. package/dist/shared/stacks-yfveb68e.js.map +0 -10
@@ -1,11 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../src/utils/encoding.ts", "../src/utils/c32.ts"],
4
- "sourcesContent": [
5
- "const hexes = Array.from({ length: 256 }, (_, i) => i.toString(16).padStart(2, \"0\"));\n\nexport function bytesToHex(bytes: Uint8Array): string {\n let hex = \"\";\n for (const b of bytes) {\n hex += hexes[b];\n }\n return hex;\n}\n\nexport function hexToBytes(hex: string): Uint8Array {\n hex = without0x(hex);\n if (hex.length % 2) hex = `0${hex}`;\n\n const array = new Uint8Array(hex.length / 2);\n for (let i = 0; i < array.length; i++) {\n const j = i * 2;\n const byte = Number.parseInt(hex.slice(j, j + 2), 16);\n if (Number.isNaN(byte) || byte < 0) throw new Error(\"Invalid byte sequence\");\n array[i] = byte;\n }\n return array;\n}\n\nexport function with0x(value: string): string {\n return /^0x/i.test(value) ? value : `0x${value}`;\n}\n\nexport function without0x(value: string): string {\n return /^0x/i.test(value) ? value.slice(2) : value;\n}\n\nexport function utf8ToBytes(str: string): Uint8Array {\n return new TextEncoder().encode(str);\n}\n\nexport function bytesToUtf8(bytes: Uint8Array): string {\n return new TextDecoder().decode(bytes);\n}\n\nexport function asciiToBytes(str: string): Uint8Array {\n const bytes = new Uint8Array(str.length);\n for (let i = 0; i < str.length; i++) {\n bytes[i] = str.charCodeAt(i) & 0xff;\n }\n return bytes;\n}\n\nexport function bytesToAscii(bytes: Uint8Array): string {\n return String.fromCharCode(...bytes);\n}\n\nexport function concatBytes(...arrays: Uint8Array[]): Uint8Array {\n if (arrays.length === 1) return arrays[0]!;\n const length = arrays.reduce((a, arr) => a + arr.length, 0);\n const result = new Uint8Array(length);\n let pad = 0;\n for (const arr of arrays) {\n result.set(arr, pad);\n pad += arr.length;\n }\n return result;\n}\n\nexport type IntegerType = number | string | bigint | Uint8Array;\n\nexport function intToBigInt(value: IntegerType): bigint {\n if (typeof value === \"bigint\") return value;\n if (typeof value === \"string\") return BigInt(value);\n if (typeof value === \"number\") {\n if (!Number.isInteger(value))\n throw new RangeError(\"Values of type 'number' must be an integer.\");\n if (value > Number.MAX_SAFE_INTEGER)\n throw new RangeError(\n `Values of type 'number' must be <= ${Number.MAX_SAFE_INTEGER}. Use BigInt instead.`\n );\n return BigInt(value);\n }\n if (value instanceof Uint8Array) return BigInt(`0x${bytesToHex(value)}`);\n throw new TypeError(\"Must be a number, bigint, string, or Uint8Array.\");\n}\n\nexport function intToBytes(value: IntegerType, byteLength: number): Uint8Array {\n return bigIntToBytes(intToBigInt(value), byteLength);\n}\n\nexport function bigIntToBytes(value: bigint, length: number = 16): Uint8Array {\n const hex = value.toString(16).padStart(length * 2, \"0\");\n return hexToBytes(hex);\n}\n\nexport function intToHex(integer: IntegerType, byteLength = 8): string {\n const value = typeof integer === \"bigint\" ? integer : intToBigInt(integer);\n return value.toString(16).padStart(byteLength * 2, \"0\");\n}\n\nexport function toTwos(value: bigint, width: bigint): bigint {\n const limit = BigInt(1) << (width - BigInt(1));\n if (value < -limit || value > limit - BigInt(1)) {\n throw new Error(`Unable to represent integer in width: ${width}`);\n }\n if (value >= BigInt(0)) return value;\n return value + (BigInt(1) << width);\n}\n\nexport function fromTwos(value: bigint, width: bigint): bigint {\n if (value & (BigInt(1) << (width - BigInt(1)))) {\n return value - (BigInt(1) << width);\n }\n return value;\n}\n\nexport function bytesToTwosBigInt(bytes: Uint8Array): bigint {\n return fromTwos(BigInt(`0x${bytesToHex(bytes)}`), BigInt(bytes.byteLength * 8));\n}\n\nexport function writeUInt32BE(value: number): Uint8Array {\n const buf = new Uint8Array(4);\n buf[0] = (value >>> 24) & 0xff;\n buf[1] = (value >>> 16) & 0xff;\n buf[2] = (value >>> 8) & 0xff;\n buf[3] = value & 0xff;\n return buf;\n}\n\nexport function readUInt32BE(bytes: Uint8Array, offset = 0): number {\n return (\n ((bytes[offset]! << 24) |\n (bytes[offset + 1]! << 16) |\n (bytes[offset + 2]! << 8) |\n bytes[offset + 3]!) >>>\n 0\n );\n}\n\nexport function writeUInt16BE(value: number): Uint8Array {\n const buf = new Uint8Array(2);\n buf[0] = (value >>> 8) & 0xff;\n buf[1] = value & 0xff;\n return buf;\n}\n\nexport function readUInt16BE(bytes: Uint8Array, offset = 0): number {\n return ((bytes[offset]! << 8) | bytes[offset + 1]!) >>> 0;\n}\n\nexport function writeUInt8(value: number): Uint8Array {\n return new Uint8Array([value & 0xff]);\n}\n",
6
- "import { sha256 } from \"@noble/hashes/sha2.js\";\nimport { bytesToHex, hexToBytes } from \"./encoding.ts\";\n\nconst C32 = \"0123456789ABCDEFGHJKMNPQRSTVWXYZ\";\nconst HEX = \"0123456789abcdef\";\n\nfunction c32normalize(input: string): string {\n return input.toUpperCase().replace(/O/g, \"0\").replace(/L|I/g, \"1\");\n}\n\nfunction c32encode(inputHex: string): string {\n if (inputHex.length % 2 !== 0) inputHex = `0${inputHex}`;\n inputHex = inputHex.toLowerCase();\n\n const res: string[] = [];\n let carry = 0;\n for (let i = inputHex.length - 1; i >= 0; i--) {\n if (carry < 4) {\n const currentCode = HEX.indexOf(inputHex[i]!) >> carry;\n const nextCode = i !== 0 ? HEX.indexOf(inputHex[i - 1]!) : 0;\n const nextBits = 1 + carry;\n const nextLowBits = (nextCode % (1 << nextBits)) << (5 - nextBits);\n res.unshift(C32[currentCode + nextLowBits]!);\n carry = nextBits;\n } else {\n carry = 0;\n }\n }\n\n // Strip leading c32 zeros\n let leadingZeros = 0;\n while (leadingZeros < res.length && res[leadingZeros] === \"0\") leadingZeros++;\n const stripped = res.slice(leadingZeros);\n\n // Preserve leading zero bytes from hex\n const bytes = hexToBytes(inputHex);\n let zeroBytesCount = 0;\n while (zeroBytesCount < bytes.length && bytes[zeroBytesCount] === 0) zeroBytesCount++;\n const prefix = Array(zeroBytesCount).fill(C32[0]) as string[];\n\n return [...prefix, ...stripped].join(\"\");\n}\n\nfunction c32decode(c32input: string): string {\n c32input = c32normalize(c32input);\n if (!c32input.match(`^[${C32}]*$`)) throw new Error(\"Not a c32-encoded string\");\n\n const zeroPrefix = c32input.match(`^${C32[0]}*`);\n const numLeadingZeroBytes = zeroPrefix ? zeroPrefix[0]!.length : 0;\n\n const res: string[] = [];\n let carry = 0;\n let carryBits = 0;\n for (let i = c32input.length - 1; i >= 0; i--) {\n if (carryBits === 4) {\n res.unshift(HEX[carry]!);\n carryBits = 0;\n carry = 0;\n }\n const currentValue = (C32.indexOf(c32input[i]!) << carryBits) + carry;\n res.unshift(HEX[currentValue % 16]!);\n carryBits += 1;\n carry = currentValue >> 4;\n if (carry > 1 << carryBits) throw new Error(\"Panic error in c32 decoding\");\n }\n res.unshift(HEX[carry]!);\n\n if (res.length % 2 === 1) res.unshift(\"0\");\n\n // Strip leading hex zeros\n let hexLeadingZeros = 0;\n while (hexLeadingZeros < res.length && res[hexLeadingZeros] === \"0\") hexLeadingZeros++;\n let hexStr = res.slice(hexLeadingZeros - (hexLeadingZeros % 2)).join(\"\");\n\n for (let i = 0; i < numLeadingZeroBytes; i++) hexStr = `00${hexStr}`;\n\n return hexStr;\n}\n\nfunction c32checksum(dataHex: string): string {\n return bytesToHex(sha256(sha256(hexToBytes(dataHex))).slice(0, 4));\n}\n\nfunction c32checkEncode(version: number, data: string): string {\n if (version < 0 || version >= 32) throw new Error(\"Invalid version (must be between 0 and 31)\");\n if (!data.match(/^[0-9a-fA-F]*$/)) throw new Error(\"Invalid data (not a hex string)\");\n\n data = data.toLowerCase();\n if (data.length % 2 !== 0) data = `0${data}`;\n\n let versionHex = version.toString(16);\n if (versionHex.length === 1) versionHex = `0${versionHex}`;\n\n const checksumHex = c32checksum(`${versionHex}${data}`);\n return `${C32[version]}${c32encode(`${data}${checksumHex}`)}`;\n}\n\nfunction c32checkDecode(c32data: string): [number, string] {\n c32data = c32normalize(c32data);\n const dataHex = c32decode(c32data.slice(1));\n const version = C32.indexOf(c32data[0]!);\n const checksum = dataHex.slice(-8);\n\n let versionHex = version.toString(16);\n if (versionHex.length === 1) versionHex = `0${versionHex}`;\n\n if (c32checksum(`${versionHex}${dataHex.substring(0, dataHex.length - 8)}`) !== checksum) {\n throw new Error(\"Invalid c32check string: checksum mismatch\");\n }\n\n return [version, dataHex.substring(0, dataHex.length - 8)];\n}\n\nexport function c32address(version: number, hash160hex: string): string {\n if (!hash160hex.match(/^[0-9a-fA-F]{40}$/)) {\n throw new Error(\"Invalid argument: not a hash160 hex string\");\n }\n return `S${c32checkEncode(version, hash160hex)}`;\n}\n\nexport function c32addressDecode(c32addr: string): [number, string] {\n if (c32addr.length <= 5) throw new Error(\"Invalid c32 address: invalid length\");\n if (c32addr[0] !== \"S\") throw new Error('Invalid c32 address: must start with \"S\"');\n return c32checkDecode(c32addr.slice(1));\n}\n"
7
- ],
8
- "mappings": ";AAAA,IAAM,QAAQ,MAAM,KAAK,EAAE,QAAQ,IAAI,GAAG,CAAC,GAAG,MAAM,EAAE,SAAS,EAAE,EAAE,SAAS,GAAG,GAAG,CAAC;AAE5E,SAAS,UAAU,CAAC,OAA2B;AAAA,EACpD,IAAI,MAAM;AAAA,EACV,WAAW,KAAK,OAAO;AAAA,IACrB,OAAO,MAAM;AAAA,EACf;AAAA,EACA,OAAO;AAAA;AAGF,SAAS,UAAU,CAAC,KAAyB;AAAA,EAClD,MAAM,UAAU,GAAG;AAAA,EACnB,IAAI,IAAI,SAAS;AAAA,IAAG,MAAM,IAAI;AAAA,EAE9B,MAAM,QAAQ,IAAI,WAAW,IAAI,SAAS,CAAC;AAAA,EAC3C,SAAS,IAAI,EAAG,IA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,MAAM,qCAAqC;AAAA,EAC9E,IAAI,QAAQ,OAAO;AAAA,IAAK,MAAM,IAAI,MAAM,0CAA0C;AAAA,EAClF,OAAO,eAAe,QAAQ,MAAM,CAAC,CAAC;AAAA;",
9
- "debugId": "8867D374DFC77CCA64756E2164756E21",
10
- "names": []
11
- }
@@ -1,10 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../src/transactions/wire/deserialize.ts"],
4
- "sourcesContent": [
5
- "import {\n bytesToHex,\n hexToBytes,\n bytesToAscii,\n bytesToUtf8,\n without0x,\n} from \"../../utils/encoding.ts\";\nimport { c32address } from \"../../utils/c32.ts\";\nimport {\n AuthType,\n PayloadType,\n AddressHashMode,\n PostConditionPrincipalId,\n AssetType,\n RECOVERABLE_ECDSA_SIG_LENGTH_BYTES,\n MEMO_MAX_LENGTH_BYTES,\n COINBASE_BYTES_LENGTH,\n VRF_PROOF_BYTES_LENGTH,\n MICROBLOCK_HEADER_BYTES_LENGTH,\n type StacksTransaction,\n type Authorization,\n type SpendingCondition,\n type TransactionPayload,\n type PostConditionWire,\n type PostConditionPrincipalWire,\n type AssetInfoWire,\n type TransactionAuthField,\n type AnchorMode,\n type PostConditionModeWire,\n type ClarityVersion,\n type TenureChangeCause,\n} from \"../types.ts\";\nimport type { ClarityValue } from \"../../clarity/types.ts\";\nimport { clarityTypeFromByte } from \"../../clarity/types.ts\";\nimport {\n intCV,\n uintCV,\n trueCV,\n falseCV,\n bufferCV,\n noneCV,\n someCV,\n responseOkCV,\n responseErrorCV,\n standardPrincipalCV,\n contractPrincipalCV,\n listCV,\n tupleCV,\n stringAsciiCV,\n stringUtf8CV,\n} from \"../../clarity/values.ts\";\nimport { bytesToTwosBigInt } from \"../../utils/encoding.ts\";\n\nclass Reader {\n private data: Uint8Array;\n public offset = 0;\n\n constructor(data: Uint8Array) {\n this.data = data;\n }\n\n readUInt8(): number {\n return this.data[this.offset++]!;\n }\n\n readUInt16BE(): number {\n const val = ((this.data[this.offset]! << 8) | this.data[this.offset + 1]!) >>> 0;\n this.offset += 2;\n return val;\n }\n\n readUInt32BE(): number {\n const val =\n ((this.data[this.offset]! << 24) |\n (this.data[this.offset + 1]! << 16) |\n (this.data[this.offset + 2]! << 8) |\n this.data[this.offset + 3]!) >>>\n 0;\n this.offset += 4;\n return val;\n }\n\n readBytes(length: number): Uint8Array {\n const slice = this.data.slice(this.offset, this.offset + length);\n this.offset += length;\n return slice;\n }\n\n readBigUInt64BE(): bigint {\n return BigInt(`0x${bytesToHex(this.readBytes(8))}`);\n }\n}\n\nfunction readAddress(r: Reader): string {\n const version = r.readUInt8();\n const hash160 = bytesToHex(r.readBytes(20));\n return c32address(version, hash160);\n}\n\nfunction readLPString(r: Reader, prefixBytes = 1): string {\n let length = 0;\n for (let i = 0; i < prefixBytes; i++) {\n length = (length << 8) | r.readUInt8();\n }\n return bytesToUtf8(r.readBytes(length));\n}\n\nfunction readCV(r: Reader): ClarityValue {\n const typeByte = r.readUInt8();\n const type = clarityTypeFromByte(typeByte);\n\n switch (type) {\n case \"int\":\n return intCV(bytesToTwosBigInt(r.readBytes(16)));\n case \"uint\":\n return uintCV(r.readBytes(16));\n case \"true\":\n return trueCV();\n case \"false\":\n return falseCV();\n case \"buffer\": {\n const len = r.readUInt32BE();\n return bufferCV(r.readBytes(len));\n }\n case \"none\":\n return noneCV();\n case \"some\":\n return someCV(readCV(r));\n case \"ok\":\n return responseOkCV(readCV(r));\n case \"err\":\n return responseErrorCV(readCV(r));\n case \"address\":\n return standardPrincipalCV(readAddress(r));\n case \"contract\": {\n const addr = readAddress(r);\n const name = readLPString(r);\n return contractPrincipalCV(addr, name);\n }\n case \"list\": {\n const len = r.readUInt32BE();\n const items: ClarityValue[] = [];\n for (let i = 0; i < len; i++) items.push(readCV(r));\n return listCV(items);\n }\n case \"tuple\": {\n const len = r.readUInt32BE();\n const data: Record<string, ClarityValue> = {};\n for (let i = 0; i < len; i++) {\n const key = readLPString(r);\n data[key] = readCV(r);\n }\n return tupleCV(data);\n }\n case \"ascii\": {\n const len = r.readUInt32BE();\n return stringAsciiCV(bytesToAscii(r.readBytes(len)));\n }\n case \"utf8\": {\n const len = r.readUInt32BE();\n return stringUtf8CV(bytesToUtf8(r.readBytes(len)));\n }\n default:\n throw new Error(`Unknown clarity type: ${type}`);\n }\n}\n\nfunction readSpendingCondition(r: Reader): SpendingCondition {\n const hashMode = r.readUInt8();\n const signer = bytesToHex(r.readBytes(20));\n const nonce = r.readBigUInt64BE();\n const fee = r.readBigUInt64BE();\n\n if (hashMode === AddressHashMode.P2PKH || hashMode === AddressHashMode.P2WPKH) {\n const keyEncoding = r.readUInt8();\n const signature = bytesToHex(r.readBytes(RECOVERABLE_ECDSA_SIG_LENGTH_BYTES));\n return { hashMode, signer, nonce, fee, keyEncoding, signature } as SpendingCondition;\n }\n\n const fieldCount = r.readUInt32BE();\n const fields: TransactionAuthField[] = [];\n for (let i = 0; i < fieldCount; i++) {\n const fieldType = r.readUInt8();\n if (fieldType <= 0x01) {\n const keyLen = fieldType === 0x00 ? 33 : 65;\n fields.push({\n type: \"publicKey\",\n pubKeyEncoding: fieldType as 0x00 | 0x01,\n data: bytesToHex(r.readBytes(keyLen)),\n });\n } else {\n fields.push({\n type: \"signature\",\n pubKeyEncoding: (fieldType === 0x02 ? 0x00 : 0x01) as 0x00 | 0x01,\n data: bytesToHex(r.readBytes(RECOVERABLE_ECDSA_SIG_LENGTH_BYTES)),\n });\n }\n }\n const signaturesRequired = r.readUInt16BE();\n\n return { hashMode, signer, nonce, fee, fields, signaturesRequired } as SpendingCondition;\n}\n\nfunction readAuthorization(r: Reader): Authorization {\n const authType = r.readUInt8();\n const spendingCondition = readSpendingCondition(r);\n\n if (authType === AuthType.Standard) {\n return { authType: AuthType.Standard, spendingCondition };\n }\n\n const sponsorSpendingCondition = readSpendingCondition(r);\n return {\n authType: AuthType.Sponsored,\n spendingCondition,\n sponsorSpendingCondition,\n };\n}\n\nfunction readAssetInfo(r: Reader): AssetInfoWire {\n return {\n address: readAddress(r),\n contractName: readLPString(r),\n assetName: readLPString(r),\n };\n}\n\nfunction readPostConditionPrincipal(r: Reader): PostConditionPrincipalWire {\n const type = r.readUInt8();\n switch (type) {\n case PostConditionPrincipalId.Origin:\n return { type: \"origin\" };\n case PostConditionPrincipalId.Standard:\n return { type: \"standard\", address: readAddress(r) };\n case PostConditionPrincipalId.Contract:\n return { type: \"contract\", address: readAddress(r), contractName: readLPString(r) };\n default:\n throw new Error(`Unknown post condition principal type: ${type}`);\n }\n}\n\nfunction readPostConditions(r: Reader): PostConditionWire[] {\n const count = r.readUInt32BE();\n const pcs: PostConditionWire[] = [];\n for (let i = 0; i < count; i++) {\n const principal = readPostConditionPrincipal(r);\n const assetType = r.readUInt8();\n switch (assetType) {\n case AssetType.STX:\n pcs.push({ type: \"stx\", principal, conditionCode: r.readUInt8(), amount: r.readBigUInt64BE() });\n break;\n case AssetType.Fungible:\n pcs.push({ type: \"ft\", principal, asset: readAssetInfo(r), conditionCode: r.readUInt8(), amount: r.readBigUInt64BE() });\n break;\n case AssetType.NonFungible:\n pcs.push({ type: \"nft\", principal, asset: readAssetInfo(r), assetId: readCV(r), conditionCode: r.readUInt8() });\n break;\n }\n }\n return pcs;\n}\n\nfunction readPayload(r: Reader): TransactionPayload {\n const payloadType = r.readUInt8();\n\n switch (payloadType) {\n case PayloadType.TokenTransfer: {\n const recipient = readCV(r);\n const amount = r.readBigUInt64BE();\n const memoContentLen = r.readUInt8();\n const memoBytes = r.readBytes(MEMO_MAX_LENGTH_BYTES);\n const memo = bytesToAscii(memoBytes.slice(0, memoContentLen)).replace(/\\0+$/, \"\");\n return { payloadType: PayloadType.TokenTransfer, recipient, amount, memo };\n }\n case PayloadType.ContractCall: {\n const contractAddress = readAddress(r);\n const contractName = readLPString(r);\n const functionName = readLPString(r);\n const numArgs = r.readUInt32BE();\n const functionArgs: ClarityValue[] = [];\n for (let i = 0; i < numArgs; i++) functionArgs.push(readCV(r));\n return { payloadType: PayloadType.ContractCall, contractAddress, contractName, functionName, functionArgs };\n }\n case PayloadType.SmartContract: {\n const contractName = readLPString(r);\n const codeBody = readLPString(r, 4);\n return { payloadType: PayloadType.SmartContract, contractName, codeBody };\n }\n case PayloadType.VersionedSmartContract: {\n const clarityVersion = r.readUInt8() as ClarityVersion;\n const contractName = readLPString(r);\n const codeBody = readLPString(r, 4);\n return { payloadType: PayloadType.VersionedSmartContract, clarityVersion, contractName, codeBody };\n }\n case PayloadType.Coinbase: {\n const coinbaseBuffer = bytesToHex(r.readBytes(COINBASE_BYTES_LENGTH));\n return { payloadType: PayloadType.Coinbase, coinbaseBuffer };\n }\n case PayloadType.CoinbaseToAltRecipient: {\n const coinbaseBuffer = bytesToHex(r.readBytes(COINBASE_BYTES_LENGTH));\n const recipient = readCV(r);\n return { payloadType: PayloadType.CoinbaseToAltRecipient, coinbaseBuffer, recipient };\n }\n case PayloadType.PoisonMicroblock: {\n const header1 = bytesToHex(r.readBytes(MICROBLOCK_HEADER_BYTES_LENGTH));\n const header2 = bytesToHex(r.readBytes(MICROBLOCK_HEADER_BYTES_LENGTH));\n return { payloadType: PayloadType.PoisonMicroblock, header1, header2 };\n }\n case PayloadType.TenureChange: {\n const tenureConsensusHash = bytesToHex(r.readBytes(20));\n const prevTenureConsensusHash = bytesToHex(r.readBytes(20));\n const burnViewConsensusHash = bytesToHex(r.readBytes(20));\n const previousTenureEnd = bytesToHex(r.readBytes(32));\n const previousTenureBlocks = r.readUInt32BE();\n const cause = r.readUInt8() as TenureChangeCause;\n const pubkeyHash = bytesToHex(r.readBytes(20));\n return {\n payloadType: PayloadType.TenureChange,\n tenureConsensusHash,\n prevTenureConsensusHash,\n burnViewConsensusHash,\n previousTenureEnd,\n previousTenureBlocks,\n cause,\n pubkeyHash,\n };\n }\n case PayloadType.NakamotoCoinbase: {\n const coinbaseBuffer = bytesToHex(r.readBytes(COINBASE_BYTES_LENGTH));\n const optionalCV = readCV(r);\n const recipient = optionalCV.type === \"none\" ? null : optionalCV.type === \"some\" ? optionalCV.value : optionalCV;\n const vrfProof = bytesToHex(r.readBytes(VRF_PROOF_BYTES_LENGTH));\n return { payloadType: PayloadType.NakamotoCoinbase, coinbaseBuffer, recipient, vrfProof };\n }\n default:\n throw new Error(`Unknown payload type: ${payloadType}`);\n }\n}\n\nexport function deserializeTransaction(input: string | Uint8Array): StacksTransaction {\n const bytes = typeof input === \"string\" ? hexToBytes(without0x(input)) : input;\n const r = new Reader(bytes);\n\n return {\n version: r.readUInt8(),\n chainId: r.readUInt32BE(),\n auth: readAuthorization(r),\n anchorMode: r.readUInt8() as AnchorMode,\n postConditionMode: r.readUInt8() as PostConditionModeWire,\n postConditions: readPostConditions(r),\n payload: readPayload(r),\n };\n}\n"
6
- ],
7
- "mappings": ";AAqDA,MAAM,OAAO;AAAA,EACH;AAAA,EACD,SAAS;AAAA,EAEhB,WAAW,CAAC,MAAkB;AAAA,IAC5B,KAAK,OAAO;AAAA;AAAA,EAGd,SAAS,GAAW;AAAA,IAClB,OAAO,KAAK,KAAK,KAAK;AAAA;AAAA,EAGxB,YAAY,GAAW;AAAA,IACrB,MAAM,OAAQ,KAAK,KAAK,KAAK,WAAY,IAAK,KAAK,KAAK,KAAK,SAAS,QAAS;AAAA,IAC/E,KAAK,UAAU;AAAA,IACf,OAAO;AAAA;AAAA,EAGT,YAAY,GAAW;AAAA,IACrB,MAAM,OACF,KAAK,KAAK,KAAK,WAAY,KAC1B,KAAK,KAAK,KAAK,SAAS,MAAO,KAC/B,KAAK,KAAK,KAAK,SAAS,MAAO,IAChC,KAAK,KAAK,KAAK,SAAS,QAC1B;AAAA,IACF,KAAK,UAAU;AAAA,IACf,OAAO;AAAA;AAAA,EAGT,SAAS,CAAC,QAA4B;AAAA,IACpC,MAAM,QAAQ,KAAK,KAAK,MAAM,KAAK,QAAQ,KAAK,SAAS,MAAM;AAAA,IAC/D,KAAK,UAAU;AAAA,IACf,OAAO;AAAA;AAAA,EAGT,eAAe,GAAW;AAAA,IACxB,OAAO,OAAO,KA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EE,MAAM,IAAI,MAAM,yBAAyB,aAAa;AAAA;AAAA;AAIrD,SAAS,sBAAsB,CAAC,OAA+C;AAAA,EACpF,MAAM,QAAQ,OAAO,UAAU,WAAW,WAAW,UAAU,KAAK,CAAC,IAAI;AAAA,EACzE,MAAM,IAAI,IAAI,OAAO,KAAK;AAAA,EAE1B,OAAO;AAAA,IACL,SAAS,EAAE,UAAU;AAAA,IACrB,SAAS,EAAE,aAAa;AAAA,IACxB,MAAM,kBAAkB,CAAC;AAAA,IACzB,YAAY,EAAE,UAAU;AAAA,IACxB,mBAAmB,EAAE,UAAU;AAAA,IAC/B,gBAAgB,mBAAmB,CAAC;AAAA,IACpC,SAAS,YAAY,CAAC;AAAA,EACxB;AAAA;",
8
- "debugId": "2951E64B5A5D8D3264756E2164756E21",
9
- "names": []
10
- }
@@ -1,15 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../src/transactions/types.ts", "../src/transactions/wire/serialize.ts", "../src/transactions/authorization.ts", "../src/transactions/multisig.ts", "../src/transactions/signer.ts", "../src/transactions/build.ts"],
4
- "sourcesContent": [
5
- "import type { ClarityValue } from \"../clarity/types.ts\";\n\n// Auth types\nexport const AuthType = {\n Standard: 0x04,\n Sponsored: 0x05,\n} as const;\nexport type AuthType = (typeof AuthType)[keyof typeof AuthType];\n\n// Payload types\nexport const PayloadType = {\n TokenTransfer: 0x00,\n SmartContract: 0x01,\n ContractCall: 0x02,\n PoisonMicroblock: 0x03,\n Coinbase: 0x04,\n CoinbaseToAltRecipient: 0x05,\n VersionedSmartContract: 0x06,\n TenureChange: 0x07,\n NakamotoCoinbase: 0x08,\n} as const;\nexport type PayloadType = (typeof PayloadType)[keyof typeof PayloadType];\n\n// Clarity version\nexport const ClarityVersion = {\n Clarity1: 1,\n Clarity2: 2,\n Clarity3: 3,\n} as const;\nexport type ClarityVersion = (typeof ClarityVersion)[keyof typeof ClarityVersion];\n\n// Anchor mode (deprecated post-Nakamoto, but needed for wire format)\nexport const AnchorMode = {\n OnChainOnly: 0x01,\n OffChainOnly: 0x02,\n Any: 0x03,\n} as const;\nexport type AnchorMode = (typeof AnchorMode)[keyof typeof AnchorMode];\n\n// Post condition mode\nexport const PostConditionModeWire = {\n Allow: 0x01,\n Deny: 0x02,\n} as const;\nexport type PostConditionModeWire =\n (typeof PostConditionModeWire)[keyof typeof PostConditionModeWire];\n\n// Address hash modes\nexport const AddressHashMode = {\n P2PKH: 0x00,\n P2SH: 0x01,\n P2WPKH: 0x02,\n P2WSH: 0x03,\n P2SH_NonSequential: 0x05, // SIP-027\n P2WSH_P2SH_NonSequential: 0x07, // SIP-027\n} as const;\nexport type AddressHashMode = (typeof AddressHashMode)[keyof typeof AddressHashMode];\n\n// Pub key encoding\nexport const PubKeyEncoding = {\n Compressed: 0x00,\n Uncompressed: 0x01,\n} as const;\nexport type PubKeyEncoding = (typeof PubKeyEncoding)[keyof typeof PubKeyEncoding];\n\n// Fungible condition codes (wire format)\nexport const FungibleConditionCode = {\n Equal: 0x01,\n Greater: 0x02,\n GreaterEqual: 0x03,\n Less: 0x04,\n LessEqual: 0x05,\n} as const;\n\n// Non-fungible condition codes (wire format)\nexport const NonFungibleConditionCode = {\n Sends: 0x10,\n DoesNotSend: 0x11,\n} as const;\n\n// Post condition principal types\nexport const PostConditionPrincipalId = {\n Origin: 0x01,\n Standard: 0x02,\n Contract: 0x03,\n} as const;\n\n// Post condition asset types\nexport const AssetType = {\n STX: 0x00,\n Fungible: 0x01,\n NonFungible: 0x02,\n} as const;\n\n// Auth field types\nexport const AuthFieldType = {\n PublicKeyCompressed: 0x00,\n PublicKeyUncompressed: 0x01,\n SignatureCompressed: 0x02,\n SignatureUncompressed: 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 BlockFound: 0x00,\n Extended: 0x01,\n} as const;\nexport type TenureChangeCause = (typeof TenureChangeCause)[keyof typeof TenureChangeCause];\n\n// Token transfer payload\nexport type TokenTransferPayload = {\n payloadType: typeof PayloadType.TokenTransfer;\n recipient: ClarityValue; // PrincipalCV\n amount: bigint;\n memo: string;\n};\n\n// Contract call payload\nexport type ContractCallPayload = {\n payloadType: typeof PayloadType.ContractCall;\n contractAddress: string;\n contractName: string;\n functionName: string;\n functionArgs: ClarityValue[];\n};\n\n// Smart contract deploy payload\nexport type SmartContractPayload = {\n payloadType: typeof PayloadType.SmartContract | typeof PayloadType.VersionedSmartContract;\n clarityVersion?: ClarityVersion;\n contractName: string;\n codeBody: string;\n};\n\n// Coinbase payload (appears in every pre-Nakamoto block)\nexport type CoinbasePayload = {\n payloadType: typeof PayloadType.Coinbase;\n coinbaseBuffer: string; // 32 bytes hex\n};\n\n// Coinbase to alt recipient payload\nexport type CoinbaseToAltRecipientPayload = {\n payloadType: typeof PayloadType.CoinbaseToAltRecipient;\n coinbaseBuffer: string; // 32 bytes hex\n recipient: ClarityValue; // PrincipalCV\n};\n\n// Poison microblock payload\nexport type PoisonMicroblockPayload = {\n payloadType: typeof PayloadType.PoisonMicroblock;\n header1: string; // 132 bytes hex (raw microblock header)\n header2: string; // 132 bytes hex (raw microblock header)\n};\n\n// Tenure change payload (Nakamoto)\nexport type TenureChangePayload = {\n payloadType: typeof PayloadType.TenureChange;\n tenureConsensusHash: string; // 20 bytes hex\n prevTenureConsensusHash: string; // 20 bytes hex\n burnViewConsensusHash: string; // 20 bytes hex\n previousTenureEnd: string; // 32 bytes hex\n previousTenureBlocks: number; // u32\n cause: TenureChangeCause;\n pubkeyHash: string; // 20 bytes hex\n};\n\n// Nakamoto coinbase payload\nexport type NakamotoCoinbasePayload = {\n payloadType: typeof PayloadType.NakamotoCoinbase;\n coinbaseBuffer: string; // 32 bytes hex\n recipient: ClarityValue | null; // Optional PrincipalCV\n vrfProof: string; // 80 bytes hex\n};\n\nexport type TransactionPayload =\n | TokenTransferPayload\n | ContractCallPayload\n | SmartContractPayload\n | CoinbasePayload\n | CoinbaseToAltRecipientPayload\n | PoisonMicroblockPayload\n | TenureChangePayload\n | NakamotoCoinbasePayload;\n\n// Spending condition\nexport type SingleSigSpendingCondition = {\n hashMode: typeof AddressHashMode.P2PKH | typeof AddressHashMode.P2WPKH;\n signer: string; // hash160 hex\n nonce: bigint;\n fee: bigint;\n keyEncoding: PubKeyEncoding;\n signature: string; // 65-byte recoverable sig hex\n};\n\nexport type TransactionAuthField = {\n pubKeyEncoding: PubKeyEncoding;\n type: \"publicKey\" | \"signature\";\n data: string; // hex\n};\n\nexport type MultiSigHashMode =\n | typeof AddressHashMode.P2SH\n | typeof AddressHashMode.P2WSH\n | typeof AddressHashMode.P2SH_NonSequential\n | typeof AddressHashMode.P2WSH_P2SH_NonSequential;\n\nexport type MultiSigSpendingCondition = {\n hashMode: MultiSigHashMode;\n signer: string;\n nonce: bigint;\n fee: bigint;\n fields: TransactionAuthField[];\n signaturesRequired: number;\n};\n\nexport type SpendingCondition = SingleSigSpendingCondition | MultiSigSpendingCondition;\n\nexport type StandardAuthorization = {\n authType: typeof AuthType.Standard;\n spendingCondition: SpendingCondition;\n};\n\nexport type SponsoredAuthorization = {\n authType: typeof AuthType.Sponsored;\n spendingCondition: SpendingCondition;\n sponsorSpendingCondition: SpendingCondition;\n};\n\nexport type Authorization = StandardAuthorization | SponsoredAuthorization;\n\n// Full transaction\nexport type StacksTransaction = {\n version: number;\n chainId: number;\n auth: Authorization;\n anchorMode: AnchorMode;\n postConditionMode: PostConditionModeWire;\n postConditions: PostConditionWire[];\n payload: TransactionPayload;\n};\n\n// Wire post condition types\nexport type PostConditionWire = StxPostConditionWire | FtPostConditionWire | NftPostConditionWire;\n\nexport type StxPostConditionWire = {\n type: \"stx\";\n principal: PostConditionPrincipalWire;\n conditionCode: number;\n amount: bigint;\n};\n\nexport type FtPostConditionWire = {\n type: \"ft\";\n principal: PostConditionPrincipalWire;\n asset: AssetInfoWire;\n conditionCode: number;\n amount: bigint;\n};\n\nexport type NftPostConditionWire = {\n type: \"nft\";\n principal: PostConditionPrincipalWire;\n asset: AssetInfoWire;\n conditionCode: number;\n assetId: ClarityValue;\n};\n\nexport type PostConditionPrincipalWire =\n | { type: \"origin\" }\n | { type: \"standard\"; address: string }\n | { type: \"contract\"; address: string; contractName: string };\n\nexport type AssetInfoWire = {\n address: string;\n contractName: string;\n assetName: string;\n};\n",
6
- "import {\n bytesToHex,\n hexToBytes,\n concatBytes,\n intToBytes,\n intToHex,\n utf8ToBytes,\n asciiToBytes,\n writeUInt32BE,\n writeUInt16BE,\n writeUInt8,\n} from \"../../utils/encoding.ts\";\nimport { c32addressDecode } from \"../../utils/c32.ts\";\nimport { serializeCVBytes } from \"../../clarity/serialize.ts\";\nimport {\n AuthType,\n PayloadType,\n PostConditionPrincipalId,\n AssetType,\n MEMO_MAX_LENGTH_BYTES,\n type StacksTransaction,\n type Authorization,\n type SpendingCondition,\n type SingleSigSpendingCondition,\n type MultiSigSpendingCondition,\n type TransactionPayload,\n type PostConditionWire,\n type PostConditionPrincipalWire,\n type AssetInfoWire,\n type TransactionAuthField,\n type CoinbasePayload,\n type CoinbaseToAltRecipientPayload,\n type PoisonMicroblockPayload,\n type TenureChangePayload as TenureChangePayloadType,\n type NakamotoCoinbasePayload,\n} from \"../types.ts\";\n\n// Address serialization: version (1 byte) + hash160 (20 bytes)\nfunction serializeAddress(c32Address: string): Uint8Array {\n const [version, hash160] = c32addressDecode(c32Address);\n return 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 const content = utf8ToBytes(str);\n const prefix = hexToBytes(intToHex(content.byteLength, prefixBytes));\n return concatBytes(prefix, content);\n}\n\n// LP string for code body (4-byte prefix)\nfunction serializeLPStringLong(str: string): Uint8Array {\n return serializeLPString(str, 4);\n}\n\n// Memo: padded to MEMO_MAX_LENGTH_BYTES\nfunction serializeMemo(memo: string): Uint8Array {\n const content = asciiToBytes(memo);\n const padded = new Uint8Array(MEMO_MAX_LENGTH_BYTES);\n padded.set(content.slice(0, MEMO_MAX_LENGTH_BYTES));\n return concatBytes(writeUInt8(content.length), padded);\n}\n\nfunction serializeSpendingCondition(condition: SpendingCondition): Uint8Array {\n const parts: Uint8Array[] = [\n writeUInt8(condition.hashMode),\n hexToBytes(condition.signer), // 20 bytes\n intToBytes(condition.nonce, 8),\n intToBytes(condition.fee, 8),\n ];\n\n if (\"signature\" in condition) {\n // Single sig\n const sc = condition as SingleSigSpendingCondition;\n parts.push(writeUInt8(sc.keyEncoding));\n parts.push(hexToBytes(sc.signature)); // 65 bytes\n } else {\n // Multi sig\n const mc = condition as MultiSigSpendingCondition;\n // Fields as LP list\n parts.push(writeUInt32BE(mc.fields.length));\n for (const field of mc.fields) {\n parts.push(serializeAuthField(field));\n }\n parts.push(writeUInt16BE(mc.signaturesRequired));\n }\n\n return concatBytes(...parts);\n}\n\nfunction serializeAuthField(field: TransactionAuthField): Uint8Array {\n if (field.type === \"publicKey\") {\n const typeId = field.pubKeyEncoding === 0x00 ? 0x00 : 0x01;\n return concatBytes(writeUInt8(typeId), hexToBytes(field.data));\n } else {\n const typeId = field.pubKeyEncoding === 0x00 ? 0x02 : 0x03;\n return concatBytes(writeUInt8(typeId), hexToBytes(field.data));\n }\n}\n\nfunction serializeAuthorization(auth: Authorization): Uint8Array {\n const parts: Uint8Array[] = [writeUInt8(auth.authType)];\n parts.push(serializeSpendingCondition(auth.spendingCondition));\n if (auth.authType === AuthType.Sponsored) {\n parts.push(serializeSpendingCondition(auth.sponsorSpendingCondition));\n }\n return concatBytes(...parts);\n}\n\nfunction serializePrincipal(principal: PostConditionPrincipalWire): Uint8Array {\n switch (principal.type) {\n case \"origin\":\n return writeUInt8(PostConditionPrincipalId.Origin);\n case \"standard\":\n return concatBytes(\n writeUInt8(PostConditionPrincipalId.Standard),\n serializeAddress(principal.address)\n );\n case \"contract\":\n return concatBytes(\n writeUInt8(PostConditionPrincipalId.Contract),\n serializeAddress(principal.address),\n serializeLPString(principal.contractName)\n );\n }\n}\n\nfunction serializeAssetInfo(asset: AssetInfoWire): Uint8Array {\n return concatBytes(\n serializeAddress(asset.address),\n serializeLPString(asset.contractName),\n serializeLPString(asset.assetName)\n );\n}\n\nfunction serializePostCondition(pc: PostConditionWire): Uint8Array {\n const parts: Uint8Array[] = [serializePrincipal(pc.principal)];\n\n switch (pc.type) {\n case \"stx\":\n parts.push(writeUInt8(AssetType.STX));\n parts.push(writeUInt8(pc.conditionCode));\n parts.push(intToBytes(pc.amount, 8));\n break;\n case \"ft\":\n parts.push(writeUInt8(AssetType.Fungible));\n parts.push(serializeAssetInfo(pc.asset));\n parts.push(writeUInt8(pc.conditionCode));\n parts.push(intToBytes(pc.amount, 8));\n break;\n case \"nft\":\n parts.push(writeUInt8(AssetType.NonFungible));\n parts.push(serializeAssetInfo(pc.asset));\n parts.push(serializeCVBytes(pc.assetId));\n parts.push(writeUInt8(pc.conditionCode));\n break;\n }\n\n return concatBytes(...parts);\n}\n\nfunction serializePostConditions(pcs: PostConditionWire[]): Uint8Array {\n const parts: Uint8Array[] = [writeUInt32BE(pcs.length)];\n for (const pc of pcs) {\n parts.push(serializePostCondition(pc));\n }\n return concatBytes(...parts);\n}\n\nexport function serializePayload(payload: TransactionPayload): Uint8Array {\n const parts: Uint8Array[] = [writeUInt8(payload.payloadType)];\n\n switch (payload.payloadType) {\n case PayloadType.TokenTransfer:\n parts.push(serializeCVBytes(payload.recipient));\n parts.push(intToBytes(payload.amount, 8));\n parts.push(serializeMemo(payload.memo));\n break;\n\n case PayloadType.ContractCall:\n parts.push(serializeAddress(payload.contractAddress));\n parts.push(serializeLPString(payload.contractName));\n parts.push(serializeLPString(payload.functionName));\n parts.push(writeUInt32BE(payload.functionArgs.length));\n for (const arg of payload.functionArgs) {\n parts.push(serializeCVBytes(arg));\n }\n break;\n\n case PayloadType.SmartContract:\n parts.push(serializeLPString(payload.contractName));\n parts.push(serializeLPStringLong(payload.codeBody));\n break;\n\n case PayloadType.VersionedSmartContract:\n parts.push(writeUInt8(payload.clarityVersion ?? 2));\n parts.push(serializeLPString(payload.contractName));\n parts.push(serializeLPStringLong(payload.codeBody));\n break;\n\n case PayloadType.Coinbase:\n parts.push(hexToBytes((payload as CoinbasePayload).coinbaseBuffer));\n break;\n\n case PayloadType.CoinbaseToAltRecipient: {\n const cbAlt = payload as CoinbaseToAltRecipientPayload;\n parts.push(hexToBytes(cbAlt.coinbaseBuffer));\n parts.push(serializeCVBytes(cbAlt.recipient));\n break;\n }\n\n case PayloadType.PoisonMicroblock: {\n const pm = payload as PoisonMicroblockPayload;\n parts.push(hexToBytes(pm.header1));\n parts.push(hexToBytes(pm.header2));\n break;\n }\n\n case PayloadType.TenureChange: {\n const tc = payload as TenureChangePayloadType;\n parts.push(hexToBytes(tc.tenureConsensusHash));\n parts.push(hexToBytes(tc.prevTenureConsensusHash));\n parts.push(hexToBytes(tc.burnViewConsensusHash));\n parts.push(hexToBytes(tc.previousTenureEnd));\n parts.push(writeUInt32BE(tc.previousTenureBlocks));\n parts.push(writeUInt8(tc.cause));\n parts.push(hexToBytes(tc.pubkeyHash));\n break;\n }\n\n case PayloadType.NakamotoCoinbase: {\n const nc = payload as NakamotoCoinbasePayload;\n parts.push(hexToBytes(nc.coinbaseBuffer));\n if (nc.recipient) {\n parts.push(serializeCVBytes({ type: \"some\", value: nc.recipient }));\n } else {\n parts.push(serializeCVBytes({ type: \"none\" }));\n }\n parts.push(hexToBytes(nc.vrfProof));\n break;\n }\n }\n\n return concatBytes(...parts);\n}\n\nexport function serializeTransaction(tx: StacksTransaction): Uint8Array {\n return concatBytes(\n writeUInt8(tx.version),\n writeUInt32BE(tx.chainId),\n serializeAuthorization(tx.auth),\n writeUInt8(tx.anchorMode),\n writeUInt8(tx.postConditionMode),\n serializePostConditions(tx.postConditions),\n serializePayload(tx.payload)\n );\n}\n\nexport function serializeTransactionHex(tx: StacksTransaction): string {\n return bytesToHex(serializeTransaction(tx));\n}\n",
7
- "import {\n getPublicKey as nobleGetPublicKey,\n sign,\n etc,\n} from \"@noble/secp256k1\";\nimport { hmac } from \"@noble/hashes/hmac.js\";\nimport { sha256 } from \"@noble/hashes/sha2.js\";\nimport {\n bytesToHex,\n hexToBytes,\n intToBytes,\n intToHex,\n concatBytes,\n} from \"../utils/encoding.ts\";\nimport { hashP2PKH, txidFromBytes } from \"../utils/hash.ts\";\nimport {\n AuthType,\n AddressHashMode,\n PubKeyEncoding,\n RECOVERABLE_ECDSA_SIG_LENGTH_BYTES,\n type SingleSigSpendingCondition,\n type SpendingCondition,\n type Authorization,\n type StandardAuthorization,\n type SponsoredAuthorization,\n} from \"./types.ts\";\n\n// Ensure sync signing is available\netc.hmacSha256Sync = (key: Uint8Array, ...msgs: Uint8Array[]) => {\n const h = hmac.create(sha256, key);\n msgs.forEach((msg) => h.update(msg));\n return h.digest();\n};\n\nconst EMPTY_SIG = bytesToHex(new Uint8Array(RECOVERABLE_ECDSA_SIG_LENGTH_BYTES));\n\nexport function createSingleSigSpendingCondition(\n publicKey: string,\n nonce: bigint,\n fee: bigint\n): SingleSigSpendingCondition {\n const pubKeyBytes = hexToBytes(publicKey);\n const signer = hashP2PKH(pubKeyBytes);\n const isCompressed = pubKeyBytes.length === 33;\n\n return {\n hashMode: AddressHashMode.P2PKH,\n signer,\n nonce,\n fee,\n keyEncoding: isCompressed ? PubKeyEncoding.Compressed : PubKeyEncoding.Uncompressed,\n signature: EMPTY_SIG,\n };\n}\n\nexport function createStandardAuth(\n spendingCondition: SpendingCondition\n): StandardAuthorization {\n return { authType: AuthType.Standard, spendingCondition };\n}\n\nexport function createSponsoredAuth(\n spendingCondition: SpendingCondition,\n sponsorSpendingCondition?: SpendingCondition\n): SponsoredAuthorization {\n return {\n authType: AuthType.Sponsored,\n spendingCondition,\n sponsorSpendingCondition: sponsorSpendingCondition ?? createSingleSigSpendingCondition(\n \"0\".repeat(66),\n 0n,\n 0n\n ),\n };\n}\n\nfunction clearCondition(condition: SpendingCondition): SpendingCondition {\n if (\"signature\" in condition) {\n return {\n ...condition,\n nonce: 0n,\n fee: 0n,\n signature: EMPTY_SIG,\n };\n }\n return {\n ...condition,\n nonce: 0n,\n fee: 0n,\n fields: [],\n };\n}\n\nexport function intoInitialSighashAuth(auth: Authorization): Authorization {\n if (auth.authType === AuthType.Standard) {\n return createStandardAuth(clearCondition(auth.spendingCondition));\n }\n return createSponsoredAuth(\n clearCondition(auth.spendingCondition),\n clearCondition(createSingleSigSpendingCondition(\"0\".repeat(66), 0n, 0n))\n );\n}\n\n/** Compute pre-sign sighash = sha512/256(prevSigHash + authType + fee + nonce) */\nexport function sigHashPreSign(\n curSigHash: string,\n authType: number,\n fee: bigint,\n nonce: bigint\n): string {\n const data = concatBytes(\n hexToBytes(curSigHash),\n new Uint8Array([authType]),\n intToBytes(fee, 8),\n intToBytes(nonce, 8)\n );\n return txidFromBytes(data);\n}\n\n/** Compute post-sign sighash = sha512/256(preSigHash + pubKeyEncoding + signature) */\nexport function sigHashPostSign(\n curSigHash: string,\n pubKeyEncoding: number,\n signature: string\n): string {\n const data = concatBytes(\n hexToBytes(curSigHash),\n new Uint8Array([pubKeyEncoding]),\n hexToBytes(signature)\n );\n return txidFromBytes(data);\n}\n\n/** Sign with private key and return VRS signature (recoveryId + r + s) */\nfunction signWithKey(privateKey: string, messageHash: string): string {\n const keyBytes = hexToBytes(privateKey).slice(0, 32);\n const sig = sign(messageHash, keyBytes, { lowS: true });\n const recoveryIdHex = intToHex(sig.recovery, 1);\n return recoveryIdHex + sig.toCompactHex();\n}\n\nexport function nextSignature(\n curSigHash: string,\n authType: number,\n fee: bigint,\n nonce: bigint,\n privateKey: string\n): { nextSig: string; nextSigHash: string } {\n const sigHashPre = sigHashPreSign(curSigHash, authType, fee, nonce);\n\n const keyBytes = hexToBytes(privateKey).slice(0, 32);\n const pubKey = nobleGetPublicKey(keyBytes, true);\n const isCompressed = pubKey.length === 33;\n const pubKeyEncoding = isCompressed\n ? PubKeyEncoding.Compressed\n : PubKeyEncoding.Uncompressed;\n\n const nextSig = signWithKey(privateKey, sigHashPre);\n const nextSigHash = sigHashPostSign(sigHashPre, pubKeyEncoding, nextSig);\n\n return { nextSig, nextSigHash };\n}\n",
8
- "import {\n getPublicKey as nobleGetPublicKey,\n sign as nobleSign,\n} from \"@noble/secp256k1\";\nimport { c32address } from \"../utils/c32.ts\";\nimport { bytesToHex, hexToBytes, intToHex, concatBytes } from \"../utils/encoding.ts\";\nimport { hash160 } from \"../utils/hash.ts\";\nimport {\n sigHashPreSign,\n sigHashPostSign,\n intoInitialSighashAuth,\n nextSignature,\n} from \"./authorization.ts\";\nimport { txidFromBytes } from \"../utils/hash.ts\";\nimport { serializeTransaction } from \"./wire/serialize.ts\";\nimport {\n AuthType,\n AddressHashMode,\n PubKeyEncoding,\n type MultiSigSpendingCondition,\n type MultiSigHashMode,\n type TransactionAuthField,\n type StacksTransaction,\n} from \"./types.ts\";\nimport type { StacksChain } from \"../chains/types.ts\";\nimport type { LocalAccount, CustomAccount } from \"../accounts/types.ts\";\n\n// OP codes for redeem script\nconst OP_CHECKMULTISIG = 0xae;\n\n/** Check if hash mode is non-sequential (SIP-027) */\nexport function isNonSequential(hashMode: number): boolean {\n return (hashMode & 0x04) !== 0;\n}\n\n/** Build a Bitcoin-style redeem script for m-of-n multi-sig */\nfunction makeRedeemScript(publicKeys: string[], signaturesRequired: number): Uint8Array {\n const parts: Uint8Array[] = [];\n parts.push(new Uint8Array([0x50 + signaturesRequired])); // OP_n\n for (const pk of publicKeys) {\n const pkBytes = hexToBytes(pk);\n parts.push(new Uint8Array([pkBytes.length])); // length prefix (0x21 for compressed)\n parts.push(pkBytes);\n }\n parts.push(new Uint8Array([0x50 + publicKeys.length])); // OP_m\n parts.push(new Uint8Array([OP_CHECKMULTISIG]));\n return concatBytes(...parts);\n}\n\n/** Derive a multi-sig address from public keys */\nexport function makeMultiSigAddress(\n publicKeys: string[],\n signaturesRequired: number,\n chain?: StacksChain\n): string {\n if (signaturesRequired < 1 || signaturesRequired > publicKeys.length) {\n throw new Error(`signaturesRequired must be between 1 and ${publicKeys.length}`);\n }\n const redeemScript = makeRedeemScript(publicKeys, signaturesRequired);\n const signer = hash160(redeemScript);\n const version = chain?.addressVersion?.multiSig ?? 20; // mainnet default\n return c32address(version, bytesToHex(signer));\n}\n\n/** Create an empty multi-sig spending condition */\nexport function createMultiSigSpendingCondition(\n publicKeys: string[],\n signaturesRequired: number,\n nonce: bigint,\n fee: bigint,\n hashMode: MultiSigHashMode = AddressHashMode.P2SH\n): MultiSigSpendingCondition {\n const redeemScript = makeRedeemScript(publicKeys, signaturesRequired);\n const signer = bytesToHex(hash160(redeemScript));\n\n return {\n hashMode,\n signer,\n nonce,\n fee,\n fields: [],\n signaturesRequired,\n };\n}\n\n/** Compute the initial sighash for a transaction (same as signBegin) */\nfunction initialSigHash(tx: StacksTransaction): string {\n const cleared: StacksTransaction = {\n ...tx,\n auth: intoInitialSighashAuth(tx.auth),\n };\n return txidFromBytes(serializeTransaction(cleared));\n}\n\n/** Compute the presign-sighash used by all non-sequential signers */\nfunction nonSequentialPreSignHash(tx: StacksTransaction): string {\n const condition = tx.auth.spendingCondition as MultiSigSpendingCondition;\n const initHash = initialSigHash(tx);\n return sigHashPreSign(initHash, AuthType.Standard, condition.fee, condition.nonce);\n}\n\n/** Replay sighash through existing auth fields of a multi-sig tx */\nexport function replayMultiSigSigHash(tx: StacksTransaction): string {\n const condition = tx.auth.spendingCondition as MultiSigSpendingCondition;\n\n // Non-sequential: all signers sign the same presign-sighash, no field chaining\n if (isNonSequential(condition.hashMode)) {\n const preSign = nonSequentialPreSignHash(tx);\n // Chain through all fields to get the final sighash\n let curSigHash = preSign;\n for (const field of condition.fields) {\n curSigHash = sigHashPostSign(curSigHash, field.pubKeyEncoding, field.data);\n }\n return curSigHash;\n }\n\n // Sequential: chain through all fields\n let curSigHash = initialSigHash(tx);\n for (const field of condition.fields) {\n const preSign = sigHashPreSign(curSigHash, AuthType.Standard, condition.fee, condition.nonce);\n curSigHash = sigHashPostSign(preSign, field.pubKeyEncoding, field.data);\n }\n return curSigHash;\n}\n\n/** Sign one position of a multi-sig transaction with a private key */\nexport function signMultiSig(\n tx: StacksTransaction,\n privateKey: string,\n publicKeys: string[]\n): StacksTransaction {\n const keyBytes = hexToBytes(privateKey).slice(0, 32);\n const signerPubKey = bytesToHex(nobleGetPublicKey(keyBytes, true));\n\n const signerIndex = publicKeys.findIndex((pk) => pk === signerPubKey);\n if (signerIndex === -1) {\n throw new Error(\"Private key does not correspond to any signer in the multi-sig\");\n }\n\n const condition = { ...(tx.auth.spendingCondition as MultiSigSpendingCondition) };\n\n // Non-sequential: all signers sign the same presign-sighash independently\n if (isNonSequential(condition.hashMode)) {\n return signNonSequential(tx, condition, privateKey);\n }\n\n // Sequential: existing P2SH behavior\n return signSequential(tx, condition, privateKey, publicKeys, signerIndex);\n}\n\n/** Non-sequential signing: compute presign-sighash from initial tx, sign, append */\nfunction signNonSequential(\n tx: StacksTransaction,\n condition: MultiSigSpendingCondition,\n privateKey: string\n): StacksTransaction {\n const fields = [...condition.fields];\n const preSignHash = nonSequentialPreSignHash(tx);\n\n // Sign the presign-sighash directly\n const keyBytes = hexToBytes(privateKey).slice(0, 32);\n const sig = nobleSign(preSignHash, keyBytes, { lowS: true });\n const recoveryIdHex = intToHex(sig.recovery, 1);\n const nextSig = recoveryIdHex + sig.toCompactHex();\n\n fields.push({\n type: \"signature\",\n pubKeyEncoding: PubKeyEncoding.Compressed,\n data: nextSig,\n });\n\n const newCondition: MultiSigSpendingCondition = { ...condition, fields };\n const sigCount = fields.filter((f) => f.type === \"signature\").length;\n\n // Auto-finalize: non-sequential needs no pubkey gap-filling\n if (sigCount >= condition.signaturesRequired) {\n return {\n ...tx,\n auth: { ...tx.auth, spendingCondition: newCondition },\n };\n }\n\n return {\n ...tx,\n auth: { ...tx.auth, spendingCondition: newCondition },\n };\n}\n\n/** Sequential signing: existing P2SH behavior */\nfunction signSequential(\n tx: StacksTransaction,\n condition: MultiSigSpendingCondition,\n privateKey: string,\n publicKeys: string[],\n signerIndex: number\n): StacksTransaction {\n const fields = [...condition.fields];\n\n // Replay sighash through existing fields\n let curSigHash = initialSigHash(tx);\n for (const field of fields) {\n const preSign = sigHashPreSign(curSigHash, AuthType.Standard, condition.fee, condition.nonce);\n curSigHash = sigHashPostSign(preSign, field.pubKeyEncoding, field.data);\n }\n\n // Fill intervening positions with pubkey fields\n for (let i = fields.length; i < signerIndex; i++) {\n const pubKeyField: TransactionAuthField = {\n type: \"publicKey\",\n pubKeyEncoding: PubKeyEncoding.Compressed,\n data: publicKeys[i]!,\n };\n fields.push(pubKeyField);\n const preSign = sigHashPreSign(curSigHash, AuthType.Standard, condition.fee, condition.nonce);\n curSigHash = sigHashPostSign(preSign, pubKeyField.pubKeyEncoding, pubKeyField.data);\n }\n\n // Sign at signerIndex\n const { nextSig, nextSigHash } = nextSignature(\n curSigHash,\n AuthType.Standard,\n condition.fee,\n condition.nonce,\n privateKey\n );\n\n fields.push({\n type: \"signature\",\n pubKeyEncoding: PubKeyEncoding.Compressed,\n data: nextSig,\n });\n curSigHash = nextSigHash;\n\n const newCondition: MultiSigSpendingCondition = { ...condition, fields };\n\n // Count signatures so far\n const sigCount = fields.filter((f) => f.type === \"signature\").length;\n let finalCondition = newCondition;\n\n // Auto-finalize if enough signatures collected\n if (sigCount >= condition.signaturesRequired) {\n finalCondition = finalizeMultiSigCondition(newCondition, publicKeys, curSigHash);\n }\n\n return {\n ...tx,\n auth: {\n ...tx.auth,\n spendingCondition: finalCondition,\n },\n };\n}\n\n/** Sign one position of a multi-sig transaction with an account */\nexport async function signMultiSigWithAccount(\n tx: StacksTransaction,\n account: LocalAccount | CustomAccount,\n publicKeys: string[]\n): Promise<StacksTransaction> {\n const signerPubKey = account.publicKey;\n\n const signerIndex = publicKeys.findIndex((pk) => pk === signerPubKey);\n if (signerIndex === -1) {\n throw new Error(\"Account does not correspond to any signer in the multi-sig\");\n }\n\n const condition = { ...(tx.auth.spendingCondition as MultiSigSpendingCondition) };\n\n // Non-sequential: all signers sign the same presign-sighash independently\n if (isNonSequential(condition.hashMode)) {\n return signNonSequentialWithAccount(tx, condition, account);\n }\n\n // Sequential: existing behavior\n return signSequentialWithAccount(tx, condition, account, publicKeys, signerIndex);\n}\n\n/** Non-sequential signing with account */\nasync function signNonSequentialWithAccount(\n tx: StacksTransaction,\n condition: MultiSigSpendingCondition,\n account: LocalAccount | CustomAccount\n): Promise<StacksTransaction> {\n const fields = [...condition.fields];\n const preSignHash = nonSequentialPreSignHash(tx);\n\n const sigBytes = await account.sign(hexToBytes(preSignHash));\n const nextSig = bytesToHex(sigBytes);\n\n fields.push({\n type: \"signature\",\n pubKeyEncoding: PubKeyEncoding.Compressed,\n data: nextSig,\n });\n\n const newCondition: MultiSigSpendingCondition = { ...condition, fields };\n\n return {\n ...tx,\n auth: { ...tx.auth, spendingCondition: newCondition },\n };\n}\n\n/** Sequential signing with account */\nasync function signSequentialWithAccount(\n tx: StacksTransaction,\n condition: MultiSigSpendingCondition,\n account: LocalAccount | CustomAccount,\n publicKeys: string[],\n signerIndex: number\n): Promise<StacksTransaction> {\n const fields = [...condition.fields];\n\n // Replay sighash through existing fields\n let curSigHash = initialSigHash(tx);\n for (const field of fields) {\n const preSign = sigHashPreSign(curSigHash, AuthType.Standard, condition.fee, condition.nonce);\n curSigHash = sigHashPostSign(preSign, field.pubKeyEncoding, field.data);\n }\n\n // Fill intervening positions with pubkey fields\n for (let i = fields.length; i < signerIndex; i++) {\n const pubKeyField: TransactionAuthField = {\n type: \"publicKey\",\n pubKeyEncoding: PubKeyEncoding.Compressed,\n data: publicKeys[i]!,\n };\n fields.push(pubKeyField);\n const preSign = sigHashPreSign(curSigHash, AuthType.Standard, condition.fee, condition.nonce);\n curSigHash = sigHashPostSign(preSign, pubKeyField.pubKeyEncoding, pubKeyField.data);\n }\n\n // Sign at signerIndex\n const preSign = sigHashPreSign(curSigHash, AuthType.Standard, condition.fee, condition.nonce);\n const sigBytes = await account.sign(hexToBytes(preSign));\n const nextSig = bytesToHex(sigBytes);\n const nextSigHash = sigHashPostSign(preSign, PubKeyEncoding.Compressed, nextSig);\n\n fields.push({\n type: \"signature\",\n pubKeyEncoding: PubKeyEncoding.Compressed,\n data: nextSig,\n });\n curSigHash = nextSigHash;\n\n const newCondition: MultiSigSpendingCondition = { ...condition, fields };\n\n // Count signatures so far\n const sigCount = fields.filter((f) => f.type === \"signature\").length;\n let finalCondition = newCondition;\n\n // Auto-finalize if enough signatures collected\n if (sigCount >= condition.signaturesRequired) {\n finalCondition = finalizeMultiSigCondition(newCondition, publicKeys, curSigHash);\n }\n\n return {\n ...tx,\n auth: {\n ...tx.auth,\n spendingCondition: finalCondition,\n },\n };\n}\n\n/** Fill remaining slots with pubkey fields after all signatures are collected */\nexport function finalizeMultiSig(\n tx: StacksTransaction,\n publicKeys: string[]\n): StacksTransaction {\n const condition = tx.auth.spendingCondition as MultiSigSpendingCondition;\n\n // Non-sequential: no pubkey gap-filling needed\n if (isNonSequential(condition.hashMode)) {\n return tx;\n }\n\n const curSigHash = replayMultiSigSigHash(tx);\n const finalCondition = finalizeMultiSigCondition(condition, publicKeys, curSigHash);\n\n return {\n ...tx,\n auth: {\n ...tx.auth,\n spendingCondition: finalCondition,\n },\n };\n}\n\n/** Internal: finalize remaining pubkey slots (sequential only) */\nfunction finalizeMultiSigCondition(\n condition: MultiSigSpendingCondition,\n publicKeys: string[],\n curSigHash: string\n): MultiSigSpendingCondition {\n const fields = [...condition.fields];\n let sigHash = curSigHash;\n\n // Fill remaining positions\n for (let i = fields.length; i < publicKeys.length; i++) {\n const pubKeyField: TransactionAuthField = {\n type: \"publicKey\",\n pubKeyEncoding: PubKeyEncoding.Compressed,\n data: publicKeys[i]!,\n };\n fields.push(pubKeyField);\n const preSign = sigHashPreSign(sigHash, AuthType.Standard, condition.fee, condition.nonce);\n sigHash = sigHashPostSign(preSign, pubKeyField.pubKeyEncoding, pubKeyField.data);\n }\n\n return { ...condition, fields };\n}\n\n/** Combine independently-signed non-sequential multi-sig transactions */\nexport function combineMultiSigSignatures(\n baseTx: StacksTransaction,\n signedTxs: StacksTransaction[]\n): StacksTransaction {\n const condition = baseTx.auth.spendingCondition as MultiSigSpendingCondition;\n\n if (!isNonSequential(condition.hashMode)) {\n throw new Error(\"combineMultiSigSignatures only works with non-sequential hash modes (SIP-027)\");\n }\n\n // Collect all signature fields from each signed tx\n const seenSigs = new Set<string>();\n const signatures: TransactionAuthField[] = [];\n\n for (const stx of signedTxs) {\n const stxCondition = stx.auth.spendingCondition as MultiSigSpendingCondition;\n for (const field of stxCondition.fields) {\n if (field.type === \"signature\" && !seenSigs.has(field.data)) {\n seenSigs.add(field.data);\n signatures.push(field);\n }\n }\n }\n\n if (signatures.length === 0) {\n throw new Error(\"No signatures found in the provided transactions\");\n }\n\n const newCondition: MultiSigSpendingCondition = {\n ...condition,\n fields: signatures,\n };\n\n return {\n ...baseTx,\n auth: { ...baseTx.auth, spendingCondition: newCondition },\n };\n}\n",
9
- "import { bytesToHex, hexToBytes } from \"../utils/encoding.ts\";\nimport { txidFromBytes } from \"../utils/hash.ts\";\nimport {\n intoInitialSighashAuth,\n nextSignature,\n sigHashPreSign,\n sigHashPostSign,\n} from \"./authorization.ts\";\nimport { replayMultiSigSigHash } from \"./multisig.ts\";\nimport { serializeTransaction } from \"./wire/serialize.ts\";\nimport {\n AuthType,\n type StacksTransaction,\n type SingleSigSpendingCondition,\n type SponsoredAuthorization,\n} from \"./types.ts\";\nimport type { LocalAccount, CustomAccount } from \"../accounts/types.ts\";\n\nfunction txid(tx: StacksTransaction): string {\n return txidFromBytes(serializeTransaction(tx));\n}\n\n/** Compute the initial sighash for a transaction */\nexport function signBegin(tx: StacksTransaction): string {\n const cleared: StacksTransaction = {\n ...tx,\n auth: intoInitialSighashAuth(tx.auth),\n };\n return txid(cleared);\n}\n\n/** Sign a single-sig transaction with a private key, returning the signed transaction */\nexport function signTransaction(\n tx: StacksTransaction,\n privateKey: string\n): StacksTransaction {\n const sigHash = signBegin(tx);\n const condition = tx.auth.spendingCondition as SingleSigSpendingCondition;\n\n // Origin always signs with AuthType.Standard (even for sponsored txs)\n const { nextSig } = nextSignature(\n sigHash,\n AuthType.Standard,\n condition.fee,\n condition.nonce,\n privateKey\n );\n\n return {\n ...tx,\n auth: {\n ...tx.auth,\n spendingCondition: {\n ...condition,\n signature: nextSig,\n },\n },\n };\n}\n\n/** Sign a single-sig transaction using an account (LocalAccount or CustomAccount) */\nexport async function signTransactionWithAccount(\n tx: StacksTransaction,\n account: LocalAccount | CustomAccount\n): Promise<StacksTransaction> {\n const sigHash = signBegin(tx);\n const condition = tx.auth.spendingCondition as SingleSigSpendingCondition;\n\n // Origin always signs with AuthType.Standard (even for sponsored txs)\n const sigHashPre = sigHashPreSign(\n sigHash,\n AuthType.Standard,\n condition.fee,\n condition.nonce\n );\n\n // account.sign returns 65-byte VRS (recovery + r + s)\n const sigBytes = await account.sign(hexToBytes(sigHashPre));\n const nextSig = bytesToHex(sigBytes);\n\n return {\n ...tx,\n auth: {\n ...tx.auth,\n spendingCondition: {\n ...condition,\n signature: nextSig,\n },\n },\n };\n}\n\n/** Get the txid of a transaction */\nexport function getTransactionId(tx: StacksTransaction): string {\n return txid(tx);\n}\n\n/** Reconstruct the sighash after origin signing (needed for sponsor signing) */\nexport function getOriginSigHash(tx: StacksTransaction): string {\n const condition = tx.auth.spendingCondition;\n\n // Multi-sig: replay through all fields\n if (\"fields\" in condition) {\n return replayMultiSigSigHash(tx);\n }\n\n // Single-sig\n const initialSigHash = signBegin(tx);\n const sc = condition as SingleSigSpendingCondition;\n const preSign = sigHashPreSign(initialSigHash, AuthType.Standard, sc.fee, sc.nonce);\n return sigHashPostSign(preSign, sc.keyEncoding, sc.signature);\n}\n\n/** Sign a sponsored transaction as the sponsor with a private key */\nexport function signSponsor(tx: StacksTransaction, privateKey: string): StacksTransaction {\n if (tx.auth.authType !== AuthType.Sponsored) {\n throw new Error(\"Transaction must be sponsored\");\n }\n const auth = tx.auth as SponsoredAuthorization;\n const sponsorCondition = auth.sponsorSpendingCondition as SingleSigSpendingCondition;\n const originSigHash = getOriginSigHash(tx);\n\n const { nextSig } = nextSignature(\n originSigHash,\n AuthType.Sponsored,\n sponsorCondition.fee,\n sponsorCondition.nonce,\n privateKey\n );\n\n return {\n ...tx,\n auth: {\n ...auth,\n sponsorSpendingCondition: {\n ...sponsorCondition,\n signature: nextSig,\n },\n },\n };\n}\n\n/** Sign a sponsored transaction as the sponsor using an account */\nexport async function signSponsorWithAccount(\n tx: StacksTransaction,\n account: LocalAccount | CustomAccount\n): Promise<StacksTransaction> {\n if (tx.auth.authType !== AuthType.Sponsored) {\n throw new Error(\"Transaction must be sponsored\");\n }\n const auth = tx.auth as SponsoredAuthorization;\n const sponsorCondition = auth.sponsorSpendingCondition as SingleSigSpendingCondition;\n const originSigHash = getOriginSigHash(tx);\n\n const sigHashPre = sigHashPreSign(\n originSigHash,\n AuthType.Sponsored,\n sponsorCondition.fee,\n sponsorCondition.nonce\n );\n\n const sigBytes = await account.sign(hexToBytes(sigHashPre));\n const nextSig = bytesToHex(sigBytes);\n\n return {\n ...tx,\n auth: {\n ...auth,\n sponsorSpendingCondition: {\n ...sponsorCondition,\n signature: nextSig,\n },\n },\n };\n}\n",
10
- "import type { StacksChain } from \"../chains/types.ts\";\nimport type { ClarityValue } from \"../clarity/types.ts\";\nimport type { PostCondition } from \"../postconditions/types.ts\";\nimport type { MultiSigHashMode, SpendingCondition } from \"./types.ts\";\nimport {\n createSingleSigSpendingCondition,\n createStandardAuth,\n createSponsoredAuth,\n} from \"./authorization.ts\";\nimport { createMultiSigSpendingCondition } from \"./multisig.ts\";\nimport {\n PayloadType,\n AnchorMode,\n PostConditionModeWire,\n FungibleConditionCode,\n NonFungibleConditionCode,\n type StacksTransaction,\n type PostConditionWire,\n type PostConditionPrincipalWire,\n type ClarityVersion,\n} from \"./types.ts\";\nimport { Cl } from \"../clarity/values.ts\";\nimport { intToBigInt, type IntegerType } from \"../utils/encoding.ts\";\nimport { parseContractId } from \"../utils/address.ts\";\n\ntype MultiSigOptions = {\n publicKeys?: string[];\n signaturesRequired?: number;\n hashMode?: MultiSigHashMode;\n};\n\nexport type BuildTokenTransferOptions = MultiSigOptions & {\n recipient: string;\n amount: IntegerType;\n memo?: string;\n fee: IntegerType;\n nonce: IntegerType;\n publicKey?: string;\n chain?: StacksChain;\n postConditionMode?: \"allow\" | \"deny\";\n postConditions?: PostCondition[];\n sponsored?: boolean;\n};\n\nexport type BuildContractCallOptions = MultiSigOptions & {\n contractAddress: string;\n contractName: string;\n functionName: string;\n functionArgs: ClarityValue[];\n fee: IntegerType;\n nonce: IntegerType;\n publicKey?: string;\n chain?: StacksChain;\n postConditionMode?: \"allow\" | \"deny\";\n postConditions?: PostCondition[];\n sponsored?: boolean;\n};\n\nexport type BuildContractDeployOptions = MultiSigOptions & {\n contractName: string;\n codeBody: string;\n clarityVersion?: ClarityVersion;\n fee: IntegerType;\n nonce: IntegerType;\n publicKey?: string;\n chain?: StacksChain;\n postConditionMode?: \"allow\" | \"deny\";\n postConditions?: PostCondition[];\n sponsored?: boolean;\n};\n\nfunction resolvePcMode(mode?: \"allow\" | \"deny\"): PostConditionModeWire {\n return mode === \"allow\" ? PostConditionModeWire.Allow : PostConditionModeWire.Deny;\n}\n\nfunction convertPostConditions(pcs?: PostCondition[]): PostConditionWire[] {\n if (!pcs || pcs.length === 0) return [];\n return pcs.map(convertPostCondition);\n}\n\nfunction resolvePrincipal(address: string): PostConditionPrincipalWire {\n if (address === \"origin\") return { type: \"origin\" };\n const [addr, name] = address.split(\".\");\n if (name) {\n return { type: \"contract\", address: addr!, contractName: name };\n }\n return { type: \"standard\", address: addr! };\n}\n\nconst FUNGIBLE_CODE_MAP: Record<string, number> = {\n eq: FungibleConditionCode.Equal,\n gt: FungibleConditionCode.Greater,\n gte: FungibleConditionCode.GreaterEqual,\n lt: FungibleConditionCode.Less,\n lte: FungibleConditionCode.LessEqual,\n};\n\nfunction convertPostCondition(pc: PostCondition): PostConditionWire {\n switch (pc.type) {\n case \"stx-postcondition\":\n return {\n type: \"stx\",\n principal: resolvePrincipal(pc.address),\n conditionCode: FUNGIBLE_CODE_MAP[pc.condition]!,\n amount: intToBigInt(pc.amount),\n };\n case \"ft-postcondition\": {\n const [contractId, tokenName] = pc.asset.split(\"::\");\n const [addr, name] = parseContractId(contractId!);\n return {\n type: \"ft\",\n principal: resolvePrincipal(pc.address),\n asset: { address: addr, contractName: name, assetName: tokenName! },\n conditionCode: FUNGIBLE_CODE_MAP[pc.condition]!,\n amount: intToBigInt(pc.amount),\n };\n }\n case \"nft-postcondition\": {\n const [contractId, tokenName] = pc.asset.split(\"::\");\n const [addr, name] = parseContractId(contractId!);\n return {\n type: \"nft\",\n principal: resolvePrincipal(pc.address),\n asset: { address: addr, contractName: name, assetName: tokenName! },\n conditionCode: pc.condition === \"sent\" ? NonFungibleConditionCode.Sends : NonFungibleConditionCode.DoesNotSend,\n assetId: pc.assetId,\n };\n }\n }\n}\n\nimport type { Authorization } from \"./types.ts\";\n\nfunction resolveSpendingCondition(\n opts: MultiSigOptions & { publicKey?: string },\n nonce: bigint,\n fee: bigint\n): SpendingCondition {\n if (opts.publicKeys) {\n return createMultiSigSpendingCondition(\n opts.publicKeys,\n opts.signaturesRequired!,\n nonce,\n fee,\n opts.hashMode\n );\n }\n return createSingleSigSpendingCondition(opts.publicKey!, nonce, fee);\n}\n\nfunction resolveAuth(spendingCondition: any, sponsored?: boolean): Authorization {\n return sponsored\n ? createSponsoredAuth(spendingCondition)\n : createStandardAuth(spendingCondition);\n}\n\nfunction resolveVersionAndChainId(chain?: StacksChain): { version: number; chainId: number } {\n if (!chain) return { version: 0x00, chainId: 0x00000001 }; // mainnet defaults\n return { version: chain.transactionVersion, chainId: chain.id };\n}\n\nexport function buildTokenTransfer(options: BuildTokenTransferOptions): StacksTransaction {\n const { version, chainId } = resolveVersionAndChainId(options.chain);\n const fee = intToBigInt(options.fee);\n const nonce = intToBigInt(options.nonce);\n\n const spendingCondition = resolveSpendingCondition(options, nonce, fee);\n const recipient = Cl.principal(options.recipient);\n\n const tx: StacksTransaction = {\n version,\n chainId,\n auth: resolveAuth(spendingCondition, options.sponsored),\n anchorMode: AnchorMode.Any,\n postConditionMode: resolvePcMode(options.postConditionMode),\n postConditions: convertPostConditions(options.postConditions),\n payload: {\n payloadType: PayloadType.TokenTransfer,\n recipient,\n amount: intToBigInt(options.amount),\n memo: options.memo ?? \"\",\n },\n };\n\n if (options.publicKeys) {\n (tx as any)._multisig = { publicKeys: options.publicKeys };\n }\n return tx;\n}\n\nexport function buildContractCall(options: BuildContractCallOptions): StacksTransaction {\n const { version, chainId } = resolveVersionAndChainId(options.chain);\n const fee = intToBigInt(options.fee);\n const nonce = intToBigInt(options.nonce);\n\n const spendingCondition = resolveSpendingCondition(options, nonce, fee);\n\n const tx: StacksTransaction = {\n version,\n chainId,\n auth: resolveAuth(spendingCondition, options.sponsored),\n anchorMode: AnchorMode.Any,\n postConditionMode: resolvePcMode(options.postConditionMode),\n postConditions: convertPostConditions(options.postConditions),\n payload: {\n payloadType: PayloadType.ContractCall,\n contractAddress: options.contractAddress,\n contractName: options.contractName,\n functionName: options.functionName,\n functionArgs: options.functionArgs,\n },\n };\n\n if (options.publicKeys) {\n (tx as any)._multisig = { publicKeys: options.publicKeys };\n }\n return tx;\n}\n\nexport function buildContractDeploy(options: BuildContractDeployOptions): StacksTransaction {\n const { version, chainId } = resolveVersionAndChainId(options.chain);\n const fee = intToBigInt(options.fee);\n const nonce = intToBigInt(options.nonce);\n\n const spendingCondition = resolveSpendingCondition(options, nonce, fee);\n const useVersioned = options.clarityVersion !== undefined;\n\n const tx: StacksTransaction = {\n version,\n chainId,\n auth: resolveAuth(spendingCondition, options.sponsored),\n anchorMode: AnchorMode.Any,\n postConditionMode: resolvePcMode(options.postConditionMode),\n postConditions: convertPostConditions(options.postConditions),\n payload: {\n payloadType: useVersioned ? PayloadType.VersionedSmartContract : PayloadType.SmartContract,\n clarityVersion: options.clarityVersion,\n contractName: options.contractName,\n codeBody: options.codeBody,\n },\n };\n\n if (options.publicKeys) {\n (tx as any)._multisig = { publicKeys: options.publicKeys };\n }\n return tx;\n}\n"
11
- ],
12
- "mappings": ";AAGO,IAAM,WAAW;AAAA,EACtB,UAAU;AAAA,EACV,WAAW;AACb;AAIO,IAAM,cAAc;AAAA,EACzB,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;AACpB;AAIO,IAAM,iBAAiB;AAAA,EAC5B,UAAU;AAAA,EACV,UAAU;AAAA,EACV,UAAU;AACZ;AAIO,IAAM,aAAa;AAAA,EACxB,aAAa;AAAA,EACb,cAAc;AAAA,EACd,KAAK;AACP;AAIO,IAAM,wBAAwB;AAAA,EACnC,OAAO;AAAA,EACP,MAAM;AACR;AAKO,IAAM,kBAAkB;AAAA,EAC7B,OAAO;AAAA,EACP,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,OAAO;AAAA,EACP,oBAAoB;AAAA,EACpB,0BAA0B;AAC5B;AAIO,IAAM,iBAAiB;AAAA,EAC5B,YAAY;AAAA,EACZ,cAAc;AAChB;AAIO,IAAM,wBAAwB;AAAA,EACnC,OAAO;AAAA,EACP,SAAS;AAAA,EACT,cAAc;AAAA,EACd,MAAM;AAAA,EACN,WAAW;AACb;AAGO,IAAM,2BAA2B;AAAA,EACtC,OAAO;AAAA,EACP,aAAa;AACf;AAGO,IAAM,2BAA2B;AAAA,EACtC,QAAQ;AAAA,EACR,UAAU;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;AAAA,IACrB,GAAW,YAAY,EAAE,YAAY,QAAQ,WAAW;AAAA,EAC3D;AAAA,EACA,OAAO;AAAA;AAGF,SAAS,mBAAmB,CAAC,SAAwD;AAAA,EAC1F,QAAQ,SAAS,YAAY,yBAAyB,QAAQ,KAAK;AAAA,EACnE,MAAM,MAAM,YAAY,QAAQ,GAAG;AAAA,EACnC,MAAM,QAAQ,YAAY,QAAQ,KAAK;AAAA,EAEvC,MAAM,oBAAoB,yBAAyB,SAAS,OAAO,GAAG;AAAA,EACtE,MAAM,eAAe,QAAQ,mBAAmB;AAAA,EAEhD,MAAM,KAAwB;AAAA,IAC5B;AAAA,IACA;AAAA,IACA,MAAM,YAAY,mBAAmB,QAAQ,SAAS;AAAA,IACtD,YAAY,WAAW;AAAA,IACvB,mBAAmB,cAAc,QAAQ,iBAAiB;AAAA,IAC1D,gBAAgB,sBAAsB,QAAQ,cAAc;AAAA,IAC5D,SAAS;AAAA,MACP,aAAa,eAAe,YAAY,yBAAyB,YAAY;AAAA,MAC7E,gBAAgB,QAAQ;AAAA,MACxB,cAAc,QAAQ;AAAA,MACtB,UAAU,QAAQ;AAAA,IACpB;AAAA,EACF;AAAA,EAEA,IAAI,QAAQ,YAAY;AAAA,IACrB,GAAW,YAAY,EAAE,YAAY,QAAQ,WAAW;AAAA,EAC3D;AAAA,EACA,OAAO;AAAA;",
13
- "debugId": "F9AB0B29B396E33564756E2164756E21",
14
- "names": []
15
- }
@@ -1,23 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../src/actions/public/getBalance.ts", "../src/actions/public/getAccountInfo.ts", "../src/actions/public/getBlock.ts", "../src/actions/public/getBlockHeight.ts", "../src/actions/public/getContractAbi.ts", "../src/actions/public/multicall.ts", "../src/errors/simulation.ts", "../src/actions/public/simulateCall.ts", "../src/actions/public/simulateTransaction.ts", "../src/actions/wallet/signTransaction.ts", "../src/actions/wallet/transferStx.ts", "../src/actions/wallet/deployContract.ts", "../src/actions/wallet/signMessage.ts", "../src/actions/wallet/sponsorTransaction.ts"],
4
- "sourcesContent": [
5
- "import type { Client } from \"../../clients/types.ts\";\n\nexport type GetBalanceParams = {\n address: string;\n};\n\nexport async function getBalance(\n client: Client,\n params: GetBalanceParams\n): Promise<bigint> {\n const data = await client.request(`/v2/accounts/${params.address}`, {\n method: \"GET\",\n });\n return BigInt(data.balance);\n}\n",
6
- "import type { Client } from \"../../clients/types.ts\";\n\nexport type GetAccountInfoParams = {\n address: string;\n};\n\nexport type AccountInfo = {\n balance: bigint;\n nonce: bigint;\n balanceProof: string;\n nonceProof: string;\n};\n\nexport async function getAccountInfo(\n client: Client,\n params: GetAccountInfoParams\n): Promise<AccountInfo> {\n const data = await client.request(\n `/v2/accounts/${params.address}?proof=1`,\n { method: \"GET\" }\n );\n return {\n balance: BigInt(data.balance),\n nonce: BigInt(data.nonce),\n balanceProof: data.balance_proof ?? \"\",\n nonceProof: data.nonce_proof ?? \"\",\n };\n}\n",
7
- "import type { Client } from \"../../clients/types.ts\";\n\nexport type GetBlockParams = {\n height?: number;\n hash?: string;\n};\n\nexport async function getBlock(client: Client, params?: GetBlockParams): Promise<any> {\n if (params?.hash) {\n return client.request(`/extended/v2/blocks/${params.hash}`, { method: \"GET\" });\n }\n if (params?.height !== undefined) {\n return client.request(`/extended/v2/blocks/${params.height}`, { method: \"GET\" });\n }\n // Latest block\n return client.request(\"/extended/v2/blocks?limit=1\", { method: \"GET\" });\n}\n",
8
- "import type { Client } from \"../../clients/types.ts\";\n\nexport async function getBlockHeight(client: Client): Promise<number> {\n const data = await client.request(\"/v2/info\", { method: \"GET\" });\n return data.stacks_tip_height;\n}\n",
9
- "import type { Client } from \"../../clients/types.ts\";\nimport { parseContractId } from \"../../utils/address.ts\";\n\nexport type GetContractAbiParams = {\n contract: string; // \"address.name\"\n};\n\nexport async function getContractAbi(\n client: Client,\n params: GetContractAbiParams\n): Promise<any> {\n const [address, name] = parseContractId(params.contract);\n return client.request(`/v2/contracts/interface/${address}/${name}`, {\n method: \"GET\",\n });\n}\n",
10
- "import type { Client } from \"../../clients/types.ts\";\nimport type { ClarityValue } from \"../../clarity/types.ts\";\nimport { readContract } from \"./readContract.ts\";\n\nexport type MulticallCall = {\n contract: string;\n functionName: string;\n args?: ClarityValue[];\n sender?: string;\n};\n\nexport type MulticallParams<TAllowFailure extends boolean = true> = {\n calls: readonly MulticallCall[];\n allowFailure?: TAllowFailure;\n};\n\nexport type MulticallSuccessResult = { status: \"success\"; result: ClarityValue };\nexport type MulticallFailureResult = { status: \"failure\"; error: Error };\n\nexport type MulticallResult<T extends boolean> = T extends true\n ? (MulticallSuccessResult | MulticallFailureResult)[]\n : ClarityValue[];\n\nexport async function multicall<TAllowFailure extends boolean = true>(\n client: Client,\n params: MulticallParams<TAllowFailure>\n): Promise<MulticallResult<TAllowFailure>> {\n const { calls, allowFailure = true } = params;\n\n if (allowFailure) {\n const settled = await Promise.allSettled(\n calls.map((call) => readContract(client, call))\n );\n return settled.map((r) =>\n r.status === \"fulfilled\"\n ? { status: \"success\" as const, result: r.value }\n : { status: \"failure\" as const, error: r.reason instanceof Error ? r.reason : new Error(String(r.reason)) }\n ) as MulticallResult<TAllowFailure>;\n }\n\n const results = await Promise.all(\n calls.map((call) => readContract(client, call))\n );\n return results as MulticallResult<TAllowFailure>;\n}\n",
11
- "import { BaseError } from \"./base.ts\";\n\nexport class SimulationError extends BaseError {\n override name = \"SimulationError\";\n writesDetected: boolean;\n\n constructor(\n message: string,\n options: { writesDetected: boolean; details?: string }\n ) {\n super(message, { details: options.details });\n this.writesDetected = options.writesDetected;\n }\n}\n",
12
- "import type { Client } from \"../../clients/types.ts\";\nimport type { ClarityValue } from \"../../clarity/types.ts\";\nimport { serializeCVBytes } from \"../../clarity/serialize.ts\";\nimport { deserializeCVBytes } from \"../../clarity/deserialize.ts\";\nimport { bytesToHex, with0x } from \"../../utils/encoding.ts\";\nimport { parseContractId } from \"../../utils/address.ts\";\nimport { SimulationError } from \"../../errors/simulation.ts\";\n\nexport type SimulateCallParams = {\n contract: string;\n functionName: string;\n args?: ClarityValue[];\n sender?: string;\n tip?: 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 client: Client,\n params: SimulateCallParams\n): Promise<SimulateCallResult> {\n const [address, name] = parseContractId(params.contract);\n const sender = params.sender ?? address;\n\n const serializedArgs = (params.args ?? []).map((arg) =>\n with0x(bytesToHex(serializeCVBytes(arg)))\n );\n\n let path = `/v2/contracts/call-read/${address}/${name}/${params.functionName}`;\n if (params.tip) {\n path += `?tip=${params.tip}`;\n }\n\n const data = await client.request(path, {\n method: \"POST\",\n body: {\n sender,\n arguments: serializedArgs,\n },\n });\n\n if (data.okay) {\n return { success: true, result: deserializeCVBytes(data.result) };\n }\n\n const cause: string = data.cause ?? \"Simulation failed\";\n const writesDetected =\n cause.includes(\"NotReadOnly\") || cause.includes(\"CostBalanceExceeded\");\n\n return {\n success: false,\n error: new SimulationError(\n writesDetected\n ? \"Function mutates state and cannot be simulated\"\n : \"Simulation failed\",\n { writesDetected, details: cause }\n ),\n };\n}\n",
13
- "import type { Client } from \"../../clients/types.ts\";\nimport type { StacksTransaction } from \"../../transactions/types.ts\";\nimport { PayloadType, AddressHashMode } from \"../../transactions/types.ts\";\nimport { c32address } from \"../../utils/address.ts\";\nimport { simulateCall, type SimulateCallResult } from \"./simulateCall.ts\";\nimport { estimateFee, type FeeEstimation } from \"./estimateFee.ts\";\n\nexport type SimulateTransactionParams = {\n transaction: StacksTransaction;\n sender?: string;\n tip?: string;\n};\n\nexport type SimulateContractCallResult = {\n type: \"contract-call\";\n execution: SimulateCallResult;\n fees: FeeEstimation[];\n};\n\nexport type SimulateTransferResult = {\n type: \"token-transfer\";\n fees: FeeEstimation[];\n};\n\nexport type SimulateDeployResult = {\n type: \"contract-deploy\";\n fees: FeeEstimation[];\n};\n\nexport type SimulateTransactionResult =\n | SimulateContractCallResult\n | SimulateTransferResult\n | SimulateDeployResult;\n\nfunction isMultiSig(hashMode: number): boolean {\n return (\n hashMode === AddressHashMode.P2SH ||\n hashMode === AddressHashMode.P2WSH ||\n hashMode === AddressHashMode.P2SH_NonSequential ||\n hashMode === AddressHashMode.P2WSH_P2SH_NonSequential\n );\n}\n\nfunction extractSender(tx: StacksTransaction, client: Client): string {\n const { hashMode, signer } = tx.auth.spendingCondition;\n const chain = client.chain;\n const version = isMultiSig(hashMode)\n ? chain?.addressVersion.multiSig ?? 20\n : chain?.addressVersion.singleSig ?? 22;\n return c32address(version, signer);\n}\n\nexport async function simulateTransaction(\n client: Client,\n params: SimulateTransactionParams,\n): Promise<SimulateTransactionResult> {\n const { transaction, tip } = params;\n const { payload } = transaction;\n\n if (payload.payloadType === PayloadType.ContractCall) {\n const sender = params.sender ?? extractSender(transaction, client);\n const contract = `${payload.contractAddress}.${payload.contractName}`;\n\n const [execution, fees] = await Promise.all([\n simulateCall(client, {\n contract,\n functionName: payload.functionName,\n args: payload.functionArgs,\n sender,\n tip,\n }),\n estimateFee(client, { transaction }),\n ]);\n\n return { type: \"contract-call\", execution, fees };\n }\n\n const fees = await estimateFee(client, { transaction });\n\n if (\n payload.payloadType === PayloadType.SmartContract ||\n payload.payloadType === PayloadType.VersionedSmartContract\n ) {\n return { type: \"contract-deploy\", fees };\n }\n\n return { type: \"token-transfer\", fees };\n}\n",
14
- "import type { Client } from \"../../clients/types.ts\";\nimport { signTransactionWithAccount } from \"../../transactions/signer.ts\";\nimport { signMultiSigWithAccount } from \"../../transactions/multisig.ts\";\nimport { serializeTransactionHex } from \"../../transactions/wire/serialize.ts\";\nimport { deserializeTransaction } from \"../../transactions/wire/deserialize.ts\";\nimport type { StacksTransaction } from \"../../transactions/types.ts\";\nimport { isProviderAccount } from \"./utils.ts\";\n\nexport type SignTransactionParams = {\n transaction: StacksTransaction;\n /** Public keys for multi-sig signing (auto-detected from _multisig metadata if omitted) */\n signers?: string[];\n};\n\n/** Sign a transaction using the client's account */\nexport async function signTransactionAction(\n client: Client,\n params: SignTransactionParams\n): Promise<StacksTransaction> {\n const account = client.account;\n if (!account) throw new Error(\"Account required\");\n\n // Provider: send hex to wallet, get signed hex back\n if (isProviderAccount(account)) {\n const hex = serializeTransactionHex(params.transaction);\n const result = await account.provider.request(\"stx_signTransaction\", {\n transaction: hex,\n });\n return deserializeTransaction(result.transaction);\n }\n\n // Multi-sig: auto-detect from fields or _multisig metadata\n const condition = params.transaction.auth.spendingCondition;\n if (\"fields\" in condition) {\n const publicKeys = params.signers ?? (params.transaction as any)._multisig?.publicKeys;\n if (!publicKeys) throw new Error(\"Multi-sig signing requires signers (publicKeys)\");\n return signMultiSigWithAccount(params.transaction, account, publicKeys);\n }\n\n // Local/Custom: sign with account\n return signTransactionWithAccount(params.transaction, account);\n}\n",
15
- "import type { Client } from \"../../clients/types.ts\";\nimport type { PostCondition } from \"../../postconditions/types.ts\";\nimport type { IntegerType } from \"../../utils/encoding.ts\";\nimport { buildTokenTransfer } from \"../../transactions/build.ts\";\nimport { signTransactionWithAccount } from \"../../transactions/signer.ts\";\nimport { sendTransaction } from \"./sendTransaction.ts\";\nimport { getNonce } from \"../public/getNonce.ts\";\nimport { estimateFee } from \"../public/estimateFee.ts\";\nimport { isProviderAccount } from \"./utils.ts\";\n\nexport type TransferStxParams = {\n to: string;\n amount: IntegerType;\n memo?: string;\n fee?: IntegerType;\n nonce?: IntegerType;\n postConditionMode?: \"allow\" | \"deny\";\n postConditions?: PostCondition[];\n};\n\n/** Build, sign, and broadcast an STX transfer */\nexport async function transferStx(\n client: Client,\n params: TransferStxParams\n): Promise<string> {\n const account = client.account;\n if (!account) throw new Error(\"Account required\");\n\n // Provider: delegate to wallet\n if (isProviderAccount(account)) {\n const result = await account.provider.request(\"stx_transferStx\", {\n recipient: params.to,\n amount: String(params.amount),\n memo: params.memo,\n });\n return result.txid;\n }\n\n // Local/Custom: build → sign → broadcast\n const nonce =\n params.nonce ?? await getNonce(client, { address: account.address });\n\n const unsigned = buildTokenTransfer({\n recipient: params.to,\n amount: params.amount,\n memo: params.memo,\n fee: params.fee ?? 0n,\n nonce,\n publicKey: account.publicKey,\n chain: client.chain,\n postConditionMode: params.postConditionMode,\n postConditions: params.postConditions,\n });\n\n if (params.fee === undefined) {\n const estimates = await estimateFee(client, { transaction: unsigned });\n const mid = estimates[1] ?? estimates[0];\n if (mid) {\n (unsigned.auth.spendingCondition as any).fee = BigInt(mid.fee);\n }\n }\n\n const signed = await signTransactionWithAccount(unsigned, account);\n const result = await sendTransaction(client, { transaction: signed });\n return result.txid;\n}\n",
16
- "import type { Client } from \"../../clients/types.ts\";\nimport type { ClarityVersion } from \"../../transactions/types.ts\";\nimport type { PostCondition } from \"../../postconditions/types.ts\";\nimport type { IntegerType } from \"../../utils/encoding.ts\";\nimport { buildContractDeploy } from \"../../transactions/build.ts\";\nimport { signTransactionWithAccount } from \"../../transactions/signer.ts\";\nimport { sendTransaction } from \"./sendTransaction.ts\";\nimport { getNonce } from \"../public/getNonce.ts\";\nimport { estimateFee } from \"../public/estimateFee.ts\";\nimport { isProviderAccount } from \"./utils.ts\";\n\nexport type DeployContractParams = {\n contractName: string;\n codeBody: string;\n clarityVersion?: ClarityVersion;\n fee?: IntegerType;\n nonce?: IntegerType;\n postConditionMode?: \"allow\" | \"deny\";\n postConditions?: PostCondition[];\n};\n\n/** Build, sign, and broadcast a contract deploy */\nexport async function deployContract(\n client: Client,\n params: DeployContractParams\n): Promise<string> {\n const account = client.account;\n if (!account) throw new Error(\"Account required\");\n\n // Provider: delegate to wallet\n if (isProviderAccount(account)) {\n const result = await account.provider.request(\"stx_deployContract\", {\n contractName: params.contractName,\n codeBody: params.codeBody,\n clarityVersion: params.clarityVersion,\n });\n return result.txid;\n }\n\n // Local/Custom: build → sign → broadcast\n const nonce =\n params.nonce ?? await getNonce(client, { address: account.address });\n\n const unsigned = buildContractDeploy({\n contractName: params.contractName,\n codeBody: params.codeBody,\n clarityVersion: params.clarityVersion,\n fee: params.fee ?? 0n,\n nonce,\n publicKey: account.publicKey,\n chain: client.chain,\n postConditionMode: params.postConditionMode,\n postConditions: params.postConditions,\n });\n\n if (params.fee === undefined) {\n const estimates = await estimateFee(client, { transaction: unsigned });\n const mid = estimates[1] ?? estimates[0];\n if (mid) {\n (unsigned.auth.spendingCondition as any).fee = BigInt(mid.fee);\n }\n }\n\n const signed = await signTransactionWithAccount(unsigned, account);\n const result = await sendTransaction(client, { transaction: signed });\n return result.txid;\n}\n",
17
- "import type { Client } from \"../../clients/types.ts\";\nimport type { ClarityValue } from \"../../clarity/types.ts\";\nimport { Cl } from \"../../clarity/values.ts\";\nimport { serializeCVBytes } from \"../../clarity/serialize.ts\";\nimport { concatBytes, bytesToHex } from \"../../utils/encoding.ts\";\nimport { sha256 } from \"@noble/hashes/sha2.js\";\nimport { isProviderAccount } from \"./utils.ts\";\n\nexport type SignMessageParams = {\n message: string | ClarityValue;\n domain?: {\n name: string;\n version: string;\n chainId: number;\n };\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 client: Client,\n params: SignMessageParams\n): Promise<string> {\n const account = client.account;\n if (!account) throw new Error(\"Account required\");\n\n // Provider: delegate to wallet\n if (isProviderAccount(account)) {\n const method = params.domain\n ? \"stx_signStructuredMessage\"\n : \"stx_signMessage\";\n const result = await account.provider.request(method, {\n message: params.message,\n domain: params.domain,\n });\n return result.signature;\n }\n\n // Local/Custom: sign locally\n const cv =\n typeof params.message === \"string\"\n ? Cl.stringAscii(params.message)\n : params.message;\n\n const serializedMsg = serializeCVBytes(cv);\n\n let hash: Uint8Array;\n\n if (params.domain) {\n const domainCV = Cl.tuple({\n name: Cl.stringAscii(params.domain.name),\n version: Cl.stringAscii(params.domain.version),\n \"chain-id\": Cl.uint(params.domain.chainId),\n });\n const serializedDomain = serializeCVBytes(domainCV);\n hash = sha256(concatBytes(SIP018_PREFIX, serializedDomain, serializedMsg));\n } else {\n hash = sha256(serializedMsg);\n }\n\n const sigBytes = await account.sign(hash);\n return bytesToHex(sigBytes);\n}\n",
18
- "import type { Client } from \"../../clients/types.ts\";\nimport type { IntegerType } from \"../../utils/encoding.ts\";\nimport { intToBigInt } from \"../../utils/encoding.ts\";\nimport {\n AuthType,\n type StacksTransaction,\n type SponsoredAuthorization,\n} from \"../../transactions/types.ts\";\nimport { createSingleSigSpendingCondition } from \"../../transactions/authorization.ts\";\nimport { signSponsorWithAccount } from \"../../transactions/signer.ts\";\nimport { getNonce } from \"../public/getNonce.ts\";\nimport { estimateFee } from \"../public/estimateFee.ts\";\nimport { isProviderAccount } from \"./utils.ts\";\n\nexport type SponsorTransactionParams = {\n transaction: StacksTransaction;\n fee?: IntegerType;\n nonce?: IntegerType;\n};\n\n/** Sponsor a transaction: set sponsor spending condition, sign as sponsor */\nexport async function sponsorTransaction(\n client: Client,\n params: SponsorTransactionParams\n): Promise<StacksTransaction> {\n const { transaction } = params;\n\n if (transaction.auth.authType !== AuthType.Sponsored) {\n throw new Error(\"Transaction must have sponsored authorization\");\n }\n\n const account = client.account;\n if (!account) throw new Error(\"Account required\");\n if (isProviderAccount(account)) {\n throw new Error(\"Provider accounts cannot sponsor transactions\");\n }\n\n // Resolve sponsor nonce\n const nonce = params.nonce != null\n ? intToBigInt(params.nonce)\n : await getNonce(client, { address: account.address });\n\n // Resolve sponsor fee\n let fee: bigint;\n if (params.fee != null) {\n fee = intToBigInt(params.fee);\n } else {\n const estimates = await estimateFee(client, { transaction });\n const mid = estimates[1] ?? estimates[0];\n fee = mid ? BigInt(mid.fee) : 0n;\n }\n\n // Create sponsor spending condition\n const sponsorCondition = createSingleSigSpendingCondition(\n account.publicKey,\n nonce,\n fee\n );\n\n // Set sponsor spending condition on the tx\n const auth = transaction.auth as SponsoredAuthorization;\n const sponsored: StacksTransaction = {\n ...transaction,\n auth: {\n ...auth,\n sponsorS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AAM;AAAA,IACtB,MAAM,YAAY,OAAO,GAAG;AAAA,EAC9B,EAAO;AAAA,IACL,MAAM,YAAY,MAAM,YAAY,QAAQ,EAAE,YAAY,CAAC;AAAA,IAC3D,MAAM,MAAM,UAAU,MAAM,UAAU;AAAA,IACtC,MAAM,MAAM,OAAO,IAAI,GAAG,IAAI;AAAA;AAAA,EAIhC,MAAM,mBAAmB,iCACvB,QAAQ,WACR,OACA,GACF;AAAA,EAGA,MAAM,OAAO,YAAY;AAAA,EACzB,MAAM,YAA+B;AAAA,OAChC;AAAA,IACH,MAAM;AAAA,SACD;AAAA,MACH,0BAA0B;AAAA,IAC5B;AAAA,EACF;AAAA,EAGA,OAAO,uBAAuB,WAAW,OAAO;AAAA;",
21
- "debugId": "EB1C10EEB8BA72D364756E2164756E21",
22
- "names": []
23
- }
@@ -1,15 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../src/transactions/types.ts", "../src/transactions/wire/serialize.ts", "../src/transactions/authorization.ts", "../src/transactions/multisig.ts", "../src/transactions/signer.ts", "../src/transactions/build.ts"],
4
- "sourcesContent": [
5
- "import type { ClarityValue } from \"../clarity/types.ts\";\n\n// Auth types\nexport const AuthType = {\n Standard: 0x04,\n Sponsored: 0x05,\n} as const;\nexport type AuthType = (typeof AuthType)[keyof typeof AuthType];\n\n// Payload types\nexport const PayloadType = {\n TokenTransfer: 0x00,\n SmartContract: 0x01,\n ContractCall: 0x02,\n PoisonMicroblock: 0x03,\n Coinbase: 0x04,\n CoinbaseToAltRecipient: 0x05,\n VersionedSmartContract: 0x06,\n TenureChange: 0x07,\n NakamotoCoinbase: 0x08,\n} as const;\nexport type PayloadType = (typeof PayloadType)[keyof typeof PayloadType];\n\n// Clarity version\nexport const ClarityVersion = {\n Clarity1: 1,\n Clarity2: 2,\n Clarity3: 3,\n} as const;\nexport type ClarityVersion = (typeof ClarityVersion)[keyof typeof ClarityVersion];\n\n// Anchor mode (deprecated post-Nakamoto, but needed for wire format)\nexport const AnchorMode = {\n OnChainOnly: 0x01,\n OffChainOnly: 0x02,\n Any: 0x03,\n} as const;\nexport type AnchorMode = (typeof AnchorMode)[keyof typeof AnchorMode];\n\n// Post condition mode\nexport const PostConditionModeWire = {\n Allow: 0x01,\n Deny: 0x02,\n} as const;\nexport type PostConditionModeWire =\n (typeof PostConditionModeWire)[keyof typeof PostConditionModeWire];\n\n// Address hash modes\nexport const AddressHashMode = {\n P2PKH: 0x00,\n P2SH: 0x01,\n P2WPKH: 0x02,\n P2WSH: 0x03,\n P2SH_NonSequential: 0x05, // SIP-027\n P2WSH_P2SH_NonSequential: 0x07, // SIP-027\n} as const;\nexport type AddressHashMode = (typeof AddressHashMode)[keyof typeof AddressHashMode];\n\n// Pub key encoding\nexport const PubKeyEncoding = {\n Compressed: 0x00,\n Uncompressed: 0x01,\n} as const;\nexport type PubKeyEncoding = (typeof PubKeyEncoding)[keyof typeof PubKeyEncoding];\n\n// Fungible condition codes (wire format)\nexport const FungibleConditionCode = {\n Equal: 0x01,\n Greater: 0x02,\n GreaterEqual: 0x03,\n Less: 0x04,\n LessEqual: 0x05,\n} as const;\n\n// Non-fungible condition codes (wire format)\nexport const NonFungibleConditionCode = {\n Sends: 0x10,\n DoesNotSend: 0x11,\n} as const;\n\n// Post condition principal types\nexport const PostConditionPrincipalId = {\n Origin: 0x01,\n Standard: 0x02,\n Contract: 0x03,\n} as const;\n\n// Post condition asset types\nexport const AssetType = {\n STX: 0x00,\n Fungible: 0x01,\n NonFungible: 0x02,\n} as const;\n\n// Auth field types\nexport const AuthFieldType = {\n PublicKeyCompressed: 0x00,\n PublicKeyUncompressed: 0x01,\n SignatureCompressed: 0x02,\n SignatureUncompressed: 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 BlockFound: 0x00,\n Extended: 0x01,\n} as const;\nexport type TenureChangeCause = (typeof TenureChangeCause)[keyof typeof TenureChangeCause];\n\n// Token transfer payload\nexport type TokenTransferPayload = {\n payloadType: typeof PayloadType.TokenTransfer;\n recipient: ClarityValue; // PrincipalCV\n amount: bigint;\n memo: string;\n};\n\n// Contract call payload\nexport type ContractCallPayload = {\n payloadType: typeof PayloadType.ContractCall;\n contractAddress: string;\n contractName: string;\n functionName: string;\n functionArgs: ClarityValue[];\n};\n\n// Smart contract deploy payload\nexport type SmartContractPayload = {\n payloadType: typeof PayloadType.SmartContract | typeof PayloadType.VersionedSmartContract;\n clarityVersion?: ClarityVersion;\n contractName: string;\n codeBody: string;\n};\n\n// Coinbase payload (appears in every pre-Nakamoto block)\nexport type CoinbasePayload = {\n payloadType: typeof PayloadType.Coinbase;\n coinbaseBuffer: string; // 32 bytes hex\n};\n\n// Coinbase to alt recipient payload\nexport type CoinbaseToAltRecipientPayload = {\n payloadType: typeof PayloadType.CoinbaseToAltRecipient;\n coinbaseBuffer: string; // 32 bytes hex\n recipient: ClarityValue; // PrincipalCV\n};\n\n// Poison microblock payload\nexport type PoisonMicroblockPayload = {\n payloadType: typeof PayloadType.PoisonMicroblock;\n header1: string; // 132 bytes hex (raw microblock header)\n header2: string; // 132 bytes hex (raw microblock header)\n};\n\n// Tenure change payload (Nakamoto)\nexport type TenureChangePayload = {\n payloadType: typeof PayloadType.TenureChange;\n tenureConsensusHash: string; // 20 bytes hex\n prevTenureConsensusHash: string; // 20 bytes hex\n burnViewConsensusHash: string; // 20 bytes hex\n previousTenureEnd: string; // 32 bytes hex\n previousTenureBlocks: number; // u32\n cause: TenureChangeCause;\n pubkeyHash: string; // 20 bytes hex\n};\n\n// Nakamoto coinbase payload\nexport type NakamotoCoinbasePayload = {\n payloadType: typeof PayloadType.NakamotoCoinbase;\n coinbaseBuffer: string; // 32 bytes hex\n recipient: ClarityValue | null; // Optional PrincipalCV\n vrfProof: string; // 80 bytes hex\n};\n\nexport type TransactionPayload =\n | TokenTransferPayload\n | ContractCallPayload\n | SmartContractPayload\n | CoinbasePayload\n | CoinbaseToAltRecipientPayload\n | PoisonMicroblockPayload\n | TenureChangePayload\n | NakamotoCoinbasePayload;\n\n// Spending condition\nexport type SingleSigSpendingCondition = {\n hashMode: typeof AddressHashMode.P2PKH | typeof AddressHashMode.P2WPKH;\n signer: string; // hash160 hex\n nonce: bigint;\n fee: bigint;\n keyEncoding: PubKeyEncoding;\n signature: string; // 65-byte recoverable sig hex\n};\n\nexport type TransactionAuthField = {\n pubKeyEncoding: PubKeyEncoding;\n type: \"publicKey\" | \"signature\";\n data: string; // hex\n};\n\nexport type MultiSigHashMode =\n | typeof AddressHashMode.P2SH\n | typeof AddressHashMode.P2WSH\n | typeof AddressHashMode.P2SH_NonSequential\n | typeof AddressHashMode.P2WSH_P2SH_NonSequential;\n\nexport type MultiSigSpendingCondition = {\n hashMode: MultiSigHashMode;\n signer: string;\n nonce: bigint;\n fee: bigint;\n fields: TransactionAuthField[];\n signaturesRequired: number;\n};\n\nexport type SpendingCondition = SingleSigSpendingCondition | MultiSigSpendingCondition;\n\nexport type StandardAuthorization = {\n authType: typeof AuthType.Standard;\n spendingCondition: SpendingCondition;\n};\n\nexport type SponsoredAuthorization = {\n authType: typeof AuthType.Sponsored;\n spendingCondition: SpendingCondition;\n sponsorSpendingCondition: SpendingCondition;\n};\n\nexport type Authorization = StandardAuthorization | SponsoredAuthorization;\n\n// Full transaction\nexport type StacksTransaction = {\n version: number;\n chainId: number;\n auth: Authorization;\n anchorMode: AnchorMode;\n postConditionMode: PostConditionModeWire;\n postConditions: PostConditionWire[];\n payload: TransactionPayload;\n};\n\n// Wire post condition types\nexport type PostConditionWire = StxPostConditionWire | FtPostConditionWire | NftPostConditionWire;\n\nexport type StxPostConditionWire = {\n type: \"stx\";\n principal: PostConditionPrincipalWire;\n conditionCode: number;\n amount: bigint;\n};\n\nexport type FtPostConditionWire = {\n type: \"ft\";\n principal: PostConditionPrincipalWire;\n asset: AssetInfoWire;\n conditionCode: number;\n amount: bigint;\n};\n\nexport type NftPostConditionWire = {\n type: \"nft\";\n principal: PostConditionPrincipalWire;\n asset: AssetInfoWire;\n conditionCode: number;\n assetId: ClarityValue;\n};\n\nexport type PostConditionPrincipalWire =\n | { type: \"origin\" }\n | { type: \"standard\"; address: string }\n | { type: \"contract\"; address: string; contractName: string };\n\nexport type AssetInfoWire = {\n address: string;\n contractName: string;\n assetName: string;\n};\n",
6
- "import {\n bytesToHex,\n hexToBytes,\n concatBytes,\n intToBytes,\n intToHex,\n utf8ToBytes,\n asciiToBytes,\n writeUInt32BE,\n writeUInt16BE,\n writeUInt8,\n} from \"../../utils/encoding.ts\";\nimport { c32addressDecode } from \"../../utils/c32.ts\";\nimport { serializeCVBytes } from \"../../clarity/serialize.ts\";\nimport {\n AuthType,\n PayloadType,\n PostConditionPrincipalId,\n AssetType,\n MEMO_MAX_LENGTH_BYTES,\n type StacksTransaction,\n type Authorization,\n type SpendingCondition,\n type SingleSigSpendingCondition,\n type MultiSigSpendingCondition,\n type TransactionPayload,\n type PostConditionWire,\n type PostConditionPrincipalWire,\n type AssetInfoWire,\n type TransactionAuthField,\n type CoinbasePayload,\n type CoinbaseToAltRecipientPayload,\n type PoisonMicroblockPayload,\n type TenureChangePayload as TenureChangePayloadType,\n type NakamotoCoinbasePayload,\n} from \"../types.ts\";\n\n// Address serialization: version (1 byte) + hash160 (20 bytes)\nfunction serializeAddress(c32Address: string): Uint8Array {\n const [version, hash160] = c32addressDecode(c32Address);\n return 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 const content = utf8ToBytes(str);\n const prefix = hexToBytes(intToHex(content.byteLength, prefixBytes));\n return concatBytes(prefix, content);\n}\n\n// LP string for code body (4-byte prefix)\nfunction serializeLPStringLong(str: string): Uint8Array {\n return serializeLPString(str, 4);\n}\n\n// Memo: padded to MEMO_MAX_LENGTH_BYTES\nfunction serializeMemo(memo: string): Uint8Array {\n const content = asciiToBytes(memo);\n const padded = new Uint8Array(MEMO_MAX_LENGTH_BYTES);\n padded.set(content.slice(0, MEMO_MAX_LENGTH_BYTES));\n return concatBytes(writeUInt8(content.length), padded);\n}\n\nfunction serializeSpendingCondition(condition: SpendingCondition): Uint8Array {\n const parts: Uint8Array[] = [\n writeUInt8(condition.hashMode),\n hexToBytes(condition.signer), // 20 bytes\n intToBytes(condition.nonce, 8),\n intToBytes(condition.fee, 8),\n ];\n\n if (\"signature\" in condition) {\n // Single sig\n const sc = condition as SingleSigSpendingCondition;\n parts.push(writeUInt8(sc.keyEncoding));\n parts.push(hexToBytes(sc.signature)); // 65 bytes\n } else {\n // Multi sig\n const mc = condition as MultiSigSpendingCondition;\n // Fields as LP list\n parts.push(writeUInt32BE(mc.fields.length));\n for (const field of mc.fields) {\n parts.push(serializeAuthField(field));\n }\n parts.push(writeUInt16BE(mc.signaturesRequired));\n }\n\n return concatBytes(...parts);\n}\n\nfunction serializeAuthField(field: TransactionAuthField): Uint8Array {\n if (field.type === \"publicKey\") {\n const typeId = field.pubKeyEncoding === 0x00 ? 0x00 : 0x01;\n return concatBytes(writeUInt8(typeId), hexToBytes(field.data));\n } else {\n const typeId = field.pubKeyEncoding === 0x00 ? 0x02 : 0x03;\n return concatBytes(writeUInt8(typeId), hexToBytes(field.data));\n }\n}\n\nfunction serializeAuthorization(auth: Authorization): Uint8Array {\n const parts: Uint8Array[] = [writeUInt8(auth.authType)];\n parts.push(serializeSpendingCondition(auth.spendingCondition));\n if (auth.authType === AuthType.Sponsored) {\n parts.push(serializeSpendingCondition(auth.sponsorSpendingCondition));\n }\n return concatBytes(...parts);\n}\n\nfunction serializePrincipal(principal: PostConditionPrincipalWire): Uint8Array {\n switch (principal.type) {\n case \"origin\":\n return writeUInt8(PostConditionPrincipalId.Origin);\n case \"standard\":\n return concatBytes(\n writeUInt8(PostConditionPrincipalId.Standard),\n serializeAddress(principal.address)\n );\n case \"contract\":\n return concatBytes(\n writeUInt8(PostConditionPrincipalId.Contract),\n serializeAddress(principal.address),\n serializeLPString(principal.contractName)\n );\n }\n}\n\nfunction serializeAssetInfo(asset: AssetInfoWire): Uint8Array {\n return concatBytes(\n serializeAddress(asset.address),\n serializeLPString(asset.contractName),\n serializeLPString(asset.assetName)\n );\n}\n\nfunction serializePostCondition(pc: PostConditionWire): Uint8Array {\n const parts: Uint8Array[] = [serializePrincipal(pc.principal)];\n\n switch (pc.type) {\n case \"stx\":\n parts.push(writeUInt8(AssetType.STX));\n parts.push(writeUInt8(pc.conditionCode));\n parts.push(intToBytes(pc.amount, 8));\n break;\n case \"ft\":\n parts.push(writeUInt8(AssetType.Fungible));\n parts.push(serializeAssetInfo(pc.asset));\n parts.push(writeUInt8(pc.conditionCode));\n parts.push(intToBytes(pc.amount, 8));\n break;\n case \"nft\":\n parts.push(writeUInt8(AssetType.NonFungible));\n parts.push(serializeAssetInfo(pc.asset));\n parts.push(serializeCVBytes(pc.assetId));\n parts.push(writeUInt8(pc.conditionCode));\n break;\n }\n\n return concatBytes(...parts);\n}\n\nfunction serializePostConditions(pcs: PostConditionWire[]): Uint8Array {\n const parts: Uint8Array[] = [writeUInt32BE(pcs.length)];\n for (const pc of pcs) {\n parts.push(serializePostCondition(pc));\n }\n return concatBytes(...parts);\n}\n\nexport function serializePayload(payload: TransactionPayload): Uint8Array {\n const parts: Uint8Array[] = [writeUInt8(payload.payloadType)];\n\n switch (payload.payloadType) {\n case PayloadType.TokenTransfer:\n parts.push(serializeCVBytes(payload.recipient));\n parts.push(intToBytes(payload.amount, 8));\n parts.push(serializeMemo(payload.memo));\n break;\n\n case PayloadType.ContractCall:\n parts.push(serializeAddress(payload.contractAddress));\n parts.push(serializeLPString(payload.contractName));\n parts.push(serializeLPString(payload.functionName));\n parts.push(writeUInt32BE(payload.functionArgs.length));\n for (const arg of payload.functionArgs) {\n parts.push(serializeCVBytes(arg));\n }\n break;\n\n case PayloadType.SmartContract:\n parts.push(serializeLPString(payload.contractName));\n parts.push(serializeLPStringLong(payload.codeBody));\n break;\n\n case PayloadType.VersionedSmartContract:\n parts.push(writeUInt8(payload.clarityVersion ?? 2));\n parts.push(serializeLPString(payload.contractName));\n parts.push(serializeLPStringLong(payload.codeBody));\n break;\n\n case PayloadType.Coinbase:\n parts.push(hexToBytes((payload as CoinbasePayload).coinbaseBuffer));\n break;\n\n case PayloadType.CoinbaseToAltRecipient: {\n const cbAlt = payload as CoinbaseToAltRecipientPayload;\n parts.push(hexToBytes(cbAlt.coinbaseBuffer));\n parts.push(serializeCVBytes(cbAlt.recipient));\n break;\n }\n\n case PayloadType.PoisonMicroblock: {\n const pm = payload as PoisonMicroblockPayload;\n parts.push(hexToBytes(pm.header1));\n parts.push(hexToBytes(pm.header2));\n break;\n }\n\n case PayloadType.TenureChange: {\n const tc = payload as TenureChangePayloadType;\n parts.push(hexToBytes(tc.tenureConsensusHash));\n parts.push(hexToBytes(tc.prevTenureConsensusHash));\n parts.push(hexToBytes(tc.burnViewConsensusHash));\n parts.push(hexToBytes(tc.previousTenureEnd));\n parts.push(writeUInt32BE(tc.previousTenureBlocks));\n parts.push(writeUInt8(tc.cause));\n parts.push(hexToBytes(tc.pubkeyHash));\n break;\n }\n\n case PayloadType.NakamotoCoinbase: {\n const nc = payload as NakamotoCoinbasePayload;\n parts.push(hexToBytes(nc.coinbaseBuffer));\n if (nc.recipient) {\n parts.push(serializeCVBytes({ type: \"some\", value: nc.recipient }));\n } else {\n parts.push(serializeCVBytes({ type: \"none\" }));\n }\n parts.push(hexToBytes(nc.vrfProof));\n break;\n }\n }\n\n return concatBytes(...parts);\n}\n\nexport function serializeTransaction(tx: StacksTransaction): Uint8Array {\n return concatBytes(\n writeUInt8(tx.version),\n writeUInt32BE(tx.chainId),\n serializeAuthorization(tx.auth),\n writeUInt8(tx.anchorMode),\n writeUInt8(tx.postConditionMode),\n serializePostConditions(tx.postConditions),\n serializePayload(tx.payload)\n );\n}\n\nexport function serializeTransactionHex(tx: StacksTransaction): string {\n return bytesToHex(serializeTransaction(tx));\n}\n",
7
- "import {\n getPublicKey as nobleGetPublicKey,\n sign,\n etc,\n} from \"@noble/secp256k1\";\nimport { hmac } from \"@noble/hashes/hmac.js\";\nimport { sha256 } from \"@noble/hashes/sha2.js\";\nimport {\n bytesToHex,\n hexToBytes,\n intToBytes,\n intToHex,\n concatBytes,\n} from \"../utils/encoding.ts\";\nimport { hashP2PKH, txidFromBytes } from \"../utils/hash.ts\";\nimport {\n AuthType,\n AddressHashMode,\n PubKeyEncoding,\n RECOVERABLE_ECDSA_SIG_LENGTH_BYTES,\n type SingleSigSpendingCondition,\n type SpendingCondition,\n type Authorization,\n type StandardAuthorization,\n type SponsoredAuthorization,\n} from \"./types.ts\";\n\n// Ensure sync signing is available\netc.hmacSha256Sync = (key: Uint8Array, ...msgs: Uint8Array[]) => {\n const h = hmac.create(sha256, key);\n msgs.forEach((msg) => h.update(msg));\n return h.digest();\n};\n\nconst EMPTY_SIG = bytesToHex(new Uint8Array(RECOVERABLE_ECDSA_SIG_LENGTH_BYTES));\n\nexport function createSingleSigSpendingCondition(\n publicKey: string,\n nonce: bigint,\n fee: bigint\n): SingleSigSpendingCondition {\n const pubKeyBytes = hexToBytes(publicKey);\n const signer = hashP2PKH(pubKeyBytes);\n const isCompressed = pubKeyBytes.length === 33;\n\n return {\n hashMode: AddressHashMode.P2PKH,\n signer,\n nonce,\n fee,\n keyEncoding: isCompressed ? PubKeyEncoding.Compressed : PubKeyEncoding.Uncompressed,\n signature: EMPTY_SIG,\n };\n}\n\nexport function createStandardAuth(\n spendingCondition: SpendingCondition\n): StandardAuthorization {\n return { authType: AuthType.Standard, spendingCondition };\n}\n\nexport function createSponsoredAuth(\n spendingCondition: SpendingCondition,\n sponsorSpendingCondition?: SpendingCondition\n): SponsoredAuthorization {\n return {\n authType: AuthType.Sponsored,\n spendingCondition,\n sponsorSpendingCondition: sponsorSpendingCondition ?? createSingleSigSpendingCondition(\n \"0\".repeat(66),\n 0n,\n 0n\n ),\n };\n}\n\nfunction clearCondition(condition: SpendingCondition): SpendingCondition {\n if (\"signature\" in condition) {\n return {\n ...condition,\n nonce: 0n,\n fee: 0n,\n signature: EMPTY_SIG,\n };\n }\n return {\n ...condition,\n nonce: 0n,\n fee: 0n,\n fields: [],\n };\n}\n\nexport function intoInitialSighashAuth(auth: Authorization): Authorization {\n if (auth.authType === AuthType.Standard) {\n return createStandardAuth(clearCondition(auth.spendingCondition));\n }\n return createSponsoredAuth(\n clearCondition(auth.spendingCondition),\n clearCondition(createSingleSigSpendingCondition(\"0\".repeat(66), 0n, 0n))\n );\n}\n\n/** Compute pre-sign sighash = sha512/256(prevSigHash + authType + fee + nonce) */\nexport function sigHashPreSign(\n curSigHash: string,\n authType: number,\n fee: bigint,\n nonce: bigint\n): string {\n const data = concatBytes(\n hexToBytes(curSigHash),\n new Uint8Array([authType]),\n intToBytes(fee, 8),\n intToBytes(nonce, 8)\n );\n return txidFromBytes(data);\n}\n\n/** Compute post-sign sighash = sha512/256(preSigHash + pubKeyEncoding + signature) */\nexport function sigHashPostSign(\n curSigHash: string,\n pubKeyEncoding: number,\n signature: string\n): string {\n const data = concatBytes(\n hexToBytes(curSigHash),\n new Uint8Array([pubKeyEncoding]),\n hexToBytes(signature)\n );\n return txidFromBytes(data);\n}\n\n/** Sign with private key and return VRS signature (recoveryId + r + s) */\nfunction signWithKey(privateKey: string, messageHash: string): string {\n const keyBytes = hexToBytes(privateKey).slice(0, 32);\n const sig = sign(messageHash, keyBytes, { lowS: true });\n const recoveryIdHex = intToHex(sig.recovery, 1);\n return recoveryIdHex + sig.toCompactHex();\n}\n\nexport function nextSignature(\n curSigHash: string,\n authType: number,\n fee: bigint,\n nonce: bigint,\n privateKey: string\n): { nextSig: string; nextSigHash: string } {\n const sigHashPre = sigHashPreSign(curSigHash, authType, fee, nonce);\n\n const keyBytes = hexToBytes(privateKey).slice(0, 32);\n const pubKey = nobleGetPublicKey(keyBytes, true);\n const isCompressed = pubKey.length === 33;\n const pubKeyEncoding = isCompressed\n ? PubKeyEncoding.Compressed\n : PubKeyEncoding.Uncompressed;\n\n const nextSig = signWithKey(privateKey, sigHashPre);\n const nextSigHash = sigHashPostSign(sigHashPre, pubKeyEncoding, nextSig);\n\n return { nextSig, nextSigHash };\n}\n",
8
- "import {\n getPublicKey as nobleGetPublicKey,\n sign as nobleSign,\n} from \"@noble/secp256k1\";\nimport { c32address } from \"../utils/c32.ts\";\nimport { bytesToHex, hexToBytes, intToHex, concatBytes } from \"../utils/encoding.ts\";\nimport { hash160 } from \"../utils/hash.ts\";\nimport {\n sigHashPreSign,\n sigHashPostSign,\n intoInitialSighashAuth,\n nextSignature,\n} from \"./authorization.ts\";\nimport { txidFromBytes } from \"../utils/hash.ts\";\nimport { serializeTransaction } from \"./wire/serialize.ts\";\nimport {\n AuthType,\n AddressHashMode,\n PubKeyEncoding,\n type MultiSigSpendingCondition,\n type MultiSigHashMode,\n type TransactionAuthField,\n type StacksTransaction,\n} from \"./types.ts\";\nimport type { StacksChain } from \"../chains/types.ts\";\nimport type { LocalAccount, CustomAccount } from \"../accounts/types.ts\";\n\n// OP codes for redeem script\nconst OP_CHECKMULTISIG = 0xae;\n\n/** Check if hash mode is non-sequential (SIP-027) */\nexport function isNonSequential(hashMode: number): boolean {\n return (hashMode & 0x04) !== 0;\n}\n\n/** Build a Bitcoin-style redeem script for m-of-n multi-sig */\nfunction makeRedeemScript(publicKeys: string[], signaturesRequired: number): Uint8Array {\n const parts: Uint8Array[] = [];\n parts.push(new Uint8Array([0x50 + signaturesRequired])); // OP_n\n for (const pk of publicKeys) {\n const pkBytes = hexToBytes(pk);\n parts.push(new Uint8Array([pkBytes.length])); // length prefix (0x21 for compressed)\n parts.push(pkBytes);\n }\n parts.push(new Uint8Array([0x50 + publicKeys.length])); // OP_m\n parts.push(new Uint8Array([OP_CHECKMULTISIG]));\n return concatBytes(...parts);\n}\n\n/** Derive a multi-sig address from public keys */\nexport function makeMultiSigAddress(\n publicKeys: string[],\n signaturesRequired: number,\n chain?: StacksChain\n): string {\n if (signaturesRequired < 1 || signaturesRequired > publicKeys.length) {\n throw new Error(`signaturesRequired must be between 1 and ${publicKeys.length}`);\n }\n const redeemScript = makeRedeemScript(publicKeys, signaturesRequired);\n const signer = hash160(redeemScript);\n const version = chain?.addressVersion?.multiSig ?? 20; // mainnet default\n return c32address(version, bytesToHex(signer));\n}\n\n/** Create an empty multi-sig spending condition */\nexport function createMultiSigSpendingCondition(\n publicKeys: string[],\n signaturesRequired: number,\n nonce: bigint,\n fee: bigint,\n hashMode: MultiSigHashMode = AddressHashMode.P2SH\n): MultiSigSpendingCondition {\n const redeemScript = makeRedeemScript(publicKeys, signaturesRequired);\n const signer = bytesToHex(hash160(redeemScript));\n\n return {\n hashMode,\n signer,\n nonce,\n fee,\n fields: [],\n signaturesRequired,\n };\n}\n\n/** Compute the initial sighash for a transaction (same as signBegin) */\nfunction initialSigHash(tx: StacksTransaction): string {\n const cleared: StacksTransaction = {\n ...tx,\n auth: intoInitialSighashAuth(tx.auth),\n };\n return txidFromBytes(serializeTransaction(cleared));\n}\n\n/** Compute the presign-sighash used by all non-sequential signers */\nfunction nonSequentialPreSignHash(tx: StacksTransaction): string {\n const condition = tx.auth.spendingCondition as MultiSigSpendingCondition;\n const initHash = initialSigHash(tx);\n return sigHashPreSign(initHash, AuthType.Standard, condition.fee, condition.nonce);\n}\n\n/** Replay sighash through existing auth fields of a multi-sig tx */\nexport function replayMultiSigSigHash(tx: StacksTransaction): string {\n const condition = tx.auth.spendingCondition as MultiSigSpendingCondition;\n\n // Non-sequential: all signers sign the same presign-sighash, no field chaining\n if (isNonSequential(condition.hashMode)) {\n const preSign = nonSequentialPreSignHash(tx);\n // Chain through all fields to get the final sighash\n let curSigHash = preSign;\n for (const field of condition.fields) {\n curSigHash = sigHashPostSign(curSigHash, field.pubKeyEncoding, field.data);\n }\n return curSigHash;\n }\n\n // Sequential: chain through all fields\n let curSigHash = initialSigHash(tx);\n for (const field of condition.fields) {\n const preSign = sigHashPreSign(curSigHash, AuthType.Standard, condition.fee, condition.nonce);\n curSigHash = sigHashPostSign(preSign, field.pubKeyEncoding, field.data);\n }\n return curSigHash;\n}\n\n/** Sign one position of a multi-sig transaction with a private key */\nexport function signMultiSig(\n tx: StacksTransaction,\n privateKey: string,\n publicKeys: string[]\n): StacksTransaction {\n const keyBytes = hexToBytes(privateKey).slice(0, 32);\n const signerPubKey = bytesToHex(nobleGetPublicKey(keyBytes, true));\n\n const signerIndex = publicKeys.findIndex((pk) => pk === signerPubKey);\n if (signerIndex === -1) {\n throw new Error(\"Private key does not correspond to any signer in the multi-sig\");\n }\n\n const condition = { ...(tx.auth.spendingCondition as MultiSigSpendingCondition) };\n\n // Non-sequential: all signers sign the same presign-sighash independently\n if (isNonSequential(condition.hashMode)) {\n return signNonSequential(tx, condition, privateKey);\n }\n\n // Sequential: existing P2SH behavior\n return signSequential(tx, condition, privateKey, publicKeys, signerIndex);\n}\n\n/** Non-sequential signing: compute presign-sighash from initial tx, sign, append */\nfunction signNonSequential(\n tx: StacksTransaction,\n condition: MultiSigSpendingCondition,\n privateKey: string\n): StacksTransaction {\n const fields = [...condition.fields];\n const preSignHash = nonSequentialPreSignHash(tx);\n\n // Sign the presign-sighash directly\n const keyBytes = hexToBytes(privateKey).slice(0, 32);\n const sig = nobleSign(preSignHash, keyBytes, { lowS: true });\n const recoveryIdHex = intToHex(sig.recovery, 1);\n const nextSig = recoveryIdHex + sig.toCompactHex();\n\n fields.push({\n type: \"signature\",\n pubKeyEncoding: PubKeyEncoding.Compressed,\n data: nextSig,\n });\n\n const newCondition: MultiSigSpendingCondition = { ...condition, fields };\n const sigCount = fields.filter((f) => f.type === \"signature\").length;\n\n // Auto-finalize: non-sequential needs no pubkey gap-filling\n if (sigCount >= condition.signaturesRequired) {\n return {\n ...tx,\n auth: { ...tx.auth, spendingCondition: newCondition },\n };\n }\n\n return {\n ...tx,\n auth: { ...tx.auth, spendingCondition: newCondition },\n };\n}\n\n/** Sequential signing: existing P2SH behavior */\nfunction signSequential(\n tx: StacksTransaction,\n condition: MultiSigSpendingCondition,\n privateKey: string,\n publicKeys: string[],\n signerIndex: number\n): StacksTransaction {\n const fields = [...condition.fields];\n\n // Replay sighash through existing fields\n let curSigHash = initialSigHash(tx);\n for (const field of fields) {\n const preSign = sigHashPreSign(curSigHash, AuthType.Standard, condition.fee, condition.nonce);\n curSigHash = sigHashPostSign(preSign, field.pubKeyEncoding, field.data);\n }\n\n // Fill intervening positions with pubkey fields\n for (let i = fields.length; i < signerIndex; i++) {\n const pubKeyField: TransactionAuthField = {\n type: \"publicKey\",\n pubKeyEncoding: PubKeyEncoding.Compressed,\n data: publicKeys[i]!,\n };\n fields.push(pubKeyField);\n const preSign = sigHashPreSign(curSigHash, AuthType.Standard, condition.fee, condition.nonce);\n curSigHash = sigHashPostSign(preSign, pubKeyField.pubKeyEncoding, pubKeyField.data);\n }\n\n // Sign at signerIndex\n const { nextSig, nextSigHash } = nextSignature(\n curSigHash,\n AuthType.Standard,\n condition.fee,\n condition.nonce,\n privateKey\n );\n\n fields.push({\n type: \"signature\",\n pubKeyEncoding: PubKeyEncoding.Compressed,\n data: nextSig,\n });\n curSigHash = nextSigHash;\n\n const newCondition: MultiSigSpendingCondition = { ...condition, fields };\n\n // Count signatures so far\n const sigCount = fields.filter((f) => f.type === \"signature\").length;\n let finalCondition = newCondition;\n\n // Auto-finalize if enough signatures collected\n if (sigCount >= condition.signaturesRequired) {\n finalCondition = finalizeMultiSigCondition(newCondition, publicKeys, curSigHash);\n }\n\n return {\n ...tx,\n auth: {\n ...tx.auth,\n spendingCondition: finalCondition,\n },\n };\n}\n\n/** Sign one position of a multi-sig transaction with an account */\nexport async function signMultiSigWithAccount(\n tx: StacksTransaction,\n account: LocalAccount | CustomAccount,\n publicKeys: string[]\n): Promise<StacksTransaction> {\n const signerPubKey = account.publicKey;\n\n const signerIndex = publicKeys.findIndex((pk) => pk === signerPubKey);\n if (signerIndex === -1) {\n throw new Error(\"Account does not correspond to any signer in the multi-sig\");\n }\n\n const condition = { ...(tx.auth.spendingCondition as MultiSigSpendingCondition) };\n\n // Non-sequential: all signers sign the same presign-sighash independently\n if (isNonSequential(condition.hashMode)) {\n return signNonSequentialWithAccount(tx, condition, account);\n }\n\n // Sequential: existing behavior\n return signSequentialWithAccount(tx, condition, account, publicKeys, signerIndex);\n}\n\n/** Non-sequential signing with account */\nasync function signNonSequentialWithAccount(\n tx: StacksTransaction,\n condition: MultiSigSpendingCondition,\n account: LocalAccount | CustomAccount\n): Promise<StacksTransaction> {\n const fields = [...condition.fields];\n const preSignHash = nonSequentialPreSignHash(tx);\n\n const sigBytes = await account.sign(hexToBytes(preSignHash));\n const nextSig = bytesToHex(sigBytes);\n\n fields.push({\n type: \"signature\",\n pubKeyEncoding: PubKeyEncoding.Compressed,\n data: nextSig,\n });\n\n const newCondition: MultiSigSpendingCondition = { ...condition, fields };\n\n return {\n ...tx,\n auth: { ...tx.auth, spendingCondition: newCondition },\n };\n}\n\n/** Sequential signing with account */\nasync function signSequentialWithAccount(\n tx: StacksTransaction,\n condition: MultiSigSpendingCondition,\n account: LocalAccount | CustomAccount,\n publicKeys: string[],\n signerIndex: number\n): Promise<StacksTransaction> {\n const fields = [...condition.fields];\n\n // Replay sighash through existing fields\n let curSigHash = initialSigHash(tx);\n for (const field of fields) {\n const preSign = sigHashPreSign(curSigHash, AuthType.Standard, condition.fee, condition.nonce);\n curSigHash = sigHashPostSign(preSign, field.pubKeyEncoding, field.data);\n }\n\n // Fill intervening positions with pubkey fields\n for (let i = fields.length; i < signerIndex; i++) {\n const pubKeyField: TransactionAuthField = {\n type: \"publicKey\",\n pubKeyEncoding: PubKeyEncoding.Compressed,\n data: publicKeys[i]!,\n };\n fields.push(pubKeyField);\n const preSign = sigHashPreSign(curSigHash, AuthType.Standard, condition.fee, condition.nonce);\n curSigHash = sigHashPostSign(preSign, pubKeyField.pubKeyEncoding, pubKeyField.data);\n }\n\n // Sign at signerIndex\n const preSign = sigHashPreSign(curSigHash, AuthType.Standard, condition.fee, condition.nonce);\n const sigBytes = await account.sign(hexToBytes(preSign));\n const nextSig = bytesToHex(sigBytes);\n const nextSigHash = sigHashPostSign(preSign, PubKeyEncoding.Compressed, nextSig);\n\n fields.push({\n type: \"signature\",\n pubKeyEncoding: PubKeyEncoding.Compressed,\n data: nextSig,\n });\n curSigHash = nextSigHash;\n\n const newCondition: MultiSigSpendingCondition = { ...condition, fields };\n\n // Count signatures so far\n const sigCount = fields.filter((f) => f.type === \"signature\").length;\n let finalCondition = newCondition;\n\n // Auto-finalize if enough signatures collected\n if (sigCount >= condition.signaturesRequired) {\n finalCondition = finalizeMultiSigCondition(newCondition, publicKeys, curSigHash);\n }\n\n return {\n ...tx,\n auth: {\n ...tx.auth,\n spendingCondition: finalCondition,\n },\n };\n}\n\n/** Fill remaining slots with pubkey fields after all signatures are collected */\nexport function finalizeMultiSig(\n tx: StacksTransaction,\n publicKeys: string[]\n): StacksTransaction {\n const condition = tx.auth.spendingCondition as MultiSigSpendingCondition;\n\n // Non-sequential: no pubkey gap-filling needed\n if (isNonSequential(condition.hashMode)) {\n return tx;\n }\n\n const curSigHash = replayMultiSigSigHash(tx);\n const finalCondition = finalizeMultiSigCondition(condition, publicKeys, curSigHash);\n\n return {\n ...tx,\n auth: {\n ...tx.auth,\n spendingCondition: finalCondition,\n },\n };\n}\n\n/** Internal: finalize remaining pubkey slots (sequential only) */\nfunction finalizeMultiSigCondition(\n condition: MultiSigSpendingCondition,\n publicKeys: string[],\n curSigHash: string\n): MultiSigSpendingCondition {\n const fields = [...condition.fields];\n let sigHash = curSigHash;\n\n // Fill remaining positions\n for (let i = fields.length; i < publicKeys.length; i++) {\n const pubKeyField: TransactionAuthField = {\n type: \"publicKey\",\n pubKeyEncoding: PubKeyEncoding.Compressed,\n data: publicKeys[i]!,\n };\n fields.push(pubKeyField);\n const preSign = sigHashPreSign(sigHash, AuthType.Standard, condition.fee, condition.nonce);\n sigHash = sigHashPostSign(preSign, pubKeyField.pubKeyEncoding, pubKeyField.data);\n }\n\n return { ...condition, fields };\n}\n\n/** Combine independently-signed non-sequential multi-sig transactions */\nexport function combineMultiSigSignatures(\n baseTx: StacksTransaction,\n signedTxs: StacksTransaction[]\n): StacksTransaction {\n const condition = baseTx.auth.spendingCondition as MultiSigSpendingCondition;\n\n if (!isNonSequential(condition.hashMode)) {\n throw new Error(\"combineMultiSigSignatures only works with non-sequential hash modes (SIP-027)\");\n }\n\n // Collect all signature fields from each signed tx\n const seenSigs = new Set<string>();\n const signatures: TransactionAuthField[] = [];\n\n for (const stx of signedTxs) {\n const stxCondition = stx.auth.spendingCondition as MultiSigSpendingCondition;\n for (const field of stxCondition.fields) {\n if (field.type === \"signature\" && !seenSigs.has(field.data)) {\n seenSigs.add(field.data);\n signatures.push(field);\n }\n }\n }\n\n if (signatures.length === 0) {\n throw new Error(\"No signatures found in the provided transactions\");\n }\n\n const newCondition: MultiSigSpendingCondition = {\n ...condition,\n fields: signatures,\n };\n\n return {\n ...baseTx,\n auth: { ...baseTx.auth, spendingCondition: newCondition },\n };\n}\n",
9
- "import { bytesToHex, hexToBytes } from \"../utils/encoding.ts\";\nimport { txidFromBytes } from \"../utils/hash.ts\";\nimport {\n intoInitialSighashAuth,\n nextSignature,\n sigHashPreSign,\n sigHashPostSign,\n} from \"./authorization.ts\";\nimport { replayMultiSigSigHash } from \"./multisig.ts\";\nimport { serializeTransaction } from \"./wire/serialize.ts\";\nimport {\n AuthType,\n type StacksTransaction,\n type SingleSigSpendingCondition,\n type SponsoredAuthorization,\n} from \"./types.ts\";\nimport type { LocalAccount, CustomAccount } from \"../accounts/types.ts\";\n\nfunction txid(tx: StacksTransaction): string {\n return txidFromBytes(serializeTransaction(tx));\n}\n\n/** Compute the initial sighash for a transaction */\nexport function signBegin(tx: StacksTransaction): string {\n const cleared: StacksTransaction = {\n ...tx,\n auth: intoInitialSighashAuth(tx.auth),\n };\n return txid(cleared);\n}\n\n/** Sign a single-sig transaction with a private key, returning the signed transaction */\nexport function signTransaction(\n tx: StacksTransaction,\n privateKey: string\n): StacksTransaction {\n const sigHash = signBegin(tx);\n const condition = tx.auth.spendingCondition as SingleSigSpendingCondition;\n\n // Origin always signs with AuthType.Standard (even for sponsored txs)\n const { nextSig } = nextSignature(\n sigHash,\n AuthType.Standard,\n condition.fee,\n condition.nonce,\n privateKey\n );\n\n return {\n ...tx,\n auth: {\n ...tx.auth,\n spendingCondition: {\n ...condition,\n signature: nextSig,\n },\n },\n };\n}\n\n/** Sign a single-sig transaction using an account (LocalAccount or CustomAccount) */\nexport async function signTransactionWithAccount(\n tx: StacksTransaction,\n account: LocalAccount | CustomAccount\n): Promise<StacksTransaction> {\n const sigHash = signBegin(tx);\n const condition = tx.auth.spendingCondition as SingleSigSpendingCondition;\n\n // Origin always signs with AuthType.Standard (even for sponsored txs)\n const sigHashPre = sigHashPreSign(\n sigHash,\n AuthType.Standard,\n condition.fee,\n condition.nonce\n );\n\n // account.sign returns 65-byte VRS (recovery + r + s)\n const sigBytes = await account.sign(hexToBytes(sigHashPre));\n const nextSig = bytesToHex(sigBytes);\n\n return {\n ...tx,\n auth: {\n ...tx.auth,\n spendingCondition: {\n ...condition,\n signature: nextSig,\n },\n },\n };\n}\n\n/** Get the txid of a transaction */\nexport function getTransactionId(tx: StacksTransaction): string {\n return txid(tx);\n}\n\n/** Reconstruct the sighash after origin signing (needed for sponsor signing) */\nexport function getOriginSigHash(tx: StacksTransaction): string {\n const condition = tx.auth.spendingCondition;\n\n // Multi-sig: replay through all fields\n if (\"fields\" in condition) {\n return replayMultiSigSigHash(tx);\n }\n\n // Single-sig\n const initialSigHash = signBegin(tx);\n const sc = condition as SingleSigSpendingCondition;\n const preSign = sigHashPreSign(initialSigHash, AuthType.Standard, sc.fee, sc.nonce);\n return sigHashPostSign(preSign, sc.keyEncoding, sc.signature);\n}\n\n/** Sign a sponsored transaction as the sponsor with a private key */\nexport function signSponsor(tx: StacksTransaction, privateKey: string): StacksTransaction {\n if (tx.auth.authType !== AuthType.Sponsored) {\n throw new Error(\"Transaction must be sponsored\");\n }\n const auth = tx.auth as SponsoredAuthorization;\n const sponsorCondition = auth.sponsorSpendingCondition as SingleSigSpendingCondition;\n const originSigHash = getOriginSigHash(tx);\n\n const { nextSig } = nextSignature(\n originSigHash,\n AuthType.Sponsored,\n sponsorCondition.fee,\n sponsorCondition.nonce,\n privateKey\n );\n\n return {\n ...tx,\n auth: {\n ...auth,\n sponsorSpendingCondition: {\n ...sponsorCondition,\n signature: nextSig,\n },\n },\n };\n}\n\n/** Sign a sponsored transaction as the sponsor using an account */\nexport async function signSponsorWithAccount(\n tx: StacksTransaction,\n account: LocalAccount | CustomAccount\n): Promise<StacksTransaction> {\n if (tx.auth.authType !== AuthType.Sponsored) {\n throw new Error(\"Transaction must be sponsored\");\n }\n const auth = tx.auth as SponsoredAuthorization;\n const sponsorCondition = auth.sponsorSpendingCondition as SingleSigSpendingCondition;\n const originSigHash = getOriginSigHash(tx);\n\n const sigHashPre = sigHashPreSign(\n originSigHash,\n AuthType.Sponsored,\n sponsorCondition.fee,\n sponsorCondition.nonce\n );\n\n const sigBytes = await account.sign(hexToBytes(sigHashPre));\n const nextSig = bytesToHex(sigBytes);\n\n return {\n ...tx,\n auth: {\n ...auth,\n sponsorSpendingCondition: {\n ...sponsorCondition,\n signature: nextSig,\n },\n },\n };\n}\n",
10
- "import type { StacksChain } from \"../chains/types.ts\";\nimport type { ClarityValue } from \"../clarity/types.ts\";\nimport type { PostCondition } from \"../postconditions/types.ts\";\nimport type { MultiSigHashMode, SpendingCondition } from \"./types.ts\";\nimport {\n createSingleSigSpendingCondition,\n createStandardAuth,\n createSponsoredAuth,\n} from \"./authorization.ts\";\nimport { createMultiSigSpendingCondition } from \"./multisig.ts\";\nimport {\n PayloadType,\n AnchorMode,\n PostConditionModeWire,\n FungibleConditionCode,\n NonFungibleConditionCode,\n type StacksTransaction,\n type PostConditionWire,\n type PostConditionPrincipalWire,\n type ClarityVersion,\n} from \"./types.ts\";\nimport { Cl } from \"../clarity/values.ts\";\nimport { intToBigInt, type IntegerType } from \"../utils/encoding.ts\";\nimport { parseContractId } from \"../utils/address.ts\";\n\ntype MultiSigOptions = {\n publicKeys?: string[];\n signaturesRequired?: number;\n hashMode?: MultiSigHashMode;\n};\n\nexport type BuildTokenTransferOptions = MultiSigOptions & {\n recipient: string;\n amount: IntegerType;\n memo?: string;\n fee: IntegerType;\n nonce: IntegerType;\n publicKey?: string;\n chain?: StacksChain;\n postConditionMode?: \"allow\" | \"deny\";\n postConditions?: PostCondition[];\n sponsored?: boolean;\n};\n\nexport type BuildContractCallOptions = MultiSigOptions & {\n contractAddress: string;\n contractName: string;\n functionName: string;\n functionArgs: ClarityValue[];\n fee: IntegerType;\n nonce: IntegerType;\n publicKey?: string;\n chain?: StacksChain;\n postConditionMode?: \"allow\" | \"deny\";\n postConditions?: PostCondition[];\n sponsored?: boolean;\n};\n\nexport type BuildContractDeployOptions = MultiSigOptions & {\n contractName: string;\n codeBody: string;\n clarityVersion?: ClarityVersion;\n fee: IntegerType;\n nonce: IntegerType;\n publicKey?: string;\n chain?: StacksChain;\n postConditionMode?: \"allow\" | \"deny\";\n postConditions?: PostCondition[];\n sponsored?: boolean;\n};\n\nfunction resolvePcMode(mode?: \"allow\" | \"deny\"): PostConditionModeWire {\n return mode === \"allow\" ? PostConditionModeWire.Allow : PostConditionModeWire.Deny;\n}\n\nfunction convertPostConditions(pcs?: PostCondition[]): PostConditionWire[] {\n if (!pcs || pcs.length === 0) return [];\n return pcs.map(convertPostCondition);\n}\n\nfunction resolvePrincipal(address: string): PostConditionPrincipalWire {\n if (address === \"origin\") return { type: \"origin\" };\n const [addr, name] = address.split(\".\");\n if (name) {\n return { type: \"contract\", address: addr!, contractName: name };\n }\n return { type: \"standard\", address: addr! };\n}\n\nconst FUNGIBLE_CODE_MAP: Record<string, number> = {\n eq: FungibleConditionCode.Equal,\n gt: FungibleConditionCode.Greater,\n gte: FungibleConditionCode.GreaterEqual,\n lt: FungibleConditionCode.Less,\n lte: FungibleConditionCode.LessEqual,\n};\n\nfunction convertPostCondition(pc: PostCondition): PostConditionWire {\n switch (pc.type) {\n case \"stx-postcondition\":\n return {\n type: \"stx\",\n principal: resolvePrincipal(pc.address),\n conditionCode: FUNGIBLE_CODE_MAP[pc.condition]!,\n amount: intToBigInt(pc.amount),\n };\n case \"ft-postcondition\": {\n const [contractId, tokenName] = pc.asset.split(\"::\");\n const [addr, name] = parseContractId(contractId!);\n return {\n type: \"ft\",\n principal: resolvePrincipal(pc.address),\n asset: { address: addr, contractName: name, assetName: tokenName! },\n conditionCode: FUNGIBLE_CODE_MAP[pc.condition]!,\n amount: intToBigInt(pc.amount),\n };\n }\n case \"nft-postcondition\": {\n const [contractId, tokenName] = pc.asset.split(\"::\");\n const [addr, name] = parseContractId(contractId!);\n return {\n type: \"nft\",\n principal: resolvePrincipal(pc.address),\n asset: { address: addr, contractName: name, assetName: tokenName! },\n conditionCode: pc.condition === \"sent\" ? NonFungibleConditionCode.Sends : NonFungibleConditionCode.DoesNotSend,\n assetId: pc.assetId,\n };\n }\n }\n}\n\nimport type { Authorization } from \"./types.ts\";\n\nfunction resolveSpendingCondition(\n opts: MultiSigOptions & { publicKey?: string },\n nonce: bigint,\n fee: bigint\n): SpendingCondition {\n if (opts.publicKeys) {\n return createMultiSigSpendingCondition(\n opts.publicKeys,\n opts.signaturesRequired!,\n nonce,\n fee,\n opts.hashMode\n );\n }\n return createSingleSigSpendingCondition(opts.publicKey!, nonce, fee);\n}\n\nfunction resolveAuth(spendingCondition: any, sponsored?: boolean): Authorization {\n return sponsored\n ? createSponsoredAuth(spendingCondition)\n : createStandardAuth(spendingCondition);\n}\n\nfunction resolveVersionAndChainId(chain?: StacksChain): { version: number; chainId: number } {\n if (!chain) return { version: 0x00, chainId: 0x00000001 }; // mainnet defaults\n return { version: chain.transactionVersion, chainId: chain.id };\n}\n\nexport function buildTokenTransfer(options: BuildTokenTransferOptions): StacksTransaction {\n const { version, chainId } = resolveVersionAndChainId(options.chain);\n const fee = intToBigInt(options.fee);\n const nonce = intToBigInt(options.nonce);\n\n const spendingCondition = resolveSpendingCondition(options, nonce, fee);\n const recipient = Cl.principal(options.recipient);\n\n const tx: StacksTransaction = {\n version,\n chainId,\n auth: resolveAuth(spendingCondition, options.sponsored),\n anchorMode: AnchorMode.Any,\n postConditionMode: resolvePcMode(options.postConditionMode),\n postConditions: convertPostConditions(options.postConditions),\n payload: {\n payloadType: PayloadType.TokenTransfer,\n recipient,\n amount: intToBigInt(options.amount),\n memo: options.memo ?? \"\",\n },\n };\n\n if (options.publicKeys) {\n (tx as any)._multisig = { publicKeys: options.publicKeys };\n }\n return tx;\n}\n\nexport function buildContractCall(options: BuildContractCallOptions): StacksTransaction {\n const { version, chainId } = resolveVersionAndChainId(options.chain);\n const fee = intToBigInt(options.fee);\n const nonce = intToBigInt(options.nonce);\n\n const spendingCondition = resolveSpendingCondition(options, nonce, fee);\n\n const tx: StacksTransaction = {\n version,\n chainId,\n auth: resolveAuth(spendingCondition, options.sponsored),\n anchorMode: AnchorMode.Any,\n postConditionMode: resolvePcMode(options.postConditionMode),\n postConditions: convertPostConditions(options.postConditions),\n payload: {\n payloadType: PayloadType.ContractCall,\n contractAddress: options.contractAddress,\n contractName: options.contractName,\n functionName: options.functionName,\n functionArgs: options.functionArgs,\n },\n };\n\n if (options.publicKeys) {\n (tx as any)._multisig = { publicKeys: options.publicKeys };\n }\n return tx;\n}\n\nexport function buildContractDeploy(options: BuildContractDeployOptions): StacksTransaction {\n const { version, chainId } = resolveVersionAndChainId(options.chain);\n const fee = intToBigInt(options.fee);\n const nonce = intToBigInt(options.nonce);\n\n const spendingCondition = resolveSpendingCondition(options, nonce, fee);\n const useVersioned = options.clarityVersion !== undefined;\n\n const tx: StacksTransaction = {\n version,\n chainId,\n auth: resolveAuth(spendingCondition, options.sponsored),\n anchorMode: AnchorMode.Any,\n postConditionMode: resolvePcMode(options.postConditionMode),\n postConditions: convertPostConditions(options.postConditions),\n payload: {\n payloadType: useVersioned ? PayloadType.VersionedSmartContract : PayloadType.SmartContract,\n clarityVersion: options.clarityVersion,\n contractName: options.contractName,\n codeBody: options.codeBody,\n },\n };\n\n if (options.publicKeys) {\n (tx as any)._multisig = { publicKeys: options.publicKeys };\n }\n return tx;\n}\n"
11
- ],
12
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGO,IAAM,WAAW;AAAA,EACtB,UAAU;AAAA,EACV,WAAW;AACb;AAIO,IAAM,cAAc;AAAA,EACzB,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;AACpB;AAIO,IAAM,iBAAiB;AAAA,EAC5B,UAAU;AAAA,EACV,UAAU;AAAA,EACV,UAAU;AACZ;AAIO,IAAM,aAAa;AAAA,EACxB,aAAa;AAAA,EACb,cAAc;AAAA,EACd,KAAK;AACP;AAIO,IAAM,wBAAwB;AAAA,EACnC,OAAO;AAAA,EACP,MAAM;AACR;AAKO,IAAM,kBAAkB;AAAA,EAC7B,OAAO;AAAA,EACP,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,OAAO;AAAA,EACP,oBAAoB;AAAA,EACpB,0BAA0B;AAC5B;AAIO,IAAM,iBAAiB;AAAA,EAC5B,YAAY;AAAA,EACZ,cAAc;AAChB;AAIO,IAAM,wBAAwB;AAAA,EACnC,OAAO;AAAA,EACP,SAAS;AAAA,EACT,cAAc;AAAA,EACd,MAAM;AAAA,EACN,WAAW;AACb;AAGO,IAAM,2BAA2B;AAAA,EACtC,OAAO;AAAA,EACP,aAAa;AACf;AAGO,IAAM,2BAA2B;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