@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.

Files changed (31) hide show
  1. package/dist/hdwallet/hdwallet.d.ts.map +1 -1
  2. package/dist/index.global.js +1373 -1574
  3. package/dist/index.global.js.map +1 -1
  4. package/dist/index.js +337 -269
  5. package/dist/index.js.map +1 -1
  6. package/dist/index.mjs +237 -176
  7. package/dist/index.mjs.map +1 -1
  8. package/dist/mnemonic/mnemonic.d.ts.map +1 -1
  9. package/dist/predicate/predicate.d.ts +9 -2
  10. package/dist/predicate/predicate.d.ts.map +1 -1
  11. package/dist/providers/provider.d.ts +1 -1
  12. package/dist/providers/provider.d.ts.map +1 -1
  13. package/dist/providers/transaction-request/helpers.d.ts +4 -0
  14. package/dist/providers/transaction-request/helpers.d.ts.map +1 -1
  15. package/dist/providers/transaction-request/index.d.ts +1 -0
  16. package/dist/providers/transaction-request/index.d.ts.map +1 -1
  17. package/dist/providers/transaction-request/transaction-request.d.ts +2 -0
  18. package/dist/providers/transaction-request/transaction-request.d.ts.map +1 -1
  19. package/dist/providers/transaction-request/utils.d.ts +0 -4
  20. package/dist/providers/transaction-request/utils.d.ts.map +1 -1
  21. package/dist/test-utils/seedTestWallet.d.ts +1 -1
  22. package/dist/test-utils/seedTestWallet.d.ts.map +1 -1
  23. package/dist/test-utils.global.js +1326 -1568
  24. package/dist/test-utils.global.js.map +1 -1
  25. package/dist/test-utils.js +282 -269
  26. package/dist/test-utils.js.map +1 -1
  27. package/dist/test-utils.mjs +192 -179
  28. package/dist/test-utils.mjs.map +1 -1
  29. package/dist/wallet/base-wallet-unlocked.d.ts +2 -2
  30. package/dist/wallet/base-wallet-unlocked.d.ts.map +1 -1
  31. package/package.json +15 -16
@@ -68,178 +68,12 @@
68
68
  return method;
69
69
  };
70
70
 
71
- // ../../node_modules/.pnpm/bech32@2.0.0/node_modules/bech32/dist/index.js
72
- var require_dist = __commonJS({
73
- "../../node_modules/.pnpm/bech32@2.0.0/node_modules/bech32/dist/index.js"(exports) {
74
- "use strict";
75
- Object.defineProperty(exports, "__esModule", { value: true });
76
- exports.bech32m = exports.bech32 = void 0;
77
- var ALPHABET = "qpzry9x8gf2tvdw0s3jn54khce6mua7l";
78
- var ALPHABET_MAP = {};
79
- for (let z = 0; z < ALPHABET.length; z++) {
80
- const x = ALPHABET.charAt(z);
81
- ALPHABET_MAP[x] = z;
82
- }
83
- function polymodStep(pre) {
84
- const b = pre >> 25;
85
- return (pre & 33554431) << 5 ^ -(b >> 0 & 1) & 996825010 ^ -(b >> 1 & 1) & 642813549 ^ -(b >> 2 & 1) & 513874426 ^ -(b >> 3 & 1) & 1027748829 ^ -(b >> 4 & 1) & 705979059;
86
- }
87
- function prefixChk(prefix) {
88
- let chk = 1;
89
- for (let i = 0; i < prefix.length; ++i) {
90
- const c = prefix.charCodeAt(i);
91
- if (c < 33 || c > 126)
92
- return "Invalid prefix (" + prefix + ")";
93
- chk = polymodStep(chk) ^ c >> 5;
94
- }
95
- chk = polymodStep(chk);
96
- for (let i = 0; i < prefix.length; ++i) {
97
- const v = prefix.charCodeAt(i);
98
- chk = polymodStep(chk) ^ v & 31;
99
- }
100
- return chk;
101
- }
102
- function convert2(data, inBits, outBits, pad3) {
103
- let value = 0;
104
- let bits = 0;
105
- const maxV = (1 << outBits) - 1;
106
- const result = [];
107
- for (let i = 0; i < data.length; ++i) {
108
- value = value << inBits | data[i];
109
- bits += inBits;
110
- while (bits >= outBits) {
111
- bits -= outBits;
112
- result.push(value >> bits & maxV);
113
- }
114
- }
115
- if (pad3) {
116
- if (bits > 0) {
117
- result.push(value << outBits - bits & maxV);
118
- }
119
- } else {
120
- if (bits >= inBits)
121
- return "Excess padding";
122
- if (value << outBits - bits & maxV)
123
- return "Non-zero padding";
124
- }
125
- return result;
126
- }
127
- function toWords(bytes3) {
128
- return convert2(bytes3, 8, 5, true);
129
- }
130
- function fromWordsUnsafe(words) {
131
- const res = convert2(words, 5, 8, false);
132
- if (Array.isArray(res))
133
- return res;
134
- }
135
- function fromWords(words) {
136
- const res = convert2(words, 5, 8, false);
137
- if (Array.isArray(res))
138
- return res;
139
- throw new Error(res);
140
- }
141
- function getLibraryFromEncoding(encoding) {
142
- let ENCODING_CONST;
143
- if (encoding === "bech32") {
144
- ENCODING_CONST = 1;
145
- } else {
146
- ENCODING_CONST = 734539939;
147
- }
148
- function encode(prefix, words, LIMIT) {
149
- LIMIT = LIMIT || 90;
150
- if (prefix.length + 7 + words.length > LIMIT)
151
- throw new TypeError("Exceeds length limit");
152
- prefix = prefix.toLowerCase();
153
- let chk = prefixChk(prefix);
154
- if (typeof chk === "string")
155
- throw new Error(chk);
156
- let result = prefix + "1";
157
- for (let i = 0; i < words.length; ++i) {
158
- const x = words[i];
159
- if (x >> 5 !== 0)
160
- throw new Error("Non 5-bit word");
161
- chk = polymodStep(chk) ^ x;
162
- result += ALPHABET.charAt(x);
163
- }
164
- for (let i = 0; i < 6; ++i) {
165
- chk = polymodStep(chk);
166
- }
167
- chk ^= ENCODING_CONST;
168
- for (let i = 0; i < 6; ++i) {
169
- const v = chk >> (5 - i) * 5 & 31;
170
- result += ALPHABET.charAt(v);
171
- }
172
- return result;
173
- }
174
- function __decode(str, LIMIT) {
175
- LIMIT = LIMIT || 90;
176
- if (str.length < 8)
177
- return str + " too short";
178
- if (str.length > LIMIT)
179
- return "Exceeds length limit";
180
- const lowered = str.toLowerCase();
181
- const uppered = str.toUpperCase();
182
- if (str !== lowered && str !== uppered)
183
- return "Mixed-case string " + str;
184
- str = lowered;
185
- const split2 = str.lastIndexOf("1");
186
- if (split2 === -1)
187
- return "No separator character for " + str;
188
- if (split2 === 0)
189
- return "Missing prefix for " + str;
190
- const prefix = str.slice(0, split2);
191
- const wordChars = str.slice(split2 + 1);
192
- if (wordChars.length < 6)
193
- return "Data too short";
194
- let chk = prefixChk(prefix);
195
- if (typeof chk === "string")
196
- return chk;
197
- const words = [];
198
- for (let i = 0; i < wordChars.length; ++i) {
199
- const c = wordChars.charAt(i);
200
- const v = ALPHABET_MAP[c];
201
- if (v === void 0)
202
- return "Unknown character " + c;
203
- chk = polymodStep(chk) ^ v;
204
- if (i + 6 >= wordChars.length)
205
- continue;
206
- words.push(v);
207
- }
208
- if (chk !== ENCODING_CONST)
209
- return "Invalid checksum for " + str;
210
- return { prefix, words };
211
- }
212
- function decodeUnsafe(str, LIMIT) {
213
- const res = __decode(str, LIMIT);
214
- if (typeof res === "object")
215
- return res;
216
- }
217
- function decode(str, LIMIT) {
218
- const res = __decode(str, LIMIT);
219
- if (typeof res === "object")
220
- return res;
221
- throw new Error(res);
222
- }
223
- return {
224
- decodeUnsafe,
225
- decode,
226
- encode,
227
- toWords,
228
- fromWordsUnsafe,
229
- fromWords
230
- };
231
- }
232
- exports.bech32 = getLibraryFromEncoding("bech32");
233
- exports.bech32m = getLibraryFromEncoding("bech32m");
234
- }
235
- });
236
-
237
71
  // ../../node_modules/.pnpm/bn.js@5.2.1/node_modules/bn.js/lib/bn.js
238
72
  var require_bn = __commonJS({
239
73
  "../../node_modules/.pnpm/bn.js@5.2.1/node_modules/bn.js/lib/bn.js"(exports, module) {
240
74
  (function(module2, exports2) {
241
75
  "use strict";
242
- function assert4(val, msg) {
76
+ function assert3(val, msg) {
243
77
  if (!val)
244
78
  throw new Error(msg || "Assertion failed");
245
79
  }
@@ -251,20 +85,20 @@
251
85
  ctor.prototype = new TempCtor();
252
86
  ctor.prototype.constructor = ctor;
253
87
  }
254
- function BN2(number3, base, endian) {
255
- if (BN2.isBN(number3)) {
256
- return number3;
88
+ function BN2(number2, base, endian) {
89
+ if (BN2.isBN(number2)) {
90
+ return number2;
257
91
  }
258
92
  this.negative = 0;
259
93
  this.words = null;
260
94
  this.length = 0;
261
95
  this.red = null;
262
- if (number3 !== null) {
96
+ if (number2 !== null) {
263
97
  if (base === "le" || base === "be") {
264
98
  endian = base;
265
99
  base = 10;
266
100
  }
267
- this._init(number3 || 0, base || 10, endian || "be");
101
+ this._init(number2 || 0, base || 10, endian || "be");
268
102
  }
269
103
  }
270
104
  if (typeof module2 === "object") {
@@ -299,53 +133,53 @@
299
133
  return left;
300
134
  return right;
301
135
  };
302
- BN2.prototype._init = function init(number3, base, endian) {
303
- if (typeof number3 === "number") {
304
- return this._initNumber(number3, base, endian);
136
+ BN2.prototype._init = function init(number2, base, endian) {
137
+ if (typeof number2 === "number") {
138
+ return this._initNumber(number2, base, endian);
305
139
  }
306
- if (typeof number3 === "object") {
307
- return this._initArray(number3, base, endian);
140
+ if (typeof number2 === "object") {
141
+ return this._initArray(number2, base, endian);
308
142
  }
309
143
  if (base === "hex") {
310
144
  base = 16;
311
145
  }
312
- assert4(base === (base | 0) && base >= 2 && base <= 36);
313
- number3 = number3.toString().replace(/\s+/g, "");
146
+ assert3(base === (base | 0) && base >= 2 && base <= 36);
147
+ number2 = number2.toString().replace(/\s+/g, "");
314
148
  var start = 0;
315
- if (number3[0] === "-") {
149
+ if (number2[0] === "-") {
316
150
  start++;
317
151
  this.negative = 1;
318
152
  }
319
- if (start < number3.length) {
153
+ if (start < number2.length) {
320
154
  if (base === 16) {
321
- this._parseHex(number3, start, endian);
155
+ this._parseHex(number2, start, endian);
322
156
  } else {
323
- this._parseBase(number3, base, start);
157
+ this._parseBase(number2, base, start);
324
158
  if (endian === "le") {
325
159
  this._initArray(this.toArray(), base, endian);
326
160
  }
327
161
  }
328
162
  }
329
163
  };
330
- BN2.prototype._initNumber = function _initNumber(number3, base, endian) {
331
- if (number3 < 0) {
164
+ BN2.prototype._initNumber = function _initNumber(number2, base, endian) {
165
+ if (number2 < 0) {
332
166
  this.negative = 1;
333
- number3 = -number3;
167
+ number2 = -number2;
334
168
  }
335
- if (number3 < 67108864) {
336
- this.words = [number3 & 67108863];
169
+ if (number2 < 67108864) {
170
+ this.words = [number2 & 67108863];
337
171
  this.length = 1;
338
- } else if (number3 < 4503599627370496) {
172
+ } else if (number2 < 4503599627370496) {
339
173
  this.words = [
340
- number3 & 67108863,
341
- number3 / 67108864 & 67108863
174
+ number2 & 67108863,
175
+ number2 / 67108864 & 67108863
342
176
  ];
343
177
  this.length = 2;
344
178
  } else {
345
- assert4(number3 < 9007199254740992);
179
+ assert3(number2 < 9007199254740992);
346
180
  this.words = [
347
- number3 & 67108863,
348
- number3 / 67108864 & 67108863,
181
+ number2 & 67108863,
182
+ number2 / 67108864 & 67108863,
349
183
  1
350
184
  ];
351
185
  this.length = 3;
@@ -354,14 +188,14 @@
354
188
  return;
355
189
  this._initArray(this.toArray(), base, endian);
356
190
  };
357
- BN2.prototype._initArray = function _initArray(number3, base, endian) {
358
- assert4(typeof number3.length === "number");
359
- if (number3.length <= 0) {
191
+ BN2.prototype._initArray = function _initArray(number2, base, endian) {
192
+ assert3(typeof number2.length === "number");
193
+ if (number2.length <= 0) {
360
194
  this.words = [0];
361
195
  this.length = 1;
362
196
  return this;
363
197
  }
364
- this.length = Math.ceil(number3.length / 3);
198
+ this.length = Math.ceil(number2.length / 3);
365
199
  this.words = new Array(this.length);
366
200
  for (var i = 0; i < this.length; i++) {
367
201
  this.words[i] = 0;
@@ -369,8 +203,8 @@
369
203
  var j, w;
370
204
  var off = 0;
371
205
  if (endian === "be") {
372
- for (i = number3.length - 1, j = 0; i >= 0; i -= 3) {
373
- w = number3[i] | number3[i - 1] << 8 | number3[i - 2] << 16;
206
+ for (i = number2.length - 1, j = 0; i >= 0; i -= 3) {
207
+ w = number2[i] | number2[i - 1] << 8 | number2[i - 2] << 16;
374
208
  this.words[j] |= w << off & 67108863;
375
209
  this.words[j + 1] = w >>> 26 - off & 67108863;
376
210
  off += 24;
@@ -380,8 +214,8 @@
380
214
  }
381
215
  }
382
216
  } else if (endian === "le") {
383
- for (i = 0, j = 0; i < number3.length; i += 3) {
384
- w = number3[i] | number3[i + 1] << 8 | number3[i + 2] << 16;
217
+ for (i = 0, j = 0; i < number2.length; i += 3) {
218
+ w = number2[i] | number2[i + 1] << 8 | number2[i + 2] << 16;
385
219
  this.words[j] |= w << off & 67108863;
386
220
  this.words[j + 1] = w >>> 26 - off & 67108863;
387
221
  off += 24;
@@ -402,7 +236,7 @@
402
236
  } else if (c >= 97 && c <= 102) {
403
237
  return c - 87;
404
238
  } else {
405
- assert4(false, "Invalid character in " + string);
239
+ assert3(false, "Invalid character in " + string);
406
240
  }
407
241
  }
408
242
  function parseHexByte(string, lowerBound, index) {
@@ -412,8 +246,8 @@
412
246
  }
413
247
  return r;
414
248
  }
415
- BN2.prototype._parseHex = function _parseHex(number3, start, endian) {
416
- this.length = Math.ceil((number3.length - start) / 6);
249
+ BN2.prototype._parseHex = function _parseHex(number2, start, endian) {
250
+ this.length = Math.ceil((number2.length - start) / 6);
417
251
  this.words = new Array(this.length);
418
252
  for (var i = 0; i < this.length; i++) {
419
253
  this.words[i] = 0;
@@ -422,8 +256,8 @@
422
256
  var j = 0;
423
257
  var w;
424
258
  if (endian === "be") {
425
- for (i = number3.length - 1; i >= start; i -= 2) {
426
- w = parseHexByte(number3, start, i) << off;
259
+ for (i = number2.length - 1; i >= start; i -= 2) {
260
+ w = parseHexByte(number2, start, i) << off;
427
261
  this.words[j] |= w & 67108863;
428
262
  if (off >= 18) {
429
263
  off -= 18;
@@ -434,9 +268,9 @@
434
268
  }
435
269
  }
436
270
  } else {
437
- var parseLength = number3.length - start;
438
- for (i = parseLength % 2 === 0 ? start + 1 : start; i < number3.length; i += 2) {
439
- w = parseHexByte(number3, start, i) << off;
271
+ var parseLength = number2.length - start;
272
+ for (i = parseLength % 2 === 0 ? start + 1 : start; i < number2.length; i += 2) {
273
+ w = parseHexByte(number2, start, i) << off;
440
274
  this.words[j] |= w & 67108863;
441
275
  if (off >= 18) {
442
276
  off -= 18;
@@ -463,12 +297,12 @@
463
297
  } else {
464
298
  b = c;
465
299
  }
466
- assert4(c >= 0 && b < mul, "Invalid character");
300
+ assert3(c >= 0 && b < mul, "Invalid character");
467
301
  r += b;
468
302
  }
469
303
  return r;
470
304
  }
471
- BN2.prototype._parseBase = function _parseBase(number3, base, start) {
305
+ BN2.prototype._parseBase = function _parseBase(number2, base, start) {
472
306
  this.words = [0];
473
307
  this.length = 1;
474
308
  for (var limbLen = 0, limbPow = 1; limbPow <= 67108863; limbPow *= base) {
@@ -476,12 +310,12 @@
476
310
  }
477
311
  limbLen--;
478
312
  limbPow = limbPow / base | 0;
479
- var total = number3.length - start;
313
+ var total = number2.length - start;
480
314
  var mod2 = total % limbLen;
481
315
  var end = Math.min(total, total - mod2) + start;
482
316
  var word = 0;
483
317
  for (var i = start; i < end; i += limbLen) {
484
- word = parseBase(number3, i, i + limbLen, base);
318
+ word = parseBase(number2, i, i + limbLen, base);
485
319
  this.imuln(limbPow);
486
320
  if (this.words[0] + word < 67108864) {
487
321
  this.words[0] += word;
@@ -491,7 +325,7 @@
491
325
  }
492
326
  if (mod2 !== 0) {
493
327
  var pow3 = 1;
494
- word = parseBase(number3, i, number3.length, base);
328
+ word = parseBase(number2, i, number2.length, base);
495
329
  for (i = 0; i < mod2; i++) {
496
330
  pow3 *= base;
497
331
  }
@@ -723,7 +557,7 @@
723
557
  }
724
558
  return out;
725
559
  }
726
- assert4(false, "Base should be between 2 and 36");
560
+ assert3(false, "Base should be between 2 and 36");
727
561
  };
728
562
  BN2.prototype.toNumber = function toNumber3() {
729
563
  var ret2 = this.words[0];
@@ -732,7 +566,7 @@
732
566
  } else if (this.length === 3 && this.words[2] === 1) {
733
567
  ret2 += 4503599627370496 + this.words[1] * 67108864;
734
568
  } else if (this.length > 2) {
735
- assert4(false, "Number can only safely store up to 53 bits");
569
+ assert3(false, "Number can only safely store up to 53 bits");
736
570
  }
737
571
  return this.negative !== 0 ? -ret2 : ret2;
738
572
  };
@@ -757,8 +591,8 @@
757
591
  this._strip();
758
592
  var byteLength = this.byteLength();
759
593
  var reqLength = length || Math.max(1, byteLength);
760
- assert4(byteLength <= reqLength, "byte array longer than desired length");
761
- assert4(reqLength > 0, "Requested array length <= 0");
594
+ assert3(byteLength <= reqLength, "byte array longer than desired length");
595
+ assert3(reqLength > 0, "Requested array length <= 0");
762
596
  var res = allocate(ArrayType, reqLength);
763
597
  var postfix = endian === "le" ? "LE" : "BE";
764
598
  this["_toArrayLike" + postfix](res, byteLength);
@@ -940,7 +774,7 @@
940
774
  return this._strip();
941
775
  };
942
776
  BN2.prototype.ior = function ior(num) {
943
- assert4((this.negative | num.negative) === 0);
777
+ assert3((this.negative | num.negative) === 0);
944
778
  return this.iuor(num);
945
779
  };
946
780
  BN2.prototype.or = function or(num) {
@@ -967,7 +801,7 @@
967
801
  return this._strip();
968
802
  };
969
803
  BN2.prototype.iand = function iand(num) {
970
- assert4((this.negative | num.negative) === 0);
804
+ assert3((this.negative | num.negative) === 0);
971
805
  return this.iuand(num);
972
806
  };
973
807
  BN2.prototype.and = function and(num) {
@@ -1002,7 +836,7 @@
1002
836
  return this._strip();
1003
837
  };
1004
838
  BN2.prototype.ixor = function ixor(num) {
1005
- assert4((this.negative | num.negative) === 0);
839
+ assert3((this.negative | num.negative) === 0);
1006
840
  return this.iuxor(num);
1007
841
  };
1008
842
  BN2.prototype.xor = function xor(num) {
@@ -1016,7 +850,7 @@
1016
850
  return num.clone().iuxor(this);
1017
851
  };
1018
852
  BN2.prototype.inotn = function inotn(width) {
1019
- assert4(typeof width === "number" && width >= 0);
853
+ assert3(typeof width === "number" && width >= 0);
1020
854
  var bytesNeeded = Math.ceil(width / 26) | 0;
1021
855
  var bitsLeft = width % 26;
1022
856
  this._expand(bytesNeeded);
@@ -1035,7 +869,7 @@
1035
869
  return this.clone().inotn(width);
1036
870
  };
1037
871
  BN2.prototype.setn = function setn(bit, val) {
1038
- assert4(typeof bit === "number" && bit >= 0);
872
+ assert3(typeof bit === "number" && bit >= 0);
1039
873
  var off = bit / 26 | 0;
1040
874
  var wbit = bit % 26;
1041
875
  this._expand(off + 1);
@@ -1901,8 +1735,8 @@
1901
1735
  for (i = 2 * len; i < N; ++i) {
1902
1736
  rws[i] = 0;
1903
1737
  }
1904
- assert4(carry === 0);
1905
- assert4((carry & ~8191) === 0);
1738
+ assert3(carry === 0);
1739
+ assert3((carry & ~8191) === 0);
1906
1740
  };
1907
1741
  FFTM.prototype.stub = function stub(N) {
1908
1742
  var ph = new Array(N);
@@ -1957,8 +1791,8 @@
1957
1791
  var isNegNum = num < 0;
1958
1792
  if (isNegNum)
1959
1793
  num = -num;
1960
- assert4(typeof num === "number");
1961
- assert4(num < 67108864);
1794
+ assert3(typeof num === "number");
1795
+ assert3(num < 67108864);
1962
1796
  var carry = 0;
1963
1797
  for (var i = 0; i < this.length; i++) {
1964
1798
  var w = (this.words[i] | 0) * num;
@@ -2002,7 +1836,7 @@
2002
1836
  return res;
2003
1837
  };
2004
1838
  BN2.prototype.iushln = function iushln(bits) {
2005
- assert4(typeof bits === "number" && bits >= 0);
1839
+ assert3(typeof bits === "number" && bits >= 0);
2006
1840
  var r = bits % 26;
2007
1841
  var s = (bits - r) / 26;
2008
1842
  var carryMask = 67108863 >>> 26 - r << 26 - r;
@@ -2032,11 +1866,11 @@
2032
1866
  return this._strip();
2033
1867
  };
2034
1868
  BN2.prototype.ishln = function ishln(bits) {
2035
- assert4(this.negative === 0);
1869
+ assert3(this.negative === 0);
2036
1870
  return this.iushln(bits);
2037
1871
  };
2038
1872
  BN2.prototype.iushrn = function iushrn(bits, hint, extended) {
2039
- assert4(typeof bits === "number" && bits >= 0);
1873
+ assert3(typeof bits === "number" && bits >= 0);
2040
1874
  var h;
2041
1875
  if (hint) {
2042
1876
  h = (hint - hint % 26) / 26;
@@ -2081,7 +1915,7 @@
2081
1915
  return this._strip();
2082
1916
  };
2083
1917
  BN2.prototype.ishrn = function ishrn(bits, hint, extended) {
2084
- assert4(this.negative === 0);
1918
+ assert3(this.negative === 0);
2085
1919
  return this.iushrn(bits, hint, extended);
2086
1920
  };
2087
1921
  BN2.prototype.shln = function shln(bits) {
@@ -2097,7 +1931,7 @@
2097
1931
  return this.clone().iushrn(bits);
2098
1932
  };
2099
1933
  BN2.prototype.testn = function testn(bit) {
2100
- assert4(typeof bit === "number" && bit >= 0);
1934
+ assert3(typeof bit === "number" && bit >= 0);
2101
1935
  var r = bit % 26;
2102
1936
  var s = (bit - r) / 26;
2103
1937
  var q = 1 << r;
@@ -2107,10 +1941,10 @@
2107
1941
  return !!(w & q);
2108
1942
  };
2109
1943
  BN2.prototype.imaskn = function imaskn(bits) {
2110
- assert4(typeof bits === "number" && bits >= 0);
1944
+ assert3(typeof bits === "number" && bits >= 0);
2111
1945
  var r = bits % 26;
2112
1946
  var s = (bits - r) / 26;
2113
- assert4(this.negative === 0, "imaskn works only with positive numbers");
1947
+ assert3(this.negative === 0, "imaskn works only with positive numbers");
2114
1948
  if (this.length <= s) {
2115
1949
  return this;
2116
1950
  }
@@ -2128,8 +1962,8 @@
2128
1962
  return this.clone().imaskn(bits);
2129
1963
  };
2130
1964
  BN2.prototype.iaddn = function iaddn(num) {
2131
- assert4(typeof num === "number");
2132
- assert4(num < 67108864);
1965
+ assert3(typeof num === "number");
1966
+ assert3(num < 67108864);
2133
1967
  if (num < 0)
2134
1968
  return this.isubn(-num);
2135
1969
  if (this.negative !== 0) {
@@ -2159,8 +1993,8 @@
2159
1993
  return this;
2160
1994
  };
2161
1995
  BN2.prototype.isubn = function isubn(num) {
2162
- assert4(typeof num === "number");
2163
- assert4(num < 67108864);
1996
+ assert3(typeof num === "number");
1997
+ assert3(num < 67108864);
2164
1998
  if (num < 0)
2165
1999
  return this.iaddn(-num);
2166
2000
  if (this.negative !== 0) {
@@ -2214,7 +2048,7 @@
2214
2048
  }
2215
2049
  if (carry === 0)
2216
2050
  return this._strip();
2217
- assert4(carry === -1);
2051
+ assert3(carry === -1);
2218
2052
  carry = 0;
2219
2053
  for (i = 0; i < this.length; i++) {
2220
2054
  w = -(this.words[i] | 0) + carry;
@@ -2282,7 +2116,7 @@
2282
2116
  };
2283
2117
  };
2284
2118
  BN2.prototype.divmod = function divmod(num, mode, positive) {
2285
- assert4(!num.isZero());
2119
+ assert3(!num.isZero());
2286
2120
  if (this.isZero()) {
2287
2121
  return {
2288
2122
  div: new BN2(0),
@@ -2380,7 +2214,7 @@
2380
2214
  var isNegNum = num < 0;
2381
2215
  if (isNegNum)
2382
2216
  num = -num;
2383
- assert4(num <= 67108863);
2217
+ assert3(num <= 67108863);
2384
2218
  var p = (1 << 26) % num;
2385
2219
  var acc = 0;
2386
2220
  for (var i = this.length - 1; i >= 0; i--) {
@@ -2395,7 +2229,7 @@
2395
2229
  var isNegNum = num < 0;
2396
2230
  if (isNegNum)
2397
2231
  num = -num;
2398
- assert4(num <= 67108863);
2232
+ assert3(num <= 67108863);
2399
2233
  var carry = 0;
2400
2234
  for (var i = this.length - 1; i >= 0; i--) {
2401
2235
  var w = (this.words[i] | 0) + carry * 67108864;
@@ -2409,8 +2243,8 @@
2409
2243
  return this.clone().idivn(num);
2410
2244
  };
2411
2245
  BN2.prototype.egcd = function egcd(p) {
2412
- assert4(p.negative === 0);
2413
- assert4(!p.isZero());
2246
+ assert3(p.negative === 0);
2247
+ assert3(!p.isZero());
2414
2248
  var x = this;
2415
2249
  var y = p.clone();
2416
2250
  if (x.negative !== 0) {
@@ -2474,8 +2308,8 @@
2474
2308
  };
2475
2309
  };
2476
2310
  BN2.prototype._invmp = function _invmp(p) {
2477
- assert4(p.negative === 0);
2478
- assert4(!p.isZero());
2311
+ assert3(p.negative === 0);
2312
+ assert3(!p.isZero());
2479
2313
  var a = this;
2480
2314
  var b = p.clone();
2481
2315
  if (a.negative !== 0) {
@@ -2573,7 +2407,7 @@
2573
2407
  return this.words[0] & num;
2574
2408
  };
2575
2409
  BN2.prototype.bincn = function bincn(bit) {
2576
- assert4(typeof bit === "number");
2410
+ assert3(typeof bit === "number");
2577
2411
  var r = bit % 26;
2578
2412
  var s = (bit - r) / 26;
2579
2413
  var q = 1 << r;
@@ -2613,7 +2447,7 @@
2613
2447
  if (negative) {
2614
2448
  num = -num;
2615
2449
  }
2616
- assert4(num <= 67108863, "Number is too big");
2450
+ assert3(num <= 67108863, "Number is too big");
2617
2451
  var w = this.words[0] | 0;
2618
2452
  res = w === num ? 0 : w < num ? -1 : 1;
2619
2453
  }
@@ -2685,12 +2519,12 @@
2685
2519
  return new Red(num);
2686
2520
  };
2687
2521
  BN2.prototype.toRed = function toRed(ctx) {
2688
- assert4(!this.red, "Already a number in reduction context");
2689
- assert4(this.negative === 0, "red works only with positives");
2522
+ assert3(!this.red, "Already a number in reduction context");
2523
+ assert3(this.negative === 0, "red works only with positives");
2690
2524
  return ctx.convertTo(this)._forceRed(ctx);
2691
2525
  };
2692
2526
  BN2.prototype.fromRed = function fromRed() {
2693
- assert4(this.red, "fromRed works only with numbers in reduction context");
2527
+ assert3(this.red, "fromRed works only with numbers in reduction context");
2694
2528
  return this.red.convertFrom(this);
2695
2529
  };
2696
2530
  BN2.prototype._forceRed = function _forceRed(ctx) {
@@ -2698,66 +2532,66 @@
2698
2532
  return this;
2699
2533
  };
2700
2534
  BN2.prototype.forceRed = function forceRed(ctx) {
2701
- assert4(!this.red, "Already a number in reduction context");
2535
+ assert3(!this.red, "Already a number in reduction context");
2702
2536
  return this._forceRed(ctx);
2703
2537
  };
2704
2538
  BN2.prototype.redAdd = function redAdd(num) {
2705
- assert4(this.red, "redAdd works only with red numbers");
2539
+ assert3(this.red, "redAdd works only with red numbers");
2706
2540
  return this.red.add(this, num);
2707
2541
  };
2708
2542
  BN2.prototype.redIAdd = function redIAdd(num) {
2709
- assert4(this.red, "redIAdd works only with red numbers");
2543
+ assert3(this.red, "redIAdd works only with red numbers");
2710
2544
  return this.red.iadd(this, num);
2711
2545
  };
2712
2546
  BN2.prototype.redSub = function redSub(num) {
2713
- assert4(this.red, "redSub works only with red numbers");
2547
+ assert3(this.red, "redSub works only with red numbers");
2714
2548
  return this.red.sub(this, num);
2715
2549
  };
2716
2550
  BN2.prototype.redISub = function redISub(num) {
2717
- assert4(this.red, "redISub works only with red numbers");
2551
+ assert3(this.red, "redISub works only with red numbers");
2718
2552
  return this.red.isub(this, num);
2719
2553
  };
2720
2554
  BN2.prototype.redShl = function redShl(num) {
2721
- assert4(this.red, "redShl works only with red numbers");
2555
+ assert3(this.red, "redShl works only with red numbers");
2722
2556
  return this.red.shl(this, num);
2723
2557
  };
2724
2558
  BN2.prototype.redMul = function redMul(num) {
2725
- assert4(this.red, "redMul works only with red numbers");
2559
+ assert3(this.red, "redMul works only with red numbers");
2726
2560
  this.red._verify2(this, num);
2727
2561
  return this.red.mul(this, num);
2728
2562
  };
2729
2563
  BN2.prototype.redIMul = function redIMul(num) {
2730
- assert4(this.red, "redMul works only with red numbers");
2564
+ assert3(this.red, "redMul works only with red numbers");
2731
2565
  this.red._verify2(this, num);
2732
2566
  return this.red.imul(this, num);
2733
2567
  };
2734
2568
  BN2.prototype.redSqr = function redSqr() {
2735
- assert4(this.red, "redSqr works only with red numbers");
2569
+ assert3(this.red, "redSqr works only with red numbers");
2736
2570
  this.red._verify1(this);
2737
2571
  return this.red.sqr(this);
2738
2572
  };
2739
2573
  BN2.prototype.redISqr = function redISqr() {
2740
- assert4(this.red, "redISqr works only with red numbers");
2574
+ assert3(this.red, "redISqr works only with red numbers");
2741
2575
  this.red._verify1(this);
2742
2576
  return this.red.isqr(this);
2743
2577
  };
2744
2578
  BN2.prototype.redSqrt = function redSqrt() {
2745
- assert4(this.red, "redSqrt works only with red numbers");
2579
+ assert3(this.red, "redSqrt works only with red numbers");
2746
2580
  this.red._verify1(this);
2747
2581
  return this.red.sqrt(this);
2748
2582
  };
2749
2583
  BN2.prototype.redInvm = function redInvm() {
2750
- assert4(this.red, "redInvm works only with red numbers");
2584
+ assert3(this.red, "redInvm works only with red numbers");
2751
2585
  this.red._verify1(this);
2752
2586
  return this.red.invm(this);
2753
2587
  };
2754
2588
  BN2.prototype.redNeg = function redNeg() {
2755
- assert4(this.red, "redNeg works only with red numbers");
2589
+ assert3(this.red, "redNeg works only with red numbers");
2756
2590
  this.red._verify1(this);
2757
2591
  return this.red.neg(this);
2758
2592
  };
2759
2593
  BN2.prototype.redPow = function redPow(num) {
2760
- assert4(this.red && !num.red, "redPow(normalNum)");
2594
+ assert3(this.red && !num.red, "redPow(normalNum)");
2761
2595
  this.red._verify1(this);
2762
2596
  return this.red.pow(this, num);
2763
2597
  };
@@ -2817,20 +2651,20 @@
2817
2651
  );
2818
2652
  }
2819
2653
  inherits(K256, MPrime);
2820
- K256.prototype.split = function split2(input, output3) {
2654
+ K256.prototype.split = function split2(input, output2) {
2821
2655
  var mask2 = 4194303;
2822
2656
  var outLen = Math.min(input.length, 9);
2823
2657
  for (var i = 0; i < outLen; i++) {
2824
- output3.words[i] = input.words[i];
2658
+ output2.words[i] = input.words[i];
2825
2659
  }
2826
- output3.length = outLen;
2660
+ output2.length = outLen;
2827
2661
  if (input.length <= 9) {
2828
2662
  input.words[0] = 0;
2829
2663
  input.length = 1;
2830
2664
  return;
2831
2665
  }
2832
2666
  var prev = input.words[9];
2833
- output3.words[output3.length++] = prev & mask2;
2667
+ output2.words[output2.length++] = prev & mask2;
2834
2668
  for (i = 10; i < input.length; i++) {
2835
2669
  var next = input.words[i] | 0;
2836
2670
  input.words[i - 10] = (next & mask2) << 4 | prev >>> 22;
@@ -2925,18 +2759,18 @@
2925
2759
  this.m = prime.p;
2926
2760
  this.prime = prime;
2927
2761
  } else {
2928
- assert4(m.gtn(1), "modulus must be greater than 1");
2762
+ assert3(m.gtn(1), "modulus must be greater than 1");
2929
2763
  this.m = m;
2930
2764
  this.prime = null;
2931
2765
  }
2932
2766
  }
2933
2767
  Red.prototype._verify1 = function _verify1(a) {
2934
- assert4(a.negative === 0, "red works only with positives");
2935
- assert4(a.red, "red works only with red numbers");
2768
+ assert3(a.negative === 0, "red works only with positives");
2769
+ assert3(a.red, "red works only with red numbers");
2936
2770
  };
2937
2771
  Red.prototype._verify2 = function _verify2(a, b) {
2938
- assert4((a.negative | b.negative) === 0, "red works only with positives");
2939
- assert4(
2772
+ assert3((a.negative | b.negative) === 0, "red works only with positives");
2773
+ assert3(
2940
2774
  a.red && a.red === b.red,
2941
2775
  "red works only with red numbers"
2942
2776
  );
@@ -3007,7 +2841,7 @@
3007
2841
  if (a.isZero())
3008
2842
  return a.clone();
3009
2843
  var mod3 = this.m.andln(3);
3010
- assert4(mod3 % 2 === 1);
2844
+ assert3(mod3 % 2 === 1);
3011
2845
  if (mod3 === 3) {
3012
2846
  var pow3 = this.m.add(new BN2(1)).iushrn(2);
3013
2847
  return this.pow(a, pow3);
@@ -3018,7 +2852,7 @@
3018
2852
  s++;
3019
2853
  q.iushrn(1);
3020
2854
  }
3021
- assert4(!q.isZero());
2855
+ assert3(!q.isZero());
3022
2856
  var one = new BN2(1).toRed(this);
3023
2857
  var nOne = one.redNeg();
3024
2858
  var lpow = this.m.subn(1).iushrn(1);
@@ -3036,7 +2870,7 @@
3036
2870
  for (var i = 0; tmp.cmp(one) !== 0; i++) {
3037
2871
  tmp = tmp.redSqr();
3038
2872
  }
3039
- assert4(i < m);
2873
+ assert3(i < m);
3040
2874
  var b = this.pow(c, new BN2(1).iushln(m - i - 1));
3041
2875
  r = r.redMul(b);
3042
2876
  c = b.redSqr();
@@ -3170,6 +3004,172 @@
3170
3004
  }
3171
3005
  });
3172
3006
 
3007
+ // ../../node_modules/.pnpm/bech32@2.0.0/node_modules/bech32/dist/index.js
3008
+ var require_dist = __commonJS({
3009
+ "../../node_modules/.pnpm/bech32@2.0.0/node_modules/bech32/dist/index.js"(exports) {
3010
+ "use strict";
3011
+ Object.defineProperty(exports, "__esModule", { value: true });
3012
+ exports.bech32m = exports.bech32 = void 0;
3013
+ var ALPHABET = "qpzry9x8gf2tvdw0s3jn54khce6mua7l";
3014
+ var ALPHABET_MAP = {};
3015
+ for (let z = 0; z < ALPHABET.length; z++) {
3016
+ const x = ALPHABET.charAt(z);
3017
+ ALPHABET_MAP[x] = z;
3018
+ }
3019
+ function polymodStep(pre) {
3020
+ const b = pre >> 25;
3021
+ return (pre & 33554431) << 5 ^ -(b >> 0 & 1) & 996825010 ^ -(b >> 1 & 1) & 642813549 ^ -(b >> 2 & 1) & 513874426 ^ -(b >> 3 & 1) & 1027748829 ^ -(b >> 4 & 1) & 705979059;
3022
+ }
3023
+ function prefixChk(prefix) {
3024
+ let chk = 1;
3025
+ for (let i = 0; i < prefix.length; ++i) {
3026
+ const c = prefix.charCodeAt(i);
3027
+ if (c < 33 || c > 126)
3028
+ return "Invalid prefix (" + prefix + ")";
3029
+ chk = polymodStep(chk) ^ c >> 5;
3030
+ }
3031
+ chk = polymodStep(chk);
3032
+ for (let i = 0; i < prefix.length; ++i) {
3033
+ const v = prefix.charCodeAt(i);
3034
+ chk = polymodStep(chk) ^ v & 31;
3035
+ }
3036
+ return chk;
3037
+ }
3038
+ function convert2(data, inBits, outBits, pad3) {
3039
+ let value = 0;
3040
+ let bits = 0;
3041
+ const maxV = (1 << outBits) - 1;
3042
+ const result = [];
3043
+ for (let i = 0; i < data.length; ++i) {
3044
+ value = value << inBits | data[i];
3045
+ bits += inBits;
3046
+ while (bits >= outBits) {
3047
+ bits -= outBits;
3048
+ result.push(value >> bits & maxV);
3049
+ }
3050
+ }
3051
+ if (pad3) {
3052
+ if (bits > 0) {
3053
+ result.push(value << outBits - bits & maxV);
3054
+ }
3055
+ } else {
3056
+ if (bits >= inBits)
3057
+ return "Excess padding";
3058
+ if (value << outBits - bits & maxV)
3059
+ return "Non-zero padding";
3060
+ }
3061
+ return result;
3062
+ }
3063
+ function toWords(bytes2) {
3064
+ return convert2(bytes2, 8, 5, true);
3065
+ }
3066
+ function fromWordsUnsafe(words) {
3067
+ const res = convert2(words, 5, 8, false);
3068
+ if (Array.isArray(res))
3069
+ return res;
3070
+ }
3071
+ function fromWords(words) {
3072
+ const res = convert2(words, 5, 8, false);
3073
+ if (Array.isArray(res))
3074
+ return res;
3075
+ throw new Error(res);
3076
+ }
3077
+ function getLibraryFromEncoding(encoding) {
3078
+ let ENCODING_CONST;
3079
+ if (encoding === "bech32") {
3080
+ ENCODING_CONST = 1;
3081
+ } else {
3082
+ ENCODING_CONST = 734539939;
3083
+ }
3084
+ function encode(prefix, words, LIMIT) {
3085
+ LIMIT = LIMIT || 90;
3086
+ if (prefix.length + 7 + words.length > LIMIT)
3087
+ throw new TypeError("Exceeds length limit");
3088
+ prefix = prefix.toLowerCase();
3089
+ let chk = prefixChk(prefix);
3090
+ if (typeof chk === "string")
3091
+ throw new Error(chk);
3092
+ let result = prefix + "1";
3093
+ for (let i = 0; i < words.length; ++i) {
3094
+ const x = words[i];
3095
+ if (x >> 5 !== 0)
3096
+ throw new Error("Non 5-bit word");
3097
+ chk = polymodStep(chk) ^ x;
3098
+ result += ALPHABET.charAt(x);
3099
+ }
3100
+ for (let i = 0; i < 6; ++i) {
3101
+ chk = polymodStep(chk);
3102
+ }
3103
+ chk ^= ENCODING_CONST;
3104
+ for (let i = 0; i < 6; ++i) {
3105
+ const v = chk >> (5 - i) * 5 & 31;
3106
+ result += ALPHABET.charAt(v);
3107
+ }
3108
+ return result;
3109
+ }
3110
+ function __decode(str, LIMIT) {
3111
+ LIMIT = LIMIT || 90;
3112
+ if (str.length < 8)
3113
+ return str + " too short";
3114
+ if (str.length > LIMIT)
3115
+ return "Exceeds length limit";
3116
+ const lowered = str.toLowerCase();
3117
+ const uppered = str.toUpperCase();
3118
+ if (str !== lowered && str !== uppered)
3119
+ return "Mixed-case string " + str;
3120
+ str = lowered;
3121
+ const split2 = str.lastIndexOf("1");
3122
+ if (split2 === -1)
3123
+ return "No separator character for " + str;
3124
+ if (split2 === 0)
3125
+ return "Missing prefix for " + str;
3126
+ const prefix = str.slice(0, split2);
3127
+ const wordChars = str.slice(split2 + 1);
3128
+ if (wordChars.length < 6)
3129
+ return "Data too short";
3130
+ let chk = prefixChk(prefix);
3131
+ if (typeof chk === "string")
3132
+ return chk;
3133
+ const words = [];
3134
+ for (let i = 0; i < wordChars.length; ++i) {
3135
+ const c = wordChars.charAt(i);
3136
+ const v = ALPHABET_MAP[c];
3137
+ if (v === void 0)
3138
+ return "Unknown character " + c;
3139
+ chk = polymodStep(chk) ^ v;
3140
+ if (i + 6 >= wordChars.length)
3141
+ continue;
3142
+ words.push(v);
3143
+ }
3144
+ if (chk !== ENCODING_CONST)
3145
+ return "Invalid checksum for " + str;
3146
+ return { prefix, words };
3147
+ }
3148
+ function decodeUnsafe(str, LIMIT) {
3149
+ const res = __decode(str, LIMIT);
3150
+ if (typeof res === "object")
3151
+ return res;
3152
+ }
3153
+ function decode(str, LIMIT) {
3154
+ const res = __decode(str, LIMIT);
3155
+ if (typeof res === "object")
3156
+ return res;
3157
+ throw new Error(res);
3158
+ }
3159
+ return {
3160
+ decodeUnsafe,
3161
+ decode,
3162
+ encode,
3163
+ toWords,
3164
+ fromWordsUnsafe,
3165
+ fromWords
3166
+ };
3167
+ }
3168
+ exports.bech32 = getLibraryFromEncoding("bech32");
3169
+ exports.bech32m = getLibraryFromEncoding("bech32m");
3170
+ }
3171
+ });
3172
+
3173
3173
  // ../../node_modules/.pnpm/webidl-conversions@3.0.1/node_modules/webidl-conversions/lib/index.js
3174
3174
  var require_lib = __commonJS({
3175
3175
  "../../node_modules/.pnpm/webidl-conversions@3.0.1/node_modules/webidl-conversions/lib/index.js"(exports, module) {
@@ -3600,18 +3600,18 @@
3600
3600
  }
3601
3601
  function utf8PercentDecode(str) {
3602
3602
  const input = new Buffer(str);
3603
- const output3 = [];
3603
+ const output2 = [];
3604
3604
  for (let i = 0; i < input.length; ++i) {
3605
3605
  if (input[i] !== 37) {
3606
- output3.push(input[i]);
3606
+ output2.push(input[i]);
3607
3607
  } else if (input[i] === 37 && isASCIIHex(input[i + 1]) && isASCIIHex(input[i + 2])) {
3608
- output3.push(parseInt(input.slice(i + 1, i + 3).toString(), 16));
3608
+ output2.push(parseInt(input.slice(i + 1, i + 3).toString(), 16));
3609
3609
  i += 2;
3610
3610
  } else {
3611
- output3.push(input[i]);
3611
+ output2.push(input[i]);
3612
3612
  }
3613
3613
  }
3614
- return new Buffer(output3).toString();
3614
+ return new Buffer(output2).toString();
3615
3615
  }
3616
3616
  function isC0ControlPercentEncode(c) {
3617
3617
  return c <= 31 || c > 126;
@@ -3687,16 +3687,16 @@
3687
3687
  return ipv4;
3688
3688
  }
3689
3689
  function serializeIPv4(address) {
3690
- let output3 = "";
3690
+ let output2 = "";
3691
3691
  let n = address;
3692
3692
  for (let i = 1; i <= 4; ++i) {
3693
- output3 = String(n % 256) + output3;
3693
+ output2 = String(n % 256) + output2;
3694
3694
  if (i !== 4) {
3695
- output3 = "." + output3;
3695
+ output2 = "." + output2;
3696
3696
  }
3697
3697
  n = Math.floor(n / 256);
3698
3698
  }
3699
- return output3;
3699
+ return output2;
3700
3700
  }
3701
3701
  function parseIPv6(input) {
3702
3702
  const address = [0, 0, 0, 0, 0, 0, 0, 0];
@@ -3754,13 +3754,13 @@
3754
3754
  return failure;
3755
3755
  }
3756
3756
  while (isASCIIDigit(input[pointer])) {
3757
- const number3 = parseInt(at(input, pointer));
3757
+ const number2 = parseInt(at(input, pointer));
3758
3758
  if (ipv4Piece === null) {
3759
- ipv4Piece = number3;
3759
+ ipv4Piece = number2;
3760
3760
  } else if (ipv4Piece === 0) {
3761
3761
  return failure;
3762
3762
  } else {
3763
- ipv4Piece = ipv4Piece * 10 + number3;
3763
+ ipv4Piece = ipv4Piece * 10 + number2;
3764
3764
  }
3765
3765
  if (ipv4Piece > 255) {
3766
3766
  return failure;
@@ -3804,7 +3804,7 @@
3804
3804
  return address;
3805
3805
  }
3806
3806
  function serializeIPv6(address) {
3807
- let output3 = "";
3807
+ let output2 = "";
3808
3808
  const seqResult = findLongestZeroSequence(address);
3809
3809
  const compress = seqResult.idx;
3810
3810
  let ignore0 = false;
@@ -3816,16 +3816,16 @@
3816
3816
  }
3817
3817
  if (compress === pieceIndex) {
3818
3818
  const separator = pieceIndex === 0 ? "::" : ":";
3819
- output3 += separator;
3819
+ output2 += separator;
3820
3820
  ignore0 = true;
3821
3821
  continue;
3822
3822
  }
3823
- output3 += address[pieceIndex].toString(16);
3823
+ output2 += address[pieceIndex].toString(16);
3824
3824
  if (pieceIndex !== 7) {
3825
- output3 += ":";
3825
+ output2 += ":";
3826
3826
  }
3827
3827
  }
3828
- return output3;
3828
+ return output2;
3829
3829
  }
3830
3830
  function parseHost(input, isSpecialArg) {
3831
3831
  if (input[0] === "[") {
@@ -3855,12 +3855,12 @@
3855
3855
  if (containsForbiddenHostCodePointExcludingPercent(input)) {
3856
3856
  return failure;
3857
3857
  }
3858
- let output3 = "";
3858
+ let output2 = "";
3859
3859
  const decoded = punycode.ucs2.decode(input);
3860
3860
  for (let i = 0; i < decoded.length; ++i) {
3861
- output3 += percentEncodeChar(decoded[i], isC0ControlPercentEncode);
3861
+ output2 += percentEncodeChar(decoded[i], isC0ControlPercentEncode);
3862
3862
  }
3863
- return output3;
3863
+ return output2;
3864
3864
  }
3865
3865
  function findLongestZeroSequence(arr) {
3866
3866
  let maxIdx = null;
@@ -4485,37 +4485,37 @@
4485
4485
  return true;
4486
4486
  };
4487
4487
  function serializeURL(url, excludeFragment) {
4488
- let output3 = url.scheme + ":";
4488
+ let output2 = url.scheme + ":";
4489
4489
  if (url.host !== null) {
4490
- output3 += "//";
4490
+ output2 += "//";
4491
4491
  if (url.username !== "" || url.password !== "") {
4492
- output3 += url.username;
4492
+ output2 += url.username;
4493
4493
  if (url.password !== "") {
4494
- output3 += ":" + url.password;
4494
+ output2 += ":" + url.password;
4495
4495
  }
4496
- output3 += "@";
4496
+ output2 += "@";
4497
4497
  }
4498
- output3 += serializeHost(url.host);
4498
+ output2 += serializeHost(url.host);
4499
4499
  if (url.port !== null) {
4500
- output3 += ":" + url.port;
4500
+ output2 += ":" + url.port;
4501
4501
  }
4502
4502
  } else if (url.host === null && url.scheme === "file") {
4503
- output3 += "//";
4503
+ output2 += "//";
4504
4504
  }
4505
4505
  if (url.cannotBeABaseURL) {
4506
- output3 += url.path[0];
4506
+ output2 += url.path[0];
4507
4507
  } else {
4508
4508
  for (const string of url.path) {
4509
- output3 += "/" + string;
4509
+ output2 += "/" + string;
4510
4510
  }
4511
4511
  }
4512
4512
  if (url.query !== null) {
4513
- output3 += "?" + url.query;
4513
+ output2 += "?" + url.query;
4514
4514
  }
4515
4515
  if (!excludeFragment && url.fragment !== null) {
4516
- output3 += "#" + url.fragment;
4516
+ output2 += "#" + url.fragment;
4517
4517
  }
4518
- return output3;
4518
+ return output2;
4519
4519
  }
4520
4520
  function serializeOrigin(tuple) {
4521
4521
  let result = tuple.scheme + "://";
@@ -6459,19 +6459,19 @@
6459
6459
  return "GraphQLError";
6460
6460
  }
6461
6461
  toString() {
6462
- let output3 = this.message;
6462
+ let output2 = this.message;
6463
6463
  if (this.nodes) {
6464
6464
  for (const node of this.nodes) {
6465
6465
  if (node.loc) {
6466
- output3 += "\n\n" + (0, _printLocation.printLocation)(node.loc);
6466
+ output2 += "\n\n" + (0, _printLocation.printLocation)(node.loc);
6467
6467
  }
6468
6468
  }
6469
6469
  } else if (this.source && this.locations) {
6470
6470
  for (const location of this.locations) {
6471
- output3 += "\n\n" + (0, _printLocation.printSourceLocation)(this.source, location);
6471
+ output2 += "\n\n" + (0, _printLocation.printSourceLocation)(this.source, location);
6472
6472
  }
6473
6473
  }
6474
- return output3;
6474
+ return output2;
6475
6475
  }
6476
6476
  toJSON() {
6477
6477
  const formattedError = {
@@ -18786,7 +18786,7 @@ spurious results.`);
18786
18786
  module.exports = iterate;
18787
18787
  function iterate(list, iterator, state, callback) {
18788
18788
  var key = state["keyedList"] ? state["keyedList"][state.index] : state.index;
18789
- state.jobs[key] = runJob(iterator, key, list[key], function(error, output3) {
18789
+ state.jobs[key] = runJob(iterator, key, list[key], function(error, output2) {
18790
18790
  if (!(key in state.jobs)) {
18791
18791
  return;
18792
18792
  }
@@ -18794,7 +18794,7 @@ spurious results.`);
18794
18794
  if (error) {
18795
18795
  abort(state);
18796
18796
  } else {
18797
- state.results[key] = output3;
18797
+ state.results[key] = output2;
18798
18798
  }
18799
18799
  callback(error, state.results);
18800
18800
  });
@@ -20556,8 +20556,8 @@ spurious results.`);
20556
20556
  const ret3 = wasm$1.retd(addr, len);
20557
20557
  return Instruction.__wrap(ret3);
20558
20558
  }
20559
- function aloc(bytes3) {
20560
- const ret3 = wasm$1.aloc(bytes3);
20559
+ function aloc(bytes2) {
20560
+ const ret3 = wasm$1.aloc(bytes2);
20561
20561
  return Instruction.__wrap(ret3);
20562
20562
  }
20563
20563
  function mcl(dst_addr, len) {
@@ -21771,9 +21771,9 @@ spurious results.`);
21771
21771
  * Construct the instruction from its parts.
21772
21772
  * @param {RegId} bytes
21773
21773
  */
21774
- constructor(bytes3) {
21775
- _assertClass(bytes3, RegId);
21776
- var ptr0 = bytes3.__destroy_into_raw();
21774
+ constructor(bytes2) {
21775
+ _assertClass(bytes2, RegId);
21776
+ var ptr0 = bytes2.__destroy_into_raw();
21777
21777
  const ret3 = wasm$1.aloc_new_typescript(ptr0);
21778
21778
  this.__wbg_ptr = ret3 >>> 0;
21779
21779
  return this;
@@ -28310,8 +28310,8 @@ spurious results.`);
28310
28310
  }
28311
28311
  }
28312
28312
  }
28313
- const bytes3 = await module2.arrayBuffer();
28314
- return await WebAssembly.instantiate(bytes3, imports);
28313
+ const bytes2 = await module2.arrayBuffer();
28314
+ return await WebAssembly.instantiate(bytes2, imports);
28315
28315
  } else {
28316
28316
  const instance = await WebAssembly.instantiate(module2, imports);
28317
28317
  if (instance instanceof WebAssembly.Instance) {
@@ -28652,11 +28652,11 @@ spurious results.`);
28652
28652
  if (lengths.length > 0 && !lengths.includes(b.length))
28653
28653
  throw new Error(`Expected Uint8Array of length ${lengths}, not of length=${b.length}`);
28654
28654
  }
28655
- function hash(hash4) {
28656
- if (typeof hash4 !== "function" || typeof hash4.create !== "function")
28655
+ function hash(hash3) {
28656
+ if (typeof hash3 !== "function" || typeof hash3.create !== "function")
28657
28657
  throw new Error("Hash should be wrapped by utils.wrapConstructor");
28658
- number(hash4.outputLen);
28659
- number(hash4.blockLen);
28658
+ number(hash3.outputLen);
28659
+ number(hash3.blockLen);
28660
28660
  }
28661
28661
  function exists(instance, checkFinished = true) {
28662
28662
  if (instance.destroyed)
@@ -28751,25 +28751,25 @@ spurious results.`);
28751
28751
  }
28752
28752
 
28753
28753
  // ../../node_modules/.pnpm/@noble+hashes@1.3.3/node_modules/@noble/hashes/esm/_sha2.js
28754
- function setBigUint64(view, byteOffset, value, isLE3) {
28754
+ function setBigUint64(view, byteOffset, value, isLE2) {
28755
28755
  if (typeof view.setBigUint64 === "function")
28756
- return view.setBigUint64(byteOffset, value, isLE3);
28756
+ return view.setBigUint64(byteOffset, value, isLE2);
28757
28757
  const _32n2 = BigInt(32);
28758
28758
  const _u32_max = BigInt(4294967295);
28759
28759
  const wh = Number(value >> _32n2 & _u32_max);
28760
28760
  const wl = Number(value & _u32_max);
28761
- const h = isLE3 ? 4 : 0;
28762
- const l = isLE3 ? 0 : 4;
28763
- view.setUint32(byteOffset + h, wh, isLE3);
28764
- view.setUint32(byteOffset + l, wl, isLE3);
28761
+ const h = isLE2 ? 4 : 0;
28762
+ const l = isLE2 ? 0 : 4;
28763
+ view.setUint32(byteOffset + h, wh, isLE2);
28764
+ view.setUint32(byteOffset + l, wl, isLE2);
28765
28765
  }
28766
28766
  var SHA2 = class extends Hash {
28767
- constructor(blockLen, outputLen, padOffset, isLE3) {
28767
+ constructor(blockLen, outputLen, padOffset, isLE2) {
28768
28768
  super();
28769
28769
  this.blockLen = blockLen;
28770
28770
  this.outputLen = outputLen;
28771
28771
  this.padOffset = padOffset;
28772
- this.isLE = isLE3;
28772
+ this.isLE = isLE2;
28773
28773
  this.finished = false;
28774
28774
  this.length = 0;
28775
28775
  this.pos = 0;
@@ -28806,7 +28806,7 @@ spurious results.`);
28806
28806
  exists(this);
28807
28807
  output(out, this);
28808
28808
  this.finished = true;
28809
- const { buffer, view, blockLen, isLE: isLE3 } = this;
28809
+ const { buffer, view, blockLen, isLE: isLE2 } = this;
28810
28810
  let { pos } = this;
28811
28811
  buffer[pos++] = 128;
28812
28812
  this.buffer.subarray(pos).fill(0);
@@ -28816,7 +28816,7 @@ spurious results.`);
28816
28816
  }
28817
28817
  for (let i = pos; i < blockLen; i++)
28818
28818
  buffer[i] = 0;
28819
- setBigUint64(view, blockLen - 8, BigInt(this.length * 8), isLE3);
28819
+ setBigUint64(view, blockLen - 8, BigInt(this.length * 8), isLE2);
28820
28820
  this.process(view, 0);
28821
28821
  const oview = createView(out);
28822
28822
  const len = this.outputLen;
@@ -28827,7 +28827,7 @@ spurious results.`);
28827
28827
  if (outLen > state.length)
28828
28828
  throw new Error("_sha2: outputLen bigger than state");
28829
28829
  for (let i = 0; i < outLen; i++)
28830
- oview.setUint32(4 * i, state[i], isLE3);
28830
+ oview.setUint32(4 * i, state[i], isLE2);
28831
28831
  }
28832
28832
  digest() {
28833
28833
  const { buffer, outputLen } = this;
@@ -29004,24 +29004,24 @@ spurious results.`);
29004
29004
 
29005
29005
  // ../../node_modules/.pnpm/@noble+hashes@1.3.3/node_modules/@noble/hashes/esm/hmac.js
29006
29006
  var HMAC = class extends Hash {
29007
- constructor(hash4, _key) {
29007
+ constructor(hash3, _key) {
29008
29008
  super();
29009
29009
  this.finished = false;
29010
29010
  this.destroyed = false;
29011
- hash(hash4);
29011
+ hash(hash3);
29012
29012
  const key = toBytes(_key);
29013
- this.iHash = hash4.create();
29013
+ this.iHash = hash3.create();
29014
29014
  if (typeof this.iHash.update !== "function")
29015
29015
  throw new Error("Expected instance of class which extends utils.Hash");
29016
29016
  this.blockLen = this.iHash.blockLen;
29017
29017
  this.outputLen = this.iHash.outputLen;
29018
29018
  const blockLen = this.blockLen;
29019
29019
  const pad3 = new Uint8Array(blockLen);
29020
- pad3.set(key.length > blockLen ? hash4.create().update(key).digest() : key);
29020
+ pad3.set(key.length > blockLen ? hash3.create().update(key).digest() : key);
29021
29021
  for (let i = 0; i < pad3.length; i++)
29022
29022
  pad3[i] ^= 54;
29023
29023
  this.iHash.update(pad3);
29024
- this.oHash = hash4.create();
29024
+ this.oHash = hash3.create();
29025
29025
  for (let i = 0; i < pad3.length; i++)
29026
29026
  pad3[i] ^= 54 ^ 92;
29027
29027
  this.oHash.update(pad3);
@@ -29064,12 +29064,12 @@ spurious results.`);
29064
29064
  this.iHash.destroy();
29065
29065
  }
29066
29066
  };
29067
- var hmac = (hash4, key, message) => new HMAC(hash4, key).update(message).digest();
29068
- hmac.create = (hash4, key) => new HMAC(hash4, key);
29067
+ var hmac = (hash3, key, message) => new HMAC(hash3, key).update(message).digest();
29068
+ hmac.create = (hash3, key) => new HMAC(hash3, key);
29069
29069
 
29070
29070
  // ../../node_modules/.pnpm/@noble+hashes@1.3.3/node_modules/@noble/hashes/esm/pbkdf2.js
29071
- function pbkdf2Init(hash4, _password, _salt, _opts) {
29072
- hash(hash4);
29071
+ function pbkdf2Init(hash3, _password, _salt, _opts) {
29072
+ hash(hash3);
29073
29073
  const opts = checkOpts({ dkLen: 32, asyncTick: 10 }, _opts);
29074
29074
  const { c, dkLen, asyncTick } = opts;
29075
29075
  number(c);
@@ -29080,7 +29080,7 @@ spurious results.`);
29080
29080
  const password = toBytes(_password);
29081
29081
  const salt = toBytes(_salt);
29082
29082
  const DK = new Uint8Array(dkLen);
29083
- const PRF = hmac.create(hash4, password);
29083
+ const PRF = hmac.create(hash3, password);
29084
29084
  const PRFSalt = PRF._cloneInto().update(salt);
29085
29085
  return { c, dkLen, asyncTick, DK, PRF, PRFSalt };
29086
29086
  }
@@ -29092,8 +29092,8 @@ spurious results.`);
29092
29092
  u.fill(0);
29093
29093
  return DK;
29094
29094
  }
29095
- function pbkdf2(hash4, password, salt, opts) {
29096
- const { c, dkLen, DK, PRF, PRFSalt } = pbkdf2Init(hash4, password, salt, opts);
29095
+ function pbkdf2(hash3, password, salt, opts) {
29096
+ const { c, dkLen, DK, PRF, PRFSalt } = pbkdf2Init(hash3, password, salt, opts);
29097
29097
  let prfW;
29098
29098
  const arr = new Uint8Array(4);
29099
29099
  const view = createView(arr);
@@ -29420,9 +29420,9 @@ spurious results.`);
29420
29420
  throw new Error("XOF is not possible for this instance");
29421
29421
  return this.writeInto(out);
29422
29422
  }
29423
- xof(bytes3) {
29424
- number(bytes3);
29425
- return this.xofInto(new Uint8Array(bytes3));
29423
+ xof(bytes2) {
29424
+ number(bytes2);
29425
+ return this.xofInto(new Uint8Array(bytes2));
29426
29426
  }
29427
29427
  digestInto(out) {
29428
29428
  output(out, this);
@@ -29558,7 +29558,6 @@ This unreleased fuel-core build may include features and updates not yet support
29558
29558
  ErrorCode2["PARSE_FAILED"] = "parse-failed";
29559
29559
  ErrorCode2["ENCODE_ERROR"] = "encode-error";
29560
29560
  ErrorCode2["DECODE_ERROR"] = "decode-error";
29561
- ErrorCode2["INVALID_CREDENTIALS"] = "invalid-credentials";
29562
29561
  ErrorCode2["ENV_DEPENDENCY_MISSING"] = "env-dependency-missing";
29563
29562
  ErrorCode2["INVALID_TTL"] = "invalid-ttl";
29564
29563
  ErrorCode2["INVALID_INPUT_PARAMETERS"] = "invalid-input-parameters";
@@ -29569,6 +29568,8 @@ This unreleased fuel-core build may include features and updates not yet support
29569
29568
  ErrorCode2["MISSING_REQUIRED_PARAMETER"] = "missing-required-parameter";
29570
29569
  ErrorCode2["INVALID_REQUEST"] = "invalid-request";
29571
29570
  ErrorCode2["INVALID_TRANSFER_AMOUNT"] = "invalid-transfer-amount";
29571
+ ErrorCode2["INVALID_CREDENTIALS"] = "invalid-credentials";
29572
+ ErrorCode2["HASHER_LOCKED"] = "hasher-locked";
29572
29573
  ErrorCode2["GAS_PRICE_TOO_LOW"] = "gas-price-too-low";
29573
29574
  ErrorCode2["GAS_LIMIT_TOO_LOW"] = "gas-limit-too-low";
29574
29575
  ErrorCode2["MAX_FEE_TOO_LOW"] = "max-fee-too-low";
@@ -29636,6 +29637,226 @@ This unreleased fuel-core build may include features and updates not yet support
29636
29637
  var FuelError = _FuelError;
29637
29638
  __publicField2(FuelError, "CODES", ErrorCode);
29638
29639
 
29640
+ // ../math/dist/index.mjs
29641
+ var import_bn = __toESM(require_bn(), 1);
29642
+ var DEFAULT_PRECISION = 9;
29643
+ var DEFAULT_MIN_PRECISION = 3;
29644
+ var DEFAULT_DECIMAL_UNITS = 9;
29645
+ function toFixed(value, options) {
29646
+ const { precision = DEFAULT_PRECISION, minPrecision = DEFAULT_MIN_PRECISION } = options || {};
29647
+ const [valueUnits = "0", valueDecimals = "0"] = String(value || "0.0").split(".");
29648
+ const groupRegex = /(\d)(?=(\d{3})+\b)/g;
29649
+ const units = valueUnits.replace(groupRegex, "$1,");
29650
+ let decimals = valueDecimals.slice(0, precision);
29651
+ if (minPrecision < precision) {
29652
+ const trimmedDecimal = decimals.match(/.*[1-9]{1}/);
29653
+ const lastNonZeroIndex = trimmedDecimal?.[0].length || 0;
29654
+ const keepChars = Math.max(minPrecision, lastNonZeroIndex);
29655
+ decimals = decimals.slice(0, keepChars);
29656
+ }
29657
+ const decimalPortion = decimals ? `.${decimals}` : "";
29658
+ return `${units}${decimalPortion}`;
29659
+ }
29660
+ var BN = class extends import_bn.default {
29661
+ MAX_U64 = "0xFFFFFFFFFFFFFFFF";
29662
+ constructor(value, base, endian) {
29663
+ let bnValue = value;
29664
+ let bnBase = base;
29665
+ if (BN.isBN(value)) {
29666
+ bnValue = value.toArray();
29667
+ } else if (typeof value === "string" && value.slice(0, 2) === "0x") {
29668
+ bnValue = value.substring(2);
29669
+ bnBase = base || "hex";
29670
+ }
29671
+ super(bnValue == null ? 0 : bnValue, bnBase, endian);
29672
+ }
29673
+ // ANCHOR: HELPERS
29674
+ // make sure we always include `0x` in hex strings
29675
+ toString(base, length) {
29676
+ const output2 = super.toString(base, length);
29677
+ if (base === 16 || base === "hex") {
29678
+ return `0x${output2}`;
29679
+ }
29680
+ return output2;
29681
+ }
29682
+ toHex(bytesPadding) {
29683
+ const bytes2 = bytesPadding || 0;
29684
+ const bytesLength = bytes2 * 2;
29685
+ if (this.isNeg()) {
29686
+ throw new FuelError(ErrorCode.CONVERTING_FAILED, "Cannot convert negative value to hex.");
29687
+ }
29688
+ if (bytesPadding && this.byteLength() > bytesPadding) {
29689
+ throw new FuelError(
29690
+ ErrorCode.CONVERTING_FAILED,
29691
+ `Provided value ${this} is too large. It should fit within ${bytesPadding} bytes.`
29692
+ );
29693
+ }
29694
+ return this.toString(16, bytesLength);
29695
+ }
29696
+ toBytes(bytesPadding) {
29697
+ if (this.isNeg()) {
29698
+ throw new FuelError(ErrorCode.CONVERTING_FAILED, "Cannot convert negative value to bytes.");
29699
+ }
29700
+ return Uint8Array.from(this.toArray(void 0, bytesPadding));
29701
+ }
29702
+ toJSON() {
29703
+ return this.toString(16);
29704
+ }
29705
+ valueOf() {
29706
+ return this.toString();
29707
+ }
29708
+ format(options) {
29709
+ const {
29710
+ units = DEFAULT_DECIMAL_UNITS,
29711
+ precision = DEFAULT_PRECISION,
29712
+ minPrecision = DEFAULT_MIN_PRECISION
29713
+ } = options || {};
29714
+ const formattedUnits = this.formatUnits(units);
29715
+ const formattedFixed = toFixed(formattedUnits, { precision, minPrecision });
29716
+ if (!parseFloat(formattedFixed)) {
29717
+ const [, originalDecimals = "0"] = formattedUnits.split(".");
29718
+ const firstNonZero = originalDecimals.match(/[1-9]/);
29719
+ if (firstNonZero && firstNonZero.index && firstNonZero.index + 1 > precision) {
29720
+ const [valueUnits = "0"] = formattedFixed.split(".");
29721
+ return `${valueUnits}.${originalDecimals.slice(0, firstNonZero.index + 1)}`;
29722
+ }
29723
+ }
29724
+ return formattedFixed;
29725
+ }
29726
+ formatUnits(units = DEFAULT_DECIMAL_UNITS) {
29727
+ const valueUnits = this.toString().slice(0, units * -1);
29728
+ const valueDecimals = this.toString().slice(units * -1);
29729
+ const length = valueDecimals.length;
29730
+ const defaultDecimals = Array.from({ length: units - length }).fill("0").join("");
29731
+ const integerPortion = valueUnits ? `${valueUnits}.` : "0.";
29732
+ return `${integerPortion}${defaultDecimals}${valueDecimals}`;
29733
+ }
29734
+ // END ANCHOR: HELPERS
29735
+ // ANCHOR: OVERRIDES to accept better inputs
29736
+ add(v) {
29737
+ return this.caller(v, "add");
29738
+ }
29739
+ pow(v) {
29740
+ return this.caller(v, "pow");
29741
+ }
29742
+ sub(v) {
29743
+ return this.caller(v, "sub");
29744
+ }
29745
+ div(v) {
29746
+ return this.caller(v, "div");
29747
+ }
29748
+ mul(v) {
29749
+ return this.caller(v, "mul");
29750
+ }
29751
+ mod(v) {
29752
+ return this.caller(v, "mod");
29753
+ }
29754
+ divRound(v) {
29755
+ return this.caller(v, "divRound");
29756
+ }
29757
+ lt(v) {
29758
+ return this.caller(v, "lt");
29759
+ }
29760
+ lte(v) {
29761
+ return this.caller(v, "lte");
29762
+ }
29763
+ gt(v) {
29764
+ return this.caller(v, "gt");
29765
+ }
29766
+ gte(v) {
29767
+ return this.caller(v, "gte");
29768
+ }
29769
+ eq(v) {
29770
+ return this.caller(v, "eq");
29771
+ }
29772
+ cmp(v) {
29773
+ return this.caller(v, "cmp");
29774
+ }
29775
+ // END ANCHOR: OVERRIDES to accept better inputs
29776
+ // ANCHOR: OVERRIDES to output our BN type
29777
+ sqr() {
29778
+ return new BN(super.sqr().toArray());
29779
+ }
29780
+ neg() {
29781
+ return new BN(super.neg().toArray());
29782
+ }
29783
+ abs() {
29784
+ return new BN(super.abs().toArray());
29785
+ }
29786
+ toTwos(width) {
29787
+ return new BN(super.toTwos(width).toArray());
29788
+ }
29789
+ fromTwos(width) {
29790
+ return new BN(super.fromTwos(width).toArray());
29791
+ }
29792
+ // END ANCHOR: OVERRIDES to output our BN type
29793
+ // ANCHOR: OVERRIDES to avoid losing references
29794
+ caller(v, methodName) {
29795
+ const output2 = super[methodName](new BN(v));
29796
+ if (BN.isBN(output2)) {
29797
+ return new BN(output2.toArray());
29798
+ }
29799
+ if (typeof output2 === "boolean") {
29800
+ return output2;
29801
+ }
29802
+ return output2;
29803
+ }
29804
+ clone() {
29805
+ return new BN(this.toArray());
29806
+ }
29807
+ mulTo(num, out) {
29808
+ const output2 = new import_bn.default(this.toArray()).mulTo(num, out);
29809
+ return new BN(output2.toArray());
29810
+ }
29811
+ egcd(p) {
29812
+ const { a, b, gcd } = new import_bn.default(this.toArray()).egcd(p);
29813
+ return {
29814
+ a: new BN(a.toArray()),
29815
+ b: new BN(b.toArray()),
29816
+ gcd: new BN(gcd.toArray())
29817
+ };
29818
+ }
29819
+ divmod(num, mode, positive) {
29820
+ const { div, mod: mod2 } = new import_bn.default(this.toArray()).divmod(new BN(num), mode, positive);
29821
+ return {
29822
+ div: new BN(div?.toArray()),
29823
+ mod: new BN(mod2?.toArray())
29824
+ };
29825
+ }
29826
+ maxU64() {
29827
+ return this.gte(this.MAX_U64) ? new BN(this.MAX_U64) : this;
29828
+ }
29829
+ normalizeZeroToOne() {
29830
+ return this.isZero() ? new BN(1) : this;
29831
+ }
29832
+ // END ANCHOR: OVERRIDES to avoid losing references
29833
+ };
29834
+ var bn = (value, base, endian) => new BN(value, base, endian);
29835
+ bn.parseUnits = (value, units = DEFAULT_DECIMAL_UNITS) => {
29836
+ const valueToParse = value === "." ? "0." : value;
29837
+ const [valueUnits = "0", valueDecimals = "0"] = valueToParse.split(".");
29838
+ const length = valueDecimals.length;
29839
+ if (length > units) {
29840
+ throw new FuelError(
29841
+ ErrorCode.CONVERTING_FAILED,
29842
+ `Decimal can't have more than ${units} digits.`
29843
+ );
29844
+ }
29845
+ const decimals = Array.from({ length: units }).fill("0");
29846
+ decimals.splice(0, length, valueDecimals);
29847
+ const amount = `${valueUnits.replaceAll(",", "")}${decimals.join("")}`;
29848
+ return bn(amount);
29849
+ };
29850
+ function toNumber(value) {
29851
+ return bn(value).toNumber();
29852
+ }
29853
+ function toHex(value, bytesPadding) {
29854
+ return bn(value).toHex(bytesPadding);
29855
+ }
29856
+ function toBytes2(value, bytesPadding) {
29857
+ return bn(value).toBytes(bytesPadding);
29858
+ }
29859
+
29639
29860
  // ../utils/dist/index.mjs
29640
29861
  var __defProp3 = Object.defineProperty;
29641
29862
  var __defNormalProp3 = (obj, key, value) => key in obj ? __defProp3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
@@ -29643,23 +29864,26 @@ This unreleased fuel-core build may include features and updates not yet support
29643
29864
  __defNormalProp3(obj, typeof key !== "symbol" ? key + "" : key, value);
29644
29865
  return value;
29645
29866
  };
29646
- var chunkAndPadBytes = (bytes3, chunkSize) => {
29867
+ var chunkAndPadBytes = (bytes2, chunkSize) => {
29647
29868
  const chunks = [];
29648
- for (let offset = 0; offset < bytes3.length; offset += chunkSize) {
29869
+ for (let offset = 0; offset < bytes2.length; offset += chunkSize) {
29649
29870
  const chunk = new Uint8Array(chunkSize);
29650
- chunk.set(bytes3.slice(offset, offset + chunkSize));
29871
+ chunk.set(bytes2.slice(offset, offset + chunkSize));
29651
29872
  chunks.push(chunk);
29652
29873
  }
29653
29874
  const lastChunk = chunks[chunks.length - 1];
29654
- const remainingBytes = bytes3.length % chunkSize;
29875
+ const remainingBytes = bytes2.length % chunkSize;
29655
29876
  const paddedChunkLength = remainingBytes + (8 - remainingBytes % 8) % 8;
29656
29877
  const newChunk = lastChunk.slice(0, paddedChunkLength);
29657
29878
  chunks[chunks.length - 1] = newChunk;
29658
29879
  return chunks;
29659
29880
  };
29660
- var arrayify = (value) => {
29881
+ var arrayify = (value, name, copy = true) => {
29661
29882
  if (value instanceof Uint8Array) {
29662
- return new Uint8Array(value);
29883
+ if (copy) {
29884
+ return new Uint8Array(value);
29885
+ }
29886
+ return value;
29663
29887
  }
29664
29888
  if (typeof value === "string" && value.match(/^0x([0-9a-f][0-9a-f])*$/i)) {
29665
29889
  const result = new Uint8Array((value.length - 2) / 2);
@@ -29670,7 +29894,7 @@ This unreleased fuel-core build may include features and updates not yet support
29670
29894
  }
29671
29895
  return result;
29672
29896
  }
29673
- throw new FuelError(ErrorCode.PARSE_FAILED, "invalid BytesLike value");
29897
+ throw new FuelError(ErrorCode.INVALID_DATA, `invalid data - ${name || ""}`);
29674
29898
  };
29675
29899
  var concatBytes2 = (arrays) => {
29676
29900
  const byteArrays = arrays.map((array) => {
@@ -29688,15 +29912,15 @@ This unreleased fuel-core build may include features and updates not yet support
29688
29912
  return concatenated;
29689
29913
  };
29690
29914
  var concat = (arrays) => {
29691
- const bytes3 = arrays.map((v) => arrayify(v));
29692
- return concatBytes2(bytes3);
29915
+ const bytes2 = arrays.map((v) => arrayify(v));
29916
+ return concatBytes2(bytes2);
29693
29917
  };
29694
29918
  var HexCharacters = "0123456789abcdef";
29695
29919
  function hexlify(data) {
29696
- const bytes3 = arrayify(data);
29920
+ const bytes2 = arrayify(data);
29697
29921
  let result = "0x";
29698
- for (let i = 0; i < bytes3.length; i++) {
29699
- const v = bytes3[i];
29922
+ for (let i = 0; i < bytes2.length; i++) {
29923
+ const v = bytes2[i];
29700
29924
  result += HexCharacters[(v & 240) >> 4] + HexCharacters[v & 15];
29701
29925
  }
29702
29926
  return result;
@@ -29764,681 +29988,87 @@ This unreleased fuel-core build may include features and updates not yet support
29764
29988
  function isDefined(value) {
29765
29989
  return value !== void 0;
29766
29990
  }
29767
-
29768
- // ../crypto/dist/index.mjs
29769
- var import_crypto7 = __toESM(__require("crypto"), 1);
29770
-
29771
- // ../../node_modules/.pnpm/ethers@6.7.1/node_modules/ethers/lib.esm/_version.js
29772
- var version = "6.7.1";
29773
-
29774
- // ../../node_modules/.pnpm/ethers@6.7.1/node_modules/ethers/lib.esm/utils/properties.js
29775
- function checkType(value, type3, name) {
29776
- const types = type3.split("|").map((t) => t.trim());
29777
- for (let i = 0; i < types.length; i++) {
29778
- switch (type3) {
29779
- case "any":
29780
- return;
29781
- case "bigint":
29782
- case "boolean":
29783
- case "number":
29784
- case "string":
29785
- if (typeof value === type3) {
29786
- return;
29787
- }
29788
- }
29789
- }
29790
- const error = new Error(`invalid value for type ${type3}`);
29791
- error.code = "INVALID_ARGUMENT";
29792
- error.argument = `value.${name}`;
29793
- error.value = value;
29794
- throw error;
29795
- }
29796
- function defineProperties(target, values, types) {
29797
- for (let key in values) {
29798
- let value = values[key];
29799
- const type3 = types ? types[key] : null;
29800
- if (type3) {
29801
- checkType(value, type3, key);
29802
- }
29803
- Object.defineProperty(target, key, { enumerable: true, value, writable: false });
29804
- }
29805
- }
29806
-
29807
- // ../../node_modules/.pnpm/ethers@6.7.1/node_modules/ethers/lib.esm/utils/errors.js
29808
- function stringify(value) {
29809
- if (value == null) {
29810
- return "null";
29811
- }
29812
- if (Array.isArray(value)) {
29813
- return "[ " + value.map(stringify).join(", ") + " ]";
29814
- }
29815
- if (value instanceof Uint8Array) {
29816
- const HEX = "0123456789abcdef";
29817
- let result = "0x";
29818
- for (let i = 0; i < value.length; i++) {
29819
- result += HEX[value[i] >> 4];
29820
- result += HEX[value[i] & 15];
29821
- }
29822
- return result;
29823
- }
29824
- if (typeof value === "object" && typeof value.toJSON === "function") {
29825
- return stringify(value.toJSON());
29826
- }
29827
- switch (typeof value) {
29828
- case "boolean":
29829
- case "symbol":
29830
- return value.toString();
29831
- case "bigint":
29832
- return BigInt(value).toString();
29833
- case "number":
29834
- return value.toString();
29835
- case "string":
29836
- return JSON.stringify(value);
29837
- case "object": {
29838
- const keys = Object.keys(value);
29839
- keys.sort();
29840
- return "{ " + keys.map((k) => `${stringify(k)}: ${stringify(value[k])}`).join(", ") + " }";
29841
- }
29842
- }
29843
- return `[ COULD NOT SERIALIZE ]`;
29844
- }
29845
- function makeError(message, code, info) {
29846
- {
29847
- const details = [];
29848
- if (info) {
29849
- if ("message" in info || "code" in info || "name" in info) {
29850
- throw new Error(`value will overwrite populated values: ${stringify(info)}`);
29851
- }
29852
- for (const key in info) {
29853
- const value = info[key];
29854
- details.push(key + "=" + stringify(value));
29855
- }
29856
- }
29857
- details.push(`code=${code}`);
29858
- details.push(`version=${version}`);
29859
- if (details.length) {
29860
- message += " (" + details.join(", ") + ")";
29861
- }
29862
- }
29863
- let error;
29864
- switch (code) {
29865
- case "INVALID_ARGUMENT":
29866
- error = new TypeError(message);
29867
- break;
29868
- case "NUMERIC_FAULT":
29869
- case "BUFFER_OVERRUN":
29870
- error = new RangeError(message);
29871
- break;
29872
- default:
29873
- error = new Error(message);
29874
- }
29875
- defineProperties(error, { code });
29876
- if (info) {
29877
- Object.assign(error, info);
29878
- }
29879
- return error;
29880
- }
29881
- function assert(check, message, code, info) {
29882
- if (!check) {
29883
- throw makeError(message, code, info);
29884
- }
29885
- }
29886
- function assertArgument(check, message, name, value) {
29887
- assert(check, message, "INVALID_ARGUMENT", { argument: name, value });
29888
- }
29889
- var _normalizeForms = ["NFD", "NFC", "NFKD", "NFKC"].reduce((accum, form) => {
29890
- try {
29891
- if ("test".normalize(form) !== "test") {
29892
- throw new Error("bad");
29893
- }
29894
- ;
29895
- if (form === "NFD") {
29896
- const check = String.fromCharCode(233).normalize("NFD");
29897
- const expected = String.fromCharCode(101, 769);
29898
- if (check !== expected) {
29899
- throw new Error("broken");
29900
- }
29901
- }
29902
- accum.push(form);
29903
- } catch (error) {
29904
- }
29905
- return accum;
29906
- }, []);
29907
- function assertNormalize(form) {
29908
- assert(_normalizeForms.indexOf(form) >= 0, "platform missing String.prototype.normalize", "UNSUPPORTED_OPERATION", {
29909
- operation: "String.prototype.normalize",
29910
- info: { form }
29911
- });
29912
- }
29913
-
29914
- // ../../node_modules/.pnpm/ethers@6.7.1/node_modules/ethers/lib.esm/utils/data.js
29915
- function _getBytes(value, name, copy) {
29916
- if (value instanceof Uint8Array) {
29917
- if (copy) {
29918
- return new Uint8Array(value);
29919
- }
29920
- return value;
29921
- }
29922
- if (typeof value === "string" && value.match(/^0x([0-9a-f][0-9a-f])*$/i)) {
29923
- const result = new Uint8Array((value.length - 2) / 2);
29924
- let offset = 2;
29925
- for (let i = 0; i < result.length; i++) {
29926
- result[i] = parseInt(value.substring(offset, offset + 2), 16);
29927
- offset += 2;
29928
- }
29929
- return result;
29930
- }
29931
- assertArgument(false, "invalid BytesLike value", name || "value", value);
29932
- }
29933
- function getBytes(value, name) {
29934
- return _getBytes(value, name, false);
29935
- }
29936
- var HexCharacters2 = "0123456789abcdef";
29937
- function hexlify2(data) {
29938
- const bytes3 = getBytes(data);
29939
- let result = "0x";
29940
- for (let i = 0; i < bytes3.length; i++) {
29941
- const v = bytes3[i];
29942
- result += HexCharacters2[(v & 240) >> 4] + HexCharacters2[v & 15];
29943
- }
29944
- return result;
29945
- }
29946
- function dataSlice(data, start, end) {
29947
- const bytes3 = getBytes(data);
29948
- if (end != null && end > bytes3.length) {
29949
- assert(false, "cannot slice beyond data bounds", "BUFFER_OVERRUN", {
29950
- buffer: bytes3,
29951
- length: bytes3.length,
29952
- offset: end
29953
- });
29954
- }
29955
- return hexlify2(bytes3.slice(start == null ? 0 : start, end == null ? bytes3.length : end));
29956
- }
29957
-
29958
- // ../../node_modules/.pnpm/ethers@6.7.1/node_modules/ethers/lib.esm/utils/maths.js
29959
- var BN_0 = BigInt(0);
29960
- var BN_1 = BigInt(1);
29961
- var maxValue = 9007199254740991;
29962
- function getBigInt(value, name) {
29963
- switch (typeof value) {
29964
- case "bigint":
29965
- return value;
29966
- case "number":
29967
- assertArgument(Number.isInteger(value), "underflow", name || "value", value);
29968
- assertArgument(value >= -maxValue && value <= maxValue, "overflow", name || "value", value);
29969
- return BigInt(value);
29970
- case "string":
29971
- try {
29972
- if (value === "") {
29973
- throw new Error("empty string");
29974
- }
29975
- if (value[0] === "-" && value[1] !== "-") {
29976
- return -BigInt(value.substring(1));
29977
- }
29978
- return BigInt(value);
29979
- } catch (e) {
29980
- assertArgument(false, `invalid BigNumberish string: ${e.message}`, name || "value", value);
29981
- }
29982
- }
29983
- assertArgument(false, "invalid BigNumberish value", name || "value", value);
29984
- }
29985
- function getUint(value, name) {
29986
- const result = getBigInt(value, name);
29987
- assert(result >= BN_0, "unsigned value cannot be negative", "NUMERIC_FAULT", {
29988
- fault: "overflow",
29989
- operation: "getUint",
29990
- value
29991
- });
29992
- return result;
29993
- }
29994
- var Nibbles = "0123456789abcdef";
29995
- function toBigInt(value) {
29996
- if (value instanceof Uint8Array) {
29997
- let result = "0x0";
29998
- for (const v of value) {
29999
- result += Nibbles[v >> 4];
30000
- result += Nibbles[v & 15];
30001
- }
30002
- return BigInt(result);
30003
- }
30004
- return getBigInt(value);
30005
- }
30006
- function getNumber(value, name) {
30007
- switch (typeof value) {
30008
- case "bigint":
30009
- assertArgument(value >= -maxValue && value <= maxValue, "overflow", name || "value", value);
30010
- return Number(value);
30011
- case "number":
30012
- assertArgument(Number.isInteger(value), "underflow", name || "value", value);
30013
- assertArgument(value >= -maxValue && value <= maxValue, "overflow", name || "value", value);
30014
- return value;
30015
- case "string":
30016
- try {
30017
- if (value === "") {
30018
- throw new Error("empty string");
30019
- }
30020
- return getNumber(BigInt(value), name);
30021
- } catch (e) {
30022
- assertArgument(false, `invalid numeric string: ${e.message}`, name || "value", value);
30023
- }
30024
- }
30025
- assertArgument(false, "invalid numeric value", name || "value", value);
30026
- }
30027
- function toBeHex(_value, _width) {
30028
- const value = getUint(_value, "value");
30029
- let result = value.toString(16);
30030
- if (_width == null) {
30031
- if (result.length % 2) {
30032
- result = "0" + result;
30033
- }
30034
- } else {
30035
- const width = getNumber(_width, "width");
30036
- assert(width * 2 >= result.length, `value exceeds width (${width} bits)`, "NUMERIC_FAULT", {
30037
- operation: "toBeHex",
30038
- fault: "overflow",
30039
- value: _value
30040
- });
30041
- while (result.length < width * 2) {
30042
- result = "0" + result;
30043
- }
30044
- }
30045
- return "0x" + result;
30046
- }
30047
-
30048
- // ../../node_modules/.pnpm/ethers@6.7.1/node_modules/ethers/lib.esm/utils/base58.js
29991
+ var BN_0 = bn(0);
29992
+ var BN_58 = bn(58);
30049
29993
  var Alphabet = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
30050
29994
  var Lookup = null;
30051
29995
  function getAlpha(letter) {
30052
29996
  if (Lookup == null) {
30053
29997
  Lookup = {};
30054
29998
  for (let i = 0; i < Alphabet.length; i++) {
30055
- Lookup[Alphabet[i]] = BigInt(i);
29999
+ Lookup[Alphabet[i]] = bn(i);
30056
30000
  }
30057
30001
  }
30058
30002
  const result = Lookup[letter];
30059
- assertArgument(result != null, `invalid base58 value`, "letter", letter);
30060
- return result;
30003
+ if (result == null) {
30004
+ throw new FuelError(ErrorCode.INVALID_DATA, `invalid base58 value ${letter}`);
30005
+ }
30006
+ return bn(result);
30061
30007
  }
30062
- var BN_02 = BigInt(0);
30063
- var BN_58 = BigInt(58);
30064
30008
  function encodeBase58(_value) {
30065
- let value = toBigInt(getBytes(_value));
30009
+ const bytes2 = arrayify(_value);
30010
+ let value = bn(bytes2);
30066
30011
  let result = "";
30067
- while (value) {
30068
- result = Alphabet[Number(value % BN_58)] + result;
30069
- value /= BN_58;
30012
+ while (value.gt(BN_0)) {
30013
+ result = Alphabet[Number(value.mod(BN_58))] + result;
30014
+ value = value.div(BN_58);
30015
+ }
30016
+ for (let i = 0; i < bytes2.length; i++) {
30017
+ if (bytes2[i]) {
30018
+ break;
30019
+ }
30020
+ result = Alphabet[0] + result;
30070
30021
  }
30071
30022
  return result;
30072
30023
  }
30073
30024
  function decodeBase58(value) {
30074
- let result = BN_02;
30025
+ let result = BN_0;
30075
30026
  for (let i = 0; i < value.length; i++) {
30076
- result *= BN_58;
30077
- result += getAlpha(value[i]);
30027
+ result = result.mul(BN_58);
30028
+ result = result.add(getAlpha(value[i].toString()));
30078
30029
  }
30079
30030
  return result;
30080
30031
  }
30081
-
30082
- // ../../node_modules/.pnpm/ethers@6.7.1/node_modules/ethers/lib.esm/utils/utf8.js
30083
- function errorFunc(reason, offset, bytes3, output3, badCodepoint) {
30084
- assertArgument(false, `invalid codepoint at offset ${offset}; ${reason}`, "bytes", bytes3);
30085
- }
30086
- function ignoreFunc(reason, offset, bytes3, output3, badCodepoint) {
30087
- if (reason === "BAD_PREFIX" || reason === "UNEXPECTED_CONTINUE") {
30088
- let i = 0;
30089
- for (let o = offset + 1; o < bytes3.length; o++) {
30090
- if (bytes3[o] >> 6 !== 2) {
30091
- break;
30092
- }
30093
- i++;
30094
- }
30095
- return i;
30096
- }
30097
- if (reason === "OVERRUN") {
30098
- return bytes3.length - offset - 1;
30099
- }
30100
- return 0;
30101
- }
30102
- function replaceFunc(reason, offset, bytes3, output3, badCodepoint) {
30103
- if (reason === "OVERLONG") {
30104
- assertArgument(typeof badCodepoint === "number", "invalid bad code point for replacement", "badCodepoint", badCodepoint);
30105
- output3.push(badCodepoint);
30106
- return 0;
30107
- }
30108
- output3.push(65533);
30109
- return ignoreFunc(reason, offset, bytes3, output3, badCodepoint);
30110
- }
30111
- var Utf8ErrorFuncs = Object.freeze({
30112
- error: errorFunc,
30113
- ignore: ignoreFunc,
30114
- replace: replaceFunc
30115
- });
30116
- function getUtf8CodePoints(_bytes, onError) {
30117
- if (onError == null) {
30118
- onError = Utf8ErrorFuncs.error;
30119
- }
30120
- const bytes3 = getBytes(_bytes, "bytes");
30121
- const result = [];
30122
- let i = 0;
30123
- while (i < bytes3.length) {
30124
- const c = bytes3[i++];
30125
- if (c >> 7 === 0) {
30126
- result.push(c);
30127
- continue;
30128
- }
30129
- let extraLength = null;
30130
- let overlongMask = null;
30131
- if ((c & 224) === 192) {
30132
- extraLength = 1;
30133
- overlongMask = 127;
30134
- } else if ((c & 240) === 224) {
30135
- extraLength = 2;
30136
- overlongMask = 2047;
30137
- } else if ((c & 248) === 240) {
30138
- extraLength = 3;
30139
- overlongMask = 65535;
30140
- } else {
30141
- if ((c & 192) === 128) {
30142
- i += onError("UNEXPECTED_CONTINUE", i - 1, bytes3, result);
30143
- } else {
30144
- i += onError("BAD_PREFIX", i - 1, bytes3, result);
30145
- }
30146
- continue;
30147
- }
30148
- if (i - 1 + extraLength >= bytes3.length) {
30149
- i += onError("OVERRUN", i - 1, bytes3, result);
30150
- continue;
30151
- }
30152
- let res = c & (1 << 8 - extraLength - 1) - 1;
30153
- for (let j = 0; j < extraLength; j++) {
30154
- let nextChar = bytes3[i];
30155
- if ((nextChar & 192) != 128) {
30156
- i += onError("MISSING_CONTINUE", i, bytes3, result);
30157
- res = null;
30158
- break;
30159
- }
30160
- ;
30161
- res = res << 6 | nextChar & 63;
30162
- i++;
30163
- }
30164
- if (res === null) {
30165
- continue;
30166
- }
30167
- if (res > 1114111) {
30168
- i += onError("OUT_OF_RANGE", i - 1 - extraLength, bytes3, result, res);
30169
- continue;
30170
- }
30171
- if (res >= 55296 && res <= 57343) {
30172
- i += onError("UTF16_SURROGATE", i - 1 - extraLength, bytes3, result, res);
30173
- continue;
30174
- }
30175
- if (res <= overlongMask) {
30176
- i += onError("OVERLONG", i - 1 - extraLength, bytes3, result, res);
30177
- continue;
30178
- }
30179
- result.push(res);
30180
- }
30181
- return result;
30182
- }
30183
- function toUtf8Bytes(str, form) {
30184
- if (form != null) {
30185
- assertNormalize(form);
30186
- str = str.normalize(form);
30187
- }
30188
- let result = [];
30189
- for (let i = 0; i < str.length; i++) {
30190
- const c = str.charCodeAt(i);
30191
- if (c < 128) {
30192
- result.push(c);
30193
- } else if (c < 2048) {
30194
- result.push(c >> 6 | 192);
30195
- result.push(c & 63 | 128);
30196
- } else if ((c & 64512) == 55296) {
30197
- i++;
30198
- const c2 = str.charCodeAt(i);
30199
- assertArgument(i < str.length && (c2 & 64512) === 56320, "invalid surrogate pair", "str", str);
30200
- const pair = 65536 + ((c & 1023) << 10) + (c2 & 1023);
30201
- result.push(pair >> 18 | 240);
30202
- result.push(pair >> 12 & 63 | 128);
30203
- result.push(pair >> 6 & 63 | 128);
30204
- result.push(pair & 63 | 128);
30205
- } else {
30206
- result.push(c >> 12 | 224);
30207
- result.push(c >> 6 & 63 | 128);
30208
- result.push(c & 63 | 128);
30209
- }
30210
- }
30211
- return new Uint8Array(result);
30212
- }
30213
- function _toUtf8String(codePoints) {
30214
- return codePoints.map((codePoint) => {
30215
- if (codePoint <= 65535) {
30216
- return String.fromCharCode(codePoint);
30217
- }
30218
- codePoint -= 65536;
30219
- return String.fromCharCode((codePoint >> 10 & 1023) + 55296, (codePoint & 1023) + 56320);
30220
- }).join("");
30221
- }
30222
- function toUtf8String(bytes3, onError) {
30223
- return _toUtf8String(getUtf8CodePoints(bytes3, onError));
30224
- }
30225
-
30226
- // ../../node_modules/.pnpm/ethers@6.7.1/node_modules/ethers/lib.esm/crypto/crypto.js
30227
- var import_crypto2 = __require("crypto");
30228
-
30229
- // ../../node_modules/.pnpm/ethers@6.7.1/node_modules/ethers/lib.esm/crypto/hmac.js
30230
- var locked = false;
30231
- var _computeHmac = function(algorithm, key, data) {
30232
- return (0, import_crypto2.createHmac)(algorithm, key).update(data).digest();
30233
- };
30234
- var __computeHmac = _computeHmac;
30235
- function computeHmac(algorithm, _key, _data) {
30236
- const key = getBytes(_key, "key");
30237
- const data = getBytes(_data, "data");
30238
- return hexlify2(__computeHmac(algorithm, key, data));
30239
- }
30240
- computeHmac._ = _computeHmac;
30241
- computeHmac.lock = function() {
30242
- locked = true;
30243
- };
30244
- computeHmac.register = function(func) {
30245
- if (locked) {
30246
- throw new Error("computeHmac is locked");
30247
- }
30248
- __computeHmac = func;
30249
- };
30250
- Object.freeze(computeHmac);
30251
-
30252
- // ../../node_modules/.pnpm/@noble+hashes@1.1.2/node_modules/@noble/hashes/esm/_assert.js
30253
- function number2(n) {
30254
- if (!Number.isSafeInteger(n) || n < 0)
30255
- throw new Error(`Wrong positive integer: ${n}`);
30256
- }
30257
- function bool(b) {
30258
- if (typeof b !== "boolean")
30259
- throw new Error(`Expected boolean, not ${b}`);
30260
- }
30261
- function bytes2(b, ...lengths) {
30262
- if (!(b instanceof Uint8Array))
30263
- throw new TypeError("Expected Uint8Array");
30264
- if (lengths.length > 0 && !lengths.includes(b.length))
30265
- throw new TypeError(`Expected Uint8Array of length ${lengths}, not of length=${b.length}`);
30266
- }
30267
- function hash2(hash4) {
30268
- if (typeof hash4 !== "function" || typeof hash4.create !== "function")
30269
- throw new Error("Hash should be wrapped by utils.wrapConstructor");
30270
- number2(hash4.outputLen);
30271
- number2(hash4.blockLen);
30272
- }
30273
- function exists2(instance, checkFinished = true) {
30274
- if (instance.destroyed)
30275
- throw new Error("Hash instance has been destroyed");
30276
- if (checkFinished && instance.finished)
30277
- throw new Error("Hash#digest() has already been called");
30278
- }
30279
- function output2(out, instance) {
30280
- bytes2(out);
30281
- const min = instance.outputLen;
30282
- if (out.length < min) {
30283
- throw new Error(`digestInto() expects output buffer of length at least ${min}`);
30284
- }
30285
- }
30286
- var assert2 = {
30287
- number: number2,
30288
- bool,
30289
- bytes: bytes2,
30290
- hash: hash2,
30291
- exists: exists2,
30292
- output: output2
30293
- };
30294
- var assert_default = assert2;
30295
-
30296
- // ../../node_modules/.pnpm/@noble+hashes@1.1.2/node_modules/@noble/hashes/esm/utils.js
30297
- var createView2 = (arr) => new DataView(arr.buffer, arr.byteOffset, arr.byteLength);
30298
- var isLE2 = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68;
30299
- if (!isLE2)
30300
- throw new Error("Non little-endian hardware is not supported");
30301
- var hexes = Array.from({ length: 256 }, (v, i) => i.toString(16).padStart(2, "0"));
30302
- function utf8ToBytes2(str) {
30303
- if (typeof str !== "string") {
30304
- throw new TypeError(`utf8ToBytes expected string, got ${typeof str}`);
30305
- }
30306
- return new TextEncoder().encode(str);
30307
- }
30308
- function toBytes2(data) {
30309
- if (typeof data === "string")
30310
- data = utf8ToBytes2(data);
30311
- if (!(data instanceof Uint8Array))
30312
- throw new TypeError(`Expected input type is Uint8Array (got ${typeof data})`);
30313
- return data;
30314
- }
30315
- var Hash2 = class {
30316
- // Safe version that clones internal state
30317
- clone() {
30318
- return this._cloneInto();
30032
+ function dataSlice(data, start, end) {
30033
+ const bytes2 = arrayify(data);
30034
+ if (end != null && end > bytes2.length) {
30035
+ throw new FuelError(ErrorCode.INVALID_DATA, "cannot slice beyond data bounds");
30319
30036
  }
30320
- };
30321
- function wrapConstructor2(hashConstructor) {
30322
- const hashC = (message) => hashConstructor().update(toBytes2(message)).digest();
30323
- const tmp = hashConstructor();
30324
- hashC.outputLen = tmp.outputLen;
30325
- hashC.blockLen = tmp.blockLen;
30326
- hashC.create = () => hashConstructor();
30327
- return hashC;
30037
+ return hexlify(bytes2.slice(start == null ? 0 : start, end == null ? bytes2.length : end));
30328
30038
  }
30329
30039
 
30330
- // ../../node_modules/.pnpm/@noble+hashes@1.1.2/node_modules/@noble/hashes/esm/_sha2.js
30331
- function setBigUint642(view, byteOffset, value, isLE3) {
30332
- if (typeof view.setBigUint64 === "function")
30333
- return view.setBigUint64(byteOffset, value, isLE3);
30334
- const _32n2 = BigInt(32);
30335
- const _u32_max = BigInt(4294967295);
30336
- const wh = Number(value >> _32n2 & _u32_max);
30337
- const wl = Number(value & _u32_max);
30338
- const h = isLE3 ? 4 : 0;
30339
- const l = isLE3 ? 0 : 4;
30340
- view.setUint32(byteOffset + h, wh, isLE3);
30341
- view.setUint32(byteOffset + l, wl, isLE3);
30342
- }
30343
- var SHA22 = class extends Hash2 {
30344
- constructor(blockLen, outputLen, padOffset, isLE3) {
30345
- super();
30346
- this.blockLen = blockLen;
30347
- this.outputLen = outputLen;
30348
- this.padOffset = padOffset;
30349
- this.isLE = isLE3;
30350
- this.finished = false;
30351
- this.length = 0;
30352
- this.pos = 0;
30353
- this.destroyed = false;
30354
- this.buffer = new Uint8Array(blockLen);
30355
- this.view = createView2(this.buffer);
30356
- }
30357
- update(data) {
30358
- assert_default.exists(this);
30359
- const { view, buffer, blockLen } = this;
30360
- data = toBytes2(data);
30361
- const len = data.length;
30362
- for (let pos = 0; pos < len; ) {
30363
- const take = Math.min(blockLen - this.pos, len - pos);
30364
- if (take === blockLen) {
30365
- const dataView = createView2(data);
30366
- for (; blockLen <= len - pos; pos += blockLen)
30367
- this.process(dataView, pos);
30368
- continue;
30369
- }
30370
- buffer.set(data.subarray(pos, pos + take), this.pos);
30371
- this.pos += take;
30372
- pos += take;
30373
- if (this.pos === blockLen) {
30374
- this.process(view, 0);
30375
- this.pos = 0;
30376
- }
30377
- }
30378
- this.length += data.length;
30379
- this.roundClean();
30380
- return this;
30381
- }
30382
- digestInto(out) {
30383
- assert_default.exists(this);
30384
- assert_default.output(out, this);
30385
- this.finished = true;
30386
- const { buffer, view, blockLen, isLE: isLE3 } = this;
30387
- let { pos } = this;
30388
- buffer[pos++] = 128;
30389
- this.buffer.subarray(pos).fill(0);
30390
- if (this.padOffset > blockLen - pos) {
30391
- this.process(view, 0);
30392
- pos = 0;
30393
- }
30394
- for (let i = pos; i < blockLen; i++)
30395
- buffer[i] = 0;
30396
- setBigUint642(view, blockLen - 8, BigInt(this.length * 8), isLE3);
30397
- this.process(view, 0);
30398
- const oview = createView2(out);
30399
- this.get().forEach((v, i) => oview.setUint32(4 * i, v, isLE3));
30400
- }
30401
- digest() {
30402
- const { buffer, outputLen } = this;
30403
- this.digestInto(buffer);
30404
- const res = buffer.slice(0, outputLen);
30405
- this.destroy();
30406
- return res;
30407
- }
30408
- _cloneInto(to) {
30409
- to || (to = new this.constructor());
30410
- to.set(...this.get());
30411
- const { blockLen, buffer, length, finished, destroyed, pos } = this;
30412
- to.length = length;
30413
- to.pos = pos;
30414
- to.finished = finished;
30415
- to.destroyed = destroyed;
30416
- if (length % blockLen)
30417
- to.buffer.set(buffer);
30418
- return to;
30419
- }
30420
- };
30421
-
30422
- // ../../node_modules/.pnpm/@noble+hashes@1.1.2/node_modules/@noble/hashes/esm/ripemd160.js
30423
- var Rho = new Uint8Array([7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8]);
30424
- var Id = Uint8Array.from({ length: 16 }, (_, i) => i);
30425
- var Pi = Id.map((i) => (9 * i + 5) % 16);
30040
+ // ../../node_modules/.pnpm/@noble+hashes@1.3.3/node_modules/@noble/hashes/esm/ripemd160.js
30041
+ var Rho = /* @__PURE__ */ new Uint8Array([7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8]);
30042
+ var Id = /* @__PURE__ */ Uint8Array.from({ length: 16 }, (_, i) => i);
30043
+ var Pi = /* @__PURE__ */ Id.map((i) => (9 * i + 5) % 16);
30426
30044
  var idxL = [Id];
30427
30045
  var idxR = [Pi];
30428
30046
  for (let i = 0; i < 4; i++)
30429
30047
  for (let j of [idxL, idxR])
30430
30048
  j.push(j[i].map((k) => Rho[k]));
30431
- var shifts = [
30049
+ var shifts = /* @__PURE__ */ [
30432
30050
  [11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8],
30433
30051
  [12, 13, 11, 15, 6, 9, 9, 7, 12, 15, 11, 13, 7, 8, 7, 7],
30434
30052
  [13, 15, 14, 11, 7, 7, 6, 8, 13, 14, 13, 12, 5, 5, 6, 9],
30435
30053
  [14, 11, 12, 14, 8, 6, 5, 5, 15, 12, 15, 14, 9, 9, 8, 6],
30436
30054
  [15, 12, 13, 13, 9, 5, 8, 6, 14, 11, 12, 11, 8, 6, 5, 5]
30437
30055
  ].map((i) => new Uint8Array(i));
30438
- var shiftsL = idxL.map((idx, i) => idx.map((j) => shifts[i][j]));
30439
- var shiftsR = idxR.map((idx, i) => idx.map((j) => shifts[i][j]));
30440
- var Kl = new Uint32Array([0, 1518500249, 1859775393, 2400959708, 2840853838]);
30441
- var Kr = new Uint32Array([1352829926, 1548603684, 1836072691, 2053994217, 0]);
30056
+ var shiftsL = /* @__PURE__ */ idxL.map((idx, i) => idx.map((j) => shifts[i][j]));
30057
+ var shiftsR = /* @__PURE__ */ idxR.map((idx, i) => idx.map((j) => shifts[i][j]));
30058
+ var Kl = /* @__PURE__ */ new Uint32Array([
30059
+ 0,
30060
+ 1518500249,
30061
+ 1859775393,
30062
+ 2400959708,
30063
+ 2840853838
30064
+ ]);
30065
+ var Kr = /* @__PURE__ */ new Uint32Array([
30066
+ 1352829926,
30067
+ 1548603684,
30068
+ 1836072691,
30069
+ 2053994217,
30070
+ 0
30071
+ ]);
30442
30072
  var rotl2 = (word, shift) => word << shift | word >>> 32 - shift;
30443
30073
  function f(group, x, y, z) {
30444
30074
  if (group === 0)
@@ -30452,8 +30082,8 @@ This unreleased fuel-core build may include features and updates not yet support
30452
30082
  else
30453
30083
  return x ^ (y | ~z);
30454
30084
  }
30455
- var BUF = new Uint32Array(16);
30456
- var RIPEMD160 = class extends SHA22 {
30085
+ var BUF = /* @__PURE__ */ new Uint32Array(16);
30086
+ var RIPEMD160 = class extends SHA2 {
30457
30087
  constructor() {
30458
30088
  super(64, 20, 8, true);
30459
30089
  this.h0 = 1732584193 | 0;
@@ -30502,65 +30132,60 @@ This unreleased fuel-core build may include features and updates not yet support
30502
30132
  this.set(0, 0, 0, 0, 0);
30503
30133
  }
30504
30134
  };
30505
- var ripemd160 = wrapConstructor2(() => new RIPEMD160());
30135
+ var ripemd160 = /* @__PURE__ */ wrapConstructor(() => new RIPEMD160());
30506
30136
 
30507
- // ../../node_modules/.pnpm/ethers@6.7.1/node_modules/ethers/lib.esm/crypto/ripemd160.js
30508
- var locked2 = false;
30509
- var _ripemd160 = function(data) {
30510
- return ripemd160(data);
30137
+ // ../crypto/dist/index.mjs
30138
+ var import_crypto2 = __toESM(__require("crypto"), 1);
30139
+ var import_crypto3 = __require("crypto");
30140
+ var import_crypto4 = __toESM(__require("crypto"), 1);
30141
+ var import_crypto5 = __toESM(__require("crypto"), 1);
30142
+ var import_crypto6 = __require("crypto");
30143
+ var scrypt2 = (params) => {
30144
+ const { password, salt, n, p, r, dklen } = params;
30145
+ const derivedKey = scrypt(password, salt, { N: n, r, p, dkLen: dklen });
30146
+ return derivedKey;
30511
30147
  };
30512
- var __ripemd160 = _ripemd160;
30148
+ var keccak256 = (data) => keccak_256(data);
30149
+ var locked = false;
30150
+ var helper = (data) => ripemd160(data);
30151
+ var ripemd = helper;
30513
30152
  function ripemd1602(_data) {
30514
- const data = getBytes(_data, "data");
30515
- return hexlify2(__ripemd160(data));
30153
+ const data = arrayify(_data, "data");
30154
+ return ripemd(data);
30516
30155
  }
30517
- ripemd1602._ = _ripemd160;
30518
- ripemd1602.lock = function() {
30519
- locked2 = true;
30156
+ ripemd1602._ = helper;
30157
+ ripemd1602.lock = () => {
30158
+ locked = true;
30520
30159
  };
30521
- ripemd1602.register = function(func) {
30522
- if (locked2) {
30523
- throw new TypeError("ripemd160 is locked");
30160
+ ripemd1602.register = (func) => {
30161
+ if (locked) {
30162
+ throw new FuelError(ErrorCode.HASHER_LOCKED, "ripemd160 is locked");
30524
30163
  }
30525
- __ripemd160 = func;
30164
+ ripemd = func;
30526
30165
  };
30527
30166
  Object.freeze(ripemd1602);
30528
-
30529
- // ../../node_modules/.pnpm/ethers@6.7.1/node_modules/ethers/lib.esm/crypto/pbkdf2.js
30530
- var locked3 = false;
30531
- var _pbkdf2 = function(password, salt, iterations, keylen, algo) {
30532
- return (0, import_crypto2.pbkdf2Sync)(password, salt, iterations, keylen, algo);
30533
- };
30534
- var __pbkdf2 = _pbkdf2;
30167
+ var bufferFromString = (string, encoding = "base64") => Uint8Array.from(Buffer.from(string, encoding));
30168
+ var locked2 = false;
30169
+ var PBKDF2 = (password, salt, iterations, keylen, algo) => (0, import_crypto3.pbkdf2Sync)(password, salt, iterations, keylen, algo);
30170
+ var pBkdf2 = PBKDF2;
30535
30171
  function pbkdf22(_password, _salt, iterations, keylen, algo) {
30536
- const password = getBytes(_password, "password");
30537
- const salt = getBytes(_salt, "salt");
30538
- return hexlify2(__pbkdf2(password, salt, iterations, keylen, algo));
30172
+ const password = arrayify(_password, "password");
30173
+ const salt = arrayify(_salt, "salt");
30174
+ return hexlify(pBkdf2(password, salt, iterations, keylen, algo));
30539
30175
  }
30540
- pbkdf22._ = _pbkdf2;
30541
- pbkdf22.lock = function() {
30542
- locked3 = true;
30176
+ pbkdf22._ = PBKDF2;
30177
+ pbkdf22.lock = () => {
30178
+ locked2 = true;
30543
30179
  };
30544
- pbkdf22.register = function(func) {
30545
- if (locked3) {
30546
- throw new Error("pbkdf2 is locked");
30180
+ pbkdf22.register = (func) => {
30181
+ if (locked2) {
30182
+ throw new FuelError(ErrorCode.HASHER_LOCKED, "pbkdf2 is locked");
30547
30183
  }
30548
- __pbkdf2 = func;
30184
+ pBkdf2 = func;
30549
30185
  };
30550
30186
  Object.freeze(pbkdf22);
30551
-
30552
- // ../crypto/dist/index.mjs
30553
- var import_crypto8 = __toESM(__require("crypto"), 1);
30554
- var import_crypto9 = __toESM(__require("crypto"), 1);
30555
- var scrypt3 = (params) => {
30556
- const { password, salt, n, p, r, dklen } = params;
30557
- const derivedKey = scrypt(password, salt, { N: n, r, p, dkLen: dklen });
30558
- return derivedKey;
30559
- };
30560
- var keccak2562 = (data) => keccak_256(data);
30561
- var bufferFromString = (string, encoding = "base64") => Uint8Array.from(Buffer.from(string, encoding));
30562
- var randomBytes4 = (length) => {
30563
- const randomValues = Uint8Array.from(import_crypto8.default.randomBytes(length));
30187
+ var randomBytes2 = (length) => {
30188
+ const randomValues = Uint8Array.from(import_crypto4.default.randomBytes(length));
30564
30189
  return randomValues;
30565
30190
  };
30566
30191
  var stringFromBuffer = (buffer, encoding = "base64") => Buffer.from(buffer).toString(encoding);
@@ -30571,11 +30196,11 @@ This unreleased fuel-core build may include features and updates not yet support
30571
30196
  return arrayify(key);
30572
30197
  };
30573
30198
  var encrypt = async (password, data) => {
30574
- const iv = randomBytes4(16);
30575
- const salt = randomBytes4(32);
30199
+ const iv = randomBytes2(16);
30200
+ const salt = randomBytes2(32);
30576
30201
  const secret = keyFromPassword(password, salt);
30577
30202
  const dataBuffer = Uint8Array.from(Buffer.from(JSON.stringify(data), "utf-8"));
30578
- const cipher = await import_crypto7.default.createCipheriv(ALGORITHM, secret, iv);
30203
+ const cipher = await import_crypto2.default.createCipheriv(ALGORITHM, secret, iv);
30579
30204
  let cipherData = cipher.update(dataBuffer);
30580
30205
  cipherData = Buffer.concat([cipherData, cipher.final()]);
30581
30206
  return {
@@ -30589,7 +30214,7 @@ This unreleased fuel-core build may include features and updates not yet support
30589
30214
  const salt = bufferFromString(keystore.salt);
30590
30215
  const secret = keyFromPassword(password, salt);
30591
30216
  const encryptedText = bufferFromString(keystore.data);
30592
- const decipher = await import_crypto7.default.createDecipheriv(ALGORITHM, secret, iv);
30217
+ const decipher = await import_crypto2.default.createDecipheriv(ALGORITHM, secret, iv);
30593
30218
  const decrypted = decipher.update(encryptedText);
30594
30219
  const deBuff = Buffer.concat([decrypted, decipher.final()]);
30595
30220
  const decryptedData = Buffer.from(deBuff).toString("utf-8");
@@ -30600,26 +30225,48 @@ This unreleased fuel-core build may include features and updates not yet support
30600
30225
  }
30601
30226
  };
30602
30227
  async function encryptJsonWalletData(data, key, iv) {
30603
- const cipher = await import_crypto9.default.createCipheriv("aes-128-ctr", key.subarray(0, 16), iv);
30228
+ const cipher = await import_crypto5.default.createCipheriv("aes-128-ctr", key.subarray(0, 16), iv);
30604
30229
  const encrypted = Buffer.concat([cipher.update(data), cipher.final()]);
30605
30230
  return new Uint8Array(encrypted);
30606
30231
  }
30607
30232
  async function decryptJsonWalletData(data, key, iv) {
30608
- const decipher = import_crypto9.default.createDecipheriv("aes-128-ctr", key.subarray(0, 16), iv);
30233
+ const decipher = import_crypto5.default.createDecipheriv("aes-128-ctr", key.subarray(0, 16), iv);
30609
30234
  const decrypted = await Buffer.concat([decipher.update(data), decipher.final()]);
30610
30235
  return new Uint8Array(decrypted);
30611
30236
  }
30237
+ var locked3 = false;
30238
+ var COMPUTEHMAC = (algorithm, key, data) => (0, import_crypto6.createHmac)(algorithm, key).update(data).digest();
30239
+ var computeHMAC = COMPUTEHMAC;
30240
+ function computeHmac(algorithm, _key, _data) {
30241
+ const key = arrayify(_key, "key");
30242
+ const data = arrayify(_data, "data");
30243
+ return hexlify(computeHMAC(algorithm, key, data));
30244
+ }
30245
+ computeHmac._ = COMPUTEHMAC;
30246
+ computeHmac.lock = () => {
30247
+ locked3 = true;
30248
+ };
30249
+ computeHmac.register = (func) => {
30250
+ if (locked3) {
30251
+ throw new FuelError(ErrorCode.HASHER_LOCKED, "computeHmac is locked");
30252
+ }
30253
+ computeHMAC = func;
30254
+ };
30255
+ Object.freeze(computeHmac);
30612
30256
  var api = {
30613
30257
  bufferFromString,
30614
30258
  stringFromBuffer,
30615
30259
  decrypt,
30616
30260
  encrypt,
30617
30261
  keyFromPassword,
30618
- randomBytes: randomBytes4,
30619
- scrypt: scrypt3,
30620
- keccak256: keccak2562,
30262
+ randomBytes: randomBytes2,
30263
+ scrypt: scrypt2,
30264
+ keccak256,
30621
30265
  decryptJsonWalletData,
30622
- encryptJsonWalletData
30266
+ encryptJsonWalletData,
30267
+ computeHmac,
30268
+ pbkdf2: pbkdf22,
30269
+ ripemd160: ripemd1602
30623
30270
  };
30624
30271
  var node_default = api;
30625
30272
  var {
@@ -30630,9 +30277,12 @@ This unreleased fuel-core build may include features and updates not yet support
30630
30277
  randomBytes: randomBytes22,
30631
30278
  stringFromBuffer: stringFromBuffer2,
30632
30279
  scrypt: scrypt22,
30633
- keccak256: keccak25622,
30280
+ keccak256: keccak2562,
30634
30281
  decryptJsonWalletData: decryptJsonWalletData2,
30635
- encryptJsonWalletData: encryptJsonWalletData2
30282
+ encryptJsonWalletData: encryptJsonWalletData2,
30283
+ computeHmac: computeHmac2,
30284
+ pbkdf2: pbkdf222,
30285
+ ripemd160: ripemd16022
30636
30286
  } = node_default;
30637
30287
 
30638
30288
  // ../interfaces/dist/index.mjs
@@ -30696,7 +30346,7 @@ This unreleased fuel-core build may include features and updates not yet support
30696
30346
  };
30697
30347
  var getRandomB256 = () => hexlify(randomBytes22(32));
30698
30348
  var clearFirst12BytesFromB256 = (b256) => {
30699
- let bytes3;
30349
+ let bytes2;
30700
30350
  try {
30701
30351
  if (!isB256(b256)) {
30702
30352
  throw new FuelError(
@@ -30704,15 +30354,15 @@ This unreleased fuel-core build may include features and updates not yet support
30704
30354
  `Invalid Bech32 Address: ${b256}.`
30705
30355
  );
30706
30356
  }
30707
- bytes3 = getBytesFromBech32(toBech32(b256));
30708
- bytes3 = hexlify(bytes3.fill(0, 0, 12));
30357
+ bytes2 = getBytesFromBech32(toBech32(b256));
30358
+ bytes2 = hexlify(bytes2.fill(0, 0, 12));
30709
30359
  } catch (error) {
30710
30360
  throw new FuelError(
30711
30361
  FuelError.CODES.PARSE_FAILED,
30712
30362
  `Cannot generate EVM Address B256 from: ${b256}.`
30713
30363
  );
30714
30364
  }
30715
- return bytes3;
30365
+ return bytes2;
30716
30366
  };
30717
30367
  var padFirst12BytesOfEvmAddress = (address) => {
30718
30368
  if (!isEvmAddress(address)) {
@@ -30921,226 +30571,6 @@ This unreleased fuel-core build may include features and updates not yet support
30921
30571
  }
30922
30572
  };
30923
30573
 
30924
- // ../math/dist/index.mjs
30925
- var import_bn = __toESM(require_bn(), 1);
30926
- var DEFAULT_PRECISION = 9;
30927
- var DEFAULT_MIN_PRECISION = 3;
30928
- var DEFAULT_DECIMAL_UNITS = 9;
30929
- function toFixed(value, options) {
30930
- const { precision = DEFAULT_PRECISION, minPrecision = DEFAULT_MIN_PRECISION } = options || {};
30931
- const [valueUnits = "0", valueDecimals = "0"] = String(value || "0.0").split(".");
30932
- const groupRegex = /(\d)(?=(\d{3})+\b)/g;
30933
- const units = valueUnits.replace(groupRegex, "$1,");
30934
- let decimals = valueDecimals.slice(0, precision);
30935
- if (minPrecision < precision) {
30936
- const trimmedDecimal = decimals.match(/.*[1-9]{1}/);
30937
- const lastNonZeroIndex = trimmedDecimal?.[0].length || 0;
30938
- const keepChars = Math.max(minPrecision, lastNonZeroIndex);
30939
- decimals = decimals.slice(0, keepChars);
30940
- }
30941
- const decimalPortion = decimals ? `.${decimals}` : "";
30942
- return `${units}${decimalPortion}`;
30943
- }
30944
- var BN = class extends import_bn.default {
30945
- MAX_U64 = "0xFFFFFFFFFFFFFFFF";
30946
- constructor(value, base, endian) {
30947
- let bnValue = value;
30948
- let bnBase = base;
30949
- if (BN.isBN(value)) {
30950
- bnValue = value.toArray();
30951
- } else if (typeof value === "string" && value.slice(0, 2) === "0x") {
30952
- bnValue = value.substring(2);
30953
- bnBase = base || "hex";
30954
- }
30955
- super(bnValue == null ? 0 : bnValue, bnBase, endian);
30956
- }
30957
- // ANCHOR: HELPERS
30958
- // make sure we always include `0x` in hex strings
30959
- toString(base, length) {
30960
- const output3 = super.toString(base, length);
30961
- if (base === 16 || base === "hex") {
30962
- return `0x${output3}`;
30963
- }
30964
- return output3;
30965
- }
30966
- toHex(bytesPadding) {
30967
- const bytes3 = bytesPadding || 0;
30968
- const bytesLength = bytes3 * 2;
30969
- if (this.isNeg()) {
30970
- throw new FuelError(ErrorCode.CONVERTING_FAILED, "Cannot convert negative value to hex.");
30971
- }
30972
- if (bytesPadding && this.byteLength() > bytesPadding) {
30973
- throw new FuelError(
30974
- ErrorCode.CONVERTING_FAILED,
30975
- `Provided value ${this} is too large. It should fit within ${bytesPadding} bytes.`
30976
- );
30977
- }
30978
- return this.toString(16, bytesLength);
30979
- }
30980
- toBytes(bytesPadding) {
30981
- if (this.isNeg()) {
30982
- throw new FuelError(ErrorCode.CONVERTING_FAILED, "Cannot convert negative value to bytes.");
30983
- }
30984
- return Uint8Array.from(this.toArray(void 0, bytesPadding));
30985
- }
30986
- toJSON() {
30987
- return this.toString(16);
30988
- }
30989
- valueOf() {
30990
- return this.toString();
30991
- }
30992
- format(options) {
30993
- const {
30994
- units = DEFAULT_DECIMAL_UNITS,
30995
- precision = DEFAULT_PRECISION,
30996
- minPrecision = DEFAULT_MIN_PRECISION
30997
- } = options || {};
30998
- const formattedUnits = this.formatUnits(units);
30999
- const formattedFixed = toFixed(formattedUnits, { precision, minPrecision });
31000
- if (!parseFloat(formattedFixed)) {
31001
- const [, originalDecimals = "0"] = formattedUnits.split(".");
31002
- const firstNonZero = originalDecimals.match(/[1-9]/);
31003
- if (firstNonZero && firstNonZero.index && firstNonZero.index + 1 > precision) {
31004
- const [valueUnits = "0"] = formattedFixed.split(".");
31005
- return `${valueUnits}.${originalDecimals.slice(0, firstNonZero.index + 1)}`;
31006
- }
31007
- }
31008
- return formattedFixed;
31009
- }
31010
- formatUnits(units = DEFAULT_DECIMAL_UNITS) {
31011
- const valueUnits = this.toString().slice(0, units * -1);
31012
- const valueDecimals = this.toString().slice(units * -1);
31013
- const length = valueDecimals.length;
31014
- const defaultDecimals = Array.from({ length: units - length }).fill("0").join("");
31015
- const integerPortion = valueUnits ? `${valueUnits}.` : "0.";
31016
- return `${integerPortion}${defaultDecimals}${valueDecimals}`;
31017
- }
31018
- // END ANCHOR: HELPERS
31019
- // ANCHOR: OVERRIDES to accept better inputs
31020
- add(v) {
31021
- return this.caller(v, "add");
31022
- }
31023
- pow(v) {
31024
- return this.caller(v, "pow");
31025
- }
31026
- sub(v) {
31027
- return this.caller(v, "sub");
31028
- }
31029
- div(v) {
31030
- return this.caller(v, "div");
31031
- }
31032
- mul(v) {
31033
- return this.caller(v, "mul");
31034
- }
31035
- mod(v) {
31036
- return this.caller(v, "mod");
31037
- }
31038
- divRound(v) {
31039
- return this.caller(v, "divRound");
31040
- }
31041
- lt(v) {
31042
- return this.caller(v, "lt");
31043
- }
31044
- lte(v) {
31045
- return this.caller(v, "lte");
31046
- }
31047
- gt(v) {
31048
- return this.caller(v, "gt");
31049
- }
31050
- gte(v) {
31051
- return this.caller(v, "gte");
31052
- }
31053
- eq(v) {
31054
- return this.caller(v, "eq");
31055
- }
31056
- cmp(v) {
31057
- return this.caller(v, "cmp");
31058
- }
31059
- // END ANCHOR: OVERRIDES to accept better inputs
31060
- // ANCHOR: OVERRIDES to output our BN type
31061
- sqr() {
31062
- return new BN(super.sqr().toArray());
31063
- }
31064
- neg() {
31065
- return new BN(super.neg().toArray());
31066
- }
31067
- abs() {
31068
- return new BN(super.abs().toArray());
31069
- }
31070
- toTwos(width) {
31071
- return new BN(super.toTwos(width).toArray());
31072
- }
31073
- fromTwos(width) {
31074
- return new BN(super.fromTwos(width).toArray());
31075
- }
31076
- // END ANCHOR: OVERRIDES to output our BN type
31077
- // ANCHOR: OVERRIDES to avoid losing references
31078
- caller(v, methodName) {
31079
- const output3 = super[methodName](new BN(v));
31080
- if (BN.isBN(output3)) {
31081
- return new BN(output3.toArray());
31082
- }
31083
- if (typeof output3 === "boolean") {
31084
- return output3;
31085
- }
31086
- return output3;
31087
- }
31088
- clone() {
31089
- return new BN(this.toArray());
31090
- }
31091
- mulTo(num, out) {
31092
- const output3 = new import_bn.default(this.toArray()).mulTo(num, out);
31093
- return new BN(output3.toArray());
31094
- }
31095
- egcd(p) {
31096
- const { a, b, gcd } = new import_bn.default(this.toArray()).egcd(p);
31097
- return {
31098
- a: new BN(a.toArray()),
31099
- b: new BN(b.toArray()),
31100
- gcd: new BN(gcd.toArray())
31101
- };
31102
- }
31103
- divmod(num, mode, positive) {
31104
- const { div, mod: mod2 } = new import_bn.default(this.toArray()).divmod(new BN(num), mode, positive);
31105
- return {
31106
- div: new BN(div?.toArray()),
31107
- mod: new BN(mod2?.toArray())
31108
- };
31109
- }
31110
- maxU64() {
31111
- return this.gte(this.MAX_U64) ? new BN(this.MAX_U64) : this;
31112
- }
31113
- normalizeZeroToOne() {
31114
- return this.isZero() ? new BN(1) : this;
31115
- }
31116
- // END ANCHOR: OVERRIDES to avoid losing references
31117
- };
31118
- var bn = (value, base, endian) => new BN(value, base, endian);
31119
- bn.parseUnits = (value, units = DEFAULT_DECIMAL_UNITS) => {
31120
- const valueToParse = value === "." ? "0." : value;
31121
- const [valueUnits = "0", valueDecimals = "0"] = valueToParse.split(".");
31122
- const length = valueDecimals.length;
31123
- if (length > units) {
31124
- throw new FuelError(
31125
- ErrorCode.CONVERTING_FAILED,
31126
- `Decimal can't have more than ${units} digits.`
31127
- );
31128
- }
31129
- const decimals = Array.from({ length: units }).fill("0");
31130
- decimals.splice(0, length, valueDecimals);
31131
- const amount = `${valueUnits.replaceAll(",", "")}${decimals.join("")}`;
31132
- return bn(amount);
31133
- };
31134
- function toNumber2(value) {
31135
- return bn(value).toNumber();
31136
- }
31137
- function toHex(value, bytesPadding) {
31138
- return bn(value).toHex(bytesPadding);
31139
- }
31140
- function toBytes3(value, bytesPadding) {
31141
- return bn(value).toBytes(bytesPadding);
31142
- }
31143
-
31144
30574
  // ../../node_modules/.pnpm/ramda@0.29.0/node_modules/ramda/es/internal/_isPlaceholder.js
31145
30575
  function _isPlaceholder(a) {
31146
30576
  return a != null && typeof a === "object" && a["@@functional/placeholder"] === true;
@@ -31327,12 +30757,322 @@ This unreleased fuel-core build may include features and updates not yet support
31327
30757
  return coinQuantities;
31328
30758
  };
31329
30759
 
30760
+ // ../../node_modules/.pnpm/ethers@6.7.1/node_modules/ethers/lib.esm/_version.js
30761
+ var version = "6.7.1";
30762
+
30763
+ // ../../node_modules/.pnpm/ethers@6.7.1/node_modules/ethers/lib.esm/utils/properties.js
30764
+ function checkType(value, type3, name) {
30765
+ const types = type3.split("|").map((t) => t.trim());
30766
+ for (let i = 0; i < types.length; i++) {
30767
+ switch (type3) {
30768
+ case "any":
30769
+ return;
30770
+ case "bigint":
30771
+ case "boolean":
30772
+ case "number":
30773
+ case "string":
30774
+ if (typeof value === type3) {
30775
+ return;
30776
+ }
30777
+ }
30778
+ }
30779
+ const error = new Error(`invalid value for type ${type3}`);
30780
+ error.code = "INVALID_ARGUMENT";
30781
+ error.argument = `value.${name}`;
30782
+ error.value = value;
30783
+ throw error;
30784
+ }
30785
+ function defineProperties(target, values, types) {
30786
+ for (let key in values) {
30787
+ let value = values[key];
30788
+ const type3 = types ? types[key] : null;
30789
+ if (type3) {
30790
+ checkType(value, type3, key);
30791
+ }
30792
+ Object.defineProperty(target, key, { enumerable: true, value, writable: false });
30793
+ }
30794
+ }
30795
+
30796
+ // ../../node_modules/.pnpm/ethers@6.7.1/node_modules/ethers/lib.esm/utils/errors.js
30797
+ function stringify(value) {
30798
+ if (value == null) {
30799
+ return "null";
30800
+ }
30801
+ if (Array.isArray(value)) {
30802
+ return "[ " + value.map(stringify).join(", ") + " ]";
30803
+ }
30804
+ if (value instanceof Uint8Array) {
30805
+ const HEX = "0123456789abcdef";
30806
+ let result = "0x";
30807
+ for (let i = 0; i < value.length; i++) {
30808
+ result += HEX[value[i] >> 4];
30809
+ result += HEX[value[i] & 15];
30810
+ }
30811
+ return result;
30812
+ }
30813
+ if (typeof value === "object" && typeof value.toJSON === "function") {
30814
+ return stringify(value.toJSON());
30815
+ }
30816
+ switch (typeof value) {
30817
+ case "boolean":
30818
+ case "symbol":
30819
+ return value.toString();
30820
+ case "bigint":
30821
+ return BigInt(value).toString();
30822
+ case "number":
30823
+ return value.toString();
30824
+ case "string":
30825
+ return JSON.stringify(value);
30826
+ case "object": {
30827
+ const keys = Object.keys(value);
30828
+ keys.sort();
30829
+ return "{ " + keys.map((k) => `${stringify(k)}: ${stringify(value[k])}`).join(", ") + " }";
30830
+ }
30831
+ }
30832
+ return `[ COULD NOT SERIALIZE ]`;
30833
+ }
30834
+ function makeError(message, code, info) {
30835
+ {
30836
+ const details = [];
30837
+ if (info) {
30838
+ if ("message" in info || "code" in info || "name" in info) {
30839
+ throw new Error(`value will overwrite populated values: ${stringify(info)}`);
30840
+ }
30841
+ for (const key in info) {
30842
+ const value = info[key];
30843
+ details.push(key + "=" + stringify(value));
30844
+ }
30845
+ }
30846
+ details.push(`code=${code}`);
30847
+ details.push(`version=${version}`);
30848
+ if (details.length) {
30849
+ message += " (" + details.join(", ") + ")";
30850
+ }
30851
+ }
30852
+ let error;
30853
+ switch (code) {
30854
+ case "INVALID_ARGUMENT":
30855
+ error = new TypeError(message);
30856
+ break;
30857
+ case "NUMERIC_FAULT":
30858
+ case "BUFFER_OVERRUN":
30859
+ error = new RangeError(message);
30860
+ break;
30861
+ default:
30862
+ error = new Error(message);
30863
+ }
30864
+ defineProperties(error, { code });
30865
+ if (info) {
30866
+ Object.assign(error, info);
30867
+ }
30868
+ return error;
30869
+ }
30870
+ function assert(check, message, code, info) {
30871
+ if (!check) {
30872
+ throw makeError(message, code, info);
30873
+ }
30874
+ }
30875
+ function assertArgument(check, message, name, value) {
30876
+ assert(check, message, "INVALID_ARGUMENT", { argument: name, value });
30877
+ }
30878
+ var _normalizeForms = ["NFD", "NFC", "NFKD", "NFKC"].reduce((accum, form) => {
30879
+ try {
30880
+ if ("test".normalize(form) !== "test") {
30881
+ throw new Error("bad");
30882
+ }
30883
+ ;
30884
+ if (form === "NFD") {
30885
+ const check = String.fromCharCode(233).normalize("NFD");
30886
+ const expected = String.fromCharCode(101, 769);
30887
+ if (check !== expected) {
30888
+ throw new Error("broken");
30889
+ }
30890
+ }
30891
+ accum.push(form);
30892
+ } catch (error) {
30893
+ }
30894
+ return accum;
30895
+ }, []);
30896
+ function assertNormalize(form) {
30897
+ assert(_normalizeForms.indexOf(form) >= 0, "platform missing String.prototype.normalize", "UNSUPPORTED_OPERATION", {
30898
+ operation: "String.prototype.normalize",
30899
+ info: { form }
30900
+ });
30901
+ }
30902
+
30903
+ // ../../node_modules/.pnpm/ethers@6.7.1/node_modules/ethers/lib.esm/utils/data.js
30904
+ function _getBytes(value, name, copy) {
30905
+ if (value instanceof Uint8Array) {
30906
+ if (copy) {
30907
+ return new Uint8Array(value);
30908
+ }
30909
+ return value;
30910
+ }
30911
+ if (typeof value === "string" && value.match(/^0x([0-9a-f][0-9a-f])*$/i)) {
30912
+ const result = new Uint8Array((value.length - 2) / 2);
30913
+ let offset = 2;
30914
+ for (let i = 0; i < result.length; i++) {
30915
+ result[i] = parseInt(value.substring(offset, offset + 2), 16);
30916
+ offset += 2;
30917
+ }
30918
+ return result;
30919
+ }
30920
+ assertArgument(false, "invalid BytesLike value", name || "value", value);
30921
+ }
30922
+ function getBytes(value, name) {
30923
+ return _getBytes(value, name, false);
30924
+ }
30925
+
30926
+ // ../../node_modules/.pnpm/ethers@6.7.1/node_modules/ethers/lib.esm/utils/utf8.js
30927
+ function errorFunc(reason, offset, bytes2, output2, badCodepoint) {
30928
+ assertArgument(false, `invalid codepoint at offset ${offset}; ${reason}`, "bytes", bytes2);
30929
+ }
30930
+ function ignoreFunc(reason, offset, bytes2, output2, badCodepoint) {
30931
+ if (reason === "BAD_PREFIX" || reason === "UNEXPECTED_CONTINUE") {
30932
+ let i = 0;
30933
+ for (let o = offset + 1; o < bytes2.length; o++) {
30934
+ if (bytes2[o] >> 6 !== 2) {
30935
+ break;
30936
+ }
30937
+ i++;
30938
+ }
30939
+ return i;
30940
+ }
30941
+ if (reason === "OVERRUN") {
30942
+ return bytes2.length - offset - 1;
30943
+ }
30944
+ return 0;
30945
+ }
30946
+ function replaceFunc(reason, offset, bytes2, output2, badCodepoint) {
30947
+ if (reason === "OVERLONG") {
30948
+ assertArgument(typeof badCodepoint === "number", "invalid bad code point for replacement", "badCodepoint", badCodepoint);
30949
+ output2.push(badCodepoint);
30950
+ return 0;
30951
+ }
30952
+ output2.push(65533);
30953
+ return ignoreFunc(reason, offset, bytes2, output2, badCodepoint);
30954
+ }
30955
+ var Utf8ErrorFuncs = Object.freeze({
30956
+ error: errorFunc,
30957
+ ignore: ignoreFunc,
30958
+ replace: replaceFunc
30959
+ });
30960
+ function getUtf8CodePoints(_bytes, onError) {
30961
+ if (onError == null) {
30962
+ onError = Utf8ErrorFuncs.error;
30963
+ }
30964
+ const bytes2 = getBytes(_bytes, "bytes");
30965
+ const result = [];
30966
+ let i = 0;
30967
+ while (i < bytes2.length) {
30968
+ const c = bytes2[i++];
30969
+ if (c >> 7 === 0) {
30970
+ result.push(c);
30971
+ continue;
30972
+ }
30973
+ let extraLength = null;
30974
+ let overlongMask = null;
30975
+ if ((c & 224) === 192) {
30976
+ extraLength = 1;
30977
+ overlongMask = 127;
30978
+ } else if ((c & 240) === 224) {
30979
+ extraLength = 2;
30980
+ overlongMask = 2047;
30981
+ } else if ((c & 248) === 240) {
30982
+ extraLength = 3;
30983
+ overlongMask = 65535;
30984
+ } else {
30985
+ if ((c & 192) === 128) {
30986
+ i += onError("UNEXPECTED_CONTINUE", i - 1, bytes2, result);
30987
+ } else {
30988
+ i += onError("BAD_PREFIX", i - 1, bytes2, result);
30989
+ }
30990
+ continue;
30991
+ }
30992
+ if (i - 1 + extraLength >= bytes2.length) {
30993
+ i += onError("OVERRUN", i - 1, bytes2, result);
30994
+ continue;
30995
+ }
30996
+ let res = c & (1 << 8 - extraLength - 1) - 1;
30997
+ for (let j = 0; j < extraLength; j++) {
30998
+ let nextChar = bytes2[i];
30999
+ if ((nextChar & 192) != 128) {
31000
+ i += onError("MISSING_CONTINUE", i, bytes2, result);
31001
+ res = null;
31002
+ break;
31003
+ }
31004
+ ;
31005
+ res = res << 6 | nextChar & 63;
31006
+ i++;
31007
+ }
31008
+ if (res === null) {
31009
+ continue;
31010
+ }
31011
+ if (res > 1114111) {
31012
+ i += onError("OUT_OF_RANGE", i - 1 - extraLength, bytes2, result, res);
31013
+ continue;
31014
+ }
31015
+ if (res >= 55296 && res <= 57343) {
31016
+ i += onError("UTF16_SURROGATE", i - 1 - extraLength, bytes2, result, res);
31017
+ continue;
31018
+ }
31019
+ if (res <= overlongMask) {
31020
+ i += onError("OVERLONG", i - 1 - extraLength, bytes2, result, res);
31021
+ continue;
31022
+ }
31023
+ result.push(res);
31024
+ }
31025
+ return result;
31026
+ }
31027
+ function toUtf8Bytes(str, form) {
31028
+ if (form != null) {
31029
+ assertNormalize(form);
31030
+ str = str.normalize(form);
31031
+ }
31032
+ let result = [];
31033
+ for (let i = 0; i < str.length; i++) {
31034
+ const c = str.charCodeAt(i);
31035
+ if (c < 128) {
31036
+ result.push(c);
31037
+ } else if (c < 2048) {
31038
+ result.push(c >> 6 | 192);
31039
+ result.push(c & 63 | 128);
31040
+ } else if ((c & 64512) == 55296) {
31041
+ i++;
31042
+ const c2 = str.charCodeAt(i);
31043
+ assertArgument(i < str.length && (c2 & 64512) === 56320, "invalid surrogate pair", "str", str);
31044
+ const pair = 65536 + ((c & 1023) << 10) + (c2 & 1023);
31045
+ result.push(pair >> 18 | 240);
31046
+ result.push(pair >> 12 & 63 | 128);
31047
+ result.push(pair >> 6 & 63 | 128);
31048
+ result.push(pair & 63 | 128);
31049
+ } else {
31050
+ result.push(c >> 12 | 224);
31051
+ result.push(c >> 6 & 63 | 128);
31052
+ result.push(c & 63 | 128);
31053
+ }
31054
+ }
31055
+ return new Uint8Array(result);
31056
+ }
31057
+ function _toUtf8String(codePoints) {
31058
+ return codePoints.map((codePoint) => {
31059
+ if (codePoint <= 65535) {
31060
+ return String.fromCharCode(codePoint);
31061
+ }
31062
+ codePoint -= 65536;
31063
+ return String.fromCharCode((codePoint >> 10 & 1023) + 55296, (codePoint & 1023) + 56320);
31064
+ }).join("");
31065
+ }
31066
+ function toUtf8String(bytes2, onError) {
31067
+ return _toUtf8String(getUtf8CodePoints(bytes2, onError));
31068
+ }
31069
+
31330
31070
  // ../hasher/dist/index.mjs
31331
- function sha2563(data) {
31071
+ function sha2562(data) {
31332
31072
  return hexlify(sha256(arrayify(data)));
31333
31073
  }
31334
- function hash3(data) {
31335
- return sha2563(data);
31074
+ function hash2(data) {
31075
+ return sha2562(data);
31336
31076
  }
31337
31077
  function uint64ToBytesBE(value) {
31338
31078
  const bigIntValue = BigInt(value);
@@ -31342,7 +31082,7 @@ This unreleased fuel-core build may include features and updates not yet support
31342
31082
  return new Uint8Array(dataView.buffer);
31343
31083
  }
31344
31084
  function hashMessage(msg) {
31345
- return hash3(bufferFromString2(msg, "utf-8"));
31085
+ return hash2(bufferFromString2(msg, "utf-8"));
31346
31086
  }
31347
31087
 
31348
31088
  // ../abi-coder/dist/index.mjs
@@ -31450,24 +31190,24 @@ This unreleased fuel-core build may include features and updates not yet support
31450
31190
  super("bigNumber", baseType, encodedLengths[baseType]);
31451
31191
  }
31452
31192
  encode(value) {
31453
- let bytes3;
31193
+ let bytes2;
31454
31194
  try {
31455
- bytes3 = toBytes3(value, this.encodedLength);
31195
+ bytes2 = toBytes2(value, this.encodedLength);
31456
31196
  } catch (error) {
31457
31197
  throw new FuelError(ErrorCode.ENCODE_ERROR, `Invalid ${this.type}.`);
31458
31198
  }
31459
- return bytes3;
31199
+ return bytes2;
31460
31200
  }
31461
31201
  decode(data, offset) {
31462
31202
  if (data.length < this.encodedLength) {
31463
31203
  throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid ${this.type} data size.`);
31464
31204
  }
31465
- let bytes3 = data.slice(offset, offset + this.encodedLength);
31466
- bytes3 = bytes3.slice(0, this.encodedLength);
31467
- if (bytes3.length !== this.encodedLength) {
31205
+ let bytes2 = data.slice(offset, offset + this.encodedLength);
31206
+ bytes2 = bytes2.slice(0, this.encodedLength);
31207
+ if (bytes2.length !== this.encodedLength) {
31468
31208
  throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid ${this.type} byte data size.`);
31469
31209
  }
31470
- return [bn(bytes3), offset + this.encodedLength];
31210
+ return [bn(bytes2), offset + this.encodedLength];
31471
31211
  }
31472
31212
  };
31473
31213
  var VEC_PROPERTY_SPACE = 3;
@@ -31610,15 +31350,15 @@ This unreleased fuel-core build may include features and updates not yet support
31610
31350
  if (data.length < this.encodedLength) {
31611
31351
  throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid b256 data size.`);
31612
31352
  }
31613
- let bytes3 = data.slice(offset, offset + this.encodedLength);
31614
- const decoded = bn(bytes3);
31353
+ let bytes2 = data.slice(offset, offset + this.encodedLength);
31354
+ const decoded = bn(bytes2);
31615
31355
  if (decoded.isZero()) {
31616
- bytes3 = new Uint8Array(32);
31356
+ bytes2 = new Uint8Array(32);
31617
31357
  }
31618
- if (bytes3.length !== this.encodedLength) {
31358
+ if (bytes2.length !== this.encodedLength) {
31619
31359
  throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid b256 byte data size.`);
31620
31360
  }
31621
- return [toHex(bytes3, 32), offset + 32];
31361
+ return [toHex(bytes2, 32), offset + 32];
31622
31362
  }
31623
31363
  };
31624
31364
  var B512Coder = class extends Coder {
@@ -31641,15 +31381,15 @@ This unreleased fuel-core build may include features and updates not yet support
31641
31381
  if (data.length < this.encodedLength) {
31642
31382
  throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid b512 data size.`);
31643
31383
  }
31644
- let bytes3 = data.slice(offset, offset + this.encodedLength);
31645
- const decoded = bn(bytes3);
31384
+ let bytes2 = data.slice(offset, offset + this.encodedLength);
31385
+ const decoded = bn(bytes2);
31646
31386
  if (decoded.isZero()) {
31647
- bytes3 = new Uint8Array(64);
31387
+ bytes2 = new Uint8Array(64);
31648
31388
  }
31649
- if (bytes3.length !== this.encodedLength) {
31389
+ if (bytes2.length !== this.encodedLength) {
31650
31390
  throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid b512 byte data size.`);
31651
31391
  }
31652
- return [toHex(bytes3, this.encodedLength), offset + this.encodedLength];
31392
+ return [toHex(bytes2, this.encodedLength), offset + this.encodedLength];
31653
31393
  }
31654
31394
  };
31655
31395
  var BooleanCoder = class extends Coder {
@@ -31669,23 +31409,23 @@ This unreleased fuel-core build may include features and updates not yet support
31669
31409
  if (!isTrueBool) {
31670
31410
  throw new FuelError(ErrorCode.ENCODE_ERROR, `Invalid boolean value.`);
31671
31411
  }
31672
- const output3 = toBytes3(value ? 1 : 0, this.paddingLength);
31412
+ const output2 = toBytes2(value ? 1 : 0, this.paddingLength);
31673
31413
  if (this.options.isRightPadded) {
31674
- return output3.reverse();
31414
+ return output2.reverse();
31675
31415
  }
31676
- return output3;
31416
+ return output2;
31677
31417
  }
31678
31418
  decode(data, offset) {
31679
31419
  if (data.length < this.paddingLength) {
31680
31420
  throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid boolean data size.`);
31681
31421
  }
31682
- let bytes3;
31422
+ let bytes2;
31683
31423
  if (this.options.isRightPadded) {
31684
- bytes3 = data.slice(offset, offset + 1);
31424
+ bytes2 = data.slice(offset, offset + 1);
31685
31425
  } else {
31686
- bytes3 = data.slice(offset, offset + this.paddingLength);
31426
+ bytes2 = data.slice(offset, offset + this.paddingLength);
31687
31427
  }
31688
- const decodedValue = bn(bytes3);
31428
+ const decodedValue = bn(bytes2);
31689
31429
  if (decodedValue.isZero()) {
31690
31430
  return [false, offset + this.paddingLength];
31691
31431
  }
@@ -31792,7 +31532,7 @@ This unreleased fuel-core build may include features and updates not yet support
31792
31532
  let newOffset = offset;
31793
31533
  let decoded;
31794
31534
  [decoded, newOffset] = new BigNumberCoder("u64").decode(data, newOffset);
31795
- const caseIndex = toNumber2(decoded);
31535
+ const caseIndex = toNumber(decoded);
31796
31536
  const caseKey = Object.keys(this.coders)[caseIndex];
31797
31537
  if (!caseKey) {
31798
31538
  throw new FuelError(
@@ -31828,9 +31568,9 @@ This unreleased fuel-core build may include features and updates not yet support
31828
31568
  const [decoded, newOffset] = super.decode(data, offset);
31829
31569
  return [this.toOption(decoded), newOffset];
31830
31570
  }
31831
- toOption(output3) {
31832
- if (output3 && "Some" in output3) {
31833
- return output3.Some;
31571
+ toOption(output2) {
31572
+ if (output2 && "Some" in output2) {
31573
+ return output2.Some;
31834
31574
  }
31835
31575
  return void 0;
31836
31576
  }
@@ -31865,30 +31605,30 @@ This unreleased fuel-core build may include features and updates not yet support
31865
31605
  this.options = options;
31866
31606
  }
31867
31607
  encode(value) {
31868
- let bytes3;
31608
+ let bytes2;
31869
31609
  try {
31870
- bytes3 = toBytes3(value);
31610
+ bytes2 = toBytes2(value);
31871
31611
  } catch (error) {
31872
31612
  throw new FuelError(ErrorCode.ENCODE_ERROR, `Invalid ${this.baseType}.`);
31873
31613
  }
31874
- if (bytes3.length > this.length) {
31614
+ if (bytes2.length > this.length) {
31875
31615
  throw new FuelError(ErrorCode.ENCODE_ERROR, `Invalid ${this.baseType}, too many bytes.`);
31876
31616
  }
31877
- const output3 = toBytes3(bytes3, this.paddingLength);
31617
+ const output2 = toBytes2(bytes2, this.paddingLength);
31878
31618
  if (this.baseType !== "u8") {
31879
- return output3;
31619
+ return output2;
31880
31620
  }
31881
- return this.options.isRightPadded ? output3.reverse() : output3;
31621
+ return this.options.isRightPadded ? output2.reverse() : output2;
31882
31622
  }
31883
31623
  decodeU8(data, offset) {
31884
- let bytes3;
31624
+ let bytes2;
31885
31625
  if (this.options.isRightPadded) {
31886
- bytes3 = data.slice(offset, offset + 1);
31626
+ bytes2 = data.slice(offset, offset + 1);
31887
31627
  } else {
31888
- bytes3 = data.slice(offset, offset + this.paddingLength);
31889
- bytes3 = bytes3.slice(this.paddingLength - this.length, this.paddingLength);
31628
+ bytes2 = data.slice(offset, offset + this.paddingLength);
31629
+ bytes2 = bytes2.slice(this.paddingLength - this.length, this.paddingLength);
31890
31630
  }
31891
- return [toNumber2(bytes3), offset + this.paddingLength];
31631
+ return [toNumber(bytes2), offset + this.paddingLength];
31892
31632
  }
31893
31633
  decode(data, offset) {
31894
31634
  if (data.length < this.paddingLength) {
@@ -31897,12 +31637,12 @@ This unreleased fuel-core build may include features and updates not yet support
31897
31637
  if (this.baseType === "u8") {
31898
31638
  return this.decodeU8(data, offset);
31899
31639
  }
31900
- let bytes3 = data.slice(offset, offset + this.paddingLength);
31901
- bytes3 = bytes3.slice(8 - this.length, 8);
31902
- if (bytes3.length !== this.paddingLength - (this.paddingLength - this.length)) {
31640
+ let bytes2 = data.slice(offset, offset + this.paddingLength);
31641
+ bytes2 = bytes2.slice(8 - this.length, 8);
31642
+ if (bytes2.length !== this.paddingLength - (this.paddingLength - this.length)) {
31903
31643
  throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid number byte data size.`);
31904
31644
  }
31905
- return [toNumber2(bytes3), offset + 8];
31645
+ return [toNumber(bytes2), offset + 8];
31906
31646
  }
31907
31647
  };
31908
31648
  var RawSliceCoder = class extends Coder {
@@ -32000,11 +31740,11 @@ This unreleased fuel-core build may include features and updates not yet support
32000
31740
  if (data.length < this.encodedLength) {
32001
31741
  throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid string data size.`);
32002
31742
  }
32003
- const bytes3 = data.slice(offset, offset + this.length);
32004
- if (bytes3.length !== this.length) {
31743
+ const bytes2 = data.slice(offset, offset + this.length);
31744
+ if (bytes2.length !== this.length) {
32005
31745
  throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid string byte data size.`);
32006
31746
  }
32007
- const value = toUtf8String(bytes3);
31747
+ const value = toUtf8String(bytes2);
32008
31748
  const padding = this.#paddingLength;
32009
31749
  return [value, offset + this.length + padding];
32010
31750
  }
@@ -32415,17 +32155,17 @@ This unreleased fuel-core build may include features and updates not yet support
32415
32155
  if (!isTrueBool) {
32416
32156
  throw new FuelError(ErrorCode.ENCODE_ERROR, `Invalid boolean value.`);
32417
32157
  }
32418
- return toBytes3(value ? 1 : 0, this.encodedLength);
32158
+ return toBytes2(value ? 1 : 0, this.encodedLength);
32419
32159
  }
32420
32160
  decode(data, offset) {
32421
32161
  if (data.length < this.encodedLength) {
32422
32162
  throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid boolean data size.`);
32423
32163
  }
32424
- const bytes3 = bn(data.slice(offset, offset + this.encodedLength));
32425
- if (bytes3.isZero()) {
32164
+ const bytes2 = bn(data.slice(offset, offset + this.encodedLength));
32165
+ if (bytes2.isZero()) {
32426
32166
  return [false, offset + this.encodedLength];
32427
32167
  }
32428
- if (!bytes3.eq(bn(1))) {
32168
+ if (!bytes2.eq(bn(1))) {
32429
32169
  throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid boolean value.`);
32430
32170
  }
32431
32171
  return [true, offset + this.encodedLength];
@@ -32436,9 +32176,9 @@ This unreleased fuel-core build may include features and updates not yet support
32436
32176
  super("struct", "struct Bytes", WORD_SIZE);
32437
32177
  }
32438
32178
  encode(value) {
32439
- const bytes3 = value instanceof Uint8Array ? value : new Uint8Array(value);
32440
- const lengthBytes = new BigNumberCoder("u64").encode(bytes3.length);
32441
- return new Uint8Array([...lengthBytes, ...bytes3]);
32179
+ const bytes2 = value instanceof Uint8Array ? value : new Uint8Array(value);
32180
+ const lengthBytes = new BigNumberCoder("u64").encode(bytes2.length);
32181
+ return new Uint8Array([...lengthBytes, ...bytes2]);
32442
32182
  }
32443
32183
  decode(data, offset) {
32444
32184
  if (data.length < WORD_SIZE) {
@@ -32507,7 +32247,7 @@ This unreleased fuel-core build may include features and updates not yet support
32507
32247
  throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid enum data size.`);
32508
32248
  }
32509
32249
  const caseBytes = new BigNumberCoder("u64").decode(data, offset)[0];
32510
- const caseIndex = toNumber2(caseBytes);
32250
+ const caseIndex = toNumber(caseBytes);
32511
32251
  const caseKey = Object.keys(this.coders)[caseIndex];
32512
32252
  if (!caseKey) {
32513
32253
  throw new FuelError(
@@ -32546,26 +32286,26 @@ This unreleased fuel-core build may include features and updates not yet support
32546
32286
  this.length = length;
32547
32287
  }
32548
32288
  encode(value) {
32549
- let bytes3;
32289
+ let bytes2;
32550
32290
  try {
32551
- bytes3 = toBytes3(value);
32291
+ bytes2 = toBytes2(value);
32552
32292
  } catch (error) {
32553
32293
  throw new FuelError(ErrorCode.ENCODE_ERROR, `Invalid ${this.baseType}.`);
32554
32294
  }
32555
- if (bytes3.length > this.length) {
32295
+ if (bytes2.length > this.length) {
32556
32296
  throw new FuelError(ErrorCode.ENCODE_ERROR, `Invalid ${this.baseType}, too many bytes.`);
32557
32297
  }
32558
- return toBytes3(bytes3, this.length);
32298
+ return toBytes2(bytes2, this.length);
32559
32299
  }
32560
32300
  decode(data, offset) {
32561
32301
  if (data.length < this.encodedLength) {
32562
32302
  throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid number data size.`);
32563
32303
  }
32564
- const bytes3 = data.slice(offset, offset + this.length);
32565
- if (bytes3.length !== this.encodedLength) {
32304
+ const bytes2 = data.slice(offset, offset + this.length);
32305
+ if (bytes2.length !== this.encodedLength) {
32566
32306
  throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid number byte data size.`);
32567
32307
  }
32568
- return [toNumber2(bytes3), offset + this.length];
32308
+ return [toNumber(bytes2), offset + this.length];
32569
32309
  }
32570
32310
  };
32571
32311
  var OptionCoder2 = class extends EnumCoder2 {
@@ -32583,9 +32323,9 @@ This unreleased fuel-core build may include features and updates not yet support
32583
32323
  const [decoded, newOffset] = super.decode(data, offset);
32584
32324
  return [this.toOption(decoded), newOffset];
32585
32325
  }
32586
- toOption(output3) {
32587
- if (output3 && "Some" in output3) {
32588
- return output3.Some;
32326
+ toOption(output2) {
32327
+ if (output2 && "Some" in output2) {
32328
+ return output2.Some;
32589
32329
  }
32590
32330
  return void 0;
32591
32331
  }
@@ -32599,9 +32339,9 @@ This unreleased fuel-core build may include features and updates not yet support
32599
32339
  throw new FuelError(ErrorCode.ENCODE_ERROR, `Expected array value.`);
32600
32340
  }
32601
32341
  const internalCoder = new ArrayCoder(new NumberCoder2("u8"), value.length);
32602
- const bytes3 = internalCoder.encode(value);
32603
- const lengthBytes = new BigNumberCoder("u64").encode(bytes3.length);
32604
- return new Uint8Array([...lengthBytes, ...bytes3]);
32342
+ const bytes2 = internalCoder.encode(value);
32343
+ const lengthBytes = new BigNumberCoder("u64").encode(bytes2.length);
32344
+ return new Uint8Array([...lengthBytes, ...bytes2]);
32605
32345
  }
32606
32346
  decode(data, offset) {
32607
32347
  if (data.length < this.encodedLength) {
@@ -32624,9 +32364,9 @@ This unreleased fuel-core build may include features and updates not yet support
32624
32364
  super("struct", "struct String", WORD_SIZE);
32625
32365
  }
32626
32366
  encode(value) {
32627
- const bytes3 = toUtf8Bytes(value);
32367
+ const bytes2 = toUtf8Bytes(value);
32628
32368
  const lengthBytes = new BigNumberCoder("u64").encode(value.length);
32629
- return new Uint8Array([...lengthBytes, ...bytes3]);
32369
+ return new Uint8Array([...lengthBytes, ...bytes2]);
32630
32370
  }
32631
32371
  decode(data, offset) {
32632
32372
  if (data.length < this.encodedLength) {
@@ -32648,9 +32388,9 @@ This unreleased fuel-core build may include features and updates not yet support
32648
32388
  super("strSlice", "str", WORD_SIZE);
32649
32389
  }
32650
32390
  encode(value) {
32651
- const bytes3 = toUtf8Bytes(value);
32391
+ const bytes2 = toUtf8Bytes(value);
32652
32392
  const lengthBytes = new BigNumberCoder("u64").encode(value.length);
32653
- return new Uint8Array([...lengthBytes, ...bytes3]);
32393
+ return new Uint8Array([...lengthBytes, ...bytes2]);
32654
32394
  }
32655
32395
  decode(data, offset) {
32656
32396
  if (data.length < this.encodedLength) {
@@ -32659,11 +32399,11 @@ This unreleased fuel-core build may include features and updates not yet support
32659
32399
  const offsetAndLength = offset + WORD_SIZE;
32660
32400
  const lengthBytes = data.slice(offset, offsetAndLength);
32661
32401
  const length = bn(new BigNumberCoder("u64").decode(lengthBytes, 0)[0]).toNumber();
32662
- const bytes3 = data.slice(offsetAndLength, offsetAndLength + length);
32663
- if (bytes3.length !== length) {
32402
+ const bytes2 = data.slice(offsetAndLength, offsetAndLength + length);
32403
+ if (bytes2.length !== length) {
32664
32404
  throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid string slice byte data size.`);
32665
32405
  }
32666
- return [toUtf8String(bytes3), offsetAndLength + length];
32406
+ return [toUtf8String(bytes2), offsetAndLength + length];
32667
32407
  }
32668
32408
  };
32669
32409
  __publicField4(StrSliceCoder, "memorySize", 1);
@@ -32681,11 +32421,11 @@ This unreleased fuel-core build may include features and updates not yet support
32681
32421
  if (data.length < this.encodedLength) {
32682
32422
  throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid string data size.`);
32683
32423
  }
32684
- const bytes3 = data.slice(offset, offset + this.encodedLength);
32685
- if (bytes3.length !== this.encodedLength) {
32424
+ const bytes2 = data.slice(offset, offset + this.encodedLength);
32425
+ if (bytes2.length !== this.encodedLength) {
32686
32426
  throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid string byte data size.`);
32687
32427
  }
32688
- return [toUtf8String(bytes3), offset + this.encodedLength];
32428
+ return [toUtf8String(bytes2), offset + this.encodedLength];
32689
32429
  }
32690
32430
  };
32691
32431
  var StructCoder2 = class extends Coder {
@@ -32765,12 +32505,19 @@ This unreleased fuel-core build may include features and updates not yet support
32765
32505
  this.#isOptionVec = this.coder instanceof OptionCoder2;
32766
32506
  }
32767
32507
  encode(value) {
32768
- if (!Array.isArray(value)) {
32769
- throw new FuelError(ErrorCode.ENCODE_ERROR, `Expected array value.`);
32508
+ if (!Array.isArray(value) && !isUint8Array(value)) {
32509
+ throw new FuelError(
32510
+ ErrorCode.ENCODE_ERROR,
32511
+ `Expected array value, or a Uint8Array. You can use arrayify to convert a value to a Uint8Array.`
32512
+ );
32770
32513
  }
32771
- const bytes3 = value.map((v) => this.coder.encode(v));
32772
- const lengthBytes = new BigNumberCoder("u64").encode(value.length);
32773
- return new Uint8Array([...lengthBytes, ...concatBytes2(bytes3)]);
32514
+ const lengthCoder = new BigNumberCoder("u64");
32515
+ if (isUint8Array(value)) {
32516
+ return new Uint8Array([...lengthCoder.encode(value.length), ...value]);
32517
+ }
32518
+ const bytes2 = value.map((v) => this.coder.encode(v));
32519
+ const lengthBytes = lengthCoder.encode(value.length);
32520
+ return new Uint8Array([...lengthBytes, ...concatBytes2(bytes2)]);
32774
32521
  }
32775
32522
  decode(data, offset) {
32776
32523
  if (!this.#isOptionVec && (data.length < this.encodedLength || data.length > MAX_BYTES)) {
@@ -32933,7 +32680,7 @@ This unreleased fuel-core build may include features and updates not yet support
32933
32680
  return `${fn.name}(${inputsSignatures.join(",")})`;
32934
32681
  }
32935
32682
  static getFunctionSelector(functionSignature) {
32936
- const hashedFunctionSignature = sha2563(bufferFromString2(functionSignature, "utf-8"));
32683
+ const hashedFunctionSignature = sha2562(bufferFromString2(functionSignature, "utf-8"));
32937
32684
  return bn(hashedFunctionSignature.slice(0, 10)).toHex(8);
32938
32685
  }
32939
32686
  #isInputDataPointer() {
@@ -32996,10 +32743,10 @@ This unreleased fuel-core build may include features and updates not yet support
32996
32743
  throw new FuelError(ErrorCode.ABI_TYPES_AND_VALUES_MISMATCH, errorMsg);
32997
32744
  }
32998
32745
  decodeArguments(data) {
32999
- const bytes3 = arrayify(data);
32746
+ const bytes2 = arrayify(data);
33000
32747
  const nonEmptyInputs = findNonEmptyInputs(this.jsonAbi, this.jsonFn.inputs);
33001
32748
  if (nonEmptyInputs.length === 0) {
33002
- if (bytes3.length === 0) {
32749
+ if (bytes2.length === 0) {
33003
32750
  return void 0;
33004
32751
  }
33005
32752
  throw new FuelError(
@@ -33008,12 +32755,12 @@ This unreleased fuel-core build may include features and updates not yet support
33008
32755
  count: {
33009
32756
  types: this.jsonFn.inputs.length,
33010
32757
  nonEmptyInputs: nonEmptyInputs.length,
33011
- values: bytes3.length
32758
+ values: bytes2.length
33012
32759
  },
33013
32760
  value: {
33014
32761
  args: this.jsonFn.inputs,
33015
32762
  nonEmptyInputs,
33016
- values: bytes3
32763
+ values: bytes2
33017
32764
  }
33018
32765
  })}`
33019
32766
  );
@@ -33021,7 +32768,7 @@ This unreleased fuel-core build may include features and updates not yet support
33021
32768
  const result = nonEmptyInputs.reduce(
33022
32769
  (obj, input) => {
33023
32770
  const coder = AbiCoder.getCoder(this.jsonAbi, input, { encoding: this.encoding });
33024
- const [decodedValue, decodedValueByteSize] = coder.decode(bytes3, obj.offset);
32771
+ const [decodedValue, decodedValueByteSize] = coder.decode(bytes2, obj.offset);
33025
32772
  return {
33026
32773
  decoded: [...obj.decoded, decodedValue],
33027
32774
  offset: obj.offset + decodedValueByteSize
@@ -33036,11 +32783,11 @@ This unreleased fuel-core build may include features and updates not yet support
33036
32783
  if (outputAbiType.type === "()") {
33037
32784
  return [void 0, 0];
33038
32785
  }
33039
- const bytes3 = arrayify(data);
32786
+ const bytes2 = arrayify(data);
33040
32787
  const coder = AbiCoder.getCoder(this.jsonAbi, this.jsonFn.output, {
33041
32788
  encoding: this.encoding
33042
32789
  });
33043
- return coder.decode(bytes3, 0);
32790
+ return coder.decode(bytes2, 0);
33044
32791
  }
33045
32792
  /**
33046
32793
  * Checks if the function is read-only i.e. it only reads from storage, does not write to it.
@@ -33301,12 +33048,12 @@ This unreleased fuel-core build may include features and updates not yet support
33301
33048
  parts.push(new ByteArrayCoder(32).encode(value.nonce));
33302
33049
  parts.push(new BigNumberCoder("u64").encode(value.amount));
33303
33050
  parts.push(arrayify(value.data || "0x"));
33304
- return sha2563(concat(parts));
33051
+ return sha2562(concat(parts));
33305
33052
  }
33306
33053
  static encodeData(messageData) {
33307
- const bytes3 = arrayify(messageData || "0x");
33308
- const dataLength2 = bytes3.length;
33309
- return new ByteArrayCoder(dataLength2).encode(bytes3);
33054
+ const bytes2 = arrayify(messageData || "0x");
33055
+ const dataLength2 = bytes2.length;
33056
+ return new ByteArrayCoder(dataLength2).encode(bytes2);
33310
33057
  }
33311
33058
  encode(value) {
33312
33059
  const parts = [];
@@ -33328,9 +33075,9 @@ This unreleased fuel-core build may include features and updates not yet support
33328
33075
  return concat(parts);
33329
33076
  }
33330
33077
  static decodeData(messageData) {
33331
- const bytes3 = arrayify(messageData);
33332
- const dataLength2 = bytes3.length;
33333
- const [data] = new ByteArrayCoder(dataLength2).decode(bytes3, 0);
33078
+ const bytes2 = arrayify(messageData);
33079
+ const dataLength2 = bytes2.length;
33080
+ const [data] = new ByteArrayCoder(dataLength2).decode(bytes2, 0);
33334
33081
  return arrayify(data);
33335
33082
  }
33336
33083
  decode(data, offset) {
@@ -33767,7 +33514,7 @@ This unreleased fuel-core build may include features and updates not yet support
33767
33514
  parts.push(new ByteArrayCoder(32).encode(value.nonce));
33768
33515
  parts.push(new BigNumberCoder("u64").encode(value.amount));
33769
33516
  parts.push(arrayify(value.data || "0x"));
33770
- return sha2563(concat(parts));
33517
+ return sha2562(concat(parts));
33771
33518
  }
33772
33519
  encode(value) {
33773
33520
  const parts = [];
@@ -33814,7 +33561,7 @@ This unreleased fuel-core build may include features and updates not yet support
33814
33561
  var getMintedAssetId = (contractId, subId) => {
33815
33562
  const contractIdBytes = arrayify(contractId);
33816
33563
  const subIdBytes = arrayify(subId);
33817
- return sha2563(concat([contractIdBytes, subIdBytes]));
33564
+ return sha2562(concat([contractIdBytes, subIdBytes]));
33818
33565
  };
33819
33566
  var ReceiptMintCoder = class extends Coder {
33820
33567
  constructor() {
@@ -34428,7 +34175,7 @@ This unreleased fuel-core build may include features and updates not yet support
34428
34175
  numberToBytesLE: () => numberToBytesLE,
34429
34176
  numberToHexUnpadded: () => numberToHexUnpadded,
34430
34177
  numberToVarBytesBE: () => numberToVarBytesBE,
34431
- utf8ToBytes: () => utf8ToBytes3,
34178
+ utf8ToBytes: () => utf8ToBytes2,
34432
34179
  validateObject: () => validateObject
34433
34180
  });
34434
34181
  var _0n2 = BigInt(0);
@@ -34437,13 +34184,13 @@ This unreleased fuel-core build may include features and updates not yet support
34437
34184
  function isBytes3(a) {
34438
34185
  return a instanceof Uint8Array || a != null && typeof a === "object" && a.constructor.name === "Uint8Array";
34439
34186
  }
34440
- var hexes2 = /* @__PURE__ */ Array.from({ length: 256 }, (_, i) => i.toString(16).padStart(2, "0"));
34441
- function bytesToHex(bytes3) {
34442
- if (!isBytes3(bytes3))
34187
+ var hexes = /* @__PURE__ */ Array.from({ length: 256 }, (_, i) => i.toString(16).padStart(2, "0"));
34188
+ function bytesToHex(bytes2) {
34189
+ if (!isBytes3(bytes2))
34443
34190
  throw new Error("Uint8Array expected");
34444
34191
  let hex = "";
34445
- for (let i = 0; i < bytes3.length; i++) {
34446
- hex += hexes2[bytes3[i]];
34192
+ for (let i = 0; i < bytes2.length; i++) {
34193
+ hex += hexes[bytes2[i]];
34447
34194
  }
34448
34195
  return hex;
34449
34196
  }
@@ -34485,13 +34232,13 @@ This unreleased fuel-core build may include features and updates not yet support
34485
34232
  }
34486
34233
  return array;
34487
34234
  }
34488
- function bytesToNumberBE(bytes3) {
34489
- return hexToNumber(bytesToHex(bytes3));
34235
+ function bytesToNumberBE(bytes2) {
34236
+ return hexToNumber(bytesToHex(bytes2));
34490
34237
  }
34491
- function bytesToNumberLE(bytes3) {
34492
- if (!isBytes3(bytes3))
34238
+ function bytesToNumberLE(bytes2) {
34239
+ if (!isBytes3(bytes2))
34493
34240
  throw new Error("Uint8Array expected");
34494
- return hexToNumber(bytesToHex(Uint8Array.from(bytes3).reverse()));
34241
+ return hexToNumber(bytesToHex(Uint8Array.from(bytes2).reverse()));
34495
34242
  }
34496
34243
  function numberToBytesBE(n, len) {
34497
34244
  return hexToBytes(n.toString(16).padStart(len * 2, "0"));
@@ -34545,7 +34292,7 @@ This unreleased fuel-core build may include features and updates not yet support
34545
34292
  diff |= a[i] ^ b[i];
34546
34293
  return diff === 0;
34547
34294
  }
34548
- function utf8ToBytes3(str) {
34295
+ function utf8ToBytes2(str) {
34549
34296
  if (typeof str !== "string")
34550
34297
  throw new Error(`utf8ToBytes expected string, got ${typeof str}`);
34551
34298
  return new Uint8Array(new TextEncoder().encode(str));
@@ -34864,19 +34611,19 @@ This unreleased fuel-core build may include features and updates not yet support
34864
34611
  return "GraphQLError";
34865
34612
  }
34866
34613
  toString() {
34867
- let output3 = this.message;
34614
+ let output2 = this.message;
34868
34615
  if (this.nodes) {
34869
34616
  for (const node of this.nodes) {
34870
34617
  if (node.loc) {
34871
- output3 += "\n\n" + printLocation(node.loc);
34618
+ output2 += "\n\n" + printLocation(node.loc);
34872
34619
  }
34873
34620
  }
34874
34621
  } else if (this.source && this.locations) {
34875
34622
  for (const location of this.locations) {
34876
- output3 += "\n\n" + printSourceLocation(this.source, location);
34623
+ output2 += "\n\n" + printSourceLocation(this.source, location);
34877
34624
  }
34878
34625
  }
34879
- return output3;
34626
+ return output2;
34880
34627
  }
34881
34628
  toJSON() {
34882
34629
  const formattedError = {
@@ -38890,13 +38637,13 @@ ${MessageCoinFragmentDoc}`;
38890
38637
  return {
38891
38638
  type: InputType.Coin,
38892
38639
  txID: hexlify(arrayify(value.id).slice(0, BYTES_32)),
38893
- outputIndex: toNumber2(arrayify(value.id).slice(BYTES_32, UTXO_ID_LEN)),
38640
+ outputIndex: toNumber(arrayify(value.id).slice(BYTES_32, UTXO_ID_LEN)),
38894
38641
  owner: hexlify(value.owner),
38895
38642
  amount: bn(value.amount),
38896
38643
  assetId: hexlify(value.assetId),
38897
38644
  txPointer: {
38898
- blockHeight: toNumber2(arrayify(value.txPointer).slice(0, 8)),
38899
- txIndex: toNumber2(arrayify(value.txPointer).slice(8, 16))
38645
+ blockHeight: toNumber(arrayify(value.txPointer).slice(0, 8)),
38646
+ txIndex: toNumber(arrayify(value.txPointer).slice(8, 16))
38900
38647
  },
38901
38648
  witnessIndex: value.witnessIndex,
38902
38649
  predicateGasUsed: bn(value.predicateGasUsed),
@@ -38914,8 +38661,8 @@ ${MessageCoinFragmentDoc}`;
38914
38661
  balanceRoot: ZeroBytes32,
38915
38662
  stateRoot: ZeroBytes32,
38916
38663
  txPointer: {
38917
- blockHeight: toNumber2(arrayify(value.txPointer).slice(0, 8)),
38918
- txIndex: toNumber2(arrayify(value.txPointer).slice(8, 16))
38664
+ blockHeight: toNumber(arrayify(value.txPointer).slice(0, 8)),
38665
+ txIndex: toNumber(arrayify(value.txPointer).slice(8, 16))
38919
38666
  },
38920
38667
  contractID: hexlify(value.contractId)
38921
38668
  };
@@ -39550,6 +39297,50 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
39550
39297
  name = "NoWitnessByOwnerError";
39551
39298
  };
39552
39299
 
39300
+ // src/providers/transaction-request/helpers.ts
39301
+ var isRequestInputCoin = (input) => input.type === InputType.Coin;
39302
+ var isRequestInputMessage = (input) => input.type === InputType.Message;
39303
+ var isRequestInputResource = (input) => isRequestInputCoin(input) || isRequestInputMessage(input);
39304
+ var getRequestInputResourceOwner = (input) => isRequestInputCoin(input) ? input.owner : input.recipient;
39305
+ var isRequestInputResourceFromOwner = (input, owner) => getRequestInputResourceOwner(input) === owner.toB256();
39306
+ var getAssetAmountInRequestInputs = (inputs, assetId, baseAsset) => inputs.filter(isRequestInputResource).reduce((acc, input) => {
39307
+ if (isRequestInputCoin(input) && input.assetId === assetId) {
39308
+ return acc.add(input.amount);
39309
+ }
39310
+ if (isRequestInputMessage(input) && assetId === baseAsset) {
39311
+ return acc.add(input.amount);
39312
+ }
39313
+ return acc;
39314
+ }, bn(0));
39315
+ var cacheRequestInputsResources = (inputs) => inputs.filter(isRequestInputResource).reduce(
39316
+ (cache2, input) => {
39317
+ if (isRequestInputCoin(input)) {
39318
+ cache2.utxos.push(input.id);
39319
+ } else {
39320
+ cache2.messages.push(input.nonce);
39321
+ }
39322
+ return cache2;
39323
+ },
39324
+ {
39325
+ utxos: [],
39326
+ messages: []
39327
+ }
39328
+ );
39329
+ var cacheRequestInputsResourcesFromOwner = (inputs, owner) => inputs.reduce(
39330
+ (acc, input) => {
39331
+ if (isRequestInputCoin(input) && input.owner === owner.toB256()) {
39332
+ acc.utxos.push(input.id);
39333
+ } else if (isRequestInputMessage(input) && input.recipient === owner.toB256()) {
39334
+ acc.messages.push(input.nonce);
39335
+ }
39336
+ return acc;
39337
+ },
39338
+ {
39339
+ utxos: [],
39340
+ messages: []
39341
+ }
39342
+ );
39343
+
39553
39344
  // src/providers/transaction-request/witness.ts
39554
39345
  var witnessify = (value) => {
39555
39346
  const data = arrayify(value);
@@ -39663,8 +39454,8 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
39663
39454
  *
39664
39455
  * Pushes an output to the list without any side effects and returns the index
39665
39456
  */
39666
- pushOutput(output3) {
39667
- this.outputs.push(output3);
39457
+ pushOutput(output2) {
39458
+ this.outputs.push(output2);
39668
39459
  return this.outputs.length - 1;
39669
39460
  }
39670
39461
  /**
@@ -39748,7 +39539,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
39748
39539
  */
39749
39540
  getCoinOutputs() {
39750
39541
  return this.outputs.filter(
39751
- (output3) => output3.type === OutputType.Coin
39542
+ (output2) => output2.type === OutputType.Coin
39752
39543
  );
39753
39544
  }
39754
39545
  /**
@@ -39758,7 +39549,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
39758
39549
  */
39759
39550
  getChangeOutputs() {
39760
39551
  return this.outputs.filter(
39761
- (output3) => output3.type === OutputType.Change
39552
+ (output2) => output2.type === OutputType.Change
39762
39553
  );
39763
39554
  }
39764
39555
  /**
@@ -39787,7 +39578,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
39787
39578
  * @param coin - Coin resource.
39788
39579
  */
39789
39580
  addCoinInput(coin) {
39790
- const { assetId, owner, amount } = coin;
39581
+ const { assetId, owner, amount, id, predicate } = coin;
39791
39582
  let witnessIndex;
39792
39583
  if (coin.predicate) {
39793
39584
  witnessIndex = 0;
@@ -39798,13 +39589,14 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
39798
39589
  }
39799
39590
  }
39800
39591
  const input = {
39801
- ...coin,
39592
+ id,
39802
39593
  type: InputType.Coin,
39803
39594
  owner: owner.toB256(),
39804
39595
  amount,
39805
39596
  assetId,
39806
39597
  txPointer: "0x00000000000000000000000000000000",
39807
- witnessIndex
39598
+ witnessIndex,
39599
+ predicate
39808
39600
  };
39809
39601
  this.pushInput(input);
39810
39602
  this.addChangeOutput(owner, assetId);
@@ -39816,7 +39608,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
39816
39608
  * @param message - Message resource.
39817
39609
  */
39818
39610
  addMessageInput(message) {
39819
- const { recipient, sender, amount, assetId } = message;
39611
+ const { recipient, sender, amount, predicate, nonce, assetId } = message;
39820
39612
  let witnessIndex;
39821
39613
  if (message.predicate) {
39822
39614
  witnessIndex = 0;
@@ -39827,12 +39619,13 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
39827
39619
  }
39828
39620
  }
39829
39621
  const input = {
39830
- ...message,
39622
+ nonce,
39831
39623
  type: InputType.Message,
39832
39624
  sender: sender.toB256(),
39833
39625
  recipient: recipient.toB256(),
39834
39626
  amount,
39835
- witnessIndex
39627
+ witnessIndex,
39628
+ predicate
39836
39629
  };
39837
39630
  this.pushInput(input);
39838
39631
  this.addChangeOutput(recipient, assetId);
@@ -39904,7 +39697,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
39904
39697
  */
39905
39698
  addChangeOutput(to, assetId) {
39906
39699
  const changeOutput = this.getChangeOutputs().find(
39907
- (output3) => hexlify(output3.assetId) === assetId
39700
+ (output2) => hexlify(output2.assetId) === assetId
39908
39701
  );
39909
39702
  if (!changeOutput) {
39910
39703
  this.pushOutput({
@@ -40022,6 +39815,17 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
40022
39815
  toJSON() {
40023
39816
  return normalizeJSON(this);
40024
39817
  }
39818
+ removeWitness(index) {
39819
+ this.witnesses.splice(index, 1);
39820
+ this.adjustWitnessIndexes(index);
39821
+ }
39822
+ adjustWitnessIndexes(removedIndex) {
39823
+ this.inputs.filter(isRequestInputResource).forEach((input) => {
39824
+ if (input.witnessIndex > removedIndex) {
39825
+ input.witnessIndex -= 1;
39826
+ }
39827
+ });
39828
+ }
40025
39829
  updatePredicateGasUsed(inputs) {
40026
39830
  this.inputs.forEach((i) => {
40027
39831
  let correspondingInput;
@@ -40091,8 +39895,8 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
40091
39895
  return inputClone;
40092
39896
  }
40093
39897
  });
40094
- transaction.outputs = transaction.outputs.map((output3) => {
40095
- const outputClone = clone_default(output3);
39898
+ transaction.outputs = transaction.outputs.map((output2) => {
39899
+ const outputClone = clone_default(output2);
40096
39900
  switch (outputClone.type) {
40097
39901
  case OutputType.Contract: {
40098
39902
  outputClone.balanceRoot = ZeroBytes32;
@@ -40117,7 +39921,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
40117
39921
  transaction.witnesses = [];
40118
39922
  const chainIdBytes = uint64ToBytesBE(chainId);
40119
39923
  const concatenatedData = concat([chainIdBytes, new TransactionCoder().encode(transaction)]);
40120
- return sha2563(concatenatedData);
39924
+ return sha2562(concatenatedData);
40121
39925
  }
40122
39926
 
40123
39927
  // src/providers/transaction-request/storage-slot.ts
@@ -40194,7 +39998,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
40194
39998
  */
40195
39999
  getContractCreatedOutputs() {
40196
40000
  return this.outputs.filter(
40197
- (output3) => output3.type === OutputType.ContractCreated
40001
+ (output2) => output2.type === OutputType.ContractCreated
40198
40002
  );
40199
40003
  }
40200
40004
  /**
@@ -40320,7 +40124,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
40320
40124
  */
40321
40125
  getContractOutputs() {
40322
40126
  return this.outputs.filter(
40323
- (output3) => output3.type === OutputType.Contract
40127
+ (output2) => output2.type === OutputType.Contract
40324
40128
  );
40325
40129
  }
40326
40130
  /**
@@ -40330,7 +40134,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
40330
40134
  */
40331
40135
  getVariableOutputs() {
40332
40136
  return this.outputs.filter(
40333
- (output3) => output3.type === OutputType.Variable
40137
+ (output2) => output2.type === OutputType.Variable
40334
40138
  );
40335
40139
  }
40336
40140
  /**
@@ -40448,21 +40252,6 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
40448
40252
  }
40449
40253
  }
40450
40254
  };
40451
- var cacheTxInputsFromOwner = (inputs, owner) => inputs.reduce(
40452
- (acc, input) => {
40453
- if (input.type === InputType.Coin && input.owner === owner.toB256()) {
40454
- acc.utxos.push(input.id);
40455
- }
40456
- if (input.type === InputType.Message && input.recipient === owner.toB256()) {
40457
- acc.messages.push(input.nonce);
40458
- }
40459
- return acc;
40460
- },
40461
- {
40462
- utxos: [],
40463
- messages: []
40464
- }
40465
- );
40466
40255
 
40467
40256
  // src/providers/transaction-summary/calculate-tx-fee-for-summary.ts
40468
40257
  var calculateTXFeeForSummary = (params) => {
@@ -40820,8 +40609,8 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
40820
40609
  }) {
40821
40610
  const contractCallReceipts = getReceiptsCall(receipts);
40822
40611
  const contractOutputs = getOutputsContract(outputs);
40823
- const contractCallOperations = contractOutputs.reduce((prevOutputCallOps, output3) => {
40824
- const contractInput = getInputContractFromIndex(inputs, output3.inputIndex);
40612
+ const contractCallOperations = contractOutputs.reduce((prevOutputCallOps, output2) => {
40613
+ const contractInput = getInputContractFromIndex(inputs, output2.inputIndex);
40825
40614
  if (contractInput) {
40826
40615
  const newCallOps = contractCallReceipts.reduce((prevContractCallOps, receipt) => {
40827
40616
  if (receipt.to === contractInput.contractID) {
@@ -40875,7 +40664,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
40875
40664
  let { from: fromAddress } = receipt;
40876
40665
  const toType = contractInputs.some((input) => input.contractID === toAddress) ? 0 /* contract */ : 1 /* account */;
40877
40666
  if (ZeroBytes32 === fromAddress) {
40878
- const change = changeOutputs.find((output3) => output3.assetId === assetId);
40667
+ const change = changeOutputs.find((output2) => output2.assetId === assetId);
40879
40668
  fromAddress = change?.to || fromAddress;
40880
40669
  }
40881
40670
  const fromType = contractInputs.some((input) => input.contractID === fromAddress) ? 0 /* contract */ : 1 /* account */;
@@ -40906,8 +40695,8 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
40906
40695
  const coinOutputs = getOutputsCoin(outputs);
40907
40696
  const contractInputs = getInputsContract(inputs);
40908
40697
  const changeOutputs = getOutputsChange(outputs);
40909
- coinOutputs.forEach((output3) => {
40910
- const { amount, assetId, to } = output3;
40698
+ coinOutputs.forEach((output2) => {
40699
+ const { amount, assetId, to } = output2;
40911
40700
  const changeOutput = changeOutputs.find((change) => change.assetId === assetId);
40912
40701
  if (changeOutput) {
40913
40702
  operations = addOperation(operations, {
@@ -40945,7 +40734,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
40945
40734
  }
40946
40735
  function getPayProducerOperations(outputs) {
40947
40736
  const coinOutputs = getOutputsCoin(outputs);
40948
- const payProducerOperations = coinOutputs.reduce((prev, output3) => {
40737
+ const payProducerOperations = coinOutputs.reduce((prev, output2) => {
40949
40738
  const operations = addOperation(prev, {
40950
40739
  name: "Pay network fee to block producer" /* payBlockProducer */,
40951
40740
  from: {
@@ -40954,12 +40743,12 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
40954
40743
  },
40955
40744
  to: {
40956
40745
  type: 1 /* account */,
40957
- address: output3.to.toString()
40746
+ address: output2.to.toString()
40958
40747
  },
40959
40748
  assetsSent: [
40960
40749
  {
40961
- assetId: output3.assetId.toString(),
40962
- amount: output3.amount
40750
+ assetId: output2.assetId.toString(),
40751
+ amount: output2.amount
40963
40752
  }
40964
40753
  ]
40965
40754
  });
@@ -42685,11 +42474,11 @@ Supported fuel-core version: ${supportedVersion}.`
42685
42474
  maxGasPerTx,
42686
42475
  gasPrice
42687
42476
  });
42688
- const output3 = {
42477
+ const output2 = {
42689
42478
  gqlTransaction,
42690
42479
  ...transactionSummary
42691
42480
  };
42692
- return output3;
42481
+ return output2;
42693
42482
  });
42694
42483
  return {
42695
42484
  transactions,
@@ -42822,20 +42611,6 @@ Supported fuel-core version: ${supportedVersion}.`
42822
42611
  ];
42823
42612
  var assets = resolveIconPaths(rawAssets, fuelAssetsBaseUrl);
42824
42613
 
42825
- // src/providers/transaction-request/helpers.ts
42826
- var isRequestInputCoin = (input) => input.type === InputType.Coin;
42827
- var isRequestInputMessage = (input) => input.type === InputType.Message;
42828
- var isRequestInputResource = (input) => isRequestInputCoin(input) || isRequestInputMessage(input);
42829
- var getAssetAmountInRequestInputs = (inputs, assetId, baseAsset) => inputs.filter(isRequestInputResource).reduce((acc, input) => {
42830
- if (isRequestInputCoin(input) && input.assetId === assetId) {
42831
- return acc.add(input.amount);
42832
- }
42833
- if (isRequestInputMessage(input) && assetId === baseAsset) {
42834
- return acc.add(input.amount);
42835
- }
42836
- return acc;
42837
- }, bn(0));
42838
-
42839
42614
  // src/utils/formatTransferToContractScriptData.ts
42840
42615
  var asm = __toESM(require_node());
42841
42616
  var formatTransferToContractScriptData = (params) => {
@@ -43070,7 +42845,7 @@ Supported fuel-core version: ${supportedVersion}.`
43070
42845
  while (needsToBeFunded && fundingAttempts < MAX_FUNDING_ATTEMPTS) {
43071
42846
  const resources = await this.getResourcesToSpend(
43072
42847
  missingQuantities,
43073
- cacheTxInputsFromOwner(request.inputs, this.address)
42848
+ cacheRequestInputsResourcesFromOwner(request.inputs, this.address)
43074
42849
  );
43075
42850
  request.addResources(resources);
43076
42851
  request.shiftPredicateData();
@@ -43361,11 +43136,11 @@ Supported fuel-core version: ${supportedVersion}.`
43361
43136
  }
43362
43137
  return res;
43363
43138
  }
43364
- function invert(number3, modulo) {
43365
- if (number3 === _0n3 || modulo <= _0n3) {
43366
- throw new Error(`invert: expected positive integers, got n=${number3} mod=${modulo}`);
43139
+ function invert(number2, modulo) {
43140
+ if (number2 === _0n3 || modulo <= _0n3) {
43141
+ throw new Error(`invert: expected positive integers, got n=${number2} mod=${modulo}`);
43367
43142
  }
43368
- let a = mod(number3, modulo);
43143
+ let a = mod(number2, modulo);
43369
43144
  let b = modulo;
43370
43145
  let x = _0n3, y = _1n3, u = _1n3, v = _0n3;
43371
43146
  while (a !== _0n3) {
@@ -43520,7 +43295,7 @@ Supported fuel-core version: ${supportedVersion}.`
43520
43295
  const nByteLength = Math.ceil(_nBitLength / 8);
43521
43296
  return { nBitLength: _nBitLength, nByteLength };
43522
43297
  }
43523
- function Field(ORDER, bitLen2, isLE3 = false, redef = {}) {
43298
+ function Field(ORDER, bitLen2, isLE2 = false, redef = {}) {
43524
43299
  if (ORDER <= _0n3)
43525
43300
  throw new Error(`Expected Field ORDER > 0, got ${ORDER}`);
43526
43301
  const { nBitLength: BITS, nByteLength: BYTES } = nLength(ORDER, bitLen2);
@@ -43561,11 +43336,11 @@ Supported fuel-core version: ${supportedVersion}.`
43561
43336
  // TODO: do we really need constant cmov?
43562
43337
  // We don't have const-time bigints anyway, so probably will be not very useful
43563
43338
  cmov: (a, b, c) => c ? b : a,
43564
- toBytes: (num) => isLE3 ? numberToBytesLE(num, BYTES) : numberToBytesBE(num, BYTES),
43565
- fromBytes: (bytes3) => {
43566
- if (bytes3.length !== BYTES)
43567
- throw new Error(`Fp.fromBytes: expected ${BYTES}, got ${bytes3.length}`);
43568
- return isLE3 ? bytesToNumberLE(bytes3) : bytesToNumberBE(bytes3);
43339
+ toBytes: (num) => isLE2 ? numberToBytesLE(num, BYTES) : numberToBytesBE(num, BYTES),
43340
+ fromBytes: (bytes2) => {
43341
+ if (bytes2.length !== BYTES)
43342
+ throw new Error(`Fp.fromBytes: expected ${BYTES}, got ${bytes2.length}`);
43343
+ return isLE2 ? bytesToNumberLE(bytes2) : bytesToNumberBE(bytes2);
43569
43344
  }
43570
43345
  });
43571
43346
  return Object.freeze(f2);
@@ -43580,15 +43355,15 @@ Supported fuel-core version: ${supportedVersion}.`
43580
43355
  const length = getFieldBytesLength(fieldOrder);
43581
43356
  return length + Math.ceil(length / 2);
43582
43357
  }
43583
- function mapHashToField(key, fieldOrder, isLE3 = false) {
43358
+ function mapHashToField(key, fieldOrder, isLE2 = false) {
43584
43359
  const len = key.length;
43585
43360
  const fieldLen = getFieldBytesLength(fieldOrder);
43586
43361
  const minLen = getMinHashLength(fieldOrder);
43587
43362
  if (len < 16 || len < minLen || len > 1024)
43588
43363
  throw new Error(`expected ${minLen}-1024 bytes of input, got ${len}`);
43589
- const num = isLE3 ? bytesToNumberBE(key) : bytesToNumberLE(key);
43364
+ const num = isLE2 ? bytesToNumberBE(key) : bytesToNumberLE(key);
43590
43365
  const reduced = mod(num, fieldOrder - _1n3) + _1n3;
43591
- return isLE3 ? numberToBytesLE(reduced, fieldLen) : numberToBytesBE(reduced, fieldLen);
43366
+ return isLE2 ? numberToBytesLE(reduced, fieldLen) : numberToBytesBE(reduced, fieldLen);
43592
43367
  }
43593
43368
 
43594
43369
  // ../../node_modules/.pnpm/@noble+curves@1.3.0/node_modules/@noble/curves/esm/abstract/curve.js
@@ -43796,12 +43571,12 @@ Supported fuel-core version: ${supportedVersion}.`
43796
43571
  function weierstrassPoints(opts) {
43797
43572
  const CURVE = validatePointOpts(opts);
43798
43573
  const { Fp: Fp2 } = CURVE;
43799
- const toBytes4 = CURVE.toBytes || ((_c, point, _isCompressed) => {
43574
+ const toBytes3 = CURVE.toBytes || ((_c, point, _isCompressed) => {
43800
43575
  const a = point.toAffine();
43801
43576
  return concatBytes3(Uint8Array.from([4]), Fp2.toBytes(a.x), Fp2.toBytes(a.y));
43802
43577
  });
43803
- const fromBytes = CURVE.fromBytes || ((bytes3) => {
43804
- const tail = bytes3.subarray(1);
43578
+ const fromBytes = CURVE.fromBytes || ((bytes2) => {
43579
+ const tail = bytes2.subarray(1);
43805
43580
  const x = Fp2.fromBytes(tail.subarray(0, Fp2.BYTES));
43806
43581
  const y = Fp2.fromBytes(tail.subarray(Fp2.BYTES, 2 * Fp2.BYTES));
43807
43582
  return { x, y };
@@ -44164,7 +43939,7 @@ Supported fuel-core version: ${supportedVersion}.`
44164
43939
  }
44165
43940
  toRawBytes(isCompressed = true) {
44166
43941
  this.assertValidity();
44167
- return toBytes4(Point2, this, isCompressed);
43942
+ return toBytes3(Point2, this, isCompressed);
44168
43943
  }
44169
43944
  toHex(isCompressed = true) {
44170
43945
  return bytesToHex(this.toRawBytes(isCompressed));
@@ -44221,10 +43996,10 @@ Supported fuel-core version: ${supportedVersion}.`
44221
43996
  return cat(Uint8Array.from([4]), x, Fp2.toBytes(a.y));
44222
43997
  }
44223
43998
  },
44224
- fromBytes(bytes3) {
44225
- const len = bytes3.length;
44226
- const head = bytes3[0];
44227
- const tail = bytes3.subarray(1);
43999
+ fromBytes(bytes2) {
44000
+ const len = bytes2.length;
44001
+ const head = bytes2[0];
44002
+ const tail = bytes2.subarray(1);
44228
44003
  if (len === compressedLen && (head === 2 || head === 3)) {
44229
44004
  const x = bytesToNumberBE(tail);
44230
44005
  if (!isValidFieldElement(x))
@@ -44246,15 +44021,15 @@ Supported fuel-core version: ${supportedVersion}.`
44246
44021
  }
44247
44022
  });
44248
44023
  const numToNByteStr = (num) => bytesToHex(numberToBytesBE(num, CURVE.nByteLength));
44249
- function isBiggerThanHalfOrder(number3) {
44024
+ function isBiggerThanHalfOrder(number2) {
44250
44025
  const HALF = CURVE_ORDER >> _1n5;
44251
- return number3 > HALF;
44026
+ return number2 > HALF;
44252
44027
  }
44253
44028
  function normalizeS(s) {
44254
44029
  return isBiggerThanHalfOrder(s) ? modN(-s) : s;
44255
44030
  }
44256
44031
  const slcNum = (b, from, to) => bytesToNumberBE(b.slice(from, to));
44257
- class Signature2 {
44032
+ class Signature {
44258
44033
  constructor(r, s, recovery) {
44259
44034
  this.r = r;
44260
44035
  this.s = s;
@@ -44265,13 +44040,13 @@ Supported fuel-core version: ${supportedVersion}.`
44265
44040
  static fromCompact(hex) {
44266
44041
  const l = CURVE.nByteLength;
44267
44042
  hex = ensureBytes("compactSignature", hex, l * 2);
44268
- return new Signature2(slcNum(hex, 0, l), slcNum(hex, l, 2 * l));
44043
+ return new Signature(slcNum(hex, 0, l), slcNum(hex, l, 2 * l));
44269
44044
  }
44270
44045
  // DER encoded ECDSA signature
44271
44046
  // https://bitcoin.stackexchange.com/questions/57644/what-are-the-parts-of-a-bitcoin-transaction-input-script
44272
44047
  static fromDER(hex) {
44273
44048
  const { r, s } = DER.toSig(ensureBytes("DER", hex));
44274
- return new Signature2(r, s);
44049
+ return new Signature(r, s);
44275
44050
  }
44276
44051
  assertValidity() {
44277
44052
  if (!isWithinCurveOrder(this.r))
@@ -44280,7 +44055,7 @@ Supported fuel-core version: ${supportedVersion}.`
44280
44055
  throw new Error("s must be 0 < s < CURVE.n");
44281
44056
  }
44282
44057
  addRecoveryBit(recovery) {
44283
- return new Signature2(this.r, this.s, recovery);
44058
+ return new Signature(this.r, this.s, recovery);
44284
44059
  }
44285
44060
  recoverPublicKey(msgHash) {
44286
44061
  const { r, s, recovery: rec } = this;
@@ -44306,7 +44081,7 @@ Supported fuel-core version: ${supportedVersion}.`
44306
44081
  return isBiggerThanHalfOrder(this.s);
44307
44082
  }
44308
44083
  normalizeS() {
44309
- return this.hasHighS() ? new Signature2(this.r, modN(-this.s), this.recovery) : this;
44084
+ return this.hasHighS() ? new Signature(this.r, modN(-this.s), this.recovery) : this;
44310
44085
  }
44311
44086
  // DER-encoded
44312
44087
  toDERRawBytes() {
@@ -44378,13 +44153,13 @@ Supported fuel-core version: ${supportedVersion}.`
44378
44153
  const b = Point2.fromHex(publicB);
44379
44154
  return b.multiply(normPrivateKeyToScalar(privateA)).toRawBytes(isCompressed);
44380
44155
  }
44381
- const bits2int = CURVE.bits2int || function(bytes3) {
44382
- const num = bytesToNumberBE(bytes3);
44383
- const delta = bytes3.length * 8 - CURVE.nBitLength;
44156
+ const bits2int = CURVE.bits2int || function(bytes2) {
44157
+ const num = bytesToNumberBE(bytes2);
44158
+ const delta = bytes2.length * 8 - CURVE.nBitLength;
44384
44159
  return delta > 0 ? num >> BigInt(delta) : num;
44385
44160
  };
44386
- const bits2int_modN = CURVE.bits2int_modN || function(bytes3) {
44387
- return modN(bits2int(bytes3));
44161
+ const bits2int_modN = CURVE.bits2int_modN || function(bytes2) {
44162
+ return modN(bits2int(bytes2));
44388
44163
  };
44389
44164
  const ORDER_MASK = bitMask(CURVE.nBitLength);
44390
44165
  function int2octets(num) {
@@ -44397,18 +44172,18 @@ Supported fuel-core version: ${supportedVersion}.`
44397
44172
  function prepSig(msgHash, privateKey, opts = defaultSigOpts) {
44398
44173
  if (["recovered", "canonical"].some((k) => k in opts))
44399
44174
  throw new Error("sign() legacy options not supported");
44400
- const { hash: hash4, randomBytes: randomBytes5 } = CURVE;
44175
+ const { hash: hash3, randomBytes: randomBytes3 } = CURVE;
44401
44176
  let { lowS, prehash, extraEntropy: ent } = opts;
44402
44177
  if (lowS == null)
44403
44178
  lowS = true;
44404
44179
  msgHash = ensureBytes("msgHash", msgHash);
44405
44180
  if (prehash)
44406
- msgHash = ensureBytes("prehashed msgHash", hash4(msgHash));
44181
+ msgHash = ensureBytes("prehashed msgHash", hash3(msgHash));
44407
44182
  const h1int = bits2int_modN(msgHash);
44408
44183
  const d = normPrivateKeyToScalar(privateKey);
44409
44184
  const seedArgs = [int2octets(d), int2octets(h1int)];
44410
44185
  if (ent != null) {
44411
- const e = ent === true ? randomBytes5(Fp2.BYTES) : ent;
44186
+ const e = ent === true ? randomBytes3(Fp2.BYTES) : ent;
44412
44187
  seedArgs.push(ensureBytes("extraEntropy", e));
44413
44188
  }
44414
44189
  const seed = concatBytes3(...seedArgs);
@@ -44431,7 +44206,7 @@ Supported fuel-core version: ${supportedVersion}.`
44431
44206
  normS = normalizeS(s);
44432
44207
  recovery ^= 1;
44433
44208
  }
44434
- return new Signature2(r, normS, recovery);
44209
+ return new Signature(r, normS, recovery);
44435
44210
  }
44436
44211
  return { seed, k2sig };
44437
44212
  }
@@ -44456,15 +44231,15 @@ Supported fuel-core version: ${supportedVersion}.`
44456
44231
  try {
44457
44232
  if (typeof sg === "string" || isBytes3(sg)) {
44458
44233
  try {
44459
- _sig = Signature2.fromDER(sg);
44234
+ _sig = Signature.fromDER(sg);
44460
44235
  } catch (derError) {
44461
44236
  if (!(derError instanceof DER.Err))
44462
44237
  throw derError;
44463
- _sig = Signature2.fromCompact(sg);
44238
+ _sig = Signature.fromCompact(sg);
44464
44239
  }
44465
44240
  } else if (typeof sg === "object" && typeof sg.r === "bigint" && typeof sg.s === "bigint") {
44466
44241
  const { r: r2, s: s2 } = sg;
44467
- _sig = new Signature2(r2, s2);
44242
+ _sig = new Signature(r2, s2);
44468
44243
  } else {
44469
44244
  throw new Error("PARSE");
44470
44245
  }
@@ -44496,21 +44271,21 @@ Supported fuel-core version: ${supportedVersion}.`
44496
44271
  sign,
44497
44272
  verify,
44498
44273
  ProjectivePoint: Point2,
44499
- Signature: Signature2,
44274
+ Signature,
44500
44275
  utils
44501
44276
  };
44502
44277
  }
44503
44278
 
44504
44279
  // ../../node_modules/.pnpm/@noble+curves@1.3.0/node_modules/@noble/curves/esm/_shortw_utils.js
44505
- function getHash(hash4) {
44280
+ function getHash(hash3) {
44506
44281
  return {
44507
- hash: hash4,
44508
- hmac: (key, ...msgs) => hmac(hash4, key, concatBytes(...msgs)),
44282
+ hash: hash3,
44283
+ hmac: (key, ...msgs) => hmac(hash3, key, concatBytes(...msgs)),
44509
44284
  randomBytes
44510
44285
  };
44511
44286
  }
44512
44287
  function createCurve(curveDef, defHash) {
44513
- const create = (hash4) => weierstrass({ ...curveDef, ...getHash(hash4) });
44288
+ const create = (hash3) => weierstrass({ ...curveDef, ...getHash(hash3) });
44514
44289
  return Object.freeze({ ...create(defHash), create });
44515
44290
  }
44516
44291
 
@@ -44612,7 +44387,7 @@ Supported fuel-core version: ${supportedVersion}.`
44612
44387
  privateKey = `0x${privateKey}`;
44613
44388
  }
44614
44389
  }
44615
- const privateKeyBytes = toBytes3(privateKey, 32);
44390
+ const privateKeyBytes = toBytes2(privateKey, 32);
44616
44391
  this.privateKey = hexlify(privateKeyBytes);
44617
44392
  this.publicKey = hexlify(secp256k1.getPublicKey(privateKeyBytes, false).slice(1));
44618
44393
  this.compressedPublicKey = hexlify(secp256k1.getPublicKey(privateKeyBytes, true));
@@ -44630,8 +44405,8 @@ Supported fuel-core version: ${supportedVersion}.`
44630
44405
  */
44631
44406
  sign(data) {
44632
44407
  const signature = secp256k1.sign(arrayify(data), arrayify(this.privateKey));
44633
- const r = toBytes3(`0x${signature.r.toString(16)}`, 32);
44634
- const s = toBytes3(`0x${signature.s.toString(16)}`, 32);
44408
+ const r = toBytes2(`0x${signature.r.toString(16)}`, 32);
44409
+ const s = toBytes2(`0x${signature.s.toString(16)}`, 32);
44635
44410
  s[0] |= (signature.recovery || 0) << 7;
44636
44411
  return hexlify(concat([r, s]));
44637
44412
  }
@@ -44683,7 +44458,7 @@ Supported fuel-core version: ${supportedVersion}.`
44683
44458
  * @returns random 32-byte hashed
44684
44459
  */
44685
44460
  static generatePrivateKey(entropy) {
44686
- return entropy ? hash3(concat([randomBytes22(32), arrayify(entropy)])) : randomBytes22(32);
44461
+ return entropy ? hash2(concat([randomBytes22(32), arrayify(entropy)])) : randomBytes22(32);
44687
44462
  }
44688
44463
  /**
44689
44464
  * Extended publicKey from a compact publicKey
@@ -44698,12 +44473,12 @@ Supported fuel-core version: ${supportedVersion}.`
44698
44473
  };
44699
44474
 
44700
44475
  // ../../node_modules/.pnpm/uuid@9.0.0/node_modules/uuid/dist/esm-node/rng.js
44701
- var import_crypto15 = __toESM(__require("crypto"));
44476
+ var import_crypto12 = __toESM(__require("crypto"));
44702
44477
  var rnds8Pool = new Uint8Array(256);
44703
44478
  var poolPtr = rnds8Pool.length;
44704
44479
  function rng() {
44705
44480
  if (poolPtr > rnds8Pool.length - 16) {
44706
- import_crypto15.default.randomFillSync(rnds8Pool);
44481
+ import_crypto12.default.randomFillSync(rnds8Pool);
44707
44482
  poolPtr = 0;
44708
44483
  }
44709
44484
  return rnds8Pool.slice(poolPtr, poolPtr += 16);
@@ -44719,9 +44494,9 @@ Supported fuel-core version: ${supportedVersion}.`
44719
44494
  }
44720
44495
 
44721
44496
  // ../../node_modules/.pnpm/uuid@9.0.0/node_modules/uuid/dist/esm-node/native.js
44722
- var import_crypto16 = __toESM(__require("crypto"));
44497
+ var import_crypto13 = __toESM(__require("crypto"));
44723
44498
  var native_default = {
44724
- randomUUID: import_crypto16.default.randomUUID
44499
+ randomUUID: import_crypto13.default.randomUUID
44725
44500
  };
44726
44501
 
44727
44502
  // ../../node_modules/.pnpm/uuid@9.0.0/node_modules/uuid/dist/esm-node/v4.js
@@ -44771,7 +44546,7 @@ Supported fuel-core version: ${supportedVersion}.`
44771
44546
  const iv = randomBytes22(DEFAULT_IV_SIZE);
44772
44547
  const ciphertext = await encryptJsonWalletData2(privateKeyBuffer, key, iv);
44773
44548
  const data = Uint8Array.from([...key.subarray(16, 32), ...ciphertext]);
44774
- const macHashUint8Array = keccak25622(data);
44549
+ const macHashUint8Array = keccak2562(data);
44775
44550
  const mac = stringFromBuffer2(macHashUint8Array, "hex");
44776
44551
  const keystore = {
44777
44552
  id: v4_default(),
@@ -44817,7 +44592,7 @@ Supported fuel-core version: ${supportedVersion}.`
44817
44592
  dklen
44818
44593
  });
44819
44594
  const data = Uint8Array.from([...key.subarray(16, 32), ...ciphertextBuffer]);
44820
- const macHashUint8Array = keccak25622(data);
44595
+ const macHashUint8Array = keccak2562(data);
44821
44596
  const macHash = stringFromBuffer2(macHashUint8Array, "hex");
44822
44597
  if (mac !== macHash) {
44823
44598
  throw new FuelError(
@@ -47067,7 +46842,7 @@ Supported fuel-core version: ${supportedVersion}.`
47067
46842
  }
47068
46843
  }
47069
46844
  const checksumBits = entropy.length / 4;
47070
- const checksum = arrayify(sha2563(entropy))[0] & getUpperMask(checksumBits);
46845
+ const checksum = arrayify(sha2562(entropy))[0] & getUpperMask(checksumBits);
47071
46846
  indices[indices.length - 1] <<= checksumBits;
47072
46847
  indices[indices.length - 1] |= checksum >> 8 - checksumBits;
47073
46848
  return indices;
@@ -47094,7 +46869,7 @@ Supported fuel-core version: ${supportedVersion}.`
47094
46869
  const entropyBits = 32 * words.length / 3;
47095
46870
  const checksumBits = words.length / 3;
47096
46871
  const checksumMask = getUpperMask(checksumBits);
47097
- const checksum = arrayify(sha2563(entropy.slice(0, entropyBits / 8)))[0] & checksumMask;
46872
+ const checksum = arrayify(sha2562(entropy.slice(0, entropyBits / 8)))[0] & checksumMask;
47098
46873
  if (checksum !== (entropy[entropy.length - 1] & checksumMask)) {
47099
46874
  throw new FuelError(
47100
46875
  ErrorCode.INVALID_CHECKSUM,
@@ -47191,7 +46966,7 @@ Supported fuel-core version: ${supportedVersion}.`
47191
46966
  assertMnemonic(getWords(phrase));
47192
46967
  const phraseBytes = toUtf8Bytes2(getPhrase(phrase));
47193
46968
  const salt = toUtf8Bytes2(`mnemonic${passphrase}`);
47194
- return pbkdf22(phraseBytes, salt, 2048, 64, "sha512");
46969
+ return pbkdf222(phraseBytes, salt, 2048, 64, "sha512");
47195
46970
  }
47196
46971
  /**
47197
46972
  * @param phrase - Mnemonic phrase composed by words from the provided wordlist
@@ -47253,7 +47028,7 @@ Supported fuel-core version: ${supportedVersion}.`
47253
47028
  `Seed length should be between 16 and 64 bytes, but received ${seedArray.length} bytes.`
47254
47029
  );
47255
47030
  }
47256
- return arrayify(computeHmac("sha512", MasterSecret, seedArray));
47031
+ return arrayify(computeHmac2("sha512", MasterSecret, seedArray));
47257
47032
  }
47258
47033
  /**
47259
47034
  * Get the extendKey as defined on BIP-32 from the provided seed
@@ -47278,7 +47053,7 @@ Supported fuel-core version: ${supportedVersion}.`
47278
47053
  chainCode,
47279
47054
  concat(["0x00", privateKey])
47280
47055
  ]);
47281
- const checksum = dataSlice(sha2563(sha2563(extendedKey)), 0, 4);
47056
+ const checksum = dataSlice(sha2562(sha2562(extendedKey)), 0, 4);
47282
47057
  return encodeBase58(concat([extendedKey, checksum]));
47283
47058
  }
47284
47059
  /**
@@ -47294,7 +47069,7 @@ Supported fuel-core version: ${supportedVersion}.`
47294
47069
  * @returns A randomly generated mnemonic
47295
47070
  */
47296
47071
  static generate(size = 32, extraEntropy = "") {
47297
- const entropy = extraEntropy ? sha2563(concat([randomBytes22(size), arrayify(extraEntropy)])) : randomBytes22(size);
47072
+ const entropy = extraEntropy ? sha2562(concat([randomBytes22(size), arrayify(extraEntropy)])) : randomBytes22(size);
47298
47073
  return Mnemonic.entropyToMnemonic(entropy);
47299
47074
  }
47300
47075
  };
@@ -47307,7 +47082,7 @@ Supported fuel-core version: ${supportedVersion}.`
47307
47082
  var TestnetPRV2 = hexlify("0x04358394");
47308
47083
  var TestnetPUB = hexlify("0x043587cf");
47309
47084
  function base58check(data) {
47310
- return encodeBase58(concat([data, dataSlice(sha2563(sha2563(data)), 0, 4)]));
47085
+ return encodeBase58(concat([data, dataSlice(sha2562(sha2562(data)), 0, 4)]));
47311
47086
  }
47312
47087
  function getExtendedKeyPrefix(isPublic = false, testnet = false) {
47313
47088
  if (isPublic) {
@@ -47363,7 +47138,7 @@ Supported fuel-core version: ${supportedVersion}.`
47363
47138
  this.publicKey = hexlify(config.publicKey);
47364
47139
  }
47365
47140
  this.parentFingerprint = config.parentFingerprint || this.parentFingerprint;
47366
- this.fingerprint = dataSlice(ripemd1602(sha2563(this.publicKey)), 0, 4);
47141
+ this.fingerprint = dataSlice(ripemd16022(sha2562(this.publicKey)), 0, 4);
47367
47142
  this.depth = config.depth || this.depth;
47368
47143
  this.index = config.index || this.index;
47369
47144
  this.chainCode = config.chainCode;
@@ -47394,10 +47169,10 @@ Supported fuel-core version: ${supportedVersion}.`
47394
47169
  } else {
47395
47170
  data.set(arrayify(this.publicKey));
47396
47171
  }
47397
- data.set(toBytes3(index, 4), 33);
47398
- const bytes3 = arrayify(computeHmac("sha512", chainCode, data));
47399
- const IL = bytes3.slice(0, 32);
47400
- const IR = bytes3.slice(32);
47172
+ data.set(toBytes2(index, 4), 33);
47173
+ const bytes2 = arrayify(computeHmac2("sha512", chainCode, data));
47174
+ const IL = bytes2.slice(0, 32);
47175
+ const IR = bytes2.slice(32);
47401
47176
  if (privateKey) {
47402
47177
  const N = "0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141";
47403
47178
  const ki = bn(IL).add(privateKey).mod(N).toBytes(32);
@@ -47466,27 +47241,27 @@ Supported fuel-core version: ${supportedVersion}.`
47466
47241
  });
47467
47242
  }
47468
47243
  static fromExtendedKey(extendedKey) {
47469
- const decoded = toBeHex(decodeBase58(extendedKey));
47470
- const bytes3 = arrayify(decoded);
47471
- const validChecksum = base58check(bytes3.slice(0, 78)) === extendedKey;
47472
- if (bytes3.length !== 82 || !isValidExtendedKey(bytes3)) {
47244
+ const decoded = hexlify(toBytes2(decodeBase58(extendedKey)));
47245
+ const bytes2 = arrayify(decoded);
47246
+ const validChecksum = base58check(bytes2.slice(0, 78)) === extendedKey;
47247
+ if (bytes2.length !== 82 || !isValidExtendedKey(bytes2)) {
47473
47248
  throw new FuelError(ErrorCode.HD_WALLET_ERROR, "Provided key is not a valid extended key.");
47474
47249
  }
47475
47250
  if (!validChecksum) {
47476
47251
  throw new FuelError(ErrorCode.HD_WALLET_ERROR, "Provided key has an invalid checksum.");
47477
47252
  }
47478
- const depth = bytes3[4];
47479
- const parentFingerprint = hexlify(bytes3.slice(5, 9));
47480
- const index = parseInt(hexlify(bytes3.slice(9, 13)).substring(2), 16);
47481
- const chainCode = hexlify(bytes3.slice(13, 45));
47482
- const key = bytes3.slice(45, 78);
47253
+ const depth = bytes2[4];
47254
+ const parentFingerprint = hexlify(bytes2.slice(5, 9));
47255
+ const index = parseInt(hexlify(bytes2.slice(9, 13)).substring(2), 16);
47256
+ const chainCode = hexlify(bytes2.slice(13, 45));
47257
+ const key = bytes2.slice(45, 78);
47483
47258
  if (depth === 0 && parentFingerprint !== "0x00000000" || depth === 0 && index !== 0) {
47484
47259
  throw new FuelError(
47485
47260
  ErrorCode.HD_WALLET_ERROR,
47486
47261
  "Inconsistency detected: Depth is zero but fingerprint/index is non-zero."
47487
47262
  );
47488
47263
  }
47489
- if (isPublicExtendedKey(bytes3)) {
47264
+ if (isPublicExtendedKey(bytes2)) {
47490
47265
  if (key[0] !== 3) {
47491
47266
  throw new FuelError(ErrorCode.HD_WALLET_ERROR, "Invalid public extended key.");
47492
47267
  }
@@ -47818,7 +47593,7 @@ Supported fuel-core version: ${supportedVersion}.`
47818
47593
  wallet_not_unlocked: "The wallet is currently locked.",
47819
47594
  passphrase_not_match: "The provided passphrase did not match the expected value."
47820
47595
  };
47821
- function assert3(condition, message) {
47596
+ function assert2(condition, message) {
47822
47597
  if (!condition) {
47823
47598
  throw new FuelError(ErrorCode.WALLET_MANAGER_ERROR, message);
47824
47599
  }
@@ -47861,9 +47636,9 @@ Supported fuel-core version: ${supportedVersion}.`
47861
47636
  * the format of the return depends on the Vault type.
47862
47637
  */
47863
47638
  exportVault(vaultId) {
47864
- assert3(!__privateGet(this, _isLocked), ERROR_MESSAGES.wallet_not_unlocked);
47639
+ assert2(!__privateGet(this, _isLocked), ERROR_MESSAGES.wallet_not_unlocked);
47865
47640
  const vaultState = __privateGet(this, _vaults).find((_, idx) => idx === vaultId);
47866
- assert3(vaultState, ERROR_MESSAGES.vault_not_found);
47641
+ assert2(vaultState, ERROR_MESSAGES.vault_not_found);
47867
47642
  return vaultState.vault.serialize();
47868
47643
  }
47869
47644
  /**
@@ -47892,7 +47667,7 @@ Supported fuel-core version: ${supportedVersion}.`
47892
47667
  const vaultState = __privateGet(this, _vaults).find(
47893
47668
  (vs) => vs.vault.getAccounts().find((a) => a.address.equals(ownerAddress))
47894
47669
  );
47895
- assert3(vaultState, ERROR_MESSAGES.address_not_found);
47670
+ assert2(vaultState, ERROR_MESSAGES.address_not_found);
47896
47671
  return vaultState.vault.getWallet(ownerAddress);
47897
47672
  }
47898
47673
  /**
@@ -47900,11 +47675,11 @@ Supported fuel-core version: ${supportedVersion}.`
47900
47675
  */
47901
47676
  exportPrivateKey(address) {
47902
47677
  const ownerAddress = Address.fromAddressOrString(address);
47903
- assert3(!__privateGet(this, _isLocked), ERROR_MESSAGES.wallet_not_unlocked);
47678
+ assert2(!__privateGet(this, _isLocked), ERROR_MESSAGES.wallet_not_unlocked);
47904
47679
  const vaultState = __privateGet(this, _vaults).find(
47905
47680
  (vs) => vs.vault.getAccounts().find((a) => a.address.equals(ownerAddress))
47906
47681
  );
47907
- assert3(vaultState, ERROR_MESSAGES.address_not_found);
47682
+ assert2(vaultState, ERROR_MESSAGES.address_not_found);
47908
47683
  return vaultState.vault.exportAccount(ownerAddress);
47909
47684
  }
47910
47685
  /**
@@ -47914,7 +47689,7 @@ Supported fuel-core version: ${supportedVersion}.`
47914
47689
  async addAccount(options) {
47915
47690
  await this.loadState();
47916
47691
  const vaultState = __privateGet(this, _vaults)[options?.vaultId || 0];
47917
- await assert3(vaultState, ERROR_MESSAGES.vault_not_found);
47692
+ await assert2(vaultState, ERROR_MESSAGES.vault_not_found);
47918
47693
  const account = vaultState.vault.addAccount();
47919
47694
  await this.saveState();
47920
47695
  return account;
@@ -47984,7 +47759,7 @@ Supported fuel-core version: ${supportedVersion}.`
47984
47759
  * Retrieve and decrypt WalletManager state from storage
47985
47760
  */
47986
47761
  async loadState() {
47987
- await assert3(!__privateGet(this, _isLocked), ERROR_MESSAGES.wallet_not_unlocked);
47762
+ await assert2(!__privateGet(this, _isLocked), ERROR_MESSAGES.wallet_not_unlocked);
47988
47763
  const data = await this.storage.getItem(this.STORAGE_KEY);
47989
47764
  if (data) {
47990
47765
  const state = await decrypt2(__privateGet(this, _passphrase), JSON.parse(data));
@@ -47995,7 +47770,7 @@ Supported fuel-core version: ${supportedVersion}.`
47995
47770
  * Store encrypted WalletManager state on storage
47996
47771
  */
47997
47772
  async saveState() {
47998
- await assert3(!__privateGet(this, _isLocked), ERROR_MESSAGES.wallet_not_unlocked);
47773
+ await assert2(!__privateGet(this, _isLocked), ERROR_MESSAGES.wallet_not_unlocked);
47999
47774
  const encryptedData = await encrypt2(__privateGet(this, _passphrase), {
48000
47775
  vaults: __privateMethod(this, _serializeVaults, serializeVaults_fn).call(this, __privateGet(this, _vaults))
48001
47776
  });
@@ -48007,7 +47782,7 @@ Supported fuel-core version: ${supportedVersion}.`
48007
47782
  */
48008
47783
  getVaultClass(type3) {
48009
47784
  const VaultClass = _WalletManager.Vaults.find((v) => v.type === type3);
48010
- assert3(VaultClass, ERROR_MESSAGES.invalid_vault_type);
47785
+ assert2(VaultClass, ERROR_MESSAGES.invalid_vault_type);
48011
47786
  return VaultClass;
48012
47787
  }
48013
47788
  };
@@ -48090,10 +47865,10 @@ Supported fuel-core version: ${supportedVersion}.`
48090
47865
  };
48091
47866
  var node_default2 = Node;
48092
47867
  function hashLeaf(data) {
48093
- return hash3("0x00".concat(data.slice(2)));
47868
+ return hash2("0x00".concat(data.slice(2)));
48094
47869
  }
48095
47870
  function hashNode(left, right) {
48096
- return hash3("0x01".concat(left.slice(2)).concat(right.slice(2)));
47871
+ return hash2("0x01".concat(left.slice(2)).concat(right.slice(2)));
48097
47872
  }
48098
47873
  function calcRoot(data) {
48099
47874
  if (!data.length) {
@@ -48130,10 +47905,10 @@ Supported fuel-core version: ${supportedVersion}.`
48130
47905
  // src/predicate/utils/getPredicateRoot.ts
48131
47906
  var getPredicateRoot = (bytecode) => {
48132
47907
  const chunkSize = 16 * 1024;
48133
- const bytes3 = arrayify(bytecode);
48134
- const chunks = chunkAndPadBytes(bytes3, chunkSize);
47908
+ const bytes2 = arrayify(bytecode);
47909
+ const chunks = chunkAndPadBytes(bytes2, chunkSize);
48135
47910
  const codeRoot = calcRoot(chunks.map((c) => hexlify(c)));
48136
- const predicateRoot = hash3(concat(["0x4655454C", codeRoot]));
47911
+ const predicateRoot = hash2(concat(["0x4655454C", codeRoot]));
48137
47912
  return predicateRoot;
48138
47913
  };
48139
47914
 
@@ -48180,10 +47955,15 @@ Supported fuel-core version: ${supportedVersion}.`
48180
47955
  populateTransactionPredicateData(transactionRequestLike) {
48181
47956
  const request = transactionRequestify(transactionRequestLike);
48182
47957
  const { policies } = BaseTransactionRequest.getPolicyMeta(request);
48183
- request.inputs?.forEach((input) => {
48184
- if (input.type === InputType.Coin && hexlify(input.owner) === this.address.toB256()) {
47958
+ const placeholderIndex = this.getIndexFromPlaceholderWitness(request);
47959
+ if (placeholderIndex !== -1) {
47960
+ request.removeWitness(placeholderIndex);
47961
+ }
47962
+ request.inputs.filter(isRequestInputResource).forEach((input) => {
47963
+ if (isRequestInputResourceFromOwner(input, this.address)) {
48185
47964
  input.predicate = hexlify(this.bytes);
48186
47965
  input.predicateData = hexlify(this.getPredicateData(policies.length));
47966
+ input.witnessIndex = 0;
48187
47967
  }
48188
47968
  });
48189
47969
  return request;
@@ -48228,8 +48008,8 @@ Supported fuel-core version: ${supportedVersion}.`
48228
48008
  * @param configurableConstants - Optional configurable constants for the predicate.
48229
48009
  * @returns An object containing the new predicate bytes and interface.
48230
48010
  */
48231
- static processPredicateData(bytes3, jsonAbi, configurableConstants) {
48232
- let predicateBytes = arrayify(bytes3);
48011
+ static processPredicateData(bytes2, jsonAbi, configurableConstants) {
48012
+ let predicateBytes = arrayify(bytes2);
48233
48013
  let abiInterface;
48234
48014
  if (jsonAbi) {
48235
48015
  abiInterface = new Interface(jsonAbi);
@@ -48279,8 +48059,8 @@ Supported fuel-core version: ${supportedVersion}.`
48279
48059
  * @param abiInterface - The ABI interface of the predicate.
48280
48060
  * @returns The mutated bytes with the configurable constants set.
48281
48061
  */
48282
- static setConfigurableConstants(bytes3, configurableConstants, abiInterface) {
48283
- const mutatedBytes = bytes3;
48062
+ static setConfigurableConstants(bytes2, configurableConstants, abiInterface) {
48063
+ const mutatedBytes = bytes2;
48284
48064
  try {
48285
48065
  if (!abiInterface) {
48286
48066
  throw new Error(
@@ -48306,6 +48086,28 @@ Supported fuel-core version: ${supportedVersion}.`
48306
48086
  }
48307
48087
  return mutatedBytes;
48308
48088
  }
48089
+ /**
48090
+ * Returns the index of the witness placeholder that was added to this predicate.
48091
+ * If no witness placeholder was added, it returns -1.
48092
+ * @param request - The transaction request.
48093
+ * @returns The index of the witness placeholder, or -1 if there is no witness placeholder.
48094
+ */
48095
+ getIndexFromPlaceholderWitness(request) {
48096
+ const predicateInputs = request.inputs.filter(isRequestInputResource).filter((input) => isRequestInputResourceFromOwner(input, this.address));
48097
+ let index = -1;
48098
+ const hasEmptyPredicateInputs = predicateInputs.find((input) => !input.predicate);
48099
+ if (hasEmptyPredicateInputs) {
48100
+ index = hasEmptyPredicateInputs.witnessIndex;
48101
+ const allInputsAreEmpty = predicateInputs.every((input) => !input.predicate);
48102
+ if (!allInputsAreEmpty) {
48103
+ const wasFilledInputAddedFirst = !!predicateInputs[0]?.predicate;
48104
+ if (wasFilledInputAddedFirst) {
48105
+ index = -1;
48106
+ }
48107
+ }
48108
+ }
48109
+ return index;
48110
+ }
48309
48111
  };
48310
48112
 
48311
48113
  // src/connectors/fuel-connector.ts
@@ -48999,9 +48801,6 @@ mime-types/index.js:
48999
48801
  @noble/hashes/esm/utils.js:
49000
48802
  (*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
49001
48803
 
49002
- @noble/hashes/esm/utils.js:
49003
- (*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
49004
-
49005
48804
  @noble/curves/esm/abstract/utils.js:
49006
48805
  (*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
49007
48806