@fuel-ts/account 0.0.0-rc-1962-20240328141721 → 0.0.0-rc-1895-20240328175953

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