@tinycloud/cli 0.7.7-beta.5 → 0.7.7-beta.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +16 -1
- package/dist/index.js +18335 -49296
- package/dist/index.js.map +1 -1
- package/package.json +10 -5
- package/dist/_esm-6RCT7X34.js +0 -3922
- package/dist/_esm-6RCT7X34.js.map +0 -1
- package/dist/ccip-ID23WCLC.js +0 -3740
- package/dist/ccip-ID23WCLC.js.map +0 -1
- package/dist/chunk-725HE3UG.js +0 -159
- package/dist/chunk-725HE3UG.js.map +0 -1
- package/dist/chunk-PLDDJCW6.js +0 -49
- package/dist/chunk-PLDDJCW6.js.map +0 -1
- package/dist/chunk-TWMXCCSD.js +0 -684
- package/dist/chunk-TWMXCCSD.js.map +0 -1
- package/dist/secp256k1-RXKUF757.js +0 -2454
- package/dist/secp256k1-RXKUF757.js.map +0 -1
package/dist/chunk-TWMXCCSD.js
DELETED
|
@@ -1,684 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Hash,
|
|
3
|
-
abytes,
|
|
4
|
-
aexists,
|
|
5
|
-
anumber,
|
|
6
|
-
aoutput,
|
|
7
|
-
clean,
|
|
8
|
-
createHasher,
|
|
9
|
-
rotlBH,
|
|
10
|
-
rotlBL,
|
|
11
|
-
rotlSH,
|
|
12
|
-
rotlSL,
|
|
13
|
-
split,
|
|
14
|
-
swap32IfBE,
|
|
15
|
-
toBytes,
|
|
16
|
-
u32
|
|
17
|
-
} from "./chunk-725HE3UG.js";
|
|
18
|
-
|
|
19
|
-
// ../../node_modules/viem/_esm/utils/data/isHex.js
|
|
20
|
-
function isHex(value, { strict = true } = {}) {
|
|
21
|
-
if (!value)
|
|
22
|
-
return false;
|
|
23
|
-
if (typeof value !== "string")
|
|
24
|
-
return false;
|
|
25
|
-
return strict ? /^0x[0-9a-fA-F]*$/.test(value) : value.startsWith("0x");
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
// ../../node_modules/viem/_esm/utils/data/size.js
|
|
29
|
-
function size(value) {
|
|
30
|
-
if (isHex(value, { strict: false }))
|
|
31
|
-
return Math.ceil((value.length - 2) / 2);
|
|
32
|
-
return value.length;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
// ../../node_modules/viem/_esm/errors/version.js
|
|
36
|
-
var version = "2.45.1";
|
|
37
|
-
|
|
38
|
-
// ../../node_modules/viem/_esm/errors/base.js
|
|
39
|
-
var errorConfig = {
|
|
40
|
-
getDocsUrl: ({ docsBaseUrl, docsPath = "", docsSlug }) => docsPath ? `${docsBaseUrl ?? "https://viem.sh"}${docsPath}${docsSlug ? `#${docsSlug}` : ""}` : void 0,
|
|
41
|
-
version: `viem@${version}`
|
|
42
|
-
};
|
|
43
|
-
var BaseError = class _BaseError extends Error {
|
|
44
|
-
constructor(shortMessage, args = {}) {
|
|
45
|
-
const details = (() => {
|
|
46
|
-
if (args.cause instanceof _BaseError)
|
|
47
|
-
return args.cause.details;
|
|
48
|
-
if (args.cause?.message)
|
|
49
|
-
return args.cause.message;
|
|
50
|
-
return args.details;
|
|
51
|
-
})();
|
|
52
|
-
const docsPath = (() => {
|
|
53
|
-
if (args.cause instanceof _BaseError)
|
|
54
|
-
return args.cause.docsPath || args.docsPath;
|
|
55
|
-
return args.docsPath;
|
|
56
|
-
})();
|
|
57
|
-
const docsUrl = errorConfig.getDocsUrl?.({ ...args, docsPath });
|
|
58
|
-
const message = [
|
|
59
|
-
shortMessage || "An error occurred.",
|
|
60
|
-
"",
|
|
61
|
-
...args.metaMessages ? [...args.metaMessages, ""] : [],
|
|
62
|
-
...docsUrl ? [`Docs: ${docsUrl}`] : [],
|
|
63
|
-
...details ? [`Details: ${details}`] : [],
|
|
64
|
-
...errorConfig.version ? [`Version: ${errorConfig.version}`] : []
|
|
65
|
-
].join("\n");
|
|
66
|
-
super(message, args.cause ? { cause: args.cause } : void 0);
|
|
67
|
-
Object.defineProperty(this, "details", {
|
|
68
|
-
enumerable: true,
|
|
69
|
-
configurable: true,
|
|
70
|
-
writable: true,
|
|
71
|
-
value: void 0
|
|
72
|
-
});
|
|
73
|
-
Object.defineProperty(this, "docsPath", {
|
|
74
|
-
enumerable: true,
|
|
75
|
-
configurable: true,
|
|
76
|
-
writable: true,
|
|
77
|
-
value: void 0
|
|
78
|
-
});
|
|
79
|
-
Object.defineProperty(this, "metaMessages", {
|
|
80
|
-
enumerable: true,
|
|
81
|
-
configurable: true,
|
|
82
|
-
writable: true,
|
|
83
|
-
value: void 0
|
|
84
|
-
});
|
|
85
|
-
Object.defineProperty(this, "shortMessage", {
|
|
86
|
-
enumerable: true,
|
|
87
|
-
configurable: true,
|
|
88
|
-
writable: true,
|
|
89
|
-
value: void 0
|
|
90
|
-
});
|
|
91
|
-
Object.defineProperty(this, "version", {
|
|
92
|
-
enumerable: true,
|
|
93
|
-
configurable: true,
|
|
94
|
-
writable: true,
|
|
95
|
-
value: void 0
|
|
96
|
-
});
|
|
97
|
-
Object.defineProperty(this, "name", {
|
|
98
|
-
enumerable: true,
|
|
99
|
-
configurable: true,
|
|
100
|
-
writable: true,
|
|
101
|
-
value: "BaseError"
|
|
102
|
-
});
|
|
103
|
-
this.details = details;
|
|
104
|
-
this.docsPath = docsPath;
|
|
105
|
-
this.metaMessages = args.metaMessages;
|
|
106
|
-
this.name = args.name ?? this.name;
|
|
107
|
-
this.shortMessage = shortMessage;
|
|
108
|
-
this.version = version;
|
|
109
|
-
}
|
|
110
|
-
walk(fn) {
|
|
111
|
-
return walk(this, fn);
|
|
112
|
-
}
|
|
113
|
-
};
|
|
114
|
-
function walk(err, fn) {
|
|
115
|
-
if (fn?.(err))
|
|
116
|
-
return err;
|
|
117
|
-
if (err && typeof err === "object" && "cause" in err && err.cause !== void 0)
|
|
118
|
-
return walk(err.cause, fn);
|
|
119
|
-
return fn ? null : err;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
// ../../node_modules/viem/_esm/errors/data.js
|
|
123
|
-
var SliceOffsetOutOfBoundsError = class extends BaseError {
|
|
124
|
-
constructor({ offset, position, size: size2 }) {
|
|
125
|
-
super(`Slice ${position === "start" ? "starting" : "ending"} at offset "${offset}" is out-of-bounds (size: ${size2}).`, { name: "SliceOffsetOutOfBoundsError" });
|
|
126
|
-
}
|
|
127
|
-
};
|
|
128
|
-
var SizeExceedsPaddingSizeError = class extends BaseError {
|
|
129
|
-
constructor({ size: size2, targetSize, type }) {
|
|
130
|
-
super(`${type.charAt(0).toUpperCase()}${type.slice(1).toLowerCase()} size (${size2}) exceeds padding size (${targetSize}).`, { name: "SizeExceedsPaddingSizeError" });
|
|
131
|
-
}
|
|
132
|
-
};
|
|
133
|
-
var InvalidBytesLengthError = class extends BaseError {
|
|
134
|
-
constructor({ size: size2, targetSize, type }) {
|
|
135
|
-
super(`${type.charAt(0).toUpperCase()}${type.slice(1).toLowerCase()} is expected to be ${targetSize} ${type} long, but is ${size2} ${type} long.`, { name: "InvalidBytesLengthError" });
|
|
136
|
-
}
|
|
137
|
-
};
|
|
138
|
-
|
|
139
|
-
// ../../node_modules/viem/_esm/utils/data/pad.js
|
|
140
|
-
function pad(hexOrBytes, { dir, size: size2 = 32 } = {}) {
|
|
141
|
-
if (typeof hexOrBytes === "string")
|
|
142
|
-
return padHex(hexOrBytes, { dir, size: size2 });
|
|
143
|
-
return padBytes(hexOrBytes, { dir, size: size2 });
|
|
144
|
-
}
|
|
145
|
-
function padHex(hex_, { dir, size: size2 = 32 } = {}) {
|
|
146
|
-
if (size2 === null)
|
|
147
|
-
return hex_;
|
|
148
|
-
const hex = hex_.replace("0x", "");
|
|
149
|
-
if (hex.length > size2 * 2)
|
|
150
|
-
throw new SizeExceedsPaddingSizeError({
|
|
151
|
-
size: Math.ceil(hex.length / 2),
|
|
152
|
-
targetSize: size2,
|
|
153
|
-
type: "hex"
|
|
154
|
-
});
|
|
155
|
-
return `0x${hex[dir === "right" ? "padEnd" : "padStart"](size2 * 2, "0")}`;
|
|
156
|
-
}
|
|
157
|
-
function padBytes(bytes, { dir, size: size2 = 32 } = {}) {
|
|
158
|
-
if (size2 === null)
|
|
159
|
-
return bytes;
|
|
160
|
-
if (bytes.length > size2)
|
|
161
|
-
throw new SizeExceedsPaddingSizeError({
|
|
162
|
-
size: bytes.length,
|
|
163
|
-
targetSize: size2,
|
|
164
|
-
type: "bytes"
|
|
165
|
-
});
|
|
166
|
-
const paddedBytes = new Uint8Array(size2);
|
|
167
|
-
for (let i = 0; i < size2; i++) {
|
|
168
|
-
const padEnd = dir === "right";
|
|
169
|
-
paddedBytes[padEnd ? i : size2 - i - 1] = bytes[padEnd ? i : bytes.length - i - 1];
|
|
170
|
-
}
|
|
171
|
-
return paddedBytes;
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
// ../../node_modules/viem/_esm/errors/encoding.js
|
|
175
|
-
var IntegerOutOfRangeError = class extends BaseError {
|
|
176
|
-
constructor({ max, min, signed, size: size2, value }) {
|
|
177
|
-
super(`Number "${value}" is not in safe ${size2 ? `${size2 * 8}-bit ${signed ? "signed" : "unsigned"} ` : ""}integer range ${max ? `(${min} to ${max})` : `(above ${min})`}`, { name: "IntegerOutOfRangeError" });
|
|
178
|
-
}
|
|
179
|
-
};
|
|
180
|
-
var InvalidBytesBooleanError = class extends BaseError {
|
|
181
|
-
constructor(bytes) {
|
|
182
|
-
super(`Bytes value "${bytes}" is not a valid boolean. The bytes array must contain a single byte of either a 0 or 1 value.`, {
|
|
183
|
-
name: "InvalidBytesBooleanError"
|
|
184
|
-
});
|
|
185
|
-
}
|
|
186
|
-
};
|
|
187
|
-
var SizeOverflowError = class extends BaseError {
|
|
188
|
-
constructor({ givenSize, maxSize }) {
|
|
189
|
-
super(`Size cannot exceed ${maxSize} bytes. Given size: ${givenSize} bytes.`, { name: "SizeOverflowError" });
|
|
190
|
-
}
|
|
191
|
-
};
|
|
192
|
-
|
|
193
|
-
// ../../node_modules/viem/_esm/utils/data/trim.js
|
|
194
|
-
function trim(hexOrBytes, { dir = "left" } = {}) {
|
|
195
|
-
let data = typeof hexOrBytes === "string" ? hexOrBytes.replace("0x", "") : hexOrBytes;
|
|
196
|
-
let sliceLength = 0;
|
|
197
|
-
for (let i = 0; i < data.length - 1; i++) {
|
|
198
|
-
if (data[dir === "left" ? i : data.length - i - 1].toString() === "0")
|
|
199
|
-
sliceLength++;
|
|
200
|
-
else
|
|
201
|
-
break;
|
|
202
|
-
}
|
|
203
|
-
data = dir === "left" ? data.slice(sliceLength) : data.slice(0, data.length - sliceLength);
|
|
204
|
-
if (typeof hexOrBytes === "string") {
|
|
205
|
-
if (data.length === 1 && dir === "right")
|
|
206
|
-
data = `${data}0`;
|
|
207
|
-
return `0x${data.length % 2 === 1 ? `0${data}` : data}`;
|
|
208
|
-
}
|
|
209
|
-
return data;
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
// ../../node_modules/viem/_esm/utils/encoding/toBytes.js
|
|
213
|
-
var encoder = /* @__PURE__ */ new TextEncoder();
|
|
214
|
-
function toBytes2(value, opts = {}) {
|
|
215
|
-
if (typeof value === "number" || typeof value === "bigint")
|
|
216
|
-
return numberToBytes(value, opts);
|
|
217
|
-
if (typeof value === "boolean")
|
|
218
|
-
return boolToBytes(value, opts);
|
|
219
|
-
if (isHex(value))
|
|
220
|
-
return hexToBytes(value, opts);
|
|
221
|
-
return stringToBytes(value, opts);
|
|
222
|
-
}
|
|
223
|
-
function boolToBytes(value, opts = {}) {
|
|
224
|
-
const bytes = new Uint8Array(1);
|
|
225
|
-
bytes[0] = Number(value);
|
|
226
|
-
if (typeof opts.size === "number") {
|
|
227
|
-
assertSize(bytes, { size: opts.size });
|
|
228
|
-
return pad(bytes, { size: opts.size });
|
|
229
|
-
}
|
|
230
|
-
return bytes;
|
|
231
|
-
}
|
|
232
|
-
var charCodeMap = {
|
|
233
|
-
zero: 48,
|
|
234
|
-
nine: 57,
|
|
235
|
-
A: 65,
|
|
236
|
-
F: 70,
|
|
237
|
-
a: 97,
|
|
238
|
-
f: 102
|
|
239
|
-
};
|
|
240
|
-
function charCodeToBase16(char) {
|
|
241
|
-
if (char >= charCodeMap.zero && char <= charCodeMap.nine)
|
|
242
|
-
return char - charCodeMap.zero;
|
|
243
|
-
if (char >= charCodeMap.A && char <= charCodeMap.F)
|
|
244
|
-
return char - (charCodeMap.A - 10);
|
|
245
|
-
if (char >= charCodeMap.a && char <= charCodeMap.f)
|
|
246
|
-
return char - (charCodeMap.a - 10);
|
|
247
|
-
return void 0;
|
|
248
|
-
}
|
|
249
|
-
function hexToBytes(hex_, opts = {}) {
|
|
250
|
-
let hex = hex_;
|
|
251
|
-
if (opts.size) {
|
|
252
|
-
assertSize(hex, { size: opts.size });
|
|
253
|
-
hex = pad(hex, { dir: "right", size: opts.size });
|
|
254
|
-
}
|
|
255
|
-
let hexString = hex.slice(2);
|
|
256
|
-
if (hexString.length % 2)
|
|
257
|
-
hexString = `0${hexString}`;
|
|
258
|
-
const length = hexString.length / 2;
|
|
259
|
-
const bytes = new Uint8Array(length);
|
|
260
|
-
for (let index = 0, j = 0; index < length; index++) {
|
|
261
|
-
const nibbleLeft = charCodeToBase16(hexString.charCodeAt(j++));
|
|
262
|
-
const nibbleRight = charCodeToBase16(hexString.charCodeAt(j++));
|
|
263
|
-
if (nibbleLeft === void 0 || nibbleRight === void 0) {
|
|
264
|
-
throw new BaseError(`Invalid byte sequence ("${hexString[j - 2]}${hexString[j - 1]}" in "${hexString}").`);
|
|
265
|
-
}
|
|
266
|
-
bytes[index] = nibbleLeft * 16 + nibbleRight;
|
|
267
|
-
}
|
|
268
|
-
return bytes;
|
|
269
|
-
}
|
|
270
|
-
function numberToBytes(value, opts) {
|
|
271
|
-
const hex = numberToHex(value, opts);
|
|
272
|
-
return hexToBytes(hex);
|
|
273
|
-
}
|
|
274
|
-
function stringToBytes(value, opts = {}) {
|
|
275
|
-
const bytes = encoder.encode(value);
|
|
276
|
-
if (typeof opts.size === "number") {
|
|
277
|
-
assertSize(bytes, { size: opts.size });
|
|
278
|
-
return pad(bytes, { dir: "right", size: opts.size });
|
|
279
|
-
}
|
|
280
|
-
return bytes;
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
// ../../node_modules/viem/_esm/utils/encoding/fromHex.js
|
|
284
|
-
function assertSize(hexOrBytes, { size: size2 }) {
|
|
285
|
-
if (size(hexOrBytes) > size2)
|
|
286
|
-
throw new SizeOverflowError({
|
|
287
|
-
givenSize: size(hexOrBytes),
|
|
288
|
-
maxSize: size2
|
|
289
|
-
});
|
|
290
|
-
}
|
|
291
|
-
function hexToBigInt(hex, opts = {}) {
|
|
292
|
-
const { signed } = opts;
|
|
293
|
-
if (opts.size)
|
|
294
|
-
assertSize(hex, { size: opts.size });
|
|
295
|
-
const value = BigInt(hex);
|
|
296
|
-
if (!signed)
|
|
297
|
-
return value;
|
|
298
|
-
const size2 = (hex.length - 2) / 2;
|
|
299
|
-
const max = (1n << BigInt(size2) * 8n - 1n) - 1n;
|
|
300
|
-
if (value <= max)
|
|
301
|
-
return value;
|
|
302
|
-
return value - BigInt(`0x${"f".padStart(size2 * 2, "f")}`) - 1n;
|
|
303
|
-
}
|
|
304
|
-
function hexToNumber(hex, opts = {}) {
|
|
305
|
-
const value = hexToBigInt(hex, opts);
|
|
306
|
-
const number = Number(value);
|
|
307
|
-
if (!Number.isSafeInteger(number))
|
|
308
|
-
throw new IntegerOutOfRangeError({
|
|
309
|
-
max: `${Number.MAX_SAFE_INTEGER}`,
|
|
310
|
-
min: `${Number.MIN_SAFE_INTEGER}`,
|
|
311
|
-
signed: opts.signed,
|
|
312
|
-
size: opts.size,
|
|
313
|
-
value: `${value}n`
|
|
314
|
-
});
|
|
315
|
-
return number;
|
|
316
|
-
}
|
|
317
|
-
|
|
318
|
-
// ../../node_modules/viem/_esm/utils/encoding/toHex.js
|
|
319
|
-
var hexes = /* @__PURE__ */ Array.from({ length: 256 }, (_v, i) => i.toString(16).padStart(2, "0"));
|
|
320
|
-
function toHex(value, opts = {}) {
|
|
321
|
-
if (typeof value === "number" || typeof value === "bigint")
|
|
322
|
-
return numberToHex(value, opts);
|
|
323
|
-
if (typeof value === "string") {
|
|
324
|
-
return stringToHex(value, opts);
|
|
325
|
-
}
|
|
326
|
-
if (typeof value === "boolean")
|
|
327
|
-
return boolToHex(value, opts);
|
|
328
|
-
return bytesToHex(value, opts);
|
|
329
|
-
}
|
|
330
|
-
function boolToHex(value, opts = {}) {
|
|
331
|
-
const hex = `0x${Number(value)}`;
|
|
332
|
-
if (typeof opts.size === "number") {
|
|
333
|
-
assertSize(hex, { size: opts.size });
|
|
334
|
-
return pad(hex, { size: opts.size });
|
|
335
|
-
}
|
|
336
|
-
return hex;
|
|
337
|
-
}
|
|
338
|
-
function bytesToHex(value, opts = {}) {
|
|
339
|
-
let string = "";
|
|
340
|
-
for (let i = 0; i < value.length; i++) {
|
|
341
|
-
string += hexes[value[i]];
|
|
342
|
-
}
|
|
343
|
-
const hex = `0x${string}`;
|
|
344
|
-
if (typeof opts.size === "number") {
|
|
345
|
-
assertSize(hex, { size: opts.size });
|
|
346
|
-
return pad(hex, { dir: "right", size: opts.size });
|
|
347
|
-
}
|
|
348
|
-
return hex;
|
|
349
|
-
}
|
|
350
|
-
function numberToHex(value_, opts = {}) {
|
|
351
|
-
const { signed, size: size2 } = opts;
|
|
352
|
-
const value = BigInt(value_);
|
|
353
|
-
let maxValue;
|
|
354
|
-
if (size2) {
|
|
355
|
-
if (signed)
|
|
356
|
-
maxValue = (1n << BigInt(size2) * 8n - 1n) - 1n;
|
|
357
|
-
else
|
|
358
|
-
maxValue = 2n ** (BigInt(size2) * 8n) - 1n;
|
|
359
|
-
} else if (typeof value_ === "number") {
|
|
360
|
-
maxValue = BigInt(Number.MAX_SAFE_INTEGER);
|
|
361
|
-
}
|
|
362
|
-
const minValue = typeof maxValue === "bigint" && signed ? -maxValue - 1n : 0;
|
|
363
|
-
if (maxValue && value > maxValue || value < minValue) {
|
|
364
|
-
const suffix = typeof value_ === "bigint" ? "n" : "";
|
|
365
|
-
throw new IntegerOutOfRangeError({
|
|
366
|
-
max: maxValue ? `${maxValue}${suffix}` : void 0,
|
|
367
|
-
min: `${minValue}${suffix}`,
|
|
368
|
-
signed,
|
|
369
|
-
size: size2,
|
|
370
|
-
value: `${value_}${suffix}`
|
|
371
|
-
});
|
|
372
|
-
}
|
|
373
|
-
const hex = `0x${(signed && value < 0 ? (1n << BigInt(size2 * 8)) + BigInt(value) : value).toString(16)}`;
|
|
374
|
-
if (size2)
|
|
375
|
-
return pad(hex, { size: size2 });
|
|
376
|
-
return hex;
|
|
377
|
-
}
|
|
378
|
-
var encoder2 = /* @__PURE__ */ new TextEncoder();
|
|
379
|
-
function stringToHex(value_, opts = {}) {
|
|
380
|
-
const value = encoder2.encode(value_);
|
|
381
|
-
return bytesToHex(value, opts);
|
|
382
|
-
}
|
|
383
|
-
|
|
384
|
-
// ../../node_modules/viem/_esm/errors/address.js
|
|
385
|
-
var InvalidAddressError = class extends BaseError {
|
|
386
|
-
constructor({ address }) {
|
|
387
|
-
super(`Address "${address}" is invalid.`, {
|
|
388
|
-
metaMessages: [
|
|
389
|
-
"- Address must be a hex value of 20 bytes (40 hex characters).",
|
|
390
|
-
"- Address must match its checksum counterpart."
|
|
391
|
-
],
|
|
392
|
-
name: "InvalidAddressError"
|
|
393
|
-
});
|
|
394
|
-
}
|
|
395
|
-
};
|
|
396
|
-
|
|
397
|
-
// ../../node_modules/viem/_esm/utils/lru.js
|
|
398
|
-
var LruMap = class extends Map {
|
|
399
|
-
constructor(size2) {
|
|
400
|
-
super();
|
|
401
|
-
Object.defineProperty(this, "maxSize", {
|
|
402
|
-
enumerable: true,
|
|
403
|
-
configurable: true,
|
|
404
|
-
writable: true,
|
|
405
|
-
value: void 0
|
|
406
|
-
});
|
|
407
|
-
this.maxSize = size2;
|
|
408
|
-
}
|
|
409
|
-
get(key) {
|
|
410
|
-
const value = super.get(key);
|
|
411
|
-
if (super.has(key) && value !== void 0) {
|
|
412
|
-
this.delete(key);
|
|
413
|
-
super.set(key, value);
|
|
414
|
-
}
|
|
415
|
-
return value;
|
|
416
|
-
}
|
|
417
|
-
set(key, value) {
|
|
418
|
-
super.set(key, value);
|
|
419
|
-
if (this.maxSize && this.size > this.maxSize) {
|
|
420
|
-
const firstKey = this.keys().next().value;
|
|
421
|
-
if (firstKey)
|
|
422
|
-
this.delete(firstKey);
|
|
423
|
-
}
|
|
424
|
-
return this;
|
|
425
|
-
}
|
|
426
|
-
};
|
|
427
|
-
|
|
428
|
-
// ../../node_modules/@noble/hashes/esm/sha3.js
|
|
429
|
-
var _0n = BigInt(0);
|
|
430
|
-
var _1n = BigInt(1);
|
|
431
|
-
var _2n = BigInt(2);
|
|
432
|
-
var _7n = BigInt(7);
|
|
433
|
-
var _256n = BigInt(256);
|
|
434
|
-
var _0x71n = BigInt(113);
|
|
435
|
-
var SHA3_PI = [];
|
|
436
|
-
var SHA3_ROTL = [];
|
|
437
|
-
var _SHA3_IOTA = [];
|
|
438
|
-
for (let round = 0, R = _1n, x = 1, y = 0; round < 24; round++) {
|
|
439
|
-
[x, y] = [y, (2 * x + 3 * y) % 5];
|
|
440
|
-
SHA3_PI.push(2 * (5 * y + x));
|
|
441
|
-
SHA3_ROTL.push((round + 1) * (round + 2) / 2 % 64);
|
|
442
|
-
let t = _0n;
|
|
443
|
-
for (let j = 0; j < 7; j++) {
|
|
444
|
-
R = (R << _1n ^ (R >> _7n) * _0x71n) % _256n;
|
|
445
|
-
if (R & _2n)
|
|
446
|
-
t ^= _1n << (_1n << /* @__PURE__ */ BigInt(j)) - _1n;
|
|
447
|
-
}
|
|
448
|
-
_SHA3_IOTA.push(t);
|
|
449
|
-
}
|
|
450
|
-
var IOTAS = split(_SHA3_IOTA, true);
|
|
451
|
-
var SHA3_IOTA_H = IOTAS[0];
|
|
452
|
-
var SHA3_IOTA_L = IOTAS[1];
|
|
453
|
-
var rotlH = (h, l, s) => s > 32 ? rotlBH(h, l, s) : rotlSH(h, l, s);
|
|
454
|
-
var rotlL = (h, l, s) => s > 32 ? rotlBL(h, l, s) : rotlSL(h, l, s);
|
|
455
|
-
function keccakP(s, rounds = 24) {
|
|
456
|
-
const B = new Uint32Array(5 * 2);
|
|
457
|
-
for (let round = 24 - rounds; round < 24; round++) {
|
|
458
|
-
for (let x = 0; x < 10; x++)
|
|
459
|
-
B[x] = s[x] ^ s[x + 10] ^ s[x + 20] ^ s[x + 30] ^ s[x + 40];
|
|
460
|
-
for (let x = 0; x < 10; x += 2) {
|
|
461
|
-
const idx1 = (x + 8) % 10;
|
|
462
|
-
const idx0 = (x + 2) % 10;
|
|
463
|
-
const B0 = B[idx0];
|
|
464
|
-
const B1 = B[idx0 + 1];
|
|
465
|
-
const Th = rotlH(B0, B1, 1) ^ B[idx1];
|
|
466
|
-
const Tl = rotlL(B0, B1, 1) ^ B[idx1 + 1];
|
|
467
|
-
for (let y = 0; y < 50; y += 10) {
|
|
468
|
-
s[x + y] ^= Th;
|
|
469
|
-
s[x + y + 1] ^= Tl;
|
|
470
|
-
}
|
|
471
|
-
}
|
|
472
|
-
let curH = s[2];
|
|
473
|
-
let curL = s[3];
|
|
474
|
-
for (let t = 0; t < 24; t++) {
|
|
475
|
-
const shift = SHA3_ROTL[t];
|
|
476
|
-
const Th = rotlH(curH, curL, shift);
|
|
477
|
-
const Tl = rotlL(curH, curL, shift);
|
|
478
|
-
const PI = SHA3_PI[t];
|
|
479
|
-
curH = s[PI];
|
|
480
|
-
curL = s[PI + 1];
|
|
481
|
-
s[PI] = Th;
|
|
482
|
-
s[PI + 1] = Tl;
|
|
483
|
-
}
|
|
484
|
-
for (let y = 0; y < 50; y += 10) {
|
|
485
|
-
for (let x = 0; x < 10; x++)
|
|
486
|
-
B[x] = s[y + x];
|
|
487
|
-
for (let x = 0; x < 10; x++)
|
|
488
|
-
s[y + x] ^= ~B[(x + 2) % 10] & B[(x + 4) % 10];
|
|
489
|
-
}
|
|
490
|
-
s[0] ^= SHA3_IOTA_H[round];
|
|
491
|
-
s[1] ^= SHA3_IOTA_L[round];
|
|
492
|
-
}
|
|
493
|
-
clean(B);
|
|
494
|
-
}
|
|
495
|
-
var Keccak = class _Keccak extends Hash {
|
|
496
|
-
// NOTE: we accept arguments in bytes instead of bits here.
|
|
497
|
-
constructor(blockLen, suffix, outputLen, enableXOF = false, rounds = 24) {
|
|
498
|
-
super();
|
|
499
|
-
this.pos = 0;
|
|
500
|
-
this.posOut = 0;
|
|
501
|
-
this.finished = false;
|
|
502
|
-
this.destroyed = false;
|
|
503
|
-
this.enableXOF = false;
|
|
504
|
-
this.blockLen = blockLen;
|
|
505
|
-
this.suffix = suffix;
|
|
506
|
-
this.outputLen = outputLen;
|
|
507
|
-
this.enableXOF = enableXOF;
|
|
508
|
-
this.rounds = rounds;
|
|
509
|
-
anumber(outputLen);
|
|
510
|
-
if (!(0 < blockLen && blockLen < 200))
|
|
511
|
-
throw new Error("only keccak-f1600 function is supported");
|
|
512
|
-
this.state = new Uint8Array(200);
|
|
513
|
-
this.state32 = u32(this.state);
|
|
514
|
-
}
|
|
515
|
-
clone() {
|
|
516
|
-
return this._cloneInto();
|
|
517
|
-
}
|
|
518
|
-
keccak() {
|
|
519
|
-
swap32IfBE(this.state32);
|
|
520
|
-
keccakP(this.state32, this.rounds);
|
|
521
|
-
swap32IfBE(this.state32);
|
|
522
|
-
this.posOut = 0;
|
|
523
|
-
this.pos = 0;
|
|
524
|
-
}
|
|
525
|
-
update(data) {
|
|
526
|
-
aexists(this);
|
|
527
|
-
data = toBytes(data);
|
|
528
|
-
abytes(data);
|
|
529
|
-
const { blockLen, state } = this;
|
|
530
|
-
const len = data.length;
|
|
531
|
-
for (let pos = 0; pos < len; ) {
|
|
532
|
-
const take = Math.min(blockLen - this.pos, len - pos);
|
|
533
|
-
for (let i = 0; i < take; i++)
|
|
534
|
-
state[this.pos++] ^= data[pos++];
|
|
535
|
-
if (this.pos === blockLen)
|
|
536
|
-
this.keccak();
|
|
537
|
-
}
|
|
538
|
-
return this;
|
|
539
|
-
}
|
|
540
|
-
finish() {
|
|
541
|
-
if (this.finished)
|
|
542
|
-
return;
|
|
543
|
-
this.finished = true;
|
|
544
|
-
const { state, suffix, pos, blockLen } = this;
|
|
545
|
-
state[pos] ^= suffix;
|
|
546
|
-
if ((suffix & 128) !== 0 && pos === blockLen - 1)
|
|
547
|
-
this.keccak();
|
|
548
|
-
state[blockLen - 1] ^= 128;
|
|
549
|
-
this.keccak();
|
|
550
|
-
}
|
|
551
|
-
writeInto(out) {
|
|
552
|
-
aexists(this, false);
|
|
553
|
-
abytes(out);
|
|
554
|
-
this.finish();
|
|
555
|
-
const bufferOut = this.state;
|
|
556
|
-
const { blockLen } = this;
|
|
557
|
-
for (let pos = 0, len = out.length; pos < len; ) {
|
|
558
|
-
if (this.posOut >= blockLen)
|
|
559
|
-
this.keccak();
|
|
560
|
-
const take = Math.min(blockLen - this.posOut, len - pos);
|
|
561
|
-
out.set(bufferOut.subarray(this.posOut, this.posOut + take), pos);
|
|
562
|
-
this.posOut += take;
|
|
563
|
-
pos += take;
|
|
564
|
-
}
|
|
565
|
-
return out;
|
|
566
|
-
}
|
|
567
|
-
xofInto(out) {
|
|
568
|
-
if (!this.enableXOF)
|
|
569
|
-
throw new Error("XOF is not possible for this instance");
|
|
570
|
-
return this.writeInto(out);
|
|
571
|
-
}
|
|
572
|
-
xof(bytes) {
|
|
573
|
-
anumber(bytes);
|
|
574
|
-
return this.xofInto(new Uint8Array(bytes));
|
|
575
|
-
}
|
|
576
|
-
digestInto(out) {
|
|
577
|
-
aoutput(out, this);
|
|
578
|
-
if (this.finished)
|
|
579
|
-
throw new Error("digest() was already called");
|
|
580
|
-
this.writeInto(out);
|
|
581
|
-
this.destroy();
|
|
582
|
-
return out;
|
|
583
|
-
}
|
|
584
|
-
digest() {
|
|
585
|
-
return this.digestInto(new Uint8Array(this.outputLen));
|
|
586
|
-
}
|
|
587
|
-
destroy() {
|
|
588
|
-
this.destroyed = true;
|
|
589
|
-
clean(this.state);
|
|
590
|
-
}
|
|
591
|
-
_cloneInto(to) {
|
|
592
|
-
const { blockLen, suffix, outputLen, rounds, enableXOF } = this;
|
|
593
|
-
to || (to = new _Keccak(blockLen, suffix, outputLen, enableXOF, rounds));
|
|
594
|
-
to.state32.set(this.state32);
|
|
595
|
-
to.pos = this.pos;
|
|
596
|
-
to.posOut = this.posOut;
|
|
597
|
-
to.finished = this.finished;
|
|
598
|
-
to.rounds = rounds;
|
|
599
|
-
to.suffix = suffix;
|
|
600
|
-
to.outputLen = outputLen;
|
|
601
|
-
to.enableXOF = enableXOF;
|
|
602
|
-
to.destroyed = this.destroyed;
|
|
603
|
-
return to;
|
|
604
|
-
}
|
|
605
|
-
};
|
|
606
|
-
var gen = (suffix, blockLen, outputLen) => createHasher(() => new Keccak(blockLen, suffix, outputLen));
|
|
607
|
-
var keccak_256 = /* @__PURE__ */ (() => gen(1, 136, 256 / 8))();
|
|
608
|
-
|
|
609
|
-
// ../../node_modules/viem/_esm/utils/hash/keccak256.js
|
|
610
|
-
function keccak256(value, to_) {
|
|
611
|
-
const to = to_ || "hex";
|
|
612
|
-
const bytes = keccak_256(isHex(value, { strict: false }) ? toBytes2(value) : value);
|
|
613
|
-
if (to === "bytes")
|
|
614
|
-
return bytes;
|
|
615
|
-
return toHex(bytes);
|
|
616
|
-
}
|
|
617
|
-
|
|
618
|
-
// ../../node_modules/viem/_esm/utils/address/getAddress.js
|
|
619
|
-
var checksumAddressCache = /* @__PURE__ */ new LruMap(8192);
|
|
620
|
-
function checksumAddress(address_, chainId) {
|
|
621
|
-
if (checksumAddressCache.has(`${address_}.${chainId}`))
|
|
622
|
-
return checksumAddressCache.get(`${address_}.${chainId}`);
|
|
623
|
-
const hexAddress = chainId ? `${chainId}${address_.toLowerCase()}` : address_.substring(2).toLowerCase();
|
|
624
|
-
const hash = keccak256(stringToBytes(hexAddress), "bytes");
|
|
625
|
-
const address = (chainId ? hexAddress.substring(`${chainId}0x`.length) : hexAddress).split("");
|
|
626
|
-
for (let i = 0; i < 40; i += 2) {
|
|
627
|
-
if (hash[i >> 1] >> 4 >= 8 && address[i]) {
|
|
628
|
-
address[i] = address[i].toUpperCase();
|
|
629
|
-
}
|
|
630
|
-
if ((hash[i >> 1] & 15) >= 8 && address[i + 1]) {
|
|
631
|
-
address[i + 1] = address[i + 1].toUpperCase();
|
|
632
|
-
}
|
|
633
|
-
}
|
|
634
|
-
const result = `0x${address.join("")}`;
|
|
635
|
-
checksumAddressCache.set(`${address_}.${chainId}`, result);
|
|
636
|
-
return result;
|
|
637
|
-
}
|
|
638
|
-
|
|
639
|
-
// ../../node_modules/viem/_esm/utils/address/isAddress.js
|
|
640
|
-
var addressRegex = /^0x[a-fA-F0-9]{40}$/;
|
|
641
|
-
var isAddressCache = /* @__PURE__ */ new LruMap(8192);
|
|
642
|
-
function isAddress(address, options) {
|
|
643
|
-
const { strict = true } = options ?? {};
|
|
644
|
-
const cacheKey = `${address}.${strict}`;
|
|
645
|
-
if (isAddressCache.has(cacheKey))
|
|
646
|
-
return isAddressCache.get(cacheKey);
|
|
647
|
-
const result = (() => {
|
|
648
|
-
if (!addressRegex.test(address))
|
|
649
|
-
return false;
|
|
650
|
-
if (address.toLowerCase() === address)
|
|
651
|
-
return true;
|
|
652
|
-
if (strict)
|
|
653
|
-
return checksumAddress(address) === address;
|
|
654
|
-
return true;
|
|
655
|
-
})();
|
|
656
|
-
isAddressCache.set(cacheKey, result);
|
|
657
|
-
return result;
|
|
658
|
-
}
|
|
659
|
-
|
|
660
|
-
export {
|
|
661
|
-
isHex,
|
|
662
|
-
size,
|
|
663
|
-
BaseError,
|
|
664
|
-
SliceOffsetOutOfBoundsError,
|
|
665
|
-
InvalidBytesLengthError,
|
|
666
|
-
padHex,
|
|
667
|
-
IntegerOutOfRangeError,
|
|
668
|
-
InvalidBytesBooleanError,
|
|
669
|
-
trim,
|
|
670
|
-
assertSize,
|
|
671
|
-
hexToBigInt,
|
|
672
|
-
hexToNumber,
|
|
673
|
-
boolToHex,
|
|
674
|
-
bytesToHex,
|
|
675
|
-
numberToHex,
|
|
676
|
-
stringToHex,
|
|
677
|
-
toBytes2 as toBytes,
|
|
678
|
-
hexToBytes,
|
|
679
|
-
keccak256,
|
|
680
|
-
InvalidAddressError,
|
|
681
|
-
checksumAddress,
|
|
682
|
-
isAddress
|
|
683
|
-
};
|
|
684
|
-
//# sourceMappingURL=chunk-TWMXCCSD.js.map
|