@secondlayer/stacks 5.1.0 → 5.1.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 (35) hide show
  1. package/README.md +21 -2
  2. package/dist/shared/{stacks-6gavarmy.js → stacks-1m3m1agc.js} +2 -2
  3. package/dist/shared/{stacks-db3kwavg.cjs → stacks-37kz5t9f.cjs} +4 -6
  4. package/dist/shared/{stacks-db3kwavg.cjs.map → stacks-37kz5t9f.cjs.map} +3 -3
  5. package/dist/shared/{stacks-e3nwm1dz.js → stacks-gyp5ax89.js} +3 -3
  6. package/dist/shared/{stacks-7bqkf3b0.js → stacks-mbt36bzt.js} +3 -3
  7. package/dist/shared/{stacks-ga026yxz.js → stacks-qex691bh.js} +11 -4
  8. package/dist/shared/stacks-qex691bh.js.map +11 -0
  9. package/dist/shared/{stacks-n4d8j8q3.js → stacks-v03zef3g.js} +5 -7
  10. package/dist/shared/{stacks-n4d8j8q3.js.map → stacks-v03zef3g.js.map} +3 -3
  11. package/dist/shared/{stacks-ggdz96r1.cjs → stacks-wk8yp13j.cjs} +10 -3
  12. package/dist/shared/stacks-wk8yp13j.cjs.map +11 -0
  13. package/dist/src/actions/index.js +5 -5
  14. package/dist/src/bitcoin/index.js +1 -1
  15. package/dist/src/bns/index.js +3 -3
  16. package/dist/src/index.cjs +2 -1
  17. package/dist/src/index.cjs.map +2 -2
  18. package/dist/src/index.d.cts +5 -1
  19. package/dist/src/index.d.ts +5 -1
  20. package/dist/src/index.js +7 -5
  21. package/dist/src/index.js.map +2 -2
  22. package/dist/src/pox/index.js +3 -3
  23. package/dist/src/pox5/index.js +4 -4
  24. package/dist/src/sbtc/index.js +3 -3
  25. package/dist/src/stackingdao/index.js +3 -3
  26. package/dist/src/tools/index.cjs +11 -6
  27. package/dist/src/tools/index.cjs.map +5 -5
  28. package/dist/src/tools/index.js +11 -6
  29. package/dist/src/tools/index.js.map +5 -5
  30. package/package.json +1 -1
  31. package/dist/shared/stacks-ga026yxz.js.map +0 -11
  32. package/dist/shared/stacks-ggdz96r1.cjs.map +0 -11
  33. /package/dist/shared/{stacks-6gavarmy.js.map → stacks-1m3m1agc.js.map} +0 -0
  34. /package/dist/shared/{stacks-e3nwm1dz.js.map → stacks-gyp5ax89.js.map} +0 -0
  35. /package/dist/shared/{stacks-7bqkf3b0.js.map → stacks-mbt36bzt.js.map} +0 -0
@@ -47,6 +47,10 @@ class MalformedResponseError extends BaseError {
47
47
  name = "MalformedResponseError";
48
48
  }
49
49
 
50
+ class ReadContractError extends BaseError {
51
+ name = "ReadContractError";
52
+ }
53
+
50
54
  // src/utils/c32.ts
51
55
  import { sha256 } from "@noble/hashes/sha2.js";
52
56
 
@@ -1390,9 +1394,12 @@ async function readContract(client, params) {
1390
1394
  }
1391
1395
  });
1392
1396
  if (data.okay) {
1397
+ if (typeof data.result !== "string") {
1398
+ throw new MalformedResponseError(`readContract: /v2/contracts/call-read response is missing "result"`);
1399
+ }
1393
1400
  return deserializeCVBytes(data.result);
1394
1401
  }
1395
- throw new Error(data.cause ?? "Read-only call failed");
1402
+ throw new ReadContractError(data.cause ?? "Read-only call failed");
1396
1403
  }
1397
1404
 
1398
1405
  // src/actions/wallet/utils.ts
@@ -2248,12 +2255,10 @@ async function getMapEntry(client, params) {
2248
2255
 
2249
2256
  // src/actions/public/getNonce.ts
2250
2257
  async function getNonce(client, params) {
2251
- const data = await client.request(`/v2/accounts/${params.address}`, {
2252
- method: "GET"
2253
- });
2258
+ const data = await client.request(`/v2/accounts/${encodeURIComponent(params.address)}`, { method: "GET" });
2254
2259
  const nonce = data?.nonce;
2255
2260
  if (typeof nonce !== "number" && typeof nonce !== "string") {
2256
- throw new Error(`getNonce: unexpected /v2/accounts response for ${params.address} (missing numeric nonce)`);
2261
+ throw new MalformedResponseError(`getNonce: /v2/accounts/${params.address} response is missing "nonce"`);
2257
2262
  }
2258
2263
  return BigInt(nonce);
2259
2264
  }
@@ -3818,5 +3823,5 @@ export {
3818
3823
  bnsResolve
3819
3824
  };
3820
3825
 
3821
- //# debugId=806015FDE8C2D90F64756E2164756E21
3826
+ //# debugId=9F434A47DB8B89AF64756E2164756E21
3822
3827
  //# sourceMappingURL=index.js.map