@secondlayer/stacks 6.5.4 → 6.6.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 (103) hide show
  1. package/dist/shared/{stacks-esm-17adzt3x.js → stacks-esm-0t9vwtwh.js} +9 -9
  2. package/dist/shared/{stacks-esm-s3natb0x.js → stacks-esm-1f46cr7b.js} +8 -8
  3. package/dist/shared/{stacks-esm-s3natb0x.js.map → stacks-esm-1f46cr7b.js.map} +3 -3
  4. package/dist/shared/{stacks-esm-2cac1jn9.js → stacks-esm-2z40q8gs.js} +4 -4
  5. package/dist/shared/{stacks-esm-ev07d2aw.js → stacks-esm-4rjjsz3p.js} +3 -3
  6. package/dist/shared/{stacks-esm-5eq7meyt.js → stacks-esm-8p8xy3dz.js} +16 -4
  7. package/dist/shared/stacks-esm-8p8xy3dz.js.map +12 -0
  8. package/dist/shared/{stacks-esm-h82jj95c.js → stacks-esm-9ptct1c4.js} +3 -3
  9. package/dist/shared/{stacks-esm-qasbsv66.js → stacks-esm-a7apmjbk.js} +2 -2
  10. package/dist/shared/{stacks-esm-1nfzrepv.js → stacks-esm-brtqryjb.js} +4 -4
  11. package/dist/shared/{stacks-esm-pc20c78w.js → stacks-esm-e63kx7dq.js} +3 -3
  12. package/dist/shared/{stacks-esm-tsb8h0yr.js → stacks-esm-eep45e8s.js} +2 -2
  13. package/dist/shared/{stacks-esm-wnxhfx93.js → stacks-esm-fmq4j4ez.js} +2 -2
  14. package/dist/shared/{stacks-esm-7tc40d6t.js → stacks-esm-h60faj2n.js} +2 -2
  15. package/dist/shared/{stacks-esm-6zfssx7v.js → stacks-esm-hcaycch3.js} +3 -3
  16. package/dist/shared/{stacks-esm-cs4419br.js → stacks-esm-jwgtksgq.js} +32 -15
  17. package/dist/shared/stacks-esm-jwgtksgq.js.map +15 -0
  18. package/dist/shared/{stacks-esm-jm688fhe.js → stacks-esm-m8ph0bvw.js} +19 -11
  19. package/dist/shared/{stacks-esm-jm688fhe.js.map → stacks-esm-m8ph0bvw.js.map} +4 -4
  20. package/dist/shared/{stacks-esm-hm7kb2cp.js → stacks-esm-mqhwqhq4.js} +4 -4
  21. package/dist/shared/{stacks-esm-tfechw5c.js → stacks-esm-nqkwt2z7.js} +2 -2
  22. package/dist/shared/{stacks-esm-mmvrwreq.js → stacks-esm-wjg9aer9.js} +4 -4
  23. package/dist/shared/{stacks-esm-scq242d9.js → stacks-esm-zsdw7fq3.js} +3 -3
  24. package/dist/src/accounts/index.cjs +14 -2
  25. package/dist/src/accounts/index.cjs.map +3 -3
  26. package/dist/src/accounts/index.js +2 -2
  27. package/dist/src/actions/index.cjs +52 -16
  28. package/dist/src/actions/index.cjs.map +8 -8
  29. package/dist/src/actions/index.d.cts +2 -0
  30. package/dist/src/actions/index.d.ts +2 -0
  31. package/dist/src/actions/index.js +12 -12
  32. package/dist/src/bitcoin/index.cjs +41 -13
  33. package/dist/src/bitcoin/index.cjs.map +5 -5
  34. package/dist/src/bitcoin/index.js +10 -10
  35. package/dist/src/bns/index.cjs +52 -16
  36. package/dist/src/bns/index.cjs.map +8 -8
  37. package/dist/src/bns/index.js +12 -12
  38. package/dist/src/clarity/index.cjs +41 -13
  39. package/dist/src/clarity/index.cjs.map +5 -5
  40. package/dist/src/clarity/index.js +6 -6
  41. package/dist/src/connect/index.cjs +30 -7
  42. package/dist/src/connect/index.cjs.map +5 -5
  43. package/dist/src/connect/index.js +30 -7
  44. package/dist/src/connect/index.js.map +5 -5
  45. package/dist/src/connect/walletconnect/index.cjs +3 -1
  46. package/dist/src/connect/walletconnect/index.cjs.map +3 -3
  47. package/dist/src/connect/walletconnect/index.js +3 -1
  48. package/dist/src/connect/walletconnect/index.js.map +3 -3
  49. package/dist/src/filters/index.cjs +14 -2
  50. package/dist/src/filters/index.cjs.map +3 -3
  51. package/dist/src/filters/index.js +3 -3
  52. package/dist/src/index.cjs +75 -20
  53. package/dist/src/index.cjs.map +9 -9
  54. package/dist/src/index.d.cts +8 -0
  55. package/dist/src/index.d.ts +8 -0
  56. package/dist/src/index.js +40 -14
  57. package/dist/src/index.js.map +4 -4
  58. package/dist/src/postconditions/index.cjs +41 -13
  59. package/dist/src/postconditions/index.cjs.map +5 -5
  60. package/dist/src/postconditions/index.js +5 -5
  61. package/dist/src/pox/index.cjs +52 -16
  62. package/dist/src/pox/index.cjs.map +8 -8
  63. package/dist/src/pox/index.js +12 -12
  64. package/dist/src/pox5/index.cjs +52 -16
  65. package/dist/src/pox5/index.cjs.map +8 -8
  66. package/dist/src/pox5/index.js +14 -14
  67. package/dist/src/sbtc/index.cjs +52 -16
  68. package/dist/src/sbtc/index.cjs.map +8 -8
  69. package/dist/src/sbtc/index.js +12 -12
  70. package/dist/src/simnet/index.cjs +44 -16
  71. package/dist/src/simnet/index.cjs.map +5 -5
  72. package/dist/src/simnet/index.js +44 -16
  73. package/dist/src/simnet/index.js.map +5 -5
  74. package/dist/src/stackingdao/index.cjs +52 -16
  75. package/dist/src/stackingdao/index.cjs.map +8 -8
  76. package/dist/src/stackingdao/index.js +10 -10
  77. package/dist/src/transactions/index.cjs +44 -16
  78. package/dist/src/transactions/index.cjs.map +5 -5
  79. package/dist/src/transactions/index.js +5 -5
  80. package/dist/src/utils/index.cjs +20 -3
  81. package/dist/src/utils/index.cjs.map +4 -4
  82. package/dist/src/utils/index.d.cts +8 -1
  83. package/dist/src/utils/index.d.ts +8 -1
  84. package/dist/src/utils/index.js +9 -4
  85. package/dist/src/utils/index.js.map +3 -3
  86. package/package.json +2 -2
  87. package/dist/shared/stacks-esm-5eq7meyt.js.map +0 -12
  88. package/dist/shared/stacks-esm-cs4419br.js.map +0 -15
  89. /package/dist/shared/{stacks-esm-17adzt3x.js.map → stacks-esm-0t9vwtwh.js.map} +0 -0
  90. /package/dist/shared/{stacks-esm-2cac1jn9.js.map → stacks-esm-2z40q8gs.js.map} +0 -0
  91. /package/dist/shared/{stacks-esm-ev07d2aw.js.map → stacks-esm-4rjjsz3p.js.map} +0 -0
  92. /package/dist/shared/{stacks-esm-h82jj95c.js.map → stacks-esm-9ptct1c4.js.map} +0 -0
  93. /package/dist/shared/{stacks-esm-qasbsv66.js.map → stacks-esm-a7apmjbk.js.map} +0 -0
  94. /package/dist/shared/{stacks-esm-1nfzrepv.js.map → stacks-esm-brtqryjb.js.map} +0 -0
  95. /package/dist/shared/{stacks-esm-pc20c78w.js.map → stacks-esm-e63kx7dq.js.map} +0 -0
  96. /package/dist/shared/{stacks-esm-tsb8h0yr.js.map → stacks-esm-eep45e8s.js.map} +0 -0
  97. /package/dist/shared/{stacks-esm-wnxhfx93.js.map → stacks-esm-fmq4j4ez.js.map} +0 -0
  98. /package/dist/shared/{stacks-esm-7tc40d6t.js.map → stacks-esm-h60faj2n.js.map} +0 -0
  99. /package/dist/shared/{stacks-esm-6zfssx7v.js.map → stacks-esm-hcaycch3.js.map} +0 -0
  100. /package/dist/shared/{stacks-esm-hm7kb2cp.js.map → stacks-esm-mqhwqhq4.js.map} +0 -0
  101. /package/dist/shared/{stacks-esm-tfechw5c.js.map → stacks-esm-nqkwt2z7.js.map} +0 -0
  102. /package/dist/shared/{stacks-esm-mmvrwreq.js.map → stacks-esm-wjg9aer9.js.map} +0 -0
  103. /package/dist/shared/{stacks-esm-scq242d9.js.map → stacks-esm-zsdw7fq3.js.map} +0 -0
@@ -1031,6 +1031,8 @@ declare function transferStx(client: Client, params: TransferStxParams): Promise
1031
1031
  type CallContractParams = {
1032
1032
  contract: string
1033
1033
  functionName: string
1034
+ args?: ClarityValue[]
1035
+ /** @deprecated Use `args` (same as readContract). */
1034
1036
  functionArgs?: ClarityValue[]
1035
1037
  fee?: FeeParam
1036
1038
  nonce?: IntegerType
@@ -1031,6 +1031,8 @@ declare function transferStx(client: Client, params: TransferStxParams): Promise
1031
1031
  type CallContractParams = {
1032
1032
  contract: string
1033
1033
  functionName: string
1034
+ args?: ClarityValue[]
1035
+ /** @deprecated Use `args` (same as readContract). */
1034
1036
  functionArgs?: ClarityValue[]
1035
1037
  fee?: FeeParam
1036
1038
  nonce?: IntegerType
@@ -1,9 +1,9 @@
1
- import"../../shared/stacks-esm-5eq7meyt.js";
2
- import"../../shared/stacks-esm-cs4419br.js";
3
- import"../../shared/stacks-esm-7tc40d6t.js";
4
- import"../../shared/stacks-esm-2cac1jn9.js";
5
- import"../../shared/stacks-esm-mmvrwreq.js";
6
- import"../../shared/stacks-esm-scq242d9.js";
1
+ import"../../shared/stacks-esm-8p8xy3dz.js";
2
+ import"../../shared/stacks-esm-jwgtksgq.js";
3
+ import"../../shared/stacks-esm-h60faj2n.js";
4
+ import"../../shared/stacks-esm-2z40q8gs.js";
5
+ import"../../shared/stacks-esm-wjg9aer9.js";
6
+ import"../../shared/stacks-esm-zsdw7fq3.js";
7
7
  import {
8
8
  getAccountHistory2,
9
9
  getAccountInfo2,
@@ -20,19 +20,19 @@ import {
20
20
  signTransactionAction2,
21
21
  sponsorTransaction2,
22
22
  transferStx2
23
- } from "../../shared/stacks-esm-17adzt3x.js";
24
- import"../../shared/stacks-esm-ev07d2aw.js";
23
+ } from "../../shared/stacks-esm-0t9vwtwh.js";
24
+ import"../../shared/stacks-esm-4rjjsz3p.js";
25
25
  import {
26
26
  getContract2,
27
27
  buildFunctionArgs2,
28
28
  isResponseOutput2,
29
29
  ContractResponseError2
30
- } from "../../shared/stacks-esm-s3natb0x.js";
30
+ } from "../../shared/stacks-esm-1f46cr7b.js";
31
31
  import {
32
32
  getBalance2,
33
33
  getDataVar2,
34
34
  multicall2
35
- } from "../../shared/stacks-esm-1nfzrepv.js";
35
+ } from "../../shared/stacks-esm-brtqryjb.js";
36
36
  import {
37
37
  estimateFee2,
38
38
  getBlockHeight2,
@@ -49,10 +49,10 @@ import {
49
49
  isNoEstimateAvailable2,
50
50
  resolveFee2,
51
51
  callContract2
52
- } from "../../shared/stacks-esm-jm688fhe.js";
52
+ } from "../../shared/stacks-esm-m8ph0bvw.js";
53
53
  import {
54
54
  readContract2
55
- } from "../../shared/stacks-esm-hm7kb2cp.js";
55
+ } from "../../shared/stacks-esm-mqhwqhq4.js";
56
56
  import {
57
57
  watchBlocks2,
58
58
  watchMempool2,
@@ -198,6 +198,8 @@ function bytesToHex(bytes) {
198
198
  }
199
199
  function hexToBytes(hex) {
200
200
  let h = without0x(hex);
201
+ if (!/^[0-9a-fA-F]*$/.test(h))
202
+ throw new Error("Invalid byte sequence");
201
203
  if (h.length % 2)
202
204
  h = `0${h}`;
203
205
  const array = new Uint8Array(h.length / 2);
@@ -229,6 +231,13 @@ function asciiToBytes(str) {
229
231
  }
230
232
  return bytes;
231
233
  }
234
+ function isAscii(str) {
235
+ for (let i = 0;i < str.length; i++) {
236
+ if (str.charCodeAt(i) > 127)
237
+ return false;
238
+ }
239
+ return true;
240
+ }
232
241
  function bytesToAscii(bytes) {
233
242
  return String.fromCharCode(...bytes);
234
243
  }
@@ -247,8 +256,11 @@ function concatBytes(...arrays) {
247
256
  function intToBigInt(value) {
248
257
  if (typeof value === "bigint")
249
258
  return value;
250
- if (typeof value === "string")
259
+ if (typeof value === "string") {
260
+ if (value.trim() === "")
261
+ throw new SyntaxError("Cannot convert an empty string to an integer");
251
262
  return BigInt(value);
263
+ }
252
264
  if (typeof value === "number") {
253
265
  if (!Number.isInteger(value))
254
266
  throw new RangeError("Values of type 'number' must be an integer.");
@@ -1162,6 +1174,10 @@ function deserializeCV(input) {
1162
1174
  // src/clarity/serialize.ts
1163
1175
  var CLARITY_INT_SIZE = 128n;
1164
1176
  var CLARITY_INT_BYTE_SIZE = 16;
1177
+ var MAX_U1282 = (1n << 128n) - 1n;
1178
+ var MAX_I1282 = (1n << 127n) - 1n;
1179
+ var MIN_I1282 = -(1n << 127n);
1180
+ var MAX_STRING_BYTES = 1048576;
1165
1181
  function typeIdByte(type) {
1166
1182
  return ClarityWireType[type];
1167
1183
  }
@@ -1183,11 +1199,17 @@ function serializeCVBytes(value) {
1183
1199
  case "false":
1184
1200
  return new Uint8Array([typeIdByte(value.type)]);
1185
1201
  case "int": {
1186
- const bytes = bigIntToBytes(toTwos(BigInt(value.value), CLARITY_INT_SIZE), CLARITY_INT_BYTE_SIZE);
1202
+ const n = BigInt(value.value);
1203
+ if (n > MAX_I1282 || n < MIN_I1282)
1204
+ throw new RangeError(`Int is outside i128: ${n}`);
1205
+ const bytes = bigIntToBytes(toTwos(n, CLARITY_INT_SIZE), CLARITY_INT_BYTE_SIZE);
1187
1206
  return withTypeId(value.type, bytes);
1188
1207
  }
1189
1208
  case "uint": {
1190
- const bytes = bigIntToBytes(BigInt(value.value), CLARITY_INT_BYTE_SIZE);
1209
+ const n = BigInt(value.value);
1210
+ if (n < 0n || n > MAX_U1282)
1211
+ throw new RangeError(`UInt is outside u128: ${n}`);
1212
+ const bytes = bigIntToBytes(n, CLARITY_INT_BYTE_SIZE);
1191
1213
  return withTypeId(value.type, bytes);
1192
1214
  }
1193
1215
  case "buffer": {
@@ -1226,6 +1248,8 @@ function serializeCVBytes(value) {
1226
1248
  return withTypeId(value.type, concatBytes(...parts));
1227
1249
  }
1228
1250
  case "ascii": {
1251
+ if (!isAscii(value.value))
1252
+ throw new Error("string-ascii holds only ASCII characters");
1229
1253
  const strBytes = asciiToBytes(value.value);
1230
1254
  return withTypeId(value.type, concatBytes(writeUInt32BE(strBytes.length), strBytes));
1231
1255
  }
@@ -1242,9 +1266,9 @@ function serializeCV(value) {
1242
1266
  }
1243
1267
 
1244
1268
  // src/clarity/values.ts
1245
- var MAX_U1282 = BigInt("0xffffffffffffffffffffffffffffffff");
1246
- var MIN_I1282 = BigInt("-170141183460469231731687303715884105728");
1247
- var MAX_I1282 = BigInt("0x7fffffffffffffffffffffffffffffff");
1269
+ var MAX_U1283 = BigInt("0xffffffffffffffffffffffffffffffff");
1270
+ var MIN_I1283 = BigInt("-170141183460469231731687303715884105728");
1271
+ var MAX_I1283 = BigInt("0x7fffffffffffffffffffffffffffffff");
1248
1272
  function intCV(value) {
1249
1273
  let v = value;
1250
1274
  if (typeof v === "string" && v.toLowerCase().startsWith("0x")) {
@@ -1253,18 +1277,18 @@ function intCV(value) {
1253
1277
  if (v instanceof Uint8Array)
1254
1278
  v = bytesToTwosBigInt(v);
1255
1279
  const n = intToBigInt(v);
1256
- if (n > MAX_I1282)
1257
- throw new RangeError(`Int exceeds max i128: ${MAX_I1282}`);
1258
- if (n < MIN_I1282)
1259
- throw new RangeError(`Int below min i128: ${MIN_I1282}`);
1280
+ if (n > MAX_I1283)
1281
+ throw new RangeError(`Int exceeds max i128: ${MAX_I1283}`);
1282
+ if (n < MIN_I1283)
1283
+ throw new RangeError(`Int below min i128: ${MIN_I1283}`);
1260
1284
  return { type: "int", value: n };
1261
1285
  }
1262
1286
  function uintCV(value) {
1263
1287
  const n = intToBigInt(value);
1264
1288
  if (n < 0n)
1265
1289
  throw new RangeError("Cannot construct unsigned int from negative value");
1266
- if (n > MAX_U1282)
1267
- throw new RangeError(`UInt exceeds max u128: ${MAX_U1282}`);
1290
+ if (n > MAX_U1283)
1291
+ throw new RangeError(`UInt exceeds max u128: ${MAX_U1283}`);
1268
1292
  return { type: "uint", value: n };
1269
1293
  }
1270
1294
  var trueCV = () => ({ type: "true" });
@@ -1313,6 +1337,10 @@ function tupleCV(data) {
1313
1337
  return { type: "tuple", value: data };
1314
1338
  }
1315
1339
  function stringAsciiCV(value) {
1340
+ if (!isAscii(value))
1341
+ throw new Error("string-ascii holds only ASCII characters");
1342
+ if (value.length > MAX_STRING_BYTES)
1343
+ throw new Error(`string-ascii exceeds max size of ${MAX_STRING_BYTES} bytes`);
1316
1344
  return { type: "ascii", value };
1317
1345
  }
1318
1346
  function stringUtf8CV(value) {
@@ -2830,5 +2858,5 @@ async function verifyBitcoinPayment(client, params) {
2830
2858
  return { verified, mined, output, proof };
2831
2859
  }
2832
2860
 
2833
- //# debugId=DBDEF6E2929FBC9164756E2164756E21
2861
+ //# debugId=9005B10F14AEDD7964756E2164756E21
2834
2862
  //# sourceMappingURL=index.cjs.map