@secondlayer/stacks 0.0.3 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (98) hide show
  1. package/dist/shared/{stacks-vdfs3e5v.js → stacks-1ddg6mbv.js} +2 -2
  2. package/dist/shared/{stacks-bnvfmt7y.cjs → stacks-2gdt3aqj.cjs} +15 -2
  3. package/dist/shared/{stacks-8m9byk2j.js.map → stacks-2gdt3aqj.cjs.map} +1 -1
  4. package/dist/shared/stacks-709tra19.js.map +2 -2
  5. package/dist/shared/stacks-9g0jhab3.cjs.map +2 -2
  6. package/dist/shared/stacks-b008c3w8.cjs.map +2 -2
  7. package/dist/shared/stacks-gck1sq7h.cjs.map +2 -2
  8. package/dist/shared/stacks-gjvbq6w7.js.map +2 -2
  9. package/dist/shared/{stacks-74k8cxgb.cjs → stacks-hfem9dck.cjs} +46 -2
  10. package/dist/shared/stacks-hfem9dck.cjs.map +13 -0
  11. package/dist/shared/stacks-j2cy7qtt.js.map +2 -2
  12. package/dist/shared/stacks-k58k970n.js.map +2 -2
  13. package/dist/shared/{stacks-zm0b3tgy.js → stacks-m2dc5xwg.js} +7 -7
  14. package/dist/shared/{stacks-zm0b3tgy.js.map → stacks-m2dc5xwg.js.map} +1 -1
  15. package/dist/shared/{stacks-n2g56wgg.js → stacks-md6e5ta0.js} +13 -13
  16. package/dist/shared/{stacks-n2g56wgg.js.map → stacks-md6e5ta0.js.map} +1 -1
  17. package/dist/shared/stacks-njvyj3ab.js +23 -0
  18. package/dist/shared/{stacks-bnvfmt7y.cjs.map → stacks-njvyj3ab.js.map} +1 -1
  19. package/dist/shared/{stacks-dxhntr76.js → stacks-ph4a6322.js} +54 -11
  20. package/dist/shared/stacks-ph4a6322.js.map +10 -0
  21. package/dist/shared/{stacks-f7wdrzs3.js → stacks-pz73cn97.js} +17 -17
  22. package/dist/shared/{stacks-f7wdrzs3.js.map → stacks-pz73cn97.js.map} +1 -1
  23. package/dist/shared/stacks-qvg7c24g.cjs.map +2 -2
  24. package/dist/shared/{stacks-4py5pm0r.cjs → stacks-v3zy6zds.cjs} +42 -2
  25. package/dist/shared/stacks-v3zy6zds.cjs.map +10 -0
  26. package/dist/shared/stacks-v9jqcpd4.js.map +2 -2
  27. package/dist/shared/{stacks-yfgsm6ap.js → stacks-xtz0n62y.js} +58 -3
  28. package/dist/shared/stacks-xtz0n62y.js.map +13 -0
  29. package/dist/shared/stacks-ya3x01yd.cjs.map +2 -2
  30. package/dist/src/accounts/index.js +1 -1
  31. package/dist/src/actions/index.d.cts +43 -2
  32. package/dist/src/actions/index.d.ts +43 -2
  33. package/dist/src/actions/index.js +7 -7
  34. package/dist/src/bns/index.js +10 -10
  35. package/dist/src/bns/index.js.map +1 -1
  36. package/dist/src/chains/index.js +1 -1
  37. package/dist/src/clarity/index.cjs +326 -1
  38. package/dist/src/clarity/index.cjs.map +5 -3
  39. package/dist/src/clarity/index.d.cts +24 -5
  40. package/dist/src/clarity/index.d.ts +24 -5
  41. package/dist/src/clarity/index.js +264 -13
  42. package/dist/src/clarity/index.js.map +5 -3
  43. package/dist/src/connect/index.cjs.map +2 -2
  44. package/dist/src/connect/index.d.cts +7 -1
  45. package/dist/src/connect/index.d.ts +7 -1
  46. package/dist/src/connect/index.js.map +2 -2
  47. package/dist/src/connect/walletconnect/index.cjs +4 -4
  48. package/dist/src/connect/walletconnect/index.cjs.map +7 -7
  49. package/dist/src/connect/walletconnect/index.d.cts +5 -5
  50. package/dist/src/connect/walletconnect/index.d.ts +5 -5
  51. package/dist/src/connect/walletconnect/index.js +4 -4
  52. package/dist/src/connect/walletconnect/index.js.map +7 -7
  53. package/dist/src/index.cjs +17 -23
  54. package/dist/src/index.cjs.map +4 -4
  55. package/dist/src/index.d.cts +44 -3
  56. package/dist/src/index.d.ts +44 -3
  57. package/dist/src/index.js +27 -32
  58. package/dist/src/index.js.map +4 -4
  59. package/dist/src/postconditions/index.cjs +117 -1
  60. package/dist/src/postconditions/index.cjs.map +4 -3
  61. package/dist/src/postconditions/index.js +119 -6
  62. package/dist/src/postconditions/index.js.map +4 -3
  63. package/dist/src/pox/index.js +9 -9
  64. package/dist/src/pox/index.js.map +1 -1
  65. package/dist/src/stackingdao/index.cjs.map +2 -2
  66. package/dist/src/stackingdao/index.d.cts +18 -7
  67. package/dist/src/stackingdao/index.d.ts +18 -7
  68. package/dist/src/stackingdao/index.js +9 -9
  69. package/dist/src/stackingdao/index.js.map +3 -3
  70. package/dist/src/subscriptions/index.js +1 -1
  71. package/dist/src/transactions/index.cjs +5 -1
  72. package/dist/src/transactions/index.cjs.map +1 -1
  73. package/dist/src/transactions/index.d.cts +40 -2
  74. package/dist/src/transactions/index.d.ts +40 -2
  75. package/dist/src/transactions/index.js +18 -10
  76. package/dist/src/transactions/index.js.map +1 -1
  77. package/dist/src/utils/index.d.cts +4 -4
  78. package/dist/src/utils/index.d.ts +4 -4
  79. package/dist/src/utils/index.js +1 -1
  80. package/package.json +1 -1
  81. package/dist/shared/stacks-2ar4prfz.cjs +0 -328
  82. package/dist/shared/stacks-2ar4prfz.cjs.map +0 -11
  83. package/dist/shared/stacks-4py5pm0r.cjs.map +0 -10
  84. package/dist/shared/stacks-74k8cxgb.cjs.map +0 -13
  85. package/dist/shared/stacks-8m9byk2j.js +0 -7
  86. package/dist/shared/stacks-dr5en54r.cjs +0 -119
  87. package/dist/shared/stacks-dr5en54r.cjs.map +0 -10
  88. package/dist/shared/stacks-dxhntr76.js.map +0 -10
  89. package/dist/shared/stacks-f3tk2k5s.js +0 -27
  90. package/dist/shared/stacks-f3tk2k5s.js.map +0 -9
  91. package/dist/shared/stacks-g9mcjcqg.cjs +0 -3
  92. package/dist/shared/stacks-g9mcjcqg.cjs.map +0 -9
  93. package/dist/shared/stacks-tjxmrssa.js +0 -282
  94. package/dist/shared/stacks-tjxmrssa.js.map +0 -11
  95. package/dist/shared/stacks-yfgsm6ap.js.map +0 -13
  96. package/dist/shared/stacks-yfveb68e.js +0 -121
  97. package/dist/shared/stacks-yfveb68e.js.map +0 -10
  98. /package/dist/shared/{stacks-vdfs3e5v.js.map → stacks-1ddg6mbv.js.map} +0 -0
@@ -20,6 +20,7 @@ import {
20
20
  writeUInt32BE,
21
21
  writeUInt8
22
22
  } from "./stacks-nqytwfcc.js";
23
+ import"./stacks-njvyj3ab.js";
23
24
 
24
25
  // src/transactions/multisig.ts
25
26
  import {
@@ -108,6 +109,13 @@ var AuthFieldType = {
108
109
  var RECOVERABLE_ECDSA_SIG_LENGTH_BYTES = 65;
109
110
  var MEMO_MAX_LENGTH_BYTES = 34;
110
111
  var MAX_STRING_LENGTH_BYTES = 128;
112
+ var COINBASE_BYTES_LENGTH = 32;
113
+ var VRF_PROOF_BYTES_LENGTH = 80;
114
+ var MICROBLOCK_HEADER_BYTES_LENGTH = 132;
115
+ var TenureChangeCause = {
116
+ BlockFound: 0,
117
+ Extended: 1
118
+ };
111
119
 
112
120
  // src/transactions/authorization.ts
113
121
  etc.hmacSha256Sync = (key, ...msgs) => {
@@ -312,6 +320,43 @@ function serializePayload(payload) {
312
320
  parts.push(serializeLPString(payload.contractName));
313
321
  parts.push(serializeLPStringLong(payload.codeBody));
314
322
  break;
323
+ case PayloadType.Coinbase:
324
+ parts.push(hexToBytes(payload.coinbaseBuffer));
325
+ break;
326
+ case PayloadType.CoinbaseToAltRecipient: {
327
+ const cbAlt = payload;
328
+ parts.push(hexToBytes(cbAlt.coinbaseBuffer));
329
+ parts.push(serializeCVBytes(cbAlt.recipient));
330
+ break;
331
+ }
332
+ case PayloadType.PoisonMicroblock: {
333
+ const pm = payload;
334
+ parts.push(hexToBytes(pm.header1));
335
+ parts.push(hexToBytes(pm.header2));
336
+ break;
337
+ }
338
+ case PayloadType.TenureChange: {
339
+ const tc = payload;
340
+ parts.push(hexToBytes(tc.tenureConsensusHash));
341
+ parts.push(hexToBytes(tc.prevTenureConsensusHash));
342
+ parts.push(hexToBytes(tc.burnViewConsensusHash));
343
+ parts.push(hexToBytes(tc.previousTenureEnd));
344
+ parts.push(writeUInt32BE(tc.previousTenureBlocks));
345
+ parts.push(writeUInt8(tc.cause));
346
+ parts.push(hexToBytes(tc.pubkeyHash));
347
+ break;
348
+ }
349
+ case PayloadType.NakamotoCoinbase: {
350
+ const nc = payload;
351
+ parts.push(hexToBytes(nc.coinbaseBuffer));
352
+ if (nc.recipient) {
353
+ parts.push(serializeCVBytes({ type: "some", value: nc.recipient }));
354
+ } else {
355
+ parts.push(serializeCVBytes({ type: "none" }));
356
+ }
357
+ parts.push(hexToBytes(nc.vrfProof));
358
+ break;
359
+ }
315
360
  }
316
361
  return concatBytes(...parts);
317
362
  }
@@ -592,8 +637,18 @@ function combineMultiSigSignatures(baseTx, signedTxs) {
592
637
  auth: { ...baseTx.auth, spendingCondition: newCondition }
593
638
  };
594
639
  }
640
+ export {
641
+ signMultiSigWithAccount,
642
+ signMultiSig,
643
+ replayMultiSigSigHash,
644
+ makeMultiSigAddress,
645
+ isNonSequential,
646
+ finalizeMultiSig,
647
+ createMultiSigSpendingCondition,
648
+ combineMultiSigSignatures
649
+ };
595
650
 
596
- export { AuthType, PayloadType, ClarityVersion, AnchorMode, PostConditionModeWire, AddressHashMode, PubKeyEncoding, FungibleConditionCode, NonFungibleConditionCode, PostConditionPrincipalId, AssetType, AuthFieldType, RECOVERABLE_ECDSA_SIG_LENGTH_BYTES, MEMO_MAX_LENGTH_BYTES, MAX_STRING_LENGTH_BYTES, serializePayload, serializeTransaction, serializeTransactionHex, createSingleSigSpendingCondition, createStandardAuth, createSponsoredAuth, intoInitialSighashAuth, sigHashPreSign, sigHashPostSign, nextSignature, isNonSequential, makeMultiSigAddress, createMultiSigSpendingCondition, replayMultiSigSigHash, signMultiSig, signMultiSigWithAccount, finalizeMultiSig, combineMultiSigSignatures };
651
+ export { AuthType, PayloadType, ClarityVersion, AnchorMode, PostConditionModeWire, AddressHashMode, PubKeyEncoding, FungibleConditionCode, NonFungibleConditionCode, PostConditionPrincipalId, AssetType, AuthFieldType, RECOVERABLE_ECDSA_SIG_LENGTH_BYTES, MEMO_MAX_LENGTH_BYTES, MAX_STRING_LENGTH_BYTES, COINBASE_BYTES_LENGTH, VRF_PROOF_BYTES_LENGTH, MICROBLOCK_HEADER_BYTES_LENGTH, TenureChangeCause, serializePayload, serializeTransaction, serializeTransactionHex, createSingleSigSpendingCondition, createStandardAuth, createSponsoredAuth, intoInitialSighashAuth, sigHashPreSign, sigHashPostSign, nextSignature, isNonSequential, makeMultiSigAddress, createMultiSigSpendingCondition, replayMultiSigSigHash, signMultiSig, signMultiSigWithAccount, finalizeMultiSig, combineMultiSigSignatures };
597
652
 
598
- //# debugId=99F694C3EE6B35BA64756E2164756E21
599
- //# sourceMappingURL=stacks-yfgsm6ap.js.map
653
+ //# debugId=8A5B8348EC23E0AD64756E2164756E21
654
+ //# sourceMappingURL=stacks-xtz0n62y.js.map
@@ -0,0 +1,13 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/transactions/multisig.ts", "../src/transactions/authorization.ts", "../src/transactions/types.ts", "../src/transactions/wire/serialize.ts"],
4
+ "sourcesContent": [
5
+ "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",
6
+ "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",
7
+ "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",
8
+ "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 RECOVERABLE_ECDSA_SIG_LENGTH_BYTES,\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 AuthFieldType,\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"
9
+ ],
10
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA,kBACE;AAAA,UACA;AAAA;;;ACFF;AAAA,kBACE;AAAA;AAAA;AAAA;AAIF;AACA;;;ACHO,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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AAW,OAAO;AAAA;AAIzB,SAAS,yBAAyB,CACvC,QACA,WACmB;AAAA,EACnB,MAAM,YAAY,OAAO,KAAK;AAAA,EAE9B,IAAI,CAAC,gBAAgB,UAAU,QAAQ,GAAG;AAAA,IACxC,MAAM,IAAI,MAAM,+EAA+E;AAAA,EACjG;AAAA,EAGA,MAAM,WAAW,IAAI;AAAA,EACrB,MAAM,aAAqC,CAAC;AAAA,EAE5C,WAAW,OAAO,WAAW;AAAA,IAC3B,MAAM,eAAe,IAAI,KAAK;AAAA,IAC9B,WAAW,SAAS,aAAa,QAAQ;AAAA,MACvC,IAAI,MAAM,SAAS,eAAe,CAAC,SAAS,IAAI,MAAM,IAAI,GAAG;AAAA,QAC3D,SAAS,IAAI,MAAM,IAAI;AAAA,QACvB,WAAW,KAAK,KAAK;AAAA,MACvB;AAAA,IACF;AAAA,EACF;AAAA,EAEA,IAAI,WAAW,WAAW,GAAG;AAAA,IAC3B,MAAM,IAAI,MAAM,kDAAkD;AAAA,EACpE;AAAA,EAEA,MAAM,eAA0C;AAAA,OAC3C;AAAA,IACH,QAAQ;AAAA,EACV;AAAA,EAEA,OAAO;AAAA,OACF;AAAA,IACH,MAAM,KAAK,OAAO,MAAM,mBAAmB,aAAa;AAAA,EAC1D;AAAA;",
11
+ "debugId": "8A5B8348EC23E0AD64756E2164756E21",
12
+ "names": []
13
+ }
@@ -2,9 +2,9 @@
2
2
  "version": 3,
3
3
  "sources": ["../src/utils/constants.ts"],
4
4
  "sourcesContent": [
5
- "// Clarity integer bounds\nexport const MAX_U128 = (1n << 128n) - 1n;\nexport const MAX_I128 = (1n << 127n) - 1n;\nexport const MIN_I128 = -(1n << 127n);\n\n/** C32-encoded address version bytes for single-sig and multi-sig on each network. */\nexport const AddressVersion = {\n MainnetSingleSig: 22,\n MainnetMultiSig: 20,\n TestnetSingleSig: 26,\n TestnetMultiSig: 21,\n} as const;\nexport type AddressVersion = (typeof AddressVersion)[keyof typeof AddressVersion];\n\n/** Mainnet burn address (all-zero hash160). */\nexport const ZERO_ADDRESS = \"SP000000000000000000002Q6VF78\";\n/** Testnet burn address (all-zero hash160). */\nexport const TESTNET_ZERO_ADDRESS = \"ST000000000000000000002AMW42H\";\n\n/** Number of microSTX per 1 STX (10^6). */\nexport const MICROSTX_PER_STX = 1_000_000n;\n"
5
+ "// Clarity integer bounds\nexport const MAX_U128: bigint = (1n << 128n) - 1n;\nexport const MAX_I128: bigint = (1n << 127n) - 1n;\nexport const MIN_I128: bigint = -(1n << 127n);\n\n/** C32-encoded address version bytes for single-sig and multi-sig on each network. */\nexport const AddressVersion = {\n MainnetSingleSig: 22,\n MainnetMultiSig: 20,\n TestnetSingleSig: 26,\n TestnetMultiSig: 21,\n} as const;\nexport type AddressVersion = (typeof AddressVersion)[keyof typeof AddressVersion];\n\n/** Mainnet burn address (all-zero hash160). */\nexport const ZERO_ADDRESS = \"SP000000000000000000002Q6VF78\";\n/** Testnet burn address (all-zero hash160). */\nexport const TESTNET_ZERO_ADDRESS = \"ST000000000000000000002AMW42H\";\n\n/** Number of microSTX per 1 STX (10^6). */\nexport const MICROSTX_PER_STX = 1_000_000n;\n"
6
6
  ],
7
- "mappings": ";AACO,IAAM,YAAY,MAAM,QAAQ;AAChC,IAAM,YAAY,MAAM,QAAQ;AAChC,IAAM,WAAW,EAAE,MAAM;AAGzB,IAAM,iBAAiB;AAAA,EAC5B,kBAAkB;AAAA,EAClB,iBAAiB;AAAA,EACjB,kBAAkB;AAAA,EAClB,iBAAiB;AACnB;AAIO,IAAM,eAAe;AAErB,IAAM,uBAAuB;AAG7B,IAAM,mBAAmB;",
7
+ "mappings": ";AACO,IAAM,YAAoB,MAAM,QAAQ;AACxC,IAAM,YAAoB,MAAM,QAAQ;AACxC,IAAM,WAAmB,EAAE,MAAM;AAGjC,IAAM,iBAAiB;AAAA,EAC5B,kBAAkB;AAAA,EAClB,iBAAiB;AAAA,EACjB,kBAAkB;AAAA,EAClB,iBAAiB;AACnB;AAIO,IAAM,eAAe;AAErB,IAAM,uBAAuB;AAG7B,IAAM,mBAAmB;",
8
8
  "debugId": "B42A43BFB28E5FFC64756E2164756E21",
9
9
  "names": []
10
10
  }
@@ -10,7 +10,7 @@ import {
10
10
  hexToBytes,
11
11
  without0x
12
12
  } from "../../shared/stacks-nqytwfcc.js";
13
- import"../../shared/stacks-8m9byk2j.js";
13
+ import"../../shared/stacks-njvyj3ab.js";
14
14
 
15
15
  // src/accounts/privateKeyToAccount.ts
16
16
  import {
@@ -257,6 +257,11 @@ declare const PubKeyEncoding: {
257
257
  readonly Uncompressed: 0x01
258
258
  };
259
259
  type PubKeyEncoding = (typeof PubKeyEncoding)[keyof typeof PubKeyEncoding];
260
+ declare const TenureChangeCause: {
261
+ readonly BlockFound: 0x00
262
+ readonly Extended: 0x01
263
+ };
264
+ type TenureChangeCause = (typeof TenureChangeCause)[keyof typeof TenureChangeCause];
260
265
  type TokenTransferPayload = {
261
266
  payloadType: typeof PayloadType.TokenTransfer
262
267
  recipient: ClarityValue
@@ -276,7 +281,37 @@ type SmartContractPayload = {
276
281
  contractName: string
277
282
  codeBody: string
278
283
  };
279
- type TransactionPayload = TokenTransferPayload | ContractCallPayload | SmartContractPayload;
284
+ type CoinbasePayload = {
285
+ payloadType: typeof PayloadType.Coinbase
286
+ coinbaseBuffer: string
287
+ };
288
+ type CoinbaseToAltRecipientPayload = {
289
+ payloadType: typeof PayloadType.CoinbaseToAltRecipient
290
+ coinbaseBuffer: string
291
+ recipient: ClarityValue
292
+ };
293
+ type PoisonMicroblockPayload = {
294
+ payloadType: typeof PayloadType.PoisonMicroblock
295
+ header1: string
296
+ header2: string
297
+ };
298
+ type TenureChangePayload = {
299
+ payloadType: typeof PayloadType.TenureChange
300
+ tenureConsensusHash: string
301
+ prevTenureConsensusHash: string
302
+ burnViewConsensusHash: string
303
+ previousTenureEnd: string
304
+ previousTenureBlocks: number
305
+ cause: TenureChangeCause
306
+ pubkeyHash: string
307
+ };
308
+ type NakamotoCoinbasePayload = {
309
+ payloadType: typeof PayloadType.NakamotoCoinbase
310
+ coinbaseBuffer: string
311
+ recipient: ClarityValue | null
312
+ vrfProof: string
313
+ };
314
+ type TransactionPayload = TokenTransferPayload | ContractCallPayload | SmartContractPayload | CoinbasePayload | CoinbaseToAltRecipientPayload | PoisonMicroblockPayload | TenureChangePayload | NakamotoCoinbasePayload;
280
315
  type SingleSigSpendingCondition = {
281
316
  hashMode: typeof AddressHashMode.P2PKH | typeof AddressHashMode.P2WPKH
282
317
  signer: string
@@ -391,7 +426,13 @@ declare class BaseError extends Error {
391
426
  cause?: Error
392
427
  details?: string
393
428
  });
394
- toJSON(): {};
429
+ toJSON(): {
430
+ name: string
431
+ message: string
432
+ shortMessage: string
433
+ details: string | undefined
434
+ cause: string | undefined
435
+ };
395
436
  }
396
437
  declare class SimulationError extends BaseError {
397
438
  name: string;
@@ -257,6 +257,11 @@ declare const PubKeyEncoding: {
257
257
  readonly Uncompressed: 0x01
258
258
  };
259
259
  type PubKeyEncoding = (typeof PubKeyEncoding)[keyof typeof PubKeyEncoding];
260
+ declare const TenureChangeCause: {
261
+ readonly BlockFound: 0x00
262
+ readonly Extended: 0x01
263
+ };
264
+ type TenureChangeCause = (typeof TenureChangeCause)[keyof typeof TenureChangeCause];
260
265
  type TokenTransferPayload = {
261
266
  payloadType: typeof PayloadType.TokenTransfer
262
267
  recipient: ClarityValue
@@ -276,7 +281,37 @@ type SmartContractPayload = {
276
281
  contractName: string
277
282
  codeBody: string
278
283
  };
279
- type TransactionPayload = TokenTransferPayload | ContractCallPayload | SmartContractPayload;
284
+ type CoinbasePayload = {
285
+ payloadType: typeof PayloadType.Coinbase
286
+ coinbaseBuffer: string
287
+ };
288
+ type CoinbaseToAltRecipientPayload = {
289
+ payloadType: typeof PayloadType.CoinbaseToAltRecipient
290
+ coinbaseBuffer: string
291
+ recipient: ClarityValue
292
+ };
293
+ type PoisonMicroblockPayload = {
294
+ payloadType: typeof PayloadType.PoisonMicroblock
295
+ header1: string
296
+ header2: string
297
+ };
298
+ type TenureChangePayload = {
299
+ payloadType: typeof PayloadType.TenureChange
300
+ tenureConsensusHash: string
301
+ prevTenureConsensusHash: string
302
+ burnViewConsensusHash: string
303
+ previousTenureEnd: string
304
+ previousTenureBlocks: number
305
+ cause: TenureChangeCause
306
+ pubkeyHash: string
307
+ };
308
+ type NakamotoCoinbasePayload = {
309
+ payloadType: typeof PayloadType.NakamotoCoinbase
310
+ coinbaseBuffer: string
311
+ recipient: ClarityValue | null
312
+ vrfProof: string
313
+ };
314
+ type TransactionPayload = TokenTransferPayload | ContractCallPayload | SmartContractPayload | CoinbasePayload | CoinbaseToAltRecipientPayload | PoisonMicroblockPayload | TenureChangePayload | NakamotoCoinbasePayload;
280
315
  type SingleSigSpendingCondition = {
281
316
  hashMode: typeof AddressHashMode.P2PKH | typeof AddressHashMode.P2WPKH
282
317
  signer: string
@@ -391,7 +426,13 @@ declare class BaseError extends Error {
391
426
  cause?: Error
392
427
  details?: string
393
428
  });
394
- toJSON(): {};
429
+ toJSON(): {
430
+ name: string
431
+ message: string
432
+ shortMessage: string
433
+ details: string | undefined
434
+ cause: string | undefined
435
+ };
395
436
  }
396
437
  declare class SimulationError extends BaseError {
397
438
  name: string;
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  ContractResponseError,
3
3
  getContract
4
- } from "../../shared/stacks-vdfs3e5v.js";
4
+ } from "../../shared/stacks-1ddg6mbv.js";
5
5
  import {
6
6
  deployContract,
7
7
  getAccountInfo,
@@ -16,7 +16,7 @@ import {
16
16
  simulateTransaction,
17
17
  sponsorTransaction,
18
18
  transferStx
19
- } from "../../shared/stacks-n2g56wgg.js";
19
+ } from "../../shared/stacks-md6e5ta0.js";
20
20
  import {
21
21
  callContract,
22
22
  estimateFee,
@@ -25,7 +25,7 @@ import {
25
25
  isProviderAccount,
26
26
  readContract,
27
27
  sendTransaction
28
- } from "../../shared/stacks-zm0b3tgy.js";
28
+ } from "../../shared/stacks-m2dc5xwg.js";
29
29
  import {
30
30
  watchAddress,
31
31
  watchAddressBalance,
@@ -36,16 +36,16 @@ import {
36
36
  } from "../../shared/stacks-y3dh7hv1.js";
37
37
  import"../../shared/stacks-709tra19.js";
38
38
  import"../../shared/stacks-d1fmkv3p.js";
39
- import"../../shared/stacks-dxhntr76.js";
40
- import"../../shared/stacks-f7wdrzs3.js";
41
- import"../../shared/stacks-yfgsm6ap.js";
39
+ import"../../shared/stacks-ph4a6322.js";
40
+ import"../../shared/stacks-pz73cn97.js";
42
41
  import"../../shared/stacks-j2cy7qtt.js";
43
42
  import"../../shared/stacks-8yykgdww.js";
44
43
  import"../../shared/stacks-v9jqcpd4.js";
45
44
  import"../../shared/stacks-bycy6t9k.js";
46
45
  import"../../shared/stacks-gjvbq6w7.js";
47
46
  import"../../shared/stacks-nqytwfcc.js";
48
- import"../../shared/stacks-8m9byk2j.js";
47
+ import"../../shared/stacks-njvyj3ab.js";
48
+ import"../../shared/stacks-xtz0n62y.js";
49
49
  export {
50
50
  watchTransaction,
51
51
  watchNftEvent,
@@ -1,17 +1,12 @@
1
- import"../../shared/stacks-tjxmrssa.js";
2
1
  import"../../shared/stacks-k58k970n.js";
3
2
  import {
4
3
  ContractResponseError,
5
4
  getContract
6
- } from "../../shared/stacks-vdfs3e5v.js";
7
- import"../../shared/stacks-zm0b3tgy.js";
5
+ } from "../../shared/stacks-1ddg6mbv.js";
6
+ import"../../shared/stacks-m2dc5xwg.js";
8
7
  import"../../shared/stacks-709tra19.js";
9
8
  import"../../shared/stacks-d1fmkv3p.js";
10
- import {
11
- Pc
12
- } from "../../shared/stacks-yfveb68e.js";
13
- import"../../shared/stacks-f7wdrzs3.js";
14
- import"../../shared/stacks-yfgsm6ap.js";
9
+ import"../../shared/stacks-pz73cn97.js";
15
10
  import {
16
11
  Cl
17
12
  } from "../../shared/stacks-j2cy7qtt.js";
@@ -22,7 +17,12 @@ import {
22
17
  } from "../../shared/stacks-bycy6t9k.js";
23
18
  import"../../shared/stacks-gjvbq6w7.js";
24
19
  import"../../shared/stacks-nqytwfcc.js";
25
- import"../../shared/stacks-8m9byk2j.js";
20
+ import"../../shared/stacks-njvyj3ab.js";
21
+ import"../clarity/index.js";
22
+ import {
23
+ Pc
24
+ } from "../postconditions/index.js";
25
+ import"../../shared/stacks-xtz0n62y.js";
26
26
 
27
27
  // src/bns/abi.ts
28
28
  var BNS_ABI = {
@@ -625,5 +625,5 @@ export {
625
625
  BNS_CONTRACTS
626
626
  };
627
627
 
628
- //# debugId=3B5D8D19A6967B5564756E2164756E21
628
+ //# debugId=7C0F98F48AE37F8564756E2164756E21
629
629
  //# sourceMappingURL=index.js.map
@@ -10,6 +10,6 @@
10
10
  "import type { Client } from \"../clients/types.ts\";\nimport {\n resolveName,\n getPrimaryName,\n canRegister,\n getNamePrice,\n getNameId,\n preorder,\n register,\n claimFast,\n transfer,\n setPrimary,\n getZonefile,\n updateZonefile,\n revokeZonefile,\n} from \"./actions.ts\";\nimport type {\n ClaimFastParams,\n TransferParams,\n SetPrimaryParams,\n PreorderParams,\n RegisterParams,\n UpdateZonefileParams,\n} from \"./types.ts\";\n\nexport type {\n ClaimFastParams,\n TransferParams,\n SetPrimaryParams,\n PreorderParams,\n RegisterParams,\n UpdateZonefileParams,\n};\n\n/** Actions provided by the BNS extension. */\nexport type BnsActions = {\n bns: {\n resolveName: (name: string) => Promise<string | null>;\n getPrimaryName: (address: string) => Promise<string | null>;\n canRegister: (name: string) => Promise<boolean>;\n getNamePrice: (name: string) => Promise<bigint>;\n getNameId: (name: string) => Promise<bigint | null>;\n preorder: (params: PreorderParams) => Promise<{ txid: string; salt: Uint8Array }>;\n register: (params: RegisterParams) => Promise<string>;\n claimFast: (params: ClaimFastParams) => Promise<string>;\n transfer: (params: TransferParams) => Promise<string>;\n setPrimary: (params: SetPrimaryParams) => Promise<string>;\n getZonefile: (name: string) => Promise<Uint8Array | null>;\n updateZonefile: (params: UpdateZonefileParams) => Promise<string>;\n revokeZonefile: (name: string) => Promise<string>;\n };\n};\n\nexport { BNS_CONTRACTS, ZONEFILE_RESOLVER_CONTRACTS } from \"./constants.ts\";\nexport {\n parseFQN,\n formatFQN,\n validateName,\n validateNamespace,\n validateFQN,\n generateSalt,\n hashPreorder,\n} from \"./utils.ts\";\n\n/**\n * BNS v2 extension for Stacks client.\n * Provides name resolution, registration, and management.\n *\n * @example\n * import { createWalletClient, http, mainnet } from \"stacks\";\n * import { bns } from \"stacks/bns\";\n * import { privateKeyToAccount } from \"stacks/accounts\";\n *\n * const account = privateKeyToAccount(\"0x...\");\n * const client = createWalletClient({\n * account,\n * chain: mainnet,\n * transport: http(),\n * }).extend(bns());\n *\n * // Resolve names\n * const owner = await client.bns.resolveName(\"alice.btc\");\n *\n * // Register names\n * const txid = await client.bns.claimFast({\n * name: \"bob.btc\",\n * recipient: account.address,\n * });\n *\n * // Transfer names\n * await client.bns.transfer({\n * name: \"alice.btc\",\n * recipient: \"SP3FBR...\",\n * });\n */\nexport function bns(): (client: Client) => BnsActions {\n return (client: Client) => ({\n bns: {\n /**\n * Resolve a BNS name to its owner address.\n * @param name - Fully qualified name (e.g., \"alice.btc\" or \"alice\")\n * @returns Owner address or null if name doesn't exist\n */\n resolveName: (name: string) => resolveName(client, name),\n\n /**\n * Get the primary name for an address.\n * @param address - Stacks address\n * @returns Primary name or null if no primary set\n */\n getPrimaryName: (address: string) => getPrimaryName(client, address),\n\n /**\n * Check if a name is available for registration.\n * @param name - Fully qualified name to check\n * @returns True if available, false otherwise\n */\n canRegister: (name: string) => canRegister(client, name),\n\n /**\n * Get the price to register a name in microSTX.\n * @param name - Fully qualified name\n * @returns Price in microSTX\n */\n getNamePrice: (name: string) => getNamePrice(client, name),\n\n /**\n * Get the NFT token ID for a name.\n * @param name - Fully qualified name\n * @returns Token ID or null if name doesn't exist\n */\n getNameId: (name: string) => getNameId(client, name),\n\n /**\n * Preorder a name (step 1 of secure registration).\n * Commits to a name with a salted hash, preventing front-running.\n * Must wait 1 Bitcoin block (~10 min) before calling register().\n * Requires wallet client with account.\n * @param params - Preorder parameters\n * @returns Transaction ID and salt (save salt for register step!)\n */\n preorder: (params: PreorderParams) => preorder(client, params),\n\n /**\n * Register a name (step 2 of secure registration).\n * Reveals the name after preorder. Must wait 1 Bitcoin block after preorder.\n * Requires wallet client with account.\n * @param params - Register parameters (must include salt from preorder)\n * @returns Transaction ID\n */\n register: (params: RegisterParams) => register(client, params),\n\n /**\n * Claim a name instantly (fast but snipeable).\n * Burns STX to register the name immediately.\n * Requires wallet client with account.\n * @param params - Registration parameters\n * @returns Transaction ID\n */\n claimFast: (params: ClaimFastParams) => claimFast(client, params),\n\n /**\n * Transfer a name to a new owner.\n * Requires wallet client with account.\n * @param params - Transfer parameters\n * @returns Transaction ID\n */\n transfer: (params: TransferParams) => transfer(client, params),\n\n /**\n * Set a name as your primary name.\n * Requires wallet client with account.\n * @param params - Primary name parameters\n * @returns Transaction ID\n */\n setPrimary: (params: SetPrimaryParams) => setPrimary(client, params),\n\n /**\n * Get the zonefile for a name.\n * Zonefiles contain DNS-like records (up to 8192 bytes).\n * @param name - Fully qualified name\n * @returns Zonefile bytes or null if not set\n */\n getZonefile: (name: string) => getZonefile(client, name),\n\n /**\n * Update or clear the zonefile for a name.\n * Only the name owner can update the zonefile.\n * Requires wallet client with account.\n * @param params - Zonefile update parameters\n * @returns Transaction ID\n */\n updateZonefile: (params: UpdateZonefileParams) =>\n updateZonefile(client, params),\n\n /**\n * Revoke (clear) the zonefile for a name.\n * Requires wallet client with account.\n * @param name - Fully qualified name\n * @returns Transaction ID\n */\n revokeZonefile: (name: string) => revokeZonefile(client, name),\n },\n });\n}\n"
11
11
  ],
12
12
  "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAEO,IAAM,UAAU;AAAA,EACrB,WAAW;AAAA,IAET;AAAA,MACE,MAAM;AAAA,MACN,QAAQ;AAAA,MACR,MAAM;AAAA,QACJ,EAAE,MAAM,QAAQ,MAAM,EAAE,MAAM,EAAE,QAAQ,GAAG,EAAE,EAAE;AAAA,QAC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import {
5
5
  mocknet,
6
6
  testnet
7
7
  } from "../../shared/stacks-qt8ehebn.js";
8
- import"../../shared/stacks-8m9byk2j.js";
8
+ import"../../shared/stacks-njvyj3ab.js";
9
9
  export {
10
10
  testnet,
11
11
  mocknet,