@fuel-ts/account 0.0.0-rc-2037-20240510180649 → 0.0.0-rc-1356-20240513141855
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.
Potentially problematic release.
This version of @fuel-ts/account might be problematic. Click here for more details.
- package/dist/hdwallet/hdwallet.d.ts.map +1 -1
- package/dist/index.global.js +1287 -1545
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +118 -129
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +6 -16
- package/dist/index.mjs.map +1 -1
- package/dist/mnemonic/mnemonic.d.ts.map +1 -1
- package/dist/providers/utils/auto-retry-fetch.d.ts.map +1 -1
- package/dist/providers/utils/index.d.ts +0 -1
- package/dist/providers/utils/index.d.ts.map +1 -1
- package/dist/test-utils/asset-id.d.ts +8 -0
- package/dist/test-utils/asset-id.d.ts.map +1 -0
- package/dist/test-utils/index.d.ts +4 -0
- package/dist/test-utils/index.d.ts.map +1 -1
- package/dist/test-utils/launchNode.d.ts +8 -1
- package/dist/test-utils/launchNode.d.ts.map +1 -1
- package/dist/test-utils/setup-test-provider-and-wallets.d.ts +33 -0
- package/dist/test-utils/setup-test-provider-and-wallets.d.ts.map +1 -0
- package/dist/test-utils/test-message.d.ts +28 -0
- package/dist/test-utils/test-message.d.ts.map +1 -0
- package/dist/test-utils/wallet-config.d.ts +49 -0
- package/dist/test-utils/wallet-config.d.ts.map +1 -0
- package/dist/test-utils.global.js +1648 -1584
- package/dist/test-utils.global.js.map +1 -1
- package/dist/test-utils.js +400 -172
- package/dist/test-utils.js.map +1 -1
- package/dist/test-utils.mjs +295 -71
- package/dist/test-utils.mjs.map +1 -1
- package/package.json +16 -16
- package/dist/providers/utils/sleep.d.ts +0 -3
- package/dist/providers/utils/sleep.d.ts.map +0 -1
package/dist/index.global.js
CHANGED
@@ -68,178 +68,12 @@
|
|
68
68
|
return method;
|
69
69
|
};
|
70
70
|
|
71
|
-
// ../../node_modules/.pnpm/bech32@2.0.0/node_modules/bech32/dist/index.js
|
72
|
-
var require_dist = __commonJS({
|
73
|
-
"../../node_modules/.pnpm/bech32@2.0.0/node_modules/bech32/dist/index.js"(exports) {
|
74
|
-
"use strict";
|
75
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
76
|
-
exports.bech32m = exports.bech32 = void 0;
|
77
|
-
var ALPHABET = "qpzry9x8gf2tvdw0s3jn54khce6mua7l";
|
78
|
-
var ALPHABET_MAP = {};
|
79
|
-
for (let z = 0; z < ALPHABET.length; z++) {
|
80
|
-
const x = ALPHABET.charAt(z);
|
81
|
-
ALPHABET_MAP[x] = z;
|
82
|
-
}
|
83
|
-
function polymodStep(pre) {
|
84
|
-
const b = pre >> 25;
|
85
|
-
return (pre & 33554431) << 5 ^ -(b >> 0 & 1) & 996825010 ^ -(b >> 1 & 1) & 642813549 ^ -(b >> 2 & 1) & 513874426 ^ -(b >> 3 & 1) & 1027748829 ^ -(b >> 4 & 1) & 705979059;
|
86
|
-
}
|
87
|
-
function prefixChk(prefix) {
|
88
|
-
let chk = 1;
|
89
|
-
for (let i = 0; i < prefix.length; ++i) {
|
90
|
-
const c = prefix.charCodeAt(i);
|
91
|
-
if (c < 33 || c > 126)
|
92
|
-
return "Invalid prefix (" + prefix + ")";
|
93
|
-
chk = polymodStep(chk) ^ c >> 5;
|
94
|
-
}
|
95
|
-
chk = polymodStep(chk);
|
96
|
-
for (let i = 0; i < prefix.length; ++i) {
|
97
|
-
const v = prefix.charCodeAt(i);
|
98
|
-
chk = polymodStep(chk) ^ v & 31;
|
99
|
-
}
|
100
|
-
return chk;
|
101
|
-
}
|
102
|
-
function convert2(data, inBits, outBits, pad3) {
|
103
|
-
let value = 0;
|
104
|
-
let bits = 0;
|
105
|
-
const maxV = (1 << outBits) - 1;
|
106
|
-
const result = [];
|
107
|
-
for (let i = 0; i < data.length; ++i) {
|
108
|
-
value = value << inBits | data[i];
|
109
|
-
bits += inBits;
|
110
|
-
while (bits >= outBits) {
|
111
|
-
bits -= outBits;
|
112
|
-
result.push(value >> bits & maxV);
|
113
|
-
}
|
114
|
-
}
|
115
|
-
if (pad3) {
|
116
|
-
if (bits > 0) {
|
117
|
-
result.push(value << outBits - bits & maxV);
|
118
|
-
}
|
119
|
-
} else {
|
120
|
-
if (bits >= inBits)
|
121
|
-
return "Excess padding";
|
122
|
-
if (value << outBits - bits & maxV)
|
123
|
-
return "Non-zero padding";
|
124
|
-
}
|
125
|
-
return result;
|
126
|
-
}
|
127
|
-
function toWords(bytes3) {
|
128
|
-
return convert2(bytes3, 8, 5, true);
|
129
|
-
}
|
130
|
-
function fromWordsUnsafe(words) {
|
131
|
-
const res = convert2(words, 5, 8, false);
|
132
|
-
if (Array.isArray(res))
|
133
|
-
return res;
|
134
|
-
}
|
135
|
-
function fromWords(words) {
|
136
|
-
const res = convert2(words, 5, 8, false);
|
137
|
-
if (Array.isArray(res))
|
138
|
-
return res;
|
139
|
-
throw new Error(res);
|
140
|
-
}
|
141
|
-
function getLibraryFromEncoding(encoding) {
|
142
|
-
let ENCODING_CONST;
|
143
|
-
if (encoding === "bech32") {
|
144
|
-
ENCODING_CONST = 1;
|
145
|
-
} else {
|
146
|
-
ENCODING_CONST = 734539939;
|
147
|
-
}
|
148
|
-
function encode(prefix, words, LIMIT) {
|
149
|
-
LIMIT = LIMIT || 90;
|
150
|
-
if (prefix.length + 7 + words.length > LIMIT)
|
151
|
-
throw new TypeError("Exceeds length limit");
|
152
|
-
prefix = prefix.toLowerCase();
|
153
|
-
let chk = prefixChk(prefix);
|
154
|
-
if (typeof chk === "string")
|
155
|
-
throw new Error(chk);
|
156
|
-
let result = prefix + "1";
|
157
|
-
for (let i = 0; i < words.length; ++i) {
|
158
|
-
const x = words[i];
|
159
|
-
if (x >> 5 !== 0)
|
160
|
-
throw new Error("Non 5-bit word");
|
161
|
-
chk = polymodStep(chk) ^ x;
|
162
|
-
result += ALPHABET.charAt(x);
|
163
|
-
}
|
164
|
-
for (let i = 0; i < 6; ++i) {
|
165
|
-
chk = polymodStep(chk);
|
166
|
-
}
|
167
|
-
chk ^= ENCODING_CONST;
|
168
|
-
for (let i = 0; i < 6; ++i) {
|
169
|
-
const v = chk >> (5 - i) * 5 & 31;
|
170
|
-
result += ALPHABET.charAt(v);
|
171
|
-
}
|
172
|
-
return result;
|
173
|
-
}
|
174
|
-
function __decode(str, LIMIT) {
|
175
|
-
LIMIT = LIMIT || 90;
|
176
|
-
if (str.length < 8)
|
177
|
-
return str + " too short";
|
178
|
-
if (str.length > LIMIT)
|
179
|
-
return "Exceeds length limit";
|
180
|
-
const lowered = str.toLowerCase();
|
181
|
-
const uppered = str.toUpperCase();
|
182
|
-
if (str !== lowered && str !== uppered)
|
183
|
-
return "Mixed-case string " + str;
|
184
|
-
str = lowered;
|
185
|
-
const split2 = str.lastIndexOf("1");
|
186
|
-
if (split2 === -1)
|
187
|
-
return "No separator character for " + str;
|
188
|
-
if (split2 === 0)
|
189
|
-
return "Missing prefix for " + str;
|
190
|
-
const prefix = str.slice(0, split2);
|
191
|
-
const wordChars = str.slice(split2 + 1);
|
192
|
-
if (wordChars.length < 6)
|
193
|
-
return "Data too short";
|
194
|
-
let chk = prefixChk(prefix);
|
195
|
-
if (typeof chk === "string")
|
196
|
-
return chk;
|
197
|
-
const words = [];
|
198
|
-
for (let i = 0; i < wordChars.length; ++i) {
|
199
|
-
const c = wordChars.charAt(i);
|
200
|
-
const v = ALPHABET_MAP[c];
|
201
|
-
if (v === void 0)
|
202
|
-
return "Unknown character " + c;
|
203
|
-
chk = polymodStep(chk) ^ v;
|
204
|
-
if (i + 6 >= wordChars.length)
|
205
|
-
continue;
|
206
|
-
words.push(v);
|
207
|
-
}
|
208
|
-
if (chk !== ENCODING_CONST)
|
209
|
-
return "Invalid checksum for " + str;
|
210
|
-
return { prefix, words };
|
211
|
-
}
|
212
|
-
function decodeUnsafe(str, LIMIT) {
|
213
|
-
const res = __decode(str, LIMIT);
|
214
|
-
if (typeof res === "object")
|
215
|
-
return res;
|
216
|
-
}
|
217
|
-
function decode(str, LIMIT) {
|
218
|
-
const res = __decode(str, LIMIT);
|
219
|
-
if (typeof res === "object")
|
220
|
-
return res;
|
221
|
-
throw new Error(res);
|
222
|
-
}
|
223
|
-
return {
|
224
|
-
decodeUnsafe,
|
225
|
-
decode,
|
226
|
-
encode,
|
227
|
-
toWords,
|
228
|
-
fromWordsUnsafe,
|
229
|
-
fromWords
|
230
|
-
};
|
231
|
-
}
|
232
|
-
exports.bech32 = getLibraryFromEncoding("bech32");
|
233
|
-
exports.bech32m = getLibraryFromEncoding("bech32m");
|
234
|
-
}
|
235
|
-
});
|
236
|
-
|
237
71
|
// ../../node_modules/.pnpm/bn.js@5.2.1/node_modules/bn.js/lib/bn.js
|
238
72
|
var require_bn = __commonJS({
|
239
73
|
"../../node_modules/.pnpm/bn.js@5.2.1/node_modules/bn.js/lib/bn.js"(exports, module) {
|
240
74
|
(function(module2, exports2) {
|
241
75
|
"use strict";
|
242
|
-
function
|
76
|
+
function assert3(val, msg) {
|
243
77
|
if (!val)
|
244
78
|
throw new Error(msg || "Assertion failed");
|
245
79
|
}
|
@@ -251,20 +85,20 @@
|
|
251
85
|
ctor.prototype = new TempCtor();
|
252
86
|
ctor.prototype.constructor = ctor;
|
253
87
|
}
|
254
|
-
function BN2(
|
255
|
-
if (BN2.isBN(
|
256
|
-
return
|
88
|
+
function BN2(number2, base, endian) {
|
89
|
+
if (BN2.isBN(number2)) {
|
90
|
+
return number2;
|
257
91
|
}
|
258
92
|
this.negative = 0;
|
259
93
|
this.words = null;
|
260
94
|
this.length = 0;
|
261
95
|
this.red = null;
|
262
|
-
if (
|
96
|
+
if (number2 !== null) {
|
263
97
|
if (base === "le" || base === "be") {
|
264
98
|
endian = base;
|
265
99
|
base = 10;
|
266
100
|
}
|
267
|
-
this._init(
|
101
|
+
this._init(number2 || 0, base || 10, endian || "be");
|
268
102
|
}
|
269
103
|
}
|
270
104
|
if (typeof module2 === "object") {
|
@@ -299,53 +133,53 @@
|
|
299
133
|
return left;
|
300
134
|
return right;
|
301
135
|
};
|
302
|
-
BN2.prototype._init = function init(
|
303
|
-
if (typeof
|
304
|
-
return this._initNumber(
|
136
|
+
BN2.prototype._init = function init(number2, base, endian) {
|
137
|
+
if (typeof number2 === "number") {
|
138
|
+
return this._initNumber(number2, base, endian);
|
305
139
|
}
|
306
|
-
if (typeof
|
307
|
-
return this._initArray(
|
140
|
+
if (typeof number2 === "object") {
|
141
|
+
return this._initArray(number2, base, endian);
|
308
142
|
}
|
309
143
|
if (base === "hex") {
|
310
144
|
base = 16;
|
311
145
|
}
|
312
|
-
|
313
|
-
|
146
|
+
assert3(base === (base | 0) && base >= 2 && base <= 36);
|
147
|
+
number2 = number2.toString().replace(/\s+/g, "");
|
314
148
|
var start = 0;
|
315
|
-
if (
|
149
|
+
if (number2[0] === "-") {
|
316
150
|
start++;
|
317
151
|
this.negative = 1;
|
318
152
|
}
|
319
|
-
if (start <
|
153
|
+
if (start < number2.length) {
|
320
154
|
if (base === 16) {
|
321
|
-
this._parseHex(
|
155
|
+
this._parseHex(number2, start, endian);
|
322
156
|
} else {
|
323
|
-
this._parseBase(
|
157
|
+
this._parseBase(number2, base, start);
|
324
158
|
if (endian === "le") {
|
325
159
|
this._initArray(this.toArray(), base, endian);
|
326
160
|
}
|
327
161
|
}
|
328
162
|
}
|
329
163
|
};
|
330
|
-
BN2.prototype._initNumber = function _initNumber(
|
331
|
-
if (
|
164
|
+
BN2.prototype._initNumber = function _initNumber(number2, base, endian) {
|
165
|
+
if (number2 < 0) {
|
332
166
|
this.negative = 1;
|
333
|
-
|
167
|
+
number2 = -number2;
|
334
168
|
}
|
335
|
-
if (
|
336
|
-
this.words = [
|
169
|
+
if (number2 < 67108864) {
|
170
|
+
this.words = [number2 & 67108863];
|
337
171
|
this.length = 1;
|
338
|
-
} else if (
|
172
|
+
} else if (number2 < 4503599627370496) {
|
339
173
|
this.words = [
|
340
|
-
|
341
|
-
|
174
|
+
number2 & 67108863,
|
175
|
+
number2 / 67108864 & 67108863
|
342
176
|
];
|
343
177
|
this.length = 2;
|
344
178
|
} else {
|
345
|
-
|
179
|
+
assert3(number2 < 9007199254740992);
|
346
180
|
this.words = [
|
347
|
-
|
348
|
-
|
181
|
+
number2 & 67108863,
|
182
|
+
number2 / 67108864 & 67108863,
|
349
183
|
1
|
350
184
|
];
|
351
185
|
this.length = 3;
|
@@ -354,14 +188,14 @@
|
|
354
188
|
return;
|
355
189
|
this._initArray(this.toArray(), base, endian);
|
356
190
|
};
|
357
|
-
BN2.prototype._initArray = function _initArray(
|
358
|
-
|
359
|
-
if (
|
191
|
+
BN2.prototype._initArray = function _initArray(number2, base, endian) {
|
192
|
+
assert3(typeof number2.length === "number");
|
193
|
+
if (number2.length <= 0) {
|
360
194
|
this.words = [0];
|
361
195
|
this.length = 1;
|
362
196
|
return this;
|
363
197
|
}
|
364
|
-
this.length = Math.ceil(
|
198
|
+
this.length = Math.ceil(number2.length / 3);
|
365
199
|
this.words = new Array(this.length);
|
366
200
|
for (var i = 0; i < this.length; i++) {
|
367
201
|
this.words[i] = 0;
|
@@ -369,8 +203,8 @@
|
|
369
203
|
var j, w;
|
370
204
|
var off = 0;
|
371
205
|
if (endian === "be") {
|
372
|
-
for (i =
|
373
|
-
w =
|
206
|
+
for (i = number2.length - 1, j = 0; i >= 0; i -= 3) {
|
207
|
+
w = number2[i] | number2[i - 1] << 8 | number2[i - 2] << 16;
|
374
208
|
this.words[j] |= w << off & 67108863;
|
375
209
|
this.words[j + 1] = w >>> 26 - off & 67108863;
|
376
210
|
off += 24;
|
@@ -380,8 +214,8 @@
|
|
380
214
|
}
|
381
215
|
}
|
382
216
|
} else if (endian === "le") {
|
383
|
-
for (i = 0, j = 0; i <
|
384
|
-
w =
|
217
|
+
for (i = 0, j = 0; i < number2.length; i += 3) {
|
218
|
+
w = number2[i] | number2[i + 1] << 8 | number2[i + 2] << 16;
|
385
219
|
this.words[j] |= w << off & 67108863;
|
386
220
|
this.words[j + 1] = w >>> 26 - off & 67108863;
|
387
221
|
off += 24;
|
@@ -402,7 +236,7 @@
|
|
402
236
|
} else if (c >= 97 && c <= 102) {
|
403
237
|
return c - 87;
|
404
238
|
} else {
|
405
|
-
|
239
|
+
assert3(false, "Invalid character in " + string);
|
406
240
|
}
|
407
241
|
}
|
408
242
|
function parseHexByte(string, lowerBound, index) {
|
@@ -412,8 +246,8 @@
|
|
412
246
|
}
|
413
247
|
return r;
|
414
248
|
}
|
415
|
-
BN2.prototype._parseHex = function _parseHex(
|
416
|
-
this.length = Math.ceil((
|
249
|
+
BN2.prototype._parseHex = function _parseHex(number2, start, endian) {
|
250
|
+
this.length = Math.ceil((number2.length - start) / 6);
|
417
251
|
this.words = new Array(this.length);
|
418
252
|
for (var i = 0; i < this.length; i++) {
|
419
253
|
this.words[i] = 0;
|
@@ -422,8 +256,8 @@
|
|
422
256
|
var j = 0;
|
423
257
|
var w;
|
424
258
|
if (endian === "be") {
|
425
|
-
for (i =
|
426
|
-
w = parseHexByte(
|
259
|
+
for (i = number2.length - 1; i >= start; i -= 2) {
|
260
|
+
w = parseHexByte(number2, start, i) << off;
|
427
261
|
this.words[j] |= w & 67108863;
|
428
262
|
if (off >= 18) {
|
429
263
|
off -= 18;
|
@@ -434,9 +268,9 @@
|
|
434
268
|
}
|
435
269
|
}
|
436
270
|
} else {
|
437
|
-
var parseLength =
|
438
|
-
for (i = parseLength % 2 === 0 ? start + 1 : start; i <
|
439
|
-
w = parseHexByte(
|
271
|
+
var parseLength = number2.length - start;
|
272
|
+
for (i = parseLength % 2 === 0 ? start + 1 : start; i < number2.length; i += 2) {
|
273
|
+
w = parseHexByte(number2, start, i) << off;
|
440
274
|
this.words[j] |= w & 67108863;
|
441
275
|
if (off >= 18) {
|
442
276
|
off -= 18;
|
@@ -463,12 +297,12 @@
|
|
463
297
|
} else {
|
464
298
|
b = c;
|
465
299
|
}
|
466
|
-
|
300
|
+
assert3(c >= 0 && b < mul, "Invalid character");
|
467
301
|
r += b;
|
468
302
|
}
|
469
303
|
return r;
|
470
304
|
}
|
471
|
-
BN2.prototype._parseBase = function _parseBase(
|
305
|
+
BN2.prototype._parseBase = function _parseBase(number2, base, start) {
|
472
306
|
this.words = [0];
|
473
307
|
this.length = 1;
|
474
308
|
for (var limbLen = 0, limbPow = 1; limbPow <= 67108863; limbPow *= base) {
|
@@ -476,12 +310,12 @@
|
|
476
310
|
}
|
477
311
|
limbLen--;
|
478
312
|
limbPow = limbPow / base | 0;
|
479
|
-
var total =
|
313
|
+
var total = number2.length - start;
|
480
314
|
var mod2 = total % limbLen;
|
481
315
|
var end = Math.min(total, total - mod2) + start;
|
482
316
|
var word = 0;
|
483
317
|
for (var i = start; i < end; i += limbLen) {
|
484
|
-
word = parseBase(
|
318
|
+
word = parseBase(number2, i, i + limbLen, base);
|
485
319
|
this.imuln(limbPow);
|
486
320
|
if (this.words[0] + word < 67108864) {
|
487
321
|
this.words[0] += word;
|
@@ -491,7 +325,7 @@
|
|
491
325
|
}
|
492
326
|
if (mod2 !== 0) {
|
493
327
|
var pow3 = 1;
|
494
|
-
word = parseBase(
|
328
|
+
word = parseBase(number2, i, number2.length, base);
|
495
329
|
for (i = 0; i < mod2; i++) {
|
496
330
|
pow3 *= base;
|
497
331
|
}
|
@@ -723,7 +557,7 @@
|
|
723
557
|
}
|
724
558
|
return out;
|
725
559
|
}
|
726
|
-
|
560
|
+
assert3(false, "Base should be between 2 and 36");
|
727
561
|
};
|
728
562
|
BN2.prototype.toNumber = function toNumber3() {
|
729
563
|
var ret2 = this.words[0];
|
@@ -732,7 +566,7 @@
|
|
732
566
|
} else if (this.length === 3 && this.words[2] === 1) {
|
733
567
|
ret2 += 4503599627370496 + this.words[1] * 67108864;
|
734
568
|
} else if (this.length > 2) {
|
735
|
-
|
569
|
+
assert3(false, "Number can only safely store up to 53 bits");
|
736
570
|
}
|
737
571
|
return this.negative !== 0 ? -ret2 : ret2;
|
738
572
|
};
|
@@ -757,8 +591,8 @@
|
|
757
591
|
this._strip();
|
758
592
|
var byteLength = this.byteLength();
|
759
593
|
var reqLength = length || Math.max(1, byteLength);
|
760
|
-
|
761
|
-
|
594
|
+
assert3(byteLength <= reqLength, "byte array longer than desired length");
|
595
|
+
assert3(reqLength > 0, "Requested array length <= 0");
|
762
596
|
var res = allocate(ArrayType, reqLength);
|
763
597
|
var postfix = endian === "le" ? "LE" : "BE";
|
764
598
|
this["_toArrayLike" + postfix](res, byteLength);
|
@@ -940,7 +774,7 @@
|
|
940
774
|
return this._strip();
|
941
775
|
};
|
942
776
|
BN2.prototype.ior = function ior(num) {
|
943
|
-
|
777
|
+
assert3((this.negative | num.negative) === 0);
|
944
778
|
return this.iuor(num);
|
945
779
|
};
|
946
780
|
BN2.prototype.or = function or(num) {
|
@@ -967,7 +801,7 @@
|
|
967
801
|
return this._strip();
|
968
802
|
};
|
969
803
|
BN2.prototype.iand = function iand(num) {
|
970
|
-
|
804
|
+
assert3((this.negative | num.negative) === 0);
|
971
805
|
return this.iuand(num);
|
972
806
|
};
|
973
807
|
BN2.prototype.and = function and(num) {
|
@@ -1002,7 +836,7 @@
|
|
1002
836
|
return this._strip();
|
1003
837
|
};
|
1004
838
|
BN2.prototype.ixor = function ixor(num) {
|
1005
|
-
|
839
|
+
assert3((this.negative | num.negative) === 0);
|
1006
840
|
return this.iuxor(num);
|
1007
841
|
};
|
1008
842
|
BN2.prototype.xor = function xor(num) {
|
@@ -1016,7 +850,7 @@
|
|
1016
850
|
return num.clone().iuxor(this);
|
1017
851
|
};
|
1018
852
|
BN2.prototype.inotn = function inotn(width) {
|
1019
|
-
|
853
|
+
assert3(typeof width === "number" && width >= 0);
|
1020
854
|
var bytesNeeded = Math.ceil(width / 26) | 0;
|
1021
855
|
var bitsLeft = width % 26;
|
1022
856
|
this._expand(bytesNeeded);
|
@@ -1035,7 +869,7 @@
|
|
1035
869
|
return this.clone().inotn(width);
|
1036
870
|
};
|
1037
871
|
BN2.prototype.setn = function setn(bit, val) {
|
1038
|
-
|
872
|
+
assert3(typeof bit === "number" && bit >= 0);
|
1039
873
|
var off = bit / 26 | 0;
|
1040
874
|
var wbit = bit % 26;
|
1041
875
|
this._expand(off + 1);
|
@@ -1901,8 +1735,8 @@
|
|
1901
1735
|
for (i = 2 * len; i < N; ++i) {
|
1902
1736
|
rws[i] = 0;
|
1903
1737
|
}
|
1904
|
-
|
1905
|
-
|
1738
|
+
assert3(carry === 0);
|
1739
|
+
assert3((carry & ~8191) === 0);
|
1906
1740
|
};
|
1907
1741
|
FFTM.prototype.stub = function stub(N) {
|
1908
1742
|
var ph = new Array(N);
|
@@ -1957,8 +1791,8 @@
|
|
1957
1791
|
var isNegNum = num < 0;
|
1958
1792
|
if (isNegNum)
|
1959
1793
|
num = -num;
|
1960
|
-
|
1961
|
-
|
1794
|
+
assert3(typeof num === "number");
|
1795
|
+
assert3(num < 67108864);
|
1962
1796
|
var carry = 0;
|
1963
1797
|
for (var i = 0; i < this.length; i++) {
|
1964
1798
|
var w = (this.words[i] | 0) * num;
|
@@ -2002,7 +1836,7 @@
|
|
2002
1836
|
return res;
|
2003
1837
|
};
|
2004
1838
|
BN2.prototype.iushln = function iushln(bits) {
|
2005
|
-
|
1839
|
+
assert3(typeof bits === "number" && bits >= 0);
|
2006
1840
|
var r = bits % 26;
|
2007
1841
|
var s = (bits - r) / 26;
|
2008
1842
|
var carryMask = 67108863 >>> 26 - r << 26 - r;
|
@@ -2032,11 +1866,11 @@
|
|
2032
1866
|
return this._strip();
|
2033
1867
|
};
|
2034
1868
|
BN2.prototype.ishln = function ishln(bits) {
|
2035
|
-
|
1869
|
+
assert3(this.negative === 0);
|
2036
1870
|
return this.iushln(bits);
|
2037
1871
|
};
|
2038
1872
|
BN2.prototype.iushrn = function iushrn(bits, hint, extended) {
|
2039
|
-
|
1873
|
+
assert3(typeof bits === "number" && bits >= 0);
|
2040
1874
|
var h;
|
2041
1875
|
if (hint) {
|
2042
1876
|
h = (hint - hint % 26) / 26;
|
@@ -2081,7 +1915,7 @@
|
|
2081
1915
|
return this._strip();
|
2082
1916
|
};
|
2083
1917
|
BN2.prototype.ishrn = function ishrn(bits, hint, extended) {
|
2084
|
-
|
1918
|
+
assert3(this.negative === 0);
|
2085
1919
|
return this.iushrn(bits, hint, extended);
|
2086
1920
|
};
|
2087
1921
|
BN2.prototype.shln = function shln(bits) {
|
@@ -2097,7 +1931,7 @@
|
|
2097
1931
|
return this.clone().iushrn(bits);
|
2098
1932
|
};
|
2099
1933
|
BN2.prototype.testn = function testn(bit) {
|
2100
|
-
|
1934
|
+
assert3(typeof bit === "number" && bit >= 0);
|
2101
1935
|
var r = bit % 26;
|
2102
1936
|
var s = (bit - r) / 26;
|
2103
1937
|
var q = 1 << r;
|
@@ -2107,10 +1941,10 @@
|
|
2107
1941
|
return !!(w & q);
|
2108
1942
|
};
|
2109
1943
|
BN2.prototype.imaskn = function imaskn(bits) {
|
2110
|
-
|
1944
|
+
assert3(typeof bits === "number" && bits >= 0);
|
2111
1945
|
var r = bits % 26;
|
2112
1946
|
var s = (bits - r) / 26;
|
2113
|
-
|
1947
|
+
assert3(this.negative === 0, "imaskn works only with positive numbers");
|
2114
1948
|
if (this.length <= s) {
|
2115
1949
|
return this;
|
2116
1950
|
}
|
@@ -2128,8 +1962,8 @@
|
|
2128
1962
|
return this.clone().imaskn(bits);
|
2129
1963
|
};
|
2130
1964
|
BN2.prototype.iaddn = function iaddn(num) {
|
2131
|
-
|
2132
|
-
|
1965
|
+
assert3(typeof num === "number");
|
1966
|
+
assert3(num < 67108864);
|
2133
1967
|
if (num < 0)
|
2134
1968
|
return this.isubn(-num);
|
2135
1969
|
if (this.negative !== 0) {
|
@@ -2159,8 +1993,8 @@
|
|
2159
1993
|
return this;
|
2160
1994
|
};
|
2161
1995
|
BN2.prototype.isubn = function isubn(num) {
|
2162
|
-
|
2163
|
-
|
1996
|
+
assert3(typeof num === "number");
|
1997
|
+
assert3(num < 67108864);
|
2164
1998
|
if (num < 0)
|
2165
1999
|
return this.iaddn(-num);
|
2166
2000
|
if (this.negative !== 0) {
|
@@ -2214,7 +2048,7 @@
|
|
2214
2048
|
}
|
2215
2049
|
if (carry === 0)
|
2216
2050
|
return this._strip();
|
2217
|
-
|
2051
|
+
assert3(carry === -1);
|
2218
2052
|
carry = 0;
|
2219
2053
|
for (i = 0; i < this.length; i++) {
|
2220
2054
|
w = -(this.words[i] | 0) + carry;
|
@@ -2282,7 +2116,7 @@
|
|
2282
2116
|
};
|
2283
2117
|
};
|
2284
2118
|
BN2.prototype.divmod = function divmod(num, mode, positive) {
|
2285
|
-
|
2119
|
+
assert3(!num.isZero());
|
2286
2120
|
if (this.isZero()) {
|
2287
2121
|
return {
|
2288
2122
|
div: new BN2(0),
|
@@ -2380,7 +2214,7 @@
|
|
2380
2214
|
var isNegNum = num < 0;
|
2381
2215
|
if (isNegNum)
|
2382
2216
|
num = -num;
|
2383
|
-
|
2217
|
+
assert3(num <= 67108863);
|
2384
2218
|
var p = (1 << 26) % num;
|
2385
2219
|
var acc = 0;
|
2386
2220
|
for (var i = this.length - 1; i >= 0; i--) {
|
@@ -2395,7 +2229,7 @@
|
|
2395
2229
|
var isNegNum = num < 0;
|
2396
2230
|
if (isNegNum)
|
2397
2231
|
num = -num;
|
2398
|
-
|
2232
|
+
assert3(num <= 67108863);
|
2399
2233
|
var carry = 0;
|
2400
2234
|
for (var i = this.length - 1; i >= 0; i--) {
|
2401
2235
|
var w = (this.words[i] | 0) + carry * 67108864;
|
@@ -2409,8 +2243,8 @@
|
|
2409
2243
|
return this.clone().idivn(num);
|
2410
2244
|
};
|
2411
2245
|
BN2.prototype.egcd = function egcd(p) {
|
2412
|
-
|
2413
|
-
|
2246
|
+
assert3(p.negative === 0);
|
2247
|
+
assert3(!p.isZero());
|
2414
2248
|
var x = this;
|
2415
2249
|
var y = p.clone();
|
2416
2250
|
if (x.negative !== 0) {
|
@@ -2474,8 +2308,8 @@
|
|
2474
2308
|
};
|
2475
2309
|
};
|
2476
2310
|
BN2.prototype._invmp = function _invmp(p) {
|
2477
|
-
|
2478
|
-
|
2311
|
+
assert3(p.negative === 0);
|
2312
|
+
assert3(!p.isZero());
|
2479
2313
|
var a = this;
|
2480
2314
|
var b = p.clone();
|
2481
2315
|
if (a.negative !== 0) {
|
@@ -2573,7 +2407,7 @@
|
|
2573
2407
|
return this.words[0] & num;
|
2574
2408
|
};
|
2575
2409
|
BN2.prototype.bincn = function bincn(bit) {
|
2576
|
-
|
2410
|
+
assert3(typeof bit === "number");
|
2577
2411
|
var r = bit % 26;
|
2578
2412
|
var s = (bit - r) / 26;
|
2579
2413
|
var q = 1 << r;
|
@@ -2613,7 +2447,7 @@
|
|
2613
2447
|
if (negative) {
|
2614
2448
|
num = -num;
|
2615
2449
|
}
|
2616
|
-
|
2450
|
+
assert3(num <= 67108863, "Number is too big");
|
2617
2451
|
var w = this.words[0] | 0;
|
2618
2452
|
res = w === num ? 0 : w < num ? -1 : 1;
|
2619
2453
|
}
|
@@ -2685,12 +2519,12 @@
|
|
2685
2519
|
return new Red(num);
|
2686
2520
|
};
|
2687
2521
|
BN2.prototype.toRed = function toRed(ctx) {
|
2688
|
-
|
2689
|
-
|
2522
|
+
assert3(!this.red, "Already a number in reduction context");
|
2523
|
+
assert3(this.negative === 0, "red works only with positives");
|
2690
2524
|
return ctx.convertTo(this)._forceRed(ctx);
|
2691
2525
|
};
|
2692
2526
|
BN2.prototype.fromRed = function fromRed() {
|
2693
|
-
|
2527
|
+
assert3(this.red, "fromRed works only with numbers in reduction context");
|
2694
2528
|
return this.red.convertFrom(this);
|
2695
2529
|
};
|
2696
2530
|
BN2.prototype._forceRed = function _forceRed(ctx) {
|
@@ -2698,66 +2532,66 @@
|
|
2698
2532
|
return this;
|
2699
2533
|
};
|
2700
2534
|
BN2.prototype.forceRed = function forceRed(ctx) {
|
2701
|
-
|
2535
|
+
assert3(!this.red, "Already a number in reduction context");
|
2702
2536
|
return this._forceRed(ctx);
|
2703
2537
|
};
|
2704
2538
|
BN2.prototype.redAdd = function redAdd(num) {
|
2705
|
-
|
2539
|
+
assert3(this.red, "redAdd works only with red numbers");
|
2706
2540
|
return this.red.add(this, num);
|
2707
2541
|
};
|
2708
2542
|
BN2.prototype.redIAdd = function redIAdd(num) {
|
2709
|
-
|
2543
|
+
assert3(this.red, "redIAdd works only with red numbers");
|
2710
2544
|
return this.red.iadd(this, num);
|
2711
2545
|
};
|
2712
2546
|
BN2.prototype.redSub = function redSub(num) {
|
2713
|
-
|
2547
|
+
assert3(this.red, "redSub works only with red numbers");
|
2714
2548
|
return this.red.sub(this, num);
|
2715
2549
|
};
|
2716
2550
|
BN2.prototype.redISub = function redISub(num) {
|
2717
|
-
|
2551
|
+
assert3(this.red, "redISub works only with red numbers");
|
2718
2552
|
return this.red.isub(this, num);
|
2719
2553
|
};
|
2720
2554
|
BN2.prototype.redShl = function redShl(num) {
|
2721
|
-
|
2555
|
+
assert3(this.red, "redShl works only with red numbers");
|
2722
2556
|
return this.red.shl(this, num);
|
2723
2557
|
};
|
2724
2558
|
BN2.prototype.redMul = function redMul(num) {
|
2725
|
-
|
2559
|
+
assert3(this.red, "redMul works only with red numbers");
|
2726
2560
|
this.red._verify2(this, num);
|
2727
2561
|
return this.red.mul(this, num);
|
2728
2562
|
};
|
2729
2563
|
BN2.prototype.redIMul = function redIMul(num) {
|
2730
|
-
|
2564
|
+
assert3(this.red, "redMul works only with red numbers");
|
2731
2565
|
this.red._verify2(this, num);
|
2732
2566
|
return this.red.imul(this, num);
|
2733
2567
|
};
|
2734
2568
|
BN2.prototype.redSqr = function redSqr() {
|
2735
|
-
|
2569
|
+
assert3(this.red, "redSqr works only with red numbers");
|
2736
2570
|
this.red._verify1(this);
|
2737
2571
|
return this.red.sqr(this);
|
2738
2572
|
};
|
2739
2573
|
BN2.prototype.redISqr = function redISqr() {
|
2740
|
-
|
2574
|
+
assert3(this.red, "redISqr works only with red numbers");
|
2741
2575
|
this.red._verify1(this);
|
2742
2576
|
return this.red.isqr(this);
|
2743
2577
|
};
|
2744
2578
|
BN2.prototype.redSqrt = function redSqrt() {
|
2745
|
-
|
2579
|
+
assert3(this.red, "redSqrt works only with red numbers");
|
2746
2580
|
this.red._verify1(this);
|
2747
2581
|
return this.red.sqrt(this);
|
2748
2582
|
};
|
2749
2583
|
BN2.prototype.redInvm = function redInvm() {
|
2750
|
-
|
2584
|
+
assert3(this.red, "redInvm works only with red numbers");
|
2751
2585
|
this.red._verify1(this);
|
2752
2586
|
return this.red.invm(this);
|
2753
2587
|
};
|
2754
2588
|
BN2.prototype.redNeg = function redNeg() {
|
2755
|
-
|
2589
|
+
assert3(this.red, "redNeg works only with red numbers");
|
2756
2590
|
this.red._verify1(this);
|
2757
2591
|
return this.red.neg(this);
|
2758
2592
|
};
|
2759
2593
|
BN2.prototype.redPow = function redPow(num) {
|
2760
|
-
|
2594
|
+
assert3(this.red && !num.red, "redPow(normalNum)");
|
2761
2595
|
this.red._verify1(this);
|
2762
2596
|
return this.red.pow(this, num);
|
2763
2597
|
};
|
@@ -2817,20 +2651,20 @@
|
|
2817
2651
|
);
|
2818
2652
|
}
|
2819
2653
|
inherits(K256, MPrime);
|
2820
|
-
K256.prototype.split = function split2(input,
|
2654
|
+
K256.prototype.split = function split2(input, output2) {
|
2821
2655
|
var mask2 = 4194303;
|
2822
2656
|
var outLen = Math.min(input.length, 9);
|
2823
2657
|
for (var i = 0; i < outLen; i++) {
|
2824
|
-
|
2658
|
+
output2.words[i] = input.words[i];
|
2825
2659
|
}
|
2826
|
-
|
2660
|
+
output2.length = outLen;
|
2827
2661
|
if (input.length <= 9) {
|
2828
2662
|
input.words[0] = 0;
|
2829
2663
|
input.length = 1;
|
2830
2664
|
return;
|
2831
2665
|
}
|
2832
2666
|
var prev = input.words[9];
|
2833
|
-
|
2667
|
+
output2.words[output2.length++] = prev & mask2;
|
2834
2668
|
for (i = 10; i < input.length; i++) {
|
2835
2669
|
var next = input.words[i] | 0;
|
2836
2670
|
input.words[i - 10] = (next & mask2) << 4 | prev >>> 22;
|
@@ -2925,18 +2759,18 @@
|
|
2925
2759
|
this.m = prime.p;
|
2926
2760
|
this.prime = prime;
|
2927
2761
|
} else {
|
2928
|
-
|
2762
|
+
assert3(m.gtn(1), "modulus must be greater than 1");
|
2929
2763
|
this.m = m;
|
2930
2764
|
this.prime = null;
|
2931
2765
|
}
|
2932
2766
|
}
|
2933
2767
|
Red.prototype._verify1 = function _verify1(a) {
|
2934
|
-
|
2935
|
-
|
2768
|
+
assert3(a.negative === 0, "red works only with positives");
|
2769
|
+
assert3(a.red, "red works only with red numbers");
|
2936
2770
|
};
|
2937
2771
|
Red.prototype._verify2 = function _verify2(a, b) {
|
2938
|
-
|
2939
|
-
|
2772
|
+
assert3((a.negative | b.negative) === 0, "red works only with positives");
|
2773
|
+
assert3(
|
2940
2774
|
a.red && a.red === b.red,
|
2941
2775
|
"red works only with red numbers"
|
2942
2776
|
);
|
@@ -3007,7 +2841,7 @@
|
|
3007
2841
|
if (a.isZero())
|
3008
2842
|
return a.clone();
|
3009
2843
|
var mod3 = this.m.andln(3);
|
3010
|
-
|
2844
|
+
assert3(mod3 % 2 === 1);
|
3011
2845
|
if (mod3 === 3) {
|
3012
2846
|
var pow3 = this.m.add(new BN2(1)).iushrn(2);
|
3013
2847
|
return this.pow(a, pow3);
|
@@ -3018,7 +2852,7 @@
|
|
3018
2852
|
s++;
|
3019
2853
|
q.iushrn(1);
|
3020
2854
|
}
|
3021
|
-
|
2855
|
+
assert3(!q.isZero());
|
3022
2856
|
var one = new BN2(1).toRed(this);
|
3023
2857
|
var nOne = one.redNeg();
|
3024
2858
|
var lpow = this.m.subn(1).iushrn(1);
|
@@ -3036,7 +2870,7 @@
|
|
3036
2870
|
for (var i = 0; tmp.cmp(one) !== 0; i++) {
|
3037
2871
|
tmp = tmp.redSqr();
|
3038
2872
|
}
|
3039
|
-
|
2873
|
+
assert3(i < m);
|
3040
2874
|
var b = this.pow(c, new BN2(1).iushln(m - i - 1));
|
3041
2875
|
r = r.redMul(b);
|
3042
2876
|
c = b.redSqr();
|
@@ -3170,6 +3004,172 @@
|
|
3170
3004
|
}
|
3171
3005
|
});
|
3172
3006
|
|
3007
|
+
// ../../node_modules/.pnpm/bech32@2.0.0/node_modules/bech32/dist/index.js
|
3008
|
+
var require_dist = __commonJS({
|
3009
|
+
"../../node_modules/.pnpm/bech32@2.0.0/node_modules/bech32/dist/index.js"(exports) {
|
3010
|
+
"use strict";
|
3011
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3012
|
+
exports.bech32m = exports.bech32 = void 0;
|
3013
|
+
var ALPHABET = "qpzry9x8gf2tvdw0s3jn54khce6mua7l";
|
3014
|
+
var ALPHABET_MAP = {};
|
3015
|
+
for (let z = 0; z < ALPHABET.length; z++) {
|
3016
|
+
const x = ALPHABET.charAt(z);
|
3017
|
+
ALPHABET_MAP[x] = z;
|
3018
|
+
}
|
3019
|
+
function polymodStep(pre) {
|
3020
|
+
const b = pre >> 25;
|
3021
|
+
return (pre & 33554431) << 5 ^ -(b >> 0 & 1) & 996825010 ^ -(b >> 1 & 1) & 642813549 ^ -(b >> 2 & 1) & 513874426 ^ -(b >> 3 & 1) & 1027748829 ^ -(b >> 4 & 1) & 705979059;
|
3022
|
+
}
|
3023
|
+
function prefixChk(prefix) {
|
3024
|
+
let chk = 1;
|
3025
|
+
for (let i = 0; i < prefix.length; ++i) {
|
3026
|
+
const c = prefix.charCodeAt(i);
|
3027
|
+
if (c < 33 || c > 126)
|
3028
|
+
return "Invalid prefix (" + prefix + ")";
|
3029
|
+
chk = polymodStep(chk) ^ c >> 5;
|
3030
|
+
}
|
3031
|
+
chk = polymodStep(chk);
|
3032
|
+
for (let i = 0; i < prefix.length; ++i) {
|
3033
|
+
const v = prefix.charCodeAt(i);
|
3034
|
+
chk = polymodStep(chk) ^ v & 31;
|
3035
|
+
}
|
3036
|
+
return chk;
|
3037
|
+
}
|
3038
|
+
function convert2(data, inBits, outBits, pad3) {
|
3039
|
+
let value = 0;
|
3040
|
+
let bits = 0;
|
3041
|
+
const maxV = (1 << outBits) - 1;
|
3042
|
+
const result = [];
|
3043
|
+
for (let i = 0; i < data.length; ++i) {
|
3044
|
+
value = value << inBits | data[i];
|
3045
|
+
bits += inBits;
|
3046
|
+
while (bits >= outBits) {
|
3047
|
+
bits -= outBits;
|
3048
|
+
result.push(value >> bits & maxV);
|
3049
|
+
}
|
3050
|
+
}
|
3051
|
+
if (pad3) {
|
3052
|
+
if (bits > 0) {
|
3053
|
+
result.push(value << outBits - bits & maxV);
|
3054
|
+
}
|
3055
|
+
} else {
|
3056
|
+
if (bits >= inBits)
|
3057
|
+
return "Excess padding";
|
3058
|
+
if (value << outBits - bits & maxV)
|
3059
|
+
return "Non-zero padding";
|
3060
|
+
}
|
3061
|
+
return result;
|
3062
|
+
}
|
3063
|
+
function toWords(bytes2) {
|
3064
|
+
return convert2(bytes2, 8, 5, true);
|
3065
|
+
}
|
3066
|
+
function fromWordsUnsafe(words) {
|
3067
|
+
const res = convert2(words, 5, 8, false);
|
3068
|
+
if (Array.isArray(res))
|
3069
|
+
return res;
|
3070
|
+
}
|
3071
|
+
function fromWords(words) {
|
3072
|
+
const res = convert2(words, 5, 8, false);
|
3073
|
+
if (Array.isArray(res))
|
3074
|
+
return res;
|
3075
|
+
throw new Error(res);
|
3076
|
+
}
|
3077
|
+
function getLibraryFromEncoding(encoding) {
|
3078
|
+
let ENCODING_CONST;
|
3079
|
+
if (encoding === "bech32") {
|
3080
|
+
ENCODING_CONST = 1;
|
3081
|
+
} else {
|
3082
|
+
ENCODING_CONST = 734539939;
|
3083
|
+
}
|
3084
|
+
function encode(prefix, words, LIMIT) {
|
3085
|
+
LIMIT = LIMIT || 90;
|
3086
|
+
if (prefix.length + 7 + words.length > LIMIT)
|
3087
|
+
throw new TypeError("Exceeds length limit");
|
3088
|
+
prefix = prefix.toLowerCase();
|
3089
|
+
let chk = prefixChk(prefix);
|
3090
|
+
if (typeof chk === "string")
|
3091
|
+
throw new Error(chk);
|
3092
|
+
let result = prefix + "1";
|
3093
|
+
for (let i = 0; i < words.length; ++i) {
|
3094
|
+
const x = words[i];
|
3095
|
+
if (x >> 5 !== 0)
|
3096
|
+
throw new Error("Non 5-bit word");
|
3097
|
+
chk = polymodStep(chk) ^ x;
|
3098
|
+
result += ALPHABET.charAt(x);
|
3099
|
+
}
|
3100
|
+
for (let i = 0; i < 6; ++i) {
|
3101
|
+
chk = polymodStep(chk);
|
3102
|
+
}
|
3103
|
+
chk ^= ENCODING_CONST;
|
3104
|
+
for (let i = 0; i < 6; ++i) {
|
3105
|
+
const v = chk >> (5 - i) * 5 & 31;
|
3106
|
+
result += ALPHABET.charAt(v);
|
3107
|
+
}
|
3108
|
+
return result;
|
3109
|
+
}
|
3110
|
+
function __decode(str, LIMIT) {
|
3111
|
+
LIMIT = LIMIT || 90;
|
3112
|
+
if (str.length < 8)
|
3113
|
+
return str + " too short";
|
3114
|
+
if (str.length > LIMIT)
|
3115
|
+
return "Exceeds length limit";
|
3116
|
+
const lowered = str.toLowerCase();
|
3117
|
+
const uppered = str.toUpperCase();
|
3118
|
+
if (str !== lowered && str !== uppered)
|
3119
|
+
return "Mixed-case string " + str;
|
3120
|
+
str = lowered;
|
3121
|
+
const split2 = str.lastIndexOf("1");
|
3122
|
+
if (split2 === -1)
|
3123
|
+
return "No separator character for " + str;
|
3124
|
+
if (split2 === 0)
|
3125
|
+
return "Missing prefix for " + str;
|
3126
|
+
const prefix = str.slice(0, split2);
|
3127
|
+
const wordChars = str.slice(split2 + 1);
|
3128
|
+
if (wordChars.length < 6)
|
3129
|
+
return "Data too short";
|
3130
|
+
let chk = prefixChk(prefix);
|
3131
|
+
if (typeof chk === "string")
|
3132
|
+
return chk;
|
3133
|
+
const words = [];
|
3134
|
+
for (let i = 0; i < wordChars.length; ++i) {
|
3135
|
+
const c = wordChars.charAt(i);
|
3136
|
+
const v = ALPHABET_MAP[c];
|
3137
|
+
if (v === void 0)
|
3138
|
+
return "Unknown character " + c;
|
3139
|
+
chk = polymodStep(chk) ^ v;
|
3140
|
+
if (i + 6 >= wordChars.length)
|
3141
|
+
continue;
|
3142
|
+
words.push(v);
|
3143
|
+
}
|
3144
|
+
if (chk !== ENCODING_CONST)
|
3145
|
+
return "Invalid checksum for " + str;
|
3146
|
+
return { prefix, words };
|
3147
|
+
}
|
3148
|
+
function decodeUnsafe(str, LIMIT) {
|
3149
|
+
const res = __decode(str, LIMIT);
|
3150
|
+
if (typeof res === "object")
|
3151
|
+
return res;
|
3152
|
+
}
|
3153
|
+
function decode(str, LIMIT) {
|
3154
|
+
const res = __decode(str, LIMIT);
|
3155
|
+
if (typeof res === "object")
|
3156
|
+
return res;
|
3157
|
+
throw new Error(res);
|
3158
|
+
}
|
3159
|
+
return {
|
3160
|
+
decodeUnsafe,
|
3161
|
+
decode,
|
3162
|
+
encode,
|
3163
|
+
toWords,
|
3164
|
+
fromWordsUnsafe,
|
3165
|
+
fromWords
|
3166
|
+
};
|
3167
|
+
}
|
3168
|
+
exports.bech32 = getLibraryFromEncoding("bech32");
|
3169
|
+
exports.bech32m = getLibraryFromEncoding("bech32m");
|
3170
|
+
}
|
3171
|
+
});
|
3172
|
+
|
3173
3173
|
// ../../node_modules/.pnpm/webidl-conversions@3.0.1/node_modules/webidl-conversions/lib/index.js
|
3174
3174
|
var require_lib = __commonJS({
|
3175
3175
|
"../../node_modules/.pnpm/webidl-conversions@3.0.1/node_modules/webidl-conversions/lib/index.js"(exports, module) {
|
@@ -3600,18 +3600,18 @@
|
|
3600
3600
|
}
|
3601
3601
|
function utf8PercentDecode(str) {
|
3602
3602
|
const input = new Buffer(str);
|
3603
|
-
const
|
3603
|
+
const output2 = [];
|
3604
3604
|
for (let i = 0; i < input.length; ++i) {
|
3605
3605
|
if (input[i] !== 37) {
|
3606
|
-
|
3606
|
+
output2.push(input[i]);
|
3607
3607
|
} else if (input[i] === 37 && isASCIIHex(input[i + 1]) && isASCIIHex(input[i + 2])) {
|
3608
|
-
|
3608
|
+
output2.push(parseInt(input.slice(i + 1, i + 3).toString(), 16));
|
3609
3609
|
i += 2;
|
3610
3610
|
} else {
|
3611
|
-
|
3611
|
+
output2.push(input[i]);
|
3612
3612
|
}
|
3613
3613
|
}
|
3614
|
-
return new Buffer(
|
3614
|
+
return new Buffer(output2).toString();
|
3615
3615
|
}
|
3616
3616
|
function isC0ControlPercentEncode(c) {
|
3617
3617
|
return c <= 31 || c > 126;
|
@@ -3687,16 +3687,16 @@
|
|
3687
3687
|
return ipv4;
|
3688
3688
|
}
|
3689
3689
|
function serializeIPv4(address) {
|
3690
|
-
let
|
3690
|
+
let output2 = "";
|
3691
3691
|
let n = address;
|
3692
3692
|
for (let i = 1; i <= 4; ++i) {
|
3693
|
-
|
3693
|
+
output2 = String(n % 256) + output2;
|
3694
3694
|
if (i !== 4) {
|
3695
|
-
|
3695
|
+
output2 = "." + output2;
|
3696
3696
|
}
|
3697
3697
|
n = Math.floor(n / 256);
|
3698
3698
|
}
|
3699
|
-
return
|
3699
|
+
return output2;
|
3700
3700
|
}
|
3701
3701
|
function parseIPv6(input) {
|
3702
3702
|
const address = [0, 0, 0, 0, 0, 0, 0, 0];
|
@@ -3754,13 +3754,13 @@
|
|
3754
3754
|
return failure;
|
3755
3755
|
}
|
3756
3756
|
while (isASCIIDigit(input[pointer])) {
|
3757
|
-
const
|
3757
|
+
const number2 = parseInt(at(input, pointer));
|
3758
3758
|
if (ipv4Piece === null) {
|
3759
|
-
ipv4Piece =
|
3759
|
+
ipv4Piece = number2;
|
3760
3760
|
} else if (ipv4Piece === 0) {
|
3761
3761
|
return failure;
|
3762
3762
|
} else {
|
3763
|
-
ipv4Piece = ipv4Piece * 10 +
|
3763
|
+
ipv4Piece = ipv4Piece * 10 + number2;
|
3764
3764
|
}
|
3765
3765
|
if (ipv4Piece > 255) {
|
3766
3766
|
return failure;
|
@@ -3804,7 +3804,7 @@
|
|
3804
3804
|
return address;
|
3805
3805
|
}
|
3806
3806
|
function serializeIPv6(address) {
|
3807
|
-
let
|
3807
|
+
let output2 = "";
|
3808
3808
|
const seqResult = findLongestZeroSequence(address);
|
3809
3809
|
const compress = seqResult.idx;
|
3810
3810
|
let ignore0 = false;
|
@@ -3816,16 +3816,16 @@
|
|
3816
3816
|
}
|
3817
3817
|
if (compress === pieceIndex) {
|
3818
3818
|
const separator = pieceIndex === 0 ? "::" : ":";
|
3819
|
-
|
3819
|
+
output2 += separator;
|
3820
3820
|
ignore0 = true;
|
3821
3821
|
continue;
|
3822
3822
|
}
|
3823
|
-
|
3823
|
+
output2 += address[pieceIndex].toString(16);
|
3824
3824
|
if (pieceIndex !== 7) {
|
3825
|
-
|
3825
|
+
output2 += ":";
|
3826
3826
|
}
|
3827
3827
|
}
|
3828
|
-
return
|
3828
|
+
return output2;
|
3829
3829
|
}
|
3830
3830
|
function parseHost(input, isSpecialArg) {
|
3831
3831
|
if (input[0] === "[") {
|
@@ -3855,12 +3855,12 @@
|
|
3855
3855
|
if (containsForbiddenHostCodePointExcludingPercent(input)) {
|
3856
3856
|
return failure;
|
3857
3857
|
}
|
3858
|
-
let
|
3858
|
+
let output2 = "";
|
3859
3859
|
const decoded = punycode.ucs2.decode(input);
|
3860
3860
|
for (let i = 0; i < decoded.length; ++i) {
|
3861
|
-
|
3861
|
+
output2 += percentEncodeChar(decoded[i], isC0ControlPercentEncode);
|
3862
3862
|
}
|
3863
|
-
return
|
3863
|
+
return output2;
|
3864
3864
|
}
|
3865
3865
|
function findLongestZeroSequence(arr) {
|
3866
3866
|
let maxIdx = null;
|
@@ -4485,37 +4485,37 @@
|
|
4485
4485
|
return true;
|
4486
4486
|
};
|
4487
4487
|
function serializeURL(url, excludeFragment) {
|
4488
|
-
let
|
4488
|
+
let output2 = url.scheme + ":";
|
4489
4489
|
if (url.host !== null) {
|
4490
|
-
|
4490
|
+
output2 += "//";
|
4491
4491
|
if (url.username !== "" || url.password !== "") {
|
4492
|
-
|
4492
|
+
output2 += url.username;
|
4493
4493
|
if (url.password !== "") {
|
4494
|
-
|
4494
|
+
output2 += ":" + url.password;
|
4495
4495
|
}
|
4496
|
-
|
4496
|
+
output2 += "@";
|
4497
4497
|
}
|
4498
|
-
|
4498
|
+
output2 += serializeHost(url.host);
|
4499
4499
|
if (url.port !== null) {
|
4500
|
-
|
4500
|
+
output2 += ":" + url.port;
|
4501
4501
|
}
|
4502
4502
|
} else if (url.host === null && url.scheme === "file") {
|
4503
|
-
|
4503
|
+
output2 += "//";
|
4504
4504
|
}
|
4505
4505
|
if (url.cannotBeABaseURL) {
|
4506
|
-
|
4506
|
+
output2 += url.path[0];
|
4507
4507
|
} else {
|
4508
4508
|
for (const string of url.path) {
|
4509
|
-
|
4509
|
+
output2 += "/" + string;
|
4510
4510
|
}
|
4511
4511
|
}
|
4512
4512
|
if (url.query !== null) {
|
4513
|
-
|
4513
|
+
output2 += "?" + url.query;
|
4514
4514
|
}
|
4515
4515
|
if (!excludeFragment && url.fragment !== null) {
|
4516
|
-
|
4516
|
+
output2 += "#" + url.fragment;
|
4517
4517
|
}
|
4518
|
-
return
|
4518
|
+
return output2;
|
4519
4519
|
}
|
4520
4520
|
function serializeOrigin(tuple) {
|
4521
4521
|
let result = tuple.scheme + "://";
|
@@ -6459,19 +6459,19 @@
|
|
6459
6459
|
return "GraphQLError";
|
6460
6460
|
}
|
6461
6461
|
toString() {
|
6462
|
-
let
|
6462
|
+
let output2 = this.message;
|
6463
6463
|
if (this.nodes) {
|
6464
6464
|
for (const node of this.nodes) {
|
6465
6465
|
if (node.loc) {
|
6466
|
-
|
6466
|
+
output2 += "\n\n" + (0, _printLocation.printLocation)(node.loc);
|
6467
6467
|
}
|
6468
6468
|
}
|
6469
6469
|
} else if (this.source && this.locations) {
|
6470
6470
|
for (const location of this.locations) {
|
6471
|
-
|
6471
|
+
output2 += "\n\n" + (0, _printLocation.printSourceLocation)(this.source, location);
|
6472
6472
|
}
|
6473
6473
|
}
|
6474
|
-
return
|
6474
|
+
return output2;
|
6475
6475
|
}
|
6476
6476
|
toJSON() {
|
6477
6477
|
const formattedError = {
|
@@ -18786,7 +18786,7 @@ spurious results.`);
|
|
18786
18786
|
module.exports = iterate;
|
18787
18787
|
function iterate(list, iterator, state, callback) {
|
18788
18788
|
var key = state["keyedList"] ? state["keyedList"][state.index] : state.index;
|
18789
|
-
state.jobs[key] = runJob(iterator, key, list[key], function(error,
|
18789
|
+
state.jobs[key] = runJob(iterator, key, list[key], function(error, output2) {
|
18790
18790
|
if (!(key in state.jobs)) {
|
18791
18791
|
return;
|
18792
18792
|
}
|
@@ -18794,7 +18794,7 @@ spurious results.`);
|
|
18794
18794
|
if (error) {
|
18795
18795
|
abort(state);
|
18796
18796
|
} else {
|
18797
|
-
state.results[key] =
|
18797
|
+
state.results[key] = output2;
|
18798
18798
|
}
|
18799
18799
|
callback(error, state.results);
|
18800
18800
|
});
|
@@ -20556,8 +20556,8 @@ spurious results.`);
|
|
20556
20556
|
const ret3 = wasm$1.retd(addr, len);
|
20557
20557
|
return Instruction.__wrap(ret3);
|
20558
20558
|
}
|
20559
|
-
function aloc(
|
20560
|
-
const ret3 = wasm$1.aloc(
|
20559
|
+
function aloc(bytes2) {
|
20560
|
+
const ret3 = wasm$1.aloc(bytes2);
|
20561
20561
|
return Instruction.__wrap(ret3);
|
20562
20562
|
}
|
20563
20563
|
function mcl(dst_addr, len) {
|
@@ -21771,9 +21771,9 @@ spurious results.`);
|
|
21771
21771
|
* Construct the instruction from its parts.
|
21772
21772
|
* @param {RegId} bytes
|
21773
21773
|
*/
|
21774
|
-
constructor(
|
21775
|
-
_assertClass(
|
21776
|
-
var ptr0 =
|
21774
|
+
constructor(bytes2) {
|
21775
|
+
_assertClass(bytes2, RegId);
|
21776
|
+
var ptr0 = bytes2.__destroy_into_raw();
|
21777
21777
|
const ret3 = wasm$1.aloc_new_typescript(ptr0);
|
21778
21778
|
this.__wbg_ptr = ret3 >>> 0;
|
21779
21779
|
return this;
|
@@ -28310,8 +28310,8 @@ spurious results.`);
|
|
28310
28310
|
}
|
28311
28311
|
}
|
28312
28312
|
}
|
28313
|
-
const
|
28314
|
-
return await WebAssembly.instantiate(
|
28313
|
+
const bytes2 = await module2.arrayBuffer();
|
28314
|
+
return await WebAssembly.instantiate(bytes2, imports);
|
28315
28315
|
} else {
|
28316
28316
|
const instance = await WebAssembly.instantiate(module2, imports);
|
28317
28317
|
if (instance instanceof WebAssembly.Instance) {
|
@@ -28652,11 +28652,11 @@ spurious results.`);
|
|
28652
28652
|
if (lengths.length > 0 && !lengths.includes(b.length))
|
28653
28653
|
throw new Error(`Expected Uint8Array of length ${lengths}, not of length=${b.length}`);
|
28654
28654
|
}
|
28655
|
-
function hash(
|
28656
|
-
if (typeof
|
28655
|
+
function hash(hash3) {
|
28656
|
+
if (typeof hash3 !== "function" || typeof hash3.create !== "function")
|
28657
28657
|
throw new Error("Hash should be wrapped by utils.wrapConstructor");
|
28658
|
-
number(
|
28659
|
-
number(
|
28658
|
+
number(hash3.outputLen);
|
28659
|
+
number(hash3.blockLen);
|
28660
28660
|
}
|
28661
28661
|
function exists(instance, checkFinished = true) {
|
28662
28662
|
if (instance.destroyed)
|
@@ -28751,25 +28751,25 @@ spurious results.`);
|
|
28751
28751
|
}
|
28752
28752
|
|
28753
28753
|
// ../../node_modules/.pnpm/@noble+hashes@1.3.3/node_modules/@noble/hashes/esm/_sha2.js
|
28754
|
-
function setBigUint64(view, byteOffset, value,
|
28754
|
+
function setBigUint64(view, byteOffset, value, isLE2) {
|
28755
28755
|
if (typeof view.setBigUint64 === "function")
|
28756
|
-
return view.setBigUint64(byteOffset, value,
|
28756
|
+
return view.setBigUint64(byteOffset, value, isLE2);
|
28757
28757
|
const _32n2 = BigInt(32);
|
28758
28758
|
const _u32_max = BigInt(4294967295);
|
28759
28759
|
const wh = Number(value >> _32n2 & _u32_max);
|
28760
28760
|
const wl = Number(value & _u32_max);
|
28761
|
-
const h =
|
28762
|
-
const l =
|
28763
|
-
view.setUint32(byteOffset + h, wh,
|
28764
|
-
view.setUint32(byteOffset + l, wl,
|
28761
|
+
const h = isLE2 ? 4 : 0;
|
28762
|
+
const l = isLE2 ? 0 : 4;
|
28763
|
+
view.setUint32(byteOffset + h, wh, isLE2);
|
28764
|
+
view.setUint32(byteOffset + l, wl, isLE2);
|
28765
28765
|
}
|
28766
28766
|
var SHA2 = class extends Hash {
|
28767
|
-
constructor(blockLen, outputLen, padOffset,
|
28767
|
+
constructor(blockLen, outputLen, padOffset, isLE2) {
|
28768
28768
|
super();
|
28769
28769
|
this.blockLen = blockLen;
|
28770
28770
|
this.outputLen = outputLen;
|
28771
28771
|
this.padOffset = padOffset;
|
28772
|
-
this.isLE =
|
28772
|
+
this.isLE = isLE2;
|
28773
28773
|
this.finished = false;
|
28774
28774
|
this.length = 0;
|
28775
28775
|
this.pos = 0;
|
@@ -28806,7 +28806,7 @@ spurious results.`);
|
|
28806
28806
|
exists(this);
|
28807
28807
|
output(out, this);
|
28808
28808
|
this.finished = true;
|
28809
|
-
const { buffer, view, blockLen, isLE:
|
28809
|
+
const { buffer, view, blockLen, isLE: isLE2 } = this;
|
28810
28810
|
let { pos } = this;
|
28811
28811
|
buffer[pos++] = 128;
|
28812
28812
|
this.buffer.subarray(pos).fill(0);
|
@@ -28816,7 +28816,7 @@ spurious results.`);
|
|
28816
28816
|
}
|
28817
28817
|
for (let i = pos; i < blockLen; i++)
|
28818
28818
|
buffer[i] = 0;
|
28819
|
-
setBigUint64(view, blockLen - 8, BigInt(this.length * 8),
|
28819
|
+
setBigUint64(view, blockLen - 8, BigInt(this.length * 8), isLE2);
|
28820
28820
|
this.process(view, 0);
|
28821
28821
|
const oview = createView(out);
|
28822
28822
|
const len = this.outputLen;
|
@@ -28827,7 +28827,7 @@ spurious results.`);
|
|
28827
28827
|
if (outLen > state.length)
|
28828
28828
|
throw new Error("_sha2: outputLen bigger than state");
|
28829
28829
|
for (let i = 0; i < outLen; i++)
|
28830
|
-
oview.setUint32(4 * i, state[i],
|
28830
|
+
oview.setUint32(4 * i, state[i], isLE2);
|
28831
28831
|
}
|
28832
28832
|
digest() {
|
28833
28833
|
const { buffer, outputLen } = this;
|
@@ -29004,24 +29004,24 @@ spurious results.`);
|
|
29004
29004
|
|
29005
29005
|
// ../../node_modules/.pnpm/@noble+hashes@1.3.3/node_modules/@noble/hashes/esm/hmac.js
|
29006
29006
|
var HMAC = class extends Hash {
|
29007
|
-
constructor(
|
29007
|
+
constructor(hash3, _key) {
|
29008
29008
|
super();
|
29009
29009
|
this.finished = false;
|
29010
29010
|
this.destroyed = false;
|
29011
|
-
hash(
|
29011
|
+
hash(hash3);
|
29012
29012
|
const key = toBytes(_key);
|
29013
|
-
this.iHash =
|
29013
|
+
this.iHash = hash3.create();
|
29014
29014
|
if (typeof this.iHash.update !== "function")
|
29015
29015
|
throw new Error("Expected instance of class which extends utils.Hash");
|
29016
29016
|
this.blockLen = this.iHash.blockLen;
|
29017
29017
|
this.outputLen = this.iHash.outputLen;
|
29018
29018
|
const blockLen = this.blockLen;
|
29019
29019
|
const pad3 = new Uint8Array(blockLen);
|
29020
|
-
pad3.set(key.length > blockLen ?
|
29020
|
+
pad3.set(key.length > blockLen ? hash3.create().update(key).digest() : key);
|
29021
29021
|
for (let i = 0; i < pad3.length; i++)
|
29022
29022
|
pad3[i] ^= 54;
|
29023
29023
|
this.iHash.update(pad3);
|
29024
|
-
this.oHash =
|
29024
|
+
this.oHash = hash3.create();
|
29025
29025
|
for (let i = 0; i < pad3.length; i++)
|
29026
29026
|
pad3[i] ^= 54 ^ 92;
|
29027
29027
|
this.oHash.update(pad3);
|
@@ -29064,12 +29064,12 @@ spurious results.`);
|
|
29064
29064
|
this.iHash.destroy();
|
29065
29065
|
}
|
29066
29066
|
};
|
29067
|
-
var hmac = (
|
29068
|
-
hmac.create = (
|
29067
|
+
var hmac = (hash3, key, message) => new HMAC(hash3, key).update(message).digest();
|
29068
|
+
hmac.create = (hash3, key) => new HMAC(hash3, key);
|
29069
29069
|
|
29070
29070
|
// ../../node_modules/.pnpm/@noble+hashes@1.3.3/node_modules/@noble/hashes/esm/pbkdf2.js
|
29071
|
-
function pbkdf2Init(
|
29072
|
-
hash(
|
29071
|
+
function pbkdf2Init(hash3, _password, _salt, _opts) {
|
29072
|
+
hash(hash3);
|
29073
29073
|
const opts = checkOpts({ dkLen: 32, asyncTick: 10 }, _opts);
|
29074
29074
|
const { c, dkLen, asyncTick } = opts;
|
29075
29075
|
number(c);
|
@@ -29080,7 +29080,7 @@ spurious results.`);
|
|
29080
29080
|
const password = toBytes(_password);
|
29081
29081
|
const salt = toBytes(_salt);
|
29082
29082
|
const DK = new Uint8Array(dkLen);
|
29083
|
-
const PRF = hmac.create(
|
29083
|
+
const PRF = hmac.create(hash3, password);
|
29084
29084
|
const PRFSalt = PRF._cloneInto().update(salt);
|
29085
29085
|
return { c, dkLen, asyncTick, DK, PRF, PRFSalt };
|
29086
29086
|
}
|
@@ -29092,8 +29092,8 @@ spurious results.`);
|
|
29092
29092
|
u.fill(0);
|
29093
29093
|
return DK;
|
29094
29094
|
}
|
29095
|
-
function pbkdf2(
|
29096
|
-
const { c, dkLen, DK, PRF, PRFSalt } = pbkdf2Init(
|
29095
|
+
function pbkdf2(hash3, password, salt, opts) {
|
29096
|
+
const { c, dkLen, DK, PRF, PRFSalt } = pbkdf2Init(hash3, password, salt, opts);
|
29097
29097
|
let prfW;
|
29098
29098
|
const arr = new Uint8Array(4);
|
29099
29099
|
const view = createView(arr);
|
@@ -29420,9 +29420,9 @@ spurious results.`);
|
|
29420
29420
|
throw new Error("XOF is not possible for this instance");
|
29421
29421
|
return this.writeInto(out);
|
29422
29422
|
}
|
29423
|
-
xof(
|
29424
|
-
number(
|
29425
|
-
return this.xofInto(new Uint8Array(
|
29423
|
+
xof(bytes2) {
|
29424
|
+
number(bytes2);
|
29425
|
+
return this.xofInto(new Uint8Array(bytes2));
|
29426
29426
|
}
|
29427
29427
|
digestInto(out) {
|
29428
29428
|
output(out, this);
|
@@ -29558,7 +29558,6 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
29558
29558
|
ErrorCode2["PARSE_FAILED"] = "parse-failed";
|
29559
29559
|
ErrorCode2["ENCODE_ERROR"] = "encode-error";
|
29560
29560
|
ErrorCode2["DECODE_ERROR"] = "decode-error";
|
29561
|
-
ErrorCode2["INVALID_CREDENTIALS"] = "invalid-credentials";
|
29562
29561
|
ErrorCode2["ENV_DEPENDENCY_MISSING"] = "env-dependency-missing";
|
29563
29562
|
ErrorCode2["INVALID_TTL"] = "invalid-ttl";
|
29564
29563
|
ErrorCode2["INVALID_INPUT_PARAMETERS"] = "invalid-input-parameters";
|
@@ -29569,6 +29568,8 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
29569
29568
|
ErrorCode2["MISSING_REQUIRED_PARAMETER"] = "missing-required-parameter";
|
29570
29569
|
ErrorCode2["INVALID_REQUEST"] = "invalid-request";
|
29571
29570
|
ErrorCode2["INVALID_TRANSFER_AMOUNT"] = "invalid-transfer-amount";
|
29571
|
+
ErrorCode2["INVALID_CREDENTIALS"] = "invalid-credentials";
|
29572
|
+
ErrorCode2["HASHER_LOCKED"] = "hasher-locked";
|
29572
29573
|
ErrorCode2["GAS_PRICE_TOO_LOW"] = "gas-price-too-low";
|
29573
29574
|
ErrorCode2["GAS_LIMIT_TOO_LOW"] = "gas-limit-too-low";
|
29574
29575
|
ErrorCode2["MAX_FEE_TOO_LOW"] = "max-fee-too-low";
|
@@ -29636,6 +29637,226 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
29636
29637
|
var FuelError = _FuelError;
|
29637
29638
|
__publicField2(FuelError, "CODES", ErrorCode);
|
29638
29639
|
|
29640
|
+
// ../math/dist/index.mjs
|
29641
|
+
var import_bn = __toESM(require_bn(), 1);
|
29642
|
+
var DEFAULT_PRECISION = 9;
|
29643
|
+
var DEFAULT_MIN_PRECISION = 3;
|
29644
|
+
var DEFAULT_DECIMAL_UNITS = 9;
|
29645
|
+
function toFixed(value, options) {
|
29646
|
+
const { precision = DEFAULT_PRECISION, minPrecision = DEFAULT_MIN_PRECISION } = options || {};
|
29647
|
+
const [valueUnits = "0", valueDecimals = "0"] = String(value || "0.0").split(".");
|
29648
|
+
const groupRegex = /(\d)(?=(\d{3})+\b)/g;
|
29649
|
+
const units = valueUnits.replace(groupRegex, "$1,");
|
29650
|
+
let decimals = valueDecimals.slice(0, precision);
|
29651
|
+
if (minPrecision < precision) {
|
29652
|
+
const trimmedDecimal = decimals.match(/.*[1-9]{1}/);
|
29653
|
+
const lastNonZeroIndex = trimmedDecimal?.[0].length || 0;
|
29654
|
+
const keepChars = Math.max(minPrecision, lastNonZeroIndex);
|
29655
|
+
decimals = decimals.slice(0, keepChars);
|
29656
|
+
}
|
29657
|
+
const decimalPortion = decimals ? `.${decimals}` : "";
|
29658
|
+
return `${units}${decimalPortion}`;
|
29659
|
+
}
|
29660
|
+
var BN = class extends import_bn.default {
|
29661
|
+
MAX_U64 = "0xFFFFFFFFFFFFFFFF";
|
29662
|
+
constructor(value, base, endian) {
|
29663
|
+
let bnValue = value;
|
29664
|
+
let bnBase = base;
|
29665
|
+
if (BN.isBN(value)) {
|
29666
|
+
bnValue = value.toArray();
|
29667
|
+
} else if (typeof value === "string" && value.slice(0, 2) === "0x") {
|
29668
|
+
bnValue = value.substring(2);
|
29669
|
+
bnBase = base || "hex";
|
29670
|
+
}
|
29671
|
+
super(bnValue == null ? 0 : bnValue, bnBase, endian);
|
29672
|
+
}
|
29673
|
+
// ANCHOR: HELPERS
|
29674
|
+
// make sure we always include `0x` in hex strings
|
29675
|
+
toString(base, length) {
|
29676
|
+
const output2 = super.toString(base, length);
|
29677
|
+
if (base === 16 || base === "hex") {
|
29678
|
+
return `0x${output2}`;
|
29679
|
+
}
|
29680
|
+
return output2;
|
29681
|
+
}
|
29682
|
+
toHex(bytesPadding) {
|
29683
|
+
const bytes2 = bytesPadding || 0;
|
29684
|
+
const bytesLength = bytes2 * 2;
|
29685
|
+
if (this.isNeg()) {
|
29686
|
+
throw new FuelError(ErrorCode.CONVERTING_FAILED, "Cannot convert negative value to hex.");
|
29687
|
+
}
|
29688
|
+
if (bytesPadding && this.byteLength() > bytesPadding) {
|
29689
|
+
throw new FuelError(
|
29690
|
+
ErrorCode.CONVERTING_FAILED,
|
29691
|
+
`Provided value ${this} is too large. It should fit within ${bytesPadding} bytes.`
|
29692
|
+
);
|
29693
|
+
}
|
29694
|
+
return this.toString(16, bytesLength);
|
29695
|
+
}
|
29696
|
+
toBytes(bytesPadding) {
|
29697
|
+
if (this.isNeg()) {
|
29698
|
+
throw new FuelError(ErrorCode.CONVERTING_FAILED, "Cannot convert negative value to bytes.");
|
29699
|
+
}
|
29700
|
+
return Uint8Array.from(this.toArray(void 0, bytesPadding));
|
29701
|
+
}
|
29702
|
+
toJSON() {
|
29703
|
+
return this.toString(16);
|
29704
|
+
}
|
29705
|
+
valueOf() {
|
29706
|
+
return this.toString();
|
29707
|
+
}
|
29708
|
+
format(options) {
|
29709
|
+
const {
|
29710
|
+
units = DEFAULT_DECIMAL_UNITS,
|
29711
|
+
precision = DEFAULT_PRECISION,
|
29712
|
+
minPrecision = DEFAULT_MIN_PRECISION
|
29713
|
+
} = options || {};
|
29714
|
+
const formattedUnits = this.formatUnits(units);
|
29715
|
+
const formattedFixed = toFixed(formattedUnits, { precision, minPrecision });
|
29716
|
+
if (!parseFloat(formattedFixed)) {
|
29717
|
+
const [, originalDecimals = "0"] = formattedUnits.split(".");
|
29718
|
+
const firstNonZero = originalDecimals.match(/[1-9]/);
|
29719
|
+
if (firstNonZero && firstNonZero.index && firstNonZero.index + 1 > precision) {
|
29720
|
+
const [valueUnits = "0"] = formattedFixed.split(".");
|
29721
|
+
return `${valueUnits}.${originalDecimals.slice(0, firstNonZero.index + 1)}`;
|
29722
|
+
}
|
29723
|
+
}
|
29724
|
+
return formattedFixed;
|
29725
|
+
}
|
29726
|
+
formatUnits(units = DEFAULT_DECIMAL_UNITS) {
|
29727
|
+
const valueUnits = this.toString().slice(0, units * -1);
|
29728
|
+
const valueDecimals = this.toString().slice(units * -1);
|
29729
|
+
const length = valueDecimals.length;
|
29730
|
+
const defaultDecimals = Array.from({ length: units - length }).fill("0").join("");
|
29731
|
+
const integerPortion = valueUnits ? `${valueUnits}.` : "0.";
|
29732
|
+
return `${integerPortion}${defaultDecimals}${valueDecimals}`;
|
29733
|
+
}
|
29734
|
+
// END ANCHOR: HELPERS
|
29735
|
+
// ANCHOR: OVERRIDES to accept better inputs
|
29736
|
+
add(v) {
|
29737
|
+
return this.caller(v, "add");
|
29738
|
+
}
|
29739
|
+
pow(v) {
|
29740
|
+
return this.caller(v, "pow");
|
29741
|
+
}
|
29742
|
+
sub(v) {
|
29743
|
+
return this.caller(v, "sub");
|
29744
|
+
}
|
29745
|
+
div(v) {
|
29746
|
+
return this.caller(v, "div");
|
29747
|
+
}
|
29748
|
+
mul(v) {
|
29749
|
+
return this.caller(v, "mul");
|
29750
|
+
}
|
29751
|
+
mod(v) {
|
29752
|
+
return this.caller(v, "mod");
|
29753
|
+
}
|
29754
|
+
divRound(v) {
|
29755
|
+
return this.caller(v, "divRound");
|
29756
|
+
}
|
29757
|
+
lt(v) {
|
29758
|
+
return this.caller(v, "lt");
|
29759
|
+
}
|
29760
|
+
lte(v) {
|
29761
|
+
return this.caller(v, "lte");
|
29762
|
+
}
|
29763
|
+
gt(v) {
|
29764
|
+
return this.caller(v, "gt");
|
29765
|
+
}
|
29766
|
+
gte(v) {
|
29767
|
+
return this.caller(v, "gte");
|
29768
|
+
}
|
29769
|
+
eq(v) {
|
29770
|
+
return this.caller(v, "eq");
|
29771
|
+
}
|
29772
|
+
cmp(v) {
|
29773
|
+
return this.caller(v, "cmp");
|
29774
|
+
}
|
29775
|
+
// END ANCHOR: OVERRIDES to accept better inputs
|
29776
|
+
// ANCHOR: OVERRIDES to output our BN type
|
29777
|
+
sqr() {
|
29778
|
+
return new BN(super.sqr().toArray());
|
29779
|
+
}
|
29780
|
+
neg() {
|
29781
|
+
return new BN(super.neg().toArray());
|
29782
|
+
}
|
29783
|
+
abs() {
|
29784
|
+
return new BN(super.abs().toArray());
|
29785
|
+
}
|
29786
|
+
toTwos(width) {
|
29787
|
+
return new BN(super.toTwos(width).toArray());
|
29788
|
+
}
|
29789
|
+
fromTwos(width) {
|
29790
|
+
return new BN(super.fromTwos(width).toArray());
|
29791
|
+
}
|
29792
|
+
// END ANCHOR: OVERRIDES to output our BN type
|
29793
|
+
// ANCHOR: OVERRIDES to avoid losing references
|
29794
|
+
caller(v, methodName) {
|
29795
|
+
const output2 = super[methodName](new BN(v));
|
29796
|
+
if (BN.isBN(output2)) {
|
29797
|
+
return new BN(output2.toArray());
|
29798
|
+
}
|
29799
|
+
if (typeof output2 === "boolean") {
|
29800
|
+
return output2;
|
29801
|
+
}
|
29802
|
+
return output2;
|
29803
|
+
}
|
29804
|
+
clone() {
|
29805
|
+
return new BN(this.toArray());
|
29806
|
+
}
|
29807
|
+
mulTo(num, out) {
|
29808
|
+
const output2 = new import_bn.default(this.toArray()).mulTo(num, out);
|
29809
|
+
return new BN(output2.toArray());
|
29810
|
+
}
|
29811
|
+
egcd(p) {
|
29812
|
+
const { a, b, gcd } = new import_bn.default(this.toArray()).egcd(p);
|
29813
|
+
return {
|
29814
|
+
a: new BN(a.toArray()),
|
29815
|
+
b: new BN(b.toArray()),
|
29816
|
+
gcd: new BN(gcd.toArray())
|
29817
|
+
};
|
29818
|
+
}
|
29819
|
+
divmod(num, mode, positive) {
|
29820
|
+
const { div, mod: mod2 } = new import_bn.default(this.toArray()).divmod(new BN(num), mode, positive);
|
29821
|
+
return {
|
29822
|
+
div: new BN(div?.toArray()),
|
29823
|
+
mod: new BN(mod2?.toArray())
|
29824
|
+
};
|
29825
|
+
}
|
29826
|
+
maxU64() {
|
29827
|
+
return this.gte(this.MAX_U64) ? new BN(this.MAX_U64) : this;
|
29828
|
+
}
|
29829
|
+
normalizeZeroToOne() {
|
29830
|
+
return this.isZero() ? new BN(1) : this;
|
29831
|
+
}
|
29832
|
+
// END ANCHOR: OVERRIDES to avoid losing references
|
29833
|
+
};
|
29834
|
+
var bn = (value, base, endian) => new BN(value, base, endian);
|
29835
|
+
bn.parseUnits = (value, units = DEFAULT_DECIMAL_UNITS) => {
|
29836
|
+
const valueToParse = value === "." ? "0." : value;
|
29837
|
+
const [valueUnits = "0", valueDecimals = "0"] = valueToParse.split(".");
|
29838
|
+
const length = valueDecimals.length;
|
29839
|
+
if (length > units) {
|
29840
|
+
throw new FuelError(
|
29841
|
+
ErrorCode.CONVERTING_FAILED,
|
29842
|
+
`Decimal can't have more than ${units} digits.`
|
29843
|
+
);
|
29844
|
+
}
|
29845
|
+
const decimals = Array.from({ length: units }).fill("0");
|
29846
|
+
decimals.splice(0, length, valueDecimals);
|
29847
|
+
const amount = `${valueUnits.replaceAll(",", "")}${decimals.join("")}`;
|
29848
|
+
return bn(amount);
|
29849
|
+
};
|
29850
|
+
function toNumber(value) {
|
29851
|
+
return bn(value).toNumber();
|
29852
|
+
}
|
29853
|
+
function toHex(value, bytesPadding) {
|
29854
|
+
return bn(value).toHex(bytesPadding);
|
29855
|
+
}
|
29856
|
+
function toBytes2(value, bytesPadding) {
|
29857
|
+
return bn(value).toBytes(bytesPadding);
|
29858
|
+
}
|
29859
|
+
|
29639
29860
|
// ../utils/dist/index.mjs
|
29640
29861
|
var __defProp3 = Object.defineProperty;
|
29641
29862
|
var __defNormalProp3 = (obj, key, value) => key in obj ? __defProp3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
@@ -29643,23 +29864,26 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
29643
29864
|
__defNormalProp3(obj, typeof key !== "symbol" ? key + "" : key, value);
|
29644
29865
|
return value;
|
29645
29866
|
};
|
29646
|
-
var chunkAndPadBytes = (
|
29867
|
+
var chunkAndPadBytes = (bytes2, chunkSize) => {
|
29647
29868
|
const chunks = [];
|
29648
|
-
for (let offset = 0; offset <
|
29869
|
+
for (let offset = 0; offset < bytes2.length; offset += chunkSize) {
|
29649
29870
|
const chunk = new Uint8Array(chunkSize);
|
29650
|
-
chunk.set(
|
29871
|
+
chunk.set(bytes2.slice(offset, offset + chunkSize));
|
29651
29872
|
chunks.push(chunk);
|
29652
29873
|
}
|
29653
29874
|
const lastChunk = chunks[chunks.length - 1];
|
29654
|
-
const remainingBytes =
|
29875
|
+
const remainingBytes = bytes2.length % chunkSize;
|
29655
29876
|
const paddedChunkLength = remainingBytes + (8 - remainingBytes % 8) % 8;
|
29656
29877
|
const newChunk = lastChunk.slice(0, paddedChunkLength);
|
29657
29878
|
chunks[chunks.length - 1] = newChunk;
|
29658
29879
|
return chunks;
|
29659
29880
|
};
|
29660
|
-
var arrayify = (value) => {
|
29881
|
+
var arrayify = (value, name, copy = true) => {
|
29661
29882
|
if (value instanceof Uint8Array) {
|
29662
|
-
|
29883
|
+
if (copy) {
|
29884
|
+
return new Uint8Array(value);
|
29885
|
+
}
|
29886
|
+
return value;
|
29663
29887
|
}
|
29664
29888
|
if (typeof value === "string" && value.match(/^0x([0-9a-f][0-9a-f])*$/i)) {
|
29665
29889
|
const result = new Uint8Array((value.length - 2) / 2);
|
@@ -29670,7 +29894,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
29670
29894
|
}
|
29671
29895
|
return result;
|
29672
29896
|
}
|
29673
|
-
throw new FuelError(ErrorCode.
|
29897
|
+
throw new FuelError(ErrorCode.INVALID_DATA, `invalid data - ${name || ""}`);
|
29674
29898
|
};
|
29675
29899
|
var concatBytes2 = (arrays) => {
|
29676
29900
|
const byteArrays = arrays.map((array) => {
|
@@ -29688,15 +29912,15 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
29688
29912
|
return concatenated;
|
29689
29913
|
};
|
29690
29914
|
var concat = (arrays) => {
|
29691
|
-
const
|
29692
|
-
return concatBytes2(
|
29915
|
+
const bytes2 = arrays.map((v) => arrayify(v));
|
29916
|
+
return concatBytes2(bytes2);
|
29693
29917
|
};
|
29694
29918
|
var HexCharacters = "0123456789abcdef";
|
29695
29919
|
function hexlify(data) {
|
29696
|
-
const
|
29920
|
+
const bytes2 = arrayify(data);
|
29697
29921
|
let result = "0x";
|
29698
|
-
for (let i = 0; i <
|
29699
|
-
const v =
|
29922
|
+
for (let i = 0; i < bytes2.length; i++) {
|
29923
|
+
const v = bytes2[i];
|
29700
29924
|
result += HexCharacters[(v & 240) >> 4] + HexCharacters[v & 15];
|
29701
29925
|
}
|
29702
29926
|
return result;
|
@@ -29761,684 +29985,97 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
29761
29985
|
};
|
29762
29986
|
var DateTime = _DateTime;
|
29763
29987
|
__publicField3(DateTime, "TAI64_NULL", "");
|
29764
|
-
function
|
29765
|
-
return
|
29766
|
-
|
29767
|
-
|
29768
|
-
|
29769
|
-
var import_crypto7 = __toESM(__require("crypto"), 1);
|
29770
|
-
|
29771
|
-
// ../../node_modules/.pnpm/ethers@6.7.1/node_modules/ethers/lib.esm/_version.js
|
29772
|
-
var version = "6.7.1";
|
29773
|
-
|
29774
|
-
// ../../node_modules/.pnpm/ethers@6.7.1/node_modules/ethers/lib.esm/utils/properties.js
|
29775
|
-
function checkType(value, type3, name) {
|
29776
|
-
const types = type3.split("|").map((t) => t.trim());
|
29777
|
-
for (let i = 0; i < types.length; i++) {
|
29778
|
-
switch (type3) {
|
29779
|
-
case "any":
|
29780
|
-
return;
|
29781
|
-
case "bigint":
|
29782
|
-
case "boolean":
|
29783
|
-
case "number":
|
29784
|
-
case "string":
|
29785
|
-
if (typeof value === type3) {
|
29786
|
-
return;
|
29787
|
-
}
|
29788
|
-
}
|
29789
|
-
}
|
29790
|
-
const error = new Error(`invalid value for type ${type3}`);
|
29791
|
-
error.code = "INVALID_ARGUMENT";
|
29792
|
-
error.argument = `value.${name}`;
|
29793
|
-
error.value = value;
|
29794
|
-
throw error;
|
29795
|
-
}
|
29796
|
-
function defineProperties(target, values, types) {
|
29797
|
-
for (let key in values) {
|
29798
|
-
let value = values[key];
|
29799
|
-
const type3 = types ? types[key] : null;
|
29800
|
-
if (type3) {
|
29801
|
-
checkType(value, type3, key);
|
29802
|
-
}
|
29803
|
-
Object.defineProperty(target, key, { enumerable: true, value, writable: false });
|
29804
|
-
}
|
29805
|
-
}
|
29806
|
-
|
29807
|
-
// ../../node_modules/.pnpm/ethers@6.7.1/node_modules/ethers/lib.esm/utils/errors.js
|
29808
|
-
function stringify(value) {
|
29809
|
-
if (value == null) {
|
29810
|
-
return "null";
|
29811
|
-
}
|
29812
|
-
if (Array.isArray(value)) {
|
29813
|
-
return "[ " + value.map(stringify).join(", ") + " ]";
|
29814
|
-
}
|
29815
|
-
if (value instanceof Uint8Array) {
|
29816
|
-
const HEX = "0123456789abcdef";
|
29817
|
-
let result = "0x";
|
29818
|
-
for (let i = 0; i < value.length; i++) {
|
29819
|
-
result += HEX[value[i] >> 4];
|
29820
|
-
result += HEX[value[i] & 15];
|
29821
|
-
}
|
29822
|
-
return result;
|
29823
|
-
}
|
29824
|
-
if (typeof value === "object" && typeof value.toJSON === "function") {
|
29825
|
-
return stringify(value.toJSON());
|
29826
|
-
}
|
29827
|
-
switch (typeof value) {
|
29828
|
-
case "boolean":
|
29829
|
-
case "symbol":
|
29830
|
-
return value.toString();
|
29831
|
-
case "bigint":
|
29832
|
-
return BigInt(value).toString();
|
29833
|
-
case "number":
|
29834
|
-
return value.toString();
|
29835
|
-
case "string":
|
29836
|
-
return JSON.stringify(value);
|
29837
|
-
case "object": {
|
29838
|
-
const keys = Object.keys(value);
|
29839
|
-
keys.sort();
|
29840
|
-
return "{ " + keys.map((k) => `${stringify(k)}: ${stringify(value[k])}`).join(", ") + " }";
|
29841
|
-
}
|
29842
|
-
}
|
29843
|
-
return `[ COULD NOT SERIALIZE ]`;
|
29844
|
-
}
|
29845
|
-
function makeError(message, code, info) {
|
29846
|
-
{
|
29847
|
-
const details = [];
|
29848
|
-
if (info) {
|
29849
|
-
if ("message" in info || "code" in info || "name" in info) {
|
29850
|
-
throw new Error(`value will overwrite populated values: ${stringify(info)}`);
|
29851
|
-
}
|
29852
|
-
for (const key in info) {
|
29853
|
-
const value = info[key];
|
29854
|
-
details.push(key + "=" + stringify(value));
|
29855
|
-
}
|
29856
|
-
}
|
29857
|
-
details.push(`code=${code}`);
|
29858
|
-
details.push(`version=${version}`);
|
29859
|
-
if (details.length) {
|
29860
|
-
message += " (" + details.join(", ") + ")";
|
29861
|
-
}
|
29862
|
-
}
|
29863
|
-
let error;
|
29864
|
-
switch (code) {
|
29865
|
-
case "INVALID_ARGUMENT":
|
29866
|
-
error = new TypeError(message);
|
29867
|
-
break;
|
29868
|
-
case "NUMERIC_FAULT":
|
29869
|
-
case "BUFFER_OVERRUN":
|
29870
|
-
error = new RangeError(message);
|
29871
|
-
break;
|
29872
|
-
default:
|
29873
|
-
error = new Error(message);
|
29874
|
-
}
|
29875
|
-
defineProperties(error, { code });
|
29876
|
-
if (info) {
|
29877
|
-
Object.assign(error, info);
|
29878
|
-
}
|
29879
|
-
return error;
|
29880
|
-
}
|
29881
|
-
function assert(check, message, code, info) {
|
29882
|
-
if (!check) {
|
29883
|
-
throw makeError(message, code, info);
|
29884
|
-
}
|
29885
|
-
}
|
29886
|
-
function assertArgument(check, message, name, value) {
|
29887
|
-
assert(check, message, "INVALID_ARGUMENT", { argument: name, value });
|
29888
|
-
}
|
29889
|
-
var _normalizeForms = ["NFD", "NFC", "NFKD", "NFKC"].reduce((accum, form) => {
|
29890
|
-
try {
|
29891
|
-
if ("test".normalize(form) !== "test") {
|
29892
|
-
throw new Error("bad");
|
29893
|
-
}
|
29894
|
-
;
|
29895
|
-
if (form === "NFD") {
|
29896
|
-
const check = String.fromCharCode(233).normalize("NFD");
|
29897
|
-
const expected = String.fromCharCode(101, 769);
|
29898
|
-
if (check !== expected) {
|
29899
|
-
throw new Error("broken");
|
29900
|
-
}
|
29901
|
-
}
|
29902
|
-
accum.push(form);
|
29903
|
-
} catch (error) {
|
29904
|
-
}
|
29905
|
-
return accum;
|
29906
|
-
}, []);
|
29907
|
-
function assertNormalize(form) {
|
29908
|
-
assert(_normalizeForms.indexOf(form) >= 0, "platform missing String.prototype.normalize", "UNSUPPORTED_OPERATION", {
|
29909
|
-
operation: "String.prototype.normalize",
|
29910
|
-
info: { form }
|
29911
|
-
});
|
29912
|
-
}
|
29913
|
-
|
29914
|
-
// ../../node_modules/.pnpm/ethers@6.7.1/node_modules/ethers/lib.esm/utils/data.js
|
29915
|
-
function _getBytes(value, name, copy) {
|
29916
|
-
if (value instanceof Uint8Array) {
|
29917
|
-
if (copy) {
|
29918
|
-
return new Uint8Array(value);
|
29919
|
-
}
|
29920
|
-
return value;
|
29921
|
-
}
|
29922
|
-
if (typeof value === "string" && value.match(/^0x([0-9a-f][0-9a-f])*$/i)) {
|
29923
|
-
const result = new Uint8Array((value.length - 2) / 2);
|
29924
|
-
let offset = 2;
|
29925
|
-
for (let i = 0; i < result.length; i++) {
|
29926
|
-
result[i] = parseInt(value.substring(offset, offset + 2), 16);
|
29927
|
-
offset += 2;
|
29928
|
-
}
|
29929
|
-
return result;
|
29930
|
-
}
|
29931
|
-
assertArgument(false, "invalid BytesLike value", name || "value", value);
|
29932
|
-
}
|
29933
|
-
function getBytes(value, name) {
|
29934
|
-
return _getBytes(value, name, false);
|
29935
|
-
}
|
29936
|
-
var HexCharacters2 = "0123456789abcdef";
|
29937
|
-
function hexlify2(data) {
|
29938
|
-
const bytes3 = getBytes(data);
|
29939
|
-
let result = "0x";
|
29940
|
-
for (let i = 0; i < bytes3.length; i++) {
|
29941
|
-
const v = bytes3[i];
|
29942
|
-
result += HexCharacters2[(v & 240) >> 4] + HexCharacters2[v & 15];
|
29943
|
-
}
|
29944
|
-
return result;
|
29945
|
-
}
|
29946
|
-
function dataSlice(data, start, end) {
|
29947
|
-
const bytes3 = getBytes(data);
|
29948
|
-
if (end != null && end > bytes3.length) {
|
29949
|
-
assert(false, "cannot slice beyond data bounds", "BUFFER_OVERRUN", {
|
29950
|
-
buffer: bytes3,
|
29951
|
-
length: bytes3.length,
|
29952
|
-
offset: end
|
29953
|
-
});
|
29954
|
-
}
|
29955
|
-
return hexlify2(bytes3.slice(start == null ? 0 : start, end == null ? bytes3.length : end));
|
29956
|
-
}
|
29957
|
-
|
29958
|
-
// ../../node_modules/.pnpm/ethers@6.7.1/node_modules/ethers/lib.esm/utils/maths.js
|
29959
|
-
var BN_0 = BigInt(0);
|
29960
|
-
var BN_1 = BigInt(1);
|
29961
|
-
var maxValue = 9007199254740991;
|
29962
|
-
function getBigInt(value, name) {
|
29963
|
-
switch (typeof value) {
|
29964
|
-
case "bigint":
|
29965
|
-
return value;
|
29966
|
-
case "number":
|
29967
|
-
assertArgument(Number.isInteger(value), "underflow", name || "value", value);
|
29968
|
-
assertArgument(value >= -maxValue && value <= maxValue, "overflow", name || "value", value);
|
29969
|
-
return BigInt(value);
|
29970
|
-
case "string":
|
29971
|
-
try {
|
29972
|
-
if (value === "") {
|
29973
|
-
throw new Error("empty string");
|
29974
|
-
}
|
29975
|
-
if (value[0] === "-" && value[1] !== "-") {
|
29976
|
-
return -BigInt(value.substring(1));
|
29977
|
-
}
|
29978
|
-
return BigInt(value);
|
29979
|
-
} catch (e) {
|
29980
|
-
assertArgument(false, `invalid BigNumberish string: ${e.message}`, name || "value", value);
|
29981
|
-
}
|
29982
|
-
}
|
29983
|
-
assertArgument(false, "invalid BigNumberish value", name || "value", value);
|
29984
|
-
}
|
29985
|
-
function getUint(value, name) {
|
29986
|
-
const result = getBigInt(value, name);
|
29987
|
-
assert(result >= BN_0, "unsigned value cannot be negative", "NUMERIC_FAULT", {
|
29988
|
-
fault: "overflow",
|
29989
|
-
operation: "getUint",
|
29990
|
-
value
|
29988
|
+
function sleep(time) {
|
29989
|
+
return new Promise((resolve) => {
|
29990
|
+
setTimeout(() => {
|
29991
|
+
resolve(true);
|
29992
|
+
}, time);
|
29991
29993
|
});
|
29992
|
-
return result;
|
29993
29994
|
}
|
29994
|
-
|
29995
|
-
|
29996
|
-
if (value instanceof Uint8Array) {
|
29997
|
-
let result = "0x0";
|
29998
|
-
for (const v of value) {
|
29999
|
-
result += Nibbles[v >> 4];
|
30000
|
-
result += Nibbles[v & 15];
|
30001
|
-
}
|
30002
|
-
return BigInt(result);
|
30003
|
-
}
|
30004
|
-
return getBigInt(value);
|
30005
|
-
}
|
30006
|
-
function getNumber(value, name) {
|
30007
|
-
switch (typeof value) {
|
30008
|
-
case "bigint":
|
30009
|
-
assertArgument(value >= -maxValue && value <= maxValue, "overflow", name || "value", value);
|
30010
|
-
return Number(value);
|
30011
|
-
case "number":
|
30012
|
-
assertArgument(Number.isInteger(value), "underflow", name || "value", value);
|
30013
|
-
assertArgument(value >= -maxValue && value <= maxValue, "overflow", name || "value", value);
|
30014
|
-
return value;
|
30015
|
-
case "string":
|
30016
|
-
try {
|
30017
|
-
if (value === "") {
|
30018
|
-
throw new Error("empty string");
|
30019
|
-
}
|
30020
|
-
return getNumber(BigInt(value), name);
|
30021
|
-
} catch (e) {
|
30022
|
-
assertArgument(false, `invalid numeric string: ${e.message}`, name || "value", value);
|
30023
|
-
}
|
30024
|
-
}
|
30025
|
-
assertArgument(false, "invalid numeric value", name || "value", value);
|
30026
|
-
}
|
30027
|
-
function toBeHex(_value, _width) {
|
30028
|
-
const value = getUint(_value, "value");
|
30029
|
-
let result = value.toString(16);
|
30030
|
-
if (_width == null) {
|
30031
|
-
if (result.length % 2) {
|
30032
|
-
result = "0" + result;
|
30033
|
-
}
|
30034
|
-
} else {
|
30035
|
-
const width = getNumber(_width, "width");
|
30036
|
-
assert(width * 2 >= result.length, `value exceeds width (${width} bits)`, "NUMERIC_FAULT", {
|
30037
|
-
operation: "toBeHex",
|
30038
|
-
fault: "overflow",
|
30039
|
-
value: _value
|
30040
|
-
});
|
30041
|
-
while (result.length < width * 2) {
|
30042
|
-
result = "0" + result;
|
30043
|
-
}
|
30044
|
-
}
|
30045
|
-
return "0x" + result;
|
29995
|
+
function isDefined(value) {
|
29996
|
+
return value !== void 0;
|
30046
29997
|
}
|
30047
|
-
|
30048
|
-
|
29998
|
+
var BN_0 = bn(0);
|
29999
|
+
var BN_58 = bn(58);
|
30049
30000
|
var Alphabet = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
|
30050
30001
|
var Lookup = null;
|
30051
30002
|
function getAlpha(letter) {
|
30052
30003
|
if (Lookup == null) {
|
30053
30004
|
Lookup = {};
|
30054
30005
|
for (let i = 0; i < Alphabet.length; i++) {
|
30055
|
-
Lookup[Alphabet[i]] =
|
30006
|
+
Lookup[Alphabet[i]] = bn(i);
|
30056
30007
|
}
|
30057
30008
|
}
|
30058
30009
|
const result = Lookup[letter];
|
30059
|
-
|
30060
|
-
|
30010
|
+
if (result == null) {
|
30011
|
+
throw new FuelError(ErrorCode.INVALID_DATA, `invalid base58 value ${letter}`);
|
30012
|
+
}
|
30013
|
+
return bn(result);
|
30061
30014
|
}
|
30062
|
-
var BN_02 = BigInt(0);
|
30063
|
-
var BN_58 = BigInt(58);
|
30064
30015
|
function encodeBase58(_value) {
|
30065
|
-
|
30016
|
+
const bytes2 = arrayify(_value);
|
30017
|
+
let value = bn(bytes2);
|
30066
30018
|
let result = "";
|
30067
|
-
while (value) {
|
30068
|
-
result = Alphabet[Number(value
|
30069
|
-
value
|
30019
|
+
while (value.gt(BN_0)) {
|
30020
|
+
result = Alphabet[Number(value.mod(BN_58))] + result;
|
30021
|
+
value = value.div(BN_58);
|
30022
|
+
}
|
30023
|
+
for (let i = 0; i < bytes2.length; i++) {
|
30024
|
+
if (bytes2[i]) {
|
30025
|
+
break;
|
30026
|
+
}
|
30027
|
+
result = Alphabet[0] + result;
|
30070
30028
|
}
|
30071
30029
|
return result;
|
30072
30030
|
}
|
30073
30031
|
function decodeBase58(value) {
|
30074
|
-
let result =
|
30032
|
+
let result = BN_0;
|
30075
30033
|
for (let i = 0; i < value.length; i++) {
|
30076
|
-
result
|
30077
|
-
result
|
30078
|
-
}
|
30079
|
-
return result;
|
30080
|
-
}
|
30081
|
-
|
30082
|
-
// ../../node_modules/.pnpm/ethers@6.7.1/node_modules/ethers/lib.esm/utils/utf8.js
|
30083
|
-
function errorFunc(reason, offset, bytes3, output3, badCodepoint) {
|
30084
|
-
assertArgument(false, `invalid codepoint at offset ${offset}; ${reason}`, "bytes", bytes3);
|
30085
|
-
}
|
30086
|
-
function ignoreFunc(reason, offset, bytes3, output3, badCodepoint) {
|
30087
|
-
if (reason === "BAD_PREFIX" || reason === "UNEXPECTED_CONTINUE") {
|
30088
|
-
let i = 0;
|
30089
|
-
for (let o = offset + 1; o < bytes3.length; o++) {
|
30090
|
-
if (bytes3[o] >> 6 !== 2) {
|
30091
|
-
break;
|
30092
|
-
}
|
30093
|
-
i++;
|
30094
|
-
}
|
30095
|
-
return i;
|
30096
|
-
}
|
30097
|
-
if (reason === "OVERRUN") {
|
30098
|
-
return bytes3.length - offset - 1;
|
30099
|
-
}
|
30100
|
-
return 0;
|
30101
|
-
}
|
30102
|
-
function replaceFunc(reason, offset, bytes3, output3, badCodepoint) {
|
30103
|
-
if (reason === "OVERLONG") {
|
30104
|
-
assertArgument(typeof badCodepoint === "number", "invalid bad code point for replacement", "badCodepoint", badCodepoint);
|
30105
|
-
output3.push(badCodepoint);
|
30106
|
-
return 0;
|
30107
|
-
}
|
30108
|
-
output3.push(65533);
|
30109
|
-
return ignoreFunc(reason, offset, bytes3, output3, badCodepoint);
|
30110
|
-
}
|
30111
|
-
var Utf8ErrorFuncs = Object.freeze({
|
30112
|
-
error: errorFunc,
|
30113
|
-
ignore: ignoreFunc,
|
30114
|
-
replace: replaceFunc
|
30115
|
-
});
|
30116
|
-
function getUtf8CodePoints(_bytes, onError) {
|
30117
|
-
if (onError == null) {
|
30118
|
-
onError = Utf8ErrorFuncs.error;
|
30119
|
-
}
|
30120
|
-
const bytes3 = getBytes(_bytes, "bytes");
|
30121
|
-
const result = [];
|
30122
|
-
let i = 0;
|
30123
|
-
while (i < bytes3.length) {
|
30124
|
-
const c = bytes3[i++];
|
30125
|
-
if (c >> 7 === 0) {
|
30126
|
-
result.push(c);
|
30127
|
-
continue;
|
30128
|
-
}
|
30129
|
-
let extraLength = null;
|
30130
|
-
let overlongMask = null;
|
30131
|
-
if ((c & 224) === 192) {
|
30132
|
-
extraLength = 1;
|
30133
|
-
overlongMask = 127;
|
30134
|
-
} else if ((c & 240) === 224) {
|
30135
|
-
extraLength = 2;
|
30136
|
-
overlongMask = 2047;
|
30137
|
-
} else if ((c & 248) === 240) {
|
30138
|
-
extraLength = 3;
|
30139
|
-
overlongMask = 65535;
|
30140
|
-
} else {
|
30141
|
-
if ((c & 192) === 128) {
|
30142
|
-
i += onError("UNEXPECTED_CONTINUE", i - 1, bytes3, result);
|
30143
|
-
} else {
|
30144
|
-
i += onError("BAD_PREFIX", i - 1, bytes3, result);
|
30145
|
-
}
|
30146
|
-
continue;
|
30147
|
-
}
|
30148
|
-
if (i - 1 + extraLength >= bytes3.length) {
|
30149
|
-
i += onError("OVERRUN", i - 1, bytes3, result);
|
30150
|
-
continue;
|
30151
|
-
}
|
30152
|
-
let res = c & (1 << 8 - extraLength - 1) - 1;
|
30153
|
-
for (let j = 0; j < extraLength; j++) {
|
30154
|
-
let nextChar = bytes3[i];
|
30155
|
-
if ((nextChar & 192) != 128) {
|
30156
|
-
i += onError("MISSING_CONTINUE", i, bytes3, result);
|
30157
|
-
res = null;
|
30158
|
-
break;
|
30159
|
-
}
|
30160
|
-
;
|
30161
|
-
res = res << 6 | nextChar & 63;
|
30162
|
-
i++;
|
30163
|
-
}
|
30164
|
-
if (res === null) {
|
30165
|
-
continue;
|
30166
|
-
}
|
30167
|
-
if (res > 1114111) {
|
30168
|
-
i += onError("OUT_OF_RANGE", i - 1 - extraLength, bytes3, result, res);
|
30169
|
-
continue;
|
30170
|
-
}
|
30171
|
-
if (res >= 55296 && res <= 57343) {
|
30172
|
-
i += onError("UTF16_SURROGATE", i - 1 - extraLength, bytes3, result, res);
|
30173
|
-
continue;
|
30174
|
-
}
|
30175
|
-
if (res <= overlongMask) {
|
30176
|
-
i += onError("OVERLONG", i - 1 - extraLength, bytes3, result, res);
|
30177
|
-
continue;
|
30178
|
-
}
|
30179
|
-
result.push(res);
|
30034
|
+
result = result.mul(BN_58);
|
30035
|
+
result = result.add(getAlpha(value[i].toString()));
|
30180
30036
|
}
|
30181
30037
|
return result;
|
30182
30038
|
}
|
30183
|
-
function
|
30184
|
-
|
30185
|
-
|
30186
|
-
|
30187
|
-
}
|
30188
|
-
let result = [];
|
30189
|
-
for (let i = 0; i < str.length; i++) {
|
30190
|
-
const c = str.charCodeAt(i);
|
30191
|
-
if (c < 128) {
|
30192
|
-
result.push(c);
|
30193
|
-
} else if (c < 2048) {
|
30194
|
-
result.push(c >> 6 | 192);
|
30195
|
-
result.push(c & 63 | 128);
|
30196
|
-
} else if ((c & 64512) == 55296) {
|
30197
|
-
i++;
|
30198
|
-
const c2 = str.charCodeAt(i);
|
30199
|
-
assertArgument(i < str.length && (c2 & 64512) === 56320, "invalid surrogate pair", "str", str);
|
30200
|
-
const pair = 65536 + ((c & 1023) << 10) + (c2 & 1023);
|
30201
|
-
result.push(pair >> 18 | 240);
|
30202
|
-
result.push(pair >> 12 & 63 | 128);
|
30203
|
-
result.push(pair >> 6 & 63 | 128);
|
30204
|
-
result.push(pair & 63 | 128);
|
30205
|
-
} else {
|
30206
|
-
result.push(c >> 12 | 224);
|
30207
|
-
result.push(c >> 6 & 63 | 128);
|
30208
|
-
result.push(c & 63 | 128);
|
30209
|
-
}
|
30210
|
-
}
|
30211
|
-
return new Uint8Array(result);
|
30212
|
-
}
|
30213
|
-
function _toUtf8String(codePoints) {
|
30214
|
-
return codePoints.map((codePoint) => {
|
30215
|
-
if (codePoint <= 65535) {
|
30216
|
-
return String.fromCharCode(codePoint);
|
30217
|
-
}
|
30218
|
-
codePoint -= 65536;
|
30219
|
-
return String.fromCharCode((codePoint >> 10 & 1023) + 55296, (codePoint & 1023) + 56320);
|
30220
|
-
}).join("");
|
30221
|
-
}
|
30222
|
-
function toUtf8String(bytes3, onError) {
|
30223
|
-
return _toUtf8String(getUtf8CodePoints(bytes3, onError));
|
30224
|
-
}
|
30225
|
-
|
30226
|
-
// ../../node_modules/.pnpm/ethers@6.7.1/node_modules/ethers/lib.esm/crypto/crypto.js
|
30227
|
-
var import_crypto2 = __require("crypto");
|
30228
|
-
|
30229
|
-
// ../../node_modules/.pnpm/ethers@6.7.1/node_modules/ethers/lib.esm/crypto/hmac.js
|
30230
|
-
var locked = false;
|
30231
|
-
var _computeHmac = function(algorithm, key, data) {
|
30232
|
-
return (0, import_crypto2.createHmac)(algorithm, key).update(data).digest();
|
30233
|
-
};
|
30234
|
-
var __computeHmac = _computeHmac;
|
30235
|
-
function computeHmac(algorithm, _key, _data) {
|
30236
|
-
const key = getBytes(_key, "key");
|
30237
|
-
const data = getBytes(_data, "data");
|
30238
|
-
return hexlify2(__computeHmac(algorithm, key, data));
|
30239
|
-
}
|
30240
|
-
computeHmac._ = _computeHmac;
|
30241
|
-
computeHmac.lock = function() {
|
30242
|
-
locked = true;
|
30243
|
-
};
|
30244
|
-
computeHmac.register = function(func) {
|
30245
|
-
if (locked) {
|
30246
|
-
throw new Error("computeHmac is locked");
|
30247
|
-
}
|
30248
|
-
__computeHmac = func;
|
30249
|
-
};
|
30250
|
-
Object.freeze(computeHmac);
|
30251
|
-
|
30252
|
-
// ../../node_modules/.pnpm/@noble+hashes@1.1.2/node_modules/@noble/hashes/esm/_assert.js
|
30253
|
-
function number2(n) {
|
30254
|
-
if (!Number.isSafeInteger(n) || n < 0)
|
30255
|
-
throw new Error(`Wrong positive integer: ${n}`);
|
30256
|
-
}
|
30257
|
-
function bool(b) {
|
30258
|
-
if (typeof b !== "boolean")
|
30259
|
-
throw new Error(`Expected boolean, not ${b}`);
|
30260
|
-
}
|
30261
|
-
function bytes2(b, ...lengths) {
|
30262
|
-
if (!(b instanceof Uint8Array))
|
30263
|
-
throw new TypeError("Expected Uint8Array");
|
30264
|
-
if (lengths.length > 0 && !lengths.includes(b.length))
|
30265
|
-
throw new TypeError(`Expected Uint8Array of length ${lengths}, not of length=${b.length}`);
|
30266
|
-
}
|
30267
|
-
function hash2(hash4) {
|
30268
|
-
if (typeof hash4 !== "function" || typeof hash4.create !== "function")
|
30269
|
-
throw new Error("Hash should be wrapped by utils.wrapConstructor");
|
30270
|
-
number2(hash4.outputLen);
|
30271
|
-
number2(hash4.blockLen);
|
30272
|
-
}
|
30273
|
-
function exists2(instance, checkFinished = true) {
|
30274
|
-
if (instance.destroyed)
|
30275
|
-
throw new Error("Hash instance has been destroyed");
|
30276
|
-
if (checkFinished && instance.finished)
|
30277
|
-
throw new Error("Hash#digest() has already been called");
|
30278
|
-
}
|
30279
|
-
function output2(out, instance) {
|
30280
|
-
bytes2(out);
|
30281
|
-
const min = instance.outputLen;
|
30282
|
-
if (out.length < min) {
|
30283
|
-
throw new Error(`digestInto() expects output buffer of length at least ${min}`);
|
30284
|
-
}
|
30285
|
-
}
|
30286
|
-
var assert2 = {
|
30287
|
-
number: number2,
|
30288
|
-
bool,
|
30289
|
-
bytes: bytes2,
|
30290
|
-
hash: hash2,
|
30291
|
-
exists: exists2,
|
30292
|
-
output: output2
|
30293
|
-
};
|
30294
|
-
var assert_default = assert2;
|
30295
|
-
|
30296
|
-
// ../../node_modules/.pnpm/@noble+hashes@1.1.2/node_modules/@noble/hashes/esm/utils.js
|
30297
|
-
var createView2 = (arr) => new DataView(arr.buffer, arr.byteOffset, arr.byteLength);
|
30298
|
-
var isLE2 = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68;
|
30299
|
-
if (!isLE2)
|
30300
|
-
throw new Error("Non little-endian hardware is not supported");
|
30301
|
-
var hexes = Array.from({ length: 256 }, (v, i) => i.toString(16).padStart(2, "0"));
|
30302
|
-
function utf8ToBytes2(str) {
|
30303
|
-
if (typeof str !== "string") {
|
30304
|
-
throw new TypeError(`utf8ToBytes expected string, got ${typeof str}`);
|
30305
|
-
}
|
30306
|
-
return new TextEncoder().encode(str);
|
30307
|
-
}
|
30308
|
-
function toBytes2(data) {
|
30309
|
-
if (typeof data === "string")
|
30310
|
-
data = utf8ToBytes2(data);
|
30311
|
-
if (!(data instanceof Uint8Array))
|
30312
|
-
throw new TypeError(`Expected input type is Uint8Array (got ${typeof data})`);
|
30313
|
-
return data;
|
30314
|
-
}
|
30315
|
-
var Hash2 = class {
|
30316
|
-
// Safe version that clones internal state
|
30317
|
-
clone() {
|
30318
|
-
return this._cloneInto();
|
30039
|
+
function dataSlice(data, start, end) {
|
30040
|
+
const bytes2 = arrayify(data);
|
30041
|
+
if (end != null && end > bytes2.length) {
|
30042
|
+
throw new FuelError(ErrorCode.INVALID_DATA, "cannot slice beyond data bounds");
|
30319
30043
|
}
|
30320
|
-
|
30321
|
-
function wrapConstructor2(hashConstructor) {
|
30322
|
-
const hashC = (message) => hashConstructor().update(toBytes2(message)).digest();
|
30323
|
-
const tmp = hashConstructor();
|
30324
|
-
hashC.outputLen = tmp.outputLen;
|
30325
|
-
hashC.blockLen = tmp.blockLen;
|
30326
|
-
hashC.create = () => hashConstructor();
|
30327
|
-
return hashC;
|
30044
|
+
return hexlify(bytes2.slice(start == null ? 0 : start, end == null ? bytes2.length : end));
|
30328
30045
|
}
|
30329
30046
|
|
30330
|
-
// ../../node_modules/.pnpm/@noble+hashes@1.
|
30331
|
-
|
30332
|
-
|
30333
|
-
|
30334
|
-
const _32n2 = BigInt(32);
|
30335
|
-
const _u32_max = BigInt(4294967295);
|
30336
|
-
const wh = Number(value >> _32n2 & _u32_max);
|
30337
|
-
const wl = Number(value & _u32_max);
|
30338
|
-
const h = isLE3 ? 4 : 0;
|
30339
|
-
const l = isLE3 ? 0 : 4;
|
30340
|
-
view.setUint32(byteOffset + h, wh, isLE3);
|
30341
|
-
view.setUint32(byteOffset + l, wl, isLE3);
|
30342
|
-
}
|
30343
|
-
var SHA22 = class extends Hash2 {
|
30344
|
-
constructor(blockLen, outputLen, padOffset, isLE3) {
|
30345
|
-
super();
|
30346
|
-
this.blockLen = blockLen;
|
30347
|
-
this.outputLen = outputLen;
|
30348
|
-
this.padOffset = padOffset;
|
30349
|
-
this.isLE = isLE3;
|
30350
|
-
this.finished = false;
|
30351
|
-
this.length = 0;
|
30352
|
-
this.pos = 0;
|
30353
|
-
this.destroyed = false;
|
30354
|
-
this.buffer = new Uint8Array(blockLen);
|
30355
|
-
this.view = createView2(this.buffer);
|
30356
|
-
}
|
30357
|
-
update(data) {
|
30358
|
-
assert_default.exists(this);
|
30359
|
-
const { view, buffer, blockLen } = this;
|
30360
|
-
data = toBytes2(data);
|
30361
|
-
const len = data.length;
|
30362
|
-
for (let pos = 0; pos < len; ) {
|
30363
|
-
const take = Math.min(blockLen - this.pos, len - pos);
|
30364
|
-
if (take === blockLen) {
|
30365
|
-
const dataView = createView2(data);
|
30366
|
-
for (; blockLen <= len - pos; pos += blockLen)
|
30367
|
-
this.process(dataView, pos);
|
30368
|
-
continue;
|
30369
|
-
}
|
30370
|
-
buffer.set(data.subarray(pos, pos + take), this.pos);
|
30371
|
-
this.pos += take;
|
30372
|
-
pos += take;
|
30373
|
-
if (this.pos === blockLen) {
|
30374
|
-
this.process(view, 0);
|
30375
|
-
this.pos = 0;
|
30376
|
-
}
|
30377
|
-
}
|
30378
|
-
this.length += data.length;
|
30379
|
-
this.roundClean();
|
30380
|
-
return this;
|
30381
|
-
}
|
30382
|
-
digestInto(out) {
|
30383
|
-
assert_default.exists(this);
|
30384
|
-
assert_default.output(out, this);
|
30385
|
-
this.finished = true;
|
30386
|
-
const { buffer, view, blockLen, isLE: isLE3 } = this;
|
30387
|
-
let { pos } = this;
|
30388
|
-
buffer[pos++] = 128;
|
30389
|
-
this.buffer.subarray(pos).fill(0);
|
30390
|
-
if (this.padOffset > blockLen - pos) {
|
30391
|
-
this.process(view, 0);
|
30392
|
-
pos = 0;
|
30393
|
-
}
|
30394
|
-
for (let i = pos; i < blockLen; i++)
|
30395
|
-
buffer[i] = 0;
|
30396
|
-
setBigUint642(view, blockLen - 8, BigInt(this.length * 8), isLE3);
|
30397
|
-
this.process(view, 0);
|
30398
|
-
const oview = createView2(out);
|
30399
|
-
this.get().forEach((v, i) => oview.setUint32(4 * i, v, isLE3));
|
30400
|
-
}
|
30401
|
-
digest() {
|
30402
|
-
const { buffer, outputLen } = this;
|
30403
|
-
this.digestInto(buffer);
|
30404
|
-
const res = buffer.slice(0, outputLen);
|
30405
|
-
this.destroy();
|
30406
|
-
return res;
|
30407
|
-
}
|
30408
|
-
_cloneInto(to) {
|
30409
|
-
to || (to = new this.constructor());
|
30410
|
-
to.set(...this.get());
|
30411
|
-
const { blockLen, buffer, length, finished, destroyed, pos } = this;
|
30412
|
-
to.length = length;
|
30413
|
-
to.pos = pos;
|
30414
|
-
to.finished = finished;
|
30415
|
-
to.destroyed = destroyed;
|
30416
|
-
if (length % blockLen)
|
30417
|
-
to.buffer.set(buffer);
|
30418
|
-
return to;
|
30419
|
-
}
|
30420
|
-
};
|
30421
|
-
|
30422
|
-
// ../../node_modules/.pnpm/@noble+hashes@1.1.2/node_modules/@noble/hashes/esm/ripemd160.js
|
30423
|
-
var Rho = new Uint8Array([7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8]);
|
30424
|
-
var Id = Uint8Array.from({ length: 16 }, (_, i) => i);
|
30425
|
-
var Pi = Id.map((i) => (9 * i + 5) % 16);
|
30047
|
+
// ../../node_modules/.pnpm/@noble+hashes@1.3.3/node_modules/@noble/hashes/esm/ripemd160.js
|
30048
|
+
var Rho = /* @__PURE__ */ new Uint8Array([7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8]);
|
30049
|
+
var Id = /* @__PURE__ */ Uint8Array.from({ length: 16 }, (_, i) => i);
|
30050
|
+
var Pi = /* @__PURE__ */ Id.map((i) => (9 * i + 5) % 16);
|
30426
30051
|
var idxL = [Id];
|
30427
30052
|
var idxR = [Pi];
|
30428
30053
|
for (let i = 0; i < 4; i++)
|
30429
30054
|
for (let j of [idxL, idxR])
|
30430
30055
|
j.push(j[i].map((k) => Rho[k]));
|
30431
|
-
var shifts = [
|
30056
|
+
var shifts = /* @__PURE__ */ [
|
30432
30057
|
[11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8],
|
30433
30058
|
[12, 13, 11, 15, 6, 9, 9, 7, 12, 15, 11, 13, 7, 8, 7, 7],
|
30434
30059
|
[13, 15, 14, 11, 7, 7, 6, 8, 13, 14, 13, 12, 5, 5, 6, 9],
|
30435
30060
|
[14, 11, 12, 14, 8, 6, 5, 5, 15, 12, 15, 14, 9, 9, 8, 6],
|
30436
30061
|
[15, 12, 13, 13, 9, 5, 8, 6, 14, 11, 12, 11, 8, 6, 5, 5]
|
30437
30062
|
].map((i) => new Uint8Array(i));
|
30438
|
-
var shiftsL = idxL.map((idx, i) => idx.map((j) => shifts[i][j]));
|
30439
|
-
var shiftsR = idxR.map((idx, i) => idx.map((j) => shifts[i][j]));
|
30440
|
-
var Kl = new Uint32Array([
|
30441
|
-
|
30063
|
+
var shiftsL = /* @__PURE__ */ idxL.map((idx, i) => idx.map((j) => shifts[i][j]));
|
30064
|
+
var shiftsR = /* @__PURE__ */ idxR.map((idx, i) => idx.map((j) => shifts[i][j]));
|
30065
|
+
var Kl = /* @__PURE__ */ new Uint32Array([
|
30066
|
+
0,
|
30067
|
+
1518500249,
|
30068
|
+
1859775393,
|
30069
|
+
2400959708,
|
30070
|
+
2840853838
|
30071
|
+
]);
|
30072
|
+
var Kr = /* @__PURE__ */ new Uint32Array([
|
30073
|
+
1352829926,
|
30074
|
+
1548603684,
|
30075
|
+
1836072691,
|
30076
|
+
2053994217,
|
30077
|
+
0
|
30078
|
+
]);
|
30442
30079
|
var rotl2 = (word, shift) => word << shift | word >>> 32 - shift;
|
30443
30080
|
function f(group, x, y, z) {
|
30444
30081
|
if (group === 0)
|
@@ -30452,8 +30089,8 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
30452
30089
|
else
|
30453
30090
|
return x ^ (y | ~z);
|
30454
30091
|
}
|
30455
|
-
var BUF = new Uint32Array(16);
|
30456
|
-
var RIPEMD160 = class extends
|
30092
|
+
var BUF = /* @__PURE__ */ new Uint32Array(16);
|
30093
|
+
var RIPEMD160 = class extends SHA2 {
|
30457
30094
|
constructor() {
|
30458
30095
|
super(64, 20, 8, true);
|
30459
30096
|
this.h0 = 1732584193 | 0;
|
@@ -30502,65 +30139,60 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
30502
30139
|
this.set(0, 0, 0, 0, 0);
|
30503
30140
|
}
|
30504
30141
|
};
|
30505
|
-
var ripemd160 =
|
30142
|
+
var ripemd160 = /* @__PURE__ */ wrapConstructor(() => new RIPEMD160());
|
30506
30143
|
|
30507
|
-
//
|
30508
|
-
var
|
30509
|
-
var
|
30510
|
-
|
30144
|
+
// ../crypto/dist/index.mjs
|
30145
|
+
var import_crypto2 = __toESM(__require("crypto"), 1);
|
30146
|
+
var import_crypto3 = __require("crypto");
|
30147
|
+
var import_crypto4 = __toESM(__require("crypto"), 1);
|
30148
|
+
var import_crypto5 = __toESM(__require("crypto"), 1);
|
30149
|
+
var import_crypto6 = __require("crypto");
|
30150
|
+
var scrypt2 = (params) => {
|
30151
|
+
const { password, salt, n, p, r, dklen } = params;
|
30152
|
+
const derivedKey = scrypt(password, salt, { N: n, r, p, dkLen: dklen });
|
30153
|
+
return derivedKey;
|
30511
30154
|
};
|
30512
|
-
var
|
30155
|
+
var keccak256 = (data) => keccak_256(data);
|
30156
|
+
var locked = false;
|
30157
|
+
var helper = (data) => ripemd160(data);
|
30158
|
+
var ripemd = helper;
|
30513
30159
|
function ripemd1602(_data) {
|
30514
|
-
const data =
|
30515
|
-
return
|
30160
|
+
const data = arrayify(_data, "data");
|
30161
|
+
return ripemd(data);
|
30516
30162
|
}
|
30517
|
-
ripemd1602._ =
|
30518
|
-
ripemd1602.lock =
|
30519
|
-
|
30163
|
+
ripemd1602._ = helper;
|
30164
|
+
ripemd1602.lock = () => {
|
30165
|
+
locked = true;
|
30520
30166
|
};
|
30521
|
-
ripemd1602.register =
|
30522
|
-
if (
|
30523
|
-
throw new
|
30167
|
+
ripemd1602.register = (func) => {
|
30168
|
+
if (locked) {
|
30169
|
+
throw new FuelError(ErrorCode.HASHER_LOCKED, "ripemd160 is locked");
|
30524
30170
|
}
|
30525
|
-
|
30171
|
+
ripemd = func;
|
30526
30172
|
};
|
30527
30173
|
Object.freeze(ripemd1602);
|
30528
|
-
|
30529
|
-
|
30530
|
-
var
|
30531
|
-
var
|
30532
|
-
return (0, import_crypto2.pbkdf2Sync)(password, salt, iterations, keylen, algo);
|
30533
|
-
};
|
30534
|
-
var __pbkdf2 = _pbkdf2;
|
30174
|
+
var bufferFromString = (string, encoding = "base64") => Uint8Array.from(Buffer.from(string, encoding));
|
30175
|
+
var locked2 = false;
|
30176
|
+
var PBKDF2 = (password, salt, iterations, keylen, algo) => (0, import_crypto3.pbkdf2Sync)(password, salt, iterations, keylen, algo);
|
30177
|
+
var pBkdf2 = PBKDF2;
|
30535
30178
|
function pbkdf22(_password, _salt, iterations, keylen, algo) {
|
30536
|
-
const password =
|
30537
|
-
const salt =
|
30538
|
-
return
|
30179
|
+
const password = arrayify(_password, "password");
|
30180
|
+
const salt = arrayify(_salt, "salt");
|
30181
|
+
return hexlify(pBkdf2(password, salt, iterations, keylen, algo));
|
30539
30182
|
}
|
30540
|
-
pbkdf22._ =
|
30541
|
-
pbkdf22.lock =
|
30542
|
-
|
30183
|
+
pbkdf22._ = PBKDF2;
|
30184
|
+
pbkdf22.lock = () => {
|
30185
|
+
locked2 = true;
|
30543
30186
|
};
|
30544
|
-
pbkdf22.register =
|
30545
|
-
if (
|
30546
|
-
throw new
|
30187
|
+
pbkdf22.register = (func) => {
|
30188
|
+
if (locked2) {
|
30189
|
+
throw new FuelError(ErrorCode.HASHER_LOCKED, "pbkdf2 is locked");
|
30547
30190
|
}
|
30548
|
-
|
30191
|
+
pBkdf2 = func;
|
30549
30192
|
};
|
30550
30193
|
Object.freeze(pbkdf22);
|
30551
|
-
|
30552
|
-
|
30553
|
-
var import_crypto8 = __toESM(__require("crypto"), 1);
|
30554
|
-
var import_crypto9 = __toESM(__require("crypto"), 1);
|
30555
|
-
var scrypt3 = (params) => {
|
30556
|
-
const { password, salt, n, p, r, dklen } = params;
|
30557
|
-
const derivedKey = scrypt(password, salt, { N: n, r, p, dkLen: dklen });
|
30558
|
-
return derivedKey;
|
30559
|
-
};
|
30560
|
-
var keccak2562 = (data) => keccak_256(data);
|
30561
|
-
var bufferFromString = (string, encoding = "base64") => Uint8Array.from(Buffer.from(string, encoding));
|
30562
|
-
var randomBytes4 = (length) => {
|
30563
|
-
const randomValues = Uint8Array.from(import_crypto8.default.randomBytes(length));
|
30194
|
+
var randomBytes2 = (length) => {
|
30195
|
+
const randomValues = Uint8Array.from(import_crypto4.default.randomBytes(length));
|
30564
30196
|
return randomValues;
|
30565
30197
|
};
|
30566
30198
|
var stringFromBuffer = (buffer, encoding = "base64") => Buffer.from(buffer).toString(encoding);
|
@@ -30571,11 +30203,11 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
30571
30203
|
return arrayify(key);
|
30572
30204
|
};
|
30573
30205
|
var encrypt = async (password, data) => {
|
30574
|
-
const iv =
|
30575
|
-
const salt =
|
30206
|
+
const iv = randomBytes2(16);
|
30207
|
+
const salt = randomBytes2(32);
|
30576
30208
|
const secret = keyFromPassword(password, salt);
|
30577
30209
|
const dataBuffer = Uint8Array.from(Buffer.from(JSON.stringify(data), "utf-8"));
|
30578
|
-
const cipher = await
|
30210
|
+
const cipher = await import_crypto2.default.createCipheriv(ALGORITHM, secret, iv);
|
30579
30211
|
let cipherData = cipher.update(dataBuffer);
|
30580
30212
|
cipherData = Buffer.concat([cipherData, cipher.final()]);
|
30581
30213
|
return {
|
@@ -30589,7 +30221,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
30589
30221
|
const salt = bufferFromString(keystore.salt);
|
30590
30222
|
const secret = keyFromPassword(password, salt);
|
30591
30223
|
const encryptedText = bufferFromString(keystore.data);
|
30592
|
-
const decipher = await
|
30224
|
+
const decipher = await import_crypto2.default.createDecipheriv(ALGORITHM, secret, iv);
|
30593
30225
|
const decrypted = decipher.update(encryptedText);
|
30594
30226
|
const deBuff = Buffer.concat([decrypted, decipher.final()]);
|
30595
30227
|
const decryptedData = Buffer.from(deBuff).toString("utf-8");
|
@@ -30600,26 +30232,48 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
30600
30232
|
}
|
30601
30233
|
};
|
30602
30234
|
async function encryptJsonWalletData(data, key, iv) {
|
30603
|
-
const cipher = await
|
30235
|
+
const cipher = await import_crypto5.default.createCipheriv("aes-128-ctr", key.subarray(0, 16), iv);
|
30604
30236
|
const encrypted = Buffer.concat([cipher.update(data), cipher.final()]);
|
30605
30237
|
return new Uint8Array(encrypted);
|
30606
30238
|
}
|
30607
30239
|
async function decryptJsonWalletData(data, key, iv) {
|
30608
|
-
const decipher =
|
30240
|
+
const decipher = import_crypto5.default.createDecipheriv("aes-128-ctr", key.subarray(0, 16), iv);
|
30609
30241
|
const decrypted = await Buffer.concat([decipher.update(data), decipher.final()]);
|
30610
30242
|
return new Uint8Array(decrypted);
|
30611
30243
|
}
|
30244
|
+
var locked3 = false;
|
30245
|
+
var COMPUTEHMAC = (algorithm, key, data) => (0, import_crypto6.createHmac)(algorithm, key).update(data).digest();
|
30246
|
+
var computeHMAC = COMPUTEHMAC;
|
30247
|
+
function computeHmac(algorithm, _key, _data) {
|
30248
|
+
const key = arrayify(_key, "key");
|
30249
|
+
const data = arrayify(_data, "data");
|
30250
|
+
return hexlify(computeHMAC(algorithm, key, data));
|
30251
|
+
}
|
30252
|
+
computeHmac._ = COMPUTEHMAC;
|
30253
|
+
computeHmac.lock = () => {
|
30254
|
+
locked3 = true;
|
30255
|
+
};
|
30256
|
+
computeHmac.register = (func) => {
|
30257
|
+
if (locked3) {
|
30258
|
+
throw new FuelError(ErrorCode.HASHER_LOCKED, "computeHmac is locked");
|
30259
|
+
}
|
30260
|
+
computeHMAC = func;
|
30261
|
+
};
|
30262
|
+
Object.freeze(computeHmac);
|
30612
30263
|
var api = {
|
30613
30264
|
bufferFromString,
|
30614
30265
|
stringFromBuffer,
|
30615
30266
|
decrypt,
|
30616
30267
|
encrypt,
|
30617
30268
|
keyFromPassword,
|
30618
|
-
randomBytes:
|
30619
|
-
scrypt:
|
30620
|
-
keccak256
|
30269
|
+
randomBytes: randomBytes2,
|
30270
|
+
scrypt: scrypt2,
|
30271
|
+
keccak256,
|
30621
30272
|
decryptJsonWalletData,
|
30622
|
-
encryptJsonWalletData
|
30273
|
+
encryptJsonWalletData,
|
30274
|
+
computeHmac,
|
30275
|
+
pbkdf2: pbkdf22,
|
30276
|
+
ripemd160: ripemd1602
|
30623
30277
|
};
|
30624
30278
|
var node_default = api;
|
30625
30279
|
var {
|
@@ -30630,9 +30284,12 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
30630
30284
|
randomBytes: randomBytes22,
|
30631
30285
|
stringFromBuffer: stringFromBuffer2,
|
30632
30286
|
scrypt: scrypt22,
|
30633
|
-
keccak256:
|
30287
|
+
keccak256: keccak2562,
|
30634
30288
|
decryptJsonWalletData: decryptJsonWalletData2,
|
30635
|
-
encryptJsonWalletData: encryptJsonWalletData2
|
30289
|
+
encryptJsonWalletData: encryptJsonWalletData2,
|
30290
|
+
computeHmac: computeHmac2,
|
30291
|
+
pbkdf2: pbkdf222,
|
30292
|
+
ripemd160: ripemd16022
|
30636
30293
|
} = node_default;
|
30637
30294
|
|
30638
30295
|
// ../interfaces/dist/index.mjs
|
@@ -30696,7 +30353,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
30696
30353
|
};
|
30697
30354
|
var getRandomB256 = () => hexlify(randomBytes22(32));
|
30698
30355
|
var clearFirst12BytesFromB256 = (b256) => {
|
30699
|
-
let
|
30356
|
+
let bytes2;
|
30700
30357
|
try {
|
30701
30358
|
if (!isB256(b256)) {
|
30702
30359
|
throw new FuelError(
|
@@ -30704,15 +30361,15 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
30704
30361
|
`Invalid Bech32 Address: ${b256}.`
|
30705
30362
|
);
|
30706
30363
|
}
|
30707
|
-
|
30708
|
-
|
30364
|
+
bytes2 = getBytesFromBech32(toBech32(b256));
|
30365
|
+
bytes2 = hexlify(bytes2.fill(0, 0, 12));
|
30709
30366
|
} catch (error) {
|
30710
30367
|
throw new FuelError(
|
30711
30368
|
FuelError.CODES.PARSE_FAILED,
|
30712
30369
|
`Cannot generate EVM Address B256 from: ${b256}.`
|
30713
30370
|
);
|
30714
30371
|
}
|
30715
|
-
return
|
30372
|
+
return bytes2;
|
30716
30373
|
};
|
30717
30374
|
var padFirst12BytesOfEvmAddress = (address) => {
|
30718
30375
|
if (!isEvmAddress(address)) {
|
@@ -30921,226 +30578,6 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
30921
30578
|
}
|
30922
30579
|
};
|
30923
30580
|
|
30924
|
-
// ../math/dist/index.mjs
|
30925
|
-
var import_bn = __toESM(require_bn(), 1);
|
30926
|
-
var DEFAULT_PRECISION = 9;
|
30927
|
-
var DEFAULT_MIN_PRECISION = 3;
|
30928
|
-
var DEFAULT_DECIMAL_UNITS = 9;
|
30929
|
-
function toFixed(value, options) {
|
30930
|
-
const { precision = DEFAULT_PRECISION, minPrecision = DEFAULT_MIN_PRECISION } = options || {};
|
30931
|
-
const [valueUnits = "0", valueDecimals = "0"] = String(value || "0.0").split(".");
|
30932
|
-
const groupRegex = /(\d)(?=(\d{3})+\b)/g;
|
30933
|
-
const units = valueUnits.replace(groupRegex, "$1,");
|
30934
|
-
let decimals = valueDecimals.slice(0, precision);
|
30935
|
-
if (minPrecision < precision) {
|
30936
|
-
const trimmedDecimal = decimals.match(/.*[1-9]{1}/);
|
30937
|
-
const lastNonZeroIndex = trimmedDecimal?.[0].length || 0;
|
30938
|
-
const keepChars = Math.max(minPrecision, lastNonZeroIndex);
|
30939
|
-
decimals = decimals.slice(0, keepChars);
|
30940
|
-
}
|
30941
|
-
const decimalPortion = decimals ? `.${decimals}` : "";
|
30942
|
-
return `${units}${decimalPortion}`;
|
30943
|
-
}
|
30944
|
-
var BN = class extends import_bn.default {
|
30945
|
-
MAX_U64 = "0xFFFFFFFFFFFFFFFF";
|
30946
|
-
constructor(value, base, endian) {
|
30947
|
-
let bnValue = value;
|
30948
|
-
let bnBase = base;
|
30949
|
-
if (BN.isBN(value)) {
|
30950
|
-
bnValue = value.toArray();
|
30951
|
-
} else if (typeof value === "string" && value.slice(0, 2) === "0x") {
|
30952
|
-
bnValue = value.substring(2);
|
30953
|
-
bnBase = base || "hex";
|
30954
|
-
}
|
30955
|
-
super(bnValue == null ? 0 : bnValue, bnBase, endian);
|
30956
|
-
}
|
30957
|
-
// ANCHOR: HELPERS
|
30958
|
-
// make sure we always include `0x` in hex strings
|
30959
|
-
toString(base, length) {
|
30960
|
-
const output3 = super.toString(base, length);
|
30961
|
-
if (base === 16 || base === "hex") {
|
30962
|
-
return `0x${output3}`;
|
30963
|
-
}
|
30964
|
-
return output3;
|
30965
|
-
}
|
30966
|
-
toHex(bytesPadding) {
|
30967
|
-
const bytes3 = bytesPadding || 0;
|
30968
|
-
const bytesLength = bytes3 * 2;
|
30969
|
-
if (this.isNeg()) {
|
30970
|
-
throw new FuelError(ErrorCode.CONVERTING_FAILED, "Cannot convert negative value to hex.");
|
30971
|
-
}
|
30972
|
-
if (bytesPadding && this.byteLength() > bytesPadding) {
|
30973
|
-
throw new FuelError(
|
30974
|
-
ErrorCode.CONVERTING_FAILED,
|
30975
|
-
`Provided value ${this} is too large. It should fit within ${bytesPadding} bytes.`
|
30976
|
-
);
|
30977
|
-
}
|
30978
|
-
return this.toString(16, bytesLength);
|
30979
|
-
}
|
30980
|
-
toBytes(bytesPadding) {
|
30981
|
-
if (this.isNeg()) {
|
30982
|
-
throw new FuelError(ErrorCode.CONVERTING_FAILED, "Cannot convert negative value to bytes.");
|
30983
|
-
}
|
30984
|
-
return Uint8Array.from(this.toArray(void 0, bytesPadding));
|
30985
|
-
}
|
30986
|
-
toJSON() {
|
30987
|
-
return this.toString(16);
|
30988
|
-
}
|
30989
|
-
valueOf() {
|
30990
|
-
return this.toString();
|
30991
|
-
}
|
30992
|
-
format(options) {
|
30993
|
-
const {
|
30994
|
-
units = DEFAULT_DECIMAL_UNITS,
|
30995
|
-
precision = DEFAULT_PRECISION,
|
30996
|
-
minPrecision = DEFAULT_MIN_PRECISION
|
30997
|
-
} = options || {};
|
30998
|
-
const formattedUnits = this.formatUnits(units);
|
30999
|
-
const formattedFixed = toFixed(formattedUnits, { precision, minPrecision });
|
31000
|
-
if (!parseFloat(formattedFixed)) {
|
31001
|
-
const [, originalDecimals = "0"] = formattedUnits.split(".");
|
31002
|
-
const firstNonZero = originalDecimals.match(/[1-9]/);
|
31003
|
-
if (firstNonZero && firstNonZero.index && firstNonZero.index + 1 > precision) {
|
31004
|
-
const [valueUnits = "0"] = formattedFixed.split(".");
|
31005
|
-
return `${valueUnits}.${originalDecimals.slice(0, firstNonZero.index + 1)}`;
|
31006
|
-
}
|
31007
|
-
}
|
31008
|
-
return formattedFixed;
|
31009
|
-
}
|
31010
|
-
formatUnits(units = DEFAULT_DECIMAL_UNITS) {
|
31011
|
-
const valueUnits = this.toString().slice(0, units * -1);
|
31012
|
-
const valueDecimals = this.toString().slice(units * -1);
|
31013
|
-
const length = valueDecimals.length;
|
31014
|
-
const defaultDecimals = Array.from({ length: units - length }).fill("0").join("");
|
31015
|
-
const integerPortion = valueUnits ? `${valueUnits}.` : "0.";
|
31016
|
-
return `${integerPortion}${defaultDecimals}${valueDecimals}`;
|
31017
|
-
}
|
31018
|
-
// END ANCHOR: HELPERS
|
31019
|
-
// ANCHOR: OVERRIDES to accept better inputs
|
31020
|
-
add(v) {
|
31021
|
-
return this.caller(v, "add");
|
31022
|
-
}
|
31023
|
-
pow(v) {
|
31024
|
-
return this.caller(v, "pow");
|
31025
|
-
}
|
31026
|
-
sub(v) {
|
31027
|
-
return this.caller(v, "sub");
|
31028
|
-
}
|
31029
|
-
div(v) {
|
31030
|
-
return this.caller(v, "div");
|
31031
|
-
}
|
31032
|
-
mul(v) {
|
31033
|
-
return this.caller(v, "mul");
|
31034
|
-
}
|
31035
|
-
mod(v) {
|
31036
|
-
return this.caller(v, "mod");
|
31037
|
-
}
|
31038
|
-
divRound(v) {
|
31039
|
-
return this.caller(v, "divRound");
|
31040
|
-
}
|
31041
|
-
lt(v) {
|
31042
|
-
return this.caller(v, "lt");
|
31043
|
-
}
|
31044
|
-
lte(v) {
|
31045
|
-
return this.caller(v, "lte");
|
31046
|
-
}
|
31047
|
-
gt(v) {
|
31048
|
-
return this.caller(v, "gt");
|
31049
|
-
}
|
31050
|
-
gte(v) {
|
31051
|
-
return this.caller(v, "gte");
|
31052
|
-
}
|
31053
|
-
eq(v) {
|
31054
|
-
return this.caller(v, "eq");
|
31055
|
-
}
|
31056
|
-
cmp(v) {
|
31057
|
-
return this.caller(v, "cmp");
|
31058
|
-
}
|
31059
|
-
// END ANCHOR: OVERRIDES to accept better inputs
|
31060
|
-
// ANCHOR: OVERRIDES to output our BN type
|
31061
|
-
sqr() {
|
31062
|
-
return new BN(super.sqr().toArray());
|
31063
|
-
}
|
31064
|
-
neg() {
|
31065
|
-
return new BN(super.neg().toArray());
|
31066
|
-
}
|
31067
|
-
abs() {
|
31068
|
-
return new BN(super.abs().toArray());
|
31069
|
-
}
|
31070
|
-
toTwos(width) {
|
31071
|
-
return new BN(super.toTwos(width).toArray());
|
31072
|
-
}
|
31073
|
-
fromTwos(width) {
|
31074
|
-
return new BN(super.fromTwos(width).toArray());
|
31075
|
-
}
|
31076
|
-
// END ANCHOR: OVERRIDES to output our BN type
|
31077
|
-
// ANCHOR: OVERRIDES to avoid losing references
|
31078
|
-
caller(v, methodName) {
|
31079
|
-
const output3 = super[methodName](new BN(v));
|
31080
|
-
if (BN.isBN(output3)) {
|
31081
|
-
return new BN(output3.toArray());
|
31082
|
-
}
|
31083
|
-
if (typeof output3 === "boolean") {
|
31084
|
-
return output3;
|
31085
|
-
}
|
31086
|
-
return output3;
|
31087
|
-
}
|
31088
|
-
clone() {
|
31089
|
-
return new BN(this.toArray());
|
31090
|
-
}
|
31091
|
-
mulTo(num, out) {
|
31092
|
-
const output3 = new import_bn.default(this.toArray()).mulTo(num, out);
|
31093
|
-
return new BN(output3.toArray());
|
31094
|
-
}
|
31095
|
-
egcd(p) {
|
31096
|
-
const { a, b, gcd } = new import_bn.default(this.toArray()).egcd(p);
|
31097
|
-
return {
|
31098
|
-
a: new BN(a.toArray()),
|
31099
|
-
b: new BN(b.toArray()),
|
31100
|
-
gcd: new BN(gcd.toArray())
|
31101
|
-
};
|
31102
|
-
}
|
31103
|
-
divmod(num, mode, positive) {
|
31104
|
-
const { div, mod: mod2 } = new import_bn.default(this.toArray()).divmod(new BN(num), mode, positive);
|
31105
|
-
return {
|
31106
|
-
div: new BN(div?.toArray()),
|
31107
|
-
mod: new BN(mod2?.toArray())
|
31108
|
-
};
|
31109
|
-
}
|
31110
|
-
maxU64() {
|
31111
|
-
return this.gte(this.MAX_U64) ? new BN(this.MAX_U64) : this;
|
31112
|
-
}
|
31113
|
-
normalizeZeroToOne() {
|
31114
|
-
return this.isZero() ? new BN(1) : this;
|
31115
|
-
}
|
31116
|
-
// END ANCHOR: OVERRIDES to avoid losing references
|
31117
|
-
};
|
31118
|
-
var bn = (value, base, endian) => new BN(value, base, endian);
|
31119
|
-
bn.parseUnits = (value, units = DEFAULT_DECIMAL_UNITS) => {
|
31120
|
-
const valueToParse = value === "." ? "0." : value;
|
31121
|
-
const [valueUnits = "0", valueDecimals = "0"] = valueToParse.split(".");
|
31122
|
-
const length = valueDecimals.length;
|
31123
|
-
if (length > units) {
|
31124
|
-
throw new FuelError(
|
31125
|
-
ErrorCode.CONVERTING_FAILED,
|
31126
|
-
`Decimal can't have more than ${units} digits.`
|
31127
|
-
);
|
31128
|
-
}
|
31129
|
-
const decimals = Array.from({ length: units }).fill("0");
|
31130
|
-
decimals.splice(0, length, valueDecimals);
|
31131
|
-
const amount = `${valueUnits.replaceAll(",", "")}${decimals.join("")}`;
|
31132
|
-
return bn(amount);
|
31133
|
-
};
|
31134
|
-
function toNumber2(value) {
|
31135
|
-
return bn(value).toNumber();
|
31136
|
-
}
|
31137
|
-
function toHex(value, bytesPadding) {
|
31138
|
-
return bn(value).toHex(bytesPadding);
|
31139
|
-
}
|
31140
|
-
function toBytes3(value, bytesPadding) {
|
31141
|
-
return bn(value).toBytes(bytesPadding);
|
31142
|
-
}
|
31143
|
-
|
31144
30581
|
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_isPlaceholder.js
|
31145
30582
|
function _isPlaceholder(a) {
|
31146
30583
|
return a != null && typeof a === "object" && a["@@functional/placeholder"] === true;
|
@@ -31327,12 +30764,322 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
31327
30764
|
return coinQuantities;
|
31328
30765
|
};
|
31329
30766
|
|
30767
|
+
// ../../node_modules/.pnpm/ethers@6.7.1/node_modules/ethers/lib.esm/_version.js
|
30768
|
+
var version = "6.7.1";
|
30769
|
+
|
30770
|
+
// ../../node_modules/.pnpm/ethers@6.7.1/node_modules/ethers/lib.esm/utils/properties.js
|
30771
|
+
function checkType(value, type3, name) {
|
30772
|
+
const types = type3.split("|").map((t) => t.trim());
|
30773
|
+
for (let i = 0; i < types.length; i++) {
|
30774
|
+
switch (type3) {
|
30775
|
+
case "any":
|
30776
|
+
return;
|
30777
|
+
case "bigint":
|
30778
|
+
case "boolean":
|
30779
|
+
case "number":
|
30780
|
+
case "string":
|
30781
|
+
if (typeof value === type3) {
|
30782
|
+
return;
|
30783
|
+
}
|
30784
|
+
}
|
30785
|
+
}
|
30786
|
+
const error = new Error(`invalid value for type ${type3}`);
|
30787
|
+
error.code = "INVALID_ARGUMENT";
|
30788
|
+
error.argument = `value.${name}`;
|
30789
|
+
error.value = value;
|
30790
|
+
throw error;
|
30791
|
+
}
|
30792
|
+
function defineProperties(target, values, types) {
|
30793
|
+
for (let key in values) {
|
30794
|
+
let value = values[key];
|
30795
|
+
const type3 = types ? types[key] : null;
|
30796
|
+
if (type3) {
|
30797
|
+
checkType(value, type3, key);
|
30798
|
+
}
|
30799
|
+
Object.defineProperty(target, key, { enumerable: true, value, writable: false });
|
30800
|
+
}
|
30801
|
+
}
|
30802
|
+
|
30803
|
+
// ../../node_modules/.pnpm/ethers@6.7.1/node_modules/ethers/lib.esm/utils/errors.js
|
30804
|
+
function stringify(value) {
|
30805
|
+
if (value == null) {
|
30806
|
+
return "null";
|
30807
|
+
}
|
30808
|
+
if (Array.isArray(value)) {
|
30809
|
+
return "[ " + value.map(stringify).join(", ") + " ]";
|
30810
|
+
}
|
30811
|
+
if (value instanceof Uint8Array) {
|
30812
|
+
const HEX = "0123456789abcdef";
|
30813
|
+
let result = "0x";
|
30814
|
+
for (let i = 0; i < value.length; i++) {
|
30815
|
+
result += HEX[value[i] >> 4];
|
30816
|
+
result += HEX[value[i] & 15];
|
30817
|
+
}
|
30818
|
+
return result;
|
30819
|
+
}
|
30820
|
+
if (typeof value === "object" && typeof value.toJSON === "function") {
|
30821
|
+
return stringify(value.toJSON());
|
30822
|
+
}
|
30823
|
+
switch (typeof value) {
|
30824
|
+
case "boolean":
|
30825
|
+
case "symbol":
|
30826
|
+
return value.toString();
|
30827
|
+
case "bigint":
|
30828
|
+
return BigInt(value).toString();
|
30829
|
+
case "number":
|
30830
|
+
return value.toString();
|
30831
|
+
case "string":
|
30832
|
+
return JSON.stringify(value);
|
30833
|
+
case "object": {
|
30834
|
+
const keys = Object.keys(value);
|
30835
|
+
keys.sort();
|
30836
|
+
return "{ " + keys.map((k) => `${stringify(k)}: ${stringify(value[k])}`).join(", ") + " }";
|
30837
|
+
}
|
30838
|
+
}
|
30839
|
+
return `[ COULD NOT SERIALIZE ]`;
|
30840
|
+
}
|
30841
|
+
function makeError(message, code, info) {
|
30842
|
+
{
|
30843
|
+
const details = [];
|
30844
|
+
if (info) {
|
30845
|
+
if ("message" in info || "code" in info || "name" in info) {
|
30846
|
+
throw new Error(`value will overwrite populated values: ${stringify(info)}`);
|
30847
|
+
}
|
30848
|
+
for (const key in info) {
|
30849
|
+
const value = info[key];
|
30850
|
+
details.push(key + "=" + stringify(value));
|
30851
|
+
}
|
30852
|
+
}
|
30853
|
+
details.push(`code=${code}`);
|
30854
|
+
details.push(`version=${version}`);
|
30855
|
+
if (details.length) {
|
30856
|
+
message += " (" + details.join(", ") + ")";
|
30857
|
+
}
|
30858
|
+
}
|
30859
|
+
let error;
|
30860
|
+
switch (code) {
|
30861
|
+
case "INVALID_ARGUMENT":
|
30862
|
+
error = new TypeError(message);
|
30863
|
+
break;
|
30864
|
+
case "NUMERIC_FAULT":
|
30865
|
+
case "BUFFER_OVERRUN":
|
30866
|
+
error = new RangeError(message);
|
30867
|
+
break;
|
30868
|
+
default:
|
30869
|
+
error = new Error(message);
|
30870
|
+
}
|
30871
|
+
defineProperties(error, { code });
|
30872
|
+
if (info) {
|
30873
|
+
Object.assign(error, info);
|
30874
|
+
}
|
30875
|
+
return error;
|
30876
|
+
}
|
30877
|
+
function assert(check, message, code, info) {
|
30878
|
+
if (!check) {
|
30879
|
+
throw makeError(message, code, info);
|
30880
|
+
}
|
30881
|
+
}
|
30882
|
+
function assertArgument(check, message, name, value) {
|
30883
|
+
assert(check, message, "INVALID_ARGUMENT", { argument: name, value });
|
30884
|
+
}
|
30885
|
+
var _normalizeForms = ["NFD", "NFC", "NFKD", "NFKC"].reduce((accum, form) => {
|
30886
|
+
try {
|
30887
|
+
if ("test".normalize(form) !== "test") {
|
30888
|
+
throw new Error("bad");
|
30889
|
+
}
|
30890
|
+
;
|
30891
|
+
if (form === "NFD") {
|
30892
|
+
const check = String.fromCharCode(233).normalize("NFD");
|
30893
|
+
const expected = String.fromCharCode(101, 769);
|
30894
|
+
if (check !== expected) {
|
30895
|
+
throw new Error("broken");
|
30896
|
+
}
|
30897
|
+
}
|
30898
|
+
accum.push(form);
|
30899
|
+
} catch (error) {
|
30900
|
+
}
|
30901
|
+
return accum;
|
30902
|
+
}, []);
|
30903
|
+
function assertNormalize(form) {
|
30904
|
+
assert(_normalizeForms.indexOf(form) >= 0, "platform missing String.prototype.normalize", "UNSUPPORTED_OPERATION", {
|
30905
|
+
operation: "String.prototype.normalize",
|
30906
|
+
info: { form }
|
30907
|
+
});
|
30908
|
+
}
|
30909
|
+
|
30910
|
+
// ../../node_modules/.pnpm/ethers@6.7.1/node_modules/ethers/lib.esm/utils/data.js
|
30911
|
+
function _getBytes(value, name, copy) {
|
30912
|
+
if (value instanceof Uint8Array) {
|
30913
|
+
if (copy) {
|
30914
|
+
return new Uint8Array(value);
|
30915
|
+
}
|
30916
|
+
return value;
|
30917
|
+
}
|
30918
|
+
if (typeof value === "string" && value.match(/^0x([0-9a-f][0-9a-f])*$/i)) {
|
30919
|
+
const result = new Uint8Array((value.length - 2) / 2);
|
30920
|
+
let offset = 2;
|
30921
|
+
for (let i = 0; i < result.length; i++) {
|
30922
|
+
result[i] = parseInt(value.substring(offset, offset + 2), 16);
|
30923
|
+
offset += 2;
|
30924
|
+
}
|
30925
|
+
return result;
|
30926
|
+
}
|
30927
|
+
assertArgument(false, "invalid BytesLike value", name || "value", value);
|
30928
|
+
}
|
30929
|
+
function getBytes(value, name) {
|
30930
|
+
return _getBytes(value, name, false);
|
30931
|
+
}
|
30932
|
+
|
30933
|
+
// ../../node_modules/.pnpm/ethers@6.7.1/node_modules/ethers/lib.esm/utils/utf8.js
|
30934
|
+
function errorFunc(reason, offset, bytes2, output2, badCodepoint) {
|
30935
|
+
assertArgument(false, `invalid codepoint at offset ${offset}; ${reason}`, "bytes", bytes2);
|
30936
|
+
}
|
30937
|
+
function ignoreFunc(reason, offset, bytes2, output2, badCodepoint) {
|
30938
|
+
if (reason === "BAD_PREFIX" || reason === "UNEXPECTED_CONTINUE") {
|
30939
|
+
let i = 0;
|
30940
|
+
for (let o = offset + 1; o < bytes2.length; o++) {
|
30941
|
+
if (bytes2[o] >> 6 !== 2) {
|
30942
|
+
break;
|
30943
|
+
}
|
30944
|
+
i++;
|
30945
|
+
}
|
30946
|
+
return i;
|
30947
|
+
}
|
30948
|
+
if (reason === "OVERRUN") {
|
30949
|
+
return bytes2.length - offset - 1;
|
30950
|
+
}
|
30951
|
+
return 0;
|
30952
|
+
}
|
30953
|
+
function replaceFunc(reason, offset, bytes2, output2, badCodepoint) {
|
30954
|
+
if (reason === "OVERLONG") {
|
30955
|
+
assertArgument(typeof badCodepoint === "number", "invalid bad code point for replacement", "badCodepoint", badCodepoint);
|
30956
|
+
output2.push(badCodepoint);
|
30957
|
+
return 0;
|
30958
|
+
}
|
30959
|
+
output2.push(65533);
|
30960
|
+
return ignoreFunc(reason, offset, bytes2, output2, badCodepoint);
|
30961
|
+
}
|
30962
|
+
var Utf8ErrorFuncs = Object.freeze({
|
30963
|
+
error: errorFunc,
|
30964
|
+
ignore: ignoreFunc,
|
30965
|
+
replace: replaceFunc
|
30966
|
+
});
|
30967
|
+
function getUtf8CodePoints(_bytes, onError) {
|
30968
|
+
if (onError == null) {
|
30969
|
+
onError = Utf8ErrorFuncs.error;
|
30970
|
+
}
|
30971
|
+
const bytes2 = getBytes(_bytes, "bytes");
|
30972
|
+
const result = [];
|
30973
|
+
let i = 0;
|
30974
|
+
while (i < bytes2.length) {
|
30975
|
+
const c = bytes2[i++];
|
30976
|
+
if (c >> 7 === 0) {
|
30977
|
+
result.push(c);
|
30978
|
+
continue;
|
30979
|
+
}
|
30980
|
+
let extraLength = null;
|
30981
|
+
let overlongMask = null;
|
30982
|
+
if ((c & 224) === 192) {
|
30983
|
+
extraLength = 1;
|
30984
|
+
overlongMask = 127;
|
30985
|
+
} else if ((c & 240) === 224) {
|
30986
|
+
extraLength = 2;
|
30987
|
+
overlongMask = 2047;
|
30988
|
+
} else if ((c & 248) === 240) {
|
30989
|
+
extraLength = 3;
|
30990
|
+
overlongMask = 65535;
|
30991
|
+
} else {
|
30992
|
+
if ((c & 192) === 128) {
|
30993
|
+
i += onError("UNEXPECTED_CONTINUE", i - 1, bytes2, result);
|
30994
|
+
} else {
|
30995
|
+
i += onError("BAD_PREFIX", i - 1, bytes2, result);
|
30996
|
+
}
|
30997
|
+
continue;
|
30998
|
+
}
|
30999
|
+
if (i - 1 + extraLength >= bytes2.length) {
|
31000
|
+
i += onError("OVERRUN", i - 1, bytes2, result);
|
31001
|
+
continue;
|
31002
|
+
}
|
31003
|
+
let res = c & (1 << 8 - extraLength - 1) - 1;
|
31004
|
+
for (let j = 0; j < extraLength; j++) {
|
31005
|
+
let nextChar = bytes2[i];
|
31006
|
+
if ((nextChar & 192) != 128) {
|
31007
|
+
i += onError("MISSING_CONTINUE", i, bytes2, result);
|
31008
|
+
res = null;
|
31009
|
+
break;
|
31010
|
+
}
|
31011
|
+
;
|
31012
|
+
res = res << 6 | nextChar & 63;
|
31013
|
+
i++;
|
31014
|
+
}
|
31015
|
+
if (res === null) {
|
31016
|
+
continue;
|
31017
|
+
}
|
31018
|
+
if (res > 1114111) {
|
31019
|
+
i += onError("OUT_OF_RANGE", i - 1 - extraLength, bytes2, result, res);
|
31020
|
+
continue;
|
31021
|
+
}
|
31022
|
+
if (res >= 55296 && res <= 57343) {
|
31023
|
+
i += onError("UTF16_SURROGATE", i - 1 - extraLength, bytes2, result, res);
|
31024
|
+
continue;
|
31025
|
+
}
|
31026
|
+
if (res <= overlongMask) {
|
31027
|
+
i += onError("OVERLONG", i - 1 - extraLength, bytes2, result, res);
|
31028
|
+
continue;
|
31029
|
+
}
|
31030
|
+
result.push(res);
|
31031
|
+
}
|
31032
|
+
return result;
|
31033
|
+
}
|
31034
|
+
function toUtf8Bytes(str, form) {
|
31035
|
+
if (form != null) {
|
31036
|
+
assertNormalize(form);
|
31037
|
+
str = str.normalize(form);
|
31038
|
+
}
|
31039
|
+
let result = [];
|
31040
|
+
for (let i = 0; i < str.length; i++) {
|
31041
|
+
const c = str.charCodeAt(i);
|
31042
|
+
if (c < 128) {
|
31043
|
+
result.push(c);
|
31044
|
+
} else if (c < 2048) {
|
31045
|
+
result.push(c >> 6 | 192);
|
31046
|
+
result.push(c & 63 | 128);
|
31047
|
+
} else if ((c & 64512) == 55296) {
|
31048
|
+
i++;
|
31049
|
+
const c2 = str.charCodeAt(i);
|
31050
|
+
assertArgument(i < str.length && (c2 & 64512) === 56320, "invalid surrogate pair", "str", str);
|
31051
|
+
const pair = 65536 + ((c & 1023) << 10) + (c2 & 1023);
|
31052
|
+
result.push(pair >> 18 | 240);
|
31053
|
+
result.push(pair >> 12 & 63 | 128);
|
31054
|
+
result.push(pair >> 6 & 63 | 128);
|
31055
|
+
result.push(pair & 63 | 128);
|
31056
|
+
} else {
|
31057
|
+
result.push(c >> 12 | 224);
|
31058
|
+
result.push(c >> 6 & 63 | 128);
|
31059
|
+
result.push(c & 63 | 128);
|
31060
|
+
}
|
31061
|
+
}
|
31062
|
+
return new Uint8Array(result);
|
31063
|
+
}
|
31064
|
+
function _toUtf8String(codePoints) {
|
31065
|
+
return codePoints.map((codePoint) => {
|
31066
|
+
if (codePoint <= 65535) {
|
31067
|
+
return String.fromCharCode(codePoint);
|
31068
|
+
}
|
31069
|
+
codePoint -= 65536;
|
31070
|
+
return String.fromCharCode((codePoint >> 10 & 1023) + 55296, (codePoint & 1023) + 56320);
|
31071
|
+
}).join("");
|
31072
|
+
}
|
31073
|
+
function toUtf8String(bytes2, onError) {
|
31074
|
+
return _toUtf8String(getUtf8CodePoints(bytes2, onError));
|
31075
|
+
}
|
31076
|
+
|
31330
31077
|
// ../hasher/dist/index.mjs
|
31331
|
-
function
|
31078
|
+
function sha2562(data) {
|
31332
31079
|
return hexlify(sha256(arrayify(data)));
|
31333
31080
|
}
|
31334
|
-
function
|
31335
|
-
return
|
31081
|
+
function hash2(data) {
|
31082
|
+
return sha2562(data);
|
31336
31083
|
}
|
31337
31084
|
function uint64ToBytesBE(value) {
|
31338
31085
|
const bigIntValue = BigInt(value);
|
@@ -31342,7 +31089,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
31342
31089
|
return new Uint8Array(dataView.buffer);
|
31343
31090
|
}
|
31344
31091
|
function hashMessage(msg) {
|
31345
|
-
return
|
31092
|
+
return hash2(bufferFromString2(msg, "utf-8"));
|
31346
31093
|
}
|
31347
31094
|
|
31348
31095
|
// ../abi-coder/dist/index.mjs
|
@@ -31450,24 +31197,24 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
31450
31197
|
super("bigNumber", baseType, encodedLengths[baseType]);
|
31451
31198
|
}
|
31452
31199
|
encode(value) {
|
31453
|
-
let
|
31200
|
+
let bytes2;
|
31454
31201
|
try {
|
31455
|
-
|
31202
|
+
bytes2 = toBytes2(value, this.encodedLength);
|
31456
31203
|
} catch (error) {
|
31457
31204
|
throw new FuelError(ErrorCode.ENCODE_ERROR, `Invalid ${this.type}.`);
|
31458
31205
|
}
|
31459
|
-
return
|
31206
|
+
return bytes2;
|
31460
31207
|
}
|
31461
31208
|
decode(data, offset) {
|
31462
31209
|
if (data.length < this.encodedLength) {
|
31463
31210
|
throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid ${this.type} data size.`);
|
31464
31211
|
}
|
31465
|
-
let
|
31466
|
-
|
31467
|
-
if (
|
31212
|
+
let bytes2 = data.slice(offset, offset + this.encodedLength);
|
31213
|
+
bytes2 = bytes2.slice(0, this.encodedLength);
|
31214
|
+
if (bytes2.length !== this.encodedLength) {
|
31468
31215
|
throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid ${this.type} byte data size.`);
|
31469
31216
|
}
|
31470
|
-
return [bn(
|
31217
|
+
return [bn(bytes2), offset + this.encodedLength];
|
31471
31218
|
}
|
31472
31219
|
};
|
31473
31220
|
var VEC_PROPERTY_SPACE = 3;
|
@@ -31610,15 +31357,15 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
31610
31357
|
if (data.length < this.encodedLength) {
|
31611
31358
|
throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid b256 data size.`);
|
31612
31359
|
}
|
31613
|
-
let
|
31614
|
-
const decoded = bn(
|
31360
|
+
let bytes2 = data.slice(offset, offset + this.encodedLength);
|
31361
|
+
const decoded = bn(bytes2);
|
31615
31362
|
if (decoded.isZero()) {
|
31616
|
-
|
31363
|
+
bytes2 = new Uint8Array(32);
|
31617
31364
|
}
|
31618
|
-
if (
|
31365
|
+
if (bytes2.length !== this.encodedLength) {
|
31619
31366
|
throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid b256 byte data size.`);
|
31620
31367
|
}
|
31621
|
-
return [toHex(
|
31368
|
+
return [toHex(bytes2, 32), offset + 32];
|
31622
31369
|
}
|
31623
31370
|
};
|
31624
31371
|
var B512Coder = class extends Coder {
|
@@ -31641,15 +31388,15 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
31641
31388
|
if (data.length < this.encodedLength) {
|
31642
31389
|
throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid b512 data size.`);
|
31643
31390
|
}
|
31644
|
-
let
|
31645
|
-
const decoded = bn(
|
31391
|
+
let bytes2 = data.slice(offset, offset + this.encodedLength);
|
31392
|
+
const decoded = bn(bytes2);
|
31646
31393
|
if (decoded.isZero()) {
|
31647
|
-
|
31394
|
+
bytes2 = new Uint8Array(64);
|
31648
31395
|
}
|
31649
|
-
if (
|
31396
|
+
if (bytes2.length !== this.encodedLength) {
|
31650
31397
|
throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid b512 byte data size.`);
|
31651
31398
|
}
|
31652
|
-
return [toHex(
|
31399
|
+
return [toHex(bytes2, this.encodedLength), offset + this.encodedLength];
|
31653
31400
|
}
|
31654
31401
|
};
|
31655
31402
|
var BooleanCoder = class extends Coder {
|
@@ -31669,23 +31416,23 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
31669
31416
|
if (!isTrueBool) {
|
31670
31417
|
throw new FuelError(ErrorCode.ENCODE_ERROR, `Invalid boolean value.`);
|
31671
31418
|
}
|
31672
|
-
const
|
31419
|
+
const output2 = toBytes2(value ? 1 : 0, this.paddingLength);
|
31673
31420
|
if (this.options.isRightPadded) {
|
31674
|
-
return
|
31421
|
+
return output2.reverse();
|
31675
31422
|
}
|
31676
|
-
return
|
31423
|
+
return output2;
|
31677
31424
|
}
|
31678
31425
|
decode(data, offset) {
|
31679
31426
|
if (data.length < this.paddingLength) {
|
31680
31427
|
throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid boolean data size.`);
|
31681
31428
|
}
|
31682
|
-
let
|
31429
|
+
let bytes2;
|
31683
31430
|
if (this.options.isRightPadded) {
|
31684
|
-
|
31431
|
+
bytes2 = data.slice(offset, offset + 1);
|
31685
31432
|
} else {
|
31686
|
-
|
31433
|
+
bytes2 = data.slice(offset, offset + this.paddingLength);
|
31687
31434
|
}
|
31688
|
-
const decodedValue = bn(
|
31435
|
+
const decodedValue = bn(bytes2);
|
31689
31436
|
if (decodedValue.isZero()) {
|
31690
31437
|
return [false, offset + this.paddingLength];
|
31691
31438
|
}
|
@@ -31792,7 +31539,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
31792
31539
|
let newOffset = offset;
|
31793
31540
|
let decoded;
|
31794
31541
|
[decoded, newOffset] = new BigNumberCoder("u64").decode(data, newOffset);
|
31795
|
-
const caseIndex =
|
31542
|
+
const caseIndex = toNumber(decoded);
|
31796
31543
|
const caseKey = Object.keys(this.coders)[caseIndex];
|
31797
31544
|
if (!caseKey) {
|
31798
31545
|
throw new FuelError(
|
@@ -31828,9 +31575,9 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
31828
31575
|
const [decoded, newOffset] = super.decode(data, offset);
|
31829
31576
|
return [this.toOption(decoded), newOffset];
|
31830
31577
|
}
|
31831
|
-
toOption(
|
31832
|
-
if (
|
31833
|
-
return
|
31578
|
+
toOption(output2) {
|
31579
|
+
if (output2 && "Some" in output2) {
|
31580
|
+
return output2.Some;
|
31834
31581
|
}
|
31835
31582
|
return void 0;
|
31836
31583
|
}
|
@@ -31865,30 +31612,30 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
31865
31612
|
this.options = options;
|
31866
31613
|
}
|
31867
31614
|
encode(value) {
|
31868
|
-
let
|
31615
|
+
let bytes2;
|
31869
31616
|
try {
|
31870
|
-
|
31617
|
+
bytes2 = toBytes2(value);
|
31871
31618
|
} catch (error) {
|
31872
31619
|
throw new FuelError(ErrorCode.ENCODE_ERROR, `Invalid ${this.baseType}.`);
|
31873
31620
|
}
|
31874
|
-
if (
|
31621
|
+
if (bytes2.length > this.length) {
|
31875
31622
|
throw new FuelError(ErrorCode.ENCODE_ERROR, `Invalid ${this.baseType}, too many bytes.`);
|
31876
31623
|
}
|
31877
|
-
const
|
31624
|
+
const output2 = toBytes2(bytes2, this.paddingLength);
|
31878
31625
|
if (this.baseType !== "u8") {
|
31879
|
-
return
|
31626
|
+
return output2;
|
31880
31627
|
}
|
31881
|
-
return this.options.isRightPadded ?
|
31628
|
+
return this.options.isRightPadded ? output2.reverse() : output2;
|
31882
31629
|
}
|
31883
31630
|
decodeU8(data, offset) {
|
31884
|
-
let
|
31631
|
+
let bytes2;
|
31885
31632
|
if (this.options.isRightPadded) {
|
31886
|
-
|
31633
|
+
bytes2 = data.slice(offset, offset + 1);
|
31887
31634
|
} else {
|
31888
|
-
|
31889
|
-
|
31635
|
+
bytes2 = data.slice(offset, offset + this.paddingLength);
|
31636
|
+
bytes2 = bytes2.slice(this.paddingLength - this.length, this.paddingLength);
|
31890
31637
|
}
|
31891
|
-
return [
|
31638
|
+
return [toNumber(bytes2), offset + this.paddingLength];
|
31892
31639
|
}
|
31893
31640
|
decode(data, offset) {
|
31894
31641
|
if (data.length < this.paddingLength) {
|
@@ -31897,12 +31644,12 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
31897
31644
|
if (this.baseType === "u8") {
|
31898
31645
|
return this.decodeU8(data, offset);
|
31899
31646
|
}
|
31900
|
-
let
|
31901
|
-
|
31902
|
-
if (
|
31647
|
+
let bytes2 = data.slice(offset, offset + this.paddingLength);
|
31648
|
+
bytes2 = bytes2.slice(8 - this.length, 8);
|
31649
|
+
if (bytes2.length !== this.paddingLength - (this.paddingLength - this.length)) {
|
31903
31650
|
throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid number byte data size.`);
|
31904
31651
|
}
|
31905
|
-
return [
|
31652
|
+
return [toNumber(bytes2), offset + 8];
|
31906
31653
|
}
|
31907
31654
|
};
|
31908
31655
|
var RawSliceCoder = class extends Coder {
|
@@ -32000,11 +31747,11 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
32000
31747
|
if (data.length < this.encodedLength) {
|
32001
31748
|
throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid string data size.`);
|
32002
31749
|
}
|
32003
|
-
const
|
32004
|
-
if (
|
31750
|
+
const bytes2 = data.slice(offset, offset + this.length);
|
31751
|
+
if (bytes2.length !== this.length) {
|
32005
31752
|
throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid string byte data size.`);
|
32006
31753
|
}
|
32007
|
-
const value = toUtf8String(
|
31754
|
+
const value = toUtf8String(bytes2);
|
32008
31755
|
const padding = this.#paddingLength;
|
32009
31756
|
return [value, offset + this.length + padding];
|
32010
31757
|
}
|
@@ -32415,17 +32162,17 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
32415
32162
|
if (!isTrueBool) {
|
32416
32163
|
throw new FuelError(ErrorCode.ENCODE_ERROR, `Invalid boolean value.`);
|
32417
32164
|
}
|
32418
|
-
return
|
32165
|
+
return toBytes2(value ? 1 : 0, this.encodedLength);
|
32419
32166
|
}
|
32420
32167
|
decode(data, offset) {
|
32421
32168
|
if (data.length < this.encodedLength) {
|
32422
32169
|
throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid boolean data size.`);
|
32423
32170
|
}
|
32424
|
-
const
|
32425
|
-
if (
|
32171
|
+
const bytes2 = bn(data.slice(offset, offset + this.encodedLength));
|
32172
|
+
if (bytes2.isZero()) {
|
32426
32173
|
return [false, offset + this.encodedLength];
|
32427
32174
|
}
|
32428
|
-
if (!
|
32175
|
+
if (!bytes2.eq(bn(1))) {
|
32429
32176
|
throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid boolean value.`);
|
32430
32177
|
}
|
32431
32178
|
return [true, offset + this.encodedLength];
|
@@ -32436,9 +32183,9 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
32436
32183
|
super("struct", "struct Bytes", WORD_SIZE);
|
32437
32184
|
}
|
32438
32185
|
encode(value) {
|
32439
|
-
const
|
32440
|
-
const lengthBytes = new BigNumberCoder("u64").encode(
|
32441
|
-
return new Uint8Array([...lengthBytes, ...
|
32186
|
+
const bytes2 = value instanceof Uint8Array ? value : new Uint8Array(value);
|
32187
|
+
const lengthBytes = new BigNumberCoder("u64").encode(bytes2.length);
|
32188
|
+
return new Uint8Array([...lengthBytes, ...bytes2]);
|
32442
32189
|
}
|
32443
32190
|
decode(data, offset) {
|
32444
32191
|
if (data.length < WORD_SIZE) {
|
@@ -32507,7 +32254,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
32507
32254
|
throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid enum data size.`);
|
32508
32255
|
}
|
32509
32256
|
const caseBytes = new BigNumberCoder("u64").decode(data, offset)[0];
|
32510
|
-
const caseIndex =
|
32257
|
+
const caseIndex = toNumber(caseBytes);
|
32511
32258
|
const caseKey = Object.keys(this.coders)[caseIndex];
|
32512
32259
|
if (!caseKey) {
|
32513
32260
|
throw new FuelError(
|
@@ -32546,26 +32293,26 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
32546
32293
|
this.length = length;
|
32547
32294
|
}
|
32548
32295
|
encode(value) {
|
32549
|
-
let
|
32296
|
+
let bytes2;
|
32550
32297
|
try {
|
32551
|
-
|
32298
|
+
bytes2 = toBytes2(value);
|
32552
32299
|
} catch (error) {
|
32553
32300
|
throw new FuelError(ErrorCode.ENCODE_ERROR, `Invalid ${this.baseType}.`);
|
32554
32301
|
}
|
32555
|
-
if (
|
32302
|
+
if (bytes2.length > this.length) {
|
32556
32303
|
throw new FuelError(ErrorCode.ENCODE_ERROR, `Invalid ${this.baseType}, too many bytes.`);
|
32557
32304
|
}
|
32558
|
-
return
|
32305
|
+
return toBytes2(bytes2, this.length);
|
32559
32306
|
}
|
32560
32307
|
decode(data, offset) {
|
32561
32308
|
if (data.length < this.encodedLength) {
|
32562
32309
|
throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid number data size.`);
|
32563
32310
|
}
|
32564
|
-
const
|
32565
|
-
if (
|
32311
|
+
const bytes2 = data.slice(offset, offset + this.length);
|
32312
|
+
if (bytes2.length !== this.encodedLength) {
|
32566
32313
|
throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid number byte data size.`);
|
32567
32314
|
}
|
32568
|
-
return [
|
32315
|
+
return [toNumber(bytes2), offset + this.length];
|
32569
32316
|
}
|
32570
32317
|
};
|
32571
32318
|
var OptionCoder2 = class extends EnumCoder2 {
|
@@ -32583,9 +32330,9 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
32583
32330
|
const [decoded, newOffset] = super.decode(data, offset);
|
32584
32331
|
return [this.toOption(decoded), newOffset];
|
32585
32332
|
}
|
32586
|
-
toOption(
|
32587
|
-
if (
|
32588
|
-
return
|
32333
|
+
toOption(output2) {
|
32334
|
+
if (output2 && "Some" in output2) {
|
32335
|
+
return output2.Some;
|
32589
32336
|
}
|
32590
32337
|
return void 0;
|
32591
32338
|
}
|
@@ -32599,9 +32346,9 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
32599
32346
|
throw new FuelError(ErrorCode.ENCODE_ERROR, `Expected array value.`);
|
32600
32347
|
}
|
32601
32348
|
const internalCoder = new ArrayCoder(new NumberCoder2("u8"), value.length);
|
32602
|
-
const
|
32603
|
-
const lengthBytes = new BigNumberCoder("u64").encode(
|
32604
|
-
return new Uint8Array([...lengthBytes, ...
|
32349
|
+
const bytes2 = internalCoder.encode(value);
|
32350
|
+
const lengthBytes = new BigNumberCoder("u64").encode(bytes2.length);
|
32351
|
+
return new Uint8Array([...lengthBytes, ...bytes2]);
|
32605
32352
|
}
|
32606
32353
|
decode(data, offset) {
|
32607
32354
|
if (data.length < this.encodedLength) {
|
@@ -32624,9 +32371,9 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
32624
32371
|
super("struct", "struct String", WORD_SIZE);
|
32625
32372
|
}
|
32626
32373
|
encode(value) {
|
32627
|
-
const
|
32374
|
+
const bytes2 = toUtf8Bytes(value);
|
32628
32375
|
const lengthBytes = new BigNumberCoder("u64").encode(value.length);
|
32629
|
-
return new Uint8Array([...lengthBytes, ...
|
32376
|
+
return new Uint8Array([...lengthBytes, ...bytes2]);
|
32630
32377
|
}
|
32631
32378
|
decode(data, offset) {
|
32632
32379
|
if (data.length < this.encodedLength) {
|
@@ -32648,9 +32395,9 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
32648
32395
|
super("strSlice", "str", WORD_SIZE);
|
32649
32396
|
}
|
32650
32397
|
encode(value) {
|
32651
|
-
const
|
32398
|
+
const bytes2 = toUtf8Bytes(value);
|
32652
32399
|
const lengthBytes = new BigNumberCoder("u64").encode(value.length);
|
32653
|
-
return new Uint8Array([...lengthBytes, ...
|
32400
|
+
return new Uint8Array([...lengthBytes, ...bytes2]);
|
32654
32401
|
}
|
32655
32402
|
decode(data, offset) {
|
32656
32403
|
if (data.length < this.encodedLength) {
|
@@ -32659,11 +32406,11 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
32659
32406
|
const offsetAndLength = offset + WORD_SIZE;
|
32660
32407
|
const lengthBytes = data.slice(offset, offsetAndLength);
|
32661
32408
|
const length = bn(new BigNumberCoder("u64").decode(lengthBytes, 0)[0]).toNumber();
|
32662
|
-
const
|
32663
|
-
if (
|
32409
|
+
const bytes2 = data.slice(offsetAndLength, offsetAndLength + length);
|
32410
|
+
if (bytes2.length !== length) {
|
32664
32411
|
throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid string slice byte data size.`);
|
32665
32412
|
}
|
32666
|
-
return [toUtf8String(
|
32413
|
+
return [toUtf8String(bytes2), offsetAndLength + length];
|
32667
32414
|
}
|
32668
32415
|
};
|
32669
32416
|
__publicField4(StrSliceCoder, "memorySize", 1);
|
@@ -32681,11 +32428,11 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
32681
32428
|
if (data.length < this.encodedLength) {
|
32682
32429
|
throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid string data size.`);
|
32683
32430
|
}
|
32684
|
-
const
|
32685
|
-
if (
|
32431
|
+
const bytes2 = data.slice(offset, offset + this.encodedLength);
|
32432
|
+
if (bytes2.length !== this.encodedLength) {
|
32686
32433
|
throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid string byte data size.`);
|
32687
32434
|
}
|
32688
|
-
return [toUtf8String(
|
32435
|
+
return [toUtf8String(bytes2), offset + this.encodedLength];
|
32689
32436
|
}
|
32690
32437
|
};
|
32691
32438
|
var StructCoder2 = class extends Coder {
|
@@ -32765,12 +32512,19 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
32765
32512
|
this.#isOptionVec = this.coder instanceof OptionCoder2;
|
32766
32513
|
}
|
32767
32514
|
encode(value) {
|
32768
|
-
if (!Array.isArray(value)) {
|
32769
|
-
throw new FuelError(
|
32515
|
+
if (!Array.isArray(value) && !isUint8Array(value)) {
|
32516
|
+
throw new FuelError(
|
32517
|
+
ErrorCode.ENCODE_ERROR,
|
32518
|
+
`Expected array value, or a Uint8Array. You can use arrayify to convert a value to a Uint8Array.`
|
32519
|
+
);
|
32770
32520
|
}
|
32771
|
-
const
|
32772
|
-
|
32773
|
-
|
32521
|
+
const lengthCoder = new BigNumberCoder("u64");
|
32522
|
+
if (isUint8Array(value)) {
|
32523
|
+
return new Uint8Array([...lengthCoder.encode(value.length), ...value]);
|
32524
|
+
}
|
32525
|
+
const bytes2 = value.map((v) => this.coder.encode(v));
|
32526
|
+
const lengthBytes = lengthCoder.encode(value.length);
|
32527
|
+
return new Uint8Array([...lengthBytes, ...concatBytes2(bytes2)]);
|
32774
32528
|
}
|
32775
32529
|
decode(data, offset) {
|
32776
32530
|
if (!this.#isOptionVec && (data.length < this.encodedLength || data.length > MAX_BYTES)) {
|
@@ -32933,7 +32687,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
32933
32687
|
return `${fn.name}(${inputsSignatures.join(",")})`;
|
32934
32688
|
}
|
32935
32689
|
static getFunctionSelector(functionSignature) {
|
32936
|
-
const hashedFunctionSignature =
|
32690
|
+
const hashedFunctionSignature = sha2562(bufferFromString2(functionSignature, "utf-8"));
|
32937
32691
|
return bn(hashedFunctionSignature.slice(0, 10)).toHex(8);
|
32938
32692
|
}
|
32939
32693
|
#isInputDataPointer() {
|
@@ -32996,10 +32750,10 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
32996
32750
|
throw new FuelError(ErrorCode.ABI_TYPES_AND_VALUES_MISMATCH, errorMsg);
|
32997
32751
|
}
|
32998
32752
|
decodeArguments(data) {
|
32999
|
-
const
|
32753
|
+
const bytes2 = arrayify(data);
|
33000
32754
|
const nonEmptyInputs = findNonEmptyInputs(this.jsonAbi, this.jsonFn.inputs);
|
33001
32755
|
if (nonEmptyInputs.length === 0) {
|
33002
|
-
if (
|
32756
|
+
if (bytes2.length === 0) {
|
33003
32757
|
return void 0;
|
33004
32758
|
}
|
33005
32759
|
throw new FuelError(
|
@@ -33008,12 +32762,12 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
33008
32762
|
count: {
|
33009
32763
|
types: this.jsonFn.inputs.length,
|
33010
32764
|
nonEmptyInputs: nonEmptyInputs.length,
|
33011
|
-
values:
|
32765
|
+
values: bytes2.length
|
33012
32766
|
},
|
33013
32767
|
value: {
|
33014
32768
|
args: this.jsonFn.inputs,
|
33015
32769
|
nonEmptyInputs,
|
33016
|
-
values:
|
32770
|
+
values: bytes2
|
33017
32771
|
}
|
33018
32772
|
})}`
|
33019
32773
|
);
|
@@ -33021,7 +32775,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
33021
32775
|
const result = nonEmptyInputs.reduce(
|
33022
32776
|
(obj, input) => {
|
33023
32777
|
const coder = AbiCoder.getCoder(this.jsonAbi, input, { encoding: this.encoding });
|
33024
|
-
const [decodedValue, decodedValueByteSize] = coder.decode(
|
32778
|
+
const [decodedValue, decodedValueByteSize] = coder.decode(bytes2, obj.offset);
|
33025
32779
|
return {
|
33026
32780
|
decoded: [...obj.decoded, decodedValue],
|
33027
32781
|
offset: obj.offset + decodedValueByteSize
|
@@ -33036,11 +32790,11 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
33036
32790
|
if (outputAbiType.type === "()") {
|
33037
32791
|
return [void 0, 0];
|
33038
32792
|
}
|
33039
|
-
const
|
32793
|
+
const bytes2 = arrayify(data);
|
33040
32794
|
const coder = AbiCoder.getCoder(this.jsonAbi, this.jsonFn.output, {
|
33041
32795
|
encoding: this.encoding
|
33042
32796
|
});
|
33043
|
-
return coder.decode(
|
32797
|
+
return coder.decode(bytes2, 0);
|
33044
32798
|
}
|
33045
32799
|
/**
|
33046
32800
|
* Checks if the function is read-only i.e. it only reads from storage, does not write to it.
|
@@ -33301,12 +33055,12 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
33301
33055
|
parts.push(new ByteArrayCoder(32).encode(value.nonce));
|
33302
33056
|
parts.push(new BigNumberCoder("u64").encode(value.amount));
|
33303
33057
|
parts.push(arrayify(value.data || "0x"));
|
33304
|
-
return
|
33058
|
+
return sha2562(concat(parts));
|
33305
33059
|
}
|
33306
33060
|
static encodeData(messageData) {
|
33307
|
-
const
|
33308
|
-
const dataLength2 =
|
33309
|
-
return new ByteArrayCoder(dataLength2).encode(
|
33061
|
+
const bytes2 = arrayify(messageData || "0x");
|
33062
|
+
const dataLength2 = bytes2.length;
|
33063
|
+
return new ByteArrayCoder(dataLength2).encode(bytes2);
|
33310
33064
|
}
|
33311
33065
|
encode(value) {
|
33312
33066
|
const parts = [];
|
@@ -33328,9 +33082,9 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
33328
33082
|
return concat(parts);
|
33329
33083
|
}
|
33330
33084
|
static decodeData(messageData) {
|
33331
|
-
const
|
33332
|
-
const dataLength2 =
|
33333
|
-
const [data] = new ByteArrayCoder(dataLength2).decode(
|
33085
|
+
const bytes2 = arrayify(messageData);
|
33086
|
+
const dataLength2 = bytes2.length;
|
33087
|
+
const [data] = new ByteArrayCoder(dataLength2).decode(bytes2, 0);
|
33334
33088
|
return arrayify(data);
|
33335
33089
|
}
|
33336
33090
|
decode(data, offset) {
|
@@ -33767,7 +33521,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
33767
33521
|
parts.push(new ByteArrayCoder(32).encode(value.nonce));
|
33768
33522
|
parts.push(new BigNumberCoder("u64").encode(value.amount));
|
33769
33523
|
parts.push(arrayify(value.data || "0x"));
|
33770
|
-
return
|
33524
|
+
return sha2562(concat(parts));
|
33771
33525
|
}
|
33772
33526
|
encode(value) {
|
33773
33527
|
const parts = [];
|
@@ -33814,7 +33568,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
33814
33568
|
var getMintedAssetId = (contractId, subId) => {
|
33815
33569
|
const contractIdBytes = arrayify(contractId);
|
33816
33570
|
const subIdBytes = arrayify(subId);
|
33817
|
-
return
|
33571
|
+
return sha2562(concat([contractIdBytes, subIdBytes]));
|
33818
33572
|
};
|
33819
33573
|
var ReceiptMintCoder = class extends Coder {
|
33820
33574
|
constructor() {
|
@@ -34428,7 +34182,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
34428
34182
|
numberToBytesLE: () => numberToBytesLE,
|
34429
34183
|
numberToHexUnpadded: () => numberToHexUnpadded,
|
34430
34184
|
numberToVarBytesBE: () => numberToVarBytesBE,
|
34431
|
-
utf8ToBytes: () =>
|
34185
|
+
utf8ToBytes: () => utf8ToBytes2,
|
34432
34186
|
validateObject: () => validateObject
|
34433
34187
|
});
|
34434
34188
|
var _0n2 = BigInt(0);
|
@@ -34437,13 +34191,13 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
34437
34191
|
function isBytes3(a) {
|
34438
34192
|
return a instanceof Uint8Array || a != null && typeof a === "object" && a.constructor.name === "Uint8Array";
|
34439
34193
|
}
|
34440
|
-
var
|
34441
|
-
function bytesToHex(
|
34442
|
-
if (!isBytes3(
|
34194
|
+
var hexes = /* @__PURE__ */ Array.from({ length: 256 }, (_, i) => i.toString(16).padStart(2, "0"));
|
34195
|
+
function bytesToHex(bytes2) {
|
34196
|
+
if (!isBytes3(bytes2))
|
34443
34197
|
throw new Error("Uint8Array expected");
|
34444
34198
|
let hex = "";
|
34445
|
-
for (let i = 0; i <
|
34446
|
-
hex +=
|
34199
|
+
for (let i = 0; i < bytes2.length; i++) {
|
34200
|
+
hex += hexes[bytes2[i]];
|
34447
34201
|
}
|
34448
34202
|
return hex;
|
34449
34203
|
}
|
@@ -34485,13 +34239,13 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
34485
34239
|
}
|
34486
34240
|
return array;
|
34487
34241
|
}
|
34488
|
-
function bytesToNumberBE(
|
34489
|
-
return hexToNumber(bytesToHex(
|
34242
|
+
function bytesToNumberBE(bytes2) {
|
34243
|
+
return hexToNumber(bytesToHex(bytes2));
|
34490
34244
|
}
|
34491
|
-
function bytesToNumberLE(
|
34492
|
-
if (!isBytes3(
|
34245
|
+
function bytesToNumberLE(bytes2) {
|
34246
|
+
if (!isBytes3(bytes2))
|
34493
34247
|
throw new Error("Uint8Array expected");
|
34494
|
-
return hexToNumber(bytesToHex(Uint8Array.from(
|
34248
|
+
return hexToNumber(bytesToHex(Uint8Array.from(bytes2).reverse()));
|
34495
34249
|
}
|
34496
34250
|
function numberToBytesBE(n, len) {
|
34497
34251
|
return hexToBytes(n.toString(16).padStart(len * 2, "0"));
|
@@ -34545,7 +34299,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
34545
34299
|
diff |= a[i] ^ b[i];
|
34546
34300
|
return diff === 0;
|
34547
34301
|
}
|
34548
|
-
function
|
34302
|
+
function utf8ToBytes2(str) {
|
34549
34303
|
if (typeof str !== "string")
|
34550
34304
|
throw new Error(`utf8ToBytes expected string, got ${typeof str}`);
|
34551
34305
|
return new Uint8Array(new TextEncoder().encode(str));
|
@@ -34864,19 +34618,19 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
34864
34618
|
return "GraphQLError";
|
34865
34619
|
}
|
34866
34620
|
toString() {
|
34867
|
-
let
|
34621
|
+
let output2 = this.message;
|
34868
34622
|
if (this.nodes) {
|
34869
34623
|
for (const node of this.nodes) {
|
34870
34624
|
if (node.loc) {
|
34871
|
-
|
34625
|
+
output2 += "\n\n" + printLocation(node.loc);
|
34872
34626
|
}
|
34873
34627
|
}
|
34874
34628
|
} else if (this.source && this.locations) {
|
34875
34629
|
for (const location of this.locations) {
|
34876
|
-
|
34630
|
+
output2 += "\n\n" + printSourceLocation(this.source, location);
|
34877
34631
|
}
|
34878
34632
|
}
|
34879
|
-
return
|
34633
|
+
return output2;
|
34880
34634
|
}
|
34881
34635
|
toJSON() {
|
34882
34636
|
const formattedError = {
|
@@ -38890,13 +38644,13 @@ ${MessageCoinFragmentDoc}`;
|
|
38890
38644
|
return {
|
38891
38645
|
type: InputType.Coin,
|
38892
38646
|
txID: hexlify(arrayify(value.id).slice(0, BYTES_32)),
|
38893
|
-
outputIndex:
|
38647
|
+
outputIndex: toNumber(arrayify(value.id).slice(BYTES_32, UTXO_ID_LEN)),
|
38894
38648
|
owner: hexlify(value.owner),
|
38895
38649
|
amount: bn(value.amount),
|
38896
38650
|
assetId: hexlify(value.assetId),
|
38897
38651
|
txPointer: {
|
38898
|
-
blockHeight:
|
38899
|
-
txIndex:
|
38652
|
+
blockHeight: toNumber(arrayify(value.txPointer).slice(0, 8)),
|
38653
|
+
txIndex: toNumber(arrayify(value.txPointer).slice(8, 16))
|
38900
38654
|
},
|
38901
38655
|
witnessIndex: value.witnessIndex,
|
38902
38656
|
predicateGasUsed: bn(value.predicateGasUsed),
|
@@ -38914,8 +38668,8 @@ ${MessageCoinFragmentDoc}`;
|
|
38914
38668
|
balanceRoot: ZeroBytes32,
|
38915
38669
|
stateRoot: ZeroBytes32,
|
38916
38670
|
txPointer: {
|
38917
|
-
blockHeight:
|
38918
|
-
txIndex:
|
38671
|
+
blockHeight: toNumber(arrayify(value.txPointer).slice(0, 8)),
|
38672
|
+
txIndex: toNumber(arrayify(value.txPointer).slice(8, 16))
|
38919
38673
|
},
|
38920
38674
|
contractID: hexlify(value.contractId)
|
38921
38675
|
};
|
@@ -39451,15 +39205,6 @@ ${MessageCoinFragmentDoc}`;
|
|
39451
39205
|
return normalize2(clone_default(root));
|
39452
39206
|
}
|
39453
39207
|
|
39454
|
-
// src/providers/utils/sleep.ts
|
39455
|
-
function sleep(time) {
|
39456
|
-
return new Promise((resolve) => {
|
39457
|
-
setTimeout(() => {
|
39458
|
-
resolve(true);
|
39459
|
-
}, time);
|
39460
|
-
});
|
39461
|
-
}
|
39462
|
-
|
39463
39208
|
// src/providers/utils/extract-tx-error.ts
|
39464
39209
|
var assemblePanicError = (status) => {
|
39465
39210
|
let errorMessage = `The transaction reverted with reason: "${status.reason}".`;
|
@@ -39707,8 +39452,8 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
39707
39452
|
*
|
39708
39453
|
* Pushes an output to the list without any side effects and returns the index
|
39709
39454
|
*/
|
39710
|
-
pushOutput(
|
39711
|
-
this.outputs.push(
|
39455
|
+
pushOutput(output2) {
|
39456
|
+
this.outputs.push(output2);
|
39712
39457
|
return this.outputs.length - 1;
|
39713
39458
|
}
|
39714
39459
|
/**
|
@@ -39792,7 +39537,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
39792
39537
|
*/
|
39793
39538
|
getCoinOutputs() {
|
39794
39539
|
return this.outputs.filter(
|
39795
|
-
(
|
39540
|
+
(output2) => output2.type === OutputType.Coin
|
39796
39541
|
);
|
39797
39542
|
}
|
39798
39543
|
/**
|
@@ -39802,7 +39547,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
39802
39547
|
*/
|
39803
39548
|
getChangeOutputs() {
|
39804
39549
|
return this.outputs.filter(
|
39805
|
-
(
|
39550
|
+
(output2) => output2.type === OutputType.Change
|
39806
39551
|
);
|
39807
39552
|
}
|
39808
39553
|
/**
|
@@ -39950,7 +39695,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
39950
39695
|
*/
|
39951
39696
|
addChangeOutput(to, assetId) {
|
39952
39697
|
const changeOutput = this.getChangeOutputs().find(
|
39953
|
-
(
|
39698
|
+
(output2) => hexlify(output2.assetId) === assetId
|
39954
39699
|
);
|
39955
39700
|
if (!changeOutput) {
|
39956
39701
|
this.pushOutput({
|
@@ -40148,8 +39893,8 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
40148
39893
|
return inputClone;
|
40149
39894
|
}
|
40150
39895
|
});
|
40151
|
-
transaction.outputs = transaction.outputs.map((
|
40152
|
-
const outputClone = clone_default(
|
39896
|
+
transaction.outputs = transaction.outputs.map((output2) => {
|
39897
|
+
const outputClone = clone_default(output2);
|
40153
39898
|
switch (outputClone.type) {
|
40154
39899
|
case OutputType.Contract: {
|
40155
39900
|
outputClone.balanceRoot = ZeroBytes32;
|
@@ -40174,7 +39919,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
40174
39919
|
transaction.witnesses = [];
|
40175
39920
|
const chainIdBytes = uint64ToBytesBE(chainId);
|
40176
39921
|
const concatenatedData = concat([chainIdBytes, new TransactionCoder().encode(transaction)]);
|
40177
|
-
return
|
39922
|
+
return sha2562(concatenatedData);
|
40178
39923
|
}
|
40179
39924
|
|
40180
39925
|
// src/providers/transaction-request/storage-slot.ts
|
@@ -40251,7 +39996,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
40251
39996
|
*/
|
40252
39997
|
getContractCreatedOutputs() {
|
40253
39998
|
return this.outputs.filter(
|
40254
|
-
(
|
39999
|
+
(output2) => output2.type === OutputType.ContractCreated
|
40255
40000
|
);
|
40256
40001
|
}
|
40257
40002
|
/**
|
@@ -40377,7 +40122,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
40377
40122
|
*/
|
40378
40123
|
getContractOutputs() {
|
40379
40124
|
return this.outputs.filter(
|
40380
|
-
(
|
40125
|
+
(output2) => output2.type === OutputType.Contract
|
40381
40126
|
);
|
40382
40127
|
}
|
40383
40128
|
/**
|
@@ -40387,7 +40132,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
40387
40132
|
*/
|
40388
40133
|
getVariableOutputs() {
|
40389
40134
|
return this.outputs.filter(
|
40390
|
-
(
|
40135
|
+
(output2) => output2.type === OutputType.Variable
|
40391
40136
|
);
|
40392
40137
|
}
|
40393
40138
|
/**
|
@@ -40862,8 +40607,8 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
40862
40607
|
}) {
|
40863
40608
|
const contractCallReceipts = getReceiptsCall(receipts);
|
40864
40609
|
const contractOutputs = getOutputsContract(outputs);
|
40865
|
-
const contractCallOperations = contractOutputs.reduce((prevOutputCallOps,
|
40866
|
-
const contractInput = getInputContractFromIndex(inputs,
|
40610
|
+
const contractCallOperations = contractOutputs.reduce((prevOutputCallOps, output2) => {
|
40611
|
+
const contractInput = getInputContractFromIndex(inputs, output2.inputIndex);
|
40867
40612
|
if (contractInput) {
|
40868
40613
|
const newCallOps = contractCallReceipts.reduce((prevContractCallOps, receipt) => {
|
40869
40614
|
if (receipt.to === contractInput.contractID) {
|
@@ -40917,7 +40662,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
40917
40662
|
let { from: fromAddress } = receipt;
|
40918
40663
|
const toType = contractInputs.some((input) => input.contractID === toAddress) ? 0 /* contract */ : 1 /* account */;
|
40919
40664
|
if (ZeroBytes32 === fromAddress) {
|
40920
|
-
const change = changeOutputs.find((
|
40665
|
+
const change = changeOutputs.find((output2) => output2.assetId === assetId);
|
40921
40666
|
fromAddress = change?.to || fromAddress;
|
40922
40667
|
}
|
40923
40668
|
const fromType = contractInputs.some((input) => input.contractID === fromAddress) ? 0 /* contract */ : 1 /* account */;
|
@@ -40948,8 +40693,8 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
40948
40693
|
const coinOutputs = getOutputsCoin(outputs);
|
40949
40694
|
const contractInputs = getInputsContract(inputs);
|
40950
40695
|
const changeOutputs = getOutputsChange(outputs);
|
40951
|
-
coinOutputs.forEach((
|
40952
|
-
const { amount, assetId, to } =
|
40696
|
+
coinOutputs.forEach((output2) => {
|
40697
|
+
const { amount, assetId, to } = output2;
|
40953
40698
|
const changeOutput = changeOutputs.find((change) => change.assetId === assetId);
|
40954
40699
|
if (changeOutput) {
|
40955
40700
|
operations = addOperation(operations, {
|
@@ -40987,7 +40732,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
40987
40732
|
}
|
40988
40733
|
function getPayProducerOperations(outputs) {
|
40989
40734
|
const coinOutputs = getOutputsCoin(outputs);
|
40990
|
-
const payProducerOperations = coinOutputs.reduce((prev,
|
40735
|
+
const payProducerOperations = coinOutputs.reduce((prev, output2) => {
|
40991
40736
|
const operations = addOperation(prev, {
|
40992
40737
|
name: "Pay network fee to block producer" /* payBlockProducer */,
|
40993
40738
|
from: {
|
@@ -40996,12 +40741,12 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
40996
40741
|
},
|
40997
40742
|
to: {
|
40998
40743
|
type: 1 /* account */,
|
40999
|
-
address:
|
40744
|
+
address: output2.to.toString()
|
41000
40745
|
},
|
41001
40746
|
assetsSent: [
|
41002
40747
|
{
|
41003
|
-
assetId:
|
41004
|
-
amount:
|
40748
|
+
assetId: output2.assetId.toString(),
|
40749
|
+
amount: output2.amount
|
41005
40750
|
}
|
41006
40751
|
]
|
41007
40752
|
});
|
@@ -42727,11 +42472,11 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
42727
42472
|
maxGasPerTx,
|
42728
42473
|
gasPrice
|
42729
42474
|
});
|
42730
|
-
const
|
42475
|
+
const output2 = {
|
42731
42476
|
gqlTransaction,
|
42732
42477
|
...transactionSummary
|
42733
42478
|
};
|
42734
|
-
return
|
42479
|
+
return output2;
|
42735
42480
|
});
|
42736
42481
|
return {
|
42737
42482
|
transactions,
|
@@ -43389,11 +43134,11 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
43389
43134
|
}
|
43390
43135
|
return res;
|
43391
43136
|
}
|
43392
|
-
function invert(
|
43393
|
-
if (
|
43394
|
-
throw new Error(`invert: expected positive integers, got n=${
|
43137
|
+
function invert(number2, modulo) {
|
43138
|
+
if (number2 === _0n3 || modulo <= _0n3) {
|
43139
|
+
throw new Error(`invert: expected positive integers, got n=${number2} mod=${modulo}`);
|
43395
43140
|
}
|
43396
|
-
let a = mod(
|
43141
|
+
let a = mod(number2, modulo);
|
43397
43142
|
let b = modulo;
|
43398
43143
|
let x = _0n3, y = _1n3, u = _1n3, v = _0n3;
|
43399
43144
|
while (a !== _0n3) {
|
@@ -43548,7 +43293,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
43548
43293
|
const nByteLength = Math.ceil(_nBitLength / 8);
|
43549
43294
|
return { nBitLength: _nBitLength, nByteLength };
|
43550
43295
|
}
|
43551
|
-
function Field(ORDER, bitLen2,
|
43296
|
+
function Field(ORDER, bitLen2, isLE2 = false, redef = {}) {
|
43552
43297
|
if (ORDER <= _0n3)
|
43553
43298
|
throw new Error(`Expected Field ORDER > 0, got ${ORDER}`);
|
43554
43299
|
const { nBitLength: BITS, nByteLength: BYTES } = nLength(ORDER, bitLen2);
|
@@ -43589,11 +43334,11 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
43589
43334
|
// TODO: do we really need constant cmov?
|
43590
43335
|
// We don't have const-time bigints anyway, so probably will be not very useful
|
43591
43336
|
cmov: (a, b, c) => c ? b : a,
|
43592
|
-
toBytes: (num) =>
|
43593
|
-
fromBytes: (
|
43594
|
-
if (
|
43595
|
-
throw new Error(`Fp.fromBytes: expected ${BYTES}, got ${
|
43596
|
-
return
|
43337
|
+
toBytes: (num) => isLE2 ? numberToBytesLE(num, BYTES) : numberToBytesBE(num, BYTES),
|
43338
|
+
fromBytes: (bytes2) => {
|
43339
|
+
if (bytes2.length !== BYTES)
|
43340
|
+
throw new Error(`Fp.fromBytes: expected ${BYTES}, got ${bytes2.length}`);
|
43341
|
+
return isLE2 ? bytesToNumberLE(bytes2) : bytesToNumberBE(bytes2);
|
43597
43342
|
}
|
43598
43343
|
});
|
43599
43344
|
return Object.freeze(f2);
|
@@ -43608,15 +43353,15 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
43608
43353
|
const length = getFieldBytesLength(fieldOrder);
|
43609
43354
|
return length + Math.ceil(length / 2);
|
43610
43355
|
}
|
43611
|
-
function mapHashToField(key, fieldOrder,
|
43356
|
+
function mapHashToField(key, fieldOrder, isLE2 = false) {
|
43612
43357
|
const len = key.length;
|
43613
43358
|
const fieldLen = getFieldBytesLength(fieldOrder);
|
43614
43359
|
const minLen = getMinHashLength(fieldOrder);
|
43615
43360
|
if (len < 16 || len < minLen || len > 1024)
|
43616
43361
|
throw new Error(`expected ${minLen}-1024 bytes of input, got ${len}`);
|
43617
|
-
const num =
|
43362
|
+
const num = isLE2 ? bytesToNumberBE(key) : bytesToNumberLE(key);
|
43618
43363
|
const reduced = mod(num, fieldOrder - _1n3) + _1n3;
|
43619
|
-
return
|
43364
|
+
return isLE2 ? numberToBytesLE(reduced, fieldLen) : numberToBytesBE(reduced, fieldLen);
|
43620
43365
|
}
|
43621
43366
|
|
43622
43367
|
// ../../node_modules/.pnpm/@noble+curves@1.3.0/node_modules/@noble/curves/esm/abstract/curve.js
|
@@ -43824,12 +43569,12 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
43824
43569
|
function weierstrassPoints(opts) {
|
43825
43570
|
const CURVE = validatePointOpts(opts);
|
43826
43571
|
const { Fp: Fp2 } = CURVE;
|
43827
|
-
const
|
43572
|
+
const toBytes3 = CURVE.toBytes || ((_c, point, _isCompressed) => {
|
43828
43573
|
const a = point.toAffine();
|
43829
43574
|
return concatBytes3(Uint8Array.from([4]), Fp2.toBytes(a.x), Fp2.toBytes(a.y));
|
43830
43575
|
});
|
43831
|
-
const fromBytes = CURVE.fromBytes || ((
|
43832
|
-
const tail =
|
43576
|
+
const fromBytes = CURVE.fromBytes || ((bytes2) => {
|
43577
|
+
const tail = bytes2.subarray(1);
|
43833
43578
|
const x = Fp2.fromBytes(tail.subarray(0, Fp2.BYTES));
|
43834
43579
|
const y = Fp2.fromBytes(tail.subarray(Fp2.BYTES, 2 * Fp2.BYTES));
|
43835
43580
|
return { x, y };
|
@@ -44192,7 +43937,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
44192
43937
|
}
|
44193
43938
|
toRawBytes(isCompressed = true) {
|
44194
43939
|
this.assertValidity();
|
44195
|
-
return
|
43940
|
+
return toBytes3(Point2, this, isCompressed);
|
44196
43941
|
}
|
44197
43942
|
toHex(isCompressed = true) {
|
44198
43943
|
return bytesToHex(this.toRawBytes(isCompressed));
|
@@ -44249,10 +43994,10 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
44249
43994
|
return cat(Uint8Array.from([4]), x, Fp2.toBytes(a.y));
|
44250
43995
|
}
|
44251
43996
|
},
|
44252
|
-
fromBytes(
|
44253
|
-
const len =
|
44254
|
-
const head =
|
44255
|
-
const tail =
|
43997
|
+
fromBytes(bytes2) {
|
43998
|
+
const len = bytes2.length;
|
43999
|
+
const head = bytes2[0];
|
44000
|
+
const tail = bytes2.subarray(1);
|
44256
44001
|
if (len === compressedLen && (head === 2 || head === 3)) {
|
44257
44002
|
const x = bytesToNumberBE(tail);
|
44258
44003
|
if (!isValidFieldElement(x))
|
@@ -44274,15 +44019,15 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
44274
44019
|
}
|
44275
44020
|
});
|
44276
44021
|
const numToNByteStr = (num) => bytesToHex(numberToBytesBE(num, CURVE.nByteLength));
|
44277
|
-
function isBiggerThanHalfOrder(
|
44022
|
+
function isBiggerThanHalfOrder(number2) {
|
44278
44023
|
const HALF = CURVE_ORDER >> _1n5;
|
44279
|
-
return
|
44024
|
+
return number2 > HALF;
|
44280
44025
|
}
|
44281
44026
|
function normalizeS(s) {
|
44282
44027
|
return isBiggerThanHalfOrder(s) ? modN(-s) : s;
|
44283
44028
|
}
|
44284
44029
|
const slcNum = (b, from, to) => bytesToNumberBE(b.slice(from, to));
|
44285
|
-
class
|
44030
|
+
class Signature {
|
44286
44031
|
constructor(r, s, recovery) {
|
44287
44032
|
this.r = r;
|
44288
44033
|
this.s = s;
|
@@ -44293,13 +44038,13 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
44293
44038
|
static fromCompact(hex) {
|
44294
44039
|
const l = CURVE.nByteLength;
|
44295
44040
|
hex = ensureBytes("compactSignature", hex, l * 2);
|
44296
|
-
return new
|
44041
|
+
return new Signature(slcNum(hex, 0, l), slcNum(hex, l, 2 * l));
|
44297
44042
|
}
|
44298
44043
|
// DER encoded ECDSA signature
|
44299
44044
|
// https://bitcoin.stackexchange.com/questions/57644/what-are-the-parts-of-a-bitcoin-transaction-input-script
|
44300
44045
|
static fromDER(hex) {
|
44301
44046
|
const { r, s } = DER.toSig(ensureBytes("DER", hex));
|
44302
|
-
return new
|
44047
|
+
return new Signature(r, s);
|
44303
44048
|
}
|
44304
44049
|
assertValidity() {
|
44305
44050
|
if (!isWithinCurveOrder(this.r))
|
@@ -44308,7 +44053,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
44308
44053
|
throw new Error("s must be 0 < s < CURVE.n");
|
44309
44054
|
}
|
44310
44055
|
addRecoveryBit(recovery) {
|
44311
|
-
return new
|
44056
|
+
return new Signature(this.r, this.s, recovery);
|
44312
44057
|
}
|
44313
44058
|
recoverPublicKey(msgHash) {
|
44314
44059
|
const { r, s, recovery: rec } = this;
|
@@ -44334,7 +44079,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
44334
44079
|
return isBiggerThanHalfOrder(this.s);
|
44335
44080
|
}
|
44336
44081
|
normalizeS() {
|
44337
|
-
return this.hasHighS() ? new
|
44082
|
+
return this.hasHighS() ? new Signature(this.r, modN(-this.s), this.recovery) : this;
|
44338
44083
|
}
|
44339
44084
|
// DER-encoded
|
44340
44085
|
toDERRawBytes() {
|
@@ -44406,13 +44151,13 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
44406
44151
|
const b = Point2.fromHex(publicB);
|
44407
44152
|
return b.multiply(normPrivateKeyToScalar(privateA)).toRawBytes(isCompressed);
|
44408
44153
|
}
|
44409
|
-
const bits2int = CURVE.bits2int || function(
|
44410
|
-
const num = bytesToNumberBE(
|
44411
|
-
const delta =
|
44154
|
+
const bits2int = CURVE.bits2int || function(bytes2) {
|
44155
|
+
const num = bytesToNumberBE(bytes2);
|
44156
|
+
const delta = bytes2.length * 8 - CURVE.nBitLength;
|
44412
44157
|
return delta > 0 ? num >> BigInt(delta) : num;
|
44413
44158
|
};
|
44414
|
-
const bits2int_modN = CURVE.bits2int_modN || function(
|
44415
|
-
return modN(bits2int(
|
44159
|
+
const bits2int_modN = CURVE.bits2int_modN || function(bytes2) {
|
44160
|
+
return modN(bits2int(bytes2));
|
44416
44161
|
};
|
44417
44162
|
const ORDER_MASK = bitMask(CURVE.nBitLength);
|
44418
44163
|
function int2octets(num) {
|
@@ -44425,18 +44170,18 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
44425
44170
|
function prepSig(msgHash, privateKey, opts = defaultSigOpts) {
|
44426
44171
|
if (["recovered", "canonical"].some((k) => k in opts))
|
44427
44172
|
throw new Error("sign() legacy options not supported");
|
44428
|
-
const { hash:
|
44173
|
+
const { hash: hash3, randomBytes: randomBytes3 } = CURVE;
|
44429
44174
|
let { lowS, prehash, extraEntropy: ent } = opts;
|
44430
44175
|
if (lowS == null)
|
44431
44176
|
lowS = true;
|
44432
44177
|
msgHash = ensureBytes("msgHash", msgHash);
|
44433
44178
|
if (prehash)
|
44434
|
-
msgHash = ensureBytes("prehashed msgHash",
|
44179
|
+
msgHash = ensureBytes("prehashed msgHash", hash3(msgHash));
|
44435
44180
|
const h1int = bits2int_modN(msgHash);
|
44436
44181
|
const d = normPrivateKeyToScalar(privateKey);
|
44437
44182
|
const seedArgs = [int2octets(d), int2octets(h1int)];
|
44438
44183
|
if (ent != null) {
|
44439
|
-
const e = ent === true ?
|
44184
|
+
const e = ent === true ? randomBytes3(Fp2.BYTES) : ent;
|
44440
44185
|
seedArgs.push(ensureBytes("extraEntropy", e));
|
44441
44186
|
}
|
44442
44187
|
const seed = concatBytes3(...seedArgs);
|
@@ -44459,7 +44204,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
44459
44204
|
normS = normalizeS(s);
|
44460
44205
|
recovery ^= 1;
|
44461
44206
|
}
|
44462
|
-
return new
|
44207
|
+
return new Signature(r, normS, recovery);
|
44463
44208
|
}
|
44464
44209
|
return { seed, k2sig };
|
44465
44210
|
}
|
@@ -44484,15 +44229,15 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
44484
44229
|
try {
|
44485
44230
|
if (typeof sg === "string" || isBytes3(sg)) {
|
44486
44231
|
try {
|
44487
|
-
_sig =
|
44232
|
+
_sig = Signature.fromDER(sg);
|
44488
44233
|
} catch (derError) {
|
44489
44234
|
if (!(derError instanceof DER.Err))
|
44490
44235
|
throw derError;
|
44491
|
-
_sig =
|
44236
|
+
_sig = Signature.fromCompact(sg);
|
44492
44237
|
}
|
44493
44238
|
} else if (typeof sg === "object" && typeof sg.r === "bigint" && typeof sg.s === "bigint") {
|
44494
44239
|
const { r: r2, s: s2 } = sg;
|
44495
|
-
_sig = new
|
44240
|
+
_sig = new Signature(r2, s2);
|
44496
44241
|
} else {
|
44497
44242
|
throw new Error("PARSE");
|
44498
44243
|
}
|
@@ -44524,21 +44269,21 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
44524
44269
|
sign,
|
44525
44270
|
verify,
|
44526
44271
|
ProjectivePoint: Point2,
|
44527
|
-
Signature
|
44272
|
+
Signature,
|
44528
44273
|
utils
|
44529
44274
|
};
|
44530
44275
|
}
|
44531
44276
|
|
44532
44277
|
// ../../node_modules/.pnpm/@noble+curves@1.3.0/node_modules/@noble/curves/esm/_shortw_utils.js
|
44533
|
-
function getHash(
|
44278
|
+
function getHash(hash3) {
|
44534
44279
|
return {
|
44535
|
-
hash:
|
44536
|
-
hmac: (key, ...msgs) => hmac(
|
44280
|
+
hash: hash3,
|
44281
|
+
hmac: (key, ...msgs) => hmac(hash3, key, concatBytes(...msgs)),
|
44537
44282
|
randomBytes
|
44538
44283
|
};
|
44539
44284
|
}
|
44540
44285
|
function createCurve(curveDef, defHash) {
|
44541
|
-
const create = (
|
44286
|
+
const create = (hash3) => weierstrass({ ...curveDef, ...getHash(hash3) });
|
44542
44287
|
return Object.freeze({ ...create(defHash), create });
|
44543
44288
|
}
|
44544
44289
|
|
@@ -44640,7 +44385,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
44640
44385
|
privateKey = `0x${privateKey}`;
|
44641
44386
|
}
|
44642
44387
|
}
|
44643
|
-
const privateKeyBytes =
|
44388
|
+
const privateKeyBytes = toBytes2(privateKey, 32);
|
44644
44389
|
this.privateKey = hexlify(privateKeyBytes);
|
44645
44390
|
this.publicKey = hexlify(secp256k1.getPublicKey(privateKeyBytes, false).slice(1));
|
44646
44391
|
this.compressedPublicKey = hexlify(secp256k1.getPublicKey(privateKeyBytes, true));
|
@@ -44658,8 +44403,8 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
44658
44403
|
*/
|
44659
44404
|
sign(data) {
|
44660
44405
|
const signature = secp256k1.sign(arrayify(data), arrayify(this.privateKey));
|
44661
|
-
const r =
|
44662
|
-
const s =
|
44406
|
+
const r = toBytes2(`0x${signature.r.toString(16)}`, 32);
|
44407
|
+
const s = toBytes2(`0x${signature.s.toString(16)}`, 32);
|
44663
44408
|
s[0] |= (signature.recovery || 0) << 7;
|
44664
44409
|
return hexlify(concat([r, s]));
|
44665
44410
|
}
|
@@ -44711,7 +44456,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
44711
44456
|
* @returns random 32-byte hashed
|
44712
44457
|
*/
|
44713
44458
|
static generatePrivateKey(entropy) {
|
44714
|
-
return entropy ?
|
44459
|
+
return entropy ? hash2(concat([randomBytes22(32), arrayify(entropy)])) : randomBytes22(32);
|
44715
44460
|
}
|
44716
44461
|
/**
|
44717
44462
|
* Extended publicKey from a compact publicKey
|
@@ -44726,12 +44471,12 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
44726
44471
|
};
|
44727
44472
|
|
44728
44473
|
// ../../node_modules/.pnpm/uuid@9.0.0/node_modules/uuid/dist/esm-node/rng.js
|
44729
|
-
var
|
44474
|
+
var import_crypto12 = __toESM(__require("crypto"));
|
44730
44475
|
var rnds8Pool = new Uint8Array(256);
|
44731
44476
|
var poolPtr = rnds8Pool.length;
|
44732
44477
|
function rng() {
|
44733
44478
|
if (poolPtr > rnds8Pool.length - 16) {
|
44734
|
-
|
44479
|
+
import_crypto12.default.randomFillSync(rnds8Pool);
|
44735
44480
|
poolPtr = 0;
|
44736
44481
|
}
|
44737
44482
|
return rnds8Pool.slice(poolPtr, poolPtr += 16);
|
@@ -44747,9 +44492,9 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
44747
44492
|
}
|
44748
44493
|
|
44749
44494
|
// ../../node_modules/.pnpm/uuid@9.0.0/node_modules/uuid/dist/esm-node/native.js
|
44750
|
-
var
|
44495
|
+
var import_crypto13 = __toESM(__require("crypto"));
|
44751
44496
|
var native_default = {
|
44752
|
-
randomUUID:
|
44497
|
+
randomUUID: import_crypto13.default.randomUUID
|
44753
44498
|
};
|
44754
44499
|
|
44755
44500
|
// ../../node_modules/.pnpm/uuid@9.0.0/node_modules/uuid/dist/esm-node/v4.js
|
@@ -44799,7 +44544,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
44799
44544
|
const iv = randomBytes22(DEFAULT_IV_SIZE);
|
44800
44545
|
const ciphertext = await encryptJsonWalletData2(privateKeyBuffer, key, iv);
|
44801
44546
|
const data = Uint8Array.from([...key.subarray(16, 32), ...ciphertext]);
|
44802
|
-
const macHashUint8Array =
|
44547
|
+
const macHashUint8Array = keccak2562(data);
|
44803
44548
|
const mac = stringFromBuffer2(macHashUint8Array, "hex");
|
44804
44549
|
const keystore = {
|
44805
44550
|
id: v4_default(),
|
@@ -44845,7 +44590,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
44845
44590
|
dklen
|
44846
44591
|
});
|
44847
44592
|
const data = Uint8Array.from([...key.subarray(16, 32), ...ciphertextBuffer]);
|
44848
|
-
const macHashUint8Array =
|
44593
|
+
const macHashUint8Array = keccak2562(data);
|
44849
44594
|
const macHash = stringFromBuffer2(macHashUint8Array, "hex");
|
44850
44595
|
if (mac !== macHash) {
|
44851
44596
|
throw new FuelError(
|
@@ -47095,7 +46840,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
47095
46840
|
}
|
47096
46841
|
}
|
47097
46842
|
const checksumBits = entropy.length / 4;
|
47098
|
-
const checksum = arrayify(
|
46843
|
+
const checksum = arrayify(sha2562(entropy))[0] & getUpperMask(checksumBits);
|
47099
46844
|
indices[indices.length - 1] <<= checksumBits;
|
47100
46845
|
indices[indices.length - 1] |= checksum >> 8 - checksumBits;
|
47101
46846
|
return indices;
|
@@ -47122,7 +46867,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
47122
46867
|
const entropyBits = 32 * words.length / 3;
|
47123
46868
|
const checksumBits = words.length / 3;
|
47124
46869
|
const checksumMask = getUpperMask(checksumBits);
|
47125
|
-
const checksum = arrayify(
|
46870
|
+
const checksum = arrayify(sha2562(entropy.slice(0, entropyBits / 8)))[0] & checksumMask;
|
47126
46871
|
if (checksum !== (entropy[entropy.length - 1] & checksumMask)) {
|
47127
46872
|
throw new FuelError(
|
47128
46873
|
ErrorCode.INVALID_CHECKSUM,
|
@@ -47219,7 +46964,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
47219
46964
|
assertMnemonic(getWords(phrase));
|
47220
46965
|
const phraseBytes = toUtf8Bytes2(getPhrase(phrase));
|
47221
46966
|
const salt = toUtf8Bytes2(`mnemonic${passphrase}`);
|
47222
|
-
return
|
46967
|
+
return pbkdf222(phraseBytes, salt, 2048, 64, "sha512");
|
47223
46968
|
}
|
47224
46969
|
/**
|
47225
46970
|
* @param phrase - Mnemonic phrase composed by words from the provided wordlist
|
@@ -47281,7 +47026,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
47281
47026
|
`Seed length should be between 16 and 64 bytes, but received ${seedArray.length} bytes.`
|
47282
47027
|
);
|
47283
47028
|
}
|
47284
|
-
return arrayify(
|
47029
|
+
return arrayify(computeHmac2("sha512", MasterSecret, seedArray));
|
47285
47030
|
}
|
47286
47031
|
/**
|
47287
47032
|
* Get the extendKey as defined on BIP-32 from the provided seed
|
@@ -47306,7 +47051,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
47306
47051
|
chainCode,
|
47307
47052
|
concat(["0x00", privateKey])
|
47308
47053
|
]);
|
47309
|
-
const checksum = dataSlice(
|
47054
|
+
const checksum = dataSlice(sha2562(sha2562(extendedKey)), 0, 4);
|
47310
47055
|
return encodeBase58(concat([extendedKey, checksum]));
|
47311
47056
|
}
|
47312
47057
|
/**
|
@@ -47322,7 +47067,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
47322
47067
|
* @returns A randomly generated mnemonic
|
47323
47068
|
*/
|
47324
47069
|
static generate(size = 32, extraEntropy = "") {
|
47325
|
-
const entropy = extraEntropy ?
|
47070
|
+
const entropy = extraEntropy ? sha2562(concat([randomBytes22(size), arrayify(extraEntropy)])) : randomBytes22(size);
|
47326
47071
|
return Mnemonic.entropyToMnemonic(entropy);
|
47327
47072
|
}
|
47328
47073
|
};
|
@@ -47335,7 +47080,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
47335
47080
|
var TestnetPRV2 = hexlify("0x04358394");
|
47336
47081
|
var TestnetPUB = hexlify("0x043587cf");
|
47337
47082
|
function base58check(data) {
|
47338
|
-
return encodeBase58(concat([data, dataSlice(
|
47083
|
+
return encodeBase58(concat([data, dataSlice(sha2562(sha2562(data)), 0, 4)]));
|
47339
47084
|
}
|
47340
47085
|
function getExtendedKeyPrefix(isPublic = false, testnet = false) {
|
47341
47086
|
if (isPublic) {
|
@@ -47391,7 +47136,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
47391
47136
|
this.publicKey = hexlify(config.publicKey);
|
47392
47137
|
}
|
47393
47138
|
this.parentFingerprint = config.parentFingerprint || this.parentFingerprint;
|
47394
|
-
this.fingerprint = dataSlice(
|
47139
|
+
this.fingerprint = dataSlice(ripemd16022(sha2562(this.publicKey)), 0, 4);
|
47395
47140
|
this.depth = config.depth || this.depth;
|
47396
47141
|
this.index = config.index || this.index;
|
47397
47142
|
this.chainCode = config.chainCode;
|
@@ -47422,10 +47167,10 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
47422
47167
|
} else {
|
47423
47168
|
data.set(arrayify(this.publicKey));
|
47424
47169
|
}
|
47425
|
-
data.set(
|
47426
|
-
const
|
47427
|
-
const IL =
|
47428
|
-
const IR =
|
47170
|
+
data.set(toBytes2(index, 4), 33);
|
47171
|
+
const bytes2 = arrayify(computeHmac2("sha512", chainCode, data));
|
47172
|
+
const IL = bytes2.slice(0, 32);
|
47173
|
+
const IR = bytes2.slice(32);
|
47429
47174
|
if (privateKey) {
|
47430
47175
|
const N = "0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141";
|
47431
47176
|
const ki = bn(IL).add(privateKey).mod(N).toBytes(32);
|
@@ -47494,27 +47239,27 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
47494
47239
|
});
|
47495
47240
|
}
|
47496
47241
|
static fromExtendedKey(extendedKey) {
|
47497
|
-
const decoded =
|
47498
|
-
const
|
47499
|
-
const validChecksum = base58check(
|
47500
|
-
if (
|
47242
|
+
const decoded = hexlify(toBytes2(decodeBase58(extendedKey)));
|
47243
|
+
const bytes2 = arrayify(decoded);
|
47244
|
+
const validChecksum = base58check(bytes2.slice(0, 78)) === extendedKey;
|
47245
|
+
if (bytes2.length !== 82 || !isValidExtendedKey(bytes2)) {
|
47501
47246
|
throw new FuelError(ErrorCode.HD_WALLET_ERROR, "Provided key is not a valid extended key.");
|
47502
47247
|
}
|
47503
47248
|
if (!validChecksum) {
|
47504
47249
|
throw new FuelError(ErrorCode.HD_WALLET_ERROR, "Provided key has an invalid checksum.");
|
47505
47250
|
}
|
47506
|
-
const depth =
|
47507
|
-
const parentFingerprint = hexlify(
|
47508
|
-
const index = parseInt(hexlify(
|
47509
|
-
const chainCode = hexlify(
|
47510
|
-
const key =
|
47251
|
+
const depth = bytes2[4];
|
47252
|
+
const parentFingerprint = hexlify(bytes2.slice(5, 9));
|
47253
|
+
const index = parseInt(hexlify(bytes2.slice(9, 13)).substring(2), 16);
|
47254
|
+
const chainCode = hexlify(bytes2.slice(13, 45));
|
47255
|
+
const key = bytes2.slice(45, 78);
|
47511
47256
|
if (depth === 0 && parentFingerprint !== "0x00000000" || depth === 0 && index !== 0) {
|
47512
47257
|
throw new FuelError(
|
47513
47258
|
ErrorCode.HD_WALLET_ERROR,
|
47514
47259
|
"Inconsistency detected: Depth is zero but fingerprint/index is non-zero."
|
47515
47260
|
);
|
47516
47261
|
}
|
47517
|
-
if (isPublicExtendedKey(
|
47262
|
+
if (isPublicExtendedKey(bytes2)) {
|
47518
47263
|
if (key[0] !== 3) {
|
47519
47264
|
throw new FuelError(ErrorCode.HD_WALLET_ERROR, "Invalid public extended key.");
|
47520
47265
|
}
|
@@ -47846,7 +47591,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
47846
47591
|
wallet_not_unlocked: "The wallet is currently locked.",
|
47847
47592
|
passphrase_not_match: "The provided passphrase did not match the expected value."
|
47848
47593
|
};
|
47849
|
-
function
|
47594
|
+
function assert2(condition, message) {
|
47850
47595
|
if (!condition) {
|
47851
47596
|
throw new FuelError(ErrorCode.WALLET_MANAGER_ERROR, message);
|
47852
47597
|
}
|
@@ -47889,9 +47634,9 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
47889
47634
|
* the format of the return depends on the Vault type.
|
47890
47635
|
*/
|
47891
47636
|
exportVault(vaultId) {
|
47892
|
-
|
47637
|
+
assert2(!__privateGet(this, _isLocked), ERROR_MESSAGES.wallet_not_unlocked);
|
47893
47638
|
const vaultState = __privateGet(this, _vaults).find((_, idx) => idx === vaultId);
|
47894
|
-
|
47639
|
+
assert2(vaultState, ERROR_MESSAGES.vault_not_found);
|
47895
47640
|
return vaultState.vault.serialize();
|
47896
47641
|
}
|
47897
47642
|
/**
|
@@ -47920,7 +47665,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
47920
47665
|
const vaultState = __privateGet(this, _vaults).find(
|
47921
47666
|
(vs) => vs.vault.getAccounts().find((a) => a.address.equals(ownerAddress))
|
47922
47667
|
);
|
47923
|
-
|
47668
|
+
assert2(vaultState, ERROR_MESSAGES.address_not_found);
|
47924
47669
|
return vaultState.vault.getWallet(ownerAddress);
|
47925
47670
|
}
|
47926
47671
|
/**
|
@@ -47928,11 +47673,11 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
47928
47673
|
*/
|
47929
47674
|
exportPrivateKey(address) {
|
47930
47675
|
const ownerAddress = Address.fromAddressOrString(address);
|
47931
|
-
|
47676
|
+
assert2(!__privateGet(this, _isLocked), ERROR_MESSAGES.wallet_not_unlocked);
|
47932
47677
|
const vaultState = __privateGet(this, _vaults).find(
|
47933
47678
|
(vs) => vs.vault.getAccounts().find((a) => a.address.equals(ownerAddress))
|
47934
47679
|
);
|
47935
|
-
|
47680
|
+
assert2(vaultState, ERROR_MESSAGES.address_not_found);
|
47936
47681
|
return vaultState.vault.exportAccount(ownerAddress);
|
47937
47682
|
}
|
47938
47683
|
/**
|
@@ -47942,7 +47687,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
47942
47687
|
async addAccount(options) {
|
47943
47688
|
await this.loadState();
|
47944
47689
|
const vaultState = __privateGet(this, _vaults)[options?.vaultId || 0];
|
47945
|
-
await
|
47690
|
+
await assert2(vaultState, ERROR_MESSAGES.vault_not_found);
|
47946
47691
|
const account = vaultState.vault.addAccount();
|
47947
47692
|
await this.saveState();
|
47948
47693
|
return account;
|
@@ -48012,7 +47757,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
48012
47757
|
* Retrieve and decrypt WalletManager state from storage
|
48013
47758
|
*/
|
48014
47759
|
async loadState() {
|
48015
|
-
await
|
47760
|
+
await assert2(!__privateGet(this, _isLocked), ERROR_MESSAGES.wallet_not_unlocked);
|
48016
47761
|
const data = await this.storage.getItem(this.STORAGE_KEY);
|
48017
47762
|
if (data) {
|
48018
47763
|
const state = await decrypt2(__privateGet(this, _passphrase), JSON.parse(data));
|
@@ -48023,7 +47768,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
48023
47768
|
* Store encrypted WalletManager state on storage
|
48024
47769
|
*/
|
48025
47770
|
async saveState() {
|
48026
|
-
await
|
47771
|
+
await assert2(!__privateGet(this, _isLocked), ERROR_MESSAGES.wallet_not_unlocked);
|
48027
47772
|
const encryptedData = await encrypt2(__privateGet(this, _passphrase), {
|
48028
47773
|
vaults: __privateMethod(this, _serializeVaults, serializeVaults_fn).call(this, __privateGet(this, _vaults))
|
48029
47774
|
});
|
@@ -48035,7 +47780,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
48035
47780
|
*/
|
48036
47781
|
getVaultClass(type3) {
|
48037
47782
|
const VaultClass = _WalletManager.Vaults.find((v) => v.type === type3);
|
48038
|
-
|
47783
|
+
assert2(VaultClass, ERROR_MESSAGES.invalid_vault_type);
|
48039
47784
|
return VaultClass;
|
48040
47785
|
}
|
48041
47786
|
};
|
@@ -48118,10 +47863,10 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
48118
47863
|
};
|
48119
47864
|
var node_default2 = Node;
|
48120
47865
|
function hashLeaf(data) {
|
48121
|
-
return
|
47866
|
+
return hash2("0x00".concat(data.slice(2)));
|
48122
47867
|
}
|
48123
47868
|
function hashNode(left, right) {
|
48124
|
-
return
|
47869
|
+
return hash2("0x01".concat(left.slice(2)).concat(right.slice(2)));
|
48125
47870
|
}
|
48126
47871
|
function calcRoot(data) {
|
48127
47872
|
if (!data.length) {
|
@@ -48158,10 +47903,10 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
48158
47903
|
// src/predicate/utils/getPredicateRoot.ts
|
48159
47904
|
var getPredicateRoot = (bytecode) => {
|
48160
47905
|
const chunkSize = 16 * 1024;
|
48161
|
-
const
|
48162
|
-
const chunks = chunkAndPadBytes(
|
47906
|
+
const bytes2 = arrayify(bytecode);
|
47907
|
+
const chunks = chunkAndPadBytes(bytes2, chunkSize);
|
48163
47908
|
const codeRoot = calcRoot(chunks.map((c) => hexlify(c)));
|
48164
|
-
const predicateRoot =
|
47909
|
+
const predicateRoot = hash2(concat(["0x4655454C", codeRoot]));
|
48165
47910
|
return predicateRoot;
|
48166
47911
|
};
|
48167
47912
|
|
@@ -48261,8 +48006,8 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
48261
48006
|
* @param configurableConstants - Optional configurable constants for the predicate.
|
48262
48007
|
* @returns An object containing the new predicate bytes and interface.
|
48263
48008
|
*/
|
48264
|
-
static processPredicateData(
|
48265
|
-
let predicateBytes = arrayify(
|
48009
|
+
static processPredicateData(bytes2, jsonAbi, configurableConstants) {
|
48010
|
+
let predicateBytes = arrayify(bytes2);
|
48266
48011
|
let abiInterface;
|
48267
48012
|
if (jsonAbi) {
|
48268
48013
|
abiInterface = new Interface(jsonAbi);
|
@@ -48312,8 +48057,8 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
48312
48057
|
* @param abiInterface - The ABI interface of the predicate.
|
48313
48058
|
* @returns The mutated bytes with the configurable constants set.
|
48314
48059
|
*/
|
48315
|
-
static setConfigurableConstants(
|
48316
|
-
const mutatedBytes =
|
48060
|
+
static setConfigurableConstants(bytes2, configurableConstants, abiInterface) {
|
48061
|
+
const mutatedBytes = bytes2;
|
48317
48062
|
try {
|
48318
48063
|
if (!abiInterface) {
|
48319
48064
|
throw new Error(
|
@@ -49054,9 +48799,6 @@ mime-types/index.js:
|
|
49054
48799
|
@noble/hashes/esm/utils.js:
|
49055
48800
|
(*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
|
49056
48801
|
|
49057
|
-
@noble/hashes/esm/utils.js:
|
49058
|
-
(*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
|
49059
|
-
|
49060
48802
|
@noble/curves/esm/abstract/utils.js:
|
49061
48803
|
(*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
|
49062
48804
|
|