@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.
- package/README.md +21 -2
- package/dist/shared/{stacks-6gavarmy.js → stacks-1m3m1agc.js} +2 -2
- package/dist/shared/{stacks-db3kwavg.cjs → stacks-37kz5t9f.cjs} +4 -6
- package/dist/shared/{stacks-db3kwavg.cjs.map → stacks-37kz5t9f.cjs.map} +3 -3
- package/dist/shared/{stacks-e3nwm1dz.js → stacks-gyp5ax89.js} +3 -3
- package/dist/shared/{stacks-7bqkf3b0.js → stacks-mbt36bzt.js} +3 -3
- package/dist/shared/{stacks-ga026yxz.js → stacks-qex691bh.js} +11 -4
- package/dist/shared/stacks-qex691bh.js.map +11 -0
- package/dist/shared/{stacks-n4d8j8q3.js → stacks-v03zef3g.js} +5 -7
- package/dist/shared/{stacks-n4d8j8q3.js.map → stacks-v03zef3g.js.map} +3 -3
- package/dist/shared/{stacks-ggdz96r1.cjs → stacks-wk8yp13j.cjs} +10 -3
- package/dist/shared/stacks-wk8yp13j.cjs.map +11 -0
- package/dist/src/actions/index.js +5 -5
- package/dist/src/bitcoin/index.js +1 -1
- package/dist/src/bns/index.js +3 -3
- package/dist/src/index.cjs +2 -1
- package/dist/src/index.cjs.map +2 -2
- package/dist/src/index.d.cts +5 -1
- package/dist/src/index.d.ts +5 -1
- package/dist/src/index.js +7 -5
- package/dist/src/index.js.map +2 -2
- package/dist/src/pox/index.js +3 -3
- package/dist/src/pox5/index.js +4 -4
- package/dist/src/sbtc/index.js +3 -3
- package/dist/src/stackingdao/index.js +3 -3
- package/dist/src/tools/index.cjs +11 -6
- package/dist/src/tools/index.cjs.map +5 -5
- package/dist/src/tools/index.js +11 -6
- package/dist/src/tools/index.js.map +5 -5
- package/package.json +1 -1
- package/dist/shared/stacks-ga026yxz.js.map +0 -11
- package/dist/shared/stacks-ggdz96r1.cjs.map +0 -11
- /package/dist/shared/{stacks-6gavarmy.js.map → stacks-1m3m1agc.js.map} +0 -0
- /package/dist/shared/{stacks-e3nwm1dz.js.map → stacks-gyp5ax89.js.map} +0 -0
- /package/dist/shared/{stacks-7bqkf3b0.js.map → stacks-mbt36bzt.js.map} +0 -0
package/dist/src/tools/index.js
CHANGED
|
@@ -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
|
|
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
|
|
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=
|
|
3826
|
+
//# debugId=9F434A47DB8B89AF64756E2164756E21
|
|
3822
3827
|
//# sourceMappingURL=index.js.map
|