@latticexyz/world-module-erc20 2.2.18-90aac1d4acce19ac592d47a090732dd11c1c3e7a → 2.2.18-9fa07c8489f1fbf167d0db01cd9aaa645a29c8e2
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/dist/_esm-55YV6YVE.js +3941 -0
- package/dist/{_esm-BQNWKNND.js.map → _esm-55YV6YVE.js.map} +1 -1
- package/dist/ccip-LZKN25J7.js +15 -0
- package/dist/chunk-DJZL27OA.js +141 -0
- package/dist/chunk-DJZL27OA.js.map +1 -0
- package/dist/chunk-GF52EVJ6.js +3990 -0
- package/dist/chunk-GF52EVJ6.js.map +1 -0
- package/dist/chunk-M7XPBMRG.js +61 -0
- package/dist/chunk-M7XPBMRG.js.map +1 -0
- package/dist/internal.cjs +1253 -0
- package/dist/internal.cjs.map +1 -0
- package/dist/internal.d.cts +10 -0
- package/dist/internal.js +38 -1
- package/dist/internal.js.map +1 -1
- package/dist/mud.config.cjs +103 -0
- package/dist/mud.config.cjs.map +1 -0
- package/dist/mud.config.d.cts +415 -0
- package/dist/mud.config.js +86 -1
- package/dist/mud.config.js.map +1 -1
- package/dist/secp256k1-FOTFQX6Q.js +2418 -0
- package/dist/secp256k1-FOTFQX6Q.js.map +1 -0
- package/package.json +29 -12
- package/dist/_esm-BQNWKNND.js +0 -10
- package/dist/ccip-YAWUVTAX.js +0 -2
- package/dist/chunk-GSBUANUZ.js +0 -30
- package/dist/chunk-GSBUANUZ.js.map +0 -1
- package/dist/chunk-LURIOADG.js +0 -2
- package/dist/chunk-LURIOADG.js.map +0 -1
- package/dist/chunk-TJJDXMQ6.js +0 -7
- package/dist/chunk-TJJDXMQ6.js.map +0 -1
- package/dist/secp256k1-UMYSD4MC.js +0 -22
- package/dist/secp256k1-UMYSD4MC.js.map +0 -1
- /package/dist/{ccip-YAWUVTAX.js.map → ccip-LZKN25J7.js.map} +0 -0
|
@@ -0,0 +1,1253 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __esm = (fn, res) => function __init() {
|
|
7
|
+
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
8
|
+
};
|
|
9
|
+
var __export = (target, all) => {
|
|
10
|
+
for (var name in all)
|
|
11
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
12
|
+
};
|
|
13
|
+
var __copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from))
|
|
16
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
17
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
18
|
+
}
|
|
19
|
+
return to;
|
|
20
|
+
};
|
|
21
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
22
|
+
|
|
23
|
+
// ../../node_modules/.pnpm/tsup@8.3.0_@microsoft+api-extractor@7.47.7_@types+node@20.17.16__jiti@1.21.6_postcss@8.5.1_ts_rihtmhm6tp3cagz6w7ivhbdyn4/node_modules/tsup/assets/cjs_shims.js
|
|
24
|
+
var init_cjs_shims = __esm({
|
|
25
|
+
"../../node_modules/.pnpm/tsup@8.3.0_@microsoft+api-extractor@7.47.7_@types+node@20.17.16__jiti@1.21.6_postcss@8.5.1_ts_rihtmhm6tp3cagz6w7ivhbdyn4/node_modules/tsup/assets/cjs_shims.js"() {
|
|
26
|
+
"use strict";
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
// ../../node_modules/.pnpm/viem@2.21.19_bufferutil@4.0.8_typescript@5.4.2_utf-8-validate@5.0.10_zod@3.23.8/node_modules/viem/_esm/utils/data/isHex.js
|
|
31
|
+
function isHex(value, { strict = true } = {}) {
|
|
32
|
+
if (!value)
|
|
33
|
+
return false;
|
|
34
|
+
if (typeof value !== "string")
|
|
35
|
+
return false;
|
|
36
|
+
return strict ? /^0x[0-9a-fA-F]*$/.test(value) : value.startsWith("0x");
|
|
37
|
+
}
|
|
38
|
+
var init_isHex = __esm({
|
|
39
|
+
"../../node_modules/.pnpm/viem@2.21.19_bufferutil@4.0.8_typescript@5.4.2_utf-8-validate@5.0.10_zod@3.23.8/node_modules/viem/_esm/utils/data/isHex.js"() {
|
|
40
|
+
"use strict";
|
|
41
|
+
init_cjs_shims();
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
// ../../node_modules/.pnpm/viem@2.21.19_bufferutil@4.0.8_typescript@5.4.2_utf-8-validate@5.0.10_zod@3.23.8/node_modules/viem/_esm/utils/data/size.js
|
|
46
|
+
function size(value) {
|
|
47
|
+
if (isHex(value, { strict: false }))
|
|
48
|
+
return Math.ceil((value.length - 2) / 2);
|
|
49
|
+
return value.length;
|
|
50
|
+
}
|
|
51
|
+
var init_size = __esm({
|
|
52
|
+
"../../node_modules/.pnpm/viem@2.21.19_bufferutil@4.0.8_typescript@5.4.2_utf-8-validate@5.0.10_zod@3.23.8/node_modules/viem/_esm/utils/data/size.js"() {
|
|
53
|
+
"use strict";
|
|
54
|
+
init_cjs_shims();
|
|
55
|
+
init_isHex();
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
// ../../node_modules/.pnpm/viem@2.21.19_bufferutil@4.0.8_typescript@5.4.2_utf-8-validate@5.0.10_zod@3.23.8/node_modules/viem/_esm/errors/version.js
|
|
60
|
+
var version;
|
|
61
|
+
var init_version = __esm({
|
|
62
|
+
"../../node_modules/.pnpm/viem@2.21.19_bufferutil@4.0.8_typescript@5.4.2_utf-8-validate@5.0.10_zod@3.23.8/node_modules/viem/_esm/errors/version.js"() {
|
|
63
|
+
"use strict";
|
|
64
|
+
init_cjs_shims();
|
|
65
|
+
version = "2.21.19";
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
// ../../node_modules/.pnpm/viem@2.21.19_bufferutil@4.0.8_typescript@5.4.2_utf-8-validate@5.0.10_zod@3.23.8/node_modules/viem/_esm/errors/base.js
|
|
70
|
+
function walk(err, fn) {
|
|
71
|
+
if (fn?.(err))
|
|
72
|
+
return err;
|
|
73
|
+
if (err && typeof err === "object" && "cause" in err)
|
|
74
|
+
return walk(err.cause, fn);
|
|
75
|
+
return fn ? null : err;
|
|
76
|
+
}
|
|
77
|
+
var errorConfig, BaseError;
|
|
78
|
+
var init_base = __esm({
|
|
79
|
+
"../../node_modules/.pnpm/viem@2.21.19_bufferutil@4.0.8_typescript@5.4.2_utf-8-validate@5.0.10_zod@3.23.8/node_modules/viem/_esm/errors/base.js"() {
|
|
80
|
+
"use strict";
|
|
81
|
+
init_cjs_shims();
|
|
82
|
+
init_version();
|
|
83
|
+
errorConfig = {
|
|
84
|
+
getDocsUrl: ({ docsBaseUrl, docsPath = "", docsSlug }) => docsPath ? `${docsBaseUrl ?? "https://viem.sh"}${docsPath}${docsSlug ? `#${docsSlug}` : ""}` : void 0,
|
|
85
|
+
version
|
|
86
|
+
};
|
|
87
|
+
BaseError = class _BaseError extends Error {
|
|
88
|
+
constructor(shortMessage, args = {}) {
|
|
89
|
+
const details = (() => {
|
|
90
|
+
if (args.cause instanceof _BaseError)
|
|
91
|
+
return args.cause.details;
|
|
92
|
+
if (args.cause?.message)
|
|
93
|
+
return args.cause.message;
|
|
94
|
+
return args.details;
|
|
95
|
+
})();
|
|
96
|
+
const docsPath = (() => {
|
|
97
|
+
if (args.cause instanceof _BaseError)
|
|
98
|
+
return args.cause.docsPath || args.docsPath;
|
|
99
|
+
return args.docsPath;
|
|
100
|
+
})();
|
|
101
|
+
const docsUrl = errorConfig.getDocsUrl?.({ ...args, docsPath });
|
|
102
|
+
const message = [
|
|
103
|
+
shortMessage || "An error occurred.",
|
|
104
|
+
"",
|
|
105
|
+
...args.metaMessages ? [...args.metaMessages, ""] : [],
|
|
106
|
+
...docsUrl ? [`Docs: ${docsUrl}`] : [],
|
|
107
|
+
...details ? [`Details: ${details}`] : [],
|
|
108
|
+
...errorConfig.version ? [`Version: ${errorConfig.version}`] : []
|
|
109
|
+
].join("\n");
|
|
110
|
+
super(message, args.cause ? { cause: args.cause } : void 0);
|
|
111
|
+
Object.defineProperty(this, "details", {
|
|
112
|
+
enumerable: true,
|
|
113
|
+
configurable: true,
|
|
114
|
+
writable: true,
|
|
115
|
+
value: void 0
|
|
116
|
+
});
|
|
117
|
+
Object.defineProperty(this, "docsPath", {
|
|
118
|
+
enumerable: true,
|
|
119
|
+
configurable: true,
|
|
120
|
+
writable: true,
|
|
121
|
+
value: void 0
|
|
122
|
+
});
|
|
123
|
+
Object.defineProperty(this, "metaMessages", {
|
|
124
|
+
enumerable: true,
|
|
125
|
+
configurable: true,
|
|
126
|
+
writable: true,
|
|
127
|
+
value: void 0
|
|
128
|
+
});
|
|
129
|
+
Object.defineProperty(this, "shortMessage", {
|
|
130
|
+
enumerable: true,
|
|
131
|
+
configurable: true,
|
|
132
|
+
writable: true,
|
|
133
|
+
value: void 0
|
|
134
|
+
});
|
|
135
|
+
Object.defineProperty(this, "version", {
|
|
136
|
+
enumerable: true,
|
|
137
|
+
configurable: true,
|
|
138
|
+
writable: true,
|
|
139
|
+
value: void 0
|
|
140
|
+
});
|
|
141
|
+
Object.defineProperty(this, "name", {
|
|
142
|
+
enumerable: true,
|
|
143
|
+
configurable: true,
|
|
144
|
+
writable: true,
|
|
145
|
+
value: "BaseError"
|
|
146
|
+
});
|
|
147
|
+
this.details = details;
|
|
148
|
+
this.docsPath = docsPath;
|
|
149
|
+
this.metaMessages = args.metaMessages;
|
|
150
|
+
this.name = args.name ?? this.name;
|
|
151
|
+
this.shortMessage = shortMessage;
|
|
152
|
+
this.version = version;
|
|
153
|
+
}
|
|
154
|
+
walk(fn) {
|
|
155
|
+
return walk(this, fn);
|
|
156
|
+
}
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
});
|
|
160
|
+
|
|
161
|
+
// ../../node_modules/.pnpm/viem@2.21.19_bufferutil@4.0.8_typescript@5.4.2_utf-8-validate@5.0.10_zod@3.23.8/node_modules/viem/_esm/errors/abi.js
|
|
162
|
+
var AbiEncodingArrayLengthMismatchError, AbiEncodingBytesSizeMismatchError, AbiEncodingLengthMismatchError, InvalidAbiEncodingTypeError, InvalidArrayError;
|
|
163
|
+
var init_abi = __esm({
|
|
164
|
+
"../../node_modules/.pnpm/viem@2.21.19_bufferutil@4.0.8_typescript@5.4.2_utf-8-validate@5.0.10_zod@3.23.8/node_modules/viem/_esm/errors/abi.js"() {
|
|
165
|
+
"use strict";
|
|
166
|
+
init_cjs_shims();
|
|
167
|
+
init_size();
|
|
168
|
+
init_base();
|
|
169
|
+
AbiEncodingArrayLengthMismatchError = class extends BaseError {
|
|
170
|
+
constructor({ expectedLength, givenLength, type }) {
|
|
171
|
+
super([
|
|
172
|
+
`ABI encoding array length mismatch for type ${type}.`,
|
|
173
|
+
`Expected length: ${expectedLength}`,
|
|
174
|
+
`Given length: ${givenLength}`
|
|
175
|
+
].join("\n"), { name: "AbiEncodingArrayLengthMismatchError" });
|
|
176
|
+
}
|
|
177
|
+
};
|
|
178
|
+
AbiEncodingBytesSizeMismatchError = class extends BaseError {
|
|
179
|
+
constructor({ expectedSize, value }) {
|
|
180
|
+
super(`Size of bytes "${value}" (bytes${size(value)}) does not match expected size (bytes${expectedSize}).`, { name: "AbiEncodingBytesSizeMismatchError" });
|
|
181
|
+
}
|
|
182
|
+
};
|
|
183
|
+
AbiEncodingLengthMismatchError = class extends BaseError {
|
|
184
|
+
constructor({ expectedLength, givenLength }) {
|
|
185
|
+
super([
|
|
186
|
+
"ABI encoding params/values length mismatch.",
|
|
187
|
+
`Expected length (params): ${expectedLength}`,
|
|
188
|
+
`Given length (values): ${givenLength}`
|
|
189
|
+
].join("\n"), { name: "AbiEncodingLengthMismatchError" });
|
|
190
|
+
}
|
|
191
|
+
};
|
|
192
|
+
InvalidAbiEncodingTypeError = class extends BaseError {
|
|
193
|
+
constructor(type, { docsPath }) {
|
|
194
|
+
super([
|
|
195
|
+
`Type "${type}" is not a valid encoding type.`,
|
|
196
|
+
"Please provide a valid ABI type."
|
|
197
|
+
].join("\n"), { docsPath, name: "InvalidAbiEncodingType" });
|
|
198
|
+
}
|
|
199
|
+
};
|
|
200
|
+
InvalidArrayError = class extends BaseError {
|
|
201
|
+
constructor(value) {
|
|
202
|
+
super([`Value "${value}" is not a valid array.`].join("\n"), {
|
|
203
|
+
name: "InvalidArrayError"
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
});
|
|
209
|
+
|
|
210
|
+
// ../../node_modules/.pnpm/viem@2.21.19_bufferutil@4.0.8_typescript@5.4.2_utf-8-validate@5.0.10_zod@3.23.8/node_modules/viem/_esm/errors/data.js
|
|
211
|
+
var SliceOffsetOutOfBoundsError, SizeExceedsPaddingSizeError;
|
|
212
|
+
var init_data = __esm({
|
|
213
|
+
"../../node_modules/.pnpm/viem@2.21.19_bufferutil@4.0.8_typescript@5.4.2_utf-8-validate@5.0.10_zod@3.23.8/node_modules/viem/_esm/errors/data.js"() {
|
|
214
|
+
"use strict";
|
|
215
|
+
init_cjs_shims();
|
|
216
|
+
init_base();
|
|
217
|
+
SliceOffsetOutOfBoundsError = class extends BaseError {
|
|
218
|
+
constructor({ offset, position, size: size2 }) {
|
|
219
|
+
super(`Slice ${position === "start" ? "starting" : "ending"} at offset "${offset}" is out-of-bounds (size: ${size2}).`, { name: "SliceOffsetOutOfBoundsError" });
|
|
220
|
+
}
|
|
221
|
+
};
|
|
222
|
+
SizeExceedsPaddingSizeError = class extends BaseError {
|
|
223
|
+
constructor({ size: size2, targetSize, type }) {
|
|
224
|
+
super(`${type.charAt(0).toUpperCase()}${type.slice(1).toLowerCase()} size (${size2}) exceeds padding size (${targetSize}).`, { name: "SizeExceedsPaddingSizeError" });
|
|
225
|
+
}
|
|
226
|
+
};
|
|
227
|
+
}
|
|
228
|
+
});
|
|
229
|
+
|
|
230
|
+
// ../../node_modules/.pnpm/viem@2.21.19_bufferutil@4.0.8_typescript@5.4.2_utf-8-validate@5.0.10_zod@3.23.8/node_modules/viem/_esm/utils/data/pad.js
|
|
231
|
+
function pad(hexOrBytes, { dir, size: size2 = 32 } = {}) {
|
|
232
|
+
if (typeof hexOrBytes === "string")
|
|
233
|
+
return padHex(hexOrBytes, { dir, size: size2 });
|
|
234
|
+
return padBytes(hexOrBytes, { dir, size: size2 });
|
|
235
|
+
}
|
|
236
|
+
function padHex(hex_, { dir, size: size2 = 32 } = {}) {
|
|
237
|
+
if (size2 === null)
|
|
238
|
+
return hex_;
|
|
239
|
+
const hex = hex_.replace("0x", "");
|
|
240
|
+
if (hex.length > size2 * 2)
|
|
241
|
+
throw new SizeExceedsPaddingSizeError({
|
|
242
|
+
size: Math.ceil(hex.length / 2),
|
|
243
|
+
targetSize: size2,
|
|
244
|
+
type: "hex"
|
|
245
|
+
});
|
|
246
|
+
return `0x${hex[dir === "right" ? "padEnd" : "padStart"](size2 * 2, "0")}`;
|
|
247
|
+
}
|
|
248
|
+
function padBytes(bytes2, { dir, size: size2 = 32 } = {}) {
|
|
249
|
+
if (size2 === null)
|
|
250
|
+
return bytes2;
|
|
251
|
+
if (bytes2.length > size2)
|
|
252
|
+
throw new SizeExceedsPaddingSizeError({
|
|
253
|
+
size: bytes2.length,
|
|
254
|
+
targetSize: size2,
|
|
255
|
+
type: "bytes"
|
|
256
|
+
});
|
|
257
|
+
const paddedBytes = new Uint8Array(size2);
|
|
258
|
+
for (let i = 0; i < size2; i++) {
|
|
259
|
+
const padEnd = dir === "right";
|
|
260
|
+
paddedBytes[padEnd ? i : size2 - i - 1] = bytes2[padEnd ? i : bytes2.length - i - 1];
|
|
261
|
+
}
|
|
262
|
+
return paddedBytes;
|
|
263
|
+
}
|
|
264
|
+
var init_pad = __esm({
|
|
265
|
+
"../../node_modules/.pnpm/viem@2.21.19_bufferutil@4.0.8_typescript@5.4.2_utf-8-validate@5.0.10_zod@3.23.8/node_modules/viem/_esm/utils/data/pad.js"() {
|
|
266
|
+
"use strict";
|
|
267
|
+
init_cjs_shims();
|
|
268
|
+
init_data();
|
|
269
|
+
}
|
|
270
|
+
});
|
|
271
|
+
|
|
272
|
+
// ../../node_modules/.pnpm/viem@2.21.19_bufferutil@4.0.8_typescript@5.4.2_utf-8-validate@5.0.10_zod@3.23.8/node_modules/viem/_esm/errors/encoding.js
|
|
273
|
+
var IntegerOutOfRangeError, SizeOverflowError;
|
|
274
|
+
var init_encoding = __esm({
|
|
275
|
+
"../../node_modules/.pnpm/viem@2.21.19_bufferutil@4.0.8_typescript@5.4.2_utf-8-validate@5.0.10_zod@3.23.8/node_modules/viem/_esm/errors/encoding.js"() {
|
|
276
|
+
"use strict";
|
|
277
|
+
init_cjs_shims();
|
|
278
|
+
init_base();
|
|
279
|
+
IntegerOutOfRangeError = class extends BaseError {
|
|
280
|
+
constructor({ max, min, signed, size: size2, value }) {
|
|
281
|
+
super(`Number "${value}" is not in safe ${size2 ? `${size2 * 8}-bit ${signed ? "signed" : "unsigned"} ` : ""}integer range ${max ? `(${min} to ${max})` : `(above ${min})`}`, { name: "IntegerOutOfRangeError" });
|
|
282
|
+
}
|
|
283
|
+
};
|
|
284
|
+
SizeOverflowError = class extends BaseError {
|
|
285
|
+
constructor({ givenSize, maxSize }) {
|
|
286
|
+
super(`Size cannot exceed ${maxSize} bytes. Given size: ${givenSize} bytes.`, { name: "SizeOverflowError" });
|
|
287
|
+
}
|
|
288
|
+
};
|
|
289
|
+
}
|
|
290
|
+
});
|
|
291
|
+
|
|
292
|
+
// ../../node_modules/.pnpm/viem@2.21.19_bufferutil@4.0.8_typescript@5.4.2_utf-8-validate@5.0.10_zod@3.23.8/node_modules/viem/_esm/utils/encoding/fromHex.js
|
|
293
|
+
function assertSize(hexOrBytes, { size: size2 }) {
|
|
294
|
+
if (size(hexOrBytes) > size2)
|
|
295
|
+
throw new SizeOverflowError({
|
|
296
|
+
givenSize: size(hexOrBytes),
|
|
297
|
+
maxSize: size2
|
|
298
|
+
});
|
|
299
|
+
}
|
|
300
|
+
var init_fromHex = __esm({
|
|
301
|
+
"../../node_modules/.pnpm/viem@2.21.19_bufferutil@4.0.8_typescript@5.4.2_utf-8-validate@5.0.10_zod@3.23.8/node_modules/viem/_esm/utils/encoding/fromHex.js"() {
|
|
302
|
+
"use strict";
|
|
303
|
+
init_cjs_shims();
|
|
304
|
+
init_encoding();
|
|
305
|
+
init_size();
|
|
306
|
+
}
|
|
307
|
+
});
|
|
308
|
+
|
|
309
|
+
// ../../node_modules/.pnpm/viem@2.21.19_bufferutil@4.0.8_typescript@5.4.2_utf-8-validate@5.0.10_zod@3.23.8/node_modules/viem/_esm/utils/encoding/toHex.js
|
|
310
|
+
function toHex(value, opts = {}) {
|
|
311
|
+
if (typeof value === "number" || typeof value === "bigint")
|
|
312
|
+
return numberToHex(value, opts);
|
|
313
|
+
if (typeof value === "string") {
|
|
314
|
+
return stringToHex(value, opts);
|
|
315
|
+
}
|
|
316
|
+
if (typeof value === "boolean")
|
|
317
|
+
return boolToHex(value, opts);
|
|
318
|
+
return bytesToHex(value, opts);
|
|
319
|
+
}
|
|
320
|
+
function boolToHex(value, opts = {}) {
|
|
321
|
+
const hex = `0x${Number(value)}`;
|
|
322
|
+
if (typeof opts.size === "number") {
|
|
323
|
+
assertSize(hex, { size: opts.size });
|
|
324
|
+
return pad(hex, { size: opts.size });
|
|
325
|
+
}
|
|
326
|
+
return hex;
|
|
327
|
+
}
|
|
328
|
+
function bytesToHex(value, opts = {}) {
|
|
329
|
+
let string = "";
|
|
330
|
+
for (let i = 0; i < value.length; i++) {
|
|
331
|
+
string += hexes[value[i]];
|
|
332
|
+
}
|
|
333
|
+
const hex = `0x${string}`;
|
|
334
|
+
if (typeof opts.size === "number") {
|
|
335
|
+
assertSize(hex, { size: opts.size });
|
|
336
|
+
return pad(hex, { dir: "right", size: opts.size });
|
|
337
|
+
}
|
|
338
|
+
return hex;
|
|
339
|
+
}
|
|
340
|
+
function numberToHex(value_, opts = {}) {
|
|
341
|
+
const { signed, size: size2 } = opts;
|
|
342
|
+
const value = BigInt(value_);
|
|
343
|
+
let maxValue;
|
|
344
|
+
if (size2) {
|
|
345
|
+
if (signed)
|
|
346
|
+
maxValue = (1n << BigInt(size2) * 8n - 1n) - 1n;
|
|
347
|
+
else
|
|
348
|
+
maxValue = 2n ** (BigInt(size2) * 8n) - 1n;
|
|
349
|
+
} else if (typeof value_ === "number") {
|
|
350
|
+
maxValue = BigInt(Number.MAX_SAFE_INTEGER);
|
|
351
|
+
}
|
|
352
|
+
const minValue = typeof maxValue === "bigint" && signed ? -maxValue - 1n : 0;
|
|
353
|
+
if (maxValue && value > maxValue || value < minValue) {
|
|
354
|
+
const suffix = typeof value_ === "bigint" ? "n" : "";
|
|
355
|
+
throw new IntegerOutOfRangeError({
|
|
356
|
+
max: maxValue ? `${maxValue}${suffix}` : void 0,
|
|
357
|
+
min: `${minValue}${suffix}`,
|
|
358
|
+
signed,
|
|
359
|
+
size: size2,
|
|
360
|
+
value: `${value_}${suffix}`
|
|
361
|
+
});
|
|
362
|
+
}
|
|
363
|
+
const hex = `0x${(signed && value < 0 ? (1n << BigInt(size2 * 8)) + BigInt(value) : value).toString(16)}`;
|
|
364
|
+
if (size2)
|
|
365
|
+
return pad(hex, { size: size2 });
|
|
366
|
+
return hex;
|
|
367
|
+
}
|
|
368
|
+
function stringToHex(value_, opts = {}) {
|
|
369
|
+
const value = encoder.encode(value_);
|
|
370
|
+
return bytesToHex(value, opts);
|
|
371
|
+
}
|
|
372
|
+
var hexes, encoder;
|
|
373
|
+
var init_toHex = __esm({
|
|
374
|
+
"../../node_modules/.pnpm/viem@2.21.19_bufferutil@4.0.8_typescript@5.4.2_utf-8-validate@5.0.10_zod@3.23.8/node_modules/viem/_esm/utils/encoding/toHex.js"() {
|
|
375
|
+
"use strict";
|
|
376
|
+
init_cjs_shims();
|
|
377
|
+
init_encoding();
|
|
378
|
+
init_pad();
|
|
379
|
+
init_fromHex();
|
|
380
|
+
hexes = /* @__PURE__ */ Array.from({ length: 256 }, (_v, i) => i.toString(16).padStart(2, "0"));
|
|
381
|
+
encoder = /* @__PURE__ */ new TextEncoder();
|
|
382
|
+
}
|
|
383
|
+
});
|
|
384
|
+
|
|
385
|
+
// ../../node_modules/.pnpm/viem@2.21.19_bufferutil@4.0.8_typescript@5.4.2_utf-8-validate@5.0.10_zod@3.23.8/node_modules/viem/_esm/utils/encoding/toBytes.js
|
|
386
|
+
function toBytes(value, opts = {}) {
|
|
387
|
+
if (typeof value === "number" || typeof value === "bigint")
|
|
388
|
+
return numberToBytes(value, opts);
|
|
389
|
+
if (typeof value === "boolean")
|
|
390
|
+
return boolToBytes(value, opts);
|
|
391
|
+
if (isHex(value))
|
|
392
|
+
return hexToBytes(value, opts);
|
|
393
|
+
return stringToBytes(value, opts);
|
|
394
|
+
}
|
|
395
|
+
function boolToBytes(value, opts = {}) {
|
|
396
|
+
const bytes2 = new Uint8Array(1);
|
|
397
|
+
bytes2[0] = Number(value);
|
|
398
|
+
if (typeof opts.size === "number") {
|
|
399
|
+
assertSize(bytes2, { size: opts.size });
|
|
400
|
+
return pad(bytes2, { size: opts.size });
|
|
401
|
+
}
|
|
402
|
+
return bytes2;
|
|
403
|
+
}
|
|
404
|
+
function charCodeToBase16(char) {
|
|
405
|
+
if (char >= charCodeMap.zero && char <= charCodeMap.nine)
|
|
406
|
+
return char - charCodeMap.zero;
|
|
407
|
+
if (char >= charCodeMap.A && char <= charCodeMap.F)
|
|
408
|
+
return char - (charCodeMap.A - 10);
|
|
409
|
+
if (char >= charCodeMap.a && char <= charCodeMap.f)
|
|
410
|
+
return char - (charCodeMap.a - 10);
|
|
411
|
+
return void 0;
|
|
412
|
+
}
|
|
413
|
+
function hexToBytes(hex_, opts = {}) {
|
|
414
|
+
let hex = hex_;
|
|
415
|
+
if (opts.size) {
|
|
416
|
+
assertSize(hex, { size: opts.size });
|
|
417
|
+
hex = pad(hex, { dir: "right", size: opts.size });
|
|
418
|
+
}
|
|
419
|
+
let hexString = hex.slice(2);
|
|
420
|
+
if (hexString.length % 2)
|
|
421
|
+
hexString = `0${hexString}`;
|
|
422
|
+
const length = hexString.length / 2;
|
|
423
|
+
const bytes2 = new Uint8Array(length);
|
|
424
|
+
for (let index = 0, j = 0; index < length; index++) {
|
|
425
|
+
const nibbleLeft = charCodeToBase16(hexString.charCodeAt(j++));
|
|
426
|
+
const nibbleRight = charCodeToBase16(hexString.charCodeAt(j++));
|
|
427
|
+
if (nibbleLeft === void 0 || nibbleRight === void 0) {
|
|
428
|
+
throw new BaseError(`Invalid byte sequence ("${hexString[j - 2]}${hexString[j - 1]}" in "${hexString}").`);
|
|
429
|
+
}
|
|
430
|
+
bytes2[index] = nibbleLeft * 16 + nibbleRight;
|
|
431
|
+
}
|
|
432
|
+
return bytes2;
|
|
433
|
+
}
|
|
434
|
+
function numberToBytes(value, opts) {
|
|
435
|
+
const hex = numberToHex(value, opts);
|
|
436
|
+
return hexToBytes(hex);
|
|
437
|
+
}
|
|
438
|
+
function stringToBytes(value, opts = {}) {
|
|
439
|
+
const bytes2 = encoder2.encode(value);
|
|
440
|
+
if (typeof opts.size === "number") {
|
|
441
|
+
assertSize(bytes2, { size: opts.size });
|
|
442
|
+
return pad(bytes2, { dir: "right", size: opts.size });
|
|
443
|
+
}
|
|
444
|
+
return bytes2;
|
|
445
|
+
}
|
|
446
|
+
var encoder2, charCodeMap;
|
|
447
|
+
var init_toBytes = __esm({
|
|
448
|
+
"../../node_modules/.pnpm/viem@2.21.19_bufferutil@4.0.8_typescript@5.4.2_utf-8-validate@5.0.10_zod@3.23.8/node_modules/viem/_esm/utils/encoding/toBytes.js"() {
|
|
449
|
+
"use strict";
|
|
450
|
+
init_cjs_shims();
|
|
451
|
+
init_base();
|
|
452
|
+
init_isHex();
|
|
453
|
+
init_pad();
|
|
454
|
+
init_fromHex();
|
|
455
|
+
init_toHex();
|
|
456
|
+
encoder2 = /* @__PURE__ */ new TextEncoder();
|
|
457
|
+
charCodeMap = {
|
|
458
|
+
zero: 48,
|
|
459
|
+
nine: 57,
|
|
460
|
+
A: 65,
|
|
461
|
+
F: 70,
|
|
462
|
+
a: 97,
|
|
463
|
+
f: 102
|
|
464
|
+
};
|
|
465
|
+
}
|
|
466
|
+
});
|
|
467
|
+
|
|
468
|
+
// ../../node_modules/.pnpm/@noble+hashes@1.5.0/node_modules/@noble/hashes/esm/_assert.js
|
|
469
|
+
function number(n) {
|
|
470
|
+
if (!Number.isSafeInteger(n) || n < 0)
|
|
471
|
+
throw new Error(`positive integer expected, not ${n}`);
|
|
472
|
+
}
|
|
473
|
+
function isBytes(a) {
|
|
474
|
+
return a instanceof Uint8Array || a != null && typeof a === "object" && a.constructor.name === "Uint8Array";
|
|
475
|
+
}
|
|
476
|
+
function bytes(b, ...lengths) {
|
|
477
|
+
if (!isBytes(b))
|
|
478
|
+
throw new Error("Uint8Array expected");
|
|
479
|
+
if (lengths.length > 0 && !lengths.includes(b.length))
|
|
480
|
+
throw new Error(`Uint8Array expected of length ${lengths}, not of length=${b.length}`);
|
|
481
|
+
}
|
|
482
|
+
function exists(instance, checkFinished = true) {
|
|
483
|
+
if (instance.destroyed)
|
|
484
|
+
throw new Error("Hash instance has been destroyed");
|
|
485
|
+
if (checkFinished && instance.finished)
|
|
486
|
+
throw new Error("Hash#digest() has already been called");
|
|
487
|
+
}
|
|
488
|
+
function output(out, instance) {
|
|
489
|
+
bytes(out);
|
|
490
|
+
const min = instance.outputLen;
|
|
491
|
+
if (out.length < min) {
|
|
492
|
+
throw new Error(`digestInto() expects output buffer of length at least ${min}`);
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
var init_assert = __esm({
|
|
496
|
+
"../../node_modules/.pnpm/@noble+hashes@1.5.0/node_modules/@noble/hashes/esm/_assert.js"() {
|
|
497
|
+
"use strict";
|
|
498
|
+
init_cjs_shims();
|
|
499
|
+
}
|
|
500
|
+
});
|
|
501
|
+
|
|
502
|
+
// ../../node_modules/.pnpm/@noble+hashes@1.5.0/node_modules/@noble/hashes/esm/_u64.js
|
|
503
|
+
function fromBig(n, le = false) {
|
|
504
|
+
if (le)
|
|
505
|
+
return { h: Number(n & U32_MASK64), l: Number(n >> _32n & U32_MASK64) };
|
|
506
|
+
return { h: Number(n >> _32n & U32_MASK64) | 0, l: Number(n & U32_MASK64) | 0 };
|
|
507
|
+
}
|
|
508
|
+
function split(lst, le = false) {
|
|
509
|
+
let Ah = new Uint32Array(lst.length);
|
|
510
|
+
let Al = new Uint32Array(lst.length);
|
|
511
|
+
for (let i = 0; i < lst.length; i++) {
|
|
512
|
+
const { h, l } = fromBig(lst[i], le);
|
|
513
|
+
[Ah[i], Al[i]] = [h, l];
|
|
514
|
+
}
|
|
515
|
+
return [Ah, Al];
|
|
516
|
+
}
|
|
517
|
+
var U32_MASK64, _32n, rotlSH, rotlSL, rotlBH, rotlBL;
|
|
518
|
+
var init_u64 = __esm({
|
|
519
|
+
"../../node_modules/.pnpm/@noble+hashes@1.5.0/node_modules/@noble/hashes/esm/_u64.js"() {
|
|
520
|
+
"use strict";
|
|
521
|
+
init_cjs_shims();
|
|
522
|
+
U32_MASK64 = /* @__PURE__ */ BigInt(2 ** 32 - 1);
|
|
523
|
+
_32n = /* @__PURE__ */ BigInt(32);
|
|
524
|
+
rotlSH = (h, l, s) => h << s | l >>> 32 - s;
|
|
525
|
+
rotlSL = (h, l, s) => l << s | h >>> 32 - s;
|
|
526
|
+
rotlBH = (h, l, s) => l << s - 32 | h >>> 64 - s;
|
|
527
|
+
rotlBL = (h, l, s) => h << s - 32 | l >>> 64 - s;
|
|
528
|
+
}
|
|
529
|
+
});
|
|
530
|
+
|
|
531
|
+
// ../../node_modules/.pnpm/@noble+hashes@1.5.0/node_modules/@noble/hashes/esm/utils.js
|
|
532
|
+
function byteSwap32(arr) {
|
|
533
|
+
for (let i = 0; i < arr.length; i++) {
|
|
534
|
+
arr[i] = byteSwap(arr[i]);
|
|
535
|
+
}
|
|
536
|
+
}
|
|
537
|
+
function utf8ToBytes(str) {
|
|
538
|
+
if (typeof str !== "string")
|
|
539
|
+
throw new Error(`utf8ToBytes expected string, got ${typeof str}`);
|
|
540
|
+
return new Uint8Array(new TextEncoder().encode(str));
|
|
541
|
+
}
|
|
542
|
+
function toBytes2(data) {
|
|
543
|
+
if (typeof data === "string")
|
|
544
|
+
data = utf8ToBytes(data);
|
|
545
|
+
bytes(data);
|
|
546
|
+
return data;
|
|
547
|
+
}
|
|
548
|
+
function wrapConstructor(hashCons) {
|
|
549
|
+
const hashC = (msg) => hashCons().update(toBytes2(msg)).digest();
|
|
550
|
+
const tmp = hashCons();
|
|
551
|
+
hashC.outputLen = tmp.outputLen;
|
|
552
|
+
hashC.blockLen = tmp.blockLen;
|
|
553
|
+
hashC.create = () => hashCons();
|
|
554
|
+
return hashC;
|
|
555
|
+
}
|
|
556
|
+
function wrapXOFConstructorWithOpts(hashCons) {
|
|
557
|
+
const hashC = (msg, opts) => hashCons(opts).update(toBytes2(msg)).digest();
|
|
558
|
+
const tmp = hashCons({});
|
|
559
|
+
hashC.outputLen = tmp.outputLen;
|
|
560
|
+
hashC.blockLen = tmp.blockLen;
|
|
561
|
+
hashC.create = (opts) => hashCons(opts);
|
|
562
|
+
return hashC;
|
|
563
|
+
}
|
|
564
|
+
var u32, isLE, byteSwap, Hash, toStr;
|
|
565
|
+
var init_utils = __esm({
|
|
566
|
+
"../../node_modules/.pnpm/@noble+hashes@1.5.0/node_modules/@noble/hashes/esm/utils.js"() {
|
|
567
|
+
"use strict";
|
|
568
|
+
init_cjs_shims();
|
|
569
|
+
init_assert();
|
|
570
|
+
u32 = (arr) => new Uint32Array(arr.buffer, arr.byteOffset, Math.floor(arr.byteLength / 4));
|
|
571
|
+
isLE = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68;
|
|
572
|
+
byteSwap = (word) => word << 24 & 4278190080 | word << 8 & 16711680 | word >>> 8 & 65280 | word >>> 24 & 255;
|
|
573
|
+
Hash = class {
|
|
574
|
+
// Safe version that clones internal state
|
|
575
|
+
clone() {
|
|
576
|
+
return this._cloneInto();
|
|
577
|
+
}
|
|
578
|
+
};
|
|
579
|
+
toStr = {}.toString;
|
|
580
|
+
}
|
|
581
|
+
});
|
|
582
|
+
|
|
583
|
+
// ../../node_modules/.pnpm/@noble+hashes@1.5.0/node_modules/@noble/hashes/esm/sha3.js
|
|
584
|
+
function keccakP(s, rounds = 24) {
|
|
585
|
+
const B = new Uint32Array(5 * 2);
|
|
586
|
+
for (let round = 24 - rounds; round < 24; round++) {
|
|
587
|
+
for (let x = 0; x < 10; x++)
|
|
588
|
+
B[x] = s[x] ^ s[x + 10] ^ s[x + 20] ^ s[x + 30] ^ s[x + 40];
|
|
589
|
+
for (let x = 0; x < 10; x += 2) {
|
|
590
|
+
const idx1 = (x + 8) % 10;
|
|
591
|
+
const idx0 = (x + 2) % 10;
|
|
592
|
+
const B0 = B[idx0];
|
|
593
|
+
const B1 = B[idx0 + 1];
|
|
594
|
+
const Th = rotlH(B0, B1, 1) ^ B[idx1];
|
|
595
|
+
const Tl = rotlL(B0, B1, 1) ^ B[idx1 + 1];
|
|
596
|
+
for (let y = 0; y < 50; y += 10) {
|
|
597
|
+
s[x + y] ^= Th;
|
|
598
|
+
s[x + y + 1] ^= Tl;
|
|
599
|
+
}
|
|
600
|
+
}
|
|
601
|
+
let curH = s[2];
|
|
602
|
+
let curL = s[3];
|
|
603
|
+
for (let t = 0; t < 24; t++) {
|
|
604
|
+
const shift = SHA3_ROTL[t];
|
|
605
|
+
const Th = rotlH(curH, curL, shift);
|
|
606
|
+
const Tl = rotlL(curH, curL, shift);
|
|
607
|
+
const PI = SHA3_PI[t];
|
|
608
|
+
curH = s[PI];
|
|
609
|
+
curL = s[PI + 1];
|
|
610
|
+
s[PI] = Th;
|
|
611
|
+
s[PI + 1] = Tl;
|
|
612
|
+
}
|
|
613
|
+
for (let y = 0; y < 50; y += 10) {
|
|
614
|
+
for (let x = 0; x < 10; x++)
|
|
615
|
+
B[x] = s[y + x];
|
|
616
|
+
for (let x = 0; x < 10; x++)
|
|
617
|
+
s[y + x] ^= ~B[(x + 2) % 10] & B[(x + 4) % 10];
|
|
618
|
+
}
|
|
619
|
+
s[0] ^= SHA3_IOTA_H[round];
|
|
620
|
+
s[1] ^= SHA3_IOTA_L[round];
|
|
621
|
+
}
|
|
622
|
+
B.fill(0);
|
|
623
|
+
}
|
|
624
|
+
var SHA3_PI, SHA3_ROTL, _SHA3_IOTA, _0n, _1n, _2n, _7n, _256n, _0x71n, SHA3_IOTA_H, SHA3_IOTA_L, rotlH, rotlL, Keccak, gen, sha3_224, sha3_256, sha3_384, sha3_512, keccak_224, keccak_256, keccak_384, keccak_512, genShake, shake128, shake256;
|
|
625
|
+
var init_sha3 = __esm({
|
|
626
|
+
"../../node_modules/.pnpm/@noble+hashes@1.5.0/node_modules/@noble/hashes/esm/sha3.js"() {
|
|
627
|
+
"use strict";
|
|
628
|
+
init_cjs_shims();
|
|
629
|
+
init_assert();
|
|
630
|
+
init_u64();
|
|
631
|
+
init_utils();
|
|
632
|
+
SHA3_PI = [];
|
|
633
|
+
SHA3_ROTL = [];
|
|
634
|
+
_SHA3_IOTA = [];
|
|
635
|
+
_0n = /* @__PURE__ */ BigInt(0);
|
|
636
|
+
_1n = /* @__PURE__ */ BigInt(1);
|
|
637
|
+
_2n = /* @__PURE__ */ BigInt(2);
|
|
638
|
+
_7n = /* @__PURE__ */ BigInt(7);
|
|
639
|
+
_256n = /* @__PURE__ */ BigInt(256);
|
|
640
|
+
_0x71n = /* @__PURE__ */ BigInt(113);
|
|
641
|
+
for (let round = 0, R = _1n, x = 1, y = 0; round < 24; round++) {
|
|
642
|
+
[x, y] = [y, (2 * x + 3 * y) % 5];
|
|
643
|
+
SHA3_PI.push(2 * (5 * y + x));
|
|
644
|
+
SHA3_ROTL.push((round + 1) * (round + 2) / 2 % 64);
|
|
645
|
+
let t = _0n;
|
|
646
|
+
for (let j = 0; j < 7; j++) {
|
|
647
|
+
R = (R << _1n ^ (R >> _7n) * _0x71n) % _256n;
|
|
648
|
+
if (R & _2n)
|
|
649
|
+
t ^= _1n << (_1n << /* @__PURE__ */ BigInt(j)) - _1n;
|
|
650
|
+
}
|
|
651
|
+
_SHA3_IOTA.push(t);
|
|
652
|
+
}
|
|
653
|
+
[SHA3_IOTA_H, SHA3_IOTA_L] = /* @__PURE__ */ split(_SHA3_IOTA, true);
|
|
654
|
+
rotlH = (h, l, s) => s > 32 ? rotlBH(h, l, s) : rotlSH(h, l, s);
|
|
655
|
+
rotlL = (h, l, s) => s > 32 ? rotlBL(h, l, s) : rotlSL(h, l, s);
|
|
656
|
+
Keccak = class _Keccak extends Hash {
|
|
657
|
+
// NOTE: we accept arguments in bytes instead of bits here.
|
|
658
|
+
constructor(blockLen, suffix, outputLen, enableXOF = false, rounds = 24) {
|
|
659
|
+
super();
|
|
660
|
+
this.blockLen = blockLen;
|
|
661
|
+
this.suffix = suffix;
|
|
662
|
+
this.outputLen = outputLen;
|
|
663
|
+
this.enableXOF = enableXOF;
|
|
664
|
+
this.rounds = rounds;
|
|
665
|
+
this.pos = 0;
|
|
666
|
+
this.posOut = 0;
|
|
667
|
+
this.finished = false;
|
|
668
|
+
this.destroyed = false;
|
|
669
|
+
number(outputLen);
|
|
670
|
+
if (0 >= this.blockLen || this.blockLen >= 200)
|
|
671
|
+
throw new Error("Sha3 supports only keccak-f1600 function");
|
|
672
|
+
this.state = new Uint8Array(200);
|
|
673
|
+
this.state32 = u32(this.state);
|
|
674
|
+
}
|
|
675
|
+
keccak() {
|
|
676
|
+
if (!isLE)
|
|
677
|
+
byteSwap32(this.state32);
|
|
678
|
+
keccakP(this.state32, this.rounds);
|
|
679
|
+
if (!isLE)
|
|
680
|
+
byteSwap32(this.state32);
|
|
681
|
+
this.posOut = 0;
|
|
682
|
+
this.pos = 0;
|
|
683
|
+
}
|
|
684
|
+
update(data) {
|
|
685
|
+
exists(this);
|
|
686
|
+
const { blockLen, state } = this;
|
|
687
|
+
data = toBytes2(data);
|
|
688
|
+
const len = data.length;
|
|
689
|
+
for (let pos = 0; pos < len; ) {
|
|
690
|
+
const take = Math.min(blockLen - this.pos, len - pos);
|
|
691
|
+
for (let i = 0; i < take; i++)
|
|
692
|
+
state[this.pos++] ^= data[pos++];
|
|
693
|
+
if (this.pos === blockLen)
|
|
694
|
+
this.keccak();
|
|
695
|
+
}
|
|
696
|
+
return this;
|
|
697
|
+
}
|
|
698
|
+
finish() {
|
|
699
|
+
if (this.finished)
|
|
700
|
+
return;
|
|
701
|
+
this.finished = true;
|
|
702
|
+
const { state, suffix, pos, blockLen } = this;
|
|
703
|
+
state[pos] ^= suffix;
|
|
704
|
+
if ((suffix & 128) !== 0 && pos === blockLen - 1)
|
|
705
|
+
this.keccak();
|
|
706
|
+
state[blockLen - 1] ^= 128;
|
|
707
|
+
this.keccak();
|
|
708
|
+
}
|
|
709
|
+
writeInto(out) {
|
|
710
|
+
exists(this, false);
|
|
711
|
+
bytes(out);
|
|
712
|
+
this.finish();
|
|
713
|
+
const bufferOut = this.state;
|
|
714
|
+
const { blockLen } = this;
|
|
715
|
+
for (let pos = 0, len = out.length; pos < len; ) {
|
|
716
|
+
if (this.posOut >= blockLen)
|
|
717
|
+
this.keccak();
|
|
718
|
+
const take = Math.min(blockLen - this.posOut, len - pos);
|
|
719
|
+
out.set(bufferOut.subarray(this.posOut, this.posOut + take), pos);
|
|
720
|
+
this.posOut += take;
|
|
721
|
+
pos += take;
|
|
722
|
+
}
|
|
723
|
+
return out;
|
|
724
|
+
}
|
|
725
|
+
xofInto(out) {
|
|
726
|
+
if (!this.enableXOF)
|
|
727
|
+
throw new Error("XOF is not possible for this instance");
|
|
728
|
+
return this.writeInto(out);
|
|
729
|
+
}
|
|
730
|
+
xof(bytes2) {
|
|
731
|
+
number(bytes2);
|
|
732
|
+
return this.xofInto(new Uint8Array(bytes2));
|
|
733
|
+
}
|
|
734
|
+
digestInto(out) {
|
|
735
|
+
output(out, this);
|
|
736
|
+
if (this.finished)
|
|
737
|
+
throw new Error("digest() was already called");
|
|
738
|
+
this.writeInto(out);
|
|
739
|
+
this.destroy();
|
|
740
|
+
return out;
|
|
741
|
+
}
|
|
742
|
+
digest() {
|
|
743
|
+
return this.digestInto(new Uint8Array(this.outputLen));
|
|
744
|
+
}
|
|
745
|
+
destroy() {
|
|
746
|
+
this.destroyed = true;
|
|
747
|
+
this.state.fill(0);
|
|
748
|
+
}
|
|
749
|
+
_cloneInto(to) {
|
|
750
|
+
const { blockLen, suffix, outputLen, rounds, enableXOF } = this;
|
|
751
|
+
to || (to = new _Keccak(blockLen, suffix, outputLen, enableXOF, rounds));
|
|
752
|
+
to.state32.set(this.state32);
|
|
753
|
+
to.pos = this.pos;
|
|
754
|
+
to.posOut = this.posOut;
|
|
755
|
+
to.finished = this.finished;
|
|
756
|
+
to.rounds = rounds;
|
|
757
|
+
to.suffix = suffix;
|
|
758
|
+
to.outputLen = outputLen;
|
|
759
|
+
to.enableXOF = enableXOF;
|
|
760
|
+
to.destroyed = this.destroyed;
|
|
761
|
+
return to;
|
|
762
|
+
}
|
|
763
|
+
};
|
|
764
|
+
gen = (suffix, blockLen, outputLen) => wrapConstructor(() => new Keccak(blockLen, suffix, outputLen));
|
|
765
|
+
sha3_224 = /* @__PURE__ */ gen(6, 144, 224 / 8);
|
|
766
|
+
sha3_256 = /* @__PURE__ */ gen(6, 136, 256 / 8);
|
|
767
|
+
sha3_384 = /* @__PURE__ */ gen(6, 104, 384 / 8);
|
|
768
|
+
sha3_512 = /* @__PURE__ */ gen(6, 72, 512 / 8);
|
|
769
|
+
keccak_224 = /* @__PURE__ */ gen(1, 144, 224 / 8);
|
|
770
|
+
keccak_256 = /* @__PURE__ */ gen(1, 136, 256 / 8);
|
|
771
|
+
keccak_384 = /* @__PURE__ */ gen(1, 104, 384 / 8);
|
|
772
|
+
keccak_512 = /* @__PURE__ */ gen(1, 72, 512 / 8);
|
|
773
|
+
genShake = (suffix, blockLen, outputLen) => wrapXOFConstructorWithOpts((opts = {}) => new Keccak(blockLen, suffix, opts.dkLen === void 0 ? outputLen : opts.dkLen, true));
|
|
774
|
+
shake128 = /* @__PURE__ */ genShake(31, 168, 128 / 8);
|
|
775
|
+
shake256 = /* @__PURE__ */ genShake(31, 136, 256 / 8);
|
|
776
|
+
}
|
|
777
|
+
});
|
|
778
|
+
|
|
779
|
+
// ../../node_modules/.pnpm/viem@2.21.19_bufferutil@4.0.8_typescript@5.4.2_utf-8-validate@5.0.10_zod@3.23.8/node_modules/viem/_esm/utils/hash/keccak256.js
|
|
780
|
+
function keccak256(value, to_) {
|
|
781
|
+
const to = to_ || "hex";
|
|
782
|
+
const bytes2 = keccak_256(isHex(value, { strict: false }) ? toBytes(value) : value);
|
|
783
|
+
if (to === "bytes")
|
|
784
|
+
return bytes2;
|
|
785
|
+
return toHex(bytes2);
|
|
786
|
+
}
|
|
787
|
+
var init_keccak256 = __esm({
|
|
788
|
+
"../../node_modules/.pnpm/viem@2.21.19_bufferutil@4.0.8_typescript@5.4.2_utf-8-validate@5.0.10_zod@3.23.8/node_modules/viem/_esm/utils/hash/keccak256.js"() {
|
|
789
|
+
"use strict";
|
|
790
|
+
init_cjs_shims();
|
|
791
|
+
init_sha3();
|
|
792
|
+
init_isHex();
|
|
793
|
+
init_toBytes();
|
|
794
|
+
init_toHex();
|
|
795
|
+
}
|
|
796
|
+
});
|
|
797
|
+
|
|
798
|
+
// ../../node_modules/.pnpm/viem@2.21.19_bufferutil@4.0.8_typescript@5.4.2_utf-8-validate@5.0.10_zod@3.23.8/node_modules/viem/_esm/errors/address.js
|
|
799
|
+
var InvalidAddressError;
|
|
800
|
+
var init_address = __esm({
|
|
801
|
+
"../../node_modules/.pnpm/viem@2.21.19_bufferutil@4.0.8_typescript@5.4.2_utf-8-validate@5.0.10_zod@3.23.8/node_modules/viem/_esm/errors/address.js"() {
|
|
802
|
+
"use strict";
|
|
803
|
+
init_cjs_shims();
|
|
804
|
+
init_base();
|
|
805
|
+
InvalidAddressError = class extends BaseError {
|
|
806
|
+
constructor({ address }) {
|
|
807
|
+
super(`Address "${address}" is invalid.`, {
|
|
808
|
+
metaMessages: [
|
|
809
|
+
"- Address must be a hex value of 20 bytes (40 hex characters).",
|
|
810
|
+
"- Address must match its checksum counterpart."
|
|
811
|
+
],
|
|
812
|
+
name: "InvalidAddressError"
|
|
813
|
+
});
|
|
814
|
+
}
|
|
815
|
+
};
|
|
816
|
+
}
|
|
817
|
+
});
|
|
818
|
+
|
|
819
|
+
// ../../node_modules/.pnpm/viem@2.21.19_bufferutil@4.0.8_typescript@5.4.2_utf-8-validate@5.0.10_zod@3.23.8/node_modules/viem/_esm/utils/lru.js
|
|
820
|
+
var LruMap;
|
|
821
|
+
var init_lru = __esm({
|
|
822
|
+
"../../node_modules/.pnpm/viem@2.21.19_bufferutil@4.0.8_typescript@5.4.2_utf-8-validate@5.0.10_zod@3.23.8/node_modules/viem/_esm/utils/lru.js"() {
|
|
823
|
+
"use strict";
|
|
824
|
+
init_cjs_shims();
|
|
825
|
+
LruMap = class extends Map {
|
|
826
|
+
constructor(size2) {
|
|
827
|
+
super();
|
|
828
|
+
Object.defineProperty(this, "maxSize", {
|
|
829
|
+
enumerable: true,
|
|
830
|
+
configurable: true,
|
|
831
|
+
writable: true,
|
|
832
|
+
value: void 0
|
|
833
|
+
});
|
|
834
|
+
this.maxSize = size2;
|
|
835
|
+
}
|
|
836
|
+
get(key) {
|
|
837
|
+
const value = super.get(key);
|
|
838
|
+
if (super.has(key) && value !== void 0) {
|
|
839
|
+
this.delete(key);
|
|
840
|
+
super.set(key, value);
|
|
841
|
+
}
|
|
842
|
+
return value;
|
|
843
|
+
}
|
|
844
|
+
set(key, value) {
|
|
845
|
+
super.set(key, value);
|
|
846
|
+
if (this.maxSize && this.size > this.maxSize) {
|
|
847
|
+
const firstKey = this.keys().next().value;
|
|
848
|
+
if (firstKey)
|
|
849
|
+
this.delete(firstKey);
|
|
850
|
+
}
|
|
851
|
+
return this;
|
|
852
|
+
}
|
|
853
|
+
};
|
|
854
|
+
}
|
|
855
|
+
});
|
|
856
|
+
|
|
857
|
+
// ../../node_modules/.pnpm/viem@2.21.19_bufferutil@4.0.8_typescript@5.4.2_utf-8-validate@5.0.10_zod@3.23.8/node_modules/viem/_esm/utils/address/getAddress.js
|
|
858
|
+
function checksumAddress(address_, chainId) {
|
|
859
|
+
if (checksumAddressCache.has(`${address_}.${chainId}`))
|
|
860
|
+
return checksumAddressCache.get(`${address_}.${chainId}`);
|
|
861
|
+
const hexAddress = chainId ? `${chainId}${address_.toLowerCase()}` : address_.substring(2).toLowerCase();
|
|
862
|
+
const hash = keccak256(stringToBytes(hexAddress), "bytes");
|
|
863
|
+
const address = (chainId ? hexAddress.substring(`${chainId}0x`.length) : hexAddress).split("");
|
|
864
|
+
for (let i = 0; i < 40; i += 2) {
|
|
865
|
+
if (hash[i >> 1] >> 4 >= 8 && address[i]) {
|
|
866
|
+
address[i] = address[i].toUpperCase();
|
|
867
|
+
}
|
|
868
|
+
if ((hash[i >> 1] & 15) >= 8 && address[i + 1]) {
|
|
869
|
+
address[i + 1] = address[i + 1].toUpperCase();
|
|
870
|
+
}
|
|
871
|
+
}
|
|
872
|
+
const result = `0x${address.join("")}`;
|
|
873
|
+
checksumAddressCache.set(`${address_}.${chainId}`, result);
|
|
874
|
+
return result;
|
|
875
|
+
}
|
|
876
|
+
var checksumAddressCache;
|
|
877
|
+
var init_getAddress = __esm({
|
|
878
|
+
"../../node_modules/.pnpm/viem@2.21.19_bufferutil@4.0.8_typescript@5.4.2_utf-8-validate@5.0.10_zod@3.23.8/node_modules/viem/_esm/utils/address/getAddress.js"() {
|
|
879
|
+
"use strict";
|
|
880
|
+
init_cjs_shims();
|
|
881
|
+
init_toBytes();
|
|
882
|
+
init_keccak256();
|
|
883
|
+
init_lru();
|
|
884
|
+
checksumAddressCache = /* @__PURE__ */ new LruMap(8192);
|
|
885
|
+
}
|
|
886
|
+
});
|
|
887
|
+
|
|
888
|
+
// ../../node_modules/.pnpm/viem@2.21.19_bufferutil@4.0.8_typescript@5.4.2_utf-8-validate@5.0.10_zod@3.23.8/node_modules/viem/_esm/utils/address/isAddress.js
|
|
889
|
+
function isAddress(address, options) {
|
|
890
|
+
const { strict = true } = options ?? {};
|
|
891
|
+
const cacheKey = `${address}.${strict}`;
|
|
892
|
+
if (isAddressCache.has(cacheKey))
|
|
893
|
+
return isAddressCache.get(cacheKey);
|
|
894
|
+
const result = (() => {
|
|
895
|
+
if (!addressRegex.test(address))
|
|
896
|
+
return false;
|
|
897
|
+
if (address.toLowerCase() === address)
|
|
898
|
+
return true;
|
|
899
|
+
if (strict)
|
|
900
|
+
return checksumAddress(address) === address;
|
|
901
|
+
return true;
|
|
902
|
+
})();
|
|
903
|
+
isAddressCache.set(cacheKey, result);
|
|
904
|
+
return result;
|
|
905
|
+
}
|
|
906
|
+
var addressRegex, isAddressCache;
|
|
907
|
+
var init_isAddress = __esm({
|
|
908
|
+
"../../node_modules/.pnpm/viem@2.21.19_bufferutil@4.0.8_typescript@5.4.2_utf-8-validate@5.0.10_zod@3.23.8/node_modules/viem/_esm/utils/address/isAddress.js"() {
|
|
909
|
+
"use strict";
|
|
910
|
+
init_cjs_shims();
|
|
911
|
+
init_lru();
|
|
912
|
+
init_getAddress();
|
|
913
|
+
addressRegex = /^0x[a-fA-F0-9]{40}$/;
|
|
914
|
+
isAddressCache = /* @__PURE__ */ new LruMap(8192);
|
|
915
|
+
}
|
|
916
|
+
});
|
|
917
|
+
|
|
918
|
+
// ../../node_modules/.pnpm/viem@2.21.19_bufferutil@4.0.8_typescript@5.4.2_utf-8-validate@5.0.10_zod@3.23.8/node_modules/viem/_esm/utils/data/concat.js
|
|
919
|
+
function concat(values) {
|
|
920
|
+
if (typeof values[0] === "string")
|
|
921
|
+
return concatHex(values);
|
|
922
|
+
return concatBytes(values);
|
|
923
|
+
}
|
|
924
|
+
function concatBytes(values) {
|
|
925
|
+
let length = 0;
|
|
926
|
+
for (const arr of values) {
|
|
927
|
+
length += arr.length;
|
|
928
|
+
}
|
|
929
|
+
const result = new Uint8Array(length);
|
|
930
|
+
let offset = 0;
|
|
931
|
+
for (const arr of values) {
|
|
932
|
+
result.set(arr, offset);
|
|
933
|
+
offset += arr.length;
|
|
934
|
+
}
|
|
935
|
+
return result;
|
|
936
|
+
}
|
|
937
|
+
function concatHex(values) {
|
|
938
|
+
return `0x${values.reduce((acc, x) => acc + x.replace("0x", ""), "")}`;
|
|
939
|
+
}
|
|
940
|
+
var init_concat = __esm({
|
|
941
|
+
"../../node_modules/.pnpm/viem@2.21.19_bufferutil@4.0.8_typescript@5.4.2_utf-8-validate@5.0.10_zod@3.23.8/node_modules/viem/_esm/utils/data/concat.js"() {
|
|
942
|
+
"use strict";
|
|
943
|
+
init_cjs_shims();
|
|
944
|
+
}
|
|
945
|
+
});
|
|
946
|
+
|
|
947
|
+
// ../../node_modules/.pnpm/viem@2.21.19_bufferutil@4.0.8_typescript@5.4.2_utf-8-validate@5.0.10_zod@3.23.8/node_modules/viem/_esm/utils/data/slice.js
|
|
948
|
+
function slice(value, start, end, { strict } = {}) {
|
|
949
|
+
if (isHex(value, { strict: false }))
|
|
950
|
+
return sliceHex(value, start, end, {
|
|
951
|
+
strict
|
|
952
|
+
});
|
|
953
|
+
return sliceBytes(value, start, end, {
|
|
954
|
+
strict
|
|
955
|
+
});
|
|
956
|
+
}
|
|
957
|
+
function assertStartOffset(value, start) {
|
|
958
|
+
if (typeof start === "number" && start > 0 && start > size(value) - 1)
|
|
959
|
+
throw new SliceOffsetOutOfBoundsError({
|
|
960
|
+
offset: start,
|
|
961
|
+
position: "start",
|
|
962
|
+
size: size(value)
|
|
963
|
+
});
|
|
964
|
+
}
|
|
965
|
+
function assertEndOffset(value, start, end) {
|
|
966
|
+
if (typeof start === "number" && typeof end === "number" && size(value) !== end - start) {
|
|
967
|
+
throw new SliceOffsetOutOfBoundsError({
|
|
968
|
+
offset: end,
|
|
969
|
+
position: "end",
|
|
970
|
+
size: size(value)
|
|
971
|
+
});
|
|
972
|
+
}
|
|
973
|
+
}
|
|
974
|
+
function sliceBytes(value_, start, end, { strict } = {}) {
|
|
975
|
+
assertStartOffset(value_, start);
|
|
976
|
+
const value = value_.slice(start, end);
|
|
977
|
+
if (strict)
|
|
978
|
+
assertEndOffset(value, start, end);
|
|
979
|
+
return value;
|
|
980
|
+
}
|
|
981
|
+
function sliceHex(value_, start, end, { strict } = {}) {
|
|
982
|
+
assertStartOffset(value_, start);
|
|
983
|
+
const value = `0x${value_.replace("0x", "").slice((start ?? 0) * 2, (end ?? value_.length) * 2)}`;
|
|
984
|
+
if (strict)
|
|
985
|
+
assertEndOffset(value, start, end);
|
|
986
|
+
return value;
|
|
987
|
+
}
|
|
988
|
+
var init_slice = __esm({
|
|
989
|
+
"../../node_modules/.pnpm/viem@2.21.19_bufferutil@4.0.8_typescript@5.4.2_utf-8-validate@5.0.10_zod@3.23.8/node_modules/viem/_esm/utils/data/slice.js"() {
|
|
990
|
+
"use strict";
|
|
991
|
+
init_cjs_shims();
|
|
992
|
+
init_data();
|
|
993
|
+
init_isHex();
|
|
994
|
+
init_size();
|
|
995
|
+
}
|
|
996
|
+
});
|
|
997
|
+
|
|
998
|
+
// ../../node_modules/.pnpm/viem@2.21.19_bufferutil@4.0.8_typescript@5.4.2_utf-8-validate@5.0.10_zod@3.23.8/node_modules/viem/_esm/utils/abi/encodeAbiParameters.js
|
|
999
|
+
function encodeAbiParameters(params, values) {
|
|
1000
|
+
if (params.length !== values.length)
|
|
1001
|
+
throw new AbiEncodingLengthMismatchError({
|
|
1002
|
+
expectedLength: params.length,
|
|
1003
|
+
givenLength: values.length
|
|
1004
|
+
});
|
|
1005
|
+
const preparedParams = prepareParams({
|
|
1006
|
+
params,
|
|
1007
|
+
values
|
|
1008
|
+
});
|
|
1009
|
+
const data = encodeParams(preparedParams);
|
|
1010
|
+
if (data.length === 0)
|
|
1011
|
+
return "0x";
|
|
1012
|
+
return data;
|
|
1013
|
+
}
|
|
1014
|
+
function prepareParams({ params, values }) {
|
|
1015
|
+
const preparedParams = [];
|
|
1016
|
+
for (let i = 0; i < params.length; i++) {
|
|
1017
|
+
preparedParams.push(prepareParam({ param: params[i], value: values[i] }));
|
|
1018
|
+
}
|
|
1019
|
+
return preparedParams;
|
|
1020
|
+
}
|
|
1021
|
+
function prepareParam({ param, value }) {
|
|
1022
|
+
const arrayComponents = getArrayComponents(param.type);
|
|
1023
|
+
if (arrayComponents) {
|
|
1024
|
+
const [length, type] = arrayComponents;
|
|
1025
|
+
return encodeArray(value, { length, param: { ...param, type } });
|
|
1026
|
+
}
|
|
1027
|
+
if (param.type === "tuple") {
|
|
1028
|
+
return encodeTuple(value, {
|
|
1029
|
+
param
|
|
1030
|
+
});
|
|
1031
|
+
}
|
|
1032
|
+
if (param.type === "address") {
|
|
1033
|
+
return encodeAddress(value);
|
|
1034
|
+
}
|
|
1035
|
+
if (param.type === "bool") {
|
|
1036
|
+
return encodeBool(value);
|
|
1037
|
+
}
|
|
1038
|
+
if (param.type.startsWith("uint") || param.type.startsWith("int")) {
|
|
1039
|
+
const signed = param.type.startsWith("int");
|
|
1040
|
+
return encodeNumber(value, { signed });
|
|
1041
|
+
}
|
|
1042
|
+
if (param.type.startsWith("bytes")) {
|
|
1043
|
+
return encodeBytes(value, { param });
|
|
1044
|
+
}
|
|
1045
|
+
if (param.type === "string") {
|
|
1046
|
+
return encodeString(value);
|
|
1047
|
+
}
|
|
1048
|
+
throw new InvalidAbiEncodingTypeError(param.type, {
|
|
1049
|
+
docsPath: "/docs/contract/encodeAbiParameters"
|
|
1050
|
+
});
|
|
1051
|
+
}
|
|
1052
|
+
function encodeParams(preparedParams) {
|
|
1053
|
+
let staticSize = 0;
|
|
1054
|
+
for (let i = 0; i < preparedParams.length; i++) {
|
|
1055
|
+
const { dynamic, encoded } = preparedParams[i];
|
|
1056
|
+
if (dynamic)
|
|
1057
|
+
staticSize += 32;
|
|
1058
|
+
else
|
|
1059
|
+
staticSize += size(encoded);
|
|
1060
|
+
}
|
|
1061
|
+
const staticParams = [];
|
|
1062
|
+
const dynamicParams = [];
|
|
1063
|
+
let dynamicSize = 0;
|
|
1064
|
+
for (let i = 0; i < preparedParams.length; i++) {
|
|
1065
|
+
const { dynamic, encoded } = preparedParams[i];
|
|
1066
|
+
if (dynamic) {
|
|
1067
|
+
staticParams.push(numberToHex(staticSize + dynamicSize, { size: 32 }));
|
|
1068
|
+
dynamicParams.push(encoded);
|
|
1069
|
+
dynamicSize += size(encoded);
|
|
1070
|
+
} else {
|
|
1071
|
+
staticParams.push(encoded);
|
|
1072
|
+
}
|
|
1073
|
+
}
|
|
1074
|
+
return concat([...staticParams, ...dynamicParams]);
|
|
1075
|
+
}
|
|
1076
|
+
function encodeAddress(value) {
|
|
1077
|
+
if (!isAddress(value))
|
|
1078
|
+
throw new InvalidAddressError({ address: value });
|
|
1079
|
+
return { dynamic: false, encoded: padHex(value.toLowerCase()) };
|
|
1080
|
+
}
|
|
1081
|
+
function encodeArray(value, { length, param }) {
|
|
1082
|
+
const dynamic = length === null;
|
|
1083
|
+
if (!Array.isArray(value))
|
|
1084
|
+
throw new InvalidArrayError(value);
|
|
1085
|
+
if (!dynamic && value.length !== length)
|
|
1086
|
+
throw new AbiEncodingArrayLengthMismatchError({
|
|
1087
|
+
expectedLength: length,
|
|
1088
|
+
givenLength: value.length,
|
|
1089
|
+
type: `${param.type}[${length}]`
|
|
1090
|
+
});
|
|
1091
|
+
let dynamicChild = false;
|
|
1092
|
+
const preparedParams = [];
|
|
1093
|
+
for (let i = 0; i < value.length; i++) {
|
|
1094
|
+
const preparedParam = prepareParam({ param, value: value[i] });
|
|
1095
|
+
if (preparedParam.dynamic)
|
|
1096
|
+
dynamicChild = true;
|
|
1097
|
+
preparedParams.push(preparedParam);
|
|
1098
|
+
}
|
|
1099
|
+
if (dynamic || dynamicChild) {
|
|
1100
|
+
const data = encodeParams(preparedParams);
|
|
1101
|
+
if (dynamic) {
|
|
1102
|
+
const length2 = numberToHex(preparedParams.length, { size: 32 });
|
|
1103
|
+
return {
|
|
1104
|
+
dynamic: true,
|
|
1105
|
+
encoded: preparedParams.length > 0 ? concat([length2, data]) : length2
|
|
1106
|
+
};
|
|
1107
|
+
}
|
|
1108
|
+
if (dynamicChild)
|
|
1109
|
+
return { dynamic: true, encoded: data };
|
|
1110
|
+
}
|
|
1111
|
+
return {
|
|
1112
|
+
dynamic: false,
|
|
1113
|
+
encoded: concat(preparedParams.map(({ encoded }) => encoded))
|
|
1114
|
+
};
|
|
1115
|
+
}
|
|
1116
|
+
function encodeBytes(value, { param }) {
|
|
1117
|
+
const [, paramSize] = param.type.split("bytes");
|
|
1118
|
+
const bytesSize = size(value);
|
|
1119
|
+
if (!paramSize) {
|
|
1120
|
+
let value_ = value;
|
|
1121
|
+
if (bytesSize % 32 !== 0)
|
|
1122
|
+
value_ = padHex(value_, {
|
|
1123
|
+
dir: "right",
|
|
1124
|
+
size: Math.ceil((value.length - 2) / 2 / 32) * 32
|
|
1125
|
+
});
|
|
1126
|
+
return {
|
|
1127
|
+
dynamic: true,
|
|
1128
|
+
encoded: concat([padHex(numberToHex(bytesSize, { size: 32 })), value_])
|
|
1129
|
+
};
|
|
1130
|
+
}
|
|
1131
|
+
if (bytesSize !== Number.parseInt(paramSize))
|
|
1132
|
+
throw new AbiEncodingBytesSizeMismatchError({
|
|
1133
|
+
expectedSize: Number.parseInt(paramSize),
|
|
1134
|
+
value
|
|
1135
|
+
});
|
|
1136
|
+
return { dynamic: false, encoded: padHex(value, { dir: "right" }) };
|
|
1137
|
+
}
|
|
1138
|
+
function encodeBool(value) {
|
|
1139
|
+
if (typeof value !== "boolean")
|
|
1140
|
+
throw new BaseError(`Invalid boolean value: "${value}" (type: ${typeof value}). Expected: \`true\` or \`false\`.`);
|
|
1141
|
+
return { dynamic: false, encoded: padHex(boolToHex(value)) };
|
|
1142
|
+
}
|
|
1143
|
+
function encodeNumber(value, { signed }) {
|
|
1144
|
+
return {
|
|
1145
|
+
dynamic: false,
|
|
1146
|
+
encoded: numberToHex(value, {
|
|
1147
|
+
size: 32,
|
|
1148
|
+
signed
|
|
1149
|
+
})
|
|
1150
|
+
};
|
|
1151
|
+
}
|
|
1152
|
+
function encodeString(value) {
|
|
1153
|
+
const hexValue = stringToHex(value);
|
|
1154
|
+
const partsLength = Math.ceil(size(hexValue) / 32);
|
|
1155
|
+
const parts = [];
|
|
1156
|
+
for (let i = 0; i < partsLength; i++) {
|
|
1157
|
+
parts.push(padHex(slice(hexValue, i * 32, (i + 1) * 32), {
|
|
1158
|
+
dir: "right"
|
|
1159
|
+
}));
|
|
1160
|
+
}
|
|
1161
|
+
return {
|
|
1162
|
+
dynamic: true,
|
|
1163
|
+
encoded: concat([
|
|
1164
|
+
padHex(numberToHex(size(hexValue), { size: 32 })),
|
|
1165
|
+
...parts
|
|
1166
|
+
])
|
|
1167
|
+
};
|
|
1168
|
+
}
|
|
1169
|
+
function encodeTuple(value, { param }) {
|
|
1170
|
+
let dynamic = false;
|
|
1171
|
+
const preparedParams = [];
|
|
1172
|
+
for (let i = 0; i < param.components.length; i++) {
|
|
1173
|
+
const param_ = param.components[i];
|
|
1174
|
+
const index = Array.isArray(value) ? i : param_.name;
|
|
1175
|
+
const preparedParam = prepareParam({
|
|
1176
|
+
param: param_,
|
|
1177
|
+
value: value[index]
|
|
1178
|
+
});
|
|
1179
|
+
preparedParams.push(preparedParam);
|
|
1180
|
+
if (preparedParam.dynamic)
|
|
1181
|
+
dynamic = true;
|
|
1182
|
+
}
|
|
1183
|
+
return {
|
|
1184
|
+
dynamic,
|
|
1185
|
+
encoded: dynamic ? encodeParams(preparedParams) : concat(preparedParams.map(({ encoded }) => encoded))
|
|
1186
|
+
};
|
|
1187
|
+
}
|
|
1188
|
+
function getArrayComponents(type) {
|
|
1189
|
+
const matches = type.match(/^(.*)\[(\d+)?\]$/);
|
|
1190
|
+
return matches ? (
|
|
1191
|
+
// Return `null` if the array is dynamic.
|
|
1192
|
+
[matches[2] ? Number(matches[2]) : null, matches[1]]
|
|
1193
|
+
) : void 0;
|
|
1194
|
+
}
|
|
1195
|
+
var init_encodeAbiParameters = __esm({
|
|
1196
|
+
"../../node_modules/.pnpm/viem@2.21.19_bufferutil@4.0.8_typescript@5.4.2_utf-8-validate@5.0.10_zod@3.23.8/node_modules/viem/_esm/utils/abi/encodeAbiParameters.js"() {
|
|
1197
|
+
"use strict";
|
|
1198
|
+
init_cjs_shims();
|
|
1199
|
+
init_abi();
|
|
1200
|
+
init_address();
|
|
1201
|
+
init_base();
|
|
1202
|
+
init_isAddress();
|
|
1203
|
+
init_concat();
|
|
1204
|
+
init_pad();
|
|
1205
|
+
init_size();
|
|
1206
|
+
init_slice();
|
|
1207
|
+
init_toHex();
|
|
1208
|
+
}
|
|
1209
|
+
});
|
|
1210
|
+
|
|
1211
|
+
// ts/exports/internal.ts
|
|
1212
|
+
var internal_exports = {};
|
|
1213
|
+
__export(internal_exports, {
|
|
1214
|
+
defineERC20Module: () => defineERC20Module
|
|
1215
|
+
});
|
|
1216
|
+
module.exports = __toCommonJS(internal_exports);
|
|
1217
|
+
init_cjs_shims();
|
|
1218
|
+
|
|
1219
|
+
// ts/defineERC20Module.ts
|
|
1220
|
+
init_cjs_shims();
|
|
1221
|
+
|
|
1222
|
+
// ../../node_modules/.pnpm/viem@2.21.19_bufferutil@4.0.8_typescript@5.4.2_utf-8-validate@5.0.10_zod@3.23.8/node_modules/viem/_esm/index.js
|
|
1223
|
+
init_cjs_shims();
|
|
1224
|
+
init_encodeAbiParameters();
|
|
1225
|
+
init_toHex();
|
|
1226
|
+
|
|
1227
|
+
// ts/defineERC20Module.ts
|
|
1228
|
+
function defineERC20Module({ namespace, name, symbol }) {
|
|
1229
|
+
const erc20ModuleArgs = encodeAbiParameters(
|
|
1230
|
+
[{ type: "bytes14" }, { type: "string" }, { type: "string" }],
|
|
1231
|
+
[stringToHex(namespace, { size: 14 }), name, symbol]
|
|
1232
|
+
);
|
|
1233
|
+
return {
|
|
1234
|
+
artifactPath: "@latticexyz/world-module-erc20/out/ERC20Module.sol/ERC20Module.json",
|
|
1235
|
+
root: false,
|
|
1236
|
+
args: [
|
|
1237
|
+
{
|
|
1238
|
+
type: "bytes",
|
|
1239
|
+
value: erc20ModuleArgs
|
|
1240
|
+
}
|
|
1241
|
+
]
|
|
1242
|
+
};
|
|
1243
|
+
}
|
|
1244
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
1245
|
+
0 && (module.exports = {
|
|
1246
|
+
defineERC20Module
|
|
1247
|
+
});
|
|
1248
|
+
/*! Bundled license information:
|
|
1249
|
+
|
|
1250
|
+
@noble/hashes/esm/utils.js:
|
|
1251
|
+
(*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
|
|
1252
|
+
*/
|
|
1253
|
+
//# sourceMappingURL=internal.cjs.map
|