@fuel-ts/account 0.94.5 → 0.94.6

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.
Files changed (64) hide show
  1. package/dist/configs.d.ts +6 -0
  2. package/dist/configs.d.ts.map +1 -1
  3. package/dist/configs.global.js.map +1 -1
  4. package/dist/configs.js.map +1 -1
  5. package/dist/configs.mjs.map +1 -1
  6. package/dist/connectors/fuel-connector.d.ts +3 -4
  7. package/dist/connectors/fuel-connector.d.ts.map +1 -1
  8. package/dist/connectors/types/data-type.d.ts +7 -0
  9. package/dist/connectors/types/data-type.d.ts.map +1 -1
  10. package/dist/connectors/types/local-storage.d.ts +0 -1
  11. package/dist/connectors/types/local-storage.d.ts.map +1 -1
  12. package/dist/index.global.js +1620 -967
  13. package/dist/index.global.js.map +1 -1
  14. package/dist/index.js +1308 -405
  15. package/dist/index.js.map +1 -1
  16. package/dist/index.mjs +1237 -338
  17. package/dist/index.mjs.map +1 -1
  18. package/dist/providers/__generated__/operations.d.ts.map +1 -1
  19. package/dist/providers/assets/assets.d.ts +1 -1
  20. package/dist/providers/assets/assets.d.ts.map +1 -1
  21. package/dist/providers/assets/utils/network.d.ts.map +1 -1
  22. package/dist/providers/assets/utils/resolveIconPaths.d.ts +1 -1
  23. package/dist/providers/chains.d.ts +2 -0
  24. package/dist/providers/chains.d.ts.map +1 -1
  25. package/dist/providers/fuel-graphql-subscriber.d.ts +0 -2
  26. package/dist/providers/fuel-graphql-subscriber.d.ts.map +1 -1
  27. package/dist/providers/message.d.ts.map +1 -1
  28. package/dist/providers/provider.d.ts +8 -3
  29. package/dist/providers/provider.d.ts.map +1 -1
  30. package/dist/providers/resource.d.ts.map +1 -1
  31. package/dist/providers/transaction-request/helpers.d.ts.map +1 -1
  32. package/dist/providers/transaction-request/index.d.ts +2 -0
  33. package/dist/providers/transaction-request/index.d.ts.map +1 -1
  34. package/dist/providers/transaction-request/transaction-request.d.ts +2 -2
  35. package/dist/providers/transaction-request/transaction-request.d.ts.map +1 -1
  36. package/dist/providers/transaction-request/types.d.ts +8 -2
  37. package/dist/providers/transaction-request/types.d.ts.map +1 -1
  38. package/dist/providers/transaction-request/upgrade-transaction-request.d.ts +87 -0
  39. package/dist/providers/transaction-request/upgrade-transaction-request.d.ts.map +1 -0
  40. package/dist/providers/transaction-request/upload-transaction-request.d.ts +82 -0
  41. package/dist/providers/transaction-request/upload-transaction-request.d.ts.map +1 -0
  42. package/dist/providers/transaction-request/utils.d.ts +6 -0
  43. package/dist/providers/transaction-request/utils.d.ts.map +1 -1
  44. package/dist/providers/transaction-response/transaction-response.d.ts.map +1 -1
  45. package/dist/providers/transaction-summary/input.d.ts.map +1 -1
  46. package/dist/providers/transaction-summary/operations.d.ts.map +1 -1
  47. package/dist/providers/transaction-summary/output.d.ts.map +1 -1
  48. package/dist/providers/transaction-summary/receipt.d.ts.map +1 -1
  49. package/dist/providers/utils/extract-tx-error.d.ts.map +1 -1
  50. package/dist/providers/utils/gas.d.ts +16 -0
  51. package/dist/providers/utils/gas.d.ts.map +1 -1
  52. package/dist/providers/utils/receipts.d.ts.map +1 -1
  53. package/dist/test-utils/launchNode.d.ts.map +1 -1
  54. package/dist/test-utils/resources.d.ts.map +1 -1
  55. package/dist/test-utils/transactionRequest.d.ts.map +1 -1
  56. package/dist/test-utils.global.js +1614 -963
  57. package/dist/test-utils.global.js.map +1 -1
  58. package/dist/test-utils.js +1219 -332
  59. package/dist/test-utils.js.map +1 -1
  60. package/dist/test-utils.mjs +1161 -271
  61. package/dist/test-utils.mjs.map +1 -1
  62. package/dist/wallet-manager/wallet-manager.d.ts +0 -1
  63. package/dist/wallet-manager/wallet-manager.d.ts.map +1 -1
  64. package/package.json +18 -17
@@ -76,20 +76,20 @@
76
76
  ctor.prototype = new TempCtor();
77
77
  ctor.prototype.constructor = ctor;
78
78
  }
79
- function BN2(number3, base, endian) {
80
- if (BN2.isBN(number3)) {
81
- return number3;
79
+ function BN2(number2, base, endian) {
80
+ if (BN2.isBN(number2)) {
81
+ return number2;
82
82
  }
83
83
  this.negative = 0;
84
84
  this.words = null;
85
85
  this.length = 0;
86
86
  this.red = null;
87
- if (number3 !== null) {
87
+ if (number2 !== null) {
88
88
  if (base === "le" || base === "be") {
89
89
  endian = base;
90
90
  base = 10;
91
91
  }
92
- this._init(number3 || 0, base || 10, endian || "be");
92
+ this._init(number2 || 0, base || 10, endian || "be");
93
93
  }
94
94
  }
95
95
  if (typeof module2 === "object") {
@@ -124,53 +124,53 @@
124
124
  return left;
125
125
  return right;
126
126
  };
127
- BN2.prototype._init = function init(number3, base, endian) {
128
- if (typeof number3 === "number") {
129
- return this._initNumber(number3, base, endian);
127
+ BN2.prototype._init = function init(number2, base, endian) {
128
+ if (typeof number2 === "number") {
129
+ return this._initNumber(number2, base, endian);
130
130
  }
131
- if (typeof number3 === "object") {
132
- return this._initArray(number3, base, endian);
131
+ if (typeof number2 === "object") {
132
+ return this._initArray(number2, base, endian);
133
133
  }
134
134
  if (base === "hex") {
135
135
  base = 16;
136
136
  }
137
137
  assert(base === (base | 0) && base >= 2 && base <= 36);
138
- number3 = number3.toString().replace(/\s+/g, "");
138
+ number2 = number2.toString().replace(/\s+/g, "");
139
139
  var start = 0;
140
- if (number3[0] === "-") {
140
+ if (number2[0] === "-") {
141
141
  start++;
142
142
  this.negative = 1;
143
143
  }
144
- if (start < number3.length) {
144
+ if (start < number2.length) {
145
145
  if (base === 16) {
146
- this._parseHex(number3, start, endian);
146
+ this._parseHex(number2, start, endian);
147
147
  } else {
148
- this._parseBase(number3, base, start);
148
+ this._parseBase(number2, base, start);
149
149
  if (endian === "le") {
150
150
  this._initArray(this.toArray(), base, endian);
151
151
  }
152
152
  }
153
153
  }
154
154
  };
155
- BN2.prototype._initNumber = function _initNumber(number3, base, endian) {
156
- if (number3 < 0) {
155
+ BN2.prototype._initNumber = function _initNumber(number2, base, endian) {
156
+ if (number2 < 0) {
157
157
  this.negative = 1;
158
- number3 = -number3;
158
+ number2 = -number2;
159
159
  }
160
- if (number3 < 67108864) {
161
- this.words = [number3 & 67108863];
160
+ if (number2 < 67108864) {
161
+ this.words = [number2 & 67108863];
162
162
  this.length = 1;
163
- } else if (number3 < 4503599627370496) {
163
+ } else if (number2 < 4503599627370496) {
164
164
  this.words = [
165
- number3 & 67108863,
166
- number3 / 67108864 & 67108863
165
+ number2 & 67108863,
166
+ number2 / 67108864 & 67108863
167
167
  ];
168
168
  this.length = 2;
169
169
  } else {
170
- assert(number3 < 9007199254740992);
170
+ assert(number2 < 9007199254740992);
171
171
  this.words = [
172
- number3 & 67108863,
173
- number3 / 67108864 & 67108863,
172
+ number2 & 67108863,
173
+ number2 / 67108864 & 67108863,
174
174
  1
175
175
  ];
176
176
  this.length = 3;
@@ -179,14 +179,14 @@
179
179
  return;
180
180
  this._initArray(this.toArray(), base, endian);
181
181
  };
182
- BN2.prototype._initArray = function _initArray(number3, base, endian) {
183
- assert(typeof number3.length === "number");
184
- if (number3.length <= 0) {
182
+ BN2.prototype._initArray = function _initArray(number2, base, endian) {
183
+ assert(typeof number2.length === "number");
184
+ if (number2.length <= 0) {
185
185
  this.words = [0];
186
186
  this.length = 1;
187
187
  return this;
188
188
  }
189
- this.length = Math.ceil(number3.length / 3);
189
+ this.length = Math.ceil(number2.length / 3);
190
190
  this.words = new Array(this.length);
191
191
  for (var i = 0; i < this.length; i++) {
192
192
  this.words[i] = 0;
@@ -194,8 +194,8 @@
194
194
  var j, w;
195
195
  var off = 0;
196
196
  if (endian === "be") {
197
- for (i = number3.length - 1, j = 0; i >= 0; i -= 3) {
198
- w = number3[i] | number3[i - 1] << 8 | number3[i - 2] << 16;
197
+ for (i = number2.length - 1, j = 0; i >= 0; i -= 3) {
198
+ w = number2[i] | number2[i - 1] << 8 | number2[i - 2] << 16;
199
199
  this.words[j] |= w << off & 67108863;
200
200
  this.words[j + 1] = w >>> 26 - off & 67108863;
201
201
  off += 24;
@@ -205,8 +205,8 @@
205
205
  }
206
206
  }
207
207
  } else if (endian === "le") {
208
- for (i = 0, j = 0; i < number3.length; i += 3) {
209
- w = number3[i] | number3[i + 1] << 8 | number3[i + 2] << 16;
208
+ for (i = 0, j = 0; i < number2.length; i += 3) {
209
+ w = number2[i] | number2[i + 1] << 8 | number2[i + 2] << 16;
210
210
  this.words[j] |= w << off & 67108863;
211
211
  this.words[j + 1] = w >>> 26 - off & 67108863;
212
212
  off += 24;
@@ -237,8 +237,8 @@
237
237
  }
238
238
  return r;
239
239
  }
240
- BN2.prototype._parseHex = function _parseHex(number3, start, endian) {
241
- this.length = Math.ceil((number3.length - start) / 6);
240
+ BN2.prototype._parseHex = function _parseHex(number2, start, endian) {
241
+ this.length = Math.ceil((number2.length - start) / 6);
242
242
  this.words = new Array(this.length);
243
243
  for (var i = 0; i < this.length; i++) {
244
244
  this.words[i] = 0;
@@ -247,8 +247,8 @@
247
247
  var j = 0;
248
248
  var w;
249
249
  if (endian === "be") {
250
- for (i = number3.length - 1; i >= start; i -= 2) {
251
- w = parseHexByte(number3, start, i) << off;
250
+ for (i = number2.length - 1; i >= start; i -= 2) {
251
+ w = parseHexByte(number2, start, i) << off;
252
252
  this.words[j] |= w & 67108863;
253
253
  if (off >= 18) {
254
254
  off -= 18;
@@ -259,9 +259,9 @@
259
259
  }
260
260
  }
261
261
  } else {
262
- var parseLength = number3.length - start;
263
- for (i = parseLength % 2 === 0 ? start + 1 : start; i < number3.length; i += 2) {
264
- w = parseHexByte(number3, start, i) << off;
262
+ var parseLength = number2.length - start;
263
+ for (i = parseLength % 2 === 0 ? start + 1 : start; i < number2.length; i += 2) {
264
+ w = parseHexByte(number2, start, i) << off;
265
265
  this.words[j] |= w & 67108863;
266
266
  if (off >= 18) {
267
267
  off -= 18;
@@ -293,7 +293,7 @@
293
293
  }
294
294
  return r;
295
295
  }
296
- BN2.prototype._parseBase = function _parseBase(number3, base, start) {
296
+ BN2.prototype._parseBase = function _parseBase(number2, base, start) {
297
297
  this.words = [0];
298
298
  this.length = 1;
299
299
  for (var limbLen = 0, limbPow = 1; limbPow <= 67108863; limbPow *= base) {
@@ -301,12 +301,12 @@
301
301
  }
302
302
  limbLen--;
303
303
  limbPow = limbPow / base | 0;
304
- var total = number3.length - start;
304
+ var total = number2.length - start;
305
305
  var mod2 = total % limbLen;
306
306
  var end = Math.min(total, total - mod2) + start;
307
307
  var word = 0;
308
308
  for (var i = start; i < end; i += limbLen) {
309
- word = parseBase(number3, i, i + limbLen, base);
309
+ word = parseBase(number2, i, i + limbLen, base);
310
310
  this.imuln(limbPow);
311
311
  if (this.words[0] + word < 67108864) {
312
312
  this.words[0] += word;
@@ -316,7 +316,7 @@
316
316
  }
317
317
  if (mod2 !== 0) {
318
318
  var pow3 = 1;
319
- word = parseBase(number3, i, number3.length, base);
319
+ word = parseBase(number2, i, number2.length, base);
320
320
  for (i = 0; i < mod2; i++) {
321
321
  pow3 *= base;
322
322
  }
@@ -2642,20 +2642,20 @@
2642
2642
  );
2643
2643
  }
2644
2644
  inherits(K256, MPrime);
2645
- K256.prototype.split = function split2(input, output3) {
2645
+ K256.prototype.split = function split2(input, output2) {
2646
2646
  var mask = 4194303;
2647
2647
  var outLen = Math.min(input.length, 9);
2648
2648
  for (var i = 0; i < outLen; i++) {
2649
- output3.words[i] = input.words[i];
2649
+ output2.words[i] = input.words[i];
2650
2650
  }
2651
- output3.length = outLen;
2651
+ output2.length = outLen;
2652
2652
  if (input.length <= 9) {
2653
2653
  input.words[0] = 0;
2654
2654
  input.length = 1;
2655
2655
  return;
2656
2656
  }
2657
2657
  var prev = input.words[9];
2658
- output3.words[output3.length++] = prev & mask;
2658
+ output2.words[output2.length++] = prev & mask;
2659
2659
  for (i = 10; i < input.length; i++) {
2660
2660
  var next = input.words[i] | 0;
2661
2661
  input.words[i - 10] = (next & mask) << 4 | prev >>> 22;
@@ -4371,7 +4371,7 @@
4371
4371
  var queues = /* @__PURE__ */ Object.create(null);
4372
4372
  hasher = hasher || identity;
4373
4373
  var _fn = wrapAsync(fn);
4374
- var memoized = initialParams(function memoized2(args, callback) {
4374
+ var memoized2 = initialParams(function memoized3(args, callback) {
4375
4375
  var key = hasher.apply(null, args);
4376
4376
  if (has(memo, key)) {
4377
4377
  setImmediate$1(function() {
@@ -4392,9 +4392,9 @@
4392
4392
  }));
4393
4393
  }
4394
4394
  });
4395
- memoized.memo = memo;
4396
- memoized.unmemoized = fn;
4397
- return memoized;
4395
+ memoized2.memo = memo;
4396
+ memoized2.unmemoized = fn;
4397
+ return memoized2;
4398
4398
  }
4399
4399
  var _defer$1;
4400
4400
  if (hasNextTick) {
@@ -5073,12 +5073,12 @@
5073
5073
  createDebug.skips = [];
5074
5074
  createDebug.formatters = {};
5075
5075
  function selectColor(namespace) {
5076
- var hash4 = 0;
5076
+ var hash3 = 0;
5077
5077
  for (var i = 0; i < namespace.length; i++) {
5078
- hash4 = (hash4 << 5) - hash4 + namespace.charCodeAt(i);
5079
- hash4 |= 0;
5078
+ hash3 = (hash3 << 5) - hash3 + namespace.charCodeAt(i);
5079
+ hash3 |= 0;
5080
5080
  }
5081
- return createDebug.colors[Math.abs(hash4) % createDebug.colors.length];
5081
+ return createDebug.colors[Math.abs(hash3) % createDebug.colors.length];
5082
5082
  }
5083
5083
  createDebug.selectColor = selectColor;
5084
5084
  function createDebug(namespace) {
@@ -5916,8 +5916,8 @@
5916
5916
  }
5917
5917
  return result;
5918
5918
  }
5919
- function toWords(bytes3) {
5920
- return convert2(bytes3, 8, 5, true);
5919
+ function toWords(bytes2) {
5920
+ return convert2(bytes2, 8, 5, true);
5921
5921
  }
5922
5922
  function fromWordsUnsafe(words) {
5923
5923
  const res = convert2(words, 5, 8, false);
@@ -6456,18 +6456,18 @@
6456
6456
  }
6457
6457
  function utf8PercentDecode(str) {
6458
6458
  const input = new Buffer(str);
6459
- const output3 = [];
6459
+ const output2 = [];
6460
6460
  for (let i = 0; i < input.length; ++i) {
6461
6461
  if (input[i] !== 37) {
6462
- output3.push(input[i]);
6462
+ output2.push(input[i]);
6463
6463
  } else if (input[i] === 37 && isASCIIHex(input[i + 1]) && isASCIIHex(input[i + 2])) {
6464
- output3.push(parseInt(input.slice(i + 1, i + 3).toString(), 16));
6464
+ output2.push(parseInt(input.slice(i + 1, i + 3).toString(), 16));
6465
6465
  i += 2;
6466
6466
  } else {
6467
- output3.push(input[i]);
6467
+ output2.push(input[i]);
6468
6468
  }
6469
6469
  }
6470
- return new Buffer(output3).toString();
6470
+ return new Buffer(output2).toString();
6471
6471
  }
6472
6472
  function isC0ControlPercentEncode(c) {
6473
6473
  return c <= 31 || c > 126;
@@ -6543,16 +6543,16 @@
6543
6543
  return ipv4;
6544
6544
  }
6545
6545
  function serializeIPv4(address) {
6546
- let output3 = "";
6546
+ let output2 = "";
6547
6547
  let n = address;
6548
6548
  for (let i = 1; i <= 4; ++i) {
6549
- output3 = String(n % 256) + output3;
6549
+ output2 = String(n % 256) + output2;
6550
6550
  if (i !== 4) {
6551
- output3 = "." + output3;
6551
+ output2 = "." + output2;
6552
6552
  }
6553
6553
  n = Math.floor(n / 256);
6554
6554
  }
6555
- return output3;
6555
+ return output2;
6556
6556
  }
6557
6557
  function parseIPv6(input) {
6558
6558
  const address = [0, 0, 0, 0, 0, 0, 0, 0];
@@ -6610,13 +6610,13 @@
6610
6610
  return failure;
6611
6611
  }
6612
6612
  while (isASCIIDigit(input[pointer])) {
6613
- const number3 = parseInt(at(input, pointer));
6613
+ const number2 = parseInt(at(input, pointer));
6614
6614
  if (ipv4Piece === null) {
6615
- ipv4Piece = number3;
6615
+ ipv4Piece = number2;
6616
6616
  } else if (ipv4Piece === 0) {
6617
6617
  return failure;
6618
6618
  } else {
6619
- ipv4Piece = ipv4Piece * 10 + number3;
6619
+ ipv4Piece = ipv4Piece * 10 + number2;
6620
6620
  }
6621
6621
  if (ipv4Piece > 255) {
6622
6622
  return failure;
@@ -6660,7 +6660,7 @@
6660
6660
  return address;
6661
6661
  }
6662
6662
  function serializeIPv6(address) {
6663
- let output3 = "";
6663
+ let output2 = "";
6664
6664
  const seqResult = findLongestZeroSequence(address);
6665
6665
  const compress = seqResult.idx;
6666
6666
  let ignore0 = false;
@@ -6672,16 +6672,16 @@
6672
6672
  }
6673
6673
  if (compress === pieceIndex) {
6674
6674
  const separator = pieceIndex === 0 ? "::" : ":";
6675
- output3 += separator;
6675
+ output2 += separator;
6676
6676
  ignore0 = true;
6677
6677
  continue;
6678
6678
  }
6679
- output3 += address[pieceIndex].toString(16);
6679
+ output2 += address[pieceIndex].toString(16);
6680
6680
  if (pieceIndex !== 7) {
6681
- output3 += ":";
6681
+ output2 += ":";
6682
6682
  }
6683
6683
  }
6684
- return output3;
6684
+ return output2;
6685
6685
  }
6686
6686
  function parseHost(input, isSpecialArg) {
6687
6687
  if (input[0] === "[") {
@@ -6711,12 +6711,12 @@
6711
6711
  if (containsForbiddenHostCodePointExcludingPercent(input)) {
6712
6712
  return failure;
6713
6713
  }
6714
- let output3 = "";
6714
+ let output2 = "";
6715
6715
  const decoded = punycode.ucs2.decode(input);
6716
6716
  for (let i = 0; i < decoded.length; ++i) {
6717
- output3 += percentEncodeChar(decoded[i], isC0ControlPercentEncode);
6717
+ output2 += percentEncodeChar(decoded[i], isC0ControlPercentEncode);
6718
6718
  }
6719
- return output3;
6719
+ return output2;
6720
6720
  }
6721
6721
  function findLongestZeroSequence(arr) {
6722
6722
  let maxIdx = null;
@@ -7341,37 +7341,37 @@
7341
7341
  return true;
7342
7342
  };
7343
7343
  function serializeURL(url, excludeFragment) {
7344
- let output3 = url.scheme + ":";
7344
+ let output2 = url.scheme + ":";
7345
7345
  if (url.host !== null) {
7346
- output3 += "//";
7346
+ output2 += "//";
7347
7347
  if (url.username !== "" || url.password !== "") {
7348
- output3 += url.username;
7348
+ output2 += url.username;
7349
7349
  if (url.password !== "") {
7350
- output3 += ":" + url.password;
7350
+ output2 += ":" + url.password;
7351
7351
  }
7352
- output3 += "@";
7352
+ output2 += "@";
7353
7353
  }
7354
- output3 += serializeHost(url.host);
7354
+ output2 += serializeHost(url.host);
7355
7355
  if (url.port !== null) {
7356
- output3 += ":" + url.port;
7356
+ output2 += ":" + url.port;
7357
7357
  }
7358
7358
  } else if (url.host === null && url.scheme === "file") {
7359
- output3 += "//";
7359
+ output2 += "//";
7360
7360
  }
7361
7361
  if (url.cannotBeABaseURL) {
7362
- output3 += url.path[0];
7362
+ output2 += url.path[0];
7363
7363
  } else {
7364
7364
  for (const string of url.path) {
7365
- output3 += "/" + string;
7365
+ output2 += "/" + string;
7366
7366
  }
7367
7367
  }
7368
7368
  if (url.query !== null) {
7369
- output3 += "?" + url.query;
7369
+ output2 += "?" + url.query;
7370
7370
  }
7371
7371
  if (!excludeFragment && url.fragment !== null) {
7372
- output3 += "#" + url.fragment;
7372
+ output2 += "#" + url.fragment;
7373
7373
  }
7374
- return output3;
7374
+ return output2;
7375
7375
  }
7376
7376
  function serializeOrigin(tuple) {
7377
7377
  let result = tuple.scheme + "://";
@@ -9315,19 +9315,19 @@
9315
9315
  return "GraphQLError";
9316
9316
  }
9317
9317
  toString() {
9318
- let output3 = this.message;
9318
+ let output2 = this.message;
9319
9319
  if (this.nodes) {
9320
9320
  for (const node of this.nodes) {
9321
9321
  if (node.loc) {
9322
- output3 += "\n\n" + (0, _printLocation.printLocation)(node.loc);
9322
+ output2 += "\n\n" + (0, _printLocation.printLocation)(node.loc);
9323
9323
  }
9324
9324
  }
9325
9325
  } else if (this.source && this.locations) {
9326
9326
  for (const location of this.locations) {
9327
- output3 += "\n\n" + (0, _printLocation.printSourceLocation)(this.source, location);
9327
+ output2 += "\n\n" + (0, _printLocation.printSourceLocation)(this.source, location);
9328
9328
  }
9329
9329
  }
9330
- return output3;
9330
+ return output2;
9331
9331
  }
9332
9332
  toJSON() {
9333
9333
  const formattedError = {
@@ -21644,7 +21644,7 @@ spurious results.`);
21644
21644
  module.exports = iterate;
21645
21645
  function iterate(list, iterator, state, callback) {
21646
21646
  var key = state["keyedList"] ? state["keyedList"][state.index] : state.index;
21647
- state.jobs[key] = runJob(iterator, key, list[key], function(error, output3) {
21647
+ state.jobs[key] = runJob(iterator, key, list[key], function(error, output2) {
21648
21648
  if (!(key in state.jobs)) {
21649
21649
  return;
21650
21650
  }
@@ -21652,7 +21652,7 @@ spurious results.`);
21652
21652
  if (error) {
21653
21653
  abort(state);
21654
21654
  } else {
21655
- state.results[key] = output3;
21655
+ state.results[key] = output2;
21656
21656
  }
21657
21657
  callback(error, state.results);
21658
21658
  });
@@ -23414,8 +23414,8 @@ spurious results.`);
23414
23414
  const ret3 = wasm$1.retd(addr, len);
23415
23415
  return Instruction.__wrap(ret3);
23416
23416
  }
23417
- function aloc(bytes3) {
23418
- const ret3 = wasm$1.aloc(bytes3);
23417
+ function aloc(bytes2) {
23418
+ const ret3 = wasm$1.aloc(bytes2);
23419
23419
  return Instruction.__wrap(ret3);
23420
23420
  }
23421
23421
  function mcl(dst_addr, len) {
@@ -24647,9 +24647,9 @@ spurious results.`);
24647
24647
  * Construct the instruction from its parts.
24648
24648
  * @param {RegId} bytes
24649
24649
  */
24650
- constructor(bytes3) {
24651
- _assertClass(bytes3, RegId);
24652
- var ptr0 = bytes3.__destroy_into_raw();
24650
+ constructor(bytes2) {
24651
+ _assertClass(bytes2, RegId);
24652
+ var ptr0 = bytes2.__destroy_into_raw();
24653
24653
  const ret3 = wasm$1.aloc_new_typescript(ptr0);
24654
24654
  this.__wbg_ptr = ret3 >>> 0;
24655
24655
  return this;
@@ -31320,8 +31320,8 @@ spurious results.`);
31320
31320
  }
31321
31321
  }
31322
31322
  }
31323
- const bytes3 = await module2.arrayBuffer();
31324
- return await WebAssembly.instantiate(bytes3, imports);
31323
+ const bytes2 = await module2.arrayBuffer();
31324
+ return await WebAssembly.instantiate(bytes2, imports);
31325
31325
  } else {
31326
31326
  const instance = await WebAssembly.instantiate(module2, imports);
31327
31327
  if (instance instanceof WebAssembly.Instance) {
@@ -31657,7 +31657,7 @@ spurious results.`);
31657
31657
  return {
31658
31658
  FORC: "0.63.5",
31659
31659
  FUEL_CORE: "0.35.0",
31660
- FUELS: "0.94.5"
31660
+ FUELS: "0.94.6"
31661
31661
  };
31662
31662
  }
31663
31663
  function parseVersion(version) {
@@ -31740,6 +31740,7 @@ This unreleased fuel-core build may include features and updates not yet support
31740
31740
  ErrorCode2["MISSING_PROVIDER"] = "missing-provider";
31741
31741
  ErrorCode2["INVALID_PROVIDER"] = "invalid-provider";
31742
31742
  ErrorCode2["CONNECTION_REFUSED"] = "connection-refused";
31743
+ ErrorCode2["INVALID_URL"] = "invalid-url";
31743
31744
  ErrorCode2["INVALID_PUBLIC_KEY"] = "invalid-public-key";
31744
31745
  ErrorCode2["WALLET_MANAGER_ERROR"] = "wallet-manager-error";
31745
31746
  ErrorCode2["HD_WALLET_ERROR"] = "hd-wallet-error";
@@ -31871,15 +31872,15 @@ This unreleased fuel-core build may include features and updates not yet support
31871
31872
  // ANCHOR: HELPERS
31872
31873
  // make sure we always include `0x` in hex strings
31873
31874
  toString(base, length) {
31874
- const output3 = super.toString(base, length);
31875
+ const output2 = super.toString(base, length);
31875
31876
  if (base === 16 || base === "hex") {
31876
- return `0x${output3}`;
31877
+ return `0x${output2}`;
31877
31878
  }
31878
- return output3;
31879
+ return output2;
31879
31880
  }
31880
31881
  toHex(bytesPadding) {
31881
- const bytes3 = bytesPadding || 0;
31882
- const bytesLength = bytes3 * 2;
31882
+ const bytes2 = bytesPadding || 0;
31883
+ const bytesLength = bytes2 * 2;
31883
31884
  if (this.isNeg()) {
31884
31885
  throw new FuelError(ErrorCode.CONVERTING_FAILED, "Cannot convert negative value to hex.");
31885
31886
  }
@@ -31990,21 +31991,21 @@ This unreleased fuel-core build may include features and updates not yet support
31990
31991
  // END ANCHOR: OVERRIDES to output our BN type
31991
31992
  // ANCHOR: OVERRIDES to avoid losing references
31992
31993
  caller(v, methodName) {
31993
- const output3 = super[methodName](new BN(v));
31994
- if (BN.isBN(output3)) {
31995
- return new BN(output3.toArray());
31994
+ const output2 = super[methodName](new BN(v));
31995
+ if (BN.isBN(output2)) {
31996
+ return new BN(output2.toArray());
31996
31997
  }
31997
- if (typeof output3 === "boolean") {
31998
- return output3;
31998
+ if (typeof output2 === "boolean") {
31999
+ return output2;
31999
32000
  }
32000
- return output3;
32001
+ return output2;
32001
32002
  }
32002
32003
  clone() {
32003
32004
  return new BN(this.toArray());
32004
32005
  }
32005
32006
  mulTo(num, out) {
32006
- const output3 = new import_bn.default(this.toArray()).mulTo(num, out);
32007
- return new BN(output3.toArray());
32007
+ const output2 = new import_bn.default(this.toArray()).mulTo(num, out);
32008
+ return new BN(output2.toArray());
32008
32009
  }
32009
32010
  egcd(p) {
32010
32011
  const { a, b, gcd } = new import_bn.default(this.toArray()).egcd(p);
@@ -32099,15 +32100,15 @@ If you are attempting to transform a hex value, please make sure it is being pas
32099
32100
  return concatenated;
32100
32101
  };
32101
32102
  var concat = (arrays) => {
32102
- const bytes3 = arrays.map((v) => arrayify(v));
32103
- return concatBytes(bytes3);
32103
+ const bytes2 = arrays.map((v) => arrayify(v));
32104
+ return concatBytes(bytes2);
32104
32105
  };
32105
32106
  var HexCharacters = "0123456789abcdef";
32106
32107
  function hexlify(data) {
32107
- const bytes3 = arrayify(data);
32108
+ const bytes2 = arrayify(data);
32108
32109
  let result = "0x";
32109
- for (let i = 0; i < bytes3.length; i++) {
32110
- const v = bytes3[i];
32110
+ for (let i = 0; i < bytes2.length; i++) {
32111
+ const v = bytes2[i];
32111
32112
  result += HexCharacters[(v & 240) >> 4] + HexCharacters[v & 15];
32112
32113
  }
32113
32114
  return result;
@@ -32993,15 +32994,15 @@ If you are attempting to transform a hex value, please make sure it is being pas
32993
32994
  return bn(result);
32994
32995
  }
32995
32996
  function encodeBase58(_value) {
32996
- const bytes3 = arrayify(_value);
32997
- let value = bn(bytes3);
32997
+ const bytes2 = arrayify(_value);
32998
+ let value = bn(bytes2);
32998
32999
  let result = "";
32999
33000
  while (value.gt(BN_0)) {
33000
33001
  result = Alphabet[Number(value.mod(BN_58))] + result;
33001
33002
  value = value.div(BN_58);
33002
33003
  }
33003
- for (let i = 0; i < bytes3.length; i++) {
33004
- if (bytes3[i]) {
33004
+ for (let i = 0; i < bytes2.length; i++) {
33005
+ if (bytes2[i]) {
33005
33006
  break;
33006
33007
  }
33007
33008
  result = Alphabet[0] + result;
@@ -33017,11 +33018,11 @@ If you are attempting to transform a hex value, please make sure it is being pas
33017
33018
  return result;
33018
33019
  }
33019
33020
  function dataSlice(data, start, end) {
33020
- const bytes3 = arrayify(data);
33021
- if (end != null && end > bytes3.length) {
33021
+ const bytes2 = arrayify(data);
33022
+ if (end != null && end > bytes2.length) {
33022
33023
  throw new FuelError(ErrorCode.INVALID_DATA, "cannot slice beyond data bounds");
33023
33024
  }
33024
- return hexlify(bytes3.slice(start == null ? 0 : start, end == null ? bytes3.length : end));
33025
+ return hexlify(bytes2.slice(start == null ? 0 : start, end == null ? bytes2.length : end));
33025
33026
  }
33026
33027
  function toUtf8Bytes(stri, form = true) {
33027
33028
  let str = stri;
@@ -33058,8 +33059,8 @@ If you are attempting to transform a hex value, please make sure it is being pas
33058
33059
  }
33059
33060
  return new Uint8Array(result);
33060
33061
  }
33061
- function onError(reason, offset, bytes3, output3, badCodepoint) {
33062
- console.log(`invalid codepoint at offset ${offset}; ${reason}, bytes: ${bytes3}`);
33062
+ function onError(reason, offset, bytes2, output2, badCodepoint) {
33063
+ console.log(`invalid codepoint at offset ${offset}; ${reason}, bytes: ${bytes2}`);
33063
33064
  return offset;
33064
33065
  }
33065
33066
  function helper(codePoints) {
@@ -33075,11 +33076,11 @@ If you are attempting to transform a hex value, please make sure it is being pas
33075
33076
  }).join("");
33076
33077
  }
33077
33078
  function getUtf8CodePoints(_bytes) {
33078
- const bytes3 = arrayify(_bytes, "bytes");
33079
+ const bytes2 = arrayify(_bytes, "bytes");
33079
33080
  const result = [];
33080
33081
  let i = 0;
33081
- while (i < bytes3.length) {
33082
- const c = bytes3[i++];
33082
+ while (i < bytes2.length) {
33083
+ const c = bytes2[i++];
33083
33084
  if (c >> 7 === 0) {
33084
33085
  result.push(c);
33085
33086
  continue;
@@ -33097,21 +33098,21 @@ If you are attempting to transform a hex value, please make sure it is being pas
33097
33098
  overlongMask = 65535;
33098
33099
  } else {
33099
33100
  if ((c & 192) === 128) {
33100
- i += onError("UNEXPECTED_CONTINUE", i - 1, bytes3, result);
33101
+ i += onError("UNEXPECTED_CONTINUE", i - 1, bytes2, result);
33101
33102
  } else {
33102
- i += onError("BAD_PREFIX", i - 1, bytes3, result);
33103
+ i += onError("BAD_PREFIX", i - 1, bytes2, result);
33103
33104
  }
33104
33105
  continue;
33105
33106
  }
33106
- if (i - 1 + extraLength >= bytes3.length) {
33107
- i += onError("OVERRUN", i - 1, bytes3, result);
33107
+ if (i - 1 + extraLength >= bytes2.length) {
33108
+ i += onError("OVERRUN", i - 1, bytes2, result);
33108
33109
  continue;
33109
33110
  }
33110
33111
  let res = c & (1 << 8 - extraLength - 1) - 1;
33111
33112
  for (let j = 0; j < extraLength; j++) {
33112
- const nextChar = bytes3[i];
33113
+ const nextChar = bytes2[i];
33113
33114
  if ((nextChar & 192) !== 128) {
33114
- i += onError("MISSING_CONTINUE", i, bytes3, result);
33115
+ i += onError("MISSING_CONTINUE", i, bytes2, result);
33115
33116
  res = null;
33116
33117
  break;
33117
33118
  }
@@ -33122,47 +33123,47 @@ If you are attempting to transform a hex value, please make sure it is being pas
33122
33123
  continue;
33123
33124
  }
33124
33125
  if (res > 1114111) {
33125
- i += onError("OUT_OF_RANGE", i - 1 - extraLength, bytes3, result, res);
33126
+ i += onError("OUT_OF_RANGE", i - 1 - extraLength, bytes2, result, res);
33126
33127
  continue;
33127
33128
  }
33128
33129
  if (res >= 55296 && res <= 57343) {
33129
- i += onError("UTF16_SURROGATE", i - 1 - extraLength, bytes3, result, res);
33130
+ i += onError("UTF16_SURROGATE", i - 1 - extraLength, bytes2, result, res);
33130
33131
  continue;
33131
33132
  }
33132
33133
  if (res <= overlongMask) {
33133
- i += onError("OVERLONG", i - 1 - extraLength, bytes3, result, res);
33134
+ i += onError("OVERLONG", i - 1 - extraLength, bytes2, result, res);
33134
33135
  continue;
33135
33136
  }
33136
33137
  result.push(res);
33137
33138
  }
33138
33139
  return result;
33139
33140
  }
33140
- function toUtf8String(bytes3) {
33141
- return helper(getUtf8CodePoints(bytes3));
33141
+ function toUtf8String(bytes2) {
33142
+ return helper(getUtf8CodePoints(bytes2));
33142
33143
  }
33143
33144
  function assertUnreachable(_x) {
33144
33145
  throw new Error("Didn't expect to get here");
33145
33146
  }
33146
33147
 
33147
- // ../../node_modules/.pnpm/@noble+hashes@1.3.3/node_modules/@noble/hashes/esm/_assert.js
33148
+ // ../../node_modules/.pnpm/@noble+hashes@1.5.0/node_modules/@noble/hashes/esm/_assert.js
33148
33149
  function number(n) {
33149
33150
  if (!Number.isSafeInteger(n) || n < 0)
33150
- throw new Error(`Wrong positive integer: ${n}`);
33151
+ throw new Error(`positive integer expected, not ${n}`);
33151
33152
  }
33152
33153
  function isBytes(a) {
33153
33154
  return a instanceof Uint8Array || a != null && typeof a === "object" && a.constructor.name === "Uint8Array";
33154
33155
  }
33155
33156
  function bytes(b, ...lengths) {
33156
33157
  if (!isBytes(b))
33157
- throw new Error("Expected Uint8Array");
33158
+ throw new Error("Uint8Array expected");
33158
33159
  if (lengths.length > 0 && !lengths.includes(b.length))
33159
- throw new Error(`Expected Uint8Array of length ${lengths}, not of length=${b.length}`);
33160
+ throw new Error(`Uint8Array expected of length ${lengths}, not of length=${b.length}`);
33160
33161
  }
33161
- function hash(hash4) {
33162
- if (typeof hash4 !== "function" || typeof hash4.create !== "function")
33162
+ function hash(h) {
33163
+ if (typeof h !== "function" || typeof h.create !== "function")
33163
33164
  throw new Error("Hash should be wrapped by utils.wrapConstructor");
33164
- number(hash4.outputLen);
33165
- number(hash4.blockLen);
33165
+ number(h.outputLen);
33166
+ number(h.blockLen);
33166
33167
  }
33167
33168
  function exists(instance, checkFinished = true) {
33168
33169
  if (instance.destroyed)
@@ -33178,16 +33179,22 @@ If you are attempting to transform a hex value, please make sure it is being pas
33178
33179
  }
33179
33180
  }
33180
33181
 
33181
- // ../../node_modules/.pnpm/@noble+hashes@1.3.3/node_modules/@noble/hashes/esm/utils.js
33182
+ // ../../node_modules/.pnpm/@noble+hashes@1.5.0/node_modules/@noble/hashes/esm/cryptoNode.js
33183
+ var nc = __toESM(__require("crypto"), 1);
33184
+ var crypto = nc && typeof nc === "object" && "webcrypto" in nc ? nc.webcrypto : nc && typeof nc === "object" && "randomBytes" in nc ? nc : void 0;
33185
+
33186
+ // ../../node_modules/.pnpm/@noble+hashes@1.5.0/node_modules/@noble/hashes/esm/utils.js
33182
33187
  var u32 = (arr) => new Uint32Array(arr.buffer, arr.byteOffset, Math.floor(arr.byteLength / 4));
33183
- function isBytes2(a) {
33184
- return a instanceof Uint8Array || a != null && typeof a === "object" && a.constructor.name === "Uint8Array";
33185
- }
33186
33188
  var createView = (arr) => new DataView(arr.buffer, arr.byteOffset, arr.byteLength);
33187
33189
  var rotr = (word, shift) => word << 32 - shift | word >>> shift;
33190
+ var rotl = (word, shift) => word << shift | word >>> 32 - shift >>> 0;
33188
33191
  var isLE = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68;
33189
- if (!isLE)
33190
- throw new Error("Non little-endian hardware is not supported");
33192
+ var byteSwap = (word) => word << 24 & 4278190080 | word << 8 & 16711680 | word >>> 8 & 65280 | word >>> 24 & 255;
33193
+ function byteSwap32(arr) {
33194
+ for (let i = 0; i < arr.length; i++) {
33195
+ arr[i] = byteSwap(arr[i]);
33196
+ }
33197
+ }
33191
33198
  function utf8ToBytes(str) {
33192
33199
  if (typeof str !== "string")
33193
33200
  throw new Error(`utf8ToBytes expected string, got ${typeof str}`);
@@ -33196,10 +33203,24 @@ If you are attempting to transform a hex value, please make sure it is being pas
33196
33203
  function toBytes2(data) {
33197
33204
  if (typeof data === "string")
33198
33205
  data = utf8ToBytes(data);
33199
- if (!isBytes2(data))
33200
- throw new Error(`expected Uint8Array, got ${typeof data}`);
33206
+ bytes(data);
33201
33207
  return data;
33202
33208
  }
33209
+ function concatBytes2(...arrays) {
33210
+ let sum = 0;
33211
+ for (let i = 0; i < arrays.length; i++) {
33212
+ const a = arrays[i];
33213
+ bytes(a);
33214
+ sum += a.length;
33215
+ }
33216
+ const res = new Uint8Array(sum);
33217
+ for (let i = 0, pad = 0; i < arrays.length; i++) {
33218
+ const a = arrays[i];
33219
+ res.set(a, pad);
33220
+ pad += a.length;
33221
+ }
33222
+ return res;
33223
+ }
33203
33224
  var Hash = class {
33204
33225
  // Safe version that clones internal state
33205
33226
  clone() {
@@ -33229,27 +33250,38 @@ If you are attempting to transform a hex value, please make sure it is being pas
33229
33250
  hashC.create = (opts) => hashCons(opts);
33230
33251
  return hashC;
33231
33252
  }
33253
+ function randomBytes(bytesLength = 32) {
33254
+ if (crypto && typeof crypto.getRandomValues === "function") {
33255
+ return crypto.getRandomValues(new Uint8Array(bytesLength));
33256
+ }
33257
+ if (crypto && typeof crypto.randomBytes === "function") {
33258
+ return crypto.randomBytes(bytesLength);
33259
+ }
33260
+ throw new Error("crypto.getRandomValues must be defined");
33261
+ }
33232
33262
 
33233
- // ../../node_modules/.pnpm/@noble+hashes@1.3.3/node_modules/@noble/hashes/esm/_sha2.js
33234
- function setBigUint64(view, byteOffset, value, isLE3) {
33263
+ // ../../node_modules/.pnpm/@noble+hashes@1.5.0/node_modules/@noble/hashes/esm/_md.js
33264
+ function setBigUint64(view, byteOffset, value, isLE2) {
33235
33265
  if (typeof view.setBigUint64 === "function")
33236
- return view.setBigUint64(byteOffset, value, isLE3);
33266
+ return view.setBigUint64(byteOffset, value, isLE2);
33237
33267
  const _32n2 = BigInt(32);
33238
33268
  const _u32_max = BigInt(4294967295);
33239
33269
  const wh = Number(value >> _32n2 & _u32_max);
33240
33270
  const wl = Number(value & _u32_max);
33241
- const h = isLE3 ? 4 : 0;
33242
- const l = isLE3 ? 0 : 4;
33243
- view.setUint32(byteOffset + h, wh, isLE3);
33244
- view.setUint32(byteOffset + l, wl, isLE3);
33271
+ const h = isLE2 ? 4 : 0;
33272
+ const l = isLE2 ? 0 : 4;
33273
+ view.setUint32(byteOffset + h, wh, isLE2);
33274
+ view.setUint32(byteOffset + l, wl, isLE2);
33245
33275
  }
33246
- var SHA2 = class extends Hash {
33247
- constructor(blockLen, outputLen, padOffset, isLE3) {
33276
+ var Chi = (a, b, c) => a & b ^ ~a & c;
33277
+ var Maj = (a, b, c) => a & b ^ a & c ^ b & c;
33278
+ var HashMD = class extends Hash {
33279
+ constructor(blockLen, outputLen, padOffset, isLE2) {
33248
33280
  super();
33249
33281
  this.blockLen = blockLen;
33250
33282
  this.outputLen = outputLen;
33251
33283
  this.padOffset = padOffset;
33252
- this.isLE = isLE3;
33284
+ this.isLE = isLE2;
33253
33285
  this.finished = false;
33254
33286
  this.length = 0;
33255
33287
  this.pos = 0;
@@ -33286,7 +33318,7 @@ If you are attempting to transform a hex value, please make sure it is being pas
33286
33318
  exists(this);
33287
33319
  output(out, this);
33288
33320
  this.finished = true;
33289
- const { buffer, view, blockLen, isLE: isLE3 } = this;
33321
+ const { buffer, view, blockLen, isLE: isLE2 } = this;
33290
33322
  let { pos } = this;
33291
33323
  buffer[pos++] = 128;
33292
33324
  this.buffer.subarray(pos).fill(0);
@@ -33296,7 +33328,7 @@ If you are attempting to transform a hex value, please make sure it is being pas
33296
33328
  }
33297
33329
  for (let i = pos; i < blockLen; i++)
33298
33330
  buffer[i] = 0;
33299
- setBigUint64(view, blockLen - 8, BigInt(this.length * 8), isLE3);
33331
+ setBigUint64(view, blockLen - 8, BigInt(this.length * 8), isLE2);
33300
33332
  this.process(view, 0);
33301
33333
  const oview = createView(out);
33302
33334
  const len = this.outputLen;
@@ -33307,7 +33339,7 @@ If you are attempting to transform a hex value, please make sure it is being pas
33307
33339
  if (outLen > state.length)
33308
33340
  throw new Error("_sha2: outputLen bigger than state");
33309
33341
  for (let i = 0; i < outLen; i++)
33310
- oview.setUint32(4 * i, state[i], isLE3);
33342
+ oview.setUint32(4 * i, state[i], isLE2);
33311
33343
  }
33312
33344
  digest() {
33313
33345
  const { buffer, outputLen } = this;
@@ -33330,9 +33362,7 @@ If you are attempting to transform a hex value, please make sure it is being pas
33330
33362
  }
33331
33363
  };
33332
33364
 
33333
- // ../../node_modules/.pnpm/@noble+hashes@1.3.3/node_modules/@noble/hashes/esm/sha256.js
33334
- var Chi = (a, b, c) => a & b ^ ~a & c;
33335
- var Maj = (a, b, c) => a & b ^ a & c ^ b & c;
33365
+ // ../../node_modules/.pnpm/@noble+hashes@1.5.0/node_modules/@noble/hashes/esm/sha256.js
33336
33366
  var SHA256_K = /* @__PURE__ */ new Uint32Array([
33337
33367
  1116352408,
33338
33368
  1899447441,
@@ -33399,7 +33429,7 @@ If you are attempting to transform a hex value, please make sure it is being pas
33399
33429
  3204031479,
33400
33430
  3329325298
33401
33431
  ]);
33402
- var IV = /* @__PURE__ */ new Uint32Array([
33432
+ var SHA256_IV = /* @__PURE__ */ new Uint32Array([
33403
33433
  1779033703,
33404
33434
  3144134277,
33405
33435
  1013904242,
@@ -33410,17 +33440,17 @@ If you are attempting to transform a hex value, please make sure it is being pas
33410
33440
  1541459225
33411
33441
  ]);
33412
33442
  var SHA256_W = /* @__PURE__ */ new Uint32Array(64);
33413
- var SHA256 = class extends SHA2 {
33443
+ var SHA256 = class extends HashMD {
33414
33444
  constructor() {
33415
33445
  super(64, 32, 8, false);
33416
- this.A = IV[0] | 0;
33417
- this.B = IV[1] | 0;
33418
- this.C = IV[2] | 0;
33419
- this.D = IV[3] | 0;
33420
- this.E = IV[4] | 0;
33421
- this.F = IV[5] | 0;
33422
- this.G = IV[6] | 0;
33423
- this.H = IV[7] | 0;
33446
+ this.A = SHA256_IV[0] | 0;
33447
+ this.B = SHA256_IV[1] | 0;
33448
+ this.C = SHA256_IV[2] | 0;
33449
+ this.D = SHA256_IV[3] | 0;
33450
+ this.E = SHA256_IV[4] | 0;
33451
+ this.F = SHA256_IV[5] | 0;
33452
+ this.G = SHA256_IV[6] | 0;
33453
+ this.H = SHA256_IV[7] | 0;
33424
33454
  }
33425
33455
  get() {
33426
33456
  const { A, B, C, D, E, F, G, H } = this;
@@ -33482,26 +33512,26 @@ If you are attempting to transform a hex value, please make sure it is being pas
33482
33512
  };
33483
33513
  var sha256 = /* @__PURE__ */ wrapConstructor(() => new SHA256());
33484
33514
 
33485
- // ../../node_modules/.pnpm/@noble+hashes@1.3.3/node_modules/@noble/hashes/esm/hmac.js
33515
+ // ../../node_modules/.pnpm/@noble+hashes@1.5.0/node_modules/@noble/hashes/esm/hmac.js
33486
33516
  var HMAC = class extends Hash {
33487
- constructor(hash4, _key) {
33517
+ constructor(hash3, _key) {
33488
33518
  super();
33489
33519
  this.finished = false;
33490
33520
  this.destroyed = false;
33491
- hash(hash4);
33521
+ hash(hash3);
33492
33522
  const key = toBytes2(_key);
33493
- this.iHash = hash4.create();
33523
+ this.iHash = hash3.create();
33494
33524
  if (typeof this.iHash.update !== "function")
33495
33525
  throw new Error("Expected instance of class which extends utils.Hash");
33496
33526
  this.blockLen = this.iHash.blockLen;
33497
33527
  this.outputLen = this.iHash.outputLen;
33498
33528
  const blockLen = this.blockLen;
33499
33529
  const pad = new Uint8Array(blockLen);
33500
- pad.set(key.length > blockLen ? hash4.create().update(key).digest() : key);
33530
+ pad.set(key.length > blockLen ? hash3.create().update(key).digest() : key);
33501
33531
  for (let i = 0; i < pad.length; i++)
33502
33532
  pad[i] ^= 54;
33503
33533
  this.iHash.update(pad);
33504
- this.oHash = hash4.create();
33534
+ this.oHash = hash3.create();
33505
33535
  for (let i = 0; i < pad.length; i++)
33506
33536
  pad[i] ^= 54 ^ 92;
33507
33537
  this.oHash.update(pad);
@@ -33544,12 +33574,12 @@ If you are attempting to transform a hex value, please make sure it is being pas
33544
33574
  this.iHash.destroy();
33545
33575
  }
33546
33576
  };
33547
- var hmac = (hash4, key, message) => new HMAC(hash4, key).update(message).digest();
33548
- hmac.create = (hash4, key) => new HMAC(hash4, key);
33577
+ var hmac = (hash3, key, message) => new HMAC(hash3, key).update(message).digest();
33578
+ hmac.create = (hash3, key) => new HMAC(hash3, key);
33549
33579
 
33550
- // ../../node_modules/.pnpm/@noble+hashes@1.3.3/node_modules/@noble/hashes/esm/pbkdf2.js
33551
- function pbkdf2Init(hash4, _password, _salt, _opts) {
33552
- hash(hash4);
33580
+ // ../../node_modules/.pnpm/@noble+hashes@1.5.0/node_modules/@noble/hashes/esm/pbkdf2.js
33581
+ function pbkdf2Init(hash3, _password, _salt, _opts) {
33582
+ hash(hash3);
33553
33583
  const opts = checkOpts({ dkLen: 32, asyncTick: 10 }, _opts);
33554
33584
  const { c, dkLen, asyncTick } = opts;
33555
33585
  number(c);
@@ -33560,7 +33590,7 @@ If you are attempting to transform a hex value, please make sure it is being pas
33560
33590
  const password = toBytes2(_password);
33561
33591
  const salt = toBytes2(_salt);
33562
33592
  const DK = new Uint8Array(dkLen);
33563
- const PRF = hmac.create(hash4, password);
33593
+ const PRF = hmac.create(hash3, password);
33564
33594
  const PRFSalt = PRF._cloneInto().update(salt);
33565
33595
  return { c, dkLen, asyncTick, DK, PRF, PRFSalt };
33566
33596
  }
@@ -33572,8 +33602,8 @@ If you are attempting to transform a hex value, please make sure it is being pas
33572
33602
  u.fill(0);
33573
33603
  return DK;
33574
33604
  }
33575
- function pbkdf2(hash4, password, salt, opts) {
33576
- const { c, dkLen, DK, PRF, PRFSalt } = pbkdf2Init(hash4, password, salt, opts);
33605
+ function pbkdf2(hash3, password, salt, opts) {
33606
+ const { c, dkLen, DK, PRF, PRFSalt } = pbkdf2Init(hash3, password, salt, opts);
33577
33607
  let prfW;
33578
33608
  const arr = new Uint8Array(4);
33579
33609
  const view = createView(arr);
@@ -33592,8 +33622,7 @@ If you are attempting to transform a hex value, please make sure it is being pas
33592
33622
  return pbkdf2Output(PRF, PRFSalt, DK, prfW, u);
33593
33623
  }
33594
33624
 
33595
- // ../../node_modules/.pnpm/@noble+hashes@1.3.3/node_modules/@noble/hashes/esm/scrypt.js
33596
- var rotl = (a, b) => a << b | a >>> 32 - b;
33625
+ // ../../node_modules/.pnpm/@noble+hashes@1.5.0/node_modules/@noble/hashes/esm/scrypt.js
33597
33626
  function XorAndSalsa(prev, pi, input, ii, out, oi) {
33598
33627
  let y00 = prev[pi++] ^ input[ii++], y01 = prev[pi++] ^ input[ii++];
33599
33628
  let y02 = prev[pi++] ^ input[ii++], y03 = prev[pi++] ^ input[ii++];
@@ -33684,8 +33713,8 @@ If you are attempting to transform a hex value, please make sure it is being pas
33684
33713
  throw new Error("progressCb should be function");
33685
33714
  const blockSize = 128 * r;
33686
33715
  const blockSize32 = blockSize / 4;
33687
- if (N <= 1 || (N & N - 1) !== 0 || N >= 2 ** (blockSize / 8) || N > 2 ** 32) {
33688
- throw new Error("Scrypt: N must be larger than 1, a power of 2, less than 2^(128 * r / 8) and less than 2^32");
33716
+ if (N <= 1 || (N & N - 1) !== 0 || N > 2 ** 32) {
33717
+ throw new Error("Scrypt: N must be larger than 1, a power of 2, and less than 2^32");
33689
33718
  }
33690
33719
  if (p < 0 || p > (2 ** 32 - 1) * 32 / blockSize) {
33691
33720
  throw new Error("Scrypt: p must be a positive integer less than or equal to ((2^32 - 1) * 32) / (128 * r)");
@@ -33724,6 +33753,8 @@ If you are attempting to transform a hex value, please make sure it is being pas
33724
33753
  }
33725
33754
  function scrypt(password, salt, opts) {
33726
33755
  const { N, r, p, dkLen, blockSize32, V, B32, B, tmp, blockMixCb } = scryptInit(password, salt, opts);
33756
+ if (!isLE)
33757
+ byteSwap32(B32);
33727
33758
  for (let pi = 0; pi < p; pi++) {
33728
33759
  const Pi2 = blockSize32 * pi;
33729
33760
  for (let i = 0; i < blockSize32; i++)
@@ -33742,10 +33773,12 @@ If you are attempting to transform a hex value, please make sure it is being pas
33742
33773
  blockMixCb();
33743
33774
  }
33744
33775
  }
33776
+ if (!isLE)
33777
+ byteSwap32(B32);
33745
33778
  return scryptOutput(password, dkLen, B, V, tmp);
33746
33779
  }
33747
33780
 
33748
- // ../../node_modules/.pnpm/@noble+hashes@1.3.3/node_modules/@noble/hashes/esm/_u64.js
33781
+ // ../../node_modules/.pnpm/@noble+hashes@1.5.0/node_modules/@noble/hashes/esm/_u64.js
33749
33782
  var U32_MASK64 = /* @__PURE__ */ BigInt(2 ** 32 - 1);
33750
33783
  var _32n = /* @__PURE__ */ BigInt(32);
33751
33784
  function fromBig(n, le = false) {
@@ -33767,8 +33800,10 @@ If you are attempting to transform a hex value, please make sure it is being pas
33767
33800
  var rotlBH = (h, l, s) => l << s - 32 | h >>> 64 - s;
33768
33801
  var rotlBL = (h, l, s) => h << s - 32 | l >>> 64 - s;
33769
33802
 
33770
- // ../../node_modules/.pnpm/@noble+hashes@1.3.3/node_modules/@noble/hashes/esm/sha3.js
33771
- var [SHA3_PI, SHA3_ROTL, _SHA3_IOTA] = [[], [], []];
33803
+ // ../../node_modules/.pnpm/@noble+hashes@1.5.0/node_modules/@noble/hashes/esm/sha3.js
33804
+ var SHA3_PI = [];
33805
+ var SHA3_ROTL = [];
33806
+ var _SHA3_IOTA = [];
33772
33807
  var _0n = /* @__PURE__ */ BigInt(0);
33773
33808
  var _1n = /* @__PURE__ */ BigInt(1);
33774
33809
  var _2n = /* @__PURE__ */ BigInt(2);
@@ -33850,7 +33885,11 @@ If you are attempting to transform a hex value, please make sure it is being pas
33850
33885
  this.state32 = u32(this.state);
33851
33886
  }
33852
33887
  keccak() {
33888
+ if (!isLE)
33889
+ byteSwap32(this.state32);
33853
33890
  keccakP(this.state32, this.rounds);
33891
+ if (!isLE)
33892
+ byteSwap32(this.state32);
33854
33893
  this.posOut = 0;
33855
33894
  this.pos = 0;
33856
33895
  }
@@ -33900,9 +33939,9 @@ If you are attempting to transform a hex value, please make sure it is being pas
33900
33939
  throw new Error("XOF is not possible for this instance");
33901
33940
  return this.writeInto(out);
33902
33941
  }
33903
- xof(bytes3) {
33904
- number(bytes3);
33905
- return this.xofInto(new Uint8Array(bytes3));
33942
+ xof(bytes2) {
33943
+ number(bytes2);
33944
+ return this.xofInto(new Uint8Array(bytes2));
33906
33945
  }
33907
33946
  digestInto(out) {
33908
33947
  output(out, this);
@@ -33947,9 +33986,9 @@ If you are attempting to transform a hex value, please make sure it is being pas
33947
33986
  var shake128 = /* @__PURE__ */ genShake(31, 168, 128 / 8);
33948
33987
  var shake256 = /* @__PURE__ */ genShake(31, 136, 256 / 8);
33949
33988
 
33950
- // ../../node_modules/.pnpm/@noble+hashes@1.3.3/node_modules/@noble/hashes/esm/ripemd160.js
33989
+ // ../../node_modules/.pnpm/@noble+hashes@1.5.0/node_modules/@noble/hashes/esm/ripemd160.js
33951
33990
  var Rho = /* @__PURE__ */ new Uint8Array([7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8]);
33952
- var Id = /* @__PURE__ */ Uint8Array.from({ length: 16 }, (_, i) => i);
33991
+ var Id = /* @__PURE__ */ new Uint8Array(new Array(16).fill(0).map((_, i) => i));
33953
33992
  var Pi = /* @__PURE__ */ Id.map((i) => (9 * i + 5) % 16);
33954
33993
  var idxL = [Id];
33955
33994
  var idxR = [Pi];
@@ -33979,7 +34018,6 @@ If you are attempting to transform a hex value, please make sure it is being pas
33979
34018
  2053994217,
33980
34019
  0
33981
34020
  ]);
33982
- var rotl2 = (word, shift) => word << shift | word >>> 32 - shift;
33983
34021
  function f(group, x, y, z) {
33984
34022
  if (group === 0)
33985
34023
  return x ^ y ^ z;
@@ -33992,8 +34030,8 @@ If you are attempting to transform a hex value, please make sure it is being pas
33992
34030
  else
33993
34031
  return x ^ (y | ~z);
33994
34032
  }
33995
- var BUF = /* @__PURE__ */ new Uint32Array(16);
33996
- var RIPEMD160 = class extends SHA2 {
34033
+ var R_BUF = /* @__PURE__ */ new Uint32Array(16);
34034
+ var RIPEMD160 = class extends HashMD {
33997
34035
  constructor() {
33998
34036
  super(64, 20, 8, true);
33999
34037
  this.h0 = 1732584193 | 0;
@@ -34015,7 +34053,7 @@ If you are attempting to transform a hex value, please make sure it is being pas
34015
34053
  }
34016
34054
  process(view, offset) {
34017
34055
  for (let i = 0; i < 16; i++, offset += 4)
34018
- BUF[i] = view.getUint32(offset, true);
34056
+ R_BUF[i] = view.getUint32(offset, true);
34019
34057
  let al = this.h0 | 0, ar = al, bl = this.h1 | 0, br = bl, cl = this.h2 | 0, cr = cl, dl = this.h3 | 0, dr = dl, el = this.h4 | 0, er = el;
34020
34058
  for (let group = 0; group < 5; group++) {
34021
34059
  const rGroup = 4 - group;
@@ -34023,18 +34061,18 @@ If you are attempting to transform a hex value, please make sure it is being pas
34023
34061
  const rl = idxL[group], rr = idxR[group];
34024
34062
  const sl = shiftsL[group], sr = shiftsR[group];
34025
34063
  for (let i = 0; i < 16; i++) {
34026
- const tl = rotl2(al + f(group, bl, cl, dl) + BUF[rl[i]] + hbl, sl[i]) + el | 0;
34027
- al = el, el = dl, dl = rotl2(cl, 10) | 0, cl = bl, bl = tl;
34064
+ const tl = rotl(al + f(group, bl, cl, dl) + R_BUF[rl[i]] + hbl, sl[i]) + el | 0;
34065
+ al = el, el = dl, dl = rotl(cl, 10) | 0, cl = bl, bl = tl;
34028
34066
  }
34029
34067
  for (let i = 0; i < 16; i++) {
34030
- const tr2 = rotl2(ar + f(rGroup, br, cr, dr) + BUF[rr[i]] + hbr, sr[i]) + er | 0;
34031
- ar = er, er = dr, dr = rotl2(cr, 10) | 0, cr = br, br = tr2;
34068
+ const tr2 = rotl(ar + f(rGroup, br, cr, dr) + R_BUF[rr[i]] + hbr, sr[i]) + er | 0;
34069
+ ar = er, er = dr, dr = rotl(cr, 10) | 0, cr = br, br = tr2;
34032
34070
  }
34033
34071
  }
34034
34072
  this.set(this.h1 + cl + dr | 0, this.h2 + dl + er | 0, this.h3 + el + ar | 0, this.h4 + al + br | 0, this.h0 + bl + cr | 0);
34035
34073
  }
34036
34074
  roundClean() {
34037
- BUF.fill(0);
34075
+ R_BUF.fill(0);
34038
34076
  }
34039
34077
  destroy() {
34040
34078
  this.destroyed = true;
@@ -34045,12 +34083,12 @@ If you are attempting to transform a hex value, please make sure it is being pas
34045
34083
  var ripemd160 = /* @__PURE__ */ wrapConstructor(() => new RIPEMD160());
34046
34084
 
34047
34085
  // ../crypto/dist/index.mjs
34048
- var import_crypto = __toESM(__require("crypto"), 1);
34049
- var import_crypto2 = __require("crypto");
34050
- var import_crypto3 = __toESM(__require("crypto"), 1);
34086
+ var import_crypto2 = __toESM(__require("crypto"), 1);
34087
+ var import_crypto3 = __require("crypto");
34051
34088
  var import_crypto4 = __toESM(__require("crypto"), 1);
34052
- var import_crypto5 = __require("crypto");
34089
+ var import_crypto5 = __toESM(__require("crypto"), 1);
34053
34090
  var import_crypto6 = __require("crypto");
34091
+ var import_crypto7 = __require("crypto");
34054
34092
  var scrypt2 = (params) => {
34055
34093
  const { password, salt, n, p, r, dklen } = params;
34056
34094
  const derivedKey = scrypt(password, salt, { N: n, r, p, dkLen: dklen });
@@ -34065,10 +34103,10 @@ If you are attempting to transform a hex value, please make sure it is being pas
34065
34103
  function pbkdf22(_password, _salt, iterations, keylen, algo) {
34066
34104
  const password = arrayify(_password, "password");
34067
34105
  const salt = arrayify(_salt, "salt");
34068
- return hexlify((0, import_crypto2.pbkdf2Sync)(password, salt, iterations, keylen, algo));
34106
+ return hexlify((0, import_crypto3.pbkdf2Sync)(password, salt, iterations, keylen, algo));
34069
34107
  }
34070
- var randomBytes = (length) => {
34071
- const randomValues = Uint8Array.from(import_crypto3.default.randomBytes(length));
34108
+ var randomBytes2 = (length) => {
34109
+ const randomValues = Uint8Array.from(import_crypto4.default.randomBytes(length));
34072
34110
  return randomValues;
34073
34111
  };
34074
34112
  var stringFromBuffer = (buffer, encoding = "base64") => Buffer.from(buffer).toString(encoding);
@@ -34079,11 +34117,11 @@ If you are attempting to transform a hex value, please make sure it is being pas
34079
34117
  return arrayify(key);
34080
34118
  };
34081
34119
  var encrypt = async (password, data) => {
34082
- const iv = randomBytes(16);
34083
- const salt = randomBytes(32);
34120
+ const iv = randomBytes2(16);
34121
+ const salt = randomBytes2(32);
34084
34122
  const secret = keyFromPassword(password, salt);
34085
34123
  const dataBuffer = Uint8Array.from(Buffer.from(JSON.stringify(data), "utf-8"));
34086
- const cipher = await import_crypto.default.createCipheriv(ALGORITHM, secret, iv);
34124
+ const cipher = await import_crypto2.default.createCipheriv(ALGORITHM, secret, iv);
34087
34125
  let cipherData = cipher.update(dataBuffer);
34088
34126
  cipherData = Buffer.concat([cipherData, cipher.final()]);
34089
34127
  return {
@@ -34097,7 +34135,7 @@ If you are attempting to transform a hex value, please make sure it is being pas
34097
34135
  const salt = bufferFromString(keystore.salt);
34098
34136
  const secret = keyFromPassword(password, salt);
34099
34137
  const encryptedText = bufferFromString(keystore.data);
34100
- const decipher = await import_crypto.default.createDecipheriv(ALGORITHM, secret, iv);
34138
+ const decipher = await import_crypto2.default.createDecipheriv(ALGORITHM, secret, iv);
34101
34139
  const decrypted = decipher.update(encryptedText);
34102
34140
  const deBuff = Buffer.concat([decrypted, decipher.final()]);
34103
34141
  const decryptedData = Buffer.from(deBuff).toString("utf-8");
@@ -34108,28 +34146,28 @@ If you are attempting to transform a hex value, please make sure it is being pas
34108
34146
  }
34109
34147
  };
34110
34148
  async function encryptJsonWalletData(data, key, iv) {
34111
- const cipher = await import_crypto4.default.createCipheriv("aes-128-ctr", key.subarray(0, 16), iv);
34149
+ const cipher = await import_crypto5.default.createCipheriv("aes-128-ctr", key.subarray(0, 16), iv);
34112
34150
  const encrypted = Buffer.concat([cipher.update(data), cipher.final()]);
34113
34151
  return new Uint8Array(encrypted);
34114
34152
  }
34115
34153
  async function decryptJsonWalletData(data, key, iv) {
34116
- const decipher = import_crypto4.default.createDecipheriv("aes-128-ctr", key.subarray(0, 16), iv);
34154
+ const decipher = import_crypto5.default.createDecipheriv("aes-128-ctr", key.subarray(0, 16), iv);
34117
34155
  const decrypted = await Buffer.concat([decipher.update(data), decipher.final()]);
34118
34156
  return new Uint8Array(decrypted);
34119
34157
  }
34120
34158
  function computeHmac(algorithm, _key, _data) {
34121
34159
  const key = arrayify(_key, "key");
34122
34160
  const data = arrayify(_data, "data");
34123
- return hexlify((0, import_crypto5.createHmac)(algorithm, key).update(data).digest());
34161
+ return hexlify((0, import_crypto6.createHmac)(algorithm, key).update(data).digest());
34124
34162
  }
34125
- var randomUUID = () => (0, import_crypto6.randomUUID)();
34163
+ var randomUUID = () => (0, import_crypto7.randomUUID)();
34126
34164
  var api = {
34127
34165
  bufferFromString,
34128
34166
  stringFromBuffer,
34129
34167
  decrypt,
34130
34168
  encrypt,
34131
34169
  keyFromPassword,
34132
- randomBytes,
34170
+ randomBytes: randomBytes2,
34133
34171
  scrypt: scrypt2,
34134
34172
  keccak256,
34135
34173
  decryptJsonWalletData,
@@ -34145,7 +34183,7 @@ If you are attempting to transform a hex value, please make sure it is being pas
34145
34183
  decrypt: decrypt2,
34146
34184
  encrypt: encrypt2,
34147
34185
  keyFromPassword: keyFromPassword2,
34148
- randomBytes: randomBytes2,
34186
+ randomBytes: randomBytes22,
34149
34187
  stringFromBuffer: stringFromBuffer2,
34150
34188
  scrypt: scrypt22,
34151
34189
  keccak256: keccak2562,
@@ -34209,9 +34247,9 @@ If you are attempting to transform a hex value, please make sure it is being pas
34209
34247
  var STR_SLICE_CODER_TYPE = "str";
34210
34248
  var VOID_TYPE = "()";
34211
34249
  var optionRegEx = /^enum (std::option::)?Option$/m;
34212
- var stringRegEx = /str\[(?<length>[0-9]+)\]/;
34213
- var arrayRegEx = /\[(?<item>[\w\s\\[\]]+);\s*(?<length>[0-9]+)\]/;
34214
- var structRegEx = /struct.+/;
34250
+ var stringRegEx = /^str\[(?<length>[0-9]+)\]/;
34251
+ var arrayRegEx = /^\[(?<item>[\w\s\\[\]]+);\s*(?<length>[0-9]+)\]/;
34252
+ var structRegEx = /^struct.+/;
34215
34253
  var enumRegEx = /^enum.+$/;
34216
34254
  var tupleRegEx = /^\((?<items>.*)\)$/;
34217
34255
  var genericRegEx = /^generic.+$/;
@@ -34327,15 +34365,15 @@ If you are attempting to transform a hex value, please make sure it is being pas
34327
34365
  if (data.length < this.encodedLength) {
34328
34366
  throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid b256 data size.`);
34329
34367
  }
34330
- let bytes3 = data.slice(offset, offset + this.encodedLength);
34331
- const decoded = bn(bytes3);
34368
+ let bytes2 = data.slice(offset, offset + this.encodedLength);
34369
+ const decoded = bn(bytes2);
34332
34370
  if (decoded.isZero()) {
34333
- bytes3 = new Uint8Array(32);
34371
+ bytes2 = new Uint8Array(32);
34334
34372
  }
34335
- if (bytes3.length !== this.encodedLength) {
34373
+ if (bytes2.length !== this.encodedLength) {
34336
34374
  throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid b256 byte data size.`);
34337
34375
  }
34338
- return [toHex(bytes3, 32), offset + 32];
34376
+ return [toHex(bytes2, 32), offset + 32];
34339
34377
  }
34340
34378
  };
34341
34379
  var B512Coder = class extends Coder {
@@ -34358,15 +34396,15 @@ If you are attempting to transform a hex value, please make sure it is being pas
34358
34396
  if (data.length < this.encodedLength) {
34359
34397
  throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid b512 data size.`);
34360
34398
  }
34361
- let bytes3 = data.slice(offset, offset + this.encodedLength);
34362
- const decoded = bn(bytes3);
34399
+ let bytes2 = data.slice(offset, offset + this.encodedLength);
34400
+ const decoded = bn(bytes2);
34363
34401
  if (decoded.isZero()) {
34364
- bytes3 = new Uint8Array(64);
34402
+ bytes2 = new Uint8Array(64);
34365
34403
  }
34366
- if (bytes3.length !== this.encodedLength) {
34404
+ if (bytes2.length !== this.encodedLength) {
34367
34405
  throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid b512 byte data size.`);
34368
34406
  }
34369
- return [toHex(bytes3, this.encodedLength), offset + this.encodedLength];
34407
+ return [toHex(bytes2, this.encodedLength), offset + this.encodedLength];
34370
34408
  }
34371
34409
  };
34372
34410
  var encodedLengths = {
@@ -34378,24 +34416,24 @@ If you are attempting to transform a hex value, please make sure it is being pas
34378
34416
  super("bigNumber", baseType, encodedLengths[baseType]);
34379
34417
  }
34380
34418
  encode(value) {
34381
- let bytes3;
34419
+ let bytes2;
34382
34420
  try {
34383
- bytes3 = toBytes(value, this.encodedLength);
34421
+ bytes2 = toBytes(value, this.encodedLength);
34384
34422
  } catch (error) {
34385
34423
  throw new FuelError(ErrorCode.ENCODE_ERROR, `Invalid ${this.type}.`);
34386
34424
  }
34387
- return bytes3;
34425
+ return bytes2;
34388
34426
  }
34389
34427
  decode(data, offset) {
34390
34428
  if (data.length < this.encodedLength) {
34391
34429
  throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid ${this.type} data size.`);
34392
34430
  }
34393
- let bytes3 = data.slice(offset, offset + this.encodedLength);
34394
- bytes3 = bytes3.slice(0, this.encodedLength);
34395
- if (bytes3.length !== this.encodedLength) {
34431
+ let bytes2 = data.slice(offset, offset + this.encodedLength);
34432
+ bytes2 = bytes2.slice(0, this.encodedLength);
34433
+ if (bytes2.length !== this.encodedLength) {
34396
34434
  throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid ${this.type} byte data size.`);
34397
34435
  }
34398
- return [bn(bytes3), offset + this.encodedLength];
34436
+ return [bn(bytes2), offset + this.encodedLength];
34399
34437
  }
34400
34438
  };
34401
34439
  var BooleanCoder = class extends Coder {
@@ -34418,11 +34456,11 @@ If you are attempting to transform a hex value, please make sure it is being pas
34418
34456
  if (data.length < this.encodedLength) {
34419
34457
  throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid boolean data size.`);
34420
34458
  }
34421
- const bytes3 = bn(data.slice(offset, offset + this.encodedLength));
34422
- if (bytes3.isZero()) {
34459
+ const bytes2 = bn(data.slice(offset, offset + this.encodedLength));
34460
+ if (bytes2.isZero()) {
34423
34461
  return [false, offset + this.encodedLength];
34424
34462
  }
34425
- if (!bytes3.eq(bn(1))) {
34463
+ if (!bytes2.eq(bn(1))) {
34426
34464
  throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid boolean value.`);
34427
34465
  }
34428
34466
  return [true, offset + this.encodedLength];
@@ -34433,9 +34471,9 @@ If you are attempting to transform a hex value, please make sure it is being pas
34433
34471
  super("struct", "struct Bytes", WORD_SIZE);
34434
34472
  }
34435
34473
  encode(value) {
34436
- const bytes3 = value instanceof Uint8Array ? value : new Uint8Array(value);
34437
- const lengthBytes = new BigNumberCoder("u64").encode(bytes3.length);
34438
- return new Uint8Array([...lengthBytes, ...bytes3]);
34474
+ const bytes2 = value instanceof Uint8Array ? value : new Uint8Array(value);
34475
+ const lengthBytes = new BigNumberCoder("u64").encode(bytes2.length);
34476
+ return new Uint8Array([...lengthBytes, ...bytes2]);
34439
34477
  }
34440
34478
  decode(data, offset) {
34441
34479
  if (data.length < WORD_SIZE) {
@@ -34557,26 +34595,26 @@ If you are attempting to transform a hex value, please make sure it is being pas
34557
34595
  this.options = options;
34558
34596
  }
34559
34597
  encode(value) {
34560
- let bytes3;
34598
+ let bytes2;
34561
34599
  try {
34562
- bytes3 = toBytes(value);
34600
+ bytes2 = toBytes(value);
34563
34601
  } catch (error) {
34564
34602
  throw new FuelError(ErrorCode.ENCODE_ERROR, `Invalid ${this.baseType}.`);
34565
34603
  }
34566
- if (bytes3.length > this.encodedLength) {
34604
+ if (bytes2.length > this.encodedLength) {
34567
34605
  throw new FuelError(ErrorCode.ENCODE_ERROR, `Invalid ${this.baseType}, too many bytes.`);
34568
34606
  }
34569
- return toBytes(bytes3, this.encodedLength);
34607
+ return toBytes(bytes2, this.encodedLength);
34570
34608
  }
34571
34609
  decode(data, offset) {
34572
34610
  if (data.length < this.encodedLength) {
34573
34611
  throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid number data size.`);
34574
34612
  }
34575
- const bytes3 = data.slice(offset, offset + this.encodedLength);
34576
- if (bytes3.length !== this.encodedLength) {
34613
+ const bytes2 = data.slice(offset, offset + this.encodedLength);
34614
+ if (bytes2.length !== this.encodedLength) {
34577
34615
  throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid number byte data size.`);
34578
34616
  }
34579
- return [toNumber(bytes3), offset + this.encodedLength];
34617
+ return [toNumber(bytes2), offset + this.encodedLength];
34580
34618
  }
34581
34619
  };
34582
34620
  var OptionCoder = class extends EnumCoder {
@@ -34594,9 +34632,9 @@ If you are attempting to transform a hex value, please make sure it is being pas
34594
34632
  const [decoded, newOffset] = super.decode(data, offset);
34595
34633
  return [this.toOption(decoded), newOffset];
34596
34634
  }
34597
- toOption(output3) {
34598
- if (output3 && "Some" in output3) {
34599
- return output3.Some;
34635
+ toOption(output2) {
34636
+ if (output2 && "Some" in output2) {
34637
+ return output2.Some;
34600
34638
  }
34601
34639
  return void 0;
34602
34640
  }
@@ -34610,9 +34648,9 @@ If you are attempting to transform a hex value, please make sure it is being pas
34610
34648
  throw new FuelError(ErrorCode.ENCODE_ERROR, `Expected array value.`);
34611
34649
  }
34612
34650
  const internalCoder = new ArrayCoder(new NumberCoder("u8"), value.length);
34613
- const bytes3 = internalCoder.encode(value);
34614
- const lengthBytes = new BigNumberCoder("u64").encode(bytes3.length);
34615
- return new Uint8Array([...lengthBytes, ...bytes3]);
34651
+ const bytes2 = internalCoder.encode(value);
34652
+ const lengthBytes = new BigNumberCoder("u64").encode(bytes2.length);
34653
+ return new Uint8Array([...lengthBytes, ...bytes2]);
34616
34654
  }
34617
34655
  decode(data, offset) {
34618
34656
  if (data.length < this.encodedLength) {
@@ -34635,9 +34673,9 @@ If you are attempting to transform a hex value, please make sure it is being pas
34635
34673
  super("struct", "struct String", WORD_SIZE);
34636
34674
  }
34637
34675
  encode(value) {
34638
- const bytes3 = toUtf8Bytes(value);
34676
+ const bytes2 = toUtf8Bytes(value);
34639
34677
  const lengthBytes = new BigNumberCoder("u64").encode(value.length);
34640
- return new Uint8Array([...lengthBytes, ...bytes3]);
34678
+ return new Uint8Array([...lengthBytes, ...bytes2]);
34641
34679
  }
34642
34680
  decode(data, offset) {
34643
34681
  if (data.length < this.encodedLength) {
@@ -34659,9 +34697,9 @@ If you are attempting to transform a hex value, please make sure it is being pas
34659
34697
  super("strSlice", "str", WORD_SIZE);
34660
34698
  }
34661
34699
  encode(value) {
34662
- const bytes3 = toUtf8Bytes(value);
34700
+ const bytes2 = toUtf8Bytes(value);
34663
34701
  const lengthBytes = new BigNumberCoder("u64").encode(value.length);
34664
- return new Uint8Array([...lengthBytes, ...bytes3]);
34702
+ return new Uint8Array([...lengthBytes, ...bytes2]);
34665
34703
  }
34666
34704
  decode(data, offset) {
34667
34705
  if (data.length < this.encodedLength) {
@@ -34670,11 +34708,11 @@ If you are attempting to transform a hex value, please make sure it is being pas
34670
34708
  const offsetAndLength = offset + WORD_SIZE;
34671
34709
  const lengthBytes = data.slice(offset, offsetAndLength);
34672
34710
  const length = bn(new BigNumberCoder("u64").decode(lengthBytes, 0)[0]).toNumber();
34673
- const bytes3 = data.slice(offsetAndLength, offsetAndLength + length);
34674
- if (bytes3.length !== length) {
34711
+ const bytes2 = data.slice(offsetAndLength, offsetAndLength + length);
34712
+ if (bytes2.length !== length) {
34675
34713
  throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid string slice byte data size.`);
34676
34714
  }
34677
- return [toUtf8String(bytes3), offsetAndLength + length];
34715
+ return [toUtf8String(bytes2), offsetAndLength + length];
34678
34716
  }
34679
34717
  };
34680
34718
  __publicField4(StrSliceCoder, "memorySize", 1);
@@ -34692,11 +34730,11 @@ If you are attempting to transform a hex value, please make sure it is being pas
34692
34730
  if (data.length < this.encodedLength) {
34693
34731
  throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid string data size.`);
34694
34732
  }
34695
- const bytes3 = data.slice(offset, offset + this.encodedLength);
34696
- if (bytes3.length !== this.encodedLength) {
34733
+ const bytes2 = data.slice(offset, offset + this.encodedLength);
34734
+ if (bytes2.length !== this.encodedLength) {
34697
34735
  throw new FuelError(ErrorCode.DECODE_ERROR, `Invalid string byte data size.`);
34698
34736
  }
34699
- return [toUtf8String(bytes3), offset + this.encodedLength];
34737
+ return [toUtf8String(bytes2), offset + this.encodedLength];
34700
34738
  }
34701
34739
  };
34702
34740
  var StructCoder = class extends Coder {
@@ -34790,9 +34828,9 @@ If you are attempting to transform a hex value, please make sure it is being pas
34790
34828
  if (isUint8Array(value)) {
34791
34829
  return new Uint8Array([...lengthCoder.encode(value.length), ...value]);
34792
34830
  }
34793
- const bytes3 = value.map((v) => this.coder.encode(v));
34831
+ const bytes2 = value.map((v) => this.coder.encode(v));
34794
34832
  const lengthBytes = lengthCoder.encode(value.length);
34795
- return new Uint8Array([...lengthBytes, ...concatBytes(bytes3)]);
34833
+ return new Uint8Array([...lengthBytes, ...concatBytes(bytes2)]);
34796
34834
  }
34797
34835
  decode(data, offset) {
34798
34836
  if (!this.#hasNestedOption && data.length < this.encodedLength || data.length > MAX_BYTES) {
@@ -35180,10 +35218,10 @@ If you are attempting to transform a hex value, please make sure it is being pas
35180
35218
  return new TupleCoder(coders).encode(argumentValues);
35181
35219
  }
35182
35220
  decodeArguments(data) {
35183
- const bytes3 = arrayify(data);
35221
+ const bytes2 = arrayify(data);
35184
35222
  const nonVoidInputs = findNonVoidInputs(this.jsonAbiOld, this.jsonFnOld.inputs);
35185
35223
  if (nonVoidInputs.length === 0) {
35186
- if (bytes3.length === 0) {
35224
+ if (bytes2.length === 0) {
35187
35225
  return void 0;
35188
35226
  }
35189
35227
  throw new FuelError(
@@ -35192,12 +35230,12 @@ If you are attempting to transform a hex value, please make sure it is being pas
35192
35230
  count: {
35193
35231
  types: this.jsonFn.inputs.length,
35194
35232
  nonVoidInputs: nonVoidInputs.length,
35195
- values: bytes3.length
35233
+ values: bytes2.length
35196
35234
  },
35197
35235
  value: {
35198
35236
  args: this.jsonFn.inputs,
35199
35237
  nonVoidInputs,
35200
- values: bytes3
35238
+ values: bytes2
35201
35239
  }
35202
35240
  })}`
35203
35241
  );
@@ -35205,7 +35243,7 @@ If you are attempting to transform a hex value, please make sure it is being pas
35205
35243
  const result = this.jsonFnOld.inputs.reduce(
35206
35244
  (obj, input) => {
35207
35245
  const coder = AbiCoder.getCoder(this.jsonAbiOld, input, { encoding: this.encoding });
35208
- const [decodedValue, decodedValueByteSize] = coder.decode(bytes3, obj.offset);
35246
+ const [decodedValue, decodedValueByteSize] = coder.decode(bytes2, obj.offset);
35209
35247
  return {
35210
35248
  decoded: [...obj.decoded, decodedValue],
35211
35249
  offset: obj.offset + decodedValueByteSize
@@ -35216,11 +35254,11 @@ If you are attempting to transform a hex value, please make sure it is being pas
35216
35254
  return result.decoded;
35217
35255
  }
35218
35256
  decodeOutput(data) {
35219
- const bytes3 = arrayify(data);
35257
+ const bytes2 = arrayify(data);
35220
35258
  const coder = AbiCoder.getCoder(this.jsonAbiOld, this.jsonFnOld.output, {
35221
35259
  encoding: this.encoding
35222
35260
  });
35223
- return coder.decode(bytes3, 0);
35261
+ return coder.decode(bytes2, 0);
35224
35262
  }
35225
35263
  /**
35226
35264
  * Checks if the function is read-only i.e. it only reads from storage, does not write to it.
@@ -35308,8 +35346,8 @@ If you are attempting to transform a hex value, please make sure it is being pas
35308
35346
  const inputs = fn.inputs.map(
35309
35347
  ({ concreteTypeId, name }) => parseConcreteType(abi, types, concreteTypeId, name)
35310
35348
  );
35311
- const output3 = parseConcreteType(abi, types, fn.output, "");
35312
- return { ...fn, inputs, output: output3 };
35349
+ const output2 = parseConcreteType(abi, types, fn.output, "");
35350
+ return { ...fn, inputs, output: output2 };
35313
35351
  });
35314
35352
  const configurables = abi.configurables.map((conf) => ({
35315
35353
  name: conf.name,
@@ -35477,9 +35515,9 @@ If you are attempting to transform a hex value, please make sure it is being pas
35477
35515
  }
35478
35516
  return addressLike;
35479
35517
  };
35480
- var getRandomB256 = () => hexlify(randomBytes2(32));
35518
+ var getRandomB256 = () => hexlify(randomBytes22(32));
35481
35519
  var clearFirst12BytesFromB256 = (b256) => {
35482
- let bytes3;
35520
+ let bytes2;
35483
35521
  try {
35484
35522
  if (!isB256(b256)) {
35485
35523
  throw new FuelError(
@@ -35487,15 +35525,15 @@ If you are attempting to transform a hex value, please make sure it is being pas
35487
35525
  `Invalid Bech32 Address: ${b256}.`
35488
35526
  );
35489
35527
  }
35490
- bytes3 = getBytesFromBech32(toBech32(b256));
35491
- bytes3 = hexlify(bytes3.fill(0, 0, 12));
35528
+ bytes2 = getBytesFromBech32(toBech32(b256));
35529
+ bytes2 = hexlify(bytes2.fill(0, 0, 12));
35492
35530
  } catch (error) {
35493
35531
  throw new FuelError(
35494
35532
  FuelError.CODES.PARSE_FAILED,
35495
35533
  `Cannot generate EVM Address B256 from: ${b256}.`
35496
35534
  );
35497
35535
  }
35498
- return bytes3;
35536
+ return bytes2;
35499
35537
  };
35500
35538
  var padFirst12BytesOfEvmAddress = (address) => {
35501
35539
  if (!isEvmAddress(address)) {
@@ -35704,416 +35742,11 @@ If you are attempting to transform a hex value, please make sure it is being pas
35704
35742
  }
35705
35743
  };
35706
35744
 
35707
- // ../../node_modules/.pnpm/@noble+hashes@1.4.0/node_modules/@noble/hashes/esm/_assert.js
35708
- function number2(n) {
35709
- if (!Number.isSafeInteger(n) || n < 0)
35710
- throw new Error(`positive integer expected, not ${n}`);
35711
- }
35712
- function isBytes3(a) {
35713
- return a instanceof Uint8Array || a != null && typeof a === "object" && a.constructor.name === "Uint8Array";
35714
- }
35715
- function bytes2(b, ...lengths) {
35716
- if (!isBytes3(b))
35717
- throw new Error("Uint8Array expected");
35718
- if (lengths.length > 0 && !lengths.includes(b.length))
35719
- throw new Error(`Uint8Array expected of length ${lengths}, not of length=${b.length}`);
35720
- }
35721
- function hash3(h) {
35722
- if (typeof h !== "function" || typeof h.create !== "function")
35723
- throw new Error("Hash should be wrapped by utils.wrapConstructor");
35724
- number2(h.outputLen);
35725
- number2(h.blockLen);
35726
- }
35727
- function exists2(instance, checkFinished = true) {
35728
- if (instance.destroyed)
35729
- throw new Error("Hash instance has been destroyed");
35730
- if (checkFinished && instance.finished)
35731
- throw new Error("Hash#digest() has already been called");
35732
- }
35733
- function output2(out, instance) {
35734
- bytes2(out);
35735
- const min = instance.outputLen;
35736
- if (out.length < min) {
35737
- throw new Error(`digestInto() expects output buffer of length at least ${min}`);
35738
- }
35739
- }
35740
-
35741
- // ../../node_modules/.pnpm/@noble+hashes@1.4.0/node_modules/@noble/hashes/esm/cryptoNode.js
35742
- var nc = __toESM(__require("crypto"), 1);
35743
- var crypto4 = nc && typeof nc === "object" && "webcrypto" in nc ? nc.webcrypto : void 0;
35744
-
35745
- // ../../node_modules/.pnpm/@noble+hashes@1.4.0/node_modules/@noble/hashes/esm/utils.js
35746
- var createView2 = (arr) => new DataView(arr.buffer, arr.byteOffset, arr.byteLength);
35747
- var rotr2 = (word, shift) => word << 32 - shift | word >>> shift;
35748
- var isLE2 = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68;
35749
- function utf8ToBytes2(str) {
35750
- if (typeof str !== "string")
35751
- throw new Error(`utf8ToBytes expected string, got ${typeof str}`);
35752
- return new Uint8Array(new TextEncoder().encode(str));
35753
- }
35754
- function toBytes3(data) {
35755
- if (typeof data === "string")
35756
- data = utf8ToBytes2(data);
35757
- bytes2(data);
35758
- return data;
35759
- }
35760
- function concatBytes2(...arrays) {
35761
- let sum = 0;
35762
- for (let i = 0; i < arrays.length; i++) {
35763
- const a = arrays[i];
35764
- bytes2(a);
35765
- sum += a.length;
35766
- }
35767
- const res = new Uint8Array(sum);
35768
- for (let i = 0, pad = 0; i < arrays.length; i++) {
35769
- const a = arrays[i];
35770
- res.set(a, pad);
35771
- pad += a.length;
35772
- }
35773
- return res;
35774
- }
35775
- var Hash2 = class {
35776
- // Safe version that clones internal state
35777
- clone() {
35778
- return this._cloneInto();
35779
- }
35780
- };
35781
- var toStr2 = {}.toString;
35782
- function wrapConstructor2(hashCons) {
35783
- const hashC = (msg) => hashCons().update(toBytes3(msg)).digest();
35784
- const tmp = hashCons();
35785
- hashC.outputLen = tmp.outputLen;
35786
- hashC.blockLen = tmp.blockLen;
35787
- hashC.create = () => hashCons();
35788
- return hashC;
35789
- }
35790
- function randomBytes3(bytesLength = 32) {
35791
- if (crypto4 && typeof crypto4.getRandomValues === "function") {
35792
- return crypto4.getRandomValues(new Uint8Array(bytesLength));
35793
- }
35794
- throw new Error("crypto.getRandomValues must be defined");
35795
- }
35796
-
35797
- // ../../node_modules/.pnpm/@noble+hashes@1.4.0/node_modules/@noble/hashes/esm/_md.js
35798
- function setBigUint642(view, byteOffset, value, isLE3) {
35799
- if (typeof view.setBigUint64 === "function")
35800
- return view.setBigUint64(byteOffset, value, isLE3);
35801
- const _32n2 = BigInt(32);
35802
- const _u32_max = BigInt(4294967295);
35803
- const wh = Number(value >> _32n2 & _u32_max);
35804
- const wl = Number(value & _u32_max);
35805
- const h = isLE3 ? 4 : 0;
35806
- const l = isLE3 ? 0 : 4;
35807
- view.setUint32(byteOffset + h, wh, isLE3);
35808
- view.setUint32(byteOffset + l, wl, isLE3);
35809
- }
35810
- var Chi2 = (a, b, c) => a & b ^ ~a & c;
35811
- var Maj2 = (a, b, c) => a & b ^ a & c ^ b & c;
35812
- var HashMD = class extends Hash2 {
35813
- constructor(blockLen, outputLen, padOffset, isLE3) {
35814
- super();
35815
- this.blockLen = blockLen;
35816
- this.outputLen = outputLen;
35817
- this.padOffset = padOffset;
35818
- this.isLE = isLE3;
35819
- this.finished = false;
35820
- this.length = 0;
35821
- this.pos = 0;
35822
- this.destroyed = false;
35823
- this.buffer = new Uint8Array(blockLen);
35824
- this.view = createView2(this.buffer);
35825
- }
35826
- update(data) {
35827
- exists2(this);
35828
- const { view, buffer, blockLen } = this;
35829
- data = toBytes3(data);
35830
- const len = data.length;
35831
- for (let pos = 0; pos < len; ) {
35832
- const take = Math.min(blockLen - this.pos, len - pos);
35833
- if (take === blockLen) {
35834
- const dataView = createView2(data);
35835
- for (; blockLen <= len - pos; pos += blockLen)
35836
- this.process(dataView, pos);
35837
- continue;
35838
- }
35839
- buffer.set(data.subarray(pos, pos + take), this.pos);
35840
- this.pos += take;
35841
- pos += take;
35842
- if (this.pos === blockLen) {
35843
- this.process(view, 0);
35844
- this.pos = 0;
35845
- }
35846
- }
35847
- this.length += data.length;
35848
- this.roundClean();
35849
- return this;
35850
- }
35851
- digestInto(out) {
35852
- exists2(this);
35853
- output2(out, this);
35854
- this.finished = true;
35855
- const { buffer, view, blockLen, isLE: isLE3 } = this;
35856
- let { pos } = this;
35857
- buffer[pos++] = 128;
35858
- this.buffer.subarray(pos).fill(0);
35859
- if (this.padOffset > blockLen - pos) {
35860
- this.process(view, 0);
35861
- pos = 0;
35862
- }
35863
- for (let i = pos; i < blockLen; i++)
35864
- buffer[i] = 0;
35865
- setBigUint642(view, blockLen - 8, BigInt(this.length * 8), isLE3);
35866
- this.process(view, 0);
35867
- const oview = createView2(out);
35868
- const len = this.outputLen;
35869
- if (len % 4)
35870
- throw new Error("_sha2: outputLen should be aligned to 32bit");
35871
- const outLen = len / 4;
35872
- const state = this.get();
35873
- if (outLen > state.length)
35874
- throw new Error("_sha2: outputLen bigger than state");
35875
- for (let i = 0; i < outLen; i++)
35876
- oview.setUint32(4 * i, state[i], isLE3);
35877
- }
35878
- digest() {
35879
- const { buffer, outputLen } = this;
35880
- this.digestInto(buffer);
35881
- const res = buffer.slice(0, outputLen);
35882
- this.destroy();
35883
- return res;
35884
- }
35885
- _cloneInto(to) {
35886
- to || (to = new this.constructor());
35887
- to.set(...this.get());
35888
- const { blockLen, buffer, length, finished, destroyed, pos } = this;
35889
- to.length = length;
35890
- to.pos = pos;
35891
- to.finished = finished;
35892
- to.destroyed = destroyed;
35893
- if (length % blockLen)
35894
- to.buffer.set(buffer);
35895
- return to;
35896
- }
35897
- };
35898
-
35899
- // ../../node_modules/.pnpm/@noble+hashes@1.4.0/node_modules/@noble/hashes/esm/sha256.js
35900
- var SHA256_K2 = /* @__PURE__ */ new Uint32Array([
35901
- 1116352408,
35902
- 1899447441,
35903
- 3049323471,
35904
- 3921009573,
35905
- 961987163,
35906
- 1508970993,
35907
- 2453635748,
35908
- 2870763221,
35909
- 3624381080,
35910
- 310598401,
35911
- 607225278,
35912
- 1426881987,
35913
- 1925078388,
35914
- 2162078206,
35915
- 2614888103,
35916
- 3248222580,
35917
- 3835390401,
35918
- 4022224774,
35919
- 264347078,
35920
- 604807628,
35921
- 770255983,
35922
- 1249150122,
35923
- 1555081692,
35924
- 1996064986,
35925
- 2554220882,
35926
- 2821834349,
35927
- 2952996808,
35928
- 3210313671,
35929
- 3336571891,
35930
- 3584528711,
35931
- 113926993,
35932
- 338241895,
35933
- 666307205,
35934
- 773529912,
35935
- 1294757372,
35936
- 1396182291,
35937
- 1695183700,
35938
- 1986661051,
35939
- 2177026350,
35940
- 2456956037,
35941
- 2730485921,
35942
- 2820302411,
35943
- 3259730800,
35944
- 3345764771,
35945
- 3516065817,
35946
- 3600352804,
35947
- 4094571909,
35948
- 275423344,
35949
- 430227734,
35950
- 506948616,
35951
- 659060556,
35952
- 883997877,
35953
- 958139571,
35954
- 1322822218,
35955
- 1537002063,
35956
- 1747873779,
35957
- 1955562222,
35958
- 2024104815,
35959
- 2227730452,
35960
- 2361852424,
35961
- 2428436474,
35962
- 2756734187,
35963
- 3204031479,
35964
- 3329325298
35965
- ]);
35966
- var SHA256_IV = /* @__PURE__ */ new Uint32Array([
35967
- 1779033703,
35968
- 3144134277,
35969
- 1013904242,
35970
- 2773480762,
35971
- 1359893119,
35972
- 2600822924,
35973
- 528734635,
35974
- 1541459225
35975
- ]);
35976
- var SHA256_W2 = /* @__PURE__ */ new Uint32Array(64);
35977
- var SHA2562 = class extends HashMD {
35978
- constructor() {
35979
- super(64, 32, 8, false);
35980
- this.A = SHA256_IV[0] | 0;
35981
- this.B = SHA256_IV[1] | 0;
35982
- this.C = SHA256_IV[2] | 0;
35983
- this.D = SHA256_IV[3] | 0;
35984
- this.E = SHA256_IV[4] | 0;
35985
- this.F = SHA256_IV[5] | 0;
35986
- this.G = SHA256_IV[6] | 0;
35987
- this.H = SHA256_IV[7] | 0;
35988
- }
35989
- get() {
35990
- const { A, B, C, D, E, F, G, H } = this;
35991
- return [A, B, C, D, E, F, G, H];
35992
- }
35993
- // prettier-ignore
35994
- set(A, B, C, D, E, F, G, H) {
35995
- this.A = A | 0;
35996
- this.B = B | 0;
35997
- this.C = C | 0;
35998
- this.D = D | 0;
35999
- this.E = E | 0;
36000
- this.F = F | 0;
36001
- this.G = G | 0;
36002
- this.H = H | 0;
36003
- }
36004
- process(view, offset) {
36005
- for (let i = 0; i < 16; i++, offset += 4)
36006
- SHA256_W2[i] = view.getUint32(offset, false);
36007
- for (let i = 16; i < 64; i++) {
36008
- const W15 = SHA256_W2[i - 15];
36009
- const W2 = SHA256_W2[i - 2];
36010
- const s0 = rotr2(W15, 7) ^ rotr2(W15, 18) ^ W15 >>> 3;
36011
- const s1 = rotr2(W2, 17) ^ rotr2(W2, 19) ^ W2 >>> 10;
36012
- SHA256_W2[i] = s1 + SHA256_W2[i - 7] + s0 + SHA256_W2[i - 16] | 0;
36013
- }
36014
- let { A, B, C, D, E, F, G, H } = this;
36015
- for (let i = 0; i < 64; i++) {
36016
- const sigma1 = rotr2(E, 6) ^ rotr2(E, 11) ^ rotr2(E, 25);
36017
- const T1 = H + sigma1 + Chi2(E, F, G) + SHA256_K2[i] + SHA256_W2[i] | 0;
36018
- const sigma0 = rotr2(A, 2) ^ rotr2(A, 13) ^ rotr2(A, 22);
36019
- const T2 = sigma0 + Maj2(A, B, C) | 0;
36020
- H = G;
36021
- G = F;
36022
- F = E;
36023
- E = D + T1 | 0;
36024
- D = C;
36025
- C = B;
36026
- B = A;
36027
- A = T1 + T2 | 0;
36028
- }
36029
- A = A + this.A | 0;
36030
- B = B + this.B | 0;
36031
- C = C + this.C | 0;
36032
- D = D + this.D | 0;
36033
- E = E + this.E | 0;
36034
- F = F + this.F | 0;
36035
- G = G + this.G | 0;
36036
- H = H + this.H | 0;
36037
- this.set(A, B, C, D, E, F, G, H);
36038
- }
36039
- roundClean() {
36040
- SHA256_W2.fill(0);
36041
- }
36042
- destroy() {
36043
- this.set(0, 0, 0, 0, 0, 0, 0, 0);
36044
- this.buffer.fill(0);
36045
- }
36046
- };
36047
- var sha2563 = /* @__PURE__ */ wrapConstructor2(() => new SHA2562());
36048
-
36049
- // ../../node_modules/.pnpm/@noble+hashes@1.4.0/node_modules/@noble/hashes/esm/hmac.js
36050
- var HMAC2 = class extends Hash2 {
36051
- constructor(hash4, _key) {
36052
- super();
36053
- this.finished = false;
36054
- this.destroyed = false;
36055
- hash3(hash4);
36056
- const key = toBytes3(_key);
36057
- this.iHash = hash4.create();
36058
- if (typeof this.iHash.update !== "function")
36059
- throw new Error("Expected instance of class which extends utils.Hash");
36060
- this.blockLen = this.iHash.blockLen;
36061
- this.outputLen = this.iHash.outputLen;
36062
- const blockLen = this.blockLen;
36063
- const pad = new Uint8Array(blockLen);
36064
- pad.set(key.length > blockLen ? hash4.create().update(key).digest() : key);
36065
- for (let i = 0; i < pad.length; i++)
36066
- pad[i] ^= 54;
36067
- this.iHash.update(pad);
36068
- this.oHash = hash4.create();
36069
- for (let i = 0; i < pad.length; i++)
36070
- pad[i] ^= 54 ^ 92;
36071
- this.oHash.update(pad);
36072
- pad.fill(0);
36073
- }
36074
- update(buf) {
36075
- exists2(this);
36076
- this.iHash.update(buf);
36077
- return this;
36078
- }
36079
- digestInto(out) {
36080
- exists2(this);
36081
- bytes2(out, this.outputLen);
36082
- this.finished = true;
36083
- this.iHash.digestInto(out);
36084
- this.oHash.update(out);
36085
- this.oHash.digestInto(out);
36086
- this.destroy();
36087
- }
36088
- digest() {
36089
- const out = new Uint8Array(this.oHash.outputLen);
36090
- this.digestInto(out);
36091
- return out;
36092
- }
36093
- _cloneInto(to) {
36094
- to || (to = Object.create(Object.getPrototypeOf(this), {}));
36095
- const { oHash, iHash, finished, destroyed, blockLen, outputLen } = this;
36096
- to = to;
36097
- to.finished = finished;
36098
- to.destroyed = destroyed;
36099
- to.blockLen = blockLen;
36100
- to.outputLen = outputLen;
36101
- to.oHash = oHash._cloneInto(to.oHash);
36102
- to.iHash = iHash._cloneInto(to.iHash);
36103
- return to;
36104
- }
36105
- destroy() {
36106
- this.destroyed = true;
36107
- this.oHash.destroy();
36108
- this.iHash.destroy();
36109
- }
36110
- };
36111
- var hmac2 = (hash4, key, message) => new HMAC2(hash4, key).update(message).digest();
36112
- hmac2.create = (hash4, key) => new HMAC2(hash4, key);
36113
-
36114
- // ../../node_modules/.pnpm/@noble+curves@1.4.2/node_modules/@noble/curves/esm/abstract/utils.js
35745
+ // ../../node_modules/.pnpm/@noble+curves@1.6.0/node_modules/@noble/curves/esm/abstract/utils.js
36115
35746
  var utils_exports = {};
36116
35747
  __export(utils_exports, {
35748
+ aInRange: () => aInRange,
35749
+ abool: () => abool,
36117
35750
  abytes: () => abytes,
36118
35751
  bitGet: () => bitGet,
36119
35752
  bitLen: () => bitLen,
@@ -36128,30 +35761,37 @@ If you are attempting to transform a hex value, please make sure it is being pas
36128
35761
  equalBytes: () => equalBytes,
36129
35762
  hexToBytes: () => hexToBytes,
36130
35763
  hexToNumber: () => hexToNumber,
36131
- isBytes: () => isBytes4,
35764
+ inRange: () => inRange,
35765
+ isBytes: () => isBytes2,
35766
+ memoized: () => memoized,
35767
+ notImplemented: () => notImplemented,
36132
35768
  numberToBytesBE: () => numberToBytesBE,
36133
35769
  numberToBytesLE: () => numberToBytesLE,
36134
35770
  numberToHexUnpadded: () => numberToHexUnpadded,
36135
35771
  numberToVarBytesBE: () => numberToVarBytesBE,
36136
- utf8ToBytes: () => utf8ToBytes3,
35772
+ utf8ToBytes: () => utf8ToBytes2,
36137
35773
  validateObject: () => validateObject
36138
35774
  });
36139
35775
  var _0n2 = /* @__PURE__ */ BigInt(0);
36140
35776
  var _1n2 = /* @__PURE__ */ BigInt(1);
36141
35777
  var _2n2 = /* @__PURE__ */ BigInt(2);
36142
- function isBytes4(a) {
35778
+ function isBytes2(a) {
36143
35779
  return a instanceof Uint8Array || a != null && typeof a === "object" && a.constructor.name === "Uint8Array";
36144
35780
  }
36145
35781
  function abytes(item) {
36146
- if (!isBytes4(item))
35782
+ if (!isBytes2(item))
36147
35783
  throw new Error("Uint8Array expected");
36148
35784
  }
35785
+ function abool(title, value) {
35786
+ if (typeof value !== "boolean")
35787
+ throw new Error(`${title} must be valid boolean, got "${value}".`);
35788
+ }
36149
35789
  var hexes = /* @__PURE__ */ Array.from({ length: 256 }, (_, i) => i.toString(16).padStart(2, "0"));
36150
- function bytesToHex(bytes3) {
36151
- abytes(bytes3);
35790
+ function bytesToHex(bytes2) {
35791
+ abytes(bytes2);
36152
35792
  let hex = "";
36153
- for (let i = 0; i < bytes3.length; i++) {
36154
- hex += hexes[bytes3[i]];
35793
+ for (let i = 0; i < bytes2.length; i++) {
35794
+ hex += hexes[bytes2[i]];
36155
35795
  }
36156
35796
  return hex;
36157
35797
  }
@@ -36193,12 +35833,12 @@ If you are attempting to transform a hex value, please make sure it is being pas
36193
35833
  }
36194
35834
  return array;
36195
35835
  }
36196
- function bytesToNumberBE(bytes3) {
36197
- return hexToNumber(bytesToHex(bytes3));
35836
+ function bytesToNumberBE(bytes2) {
35837
+ return hexToNumber(bytesToHex(bytes2));
36198
35838
  }
36199
- function bytesToNumberLE(bytes3) {
36200
- abytes(bytes3);
36201
- return hexToNumber(bytesToHex(Uint8Array.from(bytes3).reverse()));
35839
+ function bytesToNumberLE(bytes2) {
35840
+ abytes(bytes2);
35841
+ return hexToNumber(bytesToHex(Uint8Array.from(bytes2).reverse()));
36202
35842
  }
36203
35843
  function numberToBytesBE(n, len) {
36204
35844
  return hexToBytes(n.toString(16).padStart(len * 2, "0"));
@@ -36217,7 +35857,7 @@ If you are attempting to transform a hex value, please make sure it is being pas
36217
35857
  } catch (e) {
36218
35858
  throw new Error(`${title} must be valid hex string, got "${hex}". Cause: ${e}`);
36219
35859
  }
36220
- } else if (isBytes4(hex)) {
35860
+ } else if (isBytes2(hex)) {
36221
35861
  res = Uint8Array.from(hex);
36222
35862
  } else {
36223
35863
  throw new Error(`${title} must be hex string or Uint8Array`);
@@ -36250,11 +35890,19 @@ If you are attempting to transform a hex value, please make sure it is being pas
36250
35890
  diff |= a[i] ^ b[i];
36251
35891
  return diff === 0;
36252
35892
  }
36253
- function utf8ToBytes3(str) {
35893
+ function utf8ToBytes2(str) {
36254
35894
  if (typeof str !== "string")
36255
35895
  throw new Error(`utf8ToBytes expected string, got ${typeof str}`);
36256
35896
  return new Uint8Array(new TextEncoder().encode(str));
36257
35897
  }
35898
+ var isPosBig = (n) => typeof n === "bigint" && _0n2 <= n;
35899
+ function inRange(n, min, max) {
35900
+ return isPosBig(n) && isPosBig(min) && isPosBig(max) && min <= n && n < max;
35901
+ }
35902
+ function aInRange(title, n, min, max) {
35903
+ if (!inRange(n, min, max))
35904
+ throw new Error(`expected valid ${title}: ${min} <= n < ${max}, got ${typeof n} ${n}`);
35905
+ }
36258
35906
  function bitLen(n) {
36259
35907
  let len;
36260
35908
  for (len = 0; n > _0n2; n >>= _1n2, len += 1)
@@ -36323,7 +35971,7 @@ If you are attempting to transform a hex value, please make sure it is being pas
36323
35971
  function: (val) => typeof val === "function",
36324
35972
  boolean: (val) => typeof val === "boolean",
36325
35973
  string: (val) => typeof val === "string",
36326
- stringOrUint8Array: (val) => typeof val === "string" || isBytes4(val),
35974
+ stringOrUint8Array: (val) => typeof val === "string" || isBytes2(val),
36327
35975
  isSafeInteger: (val) => Number.isSafeInteger(val),
36328
35976
  array: (val) => Array.isArray(val),
36329
35977
  field: (val, object) => object.Fp.isValid(val),
@@ -36347,8 +35995,22 @@ If you are attempting to transform a hex value, please make sure it is being pas
36347
35995
  checkField(fieldName, type3, true);
36348
35996
  return object;
36349
35997
  }
35998
+ var notImplemented = () => {
35999
+ throw new Error("not implemented");
36000
+ };
36001
+ function memoized(fn) {
36002
+ const map = /* @__PURE__ */ new WeakMap();
36003
+ return (arg, ...args) => {
36004
+ const val = map.get(arg);
36005
+ if (val !== void 0)
36006
+ return val;
36007
+ const computed = fn(arg, ...args);
36008
+ map.set(arg, computed);
36009
+ return computed;
36010
+ };
36011
+ }
36350
36012
 
36351
- // ../../node_modules/.pnpm/@noble+curves@1.4.2/node_modules/@noble/curves/esm/abstract/modular.js
36013
+ // ../../node_modules/.pnpm/@noble+curves@1.6.0/node_modules/@noble/curves/esm/abstract/modular.js
36352
36014
  var _0n3 = BigInt(0);
36353
36015
  var _1n3 = BigInt(1);
36354
36016
  var _2n3 = BigInt(2);
@@ -36384,11 +36046,11 @@ If you are attempting to transform a hex value, please make sure it is being pas
36384
36046
  }
36385
36047
  return res;
36386
36048
  }
36387
- function invert(number3, modulo) {
36388
- if (number3 === _0n3 || modulo <= _0n3) {
36389
- throw new Error(`invert: expected positive integers, got n=${number3} mod=${modulo}`);
36049
+ function invert(number2, modulo) {
36050
+ if (number2 === _0n3 || modulo <= _0n3) {
36051
+ throw new Error(`invert: expected positive integers, got n=${number2} mod=${modulo}`);
36390
36052
  }
36391
- let a = mod(number3, modulo);
36053
+ let a = mod(number2, modulo);
36392
36054
  let b = modulo;
36393
36055
  let x = _0n3, y = _1n3, u = _1n3, v = _0n3;
36394
36056
  while (a !== _0n3) {
@@ -36543,7 +36205,7 @@ If you are attempting to transform a hex value, please make sure it is being pas
36543
36205
  const nByteLength = Math.ceil(_nBitLength / 8);
36544
36206
  return { nBitLength: _nBitLength, nByteLength };
36545
36207
  }
36546
- function Field(ORDER, bitLen2, isLE3 = false, redef = {}) {
36208
+ function Field(ORDER, bitLen2, isLE2 = false, redef = {}) {
36547
36209
  if (ORDER <= _0n3)
36548
36210
  throw new Error(`Expected Field ORDER > 0, got ${ORDER}`);
36549
36211
  const { nBitLength: BITS, nByteLength: BYTES } = nLength(ORDER, bitLen2);
@@ -36584,11 +36246,11 @@ If you are attempting to transform a hex value, please make sure it is being pas
36584
36246
  // TODO: do we really need constant cmov?
36585
36247
  // We don't have const-time bigints anyway, so probably will be not very useful
36586
36248
  cmov: (a, b, c) => c ? b : a,
36587
- toBytes: (num) => isLE3 ? numberToBytesLE(num, BYTES) : numberToBytesBE(num, BYTES),
36588
- fromBytes: (bytes3) => {
36589
- if (bytes3.length !== BYTES)
36590
- throw new Error(`Fp.fromBytes: expected ${BYTES}, got ${bytes3.length}`);
36591
- return isLE3 ? bytesToNumberLE(bytes3) : bytesToNumberBE(bytes3);
36249
+ toBytes: (num) => isLE2 ? numberToBytesLE(num, BYTES) : numberToBytesBE(num, BYTES),
36250
+ fromBytes: (bytes2) => {
36251
+ if (bytes2.length !== BYTES)
36252
+ throw new Error(`Fp.fromBytes: expected ${BYTES}, got ${bytes2.length}`);
36253
+ return isLE2 ? bytesToNumberLE(bytes2) : bytesToNumberBE(bytes2);
36592
36254
  }
36593
36255
  });
36594
36256
  return Object.freeze(f2);
@@ -36603,26 +36265,33 @@ If you are attempting to transform a hex value, please make sure it is being pas
36603
36265
  const length = getFieldBytesLength(fieldOrder);
36604
36266
  return length + Math.ceil(length / 2);
36605
36267
  }
36606
- function mapHashToField(key, fieldOrder, isLE3 = false) {
36268
+ function mapHashToField(key, fieldOrder, isLE2 = false) {
36607
36269
  const len = key.length;
36608
36270
  const fieldLen = getFieldBytesLength(fieldOrder);
36609
36271
  const minLen = getMinHashLength(fieldOrder);
36610
36272
  if (len < 16 || len < minLen || len > 1024)
36611
36273
  throw new Error(`expected ${minLen}-1024 bytes of input, got ${len}`);
36612
- const num = isLE3 ? bytesToNumberBE(key) : bytesToNumberLE(key);
36274
+ const num = isLE2 ? bytesToNumberBE(key) : bytesToNumberLE(key);
36613
36275
  const reduced = mod(num, fieldOrder - _1n3) + _1n3;
36614
- return isLE3 ? numberToBytesLE(reduced, fieldLen) : numberToBytesBE(reduced, fieldLen);
36276
+ return isLE2 ? numberToBytesLE(reduced, fieldLen) : numberToBytesBE(reduced, fieldLen);
36615
36277
  }
36616
36278
 
36617
- // ../../node_modules/.pnpm/@noble+curves@1.4.2/node_modules/@noble/curves/esm/abstract/curve.js
36279
+ // ../../node_modules/.pnpm/@noble+curves@1.6.0/node_modules/@noble/curves/esm/abstract/curve.js
36618
36280
  var _0n4 = BigInt(0);
36619
36281
  var _1n4 = BigInt(1);
36282
+ var pointPrecomputes = /* @__PURE__ */ new WeakMap();
36283
+ var pointWindowSizes = /* @__PURE__ */ new WeakMap();
36620
36284
  function wNAF(c, bits) {
36621
36285
  const constTimeNegate = (condition, item) => {
36622
36286
  const neg = item.negate();
36623
36287
  return condition ? neg : item;
36624
36288
  };
36289
+ const validateW = (W) => {
36290
+ if (!Number.isSafeInteger(W) || W <= 0 || W > bits)
36291
+ throw new Error(`Wrong window size=${W}, should be [1..${bits}]`);
36292
+ };
36625
36293
  const opts = (W) => {
36294
+ validateW(W);
36626
36295
  const windows = Math.ceil(bits / W) + 1;
36627
36296
  const windowSize = 2 ** (W - 1);
36628
36297
  return { windows, windowSize };
@@ -36701,19 +36370,62 @@ If you are attempting to transform a hex value, please make sure it is being pas
36701
36370
  }
36702
36371
  return { p, f: f2 };
36703
36372
  },
36704
- wNAFCached(P, precomputesMap, n, transform) {
36705
- const W = P._WINDOW_SIZE || 1;
36706
- let comp = precomputesMap.get(P);
36373
+ wNAFCached(P, n, transform) {
36374
+ const W = pointWindowSizes.get(P) || 1;
36375
+ let comp = pointPrecomputes.get(P);
36707
36376
  if (!comp) {
36708
36377
  comp = this.precomputeWindow(P, W);
36709
- if (W !== 1) {
36710
- precomputesMap.set(P, transform(comp));
36711
- }
36378
+ if (W !== 1)
36379
+ pointPrecomputes.set(P, transform(comp));
36712
36380
  }
36713
36381
  return this.wNAF(W, comp, n);
36382
+ },
36383
+ // We calculate precomputes for elliptic curve point multiplication
36384
+ // using windowed method. This specifies window size and
36385
+ // stores precomputed values. Usually only base point would be precomputed.
36386
+ setWindowSize(P, W) {
36387
+ validateW(W);
36388
+ pointWindowSizes.set(P, W);
36389
+ pointPrecomputes.delete(P);
36714
36390
  }
36715
36391
  };
36716
36392
  }
36393
+ function pippenger(c, field, points, scalars) {
36394
+ if (!Array.isArray(points) || !Array.isArray(scalars) || scalars.length !== points.length)
36395
+ throw new Error("arrays of points and scalars must have equal length");
36396
+ scalars.forEach((s, i) => {
36397
+ if (!field.isValid(s))
36398
+ throw new Error(`wrong scalar at index ${i}`);
36399
+ });
36400
+ points.forEach((p, i) => {
36401
+ if (!(p instanceof c))
36402
+ throw new Error(`wrong point at index ${i}`);
36403
+ });
36404
+ const wbits = bitLen(BigInt(points.length));
36405
+ const windowSize = wbits > 12 ? wbits - 3 : wbits > 4 ? wbits - 2 : wbits ? 2 : 1;
36406
+ const MASK = (1 << windowSize) - 1;
36407
+ const buckets = new Array(MASK + 1).fill(c.ZERO);
36408
+ const lastBits = Math.floor((field.BITS - 1) / windowSize) * windowSize;
36409
+ let sum = c.ZERO;
36410
+ for (let i = lastBits; i >= 0; i -= windowSize) {
36411
+ buckets.fill(c.ZERO);
36412
+ for (let j = 0; j < scalars.length; j++) {
36413
+ const scalar = scalars[j];
36414
+ const wbits2 = Number(scalar >> BigInt(i) & BigInt(MASK));
36415
+ buckets[wbits2] = buckets[wbits2].add(points[j]);
36416
+ }
36417
+ let resI = c.ZERO;
36418
+ for (let j = buckets.length - 1, sumI = c.ZERO; j > 0; j--) {
36419
+ sumI = sumI.add(buckets[j]);
36420
+ resI = resI.add(sumI);
36421
+ }
36422
+ sum = sum.add(resI);
36423
+ if (i !== 0)
36424
+ for (let j = 0; j < windowSize; j++)
36425
+ sum = sum.double();
36426
+ }
36427
+ return sum;
36428
+ }
36717
36429
  function validateBasic(curve) {
36718
36430
  validateField(curve.Fp);
36719
36431
  validateObject(curve, {
@@ -36732,7 +36444,13 @@ If you are attempting to transform a hex value, please make sure it is being pas
36732
36444
  });
36733
36445
  }
36734
36446
 
36735
- // ../../node_modules/.pnpm/@noble+curves@1.4.2/node_modules/@noble/curves/esm/abstract/weierstrass.js
36447
+ // ../../node_modules/.pnpm/@noble+curves@1.6.0/node_modules/@noble/curves/esm/abstract/weierstrass.js
36448
+ function validateSigVerOpts(opts) {
36449
+ if (opts.lowS !== void 0)
36450
+ abool("lowS", opts.lowS);
36451
+ if (opts.prehash !== void 0)
36452
+ abool("prehash", opts.prehash);
36453
+ }
36736
36454
  function validatePointOpts(curve) {
36737
36455
  const opts = validateBasic(curve);
36738
36456
  validateObject(opts, {
@@ -36766,48 +36484,99 @@ If you are attempting to transform a hex value, please make sure it is being pas
36766
36484
  super(m);
36767
36485
  }
36768
36486
  },
36769
- _parseInt(data) {
36770
- const { Err: E } = DER;
36771
- if (data.length < 2 || data[0] !== 2)
36772
- throw new E("Invalid signature integer tag");
36773
- const len = data[1];
36774
- const res = data.subarray(2, len + 2);
36775
- if (!len || res.length !== len)
36776
- throw new E("Invalid signature integer: wrong length");
36777
- if (res[0] & 128)
36778
- throw new E("Invalid signature integer: negative");
36779
- if (res[0] === 0 && !(res[1] & 128))
36780
- throw new E("Invalid signature integer: unnecessary leading zero");
36781
- return { d: b2n(res), l: data.subarray(len + 2) };
36487
+ // Basic building block is TLV (Tag-Length-Value)
36488
+ _tlv: {
36489
+ encode: (tag, data) => {
36490
+ const { Err: E } = DER;
36491
+ if (tag < 0 || tag > 256)
36492
+ throw new E("tlv.encode: wrong tag");
36493
+ if (data.length & 1)
36494
+ throw new E("tlv.encode: unpadded data");
36495
+ const dataLen = data.length / 2;
36496
+ const len = numberToHexUnpadded(dataLen);
36497
+ if (len.length / 2 & 128)
36498
+ throw new E("tlv.encode: long form length too big");
36499
+ const lenLen = dataLen > 127 ? numberToHexUnpadded(len.length / 2 | 128) : "";
36500
+ return `${numberToHexUnpadded(tag)}${lenLen}${len}${data}`;
36501
+ },
36502
+ // v - value, l - left bytes (unparsed)
36503
+ decode(tag, data) {
36504
+ const { Err: E } = DER;
36505
+ let pos = 0;
36506
+ if (tag < 0 || tag > 256)
36507
+ throw new E("tlv.encode: wrong tag");
36508
+ if (data.length < 2 || data[pos++] !== tag)
36509
+ throw new E("tlv.decode: wrong tlv");
36510
+ const first = data[pos++];
36511
+ const isLong = !!(first & 128);
36512
+ let length = 0;
36513
+ if (!isLong)
36514
+ length = first;
36515
+ else {
36516
+ const lenLen = first & 127;
36517
+ if (!lenLen)
36518
+ throw new E("tlv.decode(long): indefinite length not supported");
36519
+ if (lenLen > 4)
36520
+ throw new E("tlv.decode(long): byte length is too big");
36521
+ const lengthBytes = data.subarray(pos, pos + lenLen);
36522
+ if (lengthBytes.length !== lenLen)
36523
+ throw new E("tlv.decode: length bytes not complete");
36524
+ if (lengthBytes[0] === 0)
36525
+ throw new E("tlv.decode(long): zero leftmost byte");
36526
+ for (const b of lengthBytes)
36527
+ length = length << 8 | b;
36528
+ pos += lenLen;
36529
+ if (length < 128)
36530
+ throw new E("tlv.decode(long): not minimal encoding");
36531
+ }
36532
+ const v = data.subarray(pos, pos + length);
36533
+ if (v.length !== length)
36534
+ throw new E("tlv.decode: wrong value length");
36535
+ return { v, l: data.subarray(pos + length) };
36536
+ }
36537
+ },
36538
+ // https://crypto.stackexchange.com/a/57734 Leftmost bit of first byte is 'negative' flag,
36539
+ // since we always use positive integers here. It must always be empty:
36540
+ // - add zero byte if exists
36541
+ // - if next byte doesn't have a flag, leading zero is not allowed (minimal encoding)
36542
+ _int: {
36543
+ encode(num) {
36544
+ const { Err: E } = DER;
36545
+ if (num < _0n5)
36546
+ throw new E("integer: negative integers are not allowed");
36547
+ let hex = numberToHexUnpadded(num);
36548
+ if (Number.parseInt(hex[0], 16) & 8)
36549
+ hex = "00" + hex;
36550
+ if (hex.length & 1)
36551
+ throw new E("unexpected assertion");
36552
+ return hex;
36553
+ },
36554
+ decode(data) {
36555
+ const { Err: E } = DER;
36556
+ if (data[0] & 128)
36557
+ throw new E("Invalid signature integer: negative");
36558
+ if (data[0] === 0 && !(data[1] & 128))
36559
+ throw new E("Invalid signature integer: unnecessary leading zero");
36560
+ return b2n(data);
36561
+ }
36782
36562
  },
36783
36563
  toSig(hex) {
36784
- const { Err: E } = DER;
36564
+ const { Err: E, _int: int, _tlv: tlv } = DER;
36785
36565
  const data = typeof hex === "string" ? h2b(hex) : hex;
36786
36566
  abytes(data);
36787
- let l = data.length;
36788
- if (l < 2 || data[0] != 48)
36789
- throw new E("Invalid signature tag");
36790
- if (data[1] !== l - 2)
36791
- throw new E("Invalid signature: incorrect length");
36792
- const { d: r, l: sBytes } = DER._parseInt(data.subarray(2));
36793
- const { d: s, l: rBytesLeft } = DER._parseInt(sBytes);
36794
- if (rBytesLeft.length)
36567
+ const { v: seqBytes, l: seqLeftBytes } = tlv.decode(48, data);
36568
+ if (seqLeftBytes.length)
36795
36569
  throw new E("Invalid signature: left bytes after parsing");
36796
- return { r, s };
36570
+ const { v: rBytes, l: rLeftBytes } = tlv.decode(2, seqBytes);
36571
+ const { v: sBytes, l: sLeftBytes } = tlv.decode(2, rLeftBytes);
36572
+ if (sLeftBytes.length)
36573
+ throw new E("Invalid signature: left bytes after parsing");
36574
+ return { r: int.decode(rBytes), s: int.decode(sBytes) };
36797
36575
  },
36798
36576
  hexFromSig(sig) {
36799
- const slice = (s2) => Number.parseInt(s2[0], 16) & 8 ? "00" + s2 : s2;
36800
- const h = (num) => {
36801
- const hex = num.toString(16);
36802
- return hex.length & 1 ? `0${hex}` : hex;
36803
- };
36804
- const s = slice(h(sig.s));
36805
- const r = slice(h(sig.r));
36806
- const shl = s.length / 2;
36807
- const rhl = r.length / 2;
36808
- const sl = h(shl);
36809
- const rl = h(rhl);
36810
- return `30${h(rhl + shl + 4)}02${rl}${r}02${sl}${s}`;
36577
+ const { _tlv: tlv, _int: int } = DER;
36578
+ const seq = `${tlv.encode(2, int.encode(sig.r))}${tlv.encode(2, int.encode(sig.s))}`;
36579
+ return tlv.encode(48, seq);
36811
36580
  }
36812
36581
  };
36813
36582
  var _0n5 = BigInt(0);
@@ -36818,12 +36587,13 @@ If you are attempting to transform a hex value, please make sure it is being pas
36818
36587
  function weierstrassPoints(opts) {
36819
36588
  const CURVE = validatePointOpts(opts);
36820
36589
  const { Fp: Fp2 } = CURVE;
36821
- const toBytes4 = CURVE.toBytes || ((_c, point, _isCompressed) => {
36590
+ const Fn = Field(CURVE.n, CURVE.nBitLength);
36591
+ const toBytes3 = CURVE.toBytes || ((_c, point, _isCompressed) => {
36822
36592
  const a = point.toAffine();
36823
36593
  return concatBytes3(Uint8Array.from([4]), Fp2.toBytes(a.x), Fp2.toBytes(a.y));
36824
36594
  });
36825
- const fromBytes = CURVE.fromBytes || ((bytes3) => {
36826
- const tail = bytes3.subarray(1);
36595
+ const fromBytes = CURVE.fromBytes || ((bytes2) => {
36596
+ const tail = bytes2.subarray(1);
36827
36597
  const x = Fp2.fromBytes(tail.subarray(0, Fp2.BYTES));
36828
36598
  const y = Fp2.fromBytes(tail.subarray(Fp2.BYTES, 2 * Fp2.BYTES));
36829
36599
  return { x, y };
@@ -36837,16 +36607,12 @@ If you are attempting to transform a hex value, please make sure it is being pas
36837
36607
  if (!Fp2.eql(Fp2.sqr(CURVE.Gy), weierstrassEquation(CURVE.Gx)))
36838
36608
  throw new Error("bad generator point: equation left != right");
36839
36609
  function isWithinCurveOrder(num) {
36840
- return typeof num === "bigint" && _0n5 < num && num < CURVE.n;
36841
- }
36842
- function assertGE(num) {
36843
- if (!isWithinCurveOrder(num))
36844
- throw new Error("Expected valid bigint: 0 < bigint < curve.n");
36610
+ return inRange(num, _1n5, CURVE.n);
36845
36611
  }
36846
36612
  function normPrivateKeyToScalar(key) {
36847
- const { allowedPrivateKeyLengths: lengths, nByteLength, wrapPrivateKey, n } = CURVE;
36613
+ const { allowedPrivateKeyLengths: lengths, nByteLength, wrapPrivateKey, n: N } = CURVE;
36848
36614
  if (lengths && typeof key !== "bigint") {
36849
- if (isBytes4(key))
36615
+ if (isBytes2(key))
36850
36616
  key = bytesToHex(key);
36851
36617
  if (typeof key !== "string" || !lengths.includes(key.length))
36852
36618
  throw new Error("Invalid key");
@@ -36859,15 +36625,47 @@ If you are attempting to transform a hex value, please make sure it is being pas
36859
36625
  throw new Error(`private key must be ${nByteLength} bytes, hex or bigint, not ${typeof key}`);
36860
36626
  }
36861
36627
  if (wrapPrivateKey)
36862
- num = mod(num, n);
36863
- assertGE(num);
36628
+ num = mod(num, N);
36629
+ aInRange("private key", num, _1n5, N);
36864
36630
  return num;
36865
36631
  }
36866
- const pointPrecomputes = /* @__PURE__ */ new Map();
36867
36632
  function assertPrjPoint(other) {
36868
36633
  if (!(other instanceof Point2))
36869
36634
  throw new Error("ProjectivePoint expected");
36870
36635
  }
36636
+ const toAffineMemo = memoized((p, iz) => {
36637
+ const { px: x, py: y, pz: z } = p;
36638
+ if (Fp2.eql(z, Fp2.ONE))
36639
+ return { x, y };
36640
+ const is0 = p.is0();
36641
+ if (iz == null)
36642
+ iz = is0 ? Fp2.ONE : Fp2.inv(z);
36643
+ const ax = Fp2.mul(x, iz);
36644
+ const ay = Fp2.mul(y, iz);
36645
+ const zz = Fp2.mul(z, iz);
36646
+ if (is0)
36647
+ return { x: Fp2.ZERO, y: Fp2.ZERO };
36648
+ if (!Fp2.eql(zz, Fp2.ONE))
36649
+ throw new Error("invZ was invalid");
36650
+ return { x: ax, y: ay };
36651
+ });
36652
+ const assertValidMemo = memoized((p) => {
36653
+ if (p.is0()) {
36654
+ if (CURVE.allowInfinityPoint && !Fp2.is0(p.py))
36655
+ return;
36656
+ throw new Error("bad point: ZERO");
36657
+ }
36658
+ const { x, y } = p.toAffine();
36659
+ if (!Fp2.isValid(x) || !Fp2.isValid(y))
36660
+ throw new Error("bad point: x or y not FE");
36661
+ const left = Fp2.sqr(y);
36662
+ const right = weierstrassEquation(x);
36663
+ if (!Fp2.eql(left, right))
36664
+ throw new Error("bad point: equation left != right");
36665
+ if (!p.isTorsionFree())
36666
+ throw new Error("bad point: not in prime-order subgroup");
36667
+ return true;
36668
+ });
36871
36669
  class Point2 {
36872
36670
  constructor(px, py, pz) {
36873
36671
  this.px = px;
@@ -36879,6 +36677,7 @@ If you are attempting to transform a hex value, please make sure it is being pas
36879
36677
  throw new Error("y required");
36880
36678
  if (pz == null || !Fp2.isValid(pz))
36881
36679
  throw new Error("z required");
36680
+ Object.freeze(this);
36882
36681
  }
36883
36682
  // Does not validate if the point is on-curve.
36884
36683
  // Use fromHex instead, or call assertValidity() later.
@@ -36922,27 +36721,17 @@ If you are attempting to transform a hex value, please make sure it is being pas
36922
36721
  static fromPrivateKey(privateKey) {
36923
36722
  return Point2.BASE.multiply(normPrivateKeyToScalar(privateKey));
36924
36723
  }
36724
+ // Multiscalar Multiplication
36725
+ static msm(points, scalars) {
36726
+ return pippenger(Point2, Fn, points, scalars);
36727
+ }
36925
36728
  // "Private method", don't use it directly
36926
36729
  _setWindowSize(windowSize) {
36927
- this._WINDOW_SIZE = windowSize;
36928
- pointPrecomputes.delete(this);
36730
+ wnaf.setWindowSize(this, windowSize);
36929
36731
  }
36930
36732
  // A point on curve is valid if it conforms to equation.
36931
36733
  assertValidity() {
36932
- if (this.is0()) {
36933
- if (CURVE.allowInfinityPoint && !Fp2.is0(this.py))
36934
- return;
36935
- throw new Error("bad point: ZERO");
36936
- }
36937
- const { x, y } = this.toAffine();
36938
- if (!Fp2.isValid(x) || !Fp2.isValid(y))
36939
- throw new Error("bad point: x or y not FE");
36940
- const left = Fp2.sqr(y);
36941
- const right = weierstrassEquation(x);
36942
- if (!Fp2.eql(left, right))
36943
- throw new Error("bad point: equation left != right");
36944
- if (!this.isTorsionFree())
36945
- throw new Error("bad point: not in prime-order subgroup");
36734
+ assertValidMemo(this);
36946
36735
  }
36947
36736
  hasEvenY() {
36948
36737
  const { y } = this.toAffine();
@@ -37069,27 +36858,24 @@ If you are attempting to transform a hex value, please make sure it is being pas
37069
36858
  return this.equals(Point2.ZERO);
37070
36859
  }
37071
36860
  wNAF(n) {
37072
- return wnaf.wNAFCached(this, pointPrecomputes, n, (comp) => {
37073
- const toInv = Fp2.invertBatch(comp.map((p) => p.pz));
37074
- return comp.map((p, i) => p.toAffine(toInv[i])).map(Point2.fromAffine);
37075
- });
36861
+ return wnaf.wNAFCached(this, n, Point2.normalizeZ);
37076
36862
  }
37077
36863
  /**
37078
36864
  * Non-constant-time multiplication. Uses double-and-add algorithm.
37079
36865
  * It's faster, but should only be used when you don't care about
37080
36866
  * an exposed private key e.g. sig verification, which works over *public* keys.
37081
36867
  */
37082
- multiplyUnsafe(n) {
36868
+ multiplyUnsafe(sc) {
36869
+ aInRange("scalar", sc, _0n5, CURVE.n);
37083
36870
  const I = Point2.ZERO;
37084
- if (n === _0n5)
36871
+ if (sc === _0n5)
37085
36872
  return I;
37086
- assertGE(n);
37087
- if (n === _1n5)
36873
+ if (sc === _1n5)
37088
36874
  return this;
37089
36875
  const { endo } = CURVE;
37090
36876
  if (!endo)
37091
- return wnaf.unsafeLadder(this, n);
37092
- let { k1neg, k1, k2neg, k2 } = endo.splitScalar(n);
36877
+ return wnaf.unsafeLadder(this, sc);
36878
+ let { k1neg, k1, k2neg, k2 } = endo.splitScalar(sc);
37093
36879
  let k1p = I;
37094
36880
  let k2p = I;
37095
36881
  let d = this;
@@ -37119,12 +36905,11 @@ If you are attempting to transform a hex value, please make sure it is being pas
37119
36905
  * @returns New point
37120
36906
  */
37121
36907
  multiply(scalar) {
37122
- assertGE(scalar);
37123
- let n = scalar;
36908
+ const { endo, n: N } = CURVE;
36909
+ aInRange("scalar", scalar, _1n5, N);
37124
36910
  let point, fake;
37125
- const { endo } = CURVE;
37126
36911
  if (endo) {
37127
- const { k1neg, k1, k2neg, k2 } = endo.splitScalar(n);
36912
+ const { k1neg, k1, k2neg, k2 } = endo.splitScalar(scalar);
37128
36913
  let { p: k1p, f: f1p } = this.wNAF(k1);
37129
36914
  let { p: k2p, f: f2p } = this.wNAF(k2);
37130
36915
  k1p = wnaf.constTimeNegate(k1neg, k1p);
@@ -37133,7 +36918,7 @@ If you are attempting to transform a hex value, please make sure it is being pas
37133
36918
  point = k1p.add(k2p);
37134
36919
  fake = f1p.add(f2p);
37135
36920
  } else {
37136
- const { p, f: f2 } = this.wNAF(n);
36921
+ const { p, f: f2 } = this.wNAF(scalar);
37137
36922
  point = p;
37138
36923
  fake = f2;
37139
36924
  }
@@ -37155,18 +36940,7 @@ If you are attempting to transform a hex value, please make sure it is being pas
37155
36940
  // Can accept precomputed Z^-1 - for example, from invertBatch.
37156
36941
  // (x, y, z) ∋ (x=x/z, y=y/z)
37157
36942
  toAffine(iz) {
37158
- const { px: x, py: y, pz: z } = this;
37159
- const is0 = this.is0();
37160
- if (iz == null)
37161
- iz = is0 ? Fp2.ONE : Fp2.inv(z);
37162
- const ax = Fp2.mul(x, iz);
37163
- const ay = Fp2.mul(y, iz);
37164
- const zz = Fp2.mul(z, iz);
37165
- if (is0)
37166
- return { x: Fp2.ZERO, y: Fp2.ZERO };
37167
- if (!Fp2.eql(zz, Fp2.ONE))
37168
- throw new Error("invZ was invalid");
37169
- return { x: ax, y: ay };
36943
+ return toAffineMemo(this, iz);
37170
36944
  }
37171
36945
  isTorsionFree() {
37172
36946
  const { h: cofactor, isTorsionFree } = CURVE;
@@ -37185,10 +36959,12 @@ If you are attempting to transform a hex value, please make sure it is being pas
37185
36959
  return this.multiplyUnsafe(CURVE.h);
37186
36960
  }
37187
36961
  toRawBytes(isCompressed = true) {
36962
+ abool("isCompressed", isCompressed);
37188
36963
  this.assertValidity();
37189
- return toBytes4(Point2, this, isCompressed);
36964
+ return toBytes3(Point2, this, isCompressed);
37190
36965
  }
37191
36966
  toHex(isCompressed = true) {
36967
+ abool("isCompressed", isCompressed);
37192
36968
  return bytesToHex(this.toRawBytes(isCompressed));
37193
36969
  }
37194
36970
  }
@@ -37222,9 +36998,6 @@ If you are attempting to transform a hex value, please make sure it is being pas
37222
36998
  const { Fp: Fp2, n: CURVE_ORDER } = CURVE;
37223
36999
  const compressedLen = Fp2.BYTES + 1;
37224
37000
  const uncompressedLen = 2 * Fp2.BYTES + 1;
37225
- function isValidFieldElement(num) {
37226
- return _0n5 < num && num < Fp2.ORDER;
37227
- }
37228
37001
  function modN(a) {
37229
37002
  return mod(a, CURVE_ORDER);
37230
37003
  }
@@ -37237,19 +37010,20 @@ If you are attempting to transform a hex value, please make sure it is being pas
37237
37010
  const a = point.toAffine();
37238
37011
  const x = Fp2.toBytes(a.x);
37239
37012
  const cat = concatBytes3;
37013
+ abool("isCompressed", isCompressed);
37240
37014
  if (isCompressed) {
37241
37015
  return cat(Uint8Array.from([point.hasEvenY() ? 2 : 3]), x);
37242
37016
  } else {
37243
37017
  return cat(Uint8Array.from([4]), x, Fp2.toBytes(a.y));
37244
37018
  }
37245
37019
  },
37246
- fromBytes(bytes3) {
37247
- const len = bytes3.length;
37248
- const head = bytes3[0];
37249
- const tail = bytes3.subarray(1);
37020
+ fromBytes(bytes2) {
37021
+ const len = bytes2.length;
37022
+ const head = bytes2[0];
37023
+ const tail = bytes2.subarray(1);
37250
37024
  if (len === compressedLen && (head === 2 || head === 3)) {
37251
37025
  const x = bytesToNumberBE(tail);
37252
- if (!isValidFieldElement(x))
37026
+ if (!inRange(x, _1n5, Fp2.ORDER))
37253
37027
  throw new Error("Point is not on curve");
37254
37028
  const y2 = weierstrassEquation(x);
37255
37029
  let y;
@@ -37274,9 +37048,9 @@ If you are attempting to transform a hex value, please make sure it is being pas
37274
37048
  }
37275
37049
  });
37276
37050
  const numToNByteStr = (num) => bytesToHex(numberToBytesBE(num, CURVE.nByteLength));
37277
- function isBiggerThanHalfOrder(number3) {
37051
+ function isBiggerThanHalfOrder(number2) {
37278
37052
  const HALF = CURVE_ORDER >> _1n5;
37279
- return number3 > HALF;
37053
+ return number2 > HALF;
37280
37054
  }
37281
37055
  function normalizeS(s) {
37282
37056
  return isBiggerThanHalfOrder(s) ? modN(-s) : s;
@@ -37302,10 +37076,8 @@ If you are attempting to transform a hex value, please make sure it is being pas
37302
37076
  return new Signature(r, s);
37303
37077
  }
37304
37078
  assertValidity() {
37305
- if (!isWithinCurveOrder(this.r))
37306
- throw new Error("r must be 0 < r < CURVE.n");
37307
- if (!isWithinCurveOrder(this.s))
37308
- throw new Error("s must be 0 < s < CURVE.n");
37079
+ aInRange("r", this.r, _1n5, CURVE_ORDER);
37080
+ aInRange("s", this.s, _1n5, CURVE_ORDER);
37309
37081
  }
37310
37082
  addRecoveryBit(recovery) {
37311
37083
  return new Signature(this.r, this.s, recovery);
@@ -37387,7 +37159,7 @@ If you are attempting to transform a hex value, please make sure it is being pas
37387
37159
  return Point2.fromPrivateKey(privateKey).toRawBytes(isCompressed);
37388
37160
  }
37389
37161
  function isProbPub(item) {
37390
- const arr = isBytes4(item);
37162
+ const arr = isBytes2(item);
37391
37163
  const str = typeof item === "string";
37392
37164
  const len = (arr || str) && item.length;
37393
37165
  if (arr)
@@ -37406,37 +37178,35 @@ If you are attempting to transform a hex value, please make sure it is being pas
37406
37178
  const b = Point2.fromHex(publicB);
37407
37179
  return b.multiply(normPrivateKeyToScalar(privateA)).toRawBytes(isCompressed);
37408
37180
  }
37409
- const bits2int = CURVE.bits2int || function(bytes3) {
37410
- const num = bytesToNumberBE(bytes3);
37411
- const delta = bytes3.length * 8 - CURVE.nBitLength;
37181
+ const bits2int = CURVE.bits2int || function(bytes2) {
37182
+ const num = bytesToNumberBE(bytes2);
37183
+ const delta = bytes2.length * 8 - CURVE.nBitLength;
37412
37184
  return delta > 0 ? num >> BigInt(delta) : num;
37413
37185
  };
37414
- const bits2int_modN = CURVE.bits2int_modN || function(bytes3) {
37415
- return modN(bits2int(bytes3));
37186
+ const bits2int_modN = CURVE.bits2int_modN || function(bytes2) {
37187
+ return modN(bits2int(bytes2));
37416
37188
  };
37417
37189
  const ORDER_MASK = bitMask(CURVE.nBitLength);
37418
37190
  function int2octets(num) {
37419
- if (typeof num !== "bigint")
37420
- throw new Error("bigint expected");
37421
- if (!(_0n5 <= num && num < ORDER_MASK))
37422
- throw new Error(`bigint expected < 2^${CURVE.nBitLength}`);
37191
+ aInRange(`num < 2^${CURVE.nBitLength}`, num, _0n5, ORDER_MASK);
37423
37192
  return numberToBytesBE(num, CURVE.nByteLength);
37424
37193
  }
37425
37194
  function prepSig(msgHash, privateKey, opts = defaultSigOpts) {
37426
37195
  if (["recovered", "canonical"].some((k) => k in opts))
37427
37196
  throw new Error("sign() legacy options not supported");
37428
- const { hash: hash4, randomBytes: randomBytes4 } = CURVE;
37197
+ const { hash: hash3, randomBytes: randomBytes3 } = CURVE;
37429
37198
  let { lowS, prehash, extraEntropy: ent } = opts;
37430
37199
  if (lowS == null)
37431
37200
  lowS = true;
37432
37201
  msgHash = ensureBytes("msgHash", msgHash);
37202
+ validateSigVerOpts(opts);
37433
37203
  if (prehash)
37434
- msgHash = ensureBytes("prehashed msgHash", hash4(msgHash));
37204
+ msgHash = ensureBytes("prehashed msgHash", hash3(msgHash));
37435
37205
  const h1int = bits2int_modN(msgHash);
37436
37206
  const d = normPrivateKeyToScalar(privateKey);
37437
37207
  const seedArgs = [int2octets(d), int2octets(h1int)];
37438
37208
  if (ent != null && ent !== false) {
37439
- const e = ent === true ? randomBytes4(Fp2.BYTES) : ent;
37209
+ const e = ent === true ? randomBytes3(Fp2.BYTES) : ent;
37440
37210
  seedArgs.push(ensureBytes("extraEntropy", e));
37441
37211
  }
37442
37212
  const seed = concatBytes3(...seedArgs);
@@ -37478,11 +37248,12 @@ If you are attempting to transform a hex value, please make sure it is being pas
37478
37248
  publicKey = ensureBytes("publicKey", publicKey);
37479
37249
  if ("strict" in opts)
37480
37250
  throw new Error("options.strict was renamed to lowS");
37251
+ validateSigVerOpts(opts);
37481
37252
  const { lowS, prehash } = opts;
37482
37253
  let _sig = void 0;
37483
37254
  let P;
37484
37255
  try {
37485
- if (typeof sg === "string" || isBytes4(sg)) {
37256
+ if (typeof sg === "string" || isBytes2(sg)) {
37486
37257
  try {
37487
37258
  _sig = Signature.fromDER(sg);
37488
37259
  } catch (derError) {
@@ -37529,20 +37300,20 @@ If you are attempting to transform a hex value, please make sure it is being pas
37529
37300
  };
37530
37301
  }
37531
37302
 
37532
- // ../../node_modules/.pnpm/@noble+curves@1.4.2/node_modules/@noble/curves/esm/_shortw_utils.js
37533
- function getHash(hash4) {
37303
+ // ../../node_modules/.pnpm/@noble+curves@1.6.0/node_modules/@noble/curves/esm/_shortw_utils.js
37304
+ function getHash(hash3) {
37534
37305
  return {
37535
- hash: hash4,
37536
- hmac: (key, ...msgs) => hmac2(hash4, key, concatBytes2(...msgs)),
37537
- randomBytes: randomBytes3
37306
+ hash: hash3,
37307
+ hmac: (key, ...msgs) => hmac(hash3, key, concatBytes2(...msgs)),
37308
+ randomBytes
37538
37309
  };
37539
37310
  }
37540
37311
  function createCurve(curveDef, defHash) {
37541
- const create = (hash4) => weierstrass({ ...curveDef, ...getHash(hash4) });
37312
+ const create = (hash3) => weierstrass({ ...curveDef, ...getHash(hash3) });
37542
37313
  return Object.freeze({ ...create(defHash), create });
37543
37314
  }
37544
37315
 
37545
- // ../../node_modules/.pnpm/@noble+curves@1.4.2/node_modules/@noble/curves/esm/secp256k1.js
37316
+ // ../../node_modules/.pnpm/@noble+curves@1.6.0/node_modules/@noble/curves/esm/secp256k1.js
37546
37317
  var secp256k1P = BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f");
37547
37318
  var secp256k1N = BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141");
37548
37319
  var _1n6 = BigInt(1);
@@ -37618,7 +37389,7 @@ If you are attempting to transform a hex value, please make sure it is being pas
37618
37389
  return { k1neg, k1, k2neg, k2 };
37619
37390
  }
37620
37391
  }
37621
- }, sha2563);
37392
+ }, sha256);
37622
37393
  var _0n6 = BigInt(0);
37623
37394
  var Point = secp256k1.ProjectivePoint;
37624
37395
 
@@ -37711,7 +37482,7 @@ If you are attempting to transform a hex value, please make sure it is being pas
37711
37482
  * @returns random 32-byte hashed
37712
37483
  */
37713
37484
  static generatePrivateKey(entropy) {
37714
- return entropy ? hash2(concat([randomBytes2(32), arrayify(entropy)])) : randomBytes2(32);
37485
+ return entropy ? hash2(concat([randomBytes22(32), arrayify(entropy)])) : randomBytes22(32);
37715
37486
  }
37716
37487
  /**
37717
37488
  * Extended publicKey from a compact publicKey
@@ -37759,7 +37530,7 @@ If you are attempting to transform a hex value, please make sure it is being pas
37759
37530
  const signer = new Signer(pk);
37760
37531
  process.env.GENESIS_SECRET = hexlify(pk);
37761
37532
  coins.push({
37762
- tx_id: hexlify(randomBytes2(BYTES_32)),
37533
+ tx_id: hexlify(randomBytes22(BYTES_32)),
37763
37534
  owner: signer.address.toHexString(),
37764
37535
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
37765
37536
  amount: "18446744073709551615",
@@ -38384,9 +38155,9 @@ If you are attempting to transform a hex value, please make sure it is being pas
38384
38155
  return sha2562(concat(parts));
38385
38156
  }
38386
38157
  static encodeData(messageData) {
38387
- const bytes3 = arrayify(messageData || "0x");
38388
- const dataLength = bytes3.length;
38389
- return new ByteArrayCoder(dataLength).encode(bytes3);
38158
+ const bytes2 = arrayify(messageData || "0x");
38159
+ const dataLength = bytes2.length;
38160
+ return new ByteArrayCoder(dataLength).encode(bytes2);
38390
38161
  }
38391
38162
  encode(value) {
38392
38163
  const parts = [];
@@ -38408,9 +38179,9 @@ If you are attempting to transform a hex value, please make sure it is being pas
38408
38179
  return concat(parts);
38409
38180
  }
38410
38181
  static decodeData(messageData) {
38411
- const bytes3 = arrayify(messageData);
38412
- const dataLength = bytes3.length;
38413
- const [data] = new ByteArrayCoder(dataLength).decode(bytes3, 0);
38182
+ const bytes2 = arrayify(messageData);
38183
+ const dataLength = bytes2.length;
38184
+ const [data] = new ByteArrayCoder(dataLength).decode(bytes2, 0);
38414
38185
  return arrayify(data);
38415
38186
  }
38416
38187
  decode(data, offset) {
@@ -38852,6 +38623,11 @@ If you are attempting to transform a hex value, please make sure it is being pas
38852
38623
  });
38853
38624
  }
38854
38625
  };
38626
+ var UpgradePurposeTypeEnum = /* @__PURE__ */ ((UpgradePurposeTypeEnum2) => {
38627
+ UpgradePurposeTypeEnum2[UpgradePurposeTypeEnum2["ConsensusParameters"] = 0] = "ConsensusParameters";
38628
+ UpgradePurposeTypeEnum2[UpgradePurposeTypeEnum2["StateTransition"] = 1] = "StateTransition";
38629
+ return UpgradePurposeTypeEnum2;
38630
+ })(UpgradePurposeTypeEnum || {});
38855
38631
  var UpgradePurposeCoder = class extends Coder {
38856
38632
  constructor() {
38857
38633
  super("UpgradePurpose", "UpgradePurpose", 0);
@@ -39640,19 +39416,19 @@ If you are attempting to transform a hex value, please make sure it is being pas
39640
39416
  return "GraphQLError";
39641
39417
  }
39642
39418
  toString() {
39643
- let output3 = this.message;
39419
+ let output2 = this.message;
39644
39420
  if (this.nodes) {
39645
39421
  for (const node of this.nodes) {
39646
39422
  if (node.loc) {
39647
- output3 += "\n\n" + printLocation(node.loc);
39423
+ output2 += "\n\n" + printLocation(node.loc);
39648
39424
  }
39649
39425
  }
39650
39426
  } else if (this.source && this.locations) {
39651
39427
  for (const location of this.locations) {
39652
- output3 += "\n\n" + printSourceLocation(this.source, location);
39428
+ output2 += "\n\n" + printSourceLocation(this.source, location);
39653
39429
  }
39654
39430
  }
39655
- return output3;
39431
+ return output2;
39656
39432
  }
39657
39433
  toJSON() {
39658
39434
  const formattedError = {
@@ -44276,6 +44052,39 @@ ${MessageFragmentDoc}`;
44276
44052
  const blobLen = resolveGasDependentCosts(witnessBytesSize, gasCosts.s256);
44277
44053
  return txId.add(blobLen);
44278
44054
  }
44055
+ function calculateMetadataGasForTxUpgrade({
44056
+ gasCosts,
44057
+ txBytesSize,
44058
+ consensusSize
44059
+ }) {
44060
+ const txId = resolveGasDependentCosts(txBytesSize, gasCosts.s256);
44061
+ if (consensusSize) {
44062
+ const consensusLen = resolveGasDependentCosts(consensusSize, gasCosts.s256);
44063
+ txId.add(consensusLen);
44064
+ }
44065
+ return txId;
44066
+ }
44067
+ function calculateMetadataGasForTxUpload({
44068
+ gasCosts,
44069
+ txBytesSize,
44070
+ subsectionSize,
44071
+ subsectionsSize
44072
+ }) {
44073
+ const txId = resolveGasDependentCosts(txBytesSize, gasCosts.s256);
44074
+ const subsectionLen = resolveGasDependentCosts(subsectionSize, gasCosts.s256);
44075
+ txId.add(subsectionLen);
44076
+ const subsectionsLen = resolveGasDependentCosts(subsectionsSize, gasCosts.stateRoot);
44077
+ txId.add(subsectionsLen);
44078
+ return txId;
44079
+ }
44080
+ function calculateMinGasForTxUpload({
44081
+ gasCosts,
44082
+ baseMinGas,
44083
+ subsectionSize
44084
+ }) {
44085
+ const additionalStoragePerByte = bn(gasCosts.newStoragePerByte).mul(subsectionSize);
44086
+ return bn(baseMinGas).add(additionalStoragePerByte);
44087
+ }
44279
44088
  var calculateGasFee = (params) => {
44280
44089
  const { gas, gasPrice, priceFactor, tip } = params;
44281
44090
  return gas.mul(gasPrice).div(priceFactor).add(bn(tip));
@@ -44548,8 +44357,8 @@ ${PANIC_DOC_URL}#variant.${statusReason}`;
44548
44357
  *
44549
44358
  * Pushes an output to the list without any side effects and returns the index
44550
44359
  */
44551
- pushOutput(output3) {
44552
- this.outputs.push(output3);
44360
+ pushOutput(output2) {
44361
+ this.outputs.push(output2);
44553
44362
  return this.outputs.length - 1;
44554
44363
  }
44555
44364
  /**
@@ -44633,7 +44442,7 @@ ${PANIC_DOC_URL}#variant.${statusReason}`;
44633
44442
  */
44634
44443
  getCoinOutputs() {
44635
44444
  return this.outputs.filter(
44636
- (output3) => output3.type === OutputType.Coin
44445
+ (output2) => output2.type === OutputType.Coin
44637
44446
  );
44638
44447
  }
44639
44448
  /**
@@ -44643,7 +44452,7 @@ ${PANIC_DOC_URL}#variant.${statusReason}`;
44643
44452
  */
44644
44453
  getChangeOutputs() {
44645
44454
  return this.outputs.filter(
44646
- (output3) => output3.type === OutputType.Change
44455
+ (output2) => output2.type === OutputType.Change
44647
44456
  );
44648
44457
  }
44649
44458
  /**
@@ -44796,7 +44605,7 @@ ${PANIC_DOC_URL}#variant.${statusReason}`;
44796
44605
  */
44797
44606
  addChangeOutput(to, assetId) {
44798
44607
  const changeOutput = this.getChangeOutputs().find(
44799
- (output3) => hexlify(output3.assetId) === assetId
44608
+ (output2) => hexlify(output2.assetId) === assetId
44800
44609
  );
44801
44610
  if (!changeOutput) {
44802
44611
  this.pushOutput({
@@ -44876,12 +44685,12 @@ ${PANIC_DOC_URL}#variant.${statusReason}`;
44876
44685
  usedQuantity = bn("1000000000000000000");
44877
44686
  }
44878
44687
  if (assetInput && "assetId" in assetInput) {
44879
- assetInput.id = hexlify(randomBytes2(UTXO_ID_LEN));
44688
+ assetInput.id = hexlify(randomBytes22(UTXO_ID_LEN));
44880
44689
  assetInput.amount = usedQuantity;
44881
44690
  } else {
44882
44691
  this.addResources([
44883
44692
  {
44884
- id: hexlify(randomBytes2(UTXO_ID_LEN)),
44693
+ id: hexlify(randomBytes22(UTXO_ID_LEN)),
44885
44694
  amount: usedQuantity,
44886
44695
  assetId,
44887
44696
  owner: resourcesOwner || Address.fromRandom(),
@@ -44981,8 +44790,8 @@ ${PANIC_DOC_URL}#variant.${statusReason}`;
44981
44790
  return inputClone;
44982
44791
  }
44983
44792
  });
44984
- transaction.outputs = transaction.outputs.map((output3) => {
44985
- const outputClone = clone_default(output3);
44793
+ transaction.outputs = transaction.outputs.map((output2) => {
44794
+ const outputClone = clone_default(output2);
44986
44795
  switch (outputClone.type) {
44987
44796
  case OutputType.Contract: {
44988
44797
  outputClone.balanceRoot = ZeroBytes32;
@@ -45142,7 +44951,7 @@ ${PANIC_DOC_URL}#variant.${statusReason}`;
45142
44951
  */
45143
44952
  getContractCreatedOutputs() {
45144
44953
  return this.outputs.filter(
45145
- (output3) => output3.type === OutputType.ContractCreated
44954
+ (output2) => output2.type === OutputType.ContractCreated
45146
44955
  );
45147
44956
  }
45148
44957
  /**
@@ -45265,7 +45074,7 @@ ${PANIC_DOC_URL}#variant.${statusReason}`;
45265
45074
  */
45266
45075
  getContractOutputs() {
45267
45076
  return this.outputs.filter(
45268
- (output3) => output3.type === OutputType.Contract
45077
+ (output2) => output2.type === OutputType.Contract
45269
45078
  );
45270
45079
  }
45271
45080
  /**
@@ -45275,7 +45084,7 @@ ${PANIC_DOC_URL}#variant.${statusReason}`;
45275
45084
  */
45276
45085
  getVariableOutputs() {
45277
45086
  return this.outputs.filter(
45278
- (output3) => output3.type === OutputType.Variable
45087
+ (output2) => output2.type === OutputType.Variable
45279
45088
  );
45280
45089
  }
45281
45090
  /**
@@ -45382,9 +45191,257 @@ ${PANIC_DOC_URL}#variant.${statusReason}`;
45382
45191
  }
45383
45192
  };
45384
45193
 
45194
+ // src/providers/transaction-request/upgrade-transaction-request.ts
45195
+ var UpgradeTransactionRequest = class extends BaseTransactionRequest {
45196
+ static from(obj) {
45197
+ if (obj instanceof UpgradeTransactionRequest) {
45198
+ return obj;
45199
+ }
45200
+ return new this(clone_default(obj));
45201
+ }
45202
+ /** The type of transaction */
45203
+ type = TransactionType.Upgrade;
45204
+ /** The upgrade purpose */
45205
+ upgradePurpose;
45206
+ /** Witness index of consensus */
45207
+ bytecodeWitnessIndex;
45208
+ /**
45209
+ * Creates an instance `UpgradeTransactionRequest`.
45210
+ *
45211
+ * @param upgradeTransactionRequestLike - The initial values for the instance
45212
+ */
45213
+ constructor({
45214
+ upgradePurpose,
45215
+ bytecodeWitnessIndex,
45216
+ ...rest
45217
+ } = {}) {
45218
+ super(rest);
45219
+ this.bytecodeWitnessIndex = bytecodeWitnessIndex ?? 0;
45220
+ this.upgradePurpose = upgradePurpose ?? {
45221
+ type: UpgradePurposeTypeEnum.ConsensusParameters,
45222
+ checksum: "0x"
45223
+ };
45224
+ }
45225
+ /**
45226
+ * Adds a consensus parameters upgrade purpose.
45227
+ *
45228
+ * @param consensus - The consensus bytecode.
45229
+ *
45230
+ * @returns - The current instance of `UpgradeTransactionRequest`.
45231
+ */
45232
+ addConsensusParametersUpgradePurpose(consensus) {
45233
+ this.bytecodeWitnessIndex = this.addWitness(consensus);
45234
+ this.upgradePurpose = {
45235
+ type: UpgradePurposeTypeEnum.ConsensusParameters,
45236
+ checksum: hash2(consensus)
45237
+ };
45238
+ return this;
45239
+ }
45240
+ /**
45241
+ * Adds a state transition upgrade purpose.
45242
+ *
45243
+ * @param bytecodeRoot - The Merkle root of the state transition.
45244
+ *
45245
+ * @returns - The current instance of `UpgradeTransactionRequest`.
45246
+ */
45247
+ addStateTransitionUpgradePurpose(bytecodeRoot) {
45248
+ this.upgradePurpose = {
45249
+ type: UpgradePurposeTypeEnum.StateTransition,
45250
+ data: hexlify(bytecodeRoot)
45251
+ };
45252
+ return this;
45253
+ }
45254
+ /**
45255
+ * Adds an upgrade purpose.
45256
+ *
45257
+ * @param type - The upgrade purpose type.
45258
+ * @param data - The bytecode or merkle root of upgrade purpose
45259
+ *
45260
+ * @returns - The current instance of `UpgradeTransactionRequest`.
45261
+ */
45262
+ addUpgradePurpose(type3, data) {
45263
+ if (type3 === UpgradePurposeTypeEnum.ConsensusParameters) {
45264
+ this.addConsensusParametersUpgradePurpose(data);
45265
+ }
45266
+ if (type3 === UpgradePurposeTypeEnum.StateTransition) {
45267
+ this.addStateTransitionUpgradePurpose(data);
45268
+ }
45269
+ return this;
45270
+ }
45271
+ /**
45272
+ * Converts the transaction request to a `TransactionUpgrade`.
45273
+ *
45274
+ * @returns The transaction create object.
45275
+ */
45276
+ toTransaction() {
45277
+ let upgradePurpose;
45278
+ if (this.upgradePurpose.type === UpgradePurposeTypeEnum.ConsensusParameters) {
45279
+ upgradePurpose = {
45280
+ type: UpgradePurposeTypeEnum.ConsensusParameters,
45281
+ data: {
45282
+ witnessIndex: this.bytecodeWitnessIndex,
45283
+ checksum: this.upgradePurpose.checksum
45284
+ }
45285
+ };
45286
+ } else if (this.upgradePurpose.type === UpgradePurposeTypeEnum.StateTransition) {
45287
+ upgradePurpose = {
45288
+ type: UpgradePurposeTypeEnum.StateTransition,
45289
+ data: {
45290
+ bytecodeRoot: hexlify(this.upgradePurpose.data)
45291
+ }
45292
+ };
45293
+ } else {
45294
+ throw new FuelError(FuelError.CODES.NOT_IMPLEMENTED, "Invalid upgrade purpose");
45295
+ }
45296
+ return {
45297
+ type: TransactionType.Upgrade,
45298
+ ...super.getBaseTransaction(),
45299
+ upgradePurpose
45300
+ };
45301
+ }
45302
+ /**
45303
+ * Gets the Transaction ID by hashing the transaction
45304
+ *
45305
+ * @param chainId - The chain ID.
45306
+ *
45307
+ * @returns - A hash of the transaction, which is the transaction ID.
45308
+ */
45309
+ getTransactionId(chainId) {
45310
+ return hashTransaction(this, chainId);
45311
+ }
45312
+ /**
45313
+ * Calculates the metadata gas cost for an upgrade transaction.
45314
+ *
45315
+ * @param gasCosts - gas costs passed from the chain.
45316
+ *
45317
+ * @returns metadata gas cost for the upgrade transaction.
45318
+ */
45319
+ metadataGas(gasCosts) {
45320
+ const txBytesSize = this.byteSize();
45321
+ if (this.upgradePurpose.type === UpgradePurposeTypeEnum.ConsensusParameters) {
45322
+ const witnessIndex = this.bytecodeWitnessIndex;
45323
+ const consensusSize = this.witnesses[witnessIndex].length;
45324
+ return calculateMetadataGasForTxUpgrade({
45325
+ gasCosts,
45326
+ txBytesSize,
45327
+ consensusSize
45328
+ });
45329
+ }
45330
+ if (this.upgradePurpose.type === UpgradePurposeTypeEnum.StateTransition) {
45331
+ return calculateMetadataGasForTxUpgrade({
45332
+ gasCosts,
45333
+ txBytesSize
45334
+ });
45335
+ }
45336
+ throw new FuelError(FuelError.CODES.NOT_IMPLEMENTED, "Invalid upgrade purpose");
45337
+ }
45338
+ };
45339
+
45340
+ // src/providers/transaction-request/upload-transaction-request.ts
45341
+ var UploadTransactionRequest = class extends BaseTransactionRequest {
45342
+ static from(obj) {
45343
+ if (obj instanceof UploadTransactionRequest) {
45344
+ return obj;
45345
+ }
45346
+ return new this(clone_default(obj));
45347
+ }
45348
+ /** Type of the transaction */
45349
+ type = TransactionType.Upload;
45350
+ /** The witness index of the subsection of the bytecode. */
45351
+ witnessIndex;
45352
+ /** The subsection data. */
45353
+ subsection;
45354
+ /**
45355
+ * Creates an instance `UploadTransactionRequest`.
45356
+ *
45357
+ * @param uploadTransactionRequestLike - The initial values for the instance
45358
+ */
45359
+ constructor({ witnessIndex, subsection, ...rest } = {}) {
45360
+ super(rest);
45361
+ this.witnessIndex = witnessIndex ?? 0;
45362
+ this.subsection = subsection ?? {
45363
+ proofSet: [],
45364
+ root: ZeroBytes32,
45365
+ subsectionIndex: 0,
45366
+ subsectionsNumber: 0
45367
+ };
45368
+ }
45369
+ /**
45370
+ * Adds the subsection.
45371
+ *
45372
+ * @param subsection - The subsection data.
45373
+ */
45374
+ addSubsection(subsection) {
45375
+ const { subsection: subsectionBytecode, ...rest } = subsection;
45376
+ this.subsection = rest;
45377
+ this.witnessIndex = this.addWitness(subsectionBytecode);
45378
+ }
45379
+ /**
45380
+ * Gets the Transaction Request by hashing the transaction.
45381
+ *
45382
+ * @param chainId - The chain ID.
45383
+ *
45384
+ * @returns - A hash of the transaction, which is the transaction ID.
45385
+ */
45386
+ getTransactionId(chainId) {
45387
+ return hashTransaction(this, chainId);
45388
+ }
45389
+ /**
45390
+ * Converts the transaction request to a `TransactionUpload`.
45391
+ *
45392
+ * @returns The transaction create object.
45393
+ */
45394
+ toTransaction() {
45395
+ const baseTransaction = this.getBaseTransaction();
45396
+ const { subsectionIndex, subsectionsNumber, root, proofSet } = this.subsection;
45397
+ return {
45398
+ type: TransactionType.Upload,
45399
+ ...baseTransaction,
45400
+ subsectionIndex,
45401
+ subsectionsNumber,
45402
+ root: hexlify(root),
45403
+ proofSet: proofSet.map(hexlify),
45404
+ witnessIndex: this.witnessIndex,
45405
+ proofSetCount: proofSet.length
45406
+ };
45407
+ }
45408
+ /**
45409
+ * Calculates the metadata gas cost for an upload transaction.
45410
+ *
45411
+ * @param gasCosts - gas costs passed from the chain.
45412
+ *
45413
+ * @returns metadata gas cost for the upload transaction.
45414
+ */
45415
+ metadataGas(gasCosts) {
45416
+ return calculateMetadataGasForTxUpload({
45417
+ gasCosts,
45418
+ txBytesSize: this.byteSize(),
45419
+ subsectionSize: arrayify(this.witnesses[this.witnessIndex]).length,
45420
+ subsectionsSize: this.subsection.subsectionsNumber
45421
+ });
45422
+ }
45423
+ /**
45424
+ * Calculates the minimum gas for an upload transaction.
45425
+ *
45426
+ * @param chainInfo - The chain information.
45427
+ *
45428
+ * @returns the minimum gas for the upload transaction
45429
+ */
45430
+ calculateMinGas(chainInfo) {
45431
+ const minGas = super.calculateMinGas(chainInfo);
45432
+ const { gasCosts } = chainInfo.consensusParameters;
45433
+ const bytecode = this.witnesses[this.witnessIndex] ?? ZeroBytes32;
45434
+ return calculateMinGasForTxUpload({
45435
+ gasCosts,
45436
+ baseMinGas: minGas.toNumber(),
45437
+ subsectionSize: arrayify(bytecode).length
45438
+ });
45439
+ }
45440
+ };
45441
+
45385
45442
  // src/providers/transaction-request/utils.ts
45386
45443
  var transactionRequestify = (obj) => {
45387
- if (obj instanceof ScriptTransactionRequest || obj instanceof CreateTransactionRequest || obj instanceof BlobTransactionRequest) {
45444
+ if (obj instanceof ScriptTransactionRequest || obj instanceof CreateTransactionRequest || obj instanceof BlobTransactionRequest || obj instanceof UpgradeTransactionRequest || obj instanceof UploadTransactionRequest) {
45388
45445
  return obj;
45389
45446
  }
45390
45447
  const { type: type3 } = obj;
@@ -45398,6 +45455,12 @@ ${PANIC_DOC_URL}#variant.${statusReason}`;
45398
45455
  case TransactionType.Blob: {
45399
45456
  return BlobTransactionRequest.from(obj);
45400
45457
  }
45458
+ case TransactionType.Upgrade: {
45459
+ return UpgradeTransactionRequest.from(obj);
45460
+ }
45461
+ case TransactionType.Upload: {
45462
+ return UploadTransactionRequest.from(obj);
45463
+ }
45401
45464
  default: {
45402
45465
  throw new FuelError(
45403
45466
  ErrorCode.UNSUPPORTED_TRANSACTION_TYPE,
@@ -45623,6 +45686,10 @@ ${PANIC_DOC_URL}#variant.${statusReason}`;
45623
45686
  return "Script" /* Script */;
45624
45687
  case TransactionType.Blob:
45625
45688
  return "Blob" /* Blob */;
45689
+ case TransactionType.Upgrade:
45690
+ return "Upgrade" /* Upgrade */;
45691
+ case TransactionType.Upload:
45692
+ return "Upload" /* Upload */;
45626
45693
  default:
45627
45694
  throw new FuelError(
45628
45695
  ErrorCode.UNSUPPORTED_TRANSACTION_TYPE,
@@ -45798,8 +45865,8 @@ ${PANIC_DOC_URL}#variant.${statusReason}`;
45798
45865
  }) {
45799
45866
  const contractCallReceipts = getReceiptsCall(receipts);
45800
45867
  const contractOutputs = getOutputsContract(outputs);
45801
- return contractOutputs.flatMap((output3) => {
45802
- const contractInput = getInputContractFromIndex(inputs, output3.inputIndex);
45868
+ return contractOutputs.flatMap((output2) => {
45869
+ const contractInput = getInputContractFromIndex(inputs, output2.inputIndex);
45803
45870
  if (!contractInput) {
45804
45871
  return [];
45805
45872
  }
@@ -45821,7 +45888,7 @@ ${PANIC_DOC_URL}#variant.${statusReason}`;
45821
45888
  let { from: fromAddress } = receipt;
45822
45889
  const toType = contractInputs.some((input) => input.contractID === toAddress) ? 0 /* contract */ : 1 /* account */;
45823
45890
  if (ZeroBytes32 === fromAddress) {
45824
- const change = changeOutputs.find((output3) => output3.assetId === assetId);
45891
+ const change = changeOutputs.find((output2) => output2.assetId === assetId);
45825
45892
  fromAddress = change?.to || fromAddress;
45826
45893
  }
45827
45894
  const fromType = contractInputs.some((input) => input.contractID === fromAddress) ? 0 /* contract */ : 1 /* account */;
@@ -45899,7 +45966,7 @@ ${PANIC_DOC_URL}#variant.${statusReason}`;
45899
45966
  }
45900
45967
  function getPayProducerOperations(outputs) {
45901
45968
  const coinOutputs = getOutputsCoin(outputs);
45902
- const payProducerOperations = coinOutputs.reduce((prev, output3) => {
45969
+ const payProducerOperations = coinOutputs.reduce((prev, output2) => {
45903
45970
  const operations = addOperation(prev, {
45904
45971
  name: "Pay network fee to block producer" /* payBlockProducer */,
45905
45972
  from: {
@@ -45908,12 +45975,12 @@ ${PANIC_DOC_URL}#variant.${statusReason}`;
45908
45975
  },
45909
45976
  to: {
45910
45977
  type: 1 /* account */,
45911
- address: output3.to.toString()
45978
+ address: output2.to.toString()
45912
45979
  },
45913
45980
  assetsSent: [
45914
45981
  {
45915
- assetId: output3.assetId.toString(),
45916
- amount: output3.amount
45982
+ assetId: output2.assetId.toString(),
45983
+ amount: output2.amount
45917
45984
  }
45918
45985
  ]
45919
45986
  });
@@ -46574,21 +46641,31 @@ ${PANIC_DOC_URL}#variant.${statusReason}`;
46574
46641
  * @hidden
46575
46642
  */
46576
46643
  constructor(url, options = {}) {
46577
- this.url = url;
46578
46644
  /**
46579
46645
  * @hidden
46580
46646
  */
46581
46647
  __privateAdd(this, _cacheInputs);
46582
46648
  __publicField(this, "operations");
46583
46649
  __publicField(this, "cache");
46650
+ /** @hidden */
46651
+ __publicField(this, "url");
46652
+ /** @hidden */
46653
+ __publicField(this, "urlWithoutAuth");
46584
46654
  __publicField(this, "options", {
46585
46655
  timeout: void 0,
46586
46656
  resourceCacheTTL: void 0,
46587
46657
  fetch: void 0,
46588
- retryOptions: void 0
46658
+ retryOptions: void 0,
46659
+ headers: void 0
46589
46660
  });
46661
+ const { url: rawUrl, urlWithoutAuth, headers } = _Provider.extractBasicAuth(url);
46662
+ this.url = rawUrl;
46663
+ this.urlWithoutAuth = urlWithoutAuth;
46590
46664
  this.options = { ...this.options, ...options };
46591
46665
  this.url = url;
46666
+ if (headers) {
46667
+ this.options = { ...this.options, headers: { ...this.options.headers, ...headers } };
46668
+ }
46592
46669
  this.operations = this.createOperations();
46593
46670
  const { resourceCacheTTL } = this.options;
46594
46671
  if (isDefined(resourceCacheTTL)) {
@@ -46610,12 +46687,16 @@ ${PANIC_DOC_URL}#variant.${statusReason}`;
46610
46687
  * @hidden
46611
46688
  */
46612
46689
  static getFetchFn(options) {
46613
- const { retryOptions, timeout } = options;
46690
+ const { retryOptions, timeout, headers } = options;
46614
46691
  return autoRetryFetch(async (...args) => {
46615
46692
  const url = args[0];
46616
46693
  const request = args[1];
46617
46694
  const signal = timeout ? AbortSignal.timeout(timeout) : void 0;
46618
- let fullRequest = { ...request, signal };
46695
+ let fullRequest = {
46696
+ ...request,
46697
+ signal,
46698
+ headers: { ...request?.headers, ...headers }
46699
+ };
46619
46700
  if (options.requestMiddleware) {
46620
46701
  fullRequest = await options.requestMiddleware(fullRequest);
46621
46702
  }
@@ -46623,15 +46704,23 @@ ${PANIC_DOC_URL}#variant.${statusReason}`;
46623
46704
  }, retryOptions);
46624
46705
  }
46625
46706
  static extractBasicAuth(url) {
46626
- const parsedUrl = new URL(url);
46707
+ let parsedUrl;
46708
+ try {
46709
+ parsedUrl = new URL(url);
46710
+ } catch (error) {
46711
+ throw new FuelError(FuelError.CODES.INVALID_URL, "Invalid URL provided.", { url }, error);
46712
+ }
46627
46713
  const username = parsedUrl.username;
46628
46714
  const password = parsedUrl.password;
46629
- const urlNoBasicAuth = `${parsedUrl.origin}${parsedUrl.pathname}`;
46715
+ const urlWithoutAuth = `${parsedUrl.origin}${parsedUrl.pathname}`;
46630
46716
  if (!(username && password)) {
46631
- return { url, auth: void 0 };
46717
+ return { url, urlWithoutAuth: url, headers: void 0 };
46632
46718
  }
46633
- const auth = `Basic ${btoa(`${username}:${password}`)}`;
46634
- return { url: urlNoBasicAuth, auth };
46719
+ return {
46720
+ url,
46721
+ urlWithoutAuth,
46722
+ headers: { Authorization: `Basic ${btoa(`${username}:${password}`)}` }
46723
+ };
46635
46724
  }
46636
46725
  /**
46637
46726
  * Creates a new instance of the Provider class. This is the recommended way to initialize a Provider.
@@ -46642,17 +46731,7 @@ ${PANIC_DOC_URL}#variant.${statusReason}`;
46642
46731
  * @returns A promise that resolves to a Provider instance.
46643
46732
  */
46644
46733
  static async create(url, options = {}) {
46645
- const { url: urlToUse, auth } = this.extractBasicAuth(url);
46646
- const provider = new _Provider(urlToUse, {
46647
- ...options,
46648
- requestMiddleware: async (request) => {
46649
- if (auth && request) {
46650
- request.headers ??= {};
46651
- request.headers.Authorization = auth;
46652
- }
46653
- return options.requestMiddleware?.(request) ?? request;
46654
- }
46655
- });
46734
+ const provider = new _Provider(url, options);
46656
46735
  await provider.fetchChainAndNodeInfo();
46657
46736
  return provider;
46658
46737
  }
@@ -46662,7 +46741,7 @@ ${PANIC_DOC_URL}#variant.${statusReason}`;
46662
46741
  * @returns the chain information configuration.
46663
46742
  */
46664
46743
  getChain() {
46665
- const chain = _Provider.chainInfoCache[this.url];
46744
+ const chain = _Provider.chainInfoCache[this.urlWithoutAuth];
46666
46745
  if (!chain) {
46667
46746
  throw new FuelError(
46668
46747
  ErrorCode.CHAIN_INFO_CACHE_EMPTY,
@@ -46677,7 +46756,7 @@ ${PANIC_DOC_URL}#variant.${statusReason}`;
46677
46756
  * @returns the node information configuration.
46678
46757
  */
46679
46758
  getNode() {
46680
- const node = _Provider.nodeInfoCache[this.url];
46759
+ const node = _Provider.nodeInfoCache[this.urlWithoutAuth];
46681
46760
  if (!node) {
46682
46761
  throw new FuelError(
46683
46762
  ErrorCode.NODE_INFO_CACHE_EMPTY,
@@ -46711,8 +46790,11 @@ ${PANIC_DOC_URL}#variant.${statusReason}`;
46711
46790
  * @param options - Additional options for the provider.
46712
46791
  */
46713
46792
  async connect(url, options) {
46714
- this.url = url;
46793
+ const { url: rawUrl, urlWithoutAuth, headers } = _Provider.extractBasicAuth(url);
46794
+ this.url = rawUrl;
46795
+ this.urlWithoutAuth = urlWithoutAuth;
46715
46796
  this.options = options ?? this.options;
46797
+ this.options = { ...this.options, headers: { ...this.options.headers, ...headers } };
46716
46798
  this.operations = this.createOperations();
46717
46799
  await this.fetchChainAndNodeInfo();
46718
46800
  }
@@ -46752,7 +46834,7 @@ Supported fuel-core version: ${supportedVersion}.`
46752
46834
  */
46753
46835
  createOperations() {
46754
46836
  const fetchFn = _Provider.getFetchFn(this.options);
46755
- const gqlClient = new import_graphql_request.GraphQLClient(this.url, {
46837
+ const gqlClient = new import_graphql_request.GraphQLClient(this.urlWithoutAuth, {
46756
46838
  fetch: (url, requestInit) => fetchFn(url, requestInit, this.options),
46757
46839
  responseMiddleware: (response) => {
46758
46840
  if ("response" in response) {
@@ -46770,7 +46852,7 @@ Supported fuel-core version: ${supportedVersion}.`
46770
46852
  const isSubscription = opDefinition?.operation === "subscription";
46771
46853
  if (isSubscription) {
46772
46854
  return FuelGraphqlSubscriber.create({
46773
- url: this.url,
46855
+ url: this.urlWithoutAuth,
46774
46856
  query,
46775
46857
  fetchFn: (url, requestInit) => fetchFn(url, requestInit, this.options),
46776
46858
  variables: vars
@@ -46833,7 +46915,7 @@ Supported fuel-core version: ${supportedVersion}.`
46833
46915
  utxoValidation: nodeInfo.utxoValidation,
46834
46916
  vmBacktrace: nodeInfo.vmBacktrace
46835
46917
  };
46836
- _Provider.nodeInfoCache[this.url] = processedNodeInfo;
46918
+ _Provider.nodeInfoCache[this.urlWithoutAuth] = processedNodeInfo;
46837
46919
  return processedNodeInfo;
46838
46920
  }
46839
46921
  /**
@@ -46844,7 +46926,7 @@ Supported fuel-core version: ${supportedVersion}.`
46844
46926
  async fetchChain() {
46845
46927
  const { chain } = await this.operations.getChain();
46846
46928
  const processedChain = processGqlChain(chain);
46847
- _Provider.chainInfoCache[this.url] = processedChain;
46929
+ _Provider.chainInfoCache[this.urlWithoutAuth] = processedChain;
46848
46930
  return processedChain;
46849
46931
  }
46850
46932
  /**
@@ -47891,12 +47973,14 @@ Supported fuel-core version: ${supportedVersion}.`
47891
47973
  // src/providers/chains.ts
47892
47974
  var CHAIN_IDS = {
47893
47975
  eth: {
47976
+ mainnet: 1,
47894
47977
  sepolia: 11155111,
47895
47978
  foundry: 31337
47896
47979
  },
47897
47980
  fuel: {
47898
47981
  devnet: 0,
47899
- testnet: 0
47982
+ testnet: 0,
47983
+ mainnet: 9889
47900
47984
  }
47901
47985
  };
47902
47986
 
@@ -47942,6 +48026,11 @@ Supported fuel-core version: ${supportedVersion}.`
47942
48026
  chainId: CHAIN_IDS.eth.foundry,
47943
48027
  decimals: 18
47944
48028
  },
48029
+ {
48030
+ type: "ethereum",
48031
+ chainId: CHAIN_IDS.eth.mainnet,
48032
+ decimals: 18
48033
+ },
47945
48034
  {
47946
48035
  type: "fuel",
47947
48036
  chainId: CHAIN_IDS.fuel.devnet,
@@ -47953,6 +48042,571 @@ Supported fuel-core version: ${supportedVersion}.`
47953
48042
  chainId: CHAIN_IDS.fuel.testnet,
47954
48043
  decimals: 9,
47955
48044
  assetId: "0xf8f8b6283d7fa5b672b530cbb84fcccb4ff8dc40f8176ef4544ddb1f1952ad07"
48045
+ },
48046
+ {
48047
+ type: "fuel",
48048
+ chainId: CHAIN_IDS.fuel.mainnet,
48049
+ decimals: 9,
48050
+ assetId: "0xf8f8b6283d7fa5b672b530cbb84fcccb4ff8dc40f8176ef4544ddb1f1952ad07"
48051
+ }
48052
+ ]
48053
+ },
48054
+ {
48055
+ name: "WETH",
48056
+ symbol: "WETH",
48057
+ icon: "weth.svg",
48058
+ networks: [
48059
+ {
48060
+ type: "ethereum",
48061
+ chainId: CHAIN_IDS.eth.mainnet,
48062
+ address: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
48063
+ decimals: 18
48064
+ },
48065
+ {
48066
+ type: "fuel",
48067
+ chainId: CHAIN_IDS.fuel.mainnet,
48068
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
48069
+ assetId: "0xa38a5a8beeb08d95744bc7f58528073f4052b254def59eba20c99c202b5acaa3",
48070
+ decimals: 18
48071
+ }
48072
+ ]
48073
+ },
48074
+ {
48075
+ name: "weETH",
48076
+ symbol: "weETH",
48077
+ icon: "weETH.webp",
48078
+ networks: [
48079
+ {
48080
+ type: "ethereum",
48081
+ chainId: CHAIN_IDS.eth.mainnet,
48082
+ address: "0xCd5fE23C85820F7B72D0926FC9b05b43E359b7ee",
48083
+ decimals: 18
48084
+ },
48085
+ {
48086
+ type: "fuel",
48087
+ chainId: CHAIN_IDS.fuel.mainnet,
48088
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
48089
+ assetId: "0x239ed6e12b7ce4089ee245244e3bf906999a6429c2a9a445a1e1faf56914a4ab",
48090
+ decimals: 18
48091
+ }
48092
+ ]
48093
+ },
48094
+ {
48095
+ name: "rsETH",
48096
+ symbol: "rsETH",
48097
+ icon: "rsETH.webp",
48098
+ networks: [
48099
+ {
48100
+ type: "ethereum",
48101
+ chainId: CHAIN_IDS.eth.mainnet,
48102
+ address: "0xA1290d69c65A6Fe4DF752f95823fae25cB99e5A7",
48103
+ decimals: 18
48104
+ },
48105
+ {
48106
+ type: "fuel",
48107
+ chainId: CHAIN_IDS.fuel.mainnet,
48108
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
48109
+ assetId: "0xbae80f7fb8aa6b90d9b01ef726ec847cc4f59419c4d5f2ea88fec785d1b0e849",
48110
+ decimals: 18
48111
+ }
48112
+ ]
48113
+ },
48114
+ {
48115
+ name: "rETH",
48116
+ symbol: "rETH",
48117
+ icon: "reth.svg",
48118
+ networks: [
48119
+ {
48120
+ type: "ethereum",
48121
+ chainId: CHAIN_IDS.eth.mainnet,
48122
+ address: "0xae78736cd615f374d3085123a210448e74fc6393",
48123
+ decimals: 18
48124
+ },
48125
+ {
48126
+ type: "fuel",
48127
+ chainId: CHAIN_IDS.fuel.mainnet,
48128
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
48129
+ assetId: "0xf3f9a0ed0ce8eac5f89d6b83e41b3848212d5b5f56108c54a205bb228ca30c16",
48130
+ decimals: 18
48131
+ }
48132
+ ]
48133
+ },
48134
+ {
48135
+ name: "wbETH",
48136
+ symbol: "wbETH",
48137
+ icon: "wbeth.png",
48138
+ networks: [
48139
+ {
48140
+ type: "ethereum",
48141
+ chainId: CHAIN_IDS.eth.mainnet,
48142
+ address: "0xa2E3356610840701BDf5611a53974510Ae27E2e1",
48143
+ decimals: 18
48144
+ },
48145
+ {
48146
+ type: "fuel",
48147
+ chainId: CHAIN_IDS.fuel.mainnet,
48148
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
48149
+ assetId: "0x7843c74bef935e837f2bcf67b5d64ecb46dd53ff86375530b0caf3699e8ffafe",
48150
+ decimals: 18
48151
+ }
48152
+ ]
48153
+ },
48154
+ {
48155
+ name: "rstETH",
48156
+ symbol: "rstETH",
48157
+ icon: "rstETH.webp",
48158
+ networks: [
48159
+ {
48160
+ type: "ethereum",
48161
+ chainId: CHAIN_IDS.eth.mainnet,
48162
+ address: "0x7a4EffD87C2f3C55CA251080b1343b605f327E3a",
48163
+ decimals: 18
48164
+ },
48165
+ {
48166
+ type: "fuel",
48167
+ chainId: CHAIN_IDS.fuel.mainnet,
48168
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
48169
+ assetId: "0x962792286fbc9b1d5860b4551362a12249362c21594c77abf4b3fe2bbe8d977a",
48170
+ decimals: 18
48171
+ }
48172
+ ]
48173
+ },
48174
+ {
48175
+ name: "amphrETH",
48176
+ symbol: "amphrETH",
48177
+ icon: "amphrETH.png",
48178
+ networks: [
48179
+ {
48180
+ type: "ethereum",
48181
+ chainId: CHAIN_IDS.eth.mainnet,
48182
+ address: "0x5fD13359Ba15A84B76f7F87568309040176167cd",
48183
+ decimals: 18
48184
+ },
48185
+ {
48186
+ type: "fuel",
48187
+ chainId: CHAIN_IDS.fuel.mainnet,
48188
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
48189
+ assetId: "0x05fc623e57bd7bc1258efa8e4f62b05af5471d73df6f2c2dc11ecc81134c4f36",
48190
+ decimals: 18
48191
+ }
48192
+ ]
48193
+ },
48194
+ {
48195
+ name: "Manta mBTC",
48196
+ symbol: "Manta mBTC",
48197
+ icon: "manta-mbtc.svg",
48198
+ networks: [
48199
+ {
48200
+ type: "ethereum",
48201
+ chainId: CHAIN_IDS.eth.mainnet,
48202
+ address: "0x4041381e947CFD3D483d67a25C6aa9Dc924250c5",
48203
+ decimals: 18
48204
+ },
48205
+ {
48206
+ type: "fuel",
48207
+ chainId: CHAIN_IDS.fuel.mainnet,
48208
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
48209
+ assetId: "0xaf3111a248ff7a3238cdeea845bb2d43cf3835f1f6b8c9d28360728b55b9ce5b",
48210
+ decimals: 18
48211
+ }
48212
+ ]
48213
+ },
48214
+ {
48215
+ name: "Manta mETH",
48216
+ symbol: "Manta mETH",
48217
+ icon: "manta-meth.svg",
48218
+ networks: [
48219
+ {
48220
+ type: "ethereum",
48221
+ chainId: CHAIN_IDS.eth.mainnet,
48222
+ address: "0x8CdF550C04Bc9B9F10938368349C9c8051A772b6",
48223
+ decimals: 18
48224
+ },
48225
+ {
48226
+ type: "fuel",
48227
+ chainId: CHAIN_IDS.fuel.mainnet,
48228
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
48229
+ assetId: "0xafd219f513317b1750783c6581f55530d6cf189a5863fd18bd1b3ffcec1714b4",
48230
+ decimals: 18
48231
+ }
48232
+ ]
48233
+ },
48234
+ {
48235
+ name: "Manta mUSD",
48236
+ symbol: "Manta mUSD",
48237
+ icon: "manta-musd.svg",
48238
+ networks: [
48239
+ {
48240
+ type: "ethereum",
48241
+ chainId: CHAIN_IDS.eth.mainnet,
48242
+ address: "0x3f24E1d7a973867fC2A03fE199E5502514E0e11E",
48243
+ decimals: 18
48244
+ },
48245
+ {
48246
+ type: "fuel",
48247
+ chainId: CHAIN_IDS.fuel.mainnet,
48248
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
48249
+ assetId: "0x89cb9401e55d49c3269654dd1cdfb0e80e57823a4a7db98ba8fc5953b120fef4",
48250
+ decimals: 18
48251
+ }
48252
+ ]
48253
+ },
48254
+ {
48255
+ name: "pumpBTC",
48256
+ symbol: "pumpBTC",
48257
+ icon: "pumpbtc.webp",
48258
+ networks: [
48259
+ {
48260
+ type: "ethereum",
48261
+ chainId: CHAIN_IDS.eth.mainnet,
48262
+ address: "0xf469fbd2abcd6b9de8e169d128226c0fc90a012e",
48263
+ decimals: 8
48264
+ },
48265
+ {
48266
+ type: "fuel",
48267
+ chainId: CHAIN_IDS.fuel.mainnet,
48268
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
48269
+ assetId: "0x0aa5eb2bb97ca915288b653a2529355d4dc66de2b37533213f0e4aeee3d3421f",
48270
+ decimals: 8
48271
+ }
48272
+ ]
48273
+ },
48274
+ {
48275
+ name: "FBTC",
48276
+ symbol: "FBTC",
48277
+ icon: "fbtc.svg",
48278
+ networks: [
48279
+ {
48280
+ type: "ethereum",
48281
+ chainId: CHAIN_IDS.eth.mainnet,
48282
+ address: "0xc96de26018a54d51c097160568752c4e3bd6c364",
48283
+ decimals: 8
48284
+ },
48285
+ {
48286
+ type: "fuel",
48287
+ chainId: CHAIN_IDS.fuel.mainnet,
48288
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
48289
+ assetId: "0xb5ecb0a1e08e2abbabf624ffea089df933376855f468ade35c6375b00c33996a",
48290
+ decimals: 8
48291
+ }
48292
+ ]
48293
+ },
48294
+ {
48295
+ name: "SolvBTC",
48296
+ symbol: "SolvBTC",
48297
+ icon: "solvBTC.webp",
48298
+ networks: [
48299
+ {
48300
+ type: "ethereum",
48301
+ chainId: CHAIN_IDS.eth.mainnet,
48302
+ address: "0x7a56e1c57c7475ccf742a1832b028f0456652f97",
48303
+ decimals: 18
48304
+ },
48305
+ {
48306
+ type: "fuel",
48307
+ chainId: CHAIN_IDS.fuel.mainnet,
48308
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
48309
+ assetId: "0x1186afea9affb88809c210e13e2330b5258c2cef04bb8fff5eff372b7bd3f40f",
48310
+ decimals: 18
48311
+ }
48312
+ ]
48313
+ },
48314
+ {
48315
+ name: "SolvBTC.BBN",
48316
+ symbol: "SolvBTC.BBN",
48317
+ icon: "SolvBTC.BBN.png",
48318
+ networks: [
48319
+ {
48320
+ type: "ethereum",
48321
+ chainId: CHAIN_IDS.eth.mainnet,
48322
+ address: "0xd9d920aa40f578ab794426f5c90f6c731d159def",
48323
+ decimals: 18
48324
+ },
48325
+ {
48326
+ type: "fuel",
48327
+ chainId: CHAIN_IDS.fuel.mainnet,
48328
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
48329
+ assetId: "0x7a4f087c957d30218223c2baaaa365355c9ca81b6ea49004cfb1590a5399216f",
48330
+ decimals: 18
48331
+ }
48332
+ ]
48333
+ },
48334
+ {
48335
+ name: "Mantle mETH",
48336
+ symbol: "Mantle mETH",
48337
+ icon: "mantle-meth.svg",
48338
+ networks: [
48339
+ {
48340
+ type: "ethereum",
48341
+ chainId: CHAIN_IDS.eth.mainnet,
48342
+ address: "0xd5F7838F5C461fefF7FE49ea5ebaF7728bB0ADfa",
48343
+ decimals: 18
48344
+ },
48345
+ {
48346
+ type: "fuel",
48347
+ chainId: CHAIN_IDS.fuel.mainnet,
48348
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
48349
+ assetId: "0x642a5db59ec323c2f846d4d4cf3e58d78aff64accf4f8f6455ba0aa3ef000a3b",
48350
+ decimals: 18
48351
+ }
48352
+ ]
48353
+ },
48354
+ {
48355
+ name: "sDAI",
48356
+ symbol: "sDAI",
48357
+ icon: "sdai.svg",
48358
+ networks: [
48359
+ {
48360
+ type: "ethereum",
48361
+ chainId: CHAIN_IDS.eth.mainnet,
48362
+ address: "0x83f20f44975d03b1b09e64809b757c47f942beea",
48363
+ decimals: 18
48364
+ },
48365
+ {
48366
+ type: "fuel",
48367
+ chainId: CHAIN_IDS.fuel.mainnet,
48368
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
48369
+ assetId: "0x9e46f919fbf978f3cad7cd34cca982d5613af63ff8aab6c379e4faa179552958",
48370
+ decimals: 18
48371
+ }
48372
+ ]
48373
+ },
48374
+ {
48375
+ name: "USDT",
48376
+ symbol: "USDT",
48377
+ icon: "usdt.svg",
48378
+ networks: [
48379
+ {
48380
+ type: "ethereum",
48381
+ chainId: CHAIN_IDS.eth.mainnet,
48382
+ address: "0xdAC17F958D2ee523a2206206994597C13D831ec7",
48383
+ decimals: 6
48384
+ },
48385
+ {
48386
+ type: "fuel",
48387
+ chainId: CHAIN_IDS.fuel.mainnet,
48388
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
48389
+ assetId: "0xa0265fb5c32f6e8db3197af3c7eb05c48ae373605b8165b6f4a51c5b0ba4812e",
48390
+ decimals: 6
48391
+ }
48392
+ ]
48393
+ },
48394
+ {
48395
+ name: "USDC",
48396
+ symbol: "USDC",
48397
+ icon: "usdc.svg",
48398
+ networks: [
48399
+ {
48400
+ type: "ethereum",
48401
+ chainId: CHAIN_IDS.eth.mainnet,
48402
+ address: "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
48403
+ decimals: 6
48404
+ },
48405
+ {
48406
+ type: "fuel",
48407
+ chainId: CHAIN_IDS.fuel.mainnet,
48408
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
48409
+ assetId: "0x286c479da40dc953bddc3bb4c453b608bba2e0ac483b077bd475174115395e6b",
48410
+ decimals: 6
48411
+ }
48412
+ ]
48413
+ },
48414
+ {
48415
+ name: "USDe",
48416
+ symbol: "USDe",
48417
+ icon: "USDe.svg",
48418
+ networks: [
48419
+ {
48420
+ type: "ethereum",
48421
+ chainId: CHAIN_IDS.eth.mainnet,
48422
+ address: "0x4c9edd5852cd905f086c759e8383e09bff1e68b3",
48423
+ decimals: 18
48424
+ },
48425
+ {
48426
+ type: "ethereum",
48427
+ chainId: CHAIN_IDS.eth.sepolia,
48428
+ address: "0xc6387efad0f184a90b34f397c3d6fd63135ef790",
48429
+ decimals: 18
48430
+ },
48431
+ {
48432
+ type: "fuel",
48433
+ chainId: CHAIN_IDS.fuel.mainnet,
48434
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
48435
+ assetId: "0xb6133b2ef9f6153eb869125d23dcf20d1e735331b5e41b15a6a7a6cec70e8651",
48436
+ decimals: 18
48437
+ },
48438
+ {
48439
+ type: "fuel",
48440
+ chainId: CHAIN_IDS.fuel.testnet,
48441
+ contractId: "0xC6387efAD0F184a90B34f397C3d6Fd63135ef790",
48442
+ assetId: "0xf5c6d72d0f2c782fa47d8e228c198a08654e9fc66ca60ad85902b1d09046a7ab",
48443
+ decimals: 18
48444
+ }
48445
+ ]
48446
+ },
48447
+ {
48448
+ name: "sUSDe",
48449
+ symbol: "sUSDe",
48450
+ icon: "sUSDe.webp",
48451
+ networks: [
48452
+ {
48453
+ type: "ethereum",
48454
+ chainId: CHAIN_IDS.eth.mainnet,
48455
+ address: "0x9d39a5de30e57443bff2a8307a4256c8797a3497",
48456
+ decimals: 18
48457
+ },
48458
+ {
48459
+ type: "ethereum",
48460
+ chainId: CHAIN_IDS.eth.sepolia,
48461
+ address: "0xb8f4f4eafc1d2a3c0a4d519bbf1114c311cc9b1b",
48462
+ decimals: 18
48463
+ },
48464
+ {
48465
+ type: "fuel",
48466
+ chainId: CHAIN_IDS.fuel.mainnet,
48467
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
48468
+ assetId: "0xd05563025104fc36496c15c7021ad6b31034b0e89a356f4f818045d1f48808bc",
48469
+ decimals: 18
48470
+ },
48471
+ {
48472
+ type: "fuel",
48473
+ chainId: CHAIN_IDS.fuel.testnet,
48474
+ contractId: "0xC6387efAD0F184a90B34f397C3d6Fd63135ef790",
48475
+ assetId: "0xa86e37d385c08beddbb02c8260f9ec535d484c8ea908fc19d4e6dc8d5141fb2e",
48476
+ decimals: 18
48477
+ }
48478
+ ]
48479
+ },
48480
+ {
48481
+ name: "rsUSDe",
48482
+ symbol: "rsUSDe",
48483
+ icon: "rsUSDe.svg",
48484
+ networks: [
48485
+ {
48486
+ type: "ethereum",
48487
+ chainId: CHAIN_IDS.eth.mainnet,
48488
+ address: "0x82f5104b23FF2FA54C2345F821dAc9369e9E0B26",
48489
+ decimals: 18
48490
+ },
48491
+ {
48492
+ type: "fuel",
48493
+ chainId: CHAIN_IDS.fuel.mainnet,
48494
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
48495
+ assetId: "0x78d4522ec607f6e8efb66ea49439d1ee48623cf763f9688a8eada025def033d9",
48496
+ decimals: 18
48497
+ }
48498
+ ]
48499
+ },
48500
+ {
48501
+ name: "wstETH",
48502
+ symbol: "wstETH",
48503
+ icon: "wsteth.svg",
48504
+ networks: [
48505
+ {
48506
+ type: "ethereum",
48507
+ chainId: CHAIN_IDS.eth.mainnet,
48508
+ address: "0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0",
48509
+ decimals: 18
48510
+ },
48511
+ {
48512
+ type: "ethereum",
48513
+ chainId: CHAIN_IDS.eth.sepolia,
48514
+ address: "0xB82381A3fBD3FaFA77B3a7bE693342618240067b",
48515
+ decimals: 18
48516
+ },
48517
+ {
48518
+ type: "fuel",
48519
+ chainId: CHAIN_IDS.fuel.mainnet,
48520
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
48521
+ assetId: "0x1a7815cc9f75db5c24a5b0814bfb706bb9fe485333e98254015de8f48f84c67b",
48522
+ decimals: 18
48523
+ },
48524
+ {
48525
+ type: "fuel",
48526
+ chainId: CHAIN_IDS.fuel.testnet,
48527
+ contractId: "0xC6387efAD0F184a90B34f397C3d6Fd63135ef790",
48528
+ assetId: "0x4c467e3fd4f32179e1aad3b92ebbdaa6ff6aeda5b8da5f8e64e96405eb52a7f5",
48529
+ decimals: 18
48530
+ }
48531
+ ]
48532
+ },
48533
+ {
48534
+ name: "ezETH",
48535
+ symbol: "ezETH",
48536
+ icon: "ezeth.webp",
48537
+ networks: [
48538
+ {
48539
+ type: "ethereum",
48540
+ chainId: CHAIN_IDS.eth.mainnet,
48541
+ address: "0xbf5495Efe5DB9ce00f80364C8B423567e58d2110",
48542
+ decimals: 18
48543
+ },
48544
+ {
48545
+ type: "fuel",
48546
+ chainId: CHAIN_IDS.fuel.mainnet,
48547
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
48548
+ assetId: "0x91b3559edb2619cde8ffb2aa7b3c3be97efd794ea46700db7092abeee62281b0",
48549
+ decimals: 18
48550
+ }
48551
+ ]
48552
+ },
48553
+ {
48554
+ name: "pzETH",
48555
+ symbol: "pzETH",
48556
+ icon: "pzETH.webp",
48557
+ networks: [
48558
+ {
48559
+ type: "ethereum",
48560
+ chainId: CHAIN_IDS.eth.mainnet,
48561
+ address: "0x8c9532a60e0e7c6bbd2b2c1303f63ace1c3e9811",
48562
+ decimals: 18
48563
+ },
48564
+ {
48565
+ type: "fuel",
48566
+ chainId: CHAIN_IDS.fuel.mainnet,
48567
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
48568
+ assetId: "0x1493d4ec82124de8f9b625682de69dcccda79e882b89a55a8c737b12de67bd68",
48569
+ decimals: 18
48570
+ }
48571
+ ]
48572
+ },
48573
+ {
48574
+ name: "Re7LRT",
48575
+ symbol: "Re7LRT",
48576
+ icon: "Re7LRT.png",
48577
+ networks: [
48578
+ {
48579
+ type: "ethereum",
48580
+ chainId: CHAIN_IDS.eth.mainnet,
48581
+ address: "0x84631c0d0081FDe56DeB72F6DE77abBbF6A9f93a",
48582
+ decimals: 18
48583
+ },
48584
+ {
48585
+ type: "fuel",
48586
+ chainId: CHAIN_IDS.fuel.mainnet,
48587
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
48588
+ assetId: "0xf2fc648c23a5db24610a1cf696acc4f0f6d9a7d6028dd9944964ab23f6e35995",
48589
+ decimals: 18
48590
+ }
48591
+ ]
48592
+ },
48593
+ {
48594
+ name: "steakLRT",
48595
+ symbol: "steakLRT",
48596
+ icon: "steakLRT.png",
48597
+ networks: [
48598
+ {
48599
+ type: "ethereum",
48600
+ chainId: CHAIN_IDS.eth.mainnet,
48601
+ address: "0xBEEF69Ac7870777598A04B2bd4771c71212E6aBc",
48602
+ decimals: 18
48603
+ },
48604
+ {
48605
+ type: "fuel",
48606
+ chainId: CHAIN_IDS.fuel.mainnet,
48607
+ contractId: "0x4ea6ccef1215d9479f1024dff70fc055ca538215d2c8c348beddffd54583d0e8",
48608
+ assetId: "0x4fc8ac9f101df07e2c2dec4a53c8c42c439bdbe5e36ea2d863a61ff60afafc30",
48609
+ decimals: 18
47956
48610
  }
47957
48611
  ]
47958
48612
  }
@@ -47967,7 +48621,7 @@ Supported fuel-core version: ${supportedVersion}.`
47967
48621
  static random(count = 1) {
47968
48622
  const assetIds = [];
47969
48623
  for (let i = 0; i < count; i++) {
47970
- assetIds.push(new _TestAssetId(hexlify(randomBytes2(32))));
48624
+ assetIds.push(new _TestAssetId(hexlify(randomBytes22(32))));
47971
48625
  }
47972
48626
  return assetIds;
47973
48627
  }
@@ -48510,7 +49164,7 @@ Supported fuel-core version: ${supportedVersion}.`
48510
49164
  */
48511
49165
  generateFakeResources(coins) {
48512
49166
  return coins.map((coin) => ({
48513
- id: hexlify(randomBytes2(UTXO_ID_LEN)),
49167
+ id: hexlify(randomBytes22(UTXO_ID_LEN)),
48514
49168
  owner: this.address,
48515
49169
  blockCreated: bn(1),
48516
49170
  txCreatedIdx: bn(1),
@@ -48582,7 +49236,7 @@ Supported fuel-core version: ${supportedVersion}.`
48582
49236
  async function encryptKeystoreWallet(privateKey, address, password) {
48583
49237
  const privateKeyBuffer = bufferFromString2(removeHexPrefix(privateKey), "hex");
48584
49238
  const ownerAddress = Address.fromAddressOrString(address);
48585
- const salt = randomBytes2(DEFAULT_KEY_SIZE);
49239
+ const salt = randomBytes22(DEFAULT_KEY_SIZE);
48586
49240
  const key = scrypt22({
48587
49241
  password: bufferFromString2(password),
48588
49242
  salt,
@@ -48591,7 +49245,7 @@ Supported fuel-core version: ${supportedVersion}.`
48591
49245
  r: DEFAULT_KDF_PARAMS_R,
48592
49246
  p: DEFAULT_KDF_PARAMS_P
48593
49247
  });
48594
- const iv = randomBytes2(DEFAULT_IV_SIZE);
49248
+ const iv = randomBytes22(DEFAULT_IV_SIZE);
48595
49249
  const ciphertext = await encryptJsonWalletData2(privateKeyBuffer, key, iv);
48596
49250
  const data = Uint8Array.from([...key.subarray(16, 32), ...ciphertext]);
48597
49251
  const macHashUint8Array = keccak2562(data);
@@ -51086,7 +51740,7 @@ Supported fuel-core version: ${supportedVersion}.`
51086
51740
  * @returns A randomly generated mnemonic
51087
51741
  */
51088
51742
  static generate(size = 32, extraEntropy = "") {
51089
- const entropy = extraEntropy ? sha2562(concat([randomBytes2(size), arrayify(extraEntropy)])) : randomBytes2(size);
51743
+ const entropy = extraEntropy ? sha2562(concat([randomBytes22(size), arrayify(extraEntropy)])) : randomBytes22(size);
51090
51744
  return Mnemonic.entropyToMnemonic(entropy);
51091
51745
  }
51092
51746
  };
@@ -51187,9 +51841,9 @@ Supported fuel-core version: ${supportedVersion}.`
51187
51841
  data.set(arrayify(this.publicKey));
51188
51842
  }
51189
51843
  data.set(toBytes(index, 4), 33);
51190
- const bytes3 = arrayify(computeHmac2("sha512", chainCode, data));
51191
- const IL = bytes3.slice(0, 32);
51192
- const IR = bytes3.slice(32);
51844
+ const bytes2 = arrayify(computeHmac2("sha512", chainCode, data));
51845
+ const IL = bytes2.slice(0, 32);
51846
+ const IR = bytes2.slice(32);
51193
51847
  if (privateKey) {
51194
51848
  const N = "0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141";
51195
51849
  const ki = bn(IL).add(privateKey).mod(N).toBytes(32);
@@ -51259,26 +51913,26 @@ Supported fuel-core version: ${supportedVersion}.`
51259
51913
  }
51260
51914
  static fromExtendedKey(extendedKey) {
51261
51915
  const decoded = hexlify(toBytes(decodeBase58(extendedKey)));
51262
- const bytes3 = arrayify(decoded);
51263
- const validChecksum = base58check(bytes3.slice(0, 78)) === extendedKey;
51264
- if (bytes3.length !== 82 || !isValidExtendedKey(bytes3)) {
51916
+ const bytes2 = arrayify(decoded);
51917
+ const validChecksum = base58check(bytes2.slice(0, 78)) === extendedKey;
51918
+ if (bytes2.length !== 82 || !isValidExtendedKey(bytes2)) {
51265
51919
  throw new FuelError(ErrorCode.HD_WALLET_ERROR, "Provided key is not a valid extended key.");
51266
51920
  }
51267
51921
  if (!validChecksum) {
51268
51922
  throw new FuelError(ErrorCode.HD_WALLET_ERROR, "Provided key has an invalid checksum.");
51269
51923
  }
51270
- const depth = bytes3[4];
51271
- const parentFingerprint = hexlify(bytes3.slice(5, 9));
51272
- const index = parseInt(hexlify(bytes3.slice(9, 13)).substring(2), 16);
51273
- const chainCode = hexlify(bytes3.slice(13, 45));
51274
- const key = bytes3.slice(45, 78);
51924
+ const depth = bytes2[4];
51925
+ const parentFingerprint = hexlify(bytes2.slice(5, 9));
51926
+ const index = parseInt(hexlify(bytes2.slice(9, 13)).substring(2), 16);
51927
+ const chainCode = hexlify(bytes2.slice(13, 45));
51928
+ const key = bytes2.slice(45, 78);
51275
51929
  if (depth === 0 && parentFingerprint !== "0x00000000" || depth === 0 && index !== 0) {
51276
51930
  throw new FuelError(
51277
51931
  ErrorCode.HD_WALLET_ERROR,
51278
51932
  "Inconsistency detected: Depth is zero but fingerprint/index is non-zero."
51279
51933
  );
51280
51934
  }
51281
- if (isPublicExtendedKey(bytes3)) {
51935
+ if (isPublicExtendedKey(bytes2)) {
51282
51936
  if (key[0] !== 3) {
51283
51937
  throw new FuelError(ErrorCode.HD_WALLET_ERROR, "Invalid public extended key.");
51284
51938
  }
@@ -51464,7 +52118,7 @@ Supported fuel-core version: ${supportedVersion}.`
51464
52118
  generateWallets = () => {
51465
52119
  const generatedWallets = [];
51466
52120
  for (let index = 1; index <= this.options.count; index++) {
51467
- generatedWallets.push(new WalletUnlocked(randomBytes2(32)));
52121
+ generatedWallets.push(new WalletUnlocked(randomBytes22(32)));
51468
52122
  }
51469
52123
  return generatedWallets;
51470
52124
  };
@@ -51521,7 +52175,7 @@ Supported fuel-core version: ${supportedVersion}.`
51521
52175
  tx_pointer_block_height: 0,
51522
52176
  tx_pointer_tx_idx: 0,
51523
52177
  output_index: 0,
51524
- tx_id: hexlify(randomBytes2(32))
52178
+ tx_id: hexlify(randomBytes22(32))
51525
52179
  });
51526
52180
  }
51527
52181
  });
@@ -51641,7 +52295,7 @@ Supported fuel-core version: ${supportedVersion}.`
51641
52295
  constructor({
51642
52296
  sender = Address.fromRandom(),
51643
52297
  recipient = Address.fromRandom(),
51644
- nonce = hexlify(randomBytes2(32)),
52298
+ nonce = hexlify(randomBytes22(32)),
51645
52299
  amount = 1e6,
51646
52300
  data = "",
51647
52301
  // Will default to empty data in order to be a spendable message
@@ -51688,9 +52342,6 @@ mime-types/index.js:
51688
52342
  @noble/hashes/esm/utils.js:
51689
52343
  (*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
51690
52344
 
51691
- @noble/hashes/esm/utils.js:
51692
- (*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
51693
-
51694
52345
  @noble/curves/esm/abstract/utils.js:
51695
52346
  (*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
51696
52347