@secondlayer/stacks 0.2.0 → 0.2.1

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 (76) hide show
  1. package/dist/shared/stacks-2ar4prfz.cjs +328 -0
  2. package/dist/shared/stacks-2ar4prfz.cjs.map +11 -0
  3. package/dist/shared/{stacks-d1fmkv3p.js → stacks-9avax1yf.js} +2 -2
  4. package/dist/shared/{stacks-ph4a6322.js → stacks-9mdk86wp.js} +16 -18
  5. package/dist/shared/{stacks-ph4a6322.js.map → stacks-9mdk86wp.js.map} +2 -2
  6. package/dist/shared/stacks-dr5en54r.cjs +119 -0
  7. package/dist/shared/stacks-dr5en54r.cjs.map +10 -0
  8. package/dist/shared/{stacks-b008c3w8.cjs → stacks-fedzr2ka.js} +134 -2
  9. package/dist/shared/stacks-fedzr2ka.js.map +13 -0
  10. package/dist/shared/{stacks-j2cy7qtt.js → stacks-ky14tdf6.cjs} +109 -24
  11. package/dist/shared/stacks-ky14tdf6.cjs.map +13 -0
  12. package/dist/shared/stacks-mrk6tkkh.cjs +41 -0
  13. package/dist/shared/{stacks-2gdt3aqj.cjs.map → stacks-mrk6tkkh.cjs.map} +1 -1
  14. package/dist/shared/{stacks-zhd20wgz.js → stacks-qcx67vqa.js} +3 -3
  15. package/dist/shared/stacks-qyt8m5v0.js +282 -0
  16. package/dist/shared/stacks-qyt8m5v0.js.map +11 -0
  17. package/dist/shared/{stacks-hfem9dck.cjs → stacks-vbke9mqw.cjs} +328 -87
  18. package/dist/shared/{stacks-hfem9dck.cjs.map → stacks-vbke9mqw.cjs.map} +8 -6
  19. package/dist/shared/{stacks-8qhfd37f.js → stacks-vd9jcp0b.js} +13 -17
  20. package/dist/shared/{stacks-8qhfd37f.js.map → stacks-vd9jcp0b.js.map} +2 -2
  21. package/dist/shared/{stacks-xtz0n62y.js → stacks-vyb9rx8q.js} +341 -106
  22. package/dist/shared/{stacks-xtz0n62y.js.map → stacks-vyb9rx8q.js.map} +8 -6
  23. package/dist/shared/{stacks-0hqzpm29.js → stacks-wrb1es85.js} +7 -11
  24. package/dist/shared/{stacks-0hqzpm29.js.map → stacks-wrb1es85.js.map} +2 -2
  25. package/dist/shared/stacks-yfveb68e.js +121 -0
  26. package/dist/shared/stacks-yfveb68e.js.map +10 -0
  27. package/dist/src/accounts/index.js +1 -2
  28. package/dist/src/accounts/index.js.map +2 -2
  29. package/dist/src/actions/index.js +8 -11
  30. package/dist/src/actions/index.js.map +1 -1
  31. package/dist/src/bns/index.js +10 -13
  32. package/dist/src/bns/index.js.map +2 -2
  33. package/dist/src/chains/index.js +1 -2
  34. package/dist/src/chains/index.js.map +1 -1
  35. package/dist/src/clarity/index.cjs +1 -326
  36. package/dist/src/clarity/index.cjs.map +3 -5
  37. package/dist/src/clarity/index.js +18 -272
  38. package/dist/src/clarity/index.js.map +3 -5
  39. package/dist/src/connect/index.cjs +19 -9
  40. package/dist/src/connect/index.cjs.map +2 -2
  41. package/dist/src/connect/walletconnect/index.cjs +19 -9
  42. package/dist/src/connect/walletconnect/index.cjs.map +2 -2
  43. package/dist/src/index.cjs +1 -2
  44. package/dist/src/index.cjs.map +3 -3
  45. package/dist/src/index.js +9 -16
  46. package/dist/src/index.js.map +3 -3
  47. package/dist/src/postconditions/index.cjs +1 -117
  48. package/dist/src/postconditions/index.cjs.map +3 -4
  49. package/dist/src/postconditions/index.js +5 -119
  50. package/dist/src/postconditions/index.js.map +3 -4
  51. package/dist/src/pox/index.js +9 -12
  52. package/dist/src/pox/index.js.map +2 -2
  53. package/dist/src/stackingdao/index.js +9 -12
  54. package/dist/src/stackingdao/index.js.map +2 -2
  55. package/dist/src/subscriptions/index.js +1 -2
  56. package/dist/src/subscriptions/index.js.map +1 -1
  57. package/dist/src/transactions/index.js +18 -22
  58. package/dist/src/transactions/index.js.map +1 -1
  59. package/dist/src/utils/index.js +1 -2
  60. package/dist/src/utils/index.js.map +2 -2
  61. package/package.json +1 -1
  62. package/dist/shared/stacks-1aqm7c2h.cjs +0 -110
  63. package/dist/shared/stacks-1aqm7c2h.cjs.map +0 -11
  64. package/dist/shared/stacks-2gdt3aqj.cjs +0 -44
  65. package/dist/shared/stacks-8yykgdww.js +0 -125
  66. package/dist/shared/stacks-8yykgdww.js.map +0 -11
  67. package/dist/shared/stacks-b008c3w8.cjs.map +0 -11
  68. package/dist/shared/stacks-j2cy7qtt.js.map +0 -11
  69. package/dist/shared/stacks-kgesjxq4.cjs +0 -247
  70. package/dist/shared/stacks-kgesjxq4.cjs.map +0 -11
  71. package/dist/shared/stacks-nbz193yk.js +0 -282
  72. package/dist/shared/stacks-nbz193yk.js.map +0 -11
  73. package/dist/shared/stacks-njvyj3ab.js +0 -23
  74. package/dist/shared/stacks-njvyj3ab.js.map +0 -9
  75. /package/dist/shared/{stacks-d1fmkv3p.js.map → stacks-9avax1yf.js.map} +0 -0
  76. /package/dist/shared/{stacks-zhd20wgz.js.map → stacks-qcx67vqa.js.map} +0 -0
@@ -1,11 +1,3 @@
1
- // src/transactions/multisig.ts
2
- var import_secp256k12 = require("@noble/secp256k1");
3
-
4
- // src/transactions/authorization.ts
5
- var import_secp256k1 = require("@noble/secp256k1");
6
- var import_hmac = require("@noble/hashes/hmac.js");
7
- var import_sha2 = require("@noble/hashes/sha2.js");
8
-
9
1
  // src/transactions/types.ts
10
2
  var AuthType = {
11
3
  Standard: 4,
@@ -86,83 +78,6 @@ var TenureChangeCause = {
86
78
  Extended: 1
87
79
  };
88
80
 
89
- // src/transactions/authorization.ts
90
- import_secp256k1.etc.hmacSha256Sync = (key, ...msgs) => {
91
- const h = import_hmac.hmac.create(import_sha2.sha256, key);
92
- msgs.forEach((msg) => h.update(msg));
93
- return h.digest();
94
- };
95
- var EMPTY_SIG = bytesToHex(new Uint8Array(RECOVERABLE_ECDSA_SIG_LENGTH_BYTES));
96
- function createSingleSigSpendingCondition(publicKey, nonce, fee) {
97
- const pubKeyBytes = hexToBytes(publicKey);
98
- const signer = hashP2PKH(pubKeyBytes);
99
- const isCompressed = pubKeyBytes.length === 33;
100
- return {
101
- hashMode: AddressHashMode.P2PKH,
102
- signer,
103
- nonce,
104
- fee,
105
- keyEncoding: isCompressed ? PubKeyEncoding.Compressed : PubKeyEncoding.Uncompressed,
106
- signature: EMPTY_SIG
107
- };
108
- }
109
- function createStandardAuth(spendingCondition) {
110
- return { authType: AuthType.Standard, spendingCondition };
111
- }
112
- function createSponsoredAuth(spendingCondition, sponsorSpendingCondition) {
113
- return {
114
- authType: AuthType.Sponsored,
115
- spendingCondition,
116
- sponsorSpendingCondition: sponsorSpendingCondition ?? createSingleSigSpendingCondition("0".repeat(66), 0n, 0n)
117
- };
118
- }
119
- function clearCondition(condition) {
120
- if ("signature" in condition) {
121
- return {
122
- ...condition,
123
- nonce: 0n,
124
- fee: 0n,
125
- signature: EMPTY_SIG
126
- };
127
- }
128
- return {
129
- ...condition,
130
- nonce: 0n,
131
- fee: 0n,
132
- fields: []
133
- };
134
- }
135
- function intoInitialSighashAuth(auth) {
136
- if (auth.authType === AuthType.Standard) {
137
- return createStandardAuth(clearCondition(auth.spendingCondition));
138
- }
139
- return createSponsoredAuth(clearCondition(auth.spendingCondition), clearCondition(createSingleSigSpendingCondition("0".repeat(66), 0n, 0n)));
140
- }
141
- function sigHashPreSign(curSigHash, authType, fee, nonce) {
142
- const data = concatBytes(hexToBytes(curSigHash), new Uint8Array([authType]), intToBytes(fee, 8), intToBytes(nonce, 8));
143
- return txidFromBytes(data);
144
- }
145
- function sigHashPostSign(curSigHash, pubKeyEncoding, signature) {
146
- const data = concatBytes(hexToBytes(curSigHash), new Uint8Array([pubKeyEncoding]), hexToBytes(signature));
147
- return txidFromBytes(data);
148
- }
149
- function signWithKey(privateKey, messageHash) {
150
- const keyBytes = hexToBytes(privateKey).slice(0, 32);
151
- const sig = import_secp256k1.sign(messageHash, keyBytes, { lowS: true });
152
- const recoveryIdHex = intToHex(sig.recovery, 1);
153
- return recoveryIdHex + sig.toCompactHex();
154
- }
155
- function nextSignature(curSigHash, authType, fee, nonce, privateKey) {
156
- const sigHashPre = sigHashPreSign(curSigHash, authType, fee, nonce);
157
- const keyBytes = hexToBytes(privateKey).slice(0, 32);
158
- const pubKey = import_secp256k1.getPublicKey(keyBytes, true);
159
- const isCompressed = pubKey.length === 33;
160
- const pubKeyEncoding = isCompressed ? PubKeyEncoding.Compressed : PubKeyEncoding.Uncompressed;
161
- const nextSig = signWithKey(privateKey, sigHashPre);
162
- const nextSigHash = sigHashPostSign(sigHashPre, pubKeyEncoding, nextSig);
163
- return { nextSig, nextSigHash };
164
- }
165
-
166
81
  // src/transactions/wire/serialize.ts
167
82
  function serializeAddress(c32Address) {
168
83
  const [version, hash1602] = c32addressDecode(c32Address);
@@ -336,7 +251,88 @@ function serializeTransactionHex(tx) {
336
251
  return bytesToHex(serializeTransaction(tx));
337
252
  }
338
253
 
254
+ // src/transactions/authorization.ts
255
+ var import_secp256k1 = require("@noble/secp256k1");
256
+ var import_hmac = require("@noble/hashes/hmac.js");
257
+ var import_sha2 = require("@noble/hashes/sha2.js");
258
+ import_secp256k1.etc.hmacSha256Sync = (key, ...msgs) => {
259
+ const h = import_hmac.hmac.create(import_sha2.sha256, key);
260
+ msgs.forEach((msg) => h.update(msg));
261
+ return h.digest();
262
+ };
263
+ var EMPTY_SIG = bytesToHex(new Uint8Array(RECOVERABLE_ECDSA_SIG_LENGTH_BYTES));
264
+ function createSingleSigSpendingCondition(publicKey, nonce, fee) {
265
+ const pubKeyBytes = hexToBytes(publicKey);
266
+ const signer = hashP2PKH(pubKeyBytes);
267
+ const isCompressed = pubKeyBytes.length === 33;
268
+ return {
269
+ hashMode: AddressHashMode.P2PKH,
270
+ signer,
271
+ nonce,
272
+ fee,
273
+ keyEncoding: isCompressed ? PubKeyEncoding.Compressed : PubKeyEncoding.Uncompressed,
274
+ signature: EMPTY_SIG
275
+ };
276
+ }
277
+ function createStandardAuth(spendingCondition) {
278
+ return { authType: AuthType.Standard, spendingCondition };
279
+ }
280
+ function createSponsoredAuth(spendingCondition, sponsorSpendingCondition) {
281
+ return {
282
+ authType: AuthType.Sponsored,
283
+ spendingCondition,
284
+ sponsorSpendingCondition: sponsorSpendingCondition ?? createSingleSigSpendingCondition("0".repeat(66), 0n, 0n)
285
+ };
286
+ }
287
+ function clearCondition(condition) {
288
+ if ("signature" in condition) {
289
+ return {
290
+ ...condition,
291
+ nonce: 0n,
292
+ fee: 0n,
293
+ signature: EMPTY_SIG
294
+ };
295
+ }
296
+ return {
297
+ ...condition,
298
+ nonce: 0n,
299
+ fee: 0n,
300
+ fields: []
301
+ };
302
+ }
303
+ function intoInitialSighashAuth(auth) {
304
+ if (auth.authType === AuthType.Standard) {
305
+ return createStandardAuth(clearCondition(auth.spendingCondition));
306
+ }
307
+ return createSponsoredAuth(clearCondition(auth.spendingCondition), clearCondition(createSingleSigSpendingCondition("0".repeat(66), 0n, 0n)));
308
+ }
309
+ function sigHashPreSign(curSigHash, authType, fee, nonce) {
310
+ const data = concatBytes(hexToBytes(curSigHash), new Uint8Array([authType]), intToBytes(fee, 8), intToBytes(nonce, 8));
311
+ return txidFromBytes(data);
312
+ }
313
+ function sigHashPostSign(curSigHash, pubKeyEncoding, signature) {
314
+ const data = concatBytes(hexToBytes(curSigHash), new Uint8Array([pubKeyEncoding]), hexToBytes(signature));
315
+ return txidFromBytes(data);
316
+ }
317
+ function signWithKey(privateKey, messageHash) {
318
+ const keyBytes = hexToBytes(privateKey).slice(0, 32);
319
+ const sig = import_secp256k1.sign(messageHash, keyBytes, { lowS: true });
320
+ const recoveryIdHex = intToHex(sig.recovery, 1);
321
+ return recoveryIdHex + sig.toCompactHex();
322
+ }
323
+ function nextSignature(curSigHash, authType, fee, nonce, privateKey) {
324
+ const sigHashPre = sigHashPreSign(curSigHash, authType, fee, nonce);
325
+ const keyBytes = hexToBytes(privateKey).slice(0, 32);
326
+ const pubKey = import_secp256k1.getPublicKey(keyBytes, true);
327
+ const isCompressed = pubKey.length === 33;
328
+ const pubKeyEncoding = isCompressed ? PubKeyEncoding.Compressed : PubKeyEncoding.Uncompressed;
329
+ const nextSig = signWithKey(privateKey, sigHashPre);
330
+ const nextSigHash = sigHashPostSign(sigHashPre, pubKeyEncoding, nextSig);
331
+ return { nextSig, nextSigHash };
332
+ }
333
+
339
334
  // src/transactions/multisig.ts
335
+ var import_secp256k12 = require("@noble/secp256k1");
340
336
  var OP_CHECKMULTISIG = 174;
341
337
  function isNonSequential(hashMode) {
342
338
  return (hashMode & 4) !== 0;
@@ -607,5 +603,250 @@ function combineMultiSigSignatures(baseTx, signedTxs) {
607
603
  };
608
604
  }
609
605
 
610
- //# debugId=5A8F9D28AE3FE53E64756E2164756E21
611
- //# sourceMappingURL=stacks-hfem9dck.cjs.map
606
+ // src/transactions/signer.ts
607
+ function txid(tx) {
608
+ return txidFromBytes(serializeTransaction(tx));
609
+ }
610
+ function signBegin(tx) {
611
+ const cleared = {
612
+ ...tx,
613
+ auth: intoInitialSighashAuth(tx.auth)
614
+ };
615
+ return txid(cleared);
616
+ }
617
+ function signTransaction(tx, privateKey) {
618
+ const sigHash = signBegin(tx);
619
+ const condition = tx.auth.spendingCondition;
620
+ const { nextSig } = nextSignature(sigHash, AuthType.Standard, condition.fee, condition.nonce, privateKey);
621
+ return {
622
+ ...tx,
623
+ auth: {
624
+ ...tx.auth,
625
+ spendingCondition: {
626
+ ...condition,
627
+ signature: nextSig
628
+ }
629
+ }
630
+ };
631
+ }
632
+ async function signTransactionWithAccount(tx, account) {
633
+ const sigHash = signBegin(tx);
634
+ const condition = tx.auth.spendingCondition;
635
+ const sigHashPre = sigHashPreSign(sigHash, AuthType.Standard, condition.fee, condition.nonce);
636
+ const sigBytes = await account.sign(hexToBytes(sigHashPre));
637
+ const nextSig = bytesToHex(sigBytes);
638
+ return {
639
+ ...tx,
640
+ auth: {
641
+ ...tx.auth,
642
+ spendingCondition: {
643
+ ...condition,
644
+ signature: nextSig
645
+ }
646
+ }
647
+ };
648
+ }
649
+ function getTransactionId(tx) {
650
+ return txid(tx);
651
+ }
652
+ function getOriginSigHash(tx) {
653
+ const condition = tx.auth.spendingCondition;
654
+ if ("fields" in condition) {
655
+ return replayMultiSigSigHash(tx);
656
+ }
657
+ const initialSigHash2 = signBegin(tx);
658
+ const sc = condition;
659
+ const preSign = sigHashPreSign(initialSigHash2, AuthType.Standard, sc.fee, sc.nonce);
660
+ return sigHashPostSign(preSign, sc.keyEncoding, sc.signature);
661
+ }
662
+ function signSponsor(tx, privateKey) {
663
+ if (tx.auth.authType !== AuthType.Sponsored) {
664
+ throw new Error("Transaction must be sponsored");
665
+ }
666
+ const auth = tx.auth;
667
+ const sponsorCondition = auth.sponsorSpendingCondition;
668
+ const originSigHash = getOriginSigHash(tx);
669
+ const { nextSig } = nextSignature(originSigHash, AuthType.Sponsored, sponsorCondition.fee, sponsorCondition.nonce, privateKey);
670
+ return {
671
+ ...tx,
672
+ auth: {
673
+ ...auth,
674
+ sponsorSpendingCondition: {
675
+ ...sponsorCondition,
676
+ signature: nextSig
677
+ }
678
+ }
679
+ };
680
+ }
681
+ async function signSponsorWithAccount(tx, account) {
682
+ if (tx.auth.authType !== AuthType.Sponsored) {
683
+ throw new Error("Transaction must be sponsored");
684
+ }
685
+ const auth = tx.auth;
686
+ const sponsorCondition = auth.sponsorSpendingCondition;
687
+ const originSigHash = getOriginSigHash(tx);
688
+ const sigHashPre = sigHashPreSign(originSigHash, AuthType.Sponsored, sponsorCondition.fee, sponsorCondition.nonce);
689
+ const sigBytes = await account.sign(hexToBytes(sigHashPre));
690
+ const nextSig = bytesToHex(sigBytes);
691
+ return {
692
+ ...tx,
693
+ auth: {
694
+ ...auth,
695
+ sponsorSpendingCondition: {
696
+ ...sponsorCondition,
697
+ signature: nextSig
698
+ }
699
+ }
700
+ };
701
+ }
702
+
703
+ // src/transactions/build.ts
704
+ function resolvePcMode(mode) {
705
+ return mode === "allow" ? PostConditionModeWire.Allow : PostConditionModeWire.Deny;
706
+ }
707
+ function convertPostConditions(pcs) {
708
+ if (!pcs || pcs.length === 0)
709
+ return [];
710
+ return pcs.map(convertPostCondition);
711
+ }
712
+ function resolvePrincipal(address) {
713
+ if (address === "origin")
714
+ return { type: "origin" };
715
+ const [addr, name] = address.split(".");
716
+ if (name) {
717
+ return { type: "contract", address: addr, contractName: name };
718
+ }
719
+ return { type: "standard", address: addr };
720
+ }
721
+ var FUNGIBLE_CODE_MAP = {
722
+ eq: FungibleConditionCode.Equal,
723
+ gt: FungibleConditionCode.Greater,
724
+ gte: FungibleConditionCode.GreaterEqual,
725
+ lt: FungibleConditionCode.Less,
726
+ lte: FungibleConditionCode.LessEqual
727
+ };
728
+ function convertPostCondition(pc) {
729
+ switch (pc.type) {
730
+ case "stx-postcondition":
731
+ return {
732
+ type: "stx",
733
+ principal: resolvePrincipal(pc.address),
734
+ conditionCode: FUNGIBLE_CODE_MAP[pc.condition],
735
+ amount: intToBigInt(pc.amount)
736
+ };
737
+ case "ft-postcondition": {
738
+ const [contractId, tokenName] = pc.asset.split("::");
739
+ const [addr, name] = parseContractId(contractId);
740
+ return {
741
+ type: "ft",
742
+ principal: resolvePrincipal(pc.address),
743
+ asset: { address: addr, contractName: name, assetName: tokenName },
744
+ conditionCode: FUNGIBLE_CODE_MAP[pc.condition],
745
+ amount: intToBigInt(pc.amount)
746
+ };
747
+ }
748
+ case "nft-postcondition": {
749
+ const [contractId, tokenName] = pc.asset.split("::");
750
+ const [addr, name] = parseContractId(contractId);
751
+ return {
752
+ type: "nft",
753
+ principal: resolvePrincipal(pc.address),
754
+ asset: { address: addr, contractName: name, assetName: tokenName },
755
+ conditionCode: pc.condition === "sent" ? NonFungibleConditionCode.Sends : NonFungibleConditionCode.DoesNotSend,
756
+ assetId: pc.assetId
757
+ };
758
+ }
759
+ }
760
+ }
761
+ function resolveSpendingCondition(opts, nonce, fee) {
762
+ if (opts.publicKeys) {
763
+ return createMultiSigSpendingCondition(opts.publicKeys, opts.signaturesRequired, nonce, fee, opts.hashMode);
764
+ }
765
+ return createSingleSigSpendingCondition(opts.publicKey, nonce, fee);
766
+ }
767
+ function resolveAuth(spendingCondition, sponsored) {
768
+ return sponsored ? createSponsoredAuth(spendingCondition) : createStandardAuth(spendingCondition);
769
+ }
770
+ function resolveVersionAndChainId(chain) {
771
+ if (!chain)
772
+ return { version: 0, chainId: 1 };
773
+ return { version: chain.transactionVersion, chainId: chain.id };
774
+ }
775
+ function buildTokenTransfer(options) {
776
+ const { version, chainId } = resolveVersionAndChainId(options.chain);
777
+ const fee = intToBigInt(options.fee);
778
+ const nonce = intToBigInt(options.nonce);
779
+ const spendingCondition = resolveSpendingCondition(options, nonce, fee);
780
+ const recipient = Cl.principal(options.recipient);
781
+ const tx = {
782
+ version,
783
+ chainId,
784
+ auth: resolveAuth(spendingCondition, options.sponsored),
785
+ anchorMode: AnchorMode.Any,
786
+ postConditionMode: resolvePcMode(options.postConditionMode),
787
+ postConditions: convertPostConditions(options.postConditions),
788
+ payload: {
789
+ payloadType: PayloadType.TokenTransfer,
790
+ recipient,
791
+ amount: intToBigInt(options.amount),
792
+ memo: options.memo ?? ""
793
+ }
794
+ };
795
+ if (options.publicKeys) {
796
+ tx._multisig = { publicKeys: options.publicKeys };
797
+ }
798
+ return tx;
799
+ }
800
+ function buildContractCall(options) {
801
+ const { version, chainId } = resolveVersionAndChainId(options.chain);
802
+ const fee = intToBigInt(options.fee);
803
+ const nonce = intToBigInt(options.nonce);
804
+ const spendingCondition = resolveSpendingCondition(options, nonce, fee);
805
+ const tx = {
806
+ version,
807
+ chainId,
808
+ auth: resolveAuth(spendingCondition, options.sponsored),
809
+ anchorMode: AnchorMode.Any,
810
+ postConditionMode: resolvePcMode(options.postConditionMode),
811
+ postConditions: convertPostConditions(options.postConditions),
812
+ payload: {
813
+ payloadType: PayloadType.ContractCall,
814
+ contractAddress: options.contractAddress,
815
+ contractName: options.contractName,
816
+ functionName: options.functionName,
817
+ functionArgs: options.functionArgs
818
+ }
819
+ };
820
+ if (options.publicKeys) {
821
+ tx._multisig = { publicKeys: options.publicKeys };
822
+ }
823
+ return tx;
824
+ }
825
+ function buildContractDeploy(options) {
826
+ const { version, chainId } = resolveVersionAndChainId(options.chain);
827
+ const fee = intToBigInt(options.fee);
828
+ const nonce = intToBigInt(options.nonce);
829
+ const spendingCondition = resolveSpendingCondition(options, nonce, fee);
830
+ const useVersioned = options.clarityVersion !== undefined;
831
+ const tx = {
832
+ version,
833
+ chainId,
834
+ auth: resolveAuth(spendingCondition, options.sponsored),
835
+ anchorMode: AnchorMode.Any,
836
+ postConditionMode: resolvePcMode(options.postConditionMode),
837
+ postConditions: convertPostConditions(options.postConditions),
838
+ payload: {
839
+ payloadType: useVersioned ? PayloadType.VersionedSmartContract : PayloadType.SmartContract,
840
+ clarityVersion: options.clarityVersion,
841
+ contractName: options.contractName,
842
+ codeBody: options.codeBody
843
+ }
844
+ };
845
+ if (options.publicKeys) {
846
+ tx._multisig = { publicKeys: options.publicKeys };
847
+ }
848
+ return tx;
849
+ }
850
+
851
+ //# debugId=F9AB0B29B396E33564756E2164756E21
852
+ //# sourceMappingURL=stacks-vbke9mqw.cjs.map