@thruputchain/client 0.28.0 → 0.29.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.
- package/README.md +112 -17
- package/dist/{actions-B5-CjpEF.cjs → actions-B2gV8Vzr.cjs} +297 -73
- package/dist/actions-B2gV8Vzr.cjs.map +1 -0
- package/dist/actions-UEYKD22C.js +653 -0
- package/dist/actions-UEYKD22C.js.map +1 -0
- package/dist/actions.cjs +4 -8
- package/dist/actions.d.cts +4 -4
- package/dist/actions.d.ts +4 -4
- package/dist/actions.js +3 -3
- package/dist/{artifact-BM_MVzhL.d.ts → artifact-RIAPVmVX.d.cts} +4 -3
- package/dist/artifact-RIAPVmVX.d.cts.map +1 -0
- package/dist/{artifact-BM_MVzhL.d.cts → artifact-RIAPVmVX.d.ts} +4 -3
- package/dist/artifact-RIAPVmVX.d.ts.map +1 -0
- package/dist/{contract-D77iA2iY.js → contract-BOlNskwd.js} +235 -87
- package/dist/contract-BOlNskwd.js.map +1 -0
- package/dist/{contract-DSu2UPPm.cjs → contract-D_vxUudr.cjs} +281 -109
- package/dist/contract-D_vxUudr.cjs.map +1 -0
- package/dist/contract.cjs +1 -5
- package/dist/contract.d.cts +4 -4
- package/dist/contract.d.ts +4 -4
- package/dist/contract.js +2 -2
- package/dist/contracts.cjs +5 -5
- package/dist/contracts.d.cts +19 -4
- package/dist/contracts.d.cts.map +1 -1
- package/dist/contracts.d.ts +19 -4
- package/dist/contracts.d.ts.map +1 -1
- package/dist/contracts.js +4 -4
- package/dist/decimal-BX7abv5J.cjs +171 -0
- package/dist/decimal-BX7abv5J.cjs.map +1 -0
- package/dist/decimal-CoHOISys.js +124 -0
- package/dist/decimal-CoHOISys.js.map +1 -0
- package/dist/{dev_wallet-CAbOSrak.cjs → dev_wallet-BVChhV6j.cjs} +85 -6
- package/dist/dev_wallet-BVChhV6j.cjs.map +1 -0
- package/dist/{dev_wallet-CU3RpQLm.js → dev_wallet-D9LuPZ-h.js} +84 -5
- package/dist/dev_wallet-D9LuPZ-h.js.map +1 -0
- package/dist/{execution-J5jkXhV1.d.cts → execution-pSt6k620.d.cts} +23 -50
- package/dist/execution-pSt6k620.d.cts.map +1 -0
- package/dist/{execution-XJ0iwFaX.d.ts → execution-uiuFPV0d.d.ts} +23 -50
- package/dist/execution-uiuFPV0d.d.ts.map +1 -0
- package/dist/{hex-DIcaALXL.js → hex-B8D-jBgz.js} +2 -2
- package/dist/{hex-DIcaALXL.js.map → hex-B8D-jBgz.js.map} +1 -1
- package/dist/{hex-DkGpiZ5e.cjs → hex-CSDZ9d6z.cjs} +2 -2
- package/dist/{hex-DkGpiZ5e.cjs.map → hex-CSDZ9d6z.cjs.map} +1 -1
- package/dist/{index-soFVQX9j.d.cts → index-B1efA-Y_.d.ts} +24 -21
- package/dist/index-B1efA-Y_.d.ts.map +1 -0
- package/dist/{index-C3HVRvQd.d.ts → index-BGmH_Sm7.d.cts} +12 -62
- package/dist/index-BGmH_Sm7.d.cts.map +1 -0
- package/dist/{index-Bb01ytjJ.d.ts → index-BZ5j5P5d.d.ts} +11 -9
- package/dist/index-BZ5j5P5d.d.ts.map +1 -0
- package/dist/{index-CedOvhGY.d.cts → index-BfYEEVHm.d.cts} +3 -13
- package/dist/index-BfYEEVHm.d.cts.map +1 -0
- package/dist/{index-CtjWsAXV.d.cts → index-BhOeIyrZ.d.cts} +11 -9
- package/dist/index-BhOeIyrZ.d.cts.map +1 -0
- package/dist/{index-B5KqSHeL.d.cts → index-BsvYcU_Y.d.cts} +2 -2
- package/dist/{index-B5KqSHeL.d.cts.map → index-BsvYcU_Y.d.cts.map} +1 -1
- package/dist/{index-DeS1S0m-.d.ts → index-Btl_jMCT.d.ts} +3 -13
- package/dist/index-Btl_jMCT.d.ts.map +1 -0
- package/dist/{index-CtjZ61tl.d.cts → index-CG-q0j9w.d.ts} +12 -62
- package/dist/index-CG-q0j9w.d.ts.map +1 -0
- package/dist/index-CPtBvHE8.d.ts +145 -0
- package/dist/index-CPtBvHE8.d.ts.map +1 -0
- package/dist/{index-DfmDUk5Y.d.ts → index-DBKsOzCN.d.cts} +24 -21
- package/dist/index-DBKsOzCN.d.cts.map +1 -0
- package/dist/index-Xre-0Jka.d.cts +145 -0
- package/dist/index-Xre-0Jka.d.cts.map +1 -0
- package/dist/index.cjs +39 -68
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +12 -17
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.ts +12 -17
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +27 -38
- package/dist/index.js.map +1 -1
- package/dist/provider.cjs +3 -3
- package/dist/provider.cjs.map +1 -1
- package/dist/provider.d.cts +2 -1
- package/dist/provider.d.ts +2 -1
- package/dist/provider.js +3 -3
- package/dist/provider.js.map +1 -1
- package/dist/{codec-Bxlt1gKO.js → readError-B3Rz7rgs.js} +359 -56
- package/dist/readError-B3Rz7rgs.js.map +1 -0
- package/dist/{codec-BcK8ASsg.cjs → readError-COcEDNoZ.cjs} +363 -96
- package/dist/readError-COcEDNoZ.cjs.map +1 -0
- package/dist/requestAirdrop-DBCOST2B.d.ts +1818 -0
- package/dist/requestAirdrop-DBCOST2B.d.ts.map +1 -0
- package/dist/requestAirdrop-T1eVn3l5.d.cts +1818 -0
- package/dist/requestAirdrop-T1eVn3l5.d.cts.map +1 -0
- package/dist/sendInvocation-185ZJrta.cjs +583 -0
- package/dist/sendInvocation-185ZJrta.cjs.map +1 -0
- package/dist/sendInvocation-DBaNWhr3.js +439 -0
- package/dist/sendInvocation-DBaNWhr3.js.map +1 -0
- package/dist/signed-op.cjs +2 -2
- package/dist/signed-op.d.cts +2 -2
- package/dist/signed-op.d.ts +1 -1
- package/dist/signed-op.js +2 -2
- package/dist/{signedOp-DAucp6xg.cjs → signedOp-CVyeJ5ig.cjs} +3 -3
- package/dist/{signedOp-DAucp6xg.cjs.map → signedOp-CVyeJ5ig.cjs.map} +1 -1
- package/dist/{signedOp-DpmUpH-e.js → signedOp-D6WYZG9j.js} +3 -3
- package/dist/{signedOp-DpmUpH-e.js.map → signedOp-D6WYZG9j.js.map} +1 -1
- package/dist/{signed_op-_lR85dn2.cjs → signed_op-BBsDKOlD.cjs} +4 -4
- package/dist/{signed_op-_lR85dn2.cjs.map → signed_op-BBsDKOlD.cjs.map} +1 -1
- package/dist/{signed_op-D2usgASc.d.cts → signed_op-BvbOHWKK.d.ts} +3 -3
- package/dist/{signed_op-zGq4eBo8.d.ts.map → signed_op-BvbOHWKK.d.ts.map} +1 -1
- package/dist/{signed_op-zGq4eBo8.d.ts → signed_op-DoHFpSH4.d.cts} +3 -3
- package/dist/{signed_op-D2usgASc.d.cts.map → signed_op-DoHFpSH4.d.cts.map} +1 -1
- package/dist/{signed_op-CwN-_CXw.js → signed_op-h9X9-vBL.js} +3 -3
- package/dist/{signed_op-CwN-_CXw.js.map → signed_op-h9X9-vBL.js.map} +1 -1
- package/dist/transport-BhWZxHcz.cjs +528 -0
- package/dist/transport-BhWZxHcz.cjs.map +1 -0
- package/dist/transport-EyDYuibb.js +504 -0
- package/dist/transport-EyDYuibb.js.map +1 -0
- package/dist/transport.cjs +6 -13
- package/dist/transport.d.cts +3 -3
- package/dist/transport.d.ts +3 -3
- package/dist/transport.js +4 -4
- package/dist/types-VYjJcTip.d.cts +161 -0
- package/dist/types-VYjJcTip.d.cts.map +1 -0
- package/dist/types-VYjJcTip.d.ts +161 -0
- package/dist/types-VYjJcTip.d.ts.map +1 -0
- package/dist/{validation-eXATmgO0.js → validation-BLQ64Dfh.js} +3 -3
- package/dist/validation-BLQ64Dfh.js.map +1 -0
- package/dist/{validation-4w-vDGAi.cjs → validation-CZqtmMLJ.cjs} +3 -3
- package/dist/validation-CZqtmMLJ.cjs.map +1 -0
- package/dist/{wallet-BNKgOXrF.js → wallet-NlZiI4-3.js} +161 -77
- package/dist/wallet-NlZiI4-3.js.map +1 -0
- package/dist/{wallet-7R5M_7h4.cjs → wallet-UvyXtxh5.cjs} +161 -77
- package/dist/wallet-UvyXtxh5.cjs.map +1 -0
- package/dist/wallet.cjs +2 -8
- package/dist/wallet.d.cts +4 -3
- package/dist/wallet.d.ts +4 -3
- package/dist/wallet.js +3 -3
- package/package.json +2 -2
- package/dist/actions-B5-CjpEF.cjs.map +0 -1
- package/dist/actions-C1SMLWO5.js +0 -430
- package/dist/actions-C1SMLWO5.js.map +0 -1
- package/dist/artifact-BM_MVzhL.d.cts.map +0 -1
- package/dist/artifact-BM_MVzhL.d.ts.map +0 -1
- package/dist/client-jOZxB8yW.d.cts +0 -798
- package/dist/client-jOZxB8yW.d.cts.map +0 -1
- package/dist/client-jOZxB8yW.d.ts +0 -798
- package/dist/client-jOZxB8yW.d.ts.map +0 -1
- package/dist/codec-BcK8ASsg.cjs.map +0 -1
- package/dist/codec-Bxlt1gKO.js.map +0 -1
- package/dist/contract-D77iA2iY.js.map +0 -1
- package/dist/contract-DSu2UPPm.cjs.map +0 -1
- package/dist/dev_wallet-CAbOSrak.cjs.map +0 -1
- package/dist/dev_wallet-CU3RpQLm.js.map +0 -1
- package/dist/execution-J5jkXhV1.d.cts.map +0 -1
- package/dist/execution-XJ0iwFaX.d.ts.map +0 -1
- package/dist/index-Bb01ytjJ.d.ts.map +0 -1
- package/dist/index-C3HVRvQd.d.ts.map +0 -1
- package/dist/index-CIHK7Ew9.d.cts +0 -303
- package/dist/index-CIHK7Ew9.d.cts.map +0 -1
- package/dist/index-CIHK7Ew9.d.ts +0 -303
- package/dist/index-CIHK7Ew9.d.ts.map +0 -1
- package/dist/index-CedOvhGY.d.cts.map +0 -1
- package/dist/index-CtjWsAXV.d.cts.map +0 -1
- package/dist/index-CtjZ61tl.d.cts.map +0 -1
- package/dist/index-DeS1S0m-.d.ts.map +0 -1
- package/dist/index-DfmDUk5Y.d.ts.map +0 -1
- package/dist/index-soFVQX9j.d.cts.map +0 -1
- package/dist/readError-CCVlmBhj.cjs +0 -624
- package/dist/readError-CCVlmBhj.cjs.map +0 -1
- package/dist/readError-D1dppovI.js +0 -571
- package/dist/readError-D1dppovI.js.map +0 -1
- package/dist/readViews-DbWELMMq.d.cts +0 -609
- package/dist/readViews-DbWELMMq.d.cts.map +0 -1
- package/dist/readViews-nV3jbpYc.d.ts +0 -609
- package/dist/readViews-nV3jbpYc.d.ts.map +0 -1
- package/dist/sendInvocation-Dsr9ij5P.cjs +0 -661
- package/dist/sendInvocation-Dsr9ij5P.cjs.map +0 -1
- package/dist/sendInvocation-tBmf8haQ.js +0 -505
- package/dist/sendInvocation-tBmf8haQ.js.map +0 -1
- package/dist/transport-5FPeNwuv.cjs +0 -279
- package/dist/transport-5FPeNwuv.cjs.map +0 -1
- package/dist/transport-IrhVlS4w.js +0 -261
- package/dist/transport-IrhVlS4w.js.map +0 -1
- package/dist/validation-4w-vDGAi.cjs.map +0 -1
- package/dist/validation-eXATmgO0.js.map +0 -1
- package/dist/wallet-7R5M_7h4.cjs.map +0 -1
- package/dist/wallet-BNKgOXrF.js.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index-DfmDUk5Y.d.ts","names":[],"sources":["../src/wallet/providerClient.ts","../src/wallet/client.ts"],"mappings":";;;;;;;;KA+DY,4BAAA,GAA+B,2BAAA,GACzC,IAAA,CAAK,uBAAA;;UAGU,wBAAA,SAAiC,qBAAqB;EAAA,SAC5D,OAAA,EAAS,eAAA;EAAA,SACT,WAAA;AAAA;;UAIM,wBAAA;EATa;EAW5B,QAAA,GAAW,OAAA,EAAS,wBAAA,YAAoC,OAAA;EARzC;EAUf,IAAA,GAAO,gCAAA;AAAA;;UAIQ,mBAAA,oBAAuC,YAAA;EACtD,KAAA,EAAO,CAAA;EACP,QAAA,EAAU,SAAA;EACV,iBAAA,GAAoB,uBAAA;EACpB,YAAA;AAAA;AAZF;AAAA,UAgBiB,iCAAA;;;;;;EAMf,MAAA,EAAQ,iBAAA;EApBR;EAsBA,QAAA,EAAU,cAAA;EAtBC;EAwBX,OAAA,EAAS,eAAA;EAtBT;EAwBA,WAAA;AAAA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A,iBACE,iBAAA,mBACC,aAAA,EAEjB,OAAA;EAAA,SACW,MAAA,EAAQ,OAAA;EAAA,SACR,OAAA,EAAS,QAAA;EAAA,SACT,QAAA,IACP,UAAA,EAAY,kBAAA,YACF,OAAA;EAAA,SACH,iBAAA;AAAA,IACP,oBAAA,CAAqB,OAAA,IACxB,YAAA,CAAa,OAAA,EAAS,QAAA"}
|
|
@@ -1,624 +0,0 @@
|
|
|
1
|
-
const require_codec = require("./codec-BcK8ASsg.cjs");
|
|
2
|
-
const require_hex = require("./hex-DkGpiZ5e.cjs");
|
|
3
|
-
const require_transactionHash = require("./transactionHash-D5yf4KoL.cjs");
|
|
4
|
-
let _thruputchain_protocol = require("@thruputchain/protocol");
|
|
5
|
-
//#region src/transport/responseError.ts
|
|
6
|
-
/** Malformed JSON-RPC reply after dispatch. Raw data is retained; write outcome is unknown. */
|
|
7
|
-
var RpcResponseError = class extends Error {
|
|
8
|
-
raw;
|
|
9
|
-
constructor(message, raw) {
|
|
10
|
-
super(message);
|
|
11
|
-
this.raw = raw;
|
|
12
|
-
this.name = "RpcResponseError";
|
|
13
|
-
}
|
|
14
|
-
};
|
|
15
|
-
//#endregion
|
|
16
|
-
//#region src/transport/httpBatch.ts
|
|
17
|
-
var HttpBatch = class {
|
|
18
|
-
maxSize;
|
|
19
|
-
waitMs;
|
|
20
|
-
send;
|
|
21
|
-
#queue = /* @__PURE__ */ new Set();
|
|
22
|
-
#timer;
|
|
23
|
-
constructor(maxSize, waitMs, send) {
|
|
24
|
-
this.maxSize = maxSize;
|
|
25
|
-
this.waitMs = waitMs;
|
|
26
|
-
this.send = send;
|
|
27
|
-
}
|
|
28
|
-
request(id, body, signal) {
|
|
29
|
-
return new Promise((resolve, reject) => {
|
|
30
|
-
let settled = false;
|
|
31
|
-
const finish = (callback, value) => {
|
|
32
|
-
if (settled) return;
|
|
33
|
-
settled = true;
|
|
34
|
-
signal?.removeEventListener("abort", cancel);
|
|
35
|
-
callback(value);
|
|
36
|
-
};
|
|
37
|
-
const entry = {
|
|
38
|
-
id,
|
|
39
|
-
body,
|
|
40
|
-
resolve: (value) => finish(resolve, value),
|
|
41
|
-
reject: (reason) => finish(reject, reason)
|
|
42
|
-
};
|
|
43
|
-
const cancel = () => {
|
|
44
|
-
this.#queue.delete(entry);
|
|
45
|
-
if (this.#queue.size === 0) this.#clearTimer();
|
|
46
|
-
entry.reject(signal?.reason);
|
|
47
|
-
entry.onCancel?.();
|
|
48
|
-
};
|
|
49
|
-
if (signal?.aborted) {
|
|
50
|
-
entry.reject(signal.reason);
|
|
51
|
-
return;
|
|
52
|
-
}
|
|
53
|
-
signal?.addEventListener("abort", cancel, { once: true });
|
|
54
|
-
this.#queue.add(entry);
|
|
55
|
-
if (this.#queue.size >= this.maxSize) this.#flush();
|
|
56
|
-
else if (this.#timer === void 0) this.#timer = setTimeout(() => void this.#flush(), this.waitMs);
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
#clearTimer() {
|
|
60
|
-
if (this.#timer !== void 0) clearTimeout(this.#timer);
|
|
61
|
-
this.#timer = void 0;
|
|
62
|
-
}
|
|
63
|
-
async #flush() {
|
|
64
|
-
this.#clearTimer();
|
|
65
|
-
const entries = [...this.#queue];
|
|
66
|
-
this.#queue.clear();
|
|
67
|
-
if (entries.length === 0) return;
|
|
68
|
-
const controller = new AbortController();
|
|
69
|
-
const active = new Set(entries);
|
|
70
|
-
for (const entry of entries) entry.onCancel = () => {
|
|
71
|
-
active.delete(entry);
|
|
72
|
-
if (active.size === 0) controller.abort();
|
|
73
|
-
};
|
|
74
|
-
try {
|
|
75
|
-
const responses = batchResponses(await this.send(`[${entries.map((entry) => entry.body).join(",")}]`, controller.signal), entries);
|
|
76
|
-
for (const entry of entries) entry.resolve(responses.get(entry.id));
|
|
77
|
-
} catch (error) {
|
|
78
|
-
for (const entry of entries) entry.reject(error);
|
|
79
|
-
} finally {
|
|
80
|
-
for (const entry of entries) entry.onCancel = void 0;
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
};
|
|
84
|
-
function batchResponses(json, entries) {
|
|
85
|
-
if (json !== null && typeof json === "object" && !Array.isArray(json) && "jsonrpc" in json && json.jsonrpc === "2.0" && "id" in json && json.id === null && "error" in json && !Object.hasOwn(json, "result")) return new Map(entries.map((entry) => [entry.id, json]));
|
|
86
|
-
if (!Array.isArray(json) || json.length !== entries.length) throw new RpcResponseError("Invalid JSON-RPC batch response: expected one response per request", json);
|
|
87
|
-
const expected = new Set(entries.map((entry) => entry.id));
|
|
88
|
-
const responses = /* @__PURE__ */ new Map();
|
|
89
|
-
for (const value of json) {
|
|
90
|
-
const response = value;
|
|
91
|
-
if (!response || typeof response !== "object" || Array.isArray(response) || response.jsonrpc !== "2.0" || typeof response.id !== "number" || !expected.has(response.id) || responses.has(response.id) || Object.hasOwn(response, "result") === Object.hasOwn(response, "error")) throw new RpcResponseError("Invalid JSON-RPC batch response: invalid envelope or request ID", json);
|
|
92
|
-
responses.set(response.id, response);
|
|
93
|
-
}
|
|
94
|
-
return responses;
|
|
95
|
-
}
|
|
96
|
-
//#endregion
|
|
97
|
-
//#region src/transport/http.ts
|
|
98
|
-
/**
|
|
99
|
-
* Error thrown when a JSON-RPC response contains an `error` object.
|
|
100
|
-
*
|
|
101
|
-
* Malformed envelopes throw `RpcResponseError`, preserving the raw reply.
|
|
102
|
-
*/
|
|
103
|
-
var JsonRpcError = class extends Error {
|
|
104
|
-
/** JSON-RPC numeric error code. */
|
|
105
|
-
code;
|
|
106
|
-
/** Optional JSON-RPC error data returned by the gateway. */
|
|
107
|
-
data;
|
|
108
|
-
/** JSON-RPC method associated with the failed request, when known. */
|
|
109
|
-
method;
|
|
110
|
-
/** Complete original JSON-RPC error object, including additive fields. */
|
|
111
|
-
raw;
|
|
112
|
-
rpcMessage;
|
|
113
|
-
constructor(code, message, data, method, raw) {
|
|
114
|
-
super(`${method ? `${method}: ` : ""}${message} (RPC ${code})`);
|
|
115
|
-
this.name = "JsonRpcError";
|
|
116
|
-
this.code = code;
|
|
117
|
-
this.data = data;
|
|
118
|
-
this.method = method;
|
|
119
|
-
this.rpcMessage = message;
|
|
120
|
-
this.raw = raw ?? {
|
|
121
|
-
code,
|
|
122
|
-
message,
|
|
123
|
-
...data === void 0 ? {} : { data }
|
|
124
|
-
};
|
|
125
|
-
}
|
|
126
|
-
};
|
|
127
|
-
/** Error thrown when an HTTP response has a non-successful status. */
|
|
128
|
-
var HttpResponseError = class extends Error {
|
|
129
|
-
endpoint;
|
|
130
|
-
method;
|
|
131
|
-
status;
|
|
132
|
-
statusText;
|
|
133
|
-
constructor(status, statusText, endpoint, method) {
|
|
134
|
-
super(`HTTP ${status}: ${statusText}${method ? ` (${method} at ${endpoint})` : ""}`);
|
|
135
|
-
this.endpoint = endpoint;
|
|
136
|
-
this.method = method;
|
|
137
|
-
this.name = "HttpResponseError";
|
|
138
|
-
this.status = status;
|
|
139
|
-
this.statusText = statusText;
|
|
140
|
-
}
|
|
141
|
-
};
|
|
142
|
-
/** Network failure with sanitized endpoint and method context. */
|
|
143
|
-
var HttpRequestError = class extends TypeError {
|
|
144
|
-
endpoint;
|
|
145
|
-
method;
|
|
146
|
-
constructor(endpoint, method, cause) {
|
|
147
|
-
super(`${method}: request to ${endpoint} failed`, { cause });
|
|
148
|
-
this.endpoint = endpoint;
|
|
149
|
-
this.method = method;
|
|
150
|
-
this.name = "HttpRequestError";
|
|
151
|
-
}
|
|
152
|
-
};
|
|
153
|
-
/**
|
|
154
|
-
* JSON-RPC 2.0 transport over HTTP POST.
|
|
155
|
-
*
|
|
156
|
-
* `HttpTransport` handles request IDs, JSON-RPC envelopes, optional custom
|
|
157
|
-
* headers, optional timeout cancellation, and conversion of JSON-RPC error
|
|
158
|
-
* responses into {@link JsonRpcError}.
|
|
159
|
-
*
|
|
160
|
-
* @example
|
|
161
|
-
* ```ts
|
|
162
|
-
* import { HttpTransport } from "@thruputchain/client/transport";
|
|
163
|
-
*
|
|
164
|
-
* const transport = new HttpTransport("http://127.0.0.1:9545", {
|
|
165
|
-
* timeoutMs: 10_000,
|
|
166
|
-
* });
|
|
167
|
-
*
|
|
168
|
-
* const tip = await transport.request("getChainTip");
|
|
169
|
-
* ```
|
|
170
|
-
*/
|
|
171
|
-
var HttpTransport = class {
|
|
172
|
-
#url;
|
|
173
|
-
#headers;
|
|
174
|
-
#fetch;
|
|
175
|
-
#timeoutMs;
|
|
176
|
-
#nextId = 1;
|
|
177
|
-
#batch;
|
|
178
|
-
/** Create an HTTP transport for a Thruput JSON-RPC endpoint URL. */
|
|
179
|
-
constructor(url, options = {}) {
|
|
180
|
-
this.#url = url;
|
|
181
|
-
this.#headers = options.headers;
|
|
182
|
-
this.#fetch = options.fetch ?? globalThis.fetch.bind(globalThis);
|
|
183
|
-
this.#timeoutMs = options.timeoutMs;
|
|
184
|
-
if (options.batch) {
|
|
185
|
-
const batch = options.batch === true ? {} : options.batch;
|
|
186
|
-
const maxSize = batch.maxSize ?? 100;
|
|
187
|
-
const waitMs = batch.waitMs ?? 0;
|
|
188
|
-
if (!Number.isInteger(maxSize) || maxSize < 1 || maxSize > 1e3) throw new RangeError("batch.maxSize must be an integer from 1 to 1000");
|
|
189
|
-
if (!Number.isInteger(waitMs) || waitMs < 0 || waitMs > 2147483647) throw new RangeError("batch.waitMs must be an integer from 0 to 2147483647");
|
|
190
|
-
this.#batch = new HttpBatch(maxSize, waitMs, (body, signal) => this.#post(body, "batch", { signal }));
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
/** Send one JSON-RPC request and return the decoded `result` value. */
|
|
194
|
-
async request(method, params, options = {}) {
|
|
195
|
-
options.signal?.throwIfAborted();
|
|
196
|
-
const id = this.#nextId++;
|
|
197
|
-
const body = JSON.stringify({
|
|
198
|
-
jsonrpc: "2.0",
|
|
199
|
-
id,
|
|
200
|
-
method,
|
|
201
|
-
params: params ?? []
|
|
202
|
-
});
|
|
203
|
-
let json;
|
|
204
|
-
if (this.#batch) try {
|
|
205
|
-
json = await this.#batch.request(id, body, options.signal);
|
|
206
|
-
} catch (error) {
|
|
207
|
-
if (options.signal?.aborted) throw options.signal.reason;
|
|
208
|
-
if (error instanceof HttpRequestError) throw new HttpRequestError(error.endpoint, method, error.cause);
|
|
209
|
-
if (error instanceof HttpResponseError) throw new HttpResponseError(error.status, error.statusText, error.endpoint, method);
|
|
210
|
-
throw error;
|
|
211
|
-
}
|
|
212
|
-
else json = await this.#post(body, method, options);
|
|
213
|
-
return decodeResponse(json, method, this.#batch ? void 0 : id);
|
|
214
|
-
}
|
|
215
|
-
async #post(body, method, options) {
|
|
216
|
-
const abort = this.#timeoutMs ? new AbortController() : void 0;
|
|
217
|
-
const signal = abort && options.signal ? AbortSignal.any([abort.signal, options.signal]) : abort?.signal ?? options.signal;
|
|
218
|
-
const timeout = abort ? setTimeout(() => abort.abort(new DOMException("Request timed out", "TimeoutError")), this.#timeoutMs) : void 0;
|
|
219
|
-
let json;
|
|
220
|
-
try {
|
|
221
|
-
let response;
|
|
222
|
-
try {
|
|
223
|
-
response = await this.#fetch(this.#url, {
|
|
224
|
-
method: "POST",
|
|
225
|
-
headers: {
|
|
226
|
-
"Content-Type": "application/json",
|
|
227
|
-
...this.#headers
|
|
228
|
-
},
|
|
229
|
-
body,
|
|
230
|
-
signal
|
|
231
|
-
});
|
|
232
|
-
} catch (cause) {
|
|
233
|
-
if (typeof cause === "object" && cause !== null && "name" in cause && (cause.name === "AbortError" || cause.name === "TimeoutError")) throw cause;
|
|
234
|
-
throw new HttpRequestError(new URL(this.#url).origin, method, cause);
|
|
235
|
-
}
|
|
236
|
-
if (!response.ok) throw new HttpResponseError(response.status, response.statusText, new URL(this.#url).origin, method);
|
|
237
|
-
try {
|
|
238
|
-
json = await response.json();
|
|
239
|
-
} catch (cause) {
|
|
240
|
-
if (typeof cause === "object" && cause !== null && "name" in cause && cause.name === "TypeError") throw new HttpRequestError(new URL(this.#url).origin, method, cause);
|
|
241
|
-
throw cause;
|
|
242
|
-
}
|
|
243
|
-
} catch (cause) {
|
|
244
|
-
if (signal?.aborted) throw signal.reason;
|
|
245
|
-
throw cause;
|
|
246
|
-
} finally {
|
|
247
|
-
if (timeout !== void 0) clearTimeout(timeout);
|
|
248
|
-
}
|
|
249
|
-
return json;
|
|
250
|
-
}
|
|
251
|
-
};
|
|
252
|
-
function decodeResponse(json, method, expectedId) {
|
|
253
|
-
if (!json || typeof json !== "object" || Array.isArray(json)) throw new RpcResponseError("Invalid JSON-RPC response", json);
|
|
254
|
-
const envelope = json;
|
|
255
|
-
const frameworkError = envelope.id === null && typeof envelope.error === "object" && envelope.error !== null && "code" in envelope.error && [-32700, -32600].includes(envelope.error.code);
|
|
256
|
-
if (envelope.jsonrpc !== "2.0" || expectedId !== void 0 && envelope.id !== expectedId && !frameworkError || Object.hasOwn(envelope, "result") === Object.hasOwn(envelope, "error")) throw new RpcResponseError("Invalid JSON-RPC response envelope or request ID", json);
|
|
257
|
-
if (envelope.error !== void 0) {
|
|
258
|
-
const error = envelope.error;
|
|
259
|
-
if (!error || typeof error !== "object" || Array.isArray(error)) throw new RpcResponseError("Invalid JSON-RPC error response", json);
|
|
260
|
-
const rpcError = error;
|
|
261
|
-
if (typeof rpcError.code !== "number" || !Number.isSafeInteger(rpcError.code) || typeof rpcError.message !== "string") throw new RpcResponseError("Invalid JSON-RPC error response", json);
|
|
262
|
-
throw new JsonRpcError(rpcError.code, rpcError.message, rpcError.data, method, rpcError);
|
|
263
|
-
}
|
|
264
|
-
if (!Object.prototype.hasOwnProperty.call(envelope, "result")) throw new RpcResponseError("Invalid JSON-RPC response", json);
|
|
265
|
-
return envelope.result;
|
|
266
|
-
}
|
|
267
|
-
//#endregion
|
|
268
|
-
//#region src/rpc/errorReader.ts
|
|
269
|
-
const record = (value) => value !== null && typeof value === "object" && !Array.isArray(value);
|
|
270
|
-
const equal$1 = (a, b) => a.length === b.length && a.every((v, i) => v === b[i]);
|
|
271
|
-
/**
|
|
272
|
-
* Classifies method-specific causes without granting retries. Unknown, malformed,
|
|
273
|
-
* or contradictory evidence stays unclassified with the complete raw error.
|
|
274
|
-
* Supply the locally computed/requested hash to bind admission or observation evidence.
|
|
275
|
-
*/
|
|
276
|
-
function decodeRpcError(method, raw, expectedTransactionHash) {
|
|
277
|
-
const unclassified = () => ({
|
|
278
|
-
classification: "unclassified",
|
|
279
|
-
raw
|
|
280
|
-
});
|
|
281
|
-
if (!record(raw) || typeof raw.code !== "number" || !Number.isInteger(raw.code) || raw.code < -2147483648 || raw.code > 2147483647 || typeof raw.message !== "string") return unclassified();
|
|
282
|
-
try {
|
|
283
|
-
const data = require_codec.decodeErrorData(method, raw.code, raw.data);
|
|
284
|
-
if (!validFunding(data)) return unclassified();
|
|
285
|
-
if (expectedTransactionHash) {
|
|
286
|
-
if (method === "sendTransaction" && "transactionHash" in data && data.transactionHash && !equal$1(data.transactionHash, expectedTransactionHash)) return unclassified();
|
|
287
|
-
if (method === "getTransactionReceipt" && "observation" in data && data.observation && !equal$1(data.observation.transactionHash, expectedTransactionHash)) return unclassified();
|
|
288
|
-
}
|
|
289
|
-
return {
|
|
290
|
-
classification: "known",
|
|
291
|
-
data,
|
|
292
|
-
raw
|
|
293
|
-
};
|
|
294
|
-
} catch (error) {
|
|
295
|
-
if (error instanceof require_codec.RpcDecodingError) return unclassified();
|
|
296
|
-
throw error;
|
|
297
|
-
}
|
|
298
|
-
}
|
|
299
|
-
function validFunding(data) {
|
|
300
|
-
if (data.kind !== "fundingAttemptStopped" && data.kind !== "localFundingUnresolved") return true;
|
|
301
|
-
if (data.signedTransaction) try {
|
|
302
|
-
if (!data.transactionHash || !equal$1(require_transactionHash.hashSignedTransaction((0, _thruputchain_protocol.deserialize)(data.signedTransaction, _thruputchain_protocol.codec.SignedTransaction)), data.transactionHash)) return false;
|
|
303
|
-
} catch {
|
|
304
|
-
return false;
|
|
305
|
-
}
|
|
306
|
-
if (data.kind === "fundingAttemptStopped") return !data.receipt || !!data.transactionHash && equal$1(data.receipt.transactionHash, data.transactionHash);
|
|
307
|
-
if (data.cause) {
|
|
308
|
-
if (!validFunding(data.cause)) return false;
|
|
309
|
-
if (data.cause.transactionHash && !equal$1(data.cause.transactionHash, data.transactionHash)) return false;
|
|
310
|
-
if (data.cause.signedTransaction && !equal$1(data.cause.signedTransaction, data.signedTransaction)) return false;
|
|
311
|
-
}
|
|
312
|
-
return true;
|
|
313
|
-
}
|
|
314
|
-
/** A native RPC failure retains the transport error and a conservative typed interpretation. */
|
|
315
|
-
var NativeRpcError = class extends JsonRpcError {
|
|
316
|
-
decoded;
|
|
317
|
-
constructor(error, method, expectedTransactionHash) {
|
|
318
|
-
super(error.code, error.rpcMessage, error.data, method, error.raw);
|
|
319
|
-
this.name = "NativeRpcError";
|
|
320
|
-
this.decoded = decodeRpcError(method, error.raw, expectedTransactionHash);
|
|
321
|
-
}
|
|
322
|
-
};
|
|
323
|
-
//#endregion
|
|
324
|
-
//#region src/rpc/client.ts
|
|
325
|
-
var RpcCompatibilityError = class extends Error {
|
|
326
|
-
constructor(message) {
|
|
327
|
-
super(message);
|
|
328
|
-
this.name = "RpcCompatibilityError";
|
|
329
|
-
}
|
|
330
|
-
};
|
|
331
|
-
const equal = (a, b) => a.length === b.length && a.every((v, i) => v === b[i]);
|
|
332
|
-
/**
|
|
333
|
-
* Connect a native wire-14 client. This layer reads once or sends once; it does
|
|
334
|
-
* not sign, poll, retry, refresh discovery on failure, or switch wire formats.
|
|
335
|
-
* Unknown response variants are UnsupportedRpcValue objects retaining raw data.
|
|
336
|
-
*/
|
|
337
|
-
async function createRpcClient(options) {
|
|
338
|
-
const transport = options.transport;
|
|
339
|
-
const expected = options.expectedNetworkHash ? new Uint8Array(options.expectedNetworkHash) : void 0;
|
|
340
|
-
if (expected && expected.length !== 32) throw new RangeError("expectedNetworkHash must have 32 bytes");
|
|
341
|
-
const required = [...options.requiredMethods ?? []];
|
|
342
|
-
let discovery;
|
|
343
|
-
let configured = /* @__PURE__ */ new Set();
|
|
344
|
-
const requireMethods = (methods) => {
|
|
345
|
-
for (const method of methods) if (!configured.has(method)) throw new RpcCompatibilityError(`Endpoint does not advertise ${method}`);
|
|
346
|
-
};
|
|
347
|
-
const requestOnce = async (method, params, control, hash) => {
|
|
348
|
-
try {
|
|
349
|
-
return await transport.request(method, params, control);
|
|
350
|
-
} catch (error) {
|
|
351
|
-
if (error instanceof JsonRpcError) throw new NativeRpcError(error, method, hash);
|
|
352
|
-
throw error;
|
|
353
|
-
}
|
|
354
|
-
};
|
|
355
|
-
const read = async (method, control) => require_codec.decodeResult(method, await requestOnce(method, {}, control));
|
|
356
|
-
const refreshDiscovery = async (control) => {
|
|
357
|
-
const version = await read("getVersionInfo", control);
|
|
358
|
-
if (!/^14\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)$/.test(version.wireFormat)) throw new RpcCompatibilityError(`Unsupported RPC wire format ${version.wireFormat}`);
|
|
359
|
-
const methods = new Set(version.supportedMethods);
|
|
360
|
-
for (const method of [
|
|
361
|
-
"getVersionInfo",
|
|
362
|
-
"getNetworkInfo",
|
|
363
|
-
...required
|
|
364
|
-
]) if (!methods.has(method)) throw new RpcCompatibilityError(`Endpoint does not advertise ${method}`);
|
|
365
|
-
const network = await read("getNetworkInfo", control);
|
|
366
|
-
const wanted = expected ?? discovery?.network.networkHash;
|
|
367
|
-
if (wanted && !equal(wanted, network.networkHash)) throw new RpcCompatibilityError("RPC network identity does not match");
|
|
368
|
-
const limits = methods.has("getServerLimits") ? await read("getServerLimits", control) : void 0;
|
|
369
|
-
discovery = {
|
|
370
|
-
version,
|
|
371
|
-
network,
|
|
372
|
-
...limits ? { limits } : {}
|
|
373
|
-
};
|
|
374
|
-
configured = methods;
|
|
375
|
-
return structuredClone(discovery);
|
|
376
|
-
};
|
|
377
|
-
await refreshDiscovery({ signal: options.signal });
|
|
378
|
-
const methods = Object.fromEntries(require_codec.rpcMethodNames.map((name) => [name, async (request = {}, control) => {
|
|
379
|
-
const method = name;
|
|
380
|
-
control?.signal?.throwIfAborted();
|
|
381
|
-
requireMethods([method]);
|
|
382
|
-
const params = require_codec.encodeRequest(method, request);
|
|
383
|
-
const input = structuredClone(request);
|
|
384
|
-
const limits = discovery.limits;
|
|
385
|
-
checkLimits(method, input, limits);
|
|
386
|
-
let submittedHash;
|
|
387
|
-
if (method === "sendTransaction") try {
|
|
388
|
-
submittedHash = require_transactionHash.hashSignedTransaction((0, _thruputchain_protocol.deserialize)(input.signedTransaction, _thruputchain_protocol.codec.SignedTransaction));
|
|
389
|
-
} catch {
|
|
390
|
-
throw new require_codec.RpcRequestValidationError("/params/signedTransaction", "Invalid signed transaction XDR");
|
|
391
|
-
}
|
|
392
|
-
const raw = await requestOnce(method, params, control, submittedHash ?? (method === "getTransactionReceipt" ? input.transactionHash : void 0));
|
|
393
|
-
const result = require_codec.decodeResult(method, raw);
|
|
394
|
-
checkResult(method, input, result, raw, submittedHash, limits, discovery.network.networkHash);
|
|
395
|
-
return result;
|
|
396
|
-
}]));
|
|
397
|
-
return Object.defineProperty(Object.assign(methods, {
|
|
398
|
-
refreshDiscovery,
|
|
399
|
-
requireMethods
|
|
400
|
-
}), "discovery", {
|
|
401
|
-
get: () => structuredClone(discovery),
|
|
402
|
-
enumerable: true
|
|
403
|
-
});
|
|
404
|
-
}
|
|
405
|
-
function checkLimits(method, input, limits) {
|
|
406
|
-
if (require_codec.rpcPageMethods.has(method)) {
|
|
407
|
-
if (!limits) throw new RpcCompatibilityError("History calls require advertised server limits");
|
|
408
|
-
const cap = method === "getEvents" ? limits.maxEventsPerPage : limits.maxTransactionsPerPage;
|
|
409
|
-
if (input.limit !== void 0 && input.limit > cap) throw new require_codec.RpcRequestValidationError("/params/limit", `limit exceeds endpoint cap ${cap}`);
|
|
410
|
-
if (typeof input.cursor === "string" && BigInt((input.cursor.length - 2) / 2) > limits.maxCursorBytes) throw new require_codec.RpcRequestValidationError("/params/cursor", "cursor exceeds endpoint cap");
|
|
411
|
-
}
|
|
412
|
-
if (method === "simulateInvocation" || method === "simulateInvocations") {
|
|
413
|
-
if (!limits) throw new RpcCompatibilityError("Simulation calls require advertised server limits");
|
|
414
|
-
const calls = method === "simulateInvocation" ? [input] : input.invocations;
|
|
415
|
-
let gas = 0n, bytes = 0;
|
|
416
|
-
for (const call of calls) {
|
|
417
|
-
const callGas = call.gasLimit;
|
|
418
|
-
if (callGas !== void 0 && callGas > limits.maxSimulationGas) throw new require_codec.RpcRequestValidationError("/params/gasLimit", "gasLimit exceeds endpoint cap");
|
|
419
|
-
const size = call.calldata.length;
|
|
420
|
-
if (BigInt(size) > limits.maxSimulationCalldataBytes) throw new require_codec.RpcRequestValidationError("/params/calldata", "calldata exceeds endpoint cap");
|
|
421
|
-
gas += callGas ?? limits.maxSimulationGas;
|
|
422
|
-
bytes += size;
|
|
423
|
-
}
|
|
424
|
-
if (method === "simulateInvocations") {
|
|
425
|
-
const batch = limits.simulationBatch;
|
|
426
|
-
if (!batch) throw new RpcCompatibilityError("Batch simulation limits are unavailable");
|
|
427
|
-
if (calls.length > batch.maxInvocations || bytes > batch.maxCalldataBytes || gas > batch.maxGas) throw new require_codec.RpcRequestValidationError("/params/invocations", "simulation batch exceeds endpoint cap");
|
|
428
|
-
}
|
|
429
|
-
}
|
|
430
|
-
}
|
|
431
|
-
/**
|
|
432
|
-
* Local block and time results must match their own request: a pinned
|
|
433
|
-
* timepoint comes back exactly, a multi-block request returns `count`
|
|
434
|
-
* blocks, a step change reports the requested step (none when cleared), and a
|
|
435
|
-
* mode change reports the requested mode and interval.
|
|
436
|
-
*/
|
|
437
|
-
function checkBlockControlResult(method, input, value, invalid) {
|
|
438
|
-
if (method === "dev_produceBlock") {
|
|
439
|
-
const block = value;
|
|
440
|
-
if (block.blockHeight <= 0n || input.blockTimepoint !== void 0 && block.blockTimepoint !== input.blockTimepoint) invalid();
|
|
441
|
-
}
|
|
442
|
-
if (method === "dev_produceBlocks" && value.blocks.length !== input.count) invalid();
|
|
443
|
-
if (method === "dev_setNextBlockTimepoint" && value.nextBlockTimepoint !== input.blockTimepoint) invalid();
|
|
444
|
-
if (method === "dev_setBlockTimeStep" && value.stepNanoseconds !== input.stepNanoseconds) invalid();
|
|
445
|
-
if (method === "dev_setBlockDriver") {
|
|
446
|
-
const status = value;
|
|
447
|
-
if (typeof status.mode === "string" && status.mode !== input.mode || input.intervalMilliseconds !== void 0 && status.intervalMilliseconds !== input.intervalMilliseconds) invalid();
|
|
448
|
-
}
|
|
449
|
-
}
|
|
450
|
-
function checkResult(method, input, value, raw, submittedHash, limits, networkHash) {
|
|
451
|
-
const invalid = () => {
|
|
452
|
-
throw new require_codec.RpcDecodingError("/result", raw);
|
|
453
|
-
};
|
|
454
|
-
if (value === null) return;
|
|
455
|
-
const result = value;
|
|
456
|
-
if (method === "getTransactionReceipt" && !equal(result.transactionHash, input.transactionHash) || submittedHash && !equal(result.transactionHash, submittedHash)) invalid();
|
|
457
|
-
if (method === "getBlockByHeight" && (result.blockHeight <= 0n || result.blockHeight !== input.blockHeight || !equal(result.networkHash, networkHash))) invalid();
|
|
458
|
-
if ((method === "getBalance" || method === "getRegisteredAuth") && !equal(result.address, input.address)) invalid();
|
|
459
|
-
if (method === "simulateInvocations" && result.results.length !== input.invocations.length) invalid();
|
|
460
|
-
if ((method === "simulateInvocation" || method === "simulateInvocations") && input.minStateBlockHeight !== void 0 && result.stateBlockHeight < input.minStateBlockHeight) invalid();
|
|
461
|
-
if (method === "dev_fundAccount") {
|
|
462
|
-
const funding = value;
|
|
463
|
-
try {
|
|
464
|
-
if (!equal(funding.recipient, input.recipient) || funding.rawAmount !== input.rawAmount || !equal(funding.transactionHash, require_transactionHash.hashSignedTransaction((0, _thruputchain_protocol.deserialize)(funding.signedTransaction, _thruputchain_protocol.codec.SignedTransaction)))) invalid();
|
|
465
|
-
} catch {
|
|
466
|
-
invalid();
|
|
467
|
-
}
|
|
468
|
-
}
|
|
469
|
-
checkBlockControlResult(method, input, value, invalid);
|
|
470
|
-
if (method === "faucet_requestAirdrop" && "recipient" in result && !equal(result.recipient, input.recipient)) invalid();
|
|
471
|
-
if (!require_codec.rpcPageMethods.has(method)) return;
|
|
472
|
-
const page = value;
|
|
473
|
-
const entries = method === "getEvents" ? page.events : page.transactions;
|
|
474
|
-
const cap = method === "getEvents" ? limits.maxEventsPerPage : limits.maxTransactionsPerPage;
|
|
475
|
-
if (page.oldestIndexedBlockHeight > page.latestIndexedBlockHeight || entries.length > (input.limit ?? Math.min(50, cap)) || page.nextCursor !== null && (page.nextCursor === input.cursor || BigInt((page.nextCursor.length - 2) / 2) > limits.maxCursorBytes)) invalid();
|
|
476
|
-
if (entries.some((entry) => entry.blockHeight < page.oldestIndexedBlockHeight || entry.blockHeight > page.latestIndexedBlockHeight)) invalid();
|
|
477
|
-
const start = input.start;
|
|
478
|
-
if (method === "getTransactionsByBlock") {
|
|
479
|
-
if (page.oldestIndexedBlockHeight < 1n || !entries.length && page.nextCursor !== null || input.cursor !== void 0 && (input.blockHeight < page.oldestIndexedBlockHeight || input.blockHeight > page.latestIndexedBlockHeight) || entries.some((entry) => entry.blockHeight !== input.blockHeight)) invalid();
|
|
480
|
-
} else if (start?.anchor.kind === "atHeight") {
|
|
481
|
-
const anchor = start.anchor.blockHeight;
|
|
482
|
-
if (anchor < page.oldestIndexedBlockHeight || entries.some((entry) => start.order === "ascending" ? entry.blockHeight < anchor : entry.blockHeight > anchor)) invalid();
|
|
483
|
-
}
|
|
484
|
-
const identities = /* @__PURE__ */ new Set();
|
|
485
|
-
const keys = [];
|
|
486
|
-
for (const [index, entry] of entries.entries()) {
|
|
487
|
-
const event = method === "getEvents" ? page.events[index] : void 0;
|
|
488
|
-
const hash = require_hex.toHex0x(entry.transactionHash);
|
|
489
|
-
const sequence = event?.sequenceNumber ?? 0;
|
|
490
|
-
const identity = method === "getEvents" ? `${hash}/${sequence}` : hash;
|
|
491
|
-
if (identities.has(identity)) invalid();
|
|
492
|
-
identities.add(identity);
|
|
493
|
-
keys.push([
|
|
494
|
-
entry.blockHeight,
|
|
495
|
-
hash,
|
|
496
|
-
sequence
|
|
497
|
-
]);
|
|
498
|
-
if (event && !input.filters.some((filter) => filter.addresses.some((address) => equal(address, event.event.address)) && [
|
|
499
|
-
"topic0",
|
|
500
|
-
"topic1",
|
|
501
|
-
"topic2"
|
|
502
|
-
].every((key, i) => {
|
|
503
|
-
const values = filter.topics?.[key];
|
|
504
|
-
return !values?.length || !!event.event.topics[i] && values.some((topic) => equal(topic, event.event.topics[i]));
|
|
505
|
-
}))) invalid();
|
|
506
|
-
}
|
|
507
|
-
const compare = (left, right) => {
|
|
508
|
-
for (let i = 0; i < 3; i++) {
|
|
509
|
-
if (left[i] < right[i]) return -1;
|
|
510
|
-
if (left[i] > right[i]) return 1;
|
|
511
|
-
}
|
|
512
|
-
return 0;
|
|
513
|
-
};
|
|
514
|
-
const asc = keys.every((key, i) => i === 0 || compare(keys[i - 1], key) < 0);
|
|
515
|
-
const desc = keys.every((key, i) => i === 0 || compare(keys[i - 1], key) > 0);
|
|
516
|
-
if (!(start ? start.order === "ascending" ? asc : desc : asc || desc)) invalid();
|
|
517
|
-
}
|
|
518
|
-
//#endregion
|
|
519
|
-
//#region src/transport/readError.ts
|
|
520
|
-
/**
|
|
521
|
-
* Classify an infrastructure read failure without replacing the original error.
|
|
522
|
-
*
|
|
523
|
-
* Pass the caller's signal to distinguish explicit cancellation from a transport
|
|
524
|
-
* timeout. Plain Error wrappers are inspected through their causes; domain errors
|
|
525
|
-
* and unrecognized failures remain unknown. A bare TypeError is not evidence of
|
|
526
|
-
* a network failure. Custom transports should use HttpRequestError for that case.
|
|
527
|
-
* Transaction-not-found remains operation-specific rather than a general retry.
|
|
528
|
-
* This classification never authorizes transaction resubmission.
|
|
529
|
-
*/
|
|
530
|
-
function classifyReadError(error, options = {}) {
|
|
531
|
-
if (options.signal?.aborted) return "cancelled";
|
|
532
|
-
const seen = /* @__PURE__ */ new Set();
|
|
533
|
-
while (error !== null && typeof error === "object" && !seen.has(error)) {
|
|
534
|
-
seen.add(error);
|
|
535
|
-
if (error instanceof HttpRequestError) return "transient";
|
|
536
|
-
if (error instanceof HttpResponseError) return [
|
|
537
|
-
408,
|
|
538
|
-
429,
|
|
539
|
-
500,
|
|
540
|
-
502,
|
|
541
|
-
503,
|
|
542
|
-
504
|
|
543
|
-
].includes(error.status) ? "transient" : "permanent";
|
|
544
|
-
if (error instanceof NativeRpcError) {
|
|
545
|
-
if (error.decoded.classification !== "known") return "unknown";
|
|
546
|
-
switch (error.decoded.data.kind) {
|
|
547
|
-
case "backendUnavailable":
|
|
548
|
-
case "stateHeightUnavailable":
|
|
549
|
-
case "backendTimeout":
|
|
550
|
-
case "overloaded": return "transient";
|
|
551
|
-
case "invalidParams":
|
|
552
|
-
case "invalidCursor":
|
|
553
|
-
case "transactionInvalid":
|
|
554
|
-
case "transactionRejected":
|
|
555
|
-
case "historyUnavailable": return "permanent";
|
|
556
|
-
default: return "unknown";
|
|
557
|
-
}
|
|
558
|
-
}
|
|
559
|
-
if ("name" in error) {
|
|
560
|
-
if (error.name === "TimeoutError") return "transient";
|
|
561
|
-
if (error.name === "AbortError") return "cancelled";
|
|
562
|
-
}
|
|
563
|
-
if (!(error instanceof Error) || error.constructor !== Error) return "unknown";
|
|
564
|
-
error = error.cause;
|
|
565
|
-
}
|
|
566
|
-
return "unknown";
|
|
567
|
-
}
|
|
568
|
-
//#endregion
|
|
569
|
-
Object.defineProperty(exports, "HttpRequestError", {
|
|
570
|
-
enumerable: true,
|
|
571
|
-
get: function() {
|
|
572
|
-
return HttpRequestError;
|
|
573
|
-
}
|
|
574
|
-
});
|
|
575
|
-
Object.defineProperty(exports, "HttpResponseError", {
|
|
576
|
-
enumerable: true,
|
|
577
|
-
get: function() {
|
|
578
|
-
return HttpResponseError;
|
|
579
|
-
}
|
|
580
|
-
});
|
|
581
|
-
Object.defineProperty(exports, "HttpTransport", {
|
|
582
|
-
enumerable: true,
|
|
583
|
-
get: function() {
|
|
584
|
-
return HttpTransport;
|
|
585
|
-
}
|
|
586
|
-
});
|
|
587
|
-
Object.defineProperty(exports, "JsonRpcError", {
|
|
588
|
-
enumerable: true,
|
|
589
|
-
get: function() {
|
|
590
|
-
return JsonRpcError;
|
|
591
|
-
}
|
|
592
|
-
});
|
|
593
|
-
Object.defineProperty(exports, "NativeRpcError", {
|
|
594
|
-
enumerable: true,
|
|
595
|
-
get: function() {
|
|
596
|
-
return NativeRpcError;
|
|
597
|
-
}
|
|
598
|
-
});
|
|
599
|
-
Object.defineProperty(exports, "RpcCompatibilityError", {
|
|
600
|
-
enumerable: true,
|
|
601
|
-
get: function() {
|
|
602
|
-
return RpcCompatibilityError;
|
|
603
|
-
}
|
|
604
|
-
});
|
|
605
|
-
Object.defineProperty(exports, "RpcResponseError", {
|
|
606
|
-
enumerable: true,
|
|
607
|
-
get: function() {
|
|
608
|
-
return RpcResponseError;
|
|
609
|
-
}
|
|
610
|
-
});
|
|
611
|
-
Object.defineProperty(exports, "classifyReadError", {
|
|
612
|
-
enumerable: true,
|
|
613
|
-
get: function() {
|
|
614
|
-
return classifyReadError;
|
|
615
|
-
}
|
|
616
|
-
});
|
|
617
|
-
Object.defineProperty(exports, "createRpcClient", {
|
|
618
|
-
enumerable: true,
|
|
619
|
-
get: function() {
|
|
620
|
-
return createRpcClient;
|
|
621
|
-
}
|
|
622
|
-
});
|
|
623
|
-
|
|
624
|
-
//# sourceMappingURL=readError-CCVlmBhj.cjs.map
|