@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,15 @@
1
1
  import {
2
+ Cl,
2
3
  serializeCVBytes
3
- } from "./stacks-8yykgdww.js";
4
+ } from "./stacks-fedzr2ka.js";
4
5
  import {
5
6
  hash160,
6
7
  hashP2PKH,
7
8
  txidFromBytes
8
9
  } from "./stacks-bycy6t9k.js";
10
+ import {
11
+ parseContractId
12
+ } from "./stacks-gjvbq6w7.js";
9
13
  import {
10
14
  asciiToBytes,
11
15
  bytesToHex,
@@ -13,6 +17,7 @@ import {
13
17
  c32addressDecode,
14
18
  concatBytes,
15
19
  hexToBytes,
20
+ intToBigInt,
16
21
  intToBytes,
17
22
  intToHex,
18
23
  utf8ToBytes,
@@ -20,22 +25,6 @@ import {
20
25
  writeUInt32BE,
21
26
  writeUInt8
22
27
  } from "./stacks-nqytwfcc.js";
23
- import"./stacks-njvyj3ab.js";
24
-
25
- // src/transactions/multisig.ts
26
- import {
27
- getPublicKey as nobleGetPublicKey2,
28
- sign as nobleSign
29
- } from "@noble/secp256k1";
30
-
31
- // src/transactions/authorization.ts
32
- import {
33
- getPublicKey as nobleGetPublicKey,
34
- sign,
35
- etc
36
- } from "@noble/secp256k1";
37
- import { hmac } from "@noble/hashes/hmac.js";
38
- import { sha256 } from "@noble/hashes/sha2.js";
39
28
 
40
29
  // src/transactions/types.ts
41
30
  var AuthType = {
@@ -117,83 +106,6 @@ var TenureChangeCause = {
117
106
  Extended: 1
118
107
  };
119
108
 
120
- // src/transactions/authorization.ts
121
- etc.hmacSha256Sync = (key, ...msgs) => {
122
- const h = hmac.create(sha256, key);
123
- msgs.forEach((msg) => h.update(msg));
124
- return h.digest();
125
- };
126
- var EMPTY_SIG = bytesToHex(new Uint8Array(RECOVERABLE_ECDSA_SIG_LENGTH_BYTES));
127
- function createSingleSigSpendingCondition(publicKey, nonce, fee) {
128
- const pubKeyBytes = hexToBytes(publicKey);
129
- const signer = hashP2PKH(pubKeyBytes);
130
- const isCompressed = pubKeyBytes.length === 33;
131
- return {
132
- hashMode: AddressHashMode.P2PKH,
133
- signer,
134
- nonce,
135
- fee,
136
- keyEncoding: isCompressed ? PubKeyEncoding.Compressed : PubKeyEncoding.Uncompressed,
137
- signature: EMPTY_SIG
138
- };
139
- }
140
- function createStandardAuth(spendingCondition) {
141
- return { authType: AuthType.Standard, spendingCondition };
142
- }
143
- function createSponsoredAuth(spendingCondition, sponsorSpendingCondition) {
144
- return {
145
- authType: AuthType.Sponsored,
146
- spendingCondition,
147
- sponsorSpendingCondition: sponsorSpendingCondition ?? createSingleSigSpendingCondition("0".repeat(66), 0n, 0n)
148
- };
149
- }
150
- function clearCondition(condition) {
151
- if ("signature" in condition) {
152
- return {
153
- ...condition,
154
- nonce: 0n,
155
- fee: 0n,
156
- signature: EMPTY_SIG
157
- };
158
- }
159
- return {
160
- ...condition,
161
- nonce: 0n,
162
- fee: 0n,
163
- fields: []
164
- };
165
- }
166
- function intoInitialSighashAuth(auth) {
167
- if (auth.authType === AuthType.Standard) {
168
- return createStandardAuth(clearCondition(auth.spendingCondition));
169
- }
170
- return createSponsoredAuth(clearCondition(auth.spendingCondition), clearCondition(createSingleSigSpendingCondition("0".repeat(66), 0n, 0n)));
171
- }
172
- function sigHashPreSign(curSigHash, authType, fee, nonce) {
173
- const data = concatBytes(hexToBytes(curSigHash), new Uint8Array([authType]), intToBytes(fee, 8), intToBytes(nonce, 8));
174
- return txidFromBytes(data);
175
- }
176
- function sigHashPostSign(curSigHash, pubKeyEncoding, signature) {
177
- const data = concatBytes(hexToBytes(curSigHash), new Uint8Array([pubKeyEncoding]), hexToBytes(signature));
178
- return txidFromBytes(data);
179
- }
180
- function signWithKey(privateKey, messageHash) {
181
- const keyBytes = hexToBytes(privateKey).slice(0, 32);
182
- const sig = sign(messageHash, keyBytes, { lowS: true });
183
- const recoveryIdHex = intToHex(sig.recovery, 1);
184
- return recoveryIdHex + sig.toCompactHex();
185
- }
186
- function nextSignature(curSigHash, authType, fee, nonce, privateKey) {
187
- const sigHashPre = sigHashPreSign(curSigHash, authType, fee, nonce);
188
- const keyBytes = hexToBytes(privateKey).slice(0, 32);
189
- const pubKey = nobleGetPublicKey(keyBytes, true);
190
- const isCompressed = pubKey.length === 33;
191
- const pubKeyEncoding = isCompressed ? PubKeyEncoding.Compressed : PubKeyEncoding.Uncompressed;
192
- const nextSig = signWithKey(privateKey, sigHashPre);
193
- const nextSigHash = sigHashPostSign(sigHashPre, pubKeyEncoding, nextSig);
194
- return { nextSig, nextSigHash };
195
- }
196
-
197
109
  // src/transactions/wire/serialize.ts
198
110
  function serializeAddress(c32Address) {
199
111
  const [version, hash1602] = c32addressDecode(c32Address);
@@ -367,7 +279,95 @@ function serializeTransactionHex(tx) {
367
279
  return bytesToHex(serializeTransaction(tx));
368
280
  }
369
281
 
282
+ // src/transactions/authorization.ts
283
+ import {
284
+ getPublicKey as nobleGetPublicKey,
285
+ sign,
286
+ etc
287
+ } from "@noble/secp256k1";
288
+ import { hmac } from "@noble/hashes/hmac.js";
289
+ import { sha256 } from "@noble/hashes/sha2.js";
290
+ etc.hmacSha256Sync = (key, ...msgs) => {
291
+ const h = hmac.create(sha256, key);
292
+ msgs.forEach((msg) => h.update(msg));
293
+ return h.digest();
294
+ };
295
+ var EMPTY_SIG = bytesToHex(new Uint8Array(RECOVERABLE_ECDSA_SIG_LENGTH_BYTES));
296
+ function createSingleSigSpendingCondition(publicKey, nonce, fee) {
297
+ const pubKeyBytes = hexToBytes(publicKey);
298
+ const signer = hashP2PKH(pubKeyBytes);
299
+ const isCompressed = pubKeyBytes.length === 33;
300
+ return {
301
+ hashMode: AddressHashMode.P2PKH,
302
+ signer,
303
+ nonce,
304
+ fee,
305
+ keyEncoding: isCompressed ? PubKeyEncoding.Compressed : PubKeyEncoding.Uncompressed,
306
+ signature: EMPTY_SIG
307
+ };
308
+ }
309
+ function createStandardAuth(spendingCondition) {
310
+ return { authType: AuthType.Standard, spendingCondition };
311
+ }
312
+ function createSponsoredAuth(spendingCondition, sponsorSpendingCondition) {
313
+ return {
314
+ authType: AuthType.Sponsored,
315
+ spendingCondition,
316
+ sponsorSpendingCondition: sponsorSpendingCondition ?? createSingleSigSpendingCondition("0".repeat(66), 0n, 0n)
317
+ };
318
+ }
319
+ function clearCondition(condition) {
320
+ if ("signature" in condition) {
321
+ return {
322
+ ...condition,
323
+ nonce: 0n,
324
+ fee: 0n,
325
+ signature: EMPTY_SIG
326
+ };
327
+ }
328
+ return {
329
+ ...condition,
330
+ nonce: 0n,
331
+ fee: 0n,
332
+ fields: []
333
+ };
334
+ }
335
+ function intoInitialSighashAuth(auth) {
336
+ if (auth.authType === AuthType.Standard) {
337
+ return createStandardAuth(clearCondition(auth.spendingCondition));
338
+ }
339
+ return createSponsoredAuth(clearCondition(auth.spendingCondition), clearCondition(createSingleSigSpendingCondition("0".repeat(66), 0n, 0n)));
340
+ }
341
+ function sigHashPreSign(curSigHash, authType, fee, nonce) {
342
+ const data = concatBytes(hexToBytes(curSigHash), new Uint8Array([authType]), intToBytes(fee, 8), intToBytes(nonce, 8));
343
+ return txidFromBytes(data);
344
+ }
345
+ function sigHashPostSign(curSigHash, pubKeyEncoding, signature) {
346
+ const data = concatBytes(hexToBytes(curSigHash), new Uint8Array([pubKeyEncoding]), hexToBytes(signature));
347
+ return txidFromBytes(data);
348
+ }
349
+ function signWithKey(privateKey, messageHash) {
350
+ const keyBytes = hexToBytes(privateKey).slice(0, 32);
351
+ const sig = sign(messageHash, keyBytes, { lowS: true });
352
+ const recoveryIdHex = intToHex(sig.recovery, 1);
353
+ return recoveryIdHex + sig.toCompactHex();
354
+ }
355
+ function nextSignature(curSigHash, authType, fee, nonce, privateKey) {
356
+ const sigHashPre = sigHashPreSign(curSigHash, authType, fee, nonce);
357
+ const keyBytes = hexToBytes(privateKey).slice(0, 32);
358
+ const pubKey = nobleGetPublicKey(keyBytes, true);
359
+ const isCompressed = pubKey.length === 33;
360
+ const pubKeyEncoding = isCompressed ? PubKeyEncoding.Compressed : PubKeyEncoding.Uncompressed;
361
+ const nextSig = signWithKey(privateKey, sigHashPre);
362
+ const nextSigHash = sigHashPostSign(sigHashPre, pubKeyEncoding, nextSig);
363
+ return { nextSig, nextSigHash };
364
+ }
365
+
370
366
  // src/transactions/multisig.ts
367
+ import {
368
+ getPublicKey as nobleGetPublicKey2,
369
+ sign as nobleSign
370
+ } from "@noble/secp256k1";
371
371
  var OP_CHECKMULTISIG = 174;
372
372
  function isNonSequential(hashMode) {
373
373
  return (hashMode & 4) !== 0;
@@ -637,18 +637,253 @@ function combineMultiSigSignatures(baseTx, signedTxs) {
637
637
  auth: { ...baseTx.auth, spendingCondition: newCondition }
638
638
  };
639
639
  }
640
- export {
641
- signMultiSigWithAccount,
642
- signMultiSig,
643
- replayMultiSigSigHash,
644
- makeMultiSigAddress,
645
- isNonSequential,
646
- finalizeMultiSig,
647
- createMultiSigSpendingCondition,
648
- combineMultiSigSignatures
640
+
641
+ // src/transactions/signer.ts
642
+ function txid(tx) {
643
+ return txidFromBytes(serializeTransaction(tx));
644
+ }
645
+ function signBegin(tx) {
646
+ const cleared = {
647
+ ...tx,
648
+ auth: intoInitialSighashAuth(tx.auth)
649
+ };
650
+ return txid(cleared);
651
+ }
652
+ function signTransaction(tx, privateKey) {
653
+ const sigHash = signBegin(tx);
654
+ const condition = tx.auth.spendingCondition;
655
+ const { nextSig } = nextSignature(sigHash, AuthType.Standard, condition.fee, condition.nonce, privateKey);
656
+ return {
657
+ ...tx,
658
+ auth: {
659
+ ...tx.auth,
660
+ spendingCondition: {
661
+ ...condition,
662
+ signature: nextSig
663
+ }
664
+ }
665
+ };
666
+ }
667
+ async function signTransactionWithAccount(tx, account) {
668
+ const sigHash = signBegin(tx);
669
+ const condition = tx.auth.spendingCondition;
670
+ const sigHashPre = sigHashPreSign(sigHash, AuthType.Standard, condition.fee, condition.nonce);
671
+ const sigBytes = await account.sign(hexToBytes(sigHashPre));
672
+ const nextSig = bytesToHex(sigBytes);
673
+ return {
674
+ ...tx,
675
+ auth: {
676
+ ...tx.auth,
677
+ spendingCondition: {
678
+ ...condition,
679
+ signature: nextSig
680
+ }
681
+ }
682
+ };
683
+ }
684
+ function getTransactionId(tx) {
685
+ return txid(tx);
686
+ }
687
+ function getOriginSigHash(tx) {
688
+ const condition = tx.auth.spendingCondition;
689
+ if ("fields" in condition) {
690
+ return replayMultiSigSigHash(tx);
691
+ }
692
+ const initialSigHash2 = signBegin(tx);
693
+ const sc = condition;
694
+ const preSign = sigHashPreSign(initialSigHash2, AuthType.Standard, sc.fee, sc.nonce);
695
+ return sigHashPostSign(preSign, sc.keyEncoding, sc.signature);
696
+ }
697
+ function signSponsor(tx, privateKey) {
698
+ if (tx.auth.authType !== AuthType.Sponsored) {
699
+ throw new Error("Transaction must be sponsored");
700
+ }
701
+ const auth = tx.auth;
702
+ const sponsorCondition = auth.sponsorSpendingCondition;
703
+ const originSigHash = getOriginSigHash(tx);
704
+ const { nextSig } = nextSignature(originSigHash, AuthType.Sponsored, sponsorCondition.fee, sponsorCondition.nonce, privateKey);
705
+ return {
706
+ ...tx,
707
+ auth: {
708
+ ...auth,
709
+ sponsorSpendingCondition: {
710
+ ...sponsorCondition,
711
+ signature: nextSig
712
+ }
713
+ }
714
+ };
715
+ }
716
+ async function signSponsorWithAccount(tx, account) {
717
+ if (tx.auth.authType !== AuthType.Sponsored) {
718
+ throw new Error("Transaction must be sponsored");
719
+ }
720
+ const auth = tx.auth;
721
+ const sponsorCondition = auth.sponsorSpendingCondition;
722
+ const originSigHash = getOriginSigHash(tx);
723
+ const sigHashPre = sigHashPreSign(originSigHash, AuthType.Sponsored, sponsorCondition.fee, sponsorCondition.nonce);
724
+ const sigBytes = await account.sign(hexToBytes(sigHashPre));
725
+ const nextSig = bytesToHex(sigBytes);
726
+ return {
727
+ ...tx,
728
+ auth: {
729
+ ...auth,
730
+ sponsorSpendingCondition: {
731
+ ...sponsorCondition,
732
+ signature: nextSig
733
+ }
734
+ }
735
+ };
736
+ }
737
+
738
+ // src/transactions/build.ts
739
+ function resolvePcMode(mode) {
740
+ return mode === "allow" ? PostConditionModeWire.Allow : PostConditionModeWire.Deny;
741
+ }
742
+ function convertPostConditions(pcs) {
743
+ if (!pcs || pcs.length === 0)
744
+ return [];
745
+ return pcs.map(convertPostCondition);
746
+ }
747
+ function resolvePrincipal(address) {
748
+ if (address === "origin")
749
+ return { type: "origin" };
750
+ const [addr, name] = address.split(".");
751
+ if (name) {
752
+ return { type: "contract", address: addr, contractName: name };
753
+ }
754
+ return { type: "standard", address: addr };
755
+ }
756
+ var FUNGIBLE_CODE_MAP = {
757
+ eq: FungibleConditionCode.Equal,
758
+ gt: FungibleConditionCode.Greater,
759
+ gte: FungibleConditionCode.GreaterEqual,
760
+ lt: FungibleConditionCode.Less,
761
+ lte: FungibleConditionCode.LessEqual
649
762
  };
763
+ function convertPostCondition(pc) {
764
+ switch (pc.type) {
765
+ case "stx-postcondition":
766
+ return {
767
+ type: "stx",
768
+ principal: resolvePrincipal(pc.address),
769
+ conditionCode: FUNGIBLE_CODE_MAP[pc.condition],
770
+ amount: intToBigInt(pc.amount)
771
+ };
772
+ case "ft-postcondition": {
773
+ const [contractId, tokenName] = pc.asset.split("::");
774
+ const [addr, name] = parseContractId(contractId);
775
+ return {
776
+ type: "ft",
777
+ principal: resolvePrincipal(pc.address),
778
+ asset: { address: addr, contractName: name, assetName: tokenName },
779
+ conditionCode: FUNGIBLE_CODE_MAP[pc.condition],
780
+ amount: intToBigInt(pc.amount)
781
+ };
782
+ }
783
+ case "nft-postcondition": {
784
+ const [contractId, tokenName] = pc.asset.split("::");
785
+ const [addr, name] = parseContractId(contractId);
786
+ return {
787
+ type: "nft",
788
+ principal: resolvePrincipal(pc.address),
789
+ asset: { address: addr, contractName: name, assetName: tokenName },
790
+ conditionCode: pc.condition === "sent" ? NonFungibleConditionCode.Sends : NonFungibleConditionCode.DoesNotSend,
791
+ assetId: pc.assetId
792
+ };
793
+ }
794
+ }
795
+ }
796
+ function resolveSpendingCondition(opts, nonce, fee) {
797
+ if (opts.publicKeys) {
798
+ return createMultiSigSpendingCondition(opts.publicKeys, opts.signaturesRequired, nonce, fee, opts.hashMode);
799
+ }
800
+ return createSingleSigSpendingCondition(opts.publicKey, nonce, fee);
801
+ }
802
+ function resolveAuth(spendingCondition, sponsored) {
803
+ return sponsored ? createSponsoredAuth(spendingCondition) : createStandardAuth(spendingCondition);
804
+ }
805
+ function resolveVersionAndChainId(chain) {
806
+ if (!chain)
807
+ return { version: 0, chainId: 1 };
808
+ return { version: chain.transactionVersion, chainId: chain.id };
809
+ }
810
+ function buildTokenTransfer(options) {
811
+ const { version, chainId } = resolveVersionAndChainId(options.chain);
812
+ const fee = intToBigInt(options.fee);
813
+ const nonce = intToBigInt(options.nonce);
814
+ const spendingCondition = resolveSpendingCondition(options, nonce, fee);
815
+ const recipient = Cl.principal(options.recipient);
816
+ const tx = {
817
+ version,
818
+ chainId,
819
+ auth: resolveAuth(spendingCondition, options.sponsored),
820
+ anchorMode: AnchorMode.Any,
821
+ postConditionMode: resolvePcMode(options.postConditionMode),
822
+ postConditions: convertPostConditions(options.postConditions),
823
+ payload: {
824
+ payloadType: PayloadType.TokenTransfer,
825
+ recipient,
826
+ amount: intToBigInt(options.amount),
827
+ memo: options.memo ?? ""
828
+ }
829
+ };
830
+ if (options.publicKeys) {
831
+ tx._multisig = { publicKeys: options.publicKeys };
832
+ }
833
+ return tx;
834
+ }
835
+ function buildContractCall(options) {
836
+ const { version, chainId } = resolveVersionAndChainId(options.chain);
837
+ const fee = intToBigInt(options.fee);
838
+ const nonce = intToBigInt(options.nonce);
839
+ const spendingCondition = resolveSpendingCondition(options, nonce, fee);
840
+ const tx = {
841
+ version,
842
+ chainId,
843
+ auth: resolveAuth(spendingCondition, options.sponsored),
844
+ anchorMode: AnchorMode.Any,
845
+ postConditionMode: resolvePcMode(options.postConditionMode),
846
+ postConditions: convertPostConditions(options.postConditions),
847
+ payload: {
848
+ payloadType: PayloadType.ContractCall,
849
+ contractAddress: options.contractAddress,
850
+ contractName: options.contractName,
851
+ functionName: options.functionName,
852
+ functionArgs: options.functionArgs
853
+ }
854
+ };
855
+ if (options.publicKeys) {
856
+ tx._multisig = { publicKeys: options.publicKeys };
857
+ }
858
+ return tx;
859
+ }
860
+ function buildContractDeploy(options) {
861
+ const { version, chainId } = resolveVersionAndChainId(options.chain);
862
+ const fee = intToBigInt(options.fee);
863
+ const nonce = intToBigInt(options.nonce);
864
+ const spendingCondition = resolveSpendingCondition(options, nonce, fee);
865
+ const useVersioned = options.clarityVersion !== undefined;
866
+ const tx = {
867
+ version,
868
+ chainId,
869
+ auth: resolveAuth(spendingCondition, options.sponsored),
870
+ anchorMode: AnchorMode.Any,
871
+ postConditionMode: resolvePcMode(options.postConditionMode),
872
+ postConditions: convertPostConditions(options.postConditions),
873
+ payload: {
874
+ payloadType: useVersioned ? PayloadType.VersionedSmartContract : PayloadType.SmartContract,
875
+ clarityVersion: options.clarityVersion,
876
+ contractName: options.contractName,
877
+ codeBody: options.codeBody
878
+ }
879
+ };
880
+ if (options.publicKeys) {
881
+ tx._multisig = { publicKeys: options.publicKeys };
882
+ }
883
+ return tx;
884
+ }
650
885
 
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 };
886
+ 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, sigHashPreSign, sigHashPostSign, nextSignature, isNonSequential, makeMultiSigAddress, createMultiSigSpendingCondition, replayMultiSigSigHash, signMultiSig, signMultiSigWithAccount, finalizeMultiSig, combineMultiSigSignatures, signBegin, signTransaction, signTransactionWithAccount, getTransactionId, getOriginSigHash, signSponsor, signSponsorWithAccount, buildTokenTransfer, buildContractCall, buildContractDeploy };
652
887
 
653
- //# debugId=8A5B8348EC23E0AD64756E2164756E21
654
- //# sourceMappingURL=stacks-xtz0n62y.js.map
888
+ //# debugId=0F908FC81F62163A64756E2164756E21
889
+ //# sourceMappingURL=stacks-vyb9rx8q.js.map