@secondlayer/stacks 2.9.0 → 2.10.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 (65) hide show
  1. package/dist/shared/{stacks-1qmx9kt8.js → stacks-0ek3cyt8.js} +3 -3
  2. package/dist/shared/{stacks-53bjdb6p.js → stacks-2dhf79w5.js} +4 -4
  3. package/dist/shared/{stacks-z1j5d6fd.js → stacks-4t2vmp4y.js} +3 -3
  4. package/dist/shared/{stacks-nqae5amn.cjs → stacks-5nskdw7w.cjs} +19 -2
  5. package/dist/shared/stacks-5nskdw7w.cjs.map +10 -0
  6. package/dist/shared/{stacks-8mj5jw77.js → stacks-99ghanwx.js} +10 -4
  7. package/dist/shared/{stacks-8mj5jw77.js.map → stacks-99ghanwx.js.map} +3 -3
  8. package/dist/shared/{stacks-ttbq8emk.js → stacks-9t68zmpn.js} +2 -2
  9. package/dist/shared/{stacks-wqgepfab.js → stacks-e60vrr34.js} +20 -3
  10. package/dist/shared/stacks-e60vrr34.js.map +10 -0
  11. package/dist/shared/{stacks-4trgpb5a.js → stacks-vf0ekgwb.js} +42 -5
  12. package/dist/shared/stacks-vf0ekgwb.js.map +15 -0
  13. package/dist/shared/{stacks-ertyhttt.cjs → stacks-wamwv8q8.cjs} +41 -4
  14. package/dist/shared/stacks-wamwv8q8.cjs.map +15 -0
  15. package/dist/shared/{stacks-vdfag81a.cjs → stacks-xw0j252s.cjs} +8 -2
  16. package/dist/shared/{stacks-vdfag81a.cjs.map → stacks-xw0j252s.cjs.map} +3 -3
  17. package/dist/src/actions/index.d.cts +32 -2
  18. package/dist/src/actions/index.d.ts +32 -2
  19. package/dist/src/actions/index.js +7 -7
  20. package/dist/src/bitcoin/index.cjs +42 -20
  21. package/dist/src/bitcoin/index.cjs.map +5 -5
  22. package/dist/src/bitcoin/index.d.cts +15 -6
  23. package/dist/src/bitcoin/index.d.ts +15 -6
  24. package/dist/src/bitcoin/index.js +42 -20
  25. package/dist/src/bitcoin/index.js.map +5 -5
  26. package/dist/src/bns/index.cjs +4 -16
  27. package/dist/src/bns/index.cjs.map +3 -3
  28. package/dist/src/bns/index.js +10 -21
  29. package/dist/src/bns/index.js.map +3 -3
  30. package/dist/src/index.d.cts +32 -2
  31. package/dist/src/index.d.ts +32 -2
  32. package/dist/src/index.js +6 -6
  33. package/dist/src/postconditions/index.d.cts +14 -2
  34. package/dist/src/postconditions/index.d.ts +14 -2
  35. package/dist/src/pox/index.cjs +2 -6
  36. package/dist/src/pox/index.cjs.map +3 -3
  37. package/dist/src/pox/index.js +8 -11
  38. package/dist/src/pox/index.js.map +3 -3
  39. package/dist/src/sbtc/index.cjs +2 -6
  40. package/dist/src/sbtc/index.cjs.map +3 -3
  41. package/dist/src/sbtc/index.js +8 -11
  42. package/dist/src/sbtc/index.js.map +3 -3
  43. package/dist/src/stackingdao/index.js +4 -4
  44. package/dist/src/tools/index.cjs +45 -7
  45. package/dist/src/tools/index.cjs.map +7 -7
  46. package/dist/src/tools/index.js +45 -7
  47. package/dist/src/tools/index.js.map +7 -7
  48. package/dist/src/transactions/index.cjs +2 -1
  49. package/dist/src/transactions/index.cjs.map +1 -1
  50. package/dist/src/transactions/index.d.cts +35 -3
  51. package/dist/src/transactions/index.d.ts +35 -3
  52. package/dist/src/transactions/index.js +5 -3
  53. package/dist/src/transactions/index.js.map +1 -1
  54. package/dist/src/x402/index.d.cts +19 -1
  55. package/dist/src/x402/index.d.ts +19 -1
  56. package/dist/src/x402/index.js +4 -4
  57. package/package.json +4 -2
  58. package/dist/shared/stacks-4trgpb5a.js.map +0 -15
  59. package/dist/shared/stacks-ertyhttt.cjs.map +0 -15
  60. package/dist/shared/stacks-nqae5amn.cjs.map +0 -10
  61. package/dist/shared/stacks-wqgepfab.js.map +0 -10
  62. /package/dist/shared/{stacks-1qmx9kt8.js.map → stacks-0ek3cyt8.js.map} +0 -0
  63. /package/dist/shared/{stacks-53bjdb6p.js.map → stacks-2dhf79w5.js.map} +0 -0
  64. /package/dist/shared/{stacks-z1j5d6fd.js.map → stacks-4t2vmp4y.js.map} +0 -0
  65. /package/dist/shared/{stacks-ttbq8emk.js.map → stacks-9t68zmpn.js.map} +0 -0
@@ -399,6 +399,11 @@ var NonFungibleConditionCode = {
399
399
  Sends: 16,
400
400
  DoesNotSend: 17
401
401
  };
402
+ var PoxConditionCode = {
403
+ WillNotPerform: 48,
404
+ MayPerform: 49,
405
+ WillPerform: 50
406
+ };
402
407
  var PostConditionPrincipalId = {
403
408
  Origin: 1,
404
409
  Standard: 2,
@@ -407,7 +412,9 @@ var PostConditionPrincipalId = {
407
412
  var AssetType = {
408
413
  STX: 0,
409
414
  Fungible: 1,
410
- NonFungible: 2
415
+ NonFungible: 2,
416
+ Staking: 3,
417
+ Pox: 4
411
418
  };
412
419
  var RECOVERABLE_ECDSA_SIG_LENGTH_BYTES = 65;
413
420
  var MEMO_MAX_LENGTH_BYTES = 34;
@@ -504,6 +511,17 @@ function serializePostCondition(pc) {
504
511
  parts.push(serializeCVBytes(pc.assetId));
505
512
  parts.push(writeUInt8(pc.conditionCode));
506
513
  break;
514
+ case "staking":
515
+ parts.push(writeUInt8(AssetType.Staking));
516
+ parts.push(serializePrincipal(pc.principal));
517
+ parts.push(writeUInt8(pc.conditionCode));
518
+ parts.push(intToBytes(pc.amount, 8));
519
+ break;
520
+ case "pox":
521
+ parts.push(writeUInt8(AssetType.Pox));
522
+ parts.push(serializePrincipal(pc.principal));
523
+ parts.push(writeUInt8(pc.conditionCode));
524
+ break;
507
525
  }
508
526
  return concatBytes(...parts);
509
527
  }
@@ -1234,8 +1252,26 @@ function convertPostCondition(pc) {
1234
1252
  assetId: pc.assetId
1235
1253
  };
1236
1254
  }
1255
+ case "staking-postcondition":
1256
+ return {
1257
+ type: "staking",
1258
+ principal: resolvePrincipal(pc.address),
1259
+ conditionCode: FUNGIBLE_CODE_MAP[pc.condition],
1260
+ amount: intToBigInt(pc.amount)
1261
+ };
1262
+ case "pox-postcondition":
1263
+ return {
1264
+ type: "pox",
1265
+ principal: resolvePrincipal(pc.address),
1266
+ conditionCode: POX_CODE_MAP[pc.condition]
1267
+ };
1237
1268
  }
1238
1269
  }
1270
+ var POX_CODE_MAP = {
1271
+ "will-not-perform": PoxConditionCode.WillNotPerform,
1272
+ "may-perform": PoxConditionCode.MayPerform,
1273
+ "will-perform": PoxConditionCode.WillPerform
1274
+ };
1239
1275
  function resolveSpendingCondition(opts, nonce, fee) {
1240
1276
  if (opts.publicKeys) {
1241
1277
  return createMultiSigSpendingCondition(opts.publicKeys, opts.signaturesRequired, nonce, fee, opts.hashMode);
@@ -1538,6 +1574,12 @@ function getContract(params) {
1538
1574
  });
1539
1575
  return { read, call, maps };
1540
1576
  }
1577
+ function resolveNetworkContract(client, contracts) {
1578
+ if (!client.chain) {
1579
+ throw new Error("Client must have a chain configured");
1580
+ }
1581
+ return contracts[client.chain.network];
1582
+ }
1541
1583
  function buildFunctionArgs(fn, args) {
1542
1584
  return fn.args.map((arg) => {
1543
1585
  const camelKey = toCamelCase(arg.name);
@@ -2058,11 +2100,7 @@ function validateFQN(fqn) {
2058
2100
 
2059
2101
  // src/bns/actions.ts
2060
2102
  function getBnsContract(client) {
2061
- if (!client.chain) {
2062
- throw new Error("Client must have a chain configured");
2063
- }
2064
- const network = client.chain.network;
2065
- const contract = network === "mainnet" ? BNS_CONTRACTS.mainnet : BNS_CONTRACTS.testnet;
2103
+ const contract = resolveNetworkContract(client, BNS_CONTRACTS);
2066
2104
  return getContract({
2067
2105
  client,
2068
2106
  address: contract.address,
@@ -2719,5 +2757,5 @@ export {
2719
2757
  bnsResolve
2720
2758
  };
2721
2759
 
2722
- //# debugId=0D764C03DAFF717D64756E2164756E21
2760
+ //# debugId=98CD0F025D02FDCF64756E2164756E21
2723
2761
  //# sourceMappingURL=index.js.map