@fuel-ts/account 0.0.0-rc-1356-20240510142347 → 0.0.0-rc-2037-20240510174704

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 (46) hide show
  1. package/dist/index.global.js +102 -45
  2. package/dist/index.global.js.map +1 -1
  3. package/dist/index.js +442 -363
  4. package/dist/index.js.map +1 -1
  5. package/dist/index.mjs +242 -171
  6. package/dist/index.mjs.map +1 -1
  7. package/dist/predicate/predicate.d.ts +9 -2
  8. package/dist/predicate/predicate.d.ts.map +1 -1
  9. package/dist/providers/provider.d.ts +1 -1
  10. package/dist/providers/provider.d.ts.map +1 -1
  11. package/dist/providers/transaction-request/helpers.d.ts +4 -0
  12. package/dist/providers/transaction-request/helpers.d.ts.map +1 -1
  13. package/dist/providers/transaction-request/index.d.ts +1 -0
  14. package/dist/providers/transaction-request/index.d.ts.map +1 -1
  15. package/dist/providers/transaction-request/transaction-request.d.ts +2 -0
  16. package/dist/providers/transaction-request/transaction-request.d.ts.map +1 -1
  17. package/dist/providers/transaction-request/utils.d.ts +0 -4
  18. package/dist/providers/transaction-request/utils.d.ts.map +1 -1
  19. package/dist/providers/utils/auto-retry-fetch.d.ts.map +1 -1
  20. package/dist/providers/utils/index.d.ts +1 -0
  21. package/dist/providers/utils/index.d.ts.map +1 -1
  22. package/dist/providers/utils/sleep.d.ts +3 -0
  23. package/dist/providers/utils/sleep.d.ts.map +1 -0
  24. package/dist/test-utils/index.d.ts +0 -4
  25. package/dist/test-utils/index.d.ts.map +1 -1
  26. package/dist/test-utils/launchNode.d.ts +1 -8
  27. package/dist/test-utils/launchNode.d.ts.map +1 -1
  28. package/dist/test-utils/seedTestWallet.d.ts +1 -1
  29. package/dist/test-utils/seedTestWallet.d.ts.map +1 -1
  30. package/dist/test-utils.global.js +126 -432
  31. package/dist/test-utils.global.js.map +1 -1
  32. package/dist/test-utils.js +427 -642
  33. package/dist/test-utils.js.map +1 -1
  34. package/dist/test-utils.mjs +252 -463
  35. package/dist/test-utils.mjs.map +1 -1
  36. package/dist/wallet/base-wallet-unlocked.d.ts +2 -2
  37. package/dist/wallet/base-wallet-unlocked.d.ts.map +1 -1
  38. package/package.json +15 -16
  39. package/dist/test-utils/asset-id.d.ts +0 -8
  40. package/dist/test-utils/asset-id.d.ts.map +0 -1
  41. package/dist/test-utils/setup-test-provider-and-wallets.d.ts +0 -33
  42. package/dist/test-utils/setup-test-provider-and-wallets.d.ts.map +0 -1
  43. package/dist/test-utils/test-message.d.ts +0 -28
  44. package/dist/test-utils/test-message.d.ts.map +0 -1
  45. package/dist/test-utils/wallet-config.d.ts +0 -49
  46. package/dist/test-utils/wallet-config.d.ts.map +0 -1
@@ -48,28 +48,24 @@ var __privateMethod = (obj, member, method) => {
48
48
  // src/test-utils/index.ts
49
49
  var test_utils_exports = {};
50
50
  __export(test_utils_exports, {
51
- AssetId: () => AssetId,
52
- TestMessage: () => TestMessage,
53
- WalletConfig: () => WalletConfig,
54
51
  generateTestWallet: () => generateTestWallet,
55
52
  killNode: () => killNode,
56
53
  launchNode: () => launchNode,
57
54
  launchNodeAndGetWallets: () => launchNodeAndGetWallets,
58
- seedTestWallet: () => seedTestWallet,
59
- setupTestProviderAndWallets: () => setupTestProviderAndWallets
55
+ seedTestWallet: () => seedTestWallet
60
56
  });
61
57
  module.exports = __toCommonJS(test_utils_exports);
62
58
 
63
59
  // src/wallet/base-wallet-unlocked.ts
64
60
  var import_hasher3 = require("@fuel-ts/hasher");
65
- var import_utils32 = require("@fuel-ts/utils");
61
+ var import_utils31 = require("@fuel-ts/utils");
66
62
 
67
63
  // src/account.ts
68
64
  var import_address4 = require("@fuel-ts/address");
69
65
  var import_errors16 = require("@fuel-ts/errors");
70
66
  var import_interfaces = require("@fuel-ts/interfaces");
71
67
  var import_math21 = require("@fuel-ts/math");
72
- var import_utils29 = require("@fuel-ts/utils");
68
+ var import_utils28 = require("@fuel-ts/utils");
73
69
  var import_ramda4 = require("ramda");
74
70
 
75
71
  // src/providers/coin-quantity.ts
@@ -110,11 +106,11 @@ var addAmountToCoinQuantities = (params) => {
110
106
  // src/providers/provider.ts
111
107
  var import_address3 = require("@fuel-ts/address");
112
108
  var import_errors14 = require("@fuel-ts/errors");
113
- var import_math17 = require("@fuel-ts/math");
114
- var import_transactions19 = require("@fuel-ts/transactions");
115
- var import_utils23 = require("@fuel-ts/utils");
109
+ var import_math18 = require("@fuel-ts/math");
110
+ var import_transactions20 = require("@fuel-ts/transactions");
111
+ var import_utils22 = require("@fuel-ts/utils");
116
112
  var import_versions = require("@fuel-ts/versions");
117
- var import_utils24 = require("@noble/curves/abstract/utils");
113
+ var import_utils23 = require("@noble/curves/abstract/utils");
118
114
  var import_graphql_request = require("graphql-request");
119
115
  var import_ramda3 = require("ramda");
120
116
 
@@ -1328,8 +1324,8 @@ var import_abi_coder2 = require("@fuel-ts/abi-coder");
1328
1324
  var import_address = require("@fuel-ts/address");
1329
1325
  var import_configs6 = require("@fuel-ts/address/configs");
1330
1326
  var import_crypto = require("@fuel-ts/crypto");
1331
- var import_math7 = require("@fuel-ts/math");
1332
- var import_transactions6 = require("@fuel-ts/transactions");
1327
+ var import_math8 = require("@fuel-ts/math");
1328
+ var import_transactions7 = require("@fuel-ts/transactions");
1333
1329
  var import_utils9 = require("@fuel-ts/utils");
1334
1330
 
1335
1331
  // src/providers/resource.ts
@@ -1671,6 +1667,15 @@ function normalizeJSON(root) {
1671
1667
  return normalize((0, import_ramda.clone)(root));
1672
1668
  }
1673
1669
 
1670
+ // src/providers/utils/sleep.ts
1671
+ function sleep(time) {
1672
+ return new Promise((resolve) => {
1673
+ setTimeout(() => {
1674
+ resolve(true);
1675
+ }, time);
1676
+ });
1677
+ }
1678
+
1674
1679
  // src/providers/utils/extract-tx-error.ts
1675
1680
  var import_errors7 = require("@fuel-ts/errors");
1676
1681
  var import_math6 = require("@fuel-ts/math");
@@ -1753,6 +1758,36 @@ var NoWitnessAtIndexError = class extends Error {
1753
1758
  name = "NoWitnessAtIndexError";
1754
1759
  };
1755
1760
 
1761
+ // src/providers/transaction-request/helpers.ts
1762
+ var import_math7 = require("@fuel-ts/math");
1763
+ var import_transactions6 = require("@fuel-ts/transactions");
1764
+ var isRequestInputCoin = (input) => input.type === import_transactions6.InputType.Coin;
1765
+ var isRequestInputMessage = (input) => input.type === import_transactions6.InputType.Message;
1766
+ var isRequestInputResource = (input) => isRequestInputCoin(input) || isRequestInputMessage(input);
1767
+ var getAssetAmountInRequestInputs = (inputs, assetId, baseAsset) => inputs.filter(isRequestInputResource).reduce((acc, input) => {
1768
+ if (isRequestInputCoin(input) && input.assetId === assetId) {
1769
+ return acc.add(input.amount);
1770
+ }
1771
+ if (isRequestInputMessage(input) && assetId === baseAsset) {
1772
+ return acc.add(input.amount);
1773
+ }
1774
+ return acc;
1775
+ }, (0, import_math7.bn)(0));
1776
+ var cacheRequestInputsResourcesFromOwner = (inputs, owner) => inputs.reduce(
1777
+ (acc, input) => {
1778
+ if (isRequestInputCoin(input) && input.owner === owner.toB256()) {
1779
+ acc.utxos.push(input.id);
1780
+ } else if (isRequestInputMessage(input) && input.recipient === owner.toB256()) {
1781
+ acc.messages.push(input.nonce);
1782
+ }
1783
+ return acc;
1784
+ },
1785
+ {
1786
+ utxos: [],
1787
+ messages: []
1788
+ }
1789
+ );
1790
+
1756
1791
  // src/providers/transaction-request/witness.ts
1757
1792
  var import_utils8 = require("@fuel-ts/utils");
1758
1793
  var witnessify = (value) => {
@@ -1793,10 +1828,10 @@ var BaseTransactionRequest = class {
1793
1828
  outputs,
1794
1829
  witnesses
1795
1830
  } = {}) {
1796
- this.tip = tip ? (0, import_math7.bn)(tip) : void 0;
1831
+ this.tip = tip ? (0, import_math8.bn)(tip) : void 0;
1797
1832
  this.maturity = maturity && maturity > 0 ? maturity : void 0;
1798
- this.witnessLimit = (0, import_utils9.isDefined)(witnessLimit) ? (0, import_math7.bn)(witnessLimit) : void 0;
1799
- this.maxFee = (0, import_math7.bn)(maxFee);
1833
+ this.witnessLimit = (0, import_utils9.isDefined)(witnessLimit) ? (0, import_math8.bn)(witnessLimit) : void 0;
1834
+ this.maxFee = (0, import_math8.bn)(maxFee);
1800
1835
  this.inputs = inputs ?? [];
1801
1836
  this.outputs = outputs ?? [];
1802
1837
  this.witnesses = witnesses ?? [];
@@ -1805,20 +1840,20 @@ var BaseTransactionRequest = class {
1805
1840
  let policyTypes = 0;
1806
1841
  const policies = [];
1807
1842
  const { tip, witnessLimit, maturity } = req;
1808
- if ((0, import_math7.bn)(tip).gt(0)) {
1809
- policyTypes += import_transactions6.PolicyType.Tip;
1810
- policies.push({ data: (0, import_math7.bn)(tip), type: import_transactions6.PolicyType.Tip });
1843
+ if ((0, import_math8.bn)(tip).gt(0)) {
1844
+ policyTypes += import_transactions7.PolicyType.Tip;
1845
+ policies.push({ data: (0, import_math8.bn)(tip), type: import_transactions7.PolicyType.Tip });
1811
1846
  }
1812
- if ((0, import_utils9.isDefined)(witnessLimit) && (0, import_math7.bn)(witnessLimit).gte(0)) {
1813
- policyTypes += import_transactions6.PolicyType.WitnessLimit;
1814
- policies.push({ data: (0, import_math7.bn)(witnessLimit), type: import_transactions6.PolicyType.WitnessLimit });
1847
+ if ((0, import_utils9.isDefined)(witnessLimit) && (0, import_math8.bn)(witnessLimit).gte(0)) {
1848
+ policyTypes += import_transactions7.PolicyType.WitnessLimit;
1849
+ policies.push({ data: (0, import_math8.bn)(witnessLimit), type: import_transactions7.PolicyType.WitnessLimit });
1815
1850
  }
1816
1851
  if (maturity && maturity > 0) {
1817
- policyTypes += import_transactions6.PolicyType.Maturity;
1818
- policies.push({ data: maturity, type: import_transactions6.PolicyType.Maturity });
1852
+ policyTypes += import_transactions7.PolicyType.Maturity;
1853
+ policies.push({ data: maturity, type: import_transactions7.PolicyType.Maturity });
1819
1854
  }
1820
- policyTypes += import_transactions6.PolicyType.MaxFee;
1821
- policies.push({ data: req.maxFee, type: import_transactions6.PolicyType.MaxFee });
1855
+ policyTypes += import_transactions7.PolicyType.MaxFee;
1856
+ policies.push({ data: req.maxFee, type: import_transactions7.PolicyType.MaxFee });
1822
1857
  return {
1823
1858
  policyTypes,
1824
1859
  policies
@@ -1851,7 +1886,7 @@ var BaseTransactionRequest = class {
1851
1886
  * @returns The transaction bytes.
1852
1887
  */
1853
1888
  toTransactionBytes() {
1854
- return new import_transactions6.TransactionCoder().encode(this.toTransaction());
1889
+ return new import_transactions7.TransactionCoder().encode(this.toTransaction());
1855
1890
  }
1856
1891
  /**
1857
1892
  * @hidden
@@ -1942,7 +1977,7 @@ var BaseTransactionRequest = class {
1942
1977
  */
1943
1978
  getCoinInputs() {
1944
1979
  return this.inputs.filter(
1945
- (input) => input.type === import_transactions6.InputType.Coin
1980
+ (input) => input.type === import_transactions7.InputType.Coin
1946
1981
  );
1947
1982
  }
1948
1983
  /**
@@ -1952,7 +1987,7 @@ var BaseTransactionRequest = class {
1952
1987
  */
1953
1988
  getCoinOutputs() {
1954
1989
  return this.outputs.filter(
1955
- (output) => output.type === import_transactions6.OutputType.Coin
1990
+ (output) => output.type === import_transactions7.OutputType.Coin
1956
1991
  );
1957
1992
  }
1958
1993
  /**
@@ -1962,7 +1997,7 @@ var BaseTransactionRequest = class {
1962
1997
  */
1963
1998
  getChangeOutputs() {
1964
1999
  return this.outputs.filter(
1965
- (output) => output.type === import_transactions6.OutputType.Change
2000
+ (output) => output.type === import_transactions7.OutputType.Change
1966
2001
  );
1967
2002
  }
1968
2003
  /**
@@ -1974,9 +2009,9 @@ var BaseTransactionRequest = class {
1974
2009
  const ownerAddress = (0, import_address.addressify)(owner);
1975
2010
  const found = this.inputs.find((input) => {
1976
2011
  switch (input.type) {
1977
- case import_transactions6.InputType.Coin:
2012
+ case import_transactions7.InputType.Coin:
1978
2013
  return (0, import_utils9.hexlify)(input.owner) === ownerAddress.toB256();
1979
- case import_transactions6.InputType.Message:
2014
+ case import_transactions7.InputType.Message:
1980
2015
  return (0, import_utils9.hexlify)(input.recipient) === ownerAddress.toB256();
1981
2016
  default:
1982
2017
  return false;
@@ -1991,7 +2026,7 @@ var BaseTransactionRequest = class {
1991
2026
  * @param coin - Coin resource.
1992
2027
  */
1993
2028
  addCoinInput(coin) {
1994
- const { assetId, owner, amount } = coin;
2029
+ const { assetId, owner, amount, id, predicate } = coin;
1995
2030
  let witnessIndex;
1996
2031
  if (coin.predicate) {
1997
2032
  witnessIndex = 0;
@@ -2002,13 +2037,14 @@ var BaseTransactionRequest = class {
2002
2037
  }
2003
2038
  }
2004
2039
  const input = {
2005
- ...coin,
2006
- type: import_transactions6.InputType.Coin,
2040
+ id,
2041
+ type: import_transactions7.InputType.Coin,
2007
2042
  owner: owner.toB256(),
2008
2043
  amount,
2009
2044
  assetId,
2010
2045
  txPointer: "0x00000000000000000000000000000000",
2011
- witnessIndex
2046
+ witnessIndex,
2047
+ predicate
2012
2048
  };
2013
2049
  this.pushInput(input);
2014
2050
  this.addChangeOutput(owner, assetId);
@@ -2020,7 +2056,7 @@ var BaseTransactionRequest = class {
2020
2056
  * @param message - Message resource.
2021
2057
  */
2022
2058
  addMessageInput(message) {
2023
- const { recipient, sender, amount, assetId } = message;
2059
+ const { recipient, sender, amount, predicate, nonce, assetId } = message;
2024
2060
  let witnessIndex;
2025
2061
  if (message.predicate) {
2026
2062
  witnessIndex = 0;
@@ -2031,12 +2067,13 @@ var BaseTransactionRequest = class {
2031
2067
  }
2032
2068
  }
2033
2069
  const input = {
2034
- ...message,
2035
- type: import_transactions6.InputType.Message,
2070
+ nonce,
2071
+ type: import_transactions7.InputType.Message,
2036
2072
  sender: sender.toB256(),
2037
2073
  recipient: recipient.toB256(),
2038
2074
  amount,
2039
- witnessIndex
2075
+ witnessIndex,
2076
+ predicate
2040
2077
  };
2041
2078
  this.pushInput(input);
2042
2079
  this.addChangeOutput(recipient, assetId);
@@ -2076,7 +2113,7 @@ var BaseTransactionRequest = class {
2076
2113
  */
2077
2114
  addCoinOutput(to, amount, assetId) {
2078
2115
  this.pushOutput({
2079
- type: import_transactions6.OutputType.Coin,
2116
+ type: import_transactions7.OutputType.Coin,
2080
2117
  to: (0, import_address.addressify)(to).toB256(),
2081
2118
  amount,
2082
2119
  assetId
@@ -2092,7 +2129,7 @@ var BaseTransactionRequest = class {
2092
2129
  addCoinOutputs(to, quantities) {
2093
2130
  quantities.map(coinQuantityfy).forEach((quantity) => {
2094
2131
  this.pushOutput({
2095
- type: import_transactions6.OutputType.Coin,
2132
+ type: import_transactions7.OutputType.Coin,
2096
2133
  to: (0, import_address.addressify)(to).toB256(),
2097
2134
  amount: quantity.amount,
2098
2135
  assetId: quantity.assetId
@@ -2112,7 +2149,7 @@ var BaseTransactionRequest = class {
2112
2149
  );
2113
2150
  if (!changeOutput) {
2114
2151
  this.pushOutput({
2115
- type: import_transactions6.OutputType.Change,
2152
+ type: import_transactions7.OutputType.Change,
2116
2153
  to: (0, import_address.addressify)(to).toB256(),
2117
2154
  assetId
2118
2155
  });
@@ -2183,7 +2220,7 @@ var BaseTransactionRequest = class {
2183
2220
  const assetInput = findAssetInput(assetId);
2184
2221
  let usedQuantity = quantity;
2185
2222
  if (assetId === baseAssetId) {
2186
- usedQuantity = (0, import_math7.bn)("1000000000000000000");
2223
+ usedQuantity = (0, import_math8.bn)("1000000000000000000");
2187
2224
  }
2188
2225
  if (assetInput && "assetId" in assetInput) {
2189
2226
  assetInput.id = (0, import_utils9.hexlify)((0, import_crypto.randomBytes)(import_abi_coder2.UTXO_ID_LEN));
@@ -2195,13 +2232,13 @@ var BaseTransactionRequest = class {
2195
2232
  amount: usedQuantity,
2196
2233
  assetId,
2197
2234
  owner: resourcesOwner || import_address.Address.fromRandom(),
2198
- blockCreated: (0, import_math7.bn)(1),
2199
- txCreatedIdx: (0, import_math7.bn)(1)
2235
+ blockCreated: (0, import_math8.bn)(1),
2236
+ txCreatedIdx: (0, import_math8.bn)(1)
2200
2237
  }
2201
2238
  ]);
2202
2239
  }
2203
2240
  };
2204
- updateAssetInput(baseAssetId, (0, import_math7.bn)(1e11));
2241
+ updateAssetInput(baseAssetId, (0, import_math8.bn)(1e11));
2205
2242
  quantities.forEach((q) => updateAssetInput(q.assetId, q.amount));
2206
2243
  }
2207
2244
  /**
@@ -2212,7 +2249,7 @@ var BaseTransactionRequest = class {
2212
2249
  */
2213
2250
  getCoinOutputsQuantities() {
2214
2251
  const coinsQuantities = this.getCoinOutputs().map(({ amount, assetId }) => ({
2215
- amount: (0, import_math7.bn)(amount),
2252
+ amount: (0, import_math8.bn)(amount),
2216
2253
  assetId: assetId.toString()
2217
2254
  }));
2218
2255
  return coinsQuantities;
@@ -2226,22 +2263,33 @@ var BaseTransactionRequest = class {
2226
2263
  toJSON() {
2227
2264
  return normalizeJSON(this);
2228
2265
  }
2266
+ removeWitness(index) {
2267
+ this.witnesses.splice(index, 1);
2268
+ this.adjustWitnessIndexes(index);
2269
+ }
2270
+ adjustWitnessIndexes(removedIndex) {
2271
+ this.inputs.filter(isRequestInputResource).forEach((input) => {
2272
+ if (input.witnessIndex > removedIndex) {
2273
+ input.witnessIndex -= 1;
2274
+ }
2275
+ });
2276
+ }
2229
2277
  updatePredicateGasUsed(inputs) {
2230
2278
  this.inputs.forEach((i) => {
2231
2279
  let correspondingInput;
2232
2280
  switch (i.type) {
2233
- case import_transactions6.InputType.Coin:
2234
- correspondingInput = inputs.find((x) => x.type === import_transactions6.InputType.Coin && x.owner === i.owner);
2281
+ case import_transactions7.InputType.Coin:
2282
+ correspondingInput = inputs.find((x) => x.type === import_transactions7.InputType.Coin && x.owner === i.owner);
2235
2283
  break;
2236
- case import_transactions6.InputType.Message:
2284
+ case import_transactions7.InputType.Message:
2237
2285
  correspondingInput = inputs.find(
2238
- (x) => x.type === import_transactions6.InputType.Message && x.sender === i.sender
2286
+ (x) => x.type === import_transactions7.InputType.Message && x.sender === i.sender
2239
2287
  );
2240
2288
  break;
2241
2289
  default:
2242
2290
  return;
2243
2291
  }
2244
- if (correspondingInput && "predicateGasUsed" in correspondingInput && (0, import_math7.bn)(correspondingInput.predicateGasUsed).gt(0)) {
2292
+ if (correspondingInput && "predicateGasUsed" in correspondingInput && (0, import_math8.bn)(correspondingInput.predicateGasUsed).gt(0)) {
2245
2293
  i.predicate = correspondingInput.predicate;
2246
2294
  i.predicateData = correspondingInput.predicateData;
2247
2295
  i.predicateGasUsed = correspondingInput.predicateGasUsed;
@@ -2261,38 +2309,38 @@ var BaseTransactionRequest = class {
2261
2309
 
2262
2310
  // src/providers/transaction-request/create-transaction-request.ts
2263
2311
  var import_configs8 = require("@fuel-ts/address/configs");
2264
- var import_math9 = require("@fuel-ts/math");
2265
- var import_transactions8 = require("@fuel-ts/transactions");
2312
+ var import_math10 = require("@fuel-ts/math");
2313
+ var import_transactions9 = require("@fuel-ts/transactions");
2266
2314
  var import_utils13 = require("@fuel-ts/utils");
2267
2315
 
2268
2316
  // src/providers/transaction-request/hash-transaction.ts
2269
2317
  var import_configs7 = require("@fuel-ts/address/configs");
2270
2318
  var import_hasher = require("@fuel-ts/hasher");
2271
- var import_math8 = require("@fuel-ts/math");
2272
- var import_transactions7 = require("@fuel-ts/transactions");
2319
+ var import_math9 = require("@fuel-ts/math");
2320
+ var import_transactions8 = require("@fuel-ts/transactions");
2273
2321
  var import_utils11 = require("@fuel-ts/utils");
2274
2322
  var import_ramda2 = require("ramda");
2275
2323
  function hashTransaction(transactionRequest, chainId) {
2276
2324
  const transaction = transactionRequest.toTransaction();
2277
- if (transaction.type === import_transactions7.TransactionType.Script) {
2325
+ if (transaction.type === import_transactions8.TransactionType.Script) {
2278
2326
  transaction.receiptsRoot = import_configs7.ZeroBytes32;
2279
2327
  }
2280
2328
  transaction.inputs = transaction.inputs.map((input) => {
2281
2329
  const inputClone = (0, import_ramda2.clone)(input);
2282
2330
  switch (inputClone.type) {
2283
- case import_transactions7.InputType.Coin: {
2331
+ case import_transactions8.InputType.Coin: {
2284
2332
  inputClone.txPointer = {
2285
2333
  blockHeight: 0,
2286
2334
  txIndex: 0
2287
2335
  };
2288
- inputClone.predicateGasUsed = (0, import_math8.bn)(0);
2336
+ inputClone.predicateGasUsed = (0, import_math9.bn)(0);
2289
2337
  return inputClone;
2290
2338
  }
2291
- case import_transactions7.InputType.Message: {
2292
- inputClone.predicateGasUsed = (0, import_math8.bn)(0);
2339
+ case import_transactions8.InputType.Message: {
2340
+ inputClone.predicateGasUsed = (0, import_math9.bn)(0);
2293
2341
  return inputClone;
2294
2342
  }
2295
- case import_transactions7.InputType.Contract: {
2343
+ case import_transactions8.InputType.Contract: {
2296
2344
  inputClone.txPointer = {
2297
2345
  blockHeight: 0,
2298
2346
  txIndex: 0
@@ -2310,18 +2358,18 @@ function hashTransaction(transactionRequest, chainId) {
2310
2358
  transaction.outputs = transaction.outputs.map((output) => {
2311
2359
  const outputClone = (0, import_ramda2.clone)(output);
2312
2360
  switch (outputClone.type) {
2313
- case import_transactions7.OutputType.Contract: {
2361
+ case import_transactions8.OutputType.Contract: {
2314
2362
  outputClone.balanceRoot = import_configs7.ZeroBytes32;
2315
2363
  outputClone.stateRoot = import_configs7.ZeroBytes32;
2316
2364
  return outputClone;
2317
2365
  }
2318
- case import_transactions7.OutputType.Change: {
2319
- outputClone.amount = (0, import_math8.bn)(0);
2366
+ case import_transactions8.OutputType.Change: {
2367
+ outputClone.amount = (0, import_math9.bn)(0);
2320
2368
  return outputClone;
2321
2369
  }
2322
- case import_transactions7.OutputType.Variable: {
2370
+ case import_transactions8.OutputType.Variable: {
2323
2371
  outputClone.to = import_configs7.ZeroBytes32;
2324
- outputClone.amount = (0, import_math8.bn)(0);
2372
+ outputClone.amount = (0, import_math9.bn)(0);
2325
2373
  outputClone.assetId = import_configs7.ZeroBytes32;
2326
2374
  return outputClone;
2327
2375
  }
@@ -2332,7 +2380,7 @@ function hashTransaction(transactionRequest, chainId) {
2332
2380
  transaction.witnessesCount = 0;
2333
2381
  transaction.witnesses = [];
2334
2382
  const chainIdBytes = (0, import_hasher.uint64ToBytesBE)(chainId);
2335
- const concatenatedData = (0, import_utils11.concat)([chainIdBytes, new import_transactions7.TransactionCoder().encode(transaction)]);
2383
+ const concatenatedData = (0, import_utils11.concat)([chainIdBytes, new import_transactions8.TransactionCoder().encode(transaction)]);
2336
2384
  return (0, import_hasher.sha256)(concatenatedData);
2337
2385
  }
2338
2386
 
@@ -2368,7 +2416,7 @@ var CreateTransactionRequest = class extends BaseTransactionRequest {
2368
2416
  return new this(obj);
2369
2417
  }
2370
2418
  /** Type of the transaction */
2371
- type = import_transactions8.TransactionType.Create;
2419
+ type = import_transactions9.TransactionType.Create;
2372
2420
  /** Witness index of contract bytecode to create */
2373
2421
  bytecodeWitnessIndex;
2374
2422
  /** Salt */
@@ -2396,10 +2444,10 @@ var CreateTransactionRequest = class extends BaseTransactionRequest {
2396
2444
  const bytecodeWitnessIndex = this.bytecodeWitnessIndex;
2397
2445
  const storageSlots = this.storageSlots?.map(storageSlotify) ?? [];
2398
2446
  return {
2399
- type: import_transactions8.TransactionType.Create,
2447
+ type: import_transactions9.TransactionType.Create,
2400
2448
  ...baseTransaction,
2401
2449
  bytecodeWitnessIndex,
2402
- storageSlotsCount: (0, import_math9.bn)(storageSlots.length),
2450
+ storageSlotsCount: (0, import_math10.bn)(storageSlots.length),
2403
2451
  salt: this.salt ? (0, import_utils13.hexlify)(this.salt) : import_configs8.ZeroBytes32,
2404
2452
  storageSlots
2405
2453
  };
@@ -2411,7 +2459,7 @@ var CreateTransactionRequest = class extends BaseTransactionRequest {
2411
2459
  */
2412
2460
  getContractCreatedOutputs() {
2413
2461
  return this.outputs.filter(
2414
- (output) => output.type === import_transactions8.OutputType.ContractCreated
2462
+ (output) => output.type === import_transactions9.OutputType.ContractCreated
2415
2463
  );
2416
2464
  }
2417
2465
  /**
@@ -2432,14 +2480,14 @@ var CreateTransactionRequest = class extends BaseTransactionRequest {
2432
2480
  */
2433
2481
  addContractCreatedOutput(contractId, stateRoot) {
2434
2482
  this.pushOutput({
2435
- type: import_transactions8.OutputType.ContractCreated,
2483
+ type: import_transactions9.OutputType.ContractCreated,
2436
2484
  contractId,
2437
2485
  stateRoot
2438
2486
  });
2439
2487
  }
2440
2488
  metadataGas(gasCosts) {
2441
2489
  return calculateMetadataGasForTxCreate({
2442
- contractBytesSize: (0, import_math9.bn)((0, import_utils13.arrayify)(this.witnesses[this.bytecodeWitnessIndex] || "0x").length),
2490
+ contractBytesSize: (0, import_math10.bn)((0, import_utils13.arrayify)(this.witnesses[this.bytecodeWitnessIndex] || "0x").length),
2443
2491
  gasCosts,
2444
2492
  stateRootSize: this.storageSlots.length,
2445
2493
  txBytesSize: this.byteSize()
@@ -2451,8 +2499,8 @@ var CreateTransactionRequest = class extends BaseTransactionRequest {
2451
2499
  var import_abi_coder3 = require("@fuel-ts/abi-coder");
2452
2500
  var import_address2 = require("@fuel-ts/address");
2453
2501
  var import_configs9 = require("@fuel-ts/address/configs");
2454
- var import_math10 = require("@fuel-ts/math");
2455
- var import_transactions9 = require("@fuel-ts/transactions");
2502
+ var import_math11 = require("@fuel-ts/math");
2503
+ var import_transactions10 = require("@fuel-ts/transactions");
2456
2504
  var import_utils15 = require("@fuel-ts/utils");
2457
2505
 
2458
2506
  // src/providers/transaction-request/scripts.ts
@@ -2490,7 +2538,7 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
2490
2538
  return new this(obj);
2491
2539
  }
2492
2540
  /** Type of the transaction */
2493
- type = import_transactions9.TransactionType.Script;
2541
+ type = import_transactions10.TransactionType.Script;
2494
2542
  /** Gas limit for transaction */
2495
2543
  gasLimit;
2496
2544
  /** Script to execute */
@@ -2505,7 +2553,7 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
2505
2553
  */
2506
2554
  constructor({ script, scriptData, gasLimit, ...rest } = {}) {
2507
2555
  super(rest);
2508
- this.gasLimit = (0, import_math10.bn)(gasLimit);
2556
+ this.gasLimit = (0, import_math11.bn)(gasLimit);
2509
2557
  this.script = (0, import_utils15.arrayify)(script ?? returnZeroScript.bytes);
2510
2558
  this.scriptData = (0, import_utils15.arrayify)(scriptData ?? returnZeroScript.encodeScriptData());
2511
2559
  this.abis = rest.abis;
@@ -2519,11 +2567,11 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
2519
2567
  const script = (0, import_utils15.arrayify)(this.script ?? "0x");
2520
2568
  const scriptData = (0, import_utils15.arrayify)(this.scriptData ?? "0x");
2521
2569
  return {
2522
- type: import_transactions9.TransactionType.Script,
2570
+ type: import_transactions10.TransactionType.Script,
2523
2571
  scriptGasLimit: this.gasLimit,
2524
2572
  ...super.getBaseTransaction(),
2525
- scriptLength: (0, import_math10.bn)(script.length),
2526
- scriptDataLength: (0, import_math10.bn)(scriptData.length),
2573
+ scriptLength: (0, import_math11.bn)(script.length),
2574
+ scriptDataLength: (0, import_math11.bn)(scriptData.length),
2527
2575
  receiptsRoot: import_configs9.ZeroBytes32,
2528
2576
  script: (0, import_utils15.hexlify)(script),
2529
2577
  scriptData: (0, import_utils15.hexlify)(scriptData)
@@ -2536,7 +2584,7 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
2536
2584
  */
2537
2585
  getContractInputs() {
2538
2586
  return this.inputs.filter(
2539
- (input) => input.type === import_transactions9.InputType.Contract
2587
+ (input) => input.type === import_transactions10.InputType.Contract
2540
2588
  );
2541
2589
  }
2542
2590
  /**
@@ -2546,7 +2594,7 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
2546
2594
  */
2547
2595
  getContractOutputs() {
2548
2596
  return this.outputs.filter(
2549
- (output) => output.type === import_transactions9.OutputType.Contract
2597
+ (output) => output.type === import_transactions10.OutputType.Contract
2550
2598
  );
2551
2599
  }
2552
2600
  /**
@@ -2556,7 +2604,7 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
2556
2604
  */
2557
2605
  getVariableOutputs() {
2558
2606
  return this.outputs.filter(
2559
- (output) => output.type === import_transactions9.OutputType.Variable
2607
+ (output) => output.type === import_transactions10.OutputType.Variable
2560
2608
  );
2561
2609
  }
2562
2610
  /**
@@ -2579,7 +2627,7 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
2579
2627
  let outputsNumber = numberOfVariables;
2580
2628
  while (outputsNumber) {
2581
2629
  this.pushOutput({
2582
- type: import_transactions9.OutputType.Variable
2630
+ type: import_transactions10.OutputType.Variable
2583
2631
  });
2584
2632
  outputsNumber -= 1;
2585
2633
  }
@@ -2616,12 +2664,12 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
2616
2664
  return this;
2617
2665
  }
2618
2666
  const inputIndex = super.pushInput({
2619
- type: import_transactions9.InputType.Contract,
2667
+ type: import_transactions10.InputType.Contract,
2620
2668
  contractId: contractAddress.toB256(),
2621
2669
  txPointer: "0x00000000000000000000000000000000"
2622
2670
  });
2623
2671
  this.pushOutput({
2624
- type: import_transactions9.OutputType.Contract,
2672
+ type: import_transactions10.OutputType.Contract,
2625
2673
  inputIndex
2626
2674
  });
2627
2675
  return this;
@@ -2658,17 +2706,17 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
2658
2706
 
2659
2707
  // src/providers/transaction-request/utils.ts
2660
2708
  var import_errors9 = require("@fuel-ts/errors");
2661
- var import_transactions10 = require("@fuel-ts/transactions");
2709
+ var import_transactions11 = require("@fuel-ts/transactions");
2662
2710
  var transactionRequestify = (obj) => {
2663
2711
  if (obj instanceof ScriptTransactionRequest || obj instanceof CreateTransactionRequest) {
2664
2712
  return obj;
2665
2713
  }
2666
2714
  const { type } = obj;
2667
2715
  switch (obj.type) {
2668
- case import_transactions10.TransactionType.Script: {
2716
+ case import_transactions11.TransactionType.Script: {
2669
2717
  return ScriptTransactionRequest.from(obj);
2670
2718
  }
2671
- case import_transactions10.TransactionType.Create: {
2719
+ case import_transactions11.TransactionType.Create: {
2672
2720
  return CreateTransactionRequest.from(obj);
2673
2721
  }
2674
2722
  default: {
@@ -2676,36 +2724,21 @@ var transactionRequestify = (obj) => {
2676
2724
  }
2677
2725
  }
2678
2726
  };
2679
- var cacheTxInputsFromOwner = (inputs, owner) => inputs.reduce(
2680
- (acc, input) => {
2681
- if (input.type === import_transactions10.InputType.Coin && input.owner === owner.toB256()) {
2682
- acc.utxos.push(input.id);
2683
- }
2684
- if (input.type === import_transactions10.InputType.Message && input.recipient === owner.toB256()) {
2685
- acc.messages.push(input.nonce);
2686
- }
2687
- return acc;
2688
- },
2689
- {
2690
- utxos: [],
2691
- messages: []
2692
- }
2693
- );
2694
2727
 
2695
2728
  // src/providers/transaction-response/transaction-response.ts
2696
2729
  var import_errors13 = require("@fuel-ts/errors");
2697
- var import_math16 = require("@fuel-ts/math");
2698
- var import_transactions18 = require("@fuel-ts/transactions");
2730
+ var import_math17 = require("@fuel-ts/math");
2731
+ var import_transactions19 = require("@fuel-ts/transactions");
2699
2732
  var import_utils20 = require("@fuel-ts/utils");
2700
2733
 
2701
2734
  // src/providers/transaction-summary/assemble-transaction-summary.ts
2702
- var import_math15 = require("@fuel-ts/math");
2703
- var import_transactions16 = require("@fuel-ts/transactions");
2735
+ var import_math16 = require("@fuel-ts/math");
2736
+ var import_transactions17 = require("@fuel-ts/transactions");
2704
2737
  var import_utils18 = require("@fuel-ts/utils");
2705
2738
 
2706
2739
  // src/providers/transaction-summary/calculate-tx-fee-for-summary.ts
2707
- var import_math11 = require("@fuel-ts/math");
2708
- var import_transactions11 = require("@fuel-ts/transactions");
2740
+ var import_math12 = require("@fuel-ts/math");
2741
+ var import_transactions12 = require("@fuel-ts/transactions");
2709
2742
  var import_utils16 = require("@fuel-ts/utils");
2710
2743
  var calculateTXFeeForSummary = (params) => {
2711
2744
  const {
@@ -2718,19 +2751,19 @@ var calculateTXFeeForSummary = (params) => {
2718
2751
  if (totalFee) {
2719
2752
  return totalFee;
2720
2753
  }
2721
- const gasPerByte = (0, import_math11.bn)(feeParams.gasPerByte);
2722
- const gasPriceFactor = (0, import_math11.bn)(feeParams.gasPriceFactor);
2754
+ const gasPerByte = (0, import_math12.bn)(feeParams.gasPerByte);
2755
+ const gasPriceFactor = (0, import_math12.bn)(feeParams.gasPriceFactor);
2723
2756
  const transactionBytes = (0, import_utils16.arrayify)(rawPayload);
2724
- const [transaction] = new import_transactions11.TransactionCoder().decode(transactionBytes, 0);
2757
+ const [transaction] = new import_transactions12.TransactionCoder().decode(transactionBytes, 0);
2725
2758
  const { type, witnesses, inputs, policies } = transaction;
2726
- let metadataGas = (0, import_math11.bn)(0);
2727
- let gasLimit = (0, import_math11.bn)(0);
2728
- if (type !== import_transactions11.TransactionType.Create && type !== import_transactions11.TransactionType.Script) {
2729
- return (0, import_math11.bn)(0);
2759
+ let metadataGas = (0, import_math12.bn)(0);
2760
+ let gasLimit = (0, import_math12.bn)(0);
2761
+ if (type !== import_transactions12.TransactionType.Create && type !== import_transactions12.TransactionType.Script) {
2762
+ return (0, import_math12.bn)(0);
2730
2763
  }
2731
- if (type === import_transactions11.TransactionType.Create) {
2764
+ if (type === import_transactions12.TransactionType.Create) {
2732
2765
  const { bytecodeWitnessIndex, storageSlots } = transaction;
2733
- const contractBytesSize = (0, import_math11.bn)((0, import_utils16.arrayify)(witnesses[bytecodeWitnessIndex].data).length);
2766
+ const contractBytesSize = (0, import_math12.bn)((0, import_utils16.arrayify)(witnesses[bytecodeWitnessIndex].data).length);
2734
2767
  metadataGas = calculateMetadataGasForTxCreate({
2735
2768
  contractBytesSize,
2736
2769
  gasCosts,
@@ -2749,12 +2782,12 @@ var calculateTXFeeForSummary = (params) => {
2749
2782
  }
2750
2783
  const minGas = getMinGas({
2751
2784
  gasCosts,
2752
- gasPerByte: (0, import_math11.bn)(gasPerByte),
2785
+ gasPerByte: (0, import_math12.bn)(gasPerByte),
2753
2786
  inputs,
2754
2787
  metadataGas,
2755
2788
  txBytesSize: transactionBytes.length
2756
2789
  });
2757
- const witnessLimit = policies.find((policy) => policy.type === import_transactions11.PolicyType.WitnessLimit)?.data;
2790
+ const witnessLimit = policies.find((policy) => policy.type === import_transactions12.PolicyType.WitnessLimit)?.data;
2758
2791
  const witnessesLength = witnesses.reduce((acc, wit) => acc + wit.dataLength, 0);
2759
2792
  const maxGas = getMaxGas({
2760
2793
  gasPerByte,
@@ -2776,12 +2809,12 @@ var calculateTXFeeForSummary = (params) => {
2776
2809
  // src/providers/transaction-summary/operations.ts
2777
2810
  var import_configs10 = require("@fuel-ts/address/configs");
2778
2811
  var import_errors11 = require("@fuel-ts/errors");
2779
- var import_math13 = require("@fuel-ts/math");
2780
- var import_transactions14 = require("@fuel-ts/transactions");
2812
+ var import_math14 = require("@fuel-ts/math");
2813
+ var import_transactions15 = require("@fuel-ts/transactions");
2781
2814
 
2782
2815
  // src/providers/transaction-summary/call.ts
2783
2816
  var import_abi_coder4 = require("@fuel-ts/abi-coder");
2784
- var import_math12 = require("@fuel-ts/math");
2817
+ var import_math13 = require("@fuel-ts/math");
2785
2818
  var getFunctionCall = ({ abi, receipt, rawPayload, maxInputs }) => {
2786
2819
  const abiInterface = new import_abi_coder4.Interface(abi);
2787
2820
  const callFunctionSelector = receipt.param1.toHex(8);
@@ -2790,7 +2823,7 @@ var getFunctionCall = ({ abi, receipt, rawPayload, maxInputs }) => {
2790
2823
  let encodedArgs;
2791
2824
  if (functionFragment.isInputDataPointer) {
2792
2825
  if (rawPayload) {
2793
- const argsOffset = (0, import_math12.bn)(receipt.param2).sub((0, import_abi_coder4.calculateVmTxMemory)({ maxInputs: maxInputs.toNumber() })).toNumber();
2826
+ const argsOffset = (0, import_math13.bn)(receipt.param2).sub((0, import_abi_coder4.calculateVmTxMemory)({ maxInputs: maxInputs.toNumber() })).toNumber();
2794
2827
  encodedArgs = `0x${rawPayload.slice(2).slice(argsOffset * 2)}`;
2795
2828
  }
2796
2829
  } else {
@@ -2825,7 +2858,7 @@ var getFunctionCall = ({ abi, receipt, rawPayload, maxInputs }) => {
2825
2858
 
2826
2859
  // src/providers/transaction-summary/input.ts
2827
2860
  var import_errors10 = require("@fuel-ts/errors");
2828
- var import_transactions12 = require("@fuel-ts/transactions");
2861
+ var import_transactions13 = require("@fuel-ts/transactions");
2829
2862
  function getInputsByTypes(inputs, types) {
2830
2863
  return inputs.filter((i) => types.includes(i.type));
2831
2864
  }
@@ -2833,16 +2866,16 @@ function getInputsByType(inputs, type) {
2833
2866
  return inputs.filter((i) => i.type === type);
2834
2867
  }
2835
2868
  function getInputsCoin(inputs) {
2836
- return getInputsByType(inputs, import_transactions12.InputType.Coin);
2869
+ return getInputsByType(inputs, import_transactions13.InputType.Coin);
2837
2870
  }
2838
2871
  function getInputsMessage(inputs) {
2839
- return getInputsByType(inputs, import_transactions12.InputType.Message);
2872
+ return getInputsByType(inputs, import_transactions13.InputType.Message);
2840
2873
  }
2841
2874
  function getInputsCoinAndMessage(inputs) {
2842
- return getInputsByTypes(inputs, [import_transactions12.InputType.Coin, import_transactions12.InputType.Message]);
2875
+ return getInputsByTypes(inputs, [import_transactions13.InputType.Coin, import_transactions13.InputType.Message]);
2843
2876
  }
2844
2877
  function getInputsContract(inputs) {
2845
- return getInputsByType(inputs, import_transactions12.InputType.Contract);
2878
+ return getInputsByType(inputs, import_transactions13.InputType.Contract);
2846
2879
  }
2847
2880
  function getInputFromAssetId(inputs, assetId) {
2848
2881
  const coinInputs = getInputsCoin(inputs);
@@ -2861,7 +2894,7 @@ function getInputContractFromIndex(inputs, inputIndex) {
2861
2894
  if (!contractInput) {
2862
2895
  return void 0;
2863
2896
  }
2864
- if (contractInput.type !== import_transactions12.InputType.Contract) {
2897
+ if (contractInput.type !== import_transactions13.InputType.Contract) {
2865
2898
  throw new import_errors10.FuelError(
2866
2899
  import_errors10.ErrorCode.INVALID_TRANSACTION_INPUT,
2867
2900
  `Contract input should be of type 'contract'.`
@@ -2870,31 +2903,31 @@ function getInputContractFromIndex(inputs, inputIndex) {
2870
2903
  return contractInput;
2871
2904
  }
2872
2905
  function getInputAccountAddress(input) {
2873
- if (input.type === import_transactions12.InputType.Coin) {
2906
+ if (input.type === import_transactions13.InputType.Coin) {
2874
2907
  return input.owner.toString();
2875
2908
  }
2876
- if (input.type === import_transactions12.InputType.Message) {
2909
+ if (input.type === import_transactions13.InputType.Message) {
2877
2910
  return input.recipient.toString();
2878
2911
  }
2879
2912
  return "";
2880
2913
  }
2881
2914
 
2882
2915
  // src/providers/transaction-summary/output.ts
2883
- var import_transactions13 = require("@fuel-ts/transactions");
2916
+ var import_transactions14 = require("@fuel-ts/transactions");
2884
2917
  function getOutputsByType(outputs, type) {
2885
2918
  return outputs.filter((o) => o.type === type);
2886
2919
  }
2887
2920
  function getOutputsContractCreated(outputs) {
2888
- return getOutputsByType(outputs, import_transactions13.OutputType.ContractCreated);
2921
+ return getOutputsByType(outputs, import_transactions14.OutputType.ContractCreated);
2889
2922
  }
2890
2923
  function getOutputsCoin(outputs) {
2891
- return getOutputsByType(outputs, import_transactions13.OutputType.Coin);
2924
+ return getOutputsByType(outputs, import_transactions14.OutputType.Coin);
2892
2925
  }
2893
2926
  function getOutputsChange(outputs) {
2894
- return getOutputsByType(outputs, import_transactions13.OutputType.Change);
2927
+ return getOutputsByType(outputs, import_transactions14.OutputType.Change);
2895
2928
  }
2896
2929
  function getOutputsContract(outputs) {
2897
- return getOutputsByType(outputs, import_transactions13.OutputType.Contract);
2930
+ return getOutputsByType(outputs, import_transactions14.OutputType.Contract);
2898
2931
  }
2899
2932
 
2900
2933
  // src/providers/transaction-summary/operations.ts
@@ -2903,11 +2936,11 @@ function getReceiptsByType(receipts, type) {
2903
2936
  }
2904
2937
  function getTransactionTypeName(transactionType) {
2905
2938
  switch (transactionType) {
2906
- case import_transactions14.TransactionType.Mint:
2939
+ case import_transactions15.TransactionType.Mint:
2907
2940
  return "Mint" /* Mint */;
2908
- case import_transactions14.TransactionType.Create:
2941
+ case import_transactions15.TransactionType.Create:
2909
2942
  return "Create" /* Create */;
2910
- case import_transactions14.TransactionType.Script:
2943
+ case import_transactions15.TransactionType.Script:
2911
2944
  return "Script" /* Script */;
2912
2945
  default:
2913
2946
  throw new import_errors11.FuelError(
@@ -2936,10 +2969,10 @@ function isTypeUpload(transactionType) {
2936
2969
  return isType(transactionType, "Upload" /* Upload */);
2937
2970
  }
2938
2971
  function getReceiptsCall(receipts) {
2939
- return getReceiptsByType(receipts, import_transactions14.ReceiptType.Call);
2972
+ return getReceiptsByType(receipts, import_transactions15.ReceiptType.Call);
2940
2973
  }
2941
2974
  function getReceiptsMessageOut(receipts) {
2942
- return getReceiptsByType(receipts, import_transactions14.ReceiptType.MessageOut);
2975
+ return getReceiptsByType(receipts, import_transactions15.ReceiptType.MessageOut);
2943
2976
  }
2944
2977
  var mergeAssets = (op1, op2) => {
2945
2978
  const assets1 = op1.assetsSent || [];
@@ -2952,7 +2985,7 @@ var mergeAssets = (op1, op2) => {
2952
2985
  if (!matchingAsset) {
2953
2986
  return asset1;
2954
2987
  }
2955
- const mergedAmount = (0, import_math13.bn)(asset1.amount).add(matchingAsset.amount);
2988
+ const mergedAmount = (0, import_math14.bn)(asset1.amount).add(matchingAsset.amount);
2956
2989
  return { ...asset1, amount: mergedAmount };
2957
2990
  });
2958
2991
  return mergedAssets.concat(filteredAssets);
@@ -3135,11 +3168,11 @@ function getTransferOperations({
3135
3168
  });
3136
3169
  const transferReceipts = getReceiptsByType(
3137
3170
  receipts,
3138
- import_transactions14.ReceiptType.Transfer
3171
+ import_transactions15.ReceiptType.Transfer
3139
3172
  );
3140
3173
  const transferOutReceipts = getReceiptsByType(
3141
3174
  receipts,
3142
- import_transactions14.ReceiptType.TransferOut
3175
+ import_transactions15.ReceiptType.TransferOut
3143
3176
  );
3144
3177
  [...transferReceipts, ...transferOutReceipts].forEach((receipt) => {
3145
3178
  const operation = extractTransferOperationFromReceipt(receipt, contractInputs, changeOutputs);
@@ -3224,17 +3257,17 @@ function getOperations({
3224
3257
  }
3225
3258
 
3226
3259
  // src/providers/transaction-summary/receipt.ts
3227
- var import_transactions15 = require("@fuel-ts/transactions");
3260
+ var import_transactions16 = require("@fuel-ts/transactions");
3228
3261
  var processGqlReceipt = (gqlReceipt) => {
3229
3262
  const receipt = assembleReceiptByType(gqlReceipt);
3230
3263
  switch (receipt.type) {
3231
- case import_transactions15.ReceiptType.ReturnData: {
3264
+ case import_transactions16.ReceiptType.ReturnData: {
3232
3265
  return {
3233
3266
  ...receipt,
3234
3267
  data: gqlReceipt.data || "0x"
3235
3268
  };
3236
3269
  }
3237
- case import_transactions15.ReceiptType.LogData: {
3270
+ case import_transactions16.ReceiptType.LogData: {
3238
3271
  return {
3239
3272
  ...receipt,
3240
3273
  data: gqlReceipt.data || "0x"
@@ -3247,7 +3280,7 @@ var processGqlReceipt = (gqlReceipt) => {
3247
3280
  var extractMintedAssetsFromReceipts = (receipts) => {
3248
3281
  const mintedAssets = [];
3249
3282
  receipts.forEach((receipt) => {
3250
- if (receipt.type === import_transactions15.ReceiptType.Mint) {
3283
+ if (receipt.type === import_transactions16.ReceiptType.Mint) {
3251
3284
  mintedAssets.push({
3252
3285
  subId: receipt.subId,
3253
3286
  contractId: receipt.contractId,
@@ -3261,7 +3294,7 @@ var extractMintedAssetsFromReceipts = (receipts) => {
3261
3294
  var extractBurnedAssetsFromReceipts = (receipts) => {
3262
3295
  const burnedAssets = [];
3263
3296
  receipts.forEach((receipt) => {
3264
- if (receipt.type === import_transactions15.ReceiptType.Burn) {
3297
+ if (receipt.type === import_transactions16.ReceiptType.Burn) {
3265
3298
  burnedAssets.push({
3266
3299
  subId: receipt.subId,
3267
3300
  contractId: receipt.contractId,
@@ -3275,7 +3308,7 @@ var extractBurnedAssetsFromReceipts = (receipts) => {
3275
3308
 
3276
3309
  // src/providers/transaction-summary/status.ts
3277
3310
  var import_errors12 = require("@fuel-ts/errors");
3278
- var import_math14 = require("@fuel-ts/math");
3311
+ var import_math15 = require("@fuel-ts/math");
3279
3312
  var getTransactionStatusName = (gqlStatus) => {
3280
3313
  switch (gqlStatus) {
3281
3314
  case "FailureStatus":
@@ -3309,15 +3342,15 @@ var processGraphqlStatus = (gqlTransactionStatus) => {
3309
3342
  time = gqlTransactionStatus.time;
3310
3343
  blockId = gqlTransactionStatus.block.id;
3311
3344
  isStatusSuccess = true;
3312
- totalFee = (0, import_math14.bn)(gqlTransactionStatus.totalFee);
3313
- totalGas = (0, import_math14.bn)(gqlTransactionStatus.totalGas);
3345
+ totalFee = (0, import_math15.bn)(gqlTransactionStatus.totalFee);
3346
+ totalGas = (0, import_math15.bn)(gqlTransactionStatus.totalGas);
3314
3347
  break;
3315
3348
  case "FailureStatus":
3316
3349
  time = gqlTransactionStatus.time;
3317
3350
  blockId = gqlTransactionStatus.block.id;
3318
3351
  isStatusFailure = true;
3319
- totalFee = (0, import_math14.bn)(gqlTransactionStatus.totalFee);
3320
- totalGas = (0, import_math14.bn)(gqlTransactionStatus.totalGas);
3352
+ totalFee = (0, import_math15.bn)(gqlTransactionStatus.totalFee);
3353
+ totalGas = (0, import_math15.bn)(gqlTransactionStatus.totalGas);
3321
3354
  break;
3322
3355
  case "SubmittedStatus":
3323
3356
  time = gqlTransactionStatus.time;
@@ -3367,7 +3400,7 @@ function assembleTransactionSummary(params) {
3367
3400
  maxInputs
3368
3401
  });
3369
3402
  const typeName = getTransactionTypeName(transaction.type);
3370
- const tip = (0, import_math15.bn)(transaction.policies?.find((policy) => policy.type === import_transactions16.PolicyType.Tip)?.data);
3403
+ const tip = (0, import_math16.bn)(transaction.policies?.find((policy) => policy.type === import_transactions17.PolicyType.Tip)?.data);
3371
3404
  const { isStatusFailure, isStatusPending, isStatusSuccess, blockId, status, time, totalFee } = processGraphqlStatus(gqlTransactionStatus);
3372
3405
  const fee = calculateTXFeeForSummary({
3373
3406
  totalFee,
@@ -3418,12 +3451,12 @@ function assembleTransactionSummary(params) {
3418
3451
 
3419
3452
  // src/providers/transaction-response/getDecodedLogs.ts
3420
3453
  var import_abi_coder5 = require("@fuel-ts/abi-coder");
3421
- var import_transactions17 = require("@fuel-ts/transactions");
3454
+ var import_transactions18 = require("@fuel-ts/transactions");
3422
3455
  function getDecodedLogs(receipts, mainAbi, externalAbis = {}) {
3423
3456
  return receipts.reduce((logs, receipt) => {
3424
- if (receipt.type === import_transactions17.ReceiptType.LogData || receipt.type === import_transactions17.ReceiptType.Log) {
3457
+ if (receipt.type === import_transactions18.ReceiptType.LogData || receipt.type === import_transactions18.ReceiptType.Log) {
3425
3458
  const interfaceToUse = new import_abi_coder5.Interface(externalAbis[receipt.id] || mainAbi);
3426
- const data = receipt.type === import_transactions17.ReceiptType.Log ? new import_abi_coder5.BigNumberCoder("u64").encode(receipt.val0) : receipt.data;
3459
+ const data = receipt.type === import_transactions18.ReceiptType.Log ? new import_abi_coder5.BigNumberCoder("u64").encode(receipt.val0) : receipt.data;
3427
3460
  const [decodedLog] = interfaceToUse.decodeLog(data, receipt.val1.toNumber());
3428
3461
  logs.push(decodedLog);
3429
3462
  }
@@ -3438,7 +3471,7 @@ var TransactionResponse = class {
3438
3471
  /** Current provider */
3439
3472
  provider;
3440
3473
  /** Gas used on the transaction */
3441
- gasUsed = (0, import_math16.bn)(0);
3474
+ gasUsed = (0, import_math17.bn)(0);
3442
3475
  /** The graphql Transaction with receipts object. */
3443
3476
  gqlTransaction;
3444
3477
  abis;
@@ -3496,7 +3529,7 @@ var TransactionResponse = class {
3496
3529
  * @returns The decoded transaction.
3497
3530
  */
3498
3531
  decodeTransaction(transactionWithReceipts) {
3499
- return new import_transactions18.TransactionCoder().decode(
3532
+ return new import_transactions19.TransactionCoder().decode(
3500
3533
  (0, import_utils20.arrayify)(transactionWithReceipts.rawPayload),
3501
3534
  0
3502
3535
  )?.[0];
@@ -3606,7 +3639,6 @@ var TransactionResponse = class {
3606
3639
  };
3607
3640
 
3608
3641
  // src/providers/utils/auto-retry-fetch.ts
3609
- var import_utils22 = require("@fuel-ts/utils");
3610
3642
  function getWaitDelay(options, retryAttemptNum) {
3611
3643
  const duration = options.baseDelay ?? 150;
3612
3644
  switch (options.backoff) {
@@ -3636,7 +3668,7 @@ function autoRetryFetch(fetchFn, options, retryAttemptNum = 0) {
3636
3668
  throw error;
3637
3669
  }
3638
3670
  const delay = getWaitDelay(options, retryNum);
3639
- await (0, import_utils22.sleep)(delay);
3671
+ await sleep(delay);
3640
3672
  return autoRetryFetch(fetchFn, options, retryNum)(...args);
3641
3673
  }
3642
3674
  };
@@ -3673,47 +3705,47 @@ var processGqlChain = (chain) => {
3673
3705
  } = consensusParameters;
3674
3706
  return {
3675
3707
  name,
3676
- baseChainHeight: (0, import_math17.bn)(daHeight),
3708
+ baseChainHeight: (0, import_math18.bn)(daHeight),
3677
3709
  consensusParameters: {
3678
3710
  version,
3679
- chainId: (0, import_math17.bn)(chainId),
3711
+ chainId: (0, import_math18.bn)(chainId),
3680
3712
  baseAssetId,
3681
3713
  feeParameters: {
3682
3714
  version: feeParams.version,
3683
- gasPerByte: (0, import_math17.bn)(feeParams.gasPerByte),
3684
- gasPriceFactor: (0, import_math17.bn)(feeParams.gasPriceFactor)
3715
+ gasPerByte: (0, import_math18.bn)(feeParams.gasPerByte),
3716
+ gasPriceFactor: (0, import_math18.bn)(feeParams.gasPriceFactor)
3685
3717
  },
3686
3718
  contractParameters: {
3687
3719
  version: contractParams.version,
3688
- contractMaxSize: (0, import_math17.bn)(contractParams.contractMaxSize),
3689
- maxStorageSlots: (0, import_math17.bn)(contractParams.maxStorageSlots)
3720
+ contractMaxSize: (0, import_math18.bn)(contractParams.contractMaxSize),
3721
+ maxStorageSlots: (0, import_math18.bn)(contractParams.maxStorageSlots)
3690
3722
  },
3691
3723
  txParameters: {
3692
3724
  version: txParams.version,
3693
- maxInputs: (0, import_math17.bn)(txParams.maxInputs),
3694
- maxOutputs: (0, import_math17.bn)(txParams.maxOutputs),
3695
- maxWitnesses: (0, import_math17.bn)(txParams.maxWitnesses),
3696
- maxGasPerTx: (0, import_math17.bn)(txParams.maxGasPerTx),
3697
- maxSize: (0, import_math17.bn)(txParams.maxSize),
3698
- maxBytecodeSubsections: (0, import_math17.bn)(txParams.maxBytecodeSubsections)
3725
+ maxInputs: (0, import_math18.bn)(txParams.maxInputs),
3726
+ maxOutputs: (0, import_math18.bn)(txParams.maxOutputs),
3727
+ maxWitnesses: (0, import_math18.bn)(txParams.maxWitnesses),
3728
+ maxGasPerTx: (0, import_math18.bn)(txParams.maxGasPerTx),
3729
+ maxSize: (0, import_math18.bn)(txParams.maxSize),
3730
+ maxBytecodeSubsections: (0, import_math18.bn)(txParams.maxBytecodeSubsections)
3699
3731
  },
3700
3732
  predicateParameters: {
3701
3733
  version: predicateParams.version,
3702
- maxPredicateLength: (0, import_math17.bn)(predicateParams.maxPredicateLength),
3703
- maxPredicateDataLength: (0, import_math17.bn)(predicateParams.maxPredicateDataLength),
3704
- maxGasPerPredicate: (0, import_math17.bn)(predicateParams.maxGasPerPredicate),
3705
- maxMessageDataLength: (0, import_math17.bn)(predicateParams.maxMessageDataLength)
3734
+ maxPredicateLength: (0, import_math18.bn)(predicateParams.maxPredicateLength),
3735
+ maxPredicateDataLength: (0, import_math18.bn)(predicateParams.maxPredicateDataLength),
3736
+ maxGasPerPredicate: (0, import_math18.bn)(predicateParams.maxGasPerPredicate),
3737
+ maxMessageDataLength: (0, import_math18.bn)(predicateParams.maxMessageDataLength)
3706
3738
  },
3707
3739
  scriptParameters: {
3708
3740
  version: scriptParams.version,
3709
- maxScriptLength: (0, import_math17.bn)(scriptParams.maxScriptLength),
3710
- maxScriptDataLength: (0, import_math17.bn)(scriptParams.maxScriptDataLength)
3741
+ maxScriptLength: (0, import_math18.bn)(scriptParams.maxScriptLength),
3742
+ maxScriptDataLength: (0, import_math18.bn)(scriptParams.maxScriptDataLength)
3711
3743
  },
3712
3744
  gasCosts
3713
3745
  },
3714
3746
  latestBlock: {
3715
3747
  id: latestBlock.id,
3716
- height: (0, import_math17.bn)(latestBlock.height),
3748
+ height: (0, import_math18.bn)(latestBlock.height),
3717
3749
  time: latestBlock.header.time,
3718
3750
  transactions: latestBlock.transactions.map((i) => ({
3719
3751
  id: i.id
@@ -3909,7 +3941,7 @@ Supported fuel-core version: ${supportedVersion}.`
3909
3941
  */
3910
3942
  async getBlockNumber() {
3911
3943
  const { chain } = await this.operations.getChain();
3912
- return (0, import_math17.bn)(chain.latestBlock.height, 10);
3944
+ return (0, import_math18.bn)(chain.latestBlock.height, 10);
3913
3945
  }
3914
3946
  /**
3915
3947
  * Returns the chain information.
@@ -3919,8 +3951,8 @@ Supported fuel-core version: ${supportedVersion}.`
3919
3951
  async fetchNode() {
3920
3952
  const { nodeInfo } = await this.operations.getNodeInfo();
3921
3953
  const processedNodeInfo = {
3922
- maxDepth: (0, import_math17.bn)(nodeInfo.maxDepth),
3923
- maxTx: (0, import_math17.bn)(nodeInfo.maxTx),
3954
+ maxDepth: (0, import_math18.bn)(nodeInfo.maxDepth),
3955
+ maxTx: (0, import_math18.bn)(nodeInfo.maxTx),
3924
3956
  nodeVersion: nodeInfo.nodeVersion,
3925
3957
  utxoValidation: nodeInfo.utxoValidation,
3926
3958
  vmBacktrace: nodeInfo.vmBacktrace
@@ -3976,9 +4008,9 @@ Supported fuel-core version: ${supportedVersion}.`
3976
4008
  if (estimateTxDependencies) {
3977
4009
  await this.estimateTxDependencies(transactionRequest);
3978
4010
  }
3979
- const encodedTransaction = (0, import_utils23.hexlify)(transactionRequest.toTransactionBytes());
4011
+ const encodedTransaction = (0, import_utils22.hexlify)(transactionRequest.toTransactionBytes());
3980
4012
  let abis;
3981
- if (transactionRequest.type === import_transactions19.TransactionType.Script) {
4013
+ if (transactionRequest.type === import_transactions20.TransactionType.Script) {
3982
4014
  abis = transactionRequest.abis;
3983
4015
  }
3984
4016
  if (awaitExecution) {
@@ -4019,7 +4051,7 @@ Supported fuel-core version: ${supportedVersion}.`
4019
4051
  if (estimateTxDependencies) {
4020
4052
  return this.estimateTxDependencies(transactionRequest);
4021
4053
  }
4022
- const encodedTransaction = (0, import_utils23.hexlify)(transactionRequest.toTransactionBytes());
4054
+ const encodedTransaction = (0, import_utils22.hexlify)(transactionRequest.toTransactionBytes());
4023
4055
  const { dryRun: dryRunStatuses } = await this.operations.dryRun({
4024
4056
  encodedTransactions: encodedTransaction,
4025
4057
  utxoValidation: utxoValidation || false
@@ -4037,13 +4069,13 @@ Supported fuel-core version: ${supportedVersion}.`
4037
4069
  async estimatePredicates(transactionRequest) {
4038
4070
  const shouldEstimatePredicates = Boolean(
4039
4071
  transactionRequest.inputs.find(
4040
- (input) => "predicate" in input && input.predicate && !(0, import_utils24.equalBytes)((0, import_utils23.arrayify)(input.predicate), (0, import_utils23.arrayify)("0x")) && new import_math17.BN(input.predicateGasUsed).isZero()
4072
+ (input) => "predicate" in input && input.predicate && !(0, import_utils23.equalBytes)((0, import_utils22.arrayify)(input.predicate), (0, import_utils22.arrayify)("0x")) && new import_math18.BN(input.predicateGasUsed).isZero()
4041
4073
  )
4042
4074
  );
4043
4075
  if (!shouldEstimatePredicates) {
4044
4076
  return transactionRequest;
4045
4077
  }
4046
- const encodedTransaction = (0, import_utils23.hexlify)(transactionRequest.toTransactionBytes());
4078
+ const encodedTransaction = (0, import_utils22.hexlify)(transactionRequest.toTransactionBytes());
4047
4079
  const response = await this.operations.estimatePredicates({
4048
4080
  encodedTransaction
4049
4081
  });
@@ -4052,7 +4084,7 @@ Supported fuel-core version: ${supportedVersion}.`
4052
4084
  } = response;
4053
4085
  if (inputs) {
4054
4086
  inputs.forEach((input, index) => {
4055
- if ("predicateGasUsed" in input && (0, import_math17.bn)(input.predicateGasUsed).gt(0)) {
4087
+ if ("predicateGasUsed" in input && (0, import_math18.bn)(input.predicateGasUsed).gt(0)) {
4056
4088
  transactionRequest.inputs[index].predicateGasUsed = input.predicateGasUsed;
4057
4089
  }
4058
4090
  });
@@ -4070,7 +4102,7 @@ Supported fuel-core version: ${supportedVersion}.`
4070
4102
  * @returns A promise.
4071
4103
  */
4072
4104
  async estimateTxDependencies(transactionRequest) {
4073
- if (transactionRequest.type === import_transactions19.TransactionType.Create) {
4105
+ if (transactionRequest.type === import_transactions20.TransactionType.Create) {
4074
4106
  return {
4075
4107
  receipts: [],
4076
4108
  outputVariables: 0,
@@ -4085,7 +4117,7 @@ Supported fuel-core version: ${supportedVersion}.`
4085
4117
  const {
4086
4118
  dryRun: [{ receipts: rawReceipts, status }]
4087
4119
  } = await this.operations.dryRun({
4088
- encodedTransactions: [(0, import_utils23.hexlify)(transactionRequest.toTransactionBytes())],
4120
+ encodedTransactions: [(0, import_utils22.hexlify)(transactionRequest.toTransactionBytes())],
4089
4121
  utxoValidation: false
4090
4122
  });
4091
4123
  receipts = rawReceipts.map(processGqlReceipt);
@@ -4134,8 +4166,8 @@ Supported fuel-core version: ${supportedVersion}.`
4134
4166
  const allRequests = (0, import_ramda3.clone)(transactionRequests);
4135
4167
  const serializedTransactionsMap = /* @__PURE__ */ new Map();
4136
4168
  allRequests.forEach((req, index) => {
4137
- if (req.type === import_transactions19.TransactionType.Script) {
4138
- serializedTransactionsMap.set(index, (0, import_utils23.hexlify)(req.toTransactionBytes()));
4169
+ if (req.type === import_transactions20.TransactionType.Script) {
4170
+ serializedTransactionsMap.set(index, (0, import_utils22.hexlify)(req.toTransactionBytes()));
4139
4171
  }
4140
4172
  });
4141
4173
  let transactionsToProcess = Array.from(serializedTransactionsMap.keys());
@@ -4160,7 +4192,7 @@ Supported fuel-core version: ${supportedVersion}.`
4160
4192
  );
4161
4193
  const hasMissingOutputs = missingOutputVariables.length > 0 || missingOutputContractIds.length > 0;
4162
4194
  const request = allRequests[requestIdx];
4163
- if (hasMissingOutputs && request?.type === import_transactions19.TransactionType.Script) {
4195
+ if (hasMissingOutputs && request?.type === import_transactions20.TransactionType.Script) {
4164
4196
  result.outputVariables += missingOutputVariables.length;
4165
4197
  request.addVariableOutputs(missingOutputVariables.length);
4166
4198
  missingOutputContractIds.forEach(({ contractId }) => {
@@ -4171,7 +4203,7 @@ Supported fuel-core version: ${supportedVersion}.`
4171
4203
  transactionRequest: request
4172
4204
  });
4173
4205
  request.maxFee = maxFee;
4174
- serializedTransactionsMap.set(requestIdx, (0, import_utils23.hexlify)(request.toTransactionBytes()));
4206
+ serializedTransactionsMap.set(requestIdx, (0, import_utils22.hexlify)(request.toTransactionBytes()));
4175
4207
  nextRoundTransactions.push(requestIdx);
4176
4208
  }
4177
4209
  }
@@ -4184,7 +4216,7 @@ Supported fuel-core version: ${supportedVersion}.`
4184
4216
  if (estimateTxDependencies) {
4185
4217
  return this.estimateMultipleTxDependencies(transactionRequests);
4186
4218
  }
4187
- const encodedTransactions = transactionRequests.map((tx) => (0, import_utils23.hexlify)(tx.toTransactionBytes()));
4219
+ const encodedTransactions = transactionRequests.map((tx) => (0, import_utils22.hexlify)(tx.toTransactionBytes()));
4188
4220
  const { dryRun: dryRunStatuses } = await this.operations.dryRun({
4189
4221
  encodedTransactions,
4190
4222
  utxoValidation: utxoValidation || false
@@ -4210,13 +4242,13 @@ Supported fuel-core version: ${supportedVersion}.`
4210
4242
  gasPrice = await this.estimateGasPrice(10);
4211
4243
  }
4212
4244
  const minFee = calculateGasFee({
4213
- gasPrice: (0, import_math17.bn)(gasPrice),
4245
+ gasPrice: (0, import_math18.bn)(gasPrice),
4214
4246
  gas: minGas,
4215
4247
  priceFactor: gasPriceFactor,
4216
4248
  tip: transactionRequest.tip
4217
4249
  }).add(1);
4218
- let gasLimit = (0, import_math17.bn)(0);
4219
- if (transactionRequest.type === import_transactions19.TransactionType.Script) {
4250
+ let gasLimit = (0, import_math18.bn)(0);
4251
+ if (transactionRequest.type === import_transactions20.TransactionType.Script) {
4220
4252
  gasLimit = transactionRequest.gasLimit;
4221
4253
  if (transactionRequest.gasLimit.eq(0)) {
4222
4254
  transactionRequest.gasLimit = minGas;
@@ -4228,7 +4260,7 @@ Supported fuel-core version: ${supportedVersion}.`
4228
4260
  }
4229
4261
  const maxGas = transactionRequest.calculateMaxGas(chainInfo, minGas);
4230
4262
  const maxFee = calculateGasFee({
4231
- gasPrice: (0, import_math17.bn)(gasPrice),
4263
+ gasPrice: (0, import_math18.bn)(gasPrice),
4232
4264
  gas: maxGas,
4233
4265
  priceFactor: gasPriceFactor,
4234
4266
  tip: transactionRequest.tip
@@ -4257,7 +4289,7 @@ Supported fuel-core version: ${supportedVersion}.`
4257
4289
  if (estimateTxDependencies) {
4258
4290
  return this.estimateTxDependencies(transactionRequest);
4259
4291
  }
4260
- const encodedTransactions = [(0, import_utils23.hexlify)(transactionRequest.toTransactionBytes())];
4292
+ const encodedTransactions = [(0, import_utils22.hexlify)(transactionRequest.toTransactionBytes())];
4261
4293
  const { dryRun: dryRunStatuses } = await this.operations.dryRun({
4262
4294
  encodedTransactions,
4263
4295
  utxoValidation: true
@@ -4286,14 +4318,14 @@ Supported fuel-core version: ${supportedVersion}.`
4286
4318
  */
4287
4319
  async getTransactionCost(transactionRequestLike, { resourcesOwner, signatureCallback, quantitiesToContract = [] } = {}) {
4288
4320
  const txRequestClone = (0, import_ramda3.clone)(transactionRequestify(transactionRequestLike));
4289
- const isScriptTransaction = txRequestClone.type === import_transactions19.TransactionType.Script;
4321
+ const isScriptTransaction = txRequestClone.type === import_transactions20.TransactionType.Script;
4290
4322
  const baseAssetId = this.getBaseAssetId();
4291
4323
  const updateMaxFee = txRequestClone.maxFee.eq(0);
4292
4324
  const coinOutputsQuantities = txRequestClone.getCoinOutputsQuantities();
4293
4325
  const allQuantities = mergeQuantities(coinOutputsQuantities, quantitiesToContract);
4294
4326
  txRequestClone.fundWithFakeUtxos(allQuantities, baseAssetId, resourcesOwner?.address);
4295
4327
  if (isScriptTransaction) {
4296
- txRequestClone.gasLimit = (0, import_math17.bn)(0);
4328
+ txRequestClone.gasLimit = (0, import_math18.bn)(0);
4297
4329
  }
4298
4330
  if (resourcesOwner && "populateTransactionPredicateData" in resourcesOwner) {
4299
4331
  resourcesOwner.populateTransactionPredicateData(txRequestClone);
@@ -4314,7 +4346,7 @@ Supported fuel-core version: ${supportedVersion}.`
4314
4346
  let dryRunStatus;
4315
4347
  let missingContractIds = [];
4316
4348
  let outputVariables = 0;
4317
- let gasUsed = (0, import_math17.bn)(0);
4349
+ let gasUsed = (0, import_math18.bn)(0);
4318
4350
  txRequestClone.maxFee = maxFee;
4319
4351
  if (isScriptTransaction) {
4320
4352
  txRequestClone.gasLimit = gasLimit;
@@ -4373,16 +4405,16 @@ Supported fuel-core version: ${supportedVersion}.`
4373
4405
  const result = await this.operations.getCoins({
4374
4406
  first: 10,
4375
4407
  ...paginationArgs,
4376
- filter: { owner: ownerAddress.toB256(), assetId: assetId && (0, import_utils23.hexlify)(assetId) }
4408
+ filter: { owner: ownerAddress.toB256(), assetId: assetId && (0, import_utils22.hexlify)(assetId) }
4377
4409
  });
4378
4410
  const coins = result.coins.edges.map((edge) => edge.node);
4379
4411
  return coins.map((coin) => ({
4380
4412
  id: coin.utxoId,
4381
4413
  assetId: coin.assetId,
4382
- amount: (0, import_math17.bn)(coin.amount),
4414
+ amount: (0, import_math18.bn)(coin.amount),
4383
4415
  owner: import_address3.Address.fromAddressOrString(coin.owner),
4384
- blockCreated: (0, import_math17.bn)(coin.blockCreated),
4385
- txCreatedIdx: (0, import_math17.bn)(coin.txCreatedIdx)
4416
+ blockCreated: (0, import_math18.bn)(coin.blockCreated),
4417
+ txCreatedIdx: (0, import_math18.bn)(coin.txCreatedIdx)
4386
4418
  }));
4387
4419
  }
4388
4420
  /**
@@ -4396,19 +4428,19 @@ Supported fuel-core version: ${supportedVersion}.`
4396
4428
  async getResourcesToSpend(owner, quantities, excludedIds) {
4397
4429
  const ownerAddress = import_address3.Address.fromAddressOrString(owner);
4398
4430
  const excludeInput = {
4399
- messages: excludedIds?.messages?.map((nonce) => (0, import_utils23.hexlify)(nonce)) || [],
4400
- utxos: excludedIds?.utxos?.map((id) => (0, import_utils23.hexlify)(id)) || []
4431
+ messages: excludedIds?.messages?.map((nonce) => (0, import_utils22.hexlify)(nonce)) || [],
4432
+ utxos: excludedIds?.utxos?.map((id) => (0, import_utils22.hexlify)(id)) || []
4401
4433
  };
4402
4434
  if (this.cache) {
4403
4435
  const uniqueUtxos = new Set(
4404
- excludeInput.utxos.concat(this.cache?.getActiveData().map((id) => (0, import_utils23.hexlify)(id)))
4436
+ excludeInput.utxos.concat(this.cache?.getActiveData().map((id) => (0, import_utils22.hexlify)(id)))
4405
4437
  );
4406
4438
  excludeInput.utxos = Array.from(uniqueUtxos);
4407
4439
  }
4408
4440
  const coinsQuery = {
4409
4441
  owner: ownerAddress.toB256(),
4410
4442
  queryPerAsset: quantities.map(coinQuantityfy).map(({ assetId, amount, max: maxPerAsset }) => ({
4411
- assetId: (0, import_utils23.hexlify)(assetId),
4443
+ assetId: (0, import_utils22.hexlify)(assetId),
4412
4444
  amount: amount.toString(10),
4413
4445
  max: maxPerAsset ? maxPerAsset.toString(10) : void 0
4414
4446
  })),
@@ -4419,9 +4451,9 @@ Supported fuel-core version: ${supportedVersion}.`
4419
4451
  switch (coin.type) {
4420
4452
  case "MessageCoin":
4421
4453
  return {
4422
- amount: (0, import_math17.bn)(coin.amount),
4454
+ amount: (0, import_math18.bn)(coin.amount),
4423
4455
  assetId: coin.assetId,
4424
- daHeight: (0, import_math17.bn)(coin.daHeight),
4456
+ daHeight: (0, import_math18.bn)(coin.daHeight),
4425
4457
  sender: import_address3.Address.fromAddressOrString(coin.sender),
4426
4458
  recipient: import_address3.Address.fromAddressOrString(coin.recipient),
4427
4459
  nonce: coin.nonce
@@ -4429,11 +4461,11 @@ Supported fuel-core version: ${supportedVersion}.`
4429
4461
  case "Coin":
4430
4462
  return {
4431
4463
  id: coin.utxoId,
4432
- amount: (0, import_math17.bn)(coin.amount),
4464
+ amount: (0, import_math18.bn)(coin.amount),
4433
4465
  assetId: coin.assetId,
4434
4466
  owner: import_address3.Address.fromAddressOrString(coin.owner),
4435
- blockCreated: (0, import_math17.bn)(coin.blockCreated),
4436
- txCreatedIdx: (0, import_math17.bn)(coin.txCreatedIdx)
4467
+ blockCreated: (0, import_math18.bn)(coin.blockCreated),
4468
+ txCreatedIdx: (0, import_math18.bn)(coin.txCreatedIdx)
4437
4469
  };
4438
4470
  default:
4439
4471
  return null;
@@ -4450,13 +4482,13 @@ Supported fuel-core version: ${supportedVersion}.`
4450
4482
  async getBlock(idOrHeight) {
4451
4483
  let variables;
4452
4484
  if (typeof idOrHeight === "number") {
4453
- variables = { height: (0, import_math17.bn)(idOrHeight).toString(10) };
4485
+ variables = { height: (0, import_math18.bn)(idOrHeight).toString(10) };
4454
4486
  } else if (idOrHeight === "latest") {
4455
4487
  variables = { height: (await this.getBlockNumber()).toString(10) };
4456
4488
  } else if (idOrHeight.length === 66) {
4457
4489
  variables = { blockId: idOrHeight };
4458
4490
  } else {
4459
- variables = { blockId: (0, import_math17.bn)(idOrHeight).toString(10) };
4491
+ variables = { blockId: (0, import_math18.bn)(idOrHeight).toString(10) };
4460
4492
  }
4461
4493
  const { block } = await this.operations.getBlock(variables);
4462
4494
  if (!block) {
@@ -4464,7 +4496,7 @@ Supported fuel-core version: ${supportedVersion}.`
4464
4496
  }
4465
4497
  return {
4466
4498
  id: block.id,
4467
- height: (0, import_math17.bn)(block.height),
4499
+ height: (0, import_math18.bn)(block.height),
4468
4500
  time: block.header.time,
4469
4501
  transactionIds: block.transactions.map((tx) => tx.id)
4470
4502
  };
@@ -4479,7 +4511,7 @@ Supported fuel-core version: ${supportedVersion}.`
4479
4511
  const { blocks: fetchedData } = await this.operations.getBlocks(params);
4480
4512
  const blocks = fetchedData.edges.map(({ node: block }) => ({
4481
4513
  id: block.id,
4482
- height: (0, import_math17.bn)(block.height),
4514
+ height: (0, import_math18.bn)(block.height),
4483
4515
  time: block.header.time,
4484
4516
  transactionIds: block.transactions.map((tx) => tx.id)
4485
4517
  }));
@@ -4494,7 +4526,7 @@ Supported fuel-core version: ${supportedVersion}.`
4494
4526
  async getBlockWithTransactions(idOrHeight) {
4495
4527
  let variables;
4496
4528
  if (typeof idOrHeight === "number") {
4497
- variables = { blockHeight: (0, import_math17.bn)(idOrHeight).toString(10) };
4529
+ variables = { blockHeight: (0, import_math18.bn)(idOrHeight).toString(10) };
4498
4530
  } else if (idOrHeight === "latest") {
4499
4531
  variables = { blockHeight: (await this.getBlockNumber()).toString() };
4500
4532
  } else {
@@ -4506,11 +4538,11 @@ Supported fuel-core version: ${supportedVersion}.`
4506
4538
  }
4507
4539
  return {
4508
4540
  id: block.id,
4509
- height: (0, import_math17.bn)(block.height, 10),
4541
+ height: (0, import_math18.bn)(block.height, 10),
4510
4542
  time: block.header.time,
4511
4543
  transactionIds: block.transactions.map((tx) => tx.id),
4512
4544
  transactions: block.transactions.map(
4513
- (tx) => new import_transactions19.TransactionCoder().decode((0, import_utils23.arrayify)(tx.rawPayload), 0)?.[0]
4545
+ (tx) => new import_transactions20.TransactionCoder().decode((0, import_utils22.arrayify)(tx.rawPayload), 0)?.[0]
4514
4546
  )
4515
4547
  };
4516
4548
  }
@@ -4525,8 +4557,8 @@ Supported fuel-core version: ${supportedVersion}.`
4525
4557
  if (!transaction) {
4526
4558
  return null;
4527
4559
  }
4528
- return new import_transactions19.TransactionCoder().decode(
4529
- (0, import_utils23.arrayify)(transaction.rawPayload),
4560
+ return new import_transactions20.TransactionCoder().decode(
4561
+ (0, import_utils22.arrayify)(transaction.rawPayload),
4530
4562
  0
4531
4563
  )?.[0];
4532
4564
  }
@@ -4553,9 +4585,9 @@ Supported fuel-core version: ${supportedVersion}.`
4553
4585
  async getContractBalance(contractId, assetId) {
4554
4586
  const { contractBalance } = await this.operations.getContractBalance({
4555
4587
  contract: import_address3.Address.fromAddressOrString(contractId).toB256(),
4556
- asset: (0, import_utils23.hexlify)(assetId)
4588
+ asset: (0, import_utils22.hexlify)(assetId)
4557
4589
  });
4558
- return (0, import_math17.bn)(contractBalance.amount, 10);
4590
+ return (0, import_math18.bn)(contractBalance.amount, 10);
4559
4591
  }
4560
4592
  /**
4561
4593
  * Returns the balance for the given owner for the given asset ID.
@@ -4567,9 +4599,9 @@ Supported fuel-core version: ${supportedVersion}.`
4567
4599
  async getBalance(owner, assetId) {
4568
4600
  const { balance } = await this.operations.getBalance({
4569
4601
  owner: import_address3.Address.fromAddressOrString(owner).toB256(),
4570
- assetId: (0, import_utils23.hexlify)(assetId)
4602
+ assetId: (0, import_utils22.hexlify)(assetId)
4571
4603
  });
4572
- return (0, import_math17.bn)(balance.amount, 10);
4604
+ return (0, import_math18.bn)(balance.amount, 10);
4573
4605
  }
4574
4606
  /**
4575
4607
  * Returns balances for the given owner.
@@ -4587,7 +4619,7 @@ Supported fuel-core version: ${supportedVersion}.`
4587
4619
  const balances = result.balances.edges.map((edge) => edge.node);
4588
4620
  return balances.map((balance) => ({
4589
4621
  assetId: balance.assetId,
4590
- amount: (0, import_math17.bn)(balance.amount)
4622
+ amount: (0, import_math18.bn)(balance.amount)
4591
4623
  }));
4592
4624
  }
4593
4625
  /**
@@ -4605,19 +4637,19 @@ Supported fuel-core version: ${supportedVersion}.`
4605
4637
  });
4606
4638
  const messages = result.messages.edges.map((edge) => edge.node);
4607
4639
  return messages.map((message) => ({
4608
- messageId: import_transactions19.InputMessageCoder.getMessageId({
4640
+ messageId: import_transactions20.InputMessageCoder.getMessageId({
4609
4641
  sender: message.sender,
4610
4642
  recipient: message.recipient,
4611
4643
  nonce: message.nonce,
4612
- amount: (0, import_math17.bn)(message.amount),
4644
+ amount: (0, import_math18.bn)(message.amount),
4613
4645
  data: message.data
4614
4646
  }),
4615
4647
  sender: import_address3.Address.fromAddressOrString(message.sender),
4616
4648
  recipient: import_address3.Address.fromAddressOrString(message.recipient),
4617
4649
  nonce: message.nonce,
4618
- amount: (0, import_math17.bn)(message.amount),
4619
- data: import_transactions19.InputMessageCoder.decodeData(message.data),
4620
- daHeight: (0, import_math17.bn)(message.daHeight)
4650
+ amount: (0, import_math18.bn)(message.amount),
4651
+ data: import_transactions20.InputMessageCoder.decodeData(message.data),
4652
+ daHeight: (0, import_math18.bn)(message.daHeight)
4621
4653
  }));
4622
4654
  }
4623
4655
  /**
@@ -4670,19 +4702,19 @@ Supported fuel-core version: ${supportedVersion}.`
4670
4702
  } = result.messageProof;
4671
4703
  return {
4672
4704
  messageProof: {
4673
- proofIndex: (0, import_math17.bn)(messageProof.proofIndex),
4705
+ proofIndex: (0, import_math18.bn)(messageProof.proofIndex),
4674
4706
  proofSet: messageProof.proofSet
4675
4707
  },
4676
4708
  blockProof: {
4677
- proofIndex: (0, import_math17.bn)(blockProof.proofIndex),
4709
+ proofIndex: (0, import_math18.bn)(blockProof.proofIndex),
4678
4710
  proofSet: blockProof.proofSet
4679
4711
  },
4680
4712
  messageBlockHeader: {
4681
4713
  id: messageBlockHeader.id,
4682
- daHeight: (0, import_math17.bn)(messageBlockHeader.daHeight),
4714
+ daHeight: (0, import_math18.bn)(messageBlockHeader.daHeight),
4683
4715
  transactionsCount: Number(messageBlockHeader.transactionsCount),
4684
4716
  transactionsRoot: messageBlockHeader.transactionsRoot,
4685
- height: (0, import_math17.bn)(messageBlockHeader.height),
4717
+ height: (0, import_math18.bn)(messageBlockHeader.height),
4686
4718
  prevRoot: messageBlockHeader.prevRoot,
4687
4719
  time: messageBlockHeader.time,
4688
4720
  applicationHash: messageBlockHeader.applicationHash,
@@ -4694,10 +4726,10 @@ Supported fuel-core version: ${supportedVersion}.`
4694
4726
  },
4695
4727
  commitBlockHeader: {
4696
4728
  id: commitBlockHeader.id,
4697
- daHeight: (0, import_math17.bn)(commitBlockHeader.daHeight),
4729
+ daHeight: (0, import_math18.bn)(commitBlockHeader.daHeight),
4698
4730
  transactionsCount: Number(commitBlockHeader.transactionsCount),
4699
4731
  transactionsRoot: commitBlockHeader.transactionsRoot,
4700
- height: (0, import_math17.bn)(commitBlockHeader.height),
4732
+ height: (0, import_math18.bn)(commitBlockHeader.height),
4701
4733
  prevRoot: commitBlockHeader.prevRoot,
4702
4734
  time: commitBlockHeader.time,
4703
4735
  applicationHash: commitBlockHeader.applicationHash,
@@ -4710,19 +4742,19 @@ Supported fuel-core version: ${supportedVersion}.`
4710
4742
  sender: import_address3.Address.fromAddressOrString(sender),
4711
4743
  recipient: import_address3.Address.fromAddressOrString(recipient),
4712
4744
  nonce,
4713
- amount: (0, import_math17.bn)(amount),
4745
+ amount: (0, import_math18.bn)(amount),
4714
4746
  data
4715
4747
  };
4716
4748
  }
4717
4749
  async getLatestGasPrice() {
4718
4750
  const { latestGasPrice } = await this.operations.getLatestGasPrice();
4719
- return (0, import_math17.bn)(latestGasPrice.gasPrice);
4751
+ return (0, import_math18.bn)(latestGasPrice.gasPrice);
4720
4752
  }
4721
4753
  async estimateGasPrice(blockHorizon) {
4722
4754
  const { estimateGasPrice } = await this.operations.estimateGasPrice({
4723
4755
  blockHorizon: String(blockHorizon)
4724
4756
  });
4725
- return (0, import_math17.bn)(estimateGasPrice.gasPrice);
4757
+ return (0, import_math18.bn)(estimateGasPrice.gasPrice);
4726
4758
  }
4727
4759
  /**
4728
4760
  * Returns Message Proof for given transaction id and the message id from MessageOut receipt.
@@ -4743,10 +4775,10 @@ Supported fuel-core version: ${supportedVersion}.`
4743
4775
  */
4744
4776
  async produceBlocks(amount, startTime) {
4745
4777
  const { produceBlocks: latestBlockHeight } = await this.operations.produceBlocks({
4746
- blocksToProduce: (0, import_math17.bn)(amount).toString(10),
4747
- startTimestamp: startTime ? import_utils23.DateTime.fromUnixMilliseconds(startTime).toTai64() : void 0
4778
+ blocksToProduce: (0, import_math18.bn)(amount).toString(10),
4779
+ startTimestamp: startTime ? import_utils22.DateTime.fromUnixMilliseconds(startTime).toTai64() : void 0
4748
4780
  });
4749
- return (0, import_math17.bn)(latestBlockHeight);
4781
+ return (0, import_math18.bn)(latestBlockHeight);
4750
4782
  }
4751
4783
  // eslint-disable-next-line @typescript-eslint/require-await
4752
4784
  async getTransactionResponse(transactionId) {
@@ -4782,7 +4814,7 @@ cacheInputs_fn = function(inputs) {
4782
4814
  return;
4783
4815
  }
4784
4816
  inputs.forEach((input) => {
4785
- if (input.type === import_transactions19.InputType.Coin) {
4817
+ if (input.type === import_transactions20.InputType.Coin) {
4786
4818
  this.cache?.set(input.id);
4787
4819
  }
4788
4820
  });
@@ -4792,9 +4824,9 @@ __publicField(Provider, "nodeInfoCache", {});
4792
4824
 
4793
4825
  // src/providers/transaction-summary/get-transaction-summary.ts
4794
4826
  var import_errors15 = require("@fuel-ts/errors");
4795
- var import_math18 = require("@fuel-ts/math");
4796
- var import_transactions20 = require("@fuel-ts/transactions");
4797
- var import_utils26 = require("@fuel-ts/utils");
4827
+ var import_math19 = require("@fuel-ts/math");
4828
+ var import_transactions21 = require("@fuel-ts/transactions");
4829
+ var import_utils25 = require("@fuel-ts/utils");
4798
4830
 
4799
4831
  // src/providers/chains.ts
4800
4832
  var CHAIN_IDS = {
@@ -4867,35 +4899,19 @@ var rawAssets = [
4867
4899
  ];
4868
4900
  var assets = resolveIconPaths(rawAssets, fuelAssetsBaseUrl);
4869
4901
 
4870
- // src/providers/transaction-request/helpers.ts
4871
- var import_math19 = require("@fuel-ts/math");
4872
- var import_transactions21 = require("@fuel-ts/transactions");
4873
- var isRequestInputCoin = (input) => input.type === import_transactions21.InputType.Coin;
4874
- var isRequestInputMessage = (input) => input.type === import_transactions21.InputType.Message;
4875
- var isRequestInputResource = (input) => isRequestInputCoin(input) || isRequestInputMessage(input);
4876
- var getAssetAmountInRequestInputs = (inputs, assetId, baseAsset) => inputs.filter(isRequestInputResource).reduce((acc, input) => {
4877
- if (isRequestInputCoin(input) && input.assetId === assetId) {
4878
- return acc.add(input.amount);
4879
- }
4880
- if (isRequestInputMessage(input) && assetId === baseAsset) {
4881
- return acc.add(input.amount);
4882
- }
4883
- return acc;
4884
- }, (0, import_math19.bn)(0));
4885
-
4886
4902
  // src/utils/formatTransferToContractScriptData.ts
4887
4903
  var import_abi_coder6 = require("@fuel-ts/abi-coder");
4888
4904
  var import_math20 = require("@fuel-ts/math");
4889
- var import_utils28 = require("@fuel-ts/utils");
4905
+ var import_utils27 = require("@fuel-ts/utils");
4890
4906
  var asm = __toESM(require("@fuels/vm-asm"));
4891
4907
  var formatTransferToContractScriptData = (params) => {
4892
4908
  const { assetId, amountToTransfer, hexlifiedContractId } = params;
4893
4909
  const numberCoder = new import_abi_coder6.BigNumberCoder("u64");
4894
4910
  const encoded = numberCoder.encode(new import_math20.BN(amountToTransfer).toNumber());
4895
4911
  const scriptData = Uint8Array.from([
4896
- ...(0, import_utils28.arrayify)(hexlifiedContractId),
4912
+ ...(0, import_utils27.arrayify)(hexlifiedContractId),
4897
4913
  ...encoded,
4898
- ...(0, import_utils28.arrayify)(assetId)
4914
+ ...(0, import_utils27.arrayify)(assetId)
4899
4915
  ]);
4900
4916
  return scriptData;
4901
4917
  };
@@ -5120,7 +5136,7 @@ var Account = class extends import_interfaces.AbstractAccount {
5120
5136
  while (needsToBeFunded && fundingAttempts < MAX_FUNDING_ATTEMPTS) {
5121
5137
  const resources = await this.getResourcesToSpend(
5122
5138
  missingQuantities,
5123
- cacheTxInputsFromOwner(request.inputs, this.address)
5139
+ cacheRequestInputsResourcesFromOwner(request.inputs, this.address)
5124
5140
  );
5125
5141
  request.addResources(resources);
5126
5142
  request.shiftPredicateData();
@@ -5268,14 +5284,14 @@ var Account = class extends import_interfaces.AbstractAccount {
5268
5284
  */
5269
5285
  async withdrawToBaseLayer(recipient, amount, txParams = {}) {
5270
5286
  const recipientAddress = import_address4.Address.fromAddressOrString(recipient);
5271
- const recipientDataArray = (0, import_utils29.arrayify)(
5287
+ const recipientDataArray = (0, import_utils28.arrayify)(
5272
5288
  "0x".concat(recipientAddress.toHexString().substring(2).padStart(64, "0"))
5273
5289
  );
5274
- const amountDataArray = (0, import_utils29.arrayify)(
5290
+ const amountDataArray = (0, import_utils28.arrayify)(
5275
5291
  "0x".concat((0, import_math21.bn)(amount).toHex().substring(2).padStart(16, "0"))
5276
5292
  );
5277
5293
  const script = new Uint8Array([
5278
- ...(0, import_utils29.arrayify)(withdrawScript.bytes),
5294
+ ...(0, import_utils28.arrayify)(withdrawScript.bytes),
5279
5295
  ...recipientDataArray,
5280
5296
  ...amountDataArray
5281
5297
  ]);
@@ -5355,7 +5371,7 @@ var Account = class extends import_interfaces.AbstractAccount {
5355
5371
  txParams: { gasLimit: setGasLimit, maxFee: setMaxFee }
5356
5372
  }) {
5357
5373
  const request = transactionRequestify(transactionRequest);
5358
- if (!(0, import_utils29.isDefined)(setGasLimit)) {
5374
+ if (!(0, import_utils28.isDefined)(setGasLimit)) {
5359
5375
  request.gasLimit = gasUsed;
5360
5376
  } else if (gasUsed.gt(setGasLimit)) {
5361
5377
  throw new import_errors16.FuelError(
@@ -5363,7 +5379,7 @@ var Account = class extends import_interfaces.AbstractAccount {
5363
5379
  `Gas limit '${setGasLimit}' is lower than the required: '${gasUsed}'.`
5364
5380
  );
5365
5381
  }
5366
- if (!(0, import_utils29.isDefined)(setMaxFee)) {
5382
+ if (!(0, import_utils28.isDefined)(setMaxFee)) {
5367
5383
  request.maxFee = maxFee;
5368
5384
  } else if (maxFee.gt(setMaxFee)) {
5369
5385
  throw new import_errors16.FuelError(
@@ -5380,7 +5396,7 @@ var import_address5 = require("@fuel-ts/address");
5380
5396
  var import_crypto2 = require("@fuel-ts/crypto");
5381
5397
  var import_hasher2 = require("@fuel-ts/hasher");
5382
5398
  var import_math22 = require("@fuel-ts/math");
5383
- var import_utils30 = require("@fuel-ts/utils");
5399
+ var import_utils29 = require("@fuel-ts/utils");
5384
5400
  var import_secp256k1 = require("@noble/curves/secp256k1");
5385
5401
  var Signer = class {
5386
5402
  address;
@@ -5400,9 +5416,9 @@ var Signer = class {
5400
5416
  }
5401
5417
  }
5402
5418
  const privateKeyBytes = (0, import_math22.toBytes)(privateKey, 32);
5403
- this.privateKey = (0, import_utils30.hexlify)(privateKeyBytes);
5404
- this.publicKey = (0, import_utils30.hexlify)(import_secp256k1.secp256k1.getPublicKey(privateKeyBytes, false).slice(1));
5405
- this.compressedPublicKey = (0, import_utils30.hexlify)(import_secp256k1.secp256k1.getPublicKey(privateKeyBytes, true));
5419
+ this.privateKey = (0, import_utils29.hexlify)(privateKeyBytes);
5420
+ this.publicKey = (0, import_utils29.hexlify)(import_secp256k1.secp256k1.getPublicKey(privateKeyBytes, false).slice(1));
5421
+ this.compressedPublicKey = (0, import_utils29.hexlify)(import_secp256k1.secp256k1.getPublicKey(privateKeyBytes, true));
5406
5422
  this.address = import_address5.Address.fromPublicKey(this.publicKey);
5407
5423
  }
5408
5424
  /**
@@ -5416,11 +5432,11 @@ var Signer = class {
5416
5432
  * @returns hashed signature
5417
5433
  */
5418
5434
  sign(data) {
5419
- const signature = import_secp256k1.secp256k1.sign((0, import_utils30.arrayify)(data), (0, import_utils30.arrayify)(this.privateKey));
5435
+ const signature = import_secp256k1.secp256k1.sign((0, import_utils29.arrayify)(data), (0, import_utils29.arrayify)(this.privateKey));
5420
5436
  const r = (0, import_math22.toBytes)(`0x${signature.r.toString(16)}`, 32);
5421
5437
  const s = (0, import_math22.toBytes)(`0x${signature.s.toString(16)}`, 32);
5422
5438
  s[0] |= (signature.recovery || 0) << 7;
5423
- return (0, import_utils30.hexlify)((0, import_utils30.concat)([r, s]));
5439
+ return (0, import_utils29.hexlify)((0, import_utils29.concat)([r, s]));
5424
5440
  }
5425
5441
  /**
5426
5442
  * Add point on the current elliptic curve
@@ -5429,8 +5445,8 @@ var Signer = class {
5429
5445
  * @returns compressed point on the curve
5430
5446
  */
5431
5447
  addPoint(point) {
5432
- const p0 = import_secp256k1.secp256k1.ProjectivePoint.fromHex((0, import_utils30.arrayify)(this.compressedPublicKey));
5433
- const p1 = import_secp256k1.secp256k1.ProjectivePoint.fromHex((0, import_utils30.arrayify)(point));
5448
+ const p0 = import_secp256k1.secp256k1.ProjectivePoint.fromHex((0, import_utils29.arrayify)(this.compressedPublicKey));
5449
+ const p1 = import_secp256k1.secp256k1.ProjectivePoint.fromHex((0, import_utils29.arrayify)(point));
5434
5450
  const result = p0.add(p1);
5435
5451
  return `0x${result.toHex(true)}`;
5436
5452
  }
@@ -5442,16 +5458,16 @@ var Signer = class {
5442
5458
  * @returns public key from signature from the
5443
5459
  */
5444
5460
  static recoverPublicKey(data, signature) {
5445
- const signedMessageBytes = (0, import_utils30.arrayify)(signature);
5461
+ const signedMessageBytes = (0, import_utils29.arrayify)(signature);
5446
5462
  const r = signedMessageBytes.slice(0, 32);
5447
5463
  const s = signedMessageBytes.slice(32, 64);
5448
5464
  const recoveryParam = (s[0] & 128) >> 7;
5449
5465
  s[0] &= 127;
5450
- const sig = new import_secp256k1.secp256k1.Signature(BigInt((0, import_utils30.hexlify)(r)), BigInt((0, import_utils30.hexlify)(s))).addRecoveryBit(
5466
+ const sig = new import_secp256k1.secp256k1.Signature(BigInt((0, import_utils29.hexlify)(r)), BigInt((0, import_utils29.hexlify)(s))).addRecoveryBit(
5451
5467
  recoveryParam
5452
5468
  );
5453
- const publicKey = sig.recoverPublicKey((0, import_utils30.arrayify)(data)).toRawBytes(false).slice(1);
5454
- return (0, import_utils30.hexlify)(publicKey);
5469
+ const publicKey = sig.recoverPublicKey((0, import_utils29.arrayify)(data)).toRawBytes(false).slice(1);
5470
+ return (0, import_utils29.hexlify)(publicKey);
5455
5471
  }
5456
5472
  /**
5457
5473
  * Recover the address from a signature performed with [`sign`](#sign).
@@ -5470,7 +5486,7 @@ var Signer = class {
5470
5486
  * @returns random 32-byte hashed
5471
5487
  */
5472
5488
  static generatePrivateKey(entropy) {
5473
- return entropy ? (0, import_hasher2.hash)((0, import_utils30.concat)([(0, import_crypto2.randomBytes)(32), (0, import_utils30.arrayify)(entropy)])) : (0, import_crypto2.randomBytes)(32);
5489
+ return entropy ? (0, import_hasher2.hash)((0, import_utils29.concat)([(0, import_crypto2.randomBytes)(32), (0, import_utils29.arrayify)(entropy)])) : (0, import_crypto2.randomBytes)(32);
5474
5490
  }
5475
5491
  /**
5476
5492
  * Extended publicKey from a compact publicKey
@@ -5479,8 +5495,8 @@ var Signer = class {
5479
5495
  * @returns extended publicKey
5480
5496
  */
5481
5497
  static extendPublicKey(publicKey) {
5482
- const point = import_secp256k1.secp256k1.ProjectivePoint.fromHex((0, import_utils30.arrayify)(publicKey));
5483
- return (0, import_utils30.hexlify)(point.toRawBytes(false).slice(1));
5498
+ const point = import_secp256k1.secp256k1.ProjectivePoint.fromHex((0, import_utils29.arrayify)(publicKey));
5499
+ return (0, import_utils29.hexlify)(point.toRawBytes(false).slice(1));
5484
5500
  }
5485
5501
  };
5486
5502
 
@@ -5488,7 +5504,7 @@ var Signer = class {
5488
5504
  var import_address6 = require("@fuel-ts/address");
5489
5505
  var import_crypto3 = require("@fuel-ts/crypto");
5490
5506
  var import_errors17 = require("@fuel-ts/errors");
5491
- var import_utils31 = require("@fuel-ts/utils");
5507
+ var import_utils30 = require("@fuel-ts/utils");
5492
5508
  var import_uuid = require("uuid");
5493
5509
  var DEFAULT_KDF_PARAMS_LOG_N = 13;
5494
5510
  var DEFAULT_KDF_PARAMS_R = 8;
@@ -5571,7 +5587,7 @@ async function decryptKeystoreWallet(jsonWallet, password) {
5571
5587
  );
5572
5588
  }
5573
5589
  const buffer = await (0, import_crypto3.decryptJsonWalletData)(ciphertextBuffer, key, ivBuffer);
5574
- const privateKey = (0, import_utils31.hexlify)(buffer);
5590
+ const privateKey = (0, import_utils30.hexlify)(buffer);
5575
5591
  return privateKey;
5576
5592
  }
5577
5593
 
@@ -5616,7 +5632,7 @@ var BaseWalletUnlocked = class extends Account {
5616
5632
  */
5617
5633
  async signMessage(message) {
5618
5634
  const signedMessage = await this.signer().sign((0, import_hasher3.hashMessage)(message));
5619
- return (0, import_utils32.hexlify)(signedMessage);
5635
+ return (0, import_utils31.hexlify)(signedMessage);
5620
5636
  }
5621
5637
  /**
5622
5638
  * Signs a transaction with the wallet's private key.
@@ -5629,7 +5645,7 @@ var BaseWalletUnlocked = class extends Account {
5629
5645
  const chainId = this.provider.getChainId();
5630
5646
  const hashedTransaction = transactionRequest.getTransactionId(chainId);
5631
5647
  const signature = await this.signer().sign(hashedTransaction);
5632
- return (0, import_utils32.hexlify)(signature);
5648
+ return (0, import_utils31.hexlify)(signature);
5633
5649
  }
5634
5650
  /**
5635
5651
  * Populates a transaction with the witnesses signature.
@@ -5691,14 +5707,14 @@ __publicField(BaseWalletUnlocked, "defaultPath", "m/44'/1179993420'/0'/0/0");
5691
5707
  var import_errors20 = require("@fuel-ts/errors");
5692
5708
  var import_hasher6 = require("@fuel-ts/hasher");
5693
5709
  var import_math23 = require("@fuel-ts/math");
5694
- var import_utils36 = require("@fuel-ts/utils");
5710
+ var import_utils35 = require("@fuel-ts/utils");
5695
5711
  var import_ethers2 = require("ethers");
5696
5712
 
5697
5713
  // src/mnemonic/mnemonic.ts
5698
5714
  var import_crypto4 = require("@fuel-ts/crypto");
5699
5715
  var import_errors19 = require("@fuel-ts/errors");
5700
5716
  var import_hasher5 = require("@fuel-ts/hasher");
5701
- var import_utils34 = require("@fuel-ts/utils");
5717
+ var import_utils33 = require("@fuel-ts/utils");
5702
5718
  var import_ethers = require("ethers");
5703
5719
 
5704
5720
  // src/wordlists/words/english.ts
@@ -7756,7 +7772,7 @@ var english = [
7756
7772
  // src/mnemonic/utils.ts
7757
7773
  var import_errors18 = require("@fuel-ts/errors");
7758
7774
  var import_hasher4 = require("@fuel-ts/hasher");
7759
- var import_utils33 = require("@fuel-ts/utils");
7775
+ var import_utils32 = require("@fuel-ts/utils");
7760
7776
  function toUtf8Bytes(stri) {
7761
7777
  const str = stri.normalize("NFKD");
7762
7778
  const result = [];
@@ -7823,14 +7839,14 @@ function entropyToMnemonicIndices(entropy) {
7823
7839
  }
7824
7840
  }
7825
7841
  const checksumBits = entropy.length / 4;
7826
- const checksum = (0, import_utils33.arrayify)((0, import_hasher4.sha256)(entropy))[0] & getUpperMask(checksumBits);
7842
+ const checksum = (0, import_utils32.arrayify)((0, import_hasher4.sha256)(entropy))[0] & getUpperMask(checksumBits);
7827
7843
  indices[indices.length - 1] <<= checksumBits;
7828
7844
  indices[indices.length - 1] |= checksum >> 8 - checksumBits;
7829
7845
  return indices;
7830
7846
  }
7831
7847
  function mnemonicWordsToEntropy(words, wordlist) {
7832
7848
  const size = Math.ceil(11 * words.length / 8);
7833
- const entropy = (0, import_utils33.arrayify)(new Uint8Array(size));
7849
+ const entropy = (0, import_utils32.arrayify)(new Uint8Array(size));
7834
7850
  let offset = 0;
7835
7851
  for (let i = 0; i < words.length; i += 1) {
7836
7852
  const index = wordlist.indexOf(words[i].normalize("NFKD"));
@@ -7850,7 +7866,7 @@ function mnemonicWordsToEntropy(words, wordlist) {
7850
7866
  const entropyBits = 32 * words.length / 3;
7851
7867
  const checksumBits = words.length / 3;
7852
7868
  const checksumMask = getUpperMask(checksumBits);
7853
- const checksum = (0, import_utils33.arrayify)((0, import_hasher4.sha256)(entropy.slice(0, entropyBits / 8)))[0] & checksumMask;
7869
+ const checksum = (0, import_utils32.arrayify)((0, import_hasher4.sha256)(entropy.slice(0, entropyBits / 8)))[0] & checksumMask;
7854
7870
  if (checksum !== (entropy[entropy.length - 1] & checksumMask)) {
7855
7871
  throw new import_errors18.FuelError(
7856
7872
  import_errors18.ErrorCode.INVALID_CHECKSUM,
@@ -7925,7 +7941,7 @@ var Mnemonic = class {
7925
7941
  static mnemonicToEntropy(phrase, wordlist = english) {
7926
7942
  const words = getWords(phrase);
7927
7943
  assertMnemonic(words);
7928
- return (0, import_utils34.hexlify)(mnemonicWordsToEntropy(words, wordlist));
7944
+ return (0, import_utils33.hexlify)(mnemonicWordsToEntropy(words, wordlist));
7929
7945
  }
7930
7946
  /**
7931
7947
  * @param entropy - Entropy source to the mnemonic phrase.
@@ -7933,7 +7949,7 @@ var Mnemonic = class {
7933
7949
  * @returns 64-byte array contains privateKey and chainCode as described on BIP39
7934
7950
  */
7935
7951
  static entropyToMnemonic(entropy, wordlist = english) {
7936
- const entropyBytes = (0, import_utils34.arrayify)(entropy);
7952
+ const entropyBytes = (0, import_utils33.arrayify)(entropy);
7937
7953
  assertWordList(wordlist);
7938
7954
  assertEntropy(entropyBytes);
7939
7955
  return entropyToMnemonicIndices(entropyBytes).map((i) => wordlist[i]).join(" ");
@@ -8002,14 +8018,14 @@ var Mnemonic = class {
8002
8018
  * @returns 64-byte array contains privateKey and chainCode as described on BIP39
8003
8019
  */
8004
8020
  static masterKeysFromSeed(seed) {
8005
- const seedArray = (0, import_utils34.arrayify)(seed);
8021
+ const seedArray = (0, import_utils33.arrayify)(seed);
8006
8022
  if (seedArray.length < 16 || seedArray.length > 64) {
8007
8023
  throw new import_errors19.FuelError(
8008
8024
  import_errors19.ErrorCode.INVALID_SEED,
8009
8025
  `Seed length should be between 16 and 64 bytes, but received ${seedArray.length} bytes.`
8010
8026
  );
8011
8027
  }
8012
- return (0, import_utils34.arrayify)((0, import_ethers.computeHmac)("sha512", MasterSecret, seedArray));
8028
+ return (0, import_utils33.arrayify)((0, import_ethers.computeHmac)("sha512", MasterSecret, seedArray));
8013
8029
  }
8014
8030
  /**
8015
8031
  * Get the extendKey as defined on BIP-32 from the provided seed
@@ -8020,22 +8036,22 @@ var Mnemonic = class {
8020
8036
  */
8021
8037
  static seedToExtendedKey(seed, testnet = false) {
8022
8038
  const masterKey = Mnemonic.masterKeysFromSeed(seed);
8023
- const prefix = (0, import_utils34.arrayify)(testnet ? TestnetPRV : MainnetPRV);
8039
+ const prefix = (0, import_utils33.arrayify)(testnet ? TestnetPRV : MainnetPRV);
8024
8040
  const depth = "0x00";
8025
8041
  const fingerprint = "0x00000000";
8026
8042
  const index = "0x00000000";
8027
8043
  const chainCode = masterKey.slice(32);
8028
8044
  const privateKey = masterKey.slice(0, 32);
8029
- const extendedKey = (0, import_utils34.concat)([
8045
+ const extendedKey = (0, import_utils33.concat)([
8030
8046
  prefix,
8031
8047
  depth,
8032
8048
  fingerprint,
8033
8049
  index,
8034
8050
  chainCode,
8035
- (0, import_utils34.concat)(["0x00", privateKey])
8051
+ (0, import_utils33.concat)(["0x00", privateKey])
8036
8052
  ]);
8037
8053
  const checksum = (0, import_ethers.dataSlice)((0, import_hasher5.sha256)((0, import_hasher5.sha256)(extendedKey)), 0, 4);
8038
- return (0, import_ethers.encodeBase58)((0, import_utils34.concat)([extendedKey, checksum]));
8054
+ return (0, import_ethers.encodeBase58)((0, import_utils33.concat)([extendedKey, checksum]));
8039
8055
  }
8040
8056
  /**
8041
8057
  * Create a new mnemonic using a randomly generated number as entropy.
@@ -8050,7 +8066,7 @@ var Mnemonic = class {
8050
8066
  * @returns A randomly generated mnemonic
8051
8067
  */
8052
8068
  static generate(size = 32, extraEntropy = "") {
8053
- const entropy = extraEntropy ? (0, import_hasher5.sha256)((0, import_utils34.concat)([(0, import_crypto4.randomBytes)(size), (0, import_utils34.arrayify)(extraEntropy)])) : (0, import_crypto4.randomBytes)(size);
8069
+ const entropy = extraEntropy ? (0, import_hasher5.sha256)((0, import_utils33.concat)([(0, import_crypto4.randomBytes)(size), (0, import_utils33.arrayify)(extraEntropy)])) : (0, import_crypto4.randomBytes)(size);
8054
8070
  return Mnemonic.entropyToMnemonic(entropy);
8055
8071
  }
8056
8072
  };
@@ -8058,12 +8074,12 @@ var mnemonic_default = Mnemonic;
8058
8074
 
8059
8075
  // src/hdwallet/hdwallet.ts
8060
8076
  var HARDENED_INDEX = 2147483648;
8061
- var MainnetPRV2 = (0, import_utils36.hexlify)("0x0488ade4");
8062
- var MainnetPUB = (0, import_utils36.hexlify)("0x0488b21e");
8063
- var TestnetPRV2 = (0, import_utils36.hexlify)("0x04358394");
8064
- var TestnetPUB = (0, import_utils36.hexlify)("0x043587cf");
8077
+ var MainnetPRV2 = (0, import_utils35.hexlify)("0x0488ade4");
8078
+ var MainnetPUB = (0, import_utils35.hexlify)("0x0488b21e");
8079
+ var TestnetPRV2 = (0, import_utils35.hexlify)("0x04358394");
8080
+ var TestnetPUB = (0, import_utils35.hexlify)("0x043587cf");
8065
8081
  function base58check(data) {
8066
- return (0, import_ethers2.encodeBase58)((0, import_utils36.concat)([data, (0, import_ethers2.dataSlice)((0, import_hasher6.sha256)((0, import_hasher6.sha256)(data)), 0, 4)]));
8082
+ return (0, import_ethers2.encodeBase58)((0, import_utils35.concat)([data, (0, import_ethers2.dataSlice)((0, import_hasher6.sha256)((0, import_hasher6.sha256)(data)), 0, 4)]));
8067
8083
  }
8068
8084
  function getExtendedKeyPrefix(isPublic = false, testnet = false) {
8069
8085
  if (isPublic) {
@@ -8072,11 +8088,11 @@ function getExtendedKeyPrefix(isPublic = false, testnet = false) {
8072
8088
  return testnet ? TestnetPRV2 : MainnetPRV2;
8073
8089
  }
8074
8090
  function isPublicExtendedKey(extendedKey) {
8075
- return [MainnetPUB, TestnetPUB].includes((0, import_utils36.hexlify)(extendedKey.slice(0, 4)));
8091
+ return [MainnetPUB, TestnetPUB].includes((0, import_utils35.hexlify)(extendedKey.slice(0, 4)));
8076
8092
  }
8077
8093
  function isValidExtendedKey(extendedKey) {
8078
8094
  return [MainnetPRV2, TestnetPRV2, MainnetPUB, TestnetPUB].includes(
8079
- (0, import_utils36.hexlify)(extendedKey.slice(0, 4))
8095
+ (0, import_utils35.hexlify)(extendedKey.slice(0, 4))
8080
8096
  );
8081
8097
  }
8082
8098
  function parsePath(path2, depth = 0) {
@@ -8094,8 +8110,8 @@ function parsePath(path2, depth = 0) {
8094
8110
  var HDWallet = class {
8095
8111
  depth = 0;
8096
8112
  index = 0;
8097
- fingerprint = (0, import_utils36.hexlify)("0x00000000");
8098
- parentFingerprint = (0, import_utils36.hexlify)("0x00000000");
8113
+ fingerprint = (0, import_utils35.hexlify)("0x00000000");
8114
+ parentFingerprint = (0, import_utils35.hexlify)("0x00000000");
8099
8115
  privateKey;
8100
8116
  publicKey;
8101
8117
  chainCode;
@@ -8107,8 +8123,8 @@ var HDWallet = class {
8107
8123
  constructor(config) {
8108
8124
  if (config.privateKey) {
8109
8125
  const signer = new Signer(config.privateKey);
8110
- this.publicKey = (0, import_utils36.hexlify)(signer.compressedPublicKey);
8111
- this.privateKey = (0, import_utils36.hexlify)(config.privateKey);
8126
+ this.publicKey = (0, import_utils35.hexlify)(signer.compressedPublicKey);
8127
+ this.privateKey = (0, import_utils35.hexlify)(config.privateKey);
8112
8128
  } else {
8113
8129
  if (!config.publicKey) {
8114
8130
  throw new import_errors20.FuelError(
@@ -8116,7 +8132,7 @@ var HDWallet = class {
8116
8132
  "Both public and private Key cannot be missing. At least one should be provided."
8117
8133
  );
8118
8134
  }
8119
- this.publicKey = (0, import_utils36.hexlify)(config.publicKey);
8135
+ this.publicKey = (0, import_utils35.hexlify)(config.publicKey);
8120
8136
  }
8121
8137
  this.parentFingerprint = config.parentFingerprint || this.parentFingerprint;
8122
8138
  this.fingerprint = (0, import_ethers2.dataSlice)((0, import_ethers2.ripemd160)((0, import_hasher6.sha256)(this.publicKey)), 0, 4);
@@ -8135,9 +8151,9 @@ var HDWallet = class {
8135
8151
  * @returns A new instance of HDWallet on the derived index
8136
8152
  */
8137
8153
  deriveIndex(index) {
8138
- const privateKey = this.privateKey && (0, import_utils36.arrayify)(this.privateKey);
8139
- const publicKey = (0, import_utils36.arrayify)(this.publicKey);
8140
- const chainCode = (0, import_utils36.arrayify)(this.chainCode);
8154
+ const privateKey = this.privateKey && (0, import_utils35.arrayify)(this.privateKey);
8155
+ const publicKey = (0, import_utils35.arrayify)(this.publicKey);
8156
+ const chainCode = (0, import_utils35.arrayify)(this.chainCode);
8141
8157
  const data = new Uint8Array(37);
8142
8158
  if (index & HARDENED_INDEX) {
8143
8159
  if (!privateKey) {
@@ -8148,10 +8164,10 @@ var HDWallet = class {
8148
8164
  }
8149
8165
  data.set(privateKey, 1);
8150
8166
  } else {
8151
- data.set((0, import_utils36.arrayify)(this.publicKey));
8167
+ data.set((0, import_utils35.arrayify)(this.publicKey));
8152
8168
  }
8153
8169
  data.set((0, import_math23.toBytes)(index, 4), 33);
8154
- const bytes = (0, import_utils36.arrayify)((0, import_ethers2.computeHmac)("sha512", chainCode, data));
8170
+ const bytes = (0, import_utils35.arrayify)((0, import_ethers2.computeHmac)("sha512", chainCode, data));
8155
8171
  const IL = bytes.slice(0, 32);
8156
8172
  const IR = bytes.slice(32);
8157
8173
  if (privateKey) {
@@ -8165,7 +8181,7 @@ var HDWallet = class {
8165
8181
  parentFingerprint: this.fingerprint
8166
8182
  });
8167
8183
  }
8168
- const signer = new Signer((0, import_utils36.hexlify)(IL));
8184
+ const signer = new Signer((0, import_utils35.hexlify)(IL));
8169
8185
  const Ki = signer.addPoint(publicKey);
8170
8186
  return new HDWallet({
8171
8187
  publicKey: Ki,
@@ -8200,12 +8216,12 @@ var HDWallet = class {
8200
8216
  );
8201
8217
  }
8202
8218
  const prefix = getExtendedKeyPrefix(this.privateKey == null || isPublic, testnet);
8203
- const depth = (0, import_utils36.hexlify)(Uint8Array.from([this.depth]));
8219
+ const depth = (0, import_utils35.hexlify)(Uint8Array.from([this.depth]));
8204
8220
  const parentFingerprint = this.parentFingerprint;
8205
8221
  const index = (0, import_math23.toHex)(this.index, 4);
8206
8222
  const chainCode = this.chainCode;
8207
- const key = this.privateKey != null && !isPublic ? (0, import_utils36.concat)(["0x00", this.privateKey]) : this.publicKey;
8208
- const extendedKey = (0, import_utils36.arrayify)((0, import_utils36.concat)([prefix, depth, parentFingerprint, index, chainCode, key]));
8223
+ const key = this.privateKey != null && !isPublic ? (0, import_utils35.concat)(["0x00", this.privateKey]) : this.publicKey;
8224
+ const extendedKey = (0, import_utils35.arrayify)((0, import_utils35.concat)([prefix, depth, parentFingerprint, index, chainCode, key]));
8209
8225
  return base58check(extendedKey);
8210
8226
  }
8211
8227
  /**
@@ -8217,13 +8233,13 @@ var HDWallet = class {
8217
8233
  static fromSeed(seed) {
8218
8234
  const masterKey = mnemonic_default.masterKeysFromSeed(seed);
8219
8235
  return new HDWallet({
8220
- chainCode: (0, import_utils36.arrayify)(masterKey.slice(32)),
8221
- privateKey: (0, import_utils36.arrayify)(masterKey.slice(0, 32))
8236
+ chainCode: (0, import_utils35.arrayify)(masterKey.slice(32)),
8237
+ privateKey: (0, import_utils35.arrayify)(masterKey.slice(0, 32))
8222
8238
  });
8223
8239
  }
8224
8240
  static fromExtendedKey(extendedKey) {
8225
8241
  const decoded = (0, import_ethers2.toBeHex)((0, import_ethers2.decodeBase58)(extendedKey));
8226
- const bytes = (0, import_utils36.arrayify)(decoded);
8242
+ const bytes = (0, import_utils35.arrayify)(decoded);
8227
8243
  const validChecksum = base58check(bytes.slice(0, 78)) === extendedKey;
8228
8244
  if (bytes.length !== 82 || !isValidExtendedKey(bytes)) {
8229
8245
  throw new import_errors20.FuelError(import_errors20.ErrorCode.HD_WALLET_ERROR, "Provided key is not a valid extended key.");
@@ -8232,9 +8248,9 @@ var HDWallet = class {
8232
8248
  throw new import_errors20.FuelError(import_errors20.ErrorCode.HD_WALLET_ERROR, "Provided key has an invalid checksum.");
8233
8249
  }
8234
8250
  const depth = bytes[4];
8235
- const parentFingerprint = (0, import_utils36.hexlify)(bytes.slice(5, 9));
8236
- const index = parseInt((0, import_utils36.hexlify)(bytes.slice(9, 13)).substring(2), 16);
8237
- const chainCode = (0, import_utils36.hexlify)(bytes.slice(13, 45));
8251
+ const parentFingerprint = (0, import_utils35.hexlify)(bytes.slice(5, 9));
8252
+ const index = parseInt((0, import_utils35.hexlify)(bytes.slice(9, 13)).substring(2), 16);
8253
+ const chainCode = (0, import_utils35.hexlify)(bytes.slice(13, 45));
8238
8254
  const key = bytes.slice(45, 78);
8239
8255
  if (depth === 0 && parentFingerprint !== "0x00000000" || depth === 0 && index !== 0) {
8240
8256
  throw new import_errors20.FuelError(
@@ -8422,16 +8438,18 @@ __publicField(Wallet, "fromEncryptedJson", WalletUnlocked.fromEncryptedJson);
8422
8438
 
8423
8439
  // src/test-utils/seedTestWallet.ts
8424
8440
  var import_crypto5 = require("@fuel-ts/crypto");
8425
- var seedTestWallet = async (wallet, quantities) => {
8426
- const genesisWallet = new WalletUnlocked(
8427
- process.env.GENESIS_SECRET || (0, import_crypto5.randomBytes)(32),
8428
- wallet.provider
8429
- );
8441
+ var seedTestWallet = async (wallet, quantities, utxosAmount = 1) => {
8442
+ const accountsToBeFunded = Array.isArray(wallet) ? wallet : [wallet];
8443
+ const [{ provider }] = accountsToBeFunded;
8444
+ const genesisWallet = new WalletUnlocked(process.env.GENESIS_SECRET || (0, import_crypto5.randomBytes)(32), provider);
8430
8445
  const request = new ScriptTransactionRequest();
8431
- quantities.forEach((quantity) => {
8432
- const { amount, assetId } = coinQuantityfy(quantity);
8433
- request.addCoinOutput(wallet.address, amount, assetId);
8434
- });
8446
+ quantities.map(coinQuantityfy).forEach(
8447
+ ({ amount, assetId }) => accountsToBeFunded.forEach(({ address }) => {
8448
+ for (let i = 0; i < utxosAmount; i++) {
8449
+ request.addCoinOutput(address, amount.div(utxosAmount), assetId);
8450
+ }
8451
+ })
8452
+ );
8435
8453
  const txCost = await genesisWallet.provider.getTransactionCost(request);
8436
8454
  request.gasLimit = txCost.gasUsed;
8437
8455
  request.maxFee = txCost.maxFee;
@@ -8451,7 +8469,7 @@ var generateTestWallet = async (provider, quantities) => {
8451
8469
  // src/test-utils/launchNode.ts
8452
8470
  var import_abi_coder7 = require("@fuel-ts/abi-coder");
8453
8471
  var import_crypto6 = require("@fuel-ts/crypto");
8454
- var import_utils37 = require("@fuel-ts/utils");
8472
+ var import_utils36 = require("@fuel-ts/utils");
8455
8473
  var import_cli_utils = require("@fuel-ts/utils/cli-utils");
8456
8474
  var import_child_process = require("child_process");
8457
8475
  var import_crypto7 = require("crypto");
@@ -8491,40 +8509,6 @@ var killNode = (params) => {
8491
8509
  }
8492
8510
  }
8493
8511
  };
8494
- function getFinalStateConfigJSON({ stateConfig, chainConfig }) {
8495
- const defaultCoins = import_utils37.defaultSnapshotConfigs.stateConfig.coins.map((coin) => ({
8496
- ...coin,
8497
- amount: "18446744073709551615"
8498
- }));
8499
- const defaultMessages = import_utils37.defaultSnapshotConfigs.stateConfig.messages.map((message) => ({
8500
- ...message,
8501
- amount: "18446744073709551615"
8502
- }));
8503
- const coins = defaultCoins.concat(stateConfig.coins.map((coin) => ({ ...coin, amount: coin.amount.toString() }))).filter((coin, index, self) => self.findIndex((c) => c.tx_id === coin.tx_id) === index);
8504
- const messages = defaultMessages.concat(stateConfig.messages.map((msg) => ({ ...msg, amount: msg.amount.toString() }))).filter((msg, index, self) => self.findIndex((m) => m.nonce === msg.nonce) === index);
8505
- if (!process.env.GENESIS_SECRET) {
8506
- const pk = Signer.generatePrivateKey();
8507
- const signer = new Signer(pk);
8508
- process.env.GENESIS_SECRET = (0, import_utils37.hexlify)(pk);
8509
- coins.push({
8510
- tx_id: (0, import_utils37.hexlify)((0, import_crypto6.randomBytes)(import_abi_coder7.UTXO_ID_LEN)),
8511
- owner: signer.address.toHexString(),
8512
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
8513
- amount: "18446744073709551615",
8514
- asset_id: chainConfig.consensus_parameters.V1.base_asset_id,
8515
- output_index: 0,
8516
- tx_pointer_block_height: 0,
8517
- tx_pointer_tx_idx: 0
8518
- });
8519
- }
8520
- const json = JSON.stringify({
8521
- ...stateConfig,
8522
- coins,
8523
- messages
8524
- });
8525
- const regexMakeNumber = /("amount":)"(\d+)"/gm;
8526
- return json.replace(regexMakeNumber, "$1$2");
8527
- }
8528
8512
  var launchNode = async ({
8529
8513
  ip,
8530
8514
  port,
@@ -8532,8 +8516,7 @@ var launchNode = async ({
8532
8516
  useSystemFuelCore = false,
8533
8517
  loggingEnabled = true,
8534
8518
  debugEnabled = false,
8535
- basePath,
8536
- snapshotConfig = import_utils37.defaultSnapshotConfigs
8519
+ basePath
8537
8520
  }) => (
8538
8521
  // eslint-disable-next-line no-async-promise-executor
8539
8522
  new Promise(async (resolve, reject) => {
@@ -8544,7 +8527,7 @@ var launchNode = async ({
8544
8527
  "--poa-instant"
8545
8528
  ]);
8546
8529
  const snapshotDir = getFlagValueFromArgs(args, "--snapshot");
8547
- const consensusKey = getFlagValueFromArgs(args, "--consensus-key") || import_utils37.defaultConsensusKey;
8530
+ const consensusKey = getFlagValueFromArgs(args, "--consensus-key") || import_utils36.defaultConsensusKey;
8548
8531
  const dbTypeFlagValue = getFlagValueFromArgs(args, "--db-type");
8549
8532
  const useInMemoryDb = dbTypeFlagValue === "in-memory" || dbTypeFlagValue === void 0;
8550
8533
  const poaInstantFlagValue = getFlagValueFromArgs(args, "--poa-instant");
@@ -8562,23 +8545,56 @@ var launchNode = async ({
8562
8545
  let snapshotDirToUse;
8563
8546
  const prefix = basePath || import_os.default.tmpdir();
8564
8547
  const suffix = basePath ? "" : (0, import_crypto7.randomUUID)();
8565
- const tempDir = import_path.default.join(prefix, ".fuels", suffix, "snapshotDir");
8548
+ const tempDirPath = import_path.default.join(prefix, ".fuels", suffix, "snapshotDir");
8566
8549
  if (snapshotDir) {
8567
8550
  snapshotDirToUse = snapshotDir;
8568
8551
  } else {
8569
- if (!(0, import_fs.existsSync)(tempDir)) {
8570
- (0, import_fs.mkdirSync)(tempDir, { recursive: true });
8552
+ if (!(0, import_fs.existsSync)(tempDirPath)) {
8553
+ (0, import_fs.mkdirSync)(tempDirPath, { recursive: true });
8554
+ }
8555
+ let { stateConfigJson } = import_utils36.defaultSnapshotConfigs;
8556
+ const { chainConfigJson, metadataJson } = import_utils36.defaultSnapshotConfigs;
8557
+ stateConfigJson = {
8558
+ ...stateConfigJson,
8559
+ coins: [
8560
+ ...stateConfigJson.coins.map((coin) => ({
8561
+ ...coin,
8562
+ amount: "18446744073709551615"
8563
+ }))
8564
+ ],
8565
+ messages: stateConfigJson.messages.map((message) => ({
8566
+ ...message,
8567
+ amount: "18446744073709551615"
8568
+ }))
8569
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
8570
+ };
8571
+ if (!process.env.GENESIS_SECRET) {
8572
+ const pk = Signer.generatePrivateKey();
8573
+ const signer = new Signer(pk);
8574
+ process.env.GENESIS_SECRET = (0, import_utils36.hexlify)(pk);
8575
+ stateConfigJson.coins.push({
8576
+ tx_id: (0, import_utils36.hexlify)((0, import_crypto6.randomBytes)(import_abi_coder7.UTXO_ID_LEN)),
8577
+ owner: signer.address.toHexString(),
8578
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
8579
+ amount: "18446744073709551615",
8580
+ asset_id: chainConfigJson.consensus_parameters.V1.base_asset_id,
8581
+ output_index: 0,
8582
+ tx_pointer_block_height: 0,
8583
+ tx_pointer_tx_idx: 0
8584
+ });
8571
8585
  }
8572
- const { metadata } = snapshotConfig;
8573
- const metadataPath = import_path.default.join(tempDir, "metadata.json");
8574
- const chainConfigPath = import_path.default.join(tempDir, metadata.chain_config);
8575
- const stateConfigPath = import_path.default.join(tempDir, metadata.table_encoding.Json.filepath);
8576
- const stateTransitionPath = import_path.default.join(tempDir, "state_transition_bytecode.wasm");
8577
- (0, import_fs.writeFileSync)(chainConfigPath, JSON.stringify(snapshotConfig.chainConfig), "utf8");
8578
- (0, import_fs.writeFileSync)(stateConfigPath, getFinalStateConfigJSON(snapshotConfig), "utf8");
8579
- (0, import_fs.writeFileSync)(metadataPath, JSON.stringify(metadata), "utf8");
8580
- (0, import_fs.writeFileSync)(stateTransitionPath, JSON.stringify(""));
8581
- snapshotDirToUse = tempDir;
8586
+ let fixedStateConfigJSON = JSON.stringify(stateConfigJson);
8587
+ const regexMakeNumber = /("amount":)"(\d+)"/gm;
8588
+ fixedStateConfigJSON = fixedStateConfigJSON.replace(regexMakeNumber, "$1$2");
8589
+ const chainConfigWritePath = import_path.default.join(tempDirPath, "chainConfig.json");
8590
+ const stateConfigWritePath = import_path.default.join(tempDirPath, "stateConfig.json");
8591
+ const metadataWritePath = import_path.default.join(tempDirPath, "metadata.json");
8592
+ const stateTransitionWritePath = import_path.default.join(tempDirPath, "state_transition_bytecode.wasm");
8593
+ (0, import_fs.writeFileSync)(chainConfigWritePath, JSON.stringify(chainConfigJson), "utf8");
8594
+ (0, import_fs.writeFileSync)(stateConfigWritePath, fixedStateConfigJSON, "utf8");
8595
+ (0, import_fs.writeFileSync)(metadataWritePath, JSON.stringify(metadataJson), "utf8");
8596
+ (0, import_fs.writeFileSync)(stateTransitionWritePath, JSON.stringify(""));
8597
+ snapshotDirToUse = tempDirPath;
8582
8598
  }
8583
8599
  const child = (0, import_child_process.spawn)(
8584
8600
  command,
@@ -8586,7 +8602,7 @@ var launchNode = async ({
8586
8602
  "run",
8587
8603
  ["--ip", ipToUse],
8588
8604
  ["--port", portToUse],
8589
- useInMemoryDb ? ["--db-type", "in-memory"] : ["--db-path", tempDir],
8605
+ useInMemoryDb ? ["--db-type", "in-memory"] : ["--db-path", tempDirPath],
8590
8606
  ["--min-gas-price", "1"],
8591
8607
  poaInstant ? ["--poa-instant", "true"] : [],
8592
8608
  ["--consensus-key", consensusKey],
@@ -8608,28 +8624,23 @@ var launchNode = async ({
8608
8624
  }
8609
8625
  const cleanupConfig = {
8610
8626
  child,
8611
- configPath: tempDir,
8627
+ configPath: tempDirPath,
8612
8628
  killFn: import_tree_kill.default,
8613
8629
  state: {
8614
8630
  isDead: false
8615
8631
  }
8616
8632
  };
8617
8633
  child.stderr.on("data", (chunk) => {
8618
- const text = typeof chunk === "string" ? chunk : chunk.toString();
8619
- if (text.indexOf(graphQLStartSubstring) !== -1) {
8620
- const rows = text.split("\n");
8621
- const rowWithUrl = rows.find((row) => row.indexOf(graphQLStartSubstring) !== -1);
8622
- const [realIp, realPort] = rowWithUrl.split(" ").at(-1).trim().split(":");
8634
+ if (chunk.indexOf(graphQLStartSubstring) !== -1) {
8623
8635
  resolve({
8624
8636
  cleanup: () => killNode(cleanupConfig),
8625
- ip: realIp,
8626
- port: realPort,
8627
- url: `http://${realIp}:${realPort}/v1/graphql`,
8637
+ ip: ipToUse,
8638
+ port: portToUse,
8628
8639
  snapshotDir: snapshotDirToUse
8629
8640
  });
8630
8641
  }
8631
- if (/error/i.test(text)) {
8632
- reject(text.toString());
8642
+ if (/error/i.test(chunk)) {
8643
+ reject(chunk.toString());
8633
8644
  }
8634
8645
  });
8635
8646
  process.on("exit", () => killNode(cleanupConfig));
@@ -8662,238 +8673,12 @@ var launchNodeAndGetWallets = async ({
8662
8673
  };
8663
8674
  return { wallets, stop: cleanup, provider };
8664
8675
  };
8665
-
8666
- // src/test-utils/setup-test-provider-and-wallets.ts
8667
- var import_utils40 = require("@fuel-ts/utils");
8668
- var import_ramda5 = require("ramda");
8669
-
8670
- // src/test-utils/asset-id.ts
8671
- var import_crypto8 = require("@fuel-ts/crypto");
8672
- var import_utils38 = require("@fuel-ts/utils");
8673
- var _AssetId = class {
8674
- constructor(value) {
8675
- this.value = value;
8676
- }
8677
- static random() {
8678
- return new _AssetId((0, import_utils38.hexlify)((0, import_crypto8.randomBytes)(32)));
8679
- }
8680
- };
8681
- var AssetId = _AssetId;
8682
- __publicField(AssetId, "A", new _AssetId(
8683
- "0x0101010101010101010101010101010101010101010101010101010101010101"
8684
- ));
8685
- __publicField(AssetId, "B", new _AssetId(
8686
- "0x0202020202020202020202020202020202020202020202020202020202020202"
8687
- ));
8688
-
8689
- // src/test-utils/wallet-config.ts
8690
- var import_crypto9 = require("@fuel-ts/crypto");
8691
- var import_errors21 = require("@fuel-ts/errors");
8692
- var import_utils39 = require("@fuel-ts/utils");
8693
- var WalletConfig = class {
8694
- initialState;
8695
- options;
8696
- wallets;
8697
- generateWallets = () => {
8698
- const generatedWallets = [];
8699
- for (let index = 1; index <= this.options.count; index++) {
8700
- generatedWallets.push(new WalletUnlocked((0, import_crypto9.randomBytes)(32)));
8701
- }
8702
- return generatedWallets;
8703
- };
8704
- constructor(baseAssetId, config) {
8705
- const BASE_ASSET_ID = baseAssetId.startsWith("0x") ? baseAssetId : `0x${baseAssetId}`;
8706
- WalletConfig.guard(config);
8707
- this.options = config;
8708
- const { assets: assets2, coinsPerAsset, amountPerCoin, messages } = this.options;
8709
- this.wallets = this.generateWallets();
8710
- this.initialState = {
8711
- messages: WalletConfig.createMessages(this.wallets, messages),
8712
- coins: WalletConfig.createCoins(
8713
- this.wallets,
8714
- BASE_ASSET_ID,
8715
- assets2,
8716
- coinsPerAsset,
8717
- amountPerCoin
8718
- )
8719
- };
8720
- }
8721
- apply(snapshotConfig) {
8722
- return {
8723
- ...snapshotConfig,
8724
- stateConfig: {
8725
- ...snapshotConfig?.stateConfig ?? import_utils39.defaultSnapshotConfigs.stateConfig,
8726
- coins: this.initialState.coins.concat(snapshotConfig?.stateConfig?.coins || []),
8727
- messages: this.initialState.messages.concat(snapshotConfig?.stateConfig?.messages ?? [])
8728
- }
8729
- };
8730
- }
8731
- static createMessages(wallets, messages) {
8732
- return messages.map((msg) => wallets.map((wallet) => msg.toChainMessage(wallet.address))).flatMap((x) => x);
8733
- }
8734
- static createCoins(wallets, baseAssetId, assets2, coinsPerAsset, amountPerCoin) {
8735
- const coins = [];
8736
- let assetIds = [baseAssetId];
8737
- if (Array.isArray(assets2)) {
8738
- assetIds = assetIds.concat(assets2.map((a) => a.value));
8739
- } else {
8740
- for (let index = 0; index < assets2 - 1; index++) {
8741
- assetIds.push(AssetId.random().value);
8742
- }
8743
- }
8744
- wallets.map((wallet) => wallet.address.toHexString()).forEach((walletAddress) => {
8745
- assetIds.forEach((assetId) => {
8746
- for (let index = 0; index < coinsPerAsset; index++) {
8747
- coins.push({
8748
- amount: amountPerCoin,
8749
- asset_id: assetId,
8750
- owner: walletAddress,
8751
- tx_pointer_block_height: 0,
8752
- tx_pointer_tx_idx: 0,
8753
- output_index: 0,
8754
- tx_id: (0, import_utils39.hexlify)((0, import_crypto9.randomBytes)(32))
8755
- });
8756
- }
8757
- });
8758
- });
8759
- return coins;
8760
- }
8761
- static guard({
8762
- count: wallets,
8763
- assets: assets2,
8764
- coinsPerAsset,
8765
- amountPerCoin
8766
- }) {
8767
- if (Array.isArray(wallets) && wallets.length === 0 || typeof wallets === "number" && wallets <= 0) {
8768
- throw new import_errors21.FuelError(
8769
- import_errors21.FuelError.CODES.INVALID_INPUT_PARAMETERS,
8770
- "Number of wallets must be greater than zero."
8771
- );
8772
- }
8773
- if (Array.isArray(assets2) && assets2.length === 0 || typeof assets2 === "number" && assets2 <= 0) {
8774
- throw new import_errors21.FuelError(
8775
- import_errors21.FuelError.CODES.INVALID_INPUT_PARAMETERS,
8776
- "Number of assets per wallet must be greater than zero."
8777
- );
8778
- }
8779
- if (coinsPerAsset <= 0) {
8780
- throw new import_errors21.FuelError(
8781
- import_errors21.FuelError.CODES.INVALID_INPUT_PARAMETERS,
8782
- "Number of coins per asset must be greater than zero."
8783
- );
8784
- }
8785
- if (amountPerCoin <= 0) {
8786
- throw new import_errors21.FuelError(
8787
- import_errors21.FuelError.CODES.INVALID_INPUT_PARAMETERS,
8788
- "Amount per coin must be greater than zero."
8789
- );
8790
- }
8791
- }
8792
- };
8793
-
8794
- // src/test-utils/setup-test-provider-and-wallets.ts
8795
- var defaultWalletConfigOptions = {
8796
- count: 2,
8797
- assets: [AssetId.A, AssetId.B],
8798
- coinsPerAsset: 1,
8799
- amountPerCoin: 1e10,
8800
- messages: []
8801
- };
8802
- async function setupTestProviderAndWallets({
8803
- walletConfig: walletConfigOptions = {},
8804
- providerOptions,
8805
- nodeOptions = {}
8806
- } = {}) {
8807
- Symbol.dispose ??= Symbol("Symbol.dispose");
8808
- const walletConfig = new WalletConfig(
8809
- nodeOptions.snapshotConfig?.chainConfig?.consensus_parameters?.V1?.base_asset_id ?? import_utils40.defaultSnapshotConfigs.chainConfig.consensus_parameters.V1.base_asset_id,
8810
- {
8811
- ...defaultWalletConfigOptions,
8812
- ...walletConfigOptions
8813
- }
8814
- );
8815
- const { cleanup, url } = await launchNode({
8816
- loggingEnabled: false,
8817
- ...nodeOptions,
8818
- snapshotConfig: (0, import_ramda5.mergeDeepRight)(
8819
- import_utils40.defaultSnapshotConfigs,
8820
- walletConfig.apply(nodeOptions?.snapshotConfig)
8821
- ),
8822
- port: "0"
8823
- });
8824
- let provider;
8825
- try {
8826
- provider = await Provider.create(url, providerOptions);
8827
- } catch (err) {
8828
- cleanup();
8829
- throw err;
8830
- }
8831
- const wallets = walletConfig.wallets;
8832
- wallets.forEach((wallet) => {
8833
- wallet.connect(provider);
8834
- });
8835
- return {
8836
- provider,
8837
- wallets,
8838
- cleanup,
8839
- [Symbol.dispose]: cleanup
8840
- };
8841
- }
8842
-
8843
- // src/test-utils/test-message.ts
8844
- var import_address7 = require("@fuel-ts/address");
8845
- var import_crypto10 = require("@fuel-ts/crypto");
8846
- var import_math24 = require("@fuel-ts/math");
8847
- var import_utils41 = require("@fuel-ts/utils");
8848
- var TestMessage = class {
8849
- sender;
8850
- recipient;
8851
- nonce;
8852
- amount;
8853
- data;
8854
- da_height;
8855
- /**
8856
- * A helper class to create messages for testing purposes.
8857
- *
8858
- * Used in tandem with `WalletConfig`.
8859
- * It can also be used standalone and passed into the initial state of a chain via the `.toChainMessage` method.
8860
- */
8861
- constructor({
8862
- sender = import_address7.Address.fromRandom(),
8863
- recipient = import_address7.Address.fromRandom(),
8864
- nonce = (0, import_utils41.hexlify)((0, import_crypto10.randomBytes)(32)),
8865
- amount = 1e6,
8866
- data = "02",
8867
- da_height = 0
8868
- } = {}) {
8869
- this.sender = sender;
8870
- this.recipient = recipient;
8871
- this.nonce = nonce;
8872
- this.amount = amount;
8873
- this.data = data;
8874
- this.da_height = da_height;
8875
- }
8876
- toChainMessage(recipient) {
8877
- return {
8878
- sender: this.sender.toB256(),
8879
- recipient: recipient?.toB256() ?? this.recipient.toB256(),
8880
- nonce: this.nonce,
8881
- amount: (0, import_math24.bn)(this.amount).toNumber(),
8882
- data: this.data,
8883
- da_height: this.da_height
8884
- };
8885
- }
8886
- };
8887
8676
  // Annotate the CommonJS export names for ESM import in node:
8888
8677
  0 && (module.exports = {
8889
- AssetId,
8890
- TestMessage,
8891
- WalletConfig,
8892
8678
  generateTestWallet,
8893
8679
  killNode,
8894
8680
  launchNode,
8895
8681
  launchNodeAndGetWallets,
8896
- seedTestWallet,
8897
- setupTestProviderAndWallets
8682
+ seedTestWallet
8898
8683
  });
8899
8684
  //# sourceMappingURL=test-utils.js.map