@sentio/sdk-bundle 4.0.1-rc.2 → 4.0.1-rc.5

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 (73) hide show
  1. package/assets/chainlink-oracles-sepolia.json +21 -0
  2. package/assets/chainlink-oracles.json +219 -0
  3. package/dist/{0x1-B_N1Dd6d.js → 0x1-BoDxh-YB.js} +30 -22
  4. package/dist/0x1-BoDxh-YB.js.map +1 -0
  5. package/dist/{AbstractKeylessAccount-dvYSW9Go.js → AbstractKeylessAccount-DE1e2Glg.js} +3 -2
  6. package/dist/{AbstractKeylessAccount-dvYSW9Go.js.map → AbstractKeylessAccount-DE1e2Glg.js.map} +1 -1
  7. package/dist/_md-CZAi2AzY.js +644 -0
  8. package/dist/_md-CZAi2AzY.js.map +1 -0
  9. package/dist/aptos/builtin/0x1.js +2 -2
  10. package/dist/aptos/builtin/0x3.js +3 -3
  11. package/dist/aptos/builtin/0x3.js.map +1 -1
  12. package/dist/aptos/builtin/0x4.js +3 -3
  13. package/dist/aptos/builtin/0x4.js.map +1 -1
  14. package/dist/aptos/builtin/index.js +1 -1
  15. package/dist/aptos/ext/index.js +2 -2
  16. package/dist/aptos/index.js +2 -2
  17. package/dist/{aptos-DPeebJ9j.js → aptos-C3JyHHc4.js} +257 -47
  18. package/dist/{aptos-DPeebJ9j.js.map → aptos-C3JyHHc4.js.map} +1 -1
  19. package/dist/{coin-CWRVUEBa.js → coin-CpgkWpcD.js} +803 -4
  20. package/dist/coin-CpgkWpcD.js.map +1 -0
  21. package/dist/{coin-DREiK-Br.js → coin-D4FF2o2d.js} +1514 -105
  22. package/dist/coin-D4FF2o2d.js.map +1 -0
  23. package/dist/{decode-worker-7st2rUPr.js → decode-worker-C83IoThX.js} +1375 -1456
  24. package/dist/decode-worker-C83IoThX.js.map +1 -0
  25. package/dist/eth/abi-decoder/decode-worker.js +1 -1
  26. package/dist/eth/builtin/eacaggregatorproxy.js +1 -1
  27. package/dist/eth/builtin/erc1155.js +2 -2
  28. package/dist/eth/builtin/erc20.js +1 -1
  29. package/dist/eth/builtin/erc721.js +1 -1
  30. package/dist/eth/builtin/index.js +1 -1
  31. package/dist/eth/builtin/weth9.js +2 -2
  32. package/dist/eth/index.js +3 -3
  33. package/dist/iota/builtin/0x1.js +3 -3
  34. package/dist/iota/builtin/0x2.js +168 -5
  35. package/dist/iota/builtin/0x2.js.map +1 -1
  36. package/dist/iota/builtin/0x3.js +3 -3
  37. package/dist/iota/ext/index.js +1 -1
  38. package/dist/iota/index.js +3 -3
  39. package/dist/{keyless-B3QnUmtL.js → keyless-nGiRkJjM.js} +1278 -976
  40. package/dist/keyless-nGiRkJjM.js.map +1 -0
  41. package/dist/move/index.js +1 -1
  42. package/dist/{move-Dr-DL5zT.js → move-BVvdKH2Q.js} +7 -7
  43. package/dist/{move-Dr-DL5zT.js.map → move-BVvdKH2Q.js.map} +1 -1
  44. package/dist/solana/builtin/index.js +1 -1
  45. package/dist/solana/index.js +1 -1
  46. package/dist/{solana-Cns7Irpe.js → solana-DNjOwr5Y.js} +313 -90
  47. package/dist/solana-DNjOwr5Y.js.map +1 -0
  48. package/dist/sui/builtin/0x1.js +1 -1
  49. package/dist/sui/builtin/0x2.js +4 -4
  50. package/dist/sui/builtin/0x3.js +4 -4
  51. package/dist/sui/builtin/index.js +1 -1
  52. package/dist/sui/ext/index.js +1 -1
  53. package/dist/sui/index.js +3 -3
  54. package/dist/{sui-BbKeYXM3.js → sui-Hqx2uWI-.js} +17 -17
  55. package/dist/{sui-BbKeYXM3.js.map → sui-Hqx2uWI-.js.map} +1 -1
  56. package/dist/testing/index.js +6 -6
  57. package/dist/utils/index.js +1 -1
  58. package/dist/{utils-Jndk-n_F.js → utils-Dloybvj_.js} +3270 -3431
  59. package/dist/utils-Dloybvj_.js.map +1 -0
  60. package/package.json +2 -2
  61. package/assets/chainlink-oracles-sepolia.csv +0 -19
  62. package/assets/chainlink-oracles.csv +0 -217
  63. package/dist/0x1-B_N1Dd6d.js.map +0 -1
  64. package/dist/base-BvfRCgEy.js +0 -959
  65. package/dist/base-BvfRCgEy.js.map +0 -1
  66. package/dist/coin-CWRVUEBa.js.map +0 -1
  67. package/dist/coin-DREiK-Br.js.map +0 -1
  68. package/dist/decode-worker-7st2rUPr.js.map +0 -1
  69. package/dist/dist-CA96PSzE.js +0 -824
  70. package/dist/dist-CA96PSzE.js.map +0 -1
  71. package/dist/keyless-B3QnUmtL.js.map +0 -1
  72. package/dist/solana-Cns7Irpe.js.map +0 -1
  73. package/dist/utils-Jndk-n_F.js.map +0 -1
@@ -3,383 +3,121 @@ import { F as Code, P as ConnectError, dn as EthCallParamSchema, oi as create, r
3
3
  import * as nc from "node:crypto";
4
4
  import { Piscina } from "piscina";
5
5
 
6
- //#region ../../node_modules/.pnpm/@noble+hashes@1.3.2/node_modules/@noble/hashes/esm/_assert.js
7
- function number(n) {
8
- if (!Number.isSafeInteger(n) || n < 0) throw new Error(`Wrong positive integer: ${n}`);
9
- }
10
- function bytes(b, ...lengths) {
11
- if (!(b instanceof Uint8Array)) throw new Error("Expected Uint8Array");
12
- if (lengths.length > 0 && !lengths.includes(b.length)) throw new Error(`Expected Uint8Array of length ${lengths}, not of length=${b.length}`);
13
- }
14
- function hash(hash) {
15
- if (typeof hash !== "function" || typeof hash.create !== "function") throw new Error("Hash should be wrapped by utils.wrapConstructor");
16
- number(hash.outputLen);
17
- number(hash.blockLen);
18
- }
19
- function exists(instance, checkFinished = true) {
20
- if (instance.destroyed) throw new Error("Hash instance has been destroyed");
21
- if (checkFinished && instance.finished) throw new Error("Hash#digest() has already been called");
22
- }
23
- function output(out, instance) {
24
- bytes(out);
25
- const min = instance.outputLen;
26
- if (out.length < min) throw new Error(`digestInto() expects output buffer of length at least ${min}`);
27
- }
28
-
29
- //#endregion
30
- //#region ../../node_modules/.pnpm/@noble+hashes@1.3.2/node_modules/@noble/hashes/esm/_u64.js
31
- const U32_MASK64 = /* @__PURE__ */ BigInt(2 ** 32 - 1);
32
- const _32n = /* @__PURE__ */ BigInt(32);
33
- function fromBig(n, le = false) {
34
- if (le) return {
35
- h: Number(n & U32_MASK64),
36
- l: Number(n >> _32n & U32_MASK64)
37
- };
38
- return {
39
- h: Number(n >> _32n & U32_MASK64) | 0,
40
- l: Number(n & U32_MASK64) | 0
6
+ //#region src/eth/ethers-format.ts
7
+ function allowNull(format, nullValue) {
8
+ return function(value) {
9
+ if (value == null) return nullValue;
10
+ return format(value);
41
11
  };
42
12
  }
43
- function split(lst, le = false) {
44
- let Ah = new Uint32Array(lst.length);
45
- let Al = new Uint32Array(lst.length);
46
- for (let i = 0; i < lst.length; i++) {
47
- const { h, l } = fromBig(lst[i], le);
48
- [Ah[i], Al[i]] = [h, l];
49
- }
50
- return [Ah, Al];
13
+ function arrayOf(format, allowNull) {
14
+ return (array) => {
15
+ if (allowNull && array == null) return null;
16
+ if (!Array.isArray(array)) throw new Error("not an array");
17
+ return array.map((i) => format(i));
18
+ };
51
19
  }
52
- const rotlSH = (h, l, s) => h << s | l >>> 32 - s;
53
- const rotlSL = (h, l, s) => l << s | h >>> 32 - s;
54
- const rotlBH = (h, l, s) => l << s - 32 | h >>> 64 - s;
55
- const rotlBL = (h, l, s) => h << s - 32 | l >>> 64 - s;
56
20
 
57
21
  //#endregion
58
- //#region ../../node_modules/.pnpm/@noble+hashes@1.3.2/node_modules/@noble/hashes/esm/cryptoNode.js
59
- const crypto$1 = nc && typeof nc === "object" && "webcrypto" in nc ? nc.webcrypto : void 0;
22
+ //#region ../../node_modules/.pnpm/ethers@6.17.0_bufferutil@4.0.8_utf-8-validate@5.0.10/node_modules/ethers/lib.esm/_version.js
23
+ /**
24
+ * The current version of Ethers.
25
+ */
26
+ const version = "6.17.0";
60
27
 
61
28
  //#endregion
62
- //#region ../../node_modules/.pnpm/@noble+hashes@1.3.2/node_modules/@noble/hashes/esm/utils.js
63
- /*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
64
- const u8a = (a) => a instanceof Uint8Array;
65
- const u32 = (arr) => new Uint32Array(arr.buffer, arr.byteOffset, Math.floor(arr.byteLength / 4));
66
- const createView = (arr) => new DataView(arr.buffer, arr.byteOffset, arr.byteLength);
67
- const rotr = (word, shift) => word << 32 - shift | word >>> shift;
68
- const isLE = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68;
69
- if (!isLE) throw new Error("Non little-endian hardware is not supported");
29
+ //#region ../../node_modules/.pnpm/ethers@6.17.0_bufferutil@4.0.8_utf-8-validate@5.0.10/node_modules/ethers/lib.esm/utils/properties.js
70
30
  /**
71
- * @example utf8ToBytes('abc') // new Uint8Array([97, 98, 99])
31
+ * Property helper functions.
32
+ *
33
+ * @_subsection api/utils:Properties [about-properties]
72
34
  */
73
- function utf8ToBytes(str) {
74
- if (typeof str !== "string") throw new Error(`utf8ToBytes expected string, got ${typeof str}`);
75
- return new Uint8Array(new TextEncoder().encode(str));
35
+ function checkType(value, type, name) {
36
+ const types = type.split("|").map((t) => t.trim());
37
+ for (let i = 0; i < types.length; i++) switch (type) {
38
+ case "any": return;
39
+ case "bigint":
40
+ case "boolean":
41
+ case "number":
42
+ case "string": if (typeof value === type) return;
43
+ }
44
+ const error = /* @__PURE__ */ new Error(`invalid value for type ${type}`);
45
+ error.code = "INVALID_ARGUMENT";
46
+ error.argument = `value.${name}`;
47
+ error.value = value;
48
+ throw error;
76
49
  }
77
50
  /**
78
- * Normalizes (non-hex) string or Uint8Array to Uint8Array.
79
- * Warning: when Uint8Array is passed, it would NOT get copied.
80
- * Keep in mind for future mutable operations.
51
+ * Resolves to a new object that is a copy of %%value%%, but with all
52
+ * values resolved.
81
53
  */
82
- function toBytes(data) {
83
- if (typeof data === "string") data = utf8ToBytes(data);
84
- if (!u8a(data)) throw new Error(`expected Uint8Array, got ${typeof data}`);
85
- return data;
54
+ async function resolveProperties(value) {
55
+ const keys = Object.keys(value);
56
+ return (await Promise.all(keys.map((k) => Promise.resolve(value[k])))).reduce((accum, v, index) => {
57
+ accum[keys[index]] = v;
58
+ return accum;
59
+ }, {});
86
60
  }
87
61
  /**
88
- * Copies several Uint8Arrays into one.
62
+ * Assigns the %%values%% to %%target%% as read-only values.
63
+ *
64
+ * It %%types%% is specified, the values are checked.
89
65
  */
90
- function concatBytes(...arrays) {
91
- const r = new Uint8Array(arrays.reduce((sum, a) => sum + a.length, 0));
92
- let pad = 0;
93
- arrays.forEach((a) => {
94
- if (!u8a(a)) throw new Error("Uint8Array expected");
95
- r.set(a, pad);
96
- pad += a.length;
97
- });
98
- return r;
99
- }
100
- var Hash = class {
101
- clone() {
102
- return this._cloneInto();
66
+ function defineProperties(target, values, types) {
67
+ for (let key in values) {
68
+ let value = values[key];
69
+ const type = types ? types[key] : null;
70
+ if (type) checkType(value, type, key);
71
+ Object.defineProperty(target, key, {
72
+ enumerable: true,
73
+ value,
74
+ writable: false
75
+ });
103
76
  }
104
- };
105
- const toStr = {}.toString;
106
- function wrapConstructor(hashCons) {
107
- const hashC = (msg) => hashCons().update(toBytes(msg)).digest();
108
- const tmp = hashCons();
109
- hashC.outputLen = tmp.outputLen;
110
- hashC.blockLen = tmp.blockLen;
111
- hashC.create = () => hashCons();
112
- return hashC;
113
- }
114
- /**
115
- * Secure PRNG. Uses `crypto.getRandomValues`, which defers to OS.
116
- */
117
- function randomBytes(bytesLength = 32) {
118
- if (crypto$1 && typeof crypto$1.getRandomValues === "function") return crypto$1.getRandomValues(new Uint8Array(bytesLength));
119
- throw new Error("crypto.getRandomValues must be defined");
120
77
  }
121
78
 
122
79
  //#endregion
123
- //#region ../../node_modules/.pnpm/@noble+hashes@1.3.2/node_modules/@noble/hashes/esm/sha3.js
124
- const [SHA3_PI, SHA3_ROTL, _SHA3_IOTA] = [
125
- [],
126
- [],
127
- []
128
- ];
129
- const _0n = /* @__PURE__ */ BigInt(0);
130
- const _1n = /* @__PURE__ */ BigInt(1);
131
- const _2n = /* @__PURE__ */ BigInt(2);
132
- const _7n = /* @__PURE__ */ BigInt(7);
133
- const _256n = /* @__PURE__ */ BigInt(256);
134
- const _0x71n = /* @__PURE__ */ BigInt(113);
135
- for (let round = 0, R = _1n, x = 1, y = 0; round < 24; round++) {
136
- [x, y] = [y, (2 * x + 3 * y) % 5];
137
- SHA3_PI.push(2 * (5 * y + x));
138
- SHA3_ROTL.push((round + 1) * (round + 2) / 2 % 64);
139
- let t = _0n;
140
- for (let j = 0; j < 7; j++) {
141
- R = (R << _1n ^ (R >> _7n) * _0x71n) % _256n;
142
- if (R & _2n) t ^= _1n << (_1n << /* @__PURE__ */ BigInt(j)) - _1n;
80
+ //#region ../../node_modules/.pnpm/ethers@6.17.0_bufferutil@4.0.8_utf-8-validate@5.0.10/node_modules/ethers/lib.esm/utils/errors.js
81
+ /**
82
+ * All errors in ethers include properties to ensure they are both
83
+ * human-readable (i.e. ``.message``) and machine-readable (i.e. ``.code``).
84
+ *
85
+ * The [[isError]] function can be used to check the error ``code`` and
86
+ * provide a type guard for the properties present on that error interface.
87
+ *
88
+ * @_section: api/utils/errors:Errors [about-errors]
89
+ */
90
+ function stringify(value, seen) {
91
+ if (value == null) return "null";
92
+ if (seen == null) seen = /* @__PURE__ */ new Set();
93
+ if (typeof value === "object") {
94
+ if (seen.has(value)) return "[Circular]";
95
+ seen.add(value);
143
96
  }
144
- _SHA3_IOTA.push(t);
145
- }
146
- const [SHA3_IOTA_H, SHA3_IOTA_L] = /* @__PURE__ */ split(_SHA3_IOTA, true);
147
- const rotlH = (h, l, s) => s > 32 ? rotlBH(h, l, s) : rotlSH(h, l, s);
148
- const rotlL = (h, l, s) => s > 32 ? rotlBL(h, l, s) : rotlSL(h, l, s);
149
- function keccakP(s, rounds = 24) {
150
- const B = /* @__PURE__ */ new Uint32Array(10);
151
- for (let round = 24 - rounds; round < 24; round++) {
152
- for (let x = 0; x < 10; x++) B[x] = s[x] ^ s[x + 10] ^ s[x + 20] ^ s[x + 30] ^ s[x + 40];
153
- for (let x = 0; x < 10; x += 2) {
154
- const idx1 = (x + 8) % 10;
155
- const idx0 = (x + 2) % 10;
156
- const B0 = B[idx0];
157
- const B1 = B[idx0 + 1];
158
- const Th = rotlH(B0, B1, 1) ^ B[idx1];
159
- const Tl = rotlL(B0, B1, 1) ^ B[idx1 + 1];
160
- for (let y = 0; y < 50; y += 10) {
161
- s[x + y] ^= Th;
162
- s[x + y + 1] ^= Tl;
163
- }
164
- }
165
- let curH = s[2];
166
- let curL = s[3];
167
- for (let t = 0; t < 24; t++) {
168
- const shift = SHA3_ROTL[t];
169
- const Th = rotlH(curH, curL, shift);
170
- const Tl = rotlL(curH, curL, shift);
171
- const PI = SHA3_PI[t];
172
- curH = s[PI];
173
- curL = s[PI + 1];
174
- s[PI] = Th;
175
- s[PI + 1] = Tl;
97
+ if (Array.isArray(value)) return "[ " + value.map((v) => stringify(v, seen)).join(", ") + " ]";
98
+ if (value instanceof Uint8Array) {
99
+ const HEX = "0123456789abcdef";
100
+ let result = "0x";
101
+ for (let i = 0; i < value.length; i++) {
102
+ result += HEX[value[i] >> 4];
103
+ result += HEX[value[i] & 15];
176
104
  }
177
- for (let y = 0; y < 50; y += 10) {
178
- for (let x = 0; x < 10; x++) B[x] = s[y + x];
179
- for (let x = 0; x < 10; x++) s[y + x] ^= ~B[(x + 2) % 10] & B[(x + 4) % 10];
105
+ return result;
106
+ }
107
+ if (typeof value === "object" && typeof value.toJSON === "function") return stringify(value.toJSON(), seen);
108
+ switch (typeof value) {
109
+ case "boolean":
110
+ case "number":
111
+ case "symbol": return value.toString();
112
+ case "bigint": return BigInt(value).toString();
113
+ case "string": return JSON.stringify(value);
114
+ case "object": {
115
+ const keys = Object.keys(value);
116
+ keys.sort();
117
+ return "{ " + keys.map((k) => `${stringify(k, seen)}: ${stringify(value[k], seen)}`).join(", ") + " }";
180
118
  }
181
- s[0] ^= SHA3_IOTA_H[round];
182
- s[1] ^= SHA3_IOTA_L[round];
183
119
  }
184
- B.fill(0);
185
- }
186
- var Keccak = class Keccak extends Hash {
187
- constructor(blockLen, suffix, outputLen, enableXOF = false, rounds = 24) {
188
- super();
189
- this.blockLen = blockLen;
190
- this.suffix = suffix;
191
- this.outputLen = outputLen;
192
- this.enableXOF = enableXOF;
193
- this.rounds = rounds;
194
- this.pos = 0;
195
- this.posOut = 0;
196
- this.finished = false;
197
- this.destroyed = false;
198
- number(outputLen);
199
- if (0 >= this.blockLen || this.blockLen >= 200) throw new Error("Sha3 supports only keccak-f1600 function");
200
- this.state = /* @__PURE__ */ new Uint8Array(200);
201
- this.state32 = u32(this.state);
202
- }
203
- keccak() {
204
- keccakP(this.state32, this.rounds);
205
- this.posOut = 0;
206
- this.pos = 0;
207
- }
208
- update(data) {
209
- exists(this);
210
- const { blockLen, state } = this;
211
- data = toBytes(data);
212
- const len = data.length;
213
- for (let pos = 0; pos < len;) {
214
- const take = Math.min(blockLen - this.pos, len - pos);
215
- for (let i = 0; i < take; i++) state[this.pos++] ^= data[pos++];
216
- if (this.pos === blockLen) this.keccak();
217
- }
218
- return this;
219
- }
220
- finish() {
221
- if (this.finished) return;
222
- this.finished = true;
223
- const { state, suffix, pos, blockLen } = this;
224
- state[pos] ^= suffix;
225
- if ((suffix & 128) !== 0 && pos === blockLen - 1) this.keccak();
226
- state[blockLen - 1] ^= 128;
227
- this.keccak();
228
- }
229
- writeInto(out) {
230
- exists(this, false);
231
- bytes(out);
232
- this.finish();
233
- const bufferOut = this.state;
234
- const { blockLen } = this;
235
- for (let pos = 0, len = out.length; pos < len;) {
236
- if (this.posOut >= blockLen) this.keccak();
237
- const take = Math.min(blockLen - this.posOut, len - pos);
238
- out.set(bufferOut.subarray(this.posOut, this.posOut + take), pos);
239
- this.posOut += take;
240
- pos += take;
241
- }
242
- return out;
243
- }
244
- xofInto(out) {
245
- if (!this.enableXOF) throw new Error("XOF is not possible for this instance");
246
- return this.writeInto(out);
247
- }
248
- xof(bytes) {
249
- number(bytes);
250
- return this.xofInto(new Uint8Array(bytes));
251
- }
252
- digestInto(out) {
253
- output(out, this);
254
- if (this.finished) throw new Error("digest() was already called");
255
- this.writeInto(out);
256
- this.destroy();
257
- return out;
258
- }
259
- digest() {
260
- return this.digestInto(new Uint8Array(this.outputLen));
261
- }
262
- destroy() {
263
- this.destroyed = true;
264
- this.state.fill(0);
265
- }
266
- _cloneInto(to) {
267
- const { blockLen, suffix, outputLen, rounds, enableXOF } = this;
268
- to || (to = new Keccak(blockLen, suffix, outputLen, enableXOF, rounds));
269
- to.state32.set(this.state32);
270
- to.pos = this.pos;
271
- to.posOut = this.posOut;
272
- to.finished = this.finished;
273
- to.rounds = rounds;
274
- to.suffix = suffix;
275
- to.outputLen = outputLen;
276
- to.enableXOF = enableXOF;
277
- to.destroyed = this.destroyed;
278
- return to;
279
- }
280
- };
281
- const gen = (suffix, blockLen, outputLen) => wrapConstructor(() => new Keccak(blockLen, suffix, outputLen));
282
- /**
283
- * keccak-256 hash function. Different from SHA3-256.
284
- * @param message - that would be hashed
285
- */
286
- const keccak_256 = /* @__PURE__ */ gen(1, 136, 256 / 8);
287
-
288
- //#endregion
289
- //#region ../../node_modules/.pnpm/@sentio+ethers@6.13.1-patch.6_bufferutil@4.0.8_utf-8-validate@5.0.10/node_modules/@sentio/ethers/lib.esm/_version.js
290
- /**
291
- * The current version of Ethers.
292
- */
293
- const version = "6.13.1";
294
-
295
- //#endregion
296
- //#region ../../node_modules/.pnpm/@sentio+ethers@6.13.1-patch.6_bufferutil@4.0.8_utf-8-validate@5.0.10/node_modules/@sentio/ethers/lib.esm/utils/properties.js
297
- /**
298
- * Property helper functions.
299
- *
300
- * @_subsection api/utils:Properties [about-properties]
301
- */
302
- function checkType(value, type, name) {
303
- const types = type.split("|").map((t) => t.trim());
304
- for (let i = 0; i < types.length; i++) switch (type) {
305
- case "any": return;
306
- case "bigint":
307
- case "boolean":
308
- case "number":
309
- case "string": if (typeof value === type) return;
310
- }
311
- const error = /* @__PURE__ */ new Error(`invalid value for type ${type}`);
312
- error.code = "INVALID_ARGUMENT";
313
- error.argument = `value.${name}`;
314
- error.value = value;
315
- throw error;
316
- }
317
- /**
318
- * Resolves to a new object that is a copy of %%value%%, but with all
319
- * values resolved.
320
- */
321
- async function resolveProperties(value) {
322
- const keys = Object.keys(value);
323
- return (await Promise.all(keys.map((k) => Promise.resolve(value[k])))).reduce((accum, v, index) => {
324
- accum[keys[index]] = v;
325
- return accum;
326
- }, {});
327
- }
328
- /**
329
- * Assigns the %%values%% to %%target%% as read-only values.
330
- *
331
- * It %%types%% is specified, the values are checked.
332
- */
333
- function defineProperties(target, values, types) {
334
- for (let key in values) {
335
- let value = values[key];
336
- const type = types ? types[key] : null;
337
- if (type) checkType(value, type, key);
338
- Object.defineProperty(target, key, {
339
- enumerable: true,
340
- value,
341
- writable: false
342
- });
343
- }
344
- }
345
-
346
- //#endregion
347
- //#region ../../node_modules/.pnpm/@sentio+ethers@6.13.1-patch.6_bufferutil@4.0.8_utf-8-validate@5.0.10/node_modules/@sentio/ethers/lib.esm/utils/errors.js
348
- /**
349
- * All errors in ethers include properties to ensure they are both
350
- * human-readable (i.e. ``.message``) and machine-readable (i.e. ``.code``).
351
- *
352
- * The [[isError]] function can be used to check the error ``code`` and
353
- * provide a type guard for the properties present on that error interface.
354
- *
355
- * @_section: api/utils/errors:Errors [about-errors]
356
- */
357
- function stringify(value) {
358
- if (value == null) return "null";
359
- if (Array.isArray(value)) return "[ " + value.map(stringify).join(", ") + " ]";
360
- if (value instanceof Uint8Array) {
361
- const HEX = "0123456789abcdef";
362
- let result = "0x";
363
- for (let i = 0; i < value.length; i++) {
364
- result += HEX[value[i] >> 4];
365
- result += HEX[value[i] & 15];
366
- }
367
- return result;
368
- }
369
- if (typeof value === "object" && typeof value.toJSON === "function") return stringify(value.toJSON());
370
- switch (typeof value) {
371
- case "boolean":
372
- case "symbol": return value.toString();
373
- case "bigint": return BigInt(value).toString();
374
- case "number": return value.toString();
375
- case "string": return JSON.stringify(value);
376
- case "object": {
377
- const keys = Object.keys(value);
378
- keys.sort();
379
- return "{ " + keys.map((k) => `${stringify(k)}: ${stringify(value[k])}`).join(", ") + " }";
380
- }
381
- }
382
- return `[ COULD NOT SERIALIZE ]`;
120
+ return `[ COULD NOT SERIALIZE ]`;
383
121
  }
384
122
  /**
385
123
  * Returns true if the %%error%% matches an error thrown by ethers
@@ -476,7 +214,7 @@ function assertArgument(check, message, name, value) {
476
214
  function assertArgumentCount(count, expectedCount, message) {
477
215
  if (message == null) message = "";
478
216
  if (message) message = ": " + message;
479
- assert(count >= expectedCount, "missing arguemnt" + message, "MISSING_ARGUMENT", {
217
+ assert(count >= expectedCount, "missing argument" + message, "MISSING_ARGUMENT", {
480
218
  count,
481
219
  expectedCount
482
220
  });
@@ -532,7 +270,7 @@ function assertPrivate(givenGuard, guard, className) {
532
270
  }
533
271
 
534
272
  //#endregion
535
- //#region ../../node_modules/.pnpm/@sentio+ethers@6.13.1-patch.6_bufferutil@4.0.8_utf-8-validate@5.0.10/node_modules/@sentio/ethers/lib.esm/utils/data.js
273
+ //#region ../../node_modules/.pnpm/ethers@6.17.0_bufferutil@4.0.8_utf-8-validate@5.0.10/node_modules/ethers/lib.esm/utils/data.js
536
274
  /**
537
275
  * Some data helpers.
538
276
  *
@@ -544,7 +282,7 @@ function _getBytes(value, name, copy) {
544
282
  if (copy) return new Uint8Array(value);
545
283
  return value;
546
284
  }
547
- if (typeof value === "string" && value.match(/^0x(?:[0-9a-f][0-9a-f])*$/i)) {
285
+ if (typeof value === "string" && value.length % 2 === 0 && value.match(/^0x[0-9a-f]*$/i)) {
548
286
  const result = new Uint8Array((value.length - 2) / 2);
549
287
  let offset = 2;
550
288
  for (let i = 0; i < result.length; i++) {
@@ -678,13 +416,13 @@ function zeroPadBytes(data, length) {
678
416
  }
679
417
 
680
418
  //#endregion
681
- //#region ../../node_modules/.pnpm/@sentio+ethers@6.13.1-patch.6_bufferutil@4.0.8_utf-8-validate@5.0.10/node_modules/@sentio/ethers/lib.esm/utils/maths.js
419
+ //#region ../../node_modules/.pnpm/ethers@6.17.0_bufferutil@4.0.8_utf-8-validate@5.0.10/node_modules/ethers/lib.esm/utils/maths.js
682
420
  /**
683
421
  * Some mathematic operations.
684
422
  *
685
423
  * @_subsection: api/utils:Math Helpers [about-maths]
686
424
  */
687
- const BN_0$6 = BigInt(0);
425
+ const BN_0$5 = BigInt(0);
688
426
  const BN_1$2 = BigInt(1);
689
427
  const maxValue = 9007199254740991;
690
428
  /**
@@ -696,7 +434,7 @@ const maxValue = 9007199254740991;
696
434
  function fromTwos(_value, _width) {
697
435
  const value = getUint(_value, "value");
698
436
  const width = BigInt(getNumber(_width, "width"));
699
- assert(value >> width === BN_0$6, "overflow", "NUMERIC_FAULT", {
437
+ assert(value >> width === BN_0$5, "overflow", "NUMERIC_FAULT", {
700
438
  operation: "fromTwos",
701
439
  fault: "overflow",
702
440
  value: _value
@@ -717,7 +455,7 @@ function toTwos(_value, _width) {
717
455
  let value = getBigInt(_value, "value");
718
456
  const width = BigInt(getNumber(_width, "width"));
719
457
  const limit = BN_1$2 << width - BN_1$2;
720
- if (value < BN_0$6) {
458
+ if (value < BN_0$5) {
721
459
  value = -value;
722
460
  assert(value <= limit, "too low", "NUMERIC_FAULT", {
723
461
  operation: "toTwos",
@@ -766,7 +504,7 @@ function getBigInt(value, name) {
766
504
  */
767
505
  function getUint(value, name) {
768
506
  const result = getBigInt(value, name);
769
- assert(result >= BN_0$6, "unsigned value cannot be negative", "NUMERIC_FAULT", {
507
+ assert(result >= BN_0$5, "unsigned value cannot be negative", "NUMERIC_FAULT", {
770
508
  fault: "overflow",
771
509
  operation: "getUint",
772
510
  value
@@ -819,11 +557,13 @@ function toNumber(value) {
819
557
  * %%width%% bytes.
820
558
  */
821
559
  function toBeHex(_value, _width) {
822
- let result = getUint(_value, "value").toString(16);
560
+ const value = getUint(_value, "value");
561
+ let result = value.toString(16);
823
562
  if (_width == null) {
824
563
  if (result.length % 2) result = "0" + result;
825
564
  } else {
826
565
  const width = getNumber(_width, "width");
566
+ if (width === 0 && value === BN_0$5) return "0x";
827
567
  assert(width * 2 >= result.length, `value exceeds width (${width} bytes)`, "NUMERIC_FAULT", {
828
568
  operation: "toBeHex",
829
569
  fault: "overflow",
@@ -836,11 +576,23 @@ function toBeHex(_value, _width) {
836
576
  /**
837
577
  * Converts %%value%% to a Big Endian Uint8Array.
838
578
  */
839
- function toBeArray(_value) {
579
+ function toBeArray(_value, _width) {
840
580
  const value = getUint(_value, "value");
841
- if (value === BN_0$6) return new Uint8Array([]);
581
+ if (value === BN_0$5) {
582
+ const width = _width != null ? getNumber(_width, "width") : 0;
583
+ return new Uint8Array(width);
584
+ }
842
585
  let hex = value.toString(16);
843
586
  if (hex.length % 2) hex = "0" + hex;
587
+ if (_width != null) {
588
+ const width = getNumber(_width, "width");
589
+ while (hex.length < width * 2) hex = "00" + hex;
590
+ assert(width * 2 === hex.length, `value exceeds width (${width} bytes)`, "NUMERIC_FAULT", {
591
+ operation: "toBeArray",
592
+ fault: "overflow",
593
+ value: _value
594
+ });
595
+ }
844
596
  const result = new Uint8Array(hex.length / 2);
845
597
  for (let i = 0; i < result.length; i++) {
846
598
  const offset = i * 2;
@@ -863,7 +615,7 @@ function toQuantity(value) {
863
615
  }
864
616
 
865
617
  //#endregion
866
- //#region ../../node_modules/.pnpm/@sentio+ethers@6.13.1-patch.6_bufferutil@4.0.8_utf-8-validate@5.0.10/node_modules/@sentio/ethers/lib.esm/utils/events.js
618
+ //#region ../../node_modules/.pnpm/ethers@6.17.0_bufferutil@4.0.8_utf-8-validate@5.0.10/node_modules/ethers/lib.esm/utils/events.js
867
619
  /**
868
620
  * Events allow for applications to use the observer pattern, which
869
621
  * allows subscribing and publishing events, outside the normal
@@ -907,7 +659,7 @@ var EventPayload = class {
907
659
  };
908
660
 
909
661
  //#endregion
910
- //#region ../../node_modules/.pnpm/@sentio+ethers@6.13.1-patch.6_bufferutil@4.0.8_utf-8-validate@5.0.10/node_modules/@sentio/ethers/lib.esm/utils/utf8.js
662
+ //#region ../../node_modules/.pnpm/ethers@6.17.0_bufferutil@4.0.8_utf-8-validate@5.0.10/node_modules/ethers/lib.esm/utils/utf8.js
911
663
  /**
912
664
  * Using strings in Ethereum (or any security-basd system) requires
913
665
  * additional care. These utilities attempt to mitigate some of the
@@ -1073,986 +825,1189 @@ function toUtf8String(bytes, onError) {
1073
825
  }
1074
826
 
1075
827
  //#endregion
1076
- //#region ../../node_modules/.pnpm/@sentio+ethers@6.13.1-patch.6_bufferutil@4.0.8_utf-8-validate@5.0.10/node_modules/@sentio/ethers/lib.esm/utils/rlp-encode.js
1077
- function arrayifyInteger(value) {
1078
- const result = [];
1079
- while (value) {
1080
- result.unshift(value & 255);
1081
- value >>= 8;
1082
- }
1083
- return result;
1084
- }
1085
- function _encode(object) {
1086
- if (Array.isArray(object)) {
1087
- let payload = [];
1088
- object.forEach(function(child) {
1089
- payload = payload.concat(_encode(child));
1090
- });
1091
- if (payload.length <= 55) {
1092
- payload.unshift(192 + payload.length);
1093
- return payload;
1094
- }
1095
- const length = arrayifyInteger(payload.length);
1096
- length.unshift(247 + length.length);
1097
- return length.concat(payload);
1098
- }
1099
- const data = Array.prototype.slice.call(getBytes(object, "object"));
1100
- if (data.length === 1 && data[0] <= 127) return data;
1101
- else if (data.length <= 55) {
1102
- data.unshift(128 + data.length);
1103
- return data;
1104
- }
1105
- const length = arrayifyInteger(data.length);
1106
- length.unshift(183 + length.length);
1107
- return length.concat(data);
1108
- }
1109
- const nibbles = "0123456789abcdef";
828
+ //#region ../../node_modules/.pnpm/ethers@6.17.0_bufferutil@4.0.8_utf-8-validate@5.0.10/node_modules/ethers/lib.esm/abi/coders/abstract-coder.js
1110
829
  /**
1111
- * Encodes %%object%% as an RLP-encoded [[DataHexString]].
830
+ * @_ignore:
1112
831
  */
1113
- function encodeRlp(object) {
1114
- let result = "0x";
1115
- for (const v of _encode(object)) {
1116
- result += nibbles[v >> 4];
1117
- result += nibbles[v & 15];
1118
- }
1119
- return result;
832
+ const WordSize = 32;
833
+ const Padding = new Uint8Array(32);
834
+ const passProperties$1 = ["then"];
835
+ const _guard$2 = {};
836
+ const resultNames = /* @__PURE__ */ new WeakMap();
837
+ function getNames(result) {
838
+ return resultNames.get(result);
839
+ }
840
+ function setNames(result, names) {
841
+ resultNames.set(result, names);
842
+ }
843
+ function throwError(name, error) {
844
+ const wrapped = /* @__PURE__ */ new Error(`deferred error during ABI decoding triggered accessing ${name}`);
845
+ wrapped.error = error;
846
+ throw wrapped;
847
+ }
848
+ function toObject(names, items, deep) {
849
+ if (names.indexOf(null) >= 0) return items.map((item, index) => {
850
+ if (item instanceof Result) return toObject(getNames(item), item, deep);
851
+ return item;
852
+ });
853
+ return names.reduce((accum, name, index) => {
854
+ let item = items.getValue(name);
855
+ if (!(name in accum)) {
856
+ if (deep && item instanceof Result) item = toObject(getNames(item), item, deep);
857
+ accum[name] = item;
858
+ }
859
+ return accum;
860
+ }, {});
1120
861
  }
1121
-
1122
- //#endregion
1123
- //#region ../../node_modules/.pnpm/@sentio+ethers@6.13.1-patch.6_bufferutil@4.0.8_utf-8-validate@5.0.10/node_modules/@sentio/ethers/lib.esm/crypto/keccak.js
1124
- /**
1125
- * Cryptographic hashing functions
1126
- *
1127
- * @_subsection: api/crypto:Hash Functions [about-crypto-hashing]
1128
- */
1129
- let locked = false;
1130
- const _keccak256 = function(data) {
1131
- return keccak_256(data);
1132
- };
1133
- let __keccak256 = _keccak256;
1134
862
  /**
1135
- * Compute the cryptographic KECCAK256 hash of %%data%%.
1136
- *
1137
- * The %%data%% **must** be a data representation, to compute the
1138
- * hash of UTF-8 data use the [[id]] function.
1139
- *
1140
- * @returns DataHexstring
1141
- * @example:
1142
- * keccak256("0x")
1143
- * //_result:
1144
- *
1145
- * keccak256("0x1337")
1146
- * //_result:
1147
- *
1148
- * keccak256(new Uint8Array([ 0x13, 0x37 ]))
1149
- * //_result:
863
+ * A [[Result]] is a sub-class of Array, which allows accessing any
864
+ * of its values either positionally by its index or, if keys are
865
+ * provided by its name.
1150
866
  *
1151
- * // Strings are assumed to be DataHexString, otherwise it will
1152
- * // throw. To hash UTF-8 data, see the note above.
1153
- * keccak256("Hello World")
1154
- * //_error:
867
+ * @_docloc: api/abi
1155
868
  */
1156
- function keccak256(_data) {
1157
- const data = getBytes(_data, "data");
1158
- return hexlify(__keccak256(data));
1159
- }
1160
- keccak256._ = _keccak256;
1161
- keccak256.lock = function() {
1162
- locked = true;
1163
- };
1164
- keccak256.register = function(func) {
1165
- if (locked) throw new TypeError("keccak256 is locked");
1166
- __keccak256 = func;
1167
- };
1168
- Object.freeze(keccak256);
1169
-
1170
- //#endregion
1171
- //#region ../../node_modules/.pnpm/@sentio+ethers@6.13.1-patch.6_bufferutil@4.0.8_utf-8-validate@5.0.10/node_modules/@sentio/ethers/lib.esm/constants/hashes.js
1172
- /**
1173
- * A constant for the zero hash.
1174
- *
1175
- * (**i.e.** ``"0x0000000000000000000000000000000000000000000000000000000000000000"``)
1176
- */
1177
- const ZeroHash = "0x0000000000000000000000000000000000000000000000000000000000000000";
1178
-
1179
- //#endregion
1180
- //#region ../../node_modules/.pnpm/@sentio+ethers@6.13.1-patch.6_bufferutil@4.0.8_utf-8-validate@5.0.10/node_modules/@sentio/ethers/lib.esm/crypto/signature.js
1181
- const BN_0$5 = BigInt(0);
1182
- const BN_1$1 = BigInt(1);
1183
- const BN_2 = BigInt(2);
1184
- const BN_27 = BigInt(27);
1185
- const BN_28 = BigInt(28);
1186
- const BN_35 = BigInt(35);
1187
- const _guard$2 = {};
1188
- function toUint256(value) {
1189
- return zeroPadValue(toBeArray(value), 32);
1190
- }
1191
- /**
1192
- * A Signature @TODO
1193
- *
1194
- *
1195
- * @_docloc: api/crypto:Signing
1196
- */
1197
- var Signature = class Signature {
1198
- #r;
1199
- #s;
1200
- #v;
1201
- #networkV;
1202
- /**
1203
- * The ``r`` value for a signautre.
1204
- *
1205
- * This represents the ``x`` coordinate of a "reference" or
1206
- * challenge point, from which the ``y`` can be computed.
1207
- */
1208
- get r() {
1209
- return this.#r;
1210
- }
1211
- set r(value) {
1212
- assertArgument(dataLength(value) === 32, "invalid r", "value", value);
1213
- this.#r = hexlify(value);
1214
- }
869
+ var Result = class Result extends Array {
870
+ #names;
1215
871
  /**
1216
- * The ``s`` value for a signature.
872
+ * @private
1217
873
  */
1218
- get s() {
1219
- return this.#s;
1220
- }
1221
- set s(_value) {
1222
- assertArgument(dataLength(_value) === 32, "invalid s", "value", _value);
1223
- const value = hexlify(_value);
1224
- assertArgument(parseInt(value.substring(0, 3)) < 8, "non-canonical s", "value", value);
1225
- this.#s = value;
874
+ constructor(...args) {
875
+ const guard = args[0];
876
+ let items = args[1];
877
+ let names = (args[2] || []).slice();
878
+ let wrap = true;
879
+ if (guard !== _guard$2) {
880
+ items = args;
881
+ names = [];
882
+ wrap = false;
883
+ }
884
+ super(items.length);
885
+ items.forEach((item, index) => {
886
+ this[index] = item;
887
+ });
888
+ const nameCounts = names.reduce((accum, name) => {
889
+ if (typeof name === "string") accum.set(name, (accum.get(name) || 0) + 1);
890
+ return accum;
891
+ }, /* @__PURE__ */ new Map());
892
+ setNames(this, Object.freeze(items.map((item, index) => {
893
+ const name = names[index];
894
+ if (name != null && nameCounts.get(name) === 1) return name;
895
+ return null;
896
+ })));
897
+ this.#names = [];
898
+ if (this.#names == null) this.#names;
899
+ if (!wrap) return;
900
+ Object.freeze(this);
901
+ const proxy = new Proxy(this, { get: (target, prop, receiver) => {
902
+ if (typeof prop === "string") {
903
+ if (prop.match(/^[0-9]+$/)) {
904
+ const index = getNumber(prop, "%index");
905
+ if (index < 0 || index >= this.length) throw new RangeError("out of result range");
906
+ const item = target[index];
907
+ if (item instanceof Error) throwError(`index ${index}`, item);
908
+ return item;
909
+ }
910
+ if (passProperties$1.indexOf(prop) >= 0) return Reflect.get(target, prop, receiver);
911
+ const value = target[prop];
912
+ if (value instanceof Function) return function(...args) {
913
+ return value.apply(this === receiver ? target : this, args);
914
+ };
915
+ else if (!(prop in target)) return target.getValue.apply(this === receiver ? target : this, [prop]);
916
+ }
917
+ return Reflect.get(target, prop, receiver);
918
+ } });
919
+ setNames(proxy, getNames(this));
920
+ return proxy;
1226
921
  }
1227
922
  /**
1228
- * The ``v`` value for a signature.
1229
- *
1230
- * Since a given ``x`` value for ``r`` has two possible values for
1231
- * its correspondin ``y``, the ``v`` indicates which of the two ``y``
1232
- * values to use.
923
+ * Returns the Result as a normal Array. If %%deep%%, any children
924
+ * which are Result objects are also converted to a normal Array.
1233
925
  *
1234
- * It is normalized to the values ``27`` or ``28`` for legacy
1235
- * purposes.
1236
- */
1237
- get v() {
1238
- return this.#v;
1239
- }
1240
- set v(value) {
1241
- const v = getNumber(value, "value");
1242
- assertArgument(v === 27 || v === 28, "invalid v", "v", value);
1243
- this.#v = v;
1244
- }
1245
- /**
1246
- * The EIP-155 ``v`` for legacy transactions. For non-legacy
1247
- * transactions, this value is ``null``.
1248
- */
1249
- get networkV() {
1250
- return this.#networkV;
1251
- }
1252
- /**
1253
- * The chain ID for EIP-155 legacy transactions. For non-legacy
1254
- * transactions, this value is ``null``.
926
+ * This will throw if there are any outstanding deferred
927
+ * errors.
1255
928
  */
1256
- get legacyChainId() {
1257
- const v = this.networkV;
1258
- if (v == null) return null;
1259
- return Signature.getChainId(v);
929
+ toArray(deep) {
930
+ const result = [];
931
+ this.forEach((item, index) => {
932
+ if (item instanceof Error) throwError(`index ${index}`, item);
933
+ if (deep && item instanceof Result) item = item.toArray(deep);
934
+ result.push(item);
935
+ });
936
+ return result;
1260
937
  }
1261
938
  /**
1262
- * The ``yParity`` for the signature.
939
+ * Returns the Result as an Object with each name-value pair. If
940
+ * %%deep%%, any children which are Result objects are also
941
+ * converted to an Object.
1263
942
  *
1264
- * See ``v`` for more details on how this value is used.
943
+ * This will throw if any value is unnamed, or if there are
944
+ * any outstanding deferred errors.
1265
945
  */
1266
- get yParity() {
1267
- return this.v === 27 ? 0 : 1;
946
+ toObject(deep) {
947
+ const names = getNames(this);
948
+ return names.reduce((accum, name, index) => {
949
+ assert(name != null, `value at index ${index} unnamed`, "UNSUPPORTED_OPERATION", { operation: "toObject()" });
950
+ return toObject(names, this, deep);
951
+ }, {});
1268
952
  }
1269
953
  /**
1270
- * The [[link-eip-2098]] compact representation of the ``yParity``
1271
- * and ``s`` compacted into a single ``bytes32``.
954
+ * @_ignore
1272
955
  */
1273
- get yParityAndS() {
1274
- const yParityAndS = getBytes(this.s);
1275
- if (this.yParity) yParityAndS[0] |= 128;
1276
- return hexlify(yParityAndS);
956
+ slice(start, end) {
957
+ if (start == null) start = 0;
958
+ if (start < 0) {
959
+ start += this.length;
960
+ if (start < 0) start = 0;
961
+ }
962
+ if (end == null) end = this.length;
963
+ if (end < 0) {
964
+ end += this.length;
965
+ if (end < 0) end = 0;
966
+ }
967
+ if (end > this.length) end = this.length;
968
+ const _names = getNames(this);
969
+ const result = [];
970
+ const names = [];
971
+ for (let i = start; i < end; i++) {
972
+ result.push(this[i]);
973
+ names.push(_names[i]);
974
+ }
975
+ return new Result(_guard$2, result, names);
1277
976
  }
1278
977
  /**
1279
- * The [[link-eip-2098]] compact representation.
978
+ * @_ignore
1280
979
  */
1281
- get compactSerialized() {
1282
- return concat([this.r, this.yParityAndS]);
980
+ filter(callback, thisArg) {
981
+ const _names = getNames(this);
982
+ const result = [];
983
+ const names = [];
984
+ for (let i = 0; i < this.length; i++) {
985
+ const item = this[i];
986
+ if (item instanceof Error) throwError(`index ${i}`, item);
987
+ if (callback.call(thisArg, item, i, this)) {
988
+ result.push(item);
989
+ names.push(_names[i]);
990
+ }
991
+ }
992
+ return new Result(_guard$2, result, names);
1283
993
  }
1284
994
  /**
1285
- * The serialized representation.
995
+ * @_ignore
1286
996
  */
1287
- get serialized() {
1288
- return concat([
1289
- this.r,
1290
- this.s,
1291
- this.yParity ? "0x1c" : "0x1b"
1292
- ]);
997
+ map(callback, thisArg) {
998
+ const result = [];
999
+ for (let i = 0; i < this.length; i++) {
1000
+ const item = this[i];
1001
+ if (item instanceof Error) throwError(`index ${i}`, item);
1002
+ result.push(callback.call(thisArg, item, i, this));
1003
+ }
1004
+ return result;
1293
1005
  }
1294
1006
  /**
1295
- * @private
1007
+ * Returns the value for %%name%%.
1008
+ *
1009
+ * Since it is possible to have a key whose name conflicts with
1010
+ * a method on a [[Result]] or its superclass Array, or any
1011
+ * JavaScript keyword, this ensures all named values are still
1012
+ * accessible by name.
1296
1013
  */
1297
- constructor(guard, r, s, v) {
1298
- assertPrivate(guard, _guard$2, "Signature");
1299
- this.#r = r;
1300
- this.#s = s;
1301
- this.#v = v;
1302
- this.#networkV = null;
1303
- }
1304
- [Symbol.for("nodejs.util.inspect.custom")]() {
1305
- return `Signature { r: "${this.r}", s: "${this.s}", yParity: ${this.yParity}, networkV: ${this.networkV} }`;
1014
+ getValue(name) {
1015
+ const index = getNames(this).indexOf(name);
1016
+ if (index === -1) return;
1017
+ const value = this[index];
1018
+ if (value instanceof Error) throwError(`property ${JSON.stringify(name)}`, value.error);
1019
+ return value;
1306
1020
  }
1307
1021
  /**
1308
- * Returns a new identical [[Signature]].
1022
+ * Creates a new [[Result]] for %%items%% with each entry
1023
+ * also accessible by its corresponding name in %%keys%%.
1309
1024
  */
1310
- clone() {
1311
- const clone = new Signature(_guard$2, this.r, this.s, this.v);
1312
- if (this.networkV) clone.#networkV = this.networkV;
1313
- return clone;
1025
+ static fromItems(items, keys) {
1026
+ return new Result(_guard$2, items, keys);
1314
1027
  }
1315
- /**
1316
- * Returns a representation that is compatible with ``JSON.stringify``.
1317
- */
1318
- toJSON() {
1319
- const networkV = this.networkV;
1320
- return {
1321
- _type: "signature",
1322
- networkV: networkV != null ? networkV.toString() : null,
1323
- r: this.r,
1324
- s: this.s,
1325
- v: this.v
1028
+ };
1029
+ function getValue$1(value) {
1030
+ let bytes = toBeArray(value);
1031
+ assert(bytes.length <= 32, "value out-of-bounds", "BUFFER_OVERRUN", {
1032
+ buffer: bytes,
1033
+ length: 32,
1034
+ offset: bytes.length
1035
+ });
1036
+ if (bytes.length !== 32) bytes = getBytesCopy(concat([Padding.slice(bytes.length % 32), bytes]));
1037
+ return bytes;
1038
+ }
1039
+ __name(getValue$1, "getValue");
1040
+ /**
1041
+ * @_ignore
1042
+ */
1043
+ var Coder = class {
1044
+ name;
1045
+ type;
1046
+ localName;
1047
+ dynamic;
1048
+ constructor(name, type, localName, dynamic) {
1049
+ defineProperties(this, {
1050
+ name,
1051
+ type,
1052
+ localName,
1053
+ dynamic
1054
+ }, {
1055
+ name: "string",
1056
+ type: "string",
1057
+ localName: "string",
1058
+ dynamic: "boolean"
1059
+ });
1060
+ }
1061
+ _throwError(message, value) {
1062
+ assertArgument(false, message, this.localName, value);
1063
+ }
1064
+ };
1065
+ /**
1066
+ * @_ignore
1067
+ */
1068
+ var Writer = class {
1069
+ #data;
1070
+ #dataLength;
1071
+ constructor() {
1072
+ this.#data = [];
1073
+ this.#dataLength = 0;
1074
+ }
1075
+ get data() {
1076
+ return concat(this.#data);
1077
+ }
1078
+ get length() {
1079
+ return this.#dataLength;
1080
+ }
1081
+ #writeData(data) {
1082
+ this.#data.push(data);
1083
+ this.#dataLength += data.length;
1084
+ return data.length;
1085
+ }
1086
+ appendWriter(writer) {
1087
+ return this.#writeData(getBytesCopy(writer.data));
1088
+ }
1089
+ writeBytes(value) {
1090
+ let bytes = getBytesCopy(value);
1091
+ const paddingOffset = bytes.length % 32;
1092
+ if (paddingOffset) bytes = getBytesCopy(concat([bytes, Padding.slice(paddingOffset)]));
1093
+ return this.#writeData(bytes);
1094
+ }
1095
+ writeValue(value) {
1096
+ return this.#writeData(getValue$1(value));
1097
+ }
1098
+ writeUpdatableValue() {
1099
+ const offset = this.#data.length;
1100
+ this.#data.push(Padding);
1101
+ this.#dataLength += 32;
1102
+ return (value) => {
1103
+ this.#data[offset] = getValue$1(value);
1326
1104
  };
1327
1105
  }
1328
- /**
1329
- * Compute the chain ID from the ``v`` in a legacy EIP-155 transactions.
1330
- *
1331
- * @example:
1332
- * Signature.getChainId(45)
1333
- * //_result:
1334
- *
1335
- * Signature.getChainId(46)
1336
- * //_result:
1337
- */
1338
- static getChainId(v) {
1339
- const bv = getBigInt(v, "v");
1340
- if (bv == BN_27 || bv == BN_28) return BN_0$5;
1341
- assertArgument(bv >= BN_35, "invalid EIP-155 v", "v", v);
1342
- return (bv - BN_35) / BN_2;
1106
+ };
1107
+ /**
1108
+ * @_ignore
1109
+ */
1110
+ var Reader = class Reader {
1111
+ allowLoose;
1112
+ #data;
1113
+ #offset;
1114
+ #bytesRead;
1115
+ #parent;
1116
+ #maxInflation;
1117
+ constructor(data, allowLoose, maxInflation) {
1118
+ defineProperties(this, { allowLoose: !!allowLoose });
1119
+ this.#data = getBytesCopy(data);
1120
+ this.#bytesRead = 0;
1121
+ this.#parent = null;
1122
+ this.#maxInflation = maxInflation != null ? maxInflation : 1024;
1123
+ this.#offset = 0;
1343
1124
  }
1344
- /**
1345
- * Compute the ``v`` for a chain ID for a legacy EIP-155 transactions.
1346
- *
1347
- * Legacy transactions which use [[link-eip-155]] hijack the ``v``
1348
- * property to include the chain ID.
1349
- *
1350
- * @example:
1351
- * Signature.getChainIdV(5, 27)
1352
- * //_result:
1353
- *
1354
- * Signature.getChainIdV(5, 28)
1355
- * //_result:
1356
- *
1357
- */
1358
- static getChainIdV(chainId, v) {
1359
- return getBigInt(chainId) * BN_2 + BigInt(35 + v - 27);
1125
+ get data() {
1126
+ return hexlify(this.#data);
1360
1127
  }
1361
- /**
1362
- * Compute the normalized legacy transaction ``v`` from a ``yParirty``,
1363
- * a legacy transaction ``v`` or a legacy [[link-eip-155]] transaction.
1364
- *
1365
- * @example:
1366
- * // The values 0 and 1 imply v is actually yParity
1367
- * Signature.getNormalizedV(0)
1368
- * //_result:
1369
- *
1370
- * // Legacy non-EIP-1559 transaction (i.e. 27 or 28)
1371
- * Signature.getNormalizedV(27)
1372
- * //_result:
1373
- *
1374
- * // Legacy EIP-155 transaction (i.e. >= 35)
1375
- * Signature.getNormalizedV(46)
1376
- * //_result:
1377
- *
1378
- * // Invalid values throw
1379
- * Signature.getNormalizedV(5)
1380
- * //_error:
1381
- */
1382
- static getNormalizedV(v) {
1383
- const bv = getBigInt(v);
1384
- if (bv === BN_0$5 || bv === BN_27) return 27;
1385
- if (bv === BN_1$1 || bv === BN_28) return 28;
1386
- assertArgument(bv >= BN_35, "invalid v", "v", v);
1387
- return bv & BN_1$1 ? 27 : 28;
1128
+ get dataLength() {
1129
+ return this.#data.length;
1388
1130
  }
1389
- /**
1390
- * Creates a new [[Signature]].
1391
- *
1392
- * If no %%sig%% is provided, a new [[Signature]] is created
1393
- * with default values.
1394
- *
1395
- * If %%sig%% is a string, it is parsed.
1396
- */
1397
- static from(sig) {
1398
- function assertError(check, message) {
1399
- assertArgument(check, message, "signature", sig);
1400
- }
1401
- if (sig == null) return new Signature(_guard$2, ZeroHash, ZeroHash, 27);
1402
- if (typeof sig === "string") {
1403
- const bytes = getBytes(sig, "signature");
1404
- if (bytes.length === 64) {
1405
- const r = hexlify(bytes.slice(0, 32));
1406
- const s = bytes.slice(32, 64);
1407
- const v = s[0] & 128 ? 28 : 27;
1408
- s[0] &= 127;
1409
- return new Signature(_guard$2, r, hexlify(s), v);
1410
- }
1411
- if (bytes.length === 65) {
1412
- const r = hexlify(bytes.slice(0, 32));
1413
- const s = bytes.slice(32, 64);
1414
- assertError((s[0] & 128) === 0, "non-canonical s");
1415
- const v = Signature.getNormalizedV(bytes[64]);
1416
- return new Signature(_guard$2, r, hexlify(s), v);
1417
- }
1418
- assertError(false, "invalid raw signature length");
1419
- }
1420
- if (sig instanceof Signature) return sig.clone();
1421
- const _r = sig.r;
1422
- assertError(_r != null, "missing r");
1423
- const r = toUint256(_r);
1424
- const s = (function(s, yParityAndS) {
1425
- if (s != null) return toUint256(s);
1426
- if (yParityAndS != null) {
1427
- assertError(isHexString(yParityAndS, 32), "invalid yParityAndS");
1428
- const bytes = getBytes(yParityAndS);
1429
- bytes[0] &= 127;
1430
- return hexlify(bytes);
1431
- }
1432
- assertError(false, "missing s");
1433
- })(sig.s, sig.yParityAndS);
1434
- assertError((getBytes(s)[0] & 128) == 0, "non-canonical s");
1435
- const { networkV, v } = (function(_v, yParityAndS, yParity) {
1436
- if (_v != null) {
1437
- const v = getBigInt(_v);
1438
- return {
1439
- networkV: v >= BN_35 ? v : void 0,
1440
- v: Signature.getNormalizedV(v)
1441
- };
1442
- }
1443
- if (yParityAndS != null) {
1444
- assertError(isHexString(yParityAndS, 32), "invalid yParityAndS");
1445
- return { v: getBytes(yParityAndS)[0] & 128 ? 28 : 27 };
1446
- }
1447
- if (yParity != null) {
1448
- switch (getNumber(yParity, "sig.yParity")) {
1449
- case 0: return { v: 27 };
1450
- case 1: return { v: 28 };
1451
- }
1452
- assertError(false, "invalid yParity");
1131
+ get consumed() {
1132
+ return this.#offset;
1133
+ }
1134
+ get bytes() {
1135
+ return new Uint8Array(this.#data);
1136
+ }
1137
+ #incrementBytesRead(count) {
1138
+ if (this.#parent) return this.#parent.#incrementBytesRead(count);
1139
+ this.#bytesRead += count;
1140
+ assert(this.#maxInflation < 1 || this.#bytesRead <= this.#maxInflation * this.dataLength, `compressed ABI data exceeds inflation ratio of ${this.#maxInflation} ( see: https:/\/github.com/ethers-io/ethers.js/issues/4537 )`, "BUFFER_OVERRUN", {
1141
+ buffer: getBytesCopy(this.#data),
1142
+ offset: this.#offset,
1143
+ length: count,
1144
+ info: {
1145
+ bytesRead: this.#bytesRead,
1146
+ dataLength: this.dataLength
1453
1147
  }
1454
- assertError(false, "missing v");
1455
- })(sig.v, sig.yParityAndS, sig.yParity);
1456
- const result = new Signature(_guard$2, r, s, v);
1457
- if (networkV) result.#networkV = networkV;
1458
- assertError(sig.yParity == null || getNumber(sig.yParity, "sig.yParity") === result.yParity, "yParity mismatch");
1459
- assertError(sig.yParityAndS == null || sig.yParityAndS === result.yParityAndS, "yParityAndS mismatch");
1460
- return result;
1148
+ });
1149
+ }
1150
+ #peekBytes(offset, length, loose) {
1151
+ let alignedLength = Math.ceil(length / 32) * 32;
1152
+ if (this.#offset + alignedLength > this.#data.length) if (this.allowLoose && loose && this.#offset + length <= this.#data.length) alignedLength = length;
1153
+ else assert(false, "data out-of-bounds", "BUFFER_OVERRUN", {
1154
+ buffer: getBytesCopy(this.#data),
1155
+ length: this.#data.length,
1156
+ offset: this.#offset + alignedLength
1157
+ });
1158
+ return this.#data.slice(this.#offset, this.#offset + alignedLength);
1159
+ }
1160
+ subReader(offset) {
1161
+ const reader = new Reader(this.#data.slice(this.#offset + offset), this.allowLoose, this.#maxInflation);
1162
+ reader.#parent = this;
1163
+ return reader;
1164
+ }
1165
+ readBytes(length, loose) {
1166
+ let bytes = this.#peekBytes(0, length, !!loose);
1167
+ this.#incrementBytesRead(length);
1168
+ this.#offset += bytes.length;
1169
+ return bytes.slice(0, length);
1170
+ }
1171
+ readValue() {
1172
+ return toBigInt(this.readBytes(32));
1173
+ }
1174
+ readIndex() {
1175
+ return toNumber(this.readBytes(32));
1176
+ }
1177
+ };
1178
+
1179
+ //#endregion
1180
+ //#region ../../node_modules/.pnpm/@noble+hashes@1.3.2/node_modules/@noble/hashes/esm/_assert.js
1181
+ function number(n) {
1182
+ if (!Number.isSafeInteger(n) || n < 0) throw new Error(`Wrong positive integer: ${n}`);
1183
+ }
1184
+ function bytes(b, ...lengths) {
1185
+ if (!(b instanceof Uint8Array)) throw new Error("Expected Uint8Array");
1186
+ if (lengths.length > 0 && !lengths.includes(b.length)) throw new Error(`Expected Uint8Array of length ${lengths}, not of length=${b.length}`);
1187
+ }
1188
+ function hash(hash) {
1189
+ if (typeof hash !== "function" || typeof hash.create !== "function") throw new Error("Hash should be wrapped by utils.wrapConstructor");
1190
+ number(hash.outputLen);
1191
+ number(hash.blockLen);
1192
+ }
1193
+ function exists(instance, checkFinished = true) {
1194
+ if (instance.destroyed) throw new Error("Hash instance has been destroyed");
1195
+ if (checkFinished && instance.finished) throw new Error("Hash#digest() has already been called");
1196
+ }
1197
+ function output(out, instance) {
1198
+ bytes(out);
1199
+ const min = instance.outputLen;
1200
+ if (out.length < min) throw new Error(`digestInto() expects output buffer of length at least ${min}`);
1201
+ }
1202
+
1203
+ //#endregion
1204
+ //#region ../../node_modules/.pnpm/@noble+hashes@1.3.2/node_modules/@noble/hashes/esm/_u64.js
1205
+ const U32_MASK64 = /* @__PURE__ */ BigInt(2 ** 32 - 1);
1206
+ const _32n = /* @__PURE__ */ BigInt(32);
1207
+ function fromBig(n, le = false) {
1208
+ if (le) return {
1209
+ h: Number(n & U32_MASK64),
1210
+ l: Number(n >> _32n & U32_MASK64)
1211
+ };
1212
+ return {
1213
+ h: Number(n >> _32n & U32_MASK64) | 0,
1214
+ l: Number(n & U32_MASK64) | 0
1215
+ };
1216
+ }
1217
+ function split(lst, le = false) {
1218
+ let Ah = new Uint32Array(lst.length);
1219
+ let Al = new Uint32Array(lst.length);
1220
+ for (let i = 0; i < lst.length; i++) {
1221
+ const { h, l } = fromBig(lst[i], le);
1222
+ [Ah[i], Al[i]] = [h, l];
1461
1223
  }
1462
- };
1224
+ return [Ah, Al];
1225
+ }
1226
+ const rotlSH = (h, l, s) => h << s | l >>> 32 - s;
1227
+ const rotlSL = (h, l, s) => l << s | h >>> 32 - s;
1228
+ const rotlBH = (h, l, s) => l << s - 32 | h >>> 64 - s;
1229
+ const rotlBL = (h, l, s) => h << s - 32 | l >>> 64 - s;
1463
1230
 
1464
1231
  //#endregion
1465
- //#region ../../node_modules/.pnpm/@sentio+ethers@6.13.1-patch.6_bufferutil@4.0.8_utf-8-validate@5.0.10/node_modules/@sentio/ethers/lib.esm/address/address.js
1466
- const BN_0$4 = BigInt(0);
1467
- const BN_36 = BigInt(36);
1468
- function getChecksumAddress(address) {
1469
- address = address.toLowerCase();
1470
- const chars = address.substring(2).split("");
1471
- const expanded = /* @__PURE__ */ new Uint8Array(40);
1472
- for (let i = 0; i < 40; i++) expanded[i] = chars[i].charCodeAt(0);
1473
- const hashed = getBytes(keccak256(expanded));
1474
- for (let i = 0; i < 40; i += 2) {
1475
- if (hashed[i >> 1] >> 4 >= 8) chars[i] = chars[i].toUpperCase();
1476
- if ((hashed[i >> 1] & 15) >= 8) chars[i + 1] = chars[i + 1].toUpperCase();
1477
- }
1478
- return "0x" + chars.join("");
1232
+ //#region ../../node_modules/.pnpm/@noble+hashes@1.3.2/node_modules/@noble/hashes/esm/cryptoNode.js
1233
+ const crypto$1 = nc && typeof nc === "object" && "webcrypto" in nc ? nc.webcrypto : void 0;
1234
+
1235
+ //#endregion
1236
+ //#region ../../node_modules/.pnpm/@noble+hashes@1.3.2/node_modules/@noble/hashes/esm/utils.js
1237
+ /*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
1238
+ const u8a = (a) => a instanceof Uint8Array;
1239
+ const u32 = (arr) => new Uint32Array(arr.buffer, arr.byteOffset, Math.floor(arr.byteLength / 4));
1240
+ const createView = (arr) => new DataView(arr.buffer, arr.byteOffset, arr.byteLength);
1241
+ const rotr = (word, shift) => word << 32 - shift | word >>> shift;
1242
+ const isLE = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68;
1243
+ if (!isLE) throw new Error("Non little-endian hardware is not supported");
1244
+ /**
1245
+ * @example utf8ToBytes('abc') // new Uint8Array([97, 98, 99])
1246
+ */
1247
+ function utf8ToBytes(str) {
1248
+ if (typeof str !== "string") throw new Error(`utf8ToBytes expected string, got ${typeof str}`);
1249
+ return new Uint8Array(new TextEncoder().encode(str));
1479
1250
  }
1480
- const ibanLookup = {};
1481
- for (let i = 0; i < 10; i++) ibanLookup[String(i)] = String(i);
1482
- for (let i = 0; i < 26; i++) ibanLookup[String.fromCharCode(65 + i)] = String(10 + i);
1483
- const safeDigits = 15;
1484
- function ibanChecksum(address) {
1485
- address = address.toUpperCase();
1486
- address = address.substring(4) + address.substring(0, 2) + "00";
1487
- let expanded = address.split("").map((c) => {
1488
- return ibanLookup[c];
1489
- }).join("");
1490
- while (expanded.length >= safeDigits) {
1491
- let block = expanded.substring(0, safeDigits);
1492
- expanded = parseInt(block, 10) % 97 + expanded.substring(block.length);
1493
- }
1494
- let checksum = String(98 - parseInt(expanded, 10) % 97);
1495
- while (checksum.length < 2) checksum = "0" + checksum;
1496
- return checksum;
1251
+ /**
1252
+ * Normalizes (non-hex) string or Uint8Array to Uint8Array.
1253
+ * Warning: when Uint8Array is passed, it would NOT get copied.
1254
+ * Keep in mind for future mutable operations.
1255
+ */
1256
+ function toBytes(data) {
1257
+ if (typeof data === "string") data = utf8ToBytes(data);
1258
+ if (!u8a(data)) throw new Error(`expected Uint8Array, got ${typeof data}`);
1259
+ return data;
1497
1260
  }
1498
- const Base36 = (function() {
1499
- const result = {};
1500
- for (let i = 0; i < 36; i++) {
1501
- const key = "0123456789abcdefghijklmnopqrstuvwxyz"[i];
1502
- result[key] = BigInt(i);
1261
+ /**
1262
+ * Copies several Uint8Arrays into one.
1263
+ */
1264
+ function concatBytes(...arrays) {
1265
+ const r = new Uint8Array(arrays.reduce((sum, a) => sum + a.length, 0));
1266
+ let pad = 0;
1267
+ arrays.forEach((a) => {
1268
+ if (!u8a(a)) throw new Error("Uint8Array expected");
1269
+ r.set(a, pad);
1270
+ pad += a.length;
1271
+ });
1272
+ return r;
1273
+ }
1274
+ var Hash = class {
1275
+ clone() {
1276
+ return this._cloneInto();
1503
1277
  }
1504
- return result;
1505
- })();
1506
- function fromBase36(value) {
1507
- value = value.toLowerCase();
1508
- let result = BN_0$4;
1509
- for (let i = 0; i < value.length; i++) result = result * BN_36 + Base36[value[i]];
1510
- return result;
1278
+ };
1279
+ const toStr = {}.toString;
1280
+ function wrapConstructor(hashCons) {
1281
+ const hashC = (msg) => hashCons().update(toBytes(msg)).digest();
1282
+ const tmp = hashCons();
1283
+ hashC.outputLen = tmp.outputLen;
1284
+ hashC.blockLen = tmp.blockLen;
1285
+ hashC.create = () => hashCons();
1286
+ return hashC;
1511
1287
  }
1512
1288
  /**
1513
- * Returns a normalized and checksumed address for %%address%%.
1514
- * This accepts non-checksum addresses, checksum addresses and
1515
- * [[getIcapAddress]] formats.
1516
- *
1517
- * The checksum in Ethereum uses the capitalization (upper-case
1518
- * vs lower-case) of the characters within an address to encode
1519
- * its checksum, which offers, on average, a checksum of 15-bits.
1520
- *
1521
- * If %%address%% contains both upper-case and lower-case, it is
1522
- * assumed to already be a checksum address and its checksum is
1523
- * validated, and if the address fails its expected checksum an
1524
- * error is thrown.
1525
- *
1526
- * If you wish the checksum of %%address%% to be ignore, it should
1527
- * be converted to lower-case (i.e. ``.toLowercase()``) before
1528
- * being passed in. This should be a very rare situation though,
1529
- * that you wish to bypass the safegaurds in place to protect
1530
- * against an address that has been incorrectly copied from another
1531
- * source.
1532
- *
1533
- * @example:
1534
- * // Adds the checksum (via upper-casing specific letters)
1535
- * getAddress("0x8ba1f109551bd432803012645ac136ddd64dba72")
1536
- * //_result:
1537
- *
1538
- * // Converts ICAP address and adds checksum
1539
- * getAddress("XE65GB6LDNXYOFTX0NSV3FUWKOWIXAMJK36");
1540
- * //_result:
1541
- *
1542
- * // Throws an error if an address contains mixed case,
1543
- * // but the checksum fails
1544
- * getAddress("0x8Ba1f109551bD432803012645Ac136ddd64DBA72")
1545
- * //_error:
1289
+ * Secure PRNG. Uses `crypto.getRandomValues`, which defers to OS.
1546
1290
  */
1547
- function getAddress(address) {
1548
- assertArgument(typeof address === "string", "invalid address", "address", address);
1549
- if (address.match(/^(0x)?[0-9a-fA-F]{40}$/)) {
1550
- if (!address.startsWith("0x")) address = "0x" + address;
1551
- const result = getChecksumAddress(address);
1552
- assertArgument(!address.match(/([A-F].*[a-f])|([a-f].*[A-F])/) || result === address, "bad address checksum", "address", address);
1553
- return result;
1291
+ function randomBytes(bytesLength = 32) {
1292
+ if (crypto$1 && typeof crypto$1.getRandomValues === "function") return crypto$1.getRandomValues(new Uint8Array(bytesLength));
1293
+ throw new Error("crypto.getRandomValues must be defined");
1294
+ }
1295
+
1296
+ //#endregion
1297
+ //#region ../../node_modules/.pnpm/@noble+hashes@1.3.2/node_modules/@noble/hashes/esm/sha3.js
1298
+ const [SHA3_PI, SHA3_ROTL, _SHA3_IOTA] = [
1299
+ [],
1300
+ [],
1301
+ []
1302
+ ];
1303
+ const _0n = /* @__PURE__ */ BigInt(0);
1304
+ const _1n = /* @__PURE__ */ BigInt(1);
1305
+ const _2n = /* @__PURE__ */ BigInt(2);
1306
+ const _7n = /* @__PURE__ */ BigInt(7);
1307
+ const _256n = /* @__PURE__ */ BigInt(256);
1308
+ const _0x71n = /* @__PURE__ */ BigInt(113);
1309
+ for (let round = 0, R = _1n, x = 1, y = 0; round < 24; round++) {
1310
+ [x, y] = [y, (2 * x + 3 * y) % 5];
1311
+ SHA3_PI.push(2 * (5 * y + x));
1312
+ SHA3_ROTL.push((round + 1) * (round + 2) / 2 % 64);
1313
+ let t = _0n;
1314
+ for (let j = 0; j < 7; j++) {
1315
+ R = (R << _1n ^ (R >> _7n) * _0x71n) % _256n;
1316
+ if (R & _2n) t ^= _1n << (_1n << /* @__PURE__ */ BigInt(j)) - _1n;
1317
+ }
1318
+ _SHA3_IOTA.push(t);
1319
+ }
1320
+ const [SHA3_IOTA_H, SHA3_IOTA_L] = /* @__PURE__ */ split(_SHA3_IOTA, true);
1321
+ const rotlH = (h, l, s) => s > 32 ? rotlBH(h, l, s) : rotlSH(h, l, s);
1322
+ const rotlL = (h, l, s) => s > 32 ? rotlBL(h, l, s) : rotlSL(h, l, s);
1323
+ function keccakP(s, rounds = 24) {
1324
+ const B = /* @__PURE__ */ new Uint32Array(10);
1325
+ for (let round = 24 - rounds; round < 24; round++) {
1326
+ for (let x = 0; x < 10; x++) B[x] = s[x] ^ s[x + 10] ^ s[x + 20] ^ s[x + 30] ^ s[x + 40];
1327
+ for (let x = 0; x < 10; x += 2) {
1328
+ const idx1 = (x + 8) % 10;
1329
+ const idx0 = (x + 2) % 10;
1330
+ const B0 = B[idx0];
1331
+ const B1 = B[idx0 + 1];
1332
+ const Th = rotlH(B0, B1, 1) ^ B[idx1];
1333
+ const Tl = rotlL(B0, B1, 1) ^ B[idx1 + 1];
1334
+ for (let y = 0; y < 50; y += 10) {
1335
+ s[x + y] ^= Th;
1336
+ s[x + y + 1] ^= Tl;
1337
+ }
1338
+ }
1339
+ let curH = s[2];
1340
+ let curL = s[3];
1341
+ for (let t = 0; t < 24; t++) {
1342
+ const shift = SHA3_ROTL[t];
1343
+ const Th = rotlH(curH, curL, shift);
1344
+ const Tl = rotlL(curH, curL, shift);
1345
+ const PI = SHA3_PI[t];
1346
+ curH = s[PI];
1347
+ curL = s[PI + 1];
1348
+ s[PI] = Th;
1349
+ s[PI + 1] = Tl;
1350
+ }
1351
+ for (let y = 0; y < 50; y += 10) {
1352
+ for (let x = 0; x < 10; x++) B[x] = s[y + x];
1353
+ for (let x = 0; x < 10; x++) s[y + x] ^= ~B[(x + 2) % 10] & B[(x + 4) % 10];
1354
+ }
1355
+ s[0] ^= SHA3_IOTA_H[round];
1356
+ s[1] ^= SHA3_IOTA_L[round];
1357
+ }
1358
+ B.fill(0);
1359
+ }
1360
+ var Keccak = class Keccak extends Hash {
1361
+ constructor(blockLen, suffix, outputLen, enableXOF = false, rounds = 24) {
1362
+ super();
1363
+ this.blockLen = blockLen;
1364
+ this.suffix = suffix;
1365
+ this.outputLen = outputLen;
1366
+ this.enableXOF = enableXOF;
1367
+ this.rounds = rounds;
1368
+ this.pos = 0;
1369
+ this.posOut = 0;
1370
+ this.finished = false;
1371
+ this.destroyed = false;
1372
+ number(outputLen);
1373
+ if (0 >= this.blockLen || this.blockLen >= 200) throw new Error("Sha3 supports only keccak-f1600 function");
1374
+ this.state = /* @__PURE__ */ new Uint8Array(200);
1375
+ this.state32 = u32(this.state);
1376
+ }
1377
+ keccak() {
1378
+ keccakP(this.state32, this.rounds);
1379
+ this.posOut = 0;
1380
+ this.pos = 0;
1381
+ }
1382
+ update(data) {
1383
+ exists(this);
1384
+ const { blockLen, state } = this;
1385
+ data = toBytes(data);
1386
+ const len = data.length;
1387
+ for (let pos = 0; pos < len;) {
1388
+ const take = Math.min(blockLen - this.pos, len - pos);
1389
+ for (let i = 0; i < take; i++) state[this.pos++] ^= data[pos++];
1390
+ if (this.pos === blockLen) this.keccak();
1391
+ }
1392
+ return this;
1554
1393
  }
1555
- if (address.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)) {
1556
- assertArgument(address.substring(2, 4) === ibanChecksum(address), "bad icap checksum", "address", address);
1557
- let result = fromBase36(address.substring(4)).toString(16);
1558
- while (result.length < 40) result = "0" + result;
1559
- return getChecksumAddress("0x" + result);
1394
+ finish() {
1395
+ if (this.finished) return;
1396
+ this.finished = true;
1397
+ const { state, suffix, pos, blockLen } = this;
1398
+ state[pos] ^= suffix;
1399
+ if ((suffix & 128) !== 0 && pos === blockLen - 1) this.keccak();
1400
+ state[blockLen - 1] ^= 128;
1401
+ this.keccak();
1560
1402
  }
1561
- assertArgument(false, "invalid address", "address", address);
1562
- }
1563
-
1564
- //#endregion
1565
- //#region ../../node_modules/.pnpm/@sentio+ethers@6.13.1-patch.6_bufferutil@4.0.8_utf-8-validate@5.0.10/node_modules/@sentio/ethers/lib.esm/address/contract-address.js
1403
+ writeInto(out) {
1404
+ exists(this, false);
1405
+ bytes(out);
1406
+ this.finish();
1407
+ const bufferOut = this.state;
1408
+ const { blockLen } = this;
1409
+ for (let pos = 0, len = out.length; pos < len;) {
1410
+ if (this.posOut >= blockLen) this.keccak();
1411
+ const take = Math.min(blockLen - this.posOut, len - pos);
1412
+ out.set(bufferOut.subarray(this.posOut, this.posOut + take), pos);
1413
+ this.posOut += take;
1414
+ pos += take;
1415
+ }
1416
+ return out;
1417
+ }
1418
+ xofInto(out) {
1419
+ if (!this.enableXOF) throw new Error("XOF is not possible for this instance");
1420
+ return this.writeInto(out);
1421
+ }
1422
+ xof(bytes) {
1423
+ number(bytes);
1424
+ return this.xofInto(new Uint8Array(bytes));
1425
+ }
1426
+ digestInto(out) {
1427
+ output(out, this);
1428
+ if (this.finished) throw new Error("digest() was already called");
1429
+ this.writeInto(out);
1430
+ this.destroy();
1431
+ return out;
1432
+ }
1433
+ digest() {
1434
+ return this.digestInto(new Uint8Array(this.outputLen));
1435
+ }
1436
+ destroy() {
1437
+ this.destroyed = true;
1438
+ this.state.fill(0);
1439
+ }
1440
+ _cloneInto(to) {
1441
+ const { blockLen, suffix, outputLen, rounds, enableXOF } = this;
1442
+ to || (to = new Keccak(blockLen, suffix, outputLen, enableXOF, rounds));
1443
+ to.state32.set(this.state32);
1444
+ to.pos = this.pos;
1445
+ to.posOut = this.posOut;
1446
+ to.finished = this.finished;
1447
+ to.rounds = rounds;
1448
+ to.suffix = suffix;
1449
+ to.outputLen = outputLen;
1450
+ to.enableXOF = enableXOF;
1451
+ to.destroyed = this.destroyed;
1452
+ return to;
1453
+ }
1454
+ };
1455
+ const gen = (suffix, blockLen, outputLen) => wrapConstructor(() => new Keccak(blockLen, suffix, outputLen));
1566
1456
  /**
1567
- * Returns the address that would result from a ``CREATE`` for %%tx%%.
1568
- *
1569
- * This can be used to compute the address a contract will be
1570
- * deployed to by an EOA when sending a deployment transaction (i.e.
1571
- * when the ``to`` address is ``null``).
1572
- *
1573
- * This can also be used to compute the address a contract will be
1574
- * deployed to by a contract, by using the contract's address as the
1575
- * ``to`` and the contract's nonce.
1576
- *
1577
- * @example
1578
- * from = "0x8ba1f109551bD432803012645Ac136ddd64DBA72";
1579
- * nonce = 5;
1580
- *
1581
- * getCreateAddress({ from, nonce });
1582
- * //_result:
1457
+ * keccak-256 hash function. Different from SHA3-256.
1458
+ * @param message - that would be hashed
1583
1459
  */
1584
- function getCreateAddress(tx) {
1585
- const from = getAddress(tx.from);
1586
- let nonceHex = getBigInt(tx.nonce, "tx.nonce").toString(16);
1587
- if (nonceHex === "0") nonceHex = "0x";
1588
- else if (nonceHex.length % 2) nonceHex = "0x0" + nonceHex;
1589
- else nonceHex = "0x" + nonceHex;
1590
- return getAddress(dataSlice(keccak256(encodeRlp([from, nonceHex])), 12));
1591
- }
1460
+ const keccak_256 = /* @__PURE__ */ gen(1, 136, 256 / 8);
1592
1461
 
1593
1462
  //#endregion
1594
- //#region ../../node_modules/.pnpm/@sentio+ethers@6.13.1-patch.6_bufferutil@4.0.8_utf-8-validate@5.0.10/node_modules/@sentio/ethers/lib.esm/address/checks.js
1463
+ //#region ../../node_modules/.pnpm/ethers@6.17.0_bufferutil@4.0.8_utf-8-validate@5.0.10/node_modules/ethers/lib.esm/crypto/keccak.js
1595
1464
  /**
1596
- * Returns true if %%value%% is an object which implements the
1597
- * [[Addressable]] interface.
1598
- *
1599
- * @example:
1600
- * // Wallets and AbstractSigner sub-classes
1601
- * isAddressable(Wallet.createRandom())
1602
- * //_result:
1465
+ * Cryptographic hashing functions
1603
1466
  *
1604
- * // Contracts
1605
- * contract = new Contract("dai.tokens.ethers.eth", [ ], provider)
1606
- * isAddressable(contract)
1607
- * //_result:
1467
+ * @_subsection: api/crypto:Hash Functions [about-crypto-hashing]
1608
1468
  */
1609
- function isAddressable(value) {
1610
- return value && typeof value.getAddress === "function";
1611
- }
1612
- async function checkAddress(target, promise) {
1613
- const result = await promise;
1614
- if (result == null || result === "0x0000000000000000000000000000000000000000") {
1615
- assert(typeof target !== "string", "unconfigured name", "UNCONFIGURED_NAME", { value: target });
1616
- assertArgument(false, "invalid AddressLike value; did not resolve to a value address", "target", target);
1617
- }
1618
- return getAddress(result);
1619
- }
1469
+ let locked = false;
1470
+ const _keccak256 = function(data) {
1471
+ return keccak_256(data);
1472
+ };
1473
+ let __keccak256 = _keccak256;
1620
1474
  /**
1621
- * Resolves to an address for the %%target%%, which may be any
1622
- * supported address type, an [[Addressable]] or a Promise which
1623
- * resolves to an address.
1475
+ * Compute the cryptographic KECCAK256 hash of %%data%%.
1624
1476
  *
1625
- * If an ENS name is provided, but that name has not been correctly
1626
- * configured a [[UnconfiguredNameError]] is thrown.
1477
+ * The %%data%% **must** be a data representation, to compute the
1478
+ * hash of UTF-8 data use the [[id]] function.
1627
1479
  *
1480
+ * @returns DataHexstring
1628
1481
  * @example:
1629
- * addr = "0x6B175474E89094C44Da98b954EedeAC495271d0F"
1630
- *
1631
- * // Addresses are return synchronously
1632
- * resolveAddress(addr, provider)
1633
- * //_result:
1634
- *
1635
- * // Address promises are resolved asynchronously
1636
- * resolveAddress(Promise.resolve(addr))
1482
+ * keccak256("0x")
1637
1483
  * //_result:
1638
1484
  *
1639
- * // ENS names are resolved asynchronously
1640
- * resolveAddress("dai.tokens.ethers.eth", provider)
1485
+ * keccak256("0x1337")
1641
1486
  * //_result:
1642
1487
  *
1643
- * // Addressable objects are resolved asynchronously
1644
- * contract = new Contract(addr, [ ])
1645
- * resolveAddress(contract, provider)
1488
+ * keccak256(new Uint8Array([ 0x13, 0x37 ]))
1646
1489
  * //_result:
1647
1490
  *
1648
- * // Unconfigured ENS names reject
1649
- * resolveAddress("nothing-here.ricmoo.eth", provider)
1650
- * //_error:
1651
- *
1652
- * // ENS names require a NameResolver object passed in
1653
- * // (notice the provider was omitted)
1654
- * resolveAddress("nothing-here.ricmoo.eth")
1491
+ * // Strings are assumed to be DataHexString, otherwise it will
1492
+ * // throw. To hash UTF-8 data, see the note above.
1493
+ * keccak256("Hello World")
1655
1494
  * //_error:
1656
1495
  */
1657
- function resolveAddress(target, resolver) {
1658
- if (typeof target === "string") {
1659
- if (target.match(/^0x[0-9a-f]{40}$/i)) return getAddress(target);
1660
- assert(resolver != null, "ENS resolution requires a provider", "UNSUPPORTED_OPERATION", { operation: "resolveName" });
1661
- return checkAddress(target, resolver.resolveName(target));
1662
- } else if (isAddressable(target)) return checkAddress(target, target.getAddress());
1663
- else if (target && typeof target.then === "function") return checkAddress(target, target);
1664
- assertArgument(false, "unsupported addressable value", "target", target);
1496
+ function keccak256(_data) {
1497
+ const data = getBytes(_data, "data");
1498
+ return hexlify(__keccak256(data));
1665
1499
  }
1500
+ keccak256._ = _keccak256;
1501
+ keccak256.lock = function() {
1502
+ locked = true;
1503
+ };
1504
+ keccak256.register = function(func) {
1505
+ if (locked) throw new TypeError("keccak256 is locked");
1506
+ __keccak256 = func;
1507
+ };
1508
+ Object.freeze(keccak256);
1666
1509
 
1667
1510
  //#endregion
1668
- //#region ../../node_modules/.pnpm/@sentio+ethers@6.13.1-patch.6_bufferutil@4.0.8_utf-8-validate@5.0.10/node_modules/@sentio/ethers/lib.esm/transaction/accesslist.js
1669
- function accessSetify(addr, storageKeys) {
1670
- return {
1671
- address: getAddress(addr),
1672
- storageKeys: storageKeys.map((storageKey, index) => {
1673
- assertArgument(isHexString(storageKey, 32), "invalid slot", `storageKeys[${index}]`, storageKey);
1674
- return storageKey.toLowerCase();
1675
- })
1676
- };
1677
- }
1511
+ //#region ../../node_modules/.pnpm/ethers@6.17.0_bufferutil@4.0.8_utf-8-validate@5.0.10/node_modules/ethers/lib.esm/constants/hashes.js
1678
1512
  /**
1679
- * Returns a [[AccessList]] from any ethers-supported access-list structure.
1513
+ * A constant for the zero hash.
1514
+ *
1515
+ * (**i.e.** ``"0x0000000000000000000000000000000000000000000000000000000000000000"``)
1680
1516
  */
1681
- function accessListify(value) {
1682
- if (Array.isArray(value)) return value.map((set, index) => {
1683
- if (Array.isArray(set)) {
1684
- assertArgument(set.length === 2, "invalid slot set", `value[${index}]`, set);
1685
- return accessSetify(set[0], set[1]);
1686
- }
1687
- assertArgument(set != null && typeof set === "object", "invalid address-slot set", "value", value);
1688
- return accessSetify(set.address, set.storageKeys);
1689
- });
1690
- assertArgument(value != null && typeof value === "object", "invalid access list", "value", value);
1691
- const result = Object.keys(value).map((addr) => {
1692
- const storageKeys = value[addr].reduce((accum, storageKey) => {
1693
- accum[storageKey] = true;
1694
- return accum;
1695
- }, {});
1696
- return accessSetify(addr, Object.keys(storageKeys).sort());
1697
- });
1698
- result.sort((a, b) => a.address.localeCompare(b.address));
1699
- return result;
1700
- }
1517
+ const ZeroHash = "0x0000000000000000000000000000000000000000000000000000000000000000";
1701
1518
 
1702
1519
  //#endregion
1703
- //#region ../../node_modules/.pnpm/@sentio+ethers@6.13.1-patch.6_bufferutil@4.0.8_utf-8-validate@5.0.10/node_modules/@sentio/ethers/lib.esm/abi/coders/abstract-coder.js
1704
- /**
1705
- * @_ignore:
1706
- */
1707
- const WordSize = 32;
1708
- const Padding = new Uint8Array(32);
1709
- const passProperties$1 = ["then"];
1520
+ //#region ../../node_modules/.pnpm/ethers@6.17.0_bufferutil@4.0.8_utf-8-validate@5.0.10/node_modules/ethers/lib.esm/crypto/signature.js
1521
+ const BN_0$4 = BigInt(0);
1522
+ const BN_1$1 = BigInt(1);
1523
+ const BN_2 = BigInt(2);
1524
+ const BN_27 = BigInt(27);
1525
+ const BN_28 = BigInt(28);
1526
+ const BN_35 = BigInt(35);
1527
+ const BN_N = BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141");
1528
+ const BN_N_2 = BN_N / BN_2;
1529
+ const inspect = Symbol.for("nodejs.util.inspect.custom");
1710
1530
  const _guard$1 = {};
1711
- const resultNames = /* @__PURE__ */ new WeakMap();
1712
- function getNames(result) {
1713
- return resultNames.get(result);
1714
- }
1715
- function setNames(result, names) {
1716
- resultNames.set(result, names);
1717
- }
1718
- function throwError(name, error) {
1719
- const wrapped = /* @__PURE__ */ new Error(`deferred error during ABI decoding triggered accessing ${name}`);
1720
- wrapped.error = error;
1721
- throw wrapped;
1722
- }
1723
- function toObject(names, items, deep) {
1724
- if (names.indexOf(null) >= 0) return items.map((item, index) => {
1725
- if (item instanceof Result) return toObject(getNames(item), item, deep);
1726
- return item;
1727
- });
1728
- return names.reduce((accum, name, index) => {
1729
- let item = items.getValue(name);
1730
- if (!(name in accum)) {
1731
- if (deep && item instanceof Result) item = toObject(getNames(item), item, deep);
1732
- accum[name] = item;
1733
- }
1734
- return accum;
1735
- }, {});
1531
+ function toUint256(value) {
1532
+ return zeroPadValue(toBeArray(value), 32);
1736
1533
  }
1737
1534
  /**
1738
- * A [[Result]] is a sub-class of Array, which allows accessing any
1739
- * of its values either positionally by its index or, if keys are
1740
- * provided by its name.
1535
+ * A Signature @TODO
1741
1536
  *
1742
- * @_docloc: api/abi
1537
+ *
1538
+ * @_docloc: api/crypto:Signing
1743
1539
  */
1744
- var Result = class Result extends Array {
1745
- #names;
1540
+ var Signature = class Signature {
1541
+ #r;
1542
+ #s;
1543
+ #v;
1544
+ #networkV;
1746
1545
  /**
1747
- * @private
1546
+ * The ``r`` value for a signature.
1547
+ *
1548
+ * This represents the ``x`` coordinate of a "reference" or
1549
+ * challenge point, from which the ``y`` can be computed.
1748
1550
  */
1749
- constructor(...args) {
1750
- const guard = args[0];
1751
- let items = args[1];
1752
- let names = (args[2] || []).slice();
1753
- let wrap = true;
1754
- if (guard !== _guard$1) {
1755
- items = args;
1756
- names = [];
1757
- wrap = false;
1758
- }
1759
- super(items.length);
1760
- items.forEach((item, index) => {
1761
- this[index] = item;
1762
- });
1763
- const nameCounts = names.reduce((accum, name) => {
1764
- if (typeof name === "string") accum.set(name, (accum.get(name) || 0) + 1);
1765
- return accum;
1766
- }, /* @__PURE__ */ new Map());
1767
- setNames(this, Object.freeze(items.map((item, index) => {
1768
- const name = names[index];
1769
- if (name != null && nameCounts.get(name) === 1) return name;
1770
- return null;
1771
- })));
1772
- this.#names = [];
1773
- if (this.#names == null) this.#names;
1774
- if (!wrap) return;
1775
- Object.freeze(this);
1776
- const proxy = new Proxy(this, { get: (target, prop, receiver) => {
1777
- if (typeof prop === "string") {
1778
- if (prop.match(/^[0-9]+$/)) {
1779
- const index = getNumber(prop, "%index");
1780
- if (index < 0 || index >= this.length) throw new RangeError("out of result range");
1781
- const item = target[index];
1782
- if (item instanceof Error) throwError(`index ${index}`, item);
1783
- return item;
1784
- }
1785
- if (passProperties$1.indexOf(prop) >= 0) return Reflect.get(target, prop, receiver);
1786
- const value = target[prop];
1787
- if (value instanceof Function) return function(...args) {
1788
- return value.apply(this === receiver ? target : this, args);
1789
- };
1790
- else if (!(prop in target)) return target.getValue.apply(this === receiver ? target : this, [prop]);
1791
- }
1792
- return Reflect.get(target, prop, receiver);
1793
- } });
1794
- setNames(proxy, getNames(this));
1795
- return proxy;
1551
+ get r() {
1552
+ return this.#r;
1553
+ }
1554
+ set r(value) {
1555
+ assertArgument(dataLength(value) === 32, "invalid r", "value", value);
1556
+ this.#r = hexlify(value);
1796
1557
  }
1797
1558
  /**
1798
- * Returns the Result as a normal Array. If %%deep%%, any children
1799
- * which are Result objects are also converted to a normal Array.
1800
- *
1801
- * This will throw if there are any outstanding deferred
1802
- * errors.
1559
+ * The ``s`` value for a signature.
1803
1560
  */
1804
- toArray(deep) {
1805
- const result = [];
1806
- this.forEach((item, index) => {
1807
- if (item instanceof Error) throwError(`index ${index}`, item);
1808
- if (deep && item instanceof Result) item = item.toArray(deep);
1809
- result.push(item);
1810
- });
1811
- return result;
1561
+ get s() {
1562
+ assertArgument(parseInt(this.#s.substring(0, 3)) < 8, "non-canonical s; use ._s", "s", this.#s);
1563
+ return this.#s;
1564
+ }
1565
+ set s(_value) {
1566
+ assertArgument(dataLength(_value) === 32, "invalid s", "value", _value);
1567
+ this.#s = hexlify(_value);
1812
1568
  }
1813
1569
  /**
1814
- * Returns the Result as an Object with each name-value pair. If
1815
- * %%deep%%, any children which are Result objects are also
1816
- * converted to an Object.
1570
+ * Return the s value, unchecked for EIP-2 compliance.
1817
1571
  *
1818
- * This will throw if any value is unnamed, or if there are
1819
- * any outstanding deferred errors.
1572
+ * This should generally not be used and is for situations where
1573
+ * a non-canonical S value might be relevant, such as Frontier blocks
1574
+ * that were mined prior to EIP-2 or invalid Authorization List
1575
+ * signatures.
1820
1576
  */
1821
- toObject(deep) {
1822
- const names = getNames(this);
1823
- return names.reduce((accum, name, index) => {
1824
- assert(name != null, `value at index ${index} unnamed`, "UNSUPPORTED_OPERATION", { operation: "toObject()" });
1825
- return toObject(names, this, deep);
1826
- }, {});
1577
+ get _s() {
1578
+ return this.#s;
1827
1579
  }
1828
1580
  /**
1829
- * @_ignore
1581
+ * Returns true if the Signature is valid for [[link-eip-2]] signatures.
1830
1582
  */
1831
- slice(start, end) {
1832
- if (start == null) start = 0;
1833
- if (start < 0) {
1834
- start += this.length;
1835
- if (start < 0) start = 0;
1836
- }
1837
- if (end == null) end = this.length;
1838
- if (end < 0) {
1839
- end += this.length;
1840
- if (end < 0) end = 0;
1841
- }
1842
- if (end > this.length) end = this.length;
1843
- const _names = getNames(this);
1844
- const result = [];
1845
- const names = [];
1846
- for (let i = start; i < end; i++) {
1847
- result.push(this[i]);
1848
- names.push(_names[i]);
1849
- }
1850
- return new Result(_guard$1, result, names);
1583
+ isValid() {
1584
+ return BigInt(this.#s) <= BN_N_2;
1851
1585
  }
1852
1586
  /**
1853
- * @_ignore
1587
+ * The ``v`` value for a signature.
1588
+ *
1589
+ * Since a given ``x`` value for ``r`` has two possible values for
1590
+ * its correspondin ``y``, the ``v`` indicates which of the two ``y``
1591
+ * values to use.
1592
+ *
1593
+ * It is normalized to the values ``27`` or ``28`` for legacy
1594
+ * purposes.
1854
1595
  */
1855
- filter(callback, thisArg) {
1856
- const _names = getNames(this);
1857
- const result = [];
1858
- const names = [];
1859
- for (let i = 0; i < this.length; i++) {
1860
- const item = this[i];
1861
- if (item instanceof Error) throwError(`index ${i}`, item);
1862
- if (callback.call(thisArg, item, i, this)) {
1863
- result.push(item);
1864
- names.push(_names[i]);
1865
- }
1866
- }
1867
- return new Result(_guard$1, result, names);
1596
+ get v() {
1597
+ return this.#v;
1598
+ }
1599
+ set v(value) {
1600
+ const v = getNumber(value, "value");
1601
+ assertArgument(v === 27 || v === 28, "invalid v", "v", value);
1602
+ this.#v = v;
1868
1603
  }
1869
1604
  /**
1870
- * @_ignore
1605
+ * The EIP-155 ``v`` for legacy transactions. For non-legacy
1606
+ * transactions, this value is ``null``.
1871
1607
  */
1872
- map(callback, thisArg) {
1873
- const result = [];
1874
- for (let i = 0; i < this.length; i++) {
1875
- const item = this[i];
1876
- if (item instanceof Error) throwError(`index ${i}`, item);
1877
- result.push(callback.call(thisArg, item, i, this));
1878
- }
1879
- return result;
1608
+ get networkV() {
1609
+ return this.#networkV;
1880
1610
  }
1881
1611
  /**
1882
- * Returns the value for %%name%%.
1883
- *
1884
- * Since it is possible to have a key whose name conflicts with
1885
- * a method on a [[Result]] or its superclass Array, or any
1886
- * JavaScript keyword, this ensures all named values are still
1887
- * accessible by name.
1612
+ * The chain ID for EIP-155 legacy transactions. For non-legacy
1613
+ * transactions, this value is ``null``.
1888
1614
  */
1889
- getValue(name) {
1890
- const index = getNames(this).indexOf(name);
1891
- if (index === -1) return;
1892
- const value = this[index];
1893
- if (value instanceof Error) throwError(`property ${JSON.stringify(name)}`, value.error);
1894
- return value;
1615
+ get legacyChainId() {
1616
+ const v = this.networkV;
1617
+ if (v == null) return null;
1618
+ return Signature.getChainId(v);
1895
1619
  }
1896
1620
  /**
1897
- * Creates a new [[Result]] for %%items%% with each entry
1898
- * also accessible by its corresponding name in %%keys%%.
1621
+ * The ``yParity`` for the signature.
1622
+ *
1623
+ * See ``v`` for more details on how this value is used.
1899
1624
  */
1900
- static fromItems(items, keys) {
1901
- return new Result(_guard$1, items, keys);
1902
- }
1903
- };
1904
- function getValue$1(value) {
1905
- let bytes = toBeArray(value);
1906
- assert(bytes.length <= 32, "value out-of-bounds", "BUFFER_OVERRUN", {
1907
- buffer: bytes,
1908
- length: 32,
1909
- offset: bytes.length
1910
- });
1911
- if (bytes.length !== 32) bytes = getBytesCopy(concat([Padding.slice(bytes.length % 32), bytes]));
1912
- return bytes;
1913
- }
1914
- __name(getValue$1, "getValue");
1915
- /**
1916
- * @_ignore
1917
- */
1918
- var Coder = class {
1919
- name;
1920
- type;
1921
- localName;
1922
- dynamic;
1923
- constructor(name, type, localName, dynamic) {
1924
- defineProperties(this, {
1925
- name,
1926
- type,
1927
- localName,
1928
- dynamic
1929
- }, {
1930
- name: "string",
1931
- type: "string",
1932
- localName: "string",
1933
- dynamic: "boolean"
1934
- });
1935
- }
1936
- _throwError(message, value) {
1937
- assertArgument(false, message, this.localName, value);
1938
- }
1939
- };
1940
- /**
1941
- * @_ignore
1942
- */
1943
- var Writer = class {
1944
- #data;
1945
- #dataLength;
1946
- constructor() {
1947
- this.#data = [];
1948
- this.#dataLength = 0;
1625
+ get yParity() {
1626
+ return this.v === 27 ? 0 : 1;
1949
1627
  }
1950
- get data() {
1951
- return concat(this.#data);
1628
+ /**
1629
+ * The [[link-eip-2098]] compact representation of the ``yParity``
1630
+ * and ``s`` compacted into a single ``bytes32``.
1631
+ */
1632
+ get yParityAndS() {
1633
+ const yParityAndS = getBytes(this.s);
1634
+ if (this.yParity) yParityAndS[0] |= 128;
1635
+ return hexlify(yParityAndS);
1952
1636
  }
1953
- get length() {
1954
- return this.#dataLength;
1637
+ /**
1638
+ * The [[link-eip-2098]] compact representation.
1639
+ */
1640
+ get compactSerialized() {
1641
+ return concat([this.r, this.yParityAndS]);
1955
1642
  }
1956
- #writeData(data) {
1957
- this.#data.push(data);
1958
- this.#dataLength += data.length;
1959
- return data.length;
1643
+ /**
1644
+ * The serialized representation.
1645
+ */
1646
+ get serialized() {
1647
+ return concat([
1648
+ this.r,
1649
+ this.s,
1650
+ this.yParity ? "0x1c" : "0x1b"
1651
+ ]);
1960
1652
  }
1961
- appendWriter(writer) {
1962
- return this.#writeData(getBytesCopy(writer.data));
1653
+ /**
1654
+ * @private
1655
+ */
1656
+ constructor(guard, r, s, v) {
1657
+ assertPrivate(guard, _guard$1, "Signature");
1658
+ this.#r = r;
1659
+ this.#s = s;
1660
+ this.#v = v;
1661
+ this.#networkV = null;
1963
1662
  }
1964
- writeBytes(value) {
1965
- let bytes = getBytesCopy(value);
1966
- const paddingOffset = bytes.length % 32;
1967
- if (paddingOffset) bytes = getBytesCopy(concat([bytes, Padding.slice(paddingOffset)]));
1968
- return this.#writeData(bytes);
1663
+ /**
1664
+ * Returns the canonical signature.
1665
+ *
1666
+ * This is only necessary when dealing with legacy transaction which
1667
+ * did not enforce canonical S values (i.e. [[link-eip-2]]. Most
1668
+ * developers should never require this.
1669
+ */
1670
+ getCanonical() {
1671
+ if (this.isValid()) return this;
1672
+ const s = BN_N - BigInt(this._s);
1673
+ const v = 55 - this.v;
1674
+ const result = new Signature(_guard$1, this.r, toUint256(s), v);
1675
+ if (this.networkV) result.#networkV = this.networkV;
1676
+ return result;
1969
1677
  }
1970
- writeValue(value) {
1971
- return this.#writeData(getValue$1(value));
1678
+ /**
1679
+ * Returns a new identical [[Signature]].
1680
+ */
1681
+ clone() {
1682
+ const clone = new Signature(_guard$1, this.r, this._s, this.v);
1683
+ if (this.networkV) clone.#networkV = this.networkV;
1684
+ return clone;
1972
1685
  }
1973
- writeUpdatableValue() {
1974
- const offset = this.#data.length;
1975
- this.#data.push(Padding);
1976
- this.#dataLength += 32;
1977
- return (value) => {
1978
- this.#data[offset] = getValue$1(value);
1686
+ /**
1687
+ * Returns a representation that is compatible with ``JSON.stringify``.
1688
+ */
1689
+ toJSON() {
1690
+ const networkV = this.networkV;
1691
+ return {
1692
+ _type: "signature",
1693
+ networkV: networkV != null ? networkV.toString() : null,
1694
+ r: this.r,
1695
+ s: this._s,
1696
+ v: this.v
1979
1697
  };
1980
1698
  }
1981
- };
1982
- /**
1983
- * @_ignore
1984
- */
1985
- var Reader = class Reader {
1986
- allowLoose;
1987
- #data;
1988
- #offset;
1989
- #bytesRead;
1990
- #parent;
1991
- #maxInflation;
1992
- constructor(data, allowLoose, maxInflation) {
1993
- defineProperties(this, { allowLoose: !!allowLoose });
1994
- this.#data = getBytesCopy(data);
1995
- this.#bytesRead = 0;
1996
- this.#parent = null;
1997
- this.#maxInflation = maxInflation != null ? maxInflation : 1024;
1998
- this.#offset = 0;
1699
+ [inspect]() {
1700
+ return this.toString();
1999
1701
  }
2000
- get data() {
2001
- return hexlify(this.#data);
1702
+ toString() {
1703
+ if (this.isValid()) return `Signature { r: ${this.r}, s: ${this._s}, v: ${this.v} }`;
1704
+ return `Signature { r: ${this.r}, s: ${this._s}, v: ${this.v}, valid: false }`;
2002
1705
  }
2003
- get dataLength() {
2004
- return this.#data.length;
1706
+ /**
1707
+ * Compute the chain ID from the ``v`` in a legacy EIP-155 transactions.
1708
+ *
1709
+ * @example:
1710
+ * Signature.getChainId(45)
1711
+ * //_result:
1712
+ *
1713
+ * Signature.getChainId(46)
1714
+ * //_result:
1715
+ */
1716
+ static getChainId(v) {
1717
+ const bv = getBigInt(v, "v");
1718
+ if (bv == BN_27 || bv == BN_28) return BN_0$4;
1719
+ assertArgument(bv >= BN_35, "invalid EIP-155 v", "v", v);
1720
+ return (bv - BN_35) / BN_2;
2005
1721
  }
2006
- get consumed() {
2007
- return this.#offset;
1722
+ /**
1723
+ * Compute the ``v`` for a chain ID for a legacy EIP-155 transactions.
1724
+ *
1725
+ * Legacy transactions which use [[link-eip-155]] hijack the ``v``
1726
+ * property to include the chain ID.
1727
+ *
1728
+ * @example:
1729
+ * Signature.getChainIdV(5, 27)
1730
+ * //_result:
1731
+ *
1732
+ * Signature.getChainIdV(5, 28)
1733
+ * //_result:
1734
+ *
1735
+ */
1736
+ static getChainIdV(chainId, v) {
1737
+ return getBigInt(chainId) * BN_2 + BigInt(35 + v - 27);
2008
1738
  }
2009
- get bytes() {
2010
- return new Uint8Array(this.#data);
1739
+ /**
1740
+ * Compute the normalized legacy transaction ``v`` from a ``yParirty``,
1741
+ * a legacy transaction ``v`` or a legacy [[link-eip-155]] transaction.
1742
+ *
1743
+ * @example:
1744
+ * // The values 0 and 1 imply v is actually yParity
1745
+ * Signature.getNormalizedV(0)
1746
+ * //_result:
1747
+ *
1748
+ * // Legacy non-EIP-1559 transaction (i.e. 27 or 28)
1749
+ * Signature.getNormalizedV(27)
1750
+ * //_result:
1751
+ *
1752
+ * // Legacy EIP-155 transaction (i.e. >= 35)
1753
+ * Signature.getNormalizedV(46)
1754
+ * //_result:
1755
+ *
1756
+ * // Invalid values throw
1757
+ * Signature.getNormalizedV(5)
1758
+ * //_error:
1759
+ */
1760
+ static getNormalizedV(v) {
1761
+ const bv = getBigInt(v);
1762
+ if (bv === BN_0$4 || bv === BN_27) return 27;
1763
+ if (bv === BN_1$1 || bv === BN_28) return 28;
1764
+ assertArgument(bv >= BN_35, "invalid v", "v", v);
1765
+ return bv & BN_1$1 ? 27 : 28;
2011
1766
  }
2012
- #incrementBytesRead(count) {
2013
- if (this.#parent) return this.#parent.#incrementBytesRead(count);
2014
- this.#bytesRead += count;
2015
- assert(this.#maxInflation < 1 || this.#bytesRead <= this.#maxInflation * this.dataLength, `compressed ABI data exceeds inflation ratio of ${this.#maxInflation} ( see: https:/\/github.com/ethers-io/ethers.js/issues/4537 )`, "BUFFER_OVERRUN", {
2016
- buffer: getBytesCopy(this.#data),
2017
- offset: this.#offset,
2018
- length: count,
2019
- info: {
2020
- bytesRead: this.#bytesRead,
2021
- dataLength: this.dataLength
1767
+ /**
1768
+ * Creates a new [[Signature]].
1769
+ *
1770
+ * If no %%sig%% is provided, a new [[Signature]] is created
1771
+ * with default values.
1772
+ *
1773
+ * If %%sig%% is a string, it is parsed.
1774
+ */
1775
+ static from(sig) {
1776
+ function assertError(check, message) {
1777
+ assertArgument(check, message, "signature", sig);
1778
+ }
1779
+ if (sig == null) return new Signature(_guard$1, ZeroHash, ZeroHash, 27);
1780
+ if (typeof sig === "string") {
1781
+ const bytes = getBytes(sig, "signature");
1782
+ if (bytes.length === 64) {
1783
+ const r = hexlify(bytes.slice(0, 32));
1784
+ const s = bytes.slice(32, 64);
1785
+ const v = s[0] & 128 ? 28 : 27;
1786
+ s[0] &= 127;
1787
+ return new Signature(_guard$1, r, hexlify(s), v);
2022
1788
  }
2023
- });
1789
+ if (bytes.length === 65) return new Signature(_guard$1, hexlify(bytes.slice(0, 32)), hexlify(bytes.slice(32, 64)), Signature.getNormalizedV(bytes[64]));
1790
+ assertError(false, "invalid raw signature length");
1791
+ }
1792
+ if (sig instanceof Signature) return sig.clone();
1793
+ const _r = sig.r;
1794
+ assertError(_r != null, "missing r");
1795
+ const r = toUint256(_r);
1796
+ const s = (function(s, yParityAndS) {
1797
+ if (s != null) return toUint256(s);
1798
+ if (yParityAndS != null) {
1799
+ assertError(isHexString(yParityAndS, 32), "invalid yParityAndS");
1800
+ const bytes = getBytes(yParityAndS);
1801
+ bytes[0] &= 127;
1802
+ return hexlify(bytes);
1803
+ }
1804
+ assertError(false, "missing s");
1805
+ })(sig.s, sig.yParityAndS);
1806
+ const { networkV, v } = (function(_v, yParityAndS, yParity) {
1807
+ if (_v != null) {
1808
+ const v = getBigInt(_v);
1809
+ return {
1810
+ networkV: v >= BN_35 ? v : void 0,
1811
+ v: Signature.getNormalizedV(v)
1812
+ };
1813
+ }
1814
+ if (yParityAndS != null) {
1815
+ assertError(isHexString(yParityAndS, 32), "invalid yParityAndS");
1816
+ return { v: getBytes(yParityAndS)[0] & 128 ? 28 : 27 };
1817
+ }
1818
+ if (yParity != null) {
1819
+ switch (getNumber(yParity, "sig.yParity")) {
1820
+ case 0: return { v: 27 };
1821
+ case 1: return { v: 28 };
1822
+ }
1823
+ assertError(false, "invalid yParity");
1824
+ }
1825
+ assertError(false, "missing v");
1826
+ })(sig.v, sig.yParityAndS, sig.yParity);
1827
+ const result = new Signature(_guard$1, r, s, v);
1828
+ if (networkV) result.#networkV = networkV;
1829
+ assertError(sig.yParity == null || getNumber(sig.yParity, "sig.yParity") === result.yParity, "yParity mismatch");
1830
+ assertError(sig.yParityAndS == null || sig.yParityAndS === result.yParityAndS, "yParityAndS mismatch");
1831
+ return result;
2024
1832
  }
2025
- #peekBytes(offset, length, loose) {
2026
- let alignedLength = Math.ceil(length / 32) * 32;
2027
- if (this.#offset + alignedLength > this.#data.length) if (this.allowLoose && loose && this.#offset + length <= this.#data.length) alignedLength = length;
2028
- else assert(false, "data out-of-bounds", "BUFFER_OVERRUN", {
2029
- buffer: getBytesCopy(this.#data),
2030
- length: this.#data.length,
2031
- offset: this.#offset + alignedLength
2032
- });
2033
- return this.#data.slice(this.#offset, this.#offset + alignedLength);
1833
+ };
1834
+
1835
+ //#endregion
1836
+ //#region ../../node_modules/.pnpm/ethers@6.17.0_bufferutil@4.0.8_utf-8-validate@5.0.10/node_modules/ethers/lib.esm/address/address.js
1837
+ const BN_0$3 = BigInt(0);
1838
+ const BN_36 = BigInt(36);
1839
+ function getChecksumAddress(address) {
1840
+ address = address.toLowerCase();
1841
+ const chars = address.substring(2).split("");
1842
+ const expanded = /* @__PURE__ */ new Uint8Array(40);
1843
+ for (let i = 0; i < 40; i++) expanded[i] = chars[i].charCodeAt(0);
1844
+ const hashed = getBytes(keccak256(expanded));
1845
+ for (let i = 0; i < 40; i += 2) {
1846
+ if (hashed[i >> 1] >> 4 >= 8) chars[i] = chars[i].toUpperCase();
1847
+ if ((hashed[i >> 1] & 15) >= 8) chars[i + 1] = chars[i + 1].toUpperCase();
2034
1848
  }
2035
- subReader(offset) {
2036
- const reader = new Reader(this.#data.slice(this.#offset + offset), this.allowLoose, this.#maxInflation);
2037
- reader.#parent = this;
2038
- return reader;
1849
+ return "0x" + chars.join("");
1850
+ }
1851
+ const ibanLookup = {};
1852
+ for (let i = 0; i < 10; i++) ibanLookup[String(i)] = String(i);
1853
+ for (let i = 0; i < 26; i++) ibanLookup[String.fromCharCode(65 + i)] = String(10 + i);
1854
+ const safeDigits = 15;
1855
+ function ibanChecksum(address) {
1856
+ address = address.toUpperCase();
1857
+ address = address.substring(4) + address.substring(0, 2) + "00";
1858
+ let expanded = address.split("").map((c) => {
1859
+ return ibanLookup[c];
1860
+ }).join("");
1861
+ while (expanded.length >= safeDigits) {
1862
+ let block = expanded.substring(0, safeDigits);
1863
+ expanded = parseInt(block, 10) % 97 + expanded.substring(block.length);
2039
1864
  }
2040
- readBytes(length, loose) {
2041
- let bytes = this.#peekBytes(0, length, !!loose);
2042
- this.#incrementBytesRead(length);
2043
- this.#offset += bytes.length;
2044
- return bytes.slice(0, length);
1865
+ let checksum = String(98 - parseInt(expanded, 10) % 97);
1866
+ while (checksum.length < 2) checksum = "0" + checksum;
1867
+ return checksum;
1868
+ }
1869
+ const Base36 = (function() {
1870
+ const result = {};
1871
+ for (let i = 0; i < 36; i++) {
1872
+ const key = "0123456789abcdefghijklmnopqrstuvwxyz"[i];
1873
+ result[key] = BigInt(i);
1874
+ }
1875
+ return result;
1876
+ })();
1877
+ function fromBase36(value) {
1878
+ value = value.toLowerCase();
1879
+ let result = BN_0$3;
1880
+ for (let i = 0; i < value.length; i++) result = result * BN_36 + Base36[value[i]];
1881
+ return result;
1882
+ }
1883
+ /**
1884
+ * Returns a normalized and checksumed address for %%address%%.
1885
+ * This accepts non-checksum addresses, checksum addresses and
1886
+ * [[getIcapAddress]] formats.
1887
+ *
1888
+ * The checksum in Ethereum uses the capitalization (upper-case
1889
+ * vs lower-case) of the characters within an address to encode
1890
+ * its checksum, which offers, on average, a checksum of 15-bits.
1891
+ *
1892
+ * If %%address%% contains both upper-case and lower-case, it is
1893
+ * assumed to already be a checksum address and its checksum is
1894
+ * validated, and if the address fails its expected checksum an
1895
+ * error is thrown.
1896
+ *
1897
+ * If you wish the checksum of %%address%% to be ignore, it should
1898
+ * be converted to lower-case (i.e. ``.toLowercase()``) before
1899
+ * being passed in. This should be a very rare situation though,
1900
+ * that you wish to bypass the safegaurds in place to protect
1901
+ * against an address that has been incorrectly copied from another
1902
+ * source.
1903
+ *
1904
+ * @example:
1905
+ * // Adds the checksum (via upper-casing specific letters)
1906
+ * getAddress("0x8ba1f109551bd432803012645ac136ddd64dba72")
1907
+ * //_result:
1908
+ *
1909
+ * // Converts ICAP address and adds checksum
1910
+ * getAddress("XE65GB6LDNXYOFTX0NSV3FUWKOWIXAMJK36");
1911
+ * //_result:
1912
+ *
1913
+ * // Throws an error if an address contains mixed case,
1914
+ * // but the checksum fails
1915
+ * getAddress("0x8Ba1f109551bD432803012645Ac136ddd64DBA72")
1916
+ * //_error:
1917
+ */
1918
+ function getAddress(address) {
1919
+ assertArgument(typeof address === "string", "invalid address", "address", address);
1920
+ if (address.match(/^(0x)?[0-9a-fA-F]{40}$/)) {
1921
+ if (!address.startsWith("0x")) address = "0x" + address;
1922
+ const result = getChecksumAddress(address);
1923
+ assertArgument(!address.match(/([A-F].*[a-f])|([a-f].*[A-F])/) || result === address, "bad address checksum", "address", address);
1924
+ return result;
2045
1925
  }
2046
- readValue() {
2047
- return toBigInt(this.readBytes(32));
1926
+ if (address.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)) {
1927
+ assertArgument(address.substring(2, 4) === ibanChecksum(address), "bad icap checksum", "address", address);
1928
+ let result = fromBase36(address.substring(4)).toString(16);
1929
+ while (result.length < 40) result = "0" + result;
1930
+ return getChecksumAddress("0x" + result);
2048
1931
  }
2049
- readIndex() {
2050
- return toNumber(this.readBytes(32));
1932
+ assertArgument(false, "invalid address", "address", address);
1933
+ }
1934
+
1935
+ //#endregion
1936
+ //#region ../../node_modules/.pnpm/ethers@6.17.0_bufferutil@4.0.8_utf-8-validate@5.0.10/node_modules/ethers/lib.esm/address/checks.js
1937
+ /**
1938
+ * Returns true if %%value%% is an object which implements the
1939
+ * [[Addressable]] interface.
1940
+ *
1941
+ * @example:
1942
+ * // Wallets and AbstractSigner sub-classes
1943
+ * isAddressable(Wallet.createRandom())
1944
+ * //_result:
1945
+ *
1946
+ * // Contracts
1947
+ * contract = new Contract("dai.tokens.ethers.eth", [ ], provider)
1948
+ * isAddressable(contract)
1949
+ * //_result:
1950
+ */
1951
+ function isAddressable(value) {
1952
+ return value && typeof value.getAddress === "function";
1953
+ }
1954
+ async function checkAddress(target, promise) {
1955
+ const result = await promise;
1956
+ if (result == null || result === "0x0000000000000000000000000000000000000000") {
1957
+ assert(typeof target !== "string", "unconfigured name", "UNCONFIGURED_NAME", { value: target });
1958
+ assertArgument(false, "invalid AddressLike value; did not resolve to a value address", "target", target);
2051
1959
  }
2052
- };
1960
+ return getAddress(result);
1961
+ }
1962
+ /**
1963
+ * Resolves to an address for the %%target%%, which may be any
1964
+ * supported address type, an [[Addressable]] or a Promise which
1965
+ * resolves to an address.
1966
+ *
1967
+ * If an ENS name is provided, but that name has not been correctly
1968
+ * configured a [[UnconfiguredNameError]] is thrown.
1969
+ *
1970
+ * @example:
1971
+ * addr = "0x6B175474E89094C44Da98b954EedeAC495271d0F"
1972
+ *
1973
+ * // Addresses are return synchronously
1974
+ * resolveAddress(addr, provider)
1975
+ * //_result:
1976
+ *
1977
+ * // Address promises are resolved asynchronously
1978
+ * resolveAddress(Promise.resolve(addr))
1979
+ * //_result:
1980
+ *
1981
+ * // ENS names are resolved asynchronously
1982
+ * resolveAddress("dai.tokens.ethers.eth", provider)
1983
+ * //_result:
1984
+ *
1985
+ * // Addressable objects are resolved asynchronously
1986
+ * contract = new Contract(addr, [ ])
1987
+ * resolveAddress(contract, provider)
1988
+ * //_result:
1989
+ *
1990
+ * // Unconfigured ENS names reject
1991
+ * resolveAddress("nothing-here.ricmoo.eth", provider)
1992
+ * //_error:
1993
+ *
1994
+ * // ENS names require a NameResolver object passed in
1995
+ * // (notice the provider was omitted)
1996
+ * resolveAddress("nothing-here.ricmoo.eth")
1997
+ * //_error:
1998
+ */
1999
+ function resolveAddress(target, resolver) {
2000
+ if (typeof target === "string") {
2001
+ if (target.match(/^0x[0-9a-f]{40}$/i)) return getAddress(target);
2002
+ assert(resolver != null, "ENS resolution requires a provider", "UNSUPPORTED_OPERATION", { operation: "resolveName" });
2003
+ return checkAddress(target, resolver.resolveName(target));
2004
+ } else if (isAddressable(target)) return checkAddress(target, target.getAddress());
2005
+ else if (target && typeof target.then === "function") return checkAddress(target, target);
2006
+ assertArgument(false, "unsupported addressable value", "target", target);
2007
+ }
2053
2008
 
2054
2009
  //#endregion
2055
- //#region ../../node_modules/.pnpm/@sentio+ethers@6.13.1-patch.6_bufferutil@4.0.8_utf-8-validate@5.0.10/node_modules/@sentio/ethers/lib.esm/abi/typed.js
2010
+ //#region ../../node_modules/.pnpm/ethers@6.17.0_bufferutil@4.0.8_utf-8-validate@5.0.10/node_modules/ethers/lib.esm/abi/typed.js
2056
2011
  /**
2057
2012
  * A Typed object allows a value to have its type explicitly
2058
2013
  * specified.
@@ -2836,7 +2791,7 @@ var Typed = class Typed {
2836
2791
  };
2837
2792
 
2838
2793
  //#endregion
2839
- //#region ../../node_modules/.pnpm/@sentio+ethers@6.13.1-patch.6_bufferutil@4.0.8_utf-8-validate@5.0.10/node_modules/@sentio/ethers/lib.esm/abi/coders/address.js
2794
+ //#region ../../node_modules/.pnpm/ethers@6.17.0_bufferutil@4.0.8_utf-8-validate@5.0.10/node_modules/ethers/lib.esm/abi/coders/address.js
2840
2795
  /**
2841
2796
  * @_ignore
2842
2797
  */
@@ -2862,7 +2817,7 @@ var AddressCoder = class extends Coder {
2862
2817
  };
2863
2818
 
2864
2819
  //#endregion
2865
- //#region ../../node_modules/.pnpm/@sentio+ethers@6.13.1-patch.6_bufferutil@4.0.8_utf-8-validate@5.0.10/node_modules/@sentio/ethers/lib.esm/abi/coders/anonymous.js
2820
+ //#region ../../node_modules/.pnpm/ethers@6.17.0_bufferutil@4.0.8_utf-8-validate@5.0.10/node_modules/ethers/lib.esm/abi/coders/anonymous.js
2866
2821
  /**
2867
2822
  * Clones the functionality of an existing Coder, but without a localName
2868
2823
  *
@@ -2886,7 +2841,7 @@ var AnonymousCoder = class extends Coder {
2886
2841
  };
2887
2842
 
2888
2843
  //#endregion
2889
- //#region ../../node_modules/.pnpm/@sentio+ethers@6.13.1-patch.6_bufferutil@4.0.8_utf-8-validate@5.0.10/node_modules/@sentio/ethers/lib.esm/abi/coders/array.js
2844
+ //#region ../../node_modules/.pnpm/ethers@6.17.0_bufferutil@4.0.8_utf-8-validate@5.0.10/node_modules/ethers/lib.esm/abi/coders/array.js
2890
2845
  /**
2891
2846
  * @_ignore
2892
2847
  */
@@ -3020,7 +2975,7 @@ var ArrayCoder = class extends Coder {
3020
2975
  };
3021
2976
 
3022
2977
  //#endregion
3023
- //#region ../../node_modules/.pnpm/@sentio+ethers@6.13.1-patch.6_bufferutil@4.0.8_utf-8-validate@5.0.10/node_modules/@sentio/ethers/lib.esm/abi/coders/boolean.js
2978
+ //#region ../../node_modules/.pnpm/ethers@6.17.0_bufferutil@4.0.8_utf-8-validate@5.0.10/node_modules/ethers/lib.esm/abi/coders/boolean.js
3024
2979
  /**
3025
2980
  * @_ignore
3026
2981
  */
@@ -3041,7 +2996,7 @@ var BooleanCoder = class extends Coder {
3041
2996
  };
3042
2997
 
3043
2998
  //#endregion
3044
- //#region ../../node_modules/.pnpm/@sentio+ethers@6.13.1-patch.6_bufferutil@4.0.8_utf-8-validate@5.0.10/node_modules/@sentio/ethers/lib.esm/abi/coders/bytes.js
2999
+ //#region ../../node_modules/.pnpm/ethers@6.17.0_bufferutil@4.0.8_utf-8-validate@5.0.10/node_modules/ethers/lib.esm/abi/coders/bytes.js
3045
3000
  /**
3046
3001
  * @_ignore
3047
3002
  */
@@ -3075,7 +3030,7 @@ var BytesCoder = class extends DynamicBytesCoder {
3075
3030
  };
3076
3031
 
3077
3032
  //#endregion
3078
- //#region ../../node_modules/.pnpm/@sentio+ethers@6.13.1-patch.6_bufferutil@4.0.8_utf-8-validate@5.0.10/node_modules/@sentio/ethers/lib.esm/abi/coders/fixed-bytes.js
3033
+ //#region ../../node_modules/.pnpm/ethers@6.17.0_bufferutil@4.0.8_utf-8-validate@5.0.10/node_modules/ethers/lib.esm/abi/coders/fixed-bytes.js
3079
3034
  /**
3080
3035
  * @_ignore
3081
3036
  */
@@ -3100,7 +3055,7 @@ var FixedBytesCoder = class extends Coder {
3100
3055
  };
3101
3056
 
3102
3057
  //#endregion
3103
- //#region ../../node_modules/.pnpm/@sentio+ethers@6.13.1-patch.6_bufferutil@4.0.8_utf-8-validate@5.0.10/node_modules/@sentio/ethers/lib.esm/abi/coders/null.js
3058
+ //#region ../../node_modules/.pnpm/ethers@6.17.0_bufferutil@4.0.8_utf-8-validate@5.0.10/node_modules/ethers/lib.esm/abi/coders/null.js
3104
3059
  const Empty = new Uint8Array([]);
3105
3060
  /**
3106
3061
  * @_ignore
@@ -3123,8 +3078,8 @@ var NullCoder = class extends Coder {
3123
3078
  };
3124
3079
 
3125
3080
  //#endregion
3126
- //#region ../../node_modules/.pnpm/@sentio+ethers@6.13.1-patch.6_bufferutil@4.0.8_utf-8-validate@5.0.10/node_modules/@sentio/ethers/lib.esm/abi/coders/number.js
3127
- const BN_0$3 = BigInt(0);
3081
+ //#region ../../node_modules/.pnpm/ethers@6.17.0_bufferutil@4.0.8_utf-8-validate@5.0.10/node_modules/ethers/lib.esm/abi/coders/number.js
3082
+ const BN_0$2 = BigInt(0);
3128
3083
  const BN_1 = BigInt(1);
3129
3084
  const BN_MAX_UINT256 = BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
3130
3085
  /**
@@ -3154,7 +3109,7 @@ var NumberCoder = class extends Coder {
3154
3109
  let bounds = mask(maxUintValue, this.size * 8 - 1);
3155
3110
  if (value > bounds || value < -(bounds + BN_1)) this._throwError("value out-of-bounds", _value);
3156
3111
  value = toTwos(value, 8 * 32);
3157
- } else if (value < BN_0$3 || value > mask(maxUintValue, this.size * 8)) this._throwError("value out-of-bounds", _value);
3112
+ } else if (value < BN_0$2 || value > mask(maxUintValue, this.size * 8)) this._throwError("value out-of-bounds", _value);
3158
3113
  return writer.writeValue(value);
3159
3114
  }
3160
3115
  decode(reader) {
@@ -3165,7 +3120,7 @@ var NumberCoder = class extends Coder {
3165
3120
  };
3166
3121
 
3167
3122
  //#endregion
3168
- //#region ../../node_modules/.pnpm/@sentio+ethers@6.13.1-patch.6_bufferutil@4.0.8_utf-8-validate@5.0.10/node_modules/@sentio/ethers/lib.esm/abi/coders/string.js
3123
+ //#region ../../node_modules/.pnpm/ethers@6.17.0_bufferutil@4.0.8_utf-8-validate@5.0.10/node_modules/ethers/lib.esm/abi/coders/string.js
3169
3124
  /**
3170
3125
  * @_ignore
3171
3126
  */
@@ -3185,7 +3140,7 @@ var StringCoder = class extends DynamicBytesCoder {
3185
3140
  };
3186
3141
 
3187
3142
  //#endregion
3188
- //#region ../../node_modules/.pnpm/@sentio+ethers@6.13.1-patch.6_bufferutil@4.0.8_utf-8-validate@5.0.10/node_modules/@sentio/ethers/lib.esm/abi/coders/tuple.js
3143
+ //#region ../../node_modules/.pnpm/ethers@6.17.0_bufferutil@4.0.8_utf-8-validate@5.0.10/node_modules/ethers/lib.esm/abi/coders/tuple.js
3189
3144
  /**
3190
3145
  * @_ignore
3191
3146
  */
@@ -3234,7 +3189,7 @@ var TupleCoder = class extends Coder {
3234
3189
  };
3235
3190
 
3236
3191
  //#endregion
3237
- //#region ../../node_modules/.pnpm/@sentio+ethers@6.13.1-patch.6_bufferutil@4.0.8_utf-8-validate@5.0.10/node_modules/@sentio/ethers/lib.esm/hash/id.js
3192
+ //#region ../../node_modules/.pnpm/ethers@6.17.0_bufferutil@4.0.8_utf-8-validate@5.0.10/node_modules/ethers/lib.esm/hash/id.js
3238
3193
  /**
3239
3194
  * A simple hashing function which operates on UTF-8 strings to
3240
3195
  * compute an 32-byte identifier.
@@ -3251,7 +3206,42 @@ function id(value) {
3251
3206
  }
3252
3207
 
3253
3208
  //#endregion
3254
- //#region ../../node_modules/.pnpm/@sentio+ethers@6.13.1-patch.6_bufferutil@4.0.8_utf-8-validate@5.0.10/node_modules/@sentio/ethers/lib.esm/abi/fragments.js
3209
+ //#region ../../node_modules/.pnpm/ethers@6.17.0_bufferutil@4.0.8_utf-8-validate@5.0.10/node_modules/ethers/lib.esm/transaction/accesslist.js
3210
+ function accessSetify(addr, storageKeys) {
3211
+ return {
3212
+ address: getAddress(addr),
3213
+ storageKeys: storageKeys.map((storageKey, index) => {
3214
+ assertArgument(isHexString(storageKey, 32), "invalid slot", `storageKeys[${index}]`, storageKey);
3215
+ return storageKey.toLowerCase();
3216
+ })
3217
+ };
3218
+ }
3219
+ /**
3220
+ * Returns a [[AccessList]] from any ethers-supported access-list structure.
3221
+ */
3222
+ function accessListify(value) {
3223
+ if (Array.isArray(value)) return value.map((set, index) => {
3224
+ if (Array.isArray(set)) {
3225
+ assertArgument(set.length === 2, "invalid slot set", `value[${index}]`, set);
3226
+ return accessSetify(set[0], set[1]);
3227
+ }
3228
+ assertArgument(set != null && typeof set === "object", "invalid address-slot set", "value", value);
3229
+ return accessSetify(set.address, set.storageKeys);
3230
+ });
3231
+ assertArgument(value != null && typeof value === "object", "invalid access list", "value", value);
3232
+ const result = Object.keys(value).map((addr) => {
3233
+ const storageKeys = value[addr].reduce((accum, storageKey) => {
3234
+ accum[storageKey] = true;
3235
+ return accum;
3236
+ }, {});
3237
+ return accessSetify(addr, Object.keys(storageKeys).sort());
3238
+ });
3239
+ result.sort((a, b) => a.address.localeCompare(b.address));
3240
+ return result;
3241
+ }
3242
+
3243
+ //#endregion
3244
+ //#region ../../node_modules/.pnpm/ethers@6.17.0_bufferutil@4.0.8_utf-8-validate@5.0.10/node_modules/ethers/lib.esm/abi/fragments.js
3255
3245
  /**
3256
3246
  * A fragment is a single item from an ABI, which may represent any of:
3257
3247
  *
@@ -3792,10 +3782,10 @@ var ParamType = class ParamType {
3792
3782
  const name = obj.name;
3793
3783
  assertArgument(!name || typeof name === "string" && name.match(regexId), "invalid name", "obj.name", name);
3794
3784
  let indexed = obj.indexed;
3795
- if (indexed == true) {
3785
+ if (indexed != null) {
3796
3786
  assertArgument(allowIndexed, "parameter cannot be indexed", "obj.indexed", obj.indexed);
3797
- indexed = true;
3798
- } else indexed = false;
3787
+ indexed = !!indexed;
3788
+ }
3799
3789
  let type = obj.type;
3800
3790
  let arrayMatch = type.match(regexArrayType);
3801
3791
  if (arrayMatch) {
@@ -4364,7 +4354,7 @@ var StructFragment = class StructFragment extends NamedFragment {
4364
4354
  };
4365
4355
 
4366
4356
  //#endregion
4367
- //#region ../../node_modules/.pnpm/@sentio+ethers@6.13.1-patch.6_bufferutil@4.0.8_utf-8-validate@5.0.10/node_modules/@sentio/ethers/lib.esm/abi/abi-coder.js
4357
+ //#region ../../node_modules/.pnpm/ethers@6.17.0_bufferutil@4.0.8_utf-8-validate@5.0.10/node_modules/ethers/lib.esm/abi/abi-coder.js
4368
4358
  /**
4369
4359
  * When sending values to or receiving values from a [[Contract]], the
4370
4360
  * data is generally encoded using the [ABI standard](link-solc-abi).
@@ -4528,7 +4518,7 @@ var AbiCoder = class AbiCoder {
4528
4518
  };
4529
4519
 
4530
4520
  //#endregion
4531
- //#region ../../node_modules/.pnpm/@sentio+ethers@6.13.1-patch.6_bufferutil@4.0.8_utf-8-validate@5.0.10/node_modules/@sentio/ethers/lib.esm/abi/interface.js
4521
+ //#region ../../node_modules/.pnpm/ethers@6.17.0_bufferutil@4.0.8_utf-8-validate@5.0.10/node_modules/ethers/lib.esm/abi/interface.js
4532
4522
  /**
4533
4523
  * The Interface class is a low-level class that accepts an
4534
4524
  * ABI and provides all the necessary functionality to encode
@@ -5379,8 +5369,8 @@ var Interface = class Interface {
5379
5369
  };
5380
5370
 
5381
5371
  //#endregion
5382
- //#region ../../node_modules/.pnpm/@sentio+ethers@6.13.1-patch.6_bufferutil@4.0.8_utf-8-validate@5.0.10/node_modules/@sentio/ethers/lib.esm/providers/provider.js
5383
- const BN_0$2 = BigInt(0);
5372
+ //#region ../../node_modules/.pnpm/ethers@6.17.0_bufferutil@4.0.8_utf-8-validate@5.0.10/node_modules/ethers/lib.esm/providers/provider.js
5373
+ const BN_0$1 = BigInt(0);
5384
5374
  function getValue(value) {
5385
5375
  if (value == null) return null;
5386
5376
  return value;
@@ -5465,11 +5455,13 @@ function copyRequest(req) {
5465
5455
  result[key] = getNumber(req[key], `request.${key}`);
5466
5456
  }
5467
5457
  if (req.accessList) result.accessList = accessListify(req.accessList);
5458
+ if (req.authorizationList) result.authorizationList = req.authorizationList.slice();
5468
5459
  if ("blockTag" in req) result.blockTag = req.blockTag;
5469
5460
  if ("enableCcipRead" in req) result.enableCcipRead = !!req.enableCcipRead;
5470
5461
  if ("customData" in req) result.customData = req.customData;
5471
5462
  if ("blobVersionedHashes" in req && req.blobVersionedHashes) result.blobVersionedHashes = req.blobVersionedHashes.slice();
5472
5463
  if ("kzg" in req) result.kzg = req.kzg;
5464
+ if ("blobWrapperVersion" in req) result.blobWrapperVersion = req.blobWrapperVersion;
5473
5465
  if ("blobs" in req && req.blobs) result.blobs = req.blobs.map((b) => {
5474
5466
  if (isBytesLike(b)) return hexlify(b);
5475
5467
  return Object.assign({}, b);
@@ -5547,6 +5539,10 @@ var Block = class {
5547
5539
  */
5548
5540
  receiptsRoot;
5549
5541
  /**
5542
+ * The hash of the transactions.
5543
+ */
5544
+ transactionsRoot;
5545
+ /**
5550
5546
  * The total amount of blob gas consumed by the transactions
5551
5547
  * within the block. See [[link-eip-4844]].
5552
5548
  */
@@ -5608,7 +5604,8 @@ var Block = class {
5608
5604
  extraData: block.extraData,
5609
5605
  baseFeePerGas: getValue(block.baseFeePerGas),
5610
5606
  stateRoot: block.stateRoot,
5611
- receiptsRoot: block.receiptsRoot
5607
+ receiptsRoot: block.receiptsRoot,
5608
+ transactionsRoot: block.transactionsRoot
5612
5609
  });
5613
5610
  }
5614
5611
  /**
@@ -5639,7 +5636,7 @@ var Block = class {
5639
5636
  * Returns a JSON-friendly value.
5640
5637
  */
5641
5638
  toJSON() {
5642
- const { baseFeePerGas, difficulty, extraData, gasLimit, gasUsed, hash, miner, prevRandao, nonce, number, parentHash, parentBeaconBlockRoot, stateRoot, receiptsRoot, timestamp, transactions } = this;
5639
+ const { baseFeePerGas, difficulty, extraData, gasLimit, gasUsed, hash, miner, prevRandao, nonce, number, parentHash, parentBeaconBlockRoot, stateRoot, receiptsRoot, transactionsRoot, timestamp, transactions } = this;
5643
5640
  return {
5644
5641
  _type: "Block",
5645
5642
  baseFeePerGas: toJson(baseFeePerGas),
@@ -5659,6 +5656,7 @@ var Block = class {
5659
5656
  parentBeaconBlockRoot,
5660
5657
  stateRoot,
5661
5658
  receiptsRoot,
5659
+ transactionsRoot,
5662
5660
  transactions
5663
5661
  };
5664
5662
  }
@@ -5702,7 +5700,7 @@ var Block = class {
5702
5700
  tx = v;
5703
5701
  break;
5704
5702
  } else {
5705
- if (v.hash === hash) continue;
5703
+ if (v.hash !== hash) continue;
5706
5704
  tx = v;
5707
5705
  break;
5708
5706
  }
@@ -5980,7 +5978,7 @@ var TransactionReceipt = class {
5980
5978
  this.#logs = Object.freeze(tx.logs.map((log) => {
5981
5979
  return new Log(log, provider);
5982
5980
  }));
5983
- let gasPrice = BN_0$2;
5981
+ let gasPrice = BN_0$1;
5984
5982
  if (tx.effectiveGasPrice != null) gasPrice = tx.effectiveGasPrice;
5985
5983
  else if (tx.gasPrice != null) gasPrice = tx.gasPrice;
5986
5984
  defineProperties(this, {
@@ -6228,6 +6226,10 @@ var TransactionResponse = class TransactionResponse {
6228
6226
  * The [[link-eip-4844]] BLOb versioned hashes.
6229
6227
  */
6230
6228
  blobVersionedHashes;
6229
+ /**
6230
+ * The [[link-eip-7702]] authorizations (if any).
6231
+ */
6232
+ authorizationList;
6231
6233
  #startBlock;
6232
6234
  /**
6233
6235
  * @_ignore:
@@ -6253,6 +6255,7 @@ var TransactionResponse = class TransactionResponse {
6253
6255
  this.signature = tx.signature;
6254
6256
  this.accessList = tx.accessList != null ? tx.accessList : null;
6255
6257
  this.blobVersionedHashes = tx.blobVersionedHashes != null ? tx.blobVersionedHashes : null;
6258
+ this.authorizationList = tx.authorizationList != null ? tx.authorizationList : null;
6256
6259
  this.#startBlock = -1;
6257
6260
  }
6258
6261
  /**
@@ -6367,7 +6370,7 @@ var TransactionResponse = class TransactionResponse {
6367
6370
  if (blockNumber - receipt.blockNumber + 1 < confirms) return;
6368
6371
  let reason = "replaced";
6369
6372
  if (tx.data === this.data && tx.to === this.to && tx.value === this.value) reason = "repriced";
6370
- else if (tx.data === "0x" && tx.from === tx.to && tx.value === BN_0$2) reason = "cancelled";
6373
+ else if (tx.data === "0x" && tx.from === tx.to && tx.value === BN_0$1) reason = "cancelled";
6371
6374
  assert(false, "transaction was replaced", "TRANSACTION_REPLACED", {
6372
6375
  cancelled: reason === "replaced" || reason === "cancelled",
6373
6376
  reason,
@@ -6399,7 +6402,7 @@ var TransactionResponse = class TransactionResponse {
6399
6402
  const receipt = await this.provider.getTransactionReceipt(this.hash);
6400
6403
  if (confirms === 0) return checkReceipt(receipt);
6401
6404
  if (receipt) {
6402
- if (await receipt.confirmations() >= confirms) return checkReceipt(receipt);
6405
+ if (confirms === 1 || await receipt.confirmations() >= confirms) return checkReceipt(receipt);
6403
6406
  } else {
6404
6407
  await checkReplacement();
6405
6408
  if (confirms === 0) return null;
@@ -6575,7 +6578,7 @@ function createRemovedLogFilter(log) {
6575
6578
  }
6576
6579
 
6577
6580
  //#endregion
6578
- //#region ../../node_modules/.pnpm/@sentio+ethers@6.13.1-patch.6_bufferutil@4.0.8_utf-8-validate@5.0.10/node_modules/@sentio/ethers/lib.esm/contract/wrappers.js
6581
+ //#region ../../node_modules/.pnpm/ethers@6.17.0_bufferutil@4.0.8_utf-8-validate@5.0.10/node_modules/ethers/lib.esm/contract/wrappers.js
6579
6582
  /**
6580
6583
  * An **EventLog** contains additional properties parsed from the [[Log]].
6581
6584
  */
@@ -6756,8 +6759,8 @@ var ContractEventPayload = class extends ContractUnknownEventPayload {
6756
6759
  };
6757
6760
 
6758
6761
  //#endregion
6759
- //#region ../../node_modules/.pnpm/@sentio+ethers@6.13.1-patch.6_bufferutil@4.0.8_utf-8-validate@5.0.10/node_modules/@sentio/ethers/lib.esm/contract/contract.js
6760
- const BN_0$1 = BigInt(0);
6762
+ //#region ../../node_modules/.pnpm/ethers@6.17.0_bufferutil@4.0.8_utf-8-validate@5.0.10/node_modules/ethers/lib.esm/contract/contract.js
6763
+ const BN_0 = BigInt(0);
6761
6764
  function canCall(value) {
6762
6765
  return value && typeof value.call === "function";
6763
6766
  }
@@ -6844,7 +6847,7 @@ function buildWrappedFallback(contract) {
6844
6847
  tx.to = await contract.getAddress();
6845
6848
  if (tx.from) tx.from = await resolveAddress(tx.from, getResolver(contract.runner));
6846
6849
  const iface = contract.interface;
6847
- const noValue = getBigInt(tx.value || BN_0$1, "overrides.value") === BN_0$1;
6850
+ const noValue = getBigInt(tx.value || BN_0, "overrides.value") === BN_0;
6848
6851
  const noData = (tx.data || "0x") === "0x";
6849
6852
  if (iface.fallback && !iface.fallback.payable && iface.receive && !noData && !noValue) assertArgument(false, "cannot send data to receive or send value to non-payable fallback", "overrides", overrides);
6850
6853
  assertArgument(iface.fallback || noData, "cannot send data to receive-only contract", "overrides.data", tx.data);
@@ -6933,14 +6936,7 @@ function buildWrappedMethod(contract, key) {
6933
6936
  const staticCallResult = async function(...args) {
6934
6937
  const runner = getRunner(contract.runner, "call");
6935
6938
  assert(canCall(runner), "contract runner does not support calling", "UNSUPPORTED_OPERATION", { operation: "call" });
6936
- let tx;
6937
- try {
6938
- tx = await populateTransaction(...args);
6939
- } catch (e) {
6940
- const blockNumber = args.at(-1).blockTag;
6941
- if (blockNumber) e.blockNumber = blockNumber;
6942
- throw e;
6943
- }
6939
+ const tx = await populateTransaction(...args);
6944
6940
  let result = "0x";
6945
6941
  try {
6946
6942
  result = await runner.call(tx);
@@ -7159,7 +7155,7 @@ var BaseContract = class BaseContract {
7159
7155
  * The target to connect to.
7160
7156
  *
7161
7157
  * This can be an address, ENS name or any [[Addressable]], such as
7162
- * another contract. To get the resovled address, use the ``getAddress``
7158
+ * another contract. To get the resolved address, use the ``getAddress``
7163
7159
  * method.
7164
7160
  */
7165
7161
  target;
@@ -7331,7 +7327,7 @@ var BaseContract = class BaseContract {
7331
7327
  /**
7332
7328
  * Return the function for a given name. This is useful when a contract
7333
7329
  * method name conflicts with a JavaScript name such as ``prototype`` or
7334
- * when using a Contract programatically.
7330
+ * when using a Contract programmatically.
7335
7331
  */
7336
7332
  getFunction(key) {
7337
7333
  if (typeof key !== "string") key = key.format();
@@ -7340,7 +7336,7 @@ var BaseContract = class BaseContract {
7340
7336
  /**
7341
7337
  * Return the event for a given name. This is useful when a contract
7342
7338
  * event name conflicts with a JavaScript name such as ``prototype`` or
7343
- * when using a Contract programatically.
7339
+ * when using a Contract programmatically.
7344
7340
  */
7345
7341
  getEvent(key) {
7346
7342
  if (typeof key !== "string") key = key.format();
@@ -7522,190 +7518,6 @@ function _ContractBase() {
7522
7518
  */
7523
7519
  var Contract = class extends _ContractBase() {};
7524
7520
 
7525
- //#endregion
7526
- //#region ../../node_modules/.pnpm/@sentio+ethers@6.13.1-patch.6_bufferutil@4.0.8_utf-8-validate@5.0.10/node_modules/@sentio/ethers/lib.esm/providers/format.js
7527
- /**
7528
- * @_ignore
7529
- */
7530
- const BN_0 = BigInt(0);
7531
- function allowNull(format, nullValue) {
7532
- return (function(value) {
7533
- if (value == null) return nullValue;
7534
- return format(value);
7535
- });
7536
- }
7537
- function arrayOf(format, allowNull) {
7538
- return ((array) => {
7539
- if (allowNull && array == null) return null;
7540
- if (!Array.isArray(array)) throw new Error("not an array");
7541
- return array.map((i) => format(i));
7542
- });
7543
- }
7544
- function object(format, altNames) {
7545
- return ((value) => {
7546
- const result = {};
7547
- for (const key in format) {
7548
- let srcKey = key;
7549
- if (altNames && key in altNames && !(srcKey in value)) {
7550
- for (const altKey of altNames[key]) if (altKey in value) {
7551
- srcKey = altKey;
7552
- break;
7553
- }
7554
- }
7555
- try {
7556
- const nv = format[key](value[srcKey]);
7557
- if (nv !== void 0) result[key] = nv;
7558
- } catch (error) {
7559
- assert(false, `invalid value for value.${key} (${error instanceof Error ? error.message : "not-an-error"})`, "BAD_DATA", { value });
7560
- }
7561
- }
7562
- return result;
7563
- });
7564
- }
7565
- function formatBoolean(value) {
7566
- switch (value) {
7567
- case true:
7568
- case "true": return true;
7569
- case false:
7570
- case "false": return false;
7571
- }
7572
- assertArgument(false, `invalid boolean; ${JSON.stringify(value)}`, "value", value);
7573
- }
7574
- function formatData(value) {
7575
- assertArgument(isHexString(value, true), "invalid data", "value", value);
7576
- return value;
7577
- }
7578
- function formatHash(value) {
7579
- assertArgument(isHexString(value, 32), "invalid hash", "value", value);
7580
- return value;
7581
- }
7582
- const _formatLog = object({
7583
- address: getAddress,
7584
- blockHash: formatHash,
7585
- blockNumber: getNumber,
7586
- data: formatData,
7587
- index: getNumber,
7588
- removed: allowNull(formatBoolean, false),
7589
- topics: arrayOf(formatHash),
7590
- transactionHash: formatHash,
7591
- transactionIndex: getNumber
7592
- }, { index: ["logIndex"] });
7593
- function formatLog$1(value) {
7594
- return _formatLog(value);
7595
- }
7596
- __name(formatLog$1, "formatLog");
7597
- const _formatBlock = object({
7598
- hash: allowNull(formatHash),
7599
- parentHash: formatHash,
7600
- parentBeaconBlockRoot: allowNull(formatHash, null),
7601
- number: getNumber,
7602
- timestamp: getNumber,
7603
- nonce: allowNull(formatData),
7604
- difficulty: getBigInt,
7605
- gasLimit: getBigInt,
7606
- gasUsed: getBigInt,
7607
- stateRoot: allowNull(formatHash, null),
7608
- receiptsRoot: allowNull(formatHash, null),
7609
- blobGasUsed: allowNull(getBigInt, null),
7610
- excessBlobGas: allowNull(getBigInt, null),
7611
- miner: allowNull(getAddress),
7612
- prevRandao: allowNull(formatHash, null),
7613
- extraData: formatData,
7614
- baseFeePerGas: allowNull(getBigInt)
7615
- }, { prevRandao: ["mixHash"] });
7616
- function formatBlock(value) {
7617
- const result = _formatBlock(value);
7618
- result.transactions = value.transactions.map((tx) => {
7619
- if (typeof tx === "string") return tx;
7620
- return formatTransactionResponse$1(tx);
7621
- });
7622
- return result;
7623
- }
7624
- const _formatReceiptLog = object({
7625
- transactionIndex: getNumber,
7626
- blockNumber: getNumber,
7627
- transactionHash: formatHash,
7628
- address: getAddress,
7629
- topics: arrayOf(formatHash),
7630
- data: formatData,
7631
- index: getNumber,
7632
- blockHash: formatHash
7633
- }, { index: ["logIndex"] });
7634
- function formatReceiptLog(value) {
7635
- return _formatReceiptLog(value);
7636
- }
7637
- const _formatTransactionReceipt = object({
7638
- to: allowNull(getAddress, null),
7639
- from: allowNull(getAddress, null),
7640
- contractAddress: allowNull(getAddress, null),
7641
- index: getNumber,
7642
- root: allowNull(hexlify),
7643
- gasUsed: getBigInt,
7644
- blobGasUsed: allowNull(getBigInt, null),
7645
- logsBloom: allowNull(formatData),
7646
- blockHash: formatHash,
7647
- hash: formatHash,
7648
- logs: arrayOf(formatReceiptLog),
7649
- blockNumber: getNumber,
7650
- cumulativeGasUsed: getBigInt,
7651
- effectiveGasPrice: allowNull(getBigInt),
7652
- blobGasPrice: allowNull(getBigInt, null),
7653
- l1Fee: allowNull(getBigInt, null),
7654
- status: allowNull(getNumber),
7655
- type: allowNull(getNumber, 0)
7656
- }, {
7657
- effectiveGasPrice: ["gasPrice"],
7658
- hash: ["transactionHash"],
7659
- index: ["transactionIndex"]
7660
- });
7661
- function formatTransactionReceipt$1(value) {
7662
- return _formatTransactionReceipt(value);
7663
- }
7664
- __name(formatTransactionReceipt$1, "formatTransactionReceipt");
7665
- function formatTransactionResponse$1(value) {
7666
- if (value.to && getBigInt(value.to) === BN_0) value.to = "0x0000000000000000000000000000000000000000";
7667
- const result = object({
7668
- hash: formatHash,
7669
- index: allowNull(getNumber, void 0),
7670
- type: (value) => {
7671
- if (value === "0x" || value == null) return 0;
7672
- return getNumber(value);
7673
- },
7674
- accessList: allowNull(accessListify, null),
7675
- blobVersionedHashes: allowNull(arrayOf(formatHash, true), null),
7676
- blockHash: allowNull(formatHash, null),
7677
- blockNumber: allowNull(getNumber, null),
7678
- transactionIndex: allowNull(getNumber, null),
7679
- from: getAddress,
7680
- gasPrice: allowNull(getBigInt),
7681
- maxPriorityFeePerGas: allowNull(getBigInt),
7682
- maxFeePerGas: allowNull(getBigInt),
7683
- maxFeePerBlobGas: allowNull(getBigInt, null),
7684
- gasLimit: getBigInt,
7685
- to: allowNull(getAddress, null),
7686
- value: getBigInt,
7687
- nonce: getNumber,
7688
- data: formatData,
7689
- creates: allowNull(getAddress, null),
7690
- chainId: allowNull(getBigInt, null)
7691
- }, {
7692
- data: ["input"],
7693
- gasLimit: ["gas"],
7694
- index: ["transactionIndex"]
7695
- })(value);
7696
- if (result.to == null && result.creates == null) result.creates = getCreateAddress(result);
7697
- if ((value.type === 1 || value.type === 2) && value.accessList == null) result.accessList = [];
7698
- if (value.signature) result.signature = Signature.from(value.signature);
7699
- else result.signature = Signature.from(value);
7700
- if (result.chainId == null) {
7701
- const chainId = result.signature.legacyChainId;
7702
- if (chainId != null) result.chainId = chainId;
7703
- }
7704
- if (result.blockHash && getBigInt(result.blockHash) === BN_0) result.blockHash = null;
7705
- return result;
7706
- }
7707
- __name(formatTransactionResponse$1, "formatTransactionResponse");
7708
-
7709
7521
  //#endregion
7710
7522
  //#region src/eth/eth.ts
7711
7523
  var SimpleEthersError = class extends Error {
@@ -7989,17 +7801,93 @@ var FormattedTransactionResponse = class {
7989
7801
  get blobVersionedHashes() {
7990
7802
  return this.raw.blobVersionedHashes ?? null;
7991
7803
  }
7804
+ get authorizationList() {
7805
+ return this.raw.authorizationList ?? null;
7806
+ }
7992
7807
  };
7993
7808
  function formatTransactionResponse(value) {
7994
7809
  return new FormattedTransactionResponse(value);
7995
7810
  }
7811
+ var FormattedBlock = class {
7812
+ raw;
7813
+ constructor(raw) {
7814
+ this.raw = raw;
7815
+ }
7816
+ get hash() {
7817
+ return this.raw.hash ?? null;
7818
+ }
7819
+ get number() {
7820
+ return getNumber(this.raw.number);
7821
+ }
7822
+ get timestamp() {
7823
+ return getNumber(this.raw.timestamp);
7824
+ }
7825
+ get parentHash() {
7826
+ return this.raw.parentHash;
7827
+ }
7828
+ get parentBeaconBlockRoot() {
7829
+ return this.raw.parentBeaconBlockRoot ?? null;
7830
+ }
7831
+ get nonce() {
7832
+ return this.raw.nonce;
7833
+ }
7834
+ _difficulty;
7835
+ get difficulty() {
7836
+ return this._difficulty ?? (this._difficulty = getBigInt(this.raw.difficulty));
7837
+ }
7838
+ _gasLimit;
7839
+ get gasLimit() {
7840
+ return this._gasLimit ?? (this._gasLimit = getBigInt(this.raw.gasLimit));
7841
+ }
7842
+ _gasUsed;
7843
+ get gasUsed() {
7844
+ return this._gasUsed ?? (this._gasUsed = getBigInt(this.raw.gasUsed));
7845
+ }
7846
+ get blobGasUsed() {
7847
+ return allowNull(getBigInt, null)(this.raw.blobGasUsed);
7848
+ }
7849
+ get excessBlobGas() {
7850
+ return allowNull(getBigInt, null)(this.raw.excessBlobGas);
7851
+ }
7852
+ _miner;
7853
+ get miner() {
7854
+ return this._miner ?? (this._miner = allowNull(getAddress)(this.raw.miner));
7855
+ }
7856
+ get prevRandao() {
7857
+ return this.raw.prevRandao ?? this.raw.mixHash ?? null;
7858
+ }
7859
+ get extraData() {
7860
+ return this.raw.extraData;
7861
+ }
7862
+ _baseFeePerGas;
7863
+ get baseFeePerGas() {
7864
+ return this._baseFeePerGas !== void 0 ? this._baseFeePerGas : this._baseFeePerGas = allowNull(getBigInt, null)(this.raw.baseFeePerGas);
7865
+ }
7866
+ get stateRoot() {
7867
+ return this.raw.stateRoot ?? null;
7868
+ }
7869
+ get receiptsRoot() {
7870
+ return this.raw.receiptsRoot ?? null;
7871
+ }
7872
+ get transactionsRoot() {
7873
+ return this.raw.transactionsRoot ?? null;
7874
+ }
7875
+ _transactions;
7876
+ get transactions() {
7877
+ return this._transactions ?? (this._transactions = (this.raw.transactions ?? []).map((tx) => typeof tx === "string" ? tx : formatTransactionResponse(tx)));
7878
+ }
7879
+ get traces() {
7880
+ return this.raw.traces;
7881
+ }
7882
+ _transactionReceipts;
7883
+ get transactionReceipts() {
7884
+ if (this._transactionReceipts !== void 0) return this._transactionReceipts;
7885
+ if (!this.raw.transactionReceipts) return;
7886
+ return this._transactionReceipts = this.raw.transactionReceipts.map((t) => formatTransactionReceipt(t));
7887
+ }
7888
+ };
7996
7889
  function formatRichBlock(block) {
7997
- block = {
7998
- ...block,
7999
- ...formatBlock(block)
8000
- };
8001
- if (block.transactionReceipts) block.transactionReceipts = block.transactionReceipts.map((t) => formatTransactionReceipt(t));
8002
- return block;
7890
+ return new FormattedBlock(block);
8003
7891
  }
8004
7892
  function isNullAddress(address) {
8005
7893
  try {
@@ -8024,10 +7912,41 @@ function encodeCallData(context, name, funcABI, values) {
8024
7912
  }
8025
7913
  }
8026
7914
  function newContract(target, abi, runner) {
8027
- return new Contract(target, abi, runner);
7915
+ return new Contract(target, abi instanceof Interface ? abi : sanitizeAbi(abi), runner);
8028
7916
  }
8029
7917
  function newInterface(fragments) {
8030
- return new Interface(fragments);
7918
+ return new Interface(sanitizeAbi(fragments));
7919
+ }
7920
+ /**
7921
+ * Recursively drop `indexed: false` from ABI fragment objects.
7922
+ *
7923
+ * Upstream ethers' `ParamType.from` throws "parameter cannot be indexed" when a
7924
+ * non-event parameter (function/error/constructor input) carries an explicit
7925
+ * `indexed: false` — some real-world ABIs do. The retired @sentio/ethers fork
7926
+ * tolerated this; we replicate it here by stripping the redundant flag before the
7927
+ * ABI reaches ethers. Dropping `indexed: false` is safe: it is the default for
7928
+ * event params (non-indexed) and meaningless elsewhere; `indexed: true` is kept.
7929
+ */
7930
+ function sanitizeAbi(abi) {
7931
+ if (typeof abi === "string") try {
7932
+ return dropFalseIndexed(JSON.parse(abi));
7933
+ } catch {
7934
+ return abi;
7935
+ }
7936
+ if (Array.isArray(abi)) return dropFalseIndexed(abi);
7937
+ return abi;
7938
+ }
7939
+ function dropFalseIndexed(node) {
7940
+ if (Array.isArray(node)) return node.map(dropFalseIndexed);
7941
+ if (node && typeof node === "object") {
7942
+ const out = {};
7943
+ for (const [key, value] of Object.entries(node)) {
7944
+ if (key === "indexed" && value === false) continue;
7945
+ out[key] = dropFalseIndexed(value);
7946
+ }
7947
+ return out;
7948
+ }
7949
+ return node;
8031
7950
  }
8032
7951
 
8033
7952
  //#endregion
@@ -8089,5 +8008,5 @@ var decode_worker_default = {
8089
8008
  };
8090
8009
 
8091
8010
  //#endregion
8092
- export { concat as $, TransactionResponse as A, keccak256 as B, formatTransactionResponse$1 as C, exists as Ct, FeeData as D, Block as E, Result as F, getBigInt as G, toUtf8Bytes as H, accessListify as I, toBeArray as J, getNumber as K, resolveAddress as L, LogDescription as M, AbiCoder as N, Log as O, id as P, toTwos as Q, getAddress as R, formatTransactionReceipt$1 as S, bytes as St, Contract as T, output as Tt, toUtf8String as U, encodeRlp as V, EventPayload as W, toBigInt as X, toBeHex as Y, toQuantity as Z, transformEtherError as _, createView as _t, parseLogInline as a, isBytesLike as at, formatBlock as b, toBytes as bt, TypedEvent as c, assert as ct, formatEthData as d, isError as dt, dataLength as et, formatRichBlock as f, makeError as ft, newInterface as g, concatBytes as gt, newContract as h, Hash as ht, parseLog as i, hexlify as it, copyRequest as j, TransactionReceipt as k, encodeCallData as l, assertArgument as lt, isNullAddress as m, resolveProperties as mt, decodeTraceInline as n, getBytes as nt, FormattedLog as o, isHexString as ot, formatTransactionResponse as p, defineProperties as pt, mask as q, decode_worker_default as r, getBytesCopy as rt, SimpleEthersError as s, zeroPadValue as st, decodeTrace as t, dataSlice as tt, fixEmptyKey as u, isCallException as ut, validateAndNormalizeAddress as v, randomBytes as vt, BaseContract as w, hash as wt, formatLog$1 as x, wrapConstructor as xt, allowNull as y, rotr as yt, Signature as z };
8093
- //# sourceMappingURL=decode-worker-7st2rUPr.js.map
8011
+ export { mask as $, accessListify as A, rotr as B, FeeData as C, copyRequest as D, TransactionResponse as E, keccak256 as F, hash as G, wrapConstructor as H, Hash as I, toUtf8Bytes as J, output as K, concatBytes as L, resolveAddress as M, getAddress as N, LogDescription as O, Signature as P, getNumber as Q, createView as R, Block as S, TransactionReceipt as T, bytes as U, toBytes as V, exists as W, EventPayload as X, toUtf8String as Y, getBigInt as Z, sanitizeAbi as _, isError as _t, parseLogInline as a, concat as at, BaseContract as b, resolveProperties as bt, TypedEvent as c, getBytes as ct, formatEthData as d, isBytesLike as dt, toBeArray as et, formatRichBlock as f, isHexString as ft, newInterface as g, isCallException as gt, newContract as h, assertArgument as ht, parseLog as i, toTwos as it, id as j, AbiCoder as k, encodeCallData as l, getBytesCopy as lt, isNullAddress as m, assert as mt, decodeTraceInline as n, toBigInt as nt, FormattedLog as o, dataLength as ot, formatTransactionResponse as p, zeroPadValue as pt, Result as q, decode_worker_default as r, toQuantity as rt, SimpleEthersError as s, dataSlice as st, decodeTrace as t, toBeHex as tt, fixEmptyKey as u, hexlify as ut, transformEtherError as v, makeError as vt, Log as w, Contract as x, allowNull as xt, validateAndNormalizeAddress as y, defineProperties as yt, randomBytes as z };
8012
+ //# sourceMappingURL=decode-worker-C83IoThX.js.map