@fuel-ts/account 0.0.0-rc-1895-20240404023124 → 0.0.0-rc-1832-20240404064601

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

Potentially problematic release.


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

package/dist/index.js CHANGED
@@ -88,7 +88,7 @@ __export(src_exports, {
88
88
  StorageAbstract: () => StorageAbstract,
89
89
  TransactionResponse: () => TransactionResponse,
90
90
  TransactionStatus: () => TransactionStatus,
91
- TransactionType: () => import_transactions6.TransactionType,
91
+ TransactionType: () => import_transactions5.TransactionType,
92
92
  TransactionTypeName: () => TransactionTypeName,
93
93
  Vault: () => Vault,
94
94
  Wallet: () => Wallet,
@@ -97,9 +97,7 @@ __export(src_exports, {
97
97
  WalletUnlocked: () => WalletUnlocked,
98
98
  addAmountToAsset: () => addAmountToAsset,
99
99
  addOperation: () => addOperation,
100
- assemblePanicError: () => assemblePanicError,
101
100
  assembleReceiptByType: () => assembleReceiptByType,
102
- assembleRevertError: () => assembleRevertError,
103
101
  assembleTransactionSummary: () => assembleTransactionSummary,
104
102
  assets: () => assets,
105
103
  buildBlockExplorerUrl: () => buildBlockExplorerUrl,
@@ -114,7 +112,6 @@ __export(src_exports, {
114
112
  english: () => english,
115
113
  extractBurnedAssetsFromReceipts: () => extractBurnedAssetsFromReceipts,
116
114
  extractMintedAssetsFromReceipts: () => extractMintedAssetsFromReceipts,
117
- extractTxError: () => extractTxError,
118
115
  gasUsedByInputs: () => gasUsedByInputs,
119
116
  getAssetEth: () => getAssetEth,
120
117
  getAssetFuel: () => getAssetFuel,
@@ -184,11 +181,11 @@ module.exports = __toCommonJS(src_exports);
184
181
 
185
182
  // src/account.ts
186
183
  var import_address4 = require("@fuel-ts/address");
187
- var import_configs12 = require("@fuel-ts/address/configs");
188
- var import_errors16 = require("@fuel-ts/errors");
184
+ var import_configs11 = require("@fuel-ts/address/configs");
185
+ var import_errors15 = require("@fuel-ts/errors");
189
186
  var import_interfaces = require("@fuel-ts/interfaces");
190
- var import_math18 = require("@fuel-ts/math");
191
- var import_utils28 = require("@fuel-ts/utils");
187
+ var import_math17 = require("@fuel-ts/math");
188
+ var import_utils27 = require("@fuel-ts/utils");
192
189
 
193
190
  // src/providers/coin-quantity.ts
194
191
  var import_configs = require("@fuel-ts/address/configs");
@@ -228,12 +225,12 @@ var addAmountToAsset = (params) => {
228
225
 
229
226
  // src/providers/provider.ts
230
227
  var import_address3 = require("@fuel-ts/address");
231
- var import_errors14 = require("@fuel-ts/errors");
232
- var import_math15 = require("@fuel-ts/math");
233
- var import_transactions18 = require("@fuel-ts/transactions");
234
- var import_utils23 = require("@fuel-ts/utils");
228
+ var import_errors13 = require("@fuel-ts/errors");
229
+ var import_math14 = require("@fuel-ts/math");
230
+ var import_transactions17 = require("@fuel-ts/transactions");
231
+ var import_utils22 = require("@fuel-ts/utils");
235
232
  var import_versions = require("@fuel-ts/versions");
236
- var import_utils24 = require("@noble/curves/abstract/utils");
233
+ var import_utils23 = require("@noble/curves/abstract/utils");
237
234
  var import_ethers = require("ethers");
238
235
  var import_graphql_request = require("graphql-request");
239
236
  var import_ramda3 = require("ramda");
@@ -1306,9 +1303,9 @@ var outputify = (value) => {
1306
1303
 
1307
1304
  // src/providers/transaction-request/transaction-request.ts
1308
1305
  var import_address = require("@fuel-ts/address");
1309
- var import_configs7 = require("@fuel-ts/address/configs");
1310
- var import_math7 = require("@fuel-ts/math");
1311
- var import_transactions6 = require("@fuel-ts/transactions");
1306
+ var import_configs6 = require("@fuel-ts/address/configs");
1307
+ var import_math6 = require("@fuel-ts/math");
1308
+ var import_transactions5 = require("@fuel-ts/transactions");
1312
1309
  var import_utils9 = require("@fuel-ts/utils");
1313
1310
 
1314
1311
  // src/providers/resource.ts
@@ -1701,78 +1698,6 @@ function sleep(time) {
1701
1698
  });
1702
1699
  }
1703
1700
 
1704
- // src/providers/utils/extract-tx-error.ts
1705
- var import_errors7 = require("@fuel-ts/errors");
1706
- var import_math6 = require("@fuel-ts/math");
1707
- var import_transactions5 = require("@fuel-ts/transactions");
1708
- var import_configs6 = require("@fuel-ts/transactions/configs");
1709
- var assemblePanicError = (status) => {
1710
- let errorMessage = `The transaction reverted with reason: "${status.reason}".`;
1711
- const reason = status.reason;
1712
- if (import_configs6.PANIC_REASONS.includes(status.reason)) {
1713
- errorMessage = `${errorMessage}
1714
-
1715
- You can read more about this error at:
1716
-
1717
- ${import_configs6.PANIC_DOC_URL}#variant.${status.reason}`;
1718
- }
1719
- return { errorMessage, reason };
1720
- };
1721
- var stringify = (obj) => JSON.stringify(obj, null, 2);
1722
- var assembleRevertError = (receipts, logs) => {
1723
- let errorMessage = "The transaction reverted with an unknown reason.";
1724
- const revertReceipt = receipts.find(({ type }) => type === import_transactions5.ReceiptType.Revert);
1725
- let reason = "";
1726
- if (revertReceipt) {
1727
- const reasonHex = (0, import_math6.bn)(revertReceipt.val).toHex();
1728
- switch (reasonHex) {
1729
- case import_configs6.FAILED_REQUIRE_SIGNAL: {
1730
- reason = "require";
1731
- errorMessage = `The transaction reverted because a "require" statement has thrown ${logs.length ? stringify(logs[0]) : "an error."}.`;
1732
- break;
1733
- }
1734
- case import_configs6.FAILED_ASSERT_EQ_SIGNAL: {
1735
- const sufix = logs.length >= 2 ? ` comparing ${stringify(logs[1])} and ${stringify(logs[0])}.` : ".";
1736
- reason = "assert_eq";
1737
- errorMessage = `The transaction reverted because of an "assert_eq" statement${sufix}`;
1738
- break;
1739
- }
1740
- case import_configs6.FAILED_ASSERT_NE_SIGNAL: {
1741
- const sufix = logs.length >= 2 ? ` comparing ${stringify(logs[1])} and ${stringify(logs[0])}.` : ".";
1742
- reason = "assert_ne";
1743
- errorMessage = `The transaction reverted because of an "assert_ne" statement${sufix}`;
1744
- break;
1745
- }
1746
- case import_configs6.FAILED_ASSERT_SIGNAL:
1747
- reason = "assert";
1748
- errorMessage = `The transaction reverted because an "assert" statement failed to evaluate to true.`;
1749
- break;
1750
- case import_configs6.FAILED_TRANSFER_TO_ADDRESS_SIGNAL:
1751
- reason = "MissingOutputChange";
1752
- errorMessage = `The transaction reverted because it's missing an "OutputChange".`;
1753
- break;
1754
- default:
1755
- reason = "unknown";
1756
- errorMessage = `The transaction reverted with an unknown reason: ${revertReceipt.val}`;
1757
- }
1758
- }
1759
- return { errorMessage, reason };
1760
- };
1761
- var extractTxError = (params) => {
1762
- const { receipts, status, logs } = params;
1763
- const isPanic = receipts.some(({ type }) => type === import_transactions5.ReceiptType.Panic);
1764
- const isRevert = receipts.some(({ type }) => type === import_transactions5.ReceiptType.Revert);
1765
- const { errorMessage, reason } = status?.type === "FailureStatus" && isPanic ? assemblePanicError(status) : assembleRevertError(receipts, logs);
1766
- const metadata = {
1767
- logs,
1768
- receipts,
1769
- panic: isPanic,
1770
- revert: isRevert,
1771
- reason
1772
- };
1773
- return new import_errors7.FuelError(import_errors7.ErrorCode.SCRIPT_REVERTED, errorMessage, metadata);
1774
- };
1775
-
1776
1701
  // src/providers/transaction-request/errors.ts
1777
1702
  var ChangeOutputCollisionError = class extends Error {
1778
1703
  name = "ChangeOutputCollisionError";
@@ -1835,10 +1760,10 @@ var BaseTransactionRequest = class {
1835
1760
  outputs,
1836
1761
  witnesses
1837
1762
  } = {}) {
1838
- this.gasPrice = (0, import_math7.bn)(gasPrice);
1763
+ this.gasPrice = (0, import_math6.bn)(gasPrice);
1839
1764
  this.maturity = maturity ?? 0;
1840
- this.witnessLimit = witnessLimit ? (0, import_math7.bn)(witnessLimit) : void 0;
1841
- this.maxFee = maxFee ? (0, import_math7.bn)(maxFee) : void 0;
1765
+ this.witnessLimit = witnessLimit ? (0, import_math6.bn)(witnessLimit) : void 0;
1766
+ this.maxFee = maxFee ? (0, import_math6.bn)(maxFee) : void 0;
1842
1767
  this.inputs = inputs ?? [];
1843
1768
  this.outputs = outputs ?? [];
1844
1769
  this.witnesses = witnesses ?? [];
@@ -1847,20 +1772,20 @@ var BaseTransactionRequest = class {
1847
1772
  let policyTypes = 0;
1848
1773
  const policies = [];
1849
1774
  if (req.gasPrice) {
1850
- policyTypes += import_transactions6.PolicyType.GasPrice;
1851
- policies.push({ data: req.gasPrice, type: import_transactions6.PolicyType.GasPrice });
1775
+ policyTypes += import_transactions5.PolicyType.GasPrice;
1776
+ policies.push({ data: req.gasPrice, type: import_transactions5.PolicyType.GasPrice });
1852
1777
  }
1853
1778
  if (req.witnessLimit) {
1854
- policyTypes += import_transactions6.PolicyType.WitnessLimit;
1855
- policies.push({ data: req.witnessLimit, type: import_transactions6.PolicyType.WitnessLimit });
1779
+ policyTypes += import_transactions5.PolicyType.WitnessLimit;
1780
+ policies.push({ data: req.witnessLimit, type: import_transactions5.PolicyType.WitnessLimit });
1856
1781
  }
1857
1782
  if (req.maturity > 0) {
1858
- policyTypes += import_transactions6.PolicyType.Maturity;
1859
- policies.push({ data: req.maturity, type: import_transactions6.PolicyType.Maturity });
1783
+ policyTypes += import_transactions5.PolicyType.Maturity;
1784
+ policies.push({ data: req.maturity, type: import_transactions5.PolicyType.Maturity });
1860
1785
  }
1861
1786
  if (req.maxFee) {
1862
- policyTypes += import_transactions6.PolicyType.MaxFee;
1863
- policies.push({ data: req.maxFee, type: import_transactions6.PolicyType.MaxFee });
1787
+ policyTypes += import_transactions5.PolicyType.MaxFee;
1788
+ policies.push({ data: req.maxFee, type: import_transactions5.PolicyType.MaxFee });
1864
1789
  }
1865
1790
  return {
1866
1791
  policyTypes,
@@ -1894,7 +1819,7 @@ var BaseTransactionRequest = class {
1894
1819
  * @returns The transaction bytes.
1895
1820
  */
1896
1821
  toTransactionBytes() {
1897
- return new import_transactions6.TransactionCoder().encode(this.toTransaction());
1822
+ return new import_transactions5.TransactionCoder().encode(this.toTransaction());
1898
1823
  }
1899
1824
  /**
1900
1825
  * @hidden
@@ -1934,7 +1859,7 @@ var BaseTransactionRequest = class {
1934
1859
  * @returns The index of the created witness.
1935
1860
  */
1936
1861
  addEmptyWitness() {
1937
- this.addWitness((0, import_utils9.concat)([import_configs7.ZeroBytes32, import_configs7.ZeroBytes32]));
1862
+ this.addWitness((0, import_utils9.concat)([import_configs6.ZeroBytes32, import_configs6.ZeroBytes32]));
1938
1863
  return this.witnesses.length - 1;
1939
1864
  }
1940
1865
  /**
@@ -1985,7 +1910,7 @@ var BaseTransactionRequest = class {
1985
1910
  */
1986
1911
  getCoinInputs() {
1987
1912
  return this.inputs.filter(
1988
- (input) => input.type === import_transactions6.InputType.Coin
1913
+ (input) => input.type === import_transactions5.InputType.Coin
1989
1914
  );
1990
1915
  }
1991
1916
  /**
@@ -1995,7 +1920,7 @@ var BaseTransactionRequest = class {
1995
1920
  */
1996
1921
  getCoinOutputs() {
1997
1922
  return this.outputs.filter(
1998
- (output) => output.type === import_transactions6.OutputType.Coin
1923
+ (output) => output.type === import_transactions5.OutputType.Coin
1999
1924
  );
2000
1925
  }
2001
1926
  /**
@@ -2005,7 +1930,7 @@ var BaseTransactionRequest = class {
2005
1930
  */
2006
1931
  getChangeOutputs() {
2007
1932
  return this.outputs.filter(
2008
- (output) => output.type === import_transactions6.OutputType.Change
1933
+ (output) => output.type === import_transactions5.OutputType.Change
2009
1934
  );
2010
1935
  }
2011
1936
  /**
@@ -2017,9 +1942,9 @@ var BaseTransactionRequest = class {
2017
1942
  const ownerAddress = (0, import_address.addressify)(owner);
2018
1943
  const found = this.inputs.find((input) => {
2019
1944
  switch (input.type) {
2020
- case import_transactions6.InputType.Coin:
1945
+ case import_transactions5.InputType.Coin:
2021
1946
  return (0, import_utils9.hexlify)(input.owner) === ownerAddress.toB256();
2022
- case import_transactions6.InputType.Message:
1947
+ case import_transactions5.InputType.Message:
2023
1948
  return (0, import_utils9.hexlify)(input.recipient) === ownerAddress.toB256();
2024
1949
  default:
2025
1950
  return false;
@@ -2048,7 +1973,7 @@ var BaseTransactionRequest = class {
2048
1973
  }
2049
1974
  const input = {
2050
1975
  ...coin,
2051
- type: import_transactions6.InputType.Coin,
1976
+ type: import_transactions5.InputType.Coin,
2052
1977
  owner: owner.toB256(),
2053
1978
  amount,
2054
1979
  assetId,
@@ -2070,7 +1995,7 @@ var BaseTransactionRequest = class {
2070
1995
  */
2071
1996
  addMessageInput(message, predicate) {
2072
1997
  const { recipient, sender, amount } = message;
2073
- const assetId = import_configs7.BaseAssetId;
1998
+ const assetId = import_configs6.BaseAssetId;
2074
1999
  let witnessIndex;
2075
2000
  if (predicate) {
2076
2001
  witnessIndex = 0;
@@ -2082,7 +2007,7 @@ var BaseTransactionRequest = class {
2082
2007
  }
2083
2008
  const input = {
2084
2009
  ...message,
2085
- type: import_transactions6.InputType.Message,
2010
+ type: import_transactions5.InputType.Message,
2086
2011
  sender: sender.toB256(),
2087
2012
  recipient: recipient.toB256(),
2088
2013
  amount,
@@ -2152,9 +2077,9 @@ var BaseTransactionRequest = class {
2152
2077
  * @param amount - Amount of coin.
2153
2078
  * @param assetId - Asset ID of coin.
2154
2079
  */
2155
- addCoinOutput(to, amount, assetId = import_configs7.BaseAssetId) {
2080
+ addCoinOutput(to, amount, assetId = import_configs6.BaseAssetId) {
2156
2081
  this.pushOutput({
2157
- type: import_transactions6.OutputType.Coin,
2082
+ type: import_transactions5.OutputType.Coin,
2158
2083
  to: (0, import_address.addressify)(to).toB256(),
2159
2084
  amount,
2160
2085
  assetId
@@ -2170,7 +2095,7 @@ var BaseTransactionRequest = class {
2170
2095
  addCoinOutputs(to, quantities) {
2171
2096
  quantities.map(coinQuantityfy).forEach((quantity) => {
2172
2097
  this.pushOutput({
2173
- type: import_transactions6.OutputType.Coin,
2098
+ type: import_transactions5.OutputType.Coin,
2174
2099
  to: (0, import_address.addressify)(to).toB256(),
2175
2100
  amount: quantity.amount,
2176
2101
  assetId: quantity.assetId
@@ -2184,13 +2109,13 @@ var BaseTransactionRequest = class {
2184
2109
  * @param to - Address of the owner.
2185
2110
  * @param assetId - Asset ID of coin.
2186
2111
  */
2187
- addChangeOutput(to, assetId = import_configs7.BaseAssetId) {
2112
+ addChangeOutput(to, assetId = import_configs6.BaseAssetId) {
2188
2113
  const changeOutput = this.getChangeOutputs().find(
2189
2114
  (output) => (0, import_utils9.hexlify)(output.assetId) === assetId
2190
2115
  );
2191
2116
  if (!changeOutput) {
2192
2117
  this.pushOutput({
2193
- type: import_transactions6.OutputType.Change,
2118
+ type: import_transactions5.OutputType.Change,
2194
2119
  to: (0, import_address.addressify)(to).toB256(),
2195
2120
  assetId
2196
2121
  });
@@ -2246,7 +2171,7 @@ var BaseTransactionRequest = class {
2246
2171
  let idCounter = 0;
2247
2172
  const generateId = () => {
2248
2173
  const counterString = String(idCounter++);
2249
- const id = import_configs7.ZeroBytes32.slice(0, -counterString.length).concat(counterString);
2174
+ const id = import_configs6.ZeroBytes32.slice(0, -counterString.length).concat(counterString);
2250
2175
  return id;
2251
2176
  };
2252
2177
  const findAssetInput = (assetId) => this.inputs.find((input) => {
@@ -2268,13 +2193,13 @@ var BaseTransactionRequest = class {
2268
2193
  assetId,
2269
2194
  owner: resourcesOwner || import_address.Address.fromRandom(),
2270
2195
  maturity: 0,
2271
- blockCreated: (0, import_math7.bn)(1),
2272
- txCreatedIdx: (0, import_math7.bn)(1)
2196
+ blockCreated: (0, import_math6.bn)(1),
2197
+ txCreatedIdx: (0, import_math6.bn)(1)
2273
2198
  }
2274
2199
  ]);
2275
2200
  }
2276
2201
  };
2277
- updateAssetInput(import_configs7.BaseAssetId, (0, import_math7.bn)(1e11));
2202
+ updateAssetInput(import_configs6.BaseAssetId, (0, import_math6.bn)(1e11));
2278
2203
  quantities.forEach((q) => updateAssetInput(q.assetId, q.amount));
2279
2204
  }
2280
2205
  /**
@@ -2285,7 +2210,7 @@ var BaseTransactionRequest = class {
2285
2210
  */
2286
2211
  getCoinOutputsQuantities() {
2287
2212
  const coinsQuantities = this.getCoinOutputs().map(({ amount, assetId }) => ({
2288
- amount: (0, import_math7.bn)(amount),
2213
+ amount: (0, import_math6.bn)(amount),
2289
2214
  assetId: assetId.toString()
2290
2215
  }));
2291
2216
  return coinsQuantities;
@@ -2303,18 +2228,18 @@ var BaseTransactionRequest = class {
2303
2228
  this.inputs.forEach((i) => {
2304
2229
  let correspondingInput;
2305
2230
  switch (i.type) {
2306
- case import_transactions6.InputType.Coin:
2307
- correspondingInput = inputs.find((x) => x.type === import_transactions6.InputType.Coin && x.owner === i.owner);
2231
+ case import_transactions5.InputType.Coin:
2232
+ correspondingInput = inputs.find((x) => x.type === import_transactions5.InputType.Coin && x.owner === i.owner);
2308
2233
  break;
2309
- case import_transactions6.InputType.Message:
2234
+ case import_transactions5.InputType.Message:
2310
2235
  correspondingInput = inputs.find(
2311
- (x) => x.type === import_transactions6.InputType.Message && x.sender === i.sender
2236
+ (x) => x.type === import_transactions5.InputType.Message && x.sender === i.sender
2312
2237
  );
2313
2238
  break;
2314
2239
  default:
2315
2240
  return;
2316
2241
  }
2317
- if (correspondingInput && "predicateGasUsed" in correspondingInput && (0, import_math7.bn)(correspondingInput.predicateGasUsed).gt(0)) {
2242
+ if (correspondingInput && "predicateGasUsed" in correspondingInput && (0, import_math6.bn)(correspondingInput.predicateGasUsed).gt(0)) {
2318
2243
  i.predicate = correspondingInput.predicate;
2319
2244
  i.predicateData = correspondingInput.predicateData;
2320
2245
  i.predicateGasUsed = correspondingInput.predicateGasUsed;
@@ -2324,47 +2249,47 @@ var BaseTransactionRequest = class {
2324
2249
  };
2325
2250
 
2326
2251
  // src/providers/transaction-request/create-transaction-request.ts
2327
- var import_configs9 = require("@fuel-ts/address/configs");
2328
- var import_math9 = require("@fuel-ts/math");
2329
- var import_transactions8 = require("@fuel-ts/transactions");
2252
+ var import_configs8 = require("@fuel-ts/address/configs");
2253
+ var import_math8 = require("@fuel-ts/math");
2254
+ var import_transactions7 = require("@fuel-ts/transactions");
2330
2255
  var import_utils13 = require("@fuel-ts/utils");
2331
2256
 
2332
2257
  // src/providers/transaction-request/hash-transaction.ts
2333
- var import_configs8 = require("@fuel-ts/address/configs");
2258
+ var import_configs7 = require("@fuel-ts/address/configs");
2334
2259
  var import_hasher = require("@fuel-ts/hasher");
2335
- var import_math8 = require("@fuel-ts/math");
2336
- var import_transactions7 = require("@fuel-ts/transactions");
2260
+ var import_math7 = require("@fuel-ts/math");
2261
+ var import_transactions6 = require("@fuel-ts/transactions");
2337
2262
  var import_utils11 = require("@fuel-ts/utils");
2338
2263
  var import_ramda2 = require("ramda");
2339
2264
  function hashTransaction(transactionRequest, chainId) {
2340
2265
  const transaction = transactionRequest.toTransaction();
2341
- if (transaction.type === import_transactions7.TransactionType.Script) {
2342
- transaction.receiptsRoot = import_configs8.ZeroBytes32;
2266
+ if (transaction.type === import_transactions6.TransactionType.Script) {
2267
+ transaction.receiptsRoot = import_configs7.ZeroBytes32;
2343
2268
  }
2344
2269
  transaction.inputs = transaction.inputs.map((input) => {
2345
2270
  const inputClone = (0, import_ramda2.clone)(input);
2346
2271
  switch (inputClone.type) {
2347
- case import_transactions7.InputType.Coin: {
2272
+ case import_transactions6.InputType.Coin: {
2348
2273
  inputClone.txPointer = {
2349
2274
  blockHeight: 0,
2350
2275
  txIndex: 0
2351
2276
  };
2352
- inputClone.predicateGasUsed = (0, import_math8.bn)(0);
2277
+ inputClone.predicateGasUsed = (0, import_math7.bn)(0);
2353
2278
  return inputClone;
2354
2279
  }
2355
- case import_transactions7.InputType.Message: {
2356
- inputClone.predicateGasUsed = (0, import_math8.bn)(0);
2280
+ case import_transactions6.InputType.Message: {
2281
+ inputClone.predicateGasUsed = (0, import_math7.bn)(0);
2357
2282
  return inputClone;
2358
2283
  }
2359
- case import_transactions7.InputType.Contract: {
2284
+ case import_transactions6.InputType.Contract: {
2360
2285
  inputClone.txPointer = {
2361
2286
  blockHeight: 0,
2362
2287
  txIndex: 0
2363
2288
  };
2364
- inputClone.txID = import_configs8.ZeroBytes32;
2289
+ inputClone.txID = import_configs7.ZeroBytes32;
2365
2290
  inputClone.outputIndex = 0;
2366
- inputClone.balanceRoot = import_configs8.ZeroBytes32;
2367
- inputClone.stateRoot = import_configs8.ZeroBytes32;
2291
+ inputClone.balanceRoot = import_configs7.ZeroBytes32;
2292
+ inputClone.stateRoot = import_configs7.ZeroBytes32;
2368
2293
  return inputClone;
2369
2294
  }
2370
2295
  default:
@@ -2374,19 +2299,19 @@ function hashTransaction(transactionRequest, chainId) {
2374
2299
  transaction.outputs = transaction.outputs.map((output) => {
2375
2300
  const outputClone = (0, import_ramda2.clone)(output);
2376
2301
  switch (outputClone.type) {
2377
- case import_transactions7.OutputType.Contract: {
2378
- outputClone.balanceRoot = import_configs8.ZeroBytes32;
2379
- outputClone.stateRoot = import_configs8.ZeroBytes32;
2302
+ case import_transactions6.OutputType.Contract: {
2303
+ outputClone.balanceRoot = import_configs7.ZeroBytes32;
2304
+ outputClone.stateRoot = import_configs7.ZeroBytes32;
2380
2305
  return outputClone;
2381
2306
  }
2382
- case import_transactions7.OutputType.Change: {
2383
- outputClone.amount = (0, import_math8.bn)(0);
2307
+ case import_transactions6.OutputType.Change: {
2308
+ outputClone.amount = (0, import_math7.bn)(0);
2384
2309
  return outputClone;
2385
2310
  }
2386
- case import_transactions7.OutputType.Variable: {
2387
- outputClone.to = import_configs8.ZeroBytes32;
2388
- outputClone.amount = (0, import_math8.bn)(0);
2389
- outputClone.assetId = import_configs8.ZeroBytes32;
2311
+ case import_transactions6.OutputType.Variable: {
2312
+ outputClone.to = import_configs7.ZeroBytes32;
2313
+ outputClone.amount = (0, import_math7.bn)(0);
2314
+ outputClone.assetId = import_configs7.ZeroBytes32;
2390
2315
  return outputClone;
2391
2316
  }
2392
2317
  default:
@@ -2396,7 +2321,7 @@ function hashTransaction(transactionRequest, chainId) {
2396
2321
  transaction.witnessesCount = 0;
2397
2322
  transaction.witnesses = [];
2398
2323
  const chainIdBytes = (0, import_hasher.uint64ToBytesBE)(chainId);
2399
- const concatenatedData = (0, import_utils11.concat)([chainIdBytes, new import_transactions7.TransactionCoder().encode(transaction)]);
2324
+ const concatenatedData = (0, import_utils11.concat)([chainIdBytes, new import_transactions6.TransactionCoder().encode(transaction)]);
2400
2325
  return (0, import_hasher.sha256)(concatenatedData);
2401
2326
  }
2402
2327
 
@@ -2432,7 +2357,7 @@ var CreateTransactionRequest = class extends BaseTransactionRequest {
2432
2357
  return new this(obj);
2433
2358
  }
2434
2359
  /** Type of the transaction */
2435
- type = import_transactions8.TransactionType.Create;
2360
+ type = import_transactions7.TransactionType.Create;
2436
2361
  /** Witness index of contract bytecode to create */
2437
2362
  bytecodeWitnessIndex;
2438
2363
  /** Salt */
@@ -2452,7 +2377,7 @@ var CreateTransactionRequest = class extends BaseTransactionRequest {
2452
2377
  } = {}) {
2453
2378
  super(rest);
2454
2379
  this.bytecodeWitnessIndex = bytecodeWitnessIndex ?? 0;
2455
- this.salt = (0, import_utils13.hexlify)(salt ?? import_configs9.ZeroBytes32);
2380
+ this.salt = (0, import_utils13.hexlify)(salt ?? import_configs8.ZeroBytes32);
2456
2381
  this.storageSlots = [...storageSlots ?? []];
2457
2382
  }
2458
2383
  /**
@@ -2465,12 +2390,12 @@ var CreateTransactionRequest = class extends BaseTransactionRequest {
2465
2390
  const bytecodeWitnessIndex = this.bytecodeWitnessIndex;
2466
2391
  const storageSlots = this.storageSlots?.map(storageSlotify) ?? [];
2467
2392
  return {
2468
- type: import_transactions8.TransactionType.Create,
2393
+ type: import_transactions7.TransactionType.Create,
2469
2394
  ...baseTransaction,
2470
2395
  bytecodeLength: baseTransaction.witnesses[bytecodeWitnessIndex].dataLength / 4,
2471
2396
  bytecodeWitnessIndex,
2472
2397
  storageSlotsCount: storageSlots.length,
2473
- salt: this.salt ? (0, import_utils13.hexlify)(this.salt) : import_configs9.ZeroBytes32,
2398
+ salt: this.salt ? (0, import_utils13.hexlify)(this.salt) : import_configs8.ZeroBytes32,
2474
2399
  storageSlots
2475
2400
  };
2476
2401
  }
@@ -2481,7 +2406,7 @@ var CreateTransactionRequest = class extends BaseTransactionRequest {
2481
2406
  */
2482
2407
  getContractCreatedOutputs() {
2483
2408
  return this.outputs.filter(
2484
- (output) => output.type === import_transactions8.OutputType.ContractCreated
2409
+ (output) => output.type === import_transactions7.OutputType.ContractCreated
2485
2410
  );
2486
2411
  }
2487
2412
  /**
@@ -2502,14 +2427,14 @@ var CreateTransactionRequest = class extends BaseTransactionRequest {
2502
2427
  */
2503
2428
  addContractCreatedOutput(contractId, stateRoot) {
2504
2429
  this.pushOutput({
2505
- type: import_transactions8.OutputType.ContractCreated,
2430
+ type: import_transactions7.OutputType.ContractCreated,
2506
2431
  contractId,
2507
2432
  stateRoot
2508
2433
  });
2509
2434
  }
2510
2435
  metadataGas(gasCosts) {
2511
2436
  return calculateMetadataGasForTxCreate({
2512
- contractBytesSize: (0, import_math9.bn)((0, import_utils13.arrayify)(this.witnesses[this.bytecodeWitnessIndex] || "0x").length),
2437
+ contractBytesSize: (0, import_math8.bn)((0, import_utils13.arrayify)(this.witnesses[this.bytecodeWitnessIndex] || "0x").length),
2513
2438
  gasCosts,
2514
2439
  stateRootSize: this.storageSlots.length,
2515
2440
  txBytesSize: this.byteSize()
@@ -2520,9 +2445,9 @@ var CreateTransactionRequest = class extends BaseTransactionRequest {
2520
2445
  // src/providers/transaction-request/script-transaction-request.ts
2521
2446
  var import_abi_coder = require("@fuel-ts/abi-coder");
2522
2447
  var import_address2 = require("@fuel-ts/address");
2523
- var import_configs10 = require("@fuel-ts/address/configs");
2524
- var import_math10 = require("@fuel-ts/math");
2525
- var import_transactions9 = require("@fuel-ts/transactions");
2448
+ var import_configs9 = require("@fuel-ts/address/configs");
2449
+ var import_math9 = require("@fuel-ts/math");
2450
+ var import_transactions8 = require("@fuel-ts/transactions");
2526
2451
  var import_utils15 = require("@fuel-ts/utils");
2527
2452
 
2528
2453
  // src/providers/transaction-request/scripts.ts
@@ -2560,7 +2485,7 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
2560
2485
  return new this(obj);
2561
2486
  }
2562
2487
  /** Type of the transaction */
2563
- type = import_transactions9.TransactionType.Script;
2488
+ type = import_transactions8.TransactionType.Script;
2564
2489
  /** Gas limit for transaction */
2565
2490
  gasLimit;
2566
2491
  /** Script to execute */
@@ -2575,7 +2500,7 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
2575
2500
  */
2576
2501
  constructor({ script, scriptData, gasLimit, ...rest } = {}) {
2577
2502
  super(rest);
2578
- this.gasLimit = (0, import_math10.bn)(gasLimit);
2503
+ this.gasLimit = (0, import_math9.bn)(gasLimit);
2579
2504
  this.script = (0, import_utils15.arrayify)(script ?? returnZeroScript.bytes);
2580
2505
  this.scriptData = (0, import_utils15.arrayify)(scriptData ?? returnZeroScript.encodeScriptData());
2581
2506
  this.abis = rest.abis;
@@ -2589,12 +2514,12 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
2589
2514
  const script = (0, import_utils15.arrayify)(this.script ?? "0x");
2590
2515
  const scriptData = (0, import_utils15.arrayify)(this.scriptData ?? "0x");
2591
2516
  return {
2592
- type: import_transactions9.TransactionType.Script,
2517
+ type: import_transactions8.TransactionType.Script,
2593
2518
  scriptGasLimit: this.gasLimit,
2594
2519
  ...super.getBaseTransaction(),
2595
2520
  scriptLength: script.length,
2596
2521
  scriptDataLength: scriptData.length,
2597
- receiptsRoot: import_configs10.ZeroBytes32,
2522
+ receiptsRoot: import_configs9.ZeroBytes32,
2598
2523
  script: (0, import_utils15.hexlify)(script),
2599
2524
  scriptData: (0, import_utils15.hexlify)(scriptData)
2600
2525
  };
@@ -2606,7 +2531,7 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
2606
2531
  */
2607
2532
  getContractInputs() {
2608
2533
  return this.inputs.filter(
2609
- (input) => input.type === import_transactions9.InputType.Contract
2534
+ (input) => input.type === import_transactions8.InputType.Contract
2610
2535
  );
2611
2536
  }
2612
2537
  /**
@@ -2616,7 +2541,7 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
2616
2541
  */
2617
2542
  getContractOutputs() {
2618
2543
  return this.outputs.filter(
2619
- (output) => output.type === import_transactions9.OutputType.Contract
2544
+ (output) => output.type === import_transactions8.OutputType.Contract
2620
2545
  );
2621
2546
  }
2622
2547
  /**
@@ -2626,7 +2551,7 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
2626
2551
  */
2627
2552
  getVariableOutputs() {
2628
2553
  return this.outputs.filter(
2629
- (output) => output.type === import_transactions9.OutputType.Variable
2554
+ (output) => output.type === import_transactions8.OutputType.Variable
2630
2555
  );
2631
2556
  }
2632
2557
  /**
@@ -2649,7 +2574,7 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
2649
2574
  let outputsNumber = numberOfVariables;
2650
2575
  while (outputsNumber) {
2651
2576
  this.pushOutput({
2652
- type: import_transactions9.OutputType.Variable
2577
+ type: import_transactions8.OutputType.Variable
2653
2578
  });
2654
2579
  outputsNumber -= 1;
2655
2580
  }
@@ -2682,12 +2607,12 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
2682
2607
  return this;
2683
2608
  }
2684
2609
  const inputIndex = super.pushInput({
2685
- type: import_transactions9.InputType.Contract,
2610
+ type: import_transactions8.InputType.Contract,
2686
2611
  contractId: contractAddress.toB256(),
2687
2612
  txPointer: "0x00000000000000000000000000000000"
2688
2613
  });
2689
2614
  this.pushOutput({
2690
- type: import_transactions9.OutputType.Contract,
2615
+ type: import_transactions8.OutputType.Contract,
2691
2616
  inputIndex
2692
2617
  });
2693
2618
  return this;
@@ -2723,38 +2648,38 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
2723
2648
  };
2724
2649
 
2725
2650
  // src/providers/transaction-request/utils.ts
2726
- var import_errors9 = require("@fuel-ts/errors");
2727
- var import_transactions10 = require("@fuel-ts/transactions");
2651
+ var import_errors8 = require("@fuel-ts/errors");
2652
+ var import_transactions9 = require("@fuel-ts/transactions");
2728
2653
  var transactionRequestify = (obj) => {
2729
2654
  if (obj instanceof ScriptTransactionRequest || obj instanceof CreateTransactionRequest) {
2730
2655
  return obj;
2731
2656
  }
2732
2657
  const { type } = obj;
2733
2658
  switch (obj.type) {
2734
- case import_transactions10.TransactionType.Script: {
2659
+ case import_transactions9.TransactionType.Script: {
2735
2660
  return ScriptTransactionRequest.from(obj);
2736
2661
  }
2737
- case import_transactions10.TransactionType.Create: {
2662
+ case import_transactions9.TransactionType.Create: {
2738
2663
  return CreateTransactionRequest.from(obj);
2739
2664
  }
2740
2665
  default: {
2741
- throw new import_errors9.FuelError(import_errors9.ErrorCode.INVALID_TRANSACTION_TYPE, `Invalid transaction type: ${type}.`);
2666
+ throw new import_errors8.FuelError(import_errors8.ErrorCode.INVALID_TRANSACTION_TYPE, `Invalid transaction type: ${type}.`);
2742
2667
  }
2743
2668
  }
2744
2669
  };
2745
2670
 
2746
2671
  // src/providers/transaction-response/transaction-response.ts
2747
- var import_errors13 = require("@fuel-ts/errors");
2748
- var import_math14 = require("@fuel-ts/math");
2749
- var import_transactions17 = require("@fuel-ts/transactions");
2672
+ var import_errors12 = require("@fuel-ts/errors");
2673
+ var import_math13 = require("@fuel-ts/math");
2674
+ var import_transactions16 = require("@fuel-ts/transactions");
2750
2675
  var import_utils21 = require("@fuel-ts/utils");
2751
2676
 
2752
2677
  // src/providers/transaction-summary/assemble-transaction-summary.ts
2753
2678
  var import_utils19 = require("@fuel-ts/utils");
2754
2679
 
2755
2680
  // src/providers/transaction-summary/calculate-transaction-fee.ts
2756
- var import_math11 = require("@fuel-ts/math");
2757
- var import_transactions11 = require("@fuel-ts/transactions");
2681
+ var import_math10 = require("@fuel-ts/math");
2682
+ var import_transactions10 = require("@fuel-ts/transactions");
2758
2683
  var import_utils16 = require("@fuel-ts/utils");
2759
2684
  var calculateTransactionFee = (params) => {
2760
2685
  const {
@@ -2762,24 +2687,24 @@ var calculateTransactionFee = (params) => {
2762
2687
  rawPayload,
2763
2688
  consensusParameters: { gasCosts, feeParams }
2764
2689
  } = params;
2765
- const gasPerByte = (0, import_math11.bn)(feeParams.gasPerByte);
2766
- const gasPriceFactor = (0, import_math11.bn)(feeParams.gasPriceFactor);
2690
+ const gasPerByte = (0, import_math10.bn)(feeParams.gasPerByte);
2691
+ const gasPriceFactor = (0, import_math10.bn)(feeParams.gasPriceFactor);
2767
2692
  const transactionBytes = (0, import_utils16.arrayify)(rawPayload);
2768
- const [transaction] = new import_transactions11.TransactionCoder().decode(transactionBytes, 0);
2769
- if (transaction.type === import_transactions11.TransactionType.Mint) {
2693
+ const [transaction] = new import_transactions10.TransactionCoder().decode(transactionBytes, 0);
2694
+ if (transaction.type === import_transactions10.TransactionType.Mint) {
2770
2695
  return {
2771
- fee: (0, import_math11.bn)(0),
2772
- minFee: (0, import_math11.bn)(0),
2773
- maxFee: (0, import_math11.bn)(0),
2774
- feeFromGasUsed: (0, import_math11.bn)(0)
2696
+ fee: (0, import_math10.bn)(0),
2697
+ minFee: (0, import_math10.bn)(0),
2698
+ maxFee: (0, import_math10.bn)(0),
2699
+ feeFromGasUsed: (0, import_math10.bn)(0)
2775
2700
  };
2776
2701
  }
2777
2702
  const { type, witnesses, inputs, policies } = transaction;
2778
- let metadataGas = (0, import_math11.bn)(0);
2779
- let gasLimit = (0, import_math11.bn)(0);
2780
- if (type === import_transactions11.TransactionType.Create) {
2703
+ let metadataGas = (0, import_math10.bn)(0);
2704
+ let gasLimit = (0, import_math10.bn)(0);
2705
+ if (type === import_transactions10.TransactionType.Create) {
2781
2706
  const { bytecodeWitnessIndex, storageSlots } = transaction;
2782
- const contractBytesSize = (0, import_math11.bn)((0, import_utils16.arrayify)(witnesses[bytecodeWitnessIndex].data).length);
2707
+ const contractBytesSize = (0, import_math10.bn)((0, import_utils16.arrayify)(witnesses[bytecodeWitnessIndex].data).length);
2783
2708
  metadataGas = calculateMetadataGasForTxCreate({
2784
2709
  contractBytesSize,
2785
2710
  gasCosts,
@@ -2798,13 +2723,13 @@ var calculateTransactionFee = (params) => {
2798
2723
  }
2799
2724
  const minGas = getMinGas({
2800
2725
  gasCosts,
2801
- gasPerByte: (0, import_math11.bn)(gasPerByte),
2726
+ gasPerByte: (0, import_math10.bn)(gasPerByte),
2802
2727
  inputs,
2803
2728
  metadataGas,
2804
2729
  txBytesSize: transactionBytes.length
2805
2730
  });
2806
- const gasPrice = (0, import_math11.bn)(policies.find((policy) => policy.type === import_transactions11.PolicyType.GasPrice)?.data);
2807
- const witnessLimit = policies.find((policy) => policy.type === import_transactions11.PolicyType.WitnessLimit)?.data;
2731
+ const gasPrice = (0, import_math10.bn)(policies.find((policy) => policy.type === import_transactions10.PolicyType.GasPrice)?.data);
2732
+ const witnessLimit = policies.find((policy) => policy.type === import_transactions10.PolicyType.WitnessLimit)?.data;
2808
2733
  const witnessesLength = witnesses.reduce((acc, wit) => acc + wit.dataLength, 0);
2809
2734
  const maxGas = getMaxGas({
2810
2735
  gasPerByte,
@@ -2826,14 +2751,14 @@ var calculateTransactionFee = (params) => {
2826
2751
  };
2827
2752
 
2828
2753
  // src/providers/transaction-summary/operations.ts
2829
- var import_configs11 = require("@fuel-ts/address/configs");
2830
- var import_errors11 = require("@fuel-ts/errors");
2831
- var import_math13 = require("@fuel-ts/math");
2832
- var import_transactions14 = require("@fuel-ts/transactions");
2754
+ var import_configs10 = require("@fuel-ts/address/configs");
2755
+ var import_errors10 = require("@fuel-ts/errors");
2756
+ var import_math12 = require("@fuel-ts/math");
2757
+ var import_transactions13 = require("@fuel-ts/transactions");
2833
2758
 
2834
2759
  // src/providers/transaction-summary/call.ts
2835
2760
  var import_abi_coder2 = require("@fuel-ts/abi-coder");
2836
- var import_math12 = require("@fuel-ts/math");
2761
+ var import_math11 = require("@fuel-ts/math");
2837
2762
  var getFunctionCall = ({ abi, receipt, rawPayload, maxInputs }) => {
2838
2763
  const abiInterface = new import_abi_coder2.Interface(abi);
2839
2764
  const callFunctionSelector = receipt.param1.toHex(8);
@@ -2842,7 +2767,7 @@ var getFunctionCall = ({ abi, receipt, rawPayload, maxInputs }) => {
2842
2767
  let encodedArgs;
2843
2768
  if (functionFragment.isInputDataPointer) {
2844
2769
  if (rawPayload) {
2845
- const argsOffset = (0, import_math12.bn)(receipt.param2).sub((0, import_abi_coder2.calculateVmTxMemory)({ maxInputs: maxInputs.toNumber() })).toNumber();
2770
+ const argsOffset = (0, import_math11.bn)(receipt.param2).sub((0, import_abi_coder2.calculateVmTxMemory)({ maxInputs: maxInputs.toNumber() })).toNumber();
2846
2771
  encodedArgs = `0x${rawPayload.slice(2).slice(argsOffset * 2)}`;
2847
2772
  }
2848
2773
  } else {
@@ -2876,8 +2801,8 @@ var getFunctionCall = ({ abi, receipt, rawPayload, maxInputs }) => {
2876
2801
  };
2877
2802
 
2878
2803
  // src/providers/transaction-summary/input.ts
2879
- var import_errors10 = require("@fuel-ts/errors");
2880
- var import_transactions12 = require("@fuel-ts/transactions");
2804
+ var import_errors9 = require("@fuel-ts/errors");
2805
+ var import_transactions11 = require("@fuel-ts/transactions");
2881
2806
  function getInputsByTypes(inputs, types) {
2882
2807
  return inputs.filter((i) => types.includes(i.type));
2883
2808
  }
@@ -2885,16 +2810,16 @@ function getInputsByType(inputs, type) {
2885
2810
  return inputs.filter((i) => i.type === type);
2886
2811
  }
2887
2812
  function getInputsCoin(inputs) {
2888
- return getInputsByType(inputs, import_transactions12.InputType.Coin);
2813
+ return getInputsByType(inputs, import_transactions11.InputType.Coin);
2889
2814
  }
2890
2815
  function getInputsMessage(inputs) {
2891
- return getInputsByType(inputs, import_transactions12.InputType.Message);
2816
+ return getInputsByType(inputs, import_transactions11.InputType.Message);
2892
2817
  }
2893
2818
  function getInputsCoinAndMessage(inputs) {
2894
- return getInputsByTypes(inputs, [import_transactions12.InputType.Coin, import_transactions12.InputType.Message]);
2819
+ return getInputsByTypes(inputs, [import_transactions11.InputType.Coin, import_transactions11.InputType.Message]);
2895
2820
  }
2896
2821
  function getInputsContract(inputs) {
2897
- return getInputsByType(inputs, import_transactions12.InputType.Contract);
2822
+ return getInputsByType(inputs, import_transactions11.InputType.Contract);
2898
2823
  }
2899
2824
  function getInputFromAssetId(inputs, assetId) {
2900
2825
  const coinInputs = getInputsCoin(inputs);
@@ -2913,43 +2838,43 @@ function getInputContractFromIndex(inputs, inputIndex) {
2913
2838
  if (!contractInput) {
2914
2839
  return void 0;
2915
2840
  }
2916
- if (contractInput.type !== import_transactions12.InputType.Contract) {
2917
- throw new import_errors10.FuelError(
2918
- import_errors10.ErrorCode.INVALID_TRANSACTION_INPUT,
2841
+ if (contractInput.type !== import_transactions11.InputType.Contract) {
2842
+ throw new import_errors9.FuelError(
2843
+ import_errors9.ErrorCode.INVALID_TRANSACTION_INPUT,
2919
2844
  `Contract input should be of type 'contract'.`
2920
2845
  );
2921
2846
  }
2922
2847
  return contractInput;
2923
2848
  }
2924
2849
  function getInputAccountAddress(input) {
2925
- if (input.type === import_transactions12.InputType.Coin) {
2850
+ if (input.type === import_transactions11.InputType.Coin) {
2926
2851
  return input.owner.toString();
2927
2852
  }
2928
- if (input.type === import_transactions12.InputType.Message) {
2853
+ if (input.type === import_transactions11.InputType.Message) {
2929
2854
  return input.recipient.toString();
2930
2855
  }
2931
2856
  return "";
2932
2857
  }
2933
2858
 
2934
2859
  // src/providers/transaction-summary/output.ts
2935
- var import_transactions13 = require("@fuel-ts/transactions");
2860
+ var import_transactions12 = require("@fuel-ts/transactions");
2936
2861
  function getOutputsByType(outputs, type) {
2937
2862
  return outputs.filter((o) => o.type === type);
2938
2863
  }
2939
2864
  function getOutputsContractCreated(outputs) {
2940
- return getOutputsByType(outputs, import_transactions13.OutputType.ContractCreated);
2865
+ return getOutputsByType(outputs, import_transactions12.OutputType.ContractCreated);
2941
2866
  }
2942
2867
  function getOutputsCoin(outputs) {
2943
- return getOutputsByType(outputs, import_transactions13.OutputType.Coin);
2868
+ return getOutputsByType(outputs, import_transactions12.OutputType.Coin);
2944
2869
  }
2945
2870
  function getOutputsChange(outputs) {
2946
- return getOutputsByType(outputs, import_transactions13.OutputType.Change);
2871
+ return getOutputsByType(outputs, import_transactions12.OutputType.Change);
2947
2872
  }
2948
2873
  function getOutputsContract(outputs) {
2949
- return getOutputsByType(outputs, import_transactions13.OutputType.Contract);
2874
+ return getOutputsByType(outputs, import_transactions12.OutputType.Contract);
2950
2875
  }
2951
2876
  function getOutputsVariable(outputs) {
2952
- return getOutputsByType(outputs, import_transactions13.OutputType.Variable);
2877
+ return getOutputsByType(outputs, import_transactions12.OutputType.Variable);
2953
2878
  }
2954
2879
 
2955
2880
  // src/providers/transaction-summary/types.ts
@@ -2996,15 +2921,15 @@ function getReceiptsByType(receipts, type) {
2996
2921
  }
2997
2922
  function getTransactionTypeName(transactionType) {
2998
2923
  switch (transactionType) {
2999
- case import_transactions14.TransactionType.Mint:
2924
+ case import_transactions13.TransactionType.Mint:
3000
2925
  return "Mint" /* Mint */;
3001
- case import_transactions14.TransactionType.Create:
2926
+ case import_transactions13.TransactionType.Create:
3002
2927
  return "Create" /* Create */;
3003
- case import_transactions14.TransactionType.Script:
2928
+ case import_transactions13.TransactionType.Script:
3004
2929
  return "Script" /* Script */;
3005
2930
  default:
3006
- throw new import_errors11.FuelError(
3007
- import_errors11.ErrorCode.INVALID_TRANSACTION_TYPE,
2931
+ throw new import_errors10.FuelError(
2932
+ import_errors10.ErrorCode.INVALID_TRANSACTION_TYPE,
3008
2933
  `Invalid transaction type: ${transactionType}.`
3009
2934
  );
3010
2935
  }
@@ -3026,10 +2951,10 @@ function hasSameAssetId(a) {
3026
2951
  return (b) => a.assetId === b.assetId;
3027
2952
  }
3028
2953
  function getReceiptsCall(receipts) {
3029
- return getReceiptsByType(receipts, import_transactions14.ReceiptType.Call);
2954
+ return getReceiptsByType(receipts, import_transactions13.ReceiptType.Call);
3030
2955
  }
3031
2956
  function getReceiptsMessageOut(receipts) {
3032
- return getReceiptsByType(receipts, import_transactions14.ReceiptType.MessageOut);
2957
+ return getReceiptsByType(receipts, import_transactions13.ReceiptType.MessageOut);
3033
2958
  }
3034
2959
  var mergeAssets = (op1, op2) => {
3035
2960
  const assets1 = op1.assetsSent || [];
@@ -3042,7 +2967,7 @@ var mergeAssets = (op1, op2) => {
3042
2967
  if (!matchingAsset) {
3043
2968
  return asset1;
3044
2969
  }
3045
- const mergedAmount = (0, import_math13.bn)(asset1.amount).add(matchingAsset.amount);
2970
+ const mergedAmount = (0, import_math12.bn)(asset1.amount).add(matchingAsset.amount);
3046
2971
  return { ...asset1, amount: mergedAmount };
3047
2972
  });
3048
2973
  return mergedAssets.concat(filteredAssets);
@@ -3068,7 +2993,7 @@ function addOperation(operations, toAdd) {
3068
2993
  return allOperations;
3069
2994
  }
3070
2995
  function getReceiptsTransferOut(receipts) {
3071
- return getReceiptsByType(receipts, import_transactions14.ReceiptType.TransferOut);
2996
+ return getReceiptsByType(receipts, import_transactions13.ReceiptType.TransferOut);
3072
2997
  }
3073
2998
  function getWithdrawFromFuelOperations({
3074
2999
  inputs,
@@ -3171,7 +3096,7 @@ function extractTransferOperationFromReceipt(receipt, contractInputs, changeOutp
3171
3096
  const { to: toAddress, assetId, amount } = receipt;
3172
3097
  let { from: fromAddress } = receipt;
3173
3098
  const toType = contractInputs.some((input) => input.contractID === toAddress) ? 0 /* contract */ : 1 /* account */;
3174
- if (import_configs11.ZeroBytes32 === fromAddress) {
3099
+ if (import_configs10.ZeroBytes32 === fromAddress) {
3175
3100
  const change = changeOutputs.find((output) => output.assetId === assetId);
3176
3101
  fromAddress = change?.to || fromAddress;
3177
3102
  }
@@ -3228,11 +3153,11 @@ function getTransferOperations({
3228
3153
  });
3229
3154
  const transferReceipts = getReceiptsByType(
3230
3155
  receipts,
3231
- import_transactions14.ReceiptType.Transfer
3156
+ import_transactions13.ReceiptType.Transfer
3232
3157
  );
3233
3158
  const transferOutReceipts = getReceiptsByType(
3234
3159
  receipts,
3235
- import_transactions14.ReceiptType.TransferOut
3160
+ import_transactions13.ReceiptType.TransferOut
3236
3161
  );
3237
3162
  [...transferReceipts, ...transferOutReceipts].forEach((receipt) => {
3238
3163
  const operation = extractTransferOperationFromReceipt(receipt, contractInputs, changeOutputs);
@@ -3317,17 +3242,17 @@ function getOperations({
3317
3242
  }
3318
3243
 
3319
3244
  // src/providers/transaction-summary/receipt.ts
3320
- var import_transactions15 = require("@fuel-ts/transactions");
3245
+ var import_transactions14 = require("@fuel-ts/transactions");
3321
3246
  var processGqlReceipt = (gqlReceipt) => {
3322
3247
  const receipt = assembleReceiptByType(gqlReceipt);
3323
3248
  switch (receipt.type) {
3324
- case import_transactions15.ReceiptType.ReturnData: {
3249
+ case import_transactions14.ReceiptType.ReturnData: {
3325
3250
  return {
3326
3251
  ...receipt,
3327
3252
  data: gqlReceipt.data || "0x"
3328
3253
  };
3329
3254
  }
3330
- case import_transactions15.ReceiptType.LogData: {
3255
+ case import_transactions14.ReceiptType.LogData: {
3331
3256
  return {
3332
3257
  ...receipt,
3333
3258
  data: gqlReceipt.data || "0x"
@@ -3340,7 +3265,7 @@ var processGqlReceipt = (gqlReceipt) => {
3340
3265
  var extractMintedAssetsFromReceipts = (receipts) => {
3341
3266
  const mintedAssets = [];
3342
3267
  receipts.forEach((receipt) => {
3343
- if (receipt.type === import_transactions15.ReceiptType.Mint) {
3268
+ if (receipt.type === import_transactions14.ReceiptType.Mint) {
3344
3269
  mintedAssets.push({
3345
3270
  subId: receipt.subId,
3346
3271
  contractId: receipt.contractId,
@@ -3354,7 +3279,7 @@ var extractMintedAssetsFromReceipts = (receipts) => {
3354
3279
  var extractBurnedAssetsFromReceipts = (receipts) => {
3355
3280
  const burnedAssets = [];
3356
3281
  receipts.forEach((receipt) => {
3357
- if (receipt.type === import_transactions15.ReceiptType.Burn) {
3282
+ if (receipt.type === import_transactions14.ReceiptType.Burn) {
3358
3283
  burnedAssets.push({
3359
3284
  subId: receipt.subId,
3360
3285
  contractId: receipt.contractId,
@@ -3367,7 +3292,7 @@ var extractBurnedAssetsFromReceipts = (receipts) => {
3367
3292
  };
3368
3293
 
3369
3294
  // src/providers/transaction-summary/status.ts
3370
- var import_errors12 = require("@fuel-ts/errors");
3295
+ var import_errors11 = require("@fuel-ts/errors");
3371
3296
  var getTransactionStatusName = (gqlStatus) => {
3372
3297
  switch (gqlStatus) {
3373
3298
  case "FailureStatus":
@@ -3379,8 +3304,8 @@ var getTransactionStatusName = (gqlStatus) => {
3379
3304
  case "SqueezedOutStatus":
3380
3305
  return "squeezedout" /* squeezedout */;
3381
3306
  default:
3382
- throw new import_errors12.FuelError(
3383
- import_errors12.ErrorCode.INVALID_TRANSACTION_STATUS,
3307
+ throw new import_errors11.FuelError(
3308
+ import_errors11.ErrorCode.INVALID_TRANSACTION_STATUS,
3384
3309
  `Invalid transaction status: ${gqlStatus}.`
3385
3310
  );
3386
3311
  }
@@ -3493,12 +3418,12 @@ function assembleTransactionSummary(params) {
3493
3418
 
3494
3419
  // src/providers/transaction-response/getDecodedLogs.ts
3495
3420
  var import_abi_coder3 = require("@fuel-ts/abi-coder");
3496
- var import_transactions16 = require("@fuel-ts/transactions");
3421
+ var import_transactions15 = require("@fuel-ts/transactions");
3497
3422
  function getDecodedLogs(receipts, mainAbi, externalAbis = {}) {
3498
3423
  return receipts.reduce((logs, receipt) => {
3499
- if (receipt.type === import_transactions16.ReceiptType.LogData || receipt.type === import_transactions16.ReceiptType.Log) {
3424
+ if (receipt.type === import_transactions15.ReceiptType.LogData || receipt.type === import_transactions15.ReceiptType.Log) {
3500
3425
  const interfaceToUse = new import_abi_coder3.Interface(externalAbis[receipt.id] || mainAbi);
3501
- const data = receipt.type === import_transactions16.ReceiptType.Log ? new import_abi_coder3.BigNumberCoder("u64").encode(receipt.val0) : receipt.data;
3426
+ const data = receipt.type === import_transactions15.ReceiptType.Log ? new import_abi_coder3.BigNumberCoder("u64").encode(receipt.val0) : receipt.data;
3502
3427
  const [decodedLog] = interfaceToUse.decodeLog(data, receipt.val1.toNumber());
3503
3428
  logs.push(decodedLog);
3504
3429
  }
@@ -3513,7 +3438,7 @@ var TransactionResponse = class {
3513
3438
  /** Current provider */
3514
3439
  provider;
3515
3440
  /** Gas used on the transaction */
3516
- gasUsed = (0, import_math14.bn)(0);
3441
+ gasUsed = (0, import_math13.bn)(0);
3517
3442
  /** The graphql Transaction with receipts object. */
3518
3443
  gqlTransaction;
3519
3444
  abis;
@@ -3571,7 +3496,7 @@ var TransactionResponse = class {
3571
3496
  * @returns The decoded transaction.
3572
3497
  */
3573
3498
  decodeTransaction(transactionWithReceipts) {
3574
- return new import_transactions17.TransactionCoder().decode(
3499
+ return new import_transactions16.TransactionCoder().decode(
3575
3500
  (0, import_utils21.arrayify)(transactionWithReceipts.rawPayload),
3576
3501
  0
3577
3502
  )?.[0];
@@ -3618,8 +3543,8 @@ var TransactionResponse = class {
3618
3543
  });
3619
3544
  for await (const { statusChange } of subscription) {
3620
3545
  if (statusChange.type === "SqueezedOutStatus") {
3621
- throw new import_errors13.FuelError(
3622
- import_errors13.ErrorCode.TRANSACTION_SQUEEZED_OUT,
3546
+ throw new import_errors12.FuelError(
3547
+ import_errors12.ErrorCode.TRANSACTION_SQUEEZED_OUT,
3623
3548
  `Transaction Squeezed Out with reason: ${statusChange.reason}`
3624
3549
  );
3625
3550
  }
@@ -3641,26 +3566,14 @@ var TransactionResponse = class {
3641
3566
  gqlTransaction: this.gqlTransaction,
3642
3567
  ...transactionSummary
3643
3568
  };
3644
- let logs = [];
3645
3569
  if (this.abis) {
3646
- logs = getDecodedLogs(
3570
+ const logs = getDecodedLogs(
3647
3571
  transactionSummary.receipts,
3648
3572
  this.abis.main,
3649
3573
  this.abis.otherContractsAbis
3650
3574
  );
3651
3575
  transactionResult.logs = logs;
3652
3576
  }
3653
- if (transactionResult.isStatusFailure) {
3654
- const {
3655
- receipts,
3656
- gqlTransaction: { status }
3657
- } = transactionResult;
3658
- throw extractTxError({
3659
- receipts,
3660
- status,
3661
- logs
3662
- });
3663
- }
3664
3577
  return transactionResult;
3665
3578
  }
3666
3579
  /**
@@ -3669,7 +3582,14 @@ var TransactionResponse = class {
3669
3582
  * @param contractsAbiMap - The contracts ABI map.
3670
3583
  */
3671
3584
  async wait(contractsAbiMap) {
3672
- return this.waitForResult(contractsAbiMap);
3585
+ const result = await this.waitForResult(contractsAbiMap);
3586
+ if (result.isStatusFailure) {
3587
+ throw new import_errors12.FuelError(
3588
+ import_errors12.ErrorCode.TRANSACTION_FAILED,
3589
+ `Transaction failed: ${result.gqlTransaction.status.reason}`
3590
+ );
3591
+ }
3592
+ return result;
3673
3593
  }
3674
3594
  };
3675
3595
 
@@ -3731,29 +3651,29 @@ var processGqlChain = (chain) => {
3731
3651
  const { contractParams, feeParams, predicateParams, scriptParams, txParams, gasCosts } = consensusParameters;
3732
3652
  return {
3733
3653
  name,
3734
- baseChainHeight: (0, import_math15.bn)(daHeight),
3654
+ baseChainHeight: (0, import_math14.bn)(daHeight),
3735
3655
  consensusParameters: {
3736
- contractMaxSize: (0, import_math15.bn)(contractParams.contractMaxSize),
3737
- maxInputs: (0, import_math15.bn)(txParams.maxInputs),
3738
- maxOutputs: (0, import_math15.bn)(txParams.maxOutputs),
3739
- maxWitnesses: (0, import_math15.bn)(txParams.maxWitnesses),
3740
- maxGasPerTx: (0, import_math15.bn)(txParams.maxGasPerTx),
3741
- maxScriptLength: (0, import_math15.bn)(scriptParams.maxScriptLength),
3742
- maxScriptDataLength: (0, import_math15.bn)(scriptParams.maxScriptDataLength),
3743
- maxStorageSlots: (0, import_math15.bn)(contractParams.maxStorageSlots),
3744
- maxPredicateLength: (0, import_math15.bn)(predicateParams.maxPredicateLength),
3745
- maxPredicateDataLength: (0, import_math15.bn)(predicateParams.maxPredicateDataLength),
3746
- maxGasPerPredicate: (0, import_math15.bn)(predicateParams.maxGasPerPredicate),
3747
- gasPriceFactor: (0, import_math15.bn)(feeParams.gasPriceFactor),
3748
- gasPerByte: (0, import_math15.bn)(feeParams.gasPerByte),
3749
- maxMessageDataLength: (0, import_math15.bn)(predicateParams.maxMessageDataLength),
3750
- chainId: (0, import_math15.bn)(consensusParameters.chainId),
3656
+ contractMaxSize: (0, import_math14.bn)(contractParams.contractMaxSize),
3657
+ maxInputs: (0, import_math14.bn)(txParams.maxInputs),
3658
+ maxOutputs: (0, import_math14.bn)(txParams.maxOutputs),
3659
+ maxWitnesses: (0, import_math14.bn)(txParams.maxWitnesses),
3660
+ maxGasPerTx: (0, import_math14.bn)(txParams.maxGasPerTx),
3661
+ maxScriptLength: (0, import_math14.bn)(scriptParams.maxScriptLength),
3662
+ maxScriptDataLength: (0, import_math14.bn)(scriptParams.maxScriptDataLength),
3663
+ maxStorageSlots: (0, import_math14.bn)(contractParams.maxStorageSlots),
3664
+ maxPredicateLength: (0, import_math14.bn)(predicateParams.maxPredicateLength),
3665
+ maxPredicateDataLength: (0, import_math14.bn)(predicateParams.maxPredicateDataLength),
3666
+ maxGasPerPredicate: (0, import_math14.bn)(predicateParams.maxGasPerPredicate),
3667
+ gasPriceFactor: (0, import_math14.bn)(feeParams.gasPriceFactor),
3668
+ gasPerByte: (0, import_math14.bn)(feeParams.gasPerByte),
3669
+ maxMessageDataLength: (0, import_math14.bn)(predicateParams.maxMessageDataLength),
3670
+ chainId: (0, import_math14.bn)(consensusParameters.chainId),
3751
3671
  gasCosts
3752
3672
  },
3753
3673
  gasCosts,
3754
3674
  latestBlock: {
3755
3675
  id: latestBlock.id,
3756
- height: (0, import_math15.bn)(latestBlock.header.height),
3676
+ height: (0, import_math14.bn)(latestBlock.header.height),
3757
3677
  time: latestBlock.header.time,
3758
3678
  transactions: latestBlock.transactions.map((i) => ({
3759
3679
  id: i.id
@@ -3823,8 +3743,8 @@ var _Provider = class {
3823
3743
  getChain() {
3824
3744
  const chain = _Provider.chainInfoCache[this.url];
3825
3745
  if (!chain) {
3826
- throw new import_errors14.FuelError(
3827
- import_errors14.ErrorCode.CHAIN_INFO_CACHE_EMPTY,
3746
+ throw new import_errors13.FuelError(
3747
+ import_errors13.ErrorCode.CHAIN_INFO_CACHE_EMPTY,
3828
3748
  "Chain info cache is empty. Make sure you have called `Provider.create` to initialize the provider."
3829
3749
  );
3830
3750
  }
@@ -3836,8 +3756,8 @@ var _Provider = class {
3836
3756
  getNode() {
3837
3757
  const node = _Provider.nodeInfoCache[this.url];
3838
3758
  if (!node) {
3839
- throw new import_errors14.FuelError(
3840
- import_errors14.ErrorCode.NODE_INFO_CACHE_EMPTY,
3759
+ throw new import_errors13.FuelError(
3760
+ import_errors13.ErrorCode.NODE_INFO_CACHE_EMPTY,
3841
3761
  "Node info cache is empty. Make sure you have called `Provider.create` to initialize the provider."
3842
3762
  );
3843
3763
  }
@@ -3884,8 +3804,8 @@ var _Provider = class {
3884
3804
  static ensureClientVersionIsSupported(nodeInfo) {
3885
3805
  const { isMajorSupported, isMinorSupported, supportedVersion } = (0, import_versions.checkFuelCoreVersionCompatibility)(nodeInfo.nodeVersion);
3886
3806
  if (!isMajorSupported || !isMinorSupported) {
3887
- throw new import_errors14.FuelError(
3888
- import_errors14.FuelError.CODES.UNSUPPORTED_FUEL_CLIENT_VERSION,
3807
+ throw new import_errors13.FuelError(
3808
+ import_errors13.FuelError.CODES.UNSUPPORTED_FUEL_CLIENT_VERSION,
3889
3809
  `Fuel client version: ${nodeInfo.nodeVersion}, Supported version: ${supportedVersion}`
3890
3810
  );
3891
3811
  }
@@ -3948,7 +3868,7 @@ var _Provider = class {
3948
3868
  */
3949
3869
  async getBlockNumber() {
3950
3870
  const { chain } = await this.operations.getChain();
3951
- return (0, import_math15.bn)(chain.latestBlock.header.height, 10);
3871
+ return (0, import_math14.bn)(chain.latestBlock.header.height, 10);
3952
3872
  }
3953
3873
  /**
3954
3874
  * Returns the chain information.
@@ -3958,9 +3878,9 @@ var _Provider = class {
3958
3878
  async fetchNode() {
3959
3879
  const { nodeInfo } = await this.operations.getNodeInfo();
3960
3880
  const processedNodeInfo = {
3961
- maxDepth: (0, import_math15.bn)(nodeInfo.maxDepth),
3962
- maxTx: (0, import_math15.bn)(nodeInfo.maxTx),
3963
- minGasPrice: (0, import_math15.bn)(nodeInfo.minGasPrice),
3881
+ maxDepth: (0, import_math14.bn)(nodeInfo.maxDepth),
3882
+ maxTx: (0, import_math14.bn)(nodeInfo.maxTx),
3883
+ minGasPrice: (0, import_math14.bn)(nodeInfo.minGasPrice),
3964
3884
  nodeVersion: nodeInfo.nodeVersion,
3965
3885
  utxoValidation: nodeInfo.utxoValidation,
3966
3886
  vmBacktrace: nodeInfo.vmBacktrace,
@@ -4006,17 +3926,17 @@ var _Provider = class {
4006
3926
  if (estimateTxDependencies) {
4007
3927
  await this.estimateTxDependencies(transactionRequest);
4008
3928
  }
4009
- const encodedTransaction = (0, import_utils23.hexlify)(transactionRequest.toTransactionBytes());
3929
+ const encodedTransaction = (0, import_utils22.hexlify)(transactionRequest.toTransactionBytes());
4010
3930
  let abis;
4011
- if (transactionRequest.type === import_transactions18.TransactionType.Script) {
3931
+ if (transactionRequest.type === import_transactions17.TransactionType.Script) {
4012
3932
  abis = transactionRequest.abis;
4013
3933
  }
4014
3934
  if (awaitExecution) {
4015
3935
  const subscription = this.operations.submitAndAwait({ encodedTransaction });
4016
3936
  for await (const { submitAndAwait } of subscription) {
4017
3937
  if (submitAndAwait.type === "SqueezedOutStatus") {
4018
- throw new import_errors14.FuelError(
4019
- import_errors14.ErrorCode.TRANSACTION_SQUEEZED_OUT,
3938
+ throw new import_errors13.FuelError(
3939
+ import_errors13.ErrorCode.TRANSACTION_SQUEEZED_OUT,
4020
3940
  `Transaction Squeezed Out with reason: ${submitAndAwait.reason}`
4021
3941
  );
4022
3942
  }
@@ -4049,7 +3969,7 @@ var _Provider = class {
4049
3969
  if (estimateTxDependencies) {
4050
3970
  return this.estimateTxDependencies(transactionRequest);
4051
3971
  }
4052
- const encodedTransaction = (0, import_utils23.hexlify)(transactionRequest.toTransactionBytes());
3972
+ const encodedTransaction = (0, import_utils22.hexlify)(transactionRequest.toTransactionBytes());
4053
3973
  const { dryRun: gqlReceipts } = await this.operations.dryRun({
4054
3974
  encodedTransaction,
4055
3975
  utxoValidation: utxoValidation || false
@@ -4068,13 +3988,13 @@ var _Provider = class {
4068
3988
  async estimatePredicates(transactionRequest) {
4069
3989
  const shouldEstimatePredicates = Boolean(
4070
3990
  transactionRequest.inputs.find(
4071
- (input) => "predicate" in input && input.predicate && !(0, import_utils24.equalBytes)((0, import_utils23.arrayify)(input.predicate), (0, import_utils23.arrayify)("0x")) && new import_math15.BN(input.predicateGasUsed).isZero()
3991
+ (input) => "predicate" in input && input.predicate && !(0, import_utils23.equalBytes)((0, import_utils22.arrayify)(input.predicate), (0, import_utils22.arrayify)("0x")) && new import_math14.BN(input.predicateGasUsed).isZero()
4072
3992
  )
4073
3993
  );
4074
3994
  if (!shouldEstimatePredicates) {
4075
3995
  return transactionRequest;
4076
3996
  }
4077
- const encodedTransaction = (0, import_utils23.hexlify)(transactionRequest.toTransactionBytes());
3997
+ const encodedTransaction = (0, import_utils22.hexlify)(transactionRequest.toTransactionBytes());
4078
3998
  const response = await this.operations.estimatePredicates({
4079
3999
  encodedTransaction
4080
4000
  });
@@ -4083,7 +4003,7 @@ var _Provider = class {
4083
4003
  } = response;
4084
4004
  if (inputs) {
4085
4005
  inputs.forEach((input, index) => {
4086
- if ("predicateGasUsed" in input && (0, import_math15.bn)(input.predicateGasUsed).gt(0)) {
4006
+ if ("predicateGasUsed" in input && (0, import_math14.bn)(input.predicateGasUsed).gt(0)) {
4087
4007
  transactionRequest.inputs[index].predicateGasUsed = input.predicateGasUsed;
4088
4008
  }
4089
4009
  });
@@ -4104,7 +4024,7 @@ var _Provider = class {
4104
4024
  * @returns A promise.
4105
4025
  */
4106
4026
  async estimateTxDependencies(transactionRequest) {
4107
- if (transactionRequest.type === import_transactions18.TransactionType.Create) {
4027
+ if (transactionRequest.type === import_transactions17.TransactionType.Create) {
4108
4028
  return {
4109
4029
  receipts: [],
4110
4030
  outputVariables: 0,
@@ -4117,7 +4037,7 @@ var _Provider = class {
4117
4037
  let outputVariables = 0;
4118
4038
  for (let attempt = 0; attempt < MAX_RETRIES; attempt++) {
4119
4039
  const { dryRun: gqlReceipts } = await this.operations.dryRun({
4120
- encodedTransaction: (0, import_utils23.hexlify)(transactionRequest.toTransactionBytes()),
4040
+ encodedTransaction: (0, import_utils22.hexlify)(transactionRequest.toTransactionBytes()),
4121
4041
  utxoValidation: false
4122
4042
  });
4123
4043
  receipts = gqlReceipts.map(processGqlReceipt);
@@ -4155,7 +4075,7 @@ var _Provider = class {
4155
4075
  if (estimateTxDependencies) {
4156
4076
  return this.estimateTxDependencies(transactionRequest);
4157
4077
  }
4158
- const encodedTransaction = (0, import_utils23.hexlify)(transactionRequest.toTransactionBytes());
4078
+ const encodedTransaction = (0, import_utils22.hexlify)(transactionRequest.toTransactionBytes());
4159
4079
  const { dryRun: gqlReceipts } = await this.operations.dryRun({
4160
4080
  encodedTransaction,
4161
4081
  utxoValidation: true
@@ -4189,14 +4109,14 @@ var _Provider = class {
4189
4109
  const txRequestClone = (0, import_ramda3.clone)(transactionRequestify(transactionRequestLike));
4190
4110
  const chainInfo = this.getChain();
4191
4111
  const { gasPriceFactor, minGasPrice, maxGasPerTx } = this.getGasConfig();
4192
- const gasPrice = (0, import_math15.max)(txRequestClone.gasPrice, minGasPrice);
4193
- const isScriptTransaction = txRequestClone.type === import_transactions18.TransactionType.Script;
4112
+ const gasPrice = (0, import_math14.max)(txRequestClone.gasPrice, minGasPrice);
4113
+ const isScriptTransaction = txRequestClone.type === import_transactions17.TransactionType.Script;
4194
4114
  const coinOutputsQuantities = txRequestClone.getCoinOutputsQuantities();
4195
4115
  const allQuantities = mergeQuantities(coinOutputsQuantities, forwardingQuantities);
4196
4116
  txRequestClone.fundWithFakeUtxos(allQuantities, resourcesOwner?.address);
4197
4117
  if (estimatePredicates) {
4198
4118
  if (isScriptTransaction) {
4199
- txRequestClone.gasLimit = (0, import_math15.bn)(0);
4119
+ txRequestClone.gasLimit = (0, import_math14.bn)(0);
4200
4120
  }
4201
4121
  if (resourcesOwner && "populateTransactionPredicateData" in resourcesOwner) {
4202
4122
  resourcesOwner.populateTransactionPredicateData(txRequestClone);
@@ -4212,8 +4132,8 @@ var _Provider = class {
4212
4132
  let missingContractIds = [];
4213
4133
  let outputVariables = 0;
4214
4134
  if (isScriptTransaction && estimateTxDependencies) {
4215
- txRequestClone.gasPrice = (0, import_math15.bn)(0);
4216
- txRequestClone.gasLimit = (0, import_math15.bn)(maxGasPerTx.sub(maxGas).toNumber() * 0.9);
4135
+ txRequestClone.gasPrice = (0, import_math14.bn)(0);
4136
+ txRequestClone.gasLimit = (0, import_math14.bn)(maxGasPerTx.sub(maxGas).toNumber() * 0.9);
4217
4137
  const result = await this.estimateTxDependencies(txRequestClone);
4218
4138
  receipts = result.receipts;
4219
4139
  outputVariables = result.outputVariables;
@@ -4269,17 +4189,17 @@ var _Provider = class {
4269
4189
  const result = await this.operations.getCoins({
4270
4190
  first: 10,
4271
4191
  ...paginationArgs,
4272
- filter: { owner: ownerAddress.toB256(), assetId: assetId && (0, import_utils23.hexlify)(assetId) }
4192
+ filter: { owner: ownerAddress.toB256(), assetId: assetId && (0, import_utils22.hexlify)(assetId) }
4273
4193
  });
4274
4194
  const coins = result.coins.edges.map((edge) => edge.node);
4275
4195
  return coins.map((coin) => ({
4276
4196
  id: coin.utxoId,
4277
4197
  assetId: coin.assetId,
4278
- amount: (0, import_math15.bn)(coin.amount),
4198
+ amount: (0, import_math14.bn)(coin.amount),
4279
4199
  owner: import_address3.Address.fromAddressOrString(coin.owner),
4280
- maturity: (0, import_math15.bn)(coin.maturity).toNumber(),
4281
- blockCreated: (0, import_math15.bn)(coin.blockCreated),
4282
- txCreatedIdx: (0, import_math15.bn)(coin.txCreatedIdx)
4200
+ maturity: (0, import_math14.bn)(coin.maturity).toNumber(),
4201
+ blockCreated: (0, import_math14.bn)(coin.blockCreated),
4202
+ txCreatedIdx: (0, import_math14.bn)(coin.txCreatedIdx)
4283
4203
  }));
4284
4204
  }
4285
4205
  /**
@@ -4293,19 +4213,19 @@ var _Provider = class {
4293
4213
  async getResourcesToSpend(owner, quantities, excludedIds) {
4294
4214
  const ownerAddress = import_address3.Address.fromAddressOrString(owner);
4295
4215
  const excludeInput = {
4296
- messages: excludedIds?.messages?.map((nonce) => (0, import_utils23.hexlify)(nonce)) || [],
4297
- utxos: excludedIds?.utxos?.map((id) => (0, import_utils23.hexlify)(id)) || []
4216
+ messages: excludedIds?.messages?.map((nonce) => (0, import_utils22.hexlify)(nonce)) || [],
4217
+ utxos: excludedIds?.utxos?.map((id) => (0, import_utils22.hexlify)(id)) || []
4298
4218
  };
4299
4219
  if (this.cache) {
4300
4220
  const uniqueUtxos = new Set(
4301
- excludeInput.utxos.concat(this.cache?.getActiveData().map((id) => (0, import_utils23.hexlify)(id)))
4221
+ excludeInput.utxos.concat(this.cache?.getActiveData().map((id) => (0, import_utils22.hexlify)(id)))
4302
4222
  );
4303
4223
  excludeInput.utxos = Array.from(uniqueUtxos);
4304
4224
  }
4305
4225
  const coinsQuery = {
4306
4226
  owner: ownerAddress.toB256(),
4307
4227
  queryPerAsset: quantities.map(coinQuantityfy).map(({ assetId, amount, max: maxPerAsset }) => ({
4308
- assetId: (0, import_utils23.hexlify)(assetId),
4228
+ assetId: (0, import_utils22.hexlify)(assetId),
4309
4229
  amount: amount.toString(10),
4310
4230
  max: maxPerAsset ? maxPerAsset.toString(10) : void 0
4311
4231
  })),
@@ -4316,9 +4236,9 @@ var _Provider = class {
4316
4236
  switch (coin.__typename) {
4317
4237
  case "MessageCoin":
4318
4238
  return {
4319
- amount: (0, import_math15.bn)(coin.amount),
4239
+ amount: (0, import_math14.bn)(coin.amount),
4320
4240
  assetId: coin.assetId,
4321
- daHeight: (0, import_math15.bn)(coin.daHeight),
4241
+ daHeight: (0, import_math14.bn)(coin.daHeight),
4322
4242
  sender: import_address3.Address.fromAddressOrString(coin.sender),
4323
4243
  recipient: import_address3.Address.fromAddressOrString(coin.recipient),
4324
4244
  nonce: coin.nonce
@@ -4326,12 +4246,12 @@ var _Provider = class {
4326
4246
  case "Coin":
4327
4247
  return {
4328
4248
  id: coin.utxoId,
4329
- amount: (0, import_math15.bn)(coin.amount),
4249
+ amount: (0, import_math14.bn)(coin.amount),
4330
4250
  assetId: coin.assetId,
4331
4251
  owner: import_address3.Address.fromAddressOrString(coin.owner),
4332
- maturity: (0, import_math15.bn)(coin.maturity).toNumber(),
4333
- blockCreated: (0, import_math15.bn)(coin.blockCreated),
4334
- txCreatedIdx: (0, import_math15.bn)(coin.txCreatedIdx)
4252
+ maturity: (0, import_math14.bn)(coin.maturity).toNumber(),
4253
+ blockCreated: (0, import_math14.bn)(coin.blockCreated),
4254
+ txCreatedIdx: (0, import_math14.bn)(coin.txCreatedIdx)
4335
4255
  };
4336
4256
  default:
4337
4257
  return null;
@@ -4348,13 +4268,13 @@ var _Provider = class {
4348
4268
  async getBlock(idOrHeight) {
4349
4269
  let variables;
4350
4270
  if (typeof idOrHeight === "number") {
4351
- variables = { height: (0, import_math15.bn)(idOrHeight).toString(10) };
4271
+ variables = { height: (0, import_math14.bn)(idOrHeight).toString(10) };
4352
4272
  } else if (idOrHeight === "latest") {
4353
4273
  variables = { height: (await this.getBlockNumber()).toString(10) };
4354
4274
  } else if (idOrHeight.length === 66) {
4355
4275
  variables = { blockId: idOrHeight };
4356
4276
  } else {
4357
- variables = { blockId: (0, import_math15.bn)(idOrHeight).toString(10) };
4277
+ variables = { blockId: (0, import_math14.bn)(idOrHeight).toString(10) };
4358
4278
  }
4359
4279
  const { block } = await this.operations.getBlock(variables);
4360
4280
  if (!block) {
@@ -4362,7 +4282,7 @@ var _Provider = class {
4362
4282
  }
4363
4283
  return {
4364
4284
  id: block.id,
4365
- height: (0, import_math15.bn)(block.header.height),
4285
+ height: (0, import_math14.bn)(block.header.height),
4366
4286
  time: block.header.time,
4367
4287
  transactionIds: block.transactions.map((tx) => tx.id)
4368
4288
  };
@@ -4377,7 +4297,7 @@ var _Provider = class {
4377
4297
  const { blocks: fetchedData } = await this.operations.getBlocks(params);
4378
4298
  const blocks = fetchedData.edges.map(({ node: block }) => ({
4379
4299
  id: block.id,
4380
- height: (0, import_math15.bn)(block.header.height),
4300
+ height: (0, import_math14.bn)(block.header.height),
4381
4301
  time: block.header.time,
4382
4302
  transactionIds: block.transactions.map((tx) => tx.id)
4383
4303
  }));
@@ -4392,7 +4312,7 @@ var _Provider = class {
4392
4312
  async getBlockWithTransactions(idOrHeight) {
4393
4313
  let variables;
4394
4314
  if (typeof idOrHeight === "number") {
4395
- variables = { blockHeight: (0, import_math15.bn)(idOrHeight).toString(10) };
4315
+ variables = { blockHeight: (0, import_math14.bn)(idOrHeight).toString(10) };
4396
4316
  } else if (idOrHeight === "latest") {
4397
4317
  variables = { blockHeight: (await this.getBlockNumber()).toString() };
4398
4318
  } else {
@@ -4404,11 +4324,11 @@ var _Provider = class {
4404
4324
  }
4405
4325
  return {
4406
4326
  id: block.id,
4407
- height: (0, import_math15.bn)(block.header.height, 10),
4327
+ height: (0, import_math14.bn)(block.header.height, 10),
4408
4328
  time: block.header.time,
4409
4329
  transactionIds: block.transactions.map((tx) => tx.id),
4410
4330
  transactions: block.transactions.map(
4411
- (tx) => new import_transactions18.TransactionCoder().decode((0, import_utils23.arrayify)(tx.rawPayload), 0)?.[0]
4331
+ (tx) => new import_transactions17.TransactionCoder().decode((0, import_utils22.arrayify)(tx.rawPayload), 0)?.[0]
4412
4332
  )
4413
4333
  };
4414
4334
  }
@@ -4423,8 +4343,8 @@ var _Provider = class {
4423
4343
  if (!transaction) {
4424
4344
  return null;
4425
4345
  }
4426
- return new import_transactions18.TransactionCoder().decode(
4427
- (0, import_utils23.arrayify)(transaction.rawPayload),
4346
+ return new import_transactions17.TransactionCoder().decode(
4347
+ (0, import_utils22.arrayify)(transaction.rawPayload),
4428
4348
  0
4429
4349
  )?.[0];
4430
4350
  }
@@ -4451,9 +4371,9 @@ var _Provider = class {
4451
4371
  async getContractBalance(contractId, assetId) {
4452
4372
  const { contractBalance } = await this.operations.getContractBalance({
4453
4373
  contract: import_address3.Address.fromAddressOrString(contractId).toB256(),
4454
- asset: (0, import_utils23.hexlify)(assetId)
4374
+ asset: (0, import_utils22.hexlify)(assetId)
4455
4375
  });
4456
- return (0, import_math15.bn)(contractBalance.amount, 10);
4376
+ return (0, import_math14.bn)(contractBalance.amount, 10);
4457
4377
  }
4458
4378
  /**
4459
4379
  * Returns the balance for the given owner for the given asset ID.
@@ -4465,9 +4385,9 @@ var _Provider = class {
4465
4385
  async getBalance(owner, assetId) {
4466
4386
  const { balance } = await this.operations.getBalance({
4467
4387
  owner: import_address3.Address.fromAddressOrString(owner).toB256(),
4468
- assetId: (0, import_utils23.hexlify)(assetId)
4388
+ assetId: (0, import_utils22.hexlify)(assetId)
4469
4389
  });
4470
- return (0, import_math15.bn)(balance.amount, 10);
4390
+ return (0, import_math14.bn)(balance.amount, 10);
4471
4391
  }
4472
4392
  /**
4473
4393
  * Returns balances for the given owner.
@@ -4485,7 +4405,7 @@ var _Provider = class {
4485
4405
  const balances = result.balances.edges.map((edge) => edge.node);
4486
4406
  return balances.map((balance) => ({
4487
4407
  assetId: balance.assetId,
4488
- amount: (0, import_math15.bn)(balance.amount)
4408
+ amount: (0, import_math14.bn)(balance.amount)
4489
4409
  }));
4490
4410
  }
4491
4411
  /**
@@ -4503,19 +4423,19 @@ var _Provider = class {
4503
4423
  });
4504
4424
  const messages = result.messages.edges.map((edge) => edge.node);
4505
4425
  return messages.map((message) => ({
4506
- messageId: import_transactions18.InputMessageCoder.getMessageId({
4426
+ messageId: import_transactions17.InputMessageCoder.getMessageId({
4507
4427
  sender: message.sender,
4508
4428
  recipient: message.recipient,
4509
4429
  nonce: message.nonce,
4510
- amount: (0, import_math15.bn)(message.amount),
4430
+ amount: (0, import_math14.bn)(message.amount),
4511
4431
  data: message.data
4512
4432
  }),
4513
4433
  sender: import_address3.Address.fromAddressOrString(message.sender),
4514
4434
  recipient: import_address3.Address.fromAddressOrString(message.recipient),
4515
4435
  nonce: message.nonce,
4516
- amount: (0, import_math15.bn)(message.amount),
4517
- data: import_transactions18.InputMessageCoder.decodeData(message.data),
4518
- daHeight: (0, import_math15.bn)(message.daHeight)
4436
+ amount: (0, import_math14.bn)(message.amount),
4437
+ data: import_transactions17.InputMessageCoder.decodeData(message.data),
4438
+ daHeight: (0, import_math14.bn)(message.daHeight)
4519
4439
  }));
4520
4440
  }
4521
4441
  /**
@@ -4533,8 +4453,8 @@ var _Provider = class {
4533
4453
  nonce
4534
4454
  };
4535
4455
  if (commitBlockId && commitBlockHeight) {
4536
- throw new import_errors14.FuelError(
4537
- import_errors14.ErrorCode.INVALID_INPUT_PARAMETERS,
4456
+ throw new import_errors13.FuelError(
4457
+ import_errors13.ErrorCode.INVALID_INPUT_PARAMETERS,
4538
4458
  "commitBlockId and commitBlockHeight cannot be used together"
4539
4459
  );
4540
4460
  }
@@ -4568,41 +4488,41 @@ var _Provider = class {
4568
4488
  } = result.messageProof;
4569
4489
  return {
4570
4490
  messageProof: {
4571
- proofIndex: (0, import_math15.bn)(messageProof.proofIndex),
4491
+ proofIndex: (0, import_math14.bn)(messageProof.proofIndex),
4572
4492
  proofSet: messageProof.proofSet
4573
4493
  },
4574
4494
  blockProof: {
4575
- proofIndex: (0, import_math15.bn)(blockProof.proofIndex),
4495
+ proofIndex: (0, import_math14.bn)(blockProof.proofIndex),
4576
4496
  proofSet: blockProof.proofSet
4577
4497
  },
4578
4498
  messageBlockHeader: {
4579
4499
  id: messageBlockHeader.id,
4580
- daHeight: (0, import_math15.bn)(messageBlockHeader.daHeight),
4581
- transactionsCount: (0, import_math15.bn)(messageBlockHeader.transactionsCount),
4500
+ daHeight: (0, import_math14.bn)(messageBlockHeader.daHeight),
4501
+ transactionsCount: (0, import_math14.bn)(messageBlockHeader.transactionsCount),
4582
4502
  transactionsRoot: messageBlockHeader.transactionsRoot,
4583
- height: (0, import_math15.bn)(messageBlockHeader.height),
4503
+ height: (0, import_math14.bn)(messageBlockHeader.height),
4584
4504
  prevRoot: messageBlockHeader.prevRoot,
4585
4505
  time: messageBlockHeader.time,
4586
4506
  applicationHash: messageBlockHeader.applicationHash,
4587
4507
  messageReceiptRoot: messageBlockHeader.messageReceiptRoot,
4588
- messageReceiptCount: (0, import_math15.bn)(messageBlockHeader.messageReceiptCount)
4508
+ messageReceiptCount: (0, import_math14.bn)(messageBlockHeader.messageReceiptCount)
4589
4509
  },
4590
4510
  commitBlockHeader: {
4591
4511
  id: commitBlockHeader.id,
4592
- daHeight: (0, import_math15.bn)(commitBlockHeader.daHeight),
4593
- transactionsCount: (0, import_math15.bn)(commitBlockHeader.transactionsCount),
4512
+ daHeight: (0, import_math14.bn)(commitBlockHeader.daHeight),
4513
+ transactionsCount: (0, import_math14.bn)(commitBlockHeader.transactionsCount),
4594
4514
  transactionsRoot: commitBlockHeader.transactionsRoot,
4595
- height: (0, import_math15.bn)(commitBlockHeader.height),
4515
+ height: (0, import_math14.bn)(commitBlockHeader.height),
4596
4516
  prevRoot: commitBlockHeader.prevRoot,
4597
4517
  time: commitBlockHeader.time,
4598
4518
  applicationHash: commitBlockHeader.applicationHash,
4599
4519
  messageReceiptRoot: commitBlockHeader.messageReceiptRoot,
4600
- messageReceiptCount: (0, import_math15.bn)(commitBlockHeader.messageReceiptCount)
4520
+ messageReceiptCount: (0, import_math14.bn)(commitBlockHeader.messageReceiptCount)
4601
4521
  },
4602
4522
  sender: import_address3.Address.fromAddressOrString(sender),
4603
4523
  recipient: import_address3.Address.fromAddressOrString(recipient),
4604
4524
  nonce,
4605
- amount: (0, import_math15.bn)(amount),
4525
+ amount: (0, import_math14.bn)(amount),
4606
4526
  data
4607
4527
  };
4608
4528
  }
@@ -4625,10 +4545,10 @@ var _Provider = class {
4625
4545
  */
4626
4546
  async produceBlocks(amount, startTime) {
4627
4547
  const { produceBlocks: latestBlockHeight } = await this.operations.produceBlocks({
4628
- blocksToProduce: (0, import_math15.bn)(amount).toString(10),
4629
- startTimestamp: startTime ? import_utils23.DateTime.fromUnixMilliseconds(startTime).toTai64() : void 0
4548
+ blocksToProduce: (0, import_math14.bn)(amount).toString(10),
4549
+ startTimestamp: startTime ? import_utils22.DateTime.fromUnixMilliseconds(startTime).toTai64() : void 0
4630
4550
  });
4631
- return (0, import_math15.bn)(latestBlockHeight);
4551
+ return (0, import_math14.bn)(latestBlockHeight);
4632
4552
  }
4633
4553
  // eslint-disable-next-line @typescript-eslint/require-await
4634
4554
  async getTransactionResponse(transactionId) {
@@ -4642,7 +4562,7 @@ cacheInputs_fn = function(inputs) {
4642
4562
  return;
4643
4563
  }
4644
4564
  inputs.forEach((input) => {
4645
- if (input.type === import_transactions18.InputType.Coin) {
4565
+ if (input.type === import_transactions17.InputType.Coin) {
4646
4566
  this.cache?.set(input.id);
4647
4567
  }
4648
4568
  });
@@ -4651,23 +4571,23 @@ __publicField(Provider, "chainInfoCache", {});
4651
4571
  __publicField(Provider, "nodeInfoCache", {});
4652
4572
 
4653
4573
  // src/providers/transaction-summary/get-transaction-summary.ts
4654
- var import_errors15 = require("@fuel-ts/errors");
4655
- var import_math16 = require("@fuel-ts/math");
4656
- var import_transactions19 = require("@fuel-ts/transactions");
4657
- var import_utils26 = require("@fuel-ts/utils");
4574
+ var import_errors14 = require("@fuel-ts/errors");
4575
+ var import_math15 = require("@fuel-ts/math");
4576
+ var import_transactions18 = require("@fuel-ts/transactions");
4577
+ var import_utils25 = require("@fuel-ts/utils");
4658
4578
  async function getTransactionSummary(params) {
4659
4579
  const { id, provider, abiMap } = params;
4660
4580
  const { transaction: gqlTransaction } = await provider.operations.getTransactionWithReceipts({
4661
4581
  transactionId: id
4662
4582
  });
4663
4583
  if (!gqlTransaction) {
4664
- throw new import_errors15.FuelError(
4665
- import_errors15.ErrorCode.TRANSACTION_NOT_FOUND,
4584
+ throw new import_errors14.FuelError(
4585
+ import_errors14.ErrorCode.TRANSACTION_NOT_FOUND,
4666
4586
  `Transaction not found for given id: ${id}.`
4667
4587
  );
4668
4588
  }
4669
- const [decodedTransaction] = new import_transactions19.TransactionCoder().decode(
4670
- (0, import_utils26.arrayify)(gqlTransaction.rawPayload),
4589
+ const [decodedTransaction] = new import_transactions18.TransactionCoder().decode(
4590
+ (0, import_utils25.arrayify)(gqlTransaction.rawPayload),
4671
4591
  0
4672
4592
  );
4673
4593
  const receipts = gqlTransaction.receipts?.map(processGqlReceipt) || [];
@@ -4678,10 +4598,10 @@ async function getTransactionSummary(params) {
4678
4598
  id: gqlTransaction.id,
4679
4599
  receipts,
4680
4600
  transaction: decodedTransaction,
4681
- transactionBytes: (0, import_utils26.arrayify)(gqlTransaction.rawPayload),
4601
+ transactionBytes: (0, import_utils25.arrayify)(gqlTransaction.rawPayload),
4682
4602
  gqlTransactionStatus: gqlTransaction.status,
4683
- gasPerByte: (0, import_math16.bn)(gasPerByte),
4684
- gasPriceFactor: (0, import_math16.bn)(gasPriceFactor),
4603
+ gasPerByte: (0, import_math15.bn)(gasPerByte),
4604
+ gasPriceFactor: (0, import_math15.bn)(gasPriceFactor),
4685
4605
  abiMap,
4686
4606
  maxInputs,
4687
4607
  gasCosts
@@ -4720,13 +4640,13 @@ async function getTransactionsSummaries(params) {
4720
4640
  const transactions = edges.map((edge) => {
4721
4641
  const { node: gqlTransaction } = edge;
4722
4642
  const { id, rawPayload, receipts: gqlReceipts, status } = gqlTransaction;
4723
- const [decodedTransaction] = new import_transactions19.TransactionCoder().decode((0, import_utils26.arrayify)(rawPayload), 0);
4643
+ const [decodedTransaction] = new import_transactions18.TransactionCoder().decode((0, import_utils25.arrayify)(rawPayload), 0);
4724
4644
  const receipts = gqlReceipts?.map(processGqlReceipt) || [];
4725
4645
  const transactionSummary = assembleTransactionSummary({
4726
4646
  id,
4727
4647
  receipts,
4728
4648
  transaction: decodedTransaction,
4729
- transactionBytes: (0, import_utils26.arrayify)(rawPayload),
4649
+ transactionBytes: (0, import_utils25.arrayify)(rawPayload),
4730
4650
  gqlTransactionStatus: status,
4731
4651
  abiMap,
4732
4652
  gasPerByte,
@@ -4869,17 +4789,17 @@ var assets = [
4869
4789
 
4870
4790
  // src/utils/formatTransferToContractScriptData.ts
4871
4791
  var import_abi_coder4 = require("@fuel-ts/abi-coder");
4872
- var import_math17 = require("@fuel-ts/math");
4873
- var import_utils27 = require("@fuel-ts/utils");
4792
+ var import_math16 = require("@fuel-ts/math");
4793
+ var import_utils26 = require("@fuel-ts/utils");
4874
4794
  var asm = __toESM(require("@fuels/vm-asm"));
4875
4795
  var formatTransferToContractScriptData = (params) => {
4876
4796
  const { assetId, amountToTransfer, hexlifiedContractId } = params;
4877
4797
  const numberCoder = new import_abi_coder4.BigNumberCoder("u64");
4878
- const encoded = numberCoder.encode(new import_math17.BN(amountToTransfer).toNumber());
4798
+ const encoded = numberCoder.encode(new import_math16.BN(amountToTransfer).toNumber());
4879
4799
  const scriptData = Uint8Array.from([
4880
- ...(0, import_utils27.arrayify)(hexlifiedContractId),
4800
+ ...(0, import_utils26.arrayify)(hexlifiedContractId),
4881
4801
  ...encoded,
4882
- ...(0, import_utils27.arrayify)(assetId)
4802
+ ...(0, import_utils26.arrayify)(assetId)
4883
4803
  ]);
4884
4804
  return scriptData;
4885
4805
  };
@@ -4935,7 +4855,7 @@ var Account = class extends import_interfaces.AbstractAccount {
4935
4855
  */
4936
4856
  get provider() {
4937
4857
  if (!this._provider) {
4938
- throw new import_errors16.FuelError(import_errors16.ErrorCode.MISSING_PROVIDER, "Provider not set");
4858
+ throw new import_errors15.FuelError(import_errors15.ErrorCode.MISSING_PROVIDER, "Provider not set");
4939
4859
  }
4940
4860
  return this._provider;
4941
4861
  }
@@ -4987,8 +4907,8 @@ var Account = class extends import_interfaces.AbstractAccount {
4987
4907
  if (!hasNextPage) {
4988
4908
  break;
4989
4909
  }
4990
- throw new import_errors16.FuelError(
4991
- import_errors16.ErrorCode.NOT_SUPPORTED,
4910
+ throw new import_errors15.FuelError(
4911
+ import_errors15.ErrorCode.NOT_SUPPORTED,
4992
4912
  `Wallets containing more than ${pageSize} coins exceed the current supported limit.`
4993
4913
  );
4994
4914
  }
@@ -5013,8 +4933,8 @@ var Account = class extends import_interfaces.AbstractAccount {
5013
4933
  if (!hasNextPage) {
5014
4934
  break;
5015
4935
  }
5016
- throw new import_errors16.FuelError(
5017
- import_errors16.ErrorCode.NOT_SUPPORTED,
4936
+ throw new import_errors15.FuelError(
4937
+ import_errors15.ErrorCode.NOT_SUPPORTED,
5018
4938
  `Wallets containing more than ${pageSize} messages exceed the current supported limit.`
5019
4939
  );
5020
4940
  }
@@ -5026,7 +4946,7 @@ var Account = class extends import_interfaces.AbstractAccount {
5026
4946
  * @param assetId - The asset ID to check the balance for.
5027
4947
  * @returns A promise that resolves to the balance amount.
5028
4948
  */
5029
- async getBalance(assetId = import_configs12.BaseAssetId) {
4949
+ async getBalance(assetId = import_configs11.BaseAssetId) {
5030
4950
  const amount = await this.provider.getBalance(this.address, assetId);
5031
4951
  return amount;
5032
4952
  }
@@ -5049,8 +4969,8 @@ var Account = class extends import_interfaces.AbstractAccount {
5049
4969
  if (!hasNextPage) {
5050
4970
  break;
5051
4971
  }
5052
- throw new import_errors16.FuelError(
5053
- import_errors16.ErrorCode.NOT_SUPPORTED,
4972
+ throw new import_errors15.FuelError(
4973
+ import_errors15.ErrorCode.NOT_SUPPORTED,
5054
4974
  `Wallets containing more than ${pageSize} balances exceed the current supported limit.`
5055
4975
  );
5056
4976
  }
@@ -5066,15 +4986,15 @@ var Account = class extends import_interfaces.AbstractAccount {
5066
4986
  */
5067
4987
  async fund(request, coinQuantities, fee) {
5068
4988
  const updatedQuantities = addAmountToAsset({
5069
- amount: (0, import_math18.bn)(fee),
5070
- assetId: import_configs12.BaseAssetId,
4989
+ amount: (0, import_math17.bn)(fee),
4990
+ assetId: import_configs11.BaseAssetId,
5071
4991
  coinQuantities
5072
4992
  });
5073
4993
  const quantitiesDict = {};
5074
4994
  updatedQuantities.forEach(({ amount, assetId }) => {
5075
4995
  quantitiesDict[assetId] = {
5076
4996
  required: amount,
5077
- owned: (0, import_math18.bn)(0)
4997
+ owned: (0, import_math17.bn)(0)
5078
4998
  };
5079
4999
  });
5080
5000
  const cachedUtxos = [];
@@ -5087,12 +5007,12 @@ var Account = class extends import_interfaces.AbstractAccount {
5087
5007
  if (isCoin2) {
5088
5008
  const assetId = String(input.assetId);
5089
5009
  if (input.owner === owner && quantitiesDict[assetId]) {
5090
- const amount = (0, import_math18.bn)(input.amount);
5010
+ const amount = (0, import_math17.bn)(input.amount);
5091
5011
  quantitiesDict[assetId].owned = quantitiesDict[assetId].owned.add(amount);
5092
5012
  cachedUtxos.push(input.id);
5093
5013
  }
5094
- } else if (input.recipient === owner && input.amount && quantitiesDict[import_configs12.BaseAssetId]) {
5095
- quantitiesDict[import_configs12.BaseAssetId].owned = quantitiesDict[import_configs12.BaseAssetId].owned.add(input.amount);
5014
+ } else if (input.recipient === owner && input.amount && quantitiesDict[import_configs11.BaseAssetId]) {
5015
+ quantitiesDict[import_configs11.BaseAssetId].owned = quantitiesDict[import_configs11.BaseAssetId].owned.add(input.amount);
5096
5016
  cachedMessages.push(input.nonce);
5097
5017
  }
5098
5018
  }
@@ -5124,7 +5044,7 @@ var Account = class extends import_interfaces.AbstractAccount {
5124
5044
  * @param txParams - The transaction parameters (gasLimit, gasPrice, maturity).
5125
5045
  * @returns A promise that resolves to the prepared transaction request.
5126
5046
  */
5127
- async createTransfer(destination, amount, assetId = import_configs12.BaseAssetId, txParams = {}) {
5047
+ async createTransfer(destination, amount, assetId = import_configs11.BaseAssetId, txParams = {}) {
5128
5048
  const { minGasPrice } = this.provider.getGasConfig();
5129
5049
  const params = { gasPrice: minGasPrice, ...txParams };
5130
5050
  const request = new ScriptTransactionRequest(params);
@@ -5133,8 +5053,8 @@ var Account = class extends import_interfaces.AbstractAccount {
5133
5053
  estimateTxDependencies: true,
5134
5054
  resourcesOwner: this
5135
5055
  });
5136
- request.gasPrice = (0, import_math18.bn)(txParams.gasPrice ?? minGasPrice);
5137
- request.gasLimit = (0, import_math18.bn)(txParams.gasLimit ?? gasUsed);
5056
+ request.gasPrice = (0, import_math17.bn)(txParams.gasPrice ?? minGasPrice);
5057
+ request.gasLimit = (0, import_math17.bn)(txParams.gasLimit ?? gasUsed);
5138
5058
  this.validateGas({
5139
5059
  gasUsed,
5140
5060
  gasPrice: request.gasPrice,
@@ -5154,10 +5074,10 @@ var Account = class extends import_interfaces.AbstractAccount {
5154
5074
  * @param txParams - The transaction parameters (gasLimit, gasPrice, maturity).
5155
5075
  * @returns A promise that resolves to the transaction response.
5156
5076
  */
5157
- async transfer(destination, amount, assetId = import_configs12.BaseAssetId, txParams = {}) {
5158
- if ((0, import_math18.bn)(amount).lte(0)) {
5159
- throw new import_errors16.FuelError(
5160
- import_errors16.ErrorCode.INVALID_TRANSFER_AMOUNT,
5077
+ async transfer(destination, amount, assetId = import_configs11.BaseAssetId, txParams = {}) {
5078
+ if ((0, import_math17.bn)(amount).lte(0)) {
5079
+ throw new import_errors15.FuelError(
5080
+ import_errors15.ErrorCode.INVALID_TRANSFER_AMOUNT,
5161
5081
  "Transfer amount must be a positive number."
5162
5082
  );
5163
5083
  }
@@ -5173,10 +5093,10 @@ var Account = class extends import_interfaces.AbstractAccount {
5173
5093
  * @param txParams - The optional transaction parameters.
5174
5094
  * @returns A promise that resolves to the transaction response.
5175
5095
  */
5176
- async transferToContract(contractId, amount, assetId = import_configs12.BaseAssetId, txParams = {}) {
5177
- if ((0, import_math18.bn)(amount).lte(0)) {
5178
- throw new import_errors16.FuelError(
5179
- import_errors16.ErrorCode.INVALID_TRANSFER_AMOUNT,
5096
+ async transferToContract(contractId, amount, assetId = import_configs11.BaseAssetId, txParams = {}) {
5097
+ if ((0, import_math17.bn)(amount).lte(0)) {
5098
+ throw new import_errors15.FuelError(
5099
+ import_errors15.ErrorCode.INVALID_TRANSFER_AMOUNT,
5180
5100
  "Transfer amount must be a positive number."
5181
5101
  );
5182
5102
  }
@@ -5185,7 +5105,7 @@ var Account = class extends import_interfaces.AbstractAccount {
5185
5105
  const params = { gasPrice: minGasPrice, ...txParams };
5186
5106
  const { script, scriptData } = await assembleTransferToContractScript({
5187
5107
  hexlifiedContractId: contractAddress.toB256(),
5188
- amountToTransfer: (0, import_math18.bn)(amount),
5108
+ amountToTransfer: (0, import_math17.bn)(amount),
5189
5109
  assetId
5190
5110
  });
5191
5111
  const request = new ScriptTransactionRequest({
@@ -5196,9 +5116,9 @@ var Account = class extends import_interfaces.AbstractAccount {
5196
5116
  request.addContractInputAndOutput(contractAddress);
5197
5117
  const { maxFee, requiredQuantities, gasUsed } = await this.provider.getTransactionCost(
5198
5118
  request,
5199
- [{ amount: (0, import_math18.bn)(amount), assetId: String(assetId) }]
5119
+ [{ amount: (0, import_math17.bn)(amount), assetId: String(assetId) }]
5200
5120
  );
5201
- request.gasLimit = (0, import_math18.bn)(params.gasLimit ?? gasUsed);
5121
+ request.gasLimit = (0, import_math17.bn)(params.gasLimit ?? gasUsed);
5202
5122
  this.validateGas({
5203
5123
  gasUsed,
5204
5124
  gasPrice: request.gasPrice,
@@ -5219,25 +5139,25 @@ var Account = class extends import_interfaces.AbstractAccount {
5219
5139
  async withdrawToBaseLayer(recipient, amount, txParams = {}) {
5220
5140
  const { minGasPrice } = this.provider.getGasConfig();
5221
5141
  const recipientAddress = import_address4.Address.fromAddressOrString(recipient);
5222
- const recipientDataArray = (0, import_utils28.arrayify)(
5142
+ const recipientDataArray = (0, import_utils27.arrayify)(
5223
5143
  "0x".concat(recipientAddress.toHexString().substring(2).padStart(64, "0"))
5224
5144
  );
5225
- const amountDataArray = (0, import_utils28.arrayify)(
5226
- "0x".concat((0, import_math18.bn)(amount).toHex().substring(2).padStart(16, "0"))
5145
+ const amountDataArray = (0, import_utils27.arrayify)(
5146
+ "0x".concat((0, import_math17.bn)(amount).toHex().substring(2).padStart(16, "0"))
5227
5147
  );
5228
5148
  const script = new Uint8Array([
5229
- ...(0, import_utils28.arrayify)(withdrawScript.bytes),
5149
+ ...(0, import_utils27.arrayify)(withdrawScript.bytes),
5230
5150
  ...recipientDataArray,
5231
5151
  ...amountDataArray
5232
5152
  ]);
5233
5153
  const params = { script, gasPrice: minGasPrice, ...txParams };
5234
5154
  const request = new ScriptTransactionRequest(params);
5235
- const forwardingQuantities = [{ amount: (0, import_math18.bn)(amount), assetId: import_configs12.BaseAssetId }];
5155
+ const forwardingQuantities = [{ amount: (0, import_math17.bn)(amount), assetId: import_configs11.BaseAssetId }];
5236
5156
  const { requiredQuantities, maxFee, gasUsed } = await this.provider.getTransactionCost(
5237
5157
  request,
5238
5158
  forwardingQuantities
5239
5159
  );
5240
- request.gasLimit = (0, import_math18.bn)(params.gasLimit ?? gasUsed);
5160
+ request.gasLimit = (0, import_math17.bn)(params.gasLimit ?? gasUsed);
5241
5161
  this.validateGas({
5242
5162
  gasUsed,
5243
5163
  gasPrice: request.gasPrice,
@@ -5249,7 +5169,7 @@ var Account = class extends import_interfaces.AbstractAccount {
5249
5169
  }
5250
5170
  async signMessage(message) {
5251
5171
  if (!this._connector) {
5252
- throw new import_errors16.FuelError(import_errors16.ErrorCode.MISSING_CONNECTOR, "A connector is required to sign messages.");
5172
+ throw new import_errors15.FuelError(import_errors15.ErrorCode.MISSING_CONNECTOR, "A connector is required to sign messages.");
5253
5173
  }
5254
5174
  return this._connector.signMessage(this.address.toString(), message);
5255
5175
  }
@@ -5261,8 +5181,8 @@ var Account = class extends import_interfaces.AbstractAccount {
5261
5181
  */
5262
5182
  async signTransaction(transactionRequestLike) {
5263
5183
  if (!this._connector) {
5264
- throw new import_errors16.FuelError(
5265
- import_errors16.ErrorCode.MISSING_CONNECTOR,
5184
+ throw new import_errors15.FuelError(
5185
+ import_errors15.ErrorCode.MISSING_CONNECTOR,
5266
5186
  "A connector is required to sign transactions."
5267
5187
  );
5268
5188
  }
@@ -5309,14 +5229,14 @@ var Account = class extends import_interfaces.AbstractAccount {
5309
5229
  minGasPrice
5310
5230
  }) {
5311
5231
  if (minGasPrice.gt(gasPrice)) {
5312
- throw new import_errors16.FuelError(
5313
- import_errors16.ErrorCode.GAS_PRICE_TOO_LOW,
5232
+ throw new import_errors15.FuelError(
5233
+ import_errors15.ErrorCode.GAS_PRICE_TOO_LOW,
5314
5234
  `Gas price '${gasPrice}' is lower than the required: '${minGasPrice}'.`
5315
5235
  );
5316
5236
  }
5317
5237
  if (gasUsed.gt(gasLimit)) {
5318
- throw new import_errors16.FuelError(
5319
- import_errors16.ErrorCode.GAS_LIMIT_TOO_LOW,
5238
+ throw new import_errors15.FuelError(
5239
+ import_errors15.ErrorCode.GAS_LIMIT_TOO_LOW,
5320
5240
  `Gas limit '${gasLimit}' is lower than the required: '${gasUsed}'.`
5321
5241
  );
5322
5242
  }
@@ -5325,14 +5245,14 @@ var Account = class extends import_interfaces.AbstractAccount {
5325
5245
 
5326
5246
  // src/wallet/base-wallet-unlocked.ts
5327
5247
  var import_hasher3 = require("@fuel-ts/hasher");
5328
- var import_utils31 = require("@fuel-ts/utils");
5248
+ var import_utils30 = require("@fuel-ts/utils");
5329
5249
 
5330
5250
  // src/signer/signer.ts
5331
5251
  var import_address5 = require("@fuel-ts/address");
5332
5252
  var import_crypto = require("@fuel-ts/crypto");
5333
5253
  var import_hasher2 = require("@fuel-ts/hasher");
5334
- var import_math19 = require("@fuel-ts/math");
5335
- var import_utils29 = require("@fuel-ts/utils");
5254
+ var import_math18 = require("@fuel-ts/math");
5255
+ var import_utils28 = require("@fuel-ts/utils");
5336
5256
  var import_secp256k1 = require("@noble/curves/secp256k1");
5337
5257
  var Signer = class {
5338
5258
  address;
@@ -5351,10 +5271,10 @@ var Signer = class {
5351
5271
  privateKey = `0x${privateKey}`;
5352
5272
  }
5353
5273
  }
5354
- const privateKeyBytes = (0, import_math19.toBytes)(privateKey, 32);
5355
- this.privateKey = (0, import_utils29.hexlify)(privateKeyBytes);
5356
- this.publicKey = (0, import_utils29.hexlify)(import_secp256k1.secp256k1.getPublicKey(privateKeyBytes, false).slice(1));
5357
- this.compressedPublicKey = (0, import_utils29.hexlify)(import_secp256k1.secp256k1.getPublicKey(privateKeyBytes, true));
5274
+ const privateKeyBytes = (0, import_math18.toBytes)(privateKey, 32);
5275
+ this.privateKey = (0, import_utils28.hexlify)(privateKeyBytes);
5276
+ this.publicKey = (0, import_utils28.hexlify)(import_secp256k1.secp256k1.getPublicKey(privateKeyBytes, false).slice(1));
5277
+ this.compressedPublicKey = (0, import_utils28.hexlify)(import_secp256k1.secp256k1.getPublicKey(privateKeyBytes, true));
5358
5278
  this.address = import_address5.Address.fromPublicKey(this.publicKey);
5359
5279
  }
5360
5280
  /**
@@ -5368,11 +5288,11 @@ var Signer = class {
5368
5288
  * @returns hashed signature
5369
5289
  */
5370
5290
  sign(data) {
5371
- const signature = import_secp256k1.secp256k1.sign((0, import_utils29.arrayify)(data), (0, import_utils29.arrayify)(this.privateKey));
5372
- const r = (0, import_math19.toBytes)(`0x${signature.r.toString(16)}`, 32);
5373
- const s = (0, import_math19.toBytes)(`0x${signature.s.toString(16)}`, 32);
5291
+ const signature = import_secp256k1.secp256k1.sign((0, import_utils28.arrayify)(data), (0, import_utils28.arrayify)(this.privateKey));
5292
+ const r = (0, import_math18.toBytes)(`0x${signature.r.toString(16)}`, 32);
5293
+ const s = (0, import_math18.toBytes)(`0x${signature.s.toString(16)}`, 32);
5374
5294
  s[0] |= (signature.recovery || 0) << 7;
5375
- return (0, import_utils29.hexlify)((0, import_utils29.concat)([r, s]));
5295
+ return (0, import_utils28.hexlify)((0, import_utils28.concat)([r, s]));
5376
5296
  }
5377
5297
  /**
5378
5298
  * Add point on the current elliptic curve
@@ -5381,8 +5301,8 @@ var Signer = class {
5381
5301
  * @returns compressed point on the curve
5382
5302
  */
5383
5303
  addPoint(point) {
5384
- const p0 = import_secp256k1.secp256k1.ProjectivePoint.fromHex((0, import_utils29.arrayify)(this.compressedPublicKey));
5385
- const p1 = import_secp256k1.secp256k1.ProjectivePoint.fromHex((0, import_utils29.arrayify)(point));
5304
+ const p0 = import_secp256k1.secp256k1.ProjectivePoint.fromHex((0, import_utils28.arrayify)(this.compressedPublicKey));
5305
+ const p1 = import_secp256k1.secp256k1.ProjectivePoint.fromHex((0, import_utils28.arrayify)(point));
5386
5306
  const result = p0.add(p1);
5387
5307
  return `0x${result.toHex(true)}`;
5388
5308
  }
@@ -5394,16 +5314,16 @@ var Signer = class {
5394
5314
  * @returns public key from signature from the
5395
5315
  */
5396
5316
  static recoverPublicKey(data, signature) {
5397
- const signedMessageBytes = (0, import_utils29.arrayify)(signature);
5317
+ const signedMessageBytes = (0, import_utils28.arrayify)(signature);
5398
5318
  const r = signedMessageBytes.slice(0, 32);
5399
5319
  const s = signedMessageBytes.slice(32, 64);
5400
5320
  const recoveryParam = (s[0] & 128) >> 7;
5401
5321
  s[0] &= 127;
5402
- const sig = new import_secp256k1.secp256k1.Signature(BigInt((0, import_utils29.hexlify)(r)), BigInt((0, import_utils29.hexlify)(s))).addRecoveryBit(
5322
+ const sig = new import_secp256k1.secp256k1.Signature(BigInt((0, import_utils28.hexlify)(r)), BigInt((0, import_utils28.hexlify)(s))).addRecoveryBit(
5403
5323
  recoveryParam
5404
5324
  );
5405
- const publicKey = sig.recoverPublicKey((0, import_utils29.arrayify)(data)).toRawBytes(false).slice(1);
5406
- return (0, import_utils29.hexlify)(publicKey);
5325
+ const publicKey = sig.recoverPublicKey((0, import_utils28.arrayify)(data)).toRawBytes(false).slice(1);
5326
+ return (0, import_utils28.hexlify)(publicKey);
5407
5327
  }
5408
5328
  /**
5409
5329
  * Recover the address from a signature performed with [`sign`](#sign).
@@ -5422,7 +5342,7 @@ var Signer = class {
5422
5342
  * @returns random 32-byte hashed
5423
5343
  */
5424
5344
  static generatePrivateKey(entropy) {
5425
- return entropy ? (0, import_hasher2.hash)((0, import_utils29.concat)([(0, import_crypto.randomBytes)(32), (0, import_utils29.arrayify)(entropy)])) : (0, import_crypto.randomBytes)(32);
5345
+ return entropy ? (0, import_hasher2.hash)((0, import_utils28.concat)([(0, import_crypto.randomBytes)(32), (0, import_utils28.arrayify)(entropy)])) : (0, import_crypto.randomBytes)(32);
5426
5346
  }
5427
5347
  /**
5428
5348
  * Extended publicKey from a compact publicKey
@@ -5431,16 +5351,16 @@ var Signer = class {
5431
5351
  * @returns extended publicKey
5432
5352
  */
5433
5353
  static extendPublicKey(publicKey) {
5434
- const point = import_secp256k1.secp256k1.ProjectivePoint.fromHex((0, import_utils29.arrayify)(publicKey));
5435
- return (0, import_utils29.hexlify)(point.toRawBytes(false).slice(1));
5354
+ const point = import_secp256k1.secp256k1.ProjectivePoint.fromHex((0, import_utils28.arrayify)(publicKey));
5355
+ return (0, import_utils28.hexlify)(point.toRawBytes(false).slice(1));
5436
5356
  }
5437
5357
  };
5438
5358
 
5439
5359
  // src/wallet/keystore-wallet.ts
5440
5360
  var import_address6 = require("@fuel-ts/address");
5441
5361
  var import_crypto2 = require("@fuel-ts/crypto");
5442
- var import_errors17 = require("@fuel-ts/errors");
5443
- var import_utils30 = require("@fuel-ts/utils");
5362
+ var import_errors16 = require("@fuel-ts/errors");
5363
+ var import_utils29 = require("@fuel-ts/utils");
5444
5364
  var import_uuid = require("uuid");
5445
5365
  var DEFAULT_KDF_PARAMS_LOG_N = 13;
5446
5366
  var DEFAULT_KDF_PARAMS_R = 8;
@@ -5517,13 +5437,13 @@ async function decryptKeystoreWallet(jsonWallet, password) {
5517
5437
  const macHashUint8Array = (0, import_crypto2.keccak256)(data);
5518
5438
  const macHash = (0, import_crypto2.stringFromBuffer)(macHashUint8Array, "hex");
5519
5439
  if (mac !== macHash) {
5520
- throw new import_errors17.FuelError(
5521
- import_errors17.ErrorCode.INVALID_PASSWORD,
5440
+ throw new import_errors16.FuelError(
5441
+ import_errors16.ErrorCode.INVALID_PASSWORD,
5522
5442
  "Failed to decrypt the keystore wallet, the provided password is incorrect."
5523
5443
  );
5524
5444
  }
5525
5445
  const buffer = await (0, import_crypto2.decryptJsonWalletData)(ciphertextBuffer, key, ivBuffer);
5526
- const privateKey = (0, import_utils30.hexlify)(buffer);
5446
+ const privateKey = (0, import_utils29.hexlify)(buffer);
5527
5447
  return privateKey;
5528
5448
  }
5529
5449
 
@@ -5568,7 +5488,7 @@ var BaseWalletUnlocked = class extends Account {
5568
5488
  */
5569
5489
  async signMessage(message) {
5570
5490
  const signedMessage = await this.signer().sign((0, import_hasher3.hashMessage)(message));
5571
- return (0, import_utils31.hexlify)(signedMessage);
5491
+ return (0, import_utils30.hexlify)(signedMessage);
5572
5492
  }
5573
5493
  /**
5574
5494
  * Signs a transaction with the wallet's private key.
@@ -5581,7 +5501,7 @@ var BaseWalletUnlocked = class extends Account {
5581
5501
  const chainId = this.provider.getChainId();
5582
5502
  const hashedTransaction = transactionRequest.getTransactionId(chainId);
5583
5503
  const signature = await this.signer().sign(hashedTransaction);
5584
- return (0, import_utils31.hexlify)(signature);
5504
+ return (0, import_utils30.hexlify)(signature);
5585
5505
  }
5586
5506
  /**
5587
5507
  * Populates a transaction with the witnesses signature.
@@ -5640,17 +5560,17 @@ var BaseWalletUnlocked = class extends Account {
5640
5560
  __publicField(BaseWalletUnlocked, "defaultPath", "m/44'/1179993420'/0'/0/0");
5641
5561
 
5642
5562
  // src/hdwallet/hdwallet.ts
5643
- var import_errors20 = require("@fuel-ts/errors");
5563
+ var import_errors19 = require("@fuel-ts/errors");
5644
5564
  var import_hasher6 = require("@fuel-ts/hasher");
5645
- var import_math20 = require("@fuel-ts/math");
5646
- var import_utils35 = require("@fuel-ts/utils");
5565
+ var import_math19 = require("@fuel-ts/math");
5566
+ var import_utils34 = require("@fuel-ts/utils");
5647
5567
  var import_ethers3 = require("ethers");
5648
5568
 
5649
5569
  // src/mnemonic/mnemonic.ts
5650
5570
  var import_crypto3 = require("@fuel-ts/crypto");
5651
- var import_errors19 = require("@fuel-ts/errors");
5571
+ var import_errors18 = require("@fuel-ts/errors");
5652
5572
  var import_hasher5 = require("@fuel-ts/hasher");
5653
- var import_utils33 = require("@fuel-ts/utils");
5573
+ var import_utils32 = require("@fuel-ts/utils");
5654
5574
  var import_ethers2 = require("ethers");
5655
5575
 
5656
5576
  // src/wordlists/words/english.ts
@@ -7712,9 +7632,9 @@ var Language = /* @__PURE__ */ ((Language2) => {
7712
7632
  })(Language || {});
7713
7633
 
7714
7634
  // src/mnemonic/utils.ts
7715
- var import_errors18 = require("@fuel-ts/errors");
7635
+ var import_errors17 = require("@fuel-ts/errors");
7716
7636
  var import_hasher4 = require("@fuel-ts/hasher");
7717
- var import_utils32 = require("@fuel-ts/utils");
7637
+ var import_utils31 = require("@fuel-ts/utils");
7718
7638
  function toUtf8Bytes(stri) {
7719
7639
  const str = stri.normalize("NFKD");
7720
7640
  const result = [];
@@ -7729,8 +7649,8 @@ function toUtf8Bytes(stri) {
7729
7649
  i += 1;
7730
7650
  const c2 = str.charCodeAt(i);
7731
7651
  if (i >= str.length || (c2 & 64512) !== 56320) {
7732
- throw new import_errors18.FuelError(
7733
- import_errors18.ErrorCode.INVALID_INPUT_PARAMETERS,
7652
+ throw new import_errors17.FuelError(
7653
+ import_errors17.ErrorCode.INVALID_INPUT_PARAMETERS,
7734
7654
  "Invalid UTF-8 in the input string."
7735
7655
  );
7736
7656
  }
@@ -7781,20 +7701,20 @@ function entropyToMnemonicIndices(entropy) {
7781
7701
  }
7782
7702
  }
7783
7703
  const checksumBits = entropy.length / 4;
7784
- const checksum = (0, import_utils32.arrayify)((0, import_hasher4.sha256)(entropy))[0] & getUpperMask(checksumBits);
7704
+ const checksum = (0, import_utils31.arrayify)((0, import_hasher4.sha256)(entropy))[0] & getUpperMask(checksumBits);
7785
7705
  indices[indices.length - 1] <<= checksumBits;
7786
7706
  indices[indices.length - 1] |= checksum >> 8 - checksumBits;
7787
7707
  return indices;
7788
7708
  }
7789
7709
  function mnemonicWordsToEntropy(words, wordlist) {
7790
7710
  const size = Math.ceil(11 * words.length / 8);
7791
- const entropy = (0, import_utils32.arrayify)(new Uint8Array(size));
7711
+ const entropy = (0, import_utils31.arrayify)(new Uint8Array(size));
7792
7712
  let offset = 0;
7793
7713
  for (let i = 0; i < words.length; i += 1) {
7794
7714
  const index = wordlist.indexOf(words[i].normalize("NFKD"));
7795
7715
  if (index === -1) {
7796
- throw new import_errors18.FuelError(
7797
- import_errors18.ErrorCode.INVALID_MNEMONIC,
7716
+ throw new import_errors17.FuelError(
7717
+ import_errors17.ErrorCode.INVALID_MNEMONIC,
7798
7718
  `Invalid mnemonic: the word '${words[i]}' is not found in the provided wordlist.`
7799
7719
  );
7800
7720
  }
@@ -7808,10 +7728,10 @@ function mnemonicWordsToEntropy(words, wordlist) {
7808
7728
  const entropyBits = 32 * words.length / 3;
7809
7729
  const checksumBits = words.length / 3;
7810
7730
  const checksumMask = getUpperMask(checksumBits);
7811
- const checksum = (0, import_utils32.arrayify)((0, import_hasher4.sha256)(entropy.slice(0, entropyBits / 8)))[0] & checksumMask;
7731
+ const checksum = (0, import_utils31.arrayify)((0, import_hasher4.sha256)(entropy.slice(0, entropyBits / 8)))[0] & checksumMask;
7812
7732
  if (checksum !== (entropy[entropy.length - 1] & checksumMask)) {
7813
- throw new import_errors18.FuelError(
7814
- import_errors18.ErrorCode.INVALID_CHECKSUM,
7733
+ throw new import_errors17.FuelError(
7734
+ import_errors17.ErrorCode.INVALID_CHECKSUM,
7815
7735
  "Checksum validation failed for the provided mnemonic."
7816
7736
  );
7817
7737
  }
@@ -7825,16 +7745,16 @@ var TestnetPRV = "0x04358394";
7825
7745
  var MNEMONIC_SIZES = [12, 15, 18, 21, 24];
7826
7746
  function assertWordList(wordlist) {
7827
7747
  if (wordlist.length !== 2048) {
7828
- throw new import_errors19.FuelError(
7829
- import_errors19.ErrorCode.INVALID_WORD_LIST,
7748
+ throw new import_errors18.FuelError(
7749
+ import_errors18.ErrorCode.INVALID_WORD_LIST,
7830
7750
  `Expected word list length of 2048, but got ${wordlist.length}.`
7831
7751
  );
7832
7752
  }
7833
7753
  }
7834
7754
  function assertEntropy(entropy) {
7835
7755
  if (entropy.length % 4 !== 0 || entropy.length < 16 || entropy.length > 32) {
7836
- throw new import_errors19.FuelError(
7837
- import_errors19.ErrorCode.INVALID_ENTROPY,
7756
+ throw new import_errors18.FuelError(
7757
+ import_errors18.ErrorCode.INVALID_ENTROPY,
7838
7758
  `Entropy should be between 16 and 32 bytes and a multiple of 4, but got ${entropy.length} bytes.`
7839
7759
  );
7840
7760
  }
@@ -7844,7 +7764,7 @@ function assertMnemonic(words) {
7844
7764
  const errorMsg = `Invalid mnemonic size. Expected one of [${MNEMONIC_SIZES.join(
7845
7765
  ", "
7846
7766
  )}] words, but got ${words.length}.`;
7847
- throw new import_errors19.FuelError(import_errors19.ErrorCode.INVALID_MNEMONIC, errorMsg);
7767
+ throw new import_errors18.FuelError(import_errors18.ErrorCode.INVALID_MNEMONIC, errorMsg);
7848
7768
  }
7849
7769
  }
7850
7770
  var Mnemonic = class {
@@ -7883,7 +7803,7 @@ var Mnemonic = class {
7883
7803
  static mnemonicToEntropy(phrase, wordlist = english) {
7884
7804
  const words = getWords(phrase);
7885
7805
  assertMnemonic(words);
7886
- return (0, import_utils33.hexlify)(mnemonicWordsToEntropy(words, wordlist));
7806
+ return (0, import_utils32.hexlify)(mnemonicWordsToEntropy(words, wordlist));
7887
7807
  }
7888
7808
  /**
7889
7809
  * @param entropy - Entropy source to the mnemonic phrase.
@@ -7891,7 +7811,7 @@ var Mnemonic = class {
7891
7811
  * @returns 64-byte array contains privateKey and chainCode as described on BIP39
7892
7812
  */
7893
7813
  static entropyToMnemonic(entropy, wordlist = english) {
7894
- const entropyBytes = (0, import_utils33.arrayify)(entropy);
7814
+ const entropyBytes = (0, import_utils32.arrayify)(entropy);
7895
7815
  assertWordList(wordlist);
7896
7816
  assertEntropy(entropyBytes);
7897
7817
  return entropyToMnemonicIndices(entropyBytes).map((i) => wordlist[i]).join(" ");
@@ -7960,14 +7880,14 @@ var Mnemonic = class {
7960
7880
  * @returns 64-byte array contains privateKey and chainCode as described on BIP39
7961
7881
  */
7962
7882
  static masterKeysFromSeed(seed) {
7963
- const seedArray = (0, import_utils33.arrayify)(seed);
7883
+ const seedArray = (0, import_utils32.arrayify)(seed);
7964
7884
  if (seedArray.length < 16 || seedArray.length > 64) {
7965
- throw new import_errors19.FuelError(
7966
- import_errors19.ErrorCode.INVALID_SEED,
7885
+ throw new import_errors18.FuelError(
7886
+ import_errors18.ErrorCode.INVALID_SEED,
7967
7887
  `Seed length should be between 16 and 64 bytes, but received ${seedArray.length} bytes.`
7968
7888
  );
7969
7889
  }
7970
- return (0, import_utils33.arrayify)((0, import_ethers2.computeHmac)("sha512", MasterSecret, seedArray));
7890
+ return (0, import_utils32.arrayify)((0, import_ethers2.computeHmac)("sha512", MasterSecret, seedArray));
7971
7891
  }
7972
7892
  /**
7973
7893
  * Get the extendKey as defined on BIP-32 from the provided seed
@@ -7978,22 +7898,22 @@ var Mnemonic = class {
7978
7898
  */
7979
7899
  static seedToExtendedKey(seed, testnet = false) {
7980
7900
  const masterKey = Mnemonic.masterKeysFromSeed(seed);
7981
- const prefix = (0, import_utils33.arrayify)(testnet ? TestnetPRV : MainnetPRV);
7901
+ const prefix = (0, import_utils32.arrayify)(testnet ? TestnetPRV : MainnetPRV);
7982
7902
  const depth = "0x00";
7983
7903
  const fingerprint = "0x00000000";
7984
7904
  const index = "0x00000000";
7985
7905
  const chainCode = masterKey.slice(32);
7986
7906
  const privateKey = masterKey.slice(0, 32);
7987
- const extendedKey = (0, import_utils33.concat)([
7907
+ const extendedKey = (0, import_utils32.concat)([
7988
7908
  prefix,
7989
7909
  depth,
7990
7910
  fingerprint,
7991
7911
  index,
7992
7912
  chainCode,
7993
- (0, import_utils33.concat)(["0x00", privateKey])
7913
+ (0, import_utils32.concat)(["0x00", privateKey])
7994
7914
  ]);
7995
7915
  const checksum = (0, import_ethers2.dataSlice)((0, import_hasher5.sha256)((0, import_hasher5.sha256)(extendedKey)), 0, 4);
7996
- return (0, import_ethers2.encodeBase58)((0, import_utils33.concat)([extendedKey, checksum]));
7916
+ return (0, import_ethers2.encodeBase58)((0, import_utils32.concat)([extendedKey, checksum]));
7997
7917
  }
7998
7918
  /**
7999
7919
  * Create a new mnemonic using a randomly generated number as entropy.
@@ -8008,7 +7928,7 @@ var Mnemonic = class {
8008
7928
  * @returns A randomly generated mnemonic
8009
7929
  */
8010
7930
  static generate(size = 32, extraEntropy = "") {
8011
- const entropy = extraEntropy ? (0, import_hasher5.sha256)((0, import_utils33.concat)([(0, import_crypto3.randomBytes)(size), (0, import_utils33.arrayify)(extraEntropy)])) : (0, import_crypto3.randomBytes)(size);
7931
+ const entropy = extraEntropy ? (0, import_hasher5.sha256)((0, import_utils32.concat)([(0, import_crypto3.randomBytes)(size), (0, import_utils32.arrayify)(extraEntropy)])) : (0, import_crypto3.randomBytes)(size);
8012
7932
  return Mnemonic.entropyToMnemonic(entropy);
8013
7933
  }
8014
7934
  };
@@ -8016,12 +7936,12 @@ var mnemonic_default = Mnemonic;
8016
7936
 
8017
7937
  // src/hdwallet/hdwallet.ts
8018
7938
  var HARDENED_INDEX = 2147483648;
8019
- var MainnetPRV2 = (0, import_utils35.hexlify)("0x0488ade4");
8020
- var MainnetPUB = (0, import_utils35.hexlify)("0x0488b21e");
8021
- var TestnetPRV2 = (0, import_utils35.hexlify)("0x04358394");
8022
- var TestnetPUB = (0, import_utils35.hexlify)("0x043587cf");
7939
+ var MainnetPRV2 = (0, import_utils34.hexlify)("0x0488ade4");
7940
+ var MainnetPUB = (0, import_utils34.hexlify)("0x0488b21e");
7941
+ var TestnetPRV2 = (0, import_utils34.hexlify)("0x04358394");
7942
+ var TestnetPUB = (0, import_utils34.hexlify)("0x043587cf");
8023
7943
  function base58check(data) {
8024
- return (0, import_ethers3.encodeBase58)((0, import_utils35.concat)([data, (0, import_ethers3.dataSlice)((0, import_hasher6.sha256)((0, import_hasher6.sha256)(data)), 0, 4)]));
7944
+ return (0, import_ethers3.encodeBase58)((0, import_utils34.concat)([data, (0, import_ethers3.dataSlice)((0, import_hasher6.sha256)((0, import_hasher6.sha256)(data)), 0, 4)]));
8025
7945
  }
8026
7946
  function getExtendedKeyPrefix(isPublic = false, testnet = false) {
8027
7947
  if (isPublic) {
@@ -8030,17 +7950,17 @@ function getExtendedKeyPrefix(isPublic = false, testnet = false) {
8030
7950
  return testnet ? TestnetPRV2 : MainnetPRV2;
8031
7951
  }
8032
7952
  function isPublicExtendedKey(extendedKey) {
8033
- return [MainnetPUB, TestnetPUB].includes((0, import_utils35.hexlify)(extendedKey.slice(0, 4)));
7953
+ return [MainnetPUB, TestnetPUB].includes((0, import_utils34.hexlify)(extendedKey.slice(0, 4)));
8034
7954
  }
8035
7955
  function isValidExtendedKey(extendedKey) {
8036
7956
  return [MainnetPRV2, TestnetPRV2, MainnetPUB, TestnetPUB].includes(
8037
- (0, import_utils35.hexlify)(extendedKey.slice(0, 4))
7957
+ (0, import_utils34.hexlify)(extendedKey.slice(0, 4))
8038
7958
  );
8039
7959
  }
8040
7960
  function parsePath(path, depth = 0) {
8041
7961
  const components = path.split("/");
8042
7962
  if (components.length === 0 || components[0] === "m" && depth !== 0) {
8043
- throw new import_errors20.FuelError(import_errors20.ErrorCode.HD_WALLET_ERROR, `invalid path - ${path}`);
7963
+ throw new import_errors19.FuelError(import_errors19.ErrorCode.HD_WALLET_ERROR, `invalid path - ${path}`);
8044
7964
  }
8045
7965
  if (components[0] === "m") {
8046
7966
  components.shift();
@@ -8052,8 +7972,8 @@ function parsePath(path, depth = 0) {
8052
7972
  var HDWallet = class {
8053
7973
  depth = 0;
8054
7974
  index = 0;
8055
- fingerprint = (0, import_utils35.hexlify)("0x00000000");
8056
- parentFingerprint = (0, import_utils35.hexlify)("0x00000000");
7975
+ fingerprint = (0, import_utils34.hexlify)("0x00000000");
7976
+ parentFingerprint = (0, import_utils34.hexlify)("0x00000000");
8057
7977
  privateKey;
8058
7978
  publicKey;
8059
7979
  chainCode;
@@ -8065,16 +7985,16 @@ var HDWallet = class {
8065
7985
  constructor(config) {
8066
7986
  if (config.privateKey) {
8067
7987
  const signer = new Signer(config.privateKey);
8068
- this.publicKey = (0, import_utils35.hexlify)(signer.compressedPublicKey);
8069
- this.privateKey = (0, import_utils35.hexlify)(config.privateKey);
7988
+ this.publicKey = (0, import_utils34.hexlify)(signer.compressedPublicKey);
7989
+ this.privateKey = (0, import_utils34.hexlify)(config.privateKey);
8070
7990
  } else {
8071
7991
  if (!config.publicKey) {
8072
- throw new import_errors20.FuelError(
8073
- import_errors20.ErrorCode.HD_WALLET_ERROR,
7992
+ throw new import_errors19.FuelError(
7993
+ import_errors19.ErrorCode.HD_WALLET_ERROR,
8074
7994
  "Both public and private Key cannot be missing. At least one should be provided."
8075
7995
  );
8076
7996
  }
8077
- this.publicKey = (0, import_utils35.hexlify)(config.publicKey);
7997
+ this.publicKey = (0, import_utils34.hexlify)(config.publicKey);
8078
7998
  }
8079
7999
  this.parentFingerprint = config.parentFingerprint || this.parentFingerprint;
8080
8000
  this.fingerprint = (0, import_ethers3.dataSlice)((0, import_ethers3.ripemd160)((0, import_hasher6.sha256)(this.publicKey)), 0, 4);
@@ -8093,28 +8013,28 @@ var HDWallet = class {
8093
8013
  * @returns A new instance of HDWallet on the derived index
8094
8014
  */
8095
8015
  deriveIndex(index) {
8096
- const privateKey = this.privateKey && (0, import_utils35.arrayify)(this.privateKey);
8097
- const publicKey = (0, import_utils35.arrayify)(this.publicKey);
8098
- const chainCode = (0, import_utils35.arrayify)(this.chainCode);
8016
+ const privateKey = this.privateKey && (0, import_utils34.arrayify)(this.privateKey);
8017
+ const publicKey = (0, import_utils34.arrayify)(this.publicKey);
8018
+ const chainCode = (0, import_utils34.arrayify)(this.chainCode);
8099
8019
  const data = new Uint8Array(37);
8100
8020
  if (index & HARDENED_INDEX) {
8101
8021
  if (!privateKey) {
8102
- throw new import_errors20.FuelError(
8103
- import_errors20.ErrorCode.HD_WALLET_ERROR,
8022
+ throw new import_errors19.FuelError(
8023
+ import_errors19.ErrorCode.HD_WALLET_ERROR,
8104
8024
  "Cannot derive a hardened index without a private Key."
8105
8025
  );
8106
8026
  }
8107
8027
  data.set(privateKey, 1);
8108
8028
  } else {
8109
- data.set((0, import_utils35.arrayify)(this.publicKey));
8029
+ data.set((0, import_utils34.arrayify)(this.publicKey));
8110
8030
  }
8111
- data.set((0, import_math20.toBytes)(index, 4), 33);
8112
- const bytes = (0, import_utils35.arrayify)((0, import_ethers3.computeHmac)("sha512", chainCode, data));
8031
+ data.set((0, import_math19.toBytes)(index, 4), 33);
8032
+ const bytes = (0, import_utils34.arrayify)((0, import_ethers3.computeHmac)("sha512", chainCode, data));
8113
8033
  const IL = bytes.slice(0, 32);
8114
8034
  const IR = bytes.slice(32);
8115
8035
  if (privateKey) {
8116
8036
  const N = "0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141";
8117
- const ki = (0, import_math20.bn)(IL).add(privateKey).mod(N).toBytes(32);
8037
+ const ki = (0, import_math19.bn)(IL).add(privateKey).mod(N).toBytes(32);
8118
8038
  return new HDWallet({
8119
8039
  privateKey: ki,
8120
8040
  chainCode: IR,
@@ -8123,7 +8043,7 @@ var HDWallet = class {
8123
8043
  parentFingerprint: this.fingerprint
8124
8044
  });
8125
8045
  }
8126
- const signer = new Signer((0, import_utils35.hexlify)(IL));
8046
+ const signer = new Signer((0, import_utils34.hexlify)(IL));
8127
8047
  const Ki = signer.addPoint(publicKey);
8128
8048
  return new HDWallet({
8129
8049
  publicKey: Ki,
@@ -8152,18 +8072,18 @@ var HDWallet = class {
8152
8072
  */
8153
8073
  toExtendedKey(isPublic = false, testnet = false) {
8154
8074
  if (this.depth >= 256) {
8155
- throw new import_errors20.FuelError(
8156
- import_errors20.ErrorCode.HD_WALLET_ERROR,
8075
+ throw new import_errors19.FuelError(
8076
+ import_errors19.ErrorCode.HD_WALLET_ERROR,
8157
8077
  `Exceeded max depth of 255. Current depth: ${this.depth}.`
8158
8078
  );
8159
8079
  }
8160
8080
  const prefix = getExtendedKeyPrefix(this.privateKey == null || isPublic, testnet);
8161
- const depth = (0, import_utils35.hexlify)(Uint8Array.from([this.depth]));
8081
+ const depth = (0, import_utils34.hexlify)(Uint8Array.from([this.depth]));
8162
8082
  const parentFingerprint = this.parentFingerprint;
8163
- const index = (0, import_math20.toHex)(this.index, 4);
8083
+ const index = (0, import_math19.toHex)(this.index, 4);
8164
8084
  const chainCode = this.chainCode;
8165
- const key = this.privateKey != null && !isPublic ? (0, import_utils35.concat)(["0x00", this.privateKey]) : this.publicKey;
8166
- const extendedKey = (0, import_utils35.arrayify)((0, import_utils35.concat)([prefix, depth, parentFingerprint, index, chainCode, key]));
8085
+ const key = this.privateKey != null && !isPublic ? (0, import_utils34.concat)(["0x00", this.privateKey]) : this.publicKey;
8086
+ const extendedKey = (0, import_utils34.arrayify)((0, import_utils34.concat)([prefix, depth, parentFingerprint, index, chainCode, key]));
8167
8087
  return base58check(extendedKey);
8168
8088
  }
8169
8089
  /**
@@ -8175,34 +8095,34 @@ var HDWallet = class {
8175
8095
  static fromSeed(seed) {
8176
8096
  const masterKey = mnemonic_default.masterKeysFromSeed(seed);
8177
8097
  return new HDWallet({
8178
- chainCode: (0, import_utils35.arrayify)(masterKey.slice(32)),
8179
- privateKey: (0, import_utils35.arrayify)(masterKey.slice(0, 32))
8098
+ chainCode: (0, import_utils34.arrayify)(masterKey.slice(32)),
8099
+ privateKey: (0, import_utils34.arrayify)(masterKey.slice(0, 32))
8180
8100
  });
8181
8101
  }
8182
8102
  static fromExtendedKey(extendedKey) {
8183
8103
  const decoded = (0, import_ethers3.toBeHex)((0, import_ethers3.decodeBase58)(extendedKey));
8184
- const bytes = (0, import_utils35.arrayify)(decoded);
8104
+ const bytes = (0, import_utils34.arrayify)(decoded);
8185
8105
  const validChecksum = base58check(bytes.slice(0, 78)) === extendedKey;
8186
8106
  if (bytes.length !== 82 || !isValidExtendedKey(bytes)) {
8187
- throw new import_errors20.FuelError(import_errors20.ErrorCode.HD_WALLET_ERROR, "Provided key is not a valid extended key.");
8107
+ throw new import_errors19.FuelError(import_errors19.ErrorCode.HD_WALLET_ERROR, "Provided key is not a valid extended key.");
8188
8108
  }
8189
8109
  if (!validChecksum) {
8190
- throw new import_errors20.FuelError(import_errors20.ErrorCode.HD_WALLET_ERROR, "Provided key has an invalid checksum.");
8110
+ throw new import_errors19.FuelError(import_errors19.ErrorCode.HD_WALLET_ERROR, "Provided key has an invalid checksum.");
8191
8111
  }
8192
8112
  const depth = bytes[4];
8193
- const parentFingerprint = (0, import_utils35.hexlify)(bytes.slice(5, 9));
8194
- const index = parseInt((0, import_utils35.hexlify)(bytes.slice(9, 13)).substring(2), 16);
8195
- const chainCode = (0, import_utils35.hexlify)(bytes.slice(13, 45));
8113
+ const parentFingerprint = (0, import_utils34.hexlify)(bytes.slice(5, 9));
8114
+ const index = parseInt((0, import_utils34.hexlify)(bytes.slice(9, 13)).substring(2), 16);
8115
+ const chainCode = (0, import_utils34.hexlify)(bytes.slice(13, 45));
8196
8116
  const key = bytes.slice(45, 78);
8197
8117
  if (depth === 0 && parentFingerprint !== "0x00000000" || depth === 0 && index !== 0) {
8198
- throw new import_errors20.FuelError(
8199
- import_errors20.ErrorCode.HD_WALLET_ERROR,
8118
+ throw new import_errors19.FuelError(
8119
+ import_errors19.ErrorCode.HD_WALLET_ERROR,
8200
8120
  "Inconsistency detected: Depth is zero but fingerprint/index is non-zero."
8201
8121
  );
8202
8122
  }
8203
8123
  if (isPublicExtendedKey(bytes)) {
8204
8124
  if (key[0] !== 3) {
8205
- throw new import_errors20.FuelError(import_errors20.ErrorCode.HD_WALLET_ERROR, "Invalid public extended key.");
8125
+ throw new import_errors19.FuelError(import_errors19.ErrorCode.HD_WALLET_ERROR, "Invalid public extended key.");
8206
8126
  }
8207
8127
  return new HDWallet({
8208
8128
  publicKey: key,
@@ -8213,7 +8133,7 @@ var HDWallet = class {
8213
8133
  });
8214
8134
  }
8215
8135
  if (key[0] !== 0) {
8216
- throw new import_errors20.FuelError(import_errors20.ErrorCode.HD_WALLET_ERROR, "Invalid private extended key.");
8136
+ throw new import_errors19.FuelError(import_errors19.ErrorCode.HD_WALLET_ERROR, "Invalid private extended key.");
8217
8137
  }
8218
8138
  return new HDWallet({
8219
8139
  privateKey: key.slice(1),
@@ -8381,7 +8301,7 @@ __publicField(Wallet, "fromEncryptedJson", WalletUnlocked.fromEncryptedJson);
8381
8301
  // src/wallet-manager/wallet-manager.ts
8382
8302
  var import_address9 = require("@fuel-ts/address");
8383
8303
  var import_crypto4 = require("@fuel-ts/crypto");
8384
- var import_errors23 = require("@fuel-ts/errors");
8304
+ var import_errors22 = require("@fuel-ts/errors");
8385
8305
  var import_events = require("events");
8386
8306
 
8387
8307
  // src/wallet-manager/storages/memory-storage.ts
@@ -8404,7 +8324,7 @@ var MemoryStorage = class {
8404
8324
 
8405
8325
  // src/wallet-manager/vaults/mnemonic-vault.ts
8406
8326
  var import_address7 = require("@fuel-ts/address");
8407
- var import_errors21 = require("@fuel-ts/errors");
8327
+ var import_errors20 = require("@fuel-ts/errors");
8408
8328
  var _secret;
8409
8329
  var MnemonicVault = class {
8410
8330
  constructor(options) {
@@ -8460,8 +8380,8 @@ var MnemonicVault = class {
8460
8380
  }
8461
8381
  numberOfAccounts += 1;
8462
8382
  } while (numberOfAccounts < this.numberOfAccounts);
8463
- throw new import_errors21.FuelError(
8464
- import_errors21.ErrorCode.WALLET_MANAGER_ERROR,
8383
+ throw new import_errors20.FuelError(
8384
+ import_errors20.ErrorCode.WALLET_MANAGER_ERROR,
8465
8385
  `Account with address '${address}' not found in derived wallets.`
8466
8386
  );
8467
8387
  }
@@ -8475,7 +8395,7 @@ __publicField(MnemonicVault, "type", "mnemonic");
8475
8395
 
8476
8396
  // src/wallet-manager/vaults/privatekey-vault.ts
8477
8397
  var import_address8 = require("@fuel-ts/address");
8478
- var import_errors22 = require("@fuel-ts/errors");
8398
+ var import_errors21 = require("@fuel-ts/errors");
8479
8399
  var _privateKeys;
8480
8400
  var PrivateKeyVault = class {
8481
8401
  /**
@@ -8516,8 +8436,8 @@ var PrivateKeyVault = class {
8516
8436
  (pk) => Wallet.fromPrivateKey(pk).address.equals(ownerAddress)
8517
8437
  );
8518
8438
  if (!privateKey) {
8519
- throw new import_errors22.FuelError(
8520
- import_errors22.ErrorCode.WALLET_MANAGER_ERROR,
8439
+ throw new import_errors21.FuelError(
8440
+ import_errors21.ErrorCode.WALLET_MANAGER_ERROR,
8521
8441
  `No private key found for address '${address}'.`
8522
8442
  );
8523
8443
  }
@@ -8541,7 +8461,7 @@ var ERROR_MESSAGES = {
8541
8461
  };
8542
8462
  function assert(condition, message) {
8543
8463
  if (!condition) {
8544
- throw new import_errors23.FuelError(import_errors23.ErrorCode.WALLET_MANAGER_ERROR, message);
8464
+ throw new import_errors22.FuelError(import_errors22.ErrorCode.WALLET_MANAGER_ERROR, message);
8545
8465
  }
8546
8466
  }
8547
8467
  var _vaults, _passphrase, _isLocked, _serializeVaults, serializeVaults_fn, _deserializeVaults, deserializeVaults_fn;
@@ -8767,25 +8687,25 @@ deserializeVaults_fn = function(vaults) {
8767
8687
  __publicField(WalletManager, "Vaults", [MnemonicVault, PrivateKeyVault]);
8768
8688
 
8769
8689
  // src/wallet-manager/types.ts
8770
- var import_errors24 = require("@fuel-ts/errors");
8690
+ var import_errors23 = require("@fuel-ts/errors");
8771
8691
  var Vault = class {
8772
8692
  constructor(_options) {
8773
- throw new import_errors24.FuelError(import_errors24.ErrorCode.NOT_IMPLEMENTED, "Not implemented.");
8693
+ throw new import_errors23.FuelError(import_errors23.ErrorCode.NOT_IMPLEMENTED, "Not implemented.");
8774
8694
  }
8775
8695
  serialize() {
8776
- throw new import_errors24.FuelError(import_errors24.ErrorCode.NOT_IMPLEMENTED, "Not implemented.");
8696
+ throw new import_errors23.FuelError(import_errors23.ErrorCode.NOT_IMPLEMENTED, "Not implemented.");
8777
8697
  }
8778
8698
  getAccounts() {
8779
- throw new import_errors24.FuelError(import_errors24.ErrorCode.NOT_IMPLEMENTED, "Not implemented.");
8699
+ throw new import_errors23.FuelError(import_errors23.ErrorCode.NOT_IMPLEMENTED, "Not implemented.");
8780
8700
  }
8781
8701
  addAccount() {
8782
- throw new import_errors24.FuelError(import_errors24.ErrorCode.NOT_IMPLEMENTED, "Not implemented.");
8702
+ throw new import_errors23.FuelError(import_errors23.ErrorCode.NOT_IMPLEMENTED, "Not implemented.");
8783
8703
  }
8784
8704
  exportAccount(_address) {
8785
- throw new import_errors24.FuelError(import_errors24.ErrorCode.NOT_IMPLEMENTED, "Not implemented.");
8705
+ throw new import_errors23.FuelError(import_errors23.ErrorCode.NOT_IMPLEMENTED, "Not implemented.");
8786
8706
  }
8787
8707
  getWallet(_address) {
8788
- throw new import_errors24.FuelError(import_errors24.ErrorCode.NOT_IMPLEMENTED, "Not implemented.");
8708
+ throw new import_errors23.FuelError(import_errors23.ErrorCode.NOT_IMPLEMENTED, "Not implemented.");
8789
8709
  }
8790
8710
  };
8791
8711
  __publicField(Vault, "type");
@@ -8795,21 +8715,21 @@ var StorageAbstract = class {
8795
8715
  // src/predicate/predicate.ts
8796
8716
  var import_abi_coder5 = require("@fuel-ts/abi-coder");
8797
8717
  var import_address10 = require("@fuel-ts/address");
8798
- var import_configs13 = require("@fuel-ts/address/configs");
8799
- var import_errors25 = require("@fuel-ts/errors");
8800
- var import_transactions20 = require("@fuel-ts/transactions");
8801
- var import_utils37 = require("@fuel-ts/utils");
8718
+ var import_configs12 = require("@fuel-ts/address/configs");
8719
+ var import_errors24 = require("@fuel-ts/errors");
8720
+ var import_transactions19 = require("@fuel-ts/transactions");
8721
+ var import_utils36 = require("@fuel-ts/utils");
8802
8722
 
8803
8723
  // src/predicate/utils/getPredicateRoot.ts
8804
8724
  var import_hasher7 = require("@fuel-ts/hasher");
8805
8725
  var import_merkle = require("@fuel-ts/merkle");
8806
- var import_utils36 = require("@fuel-ts/utils");
8726
+ var import_utils35 = require("@fuel-ts/utils");
8807
8727
  var getPredicateRoot = (bytecode) => {
8808
8728
  const chunkSize = 16 * 1024;
8809
- const bytes = (0, import_utils36.arrayify)(bytecode);
8810
- const chunks = (0, import_utils36.chunkAndPadBytes)(bytes, chunkSize);
8811
- const codeRoot = (0, import_merkle.calcRoot)(chunks.map((c) => (0, import_utils36.hexlify)(c)));
8812
- const predicateRoot = (0, import_hasher7.hash)((0, import_utils36.concat)(["0x4655454C", codeRoot]));
8729
+ const bytes = (0, import_utils35.arrayify)(bytecode);
8730
+ const chunks = (0, import_utils35.chunkAndPadBytes)(bytes, chunkSize);
8731
+ const codeRoot = (0, import_merkle.calcRoot)(chunks.map((c) => (0, import_utils35.hexlify)(c)));
8732
+ const predicateRoot = (0, import_hasher7.hash)((0, import_utils35.concat)(["0x4655454C", codeRoot]));
8813
8733
  return predicateRoot;
8814
8734
  };
8815
8735
 
@@ -8858,7 +8778,7 @@ var Predicate = class extends Account {
8858
8778
  const request = transactionRequestify(transactionRequestLike);
8859
8779
  const { policies } = BaseTransactionRequest.getPolicyMeta(request);
8860
8780
  request.inputs?.forEach((input) => {
8861
- if (input.type === import_transactions20.InputType.Coin && (0, import_utils37.hexlify)(input.owner) === this.address.toB256()) {
8781
+ if (input.type === import_transactions19.InputType.Coin && (0, import_utils36.hexlify)(input.owner) === this.address.toB256()) {
8862
8782
  input.predicate = this.bytes;
8863
8783
  input.predicateData = this.getPredicateData(policies.length);
8864
8784
  }
@@ -8874,7 +8794,7 @@ var Predicate = class extends Account {
8874
8794
  * @param txParams - The transaction parameters (gasLimit, gasPrice, maturity).
8875
8795
  * @returns A promise that resolves to the prepared transaction request.
8876
8796
  */
8877
- async createTransfer(destination, amount, assetId = import_configs13.BaseAssetId, txParams = {}) {
8797
+ async createTransfer(destination, amount, assetId = import_configs12.BaseAssetId, txParams = {}) {
8878
8798
  const request = await super.createTransfer(destination, amount, assetId, txParams);
8879
8799
  return this.populateTransactionPredicateData(request);
8880
8800
  }
@@ -8903,7 +8823,7 @@ var Predicate = class extends Account {
8903
8823
  return new Uint8Array();
8904
8824
  }
8905
8825
  const mainFn = this.interface?.functions.main;
8906
- const paddedCode = new import_transactions20.ByteArrayCoder(this.bytes.length).encode(this.bytes);
8826
+ const paddedCode = new import_transactions19.ByteArrayCoder(this.bytes.length).encode(this.bytes);
8907
8827
  const VM_TX_MEMORY = (0, import_abi_coder5.calculateVmTxMemory)({
8908
8828
  maxInputs: this.provider.getChain().consensusParameters.maxInputs.toNumber()
8909
8829
  });
@@ -8919,13 +8839,13 @@ var Predicate = class extends Account {
8919
8839
  * @returns An object containing the new predicate bytes and interface.
8920
8840
  */
8921
8841
  static processPredicateData(bytes, jsonAbi, configurableConstants) {
8922
- let predicateBytes = (0, import_utils37.arrayify)(bytes);
8842
+ let predicateBytes = (0, import_utils36.arrayify)(bytes);
8923
8843
  let abiInterface;
8924
8844
  if (jsonAbi) {
8925
8845
  abiInterface = new import_abi_coder5.Interface(jsonAbi);
8926
8846
  if (abiInterface.functions.main === void 0) {
8927
- throw new import_errors25.FuelError(
8928
- import_errors25.ErrorCode.ABI_MAIN_METHOD_MISSING,
8847
+ throw new import_errors24.FuelError(
8848
+ import_errors24.ErrorCode.ABI_MAIN_METHOD_MISSING,
8929
8849
  'Cannot use ABI without "main" function.'
8930
8850
  );
8931
8851
  }
@@ -8970,8 +8890,8 @@ var Predicate = class extends Account {
8970
8890
  mutatedBytes.set(encoded, offset);
8971
8891
  });
8972
8892
  } catch (err) {
8973
- throw new import_errors25.FuelError(
8974
- import_errors25.ErrorCode.INVALID_CONFIGURABLE_CONSTANTS,
8893
+ throw new import_errors24.FuelError(
8894
+ import_errors24.ErrorCode.INVALID_CONFIGURABLE_CONSTANTS,
8975
8895
  `Error setting configurable constants: ${err.message}.`
8976
8896
  );
8977
8897
  }
@@ -8980,7 +8900,7 @@ var Predicate = class extends Account {
8980
8900
  };
8981
8901
 
8982
8902
  // src/connectors/fuel.ts
8983
- var import_errors26 = require("@fuel-ts/errors");
8903
+ var import_errors25 = require("@fuel-ts/errors");
8984
8904
 
8985
8905
  // src/connectors/fuel-connector.ts
8986
8906
  var import_events2 = require("events");
@@ -9613,7 +9533,7 @@ var _Fuel = class extends FuelConnector {
9613
9533
  const currentNetwork = await this.currentNetwork();
9614
9534
  provider = await Provider.create(currentNetwork.url);
9615
9535
  } else {
9616
- throw new import_errors26.FuelError(import_errors26.ErrorCode.INVALID_PROVIDER, "Provider is not valid.");
9536
+ throw new import_errors25.FuelError(import_errors25.ErrorCode.INVALID_PROVIDER, "Provider is not valid.");
9617
9537
  }
9618
9538
  return provider;
9619
9539
  }
@@ -9693,9 +9613,7 @@ __publicField(Fuel, "defaultConfig", {});
9693
9613
  WalletUnlocked,
9694
9614
  addAmountToAsset,
9695
9615
  addOperation,
9696
- assemblePanicError,
9697
9616
  assembleReceiptByType,
9698
- assembleRevertError,
9699
9617
  assembleTransactionSummary,
9700
9618
  assets,
9701
9619
  buildBlockExplorerUrl,
@@ -9710,7 +9628,6 @@ __publicField(Fuel, "defaultConfig", {});
9710
9628
  english,
9711
9629
  extractBurnedAssetsFromReceipts,
9712
9630
  extractMintedAssetsFromReceipts,
9713
- extractTxError,
9714
9631
  gasUsedByInputs,
9715
9632
  getAssetEth,
9716
9633
  getAssetFuel,