@fuel-ts/account 0.0.0-rc-1895-20240328113714 → 0.0.0-rc-1964-20240328124253

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.

@@ -58,15 +58,15 @@ module.exports = __toCommonJS(test_utils_exports);
58
58
 
59
59
  // src/wallet/base-wallet-unlocked.ts
60
60
  var import_hasher3 = require("@fuel-ts/hasher");
61
- var import_utils31 = require("@fuel-ts/utils");
61
+ var import_utils30 = require("@fuel-ts/utils");
62
62
 
63
63
  // src/account.ts
64
64
  var import_address4 = require("@fuel-ts/address");
65
- var import_configs12 = require("@fuel-ts/address/configs");
66
- var import_errors16 = require("@fuel-ts/errors");
65
+ var import_configs11 = require("@fuel-ts/address/configs");
66
+ var import_errors15 = require("@fuel-ts/errors");
67
67
  var import_interfaces = require("@fuel-ts/interfaces");
68
- var import_math18 = require("@fuel-ts/math");
69
- var import_utils28 = require("@fuel-ts/utils");
68
+ var import_math17 = require("@fuel-ts/math");
69
+ var import_utils27 = require("@fuel-ts/utils");
70
70
 
71
71
  // src/providers/coin-quantity.ts
72
72
  var import_configs = require("@fuel-ts/address/configs");
@@ -106,12 +106,12 @@ var addAmountToAsset = (params) => {
106
106
 
107
107
  // src/providers/provider.ts
108
108
  var import_address3 = require("@fuel-ts/address");
109
- var import_errors14 = require("@fuel-ts/errors");
110
- var import_math15 = require("@fuel-ts/math");
111
- var import_transactions18 = require("@fuel-ts/transactions");
112
- var import_utils23 = require("@fuel-ts/utils");
109
+ var import_errors13 = require("@fuel-ts/errors");
110
+ var import_math14 = require("@fuel-ts/math");
111
+ var import_transactions17 = require("@fuel-ts/transactions");
112
+ var import_utils22 = require("@fuel-ts/utils");
113
113
  var import_versions = require("@fuel-ts/versions");
114
- var import_utils24 = require("@noble/curves/abstract/utils");
114
+ var import_utils23 = require("@noble/curves/abstract/utils");
115
115
  var import_ethers = require("ethers");
116
116
  var import_graphql_request = require("graphql-request");
117
117
  var import_ramda3 = require("ramda");
@@ -1184,9 +1184,9 @@ var outputify = (value) => {
1184
1184
 
1185
1185
  // src/providers/transaction-request/transaction-request.ts
1186
1186
  var import_address = require("@fuel-ts/address");
1187
- var import_configs7 = require("@fuel-ts/address/configs");
1188
- var import_math7 = require("@fuel-ts/math");
1189
- var import_transactions6 = require("@fuel-ts/transactions");
1187
+ var import_configs6 = require("@fuel-ts/address/configs");
1188
+ var import_math6 = require("@fuel-ts/math");
1189
+ var import_transactions5 = require("@fuel-ts/transactions");
1190
1190
  var import_utils9 = require("@fuel-ts/utils");
1191
1191
 
1192
1192
  // src/providers/resource.ts
@@ -1517,68 +1517,6 @@ function sleep(time) {
1517
1517
  });
1518
1518
  }
1519
1519
 
1520
- // src/providers/utils/extract-tx-error.ts
1521
- var import_errors7 = require("@fuel-ts/errors");
1522
- var import_math6 = require("@fuel-ts/math");
1523
- var import_transactions5 = require("@fuel-ts/transactions");
1524
- var import_configs6 = require("@fuel-ts/transactions/configs");
1525
- var assemblePanicError = (status) => {
1526
- let errorMessage = `The transaction reverted with reason: "${status.reason}".`;
1527
- if (import_configs6.PANIC_REASONS.includes(status.reason)) {
1528
- errorMessage = `${errorMessage}
1529
-
1530
- You can read more about this error at:
1531
-
1532
- ${import_configs6.PANIC_DOC_URL}#variant.${status.reason}`;
1533
- }
1534
- return errorMessage;
1535
- };
1536
- var stringify = (obj) => JSON.stringify(obj, null, 2);
1537
- var assembleRevertError = (receipts, logs) => {
1538
- let errorMessage = "The transaction reverted with an unknown reason.";
1539
- const revertReceipt = receipts.find(({ type }) => type === import_transactions5.ReceiptType.Revert);
1540
- if (revertReceipt) {
1541
- const reasonHex = (0, import_math6.bn)(revertReceipt.val).toHex();
1542
- switch (reasonHex) {
1543
- case import_configs6.FAILED_REQUIRE_SIGNAL: {
1544
- errorMessage = `The transaction reverted because a "require" statement has thrown ${logs.length ? stringify(logs[0]) : "an error."}.`;
1545
- break;
1546
- }
1547
- case import_configs6.FAILED_ASSERT_EQ_SIGNAL: {
1548
- const sufix = logs.length >= 2 ? ` comparing ${stringify(logs[1])} and ${stringify(logs[0])}.` : ".";
1549
- errorMessage = `The transaction reverted because of an "assert_eq" statement${sufix}`;
1550
- break;
1551
- }
1552
- case import_configs6.FAILED_ASSERT_NE_SIGNAL: {
1553
- const sufix = logs.length >= 2 ? ` comparing ${stringify(logs[1])} and ${stringify(logs[0])}.` : ".";
1554
- errorMessage = `The transaction reverted because of an "assert_ne" statement${sufix}`;
1555
- break;
1556
- }
1557
- case import_configs6.FAILED_ASSERT_SIGNAL:
1558
- errorMessage = `The transaction reverted because an "assert" statement failed to evaluate to true.`;
1559
- break;
1560
- case import_configs6.FAILED_TRANSFER_TO_ADDRESS_SIGNAL:
1561
- errorMessage = `The transaction reverted because it's missing an "OutputChange".`;
1562
- break;
1563
- default:
1564
- errorMessage = `The transaction reverted with an unknown reason: ${revertReceipt.val}`;
1565
- }
1566
- }
1567
- return errorMessage;
1568
- };
1569
- var extractTxError = (params) => {
1570
- const { receipts, status, logs } = params;
1571
- const isPanic = receipts.some(({ type }) => type === import_transactions5.ReceiptType.Panic);
1572
- let err = status?.type === "FailureStatus" && isPanic ? assemblePanicError(status) : assembleRevertError(receipts, logs);
1573
- err += `
1574
-
1575
- logs: ${JSON.stringify(logs, null, 2)}`;
1576
- err += `
1577
-
1578
- receipts: ${JSON.stringify(receipts, null, 2)}`;
1579
- return new import_errors7.FuelError(import_errors7.ErrorCode.SCRIPT_REVERTED, err);
1580
- };
1581
-
1582
1520
  // src/providers/transaction-request/errors.ts
1583
1521
  var NoWitnessAtIndexError = class extends Error {
1584
1522
  constructor(index) {
@@ -1629,10 +1567,10 @@ var BaseTransactionRequest = class {
1629
1567
  outputs,
1630
1568
  witnesses
1631
1569
  } = {}) {
1632
- this.gasPrice = (0, import_math7.bn)(gasPrice);
1570
+ this.gasPrice = (0, import_math6.bn)(gasPrice);
1633
1571
  this.maturity = maturity ?? 0;
1634
- this.witnessLimit = witnessLimit ? (0, import_math7.bn)(witnessLimit) : void 0;
1635
- this.maxFee = maxFee ? (0, import_math7.bn)(maxFee) : void 0;
1572
+ this.witnessLimit = witnessLimit ? (0, import_math6.bn)(witnessLimit) : void 0;
1573
+ this.maxFee = maxFee ? (0, import_math6.bn)(maxFee) : void 0;
1636
1574
  this.inputs = inputs ?? [];
1637
1575
  this.outputs = outputs ?? [];
1638
1576
  this.witnesses = witnesses ?? [];
@@ -1641,20 +1579,20 @@ var BaseTransactionRequest = class {
1641
1579
  let policyTypes = 0;
1642
1580
  const policies = [];
1643
1581
  if (req.gasPrice) {
1644
- policyTypes += import_transactions6.PolicyType.GasPrice;
1645
- policies.push({ data: req.gasPrice, type: import_transactions6.PolicyType.GasPrice });
1582
+ policyTypes += import_transactions5.PolicyType.GasPrice;
1583
+ policies.push({ data: req.gasPrice, type: import_transactions5.PolicyType.GasPrice });
1646
1584
  }
1647
1585
  if (req.witnessLimit) {
1648
- policyTypes += import_transactions6.PolicyType.WitnessLimit;
1649
- policies.push({ data: req.witnessLimit, type: import_transactions6.PolicyType.WitnessLimit });
1586
+ policyTypes += import_transactions5.PolicyType.WitnessLimit;
1587
+ policies.push({ data: req.witnessLimit, type: import_transactions5.PolicyType.WitnessLimit });
1650
1588
  }
1651
1589
  if (req.maturity > 0) {
1652
- policyTypes += import_transactions6.PolicyType.Maturity;
1653
- policies.push({ data: req.maturity, type: import_transactions6.PolicyType.Maturity });
1590
+ policyTypes += import_transactions5.PolicyType.Maturity;
1591
+ policies.push({ data: req.maturity, type: import_transactions5.PolicyType.Maturity });
1654
1592
  }
1655
1593
  if (req.maxFee) {
1656
- policyTypes += import_transactions6.PolicyType.MaxFee;
1657
- policies.push({ data: req.maxFee, type: import_transactions6.PolicyType.MaxFee });
1594
+ policyTypes += import_transactions5.PolicyType.MaxFee;
1595
+ policies.push({ data: req.maxFee, type: import_transactions5.PolicyType.MaxFee });
1658
1596
  }
1659
1597
  return {
1660
1598
  policyTypes,
@@ -1688,7 +1626,7 @@ var BaseTransactionRequest = class {
1688
1626
  * @returns The transaction bytes.
1689
1627
  */
1690
1628
  toTransactionBytes() {
1691
- return new import_transactions6.TransactionCoder().encode(this.toTransaction());
1629
+ return new import_transactions5.TransactionCoder().encode(this.toTransaction());
1692
1630
  }
1693
1631
  /**
1694
1632
  * @hidden
@@ -1728,7 +1666,7 @@ var BaseTransactionRequest = class {
1728
1666
  * @returns The index of the created witness.
1729
1667
  */
1730
1668
  addEmptyWitness() {
1731
- this.addWitness((0, import_utils9.concat)([import_configs7.ZeroBytes32, import_configs7.ZeroBytes32]));
1669
+ this.addWitness((0, import_utils9.concat)([import_configs6.ZeroBytes32, import_configs6.ZeroBytes32]));
1732
1670
  return this.witnesses.length - 1;
1733
1671
  }
1734
1672
  /**
@@ -1779,7 +1717,7 @@ var BaseTransactionRequest = class {
1779
1717
  */
1780
1718
  getCoinInputs() {
1781
1719
  return this.inputs.filter(
1782
- (input) => input.type === import_transactions6.InputType.Coin
1720
+ (input) => input.type === import_transactions5.InputType.Coin
1783
1721
  );
1784
1722
  }
1785
1723
  /**
@@ -1789,7 +1727,7 @@ var BaseTransactionRequest = class {
1789
1727
  */
1790
1728
  getCoinOutputs() {
1791
1729
  return this.outputs.filter(
1792
- (output) => output.type === import_transactions6.OutputType.Coin
1730
+ (output) => output.type === import_transactions5.OutputType.Coin
1793
1731
  );
1794
1732
  }
1795
1733
  /**
@@ -1799,7 +1737,7 @@ var BaseTransactionRequest = class {
1799
1737
  */
1800
1738
  getChangeOutputs() {
1801
1739
  return this.outputs.filter(
1802
- (output) => output.type === import_transactions6.OutputType.Change
1740
+ (output) => output.type === import_transactions5.OutputType.Change
1803
1741
  );
1804
1742
  }
1805
1743
  /**
@@ -1811,9 +1749,9 @@ var BaseTransactionRequest = class {
1811
1749
  const ownerAddress = (0, import_address.addressify)(owner);
1812
1750
  const found = this.inputs.find((input) => {
1813
1751
  switch (input.type) {
1814
- case import_transactions6.InputType.Coin:
1752
+ case import_transactions5.InputType.Coin:
1815
1753
  return (0, import_utils9.hexlify)(input.owner) === ownerAddress.toB256();
1816
- case import_transactions6.InputType.Message:
1754
+ case import_transactions5.InputType.Message:
1817
1755
  return (0, import_utils9.hexlify)(input.recipient) === ownerAddress.toB256();
1818
1756
  default:
1819
1757
  return false;
@@ -1842,7 +1780,7 @@ var BaseTransactionRequest = class {
1842
1780
  }
1843
1781
  const input = {
1844
1782
  ...coin,
1845
- type: import_transactions6.InputType.Coin,
1783
+ type: import_transactions5.InputType.Coin,
1846
1784
  owner: owner.toB256(),
1847
1785
  amount,
1848
1786
  assetId,
@@ -1864,7 +1802,7 @@ var BaseTransactionRequest = class {
1864
1802
  */
1865
1803
  addMessageInput(message, predicate) {
1866
1804
  const { recipient, sender, amount } = message;
1867
- const assetId = import_configs7.BaseAssetId;
1805
+ const assetId = import_configs6.BaseAssetId;
1868
1806
  let witnessIndex;
1869
1807
  if (predicate) {
1870
1808
  witnessIndex = 0;
@@ -1876,7 +1814,7 @@ var BaseTransactionRequest = class {
1876
1814
  }
1877
1815
  const input = {
1878
1816
  ...message,
1879
- type: import_transactions6.InputType.Message,
1817
+ type: import_transactions5.InputType.Message,
1880
1818
  sender: sender.toB256(),
1881
1819
  recipient: recipient.toB256(),
1882
1820
  amount,
@@ -1946,9 +1884,9 @@ var BaseTransactionRequest = class {
1946
1884
  * @param amount - Amount of coin.
1947
1885
  * @param assetId - Asset ID of coin.
1948
1886
  */
1949
- addCoinOutput(to, amount, assetId = import_configs7.BaseAssetId) {
1887
+ addCoinOutput(to, amount, assetId = import_configs6.BaseAssetId) {
1950
1888
  this.pushOutput({
1951
- type: import_transactions6.OutputType.Coin,
1889
+ type: import_transactions5.OutputType.Coin,
1952
1890
  to: (0, import_address.addressify)(to).toB256(),
1953
1891
  amount,
1954
1892
  assetId
@@ -1964,7 +1902,7 @@ var BaseTransactionRequest = class {
1964
1902
  addCoinOutputs(to, quantities) {
1965
1903
  quantities.map(coinQuantityfy).forEach((quantity) => {
1966
1904
  this.pushOutput({
1967
- type: import_transactions6.OutputType.Coin,
1905
+ type: import_transactions5.OutputType.Coin,
1968
1906
  to: (0, import_address.addressify)(to).toB256(),
1969
1907
  amount: quantity.amount,
1970
1908
  assetId: quantity.assetId
@@ -1978,13 +1916,13 @@ var BaseTransactionRequest = class {
1978
1916
  * @param to - Address of the owner.
1979
1917
  * @param assetId - Asset ID of coin.
1980
1918
  */
1981
- addChangeOutput(to, assetId = import_configs7.BaseAssetId) {
1919
+ addChangeOutput(to, assetId = import_configs6.BaseAssetId) {
1982
1920
  const changeOutput = this.getChangeOutputs().find(
1983
1921
  (output) => (0, import_utils9.hexlify)(output.assetId) === assetId
1984
1922
  );
1985
1923
  if (!changeOutput) {
1986
1924
  this.pushOutput({
1987
- type: import_transactions6.OutputType.Change,
1925
+ type: import_transactions5.OutputType.Change,
1988
1926
  to: (0, import_address.addressify)(to).toB256(),
1989
1927
  assetId
1990
1928
  });
@@ -2040,7 +1978,7 @@ var BaseTransactionRequest = class {
2040
1978
  let idCounter = 0;
2041
1979
  const generateId = () => {
2042
1980
  const counterString = String(idCounter++);
2043
- const id = import_configs7.ZeroBytes32.slice(0, -counterString.length).concat(counterString);
1981
+ const id = import_configs6.ZeroBytes32.slice(0, -counterString.length).concat(counterString);
2044
1982
  return id;
2045
1983
  };
2046
1984
  const findAssetInput = (assetId) => this.inputs.find((input) => {
@@ -2062,13 +2000,13 @@ var BaseTransactionRequest = class {
2062
2000
  assetId,
2063
2001
  owner: resourcesOwner || import_address.Address.fromRandom(),
2064
2002
  maturity: 0,
2065
- blockCreated: (0, import_math7.bn)(1),
2066
- txCreatedIdx: (0, import_math7.bn)(1)
2003
+ blockCreated: (0, import_math6.bn)(1),
2004
+ txCreatedIdx: (0, import_math6.bn)(1)
2067
2005
  }
2068
2006
  ]);
2069
2007
  }
2070
2008
  };
2071
- updateAssetInput(import_configs7.BaseAssetId, (0, import_math7.bn)(1e11));
2009
+ updateAssetInput(import_configs6.BaseAssetId, (0, import_math6.bn)(1e11));
2072
2010
  quantities.forEach((q) => updateAssetInput(q.assetId, q.amount));
2073
2011
  }
2074
2012
  /**
@@ -2079,7 +2017,7 @@ var BaseTransactionRequest = class {
2079
2017
  */
2080
2018
  getCoinOutputsQuantities() {
2081
2019
  const coinsQuantities = this.getCoinOutputs().map(({ amount, assetId }) => ({
2082
- amount: (0, import_math7.bn)(amount),
2020
+ amount: (0, import_math6.bn)(amount),
2083
2021
  assetId: assetId.toString()
2084
2022
  }));
2085
2023
  return coinsQuantities;
@@ -2097,18 +2035,18 @@ var BaseTransactionRequest = class {
2097
2035
  this.inputs.forEach((i) => {
2098
2036
  let correspondingInput;
2099
2037
  switch (i.type) {
2100
- case import_transactions6.InputType.Coin:
2101
- correspondingInput = inputs.find((x) => x.type === import_transactions6.InputType.Coin && x.owner === i.owner);
2038
+ case import_transactions5.InputType.Coin:
2039
+ correspondingInput = inputs.find((x) => x.type === import_transactions5.InputType.Coin && x.owner === i.owner);
2102
2040
  break;
2103
- case import_transactions6.InputType.Message:
2041
+ case import_transactions5.InputType.Message:
2104
2042
  correspondingInput = inputs.find(
2105
- (x) => x.type === import_transactions6.InputType.Message && x.sender === i.sender
2043
+ (x) => x.type === import_transactions5.InputType.Message && x.sender === i.sender
2106
2044
  );
2107
2045
  break;
2108
2046
  default:
2109
2047
  return;
2110
2048
  }
2111
- if (correspondingInput && "predicateGasUsed" in correspondingInput && (0, import_math7.bn)(correspondingInput.predicateGasUsed).gt(0)) {
2049
+ if (correspondingInput && "predicateGasUsed" in correspondingInput && (0, import_math6.bn)(correspondingInput.predicateGasUsed).gt(0)) {
2112
2050
  i.predicate = correspondingInput.predicate;
2113
2051
  i.predicateData = correspondingInput.predicateData;
2114
2052
  i.predicateGasUsed = correspondingInput.predicateGasUsed;
@@ -2118,47 +2056,47 @@ var BaseTransactionRequest = class {
2118
2056
  };
2119
2057
 
2120
2058
  // src/providers/transaction-request/create-transaction-request.ts
2121
- var import_configs9 = require("@fuel-ts/address/configs");
2122
- var import_math9 = require("@fuel-ts/math");
2123
- var import_transactions8 = require("@fuel-ts/transactions");
2059
+ var import_configs8 = require("@fuel-ts/address/configs");
2060
+ var import_math8 = require("@fuel-ts/math");
2061
+ var import_transactions7 = require("@fuel-ts/transactions");
2124
2062
  var import_utils13 = require("@fuel-ts/utils");
2125
2063
 
2126
2064
  // src/providers/transaction-request/hash-transaction.ts
2127
- var import_configs8 = require("@fuel-ts/address/configs");
2065
+ var import_configs7 = require("@fuel-ts/address/configs");
2128
2066
  var import_hasher = require("@fuel-ts/hasher");
2129
- var import_math8 = require("@fuel-ts/math");
2130
- var import_transactions7 = require("@fuel-ts/transactions");
2067
+ var import_math7 = require("@fuel-ts/math");
2068
+ var import_transactions6 = require("@fuel-ts/transactions");
2131
2069
  var import_utils11 = require("@fuel-ts/utils");
2132
2070
  var import_ramda2 = require("ramda");
2133
2071
  function hashTransaction(transactionRequest, chainId) {
2134
2072
  const transaction = transactionRequest.toTransaction();
2135
- if (transaction.type === import_transactions7.TransactionType.Script) {
2136
- transaction.receiptsRoot = import_configs8.ZeroBytes32;
2073
+ if (transaction.type === import_transactions6.TransactionType.Script) {
2074
+ transaction.receiptsRoot = import_configs7.ZeroBytes32;
2137
2075
  }
2138
2076
  transaction.inputs = transaction.inputs.map((input) => {
2139
2077
  const inputClone = (0, import_ramda2.clone)(input);
2140
2078
  switch (inputClone.type) {
2141
- case import_transactions7.InputType.Coin: {
2079
+ case import_transactions6.InputType.Coin: {
2142
2080
  inputClone.txPointer = {
2143
2081
  blockHeight: 0,
2144
2082
  txIndex: 0
2145
2083
  };
2146
- inputClone.predicateGasUsed = (0, import_math8.bn)(0);
2084
+ inputClone.predicateGasUsed = (0, import_math7.bn)(0);
2147
2085
  return inputClone;
2148
2086
  }
2149
- case import_transactions7.InputType.Message: {
2150
- inputClone.predicateGasUsed = (0, import_math8.bn)(0);
2087
+ case import_transactions6.InputType.Message: {
2088
+ inputClone.predicateGasUsed = (0, import_math7.bn)(0);
2151
2089
  return inputClone;
2152
2090
  }
2153
- case import_transactions7.InputType.Contract: {
2091
+ case import_transactions6.InputType.Contract: {
2154
2092
  inputClone.txPointer = {
2155
2093
  blockHeight: 0,
2156
2094
  txIndex: 0
2157
2095
  };
2158
- inputClone.txID = import_configs8.ZeroBytes32;
2096
+ inputClone.txID = import_configs7.ZeroBytes32;
2159
2097
  inputClone.outputIndex = 0;
2160
- inputClone.balanceRoot = import_configs8.ZeroBytes32;
2161
- inputClone.stateRoot = import_configs8.ZeroBytes32;
2098
+ inputClone.balanceRoot = import_configs7.ZeroBytes32;
2099
+ inputClone.stateRoot = import_configs7.ZeroBytes32;
2162
2100
  return inputClone;
2163
2101
  }
2164
2102
  default:
@@ -2168,19 +2106,19 @@ function hashTransaction(transactionRequest, chainId) {
2168
2106
  transaction.outputs = transaction.outputs.map((output) => {
2169
2107
  const outputClone = (0, import_ramda2.clone)(output);
2170
2108
  switch (outputClone.type) {
2171
- case import_transactions7.OutputType.Contract: {
2172
- outputClone.balanceRoot = import_configs8.ZeroBytes32;
2173
- outputClone.stateRoot = import_configs8.ZeroBytes32;
2109
+ case import_transactions6.OutputType.Contract: {
2110
+ outputClone.balanceRoot = import_configs7.ZeroBytes32;
2111
+ outputClone.stateRoot = import_configs7.ZeroBytes32;
2174
2112
  return outputClone;
2175
2113
  }
2176
- case import_transactions7.OutputType.Change: {
2177
- outputClone.amount = (0, import_math8.bn)(0);
2114
+ case import_transactions6.OutputType.Change: {
2115
+ outputClone.amount = (0, import_math7.bn)(0);
2178
2116
  return outputClone;
2179
2117
  }
2180
- case import_transactions7.OutputType.Variable: {
2181
- outputClone.to = import_configs8.ZeroBytes32;
2182
- outputClone.amount = (0, import_math8.bn)(0);
2183
- outputClone.assetId = import_configs8.ZeroBytes32;
2118
+ case import_transactions6.OutputType.Variable: {
2119
+ outputClone.to = import_configs7.ZeroBytes32;
2120
+ outputClone.amount = (0, import_math7.bn)(0);
2121
+ outputClone.assetId = import_configs7.ZeroBytes32;
2184
2122
  return outputClone;
2185
2123
  }
2186
2124
  default:
@@ -2190,7 +2128,7 @@ function hashTransaction(transactionRequest, chainId) {
2190
2128
  transaction.witnessesCount = 0;
2191
2129
  transaction.witnesses = [];
2192
2130
  const chainIdBytes = (0, import_hasher.uint64ToBytesBE)(chainId);
2193
- const concatenatedData = (0, import_utils11.concat)([chainIdBytes, new import_transactions7.TransactionCoder().encode(transaction)]);
2131
+ const concatenatedData = (0, import_utils11.concat)([chainIdBytes, new import_transactions6.TransactionCoder().encode(transaction)]);
2194
2132
  return (0, import_hasher.sha256)(concatenatedData);
2195
2133
  }
2196
2134
 
@@ -2226,7 +2164,7 @@ var CreateTransactionRequest = class extends BaseTransactionRequest {
2226
2164
  return new this(obj);
2227
2165
  }
2228
2166
  /** Type of the transaction */
2229
- type = import_transactions8.TransactionType.Create;
2167
+ type = import_transactions7.TransactionType.Create;
2230
2168
  /** Witness index of contract bytecode to create */
2231
2169
  bytecodeWitnessIndex;
2232
2170
  /** Salt */
@@ -2246,7 +2184,7 @@ var CreateTransactionRequest = class extends BaseTransactionRequest {
2246
2184
  } = {}) {
2247
2185
  super(rest);
2248
2186
  this.bytecodeWitnessIndex = bytecodeWitnessIndex ?? 0;
2249
- this.salt = (0, import_utils13.hexlify)(salt ?? import_configs9.ZeroBytes32);
2187
+ this.salt = (0, import_utils13.hexlify)(salt ?? import_configs8.ZeroBytes32);
2250
2188
  this.storageSlots = [...storageSlots ?? []];
2251
2189
  }
2252
2190
  /**
@@ -2259,12 +2197,12 @@ var CreateTransactionRequest = class extends BaseTransactionRequest {
2259
2197
  const bytecodeWitnessIndex = this.bytecodeWitnessIndex;
2260
2198
  const storageSlots = this.storageSlots?.map(storageSlotify) ?? [];
2261
2199
  return {
2262
- type: import_transactions8.TransactionType.Create,
2200
+ type: import_transactions7.TransactionType.Create,
2263
2201
  ...baseTransaction,
2264
2202
  bytecodeLength: baseTransaction.witnesses[bytecodeWitnessIndex].dataLength / 4,
2265
2203
  bytecodeWitnessIndex,
2266
2204
  storageSlotsCount: storageSlots.length,
2267
- salt: this.salt ? (0, import_utils13.hexlify)(this.salt) : import_configs9.ZeroBytes32,
2205
+ salt: this.salt ? (0, import_utils13.hexlify)(this.salt) : import_configs8.ZeroBytes32,
2268
2206
  storageSlots
2269
2207
  };
2270
2208
  }
@@ -2275,7 +2213,7 @@ var CreateTransactionRequest = class extends BaseTransactionRequest {
2275
2213
  */
2276
2214
  getContractCreatedOutputs() {
2277
2215
  return this.outputs.filter(
2278
- (output) => output.type === import_transactions8.OutputType.ContractCreated
2216
+ (output) => output.type === import_transactions7.OutputType.ContractCreated
2279
2217
  );
2280
2218
  }
2281
2219
  /**
@@ -2296,14 +2234,14 @@ var CreateTransactionRequest = class extends BaseTransactionRequest {
2296
2234
  */
2297
2235
  addContractCreatedOutput(contractId, stateRoot) {
2298
2236
  this.pushOutput({
2299
- type: import_transactions8.OutputType.ContractCreated,
2237
+ type: import_transactions7.OutputType.ContractCreated,
2300
2238
  contractId,
2301
2239
  stateRoot
2302
2240
  });
2303
2241
  }
2304
2242
  metadataGas(gasCosts) {
2305
2243
  return calculateMetadataGasForTxCreate({
2306
- contractBytesSize: (0, import_math9.bn)((0, import_utils13.arrayify)(this.witnesses[this.bytecodeWitnessIndex] || "0x").length),
2244
+ contractBytesSize: (0, import_math8.bn)((0, import_utils13.arrayify)(this.witnesses[this.bytecodeWitnessIndex] || "0x").length),
2307
2245
  gasCosts,
2308
2246
  stateRootSize: this.storageSlots.length,
2309
2247
  txBytesSize: this.byteSize()
@@ -2314,9 +2252,9 @@ var CreateTransactionRequest = class extends BaseTransactionRequest {
2314
2252
  // src/providers/transaction-request/script-transaction-request.ts
2315
2253
  var import_abi_coder = require("@fuel-ts/abi-coder");
2316
2254
  var import_address2 = require("@fuel-ts/address");
2317
- var import_configs10 = require("@fuel-ts/address/configs");
2318
- var import_math10 = require("@fuel-ts/math");
2319
- var import_transactions9 = require("@fuel-ts/transactions");
2255
+ var import_configs9 = require("@fuel-ts/address/configs");
2256
+ var import_math9 = require("@fuel-ts/math");
2257
+ var import_transactions8 = require("@fuel-ts/transactions");
2320
2258
  var import_utils15 = require("@fuel-ts/utils");
2321
2259
 
2322
2260
  // src/providers/transaction-request/scripts.ts
@@ -2354,7 +2292,7 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
2354
2292
  return new this(obj);
2355
2293
  }
2356
2294
  /** Type of the transaction */
2357
- type = import_transactions9.TransactionType.Script;
2295
+ type = import_transactions8.TransactionType.Script;
2358
2296
  /** Gas limit for transaction */
2359
2297
  gasLimit;
2360
2298
  /** Script to execute */
@@ -2369,7 +2307,7 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
2369
2307
  */
2370
2308
  constructor({ script, scriptData, gasLimit, ...rest } = {}) {
2371
2309
  super(rest);
2372
- this.gasLimit = (0, import_math10.bn)(gasLimit);
2310
+ this.gasLimit = (0, import_math9.bn)(gasLimit);
2373
2311
  this.script = (0, import_utils15.arrayify)(script ?? returnZeroScript.bytes);
2374
2312
  this.scriptData = (0, import_utils15.arrayify)(scriptData ?? returnZeroScript.encodeScriptData());
2375
2313
  this.abis = rest.abis;
@@ -2383,12 +2321,12 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
2383
2321
  const script = (0, import_utils15.arrayify)(this.script ?? "0x");
2384
2322
  const scriptData = (0, import_utils15.arrayify)(this.scriptData ?? "0x");
2385
2323
  return {
2386
- type: import_transactions9.TransactionType.Script,
2324
+ type: import_transactions8.TransactionType.Script,
2387
2325
  scriptGasLimit: this.gasLimit,
2388
2326
  ...super.getBaseTransaction(),
2389
2327
  scriptLength: script.length,
2390
2328
  scriptDataLength: scriptData.length,
2391
- receiptsRoot: import_configs10.ZeroBytes32,
2329
+ receiptsRoot: import_configs9.ZeroBytes32,
2392
2330
  script: (0, import_utils15.hexlify)(script),
2393
2331
  scriptData: (0, import_utils15.hexlify)(scriptData)
2394
2332
  };
@@ -2400,7 +2338,7 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
2400
2338
  */
2401
2339
  getContractInputs() {
2402
2340
  return this.inputs.filter(
2403
- (input) => input.type === import_transactions9.InputType.Contract
2341
+ (input) => input.type === import_transactions8.InputType.Contract
2404
2342
  );
2405
2343
  }
2406
2344
  /**
@@ -2410,7 +2348,7 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
2410
2348
  */
2411
2349
  getContractOutputs() {
2412
2350
  return this.outputs.filter(
2413
- (output) => output.type === import_transactions9.OutputType.Contract
2351
+ (output) => output.type === import_transactions8.OutputType.Contract
2414
2352
  );
2415
2353
  }
2416
2354
  /**
@@ -2420,7 +2358,7 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
2420
2358
  */
2421
2359
  getVariableOutputs() {
2422
2360
  return this.outputs.filter(
2423
- (output) => output.type === import_transactions9.OutputType.Variable
2361
+ (output) => output.type === import_transactions8.OutputType.Variable
2424
2362
  );
2425
2363
  }
2426
2364
  /**
@@ -2443,7 +2381,7 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
2443
2381
  let outputsNumber = numberOfVariables;
2444
2382
  while (outputsNumber) {
2445
2383
  this.pushOutput({
2446
- type: import_transactions9.OutputType.Variable
2384
+ type: import_transactions8.OutputType.Variable
2447
2385
  });
2448
2386
  outputsNumber -= 1;
2449
2387
  }
@@ -2476,12 +2414,12 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
2476
2414
  return this;
2477
2415
  }
2478
2416
  const inputIndex = super.pushInput({
2479
- type: import_transactions9.InputType.Contract,
2417
+ type: import_transactions8.InputType.Contract,
2480
2418
  contractId: contractAddress.toB256(),
2481
2419
  txPointer: "0x00000000000000000000000000000000"
2482
2420
  });
2483
2421
  this.pushOutput({
2484
- type: import_transactions9.OutputType.Contract,
2422
+ type: import_transactions8.OutputType.Contract,
2485
2423
  inputIndex
2486
2424
  });
2487
2425
  return this;
@@ -2517,38 +2455,38 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
2517
2455
  };
2518
2456
 
2519
2457
  // src/providers/transaction-request/utils.ts
2520
- var import_errors9 = require("@fuel-ts/errors");
2521
- var import_transactions10 = require("@fuel-ts/transactions");
2458
+ var import_errors8 = require("@fuel-ts/errors");
2459
+ var import_transactions9 = require("@fuel-ts/transactions");
2522
2460
  var transactionRequestify = (obj) => {
2523
2461
  if (obj instanceof ScriptTransactionRequest || obj instanceof CreateTransactionRequest) {
2524
2462
  return obj;
2525
2463
  }
2526
2464
  const { type } = obj;
2527
2465
  switch (obj.type) {
2528
- case import_transactions10.TransactionType.Script: {
2466
+ case import_transactions9.TransactionType.Script: {
2529
2467
  return ScriptTransactionRequest.from(obj);
2530
2468
  }
2531
- case import_transactions10.TransactionType.Create: {
2469
+ case import_transactions9.TransactionType.Create: {
2532
2470
  return CreateTransactionRequest.from(obj);
2533
2471
  }
2534
2472
  default: {
2535
- throw new import_errors9.FuelError(import_errors9.ErrorCode.INVALID_TRANSACTION_TYPE, `Invalid transaction type: ${type}.`);
2473
+ throw new import_errors8.FuelError(import_errors8.ErrorCode.INVALID_TRANSACTION_TYPE, `Invalid transaction type: ${type}.`);
2536
2474
  }
2537
2475
  }
2538
2476
  };
2539
2477
 
2540
2478
  // src/providers/transaction-response/transaction-response.ts
2541
- var import_errors13 = require("@fuel-ts/errors");
2542
- var import_math14 = require("@fuel-ts/math");
2543
- var import_transactions17 = require("@fuel-ts/transactions");
2479
+ var import_errors12 = require("@fuel-ts/errors");
2480
+ var import_math13 = require("@fuel-ts/math");
2481
+ var import_transactions16 = require("@fuel-ts/transactions");
2544
2482
  var import_utils21 = require("@fuel-ts/utils");
2545
2483
 
2546
2484
  // src/providers/transaction-summary/assemble-transaction-summary.ts
2547
2485
  var import_utils19 = require("@fuel-ts/utils");
2548
2486
 
2549
2487
  // src/providers/transaction-summary/calculate-transaction-fee.ts
2550
- var import_math11 = require("@fuel-ts/math");
2551
- var import_transactions11 = require("@fuel-ts/transactions");
2488
+ var import_math10 = require("@fuel-ts/math");
2489
+ var import_transactions10 = require("@fuel-ts/transactions");
2552
2490
  var import_utils16 = require("@fuel-ts/utils");
2553
2491
  var calculateTransactionFee = (params) => {
2554
2492
  const {
@@ -2556,24 +2494,24 @@ var calculateTransactionFee = (params) => {
2556
2494
  rawPayload,
2557
2495
  consensusParameters: { gasCosts, feeParams }
2558
2496
  } = params;
2559
- const gasPerByte = (0, import_math11.bn)(feeParams.gasPerByte);
2560
- const gasPriceFactor = (0, import_math11.bn)(feeParams.gasPriceFactor);
2497
+ const gasPerByte = (0, import_math10.bn)(feeParams.gasPerByte);
2498
+ const gasPriceFactor = (0, import_math10.bn)(feeParams.gasPriceFactor);
2561
2499
  const transactionBytes = (0, import_utils16.arrayify)(rawPayload);
2562
- const [transaction] = new import_transactions11.TransactionCoder().decode(transactionBytes, 0);
2563
- if (transaction.type === import_transactions11.TransactionType.Mint) {
2500
+ const [transaction] = new import_transactions10.TransactionCoder().decode(transactionBytes, 0);
2501
+ if (transaction.type === import_transactions10.TransactionType.Mint) {
2564
2502
  return {
2565
- fee: (0, import_math11.bn)(0),
2566
- minFee: (0, import_math11.bn)(0),
2567
- maxFee: (0, import_math11.bn)(0),
2568
- feeFromGasUsed: (0, import_math11.bn)(0)
2503
+ fee: (0, import_math10.bn)(0),
2504
+ minFee: (0, import_math10.bn)(0),
2505
+ maxFee: (0, import_math10.bn)(0),
2506
+ feeFromGasUsed: (0, import_math10.bn)(0)
2569
2507
  };
2570
2508
  }
2571
2509
  const { type, witnesses, inputs, policies } = transaction;
2572
- let metadataGas = (0, import_math11.bn)(0);
2573
- let gasLimit = (0, import_math11.bn)(0);
2574
- if (type === import_transactions11.TransactionType.Create) {
2510
+ let metadataGas = (0, import_math10.bn)(0);
2511
+ let gasLimit = (0, import_math10.bn)(0);
2512
+ if (type === import_transactions10.TransactionType.Create) {
2575
2513
  const { bytecodeWitnessIndex, storageSlots } = transaction;
2576
- const contractBytesSize = (0, import_math11.bn)((0, import_utils16.arrayify)(witnesses[bytecodeWitnessIndex].data).length);
2514
+ const contractBytesSize = (0, import_math10.bn)((0, import_utils16.arrayify)(witnesses[bytecodeWitnessIndex].data).length);
2577
2515
  metadataGas = calculateMetadataGasForTxCreate({
2578
2516
  contractBytesSize,
2579
2517
  gasCosts,
@@ -2592,13 +2530,13 @@ var calculateTransactionFee = (params) => {
2592
2530
  }
2593
2531
  const minGas = getMinGas({
2594
2532
  gasCosts,
2595
- gasPerByte: (0, import_math11.bn)(gasPerByte),
2533
+ gasPerByte: (0, import_math10.bn)(gasPerByte),
2596
2534
  inputs,
2597
2535
  metadataGas,
2598
2536
  txBytesSize: transactionBytes.length
2599
2537
  });
2600
- const gasPrice = (0, import_math11.bn)(policies.find((policy) => policy.type === import_transactions11.PolicyType.GasPrice)?.data);
2601
- const witnessLimit = policies.find((policy) => policy.type === import_transactions11.PolicyType.WitnessLimit)?.data;
2538
+ const gasPrice = (0, import_math10.bn)(policies.find((policy) => policy.type === import_transactions10.PolicyType.GasPrice)?.data);
2539
+ const witnessLimit = policies.find((policy) => policy.type === import_transactions10.PolicyType.WitnessLimit)?.data;
2602
2540
  const witnessesLength = witnesses.reduce((acc, wit) => acc + wit.dataLength, 0);
2603
2541
  const maxGas = getMaxGas({
2604
2542
  gasPerByte,
@@ -2620,14 +2558,14 @@ var calculateTransactionFee = (params) => {
2620
2558
  };
2621
2559
 
2622
2560
  // src/providers/transaction-summary/operations.ts
2623
- var import_configs11 = require("@fuel-ts/address/configs");
2624
- var import_errors11 = require("@fuel-ts/errors");
2625
- var import_math13 = require("@fuel-ts/math");
2626
- var import_transactions14 = require("@fuel-ts/transactions");
2561
+ var import_configs10 = require("@fuel-ts/address/configs");
2562
+ var import_errors10 = require("@fuel-ts/errors");
2563
+ var import_math12 = require("@fuel-ts/math");
2564
+ var import_transactions13 = require("@fuel-ts/transactions");
2627
2565
 
2628
2566
  // src/providers/transaction-summary/call.ts
2629
2567
  var import_abi_coder2 = require("@fuel-ts/abi-coder");
2630
- var import_math12 = require("@fuel-ts/math");
2568
+ var import_math11 = require("@fuel-ts/math");
2631
2569
  var getFunctionCall = ({ abi, receipt, rawPayload, maxInputs }) => {
2632
2570
  const abiInterface = new import_abi_coder2.Interface(abi);
2633
2571
  const callFunctionSelector = receipt.param1.toHex(8);
@@ -2636,7 +2574,7 @@ var getFunctionCall = ({ abi, receipt, rawPayload, maxInputs }) => {
2636
2574
  let encodedArgs;
2637
2575
  if (functionFragment.isInputDataPointer) {
2638
2576
  if (rawPayload) {
2639
- const argsOffset = (0, import_math12.bn)(receipt.param2).sub((0, import_abi_coder2.calculateVmTxMemory)({ maxInputs: maxInputs.toNumber() })).toNumber();
2577
+ const argsOffset = (0, import_math11.bn)(receipt.param2).sub((0, import_abi_coder2.calculateVmTxMemory)({ maxInputs: maxInputs.toNumber() })).toNumber();
2640
2578
  encodedArgs = `0x${rawPayload.slice(2).slice(argsOffset * 2)}`;
2641
2579
  }
2642
2580
  } else {
@@ -2670,8 +2608,8 @@ var getFunctionCall = ({ abi, receipt, rawPayload, maxInputs }) => {
2670
2608
  };
2671
2609
 
2672
2610
  // src/providers/transaction-summary/input.ts
2673
- var import_errors10 = require("@fuel-ts/errors");
2674
- var import_transactions12 = require("@fuel-ts/transactions");
2611
+ var import_errors9 = require("@fuel-ts/errors");
2612
+ var import_transactions11 = require("@fuel-ts/transactions");
2675
2613
  function getInputsByTypes(inputs, types) {
2676
2614
  return inputs.filter((i) => types.includes(i.type));
2677
2615
  }
@@ -2679,16 +2617,16 @@ function getInputsByType(inputs, type) {
2679
2617
  return inputs.filter((i) => i.type === type);
2680
2618
  }
2681
2619
  function getInputsCoin(inputs) {
2682
- return getInputsByType(inputs, import_transactions12.InputType.Coin);
2620
+ return getInputsByType(inputs, import_transactions11.InputType.Coin);
2683
2621
  }
2684
2622
  function getInputsMessage(inputs) {
2685
- return getInputsByType(inputs, import_transactions12.InputType.Message);
2623
+ return getInputsByType(inputs, import_transactions11.InputType.Message);
2686
2624
  }
2687
2625
  function getInputsCoinAndMessage(inputs) {
2688
- return getInputsByTypes(inputs, [import_transactions12.InputType.Coin, import_transactions12.InputType.Message]);
2626
+ return getInputsByTypes(inputs, [import_transactions11.InputType.Coin, import_transactions11.InputType.Message]);
2689
2627
  }
2690
2628
  function getInputsContract(inputs) {
2691
- return getInputsByType(inputs, import_transactions12.InputType.Contract);
2629
+ return getInputsByType(inputs, import_transactions11.InputType.Contract);
2692
2630
  }
2693
2631
  function getInputFromAssetId(inputs, assetId) {
2694
2632
  const coinInputs = getInputsCoin(inputs);
@@ -2707,40 +2645,40 @@ function getInputContractFromIndex(inputs, inputIndex) {
2707
2645
  if (!contractInput) {
2708
2646
  return void 0;
2709
2647
  }
2710
- if (contractInput.type !== import_transactions12.InputType.Contract) {
2711
- throw new import_errors10.FuelError(
2712
- import_errors10.ErrorCode.INVALID_TRANSACTION_INPUT,
2648
+ if (contractInput.type !== import_transactions11.InputType.Contract) {
2649
+ throw new import_errors9.FuelError(
2650
+ import_errors9.ErrorCode.INVALID_TRANSACTION_INPUT,
2713
2651
  `Contract input should be of type 'contract'.`
2714
2652
  );
2715
2653
  }
2716
2654
  return contractInput;
2717
2655
  }
2718
2656
  function getInputAccountAddress(input) {
2719
- if (input.type === import_transactions12.InputType.Coin) {
2657
+ if (input.type === import_transactions11.InputType.Coin) {
2720
2658
  return input.owner.toString();
2721
2659
  }
2722
- if (input.type === import_transactions12.InputType.Message) {
2660
+ if (input.type === import_transactions11.InputType.Message) {
2723
2661
  return input.recipient.toString();
2724
2662
  }
2725
2663
  return "";
2726
2664
  }
2727
2665
 
2728
2666
  // src/providers/transaction-summary/output.ts
2729
- var import_transactions13 = require("@fuel-ts/transactions");
2667
+ var import_transactions12 = require("@fuel-ts/transactions");
2730
2668
  function getOutputsByType(outputs, type) {
2731
2669
  return outputs.filter((o) => o.type === type);
2732
2670
  }
2733
2671
  function getOutputsContractCreated(outputs) {
2734
- return getOutputsByType(outputs, import_transactions13.OutputType.ContractCreated);
2672
+ return getOutputsByType(outputs, import_transactions12.OutputType.ContractCreated);
2735
2673
  }
2736
2674
  function getOutputsCoin(outputs) {
2737
- return getOutputsByType(outputs, import_transactions13.OutputType.Coin);
2675
+ return getOutputsByType(outputs, import_transactions12.OutputType.Coin);
2738
2676
  }
2739
2677
  function getOutputsChange(outputs) {
2740
- return getOutputsByType(outputs, import_transactions13.OutputType.Change);
2678
+ return getOutputsByType(outputs, import_transactions12.OutputType.Change);
2741
2679
  }
2742
2680
  function getOutputsContract(outputs) {
2743
- return getOutputsByType(outputs, import_transactions13.OutputType.Contract);
2681
+ return getOutputsByType(outputs, import_transactions12.OutputType.Contract);
2744
2682
  }
2745
2683
 
2746
2684
  // src/providers/transaction-summary/operations.ts
@@ -2749,15 +2687,15 @@ function getReceiptsByType(receipts, type) {
2749
2687
  }
2750
2688
  function getTransactionTypeName(transactionType) {
2751
2689
  switch (transactionType) {
2752
- case import_transactions14.TransactionType.Mint:
2690
+ case import_transactions13.TransactionType.Mint:
2753
2691
  return "Mint" /* Mint */;
2754
- case import_transactions14.TransactionType.Create:
2692
+ case import_transactions13.TransactionType.Create:
2755
2693
  return "Create" /* Create */;
2756
- case import_transactions14.TransactionType.Script:
2694
+ case import_transactions13.TransactionType.Script:
2757
2695
  return "Script" /* Script */;
2758
2696
  default:
2759
- throw new import_errors11.FuelError(
2760
- import_errors11.ErrorCode.INVALID_TRANSACTION_TYPE,
2697
+ throw new import_errors10.FuelError(
2698
+ import_errors10.ErrorCode.INVALID_TRANSACTION_TYPE,
2761
2699
  `Invalid transaction type: ${transactionType}.`
2762
2700
  );
2763
2701
  }
@@ -2776,10 +2714,10 @@ function isTypeScript(transactionType) {
2776
2714
  return isType(transactionType, "Script" /* Script */);
2777
2715
  }
2778
2716
  function getReceiptsCall(receipts) {
2779
- return getReceiptsByType(receipts, import_transactions14.ReceiptType.Call);
2717
+ return getReceiptsByType(receipts, import_transactions13.ReceiptType.Call);
2780
2718
  }
2781
2719
  function getReceiptsMessageOut(receipts) {
2782
- return getReceiptsByType(receipts, import_transactions14.ReceiptType.MessageOut);
2720
+ return getReceiptsByType(receipts, import_transactions13.ReceiptType.MessageOut);
2783
2721
  }
2784
2722
  var mergeAssets = (op1, op2) => {
2785
2723
  const assets1 = op1.assetsSent || [];
@@ -2792,7 +2730,7 @@ var mergeAssets = (op1, op2) => {
2792
2730
  if (!matchingAsset) {
2793
2731
  return asset1;
2794
2732
  }
2795
- const mergedAmount = (0, import_math13.bn)(asset1.amount).add(matchingAsset.amount);
2733
+ const mergedAmount = (0, import_math12.bn)(asset1.amount).add(matchingAsset.amount);
2796
2734
  return { ...asset1, amount: mergedAmount };
2797
2735
  });
2798
2736
  return mergedAssets.concat(filteredAssets);
@@ -2918,7 +2856,7 @@ function extractTransferOperationFromReceipt(receipt, contractInputs, changeOutp
2918
2856
  const { to: toAddress, assetId, amount } = receipt;
2919
2857
  let { from: fromAddress } = receipt;
2920
2858
  const toType = contractInputs.some((input) => input.contractID === toAddress) ? 0 /* contract */ : 1 /* account */;
2921
- if (import_configs11.ZeroBytes32 === fromAddress) {
2859
+ if (import_configs10.ZeroBytes32 === fromAddress) {
2922
2860
  const change = changeOutputs.find((output) => output.assetId === assetId);
2923
2861
  fromAddress = change?.to || fromAddress;
2924
2862
  }
@@ -2975,11 +2913,11 @@ function getTransferOperations({
2975
2913
  });
2976
2914
  const transferReceipts = getReceiptsByType(
2977
2915
  receipts,
2978
- import_transactions14.ReceiptType.Transfer
2916
+ import_transactions13.ReceiptType.Transfer
2979
2917
  );
2980
2918
  const transferOutReceipts = getReceiptsByType(
2981
2919
  receipts,
2982
- import_transactions14.ReceiptType.TransferOut
2920
+ import_transactions13.ReceiptType.TransferOut
2983
2921
  );
2984
2922
  [...transferReceipts, ...transferOutReceipts].forEach((receipt) => {
2985
2923
  const operation = extractTransferOperationFromReceipt(receipt, contractInputs, changeOutputs);
@@ -3064,17 +3002,17 @@ function getOperations({
3064
3002
  }
3065
3003
 
3066
3004
  // src/providers/transaction-summary/receipt.ts
3067
- var import_transactions15 = require("@fuel-ts/transactions");
3005
+ var import_transactions14 = require("@fuel-ts/transactions");
3068
3006
  var processGqlReceipt = (gqlReceipt) => {
3069
3007
  const receipt = assembleReceiptByType(gqlReceipt);
3070
3008
  switch (receipt.type) {
3071
- case import_transactions15.ReceiptType.ReturnData: {
3009
+ case import_transactions14.ReceiptType.ReturnData: {
3072
3010
  return {
3073
3011
  ...receipt,
3074
3012
  data: gqlReceipt.data || "0x"
3075
3013
  };
3076
3014
  }
3077
- case import_transactions15.ReceiptType.LogData: {
3015
+ case import_transactions14.ReceiptType.LogData: {
3078
3016
  return {
3079
3017
  ...receipt,
3080
3018
  data: gqlReceipt.data || "0x"
@@ -3087,7 +3025,7 @@ var processGqlReceipt = (gqlReceipt) => {
3087
3025
  var extractMintedAssetsFromReceipts = (receipts) => {
3088
3026
  const mintedAssets = [];
3089
3027
  receipts.forEach((receipt) => {
3090
- if (receipt.type === import_transactions15.ReceiptType.Mint) {
3028
+ if (receipt.type === import_transactions14.ReceiptType.Mint) {
3091
3029
  mintedAssets.push({
3092
3030
  subId: receipt.subId,
3093
3031
  contractId: receipt.contractId,
@@ -3101,7 +3039,7 @@ var extractMintedAssetsFromReceipts = (receipts) => {
3101
3039
  var extractBurnedAssetsFromReceipts = (receipts) => {
3102
3040
  const burnedAssets = [];
3103
3041
  receipts.forEach((receipt) => {
3104
- if (receipt.type === import_transactions15.ReceiptType.Burn) {
3042
+ if (receipt.type === import_transactions14.ReceiptType.Burn) {
3105
3043
  burnedAssets.push({
3106
3044
  subId: receipt.subId,
3107
3045
  contractId: receipt.contractId,
@@ -3114,7 +3052,7 @@ var extractBurnedAssetsFromReceipts = (receipts) => {
3114
3052
  };
3115
3053
 
3116
3054
  // src/providers/transaction-summary/status.ts
3117
- var import_errors12 = require("@fuel-ts/errors");
3055
+ var import_errors11 = require("@fuel-ts/errors");
3118
3056
  var getTransactionStatusName = (gqlStatus) => {
3119
3057
  switch (gqlStatus) {
3120
3058
  case "FailureStatus":
@@ -3126,8 +3064,8 @@ var getTransactionStatusName = (gqlStatus) => {
3126
3064
  case "SqueezedOutStatus":
3127
3065
  return "squeezedout" /* squeezedout */;
3128
3066
  default:
3129
- throw new import_errors12.FuelError(
3130
- import_errors12.ErrorCode.INVALID_TRANSACTION_STATUS,
3067
+ throw new import_errors11.FuelError(
3068
+ import_errors11.ErrorCode.INVALID_TRANSACTION_STATUS,
3131
3069
  `Invalid transaction status: ${gqlStatus}.`
3132
3070
  );
3133
3071
  }
@@ -3240,12 +3178,12 @@ function assembleTransactionSummary(params) {
3240
3178
 
3241
3179
  // src/providers/transaction-response/getDecodedLogs.ts
3242
3180
  var import_abi_coder3 = require("@fuel-ts/abi-coder");
3243
- var import_transactions16 = require("@fuel-ts/transactions");
3181
+ var import_transactions15 = require("@fuel-ts/transactions");
3244
3182
  function getDecodedLogs(receipts, mainAbi, externalAbis = {}) {
3245
3183
  return receipts.reduce((logs, receipt) => {
3246
- if (receipt.type === import_transactions16.ReceiptType.LogData || receipt.type === import_transactions16.ReceiptType.Log) {
3184
+ if (receipt.type === import_transactions15.ReceiptType.LogData || receipt.type === import_transactions15.ReceiptType.Log) {
3247
3185
  const interfaceToUse = new import_abi_coder3.Interface(externalAbis[receipt.id] || mainAbi);
3248
- const data = receipt.type === import_transactions16.ReceiptType.Log ? new import_abi_coder3.BigNumberCoder("u64").encode(receipt.val0) : receipt.data;
3186
+ const data = receipt.type === import_transactions15.ReceiptType.Log ? new import_abi_coder3.BigNumberCoder("u64").encode(receipt.val0) : receipt.data;
3249
3187
  const [decodedLog] = interfaceToUse.decodeLog(data, receipt.val1.toNumber());
3250
3188
  logs.push(decodedLog);
3251
3189
  }
@@ -3260,7 +3198,7 @@ var TransactionResponse = class {
3260
3198
  /** Current provider */
3261
3199
  provider;
3262
3200
  /** Gas used on the transaction */
3263
- gasUsed = (0, import_math14.bn)(0);
3201
+ gasUsed = (0, import_math13.bn)(0);
3264
3202
  /** The graphql Transaction with receipts object. */
3265
3203
  gqlTransaction;
3266
3204
  abis;
@@ -3318,7 +3256,7 @@ var TransactionResponse = class {
3318
3256
  * @returns The decoded transaction.
3319
3257
  */
3320
3258
  decodeTransaction(transactionWithReceipts) {
3321
- return new import_transactions17.TransactionCoder().decode(
3259
+ return new import_transactions16.TransactionCoder().decode(
3322
3260
  (0, import_utils21.arrayify)(transactionWithReceipts.rawPayload),
3323
3261
  0
3324
3262
  )?.[0];
@@ -3365,8 +3303,8 @@ var TransactionResponse = class {
3365
3303
  });
3366
3304
  for await (const { statusChange } of subscription) {
3367
3305
  if (statusChange.type === "SqueezedOutStatus") {
3368
- throw new import_errors13.FuelError(
3369
- import_errors13.ErrorCode.TRANSACTION_SQUEEZED_OUT,
3306
+ throw new import_errors12.FuelError(
3307
+ import_errors12.ErrorCode.TRANSACTION_SQUEEZED_OUT,
3370
3308
  `Transaction Squeezed Out with reason: ${statusChange.reason}`
3371
3309
  );
3372
3310
  }
@@ -3388,26 +3326,14 @@ var TransactionResponse = class {
3388
3326
  gqlTransaction: this.gqlTransaction,
3389
3327
  ...transactionSummary
3390
3328
  };
3391
- let logs = [];
3392
3329
  if (this.abis) {
3393
- logs = getDecodedLogs(
3330
+ const logs = getDecodedLogs(
3394
3331
  transactionSummary.receipts,
3395
3332
  this.abis.main,
3396
3333
  this.abis.otherContractsAbis
3397
3334
  );
3398
3335
  transactionResult.logs = logs;
3399
3336
  }
3400
- if (transactionResult.isStatusFailure) {
3401
- const {
3402
- receipts,
3403
- gqlTransaction: { status }
3404
- } = transactionResult;
3405
- throw extractTxError({
3406
- receipts,
3407
- status,
3408
- logs
3409
- });
3410
- }
3411
3337
  return transactionResult;
3412
3338
  }
3413
3339
  /**
@@ -3416,7 +3342,14 @@ var TransactionResponse = class {
3416
3342
  * @param contractsAbiMap - The contracts ABI map.
3417
3343
  */
3418
3344
  async wait(contractsAbiMap) {
3419
- return this.waitForResult(contractsAbiMap);
3345
+ const result = await this.waitForResult(contractsAbiMap);
3346
+ if (result.isStatusFailure) {
3347
+ throw new import_errors12.FuelError(
3348
+ import_errors12.ErrorCode.TRANSACTION_FAILED,
3349
+ `Transaction failed: ${result.gqlTransaction.status.reason}`
3350
+ );
3351
+ }
3352
+ return result;
3420
3353
  }
3421
3354
  };
3422
3355
 
@@ -3478,29 +3411,29 @@ var processGqlChain = (chain) => {
3478
3411
  const { contractParams, feeParams, predicateParams, scriptParams, txParams, gasCosts } = consensusParameters;
3479
3412
  return {
3480
3413
  name,
3481
- baseChainHeight: (0, import_math15.bn)(daHeight),
3414
+ baseChainHeight: (0, import_math14.bn)(daHeight),
3482
3415
  consensusParameters: {
3483
- contractMaxSize: (0, import_math15.bn)(contractParams.contractMaxSize),
3484
- maxInputs: (0, import_math15.bn)(txParams.maxInputs),
3485
- maxOutputs: (0, import_math15.bn)(txParams.maxOutputs),
3486
- maxWitnesses: (0, import_math15.bn)(txParams.maxWitnesses),
3487
- maxGasPerTx: (0, import_math15.bn)(txParams.maxGasPerTx),
3488
- maxScriptLength: (0, import_math15.bn)(scriptParams.maxScriptLength),
3489
- maxScriptDataLength: (0, import_math15.bn)(scriptParams.maxScriptDataLength),
3490
- maxStorageSlots: (0, import_math15.bn)(contractParams.maxStorageSlots),
3491
- maxPredicateLength: (0, import_math15.bn)(predicateParams.maxPredicateLength),
3492
- maxPredicateDataLength: (0, import_math15.bn)(predicateParams.maxPredicateDataLength),
3493
- maxGasPerPredicate: (0, import_math15.bn)(predicateParams.maxGasPerPredicate),
3494
- gasPriceFactor: (0, import_math15.bn)(feeParams.gasPriceFactor),
3495
- gasPerByte: (0, import_math15.bn)(feeParams.gasPerByte),
3496
- maxMessageDataLength: (0, import_math15.bn)(predicateParams.maxMessageDataLength),
3497
- chainId: (0, import_math15.bn)(consensusParameters.chainId),
3416
+ contractMaxSize: (0, import_math14.bn)(contractParams.contractMaxSize),
3417
+ maxInputs: (0, import_math14.bn)(txParams.maxInputs),
3418
+ maxOutputs: (0, import_math14.bn)(txParams.maxOutputs),
3419
+ maxWitnesses: (0, import_math14.bn)(txParams.maxWitnesses),
3420
+ maxGasPerTx: (0, import_math14.bn)(txParams.maxGasPerTx),
3421
+ maxScriptLength: (0, import_math14.bn)(scriptParams.maxScriptLength),
3422
+ maxScriptDataLength: (0, import_math14.bn)(scriptParams.maxScriptDataLength),
3423
+ maxStorageSlots: (0, import_math14.bn)(contractParams.maxStorageSlots),
3424
+ maxPredicateLength: (0, import_math14.bn)(predicateParams.maxPredicateLength),
3425
+ maxPredicateDataLength: (0, import_math14.bn)(predicateParams.maxPredicateDataLength),
3426
+ maxGasPerPredicate: (0, import_math14.bn)(predicateParams.maxGasPerPredicate),
3427
+ gasPriceFactor: (0, import_math14.bn)(feeParams.gasPriceFactor),
3428
+ gasPerByte: (0, import_math14.bn)(feeParams.gasPerByte),
3429
+ maxMessageDataLength: (0, import_math14.bn)(predicateParams.maxMessageDataLength),
3430
+ chainId: (0, import_math14.bn)(consensusParameters.chainId),
3498
3431
  gasCosts
3499
3432
  },
3500
3433
  gasCosts,
3501
3434
  latestBlock: {
3502
3435
  id: latestBlock.id,
3503
- height: (0, import_math15.bn)(latestBlock.header.height),
3436
+ height: (0, import_math14.bn)(latestBlock.header.height),
3504
3437
  time: latestBlock.header.time,
3505
3438
  transactions: latestBlock.transactions.map((i) => ({
3506
3439
  id: i.id
@@ -3570,8 +3503,8 @@ var _Provider = class {
3570
3503
  getChain() {
3571
3504
  const chain = _Provider.chainInfoCache[this.url];
3572
3505
  if (!chain) {
3573
- throw new import_errors14.FuelError(
3574
- import_errors14.ErrorCode.CHAIN_INFO_CACHE_EMPTY,
3506
+ throw new import_errors13.FuelError(
3507
+ import_errors13.ErrorCode.CHAIN_INFO_CACHE_EMPTY,
3575
3508
  "Chain info cache is empty. Make sure you have called `Provider.create` to initialize the provider."
3576
3509
  );
3577
3510
  }
@@ -3583,8 +3516,8 @@ var _Provider = class {
3583
3516
  getNode() {
3584
3517
  const node = _Provider.nodeInfoCache[this.url];
3585
3518
  if (!node) {
3586
- throw new import_errors14.FuelError(
3587
- import_errors14.ErrorCode.NODE_INFO_CACHE_EMPTY,
3519
+ throw new import_errors13.FuelError(
3520
+ import_errors13.ErrorCode.NODE_INFO_CACHE_EMPTY,
3588
3521
  "Node info cache is empty. Make sure you have called `Provider.create` to initialize the provider."
3589
3522
  );
3590
3523
  }
@@ -3631,8 +3564,8 @@ var _Provider = class {
3631
3564
  static ensureClientVersionIsSupported(nodeInfo) {
3632
3565
  const { isMajorSupported, isMinorSupported, supportedVersion } = (0, import_versions.checkFuelCoreVersionCompatibility)(nodeInfo.nodeVersion);
3633
3566
  if (!isMajorSupported || !isMinorSupported) {
3634
- throw new import_errors14.FuelError(
3635
- import_errors14.FuelError.CODES.UNSUPPORTED_FUEL_CLIENT_VERSION,
3567
+ throw new import_errors13.FuelError(
3568
+ import_errors13.FuelError.CODES.UNSUPPORTED_FUEL_CLIENT_VERSION,
3636
3569
  `Fuel client version: ${nodeInfo.nodeVersion}, Supported version: ${supportedVersion}`
3637
3570
  );
3638
3571
  }
@@ -3695,7 +3628,7 @@ var _Provider = class {
3695
3628
  */
3696
3629
  async getBlockNumber() {
3697
3630
  const { chain } = await this.operations.getChain();
3698
- return (0, import_math15.bn)(chain.latestBlock.header.height, 10);
3631
+ return (0, import_math14.bn)(chain.latestBlock.header.height, 10);
3699
3632
  }
3700
3633
  /**
3701
3634
  * Returns the chain information.
@@ -3705,9 +3638,9 @@ var _Provider = class {
3705
3638
  async fetchNode() {
3706
3639
  const { nodeInfo } = await this.operations.getNodeInfo();
3707
3640
  const processedNodeInfo = {
3708
- maxDepth: (0, import_math15.bn)(nodeInfo.maxDepth),
3709
- maxTx: (0, import_math15.bn)(nodeInfo.maxTx),
3710
- minGasPrice: (0, import_math15.bn)(nodeInfo.minGasPrice),
3641
+ maxDepth: (0, import_math14.bn)(nodeInfo.maxDepth),
3642
+ maxTx: (0, import_math14.bn)(nodeInfo.maxTx),
3643
+ minGasPrice: (0, import_math14.bn)(nodeInfo.minGasPrice),
3711
3644
  nodeVersion: nodeInfo.nodeVersion,
3712
3645
  utxoValidation: nodeInfo.utxoValidation,
3713
3646
  vmBacktrace: nodeInfo.vmBacktrace,
@@ -3753,17 +3686,17 @@ var _Provider = class {
3753
3686
  if (estimateTxDependencies) {
3754
3687
  await this.estimateTxDependencies(transactionRequest);
3755
3688
  }
3756
- const encodedTransaction = (0, import_utils23.hexlify)(transactionRequest.toTransactionBytes());
3689
+ const encodedTransaction = (0, import_utils22.hexlify)(transactionRequest.toTransactionBytes());
3757
3690
  let abis;
3758
- if (transactionRequest.type === import_transactions18.TransactionType.Script) {
3691
+ if (transactionRequest.type === import_transactions17.TransactionType.Script) {
3759
3692
  abis = transactionRequest.abis;
3760
3693
  }
3761
3694
  if (awaitExecution) {
3762
3695
  const subscription = this.operations.submitAndAwait({ encodedTransaction });
3763
3696
  for await (const { submitAndAwait } of subscription) {
3764
3697
  if (submitAndAwait.type === "SqueezedOutStatus") {
3765
- throw new import_errors14.FuelError(
3766
- import_errors14.ErrorCode.TRANSACTION_SQUEEZED_OUT,
3698
+ throw new import_errors13.FuelError(
3699
+ import_errors13.ErrorCode.TRANSACTION_SQUEEZED_OUT,
3767
3700
  `Transaction Squeezed Out with reason: ${submitAndAwait.reason}`
3768
3701
  );
3769
3702
  }
@@ -3796,7 +3729,7 @@ var _Provider = class {
3796
3729
  if (estimateTxDependencies) {
3797
3730
  return this.estimateTxDependencies(transactionRequest);
3798
3731
  }
3799
- const encodedTransaction = (0, import_utils23.hexlify)(transactionRequest.toTransactionBytes());
3732
+ const encodedTransaction = (0, import_utils22.hexlify)(transactionRequest.toTransactionBytes());
3800
3733
  const { dryRun: gqlReceipts } = await this.operations.dryRun({
3801
3734
  encodedTransaction,
3802
3735
  utxoValidation: utxoValidation || false
@@ -3815,13 +3748,13 @@ var _Provider = class {
3815
3748
  async estimatePredicates(transactionRequest) {
3816
3749
  const shouldEstimatePredicates = Boolean(
3817
3750
  transactionRequest.inputs.find(
3818
- (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()
3751
+ (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()
3819
3752
  )
3820
3753
  );
3821
3754
  if (!shouldEstimatePredicates) {
3822
3755
  return transactionRequest;
3823
3756
  }
3824
- const encodedTransaction = (0, import_utils23.hexlify)(transactionRequest.toTransactionBytes());
3757
+ const encodedTransaction = (0, import_utils22.hexlify)(transactionRequest.toTransactionBytes());
3825
3758
  const response = await this.operations.estimatePredicates({
3826
3759
  encodedTransaction
3827
3760
  });
@@ -3830,7 +3763,7 @@ var _Provider = class {
3830
3763
  } = response;
3831
3764
  if (inputs) {
3832
3765
  inputs.forEach((input, index) => {
3833
- if ("predicateGasUsed" in input && (0, import_math15.bn)(input.predicateGasUsed).gt(0)) {
3766
+ if ("predicateGasUsed" in input && (0, import_math14.bn)(input.predicateGasUsed).gt(0)) {
3834
3767
  transactionRequest.inputs[index].predicateGasUsed = input.predicateGasUsed;
3835
3768
  }
3836
3769
  });
@@ -3851,7 +3784,7 @@ var _Provider = class {
3851
3784
  * @returns A promise.
3852
3785
  */
3853
3786
  async estimateTxDependencies(transactionRequest) {
3854
- if (transactionRequest.type === import_transactions18.TransactionType.Create) {
3787
+ if (transactionRequest.type === import_transactions17.TransactionType.Create) {
3855
3788
  return {
3856
3789
  receipts: [],
3857
3790
  outputVariables: 0,
@@ -3864,7 +3797,7 @@ var _Provider = class {
3864
3797
  let outputVariables = 0;
3865
3798
  for (let attempt = 0; attempt < MAX_RETRIES; attempt++) {
3866
3799
  const { dryRun: gqlReceipts } = await this.operations.dryRun({
3867
- encodedTransaction: (0, import_utils23.hexlify)(transactionRequest.toTransactionBytes()),
3800
+ encodedTransaction: (0, import_utils22.hexlify)(transactionRequest.toTransactionBytes()),
3868
3801
  utxoValidation: false
3869
3802
  });
3870
3803
  receipts = gqlReceipts.map(processGqlReceipt);
@@ -3902,7 +3835,7 @@ var _Provider = class {
3902
3835
  if (estimateTxDependencies) {
3903
3836
  return this.estimateTxDependencies(transactionRequest);
3904
3837
  }
3905
- const encodedTransaction = (0, import_utils23.hexlify)(transactionRequest.toTransactionBytes());
3838
+ const encodedTransaction = (0, import_utils22.hexlify)(transactionRequest.toTransactionBytes());
3906
3839
  const { dryRun: gqlReceipts } = await this.operations.dryRun({
3907
3840
  encodedTransaction,
3908
3841
  utxoValidation: true
@@ -3936,14 +3869,14 @@ var _Provider = class {
3936
3869
  const txRequestClone = (0, import_ramda3.clone)(transactionRequestify(transactionRequestLike));
3937
3870
  const chainInfo = this.getChain();
3938
3871
  const { gasPriceFactor, minGasPrice, maxGasPerTx } = this.getGasConfig();
3939
- const gasPrice = (0, import_math15.max)(txRequestClone.gasPrice, minGasPrice);
3940
- const isScriptTransaction = txRequestClone.type === import_transactions18.TransactionType.Script;
3872
+ const gasPrice = (0, import_math14.max)(txRequestClone.gasPrice, minGasPrice);
3873
+ const isScriptTransaction = txRequestClone.type === import_transactions17.TransactionType.Script;
3941
3874
  const coinOutputsQuantities = txRequestClone.getCoinOutputsQuantities();
3942
3875
  const allQuantities = mergeQuantities(coinOutputsQuantities, forwardingQuantities);
3943
3876
  txRequestClone.fundWithFakeUtxos(allQuantities, resourcesOwner?.address);
3944
3877
  if (estimatePredicates) {
3945
3878
  if (isScriptTransaction) {
3946
- txRequestClone.gasLimit = (0, import_math15.bn)(0);
3879
+ txRequestClone.gasLimit = (0, import_math14.bn)(0);
3947
3880
  }
3948
3881
  if (resourcesOwner && "populateTransactionPredicateData" in resourcesOwner) {
3949
3882
  resourcesOwner.populateTransactionPredicateData(txRequestClone);
@@ -3959,8 +3892,8 @@ var _Provider = class {
3959
3892
  let missingContractIds = [];
3960
3893
  let outputVariables = 0;
3961
3894
  if (isScriptTransaction && estimateTxDependencies) {
3962
- txRequestClone.gasPrice = (0, import_math15.bn)(0);
3963
- txRequestClone.gasLimit = (0, import_math15.bn)(maxGasPerTx.sub(maxGas).toNumber() * 0.9);
3895
+ txRequestClone.gasPrice = (0, import_math14.bn)(0);
3896
+ txRequestClone.gasLimit = (0, import_math14.bn)(maxGasPerTx.sub(maxGas).toNumber() * 0.9);
3964
3897
  const result = await this.estimateTxDependencies(txRequestClone);
3965
3898
  receipts = result.receipts;
3966
3899
  outputVariables = result.outputVariables;
@@ -4016,17 +3949,17 @@ var _Provider = class {
4016
3949
  const result = await this.operations.getCoins({
4017
3950
  first: 10,
4018
3951
  ...paginationArgs,
4019
- filter: { owner: ownerAddress.toB256(), assetId: assetId && (0, import_utils23.hexlify)(assetId) }
3952
+ filter: { owner: ownerAddress.toB256(), assetId: assetId && (0, import_utils22.hexlify)(assetId) }
4020
3953
  });
4021
3954
  const coins = result.coins.edges.map((edge) => edge.node);
4022
3955
  return coins.map((coin) => ({
4023
3956
  id: coin.utxoId,
4024
3957
  assetId: coin.assetId,
4025
- amount: (0, import_math15.bn)(coin.amount),
3958
+ amount: (0, import_math14.bn)(coin.amount),
4026
3959
  owner: import_address3.Address.fromAddressOrString(coin.owner),
4027
- maturity: (0, import_math15.bn)(coin.maturity).toNumber(),
4028
- blockCreated: (0, import_math15.bn)(coin.blockCreated),
4029
- txCreatedIdx: (0, import_math15.bn)(coin.txCreatedIdx)
3960
+ maturity: (0, import_math14.bn)(coin.maturity).toNumber(),
3961
+ blockCreated: (0, import_math14.bn)(coin.blockCreated),
3962
+ txCreatedIdx: (0, import_math14.bn)(coin.txCreatedIdx)
4030
3963
  }));
4031
3964
  }
4032
3965
  /**
@@ -4040,19 +3973,19 @@ var _Provider = class {
4040
3973
  async getResourcesToSpend(owner, quantities, excludedIds) {
4041
3974
  const ownerAddress = import_address3.Address.fromAddressOrString(owner);
4042
3975
  const excludeInput = {
4043
- messages: excludedIds?.messages?.map((nonce) => (0, import_utils23.hexlify)(nonce)) || [],
4044
- utxos: excludedIds?.utxos?.map((id) => (0, import_utils23.hexlify)(id)) || []
3976
+ messages: excludedIds?.messages?.map((nonce) => (0, import_utils22.hexlify)(nonce)) || [],
3977
+ utxos: excludedIds?.utxos?.map((id) => (0, import_utils22.hexlify)(id)) || []
4045
3978
  };
4046
3979
  if (this.cache) {
4047
3980
  const uniqueUtxos = new Set(
4048
- excludeInput.utxos.concat(this.cache?.getActiveData().map((id) => (0, import_utils23.hexlify)(id)))
3981
+ excludeInput.utxos.concat(this.cache?.getActiveData().map((id) => (0, import_utils22.hexlify)(id)))
4049
3982
  );
4050
3983
  excludeInput.utxos = Array.from(uniqueUtxos);
4051
3984
  }
4052
3985
  const coinsQuery = {
4053
3986
  owner: ownerAddress.toB256(),
4054
3987
  queryPerAsset: quantities.map(coinQuantityfy).map(({ assetId, amount, max: maxPerAsset }) => ({
4055
- assetId: (0, import_utils23.hexlify)(assetId),
3988
+ assetId: (0, import_utils22.hexlify)(assetId),
4056
3989
  amount: amount.toString(10),
4057
3990
  max: maxPerAsset ? maxPerAsset.toString(10) : void 0
4058
3991
  })),
@@ -4063,9 +3996,9 @@ var _Provider = class {
4063
3996
  switch (coin.__typename) {
4064
3997
  case "MessageCoin":
4065
3998
  return {
4066
- amount: (0, import_math15.bn)(coin.amount),
3999
+ amount: (0, import_math14.bn)(coin.amount),
4067
4000
  assetId: coin.assetId,
4068
- daHeight: (0, import_math15.bn)(coin.daHeight),
4001
+ daHeight: (0, import_math14.bn)(coin.daHeight),
4069
4002
  sender: import_address3.Address.fromAddressOrString(coin.sender),
4070
4003
  recipient: import_address3.Address.fromAddressOrString(coin.recipient),
4071
4004
  nonce: coin.nonce
@@ -4073,12 +4006,12 @@ var _Provider = class {
4073
4006
  case "Coin":
4074
4007
  return {
4075
4008
  id: coin.utxoId,
4076
- amount: (0, import_math15.bn)(coin.amount),
4009
+ amount: (0, import_math14.bn)(coin.amount),
4077
4010
  assetId: coin.assetId,
4078
4011
  owner: import_address3.Address.fromAddressOrString(coin.owner),
4079
- maturity: (0, import_math15.bn)(coin.maturity).toNumber(),
4080
- blockCreated: (0, import_math15.bn)(coin.blockCreated),
4081
- txCreatedIdx: (0, import_math15.bn)(coin.txCreatedIdx)
4012
+ maturity: (0, import_math14.bn)(coin.maturity).toNumber(),
4013
+ blockCreated: (0, import_math14.bn)(coin.blockCreated),
4014
+ txCreatedIdx: (0, import_math14.bn)(coin.txCreatedIdx)
4082
4015
  };
4083
4016
  default:
4084
4017
  return null;
@@ -4095,13 +4028,13 @@ var _Provider = class {
4095
4028
  async getBlock(idOrHeight) {
4096
4029
  let variables;
4097
4030
  if (typeof idOrHeight === "number") {
4098
- variables = { height: (0, import_math15.bn)(idOrHeight).toString(10) };
4031
+ variables = { height: (0, import_math14.bn)(idOrHeight).toString(10) };
4099
4032
  } else if (idOrHeight === "latest") {
4100
4033
  variables = { height: (await this.getBlockNumber()).toString(10) };
4101
4034
  } else if (idOrHeight.length === 66) {
4102
4035
  variables = { blockId: idOrHeight };
4103
4036
  } else {
4104
- variables = { blockId: (0, import_math15.bn)(idOrHeight).toString(10) };
4037
+ variables = { blockId: (0, import_math14.bn)(idOrHeight).toString(10) };
4105
4038
  }
4106
4039
  const { block } = await this.operations.getBlock(variables);
4107
4040
  if (!block) {
@@ -4109,7 +4042,7 @@ var _Provider = class {
4109
4042
  }
4110
4043
  return {
4111
4044
  id: block.id,
4112
- height: (0, import_math15.bn)(block.header.height),
4045
+ height: (0, import_math14.bn)(block.header.height),
4113
4046
  time: block.header.time,
4114
4047
  transactionIds: block.transactions.map((tx) => tx.id)
4115
4048
  };
@@ -4124,7 +4057,7 @@ var _Provider = class {
4124
4057
  const { blocks: fetchedData } = await this.operations.getBlocks(params);
4125
4058
  const blocks = fetchedData.edges.map(({ node: block }) => ({
4126
4059
  id: block.id,
4127
- height: (0, import_math15.bn)(block.header.height),
4060
+ height: (0, import_math14.bn)(block.header.height),
4128
4061
  time: block.header.time,
4129
4062
  transactionIds: block.transactions.map((tx) => tx.id)
4130
4063
  }));
@@ -4139,7 +4072,7 @@ var _Provider = class {
4139
4072
  async getBlockWithTransactions(idOrHeight) {
4140
4073
  let variables;
4141
4074
  if (typeof idOrHeight === "number") {
4142
- variables = { blockHeight: (0, import_math15.bn)(idOrHeight).toString(10) };
4075
+ variables = { blockHeight: (0, import_math14.bn)(idOrHeight).toString(10) };
4143
4076
  } else if (idOrHeight === "latest") {
4144
4077
  variables = { blockHeight: (await this.getBlockNumber()).toString() };
4145
4078
  } else {
@@ -4151,11 +4084,11 @@ var _Provider = class {
4151
4084
  }
4152
4085
  return {
4153
4086
  id: block.id,
4154
- height: (0, import_math15.bn)(block.header.height, 10),
4087
+ height: (0, import_math14.bn)(block.header.height, 10),
4155
4088
  time: block.header.time,
4156
4089
  transactionIds: block.transactions.map((tx) => tx.id),
4157
4090
  transactions: block.transactions.map(
4158
- (tx) => new import_transactions18.TransactionCoder().decode((0, import_utils23.arrayify)(tx.rawPayload), 0)?.[0]
4091
+ (tx) => new import_transactions17.TransactionCoder().decode((0, import_utils22.arrayify)(tx.rawPayload), 0)?.[0]
4159
4092
  )
4160
4093
  };
4161
4094
  }
@@ -4170,8 +4103,8 @@ var _Provider = class {
4170
4103
  if (!transaction) {
4171
4104
  return null;
4172
4105
  }
4173
- return new import_transactions18.TransactionCoder().decode(
4174
- (0, import_utils23.arrayify)(transaction.rawPayload),
4106
+ return new import_transactions17.TransactionCoder().decode(
4107
+ (0, import_utils22.arrayify)(transaction.rawPayload),
4175
4108
  0
4176
4109
  )?.[0];
4177
4110
  }
@@ -4198,9 +4131,9 @@ var _Provider = class {
4198
4131
  async getContractBalance(contractId, assetId) {
4199
4132
  const { contractBalance } = await this.operations.getContractBalance({
4200
4133
  contract: import_address3.Address.fromAddressOrString(contractId).toB256(),
4201
- asset: (0, import_utils23.hexlify)(assetId)
4134
+ asset: (0, import_utils22.hexlify)(assetId)
4202
4135
  });
4203
- return (0, import_math15.bn)(contractBalance.amount, 10);
4136
+ return (0, import_math14.bn)(contractBalance.amount, 10);
4204
4137
  }
4205
4138
  /**
4206
4139
  * Returns the balance for the given owner for the given asset ID.
@@ -4212,9 +4145,9 @@ var _Provider = class {
4212
4145
  async getBalance(owner, assetId) {
4213
4146
  const { balance } = await this.operations.getBalance({
4214
4147
  owner: import_address3.Address.fromAddressOrString(owner).toB256(),
4215
- assetId: (0, import_utils23.hexlify)(assetId)
4148
+ assetId: (0, import_utils22.hexlify)(assetId)
4216
4149
  });
4217
- return (0, import_math15.bn)(balance.amount, 10);
4150
+ return (0, import_math14.bn)(balance.amount, 10);
4218
4151
  }
4219
4152
  /**
4220
4153
  * Returns balances for the given owner.
@@ -4232,7 +4165,7 @@ var _Provider = class {
4232
4165
  const balances = result.balances.edges.map((edge) => edge.node);
4233
4166
  return balances.map((balance) => ({
4234
4167
  assetId: balance.assetId,
4235
- amount: (0, import_math15.bn)(balance.amount)
4168
+ amount: (0, import_math14.bn)(balance.amount)
4236
4169
  }));
4237
4170
  }
4238
4171
  /**
@@ -4250,19 +4183,19 @@ var _Provider = class {
4250
4183
  });
4251
4184
  const messages = result.messages.edges.map((edge) => edge.node);
4252
4185
  return messages.map((message) => ({
4253
- messageId: import_transactions18.InputMessageCoder.getMessageId({
4186
+ messageId: import_transactions17.InputMessageCoder.getMessageId({
4254
4187
  sender: message.sender,
4255
4188
  recipient: message.recipient,
4256
4189
  nonce: message.nonce,
4257
- amount: (0, import_math15.bn)(message.amount),
4190
+ amount: (0, import_math14.bn)(message.amount),
4258
4191
  data: message.data
4259
4192
  }),
4260
4193
  sender: import_address3.Address.fromAddressOrString(message.sender),
4261
4194
  recipient: import_address3.Address.fromAddressOrString(message.recipient),
4262
4195
  nonce: message.nonce,
4263
- amount: (0, import_math15.bn)(message.amount),
4264
- data: import_transactions18.InputMessageCoder.decodeData(message.data),
4265
- daHeight: (0, import_math15.bn)(message.daHeight)
4196
+ amount: (0, import_math14.bn)(message.amount),
4197
+ data: import_transactions17.InputMessageCoder.decodeData(message.data),
4198
+ daHeight: (0, import_math14.bn)(message.daHeight)
4266
4199
  }));
4267
4200
  }
4268
4201
  /**
@@ -4280,8 +4213,8 @@ var _Provider = class {
4280
4213
  nonce
4281
4214
  };
4282
4215
  if (commitBlockId && commitBlockHeight) {
4283
- throw new import_errors14.FuelError(
4284
- import_errors14.ErrorCode.INVALID_INPUT_PARAMETERS,
4216
+ throw new import_errors13.FuelError(
4217
+ import_errors13.ErrorCode.INVALID_INPUT_PARAMETERS,
4285
4218
  "commitBlockId and commitBlockHeight cannot be used together"
4286
4219
  );
4287
4220
  }
@@ -4315,41 +4248,41 @@ var _Provider = class {
4315
4248
  } = result.messageProof;
4316
4249
  return {
4317
4250
  messageProof: {
4318
- proofIndex: (0, import_math15.bn)(messageProof.proofIndex),
4251
+ proofIndex: (0, import_math14.bn)(messageProof.proofIndex),
4319
4252
  proofSet: messageProof.proofSet
4320
4253
  },
4321
4254
  blockProof: {
4322
- proofIndex: (0, import_math15.bn)(blockProof.proofIndex),
4255
+ proofIndex: (0, import_math14.bn)(blockProof.proofIndex),
4323
4256
  proofSet: blockProof.proofSet
4324
4257
  },
4325
4258
  messageBlockHeader: {
4326
4259
  id: messageBlockHeader.id,
4327
- daHeight: (0, import_math15.bn)(messageBlockHeader.daHeight),
4328
- transactionsCount: (0, import_math15.bn)(messageBlockHeader.transactionsCount),
4260
+ daHeight: (0, import_math14.bn)(messageBlockHeader.daHeight),
4261
+ transactionsCount: (0, import_math14.bn)(messageBlockHeader.transactionsCount),
4329
4262
  transactionsRoot: messageBlockHeader.transactionsRoot,
4330
- height: (0, import_math15.bn)(messageBlockHeader.height),
4263
+ height: (0, import_math14.bn)(messageBlockHeader.height),
4331
4264
  prevRoot: messageBlockHeader.prevRoot,
4332
4265
  time: messageBlockHeader.time,
4333
4266
  applicationHash: messageBlockHeader.applicationHash,
4334
4267
  messageReceiptRoot: messageBlockHeader.messageReceiptRoot,
4335
- messageReceiptCount: (0, import_math15.bn)(messageBlockHeader.messageReceiptCount)
4268
+ messageReceiptCount: (0, import_math14.bn)(messageBlockHeader.messageReceiptCount)
4336
4269
  },
4337
4270
  commitBlockHeader: {
4338
4271
  id: commitBlockHeader.id,
4339
- daHeight: (0, import_math15.bn)(commitBlockHeader.daHeight),
4340
- transactionsCount: (0, import_math15.bn)(commitBlockHeader.transactionsCount),
4272
+ daHeight: (0, import_math14.bn)(commitBlockHeader.daHeight),
4273
+ transactionsCount: (0, import_math14.bn)(commitBlockHeader.transactionsCount),
4341
4274
  transactionsRoot: commitBlockHeader.transactionsRoot,
4342
- height: (0, import_math15.bn)(commitBlockHeader.height),
4275
+ height: (0, import_math14.bn)(commitBlockHeader.height),
4343
4276
  prevRoot: commitBlockHeader.prevRoot,
4344
4277
  time: commitBlockHeader.time,
4345
4278
  applicationHash: commitBlockHeader.applicationHash,
4346
4279
  messageReceiptRoot: commitBlockHeader.messageReceiptRoot,
4347
- messageReceiptCount: (0, import_math15.bn)(commitBlockHeader.messageReceiptCount)
4280
+ messageReceiptCount: (0, import_math14.bn)(commitBlockHeader.messageReceiptCount)
4348
4281
  },
4349
4282
  sender: import_address3.Address.fromAddressOrString(sender),
4350
4283
  recipient: import_address3.Address.fromAddressOrString(recipient),
4351
4284
  nonce,
4352
- amount: (0, import_math15.bn)(amount),
4285
+ amount: (0, import_math14.bn)(amount),
4353
4286
  data
4354
4287
  };
4355
4288
  }
@@ -4372,10 +4305,10 @@ var _Provider = class {
4372
4305
  */
4373
4306
  async produceBlocks(amount, startTime) {
4374
4307
  const { produceBlocks: latestBlockHeight } = await this.operations.produceBlocks({
4375
- blocksToProduce: (0, import_math15.bn)(amount).toString(10),
4376
- startTimestamp: startTime ? import_utils23.DateTime.fromUnixMilliseconds(startTime).toTai64() : void 0
4308
+ blocksToProduce: (0, import_math14.bn)(amount).toString(10),
4309
+ startTimestamp: startTime ? import_utils22.DateTime.fromUnixMilliseconds(startTime).toTai64() : void 0
4377
4310
  });
4378
- return (0, import_math15.bn)(latestBlockHeight);
4311
+ return (0, import_math14.bn)(latestBlockHeight);
4379
4312
  }
4380
4313
  // eslint-disable-next-line @typescript-eslint/require-await
4381
4314
  async getTransactionResponse(transactionId) {
@@ -4389,7 +4322,7 @@ cacheInputs_fn = function(inputs) {
4389
4322
  return;
4390
4323
  }
4391
4324
  inputs.forEach((input) => {
4392
- if (input.type === import_transactions18.InputType.Coin) {
4325
+ if (input.type === import_transactions17.InputType.Coin) {
4393
4326
  this.cache?.set(input.id);
4394
4327
  }
4395
4328
  });
@@ -4398,10 +4331,10 @@ __publicField(Provider, "chainInfoCache", {});
4398
4331
  __publicField(Provider, "nodeInfoCache", {});
4399
4332
 
4400
4333
  // src/providers/transaction-summary/get-transaction-summary.ts
4401
- var import_errors15 = require("@fuel-ts/errors");
4402
- var import_math16 = require("@fuel-ts/math");
4403
- var import_transactions19 = require("@fuel-ts/transactions");
4404
- var import_utils26 = require("@fuel-ts/utils");
4334
+ var import_errors14 = require("@fuel-ts/errors");
4335
+ var import_math15 = require("@fuel-ts/math");
4336
+ var import_transactions18 = require("@fuel-ts/transactions");
4337
+ var import_utils25 = require("@fuel-ts/utils");
4405
4338
 
4406
4339
  // src/providers/chains.ts
4407
4340
  var CHAIN_IDS = {
@@ -4450,17 +4383,17 @@ var assets = [
4450
4383
 
4451
4384
  // src/utils/formatTransferToContractScriptData.ts
4452
4385
  var import_abi_coder4 = require("@fuel-ts/abi-coder");
4453
- var import_math17 = require("@fuel-ts/math");
4454
- var import_utils27 = require("@fuel-ts/utils");
4386
+ var import_math16 = require("@fuel-ts/math");
4387
+ var import_utils26 = require("@fuel-ts/utils");
4455
4388
  var asm = __toESM(require("@fuels/vm-asm"));
4456
4389
  var formatTransferToContractScriptData = (params) => {
4457
4390
  const { assetId, amountToTransfer, hexlifiedContractId } = params;
4458
4391
  const numberCoder = new import_abi_coder4.BigNumberCoder("u64");
4459
- const encoded = numberCoder.encode(new import_math17.BN(amountToTransfer).toNumber());
4392
+ const encoded = numberCoder.encode(new import_math16.BN(amountToTransfer).toNumber());
4460
4393
  const scriptData = Uint8Array.from([
4461
- ...(0, import_utils27.arrayify)(hexlifiedContractId),
4394
+ ...(0, import_utils26.arrayify)(hexlifiedContractId),
4462
4395
  ...encoded,
4463
- ...(0, import_utils27.arrayify)(assetId)
4396
+ ...(0, import_utils26.arrayify)(assetId)
4464
4397
  ]);
4465
4398
  return scriptData;
4466
4399
  };
@@ -4516,7 +4449,7 @@ var Account = class extends import_interfaces.AbstractAccount {
4516
4449
  */
4517
4450
  get provider() {
4518
4451
  if (!this._provider) {
4519
- throw new import_errors16.FuelError(import_errors16.ErrorCode.MISSING_PROVIDER, "Provider not set");
4452
+ throw new import_errors15.FuelError(import_errors15.ErrorCode.MISSING_PROVIDER, "Provider not set");
4520
4453
  }
4521
4454
  return this._provider;
4522
4455
  }
@@ -4568,8 +4501,8 @@ var Account = class extends import_interfaces.AbstractAccount {
4568
4501
  if (!hasNextPage) {
4569
4502
  break;
4570
4503
  }
4571
- throw new import_errors16.FuelError(
4572
- import_errors16.ErrorCode.NOT_SUPPORTED,
4504
+ throw new import_errors15.FuelError(
4505
+ import_errors15.ErrorCode.NOT_SUPPORTED,
4573
4506
  `Wallets containing more than ${pageSize} coins exceed the current supported limit.`
4574
4507
  );
4575
4508
  }
@@ -4594,8 +4527,8 @@ var Account = class extends import_interfaces.AbstractAccount {
4594
4527
  if (!hasNextPage) {
4595
4528
  break;
4596
4529
  }
4597
- throw new import_errors16.FuelError(
4598
- import_errors16.ErrorCode.NOT_SUPPORTED,
4530
+ throw new import_errors15.FuelError(
4531
+ import_errors15.ErrorCode.NOT_SUPPORTED,
4599
4532
  `Wallets containing more than ${pageSize} messages exceed the current supported limit.`
4600
4533
  );
4601
4534
  }
@@ -4607,7 +4540,7 @@ var Account = class extends import_interfaces.AbstractAccount {
4607
4540
  * @param assetId - The asset ID to check the balance for.
4608
4541
  * @returns A promise that resolves to the balance amount.
4609
4542
  */
4610
- async getBalance(assetId = import_configs12.BaseAssetId) {
4543
+ async getBalance(assetId = import_configs11.BaseAssetId) {
4611
4544
  const amount = await this.provider.getBalance(this.address, assetId);
4612
4545
  return amount;
4613
4546
  }
@@ -4630,8 +4563,8 @@ var Account = class extends import_interfaces.AbstractAccount {
4630
4563
  if (!hasNextPage) {
4631
4564
  break;
4632
4565
  }
4633
- throw new import_errors16.FuelError(
4634
- import_errors16.ErrorCode.NOT_SUPPORTED,
4566
+ throw new import_errors15.FuelError(
4567
+ import_errors15.ErrorCode.NOT_SUPPORTED,
4635
4568
  `Wallets containing more than ${pageSize} balances exceed the current supported limit.`
4636
4569
  );
4637
4570
  }
@@ -4647,15 +4580,15 @@ var Account = class extends import_interfaces.AbstractAccount {
4647
4580
  */
4648
4581
  async fund(request, coinQuantities, fee) {
4649
4582
  const updatedQuantities = addAmountToAsset({
4650
- amount: (0, import_math18.bn)(fee),
4651
- assetId: import_configs12.BaseAssetId,
4583
+ amount: (0, import_math17.bn)(fee),
4584
+ assetId: import_configs11.BaseAssetId,
4652
4585
  coinQuantities
4653
4586
  });
4654
4587
  const quantitiesDict = {};
4655
4588
  updatedQuantities.forEach(({ amount, assetId }) => {
4656
4589
  quantitiesDict[assetId] = {
4657
4590
  required: amount,
4658
- owned: (0, import_math18.bn)(0)
4591
+ owned: (0, import_math17.bn)(0)
4659
4592
  };
4660
4593
  });
4661
4594
  const cachedUtxos = [];
@@ -4668,12 +4601,12 @@ var Account = class extends import_interfaces.AbstractAccount {
4668
4601
  if (isCoin2) {
4669
4602
  const assetId = String(input.assetId);
4670
4603
  if (input.owner === owner && quantitiesDict[assetId]) {
4671
- const amount = (0, import_math18.bn)(input.amount);
4604
+ const amount = (0, import_math17.bn)(input.amount);
4672
4605
  quantitiesDict[assetId].owned = quantitiesDict[assetId].owned.add(amount);
4673
4606
  cachedUtxos.push(input.id);
4674
4607
  }
4675
- } else if (input.recipient === owner && input.amount && quantitiesDict[import_configs12.BaseAssetId]) {
4676
- quantitiesDict[import_configs12.BaseAssetId].owned = quantitiesDict[import_configs12.BaseAssetId].owned.add(input.amount);
4608
+ } else if (input.recipient === owner && input.amount && quantitiesDict[import_configs11.BaseAssetId]) {
4609
+ quantitiesDict[import_configs11.BaseAssetId].owned = quantitiesDict[import_configs11.BaseAssetId].owned.add(input.amount);
4677
4610
  cachedMessages.push(input.nonce);
4678
4611
  }
4679
4612
  }
@@ -4705,7 +4638,7 @@ var Account = class extends import_interfaces.AbstractAccount {
4705
4638
  * @param txParams - The transaction parameters (gasLimit, gasPrice, maturity).
4706
4639
  * @returns A promise that resolves to the prepared transaction request.
4707
4640
  */
4708
- async createTransfer(destination, amount, assetId = import_configs12.BaseAssetId, txParams = {}) {
4641
+ async createTransfer(destination, amount, assetId = import_configs11.BaseAssetId, txParams = {}) {
4709
4642
  const { minGasPrice } = this.provider.getGasConfig();
4710
4643
  const params = { gasPrice: minGasPrice, ...txParams };
4711
4644
  const request = new ScriptTransactionRequest(params);
@@ -4714,8 +4647,8 @@ var Account = class extends import_interfaces.AbstractAccount {
4714
4647
  estimateTxDependencies: true,
4715
4648
  resourcesOwner: this
4716
4649
  });
4717
- request.gasPrice = (0, import_math18.bn)(txParams.gasPrice ?? minGasPrice);
4718
- request.gasLimit = (0, import_math18.bn)(txParams.gasLimit ?? gasUsed);
4650
+ request.gasPrice = (0, import_math17.bn)(txParams.gasPrice ?? minGasPrice);
4651
+ request.gasLimit = (0, import_math17.bn)(txParams.gasLimit ?? gasUsed);
4719
4652
  this.validateGas({
4720
4653
  gasUsed,
4721
4654
  gasPrice: request.gasPrice,
@@ -4735,10 +4668,10 @@ var Account = class extends import_interfaces.AbstractAccount {
4735
4668
  * @param txParams - The transaction parameters (gasLimit, gasPrice, maturity).
4736
4669
  * @returns A promise that resolves to the transaction response.
4737
4670
  */
4738
- async transfer(destination, amount, assetId = import_configs12.BaseAssetId, txParams = {}) {
4739
- if ((0, import_math18.bn)(amount).lte(0)) {
4740
- throw new import_errors16.FuelError(
4741
- import_errors16.ErrorCode.INVALID_TRANSFER_AMOUNT,
4671
+ async transfer(destination, amount, assetId = import_configs11.BaseAssetId, txParams = {}) {
4672
+ if ((0, import_math17.bn)(amount).lte(0)) {
4673
+ throw new import_errors15.FuelError(
4674
+ import_errors15.ErrorCode.INVALID_TRANSFER_AMOUNT,
4742
4675
  "Transfer amount must be a positive number."
4743
4676
  );
4744
4677
  }
@@ -4754,10 +4687,10 @@ var Account = class extends import_interfaces.AbstractAccount {
4754
4687
  * @param txParams - The optional transaction parameters.
4755
4688
  * @returns A promise that resolves to the transaction response.
4756
4689
  */
4757
- async transferToContract(contractId, amount, assetId = import_configs12.BaseAssetId, txParams = {}) {
4758
- if ((0, import_math18.bn)(amount).lte(0)) {
4759
- throw new import_errors16.FuelError(
4760
- import_errors16.ErrorCode.INVALID_TRANSFER_AMOUNT,
4690
+ async transferToContract(contractId, amount, assetId = import_configs11.BaseAssetId, txParams = {}) {
4691
+ if ((0, import_math17.bn)(amount).lte(0)) {
4692
+ throw new import_errors15.FuelError(
4693
+ import_errors15.ErrorCode.INVALID_TRANSFER_AMOUNT,
4761
4694
  "Transfer amount must be a positive number."
4762
4695
  );
4763
4696
  }
@@ -4766,7 +4699,7 @@ var Account = class extends import_interfaces.AbstractAccount {
4766
4699
  const params = { gasPrice: minGasPrice, ...txParams };
4767
4700
  const { script, scriptData } = await assembleTransferToContractScript({
4768
4701
  hexlifiedContractId: contractAddress.toB256(),
4769
- amountToTransfer: (0, import_math18.bn)(amount),
4702
+ amountToTransfer: (0, import_math17.bn)(amount),
4770
4703
  assetId
4771
4704
  });
4772
4705
  const request = new ScriptTransactionRequest({
@@ -4777,9 +4710,9 @@ var Account = class extends import_interfaces.AbstractAccount {
4777
4710
  request.addContractInputAndOutput(contractAddress);
4778
4711
  const { maxFee, requiredQuantities, gasUsed } = await this.provider.getTransactionCost(
4779
4712
  request,
4780
- [{ amount: (0, import_math18.bn)(amount), assetId: String(assetId) }]
4713
+ [{ amount: (0, import_math17.bn)(amount), assetId: String(assetId) }]
4781
4714
  );
4782
- request.gasLimit = (0, import_math18.bn)(params.gasLimit ?? gasUsed);
4715
+ request.gasLimit = (0, import_math17.bn)(params.gasLimit ?? gasUsed);
4783
4716
  this.validateGas({
4784
4717
  gasUsed,
4785
4718
  gasPrice: request.gasPrice,
@@ -4800,25 +4733,25 @@ var Account = class extends import_interfaces.AbstractAccount {
4800
4733
  async withdrawToBaseLayer(recipient, amount, txParams = {}) {
4801
4734
  const { minGasPrice } = this.provider.getGasConfig();
4802
4735
  const recipientAddress = import_address4.Address.fromAddressOrString(recipient);
4803
- const recipientDataArray = (0, import_utils28.arrayify)(
4736
+ const recipientDataArray = (0, import_utils27.arrayify)(
4804
4737
  "0x".concat(recipientAddress.toHexString().substring(2).padStart(64, "0"))
4805
4738
  );
4806
- const amountDataArray = (0, import_utils28.arrayify)(
4807
- "0x".concat((0, import_math18.bn)(amount).toHex().substring(2).padStart(16, "0"))
4739
+ const amountDataArray = (0, import_utils27.arrayify)(
4740
+ "0x".concat((0, import_math17.bn)(amount).toHex().substring(2).padStart(16, "0"))
4808
4741
  );
4809
4742
  const script = new Uint8Array([
4810
- ...(0, import_utils28.arrayify)(withdrawScript.bytes),
4743
+ ...(0, import_utils27.arrayify)(withdrawScript.bytes),
4811
4744
  ...recipientDataArray,
4812
4745
  ...amountDataArray
4813
4746
  ]);
4814
4747
  const params = { script, gasPrice: minGasPrice, ...txParams };
4815
4748
  const request = new ScriptTransactionRequest(params);
4816
- const forwardingQuantities = [{ amount: (0, import_math18.bn)(amount), assetId: import_configs12.BaseAssetId }];
4749
+ const forwardingQuantities = [{ amount: (0, import_math17.bn)(amount), assetId: import_configs11.BaseAssetId }];
4817
4750
  const { requiredQuantities, maxFee, gasUsed } = await this.provider.getTransactionCost(
4818
4751
  request,
4819
4752
  forwardingQuantities
4820
4753
  );
4821
- request.gasLimit = (0, import_math18.bn)(params.gasLimit ?? gasUsed);
4754
+ request.gasLimit = (0, import_math17.bn)(params.gasLimit ?? gasUsed);
4822
4755
  this.validateGas({
4823
4756
  gasUsed,
4824
4757
  gasPrice: request.gasPrice,
@@ -4830,7 +4763,7 @@ var Account = class extends import_interfaces.AbstractAccount {
4830
4763
  }
4831
4764
  async signMessage(message) {
4832
4765
  if (!this._connector) {
4833
- throw new import_errors16.FuelError(import_errors16.ErrorCode.MISSING_CONNECTOR, "A connector is required to sign messages.");
4766
+ throw new import_errors15.FuelError(import_errors15.ErrorCode.MISSING_CONNECTOR, "A connector is required to sign messages.");
4834
4767
  }
4835
4768
  return this._connector.signMessage(this.address.toString(), message);
4836
4769
  }
@@ -4842,8 +4775,8 @@ var Account = class extends import_interfaces.AbstractAccount {
4842
4775
  */
4843
4776
  async signTransaction(transactionRequestLike) {
4844
4777
  if (!this._connector) {
4845
- throw new import_errors16.FuelError(
4846
- import_errors16.ErrorCode.MISSING_CONNECTOR,
4778
+ throw new import_errors15.FuelError(
4779
+ import_errors15.ErrorCode.MISSING_CONNECTOR,
4847
4780
  "A connector is required to sign transactions."
4848
4781
  );
4849
4782
  }
@@ -4890,14 +4823,14 @@ var Account = class extends import_interfaces.AbstractAccount {
4890
4823
  minGasPrice
4891
4824
  }) {
4892
4825
  if (minGasPrice.gt(gasPrice)) {
4893
- throw new import_errors16.FuelError(
4894
- import_errors16.ErrorCode.GAS_PRICE_TOO_LOW,
4826
+ throw new import_errors15.FuelError(
4827
+ import_errors15.ErrorCode.GAS_PRICE_TOO_LOW,
4895
4828
  `Gas price '${gasPrice}' is lower than the required: '${minGasPrice}'.`
4896
4829
  );
4897
4830
  }
4898
4831
  if (gasUsed.gt(gasLimit)) {
4899
- throw new import_errors16.FuelError(
4900
- import_errors16.ErrorCode.GAS_LIMIT_TOO_LOW,
4832
+ throw new import_errors15.FuelError(
4833
+ import_errors15.ErrorCode.GAS_LIMIT_TOO_LOW,
4901
4834
  `Gas limit '${gasLimit}' is lower than the required: '${gasUsed}'.`
4902
4835
  );
4903
4836
  }
@@ -4908,8 +4841,8 @@ var Account = class extends import_interfaces.AbstractAccount {
4908
4841
  var import_address5 = require("@fuel-ts/address");
4909
4842
  var import_crypto = require("@fuel-ts/crypto");
4910
4843
  var import_hasher2 = require("@fuel-ts/hasher");
4911
- var import_math19 = require("@fuel-ts/math");
4912
- var import_utils29 = require("@fuel-ts/utils");
4844
+ var import_math18 = require("@fuel-ts/math");
4845
+ var import_utils28 = require("@fuel-ts/utils");
4913
4846
  var import_secp256k1 = require("@noble/curves/secp256k1");
4914
4847
  var Signer = class {
4915
4848
  address;
@@ -4928,10 +4861,10 @@ var Signer = class {
4928
4861
  privateKey = `0x${privateKey}`;
4929
4862
  }
4930
4863
  }
4931
- const privateKeyBytes = (0, import_math19.toBytes)(privateKey, 32);
4932
- this.privateKey = (0, import_utils29.hexlify)(privateKeyBytes);
4933
- this.publicKey = (0, import_utils29.hexlify)(import_secp256k1.secp256k1.getPublicKey(privateKeyBytes, false).slice(1));
4934
- this.compressedPublicKey = (0, import_utils29.hexlify)(import_secp256k1.secp256k1.getPublicKey(privateKeyBytes, true));
4864
+ const privateKeyBytes = (0, import_math18.toBytes)(privateKey, 32);
4865
+ this.privateKey = (0, import_utils28.hexlify)(privateKeyBytes);
4866
+ this.publicKey = (0, import_utils28.hexlify)(import_secp256k1.secp256k1.getPublicKey(privateKeyBytes, false).slice(1));
4867
+ this.compressedPublicKey = (0, import_utils28.hexlify)(import_secp256k1.secp256k1.getPublicKey(privateKeyBytes, true));
4935
4868
  this.address = import_address5.Address.fromPublicKey(this.publicKey);
4936
4869
  }
4937
4870
  /**
@@ -4945,11 +4878,11 @@ var Signer = class {
4945
4878
  * @returns hashed signature
4946
4879
  */
4947
4880
  sign(data) {
4948
- const signature = import_secp256k1.secp256k1.sign((0, import_utils29.arrayify)(data), (0, import_utils29.arrayify)(this.privateKey));
4949
- const r = (0, import_math19.toBytes)(`0x${signature.r.toString(16)}`, 32);
4950
- const s = (0, import_math19.toBytes)(`0x${signature.s.toString(16)}`, 32);
4881
+ const signature = import_secp256k1.secp256k1.sign((0, import_utils28.arrayify)(data), (0, import_utils28.arrayify)(this.privateKey));
4882
+ const r = (0, import_math18.toBytes)(`0x${signature.r.toString(16)}`, 32);
4883
+ const s = (0, import_math18.toBytes)(`0x${signature.s.toString(16)}`, 32);
4951
4884
  s[0] |= (signature.recovery || 0) << 7;
4952
- return (0, import_utils29.hexlify)((0, import_utils29.concat)([r, s]));
4885
+ return (0, import_utils28.hexlify)((0, import_utils28.concat)([r, s]));
4953
4886
  }
4954
4887
  /**
4955
4888
  * Add point on the current elliptic curve
@@ -4958,8 +4891,8 @@ var Signer = class {
4958
4891
  * @returns compressed point on the curve
4959
4892
  */
4960
4893
  addPoint(point) {
4961
- const p0 = import_secp256k1.secp256k1.ProjectivePoint.fromHex((0, import_utils29.arrayify)(this.compressedPublicKey));
4962
- const p1 = import_secp256k1.secp256k1.ProjectivePoint.fromHex((0, import_utils29.arrayify)(point));
4894
+ const p0 = import_secp256k1.secp256k1.ProjectivePoint.fromHex((0, import_utils28.arrayify)(this.compressedPublicKey));
4895
+ const p1 = import_secp256k1.secp256k1.ProjectivePoint.fromHex((0, import_utils28.arrayify)(point));
4963
4896
  const result = p0.add(p1);
4964
4897
  return `0x${result.toHex(true)}`;
4965
4898
  }
@@ -4971,16 +4904,16 @@ var Signer = class {
4971
4904
  * @returns public key from signature from the
4972
4905
  */
4973
4906
  static recoverPublicKey(data, signature) {
4974
- const signedMessageBytes = (0, import_utils29.arrayify)(signature);
4907
+ const signedMessageBytes = (0, import_utils28.arrayify)(signature);
4975
4908
  const r = signedMessageBytes.slice(0, 32);
4976
4909
  const s = signedMessageBytes.slice(32, 64);
4977
4910
  const recoveryParam = (s[0] & 128) >> 7;
4978
4911
  s[0] &= 127;
4979
- const sig = new import_secp256k1.secp256k1.Signature(BigInt((0, import_utils29.hexlify)(r)), BigInt((0, import_utils29.hexlify)(s))).addRecoveryBit(
4912
+ const sig = new import_secp256k1.secp256k1.Signature(BigInt((0, import_utils28.hexlify)(r)), BigInt((0, import_utils28.hexlify)(s))).addRecoveryBit(
4980
4913
  recoveryParam
4981
4914
  );
4982
- const publicKey = sig.recoverPublicKey((0, import_utils29.arrayify)(data)).toRawBytes(false).slice(1);
4983
- return (0, import_utils29.hexlify)(publicKey);
4915
+ const publicKey = sig.recoverPublicKey((0, import_utils28.arrayify)(data)).toRawBytes(false).slice(1);
4916
+ return (0, import_utils28.hexlify)(publicKey);
4984
4917
  }
4985
4918
  /**
4986
4919
  * Recover the address from a signature performed with [`sign`](#sign).
@@ -4999,7 +4932,7 @@ var Signer = class {
4999
4932
  * @returns random 32-byte hashed
5000
4933
  */
5001
4934
  static generatePrivateKey(entropy) {
5002
- 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);
4935
+ 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);
5003
4936
  }
5004
4937
  /**
5005
4938
  * Extended publicKey from a compact publicKey
@@ -5008,16 +4941,16 @@ var Signer = class {
5008
4941
  * @returns extended publicKey
5009
4942
  */
5010
4943
  static extendPublicKey(publicKey) {
5011
- const point = import_secp256k1.secp256k1.ProjectivePoint.fromHex((0, import_utils29.arrayify)(publicKey));
5012
- return (0, import_utils29.hexlify)(point.toRawBytes(false).slice(1));
4944
+ const point = import_secp256k1.secp256k1.ProjectivePoint.fromHex((0, import_utils28.arrayify)(publicKey));
4945
+ return (0, import_utils28.hexlify)(point.toRawBytes(false).slice(1));
5013
4946
  }
5014
4947
  };
5015
4948
 
5016
4949
  // src/wallet/keystore-wallet.ts
5017
4950
  var import_address6 = require("@fuel-ts/address");
5018
4951
  var import_crypto2 = require("@fuel-ts/crypto");
5019
- var import_errors17 = require("@fuel-ts/errors");
5020
- var import_utils30 = require("@fuel-ts/utils");
4952
+ var import_errors16 = require("@fuel-ts/errors");
4953
+ var import_utils29 = require("@fuel-ts/utils");
5021
4954
  var import_uuid = require("uuid");
5022
4955
  var DEFAULT_KDF_PARAMS_LOG_N = 13;
5023
4956
  var DEFAULT_KDF_PARAMS_R = 8;
@@ -5094,13 +5027,13 @@ async function decryptKeystoreWallet(jsonWallet, password) {
5094
5027
  const macHashUint8Array = (0, import_crypto2.keccak256)(data);
5095
5028
  const macHash = (0, import_crypto2.stringFromBuffer)(macHashUint8Array, "hex");
5096
5029
  if (mac !== macHash) {
5097
- throw new import_errors17.FuelError(
5098
- import_errors17.ErrorCode.INVALID_PASSWORD,
5030
+ throw new import_errors16.FuelError(
5031
+ import_errors16.ErrorCode.INVALID_PASSWORD,
5099
5032
  "Failed to decrypt the keystore wallet, the provided password is incorrect."
5100
5033
  );
5101
5034
  }
5102
5035
  const buffer = await (0, import_crypto2.decryptJsonWalletData)(ciphertextBuffer, key, ivBuffer);
5103
- const privateKey = (0, import_utils30.hexlify)(buffer);
5036
+ const privateKey = (0, import_utils29.hexlify)(buffer);
5104
5037
  return privateKey;
5105
5038
  }
5106
5039
 
@@ -5145,7 +5078,7 @@ var BaseWalletUnlocked = class extends Account {
5145
5078
  */
5146
5079
  async signMessage(message) {
5147
5080
  const signedMessage = await this.signer().sign((0, import_hasher3.hashMessage)(message));
5148
- return (0, import_utils31.hexlify)(signedMessage);
5081
+ return (0, import_utils30.hexlify)(signedMessage);
5149
5082
  }
5150
5083
  /**
5151
5084
  * Signs a transaction with the wallet's private key.
@@ -5158,7 +5091,7 @@ var BaseWalletUnlocked = class extends Account {
5158
5091
  const chainId = this.provider.getChainId();
5159
5092
  const hashedTransaction = transactionRequest.getTransactionId(chainId);
5160
5093
  const signature = await this.signer().sign(hashedTransaction);
5161
- return (0, import_utils31.hexlify)(signature);
5094
+ return (0, import_utils30.hexlify)(signature);
5162
5095
  }
5163
5096
  /**
5164
5097
  * Populates a transaction with the witnesses signature.
@@ -5217,17 +5150,17 @@ var BaseWalletUnlocked = class extends Account {
5217
5150
  __publicField(BaseWalletUnlocked, "defaultPath", "m/44'/1179993420'/0'/0/0");
5218
5151
 
5219
5152
  // src/hdwallet/hdwallet.ts
5220
- var import_errors20 = require("@fuel-ts/errors");
5153
+ var import_errors19 = require("@fuel-ts/errors");
5221
5154
  var import_hasher6 = require("@fuel-ts/hasher");
5222
- var import_math20 = require("@fuel-ts/math");
5223
- var import_utils35 = require("@fuel-ts/utils");
5155
+ var import_math19 = require("@fuel-ts/math");
5156
+ var import_utils34 = require("@fuel-ts/utils");
5224
5157
  var import_ethers3 = require("ethers");
5225
5158
 
5226
5159
  // src/mnemonic/mnemonic.ts
5227
5160
  var import_crypto3 = require("@fuel-ts/crypto");
5228
- var import_errors19 = require("@fuel-ts/errors");
5161
+ var import_errors18 = require("@fuel-ts/errors");
5229
5162
  var import_hasher5 = require("@fuel-ts/hasher");
5230
- var import_utils33 = require("@fuel-ts/utils");
5163
+ var import_utils32 = require("@fuel-ts/utils");
5231
5164
  var import_ethers2 = require("ethers");
5232
5165
 
5233
5166
  // src/wordlists/words/english.ts
@@ -7283,9 +7216,9 @@ var english = [
7283
7216
  ];
7284
7217
 
7285
7218
  // src/mnemonic/utils.ts
7286
- var import_errors18 = require("@fuel-ts/errors");
7219
+ var import_errors17 = require("@fuel-ts/errors");
7287
7220
  var import_hasher4 = require("@fuel-ts/hasher");
7288
- var import_utils32 = require("@fuel-ts/utils");
7221
+ var import_utils31 = require("@fuel-ts/utils");
7289
7222
  function toUtf8Bytes(stri) {
7290
7223
  const str = stri.normalize("NFKD");
7291
7224
  const result = [];
@@ -7300,8 +7233,8 @@ function toUtf8Bytes(stri) {
7300
7233
  i += 1;
7301
7234
  const c2 = str.charCodeAt(i);
7302
7235
  if (i >= str.length || (c2 & 64512) !== 56320) {
7303
- throw new import_errors18.FuelError(
7304
- import_errors18.ErrorCode.INVALID_INPUT_PARAMETERS,
7236
+ throw new import_errors17.FuelError(
7237
+ import_errors17.ErrorCode.INVALID_INPUT_PARAMETERS,
7305
7238
  "Invalid UTF-8 in the input string."
7306
7239
  );
7307
7240
  }
@@ -7352,20 +7285,20 @@ function entropyToMnemonicIndices(entropy) {
7352
7285
  }
7353
7286
  }
7354
7287
  const checksumBits = entropy.length / 4;
7355
- const checksum = (0, import_utils32.arrayify)((0, import_hasher4.sha256)(entropy))[0] & getUpperMask(checksumBits);
7288
+ const checksum = (0, import_utils31.arrayify)((0, import_hasher4.sha256)(entropy))[0] & getUpperMask(checksumBits);
7356
7289
  indices[indices.length - 1] <<= checksumBits;
7357
7290
  indices[indices.length - 1] |= checksum >> 8 - checksumBits;
7358
7291
  return indices;
7359
7292
  }
7360
7293
  function mnemonicWordsToEntropy(words, wordlist) {
7361
7294
  const size = Math.ceil(11 * words.length / 8);
7362
- const entropy = (0, import_utils32.arrayify)(new Uint8Array(size));
7295
+ const entropy = (0, import_utils31.arrayify)(new Uint8Array(size));
7363
7296
  let offset = 0;
7364
7297
  for (let i = 0; i < words.length; i += 1) {
7365
7298
  const index = wordlist.indexOf(words[i].normalize("NFKD"));
7366
7299
  if (index === -1) {
7367
- throw new import_errors18.FuelError(
7368
- import_errors18.ErrorCode.INVALID_MNEMONIC,
7300
+ throw new import_errors17.FuelError(
7301
+ import_errors17.ErrorCode.INVALID_MNEMONIC,
7369
7302
  `Invalid mnemonic: the word '${words[i]}' is not found in the provided wordlist.`
7370
7303
  );
7371
7304
  }
@@ -7379,10 +7312,10 @@ function mnemonicWordsToEntropy(words, wordlist) {
7379
7312
  const entropyBits = 32 * words.length / 3;
7380
7313
  const checksumBits = words.length / 3;
7381
7314
  const checksumMask = getUpperMask(checksumBits);
7382
- const checksum = (0, import_utils32.arrayify)((0, import_hasher4.sha256)(entropy.slice(0, entropyBits / 8)))[0] & checksumMask;
7315
+ const checksum = (0, import_utils31.arrayify)((0, import_hasher4.sha256)(entropy.slice(0, entropyBits / 8)))[0] & checksumMask;
7383
7316
  if (checksum !== (entropy[entropy.length - 1] & checksumMask)) {
7384
- throw new import_errors18.FuelError(
7385
- import_errors18.ErrorCode.INVALID_CHECKSUM,
7317
+ throw new import_errors17.FuelError(
7318
+ import_errors17.ErrorCode.INVALID_CHECKSUM,
7386
7319
  "Checksum validation failed for the provided mnemonic."
7387
7320
  );
7388
7321
  }
@@ -7396,16 +7329,16 @@ var TestnetPRV = "0x04358394";
7396
7329
  var MNEMONIC_SIZES = [12, 15, 18, 21, 24];
7397
7330
  function assertWordList(wordlist) {
7398
7331
  if (wordlist.length !== 2048) {
7399
- throw new import_errors19.FuelError(
7400
- import_errors19.ErrorCode.INVALID_WORD_LIST,
7332
+ throw new import_errors18.FuelError(
7333
+ import_errors18.ErrorCode.INVALID_WORD_LIST,
7401
7334
  `Expected word list length of 2048, but got ${wordlist.length}.`
7402
7335
  );
7403
7336
  }
7404
7337
  }
7405
7338
  function assertEntropy(entropy) {
7406
7339
  if (entropy.length % 4 !== 0 || entropy.length < 16 || entropy.length > 32) {
7407
- throw new import_errors19.FuelError(
7408
- import_errors19.ErrorCode.INVALID_ENTROPY,
7340
+ throw new import_errors18.FuelError(
7341
+ import_errors18.ErrorCode.INVALID_ENTROPY,
7409
7342
  `Entropy should be between 16 and 32 bytes and a multiple of 4, but got ${entropy.length} bytes.`
7410
7343
  );
7411
7344
  }
@@ -7415,7 +7348,7 @@ function assertMnemonic(words) {
7415
7348
  const errorMsg = `Invalid mnemonic size. Expected one of [${MNEMONIC_SIZES.join(
7416
7349
  ", "
7417
7350
  )}] words, but got ${words.length}.`;
7418
- throw new import_errors19.FuelError(import_errors19.ErrorCode.INVALID_MNEMONIC, errorMsg);
7351
+ throw new import_errors18.FuelError(import_errors18.ErrorCode.INVALID_MNEMONIC, errorMsg);
7419
7352
  }
7420
7353
  }
7421
7354
  var Mnemonic = class {
@@ -7454,7 +7387,7 @@ var Mnemonic = class {
7454
7387
  static mnemonicToEntropy(phrase, wordlist = english) {
7455
7388
  const words = getWords(phrase);
7456
7389
  assertMnemonic(words);
7457
- return (0, import_utils33.hexlify)(mnemonicWordsToEntropy(words, wordlist));
7390
+ return (0, import_utils32.hexlify)(mnemonicWordsToEntropy(words, wordlist));
7458
7391
  }
7459
7392
  /**
7460
7393
  * @param entropy - Entropy source to the mnemonic phrase.
@@ -7462,7 +7395,7 @@ var Mnemonic = class {
7462
7395
  * @returns 64-byte array contains privateKey and chainCode as described on BIP39
7463
7396
  */
7464
7397
  static entropyToMnemonic(entropy, wordlist = english) {
7465
- const entropyBytes = (0, import_utils33.arrayify)(entropy);
7398
+ const entropyBytes = (0, import_utils32.arrayify)(entropy);
7466
7399
  assertWordList(wordlist);
7467
7400
  assertEntropy(entropyBytes);
7468
7401
  return entropyToMnemonicIndices(entropyBytes).map((i) => wordlist[i]).join(" ");
@@ -7531,14 +7464,14 @@ var Mnemonic = class {
7531
7464
  * @returns 64-byte array contains privateKey and chainCode as described on BIP39
7532
7465
  */
7533
7466
  static masterKeysFromSeed(seed) {
7534
- const seedArray = (0, import_utils33.arrayify)(seed);
7467
+ const seedArray = (0, import_utils32.arrayify)(seed);
7535
7468
  if (seedArray.length < 16 || seedArray.length > 64) {
7536
- throw new import_errors19.FuelError(
7537
- import_errors19.ErrorCode.INVALID_SEED,
7469
+ throw new import_errors18.FuelError(
7470
+ import_errors18.ErrorCode.INVALID_SEED,
7538
7471
  `Seed length should be between 16 and 64 bytes, but received ${seedArray.length} bytes.`
7539
7472
  );
7540
7473
  }
7541
- return (0, import_utils33.arrayify)((0, import_ethers2.computeHmac)("sha512", MasterSecret, seedArray));
7474
+ return (0, import_utils32.arrayify)((0, import_ethers2.computeHmac)("sha512", MasterSecret, seedArray));
7542
7475
  }
7543
7476
  /**
7544
7477
  * Get the extendKey as defined on BIP-32 from the provided seed
@@ -7549,22 +7482,22 @@ var Mnemonic = class {
7549
7482
  */
7550
7483
  static seedToExtendedKey(seed, testnet = false) {
7551
7484
  const masterKey = Mnemonic.masterKeysFromSeed(seed);
7552
- const prefix = (0, import_utils33.arrayify)(testnet ? TestnetPRV : MainnetPRV);
7485
+ const prefix = (0, import_utils32.arrayify)(testnet ? TestnetPRV : MainnetPRV);
7553
7486
  const depth = "0x00";
7554
7487
  const fingerprint = "0x00000000";
7555
7488
  const index = "0x00000000";
7556
7489
  const chainCode = masterKey.slice(32);
7557
7490
  const privateKey = masterKey.slice(0, 32);
7558
- const extendedKey = (0, import_utils33.concat)([
7491
+ const extendedKey = (0, import_utils32.concat)([
7559
7492
  prefix,
7560
7493
  depth,
7561
7494
  fingerprint,
7562
7495
  index,
7563
7496
  chainCode,
7564
- (0, import_utils33.concat)(["0x00", privateKey])
7497
+ (0, import_utils32.concat)(["0x00", privateKey])
7565
7498
  ]);
7566
7499
  const checksum = (0, import_ethers2.dataSlice)((0, import_hasher5.sha256)((0, import_hasher5.sha256)(extendedKey)), 0, 4);
7567
- return (0, import_ethers2.encodeBase58)((0, import_utils33.concat)([extendedKey, checksum]));
7500
+ return (0, import_ethers2.encodeBase58)((0, import_utils32.concat)([extendedKey, checksum]));
7568
7501
  }
7569
7502
  /**
7570
7503
  * Create a new mnemonic using a randomly generated number as entropy.
@@ -7579,7 +7512,7 @@ var Mnemonic = class {
7579
7512
  * @returns A randomly generated mnemonic
7580
7513
  */
7581
7514
  static generate(size = 32, extraEntropy = "") {
7582
- 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);
7515
+ 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);
7583
7516
  return Mnemonic.entropyToMnemonic(entropy);
7584
7517
  }
7585
7518
  };
@@ -7587,12 +7520,12 @@ var mnemonic_default = Mnemonic;
7587
7520
 
7588
7521
  // src/hdwallet/hdwallet.ts
7589
7522
  var HARDENED_INDEX = 2147483648;
7590
- var MainnetPRV2 = (0, import_utils35.hexlify)("0x0488ade4");
7591
- var MainnetPUB = (0, import_utils35.hexlify)("0x0488b21e");
7592
- var TestnetPRV2 = (0, import_utils35.hexlify)("0x04358394");
7593
- var TestnetPUB = (0, import_utils35.hexlify)("0x043587cf");
7523
+ var MainnetPRV2 = (0, import_utils34.hexlify)("0x0488ade4");
7524
+ var MainnetPUB = (0, import_utils34.hexlify)("0x0488b21e");
7525
+ var TestnetPRV2 = (0, import_utils34.hexlify)("0x04358394");
7526
+ var TestnetPUB = (0, import_utils34.hexlify)("0x043587cf");
7594
7527
  function base58check(data) {
7595
- 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)]));
7528
+ 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)]));
7596
7529
  }
7597
7530
  function getExtendedKeyPrefix(isPublic = false, testnet = false) {
7598
7531
  if (isPublic) {
@@ -7601,17 +7534,17 @@ function getExtendedKeyPrefix(isPublic = false, testnet = false) {
7601
7534
  return testnet ? TestnetPRV2 : MainnetPRV2;
7602
7535
  }
7603
7536
  function isPublicExtendedKey(extendedKey) {
7604
- return [MainnetPUB, TestnetPUB].includes((0, import_utils35.hexlify)(extendedKey.slice(0, 4)));
7537
+ return [MainnetPUB, TestnetPUB].includes((0, import_utils34.hexlify)(extendedKey.slice(0, 4)));
7605
7538
  }
7606
7539
  function isValidExtendedKey(extendedKey) {
7607
7540
  return [MainnetPRV2, TestnetPRV2, MainnetPUB, TestnetPUB].includes(
7608
- (0, import_utils35.hexlify)(extendedKey.slice(0, 4))
7541
+ (0, import_utils34.hexlify)(extendedKey.slice(0, 4))
7609
7542
  );
7610
7543
  }
7611
7544
  function parsePath(path2, depth = 0) {
7612
7545
  const components = path2.split("/");
7613
7546
  if (components.length === 0 || components[0] === "m" && depth !== 0) {
7614
- throw new import_errors20.FuelError(import_errors20.ErrorCode.HD_WALLET_ERROR, `invalid path - ${path2}`);
7547
+ throw new import_errors19.FuelError(import_errors19.ErrorCode.HD_WALLET_ERROR, `invalid path - ${path2}`);
7615
7548
  }
7616
7549
  if (components[0] === "m") {
7617
7550
  components.shift();
@@ -7623,8 +7556,8 @@ function parsePath(path2, depth = 0) {
7623
7556
  var HDWallet = class {
7624
7557
  depth = 0;
7625
7558
  index = 0;
7626
- fingerprint = (0, import_utils35.hexlify)("0x00000000");
7627
- parentFingerprint = (0, import_utils35.hexlify)("0x00000000");
7559
+ fingerprint = (0, import_utils34.hexlify)("0x00000000");
7560
+ parentFingerprint = (0, import_utils34.hexlify)("0x00000000");
7628
7561
  privateKey;
7629
7562
  publicKey;
7630
7563
  chainCode;
@@ -7636,16 +7569,16 @@ var HDWallet = class {
7636
7569
  constructor(config) {
7637
7570
  if (config.privateKey) {
7638
7571
  const signer = new Signer(config.privateKey);
7639
- this.publicKey = (0, import_utils35.hexlify)(signer.compressedPublicKey);
7640
- this.privateKey = (0, import_utils35.hexlify)(config.privateKey);
7572
+ this.publicKey = (0, import_utils34.hexlify)(signer.compressedPublicKey);
7573
+ this.privateKey = (0, import_utils34.hexlify)(config.privateKey);
7641
7574
  } else {
7642
7575
  if (!config.publicKey) {
7643
- throw new import_errors20.FuelError(
7644
- import_errors20.ErrorCode.HD_WALLET_ERROR,
7576
+ throw new import_errors19.FuelError(
7577
+ import_errors19.ErrorCode.HD_WALLET_ERROR,
7645
7578
  "Both public and private Key cannot be missing. At least one should be provided."
7646
7579
  );
7647
7580
  }
7648
- this.publicKey = (0, import_utils35.hexlify)(config.publicKey);
7581
+ this.publicKey = (0, import_utils34.hexlify)(config.publicKey);
7649
7582
  }
7650
7583
  this.parentFingerprint = config.parentFingerprint || this.parentFingerprint;
7651
7584
  this.fingerprint = (0, import_ethers3.dataSlice)((0, import_ethers3.ripemd160)((0, import_hasher6.sha256)(this.publicKey)), 0, 4);
@@ -7664,28 +7597,28 @@ var HDWallet = class {
7664
7597
  * @returns A new instance of HDWallet on the derived index
7665
7598
  */
7666
7599
  deriveIndex(index) {
7667
- const privateKey = this.privateKey && (0, import_utils35.arrayify)(this.privateKey);
7668
- const publicKey = (0, import_utils35.arrayify)(this.publicKey);
7669
- const chainCode = (0, import_utils35.arrayify)(this.chainCode);
7600
+ const privateKey = this.privateKey && (0, import_utils34.arrayify)(this.privateKey);
7601
+ const publicKey = (0, import_utils34.arrayify)(this.publicKey);
7602
+ const chainCode = (0, import_utils34.arrayify)(this.chainCode);
7670
7603
  const data = new Uint8Array(37);
7671
7604
  if (index & HARDENED_INDEX) {
7672
7605
  if (!privateKey) {
7673
- throw new import_errors20.FuelError(
7674
- import_errors20.ErrorCode.HD_WALLET_ERROR,
7606
+ throw new import_errors19.FuelError(
7607
+ import_errors19.ErrorCode.HD_WALLET_ERROR,
7675
7608
  "Cannot derive a hardened index without a private Key."
7676
7609
  );
7677
7610
  }
7678
7611
  data.set(privateKey, 1);
7679
7612
  } else {
7680
- data.set((0, import_utils35.arrayify)(this.publicKey));
7613
+ data.set((0, import_utils34.arrayify)(this.publicKey));
7681
7614
  }
7682
- data.set((0, import_math20.toBytes)(index, 4), 33);
7683
- const bytes = (0, import_utils35.arrayify)((0, import_ethers3.computeHmac)("sha512", chainCode, data));
7615
+ data.set((0, import_math19.toBytes)(index, 4), 33);
7616
+ const bytes = (0, import_utils34.arrayify)((0, import_ethers3.computeHmac)("sha512", chainCode, data));
7684
7617
  const IL = bytes.slice(0, 32);
7685
7618
  const IR = bytes.slice(32);
7686
7619
  if (privateKey) {
7687
7620
  const N = "0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141";
7688
- const ki = (0, import_math20.bn)(IL).add(privateKey).mod(N).toBytes(32);
7621
+ const ki = (0, import_math19.bn)(IL).add(privateKey).mod(N).toBytes(32);
7689
7622
  return new HDWallet({
7690
7623
  privateKey: ki,
7691
7624
  chainCode: IR,
@@ -7694,7 +7627,7 @@ var HDWallet = class {
7694
7627
  parentFingerprint: this.fingerprint
7695
7628
  });
7696
7629
  }
7697
- const signer = new Signer((0, import_utils35.hexlify)(IL));
7630
+ const signer = new Signer((0, import_utils34.hexlify)(IL));
7698
7631
  const Ki = signer.addPoint(publicKey);
7699
7632
  return new HDWallet({
7700
7633
  publicKey: Ki,
@@ -7723,18 +7656,18 @@ var HDWallet = class {
7723
7656
  */
7724
7657
  toExtendedKey(isPublic = false, testnet = false) {
7725
7658
  if (this.depth >= 256) {
7726
- throw new import_errors20.FuelError(
7727
- import_errors20.ErrorCode.HD_WALLET_ERROR,
7659
+ throw new import_errors19.FuelError(
7660
+ import_errors19.ErrorCode.HD_WALLET_ERROR,
7728
7661
  `Exceeded max depth of 255. Current depth: ${this.depth}.`
7729
7662
  );
7730
7663
  }
7731
7664
  const prefix = getExtendedKeyPrefix(this.privateKey == null || isPublic, testnet);
7732
- const depth = (0, import_utils35.hexlify)(Uint8Array.from([this.depth]));
7665
+ const depth = (0, import_utils34.hexlify)(Uint8Array.from([this.depth]));
7733
7666
  const parentFingerprint = this.parentFingerprint;
7734
- const index = (0, import_math20.toHex)(this.index, 4);
7667
+ const index = (0, import_math19.toHex)(this.index, 4);
7735
7668
  const chainCode = this.chainCode;
7736
- const key = this.privateKey != null && !isPublic ? (0, import_utils35.concat)(["0x00", this.privateKey]) : this.publicKey;
7737
- const extendedKey = (0, import_utils35.arrayify)((0, import_utils35.concat)([prefix, depth, parentFingerprint, index, chainCode, key]));
7669
+ const key = this.privateKey != null && !isPublic ? (0, import_utils34.concat)(["0x00", this.privateKey]) : this.publicKey;
7670
+ const extendedKey = (0, import_utils34.arrayify)((0, import_utils34.concat)([prefix, depth, parentFingerprint, index, chainCode, key]));
7738
7671
  return base58check(extendedKey);
7739
7672
  }
7740
7673
  /**
@@ -7746,34 +7679,34 @@ var HDWallet = class {
7746
7679
  static fromSeed(seed) {
7747
7680
  const masterKey = mnemonic_default.masterKeysFromSeed(seed);
7748
7681
  return new HDWallet({
7749
- chainCode: (0, import_utils35.arrayify)(masterKey.slice(32)),
7750
- privateKey: (0, import_utils35.arrayify)(masterKey.slice(0, 32))
7682
+ chainCode: (0, import_utils34.arrayify)(masterKey.slice(32)),
7683
+ privateKey: (0, import_utils34.arrayify)(masterKey.slice(0, 32))
7751
7684
  });
7752
7685
  }
7753
7686
  static fromExtendedKey(extendedKey) {
7754
7687
  const decoded = (0, import_ethers3.toBeHex)((0, import_ethers3.decodeBase58)(extendedKey));
7755
- const bytes = (0, import_utils35.arrayify)(decoded);
7688
+ const bytes = (0, import_utils34.arrayify)(decoded);
7756
7689
  const validChecksum = base58check(bytes.slice(0, 78)) === extendedKey;
7757
7690
  if (bytes.length !== 82 || !isValidExtendedKey(bytes)) {
7758
- throw new import_errors20.FuelError(import_errors20.ErrorCode.HD_WALLET_ERROR, "Provided key is not a valid extended key.");
7691
+ throw new import_errors19.FuelError(import_errors19.ErrorCode.HD_WALLET_ERROR, "Provided key is not a valid extended key.");
7759
7692
  }
7760
7693
  if (!validChecksum) {
7761
- throw new import_errors20.FuelError(import_errors20.ErrorCode.HD_WALLET_ERROR, "Provided key has an invalid checksum.");
7694
+ throw new import_errors19.FuelError(import_errors19.ErrorCode.HD_WALLET_ERROR, "Provided key has an invalid checksum.");
7762
7695
  }
7763
7696
  const depth = bytes[4];
7764
- const parentFingerprint = (0, import_utils35.hexlify)(bytes.slice(5, 9));
7765
- const index = parseInt((0, import_utils35.hexlify)(bytes.slice(9, 13)).substring(2), 16);
7766
- const chainCode = (0, import_utils35.hexlify)(bytes.slice(13, 45));
7697
+ const parentFingerprint = (0, import_utils34.hexlify)(bytes.slice(5, 9));
7698
+ const index = parseInt((0, import_utils34.hexlify)(bytes.slice(9, 13)).substring(2), 16);
7699
+ const chainCode = (0, import_utils34.hexlify)(bytes.slice(13, 45));
7767
7700
  const key = bytes.slice(45, 78);
7768
7701
  if (depth === 0 && parentFingerprint !== "0x00000000" || depth === 0 && index !== 0) {
7769
- throw new import_errors20.FuelError(
7770
- import_errors20.ErrorCode.HD_WALLET_ERROR,
7702
+ throw new import_errors19.FuelError(
7703
+ import_errors19.ErrorCode.HD_WALLET_ERROR,
7771
7704
  "Inconsistency detected: Depth is zero but fingerprint/index is non-zero."
7772
7705
  );
7773
7706
  }
7774
7707
  if (isPublicExtendedKey(bytes)) {
7775
7708
  if (key[0] !== 3) {
7776
- throw new import_errors20.FuelError(import_errors20.ErrorCode.HD_WALLET_ERROR, "Invalid public extended key.");
7709
+ throw new import_errors19.FuelError(import_errors19.ErrorCode.HD_WALLET_ERROR, "Invalid public extended key.");
7777
7710
  }
7778
7711
  return new HDWallet({
7779
7712
  publicKey: key,
@@ -7784,7 +7717,7 @@ var HDWallet = class {
7784
7717
  });
7785
7718
  }
7786
7719
  if (key[0] !== 0) {
7787
- throw new import_errors20.FuelError(import_errors20.ErrorCode.HD_WALLET_ERROR, "Invalid private extended key.");
7720
+ throw new import_errors19.FuelError(import_errors19.ErrorCode.HD_WALLET_ERROR, "Invalid private extended key.");
7788
7721
  }
7789
7722
  return new HDWallet({
7790
7723
  privateKey: key.slice(1),
@@ -7977,9 +7910,9 @@ var generateTestWallet = async (provider, quantities) => {
7977
7910
  };
7978
7911
 
7979
7912
  // src/test-utils/launchNode.ts
7980
- var import_configs13 = require("@fuel-ts/address/configs");
7981
- var import_math21 = require("@fuel-ts/math");
7982
- var import_utils36 = require("@fuel-ts/utils");
7913
+ var import_configs12 = require("@fuel-ts/address/configs");
7914
+ var import_math20 = require("@fuel-ts/math");
7915
+ var import_utils35 = require("@fuel-ts/utils");
7983
7916
  var import_cli_utils = require("@fuel-ts/utils/cli-utils");
7984
7917
  var import_child_process = require("child_process");
7985
7918
  var import_crypto5 = require("crypto");
@@ -8037,7 +7970,7 @@ var launchNode = async ({
8037
7970
  "--poa-instant"
8038
7971
  ]);
8039
7972
  const chainConfigPath = getFlagValueFromArgs(args, "--chain");
8040
- const consensusKey = getFlagValueFromArgs(args, "--consensus-key") || import_utils36.defaultConsensusKey;
7973
+ const consensusKey = getFlagValueFromArgs(args, "--consensus-key") || import_utils35.defaultConsensusKey;
8041
7974
  const dbTypeFlagValue = getFlagValueFromArgs(args, "--db-type");
8042
7975
  const useInMemoryDb = dbTypeFlagValue === "in-memory" || dbTypeFlagValue === void 0;
8043
7976
  const poaInstantFlagValue = getFlagValueFromArgs(args, "--poa-instant");
@@ -8063,21 +7996,21 @@ var launchNode = async ({
8063
7996
  (0, import_fs.mkdirSync)(tempDirPath, { recursive: true });
8064
7997
  }
8065
7998
  const tempChainConfigFilePath = import_path.default.join(tempDirPath, "chainConfig.json");
8066
- let chainConfig = import_utils36.defaultChainConfig;
7999
+ let chainConfig = import_utils35.defaultChainConfig;
8067
8000
  if (!process.env.GENESIS_SECRET) {
8068
8001
  const pk = Signer.generatePrivateKey();
8069
8002
  const signer = new Signer(pk);
8070
- process.env.GENESIS_SECRET = (0, import_utils36.hexlify)(pk);
8003
+ process.env.GENESIS_SECRET = (0, import_utils35.hexlify)(pk);
8071
8004
  chainConfig = {
8072
- ...import_utils36.defaultChainConfig,
8005
+ ...import_utils35.defaultChainConfig,
8073
8006
  initial_state: {
8074
- ...import_utils36.defaultChainConfig.initial_state,
8007
+ ...import_utils35.defaultChainConfig.initial_state,
8075
8008
  coins: [
8076
- ...import_utils36.defaultChainConfig.initial_state.coins,
8009
+ ...import_utils35.defaultChainConfig.initial_state.coins,
8077
8010
  {
8078
8011
  owner: signer.address.toHexString(),
8079
- amount: (0, import_math21.toHex)(1e9),
8080
- asset_id: import_configs13.BaseAssetId
8012
+ amount: (0, import_math20.toHex)(1e9),
8013
+ asset_id: import_configs12.BaseAssetId
8081
8014
  }
8082
8015
  ]
8083
8016
  }
@@ -8145,7 +8078,7 @@ var launchNode = async ({
8145
8078
  var generateWallets = async (count, provider) => {
8146
8079
  const wallets = [];
8147
8080
  for (let i = 0; i < count; i += 1) {
8148
- const wallet = await generateTestWallet(provider, [[1e3, import_configs13.BaseAssetId]]);
8081
+ const wallet = await generateTestWallet(provider, [[1e3, import_configs12.BaseAssetId]]);
8149
8082
  wallets.push(wallet);
8150
8083
  }
8151
8084
  return wallets;