@fuel-ts/account 0.0.0-pr-2143-20240510170046 → 0.0.0-pr-2143-20240513112950
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 +1373 -1574
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +337 -269
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +237 -176
- package/dist/index.mjs.map +1 -1
- package/dist/mnemonic/mnemonic.d.ts.map +1 -1
- package/dist/predicate/predicate.d.ts +9 -2
- package/dist/predicate/predicate.d.ts.map +1 -1
- package/dist/providers/provider.d.ts +1 -1
- package/dist/providers/provider.d.ts.map +1 -1
- package/dist/providers/transaction-request/helpers.d.ts +4 -0
- package/dist/providers/transaction-request/helpers.d.ts.map +1 -1
- package/dist/providers/transaction-request/index.d.ts +1 -0
- package/dist/providers/transaction-request/index.d.ts.map +1 -1
- package/dist/providers/transaction-request/transaction-request.d.ts +2 -0
- package/dist/providers/transaction-request/transaction-request.d.ts.map +1 -1
- package/dist/providers/transaction-request/utils.d.ts +0 -4
- package/dist/providers/transaction-request/utils.d.ts.map +1 -1
- package/dist/test-utils/seedTestWallet.d.ts +1 -1
- package/dist/test-utils/seedTestWallet.d.ts.map +1 -1
- package/dist/test-utils.global.js +1326 -1568
- package/dist/test-utils.global.js.map +1 -1
- package/dist/test-utils.js +282 -269
- package/dist/test-utils.js.map +1 -1
- package/dist/test-utils.mjs +192 -179
- package/dist/test-utils.mjs.map +1 -1
- package/dist/wallet/base-wallet-unlocked.d.ts +2 -2
- package/dist/wallet/base-wallet-unlocked.d.ts.map +1 -1
- package/package.json +15 -16
@@ -59,178 +59,12 @@
|
|
59
59
|
return method;
|
60
60
|
};
|
61
61
|
|
62
|
-
// ../../node_modules/.pnpm/bech32@2.0.0/node_modules/bech32/dist/index.js
|
63
|
-
var require_dist = __commonJS({
|
64
|
-
"../../node_modules/.pnpm/bech32@2.0.0/node_modules/bech32/dist/index.js"(exports) {
|
65
|
-
"use strict";
|
66
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
67
|
-
exports.bech32m = exports.bech32 = void 0;
|
68
|
-
var ALPHABET = "qpzry9x8gf2tvdw0s3jn54khce6mua7l";
|
69
|
-
var ALPHABET_MAP = {};
|
70
|
-
for (let z = 0; z < ALPHABET.length; z++) {
|
71
|
-
const x = ALPHABET.charAt(z);
|
72
|
-
ALPHABET_MAP[x] = z;
|
73
|
-
}
|
74
|
-
function polymodStep(pre) {
|
75
|
-
const b = pre >> 25;
|
76
|
-
return (pre & 33554431) << 5 ^ -(b >> 0 & 1) & 996825010 ^ -(b >> 1 & 1) & 642813549 ^ -(b >> 2 & 1) & 513874426 ^ -(b >> 3 & 1) & 1027748829 ^ -(b >> 4 & 1) & 705979059;
|
77
|
-
}
|
78
|
-
function prefixChk(prefix) {
|
79
|
-
let chk = 1;
|
80
|
-
for (let i = 0; i < prefix.length; ++i) {
|
81
|
-
const c = prefix.charCodeAt(i);
|
82
|
-
if (c < 33 || c > 126)
|
83
|
-
return "Invalid prefix (" + prefix + ")";
|
84
|
-
chk = polymodStep(chk) ^ c >> 5;
|
85
|
-
}
|
86
|
-
chk = polymodStep(chk);
|
87
|
-
for (let i = 0; i < prefix.length; ++i) {
|
88
|
-
const v = prefix.charCodeAt(i);
|
89
|
-
chk = polymodStep(chk) ^ v & 31;
|
90
|
-
}
|
91
|
-
return chk;
|
92
|
-
}
|
93
|
-
function convert2(data, inBits, outBits, pad3) {
|
94
|
-
let value = 0;
|
95
|
-
let bits = 0;
|
96
|
-
const maxV = (1 << outBits) - 1;
|
97
|
-
const result = [];
|
98
|
-
for (let i = 0; i < data.length; ++i) {
|
99
|
-
value = value << inBits | data[i];
|
100
|
-
bits += inBits;
|
101
|
-
while (bits >= outBits) {
|
102
|
-
bits -= outBits;
|
103
|
-
result.push(value >> bits & maxV);
|
104
|
-
}
|
105
|
-
}
|
106
|
-
if (pad3) {
|
107
|
-
if (bits > 0) {
|
108
|
-
result.push(value << outBits - bits & maxV);
|
109
|
-
}
|
110
|
-
} else {
|
111
|
-
if (bits >= inBits)
|
112
|
-
return "Excess padding";
|
113
|
-
if (value << outBits - bits & maxV)
|
114
|
-
return "Non-zero padding";
|
115
|
-
}
|
116
|
-
return result;
|
117
|
-
}
|
118
|
-
function toWords(bytes3) {
|
119
|
-
return convert2(bytes3, 8, 5, true);
|
120
|
-
}
|
121
|
-
function fromWordsUnsafe(words) {
|
122
|
-
const res = convert2(words, 5, 8, false);
|
123
|
-
if (Array.isArray(res))
|
124
|
-
return res;
|
125
|
-
}
|
126
|
-
function fromWords(words) {
|
127
|
-
const res = convert2(words, 5, 8, false);
|
128
|
-
if (Array.isArray(res))
|
129
|
-
return res;
|
130
|
-
throw new Error(res);
|
131
|
-
}
|
132
|
-
function getLibraryFromEncoding(encoding) {
|
133
|
-
let ENCODING_CONST;
|
134
|
-
if (encoding === "bech32") {
|
135
|
-
ENCODING_CONST = 1;
|
136
|
-
} else {
|
137
|
-
ENCODING_CONST = 734539939;
|
138
|
-
}
|
139
|
-
function encode(prefix, words, LIMIT) {
|
140
|
-
LIMIT = LIMIT || 90;
|
141
|
-
if (prefix.length + 7 + words.length > LIMIT)
|
142
|
-
throw new TypeError("Exceeds length limit");
|
143
|
-
prefix = prefix.toLowerCase();
|
144
|
-
let chk = prefixChk(prefix);
|
145
|
-
if (typeof chk === "string")
|
146
|
-
throw new Error(chk);
|
147
|
-
let result = prefix + "1";
|
148
|
-
for (let i = 0; i < words.length; ++i) {
|
149
|
-
const x = words[i];
|
150
|
-
if (x >> 5 !== 0)
|
151
|
-
throw new Error("Non 5-bit word");
|
152
|
-
chk = polymodStep(chk) ^ x;
|
153
|
-
result += ALPHABET.charAt(x);
|
154
|
-
}
|
155
|
-
for (let i = 0; i < 6; ++i) {
|
156
|
-
chk = polymodStep(chk);
|
157
|
-
}
|
158
|
-
chk ^= ENCODING_CONST;
|
159
|
-
for (let i = 0; i < 6; ++i) {
|
160
|
-
const v = chk >> (5 - i) * 5 & 31;
|
161
|
-
result += ALPHABET.charAt(v);
|
162
|
-
}
|
163
|
-
return result;
|
164
|
-
}
|
165
|
-
function __decode(str, LIMIT) {
|
166
|
-
LIMIT = LIMIT || 90;
|
167
|
-
if (str.length < 8)
|
168
|
-
return str + " too short";
|
169
|
-
if (str.length > LIMIT)
|
170
|
-
return "Exceeds length limit";
|
171
|
-
const lowered = str.toLowerCase();
|
172
|
-
const uppered = str.toUpperCase();
|
173
|
-
if (str !== lowered && str !== uppered)
|
174
|
-
return "Mixed-case string " + str;
|
175
|
-
str = lowered;
|
176
|
-
const split2 = str.lastIndexOf("1");
|
177
|
-
if (split2 === -1)
|
178
|
-
return "No separator character for " + str;
|
179
|
-
if (split2 === 0)
|
180
|
-
return "Missing prefix for " + str;
|
181
|
-
const prefix = str.slice(0, split2);
|
182
|
-
const wordChars = str.slice(split2 + 1);
|
183
|
-
if (wordChars.length < 6)
|
184
|
-
return "Data too short";
|
185
|
-
let chk = prefixChk(prefix);
|
186
|
-
if (typeof chk === "string")
|
187
|
-
return chk;
|
188
|
-
const words = [];
|
189
|
-
for (let i = 0; i < wordChars.length; ++i) {
|
190
|
-
const c = wordChars.charAt(i);
|
191
|
-
const v = ALPHABET_MAP[c];
|
192
|
-
if (v === void 0)
|
193
|
-
return "Unknown character " + c;
|
194
|
-
chk = polymodStep(chk) ^ v;
|
195
|
-
if (i + 6 >= wordChars.length)
|
196
|
-
continue;
|
197
|
-
words.push(v);
|
198
|
-
}
|
199
|
-
if (chk !== ENCODING_CONST)
|
200
|
-
return "Invalid checksum for " + str;
|
201
|
-
return { prefix, words };
|
202
|
-
}
|
203
|
-
function decodeUnsafe(str, LIMIT) {
|
204
|
-
const res = __decode(str, LIMIT);
|
205
|
-
if (typeof res === "object")
|
206
|
-
return res;
|
207
|
-
}
|
208
|
-
function decode(str, LIMIT) {
|
209
|
-
const res = __decode(str, LIMIT);
|
210
|
-
if (typeof res === "object")
|
211
|
-
return res;
|
212
|
-
throw new Error(res);
|
213
|
-
}
|
214
|
-
return {
|
215
|
-
decodeUnsafe,
|
216
|
-
decode,
|
217
|
-
encode,
|
218
|
-
toWords,
|
219
|
-
fromWordsUnsafe,
|
220
|
-
fromWords
|
221
|
-
};
|
222
|
-
}
|
223
|
-
exports.bech32 = getLibraryFromEncoding("bech32");
|
224
|
-
exports.bech32m = getLibraryFromEncoding("bech32m");
|
225
|
-
}
|
226
|
-
});
|
227
|
-
|
228
62
|
// ../../node_modules/.pnpm/bn.js@5.2.1/node_modules/bn.js/lib/bn.js
|
229
63
|
var require_bn = __commonJS({
|
230
64
|
"../../node_modules/.pnpm/bn.js@5.2.1/node_modules/bn.js/lib/bn.js"(exports, module) {
|
231
65
|
(function(module2, exports2) {
|
232
66
|
"use strict";
|
233
|
-
function
|
67
|
+
function assert2(val, msg) {
|
234
68
|
if (!val)
|
235
69
|
throw new Error(msg || "Assertion failed");
|
236
70
|
}
|
@@ -242,20 +76,20 @@
|
|
242
76
|
ctor.prototype = new TempCtor();
|
243
77
|
ctor.prototype.constructor = ctor;
|
244
78
|
}
|
245
|
-
function BN2(
|
246
|
-
if (BN2.isBN(
|
247
|
-
return
|
79
|
+
function BN2(number2, base, endian) {
|
80
|
+
if (BN2.isBN(number2)) {
|
81
|
+
return number2;
|
248
82
|
}
|
249
83
|
this.negative = 0;
|
250
84
|
this.words = null;
|
251
85
|
this.length = 0;
|
252
86
|
this.red = null;
|
253
|
-
if (
|
87
|
+
if (number2 !== null) {
|
254
88
|
if (base === "le" || base === "be") {
|
255
89
|
endian = base;
|
256
90
|
base = 10;
|
257
91
|
}
|
258
|
-
this._init(
|
92
|
+
this._init(number2 || 0, base || 10, endian || "be");
|
259
93
|
}
|
260
94
|
}
|
261
95
|
if (typeof module2 === "object") {
|
@@ -290,53 +124,53 @@
|
|
290
124
|
return left;
|
291
125
|
return right;
|
292
126
|
};
|
293
|
-
BN2.prototype._init = function init(
|
294
|
-
if (typeof
|
295
|
-
return this._initNumber(
|
127
|
+
BN2.prototype._init = function init(number2, base, endian) {
|
128
|
+
if (typeof number2 === "number") {
|
129
|
+
return this._initNumber(number2, base, endian);
|
296
130
|
}
|
297
|
-
if (typeof
|
298
|
-
return this._initArray(
|
131
|
+
if (typeof number2 === "object") {
|
132
|
+
return this._initArray(number2, base, endian);
|
299
133
|
}
|
300
134
|
if (base === "hex") {
|
301
135
|
base = 16;
|
302
136
|
}
|
303
|
-
|
304
|
-
|
137
|
+
assert2(base === (base | 0) && base >= 2 && base <= 36);
|
138
|
+
number2 = number2.toString().replace(/\s+/g, "");
|
305
139
|
var start = 0;
|
306
|
-
if (
|
140
|
+
if (number2[0] === "-") {
|
307
141
|
start++;
|
308
142
|
this.negative = 1;
|
309
143
|
}
|
310
|
-
if (start <
|
144
|
+
if (start < number2.length) {
|
311
145
|
if (base === 16) {
|
312
|
-
this._parseHex(
|
146
|
+
this._parseHex(number2, start, endian);
|
313
147
|
} else {
|
314
|
-
this._parseBase(
|
148
|
+
this._parseBase(number2, base, start);
|
315
149
|
if (endian === "le") {
|
316
150
|
this._initArray(this.toArray(), base, endian);
|
317
151
|
}
|
318
152
|
}
|
319
153
|
}
|
320
154
|
};
|
321
|
-
BN2.prototype._initNumber = function _initNumber(
|
322
|
-
if (
|
155
|
+
BN2.prototype._initNumber = function _initNumber(number2, base, endian) {
|
156
|
+
if (number2 < 0) {
|
323
157
|
this.negative = 1;
|
324
|
-
|
158
|
+
number2 = -number2;
|
325
159
|
}
|
326
|
-
if (
|
327
|
-
this.words = [
|
160
|
+
if (number2 < 67108864) {
|
161
|
+
this.words = [number2 & 67108863];
|
328
162
|
this.length = 1;
|
329
|
-
} else if (
|
163
|
+
} else if (number2 < 4503599627370496) {
|
330
164
|
this.words = [
|
331
|
-
|
332
|
-
|
165
|
+
number2 & 67108863,
|
166
|
+
number2 / 67108864 & 67108863
|
333
167
|
];
|
334
168
|
this.length = 2;
|
335
169
|
} else {
|
336
|
-
|
170
|
+
assert2(number2 < 9007199254740992);
|
337
171
|
this.words = [
|
338
|
-
|
339
|
-
|
172
|
+
number2 & 67108863,
|
173
|
+
number2 / 67108864 & 67108863,
|
340
174
|
1
|
341
175
|
];
|
342
176
|
this.length = 3;
|
@@ -345,14 +179,14 @@
|
|
345
179
|
return;
|
346
180
|
this._initArray(this.toArray(), base, endian);
|
347
181
|
};
|
348
|
-
BN2.prototype._initArray = function _initArray(
|
349
|
-
|
350
|
-
if (
|
182
|
+
BN2.prototype._initArray = function _initArray(number2, base, endian) {
|
183
|
+
assert2(typeof number2.length === "number");
|
184
|
+
if (number2.length <= 0) {
|
351
185
|
this.words = [0];
|
352
186
|
this.length = 1;
|
353
187
|
return this;
|
354
188
|
}
|
355
|
-
this.length = Math.ceil(
|
189
|
+
this.length = Math.ceil(number2.length / 3);
|
356
190
|
this.words = new Array(this.length);
|
357
191
|
for (var i = 0; i < this.length; i++) {
|
358
192
|
this.words[i] = 0;
|
@@ -360,8 +194,8 @@
|
|
360
194
|
var j, w;
|
361
195
|
var off = 0;
|
362
196
|
if (endian === "be") {
|
363
|
-
for (i =
|
364
|
-
w =
|
197
|
+
for (i = number2.length - 1, j = 0; i >= 0; i -= 3) {
|
198
|
+
w = number2[i] | number2[i - 1] << 8 | number2[i - 2] << 16;
|
365
199
|
this.words[j] |= w << off & 67108863;
|
366
200
|
this.words[j + 1] = w >>> 26 - off & 67108863;
|
367
201
|
off += 24;
|
@@ -371,8 +205,8 @@
|
|
371
205
|
}
|
372
206
|
}
|
373
207
|
} else if (endian === "le") {
|
374
|
-
for (i = 0, j = 0; i <
|
375
|
-
w =
|
208
|
+
for (i = 0, j = 0; i < number2.length; i += 3) {
|
209
|
+
w = number2[i] | number2[i + 1] << 8 | number2[i + 2] << 16;
|
376
210
|
this.words[j] |= w << off & 67108863;
|
377
211
|
this.words[j + 1] = w >>> 26 - off & 67108863;
|
378
212
|
off += 24;
|
@@ -393,7 +227,7 @@
|
|
393
227
|
} else if (c >= 97 && c <= 102) {
|
394
228
|
return c - 87;
|
395
229
|
} else {
|
396
|
-
|
230
|
+
assert2(false, "Invalid character in " + string);
|
397
231
|
}
|
398
232
|
}
|
399
233
|
function parseHexByte(string, lowerBound, index) {
|
@@ -403,8 +237,8 @@
|
|
403
237
|
}
|
404
238
|
return r;
|
405
239
|
}
|
406
|
-
BN2.prototype._parseHex = function _parseHex(
|
407
|
-
this.length = Math.ceil((
|
240
|
+
BN2.prototype._parseHex = function _parseHex(number2, start, endian) {
|
241
|
+
this.length = Math.ceil((number2.length - start) / 6);
|
408
242
|
this.words = new Array(this.length);
|
409
243
|
for (var i = 0; i < this.length; i++) {
|
410
244
|
this.words[i] = 0;
|
@@ -413,8 +247,8 @@
|
|
413
247
|
var j = 0;
|
414
248
|
var w;
|
415
249
|
if (endian === "be") {
|
416
|
-
for (i =
|
417
|
-
w = parseHexByte(
|
250
|
+
for (i = number2.length - 1; i >= start; i -= 2) {
|
251
|
+
w = parseHexByte(number2, start, i) << off;
|
418
252
|
this.words[j] |= w & 67108863;
|
419
253
|
if (off >= 18) {
|
420
254
|
off -= 18;
|
@@ -425,9 +259,9 @@
|
|
425
259
|
}
|
426
260
|
}
|
427
261
|
} else {
|
428
|
-
var parseLength =
|
429
|
-
for (i = parseLength % 2 === 0 ? start + 1 : start; i <
|
430
|
-
w = parseHexByte(
|
262
|
+
var parseLength = number2.length - start;
|
263
|
+
for (i = parseLength % 2 === 0 ? start + 1 : start; i < number2.length; i += 2) {
|
264
|
+
w = parseHexByte(number2, start, i) << off;
|
431
265
|
this.words[j] |= w & 67108863;
|
432
266
|
if (off >= 18) {
|
433
267
|
off -= 18;
|
@@ -454,12 +288,12 @@
|
|
454
288
|
} else {
|
455
289
|
b = c;
|
456
290
|
}
|
457
|
-
|
291
|
+
assert2(c >= 0 && b < mul, "Invalid character");
|
458
292
|
r += b;
|
459
293
|
}
|
460
294
|
return r;
|
461
295
|
}
|
462
|
-
BN2.prototype._parseBase = function _parseBase(
|
296
|
+
BN2.prototype._parseBase = function _parseBase(number2, base, start) {
|
463
297
|
this.words = [0];
|
464
298
|
this.length = 1;
|
465
299
|
for (var limbLen = 0, limbPow = 1; limbPow <= 67108863; limbPow *= base) {
|
@@ -467,12 +301,12 @@
|
|
467
301
|
}
|
468
302
|
limbLen--;
|
469
303
|
limbPow = limbPow / base | 0;
|
470
|
-
var total =
|
304
|
+
var total = number2.length - start;
|
471
305
|
var mod2 = total % limbLen;
|
472
306
|
var end = Math.min(total, total - mod2) + start;
|
473
307
|
var word = 0;
|
474
308
|
for (var i = start; i < end; i += limbLen) {
|
475
|
-
word = parseBase(
|
309
|
+
word = parseBase(number2, i, i + limbLen, base);
|
476
310
|
this.imuln(limbPow);
|
477
311
|
if (this.words[0] + word < 67108864) {
|
478
312
|
this.words[0] += word;
|
@@ -482,7 +316,7 @@
|
|
482
316
|
}
|
483
317
|
if (mod2 !== 0) {
|
484
318
|
var pow3 = 1;
|
485
|
-
word = parseBase(
|
319
|
+
word = parseBase(number2, i, number2.length, base);
|
486
320
|
for (i = 0; i < mod2; i++) {
|
487
321
|
pow3 *= base;
|
488
322
|
}
|
@@ -714,7 +548,7 @@
|
|
714
548
|
}
|
715
549
|
return out;
|
716
550
|
}
|
717
|
-
|
551
|
+
assert2(false, "Base should be between 2 and 36");
|
718
552
|
};
|
719
553
|
BN2.prototype.toNumber = function toNumber3() {
|
720
554
|
var ret2 = this.words[0];
|
@@ -723,7 +557,7 @@
|
|
723
557
|
} else if (this.length === 3 && this.words[2] === 1) {
|
724
558
|
ret2 += 4503599627370496 + this.words[1] * 67108864;
|
725
559
|
} else if (this.length > 2) {
|
726
|
-
|
560
|
+
assert2(false, "Number can only safely store up to 53 bits");
|
727
561
|
}
|
728
562
|
return this.negative !== 0 ? -ret2 : ret2;
|
729
563
|
};
|
@@ -748,8 +582,8 @@
|
|
748
582
|
this._strip();
|
749
583
|
var byteLength = this.byteLength();
|
750
584
|
var reqLength = length || Math.max(1, byteLength);
|
751
|
-
|
752
|
-
|
585
|
+
assert2(byteLength <= reqLength, "byte array longer than desired length");
|
586
|
+
assert2(reqLength > 0, "Requested array length <= 0");
|
753
587
|
var res = allocate(ArrayType, reqLength);
|
754
588
|
var postfix = endian === "le" ? "LE" : "BE";
|
755
589
|
this["_toArrayLike" + postfix](res, byteLength);
|
@@ -931,7 +765,7 @@
|
|
931
765
|
return this._strip();
|
932
766
|
};
|
933
767
|
BN2.prototype.ior = function ior(num) {
|
934
|
-
|
768
|
+
assert2((this.negative | num.negative) === 0);
|
935
769
|
return this.iuor(num);
|
936
770
|
};
|
937
771
|
BN2.prototype.or = function or(num) {
|
@@ -958,7 +792,7 @@
|
|
958
792
|
return this._strip();
|
959
793
|
};
|
960
794
|
BN2.prototype.iand = function iand(num) {
|
961
|
-
|
795
|
+
assert2((this.negative | num.negative) === 0);
|
962
796
|
return this.iuand(num);
|
963
797
|
};
|
964
798
|
BN2.prototype.and = function and(num) {
|
@@ -993,7 +827,7 @@
|
|
993
827
|
return this._strip();
|
994
828
|
};
|
995
829
|
BN2.prototype.ixor = function ixor(num) {
|
996
|
-
|
830
|
+
assert2((this.negative | num.negative) === 0);
|
997
831
|
return this.iuxor(num);
|
998
832
|
};
|
999
833
|
BN2.prototype.xor = function xor(num) {
|
@@ -1007,7 +841,7 @@
|
|
1007
841
|
return num.clone().iuxor(this);
|
1008
842
|
};
|
1009
843
|
BN2.prototype.inotn = function inotn(width) {
|
1010
|
-
|
844
|
+
assert2(typeof width === "number" && width >= 0);
|
1011
845
|
var bytesNeeded = Math.ceil(width / 26) | 0;
|
1012
846
|
var bitsLeft = width % 26;
|
1013
847
|
this._expand(bytesNeeded);
|
@@ -1026,7 +860,7 @@
|
|
1026
860
|
return this.clone().inotn(width);
|
1027
861
|
};
|
1028
862
|
BN2.prototype.setn = function setn(bit, val) {
|
1029
|
-
|
863
|
+
assert2(typeof bit === "number" && bit >= 0);
|
1030
864
|
var off = bit / 26 | 0;
|
1031
865
|
var wbit = bit % 26;
|
1032
866
|
this._expand(off + 1);
|
@@ -1892,8 +1726,8 @@
|
|
1892
1726
|
for (i = 2 * len; i < N; ++i) {
|
1893
1727
|
rws[i] = 0;
|
1894
1728
|
}
|
1895
|
-
|
1896
|
-
|
1729
|
+
assert2(carry === 0);
|
1730
|
+
assert2((carry & ~8191) === 0);
|
1897
1731
|
};
|
1898
1732
|
FFTM.prototype.stub = function stub(N) {
|
1899
1733
|
var ph = new Array(N);
|
@@ -1948,8 +1782,8 @@
|
|
1948
1782
|
var isNegNum = num < 0;
|
1949
1783
|
if (isNegNum)
|
1950
1784
|
num = -num;
|
1951
|
-
|
1952
|
-
|
1785
|
+
assert2(typeof num === "number");
|
1786
|
+
assert2(num < 67108864);
|
1953
1787
|
var carry = 0;
|
1954
1788
|
for (var i = 0; i < this.length; i++) {
|
1955
1789
|
var w = (this.words[i] | 0) * num;
|
@@ -1993,7 +1827,7 @@
|
|
1993
1827
|
return res;
|
1994
1828
|
};
|
1995
1829
|
BN2.prototype.iushln = function iushln(bits) {
|
1996
|
-
|
1830
|
+
assert2(typeof bits === "number" && bits >= 0);
|
1997
1831
|
var r = bits % 26;
|
1998
1832
|
var s = (bits - r) / 26;
|
1999
1833
|
var carryMask = 67108863 >>> 26 - r << 26 - r;
|
@@ -2023,11 +1857,11 @@
|
|
2023
1857
|
return this._strip();
|
2024
1858
|
};
|
2025
1859
|
BN2.prototype.ishln = function ishln(bits) {
|
2026
|
-
|
1860
|
+
assert2(this.negative === 0);
|
2027
1861
|
return this.iushln(bits);
|
2028
1862
|
};
|
2029
1863
|
BN2.prototype.iushrn = function iushrn(bits, hint, extended) {
|
2030
|
-
|
1864
|
+
assert2(typeof bits === "number" && bits >= 0);
|
2031
1865
|
var h;
|
2032
1866
|
if (hint) {
|
2033
1867
|
h = (hint - hint % 26) / 26;
|
@@ -2072,7 +1906,7 @@
|
|
2072
1906
|
return this._strip();
|
2073
1907
|
};
|
2074
1908
|
BN2.prototype.ishrn = function ishrn(bits, hint, extended) {
|
2075
|
-
|
1909
|
+
assert2(this.negative === 0);
|
2076
1910
|
return this.iushrn(bits, hint, extended);
|
2077
1911
|
};
|
2078
1912
|
BN2.prototype.shln = function shln(bits) {
|
@@ -2088,7 +1922,7 @@
|
|
2088
1922
|
return this.clone().iushrn(bits);
|
2089
1923
|
};
|
2090
1924
|
BN2.prototype.testn = function testn(bit) {
|
2091
|
-
|
1925
|
+
assert2(typeof bit === "number" && bit >= 0);
|
2092
1926
|
var r = bit % 26;
|
2093
1927
|
var s = (bit - r) / 26;
|
2094
1928
|
var q = 1 << r;
|
@@ -2098,10 +1932,10 @@
|
|
2098
1932
|
return !!(w & q);
|
2099
1933
|
};
|
2100
1934
|
BN2.prototype.imaskn = function imaskn(bits) {
|
2101
|
-
|
1935
|
+
assert2(typeof bits === "number" && bits >= 0);
|
2102
1936
|
var r = bits % 26;
|
2103
1937
|
var s = (bits - r) / 26;
|
2104
|
-
|
1938
|
+
assert2(this.negative === 0, "imaskn works only with positive numbers");
|
2105
1939
|
if (this.length <= s) {
|
2106
1940
|
return this;
|
2107
1941
|
}
|
@@ -2119,8 +1953,8 @@
|
|
2119
1953
|
return this.clone().imaskn(bits);
|
2120
1954
|
};
|
2121
1955
|
BN2.prototype.iaddn = function iaddn(num) {
|
2122
|
-
|
2123
|
-
|
1956
|
+
assert2(typeof num === "number");
|
1957
|
+
assert2(num < 67108864);
|
2124
1958
|
if (num < 0)
|
2125
1959
|
return this.isubn(-num);
|
2126
1960
|
if (this.negative !== 0) {
|
@@ -2150,8 +1984,8 @@
|
|
2150
1984
|
return this;
|
2151
1985
|
};
|
2152
1986
|
BN2.prototype.isubn = function isubn(num) {
|
2153
|
-
|
2154
|
-
|
1987
|
+
assert2(typeof num === "number");
|
1988
|
+
assert2(num < 67108864);
|
2155
1989
|
if (num < 0)
|
2156
1990
|
return this.iaddn(-num);
|
2157
1991
|
if (this.negative !== 0) {
|
@@ -2205,7 +2039,7 @@
|
|
2205
2039
|
}
|
2206
2040
|
if (carry === 0)
|
2207
2041
|
return this._strip();
|
2208
|
-
|
2042
|
+
assert2(carry === -1);
|
2209
2043
|
carry = 0;
|
2210
2044
|
for (i = 0; i < this.length; i++) {
|
2211
2045
|
w = -(this.words[i] | 0) + carry;
|
@@ -2273,7 +2107,7 @@
|
|
2273
2107
|
};
|
2274
2108
|
};
|
2275
2109
|
BN2.prototype.divmod = function divmod(num, mode, positive) {
|
2276
|
-
|
2110
|
+
assert2(!num.isZero());
|
2277
2111
|
if (this.isZero()) {
|
2278
2112
|
return {
|
2279
2113
|
div: new BN2(0),
|
@@ -2371,7 +2205,7 @@
|
|
2371
2205
|
var isNegNum = num < 0;
|
2372
2206
|
if (isNegNum)
|
2373
2207
|
num = -num;
|
2374
|
-
|
2208
|
+
assert2(num <= 67108863);
|
2375
2209
|
var p = (1 << 26) % num;
|
2376
2210
|
var acc = 0;
|
2377
2211
|
for (var i = this.length - 1; i >= 0; i--) {
|
@@ -2386,7 +2220,7 @@
|
|
2386
2220
|
var isNegNum = num < 0;
|
2387
2221
|
if (isNegNum)
|
2388
2222
|
num = -num;
|
2389
|
-
|
2223
|
+
assert2(num <= 67108863);
|
2390
2224
|
var carry = 0;
|
2391
2225
|
for (var i = this.length - 1; i >= 0; i--) {
|
2392
2226
|
var w = (this.words[i] | 0) + carry * 67108864;
|
@@ -2400,8 +2234,8 @@
|
|
2400
2234
|
return this.clone().idivn(num);
|
2401
2235
|
};
|
2402
2236
|
BN2.prototype.egcd = function egcd(p) {
|
2403
|
-
|
2404
|
-
|
2237
|
+
assert2(p.negative === 0);
|
2238
|
+
assert2(!p.isZero());
|
2405
2239
|
var x = this;
|
2406
2240
|
var y = p.clone();
|
2407
2241
|
if (x.negative !== 0) {
|
@@ -2465,8 +2299,8 @@
|
|
2465
2299
|
};
|
2466
2300
|
};
|
2467
2301
|
BN2.prototype._invmp = function _invmp(p) {
|
2468
|
-
|
2469
|
-
|
2302
|
+
assert2(p.negative === 0);
|
2303
|
+
assert2(!p.isZero());
|
2470
2304
|
var a = this;
|
2471
2305
|
var b = p.clone();
|
2472
2306
|
if (a.negative !== 0) {
|
@@ -2564,7 +2398,7 @@
|
|
2564
2398
|
return this.words[0] & num;
|
2565
2399
|
};
|
2566
2400
|
BN2.prototype.bincn = function bincn(bit) {
|
2567
|
-
|
2401
|
+
assert2(typeof bit === "number");
|
2568
2402
|
var r = bit % 26;
|
2569
2403
|
var s = (bit - r) / 26;
|
2570
2404
|
var q = 1 << r;
|
@@ -2604,7 +2438,7 @@
|
|
2604
2438
|
if (negative) {
|
2605
2439
|
num = -num;
|
2606
2440
|
}
|
2607
|
-
|
2441
|
+
assert2(num <= 67108863, "Number is too big");
|
2608
2442
|
var w = this.words[0] | 0;
|
2609
2443
|
res = w === num ? 0 : w < num ? -1 : 1;
|
2610
2444
|
}
|
@@ -2676,12 +2510,12 @@
|
|
2676
2510
|
return new Red(num);
|
2677
2511
|
};
|
2678
2512
|
BN2.prototype.toRed = function toRed(ctx) {
|
2679
|
-
|
2680
|
-
|
2513
|
+
assert2(!this.red, "Already a number in reduction context");
|
2514
|
+
assert2(this.negative === 0, "red works only with positives");
|
2681
2515
|
return ctx.convertTo(this)._forceRed(ctx);
|
2682
2516
|
};
|
2683
2517
|
BN2.prototype.fromRed = function fromRed() {
|
2684
|
-
|
2518
|
+
assert2(this.red, "fromRed works only with numbers in reduction context");
|
2685
2519
|
return this.red.convertFrom(this);
|
2686
2520
|
};
|
2687
2521
|
BN2.prototype._forceRed = function _forceRed(ctx) {
|
@@ -2689,66 +2523,66 @@
|
|
2689
2523
|
return this;
|
2690
2524
|
};
|
2691
2525
|
BN2.prototype.forceRed = function forceRed(ctx) {
|
2692
|
-
|
2526
|
+
assert2(!this.red, "Already a number in reduction context");
|
2693
2527
|
return this._forceRed(ctx);
|
2694
2528
|
};
|
2695
2529
|
BN2.prototype.redAdd = function redAdd(num) {
|
2696
|
-
|
2530
|
+
assert2(this.red, "redAdd works only with red numbers");
|
2697
2531
|
return this.red.add(this, num);
|
2698
2532
|
};
|
2699
2533
|
BN2.prototype.redIAdd = function redIAdd(num) {
|
2700
|
-
|
2534
|
+
assert2(this.red, "redIAdd works only with red numbers");
|
2701
2535
|
return this.red.iadd(this, num);
|
2702
2536
|
};
|
2703
2537
|
BN2.prototype.redSub = function redSub(num) {
|
2704
|
-
|
2538
|
+
assert2(this.red, "redSub works only with red numbers");
|
2705
2539
|
return this.red.sub(this, num);
|
2706
2540
|
};
|
2707
2541
|
BN2.prototype.redISub = function redISub(num) {
|
2708
|
-
|
2542
|
+
assert2(this.red, "redISub works only with red numbers");
|
2709
2543
|
return this.red.isub(this, num);
|
2710
2544
|
};
|
2711
2545
|
BN2.prototype.redShl = function redShl(num) {
|
2712
|
-
|
2546
|
+
assert2(this.red, "redShl works only with red numbers");
|
2713
2547
|
return this.red.shl(this, num);
|
2714
2548
|
};
|
2715
2549
|
BN2.prototype.redMul = function redMul(num) {
|
2716
|
-
|
2550
|
+
assert2(this.red, "redMul works only with red numbers");
|
2717
2551
|
this.red._verify2(this, num);
|
2718
2552
|
return this.red.mul(this, num);
|
2719
2553
|
};
|
2720
2554
|
BN2.prototype.redIMul = function redIMul(num) {
|
2721
|
-
|
2555
|
+
assert2(this.red, "redMul works only with red numbers");
|
2722
2556
|
this.red._verify2(this, num);
|
2723
2557
|
return this.red.imul(this, num);
|
2724
2558
|
};
|
2725
2559
|
BN2.prototype.redSqr = function redSqr() {
|
2726
|
-
|
2560
|
+
assert2(this.red, "redSqr works only with red numbers");
|
2727
2561
|
this.red._verify1(this);
|
2728
2562
|
return this.red.sqr(this);
|
2729
2563
|
};
|
2730
2564
|
BN2.prototype.redISqr = function redISqr() {
|
2731
|
-
|
2565
|
+
assert2(this.red, "redISqr works only with red numbers");
|
2732
2566
|
this.red._verify1(this);
|
2733
2567
|
return this.red.isqr(this);
|
2734
2568
|
};
|
2735
2569
|
BN2.prototype.redSqrt = function redSqrt() {
|
2736
|
-
|
2570
|
+
assert2(this.red, "redSqrt works only with red numbers");
|
2737
2571
|
this.red._verify1(this);
|
2738
2572
|
return this.red.sqrt(this);
|
2739
2573
|
};
|
2740
2574
|
BN2.prototype.redInvm = function redInvm() {
|
2741
|
-
|
2575
|
+
assert2(this.red, "redInvm works only with red numbers");
|
2742
2576
|
this.red._verify1(this);
|
2743
2577
|
return this.red.invm(this);
|
2744
2578
|
};
|
2745
2579
|
BN2.prototype.redNeg = function redNeg() {
|
2746
|
-
|
2580
|
+
assert2(this.red, "redNeg works only with red numbers");
|
2747
2581
|
this.red._verify1(this);
|
2748
2582
|
return this.red.neg(this);
|
2749
2583
|
};
|
2750
2584
|
BN2.prototype.redPow = function redPow(num) {
|
2751
|
-
|
2585
|
+
assert2(this.red && !num.red, "redPow(normalNum)");
|
2752
2586
|
this.red._verify1(this);
|
2753
2587
|
return this.red.pow(this, num);
|
2754
2588
|
};
|
@@ -2808,20 +2642,20 @@
|
|
2808
2642
|
);
|
2809
2643
|
}
|
2810
2644
|
inherits(K256, MPrime);
|
2811
|
-
K256.prototype.split = function split2(input,
|
2645
|
+
K256.prototype.split = function split2(input, output2) {
|
2812
2646
|
var mask2 = 4194303;
|
2813
2647
|
var outLen = Math.min(input.length, 9);
|
2814
2648
|
for (var i = 0; i < outLen; i++) {
|
2815
|
-
|
2649
|
+
output2.words[i] = input.words[i];
|
2816
2650
|
}
|
2817
|
-
|
2651
|
+
output2.length = outLen;
|
2818
2652
|
if (input.length <= 9) {
|
2819
2653
|
input.words[0] = 0;
|
2820
2654
|
input.length = 1;
|
2821
2655
|
return;
|
2822
2656
|
}
|
2823
2657
|
var prev = input.words[9];
|
2824
|
-
|
2658
|
+
output2.words[output2.length++] = prev & mask2;
|
2825
2659
|
for (i = 10; i < input.length; i++) {
|
2826
2660
|
var next = input.words[i] | 0;
|
2827
2661
|
input.words[i - 10] = (next & mask2) << 4 | prev >>> 22;
|
@@ -2916,18 +2750,18 @@
|
|
2916
2750
|
this.m = prime.p;
|
2917
2751
|
this.prime = prime;
|
2918
2752
|
} else {
|
2919
|
-
|
2753
|
+
assert2(m.gtn(1), "modulus must be greater than 1");
|
2920
2754
|
this.m = m;
|
2921
2755
|
this.prime = null;
|
2922
2756
|
}
|
2923
2757
|
}
|
2924
2758
|
Red.prototype._verify1 = function _verify1(a) {
|
2925
|
-
|
2926
|
-
|
2759
|
+
assert2(a.negative === 0, "red works only with positives");
|
2760
|
+
assert2(a.red, "red works only with red numbers");
|
2927
2761
|
};
|
2928
2762
|
Red.prototype._verify2 = function _verify2(a, b) {
|
2929
|
-
|
2930
|
-
|
2763
|
+
assert2((a.negative | b.negative) === 0, "red works only with positives");
|
2764
|
+
assert2(
|
2931
2765
|
a.red && a.red === b.red,
|
2932
2766
|
"red works only with red numbers"
|
2933
2767
|
);
|
@@ -2998,7 +2832,7 @@
|
|
2998
2832
|
if (a.isZero())
|
2999
2833
|
return a.clone();
|
3000
2834
|
var mod3 = this.m.andln(3);
|
3001
|
-
|
2835
|
+
assert2(mod3 % 2 === 1);
|
3002
2836
|
if (mod3 === 3) {
|
3003
2837
|
var pow3 = this.m.add(new BN2(1)).iushrn(2);
|
3004
2838
|
return this.pow(a, pow3);
|
@@ -3009,7 +2843,7 @@
|
|
3009
2843
|
s++;
|
3010
2844
|
q.iushrn(1);
|
3011
2845
|
}
|
3012
|
-
|
2846
|
+
assert2(!q.isZero());
|
3013
2847
|
var one = new BN2(1).toRed(this);
|
3014
2848
|
var nOne = one.redNeg();
|
3015
2849
|
var lpow = this.m.subn(1).iushrn(1);
|
@@ -3027,7 +2861,7 @@
|
|
3027
2861
|
for (var i = 0; tmp.cmp(one) !== 0; i++) {
|
3028
2862
|
tmp = tmp.redSqr();
|
3029
2863
|
}
|
3030
|
-
|
2864
|
+
assert2(i < m);
|
3031
2865
|
var b = this.pow(c, new BN2(1).iushln(m - i - 1));
|
3032
2866
|
r = r.redMul(b);
|
3033
2867
|
c = b.redSqr();
|
@@ -3161,6 +2995,172 @@
|
|
3161
2995
|
}
|
3162
2996
|
});
|
3163
2997
|
|
2998
|
+
// ../../node_modules/.pnpm/bech32@2.0.0/node_modules/bech32/dist/index.js
|
2999
|
+
var require_dist = __commonJS({
|
3000
|
+
"../../node_modules/.pnpm/bech32@2.0.0/node_modules/bech32/dist/index.js"(exports) {
|
3001
|
+
"use strict";
|
3002
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3003
|
+
exports.bech32m = exports.bech32 = void 0;
|
3004
|
+
var ALPHABET = "qpzry9x8gf2tvdw0s3jn54khce6mua7l";
|
3005
|
+
var ALPHABET_MAP = {};
|
3006
|
+
for (let z = 0; z < ALPHABET.length; z++) {
|
3007
|
+
const x = ALPHABET.charAt(z);
|
3008
|
+
ALPHABET_MAP[x] = z;
|
3009
|
+
}
|
3010
|
+
function polymodStep(pre) {
|
3011
|
+
const b = pre >> 25;
|
3012
|
+
return (pre & 33554431) << 5 ^ -(b >> 0 & 1) & 996825010 ^ -(b >> 1 & 1) & 642813549 ^ -(b >> 2 & 1) & 513874426 ^ -(b >> 3 & 1) & 1027748829 ^ -(b >> 4 & 1) & 705979059;
|
3013
|
+
}
|
3014
|
+
function prefixChk(prefix) {
|
3015
|
+
let chk = 1;
|
3016
|
+
for (let i = 0; i < prefix.length; ++i) {
|
3017
|
+
const c = prefix.charCodeAt(i);
|
3018
|
+
if (c < 33 || c > 126)
|
3019
|
+
return "Invalid prefix (" + prefix + ")";
|
3020
|
+
chk = polymodStep(chk) ^ c >> 5;
|
3021
|
+
}
|
3022
|
+
chk = polymodStep(chk);
|
3023
|
+
for (let i = 0; i < prefix.length; ++i) {
|
3024
|
+
const v = prefix.charCodeAt(i);
|
3025
|
+
chk = polymodStep(chk) ^ v & 31;
|
3026
|
+
}
|
3027
|
+
return chk;
|
3028
|
+
}
|
3029
|
+
function convert2(data, inBits, outBits, pad3) {
|
3030
|
+
let value = 0;
|
3031
|
+
let bits = 0;
|
3032
|
+
const maxV = (1 << outBits) - 1;
|
3033
|
+
const result = [];
|
3034
|
+
for (let i = 0; i < data.length; ++i) {
|
3035
|
+
value = value << inBits | data[i];
|
3036
|
+
bits += inBits;
|
3037
|
+
while (bits >= outBits) {
|
3038
|
+
bits -= outBits;
|
3039
|
+
result.push(value >> bits & maxV);
|
3040
|
+
}
|
3041
|
+
}
|
3042
|
+
if (pad3) {
|
3043
|
+
if (bits > 0) {
|
3044
|
+
result.push(value << outBits - bits & maxV);
|
3045
|
+
}
|
3046
|
+
} else {
|
3047
|
+
if (bits >= inBits)
|
3048
|
+
return "Excess padding";
|
3049
|
+
if (value << outBits - bits & maxV)
|
3050
|
+
return "Non-zero padding";
|
3051
|
+
}
|
3052
|
+
return result;
|
3053
|
+
}
|
3054
|
+
function toWords(bytes2) {
|
3055
|
+
return convert2(bytes2, 8, 5, true);
|
3056
|
+
}
|
3057
|
+
function fromWordsUnsafe(words) {
|
3058
|
+
const res = convert2(words, 5, 8, false);
|
3059
|
+
if (Array.isArray(res))
|
3060
|
+
return res;
|
3061
|
+
}
|
3062
|
+
function fromWords(words) {
|
3063
|
+
const res = convert2(words, 5, 8, false);
|
3064
|
+
if (Array.isArray(res))
|
3065
|
+
return res;
|
3066
|
+
throw new Error(res);
|
3067
|
+
}
|
3068
|
+
function getLibraryFromEncoding(encoding) {
|
3069
|
+
let ENCODING_CONST;
|
3070
|
+
if (encoding === "bech32") {
|
3071
|
+
ENCODING_CONST = 1;
|
3072
|
+
} else {
|
3073
|
+
ENCODING_CONST = 734539939;
|
3074
|
+
}
|
3075
|
+
function encode(prefix, words, LIMIT) {
|
3076
|
+
LIMIT = LIMIT || 90;
|
3077
|
+
if (prefix.length + 7 + words.length > LIMIT)
|
3078
|
+
throw new TypeError("Exceeds length limit");
|
3079
|
+
prefix = prefix.toLowerCase();
|
3080
|
+
let chk = prefixChk(prefix);
|
3081
|
+
if (typeof chk === "string")
|
3082
|
+
throw new Error(chk);
|
3083
|
+
let result = prefix + "1";
|
3084
|
+
for (let i = 0; i < words.length; ++i) {
|
3085
|
+
const x = words[i];
|
3086
|
+
if (x >> 5 !== 0)
|
3087
|
+
throw new Error("Non 5-bit word");
|
3088
|
+
chk = polymodStep(chk) ^ x;
|
3089
|
+
result += ALPHABET.charAt(x);
|
3090
|
+
}
|
3091
|
+
for (let i = 0; i < 6; ++i) {
|
3092
|
+
chk = polymodStep(chk);
|
3093
|
+
}
|
3094
|
+
chk ^= ENCODING_CONST;
|
3095
|
+
for (let i = 0; i < 6; ++i) {
|
3096
|
+
const v = chk >> (5 - i) * 5 & 31;
|
3097
|
+
result += ALPHABET.charAt(v);
|
3098
|
+
}
|
3099
|
+
return result;
|
3100
|
+
}
|
3101
|
+
function __decode(str, LIMIT) {
|
3102
|
+
LIMIT = LIMIT || 90;
|
3103
|
+
if (str.length < 8)
|
3104
|
+
return str + " too short";
|
3105
|
+
if (str.length > LIMIT)
|
3106
|
+
return "Exceeds length limit";
|
3107
|
+
const lowered = str.toLowerCase();
|
3108
|
+
const uppered = str.toUpperCase();
|
3109
|
+
if (str !== lowered && str !== uppered)
|
3110
|
+
return "Mixed-case string " + str;
|
3111
|
+
str = lowered;
|
3112
|
+
const split2 = str.lastIndexOf("1");
|
3113
|
+
if (split2 === -1)
|
3114
|
+
return "No separator character for " + str;
|
3115
|
+
if (split2 === 0)
|
3116
|
+
return "Missing prefix for " + str;
|
3117
|
+
const prefix = str.slice(0, split2);
|
3118
|
+
const wordChars = str.slice(split2 + 1);
|
3119
|
+
if (wordChars.length < 6)
|
3120
|
+
return "Data too short";
|
3121
|
+
let chk = prefixChk(prefix);
|
3122
|
+
if (typeof chk === "string")
|
3123
|
+
return chk;
|
3124
|
+
const words = [];
|
3125
|
+
for (let i = 0; i < wordChars.length; ++i) {
|
3126
|
+
const c = wordChars.charAt(i);
|
3127
|
+
const v = ALPHABET_MAP[c];
|
3128
|
+
if (v === void 0)
|
3129
|
+
return "Unknown character " + c;
|
3130
|
+
chk = polymodStep(chk) ^ v;
|
3131
|
+
if (i + 6 >= wordChars.length)
|
3132
|
+
continue;
|
3133
|
+
words.push(v);
|
3134
|
+
}
|
3135
|
+
if (chk !== ENCODING_CONST)
|
3136
|
+
return "Invalid checksum for " + str;
|
3137
|
+
return { prefix, words };
|
3138
|
+
}
|
3139
|
+
function decodeUnsafe(str, LIMIT) {
|
3140
|
+
const res = __decode(str, LIMIT);
|
3141
|
+
if (typeof res === "object")
|
3142
|
+
return res;
|
3143
|
+
}
|
3144
|
+
function decode(str, LIMIT) {
|
3145
|
+
const res = __decode(str, LIMIT);
|
3146
|
+
if (typeof res === "object")
|
3147
|
+
return res;
|
3148
|
+
throw new Error(res);
|
3149
|
+
}
|
3150
|
+
return {
|
3151
|
+
decodeUnsafe,
|
3152
|
+
decode,
|
3153
|
+
encode,
|
3154
|
+
toWords,
|
3155
|
+
fromWordsUnsafe,
|
3156
|
+
fromWords
|
3157
|
+
};
|
3158
|
+
}
|
3159
|
+
exports.bech32 = getLibraryFromEncoding("bech32");
|
3160
|
+
exports.bech32m = getLibraryFromEncoding("bech32m");
|
3161
|
+
}
|
3162
|
+
});
|
3163
|
+
|
3164
3164
|
// ../../node_modules/.pnpm/webidl-conversions@3.0.1/node_modules/webidl-conversions/lib/index.js
|
3165
3165
|
var require_lib = __commonJS({
|
3166
3166
|
"../../node_modules/.pnpm/webidl-conversions@3.0.1/node_modules/webidl-conversions/lib/index.js"(exports, module) {
|
@@ -3591,18 +3591,18 @@
|
|
3591
3591
|
}
|
3592
3592
|
function utf8PercentDecode(str) {
|
3593
3593
|
const input = new Buffer(str);
|
3594
|
-
const
|
3594
|
+
const output2 = [];
|
3595
3595
|
for (let i = 0; i < input.length; ++i) {
|
3596
3596
|
if (input[i] !== 37) {
|
3597
|
-
|
3597
|
+
output2.push(input[i]);
|
3598
3598
|
} else if (input[i] === 37 && isASCIIHex(input[i + 1]) && isASCIIHex(input[i + 2])) {
|
3599
|
-
|
3599
|
+
output2.push(parseInt(input.slice(i + 1, i + 3).toString(), 16));
|
3600
3600
|
i += 2;
|
3601
3601
|
} else {
|
3602
|
-
|
3602
|
+
output2.push(input[i]);
|
3603
3603
|
}
|
3604
3604
|
}
|
3605
|
-
return new Buffer(
|
3605
|
+
return new Buffer(output2).toString();
|
3606
3606
|
}
|
3607
3607
|
function isC0ControlPercentEncode(c) {
|
3608
3608
|
return c <= 31 || c > 126;
|
@@ -3678,16 +3678,16 @@
|
|
3678
3678
|
return ipv4;
|
3679
3679
|
}
|
3680
3680
|
function serializeIPv4(address) {
|
3681
|
-
let
|
3681
|
+
let output2 = "";
|
3682
3682
|
let n = address;
|
3683
3683
|
for (let i = 1; i <= 4; ++i) {
|
3684
|
-
|
3684
|
+
output2 = String(n % 256) + output2;
|
3685
3685
|
if (i !== 4) {
|
3686
|
-
|
3686
|
+
output2 = "." + output2;
|
3687
3687
|
}
|
3688
3688
|
n = Math.floor(n / 256);
|
3689
3689
|
}
|
3690
|
-
return
|
3690
|
+
return output2;
|
3691
3691
|
}
|
3692
3692
|
function parseIPv6(input) {
|
3693
3693
|
const address = [0, 0, 0, 0, 0, 0, 0, 0];
|
@@ -3745,13 +3745,13 @@
|
|
3745
3745
|
return failure;
|
3746
3746
|
}
|
3747
3747
|
while (isASCIIDigit(input[pointer])) {
|
3748
|
-
const
|
3748
|
+
const number2 = parseInt(at(input, pointer));
|
3749
3749
|
if (ipv4Piece === null) {
|
3750
|
-
ipv4Piece =
|
3750
|
+
ipv4Piece = number2;
|
3751
3751
|
} else if (ipv4Piece === 0) {
|
3752
3752
|
return failure;
|
3753
3753
|
} else {
|
3754
|
-
ipv4Piece = ipv4Piece * 10 +
|
3754
|
+
ipv4Piece = ipv4Piece * 10 + number2;
|
3755
3755
|
}
|
3756
3756
|
if (ipv4Piece > 255) {
|
3757
3757
|
return failure;
|
@@ -3795,7 +3795,7 @@
|
|
3795
3795
|
return address;
|
3796
3796
|
}
|
3797
3797
|
function serializeIPv6(address) {
|
3798
|
-
let
|
3798
|
+
let output2 = "";
|
3799
3799
|
const seqResult = findLongestZeroSequence(address);
|
3800
3800
|
const compress = seqResult.idx;
|
3801
3801
|
let ignore0 = false;
|
@@ -3807,16 +3807,16 @@
|
|
3807
3807
|
}
|
3808
3808
|
if (compress === pieceIndex) {
|
3809
3809
|
const separator = pieceIndex === 0 ? "::" : ":";
|
3810
|
-
|
3810
|
+
output2 += separator;
|
3811
3811
|
ignore0 = true;
|
3812
3812
|
continue;
|
3813
3813
|
}
|
3814
|
-
|
3814
|
+
output2 += address[pieceIndex].toString(16);
|
3815
3815
|
if (pieceIndex !== 7) {
|
3816
|
-
|
3816
|
+
output2 += ":";
|
3817
3817
|
}
|
3818
3818
|
}
|
3819
|
-
return
|
3819
|
+
return output2;
|
3820
3820
|
}
|
3821
3821
|
function parseHost(input, isSpecialArg) {
|
3822
3822
|
if (input[0] === "[") {
|
@@ -3846,12 +3846,12 @@
|
|
3846
3846
|
if (containsForbiddenHostCodePointExcludingPercent(input)) {
|
3847
3847
|
return failure;
|
3848
3848
|
}
|
3849
|
-
let
|
3849
|
+
let output2 = "";
|
3850
3850
|
const decoded = punycode.ucs2.decode(input);
|
3851
3851
|
for (let i = 0; i < decoded.length; ++i) {
|
3852
|
-
|
3852
|
+
output2 += percentEncodeChar(decoded[i], isC0ControlPercentEncode);
|
3853
3853
|
}
|
3854
|
-
return
|
3854
|
+
return output2;
|
3855
3855
|
}
|
3856
3856
|
function findLongestZeroSequence(arr) {
|
3857
3857
|
let maxIdx = null;
|
@@ -4476,37 +4476,37 @@
|
|
4476
4476
|
return true;
|
4477
4477
|
};
|
4478
4478
|
function serializeURL(url, excludeFragment) {
|
4479
|
-
let
|
4479
|
+
let output2 = url.scheme + ":";
|
4480
4480
|
if (url.host !== null) {
|
4481
|
-
|
4481
|
+
output2 += "//";
|
4482
4482
|
if (url.username !== "" || url.password !== "") {
|
4483
|
-
|
4483
|
+
output2 += url.username;
|
4484
4484
|
if (url.password !== "") {
|
4485
|
-
|
4485
|
+
output2 += ":" + url.password;
|
4486
4486
|
}
|
4487
|
-
|
4487
|
+
output2 += "@";
|
4488
4488
|
}
|
4489
|
-
|
4489
|
+
output2 += serializeHost(url.host);
|
4490
4490
|
if (url.port !== null) {
|
4491
|
-
|
4491
|
+
output2 += ":" + url.port;
|
4492
4492
|
}
|
4493
4493
|
} else if (url.host === null && url.scheme === "file") {
|
4494
|
-
|
4494
|
+
output2 += "//";
|
4495
4495
|
}
|
4496
4496
|
if (url.cannotBeABaseURL) {
|
4497
|
-
|
4497
|
+
output2 += url.path[0];
|
4498
4498
|
} else {
|
4499
4499
|
for (const string of url.path) {
|
4500
|
-
|
4500
|
+
output2 += "/" + string;
|
4501
4501
|
}
|
4502
4502
|
}
|
4503
4503
|
if (url.query !== null) {
|
4504
|
-
|
4504
|
+
output2 += "?" + url.query;
|
4505
4505
|
}
|
4506
4506
|
if (!excludeFragment && url.fragment !== null) {
|
4507
|
-
|
4507
|
+
output2 += "#" + url.fragment;
|
4508
4508
|
}
|
4509
|
-
return
|
4509
|
+
return output2;
|
4510
4510
|
}
|
4511
4511
|
function serializeOrigin(tuple) {
|
4512
4512
|
let result = tuple.scheme + "://";
|
@@ -6450,19 +6450,19 @@
|
|
6450
6450
|
return "GraphQLError";
|
6451
6451
|
}
|
6452
6452
|
toString() {
|
6453
|
-
let
|
6453
|
+
let output2 = this.message;
|
6454
6454
|
if (this.nodes) {
|
6455
6455
|
for (const node of this.nodes) {
|
6456
6456
|
if (node.loc) {
|
6457
|
-
|
6457
|
+
output2 += "\n\n" + (0, _printLocation.printLocation)(node.loc);
|
6458
6458
|
}
|
6459
6459
|
}
|
6460
6460
|
} else if (this.source && this.locations) {
|
6461
6461
|
for (const location of this.locations) {
|
6462
|
-
|
6462
|
+
output2 += "\n\n" + (0, _printLocation.printSourceLocation)(this.source, location);
|
6463
6463
|
}
|
6464
6464
|
}
|
6465
|
-
return
|
6465
|
+
return output2;
|
6466
6466
|
}
|
6467
6467
|
toJSON() {
|
6468
6468
|
const formattedError = {
|
@@ -18777,7 +18777,7 @@ spurious results.`);
|
|
18777
18777
|
module.exports = iterate;
|
18778
18778
|
function iterate(list, iterator, state, callback) {
|
18779
18779
|
var key = state["keyedList"] ? state["keyedList"][state.index] : state.index;
|
18780
|
-
state.jobs[key] = runJob(iterator, key, list[key], function(error,
|
18780
|
+
state.jobs[key] = runJob(iterator, key, list[key], function(error, output2) {
|
18781
18781
|
if (!(key in state.jobs)) {
|
18782
18782
|
return;
|
18783
18783
|
}
|
@@ -18785,7 +18785,7 @@ spurious results.`);
|
|
18785
18785
|
if (error) {
|
18786
18786
|
abort(state);
|
18787
18787
|
} else {
|
18788
|
-
state.results[key] =
|
18788
|
+
state.results[key] = output2;
|
18789
18789
|
}
|
18790
18790
|
callback(error, state.results);
|
18791
18791
|
});
|
@@ -20547,8 +20547,8 @@ spurious results.`);
|
|
20547
20547
|
const ret3 = wasm$1.retd(addr, len);
|
20548
20548
|
return Instruction.__wrap(ret3);
|
20549
20549
|
}
|
20550
|
-
function aloc(
|
20551
|
-
const ret3 = wasm$1.aloc(
|
20550
|
+
function aloc(bytes2) {
|
20551
|
+
const ret3 = wasm$1.aloc(bytes2);
|
20552
20552
|
return Instruction.__wrap(ret3);
|
20553
20553
|
}
|
20554
20554
|
function mcl(dst_addr, len) {
|
@@ -21762,9 +21762,9 @@ spurious results.`);
|
|
21762
21762
|
* Construct the instruction from its parts.
|
21763
21763
|
* @param {RegId} bytes
|
21764
21764
|
*/
|
21765
|
-
constructor(
|
21766
|
-
_assertClass(
|
21767
|
-
var ptr0 =
|
21765
|
+
constructor(bytes2) {
|
21766
|
+
_assertClass(bytes2, RegId);
|
21767
|
+
var ptr0 = bytes2.__destroy_into_raw();
|
21768
21768
|
const ret3 = wasm$1.aloc_new_typescript(ptr0);
|
21769
21769
|
this.__wbg_ptr = ret3 >>> 0;
|
21770
21770
|
return this;
|
@@ -28301,8 +28301,8 @@ spurious results.`);
|
|
28301
28301
|
}
|
28302
28302
|
}
|
28303
28303
|
}
|
28304
|
-
const
|
28305
|
-
return await WebAssembly.instantiate(
|
28304
|
+
const bytes2 = await module2.arrayBuffer();
|
28305
|
+
return await WebAssembly.instantiate(bytes2, imports);
|
28306
28306
|
} else {
|
28307
28307
|
const instance = await WebAssembly.instantiate(module2, imports);
|
28308
28308
|
if (instance instanceof WebAssembly.Instance) {
|
@@ -29920,9 +29920,9 @@ spurious results.`);
|
|
29920
29920
|
const chunks = arguments_.trim().split(/\s*,\s*/g);
|
29921
29921
|
let matches;
|
29922
29922
|
for (const chunk of chunks) {
|
29923
|
-
const
|
29924
|
-
if (!Number.isNaN(
|
29925
|
-
results.push(
|
29923
|
+
const number2 = Number(chunk);
|
29924
|
+
if (!Number.isNaN(number2)) {
|
29925
|
+
results.push(number2);
|
29926
29926
|
} else if (matches = chunk.match(STRING_REGEX)) {
|
29927
29927
|
results.push(matches[2].replace(ESCAPE_REGEX, (m, escape, character) => escape ? unescape(escape) : character));
|
29928
29928
|
} else {
|
@@ -30434,11 +30434,11 @@ spurious results.`);
|
|
30434
30434
|
return r;
|
30435
30435
|
}
|
30436
30436
|
function is_char(character) {
|
30437
|
-
var
|
30437
|
+
var bool = false;
|
30438
30438
|
all.filter(function(i) {
|
30439
|
-
|
30439
|
+
bool = i === character;
|
30440
30440
|
});
|
30441
|
-
return
|
30441
|
+
return bool;
|
30442
30442
|
}
|
30443
30443
|
function heComes(text2, options2) {
|
30444
30444
|
var result = "", counts, l;
|
@@ -33040,12 +33040,12 @@ spurious results.`);
|
|
33040
33040
|
createDebug.skips = [];
|
33041
33041
|
createDebug.formatters = {};
|
33042
33042
|
function selectColor(namespace) {
|
33043
|
-
var
|
33043
|
+
var hash3 = 0;
|
33044
33044
|
for (var i = 0; i < namespace.length; i++) {
|
33045
|
-
|
33046
|
-
|
33045
|
+
hash3 = (hash3 << 5) - hash3 + namespace.charCodeAt(i);
|
33046
|
+
hash3 |= 0;
|
33047
33047
|
}
|
33048
|
-
return createDebug.colors[Math.abs(
|
33048
|
+
return createDebug.colors[Math.abs(hash3) % createDebug.colors.length];
|
33049
33049
|
}
|
33050
33050
|
createDebug.selectColor = selectColor;
|
33051
33051
|
function createDebug(namespace) {
|
@@ -33832,11 +33832,11 @@ spurious results.`);
|
|
33832
33832
|
if (lengths.length > 0 && !lengths.includes(b.length))
|
33833
33833
|
throw new Error(`Expected Uint8Array of length ${lengths}, not of length=${b.length}`);
|
33834
33834
|
}
|
33835
|
-
function hash(
|
33836
|
-
if (typeof
|
33835
|
+
function hash(hash3) {
|
33836
|
+
if (typeof hash3 !== "function" || typeof hash3.create !== "function")
|
33837
33837
|
throw new Error("Hash should be wrapped by utils.wrapConstructor");
|
33838
|
-
number(
|
33839
|
-
number(
|
33838
|
+
number(hash3.outputLen);
|
33839
|
+
number(hash3.blockLen);
|
33840
33840
|
}
|
33841
33841
|
function exists(instance, checkFinished = true) {
|
33842
33842
|
if (instance.destroyed)
|
@@ -33931,25 +33931,25 @@ spurious results.`);
|
|
33931
33931
|
}
|
33932
33932
|
|
33933
33933
|
// ../../node_modules/.pnpm/@noble+hashes@1.3.3/node_modules/@noble/hashes/esm/_sha2.js
|
33934
|
-
function setBigUint64(view, byteOffset, value,
|
33934
|
+
function setBigUint64(view, byteOffset, value, isLE2) {
|
33935
33935
|
if (typeof view.setBigUint64 === "function")
|
33936
|
-
return view.setBigUint64(byteOffset, value,
|
33936
|
+
return view.setBigUint64(byteOffset, value, isLE2);
|
33937
33937
|
const _32n2 = BigInt(32);
|
33938
33938
|
const _u32_max = BigInt(4294967295);
|
33939
33939
|
const wh = Number(value >> _32n2 & _u32_max);
|
33940
33940
|
const wl = Number(value & _u32_max);
|
33941
|
-
const h =
|
33942
|
-
const l =
|
33943
|
-
view.setUint32(byteOffset + h, wh,
|
33944
|
-
view.setUint32(byteOffset + l, wl,
|
33941
|
+
const h = isLE2 ? 4 : 0;
|
33942
|
+
const l = isLE2 ? 0 : 4;
|
33943
|
+
view.setUint32(byteOffset + h, wh, isLE2);
|
33944
|
+
view.setUint32(byteOffset + l, wl, isLE2);
|
33945
33945
|
}
|
33946
33946
|
var SHA2 = class extends Hash {
|
33947
|
-
constructor(blockLen, outputLen, padOffset,
|
33947
|
+
constructor(blockLen, outputLen, padOffset, isLE2) {
|
33948
33948
|
super();
|
33949
33949
|
this.blockLen = blockLen;
|
33950
33950
|
this.outputLen = outputLen;
|
33951
33951
|
this.padOffset = padOffset;
|
33952
|
-
this.isLE =
|
33952
|
+
this.isLE = isLE2;
|
33953
33953
|
this.finished = false;
|
33954
33954
|
this.length = 0;
|
33955
33955
|
this.pos = 0;
|
@@ -33986,7 +33986,7 @@ spurious results.`);
|
|
33986
33986
|
exists(this);
|
33987
33987
|
output(out, this);
|
33988
33988
|
this.finished = true;
|
33989
|
-
const { buffer, view, blockLen, isLE:
|
33989
|
+
const { buffer, view, blockLen, isLE: isLE2 } = this;
|
33990
33990
|
let { pos } = this;
|
33991
33991
|
buffer[pos++] = 128;
|
33992
33992
|
this.buffer.subarray(pos).fill(0);
|
@@ -33996,7 +33996,7 @@ spurious results.`);
|
|
33996
33996
|
}
|
33997
33997
|
for (let i = pos; i < blockLen; i++)
|
33998
33998
|
buffer[i] = 0;
|
33999
|
-
setBigUint64(view, blockLen - 8, BigInt(this.length * 8),
|
33999
|
+
setBigUint64(view, blockLen - 8, BigInt(this.length * 8), isLE2);
|
34000
34000
|
this.process(view, 0);
|
34001
34001
|
const oview = createView(out);
|
34002
34002
|
const len = this.outputLen;
|
@@ -34007,7 +34007,7 @@ spurious results.`);
|
|
34007
34007
|
if (outLen > state.length)
|
34008
34008
|
throw new Error("_sha2: outputLen bigger than state");
|
34009
34009
|
for (let i = 0; i < outLen; i++)
|
34010
|
-
oview.setUint32(4 * i, state[i],
|
34010
|
+
oview.setUint32(4 * i, state[i], isLE2);
|
34011
34011
|
}
|
34012
34012
|
digest() {
|
34013
34013
|
const { buffer, outputLen } = this;
|
@@ -34184,24 +34184,24 @@ spurious results.`);
|
|
34184
34184
|
|
34185
34185
|
// ../../node_modules/.pnpm/@noble+hashes@1.3.3/node_modules/@noble/hashes/esm/hmac.js
|
34186
34186
|
var HMAC = class extends Hash {
|
34187
|
-
constructor(
|
34187
|
+
constructor(hash3, _key) {
|
34188
34188
|
super();
|
34189
34189
|
this.finished = false;
|
34190
34190
|
this.destroyed = false;
|
34191
|
-
hash(
|
34191
|
+
hash(hash3);
|
34192
34192
|
const key = toBytes(_key);
|
34193
|
-
this.iHash =
|
34193
|
+
this.iHash = hash3.create();
|
34194
34194
|
if (typeof this.iHash.update !== "function")
|
34195
34195
|
throw new Error("Expected instance of class which extends utils.Hash");
|
34196
34196
|
this.blockLen = this.iHash.blockLen;
|
34197
34197
|
this.outputLen = this.iHash.outputLen;
|
34198
34198
|
const blockLen = this.blockLen;
|
34199
34199
|
const pad3 = new Uint8Array(blockLen);
|
34200
|
-
pad3.set(key.length > blockLen ?
|
34200
|
+
pad3.set(key.length > blockLen ? hash3.create().update(key).digest() : key);
|
34201
34201
|
for (let i = 0; i < pad3.length; i++)
|
34202
34202
|
pad3[i] ^= 54;
|
34203
34203
|
this.iHash.update(pad3);
|
34204
|
-
this.oHash =
|
34204
|
+
this.oHash = hash3.create();
|
34205
34205
|
for (let i = 0; i < pad3.length; i++)
|
34206
34206
|
pad3[i] ^= 54 ^ 92;
|
34207
34207
|
this.oHash.update(pad3);
|
@@ -34244,12 +34244,12 @@ spurious results.`);
|
|
34244
34244
|
this.iHash.destroy();
|
34245
34245
|
}
|
34246
34246
|
};
|
34247
|
-
var hmac = (
|
34248
|
-
hmac.create = (
|
34247
|
+
var hmac = (hash3, key, message) => new HMAC(hash3, key).update(message).digest();
|
34248
|
+
hmac.create = (hash3, key) => new HMAC(hash3, key);
|
34249
34249
|
|
34250
34250
|
// ../../node_modules/.pnpm/@noble+hashes@1.3.3/node_modules/@noble/hashes/esm/pbkdf2.js
|
34251
|
-
function pbkdf2Init(
|
34252
|
-
hash(
|
34251
|
+
function pbkdf2Init(hash3, _password, _salt, _opts) {
|
34252
|
+
hash(hash3);
|
34253
34253
|
const opts = checkOpts({ dkLen: 32, asyncTick: 10 }, _opts);
|
34254
34254
|
const { c, dkLen, asyncTick } = opts;
|
34255
34255
|
number(c);
|
@@ -34260,7 +34260,7 @@ spurious results.`);
|
|
34260
34260
|
const password = toBytes(_password);
|
34261
34261
|
const salt = toBytes(_salt);
|
34262
34262
|
const DK = new Uint8Array(dkLen);
|
34263
|
-
const PRF = hmac.create(
|
34263
|
+
const PRF = hmac.create(hash3, password);
|
34264
34264
|
const PRFSalt = PRF._cloneInto().update(salt);
|
34265
34265
|
return { c, dkLen, asyncTick, DK, PRF, PRFSalt };
|
34266
34266
|
}
|
@@ -34272,8 +34272,8 @@ spurious results.`);
|
|
34272
34272
|
u.fill(0);
|
34273
34273
|
return DK;
|
34274
34274
|
}
|
34275
|
-
function pbkdf2(
|
34276
|
-
const { c, dkLen, DK, PRF, PRFSalt } = pbkdf2Init(
|
34275
|
+
function pbkdf2(hash3, password, salt, opts) {
|
34276
|
+
const { c, dkLen, DK, PRF, PRFSalt } = pbkdf2Init(hash3, password, salt, opts);
|
34277
34277
|
let prfW;
|
34278
34278
|
const arr = new Uint8Array(4);
|
34279
34279
|
const view = createView(arr);
|
@@ -34600,9 +34600,9 @@ spurious results.`);
|
|
34600
34600
|
throw new Error("XOF is not possible for this instance");
|
34601
34601
|
return this.writeInto(out);
|
34602
34602
|
}
|
34603
|
-
xof(
|
34604
|
-
number(
|
34605
|
-
return this.xofInto(new Uint8Array(
|
34603
|
+
xof(bytes2) {
|
34604
|
+
number(bytes2);
|
34605
|
+
return this.xofInto(new Uint8Array(bytes2));
|
34606
34606
|
}
|
34607
34607
|
digestInto(out) {
|
34608
34608
|
output(out, this);
|
@@ -34738,7 +34738,6 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
34738
34738
|
ErrorCode2["PARSE_FAILED"] = "parse-failed";
|
34739
34739
|
ErrorCode2["ENCODE_ERROR"] = "encode-error";
|
34740
34740
|
ErrorCode2["DECODE_ERROR"] = "decode-error";
|
34741
|
-
ErrorCode2["INVALID_CREDENTIALS"] = "invalid-credentials";
|
34742
34741
|
ErrorCode2["ENV_DEPENDENCY_MISSING"] = "env-dependency-missing";
|
34743
34742
|
ErrorCode2["INVALID_TTL"] = "invalid-ttl";
|
34744
34743
|
ErrorCode2["INVALID_INPUT_PARAMETERS"] = "invalid-input-parameters";
|
@@ -34749,6 +34748,8 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
34749
34748
|
ErrorCode2["MISSING_REQUIRED_PARAMETER"] = "missing-required-parameter";
|
34750
34749
|
ErrorCode2["INVALID_REQUEST"] = "invalid-request";
|
34751
34750
|
ErrorCode2["INVALID_TRANSFER_AMOUNT"] = "invalid-transfer-amount";
|
34751
|
+
ErrorCode2["INVALID_CREDENTIALS"] = "invalid-credentials";
|
34752
|
+
ErrorCode2["HASHER_LOCKED"] = "hasher-locked";
|
34752
34753
|
ErrorCode2["GAS_PRICE_TOO_LOW"] = "gas-price-too-low";
|
34753
34754
|
ErrorCode2["GAS_LIMIT_TOO_LOW"] = "gas-limit-too-low";
|
34754
34755
|
ErrorCode2["MAX_FEE_TOO_LOW"] = "max-fee-too-low";
|
@@ -34816,6 +34817,226 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
34816
34817
|
var FuelError = _FuelError;
|
34817
34818
|
__publicField2(FuelError, "CODES", ErrorCode);
|
34818
34819
|
|
34820
|
+
// ../math/dist/index.mjs
|
34821
|
+
var import_bn = __toESM(require_bn(), 1);
|
34822
|
+
var DEFAULT_PRECISION = 9;
|
34823
|
+
var DEFAULT_MIN_PRECISION = 3;
|
34824
|
+
var DEFAULT_DECIMAL_UNITS = 9;
|
34825
|
+
function toFixed(value, options) {
|
34826
|
+
const { precision = DEFAULT_PRECISION, minPrecision = DEFAULT_MIN_PRECISION } = options || {};
|
34827
|
+
const [valueUnits = "0", valueDecimals = "0"] = String(value || "0.0").split(".");
|
34828
|
+
const groupRegex = /(\d)(?=(\d{3})+\b)/g;
|
34829
|
+
const units = valueUnits.replace(groupRegex, "$1,");
|
34830
|
+
let decimals = valueDecimals.slice(0, precision);
|
34831
|
+
if (minPrecision < precision) {
|
34832
|
+
const trimmedDecimal = decimals.match(/.*[1-9]{1}/);
|
34833
|
+
const lastNonZeroIndex = trimmedDecimal?.[0].length || 0;
|
34834
|
+
const keepChars = Math.max(minPrecision, lastNonZeroIndex);
|
34835
|
+
decimals = decimals.slice(0, keepChars);
|
34836
|
+
}
|
34837
|
+
const decimalPortion = decimals ? `.${decimals}` : "";
|
34838
|
+
return `${units}${decimalPortion}`;
|
34839
|
+
}
|
34840
|
+
var BN = class extends import_bn.default {
|
34841
|
+
MAX_U64 = "0xFFFFFFFFFFFFFFFF";
|
34842
|
+
constructor(value, base, endian) {
|
34843
|
+
let bnValue = value;
|
34844
|
+
let bnBase = base;
|
34845
|
+
if (BN.isBN(value)) {
|
34846
|
+
bnValue = value.toArray();
|
34847
|
+
} else if (typeof value === "string" && value.slice(0, 2) === "0x") {
|
34848
|
+
bnValue = value.substring(2);
|
34849
|
+
bnBase = base || "hex";
|
34850
|
+
}
|
34851
|
+
super(bnValue == null ? 0 : bnValue, bnBase, endian);
|
34852
|
+
}
|
34853
|
+
// ANCHOR: HELPERS
|
34854
|
+
// make sure we always include `0x` in hex strings
|
34855
|
+
toString(base, length) {
|
34856
|
+
const output2 = super.toString(base, length);
|
34857
|
+
if (base === 16 || base === "hex") {
|
34858
|
+
return `0x${output2}`;
|
34859
|
+
}
|
34860
|
+
return output2;
|
34861
|
+
}
|
34862
|
+
toHex(bytesPadding) {
|
34863
|
+
const bytes2 = bytesPadding || 0;
|
34864
|
+
const bytesLength = bytes2 * 2;
|
34865
|
+
if (this.isNeg()) {
|
34866
|
+
throw new FuelError(ErrorCode.CONVERTING_FAILED, "Cannot convert negative value to hex.");
|
34867
|
+
}
|
34868
|
+
if (bytesPadding && this.byteLength() > bytesPadding) {
|
34869
|
+
throw new FuelError(
|
34870
|
+
ErrorCode.CONVERTING_FAILED,
|
34871
|
+
`Provided value ${this} is too large. It should fit within ${bytesPadding} bytes.`
|
34872
|
+
);
|
34873
|
+
}
|
34874
|
+
return this.toString(16, bytesLength);
|
34875
|
+
}
|
34876
|
+
toBytes(bytesPadding) {
|
34877
|
+
if (this.isNeg()) {
|
34878
|
+
throw new FuelError(ErrorCode.CONVERTING_FAILED, "Cannot convert negative value to bytes.");
|
34879
|
+
}
|
34880
|
+
return Uint8Array.from(this.toArray(void 0, bytesPadding));
|
34881
|
+
}
|
34882
|
+
toJSON() {
|
34883
|
+
return this.toString(16);
|
34884
|
+
}
|
34885
|
+
valueOf() {
|
34886
|
+
return this.toString();
|
34887
|
+
}
|
34888
|
+
format(options) {
|
34889
|
+
const {
|
34890
|
+
units = DEFAULT_DECIMAL_UNITS,
|
34891
|
+
precision = DEFAULT_PRECISION,
|
34892
|
+
minPrecision = DEFAULT_MIN_PRECISION
|
34893
|
+
} = options || {};
|
34894
|
+
const formattedUnits = this.formatUnits(units);
|
34895
|
+
const formattedFixed = toFixed(formattedUnits, { precision, minPrecision });
|
34896
|
+
if (!parseFloat(formattedFixed)) {
|
34897
|
+
const [, originalDecimals = "0"] = formattedUnits.split(".");
|
34898
|
+
const firstNonZero = originalDecimals.match(/[1-9]/);
|
34899
|
+
if (firstNonZero && firstNonZero.index && firstNonZero.index + 1 > precision) {
|
34900
|
+
const [valueUnits = "0"] = formattedFixed.split(".");
|
34901
|
+
return `${valueUnits}.${originalDecimals.slice(0, firstNonZero.index + 1)}`;
|
34902
|
+
}
|
34903
|
+
}
|
34904
|
+
return formattedFixed;
|
34905
|
+
}
|
34906
|
+
formatUnits(units = DEFAULT_DECIMAL_UNITS) {
|
34907
|
+
const valueUnits = this.toString().slice(0, units * -1);
|
34908
|
+
const valueDecimals = this.toString().slice(units * -1);
|
34909
|
+
const length = valueDecimals.length;
|
34910
|
+
const defaultDecimals = Array.from({ length: units - length }).fill("0").join("");
|
34911
|
+
const integerPortion = valueUnits ? `${valueUnits}.` : "0.";
|
34912
|
+
return `${integerPortion}${defaultDecimals}${valueDecimals}`;
|
34913
|
+
}
|
34914
|
+
// END ANCHOR: HELPERS
|
34915
|
+
// ANCHOR: OVERRIDES to accept better inputs
|
34916
|
+
add(v) {
|
34917
|
+
return this.caller(v, "add");
|
34918
|
+
}
|
34919
|
+
pow(v) {
|
34920
|
+
return this.caller(v, "pow");
|
34921
|
+
}
|
34922
|
+
sub(v) {
|
34923
|
+
return this.caller(v, "sub");
|
34924
|
+
}
|
34925
|
+
div(v) {
|
34926
|
+
return this.caller(v, "div");
|
34927
|
+
}
|
34928
|
+
mul(v) {
|
34929
|
+
return this.caller(v, "mul");
|
34930
|
+
}
|
34931
|
+
mod(v) {
|
34932
|
+
return this.caller(v, "mod");
|
34933
|
+
}
|
34934
|
+
divRound(v) {
|
34935
|
+
return this.caller(v, "divRound");
|
34936
|
+
}
|
34937
|
+
lt(v) {
|
34938
|
+
return this.caller(v, "lt");
|
34939
|
+
}
|
34940
|
+
lte(v) {
|
34941
|
+
return this.caller(v, "lte");
|
34942
|
+
}
|
34943
|
+
gt(v) {
|
34944
|
+
return this.caller(v, "gt");
|
34945
|
+
}
|
34946
|
+
gte(v) {
|
34947
|
+
return this.caller(v, "gte");
|
34948
|
+
}
|
34949
|
+
eq(v) {
|
34950
|
+
return this.caller(v, "eq");
|
34951
|
+
}
|
34952
|
+
cmp(v) {
|
34953
|
+
return this.caller(v, "cmp");
|
34954
|
+
}
|
34955
|
+
// END ANCHOR: OVERRIDES to accept better inputs
|
34956
|
+
// ANCHOR: OVERRIDES to output our BN type
|
34957
|
+
sqr() {
|
34958
|
+
return new BN(super.sqr().toArray());
|
34959
|
+
}
|
34960
|
+
neg() {
|
34961
|
+
return new BN(super.neg().toArray());
|
34962
|
+
}
|
34963
|
+
abs() {
|
34964
|
+
return new BN(super.abs().toArray());
|
34965
|
+
}
|
34966
|
+
toTwos(width) {
|
34967
|
+
return new BN(super.toTwos(width).toArray());
|
34968
|
+
}
|
34969
|
+
fromTwos(width) {
|
34970
|
+
return new BN(super.fromTwos(width).toArray());
|
34971
|
+
}
|
34972
|
+
// END ANCHOR: OVERRIDES to output our BN type
|
34973
|
+
// ANCHOR: OVERRIDES to avoid losing references
|
34974
|
+
caller(v, methodName) {
|
34975
|
+
const output2 = super[methodName](new BN(v));
|
34976
|
+
if (BN.isBN(output2)) {
|
34977
|
+
return new BN(output2.toArray());
|
34978
|
+
}
|
34979
|
+
if (typeof output2 === "boolean") {
|
34980
|
+
return output2;
|
34981
|
+
}
|
34982
|
+
return output2;
|
34983
|
+
}
|
34984
|
+
clone() {
|
34985
|
+
return new BN(this.toArray());
|
34986
|
+
}
|
34987
|
+
mulTo(num, out) {
|
34988
|
+
const output2 = new import_bn.default(this.toArray()).mulTo(num, out);
|
34989
|
+
return new BN(output2.toArray());
|
34990
|
+
}
|
34991
|
+
egcd(p) {
|
34992
|
+
const { a, b, gcd } = new import_bn.default(this.toArray()).egcd(p);
|
34993
|
+
return {
|
34994
|
+
a: new BN(a.toArray()),
|
34995
|
+
b: new BN(b.toArray()),
|
34996
|
+
gcd: new BN(gcd.toArray())
|
34997
|
+
};
|
34998
|
+
}
|
34999
|
+
divmod(num, mode, positive) {
|
35000
|
+
const { div, mod: mod2 } = new import_bn.default(this.toArray()).divmod(new BN(num), mode, positive);
|
35001
|
+
return {
|
35002
|
+
div: new BN(div?.toArray()),
|
35003
|
+
mod: new BN(mod2?.toArray())
|
35004
|
+
};
|
35005
|
+
}
|
35006
|
+
maxU64() {
|
35007
|
+
return this.gte(this.MAX_U64) ? new BN(this.MAX_U64) : this;
|
35008
|
+
}
|
35009
|
+
normalizeZeroToOne() {
|
35010
|
+
return this.isZero() ? new BN(1) : this;
|
35011
|
+
}
|
35012
|
+
// END ANCHOR: OVERRIDES to avoid losing references
|
35013
|
+
};
|
35014
|
+
var bn = (value, base, endian) => new BN(value, base, endian);
|
35015
|
+
bn.parseUnits = (value, units = DEFAULT_DECIMAL_UNITS) => {
|
35016
|
+
const valueToParse = value === "." ? "0." : value;
|
35017
|
+
const [valueUnits = "0", valueDecimals = "0"] = valueToParse.split(".");
|
35018
|
+
const length = valueDecimals.length;
|
35019
|
+
if (length > units) {
|
35020
|
+
throw new FuelError(
|
35021
|
+
ErrorCode.CONVERTING_FAILED,
|
35022
|
+
`Decimal can't have more than ${units} digits.`
|
35023
|
+
);
|
35024
|
+
}
|
35025
|
+
const decimals = Array.from({ length: units }).fill("0");
|
35026
|
+
decimals.splice(0, length, valueDecimals);
|
35027
|
+
const amount = `${valueUnits.replaceAll(",", "")}${decimals.join("")}`;
|
35028
|
+
return bn(amount);
|
35029
|
+
};
|
35030
|
+
function toNumber(value) {
|
35031
|
+
return bn(value).toNumber();
|
35032
|
+
}
|
35033
|
+
function toHex(value, bytesPadding) {
|
35034
|
+
return bn(value).toHex(bytesPadding);
|
35035
|
+
}
|
35036
|
+
function toBytes2(value, bytesPadding) {
|
35037
|
+
return bn(value).toBytes(bytesPadding);
|
35038
|
+
}
|
35039
|
+
|
34819
35040
|
// ../utils/dist/index.mjs
|
34820
35041
|
var __defProp3 = Object.defineProperty;
|
34821
35042
|
var __defNormalProp3 = (obj, key, value) => key in obj ? __defProp3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
@@ -34823,9 +35044,12 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
34823
35044
|
__defNormalProp3(obj, typeof key !== "symbol" ? key + "" : key, value);
|
34824
35045
|
return value;
|
34825
35046
|
};
|
34826
|
-
var arrayify = (value) => {
|
35047
|
+
var arrayify = (value, name, copy = true) => {
|
34827
35048
|
if (value instanceof Uint8Array) {
|
34828
|
-
|
35049
|
+
if (copy) {
|
35050
|
+
return new Uint8Array(value);
|
35051
|
+
}
|
35052
|
+
return value;
|
34829
35053
|
}
|
34830
35054
|
if (typeof value === "string" && value.match(/^0x([0-9a-f][0-9a-f])*$/i)) {
|
34831
35055
|
const result = new Uint8Array((value.length - 2) / 2);
|
@@ -34836,7 +35060,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
34836
35060
|
}
|
34837
35061
|
return result;
|
34838
35062
|
}
|
34839
|
-
throw new FuelError(ErrorCode.
|
35063
|
+
throw new FuelError(ErrorCode.INVALID_DATA, `invalid data - ${name || ""}`);
|
34840
35064
|
};
|
34841
35065
|
var concatBytes2 = (arrays) => {
|
34842
35066
|
const byteArrays = arrays.map((array) => {
|
@@ -34854,15 +35078,15 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
34854
35078
|
return concatenated;
|
34855
35079
|
};
|
34856
35080
|
var concat = (arrays) => {
|
34857
|
-
const
|
34858
|
-
return concatBytes2(
|
35081
|
+
const bytes2 = arrays.map((v) => arrayify(v));
|
35082
|
+
return concatBytes2(bytes2);
|
34859
35083
|
};
|
34860
35084
|
var HexCharacters = "0123456789abcdef";
|
34861
35085
|
function hexlify(data) {
|
34862
|
-
const
|
35086
|
+
const bytes2 = arrayify(data);
|
34863
35087
|
let result = "0x";
|
34864
|
-
for (let i = 0; i <
|
34865
|
-
const v =
|
35088
|
+
for (let i = 0; i < bytes2.length; i++) {
|
35089
|
+
const v = bytes2[i];
|
34866
35090
|
result += HexCharacters[(v & 240) >> 4] + HexCharacters[v & 15];
|
34867
35091
|
}
|
34868
35092
|
return result;
|
@@ -35689,681 +35913,87 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
35689
35913
|
function isDefined(value) {
|
35690
35914
|
return value !== void 0;
|
35691
35915
|
}
|
35692
|
-
|
35693
|
-
|
35694
|
-
var import_crypto7 = __toESM(__require("crypto"), 1);
|
35695
|
-
|
35696
|
-
// ../../node_modules/.pnpm/ethers@6.7.1/node_modules/ethers/lib.esm/_version.js
|
35697
|
-
var version = "6.7.1";
|
35698
|
-
|
35699
|
-
// ../../node_modules/.pnpm/ethers@6.7.1/node_modules/ethers/lib.esm/utils/properties.js
|
35700
|
-
function checkType(value, type3, name) {
|
35701
|
-
const types = type3.split("|").map((t) => t.trim());
|
35702
|
-
for (let i = 0; i < types.length; i++) {
|
35703
|
-
switch (type3) {
|
35704
|
-
case "any":
|
35705
|
-
return;
|
35706
|
-
case "bigint":
|
35707
|
-
case "boolean":
|
35708
|
-
case "number":
|
35709
|
-
case "string":
|
35710
|
-
if (typeof value === type3) {
|
35711
|
-
return;
|
35712
|
-
}
|
35713
|
-
}
|
35714
|
-
}
|
35715
|
-
const error = new Error(`invalid value for type ${type3}`);
|
35716
|
-
error.code = "INVALID_ARGUMENT";
|
35717
|
-
error.argument = `value.${name}`;
|
35718
|
-
error.value = value;
|
35719
|
-
throw error;
|
35720
|
-
}
|
35721
|
-
function defineProperties(target, values, types) {
|
35722
|
-
for (let key in values) {
|
35723
|
-
let value = values[key];
|
35724
|
-
const type3 = types ? types[key] : null;
|
35725
|
-
if (type3) {
|
35726
|
-
checkType(value, type3, key);
|
35727
|
-
}
|
35728
|
-
Object.defineProperty(target, key, { enumerable: true, value, writable: false });
|
35729
|
-
}
|
35730
|
-
}
|
35731
|
-
|
35732
|
-
// ../../node_modules/.pnpm/ethers@6.7.1/node_modules/ethers/lib.esm/utils/errors.js
|
35733
|
-
function stringify(value) {
|
35734
|
-
if (value == null) {
|
35735
|
-
return "null";
|
35736
|
-
}
|
35737
|
-
if (Array.isArray(value)) {
|
35738
|
-
return "[ " + value.map(stringify).join(", ") + " ]";
|
35739
|
-
}
|
35740
|
-
if (value instanceof Uint8Array) {
|
35741
|
-
const HEX = "0123456789abcdef";
|
35742
|
-
let result = "0x";
|
35743
|
-
for (let i = 0; i < value.length; i++) {
|
35744
|
-
result += HEX[value[i] >> 4];
|
35745
|
-
result += HEX[value[i] & 15];
|
35746
|
-
}
|
35747
|
-
return result;
|
35748
|
-
}
|
35749
|
-
if (typeof value === "object" && typeof value.toJSON === "function") {
|
35750
|
-
return stringify(value.toJSON());
|
35751
|
-
}
|
35752
|
-
switch (typeof value) {
|
35753
|
-
case "boolean":
|
35754
|
-
case "symbol":
|
35755
|
-
return value.toString();
|
35756
|
-
case "bigint":
|
35757
|
-
return BigInt(value).toString();
|
35758
|
-
case "number":
|
35759
|
-
return value.toString();
|
35760
|
-
case "string":
|
35761
|
-
return JSON.stringify(value);
|
35762
|
-
case "object": {
|
35763
|
-
const keys = Object.keys(value);
|
35764
|
-
keys.sort();
|
35765
|
-
return "{ " + keys.map((k) => `${stringify(k)}: ${stringify(value[k])}`).join(", ") + " }";
|
35766
|
-
}
|
35767
|
-
}
|
35768
|
-
return `[ COULD NOT SERIALIZE ]`;
|
35769
|
-
}
|
35770
|
-
function makeError(message, code, info) {
|
35771
|
-
{
|
35772
|
-
const details = [];
|
35773
|
-
if (info) {
|
35774
|
-
if ("message" in info || "code" in info || "name" in info) {
|
35775
|
-
throw new Error(`value will overwrite populated values: ${stringify(info)}`);
|
35776
|
-
}
|
35777
|
-
for (const key in info) {
|
35778
|
-
const value = info[key];
|
35779
|
-
details.push(key + "=" + stringify(value));
|
35780
|
-
}
|
35781
|
-
}
|
35782
|
-
details.push(`code=${code}`);
|
35783
|
-
details.push(`version=${version}`);
|
35784
|
-
if (details.length) {
|
35785
|
-
message += " (" + details.join(", ") + ")";
|
35786
|
-
}
|
35787
|
-
}
|
35788
|
-
let error;
|
35789
|
-
switch (code) {
|
35790
|
-
case "INVALID_ARGUMENT":
|
35791
|
-
error = new TypeError(message);
|
35792
|
-
break;
|
35793
|
-
case "NUMERIC_FAULT":
|
35794
|
-
case "BUFFER_OVERRUN":
|
35795
|
-
error = new RangeError(message);
|
35796
|
-
break;
|
35797
|
-
default:
|
35798
|
-
error = new Error(message);
|
35799
|
-
}
|
35800
|
-
defineProperties(error, { code });
|
35801
|
-
if (info) {
|
35802
|
-
Object.assign(error, info);
|
35803
|
-
}
|
35804
|
-
return error;
|
35805
|
-
}
|
35806
|
-
function assert(check, message, code, info) {
|
35807
|
-
if (!check) {
|
35808
|
-
throw makeError(message, code, info);
|
35809
|
-
}
|
35810
|
-
}
|
35811
|
-
function assertArgument(check, message, name, value) {
|
35812
|
-
assert(check, message, "INVALID_ARGUMENT", { argument: name, value });
|
35813
|
-
}
|
35814
|
-
var _normalizeForms = ["NFD", "NFC", "NFKD", "NFKC"].reduce((accum, form) => {
|
35815
|
-
try {
|
35816
|
-
if ("test".normalize(form) !== "test") {
|
35817
|
-
throw new Error("bad");
|
35818
|
-
}
|
35819
|
-
;
|
35820
|
-
if (form === "NFD") {
|
35821
|
-
const check = String.fromCharCode(233).normalize("NFD");
|
35822
|
-
const expected = String.fromCharCode(101, 769);
|
35823
|
-
if (check !== expected) {
|
35824
|
-
throw new Error("broken");
|
35825
|
-
}
|
35826
|
-
}
|
35827
|
-
accum.push(form);
|
35828
|
-
} catch (error) {
|
35829
|
-
}
|
35830
|
-
return accum;
|
35831
|
-
}, []);
|
35832
|
-
function assertNormalize(form) {
|
35833
|
-
assert(_normalizeForms.indexOf(form) >= 0, "platform missing String.prototype.normalize", "UNSUPPORTED_OPERATION", {
|
35834
|
-
operation: "String.prototype.normalize",
|
35835
|
-
info: { form }
|
35836
|
-
});
|
35837
|
-
}
|
35838
|
-
|
35839
|
-
// ../../node_modules/.pnpm/ethers@6.7.1/node_modules/ethers/lib.esm/utils/data.js
|
35840
|
-
function _getBytes(value, name, copy) {
|
35841
|
-
if (value instanceof Uint8Array) {
|
35842
|
-
if (copy) {
|
35843
|
-
return new Uint8Array(value);
|
35844
|
-
}
|
35845
|
-
return value;
|
35846
|
-
}
|
35847
|
-
if (typeof value === "string" && value.match(/^0x([0-9a-f][0-9a-f])*$/i)) {
|
35848
|
-
const result = new Uint8Array((value.length - 2) / 2);
|
35849
|
-
let offset = 2;
|
35850
|
-
for (let i = 0; i < result.length; i++) {
|
35851
|
-
result[i] = parseInt(value.substring(offset, offset + 2), 16);
|
35852
|
-
offset += 2;
|
35853
|
-
}
|
35854
|
-
return result;
|
35855
|
-
}
|
35856
|
-
assertArgument(false, "invalid BytesLike value", name || "value", value);
|
35857
|
-
}
|
35858
|
-
function getBytes(value, name) {
|
35859
|
-
return _getBytes(value, name, false);
|
35860
|
-
}
|
35861
|
-
var HexCharacters2 = "0123456789abcdef";
|
35862
|
-
function hexlify2(data) {
|
35863
|
-
const bytes3 = getBytes(data);
|
35864
|
-
let result = "0x";
|
35865
|
-
for (let i = 0; i < bytes3.length; i++) {
|
35866
|
-
const v = bytes3[i];
|
35867
|
-
result += HexCharacters2[(v & 240) >> 4] + HexCharacters2[v & 15];
|
35868
|
-
}
|
35869
|
-
return result;
|
35870
|
-
}
|
35871
|
-
function dataSlice(data, start, end) {
|
35872
|
-
const bytes3 = getBytes(data);
|
35873
|
-
if (end != null && end > bytes3.length) {
|
35874
|
-
assert(false, "cannot slice beyond data bounds", "BUFFER_OVERRUN", {
|
35875
|
-
buffer: bytes3,
|
35876
|
-
length: bytes3.length,
|
35877
|
-
offset: end
|
35878
|
-
});
|
35879
|
-
}
|
35880
|
-
return hexlify2(bytes3.slice(start == null ? 0 : start, end == null ? bytes3.length : end));
|
35881
|
-
}
|
35882
|
-
|
35883
|
-
// ../../node_modules/.pnpm/ethers@6.7.1/node_modules/ethers/lib.esm/utils/maths.js
|
35884
|
-
var BN_0 = BigInt(0);
|
35885
|
-
var BN_1 = BigInt(1);
|
35886
|
-
var maxValue = 9007199254740991;
|
35887
|
-
function getBigInt(value, name) {
|
35888
|
-
switch (typeof value) {
|
35889
|
-
case "bigint":
|
35890
|
-
return value;
|
35891
|
-
case "number":
|
35892
|
-
assertArgument(Number.isInteger(value), "underflow", name || "value", value);
|
35893
|
-
assertArgument(value >= -maxValue && value <= maxValue, "overflow", name || "value", value);
|
35894
|
-
return BigInt(value);
|
35895
|
-
case "string":
|
35896
|
-
try {
|
35897
|
-
if (value === "") {
|
35898
|
-
throw new Error("empty string");
|
35899
|
-
}
|
35900
|
-
if (value[0] === "-" && value[1] !== "-") {
|
35901
|
-
return -BigInt(value.substring(1));
|
35902
|
-
}
|
35903
|
-
return BigInt(value);
|
35904
|
-
} catch (e) {
|
35905
|
-
assertArgument(false, `invalid BigNumberish string: ${e.message}`, name || "value", value);
|
35906
|
-
}
|
35907
|
-
}
|
35908
|
-
assertArgument(false, "invalid BigNumberish value", name || "value", value);
|
35909
|
-
}
|
35910
|
-
function getUint(value, name) {
|
35911
|
-
const result = getBigInt(value, name);
|
35912
|
-
assert(result >= BN_0, "unsigned value cannot be negative", "NUMERIC_FAULT", {
|
35913
|
-
fault: "overflow",
|
35914
|
-
operation: "getUint",
|
35915
|
-
value
|
35916
|
-
});
|
35917
|
-
return result;
|
35918
|
-
}
|
35919
|
-
var Nibbles = "0123456789abcdef";
|
35920
|
-
function toBigInt(value) {
|
35921
|
-
if (value instanceof Uint8Array) {
|
35922
|
-
let result = "0x0";
|
35923
|
-
for (const v of value) {
|
35924
|
-
result += Nibbles[v >> 4];
|
35925
|
-
result += Nibbles[v & 15];
|
35926
|
-
}
|
35927
|
-
return BigInt(result);
|
35928
|
-
}
|
35929
|
-
return getBigInt(value);
|
35930
|
-
}
|
35931
|
-
function getNumber(value, name) {
|
35932
|
-
switch (typeof value) {
|
35933
|
-
case "bigint":
|
35934
|
-
assertArgument(value >= -maxValue && value <= maxValue, "overflow", name || "value", value);
|
35935
|
-
return Number(value);
|
35936
|
-
case "number":
|
35937
|
-
assertArgument(Number.isInteger(value), "underflow", name || "value", value);
|
35938
|
-
assertArgument(value >= -maxValue && value <= maxValue, "overflow", name || "value", value);
|
35939
|
-
return value;
|
35940
|
-
case "string":
|
35941
|
-
try {
|
35942
|
-
if (value === "") {
|
35943
|
-
throw new Error("empty string");
|
35944
|
-
}
|
35945
|
-
return getNumber(BigInt(value), name);
|
35946
|
-
} catch (e) {
|
35947
|
-
assertArgument(false, `invalid numeric string: ${e.message}`, name || "value", value);
|
35948
|
-
}
|
35949
|
-
}
|
35950
|
-
assertArgument(false, "invalid numeric value", name || "value", value);
|
35951
|
-
}
|
35952
|
-
function toBeHex(_value, _width) {
|
35953
|
-
const value = getUint(_value, "value");
|
35954
|
-
let result = value.toString(16);
|
35955
|
-
if (_width == null) {
|
35956
|
-
if (result.length % 2) {
|
35957
|
-
result = "0" + result;
|
35958
|
-
}
|
35959
|
-
} else {
|
35960
|
-
const width = getNumber(_width, "width");
|
35961
|
-
assert(width * 2 >= result.length, `value exceeds width (${width} bits)`, "NUMERIC_FAULT", {
|
35962
|
-
operation: "toBeHex",
|
35963
|
-
fault: "overflow",
|
35964
|
-
value: _value
|
35965
|
-
});
|
35966
|
-
while (result.length < width * 2) {
|
35967
|
-
result = "0" + result;
|
35968
|
-
}
|
35969
|
-
}
|
35970
|
-
return "0x" + result;
|
35971
|
-
}
|
35972
|
-
|
35973
|
-
// ../../node_modules/.pnpm/ethers@6.7.1/node_modules/ethers/lib.esm/utils/base58.js
|
35916
|
+
var BN_0 = bn(0);
|
35917
|
+
var BN_58 = bn(58);
|
35974
35918
|
var Alphabet = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
|
35975
35919
|
var Lookup = null;
|
35976
35920
|
function getAlpha(letter) {
|
35977
35921
|
if (Lookup == null) {
|
35978
35922
|
Lookup = {};
|
35979
35923
|
for (let i = 0; i < Alphabet.length; i++) {
|
35980
|
-
Lookup[Alphabet[i]] =
|
35924
|
+
Lookup[Alphabet[i]] = bn(i);
|
35981
35925
|
}
|
35982
35926
|
}
|
35983
35927
|
const result = Lookup[letter];
|
35984
|
-
|
35985
|
-
|
35928
|
+
if (result == null) {
|
35929
|
+
throw new FuelError(ErrorCode.INVALID_DATA, `invalid base58 value ${letter}`);
|
35930
|
+
}
|
35931
|
+
return bn(result);
|
35986
35932
|
}
|
35987
|
-
var BN_02 = BigInt(0);
|
35988
|
-
var BN_58 = BigInt(58);
|
35989
35933
|
function encodeBase58(_value) {
|
35990
|
-
|
35934
|
+
const bytes2 = arrayify(_value);
|
35935
|
+
let value = bn(bytes2);
|
35991
35936
|
let result = "";
|
35992
|
-
while (value) {
|
35993
|
-
result = Alphabet[Number(value
|
35994
|
-
value
|
35937
|
+
while (value.gt(BN_0)) {
|
35938
|
+
result = Alphabet[Number(value.mod(BN_58))] + result;
|
35939
|
+
value = value.div(BN_58);
|
35940
|
+
}
|
35941
|
+
for (let i = 0; i < bytes2.length; i++) {
|
35942
|
+
if (bytes2[i]) {
|
35943
|
+
break;
|
35944
|
+
}
|
35945
|
+
result = Alphabet[0] + result;
|
35995
35946
|
}
|
35996
35947
|
return result;
|
35997
35948
|
}
|
35998
35949
|
function decodeBase58(value) {
|
35999
|
-
let result =
|
35950
|
+
let result = BN_0;
|
36000
35951
|
for (let i = 0; i < value.length; i++) {
|
36001
|
-
result
|
36002
|
-
result
|
36003
|
-
}
|
36004
|
-
return result;
|
36005
|
-
}
|
36006
|
-
|
36007
|
-
// ../../node_modules/.pnpm/ethers@6.7.1/node_modules/ethers/lib.esm/utils/utf8.js
|
36008
|
-
function errorFunc(reason, offset, bytes3, output3, badCodepoint) {
|
36009
|
-
assertArgument(false, `invalid codepoint at offset ${offset}; ${reason}`, "bytes", bytes3);
|
36010
|
-
}
|
36011
|
-
function ignoreFunc(reason, offset, bytes3, output3, badCodepoint) {
|
36012
|
-
if (reason === "BAD_PREFIX" || reason === "UNEXPECTED_CONTINUE") {
|
36013
|
-
let i = 0;
|
36014
|
-
for (let o = offset + 1; o < bytes3.length; o++) {
|
36015
|
-
if (bytes3[o] >> 6 !== 2) {
|
36016
|
-
break;
|
36017
|
-
}
|
36018
|
-
i++;
|
36019
|
-
}
|
36020
|
-
return i;
|
36021
|
-
}
|
36022
|
-
if (reason === "OVERRUN") {
|
36023
|
-
return bytes3.length - offset - 1;
|
36024
|
-
}
|
36025
|
-
return 0;
|
36026
|
-
}
|
36027
|
-
function replaceFunc(reason, offset, bytes3, output3, badCodepoint) {
|
36028
|
-
if (reason === "OVERLONG") {
|
36029
|
-
assertArgument(typeof badCodepoint === "number", "invalid bad code point for replacement", "badCodepoint", badCodepoint);
|
36030
|
-
output3.push(badCodepoint);
|
36031
|
-
return 0;
|
36032
|
-
}
|
36033
|
-
output3.push(65533);
|
36034
|
-
return ignoreFunc(reason, offset, bytes3, output3, badCodepoint);
|
36035
|
-
}
|
36036
|
-
var Utf8ErrorFuncs = Object.freeze({
|
36037
|
-
error: errorFunc,
|
36038
|
-
ignore: ignoreFunc,
|
36039
|
-
replace: replaceFunc
|
36040
|
-
});
|
36041
|
-
function getUtf8CodePoints(_bytes, onError) {
|
36042
|
-
if (onError == null) {
|
36043
|
-
onError = Utf8ErrorFuncs.error;
|
36044
|
-
}
|
36045
|
-
const bytes3 = getBytes(_bytes, "bytes");
|
36046
|
-
const result = [];
|
36047
|
-
let i = 0;
|
36048
|
-
while (i < bytes3.length) {
|
36049
|
-
const c = bytes3[i++];
|
36050
|
-
if (c >> 7 === 0) {
|
36051
|
-
result.push(c);
|
36052
|
-
continue;
|
36053
|
-
}
|
36054
|
-
let extraLength = null;
|
36055
|
-
let overlongMask = null;
|
36056
|
-
if ((c & 224) === 192) {
|
36057
|
-
extraLength = 1;
|
36058
|
-
overlongMask = 127;
|
36059
|
-
} else if ((c & 240) === 224) {
|
36060
|
-
extraLength = 2;
|
36061
|
-
overlongMask = 2047;
|
36062
|
-
} else if ((c & 248) === 240) {
|
36063
|
-
extraLength = 3;
|
36064
|
-
overlongMask = 65535;
|
36065
|
-
} else {
|
36066
|
-
if ((c & 192) === 128) {
|
36067
|
-
i += onError("UNEXPECTED_CONTINUE", i - 1, bytes3, result);
|
36068
|
-
} else {
|
36069
|
-
i += onError("BAD_PREFIX", i - 1, bytes3, result);
|
36070
|
-
}
|
36071
|
-
continue;
|
36072
|
-
}
|
36073
|
-
if (i - 1 + extraLength >= bytes3.length) {
|
36074
|
-
i += onError("OVERRUN", i - 1, bytes3, result);
|
36075
|
-
continue;
|
36076
|
-
}
|
36077
|
-
let res = c & (1 << 8 - extraLength - 1) - 1;
|
36078
|
-
for (let j = 0; j < extraLength; j++) {
|
36079
|
-
let nextChar = bytes3[i];
|
36080
|
-
if ((nextChar & 192) != 128) {
|
36081
|
-
i += onError("MISSING_CONTINUE", i, bytes3, result);
|
36082
|
-
res = null;
|
36083
|
-
break;
|
36084
|
-
}
|
36085
|
-
;
|
36086
|
-
res = res << 6 | nextChar & 63;
|
36087
|
-
i++;
|
36088
|
-
}
|
36089
|
-
if (res === null) {
|
36090
|
-
continue;
|
36091
|
-
}
|
36092
|
-
if (res > 1114111) {
|
36093
|
-
i += onError("OUT_OF_RANGE", i - 1 - extraLength, bytes3, result, res);
|
36094
|
-
continue;
|
36095
|
-
}
|
36096
|
-
if (res >= 55296 && res <= 57343) {
|
36097
|
-
i += onError("UTF16_SURROGATE", i - 1 - extraLength, bytes3, result, res);
|
36098
|
-
continue;
|
36099
|
-
}
|
36100
|
-
if (res <= overlongMask) {
|
36101
|
-
i += onError("OVERLONG", i - 1 - extraLength, bytes3, result, res);
|
36102
|
-
continue;
|
36103
|
-
}
|
36104
|
-
result.push(res);
|
35952
|
+
result = result.mul(BN_58);
|
35953
|
+
result = result.add(getAlpha(value[i].toString()));
|
36105
35954
|
}
|
36106
35955
|
return result;
|
36107
35956
|
}
|
36108
|
-
function
|
36109
|
-
|
36110
|
-
|
36111
|
-
|
36112
|
-
}
|
36113
|
-
let result = [];
|
36114
|
-
for (let i = 0; i < str.length; i++) {
|
36115
|
-
const c = str.charCodeAt(i);
|
36116
|
-
if (c < 128) {
|
36117
|
-
result.push(c);
|
36118
|
-
} else if (c < 2048) {
|
36119
|
-
result.push(c >> 6 | 192);
|
36120
|
-
result.push(c & 63 | 128);
|
36121
|
-
} else if ((c & 64512) == 55296) {
|
36122
|
-
i++;
|
36123
|
-
const c2 = str.charCodeAt(i);
|
36124
|
-
assertArgument(i < str.length && (c2 & 64512) === 56320, "invalid surrogate pair", "str", str);
|
36125
|
-
const pair = 65536 + ((c & 1023) << 10) + (c2 & 1023);
|
36126
|
-
result.push(pair >> 18 | 240);
|
36127
|
-
result.push(pair >> 12 & 63 | 128);
|
36128
|
-
result.push(pair >> 6 & 63 | 128);
|
36129
|
-
result.push(pair & 63 | 128);
|
36130
|
-
} else {
|
36131
|
-
result.push(c >> 12 | 224);
|
36132
|
-
result.push(c >> 6 & 63 | 128);
|
36133
|
-
result.push(c & 63 | 128);
|
36134
|
-
}
|
36135
|
-
}
|
36136
|
-
return new Uint8Array(result);
|
36137
|
-
}
|
36138
|
-
function _toUtf8String(codePoints) {
|
36139
|
-
return codePoints.map((codePoint) => {
|
36140
|
-
if (codePoint <= 65535) {
|
36141
|
-
return String.fromCharCode(codePoint);
|
36142
|
-
}
|
36143
|
-
codePoint -= 65536;
|
36144
|
-
return String.fromCharCode((codePoint >> 10 & 1023) + 55296, (codePoint & 1023) + 56320);
|
36145
|
-
}).join("");
|
36146
|
-
}
|
36147
|
-
function toUtf8String(bytes3, onError) {
|
36148
|
-
return _toUtf8String(getUtf8CodePoints(bytes3, onError));
|
36149
|
-
}
|
36150
|
-
|
36151
|
-
// ../../node_modules/.pnpm/ethers@6.7.1/node_modules/ethers/lib.esm/crypto/crypto.js
|
36152
|
-
var import_crypto2 = __require("crypto");
|
36153
|
-
|
36154
|
-
// ../../node_modules/.pnpm/ethers@6.7.1/node_modules/ethers/lib.esm/crypto/hmac.js
|
36155
|
-
var locked = false;
|
36156
|
-
var _computeHmac = function(algorithm, key, data) {
|
36157
|
-
return (0, import_crypto2.createHmac)(algorithm, key).update(data).digest();
|
36158
|
-
};
|
36159
|
-
var __computeHmac = _computeHmac;
|
36160
|
-
function computeHmac(algorithm, _key, _data) {
|
36161
|
-
const key = getBytes(_key, "key");
|
36162
|
-
const data = getBytes(_data, "data");
|
36163
|
-
return hexlify2(__computeHmac(algorithm, key, data));
|
36164
|
-
}
|
36165
|
-
computeHmac._ = _computeHmac;
|
36166
|
-
computeHmac.lock = function() {
|
36167
|
-
locked = true;
|
36168
|
-
};
|
36169
|
-
computeHmac.register = function(func) {
|
36170
|
-
if (locked) {
|
36171
|
-
throw new Error("computeHmac is locked");
|
36172
|
-
}
|
36173
|
-
__computeHmac = func;
|
36174
|
-
};
|
36175
|
-
Object.freeze(computeHmac);
|
36176
|
-
|
36177
|
-
// ../../node_modules/.pnpm/@noble+hashes@1.1.2/node_modules/@noble/hashes/esm/_assert.js
|
36178
|
-
function number2(n) {
|
36179
|
-
if (!Number.isSafeInteger(n) || n < 0)
|
36180
|
-
throw new Error(`Wrong positive integer: ${n}`);
|
36181
|
-
}
|
36182
|
-
function bool(b) {
|
36183
|
-
if (typeof b !== "boolean")
|
36184
|
-
throw new Error(`Expected boolean, not ${b}`);
|
36185
|
-
}
|
36186
|
-
function bytes2(b, ...lengths) {
|
36187
|
-
if (!(b instanceof Uint8Array))
|
36188
|
-
throw new TypeError("Expected Uint8Array");
|
36189
|
-
if (lengths.length > 0 && !lengths.includes(b.length))
|
36190
|
-
throw new TypeError(`Expected Uint8Array of length ${lengths}, not of length=${b.length}`);
|
36191
|
-
}
|
36192
|
-
function hash2(hash4) {
|
36193
|
-
if (typeof hash4 !== "function" || typeof hash4.create !== "function")
|
36194
|
-
throw new Error("Hash should be wrapped by utils.wrapConstructor");
|
36195
|
-
number2(hash4.outputLen);
|
36196
|
-
number2(hash4.blockLen);
|
36197
|
-
}
|
36198
|
-
function exists2(instance, checkFinished = true) {
|
36199
|
-
if (instance.destroyed)
|
36200
|
-
throw new Error("Hash instance has been destroyed");
|
36201
|
-
if (checkFinished && instance.finished)
|
36202
|
-
throw new Error("Hash#digest() has already been called");
|
36203
|
-
}
|
36204
|
-
function output2(out, instance) {
|
36205
|
-
bytes2(out);
|
36206
|
-
const min = instance.outputLen;
|
36207
|
-
if (out.length < min) {
|
36208
|
-
throw new Error(`digestInto() expects output buffer of length at least ${min}`);
|
36209
|
-
}
|
36210
|
-
}
|
36211
|
-
var assert2 = {
|
36212
|
-
number: number2,
|
36213
|
-
bool,
|
36214
|
-
bytes: bytes2,
|
36215
|
-
hash: hash2,
|
36216
|
-
exists: exists2,
|
36217
|
-
output: output2
|
36218
|
-
};
|
36219
|
-
var assert_default = assert2;
|
36220
|
-
|
36221
|
-
// ../../node_modules/.pnpm/@noble+hashes@1.1.2/node_modules/@noble/hashes/esm/utils.js
|
36222
|
-
var createView2 = (arr) => new DataView(arr.buffer, arr.byteOffset, arr.byteLength);
|
36223
|
-
var isLE2 = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68;
|
36224
|
-
if (!isLE2)
|
36225
|
-
throw new Error("Non little-endian hardware is not supported");
|
36226
|
-
var hexes = Array.from({ length: 256 }, (v, i) => i.toString(16).padStart(2, "0"));
|
36227
|
-
function utf8ToBytes2(str) {
|
36228
|
-
if (typeof str !== "string") {
|
36229
|
-
throw new TypeError(`utf8ToBytes expected string, got ${typeof str}`);
|
36230
|
-
}
|
36231
|
-
return new TextEncoder().encode(str);
|
36232
|
-
}
|
36233
|
-
function toBytes2(data) {
|
36234
|
-
if (typeof data === "string")
|
36235
|
-
data = utf8ToBytes2(data);
|
36236
|
-
if (!(data instanceof Uint8Array))
|
36237
|
-
throw new TypeError(`Expected input type is Uint8Array (got ${typeof data})`);
|
36238
|
-
return data;
|
36239
|
-
}
|
36240
|
-
var Hash2 = class {
|
36241
|
-
// Safe version that clones internal state
|
36242
|
-
clone() {
|
36243
|
-
return this._cloneInto();
|
35957
|
+
function dataSlice(data, start, end) {
|
35958
|
+
const bytes2 = arrayify(data);
|
35959
|
+
if (end != null && end > bytes2.length) {
|
35960
|
+
throw new FuelError(ErrorCode.INVALID_DATA, "cannot slice beyond data bounds");
|
36244
35961
|
}
|
36245
|
-
|
36246
|
-
function wrapConstructor2(hashConstructor) {
|
36247
|
-
const hashC = (message) => hashConstructor().update(toBytes2(message)).digest();
|
36248
|
-
const tmp = hashConstructor();
|
36249
|
-
hashC.outputLen = tmp.outputLen;
|
36250
|
-
hashC.blockLen = tmp.blockLen;
|
36251
|
-
hashC.create = () => hashConstructor();
|
36252
|
-
return hashC;
|
35962
|
+
return hexlify(bytes2.slice(start == null ? 0 : start, end == null ? bytes2.length : end));
|
36253
35963
|
}
|
36254
35964
|
|
36255
|
-
// ../../node_modules/.pnpm/@noble+hashes@1.
|
36256
|
-
|
36257
|
-
|
36258
|
-
|
36259
|
-
const _32n2 = BigInt(32);
|
36260
|
-
const _u32_max = BigInt(4294967295);
|
36261
|
-
const wh = Number(value >> _32n2 & _u32_max);
|
36262
|
-
const wl = Number(value & _u32_max);
|
36263
|
-
const h = isLE3 ? 4 : 0;
|
36264
|
-
const l = isLE3 ? 0 : 4;
|
36265
|
-
view.setUint32(byteOffset + h, wh, isLE3);
|
36266
|
-
view.setUint32(byteOffset + l, wl, isLE3);
|
36267
|
-
}
|
36268
|
-
var SHA22 = class extends Hash2 {
|
36269
|
-
constructor(blockLen, outputLen, padOffset, isLE3) {
|
36270
|
-
super();
|
36271
|
-
this.blockLen = blockLen;
|
36272
|
-
this.outputLen = outputLen;
|
36273
|
-
this.padOffset = padOffset;
|
36274
|
-
this.isLE = isLE3;
|
36275
|
-
this.finished = false;
|
36276
|
-
this.length = 0;
|
36277
|
-
this.pos = 0;
|
36278
|
-
this.destroyed = false;
|
36279
|
-
this.buffer = new Uint8Array(blockLen);
|
36280
|
-
this.view = createView2(this.buffer);
|
36281
|
-
}
|
36282
|
-
update(data) {
|
36283
|
-
assert_default.exists(this);
|
36284
|
-
const { view, buffer, blockLen } = this;
|
36285
|
-
data = toBytes2(data);
|
36286
|
-
const len = data.length;
|
36287
|
-
for (let pos = 0; pos < len; ) {
|
36288
|
-
const take = Math.min(blockLen - this.pos, len - pos);
|
36289
|
-
if (take === blockLen) {
|
36290
|
-
const dataView = createView2(data);
|
36291
|
-
for (; blockLen <= len - pos; pos += blockLen)
|
36292
|
-
this.process(dataView, pos);
|
36293
|
-
continue;
|
36294
|
-
}
|
36295
|
-
buffer.set(data.subarray(pos, pos + take), this.pos);
|
36296
|
-
this.pos += take;
|
36297
|
-
pos += take;
|
36298
|
-
if (this.pos === blockLen) {
|
36299
|
-
this.process(view, 0);
|
36300
|
-
this.pos = 0;
|
36301
|
-
}
|
36302
|
-
}
|
36303
|
-
this.length += data.length;
|
36304
|
-
this.roundClean();
|
36305
|
-
return this;
|
36306
|
-
}
|
36307
|
-
digestInto(out) {
|
36308
|
-
assert_default.exists(this);
|
36309
|
-
assert_default.output(out, this);
|
36310
|
-
this.finished = true;
|
36311
|
-
const { buffer, view, blockLen, isLE: isLE3 } = this;
|
36312
|
-
let { pos } = this;
|
36313
|
-
buffer[pos++] = 128;
|
36314
|
-
this.buffer.subarray(pos).fill(0);
|
36315
|
-
if (this.padOffset > blockLen - pos) {
|
36316
|
-
this.process(view, 0);
|
36317
|
-
pos = 0;
|
36318
|
-
}
|
36319
|
-
for (let i = pos; i < blockLen; i++)
|
36320
|
-
buffer[i] = 0;
|
36321
|
-
setBigUint642(view, blockLen - 8, BigInt(this.length * 8), isLE3);
|
36322
|
-
this.process(view, 0);
|
36323
|
-
const oview = createView2(out);
|
36324
|
-
this.get().forEach((v, i) => oview.setUint32(4 * i, v, isLE3));
|
36325
|
-
}
|
36326
|
-
digest() {
|
36327
|
-
const { buffer, outputLen } = this;
|
36328
|
-
this.digestInto(buffer);
|
36329
|
-
const res = buffer.slice(0, outputLen);
|
36330
|
-
this.destroy();
|
36331
|
-
return res;
|
36332
|
-
}
|
36333
|
-
_cloneInto(to) {
|
36334
|
-
to || (to = new this.constructor());
|
36335
|
-
to.set(...this.get());
|
36336
|
-
const { blockLen, buffer, length, finished, destroyed, pos } = this;
|
36337
|
-
to.length = length;
|
36338
|
-
to.pos = pos;
|
36339
|
-
to.finished = finished;
|
36340
|
-
to.destroyed = destroyed;
|
36341
|
-
if (length % blockLen)
|
36342
|
-
to.buffer.set(buffer);
|
36343
|
-
return to;
|
36344
|
-
}
|
36345
|
-
};
|
36346
|
-
|
36347
|
-
// ../../node_modules/.pnpm/@noble+hashes@1.1.2/node_modules/@noble/hashes/esm/ripemd160.js
|
36348
|
-
var Rho = new Uint8Array([7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8]);
|
36349
|
-
var Id = Uint8Array.from({ length: 16 }, (_, i) => i);
|
36350
|
-
var Pi = Id.map((i) => (9 * i + 5) % 16);
|
35965
|
+
// ../../node_modules/.pnpm/@noble+hashes@1.3.3/node_modules/@noble/hashes/esm/ripemd160.js
|
35966
|
+
var Rho = /* @__PURE__ */ new Uint8Array([7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8]);
|
35967
|
+
var Id = /* @__PURE__ */ Uint8Array.from({ length: 16 }, (_, i) => i);
|
35968
|
+
var Pi = /* @__PURE__ */ Id.map((i) => (9 * i + 5) % 16);
|
36351
35969
|
var idxL = [Id];
|
36352
35970
|
var idxR = [Pi];
|
36353
35971
|
for (let i = 0; i < 4; i++)
|
36354
35972
|
for (let j of [idxL, idxR])
|
36355
35973
|
j.push(j[i].map((k) => Rho[k]));
|
36356
|
-
var shifts = [
|
35974
|
+
var shifts = /* @__PURE__ */ [
|
36357
35975
|
[11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8],
|
36358
35976
|
[12, 13, 11, 15, 6, 9, 9, 7, 12, 15, 11, 13, 7, 8, 7, 7],
|
36359
35977
|
[13, 15, 14, 11, 7, 7, 6, 8, 13, 14, 13, 12, 5, 5, 6, 9],
|
36360
35978
|
[14, 11, 12, 14, 8, 6, 5, 5, 15, 12, 15, 14, 9, 9, 8, 6],
|
36361
35979
|
[15, 12, 13, 13, 9, 5, 8, 6, 14, 11, 12, 11, 8, 6, 5, 5]
|
36362
35980
|
].map((i) => new Uint8Array(i));
|
36363
|
-
var shiftsL = idxL.map((idx, i) => idx.map((j) => shifts[i][j]));
|
36364
|
-
var shiftsR = idxR.map((idx, i) => idx.map((j) => shifts[i][j]));
|
36365
|
-
var Kl = new Uint32Array([
|
36366
|
-
|
35981
|
+
var shiftsL = /* @__PURE__ */ idxL.map((idx, i) => idx.map((j) => shifts[i][j]));
|
35982
|
+
var shiftsR = /* @__PURE__ */ idxR.map((idx, i) => idx.map((j) => shifts[i][j]));
|
35983
|
+
var Kl = /* @__PURE__ */ new Uint32Array([
|
35984
|
+
0,
|
35985
|
+
1518500249,
|
35986
|
+
1859775393,
|
35987
|
+
2400959708,
|
35988
|
+
2840853838
|
35989
|
+
]);
|
35990
|
+
var Kr = /* @__PURE__ */ new Uint32Array([
|
35991
|
+
1352829926,
|
35992
|
+
1548603684,
|
35993
|
+
1836072691,
|
35994
|
+
2053994217,
|
35995
|
+
0
|
35996
|
+
]);
|
36367
35997
|
var rotl2 = (word, shift) => word << shift | word >>> 32 - shift;
|
36368
35998
|
function f(group, x, y, z) {
|
36369
35999
|
if (group === 0)
|
@@ -36377,8 +36007,8 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
36377
36007
|
else
|
36378
36008
|
return x ^ (y | ~z);
|
36379
36009
|
}
|
36380
|
-
var BUF = new Uint32Array(16);
|
36381
|
-
var RIPEMD160 = class extends
|
36010
|
+
var BUF = /* @__PURE__ */ new Uint32Array(16);
|
36011
|
+
var RIPEMD160 = class extends SHA2 {
|
36382
36012
|
constructor() {
|
36383
36013
|
super(64, 20, 8, true);
|
36384
36014
|
this.h0 = 1732584193 | 0;
|
@@ -36427,65 +36057,60 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
36427
36057
|
this.set(0, 0, 0, 0, 0);
|
36428
36058
|
}
|
36429
36059
|
};
|
36430
|
-
var ripemd160 =
|
36060
|
+
var ripemd160 = /* @__PURE__ */ wrapConstructor(() => new RIPEMD160());
|
36431
36061
|
|
36432
|
-
//
|
36433
|
-
var
|
36434
|
-
var
|
36435
|
-
|
36062
|
+
// ../crypto/dist/index.mjs
|
36063
|
+
var import_crypto2 = __toESM(__require("crypto"), 1);
|
36064
|
+
var import_crypto3 = __require("crypto");
|
36065
|
+
var import_crypto4 = __toESM(__require("crypto"), 1);
|
36066
|
+
var import_crypto5 = __toESM(__require("crypto"), 1);
|
36067
|
+
var import_crypto6 = __require("crypto");
|
36068
|
+
var scrypt2 = (params) => {
|
36069
|
+
const { password, salt, n, p, r, dklen } = params;
|
36070
|
+
const derivedKey = scrypt(password, salt, { N: n, r, p, dkLen: dklen });
|
36071
|
+
return derivedKey;
|
36436
36072
|
};
|
36437
|
-
var
|
36073
|
+
var keccak256 = (data) => keccak_256(data);
|
36074
|
+
var locked = false;
|
36075
|
+
var helper = (data) => ripemd160(data);
|
36076
|
+
var ripemd = helper;
|
36438
36077
|
function ripemd1602(_data) {
|
36439
|
-
const data =
|
36440
|
-
return
|
36078
|
+
const data = arrayify(_data, "data");
|
36079
|
+
return ripemd(data);
|
36441
36080
|
}
|
36442
|
-
ripemd1602._ =
|
36443
|
-
ripemd1602.lock =
|
36444
|
-
|
36081
|
+
ripemd1602._ = helper;
|
36082
|
+
ripemd1602.lock = () => {
|
36083
|
+
locked = true;
|
36445
36084
|
};
|
36446
|
-
ripemd1602.register =
|
36447
|
-
if (
|
36448
|
-
throw new
|
36085
|
+
ripemd1602.register = (func) => {
|
36086
|
+
if (locked) {
|
36087
|
+
throw new FuelError(ErrorCode.HASHER_LOCKED, "ripemd160 is locked");
|
36449
36088
|
}
|
36450
|
-
|
36089
|
+
ripemd = func;
|
36451
36090
|
};
|
36452
36091
|
Object.freeze(ripemd1602);
|
36453
|
-
|
36454
|
-
|
36455
|
-
var
|
36456
|
-
var
|
36457
|
-
return (0, import_crypto2.pbkdf2Sync)(password, salt, iterations, keylen, algo);
|
36458
|
-
};
|
36459
|
-
var __pbkdf2 = _pbkdf2;
|
36092
|
+
var bufferFromString = (string, encoding = "base64") => Uint8Array.from(Buffer.from(string, encoding));
|
36093
|
+
var locked2 = false;
|
36094
|
+
var PBKDF2 = (password, salt, iterations, keylen, algo) => (0, import_crypto3.pbkdf2Sync)(password, salt, iterations, keylen, algo);
|
36095
|
+
var pBkdf2 = PBKDF2;
|
36460
36096
|
function pbkdf22(_password, _salt, iterations, keylen, algo) {
|
36461
|
-
const password =
|
36462
|
-
const salt =
|
36463
|
-
return
|
36097
|
+
const password = arrayify(_password, "password");
|
36098
|
+
const salt = arrayify(_salt, "salt");
|
36099
|
+
return hexlify(pBkdf2(password, salt, iterations, keylen, algo));
|
36464
36100
|
}
|
36465
|
-
pbkdf22._ =
|
36466
|
-
pbkdf22.lock =
|
36467
|
-
|
36101
|
+
pbkdf22._ = PBKDF2;
|
36102
|
+
pbkdf22.lock = () => {
|
36103
|
+
locked2 = true;
|
36468
36104
|
};
|
36469
|
-
pbkdf22.register =
|
36470
|
-
if (
|
36471
|
-
throw new
|
36105
|
+
pbkdf22.register = (func) => {
|
36106
|
+
if (locked2) {
|
36107
|
+
throw new FuelError(ErrorCode.HASHER_LOCKED, "pbkdf2 is locked");
|
36472
36108
|
}
|
36473
|
-
|
36109
|
+
pBkdf2 = func;
|
36474
36110
|
};
|
36475
36111
|
Object.freeze(pbkdf22);
|
36476
|
-
|
36477
|
-
|
36478
|
-
var import_crypto8 = __toESM(__require("crypto"), 1);
|
36479
|
-
var import_crypto9 = __toESM(__require("crypto"), 1);
|
36480
|
-
var scrypt3 = (params) => {
|
36481
|
-
const { password, salt, n, p, r, dklen } = params;
|
36482
|
-
const derivedKey = scrypt(password, salt, { N: n, r, p, dkLen: dklen });
|
36483
|
-
return derivedKey;
|
36484
|
-
};
|
36485
|
-
var keccak2562 = (data) => keccak_256(data);
|
36486
|
-
var bufferFromString = (string, encoding = "base64") => Uint8Array.from(Buffer.from(string, encoding));
|
36487
|
-
var randomBytes4 = (length) => {
|
36488
|
-
const randomValues = Uint8Array.from(import_crypto8.default.randomBytes(length));
|
36112
|
+
var randomBytes2 = (length) => {
|
36113
|
+
const randomValues = Uint8Array.from(import_crypto4.default.randomBytes(length));
|
36489
36114
|
return randomValues;
|
36490
36115
|
};
|
36491
36116
|
var stringFromBuffer = (buffer, encoding = "base64") => Buffer.from(buffer).toString(encoding);
|
@@ -36496,11 +36121,11 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
36496
36121
|
return arrayify(key);
|
36497
36122
|
};
|
36498
36123
|
var encrypt = async (password, data) => {
|
36499
|
-
const iv =
|
36500
|
-
const salt =
|
36124
|
+
const iv = randomBytes2(16);
|
36125
|
+
const salt = randomBytes2(32);
|
36501
36126
|
const secret = keyFromPassword(password, salt);
|
36502
36127
|
const dataBuffer = Uint8Array.from(Buffer.from(JSON.stringify(data), "utf-8"));
|
36503
|
-
const cipher = await
|
36128
|
+
const cipher = await import_crypto2.default.createCipheriv(ALGORITHM, secret, iv);
|
36504
36129
|
let cipherData = cipher.update(dataBuffer);
|
36505
36130
|
cipherData = Buffer.concat([cipherData, cipher.final()]);
|
36506
36131
|
return {
|
@@ -36514,7 +36139,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
36514
36139
|
const salt = bufferFromString(keystore.salt);
|
36515
36140
|
const secret = keyFromPassword(password, salt);
|
36516
36141
|
const encryptedText = bufferFromString(keystore.data);
|
36517
|
-
const decipher = await
|
36142
|
+
const decipher = await import_crypto2.default.createDecipheriv(ALGORITHM, secret, iv);
|
36518
36143
|
const decrypted = decipher.update(encryptedText);
|
36519
36144
|
const deBuff = Buffer.concat([decrypted, decipher.final()]);
|
36520
36145
|
const decryptedData = Buffer.from(deBuff).toString("utf-8");
|
@@ -36525,26 +36150,48 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
36525
36150
|
}
|
36526
36151
|
};
|
36527
36152
|
async function encryptJsonWalletData(data, key, iv) {
|
36528
|
-
const cipher = await
|
36153
|
+
const cipher = await import_crypto5.default.createCipheriv("aes-128-ctr", key.subarray(0, 16), iv);
|
36529
36154
|
const encrypted = Buffer.concat([cipher.update(data), cipher.final()]);
|
36530
36155
|
return new Uint8Array(encrypted);
|
36531
36156
|
}
|
36532
36157
|
async function decryptJsonWalletData(data, key, iv) {
|
36533
|
-
const decipher =
|
36158
|
+
const decipher = import_crypto5.default.createDecipheriv("aes-128-ctr", key.subarray(0, 16), iv);
|
36534
36159
|
const decrypted = await Buffer.concat([decipher.update(data), decipher.final()]);
|
36535
36160
|
return new Uint8Array(decrypted);
|
36536
36161
|
}
|
36162
|
+
var locked3 = false;
|
36163
|
+
var COMPUTEHMAC = (algorithm, key, data) => (0, import_crypto6.createHmac)(algorithm, key).update(data).digest();
|
36164
|
+
var computeHMAC = COMPUTEHMAC;
|
36165
|
+
function computeHmac(algorithm, _key, _data) {
|
36166
|
+
const key = arrayify(_key, "key");
|
36167
|
+
const data = arrayify(_data, "data");
|
36168
|
+
return hexlify(computeHMAC(algorithm, key, data));
|
36169
|
+
}
|
36170
|
+
computeHmac._ = COMPUTEHMAC;
|
36171
|
+
computeHmac.lock = () => {
|
36172
|
+
locked3 = true;
|
36173
|
+
};
|
36174
|
+
computeHmac.register = (func) => {
|
36175
|
+
if (locked3) {
|
36176
|
+
throw new FuelError(ErrorCode.HASHER_LOCKED, "computeHmac is locked");
|
36177
|
+
}
|
36178
|
+
computeHMAC = func;
|
36179
|
+
};
|
36180
|
+
Object.freeze(computeHmac);
|
36537
36181
|
var api = {
|
36538
36182
|
bufferFromString,
|
36539
36183
|
stringFromBuffer,
|
36540
36184
|
decrypt,
|
36541
36185
|
encrypt,
|
36542
36186
|
keyFromPassword,
|
36543
|
-
randomBytes:
|
36544
|
-
scrypt:
|
36545
|
-
keccak256
|
36187
|
+
randomBytes: randomBytes2,
|
36188
|
+
scrypt: scrypt2,
|
36189
|
+
keccak256,
|
36546
36190
|
decryptJsonWalletData,
|
36547
|
-
encryptJsonWalletData
|
36191
|
+
encryptJsonWalletData,
|
36192
|
+
computeHmac,
|
36193
|
+
pbkdf2: pbkdf22,
|
36194
|
+
ripemd160: ripemd1602
|
36548
36195
|
};
|
36549
36196
|
var node_default = api;
|
36550
36197
|
var {
|
@@ -36555,17 +36202,20 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
36555
36202
|
randomBytes: randomBytes22,
|
36556
36203
|
stringFromBuffer: stringFromBuffer2,
|
36557
36204
|
scrypt: scrypt22,
|
36558
|
-
keccak256:
|
36205
|
+
keccak256: keccak2562,
|
36559
36206
|
decryptJsonWalletData: decryptJsonWalletData2,
|
36560
|
-
encryptJsonWalletData: encryptJsonWalletData2
|
36207
|
+
encryptJsonWalletData: encryptJsonWalletData2,
|
36208
|
+
computeHmac: computeHmac2,
|
36209
|
+
pbkdf2: pbkdf222,
|
36210
|
+
ripemd160: ripemd16022
|
36561
36211
|
} = node_default;
|
36562
36212
|
|
36563
36213
|
// ../hasher/dist/index.mjs
|
36564
|
-
function
|
36214
|
+
function sha2562(data) {
|
36565
36215
|
return hexlify(sha256(arrayify(data)));
|
36566
36216
|
}
|
36567
|
-
function
|
36568
|
-
return
|
36217
|
+
function hash2(data) {
|
36218
|
+
return sha2562(data);
|
36569
36219
|
}
|
36570
36220
|
function uint64ToBytesBE(value) {
|
36571
36221
|
const bigIntValue = BigInt(value);
|
@@ -36575,7 +36225,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
36575
36225
|
return new Uint8Array(dataView.buffer);
|
36576
36226
|
}
|
36577
36227
|
function hashMessage(msg) {
|
36578
|
-
return
|
36228
|
+
return hash2(bufferFromString2(msg, "utf-8"));
|
36579
36229
|
}
|
36580
36230
|
|
36581
36231
|
// ../interfaces/dist/index.mjs
|
@@ -36639,7 +36289,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
36639
36289
|
};
|
36640
36290
|
var getRandomB256 = () => hexlify(randomBytes22(32));
|
36641
36291
|
var clearFirst12BytesFromB256 = (b256) => {
|
36642
|
-
let
|
36292
|
+
let bytes2;
|
36643
36293
|
try {
|
36644
36294
|
if (!isB256(b256)) {
|
36645
36295
|
throw new FuelError(
|
@@ -36647,15 +36297,15 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
36647
36297
|
`Invalid Bech32 Address: ${b256}.`
|
36648
36298
|
);
|
36649
36299
|
}
|
36650
|
-
|
36651
|
-
|
36300
|
+
bytes2 = getBytesFromBech32(toBech32(b256));
|
36301
|
+
bytes2 = hexlify(bytes2.fill(0, 0, 12));
|
36652
36302
|
} catch (error) {
|
36653
36303
|
throw new FuelError(
|
36654
36304
|
FuelError.CODES.PARSE_FAILED,
|
36655
36305
|
`Cannot generate EVM Address B256 from: ${b256}.`
|
36656
36306
|
);
|
36657
36307
|
}
|
36658
|
-
return
|
36308
|
+
return bytes2;
|
36659
36309
|
};
|
36660
36310
|
var padFirst12BytesOfEvmAddress = (address) => {
|
36661
36311
|
if (!isEvmAddress(address)) {
|
@@ -36864,226 +36514,6 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
36864
36514
|
}
|
36865
36515
|
};
|
36866
36516
|
|
36867
|
-
// ../math/dist/index.mjs
|
36868
|
-
var import_bn = __toESM(require_bn(), 1);
|
36869
|
-
var DEFAULT_PRECISION = 9;
|
36870
|
-
var DEFAULT_MIN_PRECISION = 3;
|
36871
|
-
var DEFAULT_DECIMAL_UNITS = 9;
|
36872
|
-
function toFixed(value, options) {
|
36873
|
-
const { precision = DEFAULT_PRECISION, minPrecision = DEFAULT_MIN_PRECISION } = options || {};
|
36874
|
-
const [valueUnits = "0", valueDecimals = "0"] = String(value || "0.0").split(".");
|
36875
|
-
const groupRegex = /(\d)(?=(\d{3})+\b)/g;
|
36876
|
-
const units = valueUnits.replace(groupRegex, "$1,");
|
36877
|
-
let decimals = valueDecimals.slice(0, precision);
|
36878
|
-
if (minPrecision < precision) {
|
36879
|
-
const trimmedDecimal = decimals.match(/.*[1-9]{1}/);
|
36880
|
-
const lastNonZeroIndex = trimmedDecimal?.[0].length || 0;
|
36881
|
-
const keepChars = Math.max(minPrecision, lastNonZeroIndex);
|
36882
|
-
decimals = decimals.slice(0, keepChars);
|
36883
|
-
}
|
36884
|
-
const decimalPortion = decimals ? `.${decimals}` : "";
|
36885
|
-
return `${units}${decimalPortion}`;
|
36886
|
-
}
|
36887
|
-
var BN = class extends import_bn.default {
|
36888
|
-
MAX_U64 = "0xFFFFFFFFFFFFFFFF";
|
36889
|
-
constructor(value, base, endian) {
|
36890
|
-
let bnValue = value;
|
36891
|
-
let bnBase = base;
|
36892
|
-
if (BN.isBN(value)) {
|
36893
|
-
bnValue = value.toArray();
|
36894
|
-
} else if (typeof value === "string" && value.slice(0, 2) === "0x") {
|
36895
|
-
bnValue = value.substring(2);
|
36896
|
-
bnBase = base || "hex";
|
36897
|
-
}
|
36898
|
-
super(bnValue == null ? 0 : bnValue, bnBase, endian);
|
36899
|
-
}
|
36900
|
-
// ANCHOR: HELPERS
|
36901
|
-
// make sure we always include `0x` in hex strings
|
36902
|
-
toString(base, length) {
|
36903
|
-
const output3 = super.toString(base, length);
|
36904
|
-
if (base === 16 || base === "hex") {
|
36905
|
-
return `0x${output3}`;
|
36906
|
-
}
|
36907
|
-
return output3;
|
36908
|
-
}
|
36909
|
-
toHex(bytesPadding) {
|
36910
|
-
const bytes3 = bytesPadding || 0;
|
36911
|
-
const bytesLength = bytes3 * 2;
|
36912
|
-
if (this.isNeg()) {
|
36913
|
-
throw new FuelError(ErrorCode.CONVERTING_FAILED, "Cannot convert negative value to hex.");
|
36914
|
-
}
|
36915
|
-
if (bytesPadding && this.byteLength() > bytesPadding) {
|
36916
|
-
throw new FuelError(
|
36917
|
-
ErrorCode.CONVERTING_FAILED,
|
36918
|
-
`Provided value ${this} is too large. It should fit within ${bytesPadding} bytes.`
|
36919
|
-
);
|
36920
|
-
}
|
36921
|
-
return this.toString(16, bytesLength);
|
36922
|
-
}
|
36923
|
-
toBytes(bytesPadding) {
|
36924
|
-
if (this.isNeg()) {
|
36925
|
-
throw new FuelError(ErrorCode.CONVERTING_FAILED, "Cannot convert negative value to bytes.");
|
36926
|
-
}
|
36927
|
-
return Uint8Array.from(this.toArray(void 0, bytesPadding));
|
36928
|
-
}
|
36929
|
-
toJSON() {
|
36930
|
-
return this.toString(16);
|
36931
|
-
}
|
36932
|
-
valueOf() {
|
36933
|
-
return this.toString();
|
36934
|
-
}
|
36935
|
-
format(options) {
|
36936
|
-
const {
|
36937
|
-
units = DEFAULT_DECIMAL_UNITS,
|
36938
|
-
precision = DEFAULT_PRECISION,
|
36939
|
-
minPrecision = DEFAULT_MIN_PRECISION
|
36940
|
-
} = options || {};
|
36941
|
-
const formattedUnits = this.formatUnits(units);
|
36942
|
-
const formattedFixed = toFixed(formattedUnits, { precision, minPrecision });
|
36943
|
-
if (!parseFloat(formattedFixed)) {
|
36944
|
-
const [, originalDecimals = "0"] = formattedUnits.split(".");
|
36945
|
-
const firstNonZero = originalDecimals.match(/[1-9]/);
|
36946
|
-
if (firstNonZero && firstNonZero.index && firstNonZero.index + 1 > precision) {
|
36947
|
-
const [valueUnits = "0"] = formattedFixed.split(".");
|
36948
|
-
return `${valueUnits}.${originalDecimals.slice(0, firstNonZero.index + 1)}`;
|
36949
|
-
}
|
36950
|
-
}
|
36951
|
-
return formattedFixed;
|
36952
|
-
}
|
36953
|
-
formatUnits(units = DEFAULT_DECIMAL_UNITS) {
|
36954
|
-
const valueUnits = this.toString().slice(0, units * -1);
|
36955
|
-
const valueDecimals = this.toString().slice(units * -1);
|
36956
|
-
const length = valueDecimals.length;
|
36957
|
-
const defaultDecimals = Array.from({ length: units - length }).fill("0").join("");
|
36958
|
-
const integerPortion = valueUnits ? `${valueUnits}.` : "0.";
|
36959
|
-
return `${integerPortion}${defaultDecimals}${valueDecimals}`;
|
36960
|
-
}
|
36961
|
-
// END ANCHOR: HELPERS
|
36962
|
-
// ANCHOR: OVERRIDES to accept better inputs
|
36963
|
-
add(v) {
|
36964
|
-
return this.caller(v, "add");
|
36965
|
-
}
|
36966
|
-
pow(v) {
|
36967
|
-
return this.caller(v, "pow");
|
36968
|
-
}
|
36969
|
-
sub(v) {
|
36970
|
-
return this.caller(v, "sub");
|
36971
|
-
}
|
36972
|
-
div(v) {
|
36973
|
-
return this.caller(v, "div");
|
36974
|
-
}
|
36975
|
-
mul(v) {
|
36976
|
-
return this.caller(v, "mul");
|
36977
|
-
}
|
36978
|
-
mod(v) {
|
36979
|
-
return this.caller(v, "mod");
|
36980
|
-
}
|
36981
|
-
divRound(v) {
|
36982
|
-
return this.caller(v, "divRound");
|
36983
|
-
}
|
36984
|
-
lt(v) {
|
36985
|
-
return this.caller(v, "lt");
|
36986
|
-
}
|
36987
|
-
lte(v) {
|
36988
|
-
return this.caller(v, "lte");
|
36989
|
-
}
|
36990
|
-
gt(v) {
|
36991
|
-
return this.caller(v, "gt");
|
36992
|
-
}
|
36993
|
-
gte(v) {
|
36994
|
-
return this.caller(v, "gte");
|
36995
|
-
}
|
36996
|
-
eq(v) {
|
36997
|
-
return this.caller(v, "eq");
|
36998
|
-
}
|
36999
|
-
cmp(v) {
|
37000
|
-
return this.caller(v, "cmp");
|
37001
|
-
}
|
37002
|
-
// END ANCHOR: OVERRIDES to accept better inputs
|
37003
|
-
// ANCHOR: OVERRIDES to output our BN type
|
37004
|
-
sqr() {
|
37005
|
-
return new BN(super.sqr().toArray());
|
37006
|
-
}
|
37007
|
-
neg() {
|
37008
|
-
return new BN(super.neg().toArray());
|
37009
|
-
}
|
37010
|
-
abs() {
|
37011
|
-
return new BN(super.abs().toArray());
|
37012
|
-
}
|
37013
|
-
toTwos(width) {
|
37014
|
-
return new BN(super.toTwos(width).toArray());
|
37015
|
-
}
|
37016
|
-
fromTwos(width) {
|
37017
|
-
return new BN(super.fromTwos(width).toArray());
|
37018
|
-
}
|
37019
|
-
// END ANCHOR: OVERRIDES to output our BN type
|
37020
|
-
// ANCHOR: OVERRIDES to avoid losing references
|
37021
|
-
caller(v, methodName) {
|
37022
|
-
const output3 = super[methodName](new BN(v));
|
37023
|
-
if (BN.isBN(output3)) {
|
37024
|
-
return new BN(output3.toArray());
|
37025
|
-
}
|
37026
|
-
if (typeof output3 === "boolean") {
|
37027
|
-
return output3;
|
37028
|
-
}
|
37029
|
-
return output3;
|
37030
|
-
}
|
37031
|
-
clone() {
|
37032
|
-
return new BN(this.toArray());
|
37033
|
-
}
|
37034
|
-
mulTo(num, out) {
|
37035
|
-
const output3 = new import_bn.default(this.toArray()).mulTo(num, out);
|
37036
|
-
return new BN(output3.toArray());
|
37037
|
-
}
|
37038
|
-
egcd(p) {
|
37039
|
-
const { a, b, gcd } = new import_bn.default(this.toArray()).egcd(p);
|
37040
|
-
return {
|
37041
|
-
a: new BN(a.toArray()),
|
37042
|
-
b: new BN(b.toArray()),
|
37043
|
-
gcd: new BN(gcd.toArray())
|
37044
|
-
};
|
37045
|
-
}
|
37046
|
-
divmod(num, mode, positive) {
|
37047
|
-
const { div, mod: mod2 } = new import_bn.default(this.toArray()).divmod(new BN(num), mode, positive);
|
37048
|
-
return {
|
37049
|
-
div: new BN(div?.toArray()),
|
37050
|
-
mod: new BN(mod2?.toArray())
|
37051
|
-
};
|
37052
|
-
}
|
37053
|
-
maxU64() {
|
37054
|
-
return this.gte(this.MAX_U64) ? new BN(this.MAX_U64) : this;
|
37055
|
-
}
|
37056
|
-
normalizeZeroToOne() {
|
37057
|
-
return this.isZero() ? new BN(1) : this;
|
37058
|
-
}
|
37059
|
-
// END ANCHOR: OVERRIDES to avoid losing references
|
37060
|
-
};
|
37061
|
-
var bn = (value, base, endian) => new BN(value, base, endian);
|
37062
|
-
bn.parseUnits = (value, units = DEFAULT_DECIMAL_UNITS) => {
|
37063
|
-
const valueToParse = value === "." ? "0." : value;
|
37064
|
-
const [valueUnits = "0", valueDecimals = "0"] = valueToParse.split(".");
|
37065
|
-
const length = valueDecimals.length;
|
37066
|
-
if (length > units) {
|
37067
|
-
throw new FuelError(
|
37068
|
-
ErrorCode.CONVERTING_FAILED,
|
37069
|
-
`Decimal can't have more than ${units} digits.`
|
37070
|
-
);
|
37071
|
-
}
|
37072
|
-
const decimals = Array.from({ length: units }).fill("0");
|
37073
|
-
decimals.splice(0, length, valueDecimals);
|
37074
|
-
const amount = `${valueUnits.replaceAll(",", "")}${decimals.join("")}`;
|
37075
|
-
return bn(amount);
|
37076
|
-
};
|
37077
|
-
function toNumber2(value) {
|
37078
|
-
return bn(value).toNumber();
|
37079
|
-
}
|
37080
|
-
function toHex(value, bytesPadding) {
|
37081
|
-
return bn(value).toHex(bytesPadding);
|
37082
|
-
}
|
37083
|
-
function toBytes3(value, bytesPadding) {
|
37084
|
-
return bn(value).toBytes(bytesPadding);
|
37085
|
-
}
|
37086
|
-
|
37087
36517
|
// ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_isPlaceholder.js
|
37088
36518
|
function _isPlaceholder(a) {
|
37089
36519
|
return a != null && typeof a === "object" && a["@@functional/placeholder"] === true;
|
@@ -37270,6 +36700,316 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
37270
36700
|
return coinQuantities;
|
37271
36701
|
};
|
37272
36702
|
|
36703
|
+
// ../../node_modules/.pnpm/ethers@6.7.1/node_modules/ethers/lib.esm/_version.js
|
36704
|
+
var version = "6.7.1";
|
36705
|
+
|
36706
|
+
// ../../node_modules/.pnpm/ethers@6.7.1/node_modules/ethers/lib.esm/utils/properties.js
|
36707
|
+
function checkType(value, type3, name) {
|
36708
|
+
const types = type3.split("|").map((t) => t.trim());
|
36709
|
+
for (let i = 0; i < types.length; i++) {
|
36710
|
+
switch (type3) {
|
36711
|
+
case "any":
|
36712
|
+
return;
|
36713
|
+
case "bigint":
|
36714
|
+
case "boolean":
|
36715
|
+
case "number":
|
36716
|
+
case "string":
|
36717
|
+
if (typeof value === type3) {
|
36718
|
+
return;
|
36719
|
+
}
|
36720
|
+
}
|
36721
|
+
}
|
36722
|
+
const error = new Error(`invalid value for type ${type3}`);
|
36723
|
+
error.code = "INVALID_ARGUMENT";
|
36724
|
+
error.argument = `value.${name}`;
|
36725
|
+
error.value = value;
|
36726
|
+
throw error;
|
36727
|
+
}
|
36728
|
+
function defineProperties(target, values, types) {
|
36729
|
+
for (let key in values) {
|
36730
|
+
let value = values[key];
|
36731
|
+
const type3 = types ? types[key] : null;
|
36732
|
+
if (type3) {
|
36733
|
+
checkType(value, type3, key);
|
36734
|
+
}
|
36735
|
+
Object.defineProperty(target, key, { enumerable: true, value, writable: false });
|
36736
|
+
}
|
36737
|
+
}
|
36738
|
+
|
36739
|
+
// ../../node_modules/.pnpm/ethers@6.7.1/node_modules/ethers/lib.esm/utils/errors.js
|
36740
|
+
function stringify(value) {
|
36741
|
+
if (value == null) {
|
36742
|
+
return "null";
|
36743
|
+
}
|
36744
|
+
if (Array.isArray(value)) {
|
36745
|
+
return "[ " + value.map(stringify).join(", ") + " ]";
|
36746
|
+
}
|
36747
|
+
if (value instanceof Uint8Array) {
|
36748
|
+
const HEX = "0123456789abcdef";
|
36749
|
+
let result = "0x";
|
36750
|
+
for (let i = 0; i < value.length; i++) {
|
36751
|
+
result += HEX[value[i] >> 4];
|
36752
|
+
result += HEX[value[i] & 15];
|
36753
|
+
}
|
36754
|
+
return result;
|
36755
|
+
}
|
36756
|
+
if (typeof value === "object" && typeof value.toJSON === "function") {
|
36757
|
+
return stringify(value.toJSON());
|
36758
|
+
}
|
36759
|
+
switch (typeof value) {
|
36760
|
+
case "boolean":
|
36761
|
+
case "symbol":
|
36762
|
+
return value.toString();
|
36763
|
+
case "bigint":
|
36764
|
+
return BigInt(value).toString();
|
36765
|
+
case "number":
|
36766
|
+
return value.toString();
|
36767
|
+
case "string":
|
36768
|
+
return JSON.stringify(value);
|
36769
|
+
case "object": {
|
36770
|
+
const keys = Object.keys(value);
|
36771
|
+
keys.sort();
|
36772
|
+
return "{ " + keys.map((k) => `${stringify(k)}: ${stringify(value[k])}`).join(", ") + " }";
|
36773
|
+
}
|
36774
|
+
}
|
36775
|
+
return `[ COULD NOT SERIALIZE ]`;
|
36776
|
+
}
|
36777
|
+
function makeError(message, code, info) {
|
36778
|
+
{
|
36779
|
+
const details = [];
|
36780
|
+
if (info) {
|
36781
|
+
if ("message" in info || "code" in info || "name" in info) {
|
36782
|
+
throw new Error(`value will overwrite populated values: ${stringify(info)}`);
|
36783
|
+
}
|
36784
|
+
for (const key in info) {
|
36785
|
+
const value = info[key];
|
36786
|
+
details.push(key + "=" + stringify(value));
|
36787
|
+
}
|
36788
|
+
}
|
36789
|
+
details.push(`code=${code}`);
|
36790
|
+
details.push(`version=${version}`);
|
36791
|
+
if (details.length) {
|
36792
|
+
message += " (" + details.join(", ") + ")";
|
36793
|
+
}
|
36794
|
+
}
|
36795
|
+
let error;
|
36796
|
+
switch (code) {
|
36797
|
+
case "INVALID_ARGUMENT":
|
36798
|
+
error = new TypeError(message);
|
36799
|
+
break;
|
36800
|
+
case "NUMERIC_FAULT":
|
36801
|
+
case "BUFFER_OVERRUN":
|
36802
|
+
error = new RangeError(message);
|
36803
|
+
break;
|
36804
|
+
default:
|
36805
|
+
error = new Error(message);
|
36806
|
+
}
|
36807
|
+
defineProperties(error, { code });
|
36808
|
+
if (info) {
|
36809
|
+
Object.assign(error, info);
|
36810
|
+
}
|
36811
|
+
return error;
|
36812
|
+
}
|
36813
|
+
function assert(check, message, code, info) {
|
36814
|
+
if (!check) {
|
36815
|
+
throw makeError(message, code, info);
|
36816
|
+
}
|
36817
|
+
}
|
36818
|
+
function assertArgument(check, message, name, value) {
|
36819
|
+
assert(check, message, "INVALID_ARGUMENT", { argument: name, value });
|
36820
|
+
}
|
36821
|
+
var _normalizeForms = ["NFD", "NFC", "NFKD", "NFKC"].reduce((accum, form) => {
|
36822
|
+
try {
|
36823
|
+
if ("test".normalize(form) !== "test") {
|
36824
|
+
throw new Error("bad");
|
36825
|
+
}
|
36826
|
+
;
|
36827
|
+
if (form === "NFD") {
|
36828
|
+
const check = String.fromCharCode(233).normalize("NFD");
|
36829
|
+
const expected = String.fromCharCode(101, 769);
|
36830
|
+
if (check !== expected) {
|
36831
|
+
throw new Error("broken");
|
36832
|
+
}
|
36833
|
+
}
|
36834
|
+
accum.push(form);
|
36835
|
+
} catch (error) {
|
36836
|
+
}
|
36837
|
+
return accum;
|
36838
|
+
}, []);
|
36839
|
+
function assertNormalize(form) {
|
36840
|
+
assert(_normalizeForms.indexOf(form) >= 0, "platform missing String.prototype.normalize", "UNSUPPORTED_OPERATION", {
|
36841
|
+
operation: "String.prototype.normalize",
|
36842
|
+
info: { form }
|
36843
|
+
});
|
36844
|
+
}
|
36845
|
+
|
36846
|
+
// ../../node_modules/.pnpm/ethers@6.7.1/node_modules/ethers/lib.esm/utils/data.js
|
36847
|
+
function _getBytes(value, name, copy) {
|
36848
|
+
if (value instanceof Uint8Array) {
|
36849
|
+
if (copy) {
|
36850
|
+
return new Uint8Array(value);
|
36851
|
+
}
|
36852
|
+
return value;
|
36853
|
+
}
|
36854
|
+
if (typeof value === "string" && value.match(/^0x([0-9a-f][0-9a-f])*$/i)) {
|
36855
|
+
const result = new Uint8Array((value.length - 2) / 2);
|
36856
|
+
let offset = 2;
|
36857
|
+
for (let i = 0; i < result.length; i++) {
|
36858
|
+
result[i] = parseInt(value.substring(offset, offset + 2), 16);
|
36859
|
+
offset += 2;
|
36860
|
+
}
|
36861
|
+
return result;
|
36862
|
+
}
|
36863
|
+
assertArgument(false, "invalid BytesLike value", name || "value", value);
|
36864
|
+
}
|
36865
|
+
function getBytes(value, name) {
|
36866
|
+
return _getBytes(value, name, false);
|
36867
|
+
}
|
36868
|
+
|
36869
|
+
// ../../node_modules/.pnpm/ethers@6.7.1/node_modules/ethers/lib.esm/utils/utf8.js
|
36870
|
+
function errorFunc(reason, offset, bytes2, output2, badCodepoint) {
|
36871
|
+
assertArgument(false, `invalid codepoint at offset ${offset}; ${reason}`, "bytes", bytes2);
|
36872
|
+
}
|
36873
|
+
function ignoreFunc(reason, offset, bytes2, output2, badCodepoint) {
|
36874
|
+
if (reason === "BAD_PREFIX" || reason === "UNEXPECTED_CONTINUE") {
|
36875
|
+
let i = 0;
|
36876
|
+
for (let o = offset + 1; o < bytes2.length; o++) {
|
36877
|
+
if (bytes2[o] >> 6 !== 2) {
|
36878
|
+
break;
|
36879
|
+
}
|
36880
|
+
i++;
|
36881
|
+
}
|
36882
|
+
return i;
|
36883
|
+
}
|
36884
|
+
if (reason === "OVERRUN") {
|
36885
|
+
return bytes2.length - offset - 1;
|
36886
|
+
}
|
36887
|
+
return 0;
|
36888
|
+
}
|
36889
|
+
function replaceFunc(reason, offset, bytes2, output2, badCodepoint) {
|
36890
|
+
if (reason === "OVERLONG") {
|
36891
|
+
assertArgument(typeof badCodepoint === "number", "invalid bad code point for replacement", "badCodepoint", badCodepoint);
|
36892
|
+
output2.push(badCodepoint);
|
36893
|
+
return 0;
|
36894
|
+
}
|
36895
|
+
output2.push(65533);
|
36896
|
+
return ignoreFunc(reason, offset, bytes2, output2, badCodepoint);
|
36897
|
+
}
|
36898
|
+
var Utf8ErrorFuncs = Object.freeze({
|
36899
|
+
error: errorFunc,
|
36900
|
+
ignore: ignoreFunc,
|
36901
|
+
replace: replaceFunc
|
36902
|
+
});
|
36903
|
+
function getUtf8CodePoints(_bytes, onError) {
|
36904
|
+
if (onError == null) {
|
36905
|
+
onError = Utf8ErrorFuncs.error;
|
36906
|
+
}
|
36907
|
+
const bytes2 = getBytes(_bytes, "bytes");
|
36908
|
+
const result = [];
|
36909
|
+
let i = 0;
|
36910
|
+
while (i < bytes2.length) {
|
36911
|
+
const c = bytes2[i++];
|
36912
|
+
if (c >> 7 === 0) {
|
36913
|
+
result.push(c);
|
36914
|
+
continue;
|
36915
|
+
}
|
36916
|
+
let extraLength = null;
|
36917
|
+
let overlongMask = null;
|
36918
|
+
if ((c & 224) === 192) {
|
36919
|
+
extraLength = 1;
|
36920
|
+
overlongMask = 127;
|
36921
|
+
} else if ((c & 240) === 224) {
|
36922
|
+
extraLength = 2;
|
36923
|
+
overlongMask = 2047;
|
36924
|
+
} else if ((c & 248) === 240) {
|
36925
|
+
extraLength = 3;
|
36926
|
+
overlongMask = 65535;
|
36927
|
+
} else {
|
36928
|
+
if ((c & 192) === 128) {
|
36929
|
+
i += onError("UNEXPECTED_CONTINUE", i - 1, bytes2, result);
|
36930
|
+
} else {
|
36931
|
+
i += onError("BAD_PREFIX", i - 1, bytes2, result);
|
36932
|
+
}
|
36933
|
+
continue;
|
36934
|
+
}
|
36935
|
+
if (i - 1 + extraLength >= bytes2.length) {
|
36936
|
+
i += onError("OVERRUN", i - 1, bytes2, result);
|
36937
|
+
continue;
|
36938
|
+
}
|
36939
|
+
let res = c & (1 << 8 - extraLength - 1) - 1;
|
36940
|
+
for (let j = 0; j < extraLength; j++) {
|
36941
|
+
let nextChar = bytes2[i];
|
36942
|
+
if ((nextChar & 192) != 128) {
|
36943
|
+
i += onError("MISSING_CONTINUE", i, bytes2, result);
|
36944
|
+
res = null;
|
36945
|
+
break;
|
36946
|
+
}
|
36947
|
+
;
|
36948
|
+
res = res << 6 | nextChar & 63;
|
36949
|
+
i++;
|
36950
|
+
}
|
36951
|
+
if (res === null) {
|
36952
|
+
continue;
|
36953
|
+
}
|
36954
|
+
if (res > 1114111) {
|
36955
|
+
i += onError("OUT_OF_RANGE", i - 1 - extraLength, bytes2, result, res);
|
36956
|
+
continue;
|
36957
|
+
}
|
36958
|
+
if (res >= 55296 && res <= 57343) {
|
36959
|
+
i += onError("UTF16_SURROGATE", i - 1 - extraLength, bytes2, result, res);
|
36960
|
+
continue;
|
36961
|
+
}
|
36962
|
+
if (res <= overlongMask) {
|
36963
|
+
i += onError("OVERLONG", i - 1 - extraLength, bytes2, result, res);
|
36964
|
+
continue;
|
36965
|
+
}
|
36966
|
+
result.push(res);
|
36967
|
+
}
|
36968
|
+
return result;
|
36969
|
+
}
|
36970
|
+
function toUtf8Bytes(str, form) {
|
36971
|
+
if (form != null) {
|
36972
|
+
assertNormalize(form);
|
36973
|
+
str = str.normalize(form);
|
36974
|
+
}
|
36975
|
+
let result = [];
|
36976
|
+
for (let i = 0; i < str.length; i++) {
|
36977
|
+
const c = str.charCodeAt(i);
|
36978
|
+
if (c < 128) {
|
36979
|
+
result.push(c);
|
36980
|
+
} else if (c < 2048) {
|
36981
|
+
result.push(c >> 6 | 192);
|
36982
|
+
result.push(c & 63 | 128);
|
36983
|
+
} else if ((c & 64512) == 55296) {
|
36984
|
+
i++;
|
36985
|
+
const c2 = str.charCodeAt(i);
|
36986
|
+
assertArgument(i < str.length && (c2 & 64512) === 56320, "invalid surrogate pair", "str", str);
|
36987
|
+
const pair = 65536 + ((c & 1023) << 10) + (c2 & 1023);
|
36988
|
+
result.push(pair >> 18 | 240);
|
36989
|
+
result.push(pair >> 12 & 63 | 128);
|
36990
|
+
result.push(pair >> 6 & 63 | 128);
|
36991
|
+
result.push(pair & 63 | 128);
|
36992
|
+
} else {
|
36993
|
+
result.push(c >> 12 | 224);
|
36994
|
+
result.push(c >> 6 & 63 | 128);
|
36995
|
+
result.push(c & 63 | 128);
|
36996
|
+
}
|
36997
|
+
}
|
36998
|
+
return new Uint8Array(result);
|
36999
|
+
}
|
37000
|
+
function _toUtf8String(codePoints) {
|
37001
|
+
return codePoints.map((codePoint) => {
|
37002
|
+
if (codePoint <= 65535) {
|
37003
|
+
return String.fromCharCode(codePoint);
|
37004
|
+
}
|
37005
|
+
codePoint -= 65536;
|
37006
|
+
return String.fromCharCode((codePoint >> 10 & 1023) + 55296, (codePoint & 1023) + 56320);
|
37007
|
+
}).join("");
|
37008
|
+
}
|
37009
|
+
function toUtf8String(bytes2, onError) {
|
37010
|
+
return _toUtf8String(getUtf8CodePoints(bytes2, onError));
|
37011
|
+
}
|
37012
|
+
|
37273
37013
|
// ../abi-coder/dist/index.mjs
|
37274
37014
|
var __defProp4 = Object.defineProperty;
|
37275
37015
|
var __defNormalProp4 = (obj, key, value) => key in obj ? __defProp4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
@@ -37375,24 +37115,24 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
37375
37115
|
super("bigNumber", baseType, encodedLengths[baseType]);
|
37376
37116
|
}
|
37377
37117
|
encode(value) {
|
37378
|
-
let
|
37118
|
+
let bytes2;
|
37379
37119
|
try {
|
37380
|
-
|
37120
|
+
bytes2 = toBytes2(value, this.encodedLength);
|
37381
37121
|
} catch (error) {
|
37382
37122
|
throw new FuelError(ErrorCode.ENCODE_ERROR, `Invalid ${this.type}.`);
|
37383
37123
|
}
|
37384
|
-
return
|
37124
|
+
return bytes2;
|
37385
37125
|
}
|
37386
37126
|
decode(data, offset) {
|
37387
37127
|
if (data.length < this.encodedLength) {
|
37388
37128
|
throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid ${this.type} data size.`);
|
37389
37129
|
}
|
37390
|
-
let
|
37391
|
-
|
37392
|
-
if (
|
37130
|
+
let bytes2 = data.slice(offset, offset + this.encodedLength);
|
37131
|
+
bytes2 = bytes2.slice(0, this.encodedLength);
|
37132
|
+
if (bytes2.length !== this.encodedLength) {
|
37393
37133
|
throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid ${this.type} byte data size.`);
|
37394
37134
|
}
|
37395
|
-
return [bn(
|
37135
|
+
return [bn(bytes2), offset + this.encodedLength];
|
37396
37136
|
}
|
37397
37137
|
};
|
37398
37138
|
var VEC_PROPERTY_SPACE = 3;
|
@@ -37535,15 +37275,15 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
37535
37275
|
if (data.length < this.encodedLength) {
|
37536
37276
|
throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid b256 data size.`);
|
37537
37277
|
}
|
37538
|
-
let
|
37539
|
-
const decoded = bn(
|
37278
|
+
let bytes2 = data.slice(offset, offset + this.encodedLength);
|
37279
|
+
const decoded = bn(bytes2);
|
37540
37280
|
if (decoded.isZero()) {
|
37541
|
-
|
37281
|
+
bytes2 = new Uint8Array(32);
|
37542
37282
|
}
|
37543
|
-
if (
|
37283
|
+
if (bytes2.length !== this.encodedLength) {
|
37544
37284
|
throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid b256 byte data size.`);
|
37545
37285
|
}
|
37546
|
-
return [toHex(
|
37286
|
+
return [toHex(bytes2, 32), offset + 32];
|
37547
37287
|
}
|
37548
37288
|
};
|
37549
37289
|
var B512Coder = class extends Coder {
|
@@ -37566,15 +37306,15 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
37566
37306
|
if (data.length < this.encodedLength) {
|
37567
37307
|
throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid b512 data size.`);
|
37568
37308
|
}
|
37569
|
-
let
|
37570
|
-
const decoded = bn(
|
37309
|
+
let bytes2 = data.slice(offset, offset + this.encodedLength);
|
37310
|
+
const decoded = bn(bytes2);
|
37571
37311
|
if (decoded.isZero()) {
|
37572
|
-
|
37312
|
+
bytes2 = new Uint8Array(64);
|
37573
37313
|
}
|
37574
|
-
if (
|
37314
|
+
if (bytes2.length !== this.encodedLength) {
|
37575
37315
|
throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid b512 byte data size.`);
|
37576
37316
|
}
|
37577
|
-
return [toHex(
|
37317
|
+
return [toHex(bytes2, this.encodedLength), offset + this.encodedLength];
|
37578
37318
|
}
|
37579
37319
|
};
|
37580
37320
|
var BooleanCoder = class extends Coder {
|
@@ -37594,23 +37334,23 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
37594
37334
|
if (!isTrueBool) {
|
37595
37335
|
throw new FuelError(ErrorCode.ENCODE_ERROR, `Invalid boolean value.`);
|
37596
37336
|
}
|
37597
|
-
const
|
37337
|
+
const output2 = toBytes2(value ? 1 : 0, this.paddingLength);
|
37598
37338
|
if (this.options.isRightPadded) {
|
37599
|
-
return
|
37339
|
+
return output2.reverse();
|
37600
37340
|
}
|
37601
|
-
return
|
37341
|
+
return output2;
|
37602
37342
|
}
|
37603
37343
|
decode(data, offset) {
|
37604
37344
|
if (data.length < this.paddingLength) {
|
37605
37345
|
throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid boolean data size.`);
|
37606
37346
|
}
|
37607
|
-
let
|
37347
|
+
let bytes2;
|
37608
37348
|
if (this.options.isRightPadded) {
|
37609
|
-
|
37349
|
+
bytes2 = data.slice(offset, offset + 1);
|
37610
37350
|
} else {
|
37611
|
-
|
37351
|
+
bytes2 = data.slice(offset, offset + this.paddingLength);
|
37612
37352
|
}
|
37613
|
-
const decodedValue = bn(
|
37353
|
+
const decodedValue = bn(bytes2);
|
37614
37354
|
if (decodedValue.isZero()) {
|
37615
37355
|
return [false, offset + this.paddingLength];
|
37616
37356
|
}
|
@@ -37717,7 +37457,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
37717
37457
|
let newOffset = offset;
|
37718
37458
|
let decoded;
|
37719
37459
|
[decoded, newOffset] = new BigNumberCoder("u64").decode(data, newOffset);
|
37720
|
-
const caseIndex =
|
37460
|
+
const caseIndex = toNumber(decoded);
|
37721
37461
|
const caseKey = Object.keys(this.coders)[caseIndex];
|
37722
37462
|
if (!caseKey) {
|
37723
37463
|
throw new FuelError(
|
@@ -37753,9 +37493,9 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
37753
37493
|
const [decoded, newOffset] = super.decode(data, offset);
|
37754
37494
|
return [this.toOption(decoded), newOffset];
|
37755
37495
|
}
|
37756
|
-
toOption(
|
37757
|
-
if (
|
37758
|
-
return
|
37496
|
+
toOption(output2) {
|
37497
|
+
if (output2 && "Some" in output2) {
|
37498
|
+
return output2.Some;
|
37759
37499
|
}
|
37760
37500
|
return void 0;
|
37761
37501
|
}
|
@@ -37790,30 +37530,30 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
37790
37530
|
this.options = options;
|
37791
37531
|
}
|
37792
37532
|
encode(value) {
|
37793
|
-
let
|
37533
|
+
let bytes2;
|
37794
37534
|
try {
|
37795
|
-
|
37535
|
+
bytes2 = toBytes2(value);
|
37796
37536
|
} catch (error) {
|
37797
37537
|
throw new FuelError(ErrorCode.ENCODE_ERROR, `Invalid ${this.baseType}.`);
|
37798
37538
|
}
|
37799
|
-
if (
|
37539
|
+
if (bytes2.length > this.length) {
|
37800
37540
|
throw new FuelError(ErrorCode.ENCODE_ERROR, `Invalid ${this.baseType}, too many bytes.`);
|
37801
37541
|
}
|
37802
|
-
const
|
37542
|
+
const output2 = toBytes2(bytes2, this.paddingLength);
|
37803
37543
|
if (this.baseType !== "u8") {
|
37804
|
-
return
|
37544
|
+
return output2;
|
37805
37545
|
}
|
37806
|
-
return this.options.isRightPadded ?
|
37546
|
+
return this.options.isRightPadded ? output2.reverse() : output2;
|
37807
37547
|
}
|
37808
37548
|
decodeU8(data, offset) {
|
37809
|
-
let
|
37549
|
+
let bytes2;
|
37810
37550
|
if (this.options.isRightPadded) {
|
37811
|
-
|
37551
|
+
bytes2 = data.slice(offset, offset + 1);
|
37812
37552
|
} else {
|
37813
|
-
|
37814
|
-
|
37553
|
+
bytes2 = data.slice(offset, offset + this.paddingLength);
|
37554
|
+
bytes2 = bytes2.slice(this.paddingLength - this.length, this.paddingLength);
|
37815
37555
|
}
|
37816
|
-
return [
|
37556
|
+
return [toNumber(bytes2), offset + this.paddingLength];
|
37817
37557
|
}
|
37818
37558
|
decode(data, offset) {
|
37819
37559
|
if (data.length < this.paddingLength) {
|
@@ -37822,12 +37562,12 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
37822
37562
|
if (this.baseType === "u8") {
|
37823
37563
|
return this.decodeU8(data, offset);
|
37824
37564
|
}
|
37825
|
-
let
|
37826
|
-
|
37827
|
-
if (
|
37565
|
+
let bytes2 = data.slice(offset, offset + this.paddingLength);
|
37566
|
+
bytes2 = bytes2.slice(8 - this.length, 8);
|
37567
|
+
if (bytes2.length !== this.paddingLength - (this.paddingLength - this.length)) {
|
37828
37568
|
throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid number byte data size.`);
|
37829
37569
|
}
|
37830
|
-
return [
|
37570
|
+
return [toNumber(bytes2), offset + 8];
|
37831
37571
|
}
|
37832
37572
|
};
|
37833
37573
|
var RawSliceCoder = class extends Coder {
|
@@ -37925,11 +37665,11 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
37925
37665
|
if (data.length < this.encodedLength) {
|
37926
37666
|
throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid string data size.`);
|
37927
37667
|
}
|
37928
|
-
const
|
37929
|
-
if (
|
37668
|
+
const bytes2 = data.slice(offset, offset + this.length);
|
37669
|
+
if (bytes2.length !== this.length) {
|
37930
37670
|
throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid string byte data size.`);
|
37931
37671
|
}
|
37932
|
-
const value = toUtf8String(
|
37672
|
+
const value = toUtf8String(bytes2);
|
37933
37673
|
const padding = this.#paddingLength;
|
37934
37674
|
return [value, offset + this.length + padding];
|
37935
37675
|
}
|
@@ -38340,17 +38080,17 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
38340
38080
|
if (!isTrueBool) {
|
38341
38081
|
throw new FuelError(ErrorCode.ENCODE_ERROR, `Invalid boolean value.`);
|
38342
38082
|
}
|
38343
|
-
return
|
38083
|
+
return toBytes2(value ? 1 : 0, this.encodedLength);
|
38344
38084
|
}
|
38345
38085
|
decode(data, offset) {
|
38346
38086
|
if (data.length < this.encodedLength) {
|
38347
38087
|
throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid boolean data size.`);
|
38348
38088
|
}
|
38349
|
-
const
|
38350
|
-
if (
|
38089
|
+
const bytes2 = bn(data.slice(offset, offset + this.encodedLength));
|
38090
|
+
if (bytes2.isZero()) {
|
38351
38091
|
return [false, offset + this.encodedLength];
|
38352
38092
|
}
|
38353
|
-
if (!
|
38093
|
+
if (!bytes2.eq(bn(1))) {
|
38354
38094
|
throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid boolean value.`);
|
38355
38095
|
}
|
38356
38096
|
return [true, offset + this.encodedLength];
|
@@ -38361,9 +38101,9 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
38361
38101
|
super("struct", "struct Bytes", WORD_SIZE);
|
38362
38102
|
}
|
38363
38103
|
encode(value) {
|
38364
|
-
const
|
38365
|
-
const lengthBytes = new BigNumberCoder("u64").encode(
|
38366
|
-
return new Uint8Array([...lengthBytes, ...
|
38104
|
+
const bytes2 = value instanceof Uint8Array ? value : new Uint8Array(value);
|
38105
|
+
const lengthBytes = new BigNumberCoder("u64").encode(bytes2.length);
|
38106
|
+
return new Uint8Array([...lengthBytes, ...bytes2]);
|
38367
38107
|
}
|
38368
38108
|
decode(data, offset) {
|
38369
38109
|
if (data.length < WORD_SIZE) {
|
@@ -38432,7 +38172,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
38432
38172
|
throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid enum data size.`);
|
38433
38173
|
}
|
38434
38174
|
const caseBytes = new BigNumberCoder("u64").decode(data, offset)[0];
|
38435
|
-
const caseIndex =
|
38175
|
+
const caseIndex = toNumber(caseBytes);
|
38436
38176
|
const caseKey = Object.keys(this.coders)[caseIndex];
|
38437
38177
|
if (!caseKey) {
|
38438
38178
|
throw new FuelError(
|
@@ -38471,26 +38211,26 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
38471
38211
|
this.length = length;
|
38472
38212
|
}
|
38473
38213
|
encode(value) {
|
38474
|
-
let
|
38214
|
+
let bytes2;
|
38475
38215
|
try {
|
38476
|
-
|
38216
|
+
bytes2 = toBytes2(value);
|
38477
38217
|
} catch (error) {
|
38478
38218
|
throw new FuelError(ErrorCode.ENCODE_ERROR, `Invalid ${this.baseType}.`);
|
38479
38219
|
}
|
38480
|
-
if (
|
38220
|
+
if (bytes2.length > this.length) {
|
38481
38221
|
throw new FuelError(ErrorCode.ENCODE_ERROR, `Invalid ${this.baseType}, too many bytes.`);
|
38482
38222
|
}
|
38483
|
-
return
|
38223
|
+
return toBytes2(bytes2, this.length);
|
38484
38224
|
}
|
38485
38225
|
decode(data, offset) {
|
38486
38226
|
if (data.length < this.encodedLength) {
|
38487
38227
|
throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid number data size.`);
|
38488
38228
|
}
|
38489
|
-
const
|
38490
|
-
if (
|
38229
|
+
const bytes2 = data.slice(offset, offset + this.length);
|
38230
|
+
if (bytes2.length !== this.encodedLength) {
|
38491
38231
|
throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid number byte data size.`);
|
38492
38232
|
}
|
38493
|
-
return [
|
38233
|
+
return [toNumber(bytes2), offset + this.length];
|
38494
38234
|
}
|
38495
38235
|
};
|
38496
38236
|
var OptionCoder2 = class extends EnumCoder2 {
|
@@ -38508,9 +38248,9 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
38508
38248
|
const [decoded, newOffset] = super.decode(data, offset);
|
38509
38249
|
return [this.toOption(decoded), newOffset];
|
38510
38250
|
}
|
38511
|
-
toOption(
|
38512
|
-
if (
|
38513
|
-
return
|
38251
|
+
toOption(output2) {
|
38252
|
+
if (output2 && "Some" in output2) {
|
38253
|
+
return output2.Some;
|
38514
38254
|
}
|
38515
38255
|
return void 0;
|
38516
38256
|
}
|
@@ -38524,9 +38264,9 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
38524
38264
|
throw new FuelError(ErrorCode.ENCODE_ERROR, `Expected array value.`);
|
38525
38265
|
}
|
38526
38266
|
const internalCoder = new ArrayCoder(new NumberCoder2("u8"), value.length);
|
38527
|
-
const
|
38528
|
-
const lengthBytes = new BigNumberCoder("u64").encode(
|
38529
|
-
return new Uint8Array([...lengthBytes, ...
|
38267
|
+
const bytes2 = internalCoder.encode(value);
|
38268
|
+
const lengthBytes = new BigNumberCoder("u64").encode(bytes2.length);
|
38269
|
+
return new Uint8Array([...lengthBytes, ...bytes2]);
|
38530
38270
|
}
|
38531
38271
|
decode(data, offset) {
|
38532
38272
|
if (data.length < this.encodedLength) {
|
@@ -38549,9 +38289,9 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
38549
38289
|
super("struct", "struct String", WORD_SIZE);
|
38550
38290
|
}
|
38551
38291
|
encode(value) {
|
38552
|
-
const
|
38292
|
+
const bytes2 = toUtf8Bytes(value);
|
38553
38293
|
const lengthBytes = new BigNumberCoder("u64").encode(value.length);
|
38554
|
-
return new Uint8Array([...lengthBytes, ...
|
38294
|
+
return new Uint8Array([...lengthBytes, ...bytes2]);
|
38555
38295
|
}
|
38556
38296
|
decode(data, offset) {
|
38557
38297
|
if (data.length < this.encodedLength) {
|
@@ -38573,9 +38313,9 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
38573
38313
|
super("strSlice", "str", WORD_SIZE);
|
38574
38314
|
}
|
38575
38315
|
encode(value) {
|
38576
|
-
const
|
38316
|
+
const bytes2 = toUtf8Bytes(value);
|
38577
38317
|
const lengthBytes = new BigNumberCoder("u64").encode(value.length);
|
38578
|
-
return new Uint8Array([...lengthBytes, ...
|
38318
|
+
return new Uint8Array([...lengthBytes, ...bytes2]);
|
38579
38319
|
}
|
38580
38320
|
decode(data, offset) {
|
38581
38321
|
if (data.length < this.encodedLength) {
|
@@ -38584,11 +38324,11 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
38584
38324
|
const offsetAndLength = offset + WORD_SIZE;
|
38585
38325
|
const lengthBytes = data.slice(offset, offsetAndLength);
|
38586
38326
|
const length = bn(new BigNumberCoder("u64").decode(lengthBytes, 0)[0]).toNumber();
|
38587
|
-
const
|
38588
|
-
if (
|
38327
|
+
const bytes2 = data.slice(offsetAndLength, offsetAndLength + length);
|
38328
|
+
if (bytes2.length !== length) {
|
38589
38329
|
throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid string slice byte data size.`);
|
38590
38330
|
}
|
38591
|
-
return [toUtf8String(
|
38331
|
+
return [toUtf8String(bytes2), offsetAndLength + length];
|
38592
38332
|
}
|
38593
38333
|
};
|
38594
38334
|
__publicField4(StrSliceCoder, "memorySize", 1);
|
@@ -38606,11 +38346,11 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
38606
38346
|
if (data.length < this.encodedLength) {
|
38607
38347
|
throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid string data size.`);
|
38608
38348
|
}
|
38609
|
-
const
|
38610
|
-
if (
|
38349
|
+
const bytes2 = data.slice(offset, offset + this.encodedLength);
|
38350
|
+
if (bytes2.length !== this.encodedLength) {
|
38611
38351
|
throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid string byte data size.`);
|
38612
38352
|
}
|
38613
|
-
return [toUtf8String(
|
38353
|
+
return [toUtf8String(bytes2), offset + this.encodedLength];
|
38614
38354
|
}
|
38615
38355
|
};
|
38616
38356
|
var StructCoder2 = class extends Coder {
|
@@ -38690,12 +38430,19 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
38690
38430
|
this.#isOptionVec = this.coder instanceof OptionCoder2;
|
38691
38431
|
}
|
38692
38432
|
encode(value) {
|
38693
|
-
if (!Array.isArray(value)) {
|
38694
|
-
throw new FuelError(
|
38433
|
+
if (!Array.isArray(value) && !isUint8Array(value)) {
|
38434
|
+
throw new FuelError(
|
38435
|
+
ErrorCode.ENCODE_ERROR,
|
38436
|
+
`Expected array value, or a Uint8Array. You can use arrayify to convert a value to a Uint8Array.`
|
38437
|
+
);
|
38695
38438
|
}
|
38696
|
-
const
|
38697
|
-
|
38698
|
-
|
38439
|
+
const lengthCoder = new BigNumberCoder("u64");
|
38440
|
+
if (isUint8Array(value)) {
|
38441
|
+
return new Uint8Array([...lengthCoder.encode(value.length), ...value]);
|
38442
|
+
}
|
38443
|
+
const bytes2 = value.map((v) => this.coder.encode(v));
|
38444
|
+
const lengthBytes = lengthCoder.encode(value.length);
|
38445
|
+
return new Uint8Array([...lengthBytes, ...concatBytes2(bytes2)]);
|
38699
38446
|
}
|
38700
38447
|
decode(data, offset) {
|
38701
38448
|
if (!this.#isOptionVec && (data.length < this.encodedLength || data.length > MAX_BYTES)) {
|
@@ -38858,7 +38605,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
38858
38605
|
return `${fn.name}(${inputsSignatures.join(",")})`;
|
38859
38606
|
}
|
38860
38607
|
static getFunctionSelector(functionSignature) {
|
38861
|
-
const hashedFunctionSignature =
|
38608
|
+
const hashedFunctionSignature = sha2562(bufferFromString2(functionSignature, "utf-8"));
|
38862
38609
|
return bn(hashedFunctionSignature.slice(0, 10)).toHex(8);
|
38863
38610
|
}
|
38864
38611
|
#isInputDataPointer() {
|
@@ -38921,10 +38668,10 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
38921
38668
|
throw new FuelError(ErrorCode.ABI_TYPES_AND_VALUES_MISMATCH, errorMsg);
|
38922
38669
|
}
|
38923
38670
|
decodeArguments(data) {
|
38924
|
-
const
|
38671
|
+
const bytes2 = arrayify(data);
|
38925
38672
|
const nonEmptyInputs = findNonEmptyInputs(this.jsonAbi, this.jsonFn.inputs);
|
38926
38673
|
if (nonEmptyInputs.length === 0) {
|
38927
|
-
if (
|
38674
|
+
if (bytes2.length === 0) {
|
38928
38675
|
return void 0;
|
38929
38676
|
}
|
38930
38677
|
throw new FuelError(
|
@@ -38933,12 +38680,12 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
38933
38680
|
count: {
|
38934
38681
|
types: this.jsonFn.inputs.length,
|
38935
38682
|
nonEmptyInputs: nonEmptyInputs.length,
|
38936
|
-
values:
|
38683
|
+
values: bytes2.length
|
38937
38684
|
},
|
38938
38685
|
value: {
|
38939
38686
|
args: this.jsonFn.inputs,
|
38940
38687
|
nonEmptyInputs,
|
38941
|
-
values:
|
38688
|
+
values: bytes2
|
38942
38689
|
}
|
38943
38690
|
})}`
|
38944
38691
|
);
|
@@ -38946,7 +38693,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
38946
38693
|
const result = nonEmptyInputs.reduce(
|
38947
38694
|
(obj, input) => {
|
38948
38695
|
const coder = AbiCoder.getCoder(this.jsonAbi, input, { encoding: this.encoding });
|
38949
|
-
const [decodedValue, decodedValueByteSize] = coder.decode(
|
38696
|
+
const [decodedValue, decodedValueByteSize] = coder.decode(bytes2, obj.offset);
|
38950
38697
|
return {
|
38951
38698
|
decoded: [...obj.decoded, decodedValue],
|
38952
38699
|
offset: obj.offset + decodedValueByteSize
|
@@ -38961,11 +38708,11 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
38961
38708
|
if (outputAbiType.type === "()") {
|
38962
38709
|
return [void 0, 0];
|
38963
38710
|
}
|
38964
|
-
const
|
38711
|
+
const bytes2 = arrayify(data);
|
38965
38712
|
const coder = AbiCoder.getCoder(this.jsonAbi, this.jsonFn.output, {
|
38966
38713
|
encoding: this.encoding
|
38967
38714
|
});
|
38968
|
-
return coder.decode(
|
38715
|
+
return coder.decode(bytes2, 0);
|
38969
38716
|
}
|
38970
38717
|
/**
|
38971
38718
|
* Checks if the function is read-only i.e. it only reads from storage, does not write to it.
|
@@ -39226,12 +38973,12 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
39226
38973
|
parts.push(new ByteArrayCoder(32).encode(value.nonce));
|
39227
38974
|
parts.push(new BigNumberCoder("u64").encode(value.amount));
|
39228
38975
|
parts.push(arrayify(value.data || "0x"));
|
39229
|
-
return
|
38976
|
+
return sha2562(concat(parts));
|
39230
38977
|
}
|
39231
38978
|
static encodeData(messageData) {
|
39232
|
-
const
|
39233
|
-
const dataLength2 =
|
39234
|
-
return new ByteArrayCoder(dataLength2).encode(
|
38979
|
+
const bytes2 = arrayify(messageData || "0x");
|
38980
|
+
const dataLength2 = bytes2.length;
|
38981
|
+
return new ByteArrayCoder(dataLength2).encode(bytes2);
|
39235
38982
|
}
|
39236
38983
|
encode(value) {
|
39237
38984
|
const parts = [];
|
@@ -39253,9 +39000,9 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
39253
39000
|
return concat(parts);
|
39254
39001
|
}
|
39255
39002
|
static decodeData(messageData) {
|
39256
|
-
const
|
39257
|
-
const dataLength2 =
|
39258
|
-
const [data] = new ByteArrayCoder(dataLength2).decode(
|
39003
|
+
const bytes2 = arrayify(messageData);
|
39004
|
+
const dataLength2 = bytes2.length;
|
39005
|
+
const [data] = new ByteArrayCoder(dataLength2).decode(bytes2, 0);
|
39259
39006
|
return arrayify(data);
|
39260
39007
|
}
|
39261
39008
|
decode(data, offset) {
|
@@ -39692,7 +39439,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
39692
39439
|
parts.push(new ByteArrayCoder(32).encode(value.nonce));
|
39693
39440
|
parts.push(new BigNumberCoder("u64").encode(value.amount));
|
39694
39441
|
parts.push(arrayify(value.data || "0x"));
|
39695
|
-
return
|
39442
|
+
return sha2562(concat(parts));
|
39696
39443
|
}
|
39697
39444
|
encode(value) {
|
39698
39445
|
const parts = [];
|
@@ -39739,7 +39486,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
39739
39486
|
var getMintedAssetId = (contractId, subId) => {
|
39740
39487
|
const contractIdBytes = arrayify(contractId);
|
39741
39488
|
const subIdBytes = arrayify(subId);
|
39742
|
-
return
|
39489
|
+
return sha2562(concat([contractIdBytes, subIdBytes]));
|
39743
39490
|
};
|
39744
39491
|
var ReceiptMintCoder = class extends Coder {
|
39745
39492
|
constructor() {
|
@@ -40353,7 +40100,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
40353
40100
|
numberToBytesLE: () => numberToBytesLE,
|
40354
40101
|
numberToHexUnpadded: () => numberToHexUnpadded,
|
40355
40102
|
numberToVarBytesBE: () => numberToVarBytesBE,
|
40356
|
-
utf8ToBytes: () =>
|
40103
|
+
utf8ToBytes: () => utf8ToBytes2,
|
40357
40104
|
validateObject: () => validateObject
|
40358
40105
|
});
|
40359
40106
|
var _0n2 = BigInt(0);
|
@@ -40362,13 +40109,13 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
40362
40109
|
function isBytes3(a) {
|
40363
40110
|
return a instanceof Uint8Array || a != null && typeof a === "object" && a.constructor.name === "Uint8Array";
|
40364
40111
|
}
|
40365
|
-
var
|
40366
|
-
function bytesToHex(
|
40367
|
-
if (!isBytes3(
|
40112
|
+
var hexes = /* @__PURE__ */ Array.from({ length: 256 }, (_, i) => i.toString(16).padStart(2, "0"));
|
40113
|
+
function bytesToHex(bytes2) {
|
40114
|
+
if (!isBytes3(bytes2))
|
40368
40115
|
throw new Error("Uint8Array expected");
|
40369
40116
|
let hex = "";
|
40370
|
-
for (let i = 0; i <
|
40371
|
-
hex +=
|
40117
|
+
for (let i = 0; i < bytes2.length; i++) {
|
40118
|
+
hex += hexes[bytes2[i]];
|
40372
40119
|
}
|
40373
40120
|
return hex;
|
40374
40121
|
}
|
@@ -40410,13 +40157,13 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
40410
40157
|
}
|
40411
40158
|
return array;
|
40412
40159
|
}
|
40413
|
-
function bytesToNumberBE(
|
40414
|
-
return hexToNumber(bytesToHex(
|
40160
|
+
function bytesToNumberBE(bytes2) {
|
40161
|
+
return hexToNumber(bytesToHex(bytes2));
|
40415
40162
|
}
|
40416
|
-
function bytesToNumberLE(
|
40417
|
-
if (!isBytes3(
|
40163
|
+
function bytesToNumberLE(bytes2) {
|
40164
|
+
if (!isBytes3(bytes2))
|
40418
40165
|
throw new Error("Uint8Array expected");
|
40419
|
-
return hexToNumber(bytesToHex(Uint8Array.from(
|
40166
|
+
return hexToNumber(bytesToHex(Uint8Array.from(bytes2).reverse()));
|
40420
40167
|
}
|
40421
40168
|
function numberToBytesBE(n, len) {
|
40422
40169
|
return hexToBytes(n.toString(16).padStart(len * 2, "0"));
|
@@ -40470,7 +40217,7 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
40470
40217
|
diff |= a[i] ^ b[i];
|
40471
40218
|
return diff === 0;
|
40472
40219
|
}
|
40473
|
-
function
|
40220
|
+
function utf8ToBytes2(str) {
|
40474
40221
|
if (typeof str !== "string")
|
40475
40222
|
throw new Error(`utf8ToBytes expected string, got ${typeof str}`);
|
40476
40223
|
return new Uint8Array(new TextEncoder().encode(str));
|
@@ -40789,19 +40536,19 @@ This unreleased fuel-core build may include features and updates not yet support
|
|
40789
40536
|
return "GraphQLError";
|
40790
40537
|
}
|
40791
40538
|
toString() {
|
40792
|
-
let
|
40539
|
+
let output2 = this.message;
|
40793
40540
|
if (this.nodes) {
|
40794
40541
|
for (const node of this.nodes) {
|
40795
40542
|
if (node.loc) {
|
40796
|
-
|
40543
|
+
output2 += "\n\n" + printLocation(node.loc);
|
40797
40544
|
}
|
40798
40545
|
}
|
40799
40546
|
} else if (this.source && this.locations) {
|
40800
40547
|
for (const location of this.locations) {
|
40801
|
-
|
40548
|
+
output2 += "\n\n" + printSourceLocation(this.source, location);
|
40802
40549
|
}
|
40803
40550
|
}
|
40804
|
-
return
|
40551
|
+
return output2;
|
40805
40552
|
}
|
40806
40553
|
toJSON() {
|
40807
40554
|
const formattedError = {
|
@@ -44815,13 +44562,13 @@ ${MessageCoinFragmentDoc}`;
|
|
44815
44562
|
return {
|
44816
44563
|
type: InputType.Coin,
|
44817
44564
|
txID: hexlify(arrayify(value.id).slice(0, BYTES_32)),
|
44818
|
-
outputIndex:
|
44565
|
+
outputIndex: toNumber(arrayify(value.id).slice(BYTES_32, UTXO_ID_LEN)),
|
44819
44566
|
owner: hexlify(value.owner),
|
44820
44567
|
amount: bn(value.amount),
|
44821
44568
|
assetId: hexlify(value.assetId),
|
44822
44569
|
txPointer: {
|
44823
|
-
blockHeight:
|
44824
|
-
txIndex:
|
44570
|
+
blockHeight: toNumber(arrayify(value.txPointer).slice(0, 8)),
|
44571
|
+
txIndex: toNumber(arrayify(value.txPointer).slice(8, 16))
|
44825
44572
|
},
|
44826
44573
|
witnessIndex: value.witnessIndex,
|
44827
44574
|
predicateGasUsed: bn(value.predicateGasUsed),
|
@@ -44839,8 +44586,8 @@ ${MessageCoinFragmentDoc}`;
|
|
44839
44586
|
balanceRoot: ZeroBytes32,
|
44840
44587
|
stateRoot: ZeroBytes32,
|
44841
44588
|
txPointer: {
|
44842
|
-
blockHeight:
|
44843
|
-
txIndex:
|
44589
|
+
blockHeight: toNumber(arrayify(value.txPointer).slice(0, 8)),
|
44590
|
+
txIndex: toNumber(arrayify(value.txPointer).slice(8, 16))
|
44844
44591
|
},
|
44845
44592
|
contractID: hexlify(value.contractId)
|
44846
44593
|
};
|
@@ -45399,6 +45146,34 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
45399
45146
|
name = "NoWitnessAtIndexError";
|
45400
45147
|
};
|
45401
45148
|
|
45149
|
+
// src/providers/transaction-request/helpers.ts
|
45150
|
+
var isRequestInputCoin = (input) => input.type === InputType.Coin;
|
45151
|
+
var isRequestInputMessage = (input) => input.type === InputType.Message;
|
45152
|
+
var isRequestInputResource = (input) => isRequestInputCoin(input) || isRequestInputMessage(input);
|
45153
|
+
var getAssetAmountInRequestInputs = (inputs, assetId, baseAsset) => inputs.filter(isRequestInputResource).reduce((acc, input) => {
|
45154
|
+
if (isRequestInputCoin(input) && input.assetId === assetId) {
|
45155
|
+
return acc.add(input.amount);
|
45156
|
+
}
|
45157
|
+
if (isRequestInputMessage(input) && assetId === baseAsset) {
|
45158
|
+
return acc.add(input.amount);
|
45159
|
+
}
|
45160
|
+
return acc;
|
45161
|
+
}, bn(0));
|
45162
|
+
var cacheRequestInputsResourcesFromOwner = (inputs, owner) => inputs.reduce(
|
45163
|
+
(acc, input) => {
|
45164
|
+
if (isRequestInputCoin(input) && input.owner === owner.toB256()) {
|
45165
|
+
acc.utxos.push(input.id);
|
45166
|
+
} else if (isRequestInputMessage(input) && input.recipient === owner.toB256()) {
|
45167
|
+
acc.messages.push(input.nonce);
|
45168
|
+
}
|
45169
|
+
return acc;
|
45170
|
+
},
|
45171
|
+
{
|
45172
|
+
utxos: [],
|
45173
|
+
messages: []
|
45174
|
+
}
|
45175
|
+
);
|
45176
|
+
|
45402
45177
|
// src/providers/transaction-request/witness.ts
|
45403
45178
|
var witnessify = (value) => {
|
45404
45179
|
const data = arrayify(value);
|
@@ -45512,8 +45287,8 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
45512
45287
|
*
|
45513
45288
|
* Pushes an output to the list without any side effects and returns the index
|
45514
45289
|
*/
|
45515
|
-
pushOutput(
|
45516
|
-
this.outputs.push(
|
45290
|
+
pushOutput(output2) {
|
45291
|
+
this.outputs.push(output2);
|
45517
45292
|
return this.outputs.length - 1;
|
45518
45293
|
}
|
45519
45294
|
/**
|
@@ -45597,7 +45372,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
45597
45372
|
*/
|
45598
45373
|
getCoinOutputs() {
|
45599
45374
|
return this.outputs.filter(
|
45600
|
-
(
|
45375
|
+
(output2) => output2.type === OutputType.Coin
|
45601
45376
|
);
|
45602
45377
|
}
|
45603
45378
|
/**
|
@@ -45607,7 +45382,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
45607
45382
|
*/
|
45608
45383
|
getChangeOutputs() {
|
45609
45384
|
return this.outputs.filter(
|
45610
|
-
(
|
45385
|
+
(output2) => output2.type === OutputType.Change
|
45611
45386
|
);
|
45612
45387
|
}
|
45613
45388
|
/**
|
@@ -45636,7 +45411,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
45636
45411
|
* @param coin - Coin resource.
|
45637
45412
|
*/
|
45638
45413
|
addCoinInput(coin) {
|
45639
|
-
const { assetId, owner, amount } = coin;
|
45414
|
+
const { assetId, owner, amount, id, predicate } = coin;
|
45640
45415
|
let witnessIndex;
|
45641
45416
|
if (coin.predicate) {
|
45642
45417
|
witnessIndex = 0;
|
@@ -45647,13 +45422,14 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
45647
45422
|
}
|
45648
45423
|
}
|
45649
45424
|
const input = {
|
45650
|
-
|
45425
|
+
id,
|
45651
45426
|
type: InputType.Coin,
|
45652
45427
|
owner: owner.toB256(),
|
45653
45428
|
amount,
|
45654
45429
|
assetId,
|
45655
45430
|
txPointer: "0x00000000000000000000000000000000",
|
45656
|
-
witnessIndex
|
45431
|
+
witnessIndex,
|
45432
|
+
predicate
|
45657
45433
|
};
|
45658
45434
|
this.pushInput(input);
|
45659
45435
|
this.addChangeOutput(owner, assetId);
|
@@ -45665,7 +45441,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
45665
45441
|
* @param message - Message resource.
|
45666
45442
|
*/
|
45667
45443
|
addMessageInput(message) {
|
45668
|
-
const { recipient, sender, amount, assetId } = message;
|
45444
|
+
const { recipient, sender, amount, predicate, nonce, assetId } = message;
|
45669
45445
|
let witnessIndex;
|
45670
45446
|
if (message.predicate) {
|
45671
45447
|
witnessIndex = 0;
|
@@ -45676,12 +45452,13 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
45676
45452
|
}
|
45677
45453
|
}
|
45678
45454
|
const input = {
|
45679
|
-
|
45455
|
+
nonce,
|
45680
45456
|
type: InputType.Message,
|
45681
45457
|
sender: sender.toB256(),
|
45682
45458
|
recipient: recipient.toB256(),
|
45683
45459
|
amount,
|
45684
|
-
witnessIndex
|
45460
|
+
witnessIndex,
|
45461
|
+
predicate
|
45685
45462
|
};
|
45686
45463
|
this.pushInput(input);
|
45687
45464
|
this.addChangeOutput(recipient, assetId);
|
@@ -45753,7 +45530,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
45753
45530
|
*/
|
45754
45531
|
addChangeOutput(to, assetId) {
|
45755
45532
|
const changeOutput = this.getChangeOutputs().find(
|
45756
|
-
(
|
45533
|
+
(output2) => hexlify(output2.assetId) === assetId
|
45757
45534
|
);
|
45758
45535
|
if (!changeOutput) {
|
45759
45536
|
this.pushOutput({
|
@@ -45871,6 +45648,17 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
45871
45648
|
toJSON() {
|
45872
45649
|
return normalizeJSON(this);
|
45873
45650
|
}
|
45651
|
+
removeWitness(index) {
|
45652
|
+
this.witnesses.splice(index, 1);
|
45653
|
+
this.adjustWitnessIndexes(index);
|
45654
|
+
}
|
45655
|
+
adjustWitnessIndexes(removedIndex) {
|
45656
|
+
this.inputs.filter(isRequestInputResource).forEach((input) => {
|
45657
|
+
if (input.witnessIndex > removedIndex) {
|
45658
|
+
input.witnessIndex -= 1;
|
45659
|
+
}
|
45660
|
+
});
|
45661
|
+
}
|
45874
45662
|
updatePredicateGasUsed(inputs) {
|
45875
45663
|
this.inputs.forEach((i) => {
|
45876
45664
|
let correspondingInput;
|
@@ -45940,8 +45728,8 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
45940
45728
|
return inputClone;
|
45941
45729
|
}
|
45942
45730
|
});
|
45943
|
-
transaction.outputs = transaction.outputs.map((
|
45944
|
-
const outputClone = clone_default(
|
45731
|
+
transaction.outputs = transaction.outputs.map((output2) => {
|
45732
|
+
const outputClone = clone_default(output2);
|
45945
45733
|
switch (outputClone.type) {
|
45946
45734
|
case OutputType.Contract: {
|
45947
45735
|
outputClone.balanceRoot = ZeroBytes32;
|
@@ -45966,7 +45754,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
45966
45754
|
transaction.witnesses = [];
|
45967
45755
|
const chainIdBytes = uint64ToBytesBE(chainId);
|
45968
45756
|
const concatenatedData = concat([chainIdBytes, new TransactionCoder().encode(transaction)]);
|
45969
|
-
return
|
45757
|
+
return sha2562(concatenatedData);
|
45970
45758
|
}
|
45971
45759
|
|
45972
45760
|
// src/providers/transaction-request/storage-slot.ts
|
@@ -46043,7 +45831,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
46043
45831
|
*/
|
46044
45832
|
getContractCreatedOutputs() {
|
46045
45833
|
return this.outputs.filter(
|
46046
|
-
(
|
45834
|
+
(output2) => output2.type === OutputType.ContractCreated
|
46047
45835
|
);
|
46048
45836
|
}
|
46049
45837
|
/**
|
@@ -46169,7 +45957,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
46169
45957
|
*/
|
46170
45958
|
getContractOutputs() {
|
46171
45959
|
return this.outputs.filter(
|
46172
|
-
(
|
45960
|
+
(output2) => output2.type === OutputType.Contract
|
46173
45961
|
);
|
46174
45962
|
}
|
46175
45963
|
/**
|
@@ -46179,7 +45967,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
46179
45967
|
*/
|
46180
45968
|
getVariableOutputs() {
|
46181
45969
|
return this.outputs.filter(
|
46182
|
-
(
|
45970
|
+
(output2) => output2.type === OutputType.Variable
|
46183
45971
|
);
|
46184
45972
|
}
|
46185
45973
|
/**
|
@@ -46297,21 +46085,6 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
46297
46085
|
}
|
46298
46086
|
}
|
46299
46087
|
};
|
46300
|
-
var cacheTxInputsFromOwner = (inputs, owner) => inputs.reduce(
|
46301
|
-
(acc, input) => {
|
46302
|
-
if (input.type === InputType.Coin && input.owner === owner.toB256()) {
|
46303
|
-
acc.utxos.push(input.id);
|
46304
|
-
}
|
46305
|
-
if (input.type === InputType.Message && input.recipient === owner.toB256()) {
|
46306
|
-
acc.messages.push(input.nonce);
|
46307
|
-
}
|
46308
|
-
return acc;
|
46309
|
-
},
|
46310
|
-
{
|
46311
|
-
utxos: [],
|
46312
|
-
messages: []
|
46313
|
-
}
|
46314
|
-
);
|
46315
46088
|
|
46316
46089
|
// src/providers/transaction-summary/calculate-tx-fee-for-summary.ts
|
46317
46090
|
var calculateTXFeeForSummary = (params) => {
|
@@ -46620,8 +46393,8 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
46620
46393
|
}) {
|
46621
46394
|
const contractCallReceipts = getReceiptsCall(receipts);
|
46622
46395
|
const contractOutputs = getOutputsContract(outputs);
|
46623
|
-
const contractCallOperations = contractOutputs.reduce((prevOutputCallOps,
|
46624
|
-
const contractInput = getInputContractFromIndex(inputs,
|
46396
|
+
const contractCallOperations = contractOutputs.reduce((prevOutputCallOps, output2) => {
|
46397
|
+
const contractInput = getInputContractFromIndex(inputs, output2.inputIndex);
|
46625
46398
|
if (contractInput) {
|
46626
46399
|
const newCallOps = contractCallReceipts.reduce((prevContractCallOps, receipt) => {
|
46627
46400
|
if (receipt.to === contractInput.contractID) {
|
@@ -46675,7 +46448,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
46675
46448
|
let { from: fromAddress } = receipt;
|
46676
46449
|
const toType = contractInputs.some((input) => input.contractID === toAddress) ? 0 /* contract */ : 1 /* account */;
|
46677
46450
|
if (ZeroBytes32 === fromAddress) {
|
46678
|
-
const change = changeOutputs.find((
|
46451
|
+
const change = changeOutputs.find((output2) => output2.assetId === assetId);
|
46679
46452
|
fromAddress = change?.to || fromAddress;
|
46680
46453
|
}
|
46681
46454
|
const fromType = contractInputs.some((input) => input.contractID === fromAddress) ? 0 /* contract */ : 1 /* account */;
|
@@ -46706,8 +46479,8 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
46706
46479
|
const coinOutputs = getOutputsCoin(outputs);
|
46707
46480
|
const contractInputs = getInputsContract(inputs);
|
46708
46481
|
const changeOutputs = getOutputsChange(outputs);
|
46709
|
-
coinOutputs.forEach((
|
46710
|
-
const { amount, assetId, to } =
|
46482
|
+
coinOutputs.forEach((output2) => {
|
46483
|
+
const { amount, assetId, to } = output2;
|
46711
46484
|
const changeOutput = changeOutputs.find((change) => change.assetId === assetId);
|
46712
46485
|
if (changeOutput) {
|
46713
46486
|
operations = addOperation(operations, {
|
@@ -46745,7 +46518,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
46745
46518
|
}
|
46746
46519
|
function getPayProducerOperations(outputs) {
|
46747
46520
|
const coinOutputs = getOutputsCoin(outputs);
|
46748
|
-
const payProducerOperations = coinOutputs.reduce((prev,
|
46521
|
+
const payProducerOperations = coinOutputs.reduce((prev, output2) => {
|
46749
46522
|
const operations = addOperation(prev, {
|
46750
46523
|
name: "Pay network fee to block producer" /* payBlockProducer */,
|
46751
46524
|
from: {
|
@@ -46754,12 +46527,12 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
|
|
46754
46527
|
},
|
46755
46528
|
to: {
|
46756
46529
|
type: 1 /* account */,
|
46757
|
-
address:
|
46530
|
+
address: output2.to.toString()
|
46758
46531
|
},
|
46759
46532
|
assetsSent: [
|
46760
46533
|
{
|
46761
|
-
assetId:
|
46762
|
-
amount:
|
46534
|
+
assetId: output2.assetId.toString(),
|
46535
|
+
amount: output2.amount
|
46763
46536
|
}
|
46764
46537
|
]
|
46765
46538
|
});
|
@@ -48451,20 +48224,6 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
48451
48224
|
];
|
48452
48225
|
var assets = resolveIconPaths(rawAssets, fuelAssetsBaseUrl);
|
48453
48226
|
|
48454
|
-
// src/providers/transaction-request/helpers.ts
|
48455
|
-
var isRequestInputCoin = (input) => input.type === InputType.Coin;
|
48456
|
-
var isRequestInputMessage = (input) => input.type === InputType.Message;
|
48457
|
-
var isRequestInputResource = (input) => isRequestInputCoin(input) || isRequestInputMessage(input);
|
48458
|
-
var getAssetAmountInRequestInputs = (inputs, assetId, baseAsset) => inputs.filter(isRequestInputResource).reduce((acc, input) => {
|
48459
|
-
if (isRequestInputCoin(input) && input.assetId === assetId) {
|
48460
|
-
return acc.add(input.amount);
|
48461
|
-
}
|
48462
|
-
if (isRequestInputMessage(input) && assetId === baseAsset) {
|
48463
|
-
return acc.add(input.amount);
|
48464
|
-
}
|
48465
|
-
return acc;
|
48466
|
-
}, bn(0));
|
48467
|
-
|
48468
48227
|
// src/utils/formatTransferToContractScriptData.ts
|
48469
48228
|
var asm = __toESM(require_node());
|
48470
48229
|
var formatTransferToContractScriptData = (params) => {
|
@@ -48699,7 +48458,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
48699
48458
|
while (needsToBeFunded && fundingAttempts < MAX_FUNDING_ATTEMPTS) {
|
48700
48459
|
const resources = await this.getResourcesToSpend(
|
48701
48460
|
missingQuantities,
|
48702
|
-
|
48461
|
+
cacheRequestInputsResourcesFromOwner(request.inputs, this.address)
|
48703
48462
|
);
|
48704
48463
|
request.addResources(resources);
|
48705
48464
|
request.shiftPredicateData();
|
@@ -48990,11 +48749,11 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
48990
48749
|
}
|
48991
48750
|
return res;
|
48992
48751
|
}
|
48993
|
-
function invert(
|
48994
|
-
if (
|
48995
|
-
throw new Error(`invert: expected positive integers, got n=${
|
48752
|
+
function invert(number2, modulo) {
|
48753
|
+
if (number2 === _0n3 || modulo <= _0n3) {
|
48754
|
+
throw new Error(`invert: expected positive integers, got n=${number2} mod=${modulo}`);
|
48996
48755
|
}
|
48997
|
-
let a = mod(
|
48756
|
+
let a = mod(number2, modulo);
|
48998
48757
|
let b = modulo;
|
48999
48758
|
let x = _0n3, y = _1n3, u = _1n3, v = _0n3;
|
49000
48759
|
while (a !== _0n3) {
|
@@ -49149,7 +48908,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
49149
48908
|
const nByteLength = Math.ceil(_nBitLength / 8);
|
49150
48909
|
return { nBitLength: _nBitLength, nByteLength };
|
49151
48910
|
}
|
49152
|
-
function Field(ORDER, bitLen2,
|
48911
|
+
function Field(ORDER, bitLen2, isLE2 = false, redef = {}) {
|
49153
48912
|
if (ORDER <= _0n3)
|
49154
48913
|
throw new Error(`Expected Field ORDER > 0, got ${ORDER}`);
|
49155
48914
|
const { nBitLength: BITS, nByteLength: BYTES } = nLength(ORDER, bitLen2);
|
@@ -49190,11 +48949,11 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
49190
48949
|
// TODO: do we really need constant cmov?
|
49191
48950
|
// We don't have const-time bigints anyway, so probably will be not very useful
|
49192
48951
|
cmov: (a, b, c) => c ? b : a,
|
49193
|
-
toBytes: (num) =>
|
49194
|
-
fromBytes: (
|
49195
|
-
if (
|
49196
|
-
throw new Error(`Fp.fromBytes: expected ${BYTES}, got ${
|
49197
|
-
return
|
48952
|
+
toBytes: (num) => isLE2 ? numberToBytesLE(num, BYTES) : numberToBytesBE(num, BYTES),
|
48953
|
+
fromBytes: (bytes2) => {
|
48954
|
+
if (bytes2.length !== BYTES)
|
48955
|
+
throw new Error(`Fp.fromBytes: expected ${BYTES}, got ${bytes2.length}`);
|
48956
|
+
return isLE2 ? bytesToNumberLE(bytes2) : bytesToNumberBE(bytes2);
|
49198
48957
|
}
|
49199
48958
|
});
|
49200
48959
|
return Object.freeze(f2);
|
@@ -49209,15 +48968,15 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
49209
48968
|
const length = getFieldBytesLength(fieldOrder);
|
49210
48969
|
return length + Math.ceil(length / 2);
|
49211
48970
|
}
|
49212
|
-
function mapHashToField(key, fieldOrder,
|
48971
|
+
function mapHashToField(key, fieldOrder, isLE2 = false) {
|
49213
48972
|
const len = key.length;
|
49214
48973
|
const fieldLen = getFieldBytesLength(fieldOrder);
|
49215
48974
|
const minLen = getMinHashLength(fieldOrder);
|
49216
48975
|
if (len < 16 || len < minLen || len > 1024)
|
49217
48976
|
throw new Error(`expected ${minLen}-1024 bytes of input, got ${len}`);
|
49218
|
-
const num =
|
48977
|
+
const num = isLE2 ? bytesToNumberBE(key) : bytesToNumberLE(key);
|
49219
48978
|
const reduced = mod(num, fieldOrder - _1n3) + _1n3;
|
49220
|
-
return
|
48979
|
+
return isLE2 ? numberToBytesLE(reduced, fieldLen) : numberToBytesBE(reduced, fieldLen);
|
49221
48980
|
}
|
49222
48981
|
|
49223
48982
|
// ../../node_modules/.pnpm/@noble+curves@1.3.0/node_modules/@noble/curves/esm/abstract/curve.js
|
@@ -49425,12 +49184,12 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
49425
49184
|
function weierstrassPoints(opts) {
|
49426
49185
|
const CURVE = validatePointOpts(opts);
|
49427
49186
|
const { Fp: Fp2 } = CURVE;
|
49428
|
-
const
|
49187
|
+
const toBytes3 = CURVE.toBytes || ((_c, point, _isCompressed) => {
|
49429
49188
|
const a = point.toAffine();
|
49430
49189
|
return concatBytes3(Uint8Array.from([4]), Fp2.toBytes(a.x), Fp2.toBytes(a.y));
|
49431
49190
|
});
|
49432
|
-
const fromBytes = CURVE.fromBytes || ((
|
49433
|
-
const tail =
|
49191
|
+
const fromBytes = CURVE.fromBytes || ((bytes2) => {
|
49192
|
+
const tail = bytes2.subarray(1);
|
49434
49193
|
const x = Fp2.fromBytes(tail.subarray(0, Fp2.BYTES));
|
49435
49194
|
const y = Fp2.fromBytes(tail.subarray(Fp2.BYTES, 2 * Fp2.BYTES));
|
49436
49195
|
return { x, y };
|
@@ -49793,7 +49552,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
49793
49552
|
}
|
49794
49553
|
toRawBytes(isCompressed = true) {
|
49795
49554
|
this.assertValidity();
|
49796
|
-
return
|
49555
|
+
return toBytes3(Point2, this, isCompressed);
|
49797
49556
|
}
|
49798
49557
|
toHex(isCompressed = true) {
|
49799
49558
|
return bytesToHex(this.toRawBytes(isCompressed));
|
@@ -49850,10 +49609,10 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
49850
49609
|
return cat(Uint8Array.from([4]), x, Fp2.toBytes(a.y));
|
49851
49610
|
}
|
49852
49611
|
},
|
49853
|
-
fromBytes(
|
49854
|
-
const len =
|
49855
|
-
const head =
|
49856
|
-
const tail =
|
49612
|
+
fromBytes(bytes2) {
|
49613
|
+
const len = bytes2.length;
|
49614
|
+
const head = bytes2[0];
|
49615
|
+
const tail = bytes2.subarray(1);
|
49857
49616
|
if (len === compressedLen && (head === 2 || head === 3)) {
|
49858
49617
|
const x = bytesToNumberBE(tail);
|
49859
49618
|
if (!isValidFieldElement(x))
|
@@ -49875,15 +49634,15 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
49875
49634
|
}
|
49876
49635
|
});
|
49877
49636
|
const numToNByteStr = (num) => bytesToHex(numberToBytesBE(num, CURVE.nByteLength));
|
49878
|
-
function isBiggerThanHalfOrder(
|
49637
|
+
function isBiggerThanHalfOrder(number2) {
|
49879
49638
|
const HALF = CURVE_ORDER >> _1n5;
|
49880
|
-
return
|
49639
|
+
return number2 > HALF;
|
49881
49640
|
}
|
49882
49641
|
function normalizeS(s) {
|
49883
49642
|
return isBiggerThanHalfOrder(s) ? modN(-s) : s;
|
49884
49643
|
}
|
49885
49644
|
const slcNum = (b, from, to) => bytesToNumberBE(b.slice(from, to));
|
49886
|
-
class
|
49645
|
+
class Signature {
|
49887
49646
|
constructor(r, s, recovery) {
|
49888
49647
|
this.r = r;
|
49889
49648
|
this.s = s;
|
@@ -49894,13 +49653,13 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
49894
49653
|
static fromCompact(hex) {
|
49895
49654
|
const l = CURVE.nByteLength;
|
49896
49655
|
hex = ensureBytes("compactSignature", hex, l * 2);
|
49897
|
-
return new
|
49656
|
+
return new Signature(slcNum(hex, 0, l), slcNum(hex, l, 2 * l));
|
49898
49657
|
}
|
49899
49658
|
// DER encoded ECDSA signature
|
49900
49659
|
// https://bitcoin.stackexchange.com/questions/57644/what-are-the-parts-of-a-bitcoin-transaction-input-script
|
49901
49660
|
static fromDER(hex) {
|
49902
49661
|
const { r, s } = DER.toSig(ensureBytes("DER", hex));
|
49903
|
-
return new
|
49662
|
+
return new Signature(r, s);
|
49904
49663
|
}
|
49905
49664
|
assertValidity() {
|
49906
49665
|
if (!isWithinCurveOrder(this.r))
|
@@ -49909,7 +49668,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
49909
49668
|
throw new Error("s must be 0 < s < CURVE.n");
|
49910
49669
|
}
|
49911
49670
|
addRecoveryBit(recovery) {
|
49912
|
-
return new
|
49671
|
+
return new Signature(this.r, this.s, recovery);
|
49913
49672
|
}
|
49914
49673
|
recoverPublicKey(msgHash) {
|
49915
49674
|
const { r, s, recovery: rec } = this;
|
@@ -49935,7 +49694,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
49935
49694
|
return isBiggerThanHalfOrder(this.s);
|
49936
49695
|
}
|
49937
49696
|
normalizeS() {
|
49938
|
-
return this.hasHighS() ? new
|
49697
|
+
return this.hasHighS() ? new Signature(this.r, modN(-this.s), this.recovery) : this;
|
49939
49698
|
}
|
49940
49699
|
// DER-encoded
|
49941
49700
|
toDERRawBytes() {
|
@@ -50007,13 +49766,13 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
50007
49766
|
const b = Point2.fromHex(publicB);
|
50008
49767
|
return b.multiply(normPrivateKeyToScalar(privateA)).toRawBytes(isCompressed);
|
50009
49768
|
}
|
50010
|
-
const bits2int = CURVE.bits2int || function(
|
50011
|
-
const num = bytesToNumberBE(
|
50012
|
-
const delta =
|
49769
|
+
const bits2int = CURVE.bits2int || function(bytes2) {
|
49770
|
+
const num = bytesToNumberBE(bytes2);
|
49771
|
+
const delta = bytes2.length * 8 - CURVE.nBitLength;
|
50013
49772
|
return delta > 0 ? num >> BigInt(delta) : num;
|
50014
49773
|
};
|
50015
|
-
const bits2int_modN = CURVE.bits2int_modN || function(
|
50016
|
-
return modN(bits2int(
|
49774
|
+
const bits2int_modN = CURVE.bits2int_modN || function(bytes2) {
|
49775
|
+
return modN(bits2int(bytes2));
|
50017
49776
|
};
|
50018
49777
|
const ORDER_MASK = bitMask(CURVE.nBitLength);
|
50019
49778
|
function int2octets(num) {
|
@@ -50026,18 +49785,18 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
50026
49785
|
function prepSig(msgHash, privateKey, opts = defaultSigOpts) {
|
50027
49786
|
if (["recovered", "canonical"].some((k) => k in opts))
|
50028
49787
|
throw new Error("sign() legacy options not supported");
|
50029
|
-
const { hash:
|
49788
|
+
const { hash: hash3, randomBytes: randomBytes3 } = CURVE;
|
50030
49789
|
let { lowS, prehash, extraEntropy: ent } = opts;
|
50031
49790
|
if (lowS == null)
|
50032
49791
|
lowS = true;
|
50033
49792
|
msgHash = ensureBytes("msgHash", msgHash);
|
50034
49793
|
if (prehash)
|
50035
|
-
msgHash = ensureBytes("prehashed msgHash",
|
49794
|
+
msgHash = ensureBytes("prehashed msgHash", hash3(msgHash));
|
50036
49795
|
const h1int = bits2int_modN(msgHash);
|
50037
49796
|
const d = normPrivateKeyToScalar(privateKey);
|
50038
49797
|
const seedArgs = [int2octets(d), int2octets(h1int)];
|
50039
49798
|
if (ent != null) {
|
50040
|
-
const e = ent === true ?
|
49799
|
+
const e = ent === true ? randomBytes3(Fp2.BYTES) : ent;
|
50041
49800
|
seedArgs.push(ensureBytes("extraEntropy", e));
|
50042
49801
|
}
|
50043
49802
|
const seed = concatBytes3(...seedArgs);
|
@@ -50060,7 +49819,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
50060
49819
|
normS = normalizeS(s);
|
50061
49820
|
recovery ^= 1;
|
50062
49821
|
}
|
50063
|
-
return new
|
49822
|
+
return new Signature(r, normS, recovery);
|
50064
49823
|
}
|
50065
49824
|
return { seed, k2sig };
|
50066
49825
|
}
|
@@ -50085,15 +49844,15 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
50085
49844
|
try {
|
50086
49845
|
if (typeof sg === "string" || isBytes3(sg)) {
|
50087
49846
|
try {
|
50088
|
-
_sig =
|
49847
|
+
_sig = Signature.fromDER(sg);
|
50089
49848
|
} catch (derError) {
|
50090
49849
|
if (!(derError instanceof DER.Err))
|
50091
49850
|
throw derError;
|
50092
|
-
_sig =
|
49851
|
+
_sig = Signature.fromCompact(sg);
|
50093
49852
|
}
|
50094
49853
|
} else if (typeof sg === "object" && typeof sg.r === "bigint" && typeof sg.s === "bigint") {
|
50095
49854
|
const { r: r2, s: s2 } = sg;
|
50096
|
-
_sig = new
|
49855
|
+
_sig = new Signature(r2, s2);
|
50097
49856
|
} else {
|
50098
49857
|
throw new Error("PARSE");
|
50099
49858
|
}
|
@@ -50125,21 +49884,21 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
50125
49884
|
sign,
|
50126
49885
|
verify,
|
50127
49886
|
ProjectivePoint: Point2,
|
50128
|
-
Signature
|
49887
|
+
Signature,
|
50129
49888
|
utils
|
50130
49889
|
};
|
50131
49890
|
}
|
50132
49891
|
|
50133
49892
|
// ../../node_modules/.pnpm/@noble+curves@1.3.0/node_modules/@noble/curves/esm/_shortw_utils.js
|
50134
|
-
function getHash(
|
49893
|
+
function getHash(hash3) {
|
50135
49894
|
return {
|
50136
|
-
hash:
|
50137
|
-
hmac: (key, ...msgs) => hmac(
|
49895
|
+
hash: hash3,
|
49896
|
+
hmac: (key, ...msgs) => hmac(hash3, key, concatBytes(...msgs)),
|
50138
49897
|
randomBytes
|
50139
49898
|
};
|
50140
49899
|
}
|
50141
49900
|
function createCurve(curveDef, defHash) {
|
50142
|
-
const create = (
|
49901
|
+
const create = (hash3) => weierstrass({ ...curveDef, ...getHash(hash3) });
|
50143
49902
|
return Object.freeze({ ...create(defHash), create });
|
50144
49903
|
}
|
50145
49904
|
|
@@ -50241,7 +50000,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
50241
50000
|
privateKey = `0x${privateKey}`;
|
50242
50001
|
}
|
50243
50002
|
}
|
50244
|
-
const privateKeyBytes =
|
50003
|
+
const privateKeyBytes = toBytes2(privateKey, 32);
|
50245
50004
|
this.privateKey = hexlify(privateKeyBytes);
|
50246
50005
|
this.publicKey = hexlify(secp256k1.getPublicKey(privateKeyBytes, false).slice(1));
|
50247
50006
|
this.compressedPublicKey = hexlify(secp256k1.getPublicKey(privateKeyBytes, true));
|
@@ -50259,8 +50018,8 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
50259
50018
|
*/
|
50260
50019
|
sign(data) {
|
50261
50020
|
const signature = secp256k1.sign(arrayify(data), arrayify(this.privateKey));
|
50262
|
-
const r =
|
50263
|
-
const s =
|
50021
|
+
const r = toBytes2(`0x${signature.r.toString(16)}`, 32);
|
50022
|
+
const s = toBytes2(`0x${signature.s.toString(16)}`, 32);
|
50264
50023
|
s[0] |= (signature.recovery || 0) << 7;
|
50265
50024
|
return hexlify(concat([r, s]));
|
50266
50025
|
}
|
@@ -50312,7 +50071,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
50312
50071
|
* @returns random 32-byte hashed
|
50313
50072
|
*/
|
50314
50073
|
static generatePrivateKey(entropy) {
|
50315
|
-
return entropy ?
|
50074
|
+
return entropy ? hash2(concat([randomBytes22(32), arrayify(entropy)])) : randomBytes22(32);
|
50316
50075
|
}
|
50317
50076
|
/**
|
50318
50077
|
* Extended publicKey from a compact publicKey
|
@@ -50327,12 +50086,12 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
50327
50086
|
};
|
50328
50087
|
|
50329
50088
|
// ../../node_modules/.pnpm/uuid@9.0.0/node_modules/uuid/dist/esm-node/rng.js
|
50330
|
-
var
|
50089
|
+
var import_crypto12 = __toESM(__require("crypto"));
|
50331
50090
|
var rnds8Pool = new Uint8Array(256);
|
50332
50091
|
var poolPtr = rnds8Pool.length;
|
50333
50092
|
function rng() {
|
50334
50093
|
if (poolPtr > rnds8Pool.length - 16) {
|
50335
|
-
|
50094
|
+
import_crypto12.default.randomFillSync(rnds8Pool);
|
50336
50095
|
poolPtr = 0;
|
50337
50096
|
}
|
50338
50097
|
return rnds8Pool.slice(poolPtr, poolPtr += 16);
|
@@ -50348,9 +50107,9 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
50348
50107
|
}
|
50349
50108
|
|
50350
50109
|
// ../../node_modules/.pnpm/uuid@9.0.0/node_modules/uuid/dist/esm-node/native.js
|
50351
|
-
var
|
50110
|
+
var import_crypto13 = __toESM(__require("crypto"));
|
50352
50111
|
var native_default = {
|
50353
|
-
randomUUID:
|
50112
|
+
randomUUID: import_crypto13.default.randomUUID
|
50354
50113
|
};
|
50355
50114
|
|
50356
50115
|
// ../../node_modules/.pnpm/uuid@9.0.0/node_modules/uuid/dist/esm-node/v4.js
|
@@ -50400,7 +50159,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
50400
50159
|
const iv = randomBytes22(DEFAULT_IV_SIZE);
|
50401
50160
|
const ciphertext = await encryptJsonWalletData2(privateKeyBuffer, key, iv);
|
50402
50161
|
const data = Uint8Array.from([...key.subarray(16, 32), ...ciphertext]);
|
50403
|
-
const macHashUint8Array =
|
50162
|
+
const macHashUint8Array = keccak2562(data);
|
50404
50163
|
const mac = stringFromBuffer2(macHashUint8Array, "hex");
|
50405
50164
|
const keystore = {
|
50406
50165
|
id: v4_default(),
|
@@ -50446,7 +50205,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
50446
50205
|
dklen
|
50447
50206
|
});
|
50448
50207
|
const data = Uint8Array.from([...key.subarray(16, 32), ...ciphertextBuffer]);
|
50449
|
-
const macHashUint8Array =
|
50208
|
+
const macHashUint8Array = keccak2562(data);
|
50450
50209
|
const macHash = stringFromBuffer2(macHashUint8Array, "hex");
|
50451
50210
|
if (mac !== macHash) {
|
50452
50211
|
throw new FuelError(
|
@@ -52690,7 +52449,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
52690
52449
|
}
|
52691
52450
|
}
|
52692
52451
|
const checksumBits = entropy.length / 4;
|
52693
|
-
const checksum = arrayify(
|
52452
|
+
const checksum = arrayify(sha2562(entropy))[0] & getUpperMask(checksumBits);
|
52694
52453
|
indices[indices.length - 1] <<= checksumBits;
|
52695
52454
|
indices[indices.length - 1] |= checksum >> 8 - checksumBits;
|
52696
52455
|
return indices;
|
@@ -52717,7 +52476,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
52717
52476
|
const entropyBits = 32 * words.length / 3;
|
52718
52477
|
const checksumBits = words.length / 3;
|
52719
52478
|
const checksumMask = getUpperMask(checksumBits);
|
52720
|
-
const checksum = arrayify(
|
52479
|
+
const checksum = arrayify(sha2562(entropy.slice(0, entropyBits / 8)))[0] & checksumMask;
|
52721
52480
|
if (checksum !== (entropy[entropy.length - 1] & checksumMask)) {
|
52722
52481
|
throw new FuelError(
|
52723
52482
|
ErrorCode.INVALID_CHECKSUM,
|
@@ -52814,7 +52573,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
52814
52573
|
assertMnemonic(getWords(phrase));
|
52815
52574
|
const phraseBytes = toUtf8Bytes2(getPhrase(phrase));
|
52816
52575
|
const salt = toUtf8Bytes2(`mnemonic${passphrase}`);
|
52817
|
-
return
|
52576
|
+
return pbkdf222(phraseBytes, salt, 2048, 64, "sha512");
|
52818
52577
|
}
|
52819
52578
|
/**
|
52820
52579
|
* @param phrase - Mnemonic phrase composed by words from the provided wordlist
|
@@ -52876,7 +52635,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
52876
52635
|
`Seed length should be between 16 and 64 bytes, but received ${seedArray.length} bytes.`
|
52877
52636
|
);
|
52878
52637
|
}
|
52879
|
-
return arrayify(
|
52638
|
+
return arrayify(computeHmac2("sha512", MasterSecret, seedArray));
|
52880
52639
|
}
|
52881
52640
|
/**
|
52882
52641
|
* Get the extendKey as defined on BIP-32 from the provided seed
|
@@ -52901,7 +52660,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
52901
52660
|
chainCode,
|
52902
52661
|
concat(["0x00", privateKey])
|
52903
52662
|
]);
|
52904
|
-
const checksum = dataSlice(
|
52663
|
+
const checksum = dataSlice(sha2562(sha2562(extendedKey)), 0, 4);
|
52905
52664
|
return encodeBase58(concat([extendedKey, checksum]));
|
52906
52665
|
}
|
52907
52666
|
/**
|
@@ -52917,7 +52676,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
52917
52676
|
* @returns A randomly generated mnemonic
|
52918
52677
|
*/
|
52919
52678
|
static generate(size = 32, extraEntropy = "") {
|
52920
|
-
const entropy = extraEntropy ?
|
52679
|
+
const entropy = extraEntropy ? sha2562(concat([randomBytes22(size), arrayify(extraEntropy)])) : randomBytes22(size);
|
52921
52680
|
return Mnemonic.entropyToMnemonic(entropy);
|
52922
52681
|
}
|
52923
52682
|
};
|
@@ -52930,7 +52689,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
52930
52689
|
var TestnetPRV2 = hexlify("0x04358394");
|
52931
52690
|
var TestnetPUB = hexlify("0x043587cf");
|
52932
52691
|
function base58check(data) {
|
52933
|
-
return encodeBase58(concat([data, dataSlice(
|
52692
|
+
return encodeBase58(concat([data, dataSlice(sha2562(sha2562(data)), 0, 4)]));
|
52934
52693
|
}
|
52935
52694
|
function getExtendedKeyPrefix(isPublic = false, testnet = false) {
|
52936
52695
|
if (isPublic) {
|
@@ -52986,7 +52745,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
52986
52745
|
this.publicKey = hexlify(config.publicKey);
|
52987
52746
|
}
|
52988
52747
|
this.parentFingerprint = config.parentFingerprint || this.parentFingerprint;
|
52989
|
-
this.fingerprint = dataSlice(
|
52748
|
+
this.fingerprint = dataSlice(ripemd16022(sha2562(this.publicKey)), 0, 4);
|
52990
52749
|
this.depth = config.depth || this.depth;
|
52991
52750
|
this.index = config.index || this.index;
|
52992
52751
|
this.chainCode = config.chainCode;
|
@@ -53017,10 +52776,10 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
53017
52776
|
} else {
|
53018
52777
|
data.set(arrayify(this.publicKey));
|
53019
52778
|
}
|
53020
|
-
data.set(
|
53021
|
-
const
|
53022
|
-
const IL =
|
53023
|
-
const IR =
|
52779
|
+
data.set(toBytes2(index, 4), 33);
|
52780
|
+
const bytes2 = arrayify(computeHmac2("sha512", chainCode, data));
|
52781
|
+
const IL = bytes2.slice(0, 32);
|
52782
|
+
const IR = bytes2.slice(32);
|
53024
52783
|
if (privateKey) {
|
53025
52784
|
const N = "0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141";
|
53026
52785
|
const ki = bn(IL).add(privateKey).mod(N).toBytes(32);
|
@@ -53089,27 +52848,27 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
53089
52848
|
});
|
53090
52849
|
}
|
53091
52850
|
static fromExtendedKey(extendedKey) {
|
53092
|
-
const decoded =
|
53093
|
-
const
|
53094
|
-
const validChecksum = base58check(
|
53095
|
-
if (
|
52851
|
+
const decoded = hexlify(toBytes2(decodeBase58(extendedKey)));
|
52852
|
+
const bytes2 = arrayify(decoded);
|
52853
|
+
const validChecksum = base58check(bytes2.slice(0, 78)) === extendedKey;
|
52854
|
+
if (bytes2.length !== 82 || !isValidExtendedKey(bytes2)) {
|
53096
52855
|
throw new FuelError(ErrorCode.HD_WALLET_ERROR, "Provided key is not a valid extended key.");
|
53097
52856
|
}
|
53098
52857
|
if (!validChecksum) {
|
53099
52858
|
throw new FuelError(ErrorCode.HD_WALLET_ERROR, "Provided key has an invalid checksum.");
|
53100
52859
|
}
|
53101
|
-
const depth =
|
53102
|
-
const parentFingerprint = hexlify(
|
53103
|
-
const index = parseInt(hexlify(
|
53104
|
-
const chainCode = hexlify(
|
53105
|
-
const key =
|
52860
|
+
const depth = bytes2[4];
|
52861
|
+
const parentFingerprint = hexlify(bytes2.slice(5, 9));
|
52862
|
+
const index = parseInt(hexlify(bytes2.slice(9, 13)).substring(2), 16);
|
52863
|
+
const chainCode = hexlify(bytes2.slice(13, 45));
|
52864
|
+
const key = bytes2.slice(45, 78);
|
53106
52865
|
if (depth === 0 && parentFingerprint !== "0x00000000" || depth === 0 && index !== 0) {
|
53107
52866
|
throw new FuelError(
|
53108
52867
|
ErrorCode.HD_WALLET_ERROR,
|
53109
52868
|
"Inconsistency detected: Depth is zero but fingerprint/index is non-zero."
|
53110
52869
|
);
|
53111
52870
|
}
|
53112
|
-
if (isPublicExtendedKey(
|
52871
|
+
if (isPublicExtendedKey(bytes2)) {
|
53113
52872
|
if (key[0] !== 3) {
|
53114
52873
|
throw new FuelError(ErrorCode.HD_WALLET_ERROR, "Invalid public extended key.");
|
53115
52874
|
}
|
@@ -53288,16 +53047,18 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
53288
53047
|
__publicField(Wallet, "fromEncryptedJson", WalletUnlocked.fromEncryptedJson);
|
53289
53048
|
|
53290
53049
|
// src/test-utils/seedTestWallet.ts
|
53291
|
-
var seedTestWallet = async (wallet, quantities) => {
|
53292
|
-
const
|
53293
|
-
|
53294
|
-
|
53295
|
-
);
|
53050
|
+
var seedTestWallet = async (wallet, quantities, utxosAmount = 1) => {
|
53051
|
+
const accountsToBeFunded = Array.isArray(wallet) ? wallet : [wallet];
|
53052
|
+
const [{ provider }] = accountsToBeFunded;
|
53053
|
+
const genesisWallet = new WalletUnlocked(process.env.GENESIS_SECRET || randomBytes22(32), provider);
|
53296
53054
|
const request = new ScriptTransactionRequest();
|
53297
|
-
quantities.forEach(
|
53298
|
-
|
53299
|
-
|
53300
|
-
|
53055
|
+
quantities.map(coinQuantityfy).forEach(
|
53056
|
+
({ amount, assetId }) => accountsToBeFunded.forEach(({ address }) => {
|
53057
|
+
for (let i = 0; i < utxosAmount; i++) {
|
53058
|
+
request.addCoinOutput(address, amount.div(utxosAmount), assetId);
|
53059
|
+
}
|
53060
|
+
})
|
53061
|
+
);
|
53301
53062
|
const txCost = await genesisWallet.provider.getTransactionCost(request);
|
53302
53063
|
request.gasLimit = txCost.gasUsed;
|
53303
53064
|
request.maxFee = txCost.maxFee;
|
@@ -53338,7 +53099,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
53338
53099
|
|
53339
53100
|
// src/test-utils/launchNode.ts
|
53340
53101
|
var import_child_process = __require("child_process");
|
53341
|
-
var
|
53102
|
+
var import_crypto19 = __require("crypto");
|
53342
53103
|
var import_fs2 = __require("fs");
|
53343
53104
|
var import_os = __toESM(__require("os"));
|
53344
53105
|
var import_path8 = __toESM(__require("path"));
|
@@ -53411,7 +53172,7 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
53411
53172
|
})).toString();
|
53412
53173
|
let snapshotDirToUse;
|
53413
53174
|
const prefix = basePath || import_os.default.tmpdir();
|
53414
|
-
const suffix = basePath ? "" : (0,
|
53175
|
+
const suffix = basePath ? "" : (0, import_crypto19.randomUUID)();
|
53415
53176
|
const tempDirPath = import_path8.default.join(prefix, ".fuels", suffix, "snapshotDir");
|
53416
53177
|
if (snapshotDir) {
|
53417
53178
|
snapshotDirToUse = snapshotDir;
|
@@ -53562,9 +53323,6 @@ mime-types/index.js:
|
|
53562
53323
|
@noble/hashes/esm/utils.js:
|
53563
53324
|
(*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
|
53564
53325
|
|
53565
|
-
@noble/hashes/esm/utils.js:
|
53566
|
-
(*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
|
53567
|
-
|
53568
53326
|
@noble/curves/esm/abstract/utils.js:
|
53569
53327
|
(*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
|
53570
53328
|
|