@fuel-ts/account 0.0.0-rc-2152-20240429145747 → 0.0.0-rc-2037-20240430003658

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of @fuel-ts/account might be problematic. Click here for more details.

Files changed (36) hide show
  1. package/README.md +15 -12
  2. package/dist/index.global.js +1097 -126
  3. package/dist/index.global.js.map +1 -1
  4. package/dist/index.js +241 -128
  5. package/dist/index.js.map +1 -1
  6. package/dist/index.mjs +146 -39
  7. package/dist/index.mjs.map +1 -1
  8. package/dist/predicate/predicate.d.ts +9 -2
  9. package/dist/predicate/predicate.d.ts.map +1 -1
  10. package/dist/providers/__generated__/operations.d.ts +17 -0
  11. package/dist/providers/__generated__/operations.d.ts.map +1 -1
  12. package/dist/providers/provider.d.ts +17 -1
  13. package/dist/providers/provider.d.ts.map +1 -1
  14. package/dist/providers/transaction-request/helpers.d.ts +10 -0
  15. package/dist/providers/transaction-request/helpers.d.ts.map +1 -0
  16. package/dist/providers/transaction-request/index.d.ts +1 -0
  17. package/dist/providers/transaction-request/index.d.ts.map +1 -1
  18. package/dist/providers/transaction-request/transaction-request.d.ts +2 -0
  19. package/dist/providers/transaction-request/transaction-request.d.ts.map +1 -1
  20. package/dist/test-utils/index.d.ts +1 -0
  21. package/dist/test-utils/index.d.ts.map +1 -1
  22. package/dist/test-utils/resources.d.ts +4 -0
  23. package/dist/test-utils/resources.d.ts.map +1 -0
  24. package/dist/test-utils/seedTestWallet.d.ts +1 -1
  25. package/dist/test-utils/seedTestWallet.d.ts.map +1 -1
  26. package/dist/test-utils/transactionRequest.d.ts +5 -0
  27. package/dist/test-utils/transactionRequest.d.ts.map +1 -0
  28. package/dist/test-utils.global.js +1104 -136
  29. package/dist/test-utils.global.js.map +1 -1
  30. package/dist/test-utils.js +228 -125
  31. package/dist/test-utils.js.map +1 -1
  32. package/dist/test-utils.mjs +142 -42
  33. package/dist/test-utils.mjs.map +1 -1
  34. package/dist/wallet/base-wallet-unlocked.d.ts +2 -2
  35. package/dist/wallet/base-wallet-unlocked.d.ts.map +1 -1
  36. package/package.json +15 -15
@@ -182,13 +182,13 @@
182
182
  if (str !== lowered && str !== uppered)
183
183
  return "Mixed-case string " + str;
184
184
  str = lowered;
185
- const split2 = str.lastIndexOf("1");
186
- if (split2 === -1)
185
+ const split3 = str.lastIndexOf("1");
186
+ if (split3 === -1)
187
187
  return "No separator character for " + str;
188
- if (split2 === 0)
188
+ if (split3 === 0)
189
189
  return "Missing prefix for " + str;
190
- const prefix = str.slice(0, split2);
191
- const wordChars = str.slice(split2 + 1);
190
+ const prefix = str.slice(0, split3);
191
+ const wordChars = str.slice(split3 + 1);
192
192
  if (wordChars.length < 6)
193
193
  return "Data too short";
194
194
  let chk = prefixChk(prefix);
@@ -1089,7 +1089,7 @@
1089
1089
  }
1090
1090
  return this;
1091
1091
  };
1092
- BN2.prototype.add = function add(num) {
1092
+ BN2.prototype.add = function add2(num) {
1093
1093
  var res;
1094
1094
  if (num.negative !== 0 && this.negative === 0) {
1095
1095
  num.negative = 0;
@@ -2803,7 +2803,7 @@
2803
2803
  }
2804
2804
  return r;
2805
2805
  };
2806
- MPrime.prototype.split = function split2(input, out) {
2806
+ MPrime.prototype.split = function split3(input, out) {
2807
2807
  input.iushrn(this.n, 0, out);
2808
2808
  };
2809
2809
  MPrime.prototype.imulK = function imulK(num) {
@@ -2817,7 +2817,7 @@
2817
2817
  );
2818
2818
  }
2819
2819
  inherits(K256, MPrime);
2820
- K256.prototype.split = function split2(input, output3) {
2820
+ K256.prototype.split = function split3(input, output3) {
2821
2821
  var mask2 = 4194303;
2822
2822
  var outLen = Math.min(input.length, 9);
2823
2823
  for (var i = 0; i < outLen; i++) {
@@ -2953,7 +2953,7 @@
2953
2953
  }
2954
2954
  return this.m.sub(a)._forceRed(this);
2955
2955
  };
2956
- Red.prototype.add = function add(a, b) {
2956
+ Red.prototype.add = function add2(a, b) {
2957
2957
  this._verify2(a, b);
2958
2958
  var res = a.add(b);
2959
2959
  if (res.cmp(this.m) >= 0) {
@@ -20417,7 +20417,7 @@ spurious results.`);
20417
20417
  }
20418
20418
  return instance.ptr;
20419
20419
  }
20420
- function add(dst, lhs, rhs) {
20420
+ function add2(dst, lhs, rhs) {
20421
20421
  const ret3 = wasm$1.add(dst, lhs, rhs);
20422
20422
  return Instruction.__wrap(ret3);
20423
20423
  }
@@ -27996,7 +27996,7 @@ spurious results.`);
27996
27996
  exports.WQOP = WQOP;
27997
27997
  exports.XOR = XOR;
27998
27998
  exports.XORI = XORI;
27999
- exports.add = add;
27999
+ exports.add = add2;
28000
28000
  exports.addi = addi2;
28001
28001
  exports.aloc = aloc;
28002
28002
  exports.and = and;
@@ -28236,9 +28236,9 @@ spurious results.`);
28236
28236
  function setBigUint64(view, byteOffset, value, isLE3) {
28237
28237
  if (typeof view.setBigUint64 === "function")
28238
28238
  return view.setBigUint64(byteOffset, value, isLE3);
28239
- const _32n2 = BigInt(32);
28239
+ const _32n3 = BigInt(32);
28240
28240
  const _u32_max = BigInt(4294967295);
28241
- const wh = Number(value >> _32n2 & _u32_max);
28241
+ const wh = Number(value >> _32n3 & _u32_max);
28242
28242
  const wl = Number(value & _u32_max);
28243
28243
  const h = isLE3 ? 4 : 0;
28244
28244
  const l = isLE3 ? 0 : 4;
@@ -29249,7 +29249,7 @@ This unreleased fuel-core build may include features and updates not yet support
29249
29249
  }
29250
29250
 
29251
29251
  // ../crypto/dist/index.mjs
29252
- var import_crypto7 = __toESM(__require("crypto"), 1);
29252
+ var import_crypto8 = __toESM(__require("crypto"), 1);
29253
29253
 
29254
29254
  // ../../node_modules/.pnpm/ethers@6.7.1/node_modules/ethers/lib.esm/_version.js
29255
29255
  var version = "6.7.1";
@@ -29416,6 +29416,18 @@ This unreleased fuel-core build may include features and updates not yet support
29416
29416
  function getBytes(value, name) {
29417
29417
  return _getBytes(value, name, false);
29418
29418
  }
29419
+ function isHexString(value, length) {
29420
+ if (typeof value !== "string" || !value.match(/^0x[0-9A-Fa-f]*$/)) {
29421
+ return false;
29422
+ }
29423
+ if (typeof length === "number" && value.length !== 2 + 2 * length) {
29424
+ return false;
29425
+ }
29426
+ if (length === true && value.length % 2 !== 0) {
29427
+ return false;
29428
+ }
29429
+ return true;
29430
+ }
29419
29431
  var HexCharacters2 = "0123456789abcdef";
29420
29432
  function hexlify2(data) {
29421
29433
  const bytes3 = getBytes(data);
@@ -29776,7 +29788,74 @@ This unreleased fuel-core build may include features and updates not yet support
29776
29788
  };
29777
29789
  var assert_default = assert2;
29778
29790
 
29791
+ // ../../node_modules/.pnpm/@noble+hashes@1.1.2/node_modules/@noble/hashes/esm/_u64.js
29792
+ var U32_MASK642 = BigInt(2 ** 32 - 1);
29793
+ var _32n2 = BigInt(32);
29794
+ function fromBig2(n, le = false) {
29795
+ if (le)
29796
+ return { h: Number(n & U32_MASK642), l: Number(n >> _32n2 & U32_MASK642) };
29797
+ return { h: Number(n >> _32n2 & U32_MASK642) | 0, l: Number(n & U32_MASK642) | 0 };
29798
+ }
29799
+ function split2(lst, le = false) {
29800
+ let Ah = new Uint32Array(lst.length);
29801
+ let Al = new Uint32Array(lst.length);
29802
+ for (let i = 0; i < lst.length; i++) {
29803
+ const { h, l } = fromBig2(lst[i], le);
29804
+ [Ah[i], Al[i]] = [h, l];
29805
+ }
29806
+ return [Ah, Al];
29807
+ }
29808
+ var toBig = (h, l) => BigInt(h >>> 0) << _32n2 | BigInt(l >>> 0);
29809
+ var shrSH = (h, l, s) => h >>> s;
29810
+ var shrSL = (h, l, s) => h << 32 - s | l >>> s;
29811
+ var rotrSH = (h, l, s) => h >>> s | l << 32 - s;
29812
+ var rotrSL = (h, l, s) => h << 32 - s | l >>> s;
29813
+ var rotrBH = (h, l, s) => h << 64 - s | l >>> s - 32;
29814
+ var rotrBL = (h, l, s) => h >>> s - 32 | l << 64 - s;
29815
+ var rotr32H = (h, l) => l;
29816
+ var rotr32L = (h, l) => h;
29817
+ var rotlSH2 = (h, l, s) => h << s | l >>> 32 - s;
29818
+ var rotlSL2 = (h, l, s) => l << s | h >>> 32 - s;
29819
+ var rotlBH2 = (h, l, s) => l << s - 32 | h >>> 64 - s;
29820
+ var rotlBL2 = (h, l, s) => h << s - 32 | l >>> 64 - s;
29821
+ function add(Ah, Al, Bh, Bl) {
29822
+ const l = (Al >>> 0) + (Bl >>> 0);
29823
+ return { h: Ah + Bh + (l / 2 ** 32 | 0) | 0, l: l | 0 };
29824
+ }
29825
+ var add3L = (Al, Bl, Cl) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0);
29826
+ var add3H = (low, Ah, Bh, Ch) => Ah + Bh + Ch + (low / 2 ** 32 | 0) | 0;
29827
+ var add4L = (Al, Bl, Cl, Dl) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0);
29828
+ var add4H = (low, Ah, Bh, Ch, Dh) => Ah + Bh + Ch + Dh + (low / 2 ** 32 | 0) | 0;
29829
+ var add5L = (Al, Bl, Cl, Dl, El) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0) + (El >>> 0);
29830
+ var add5H = (low, Ah, Bh, Ch, Dh, Eh) => Ah + Bh + Ch + Dh + Eh + (low / 2 ** 32 | 0) | 0;
29831
+ var u64 = {
29832
+ fromBig: fromBig2,
29833
+ split: split2,
29834
+ toBig,
29835
+ shrSH,
29836
+ shrSL,
29837
+ rotrSH,
29838
+ rotrSL,
29839
+ rotrBH,
29840
+ rotrBL,
29841
+ rotr32H,
29842
+ rotr32L,
29843
+ rotlSH: rotlSH2,
29844
+ rotlSL: rotlSL2,
29845
+ rotlBH: rotlBH2,
29846
+ rotlBL: rotlBL2,
29847
+ add,
29848
+ add3L,
29849
+ add3H,
29850
+ add4L,
29851
+ add4H,
29852
+ add5H,
29853
+ add5L
29854
+ };
29855
+ var u64_default = u64;
29856
+
29779
29857
  // ../../node_modules/.pnpm/@noble+hashes@1.1.2/node_modules/@noble/hashes/esm/utils.js
29858
+ var u322 = (arr) => new Uint32Array(arr.buffer, arr.byteOffset, Math.floor(arr.byteLength / 4));
29780
29859
  var createView2 = (arr) => new DataView(arr.buffer, arr.byteOffset, arr.byteLength);
29781
29860
  var isLE2 = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68;
29782
29861
  if (!isLE2)
@@ -29809,14 +29888,224 @@ This unreleased fuel-core build may include features and updates not yet support
29809
29888
  hashC.create = () => hashConstructor();
29810
29889
  return hashC;
29811
29890
  }
29891
+ function wrapConstructorWithOpts(hashCons) {
29892
+ const hashC = (msg, opts) => hashCons(opts).update(toBytes2(msg)).digest();
29893
+ const tmp = hashCons({});
29894
+ hashC.outputLen = tmp.outputLen;
29895
+ hashC.blockLen = tmp.blockLen;
29896
+ hashC.create = (opts) => hashCons(opts);
29897
+ return hashC;
29898
+ }
29899
+
29900
+ // ../../node_modules/.pnpm/@noble+hashes@1.1.2/node_modules/@noble/hashes/esm/sha3.js
29901
+ var [SHA3_PI2, SHA3_ROTL2, _SHA3_IOTA2] = [[], [], []];
29902
+ var _0n2 = BigInt(0);
29903
+ var _1n2 = BigInt(1);
29904
+ var _2n2 = BigInt(2);
29905
+ var _7n2 = BigInt(7);
29906
+ var _256n2 = BigInt(256);
29907
+ var _0x71n2 = BigInt(113);
29908
+ for (let round = 0, R = _1n2, x = 1, y = 0; round < 24; round++) {
29909
+ [x, y] = [y, (2 * x + 3 * y) % 5];
29910
+ SHA3_PI2.push(2 * (5 * y + x));
29911
+ SHA3_ROTL2.push((round + 1) * (round + 2) / 2 % 64);
29912
+ let t = _0n2;
29913
+ for (let j = 0; j < 7; j++) {
29914
+ R = (R << _1n2 ^ (R >> _7n2) * _0x71n2) % _256n2;
29915
+ if (R & _2n2)
29916
+ t ^= _1n2 << (_1n2 << BigInt(j)) - _1n2;
29917
+ }
29918
+ _SHA3_IOTA2.push(t);
29919
+ }
29920
+ var [SHA3_IOTA_H2, SHA3_IOTA_L2] = u64_default.split(_SHA3_IOTA2, true);
29921
+ var rotlH2 = (h, l, s) => s > 32 ? u64_default.rotlBH(h, l, s) : u64_default.rotlSH(h, l, s);
29922
+ var rotlL2 = (h, l, s) => s > 32 ? u64_default.rotlBL(h, l, s) : u64_default.rotlSL(h, l, s);
29923
+ function keccakP2(s, rounds = 24) {
29924
+ const B = new Uint32Array(5 * 2);
29925
+ for (let round = 24 - rounds; round < 24; round++) {
29926
+ for (let x = 0; x < 10; x++)
29927
+ B[x] = s[x] ^ s[x + 10] ^ s[x + 20] ^ s[x + 30] ^ s[x + 40];
29928
+ for (let x = 0; x < 10; x += 2) {
29929
+ const idx1 = (x + 8) % 10;
29930
+ const idx0 = (x + 2) % 10;
29931
+ const B0 = B[idx0];
29932
+ const B1 = B[idx0 + 1];
29933
+ const Th = rotlH2(B0, B1, 1) ^ B[idx1];
29934
+ const Tl = rotlL2(B0, B1, 1) ^ B[idx1 + 1];
29935
+ for (let y = 0; y < 50; y += 10) {
29936
+ s[x + y] ^= Th;
29937
+ s[x + y + 1] ^= Tl;
29938
+ }
29939
+ }
29940
+ let curH = s[2];
29941
+ let curL = s[3];
29942
+ for (let t = 0; t < 24; t++) {
29943
+ const shift = SHA3_ROTL2[t];
29944
+ const Th = rotlH2(curH, curL, shift);
29945
+ const Tl = rotlL2(curH, curL, shift);
29946
+ const PI = SHA3_PI2[t];
29947
+ curH = s[PI];
29948
+ curL = s[PI + 1];
29949
+ s[PI] = Th;
29950
+ s[PI + 1] = Tl;
29951
+ }
29952
+ for (let y = 0; y < 50; y += 10) {
29953
+ for (let x = 0; x < 10; x++)
29954
+ B[x] = s[y + x];
29955
+ for (let x = 0; x < 10; x++)
29956
+ s[y + x] ^= ~B[(x + 2) % 10] & B[(x + 4) % 10];
29957
+ }
29958
+ s[0] ^= SHA3_IOTA_H2[round];
29959
+ s[1] ^= SHA3_IOTA_L2[round];
29960
+ }
29961
+ B.fill(0);
29962
+ }
29963
+ var Keccak2 = class extends Hash2 {
29964
+ // NOTE: we accept arguments in bytes instead of bits here.
29965
+ constructor(blockLen, suffix, outputLen, enableXOF = false, rounds = 24) {
29966
+ super();
29967
+ this.blockLen = blockLen;
29968
+ this.suffix = suffix;
29969
+ this.outputLen = outputLen;
29970
+ this.enableXOF = enableXOF;
29971
+ this.rounds = rounds;
29972
+ this.pos = 0;
29973
+ this.posOut = 0;
29974
+ this.finished = false;
29975
+ this.destroyed = false;
29976
+ assert_default.number(outputLen);
29977
+ if (0 >= this.blockLen || this.blockLen >= 200)
29978
+ throw new Error("Sha3 supports only keccak-f1600 function");
29979
+ this.state = new Uint8Array(200);
29980
+ this.state32 = u322(this.state);
29981
+ }
29982
+ keccak() {
29983
+ keccakP2(this.state32, this.rounds);
29984
+ this.posOut = 0;
29985
+ this.pos = 0;
29986
+ }
29987
+ update(data) {
29988
+ assert_default.exists(this);
29989
+ const { blockLen, state } = this;
29990
+ data = toBytes2(data);
29991
+ const len = data.length;
29992
+ for (let pos = 0; pos < len; ) {
29993
+ const take = Math.min(blockLen - this.pos, len - pos);
29994
+ for (let i = 0; i < take; i++)
29995
+ state[this.pos++] ^= data[pos++];
29996
+ if (this.pos === blockLen)
29997
+ this.keccak();
29998
+ }
29999
+ return this;
30000
+ }
30001
+ finish() {
30002
+ if (this.finished)
30003
+ return;
30004
+ this.finished = true;
30005
+ const { state, suffix, pos, blockLen } = this;
30006
+ state[pos] ^= suffix;
30007
+ if ((suffix & 128) !== 0 && pos === blockLen - 1)
30008
+ this.keccak();
30009
+ state[blockLen - 1] ^= 128;
30010
+ this.keccak();
30011
+ }
30012
+ writeInto(out) {
30013
+ assert_default.exists(this, false);
30014
+ assert_default.bytes(out);
30015
+ this.finish();
30016
+ const bufferOut = this.state;
30017
+ const { blockLen } = this;
30018
+ for (let pos = 0, len = out.length; pos < len; ) {
30019
+ if (this.posOut >= blockLen)
30020
+ this.keccak();
30021
+ const take = Math.min(blockLen - this.posOut, len - pos);
30022
+ out.set(bufferOut.subarray(this.posOut, this.posOut + take), pos);
30023
+ this.posOut += take;
30024
+ pos += take;
30025
+ }
30026
+ return out;
30027
+ }
30028
+ xofInto(out) {
30029
+ if (!this.enableXOF)
30030
+ throw new Error("XOF is not possible for this instance");
30031
+ return this.writeInto(out);
30032
+ }
30033
+ xof(bytes3) {
30034
+ assert_default.number(bytes3);
30035
+ return this.xofInto(new Uint8Array(bytes3));
30036
+ }
30037
+ digestInto(out) {
30038
+ assert_default.output(out, this);
30039
+ if (this.finished)
30040
+ throw new Error("digest() was already called");
30041
+ this.writeInto(out);
30042
+ this.destroy();
30043
+ return out;
30044
+ }
30045
+ digest() {
30046
+ return this.digestInto(new Uint8Array(this.outputLen));
30047
+ }
30048
+ destroy() {
30049
+ this.destroyed = true;
30050
+ this.state.fill(0);
30051
+ }
30052
+ _cloneInto(to) {
30053
+ const { blockLen, suffix, outputLen, rounds, enableXOF } = this;
30054
+ to || (to = new Keccak2(blockLen, suffix, outputLen, enableXOF, rounds));
30055
+ to.state32.set(this.state32);
30056
+ to.pos = this.pos;
30057
+ to.posOut = this.posOut;
30058
+ to.finished = this.finished;
30059
+ to.rounds = rounds;
30060
+ to.suffix = suffix;
30061
+ to.outputLen = outputLen;
30062
+ to.enableXOF = enableXOF;
30063
+ to.destroyed = this.destroyed;
30064
+ return to;
30065
+ }
30066
+ };
30067
+ var gen2 = (suffix, blockLen, outputLen) => wrapConstructor2(() => new Keccak2(blockLen, suffix, outputLen));
30068
+ var sha3_2242 = gen2(6, 144, 224 / 8);
30069
+ var sha3_2562 = gen2(6, 136, 256 / 8);
30070
+ var sha3_3842 = gen2(6, 104, 384 / 8);
30071
+ var sha3_5122 = gen2(6, 72, 512 / 8);
30072
+ var keccak_2242 = gen2(1, 144, 224 / 8);
30073
+ var keccak_2562 = gen2(1, 136, 256 / 8);
30074
+ var keccak_3842 = gen2(1, 104, 384 / 8);
30075
+ var keccak_5122 = gen2(1, 72, 512 / 8);
30076
+ var genShake2 = (suffix, blockLen, outputLen) => wrapConstructorWithOpts((opts = {}) => new Keccak2(blockLen, suffix, opts.dkLen === void 0 ? outputLen : opts.dkLen, true));
30077
+ var shake1282 = genShake2(31, 168, 128 / 8);
30078
+ var shake2562 = genShake2(31, 136, 256 / 8);
30079
+
30080
+ // ../../node_modules/.pnpm/ethers@6.7.1/node_modules/ethers/lib.esm/crypto/keccak.js
30081
+ var locked2 = false;
30082
+ var _keccak256 = function(data) {
30083
+ return keccak_2562(data);
30084
+ };
30085
+ var __keccak256 = _keccak256;
30086
+ function keccak256(_data) {
30087
+ const data = getBytes(_data, "data");
30088
+ return hexlify2(__keccak256(data));
30089
+ }
30090
+ keccak256._ = _keccak256;
30091
+ keccak256.lock = function() {
30092
+ locked2 = true;
30093
+ };
30094
+ keccak256.register = function(func) {
30095
+ if (locked2) {
30096
+ throw new TypeError("keccak256 is locked");
30097
+ }
30098
+ __keccak256 = func;
30099
+ };
30100
+ Object.freeze(keccak256);
29812
30101
 
29813
30102
  // ../../node_modules/.pnpm/@noble+hashes@1.1.2/node_modules/@noble/hashes/esm/_sha2.js
29814
30103
  function setBigUint642(view, byteOffset, value, isLE3) {
29815
30104
  if (typeof view.setBigUint64 === "function")
29816
30105
  return view.setBigUint64(byteOffset, value, isLE3);
29817
- const _32n2 = BigInt(32);
30106
+ const _32n3 = BigInt(32);
29818
30107
  const _u32_max = BigInt(4294967295);
29819
- const wh = Number(value >> _32n2 & _u32_max);
30108
+ const wh = Number(value >> _32n3 & _u32_max);
29820
30109
  const wl = Number(value & _u32_max);
29821
30110
  const h = isLE3 ? 4 : 0;
29822
30111
  const l = isLE3 ? 0 : 4;
@@ -29988,7 +30277,7 @@ This unreleased fuel-core build may include features and updates not yet support
29988
30277
  var ripemd160 = wrapConstructor2(() => new RIPEMD160());
29989
30278
 
29990
30279
  // ../../node_modules/.pnpm/ethers@6.7.1/node_modules/ethers/lib.esm/crypto/ripemd160.js
29991
- var locked2 = false;
30280
+ var locked3 = false;
29992
30281
  var _ripemd160 = function(data) {
29993
30282
  return ripemd160(data);
29994
30283
  };
@@ -29999,10 +30288,10 @@ This unreleased fuel-core build may include features and updates not yet support
29999
30288
  }
30000
30289
  ripemd1602._ = _ripemd160;
30001
30290
  ripemd1602.lock = function() {
30002
- locked2 = true;
30291
+ locked3 = true;
30003
30292
  };
30004
30293
  ripemd1602.register = function(func) {
30005
- if (locked2) {
30294
+ if (locked3) {
30006
30295
  throw new TypeError("ripemd160 is locked");
30007
30296
  }
30008
30297
  __ripemd160 = func;
@@ -30010,7 +30299,7 @@ This unreleased fuel-core build may include features and updates not yet support
30010
30299
  Object.freeze(ripemd1602);
30011
30300
 
30012
30301
  // ../../node_modules/.pnpm/ethers@6.7.1/node_modules/ethers/lib.esm/crypto/pbkdf2.js
30013
- var locked3 = false;
30302
+ var locked4 = false;
30014
30303
  var _pbkdf2 = function(password, salt, iterations, keylen, algo) {
30015
30304
  return (0, import_crypto2.pbkdf2Sync)(password, salt, iterations, keylen, algo);
30016
30305
  };
@@ -30022,19 +30311,602 @@ This unreleased fuel-core build may include features and updates not yet support
30022
30311
  }
30023
30312
  pbkdf22._ = _pbkdf2;
30024
30313
  pbkdf22.lock = function() {
30025
- locked3 = true;
30314
+ locked4 = true;
30026
30315
  };
30027
30316
  pbkdf22.register = function(func) {
30028
- if (locked3) {
30317
+ if (locked4) {
30029
30318
  throw new Error("pbkdf2 is locked");
30030
30319
  }
30031
30320
  __pbkdf2 = func;
30032
30321
  };
30033
30322
  Object.freeze(pbkdf22);
30034
30323
 
30324
+ // ../../node_modules/.pnpm/ethers@6.7.1/node_modules/ethers/lib.esm/address/address.js
30325
+ var BN_03 = BigInt(0);
30326
+ var BN_36 = BigInt(36);
30327
+ function getChecksumAddress(address) {
30328
+ address = address.toLowerCase();
30329
+ const chars = address.substring(2).split("");
30330
+ const expanded = new Uint8Array(40);
30331
+ for (let i = 0; i < 40; i++) {
30332
+ expanded[i] = chars[i].charCodeAt(0);
30333
+ }
30334
+ const hashed = getBytes(keccak256(expanded));
30335
+ for (let i = 0; i < 40; i += 2) {
30336
+ if (hashed[i >> 1] >> 4 >= 8) {
30337
+ chars[i] = chars[i].toUpperCase();
30338
+ }
30339
+ if ((hashed[i >> 1] & 15) >= 8) {
30340
+ chars[i + 1] = chars[i + 1].toUpperCase();
30341
+ }
30342
+ }
30343
+ return "0x" + chars.join("");
30344
+ }
30345
+ var ibanLookup = {};
30346
+ for (let i = 0; i < 10; i++) {
30347
+ ibanLookup[String(i)] = String(i);
30348
+ }
30349
+ for (let i = 0; i < 26; i++) {
30350
+ ibanLookup[String.fromCharCode(65 + i)] = String(10 + i);
30351
+ }
30352
+ var safeDigits = 15;
30353
+ function ibanChecksum(address) {
30354
+ address = address.toUpperCase();
30355
+ address = address.substring(4) + address.substring(0, 2) + "00";
30356
+ let expanded = address.split("").map((c) => {
30357
+ return ibanLookup[c];
30358
+ }).join("");
30359
+ while (expanded.length >= safeDigits) {
30360
+ let block2 = expanded.substring(0, safeDigits);
30361
+ expanded = parseInt(block2, 10) % 97 + expanded.substring(block2.length);
30362
+ }
30363
+ let checksum = String(98 - parseInt(expanded, 10) % 97);
30364
+ while (checksum.length < 2) {
30365
+ checksum = "0" + checksum;
30366
+ }
30367
+ return checksum;
30368
+ }
30369
+ var Base36 = function() {
30370
+ ;
30371
+ const result = {};
30372
+ for (let i = 0; i < 36; i++) {
30373
+ const key = "0123456789abcdefghijklmnopqrstuvwxyz"[i];
30374
+ result[key] = BigInt(i);
30375
+ }
30376
+ return result;
30377
+ }();
30378
+ function fromBase36(value) {
30379
+ value = value.toLowerCase();
30380
+ let result = BN_03;
30381
+ for (let i = 0; i < value.length; i++) {
30382
+ result = result * BN_36 + Base36[value[i]];
30383
+ }
30384
+ return result;
30385
+ }
30386
+ function getAddress(address) {
30387
+ assertArgument(typeof address === "string", "invalid address", "address", address);
30388
+ if (address.match(/^(0x)?[0-9a-fA-F]{40}$/)) {
30389
+ if (!address.startsWith("0x")) {
30390
+ address = "0x" + address;
30391
+ }
30392
+ const result = getChecksumAddress(address);
30393
+ assertArgument(!address.match(/([A-F].*[a-f])|([a-f].*[A-F])/) || result === address, "bad address checksum", "address", address);
30394
+ return result;
30395
+ }
30396
+ if (address.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)) {
30397
+ assertArgument(address.substring(2, 4) === ibanChecksum(address), "bad icap checksum", "address", address);
30398
+ let result = fromBase36(address.substring(4)).toString(16);
30399
+ while (result.length < 40) {
30400
+ result = "0" + result;
30401
+ }
30402
+ return getChecksumAddress("0x" + result);
30403
+ }
30404
+ assertArgument(false, "invalid address", "address", address);
30405
+ }
30406
+
30407
+ // ../../node_modules/.pnpm/ethers@6.7.1/node_modules/ethers/lib.esm/transaction/accesslist.js
30408
+ function accessSetify(addr, storageKeys) {
30409
+ return {
30410
+ address: getAddress(addr),
30411
+ storageKeys: storageKeys.map((storageKey, index) => {
30412
+ assertArgument(isHexString(storageKey, 32), "invalid slot", `storageKeys[${index}]`, storageKey);
30413
+ return storageKey.toLowerCase();
30414
+ })
30415
+ };
30416
+ }
30417
+ function accessListify(value) {
30418
+ if (Array.isArray(value)) {
30419
+ return value.map((set, index) => {
30420
+ if (Array.isArray(set)) {
30421
+ assertArgument(set.length === 2, "invalid slot set", `value[${index}]`, set);
30422
+ return accessSetify(set[0], set[1]);
30423
+ }
30424
+ assertArgument(set != null && typeof set === "object", "invalid address-slot set", "value", value);
30425
+ return accessSetify(set.address, set.storageKeys);
30426
+ });
30427
+ }
30428
+ assertArgument(value != null && typeof value === "object", "invalid access list", "value", value);
30429
+ const result = Object.keys(value).map((addr) => {
30430
+ const storageKeys = value[addr].reduce((accum, storageKey) => {
30431
+ accum[storageKey] = true;
30432
+ return accum;
30433
+ }, {});
30434
+ return accessSetify(addr, Object.keys(storageKeys).sort());
30435
+ });
30436
+ result.sort((a, b) => a.address.localeCompare(b.address));
30437
+ return result;
30438
+ }
30439
+
30440
+ // ../../node_modules/.pnpm/ethers@6.7.1/node_modules/ethers/lib.esm/providers/plugins-network.js
30441
+ var EnsAddress = "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e";
30442
+ var NetworkPlugin = class {
30443
+ /**
30444
+ * The name of the plugin.
30445
+ *
30446
+ * It is recommended to use reverse-domain-notation, which permits
30447
+ * unique names with a known authority as well as hierarchal entries.
30448
+ */
30449
+ name;
30450
+ /**
30451
+ * Creates a new **NetworkPlugin**.
30452
+ */
30453
+ constructor(name) {
30454
+ defineProperties(this, { name });
30455
+ }
30456
+ /**
30457
+ * Creates a copy of this plugin.
30458
+ */
30459
+ clone() {
30460
+ return new NetworkPlugin(this.name);
30461
+ }
30462
+ };
30463
+ var GasCostPlugin = class extends NetworkPlugin {
30464
+ /**
30465
+ * The block number to treat these values as valid from.
30466
+ *
30467
+ * This allows a hardfork to have updated values included as well as
30468
+ * mulutiple hardforks to be supported.
30469
+ */
30470
+ effectiveBlock;
30471
+ /**
30472
+ * The transactions base fee.
30473
+ */
30474
+ txBase;
30475
+ /**
30476
+ * The fee for creating a new account.
30477
+ */
30478
+ txCreate;
30479
+ /**
30480
+ * The fee per zero-byte in the data.
30481
+ */
30482
+ txDataZero;
30483
+ /**
30484
+ * The fee per non-zero-byte in the data.
30485
+ */
30486
+ txDataNonzero;
30487
+ /**
30488
+ * The fee per storage key in the [[link-eip-2930]] access list.
30489
+ */
30490
+ txAccessListStorageKey;
30491
+ /**
30492
+ * The fee per address in the [[link-eip-2930]] access list.
30493
+ */
30494
+ txAccessListAddress;
30495
+ /**
30496
+ * Creates a new GasCostPlugin from %%effectiveBlock%% until the
30497
+ * latest block or another GasCostPlugin supercedes that block number,
30498
+ * with the associated %%costs%%.
30499
+ */
30500
+ constructor(effectiveBlock, costs) {
30501
+ if (effectiveBlock == null) {
30502
+ effectiveBlock = 0;
30503
+ }
30504
+ super(`org.ethers.network.plugins.GasCost#${effectiveBlock || 0}`);
30505
+ const props = { effectiveBlock };
30506
+ function set(name, nullish) {
30507
+ let value = (costs || {})[name];
30508
+ if (value == null) {
30509
+ value = nullish;
30510
+ }
30511
+ assertArgument(typeof value === "number", `invalud value for ${name}`, "costs", costs);
30512
+ props[name] = value;
30513
+ }
30514
+ set("txBase", 21e3);
30515
+ set("txCreate", 32e3);
30516
+ set("txDataZero", 4);
30517
+ set("txDataNonzero", 16);
30518
+ set("txAccessListStorageKey", 1900);
30519
+ set("txAccessListAddress", 2400);
30520
+ defineProperties(this, props);
30521
+ }
30522
+ clone() {
30523
+ return new GasCostPlugin(this.effectiveBlock, this);
30524
+ }
30525
+ };
30526
+ var EnsPlugin = class extends NetworkPlugin {
30527
+ /**
30528
+ * The ENS Registrty Contract address.
30529
+ */
30530
+ address;
30531
+ /**
30532
+ * The chain ID that the ENS contract lives on.
30533
+ */
30534
+ targetNetwork;
30535
+ /**
30536
+ * Creates a new **EnsPlugin** connected to %%address%% on the
30537
+ * %%targetNetwork%%. The default ENS address and mainnet is used
30538
+ * if unspecified.
30539
+ */
30540
+ constructor(address, targetNetwork) {
30541
+ super("org.ethers.plugins.network.Ens");
30542
+ defineProperties(this, {
30543
+ address: address || EnsAddress,
30544
+ targetNetwork: targetNetwork == null ? 1 : targetNetwork
30545
+ });
30546
+ }
30547
+ clone() {
30548
+ return new EnsPlugin(this.address, this.targetNetwork);
30549
+ }
30550
+ };
30551
+ var FetchUrlFeeDataNetworkPlugin = class extends NetworkPlugin {
30552
+ #url;
30553
+ #processFunc;
30554
+ /**
30555
+ * The URL to initialize the FetchRequest with in %%processFunc%%.
30556
+ */
30557
+ get url() {
30558
+ return this.#url;
30559
+ }
30560
+ /**
30561
+ * The callback to use when computing the FeeData.
30562
+ */
30563
+ get processFunc() {
30564
+ return this.#processFunc;
30565
+ }
30566
+ /**
30567
+ * Creates a new **FetchUrlFeeDataNetworkPlugin** which will
30568
+ * be used when computing the fee data for the network.
30569
+ */
30570
+ constructor(url, processFunc) {
30571
+ super("org.ethers.plugins.network.FetchUrlFeeDataPlugin");
30572
+ this.#url = url;
30573
+ this.#processFunc = processFunc;
30574
+ }
30575
+ // We are immutable, so we can serve as our own clone
30576
+ clone() {
30577
+ return this;
30578
+ }
30579
+ };
30580
+
30581
+ // ../../node_modules/.pnpm/ethers@6.7.1/node_modules/ethers/lib.esm/providers/network.js
30582
+ var Networks = /* @__PURE__ */ new Map();
30583
+ var Network = class {
30584
+ #name;
30585
+ #chainId;
30586
+ #plugins;
30587
+ /**
30588
+ * Creates a new **Network** for %%name%% and %%chainId%%.
30589
+ */
30590
+ constructor(name, chainId) {
30591
+ this.#name = name;
30592
+ this.#chainId = getBigInt(chainId);
30593
+ this.#plugins = /* @__PURE__ */ new Map();
30594
+ }
30595
+ /**
30596
+ * Returns a JSON-compatible representation of a Network.
30597
+ */
30598
+ toJSON() {
30599
+ return { name: this.name, chainId: String(this.chainId) };
30600
+ }
30601
+ /**
30602
+ * The network common name.
30603
+ *
30604
+ * This is the canonical name, as networks migh have multiple
30605
+ * names.
30606
+ */
30607
+ get name() {
30608
+ return this.#name;
30609
+ }
30610
+ set name(value) {
30611
+ this.#name = value;
30612
+ }
30613
+ /**
30614
+ * The network chain ID.
30615
+ */
30616
+ get chainId() {
30617
+ return this.#chainId;
30618
+ }
30619
+ set chainId(value) {
30620
+ this.#chainId = getBigInt(value, "chainId");
30621
+ }
30622
+ /**
30623
+ * Returns true if %%other%% matches this network. Any chain ID
30624
+ * must match, and if no chain ID is present, the name must match.
30625
+ *
30626
+ * This method does not currently check for additional properties,
30627
+ * such as ENS address or plug-in compatibility.
30628
+ */
30629
+ matches(other) {
30630
+ if (other == null) {
30631
+ return false;
30632
+ }
30633
+ if (typeof other === "string") {
30634
+ try {
30635
+ return this.chainId === getBigInt(other);
30636
+ } catch (error) {
30637
+ }
30638
+ return this.name === other;
30639
+ }
30640
+ if (typeof other === "number" || typeof other === "bigint") {
30641
+ try {
30642
+ return this.chainId === getBigInt(other);
30643
+ } catch (error) {
30644
+ }
30645
+ return false;
30646
+ }
30647
+ if (typeof other === "object") {
30648
+ if (other.chainId != null) {
30649
+ try {
30650
+ return this.chainId === getBigInt(other.chainId);
30651
+ } catch (error) {
30652
+ }
30653
+ return false;
30654
+ }
30655
+ if (other.name != null) {
30656
+ return this.name === other.name;
30657
+ }
30658
+ return false;
30659
+ }
30660
+ return false;
30661
+ }
30662
+ /**
30663
+ * Returns the list of plugins currently attached to this Network.
30664
+ */
30665
+ get plugins() {
30666
+ return Array.from(this.#plugins.values());
30667
+ }
30668
+ /**
30669
+ * Attach a new %%plugin%% to this Network. The network name
30670
+ * must be unique, excluding any fragment.
30671
+ */
30672
+ attachPlugin(plugin) {
30673
+ if (this.#plugins.get(plugin.name)) {
30674
+ throw new Error(`cannot replace existing plugin: ${plugin.name} `);
30675
+ }
30676
+ this.#plugins.set(plugin.name, plugin.clone());
30677
+ return this;
30678
+ }
30679
+ /**
30680
+ * Return the plugin, if any, matching %%name%% exactly. Plugins
30681
+ * with fragments will not be returned unless %%name%% includes
30682
+ * a fragment.
30683
+ */
30684
+ getPlugin(name) {
30685
+ return this.#plugins.get(name) || null;
30686
+ }
30687
+ /**
30688
+ * Gets a list of all plugins that match %%name%%, with otr without
30689
+ * a fragment.
30690
+ */
30691
+ getPlugins(basename) {
30692
+ return this.plugins.filter((p) => p.name.split("#")[0] === basename);
30693
+ }
30694
+ /**
30695
+ * Create a copy of this Network.
30696
+ */
30697
+ clone() {
30698
+ const clone4 = new Network(this.name, this.chainId);
30699
+ this.plugins.forEach((plugin) => {
30700
+ clone4.attachPlugin(plugin.clone());
30701
+ });
30702
+ return clone4;
30703
+ }
30704
+ /**
30705
+ * Compute the intrinsic gas required for a transaction.
30706
+ *
30707
+ * A GasCostPlugin can be attached to override the default
30708
+ * values.
30709
+ */
30710
+ computeIntrinsicGas(tx) {
30711
+ const costs = this.getPlugin("org.ethers.plugins.network.GasCost") || new GasCostPlugin();
30712
+ let gas = costs.txBase;
30713
+ if (tx.to == null) {
30714
+ gas += costs.txCreate;
30715
+ }
30716
+ if (tx.data) {
30717
+ for (let i = 2; i < tx.data.length; i += 2) {
30718
+ if (tx.data.substring(i, i + 2) === "00") {
30719
+ gas += costs.txDataZero;
30720
+ } else {
30721
+ gas += costs.txDataNonzero;
30722
+ }
30723
+ }
30724
+ }
30725
+ if (tx.accessList) {
30726
+ const accessList = accessListify(tx.accessList);
30727
+ for (const addr in accessList) {
30728
+ gas += costs.txAccessListAddress + costs.txAccessListStorageKey * accessList[addr].storageKeys.length;
30729
+ }
30730
+ }
30731
+ return gas;
30732
+ }
30733
+ /**
30734
+ * Returns a new Network for the %%network%% name or chainId.
30735
+ */
30736
+ static from(network) {
30737
+ injectCommonNetworks();
30738
+ if (network == null) {
30739
+ return Network.from("mainnet");
30740
+ }
30741
+ if (typeof network === "number") {
30742
+ network = BigInt(network);
30743
+ }
30744
+ if (typeof network === "string" || typeof network === "bigint") {
30745
+ const networkFunc = Networks.get(network);
30746
+ if (networkFunc) {
30747
+ return networkFunc();
30748
+ }
30749
+ if (typeof network === "bigint") {
30750
+ return new Network("unknown", network);
30751
+ }
30752
+ assertArgument(false, "unknown network", "network", network);
30753
+ }
30754
+ if (typeof network.clone === "function") {
30755
+ const clone4 = network.clone();
30756
+ return clone4;
30757
+ }
30758
+ if (typeof network === "object") {
30759
+ assertArgument(typeof network.name === "string" && typeof network.chainId === "number", "invalid network object name or chainId", "network", network);
30760
+ const custom = new Network(network.name, network.chainId);
30761
+ if (network.ensAddress || network.ensNetwork != null) {
30762
+ custom.attachPlugin(new EnsPlugin(network.ensAddress, network.ensNetwork));
30763
+ }
30764
+ return custom;
30765
+ }
30766
+ assertArgument(false, "invalid network", "network", network);
30767
+ }
30768
+ /**
30769
+ * Register %%nameOrChainId%% with a function which returns
30770
+ * an instance of a Network representing that chain.
30771
+ */
30772
+ static register(nameOrChainId, networkFunc) {
30773
+ if (typeof nameOrChainId === "number") {
30774
+ nameOrChainId = BigInt(nameOrChainId);
30775
+ }
30776
+ const existing = Networks.get(nameOrChainId);
30777
+ if (existing) {
30778
+ assertArgument(false, `conflicting network for ${JSON.stringify(existing.name)}`, "nameOrChainId", nameOrChainId);
30779
+ }
30780
+ Networks.set(nameOrChainId, networkFunc);
30781
+ }
30782
+ };
30783
+ function parseUnits(_value, decimals) {
30784
+ const value = String(_value);
30785
+ if (!value.match(/^[0-9.]+$/)) {
30786
+ throw new Error(`invalid gwei value: ${_value}`);
30787
+ }
30788
+ const comps = value.split(".");
30789
+ if (comps.length === 1) {
30790
+ comps.push("");
30791
+ }
30792
+ if (comps.length !== 2) {
30793
+ throw new Error(`invalid gwei value: ${_value}`);
30794
+ }
30795
+ while (comps[1].length < decimals) {
30796
+ comps[1] += "0";
30797
+ }
30798
+ if (comps[1].length > 9) {
30799
+ let frac = BigInt(comps[1].substring(0, 9));
30800
+ if (!comps[1].substring(9).match(/^0+$/)) {
30801
+ frac++;
30802
+ }
30803
+ comps[1] = frac.toString();
30804
+ }
30805
+ return BigInt(comps[0] + comps[1]);
30806
+ }
30807
+ function getGasStationPlugin(url) {
30808
+ return new FetchUrlFeeDataNetworkPlugin(url, async (fetchFeeData, provider, request) => {
30809
+ request.setHeader("User-Agent", "ethers");
30810
+ let response;
30811
+ try {
30812
+ const [_response, _feeData] = await Promise.all([
30813
+ request.send(),
30814
+ fetchFeeData()
30815
+ ]);
30816
+ response = _response;
30817
+ const payload = response.bodyJson.standard;
30818
+ const feeData = {
30819
+ gasPrice: _feeData.gasPrice,
30820
+ maxFeePerGas: parseUnits(payload.maxFee, 9),
30821
+ maxPriorityFeePerGas: parseUnits(payload.maxPriorityFee, 9)
30822
+ };
30823
+ return feeData;
30824
+ } catch (error) {
30825
+ assert(false, `error encountered with polygon gas station (${JSON.stringify(request.url)})`, "SERVER_ERROR", { request, response, error });
30826
+ }
30827
+ });
30828
+ }
30829
+ function getPriorityFeePlugin(maxPriorityFeePerGas) {
30830
+ return new FetchUrlFeeDataNetworkPlugin("data:", async (fetchFeeData, provider, request) => {
30831
+ const feeData = await fetchFeeData();
30832
+ if (feeData.maxFeePerGas == null || feeData.maxPriorityFeePerGas == null) {
30833
+ return feeData;
30834
+ }
30835
+ const baseFee = feeData.maxFeePerGas - feeData.maxPriorityFeePerGas;
30836
+ return {
30837
+ gasPrice: feeData.gasPrice,
30838
+ maxFeePerGas: baseFee + maxPriorityFeePerGas,
30839
+ maxPriorityFeePerGas
30840
+ };
30841
+ });
30842
+ }
30843
+ var injected = false;
30844
+ function injectCommonNetworks() {
30845
+ if (injected) {
30846
+ return;
30847
+ }
30848
+ injected = true;
30849
+ function registerEth(name, chainId, options) {
30850
+ const func = function() {
30851
+ const network = new Network(name, chainId);
30852
+ if (options.ensNetwork != null) {
30853
+ network.attachPlugin(new EnsPlugin(null, options.ensNetwork));
30854
+ }
30855
+ network.attachPlugin(new GasCostPlugin());
30856
+ (options.plugins || []).forEach((plugin) => {
30857
+ network.attachPlugin(plugin);
30858
+ });
30859
+ return network;
30860
+ };
30861
+ Network.register(name, func);
30862
+ Network.register(chainId, func);
30863
+ if (options.altNames) {
30864
+ options.altNames.forEach((name2) => {
30865
+ Network.register(name2, func);
30866
+ });
30867
+ }
30868
+ }
30869
+ registerEth("mainnet", 1, { ensNetwork: 1, altNames: ["homestead"] });
30870
+ registerEth("ropsten", 3, { ensNetwork: 3 });
30871
+ registerEth("rinkeby", 4, { ensNetwork: 4 });
30872
+ registerEth("goerli", 5, { ensNetwork: 5 });
30873
+ registerEth("kovan", 42, { ensNetwork: 42 });
30874
+ registerEth("sepolia", 11155111, {});
30875
+ registerEth("classic", 61, {});
30876
+ registerEth("classicKotti", 6, {});
30877
+ registerEth("arbitrum", 42161, {
30878
+ ensNetwork: 1
30879
+ });
30880
+ registerEth("arbitrum-goerli", 421613, {});
30881
+ registerEth("bnb", 56, { ensNetwork: 1 });
30882
+ registerEth("bnbt", 97, {});
30883
+ registerEth("linea", 59144, { ensNetwork: 1 });
30884
+ registerEth("linea-goerli", 59140, {});
30885
+ registerEth("matic", 137, {
30886
+ ensNetwork: 1,
30887
+ plugins: [
30888
+ getGasStationPlugin("https://gasstation.polygon.technology/v2")
30889
+ ]
30890
+ });
30891
+ registerEth("matic-mumbai", 80001, {
30892
+ altNames: ["maticMumbai", "maticmum"],
30893
+ plugins: [
30894
+ getGasStationPlugin("https://gasstation-testnet.polygon.technology/v2")
30895
+ ]
30896
+ });
30897
+ registerEth("optimism", 10, {
30898
+ ensNetwork: 1,
30899
+ plugins: [
30900
+ getPriorityFeePlugin(BigInt("1000000"))
30901
+ ]
30902
+ });
30903
+ registerEth("optimism-goerli", 420, {});
30904
+ registerEth("xdai", 100, { ensNetwork: 1 });
30905
+ }
30906
+
30035
30907
  // ../crypto/dist/index.mjs
30036
- var import_crypto8 = __toESM(__require("crypto"), 1);
30037
30908
  var import_crypto9 = __toESM(__require("crypto"), 1);
30909
+ var import_crypto10 = __toESM(__require("crypto"), 1);
30038
30910
  var scrypt3 = (params) => {
30039
30911
  const { password, salt, n, p, r, dklen } = params;
30040
30912
  const derivedKey = scrypt(password, salt, { N: n, r, p, dkLen: dklen });
@@ -30043,7 +30915,7 @@ This unreleased fuel-core build may include features and updates not yet support
30043
30915
  var keccak2562 = (data) => keccak_256(data);
30044
30916
  var bufferFromString = (string, encoding = "base64") => Uint8Array.from(Buffer.from(string, encoding));
30045
30917
  var randomBytes4 = (length) => {
30046
- const randomValues = Uint8Array.from(import_crypto8.default.randomBytes(length));
30918
+ const randomValues = Uint8Array.from(import_crypto9.default.randomBytes(length));
30047
30919
  return randomValues;
30048
30920
  };
30049
30921
  var stringFromBuffer = (buffer, encoding = "base64") => Buffer.from(buffer).toString(encoding);
@@ -30058,7 +30930,7 @@ This unreleased fuel-core build may include features and updates not yet support
30058
30930
  const salt = randomBytes4(32);
30059
30931
  const secret = keyFromPassword(password, salt);
30060
30932
  const dataBuffer = Uint8Array.from(Buffer.from(JSON.stringify(data), "utf-8"));
30061
- const cipher = await import_crypto7.default.createCipheriv(ALGORITHM, secret, iv);
30933
+ const cipher = await import_crypto8.default.createCipheriv(ALGORITHM, secret, iv);
30062
30934
  let cipherData = cipher.update(dataBuffer);
30063
30935
  cipherData = Buffer.concat([cipherData, cipher.final()]);
30064
30936
  return {
@@ -30072,7 +30944,7 @@ This unreleased fuel-core build may include features and updates not yet support
30072
30944
  const salt = bufferFromString(keystore.salt);
30073
30945
  const secret = keyFromPassword(password, salt);
30074
30946
  const encryptedText = bufferFromString(keystore.data);
30075
- const decipher = await import_crypto7.default.createDecipheriv(ALGORITHM, secret, iv);
30947
+ const decipher = await import_crypto8.default.createDecipheriv(ALGORITHM, secret, iv);
30076
30948
  const decrypted = decipher.update(encryptedText);
30077
30949
  const deBuff = Buffer.concat([decrypted, decipher.final()]);
30078
30950
  const decryptedData = Buffer.from(deBuff).toString("utf-8");
@@ -30083,12 +30955,12 @@ This unreleased fuel-core build may include features and updates not yet support
30083
30955
  }
30084
30956
  };
30085
30957
  async function encryptJsonWalletData(data, key, iv) {
30086
- const cipher = await import_crypto9.default.createCipheriv("aes-128-ctr", key.subarray(0, 16), iv);
30958
+ const cipher = await import_crypto10.default.createCipheriv("aes-128-ctr", key.subarray(0, 16), iv);
30087
30959
  const encrypted = Buffer.concat([cipher.update(data), cipher.final()]);
30088
30960
  return new Uint8Array(encrypted);
30089
30961
  }
30090
30962
  async function decryptJsonWalletData(data, key, iv) {
30091
- const decipher = import_crypto9.default.createDecipheriv("aes-128-ctr", key.subarray(0, 16), iv);
30963
+ const decipher = import_crypto10.default.createDecipheriv("aes-128-ctr", key.subarray(0, 16), iv);
30092
30964
  const decrypted = await Buffer.concat([decipher.update(data), decipher.final()]);
30093
30965
  return new Uint8Array(decrypted);
30094
30966
  }
@@ -33706,9 +34578,9 @@ This unreleased fuel-core build may include features and updates not yet support
33706
34578
  utf8ToBytes: () => utf8ToBytes3,
33707
34579
  validateObject: () => validateObject
33708
34580
  });
33709
- var _0n2 = BigInt(0);
33710
- var _1n2 = BigInt(1);
33711
- var _2n2 = BigInt(2);
34581
+ var _0n3 = BigInt(0);
34582
+ var _1n3 = BigInt(1);
34583
+ var _2n3 = BigInt(2);
33712
34584
  function isBytes3(a) {
33713
34585
  return a instanceof Uint8Array || a != null && typeof a === "object" && a.constructor.name === "Uint8Array";
33714
34586
  }
@@ -33827,17 +34699,17 @@ This unreleased fuel-core build may include features and updates not yet support
33827
34699
  }
33828
34700
  function bitLen(n) {
33829
34701
  let len;
33830
- for (len = 0; n > _0n2; n >>= _1n2, len += 1)
34702
+ for (len = 0; n > _0n3; n >>= _1n3, len += 1)
33831
34703
  ;
33832
34704
  return len;
33833
34705
  }
33834
34706
  function bitGet(n, pos) {
33835
- return n >> BigInt(pos) & _1n2;
34707
+ return n >> BigInt(pos) & _1n3;
33836
34708
  }
33837
34709
  var bitSet = (n, pos, value) => {
33838
- return n | (value ? _1n2 : _0n2) << BigInt(pos);
34710
+ return n | (value ? _1n3 : _0n3) << BigInt(pos);
33839
34711
  };
33840
- var bitMask = (n) => (_2n2 << BigInt(n - 1)) - _1n2;
34712
+ var bitMask = (n) => (_2n3 << BigInt(n - 1)) - _1n3;
33841
34713
  var u8n = (data) => new Uint8Array(data);
33842
34714
  var u8fr = (arr) => Uint8Array.from(arr);
33843
34715
  function createHmacDrbg(hashLen, qByteLen, hmacFn) {
@@ -33864,7 +34736,7 @@ This unreleased fuel-core build may include features and updates not yet support
33864
34736
  k = h(u8fr([1]), seed);
33865
34737
  v = h();
33866
34738
  };
33867
- const gen2 = () => {
34739
+ const gen3 = () => {
33868
34740
  if (i++ >= 1e3)
33869
34741
  throw new Error("drbg: tried 1000 values");
33870
34742
  let len = 0;
@@ -33881,7 +34753,7 @@ This unreleased fuel-core build may include features and updates not yet support
33881
34753
  reset();
33882
34754
  reseed(seed);
33883
34755
  let res = void 0;
33884
- while (!(res = pred(gen2())))
34756
+ while (!(res = pred(gen3())))
33885
34757
  reseed();
33886
34758
  reset();
33887
34759
  return res;
@@ -37855,6 +38727,13 @@ ${MessageCoinFragmentFragmentDoc}`;
37855
38727
  )
37856
38728
  }
37857
38729
  `;
38730
+ var GetMessageByNonceDocument = lib_default2`
38731
+ query getMessageByNonce($nonce: Nonce!) {
38732
+ message(nonce: $nonce) {
38733
+ ...messageFragment
38734
+ }
38735
+ }
38736
+ ${MessageFragmentFragmentDoc}`;
37858
38737
  var SubmitAndAwaitDocument = lib_default2`
37859
38738
  subscription submitAndAwait($encodedTransaction: HexString!) {
37860
38739
  submitAndAwait(tx: $encodedTransaction) {
@@ -37949,6 +38828,9 @@ ${MessageCoinFragmentFragmentDoc}`;
37949
38828
  produceBlocks(variables, options) {
37950
38829
  return requester(ProduceBlocksDocument, variables, options);
37951
38830
  },
38831
+ getMessageByNonce(variables, options) {
38832
+ return requester(GetMessageByNonceDocument, variables, options);
38833
+ },
37952
38834
  submitAndAwait(variables, options) {
37953
38835
  return requester(SubmitAndAwaitDocument, variables, options);
37954
38836
  },
@@ -38766,6 +39648,27 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
38766
39648
  name = "NoWitnessByOwnerError";
38767
39649
  };
38768
39650
 
39651
+ // src/providers/transaction-request/helpers.ts
39652
+ var isRequestInputCoin = (input) => input.type === InputType.Coin;
39653
+ var isRequestInputMessage = (input) => input.type === InputType.Message;
39654
+ var isRequestInputResource = (input) => isRequestInputCoin(input) || isRequestInputMessage(input);
39655
+ var getRequestInputResourceOwner = (input) => isRequestInputCoin(input) ? input.owner : input.recipient;
39656
+ var isRequestInputResourceFromOwner = (input, owner) => getRequestInputResourceOwner(input) === owner.toB256();
39657
+ var cacheResources = (resources) => resources.reduce(
39658
+ (cache2, resource) => {
39659
+ if (isCoin(resource)) {
39660
+ cache2.utxos.push(resource.id);
39661
+ } else {
39662
+ cache2.messages.push(resource.nonce);
39663
+ }
39664
+ return cache2;
39665
+ },
39666
+ {
39667
+ utxos: [],
39668
+ messages: []
39669
+ }
39670
+ );
39671
+
38769
39672
  // src/providers/transaction-request/witness.ts
38770
39673
  var witnessify = (value) => {
38771
39674
  const data = arrayify(value);
@@ -39004,7 +39907,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
39004
39907
  * @param coin - Coin resource.
39005
39908
  */
39006
39909
  addCoinInput(coin) {
39007
- const { assetId, owner, amount } = coin;
39910
+ const { assetId, owner, amount, id, predicate } = coin;
39008
39911
  let witnessIndex;
39009
39912
  if (coin.predicate) {
39010
39913
  witnessIndex = 0;
@@ -39015,13 +39918,14 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
39015
39918
  }
39016
39919
  }
39017
39920
  const input = {
39018
- ...coin,
39921
+ id,
39019
39922
  type: InputType.Coin,
39020
39923
  owner: owner.toB256(),
39021
39924
  amount,
39022
39925
  assetId,
39023
39926
  txPointer: "0x00000000000000000000000000000000",
39024
- witnessIndex
39927
+ witnessIndex,
39928
+ predicate
39025
39929
  };
39026
39930
  this.pushInput(input);
39027
39931
  this.addChangeOutput(owner, assetId);
@@ -39033,7 +39937,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
39033
39937
  * @param message - Message resource.
39034
39938
  */
39035
39939
  addMessageInput(message) {
39036
- const { recipient, sender, amount, assetId } = message;
39940
+ const { recipient, sender, amount, predicate, nonce, assetId } = message;
39037
39941
  let witnessIndex;
39038
39942
  if (message.predicate) {
39039
39943
  witnessIndex = 0;
@@ -39044,12 +39948,13 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
39044
39948
  }
39045
39949
  }
39046
39950
  const input = {
39047
- ...message,
39951
+ nonce,
39048
39952
  type: InputType.Message,
39049
39953
  sender: sender.toB256(),
39050
39954
  recipient: recipient.toB256(),
39051
39955
  amount,
39052
- witnessIndex
39956
+ witnessIndex,
39957
+ predicate
39053
39958
  };
39054
39959
  this.pushInput(input);
39055
39960
  this.addChangeOutput(recipient, assetId);
@@ -39233,6 +40138,17 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
39233
40138
  toJSON() {
39234
40139
  return normalizeJSON(this);
39235
40140
  }
40141
+ removeWitness(index) {
40142
+ this.witnesses.splice(index, 1);
40143
+ this.adjustWitnessIndexes(index);
40144
+ }
40145
+ adjustWitnessIndexes(removedIndex) {
40146
+ this.inputs.filter(isRequestInputResource).forEach((input) => {
40147
+ if (input.witnessIndex > removedIndex) {
40148
+ input.witnessIndex -= 1;
40149
+ }
40150
+ });
40151
+ }
39236
40152
  updatePredicateGasUsed(inputs) {
39237
40153
  this.inputs.forEach((i) => {
39238
40154
  let correspondingInput;
@@ -40421,7 +41337,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
40421
41337
  }
40422
41338
 
40423
41339
  // src/providers/transaction-response/transaction-response.ts
40424
- var TransactionResponse = class {
41340
+ var TransactionResponse2 = class {
40425
41341
  /** Transaction ID */
40426
41342
  id;
40427
41343
  /** Current provider */
@@ -40451,7 +41367,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
40451
41367
  * @param provider - The provider.
40452
41368
  */
40453
41369
  static async create(id, provider, abis) {
40454
- const response = new TransactionResponse(id, provider, abis);
41370
+ const response = new TransactionResponse2(id, provider, abis);
40455
41371
  await response.fetch();
40456
41372
  return response;
40457
41373
  }
@@ -40845,6 +41761,21 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
40845
41761
  } = await this.operations.getVersion();
40846
41762
  return nodeVersion;
40847
41763
  }
41764
+ /**
41765
+ * @hidden
41766
+ *
41767
+ * Returns the network configuration of the connected Fuel node.
41768
+ *
41769
+ * @returns A promise that resolves to the network configuration object
41770
+ */
41771
+ async getNetwork() {
41772
+ const {
41773
+ name,
41774
+ consensusParameters: { chainId }
41775
+ } = await this.getChain();
41776
+ const network = new Network(name, chainId.toNumber());
41777
+ return Promise.resolve(network);
41778
+ }
40848
41779
  /**
40849
41780
  * Returns the block number.
40850
41781
  *
@@ -40938,14 +41869,14 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
40938
41869
  }
40939
41870
  }
40940
41871
  const transactionId2 = transactionRequest.getTransactionId(this.getChainId());
40941
- const response = new TransactionResponse(transactionId2, this, abis);
41872
+ const response = new TransactionResponse2(transactionId2, this, abis);
40942
41873
  await response.fetch();
40943
41874
  return response;
40944
41875
  }
40945
41876
  const {
40946
41877
  submit: { id: transactionId }
40947
41878
  } = await this.operations.submit({ encodedTransaction });
40948
- return new TransactionResponse(transactionId, this, abis);
41879
+ return new TransactionResponse2(transactionId, this, abis);
40949
41880
  }
40950
41881
  /**
40951
41882
  * Executes a transaction without actually submitting it to the chain.
@@ -41693,7 +42624,20 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
41693
42624
  }
41694
42625
  // eslint-disable-next-line @typescript-eslint/require-await
41695
42626
  async getTransactionResponse(transactionId) {
41696
- return new TransactionResponse(transactionId, this);
42627
+ return new TransactionResponse2(transactionId, this);
42628
+ }
42629
+ /**
42630
+ * Returns Message for given nonce.
42631
+ *
42632
+ * @param nonce - The nonce of the message to retrieve.
42633
+ * @returns A promise that resolves to the Message object.
42634
+ */
42635
+ async getMessageByNonce(nonce) {
42636
+ const { message } = await this.operations.getMessageByNonce({ nonce });
42637
+ if (!message) {
42638
+ return null;
42639
+ }
42640
+ return message;
41697
42641
  }
41698
42642
  };
41699
42643
  var Provider = _Provider;
@@ -42392,9 +43336,9 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
42392
43336
  };
42393
43337
 
42394
43338
  // ../../node_modules/.pnpm/@noble+curves@1.3.0/node_modules/@noble/curves/esm/abstract/modular.js
42395
- var _0n3 = BigInt(0);
42396
- var _1n3 = BigInt(1);
42397
- var _2n3 = BigInt(2);
43339
+ var _0n4 = BigInt(0);
43340
+ var _1n4 = BigInt(1);
43341
+ var _2n4 = BigInt(2);
42398
43342
  var _3n = BigInt(3);
42399
43343
  var _4n = BigInt(4);
42400
43344
  var _5n = BigInt(5);
@@ -42403,38 +43347,38 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
42403
43347
  var _16n = BigInt(16);
42404
43348
  function mod(a, b) {
42405
43349
  const result = a % b;
42406
- return result >= _0n3 ? result : b + result;
43350
+ return result >= _0n4 ? result : b + result;
42407
43351
  }
42408
43352
  function pow(num, power, modulo) {
42409
- if (modulo <= _0n3 || power < _0n3)
43353
+ if (modulo <= _0n4 || power < _0n4)
42410
43354
  throw new Error("Expected power/modulo > 0");
42411
- if (modulo === _1n3)
42412
- return _0n3;
42413
- let res = _1n3;
42414
- while (power > _0n3) {
42415
- if (power & _1n3)
43355
+ if (modulo === _1n4)
43356
+ return _0n4;
43357
+ let res = _1n4;
43358
+ while (power > _0n4) {
43359
+ if (power & _1n4)
42416
43360
  res = res * num % modulo;
42417
43361
  num = num * num % modulo;
42418
- power >>= _1n3;
43362
+ power >>= _1n4;
42419
43363
  }
42420
43364
  return res;
42421
43365
  }
42422
43366
  function pow2(x, power, modulo) {
42423
43367
  let res = x;
42424
- while (power-- > _0n3) {
43368
+ while (power-- > _0n4) {
42425
43369
  res *= res;
42426
43370
  res %= modulo;
42427
43371
  }
42428
43372
  return res;
42429
43373
  }
42430
43374
  function invert(number3, modulo) {
42431
- if (number3 === _0n3 || modulo <= _0n3) {
43375
+ if (number3 === _0n4 || modulo <= _0n4) {
42432
43376
  throw new Error(`invert: expected positive integers, got n=${number3} mod=${modulo}`);
42433
43377
  }
42434
43378
  let a = mod(number3, modulo);
42435
43379
  let b = modulo;
42436
- let x = _0n3, y = _1n3, u = _1n3, v = _0n3;
42437
- while (a !== _0n3) {
43380
+ let x = _0n4, y = _1n4, u = _1n4, v = _0n4;
43381
+ while (a !== _0n4) {
42438
43382
  const q = b / a;
42439
43383
  const r = b % a;
42440
43384
  const m = x - u * q;
@@ -42442,19 +43386,19 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
42442
43386
  b = a, a = r, x = u, y = v, u = m, v = n;
42443
43387
  }
42444
43388
  const gcd = b;
42445
- if (gcd !== _1n3)
43389
+ if (gcd !== _1n4)
42446
43390
  throw new Error("invert: does not exist");
42447
43391
  return mod(x, modulo);
42448
43392
  }
42449
43393
  function tonelliShanks(P) {
42450
- const legendreC = (P - _1n3) / _2n3;
43394
+ const legendreC = (P - _1n4) / _2n4;
42451
43395
  let Q, S, Z;
42452
- for (Q = P - _1n3, S = 0; Q % _2n3 === _0n3; Q /= _2n3, S++)
43396
+ for (Q = P - _1n4, S = 0; Q % _2n4 === _0n4; Q /= _2n4, S++)
42453
43397
  ;
42454
- for (Z = _2n3; Z < P && pow(Z, legendreC, P) !== P - _1n3; Z++)
43398
+ for (Z = _2n4; Z < P && pow(Z, legendreC, P) !== P - _1n4; Z++)
42455
43399
  ;
42456
43400
  if (S === 1) {
42457
- const p1div4 = (P + _1n3) / _4n;
43401
+ const p1div4 = (P + _1n4) / _4n;
42458
43402
  return function tonelliFast(Fp2, n) {
42459
43403
  const root = Fp2.pow(n, p1div4);
42460
43404
  if (!Fp2.eql(Fp2.sqr(root), n))
@@ -42462,7 +43406,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
42462
43406
  return root;
42463
43407
  };
42464
43408
  }
42465
- const Q1div2 = (Q + _1n3) / _2n3;
43409
+ const Q1div2 = (Q + _1n4) / _2n4;
42466
43410
  return function tonelliSlow(Fp2, n) {
42467
43411
  if (Fp2.pow(n, legendreC) === Fp2.neg(Fp2.ONE))
42468
43412
  throw new Error("Cannot find square root");
@@ -42479,7 +43423,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
42479
43423
  break;
42480
43424
  t2 = Fp2.sqr(t2);
42481
43425
  }
42482
- const ge = Fp2.pow(g, _1n3 << BigInt(r - m - 1));
43426
+ const ge = Fp2.pow(g, _1n4 << BigInt(r - m - 1));
42483
43427
  g = Fp2.sqr(ge);
42484
43428
  x = Fp2.mul(x, ge);
42485
43429
  b = Fp2.mul(b, g);
@@ -42490,7 +43434,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
42490
43434
  }
42491
43435
  function FpSqrt(P) {
42492
43436
  if (P % _4n === _3n) {
42493
- const p1div4 = (P + _1n3) / _4n;
43437
+ const p1div4 = (P + _1n4) / _4n;
42494
43438
  return function sqrt3mod4(Fp2, n) {
42495
43439
  const root = Fp2.pow(n, p1div4);
42496
43440
  if (!Fp2.eql(Fp2.sqr(root), n))
@@ -42501,10 +43445,10 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
42501
43445
  if (P % _8n === _5n) {
42502
43446
  const c1 = (P - _5n) / _8n;
42503
43447
  return function sqrt5mod8(Fp2, n) {
42504
- const n2 = Fp2.mul(n, _2n3);
43448
+ const n2 = Fp2.mul(n, _2n4);
42505
43449
  const v = Fp2.pow(n2, c1);
42506
43450
  const nv = Fp2.mul(n, v);
42507
- const i = Fp2.mul(Fp2.mul(nv, _2n3), v);
43451
+ const i = Fp2.mul(Fp2.mul(nv, _2n4), v);
42508
43452
  const root = Fp2.mul(nv, Fp2.sub(i, Fp2.ONE));
42509
43453
  if (!Fp2.eql(Fp2.sqr(root), n))
42510
43454
  throw new Error("Cannot find square root");
@@ -42548,19 +43492,19 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
42548
43492
  return validateObject(field, opts);
42549
43493
  }
42550
43494
  function FpPow(f2, num, power) {
42551
- if (power < _0n3)
43495
+ if (power < _0n4)
42552
43496
  throw new Error("Expected power > 0");
42553
- if (power === _0n3)
43497
+ if (power === _0n4)
42554
43498
  return f2.ONE;
42555
- if (power === _1n3)
43499
+ if (power === _1n4)
42556
43500
  return num;
42557
43501
  let p = f2.ONE;
42558
43502
  let d = num;
42559
- while (power > _0n3) {
42560
- if (power & _1n3)
43503
+ while (power > _0n4) {
43504
+ if (power & _1n4)
42561
43505
  p = f2.mul(p, d);
42562
43506
  d = f2.sqr(d);
42563
- power >>= _1n3;
43507
+ power >>= _1n4;
42564
43508
  }
42565
43509
  return p;
42566
43510
  }
@@ -42587,7 +43531,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
42587
43531
  return { nBitLength: _nBitLength, nByteLength };
42588
43532
  }
42589
43533
  function Field(ORDER, bitLen2, isLE3 = false, redef = {}) {
42590
- if (ORDER <= _0n3)
43534
+ if (ORDER <= _0n4)
42591
43535
  throw new Error(`Expected Field ORDER > 0, got ${ORDER}`);
42592
43536
  const { nBitLength: BITS, nByteLength: BYTES } = nLength(ORDER, bitLen2);
42593
43537
  if (BYTES > 2048)
@@ -42598,16 +43542,16 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
42598
43542
  BITS,
42599
43543
  BYTES,
42600
43544
  MASK: bitMask(BITS),
42601
- ZERO: _0n3,
42602
- ONE: _1n3,
43545
+ ZERO: _0n4,
43546
+ ONE: _1n4,
42603
43547
  create: (num) => mod(num, ORDER),
42604
43548
  isValid: (num) => {
42605
43549
  if (typeof num !== "bigint")
42606
43550
  throw new Error(`Invalid field element: expected bigint, got ${typeof num}`);
42607
- return _0n3 <= num && num < ORDER;
43551
+ return _0n4 <= num && num < ORDER;
42608
43552
  },
42609
- is0: (num) => num === _0n3,
42610
- isOdd: (num) => (num & _1n3) === _1n3,
43553
+ is0: (num) => num === _0n4,
43554
+ isOdd: (num) => (num & _1n4) === _1n4,
42611
43555
  neg: (num) => mod(-num, ORDER),
42612
43556
  eql: (lhs, rhs) => lhs === rhs,
42613
43557
  sqr: (num) => mod(num * num, ORDER),
@@ -42653,13 +43597,13 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
42653
43597
  if (len < 16 || len < minLen || len > 1024)
42654
43598
  throw new Error(`expected ${minLen}-1024 bytes of input, got ${len}`);
42655
43599
  const num = isLE3 ? bytesToNumberBE(key) : bytesToNumberLE(key);
42656
- const reduced = mod(num, fieldOrder - _1n3) + _1n3;
43600
+ const reduced = mod(num, fieldOrder - _1n4) + _1n4;
42657
43601
  return isLE3 ? numberToBytesLE(reduced, fieldLen) : numberToBytesBE(reduced, fieldLen);
42658
43602
  }
42659
43603
 
42660
43604
  // ../../node_modules/.pnpm/@noble+curves@1.3.0/node_modules/@noble/curves/esm/abstract/curve.js
42661
- var _0n4 = BigInt(0);
42662
- var _1n4 = BigInt(1);
43605
+ var _0n5 = BigInt(0);
43606
+ var _1n5 = BigInt(1);
42663
43607
  function wNAF(c, bits) {
42664
43608
  const constTimeNegate = (condition, item) => {
42665
43609
  const neg = item.negate();
@@ -42676,11 +43620,11 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
42676
43620
  unsafeLadder(elm, n) {
42677
43621
  let p = c.ZERO;
42678
43622
  let d = elm;
42679
- while (n > _0n4) {
42680
- if (n & _1n4)
43623
+ while (n > _0n5) {
43624
+ if (n & _1n5)
42681
43625
  p = p.add(d);
42682
43626
  d = d.double();
42683
- n >>= _1n4;
43627
+ n >>= _1n5;
42684
43628
  }
42685
43629
  return p;
42686
43630
  },
@@ -42730,7 +43674,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
42730
43674
  n >>= shiftBy;
42731
43675
  if (wbits > windowSize) {
42732
43676
  wbits -= maxNumber;
42733
- n += _1n4;
43677
+ n += _1n5;
42734
43678
  }
42735
43679
  const offset1 = offset;
42736
43680
  const offset2 = offset + Math.abs(wbits) - 1;
@@ -42854,9 +43798,9 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
42854
43798
  return `30${h(rhl + shl + 4)}02${rl}${r}02${sl}${s}`;
42855
43799
  }
42856
43800
  };
42857
- var _0n5 = BigInt(0);
42858
- var _1n5 = BigInt(1);
42859
- var _2n4 = BigInt(2);
43801
+ var _0n6 = BigInt(0);
43802
+ var _1n6 = BigInt(1);
43803
+ var _2n5 = BigInt(2);
42860
43804
  var _3n2 = BigInt(3);
42861
43805
  var _4n2 = BigInt(4);
42862
43806
  function weierstrassPoints(opts) {
@@ -42881,7 +43825,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
42881
43825
  if (!Fp2.eql(Fp2.sqr(CURVE.Gy), weierstrassEquation(CURVE.Gx)))
42882
43826
  throw new Error("bad generator point: equation left != right");
42883
43827
  function isWithinCurveOrder(num) {
42884
- return typeof num === "bigint" && _0n5 < num && num < CURVE.n;
43828
+ return typeof num === "bigint" && _0n6 < num && num < CURVE.n;
42885
43829
  }
42886
43830
  function assertGE(num) {
42887
43831
  if (!isWithinCurveOrder(num))
@@ -43125,10 +44069,10 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
43125
44069
  */
43126
44070
  multiplyUnsafe(n) {
43127
44071
  const I = Point2.ZERO;
43128
- if (n === _0n5)
44072
+ if (n === _0n6)
43129
44073
  return I;
43130
44074
  assertGE(n);
43131
- if (n === _1n5)
44075
+ if (n === _1n6)
43132
44076
  return this;
43133
44077
  const { endo } = CURVE;
43134
44078
  if (!endo)
@@ -43137,14 +44081,14 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
43137
44081
  let k1p = I;
43138
44082
  let k2p = I;
43139
44083
  let d = this;
43140
- while (k1 > _0n5 || k2 > _0n5) {
43141
- if (k1 & _1n5)
44084
+ while (k1 > _0n6 || k2 > _0n6) {
44085
+ if (k1 & _1n6)
43142
44086
  k1p = k1p.add(d);
43143
- if (k2 & _1n5)
44087
+ if (k2 & _1n6)
43144
44088
  k2p = k2p.add(d);
43145
44089
  d = d.double();
43146
- k1 >>= _1n5;
43147
- k2 >>= _1n5;
44090
+ k1 >>= _1n6;
44091
+ k2 >>= _1n6;
43148
44092
  }
43149
44093
  if (k1neg)
43150
44094
  k1p = k1p.negate();
@@ -43191,7 +44135,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
43191
44135
  */
43192
44136
  multiplyAndAddUnsafe(Q, a, b) {
43193
44137
  const G = Point2.BASE;
43194
- const mul = (P, a2) => a2 === _0n5 || a2 === _1n5 || !P.equals(G) ? P.multiplyUnsafe(a2) : P.multiply(a2);
44138
+ const mul = (P, a2) => a2 === _0n6 || a2 === _1n6 || !P.equals(G) ? P.multiplyUnsafe(a2) : P.multiply(a2);
43195
44139
  const sum = mul(this, a).add(mul(Q, b));
43196
44140
  return sum.is0() ? void 0 : sum;
43197
44141
  }
@@ -43214,7 +44158,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
43214
44158
  }
43215
44159
  isTorsionFree() {
43216
44160
  const { h: cofactor, isTorsionFree } = CURVE;
43217
- if (cofactor === _1n5)
44161
+ if (cofactor === _1n6)
43218
44162
  return true;
43219
44163
  if (isTorsionFree)
43220
44164
  return isTorsionFree(Point2, this);
@@ -43222,7 +44166,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
43222
44166
  }
43223
44167
  clearCofactor() {
43224
44168
  const { h: cofactor, clearCofactor } = CURVE;
43225
- if (cofactor === _1n5)
44169
+ if (cofactor === _1n6)
43226
44170
  return this;
43227
44171
  if (clearCofactor)
43228
44172
  return clearCofactor(Point2, this);
@@ -43267,7 +44211,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
43267
44211
  const compressedLen = Fp2.BYTES + 1;
43268
44212
  const uncompressedLen = 2 * Fp2.BYTES + 1;
43269
44213
  function isValidFieldElement(num) {
43270
- return _0n5 < num && num < Fp2.ORDER;
44214
+ return _0n6 < num && num < Fp2.ORDER;
43271
44215
  }
43272
44216
  function modN(a) {
43273
44217
  return mod(a, CURVE_ORDER);
@@ -43297,7 +44241,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
43297
44241
  throw new Error("Point is not on curve");
43298
44242
  const y2 = weierstrassEquation(x);
43299
44243
  let y = Fp2.sqrt(y2);
43300
- const isYOdd = (y & _1n5) === _1n5;
44244
+ const isYOdd = (y & _1n6) === _1n6;
43301
44245
  const isHeadOdd = (head & 1) === 1;
43302
44246
  if (isHeadOdd !== isYOdd)
43303
44247
  y = Fp2.neg(y);
@@ -43313,7 +44257,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
43313
44257
  });
43314
44258
  const numToNByteStr = (num) => bytesToHex(numberToBytesBE(num, CURVE.nByteLength));
43315
44259
  function isBiggerThanHalfOrder(number3) {
43316
- const HALF = CURVE_ORDER >> _1n5;
44260
+ const HALF = CURVE_ORDER >> _1n6;
43317
44261
  return number3 > HALF;
43318
44262
  }
43319
44263
  function normalizeS(s) {
@@ -43456,7 +44400,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
43456
44400
  function int2octets(num) {
43457
44401
  if (typeof num !== "bigint")
43458
44402
  throw new Error("bigint expected");
43459
- if (!(_0n5 <= num && num < ORDER_MASK))
44403
+ if (!(_0n6 <= num && num < ORDER_MASK))
43460
44404
  throw new Error(`bigint expected < 2^${CURVE.nBitLength}`);
43461
44405
  return numberToBytesBE(num, CURVE.nByteLength);
43462
44406
  }
@@ -43486,12 +44430,12 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
43486
44430
  const ik = invN(k);
43487
44431
  const q = Point2.BASE.multiply(k).toAffine();
43488
44432
  const r = modN(q.x);
43489
- if (r === _0n5)
44433
+ if (r === _0n6)
43490
44434
  return;
43491
44435
  const s = modN(ik * modN(m + r * d));
43492
- if (s === _0n5)
44436
+ if (s === _0n6)
43493
44437
  return;
43494
- let recovery = (q.x === r ? 0 : 2) | Number(q.y & _1n5);
44438
+ let recovery = (q.x === r ? 0 : 2) | Number(q.y & _1n6);
43495
44439
  let normS = s;
43496
44440
  if (lowS && isBiggerThanHalfOrder(s)) {
43497
44441
  normS = normalizeS(s);
@@ -43583,9 +44527,9 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
43583
44527
  // ../../node_modules/.pnpm/@noble+curves@1.3.0/node_modules/@noble/curves/esm/secp256k1.js
43584
44528
  var secp256k1P = BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f");
43585
44529
  var secp256k1N = BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141");
43586
- var _1n6 = BigInt(1);
43587
- var _2n5 = BigInt(2);
43588
- var divNearest = (a, b) => (a + b / _2n5) / b;
44530
+ var _1n7 = BigInt(1);
44531
+ var _2n6 = BigInt(2);
44532
+ var divNearest = (a, b) => (a + b / _2n6) / b;
43589
44533
  function sqrtMod(y) {
43590
44534
  const P = secp256k1P;
43591
44535
  const _3n3 = BigInt(3), _6n = BigInt(6), _11n = BigInt(11), _22n = BigInt(22);
@@ -43594,7 +44538,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
43594
44538
  const b3 = b2 * b2 * y % P;
43595
44539
  const b6 = pow2(b3, _3n3, P) * b3 % P;
43596
44540
  const b9 = pow2(b6, _3n3, P) * b3 % P;
43597
- const b11 = pow2(b9, _2n5, P) * b2 % P;
44541
+ const b11 = pow2(b9, _2n6, P) * b2 % P;
43598
44542
  const b22 = pow2(b11, _11n, P) * b11 % P;
43599
44543
  const b44 = pow2(b22, _22n, P) * b22 % P;
43600
44544
  const b88 = pow2(b44, _44n, P) * b44 % P;
@@ -43603,7 +44547,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
43603
44547
  const b223 = pow2(b220, _3n3, P) * b3 % P;
43604
44548
  const t1 = pow2(b223, _23n, P) * b22 % P;
43605
44549
  const t2 = pow2(t1, _6n, P) * b2 % P;
43606
- const root = pow2(t2, _2n5, P);
44550
+ const root = pow2(t2, _2n6, P);
43607
44551
  if (!Fp.eql(Fp.sqr(root), y))
43608
44552
  throw new Error("Cannot find square root");
43609
44553
  return root;
@@ -43636,7 +44580,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
43636
44580
  splitScalar: (k) => {
43637
44581
  const n = secp256k1N;
43638
44582
  const a1 = BigInt("0x3086d221a7d46bcde86c90e49284eb15");
43639
- const b1 = -_1n6 * BigInt("0xe4437ed6010e88286f547fa90abfe4c3");
44583
+ const b1 = -_1n7 * BigInt("0xe4437ed6010e88286f547fa90abfe4c3");
43640
44584
  const a2 = BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8");
43641
44585
  const b2 = a1;
43642
44586
  const POW_2_128 = BigInt("0x100000000000000000000000000000000");
@@ -43657,7 +44601,7 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
43657
44601
  }
43658
44602
  }
43659
44603
  }, sha256);
43660
- var _0n6 = BigInt(0);
44604
+ var _0n7 = BigInt(0);
43661
44605
  var Point = secp256k1.ProjectivePoint;
43662
44606
 
43663
44607
  // src/signer/signer.ts
@@ -43764,12 +44708,12 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
43764
44708
  };
43765
44709
 
43766
44710
  // ../../node_modules/.pnpm/uuid@9.0.0/node_modules/uuid/dist/esm-node/rng.js
43767
- var import_crypto15 = __toESM(__require("crypto"));
44711
+ var import_crypto16 = __toESM(__require("crypto"));
43768
44712
  var rnds8Pool = new Uint8Array(256);
43769
44713
  var poolPtr = rnds8Pool.length;
43770
44714
  function rng() {
43771
44715
  if (poolPtr > rnds8Pool.length - 16) {
43772
- import_crypto15.default.randomFillSync(rnds8Pool);
44716
+ import_crypto16.default.randomFillSync(rnds8Pool);
43773
44717
  poolPtr = 0;
43774
44718
  }
43775
44719
  return rnds8Pool.slice(poolPtr, poolPtr += 16);
@@ -43785,9 +44729,9 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
43785
44729
  }
43786
44730
 
43787
44731
  // ../../node_modules/.pnpm/uuid@9.0.0/node_modules/uuid/dist/esm-node/native.js
43788
- var import_crypto16 = __toESM(__require("crypto"));
44732
+ var import_crypto17 = __toESM(__require("crypto"));
43789
44733
  var native_default = {
43790
- randomUUID: import_crypto16.default.randomUUID
44734
+ randomUUID: import_crypto17.default.randomUUID
43791
44735
  };
43792
44736
 
43793
44737
  // ../../node_modules/.pnpm/uuid@9.0.0/node_modules/uuid/dist/esm-node/v4.js
@@ -47246,10 +48190,15 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
47246
48190
  populateTransactionPredicateData(transactionRequestLike) {
47247
48191
  const request = transactionRequestify(transactionRequestLike);
47248
48192
  const { policies } = BaseTransactionRequest.getPolicyMeta(request);
47249
- request.inputs?.forEach((input) => {
47250
- if (input.type === InputType.Coin && hexlify(input.owner) === this.address.toB256()) {
48193
+ const placeholderIndex = this.getIndexFromPlaceholderWitness(request);
48194
+ if (placeholderIndex !== -1) {
48195
+ request.removeWitness(placeholderIndex);
48196
+ }
48197
+ request.inputs.filter(isRequestInputResource).forEach((input) => {
48198
+ if (isRequestInputResourceFromOwner(input, this.address)) {
47251
48199
  input.predicate = hexlify(this.bytes);
47252
48200
  input.predicateData = hexlify(this.getPredicateData(policies.length));
48201
+ input.witnessIndex = 0;
47253
48202
  }
47254
48203
  });
47255
48204
  return request;
@@ -47372,6 +48321,28 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
47372
48321
  }
47373
48322
  return mutatedBytes;
47374
48323
  }
48324
+ /**
48325
+ * Returns the index of the witness placeholder that was added to this predicate.
48326
+ * If no witness placeholder was added, it returns -1.
48327
+ * @param request - The transaction request.
48328
+ * @returns The index of the witness placeholder, or -1 if there is no witness placeholder.
48329
+ */
48330
+ getIndexFromPlaceholderWitness(request) {
48331
+ const predicateInputs = request.inputs.filter(isRequestInputResource).filter((input) => isRequestInputResourceFromOwner(input, this.address));
48332
+ let index = -1;
48333
+ const hasEmptyPredicateInputs = predicateInputs.find((input) => !input.predicate);
48334
+ if (hasEmptyPredicateInputs) {
48335
+ index = hasEmptyPredicateInputs.witnessIndex;
48336
+ const allInputsAreEmpty = predicateInputs.every((input) => !input.predicate);
48337
+ if (!allInputsAreEmpty) {
48338
+ const wasFilledInputAddedFirst = !!predicateInputs[0]?.predicate;
48339
+ if (wasFilledInputAddedFirst) {
48340
+ index = -1;
48341
+ }
48342
+ }
48343
+ }
48344
+ return index;
48345
+ }
47375
48346
  };
47376
48347
 
47377
48348
  // src/connectors/fuel-connector.ts