@fuel-ts/account 0.0.0-rc-1976-20240404171500 → 0.0.0-rc-1976-20240405090158

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,14 +58,14 @@ module.exports = __toCommonJS(test_utils_exports);
58
58
 
59
59
  // src/wallet/base-wallet-unlocked.ts
60
60
  var import_hasher3 = require("@fuel-ts/hasher");
61
- var import_utils31 = require("@fuel-ts/utils");
61
+ var import_utils30 = require("@fuel-ts/utils");
62
62
 
63
63
  // src/account.ts
64
64
  var import_address4 = require("@fuel-ts/address");
65
- var import_errors16 = require("@fuel-ts/errors");
65
+ var import_errors15 = require("@fuel-ts/errors");
66
66
  var import_interfaces = require("@fuel-ts/interfaces");
67
- var import_math18 = require("@fuel-ts/math");
68
- var import_utils28 = require("@fuel-ts/utils");
67
+ var import_math17 = require("@fuel-ts/math");
68
+ var import_utils27 = require("@fuel-ts/utils");
69
69
 
70
70
  // src/providers/coin-quantity.ts
71
71
  var import_math = require("@fuel-ts/math");
@@ -104,12 +104,12 @@ var addAmountToAsset = (params) => {
104
104
 
105
105
  // src/providers/provider.ts
106
106
  var import_address3 = require("@fuel-ts/address");
107
- var import_errors14 = require("@fuel-ts/errors");
108
- var import_math15 = require("@fuel-ts/math");
109
- var import_transactions18 = require("@fuel-ts/transactions");
110
- var import_utils23 = require("@fuel-ts/utils");
107
+ var import_errors13 = require("@fuel-ts/errors");
108
+ var import_math14 = require("@fuel-ts/math");
109
+ var import_transactions17 = require("@fuel-ts/transactions");
110
+ var import_utils22 = require("@fuel-ts/utils");
111
111
  var import_versions = require("@fuel-ts/versions");
112
- var import_utils24 = require("@noble/curves/abstract/utils");
112
+ var import_utils23 = require("@noble/curves/abstract/utils");
113
113
  var import_ethers = require("ethers");
114
114
  var import_graphql_request = require("graphql-request");
115
115
  var import_ramda3 = require("ramda");
@@ -1182,9 +1182,9 @@ var outputify = (value) => {
1182
1182
 
1183
1183
  // src/providers/transaction-request/transaction-request.ts
1184
1184
  var import_address = require("@fuel-ts/address");
1185
- var import_configs6 = require("@fuel-ts/address/configs");
1186
- var import_math7 = require("@fuel-ts/math");
1187
- var import_transactions6 = require("@fuel-ts/transactions");
1185
+ var import_configs5 = require("@fuel-ts/address/configs");
1186
+ var import_math6 = require("@fuel-ts/math");
1187
+ var import_transactions5 = require("@fuel-ts/transactions");
1188
1188
  var import_utils9 = require("@fuel-ts/utils");
1189
1189
 
1190
1190
  // src/providers/resource.ts
@@ -1515,78 +1515,6 @@ function sleep(time) {
1515
1515
  });
1516
1516
  }
1517
1517
 
1518
- // src/providers/utils/extract-tx-error.ts
1519
- var import_errors7 = require("@fuel-ts/errors");
1520
- var import_math6 = require("@fuel-ts/math");
1521
- var import_transactions5 = require("@fuel-ts/transactions");
1522
- var import_configs5 = require("@fuel-ts/transactions/configs");
1523
- var assemblePanicError = (status) => {
1524
- let errorMessage = `The transaction reverted with reason: "${status.reason}".`;
1525
- const reason = status.reason;
1526
- if (import_configs5.PANIC_REASONS.includes(status.reason)) {
1527
- errorMessage = `${errorMessage}
1528
-
1529
- You can read more about this error at:
1530
-
1531
- ${import_configs5.PANIC_DOC_URL}#variant.${status.reason}`;
1532
- }
1533
- return { errorMessage, reason };
1534
- };
1535
- var stringify = (obj) => JSON.stringify(obj, null, 2);
1536
- var assembleRevertError = (receipts, logs) => {
1537
- let errorMessage = "The transaction reverted with an unknown reason.";
1538
- const revertReceipt = receipts.find(({ type }) => type === import_transactions5.ReceiptType.Revert);
1539
- let reason = "";
1540
- if (revertReceipt) {
1541
- const reasonHex = (0, import_math6.bn)(revertReceipt.val).toHex();
1542
- switch (reasonHex) {
1543
- case import_configs5.FAILED_REQUIRE_SIGNAL: {
1544
- reason = "require";
1545
- errorMessage = `The transaction reverted because a "require" statement has thrown ${logs.length ? stringify(logs[0]) : "an error."}.`;
1546
- break;
1547
- }
1548
- case import_configs5.FAILED_ASSERT_EQ_SIGNAL: {
1549
- const sufix = logs.length >= 2 ? ` comparing ${stringify(logs[1])} and ${stringify(logs[0])}.` : ".";
1550
- reason = "assert_eq";
1551
- errorMessage = `The transaction reverted because of an "assert_eq" statement${sufix}`;
1552
- break;
1553
- }
1554
- case import_configs5.FAILED_ASSERT_NE_SIGNAL: {
1555
- const sufix = logs.length >= 2 ? ` comparing ${stringify(logs[1])} and ${stringify(logs[0])}.` : ".";
1556
- reason = "assert_ne";
1557
- errorMessage = `The transaction reverted because of an "assert_ne" statement${sufix}`;
1558
- break;
1559
- }
1560
- case import_configs5.FAILED_ASSERT_SIGNAL:
1561
- reason = "assert";
1562
- errorMessage = `The transaction reverted because an "assert" statement failed to evaluate to true.`;
1563
- break;
1564
- case import_configs5.FAILED_TRANSFER_TO_ADDRESS_SIGNAL:
1565
- reason = "MissingOutputChange";
1566
- errorMessage = `The transaction reverted because it's missing an "OutputChange".`;
1567
- break;
1568
- default:
1569
- reason = "unknown";
1570
- errorMessage = `The transaction reverted with an unknown reason: ${revertReceipt.val}`;
1571
- }
1572
- }
1573
- return { errorMessage, reason };
1574
- };
1575
- var extractTxError = (params) => {
1576
- const { receipts, status, logs } = params;
1577
- const isPanic = receipts.some(({ type }) => type === import_transactions5.ReceiptType.Panic);
1578
- const isRevert = receipts.some(({ type }) => type === import_transactions5.ReceiptType.Revert);
1579
- const { errorMessage, reason } = status?.type === "FailureStatus" && isPanic ? assemblePanicError(status) : assembleRevertError(receipts, logs);
1580
- const metadata = {
1581
- logs,
1582
- receipts,
1583
- panic: isPanic,
1584
- revert: isRevert,
1585
- reason
1586
- };
1587
- return new import_errors7.FuelError(import_errors7.ErrorCode.SCRIPT_REVERTED, errorMessage, metadata);
1588
- };
1589
-
1590
1518
  // src/providers/transaction-request/errors.ts
1591
1519
  var NoWitnessAtIndexError = class extends Error {
1592
1520
  constructor(index) {
@@ -1624,7 +1552,7 @@ var BaseTransactionRequest = class {
1624
1552
  /** List of witnesses */
1625
1553
  witnesses = [];
1626
1554
  /** Base asset ID - should be fetched from the chain */
1627
- baseAssetId = import_configs6.ZeroBytes32;
1555
+ baseAssetId = import_configs5.ZeroBytes32;
1628
1556
  /**
1629
1557
  * Constructor for initializing a base transaction request.
1630
1558
  *
@@ -1640,33 +1568,33 @@ var BaseTransactionRequest = class {
1640
1568
  witnesses,
1641
1569
  baseAssetId
1642
1570
  } = {}) {
1643
- this.gasPrice = (0, import_math7.bn)(gasPrice);
1571
+ this.gasPrice = (0, import_math6.bn)(gasPrice);
1644
1572
  this.maturity = maturity ?? 0;
1645
- this.witnessLimit = witnessLimit ? (0, import_math7.bn)(witnessLimit) : void 0;
1646
- this.maxFee = maxFee ? (0, import_math7.bn)(maxFee) : void 0;
1573
+ this.witnessLimit = witnessLimit ? (0, import_math6.bn)(witnessLimit) : void 0;
1574
+ this.maxFee = maxFee ? (0, import_math6.bn)(maxFee) : void 0;
1647
1575
  this.inputs = inputs ?? [];
1648
1576
  this.outputs = outputs ?? [];
1649
1577
  this.witnesses = witnesses ?? [];
1650
- this.baseAssetId = baseAssetId ?? import_configs6.ZeroBytes32;
1578
+ this.baseAssetId = baseAssetId ?? import_configs5.ZeroBytes32;
1651
1579
  }
1652
1580
  static getPolicyMeta(req) {
1653
1581
  let policyTypes = 0;
1654
1582
  const policies = [];
1655
1583
  if (req.gasPrice) {
1656
- policyTypes += import_transactions6.PolicyType.GasPrice;
1657
- policies.push({ data: req.gasPrice, type: import_transactions6.PolicyType.GasPrice });
1584
+ policyTypes += import_transactions5.PolicyType.GasPrice;
1585
+ policies.push({ data: req.gasPrice, type: import_transactions5.PolicyType.GasPrice });
1658
1586
  }
1659
1587
  if (req.witnessLimit) {
1660
- policyTypes += import_transactions6.PolicyType.WitnessLimit;
1661
- policies.push({ data: req.witnessLimit, type: import_transactions6.PolicyType.WitnessLimit });
1588
+ policyTypes += import_transactions5.PolicyType.WitnessLimit;
1589
+ policies.push({ data: req.witnessLimit, type: import_transactions5.PolicyType.WitnessLimit });
1662
1590
  }
1663
1591
  if (req.maturity > 0) {
1664
- policyTypes += import_transactions6.PolicyType.Maturity;
1665
- policies.push({ data: req.maturity, type: import_transactions6.PolicyType.Maturity });
1592
+ policyTypes += import_transactions5.PolicyType.Maturity;
1593
+ policies.push({ data: req.maturity, type: import_transactions5.PolicyType.Maturity });
1666
1594
  }
1667
1595
  if (req.maxFee) {
1668
- policyTypes += import_transactions6.PolicyType.MaxFee;
1669
- policies.push({ data: req.maxFee, type: import_transactions6.PolicyType.MaxFee });
1596
+ policyTypes += import_transactions5.PolicyType.MaxFee;
1597
+ policies.push({ data: req.maxFee, type: import_transactions5.PolicyType.MaxFee });
1670
1598
  }
1671
1599
  return {
1672
1600
  policyTypes,
@@ -1700,7 +1628,7 @@ var BaseTransactionRequest = class {
1700
1628
  * @returns The transaction bytes.
1701
1629
  */
1702
1630
  toTransactionBytes() {
1703
- return new import_transactions6.TransactionCoder().encode(this.toTransaction());
1631
+ return new import_transactions5.TransactionCoder().encode(this.toTransaction());
1704
1632
  }
1705
1633
  /**
1706
1634
  * @hidden
@@ -1740,7 +1668,7 @@ var BaseTransactionRequest = class {
1740
1668
  * @returns The index of the created witness.
1741
1669
  */
1742
1670
  addEmptyWitness() {
1743
- this.addWitness((0, import_utils9.concat)([import_configs6.ZeroBytes32, import_configs6.ZeroBytes32]));
1671
+ this.addWitness((0, import_utils9.concat)([import_configs5.ZeroBytes32, import_configs5.ZeroBytes32]));
1744
1672
  return this.witnesses.length - 1;
1745
1673
  }
1746
1674
  /**
@@ -1791,7 +1719,7 @@ var BaseTransactionRequest = class {
1791
1719
  */
1792
1720
  getCoinInputs() {
1793
1721
  return this.inputs.filter(
1794
- (input) => input.type === import_transactions6.InputType.Coin
1722
+ (input) => input.type === import_transactions5.InputType.Coin
1795
1723
  );
1796
1724
  }
1797
1725
  /**
@@ -1801,7 +1729,7 @@ var BaseTransactionRequest = class {
1801
1729
  */
1802
1730
  getCoinOutputs() {
1803
1731
  return this.outputs.filter(
1804
- (output) => output.type === import_transactions6.OutputType.Coin
1732
+ (output) => output.type === import_transactions5.OutputType.Coin
1805
1733
  );
1806
1734
  }
1807
1735
  /**
@@ -1811,7 +1739,7 @@ var BaseTransactionRequest = class {
1811
1739
  */
1812
1740
  getChangeOutputs() {
1813
1741
  return this.outputs.filter(
1814
- (output) => output.type === import_transactions6.OutputType.Change
1742
+ (output) => output.type === import_transactions5.OutputType.Change
1815
1743
  );
1816
1744
  }
1817
1745
  /**
@@ -1823,9 +1751,9 @@ var BaseTransactionRequest = class {
1823
1751
  const ownerAddress = (0, import_address.addressify)(owner);
1824
1752
  const found = this.inputs.find((input) => {
1825
1753
  switch (input.type) {
1826
- case import_transactions6.InputType.Coin:
1754
+ case import_transactions5.InputType.Coin:
1827
1755
  return (0, import_utils9.hexlify)(input.owner) === ownerAddress.toB256();
1828
- case import_transactions6.InputType.Message:
1756
+ case import_transactions5.InputType.Message:
1829
1757
  return (0, import_utils9.hexlify)(input.recipient) === ownerAddress.toB256();
1830
1758
  default:
1831
1759
  return false;
@@ -1854,7 +1782,7 @@ var BaseTransactionRequest = class {
1854
1782
  }
1855
1783
  const input = {
1856
1784
  ...coin,
1857
- type: import_transactions6.InputType.Coin,
1785
+ type: import_transactions5.InputType.Coin,
1858
1786
  owner: owner.toB256(),
1859
1787
  amount,
1860
1788
  assetId,
@@ -1886,7 +1814,7 @@ var BaseTransactionRequest = class {
1886
1814
  }
1887
1815
  const input = {
1888
1816
  ...message,
1889
- type: import_transactions6.InputType.Message,
1817
+ type: import_transactions5.InputType.Message,
1890
1818
  sender: sender.toB256(),
1891
1819
  recipient: recipient.toB256(),
1892
1820
  amount,
@@ -1958,7 +1886,7 @@ var BaseTransactionRequest = class {
1958
1886
  */
1959
1887
  addCoinOutput(to, amount, assetId) {
1960
1888
  this.pushOutput({
1961
- type: import_transactions6.OutputType.Coin,
1889
+ type: import_transactions5.OutputType.Coin,
1962
1890
  to: (0, import_address.addressify)(to).toB256(),
1963
1891
  amount,
1964
1892
  assetId: assetId ?? this.baseAssetId
@@ -1974,7 +1902,7 @@ var BaseTransactionRequest = class {
1974
1902
  addCoinOutputs(to, quantities) {
1975
1903
  quantities.map(coinQuantityfy).forEach((quantity) => {
1976
1904
  this.pushOutput({
1977
- type: import_transactions6.OutputType.Coin,
1905
+ type: import_transactions5.OutputType.Coin,
1978
1906
  to: (0, import_address.addressify)(to).toB256(),
1979
1907
  amount: quantity.amount,
1980
1908
  assetId: quantity.assetId
@@ -1994,7 +1922,7 @@ var BaseTransactionRequest = class {
1994
1922
  );
1995
1923
  if (!changeOutput) {
1996
1924
  this.pushOutput({
1997
- type: import_transactions6.OutputType.Change,
1925
+ type: import_transactions5.OutputType.Change,
1998
1926
  to: (0, import_address.addressify)(to).toB256(),
1999
1927
  assetId: assetId ?? this.baseAssetId
2000
1928
  });
@@ -2050,7 +1978,7 @@ var BaseTransactionRequest = class {
2050
1978
  let idCounter = 0;
2051
1979
  const generateId = () => {
2052
1980
  const counterString = String(idCounter++);
2053
- const id = import_configs6.ZeroBytes32.slice(0, -counterString.length).concat(counterString);
1981
+ const id = import_configs5.ZeroBytes32.slice(0, -counterString.length).concat(counterString);
2054
1982
  return id;
2055
1983
  };
2056
1984
  const findAssetInput = (assetId) => this.inputs.find((input) => {
@@ -2072,13 +2000,13 @@ var BaseTransactionRequest = class {
2072
2000
  assetId,
2073
2001
  owner: resourcesOwner || import_address.Address.fromRandom(),
2074
2002
  maturity: 0,
2075
- blockCreated: (0, import_math7.bn)(1),
2076
- txCreatedIdx: (0, import_math7.bn)(1)
2003
+ blockCreated: (0, import_math6.bn)(1),
2004
+ txCreatedIdx: (0, import_math6.bn)(1)
2077
2005
  }
2078
2006
  ]);
2079
2007
  }
2080
2008
  };
2081
- updateAssetInput(this.baseAssetId, (0, import_math7.bn)(1e11));
2009
+ updateAssetInput(this.baseAssetId, (0, import_math6.bn)(1e11));
2082
2010
  quantities.forEach((q) => updateAssetInput(q.assetId, q.amount));
2083
2011
  }
2084
2012
  /**
@@ -2089,7 +2017,7 @@ var BaseTransactionRequest = class {
2089
2017
  */
2090
2018
  getCoinOutputsQuantities() {
2091
2019
  const coinsQuantities = this.getCoinOutputs().map(({ amount, assetId }) => ({
2092
- amount: (0, import_math7.bn)(amount),
2020
+ amount: (0, import_math6.bn)(amount),
2093
2021
  assetId: assetId.toString()
2094
2022
  }));
2095
2023
  return coinsQuantities;
@@ -2107,18 +2035,18 @@ var BaseTransactionRequest = class {
2107
2035
  this.inputs.forEach((i) => {
2108
2036
  let correspondingInput;
2109
2037
  switch (i.type) {
2110
- case import_transactions6.InputType.Coin:
2111
- correspondingInput = inputs.find((x) => x.type === import_transactions6.InputType.Coin && x.owner === i.owner);
2038
+ case import_transactions5.InputType.Coin:
2039
+ correspondingInput = inputs.find((x) => x.type === import_transactions5.InputType.Coin && x.owner === i.owner);
2112
2040
  break;
2113
- case import_transactions6.InputType.Message:
2041
+ case import_transactions5.InputType.Message:
2114
2042
  correspondingInput = inputs.find(
2115
- (x) => x.type === import_transactions6.InputType.Message && x.sender === i.sender
2043
+ (x) => x.type === import_transactions5.InputType.Message && x.sender === i.sender
2116
2044
  );
2117
2045
  break;
2118
2046
  default:
2119
2047
  return;
2120
2048
  }
2121
- if (correspondingInput && "predicateGasUsed" in correspondingInput && (0, import_math7.bn)(correspondingInput.predicateGasUsed).gt(0)) {
2049
+ if (correspondingInput && "predicateGasUsed" in correspondingInput && (0, import_math6.bn)(correspondingInput.predicateGasUsed).gt(0)) {
2122
2050
  i.predicate = correspondingInput.predicate;
2123
2051
  i.predicateData = correspondingInput.predicateData;
2124
2052
  i.predicateGasUsed = correspondingInput.predicateGasUsed;
@@ -2128,47 +2056,47 @@ var BaseTransactionRequest = class {
2128
2056
  };
2129
2057
 
2130
2058
  // src/providers/transaction-request/create-transaction-request.ts
2131
- var import_configs8 = require("@fuel-ts/address/configs");
2132
- var import_math9 = require("@fuel-ts/math");
2133
- var import_transactions8 = require("@fuel-ts/transactions");
2059
+ var import_configs7 = require("@fuel-ts/address/configs");
2060
+ var import_math8 = require("@fuel-ts/math");
2061
+ var import_transactions7 = require("@fuel-ts/transactions");
2134
2062
  var import_utils13 = require("@fuel-ts/utils");
2135
2063
 
2136
2064
  // src/providers/transaction-request/hash-transaction.ts
2137
- var import_configs7 = require("@fuel-ts/address/configs");
2065
+ var import_configs6 = require("@fuel-ts/address/configs");
2138
2066
  var import_hasher = require("@fuel-ts/hasher");
2139
- var import_math8 = require("@fuel-ts/math");
2140
- var import_transactions7 = require("@fuel-ts/transactions");
2067
+ var import_math7 = require("@fuel-ts/math");
2068
+ var import_transactions6 = require("@fuel-ts/transactions");
2141
2069
  var import_utils11 = require("@fuel-ts/utils");
2142
2070
  var import_ramda2 = require("ramda");
2143
2071
  function hashTransaction(transactionRequest, chainId) {
2144
2072
  const transaction = transactionRequest.toTransaction();
2145
- if (transaction.type === import_transactions7.TransactionType.Script) {
2146
- transaction.receiptsRoot = import_configs7.ZeroBytes32;
2073
+ if (transaction.type === import_transactions6.TransactionType.Script) {
2074
+ transaction.receiptsRoot = import_configs6.ZeroBytes32;
2147
2075
  }
2148
2076
  transaction.inputs = transaction.inputs.map((input) => {
2149
2077
  const inputClone = (0, import_ramda2.clone)(input);
2150
2078
  switch (inputClone.type) {
2151
- case import_transactions7.InputType.Coin: {
2079
+ case import_transactions6.InputType.Coin: {
2152
2080
  inputClone.txPointer = {
2153
2081
  blockHeight: 0,
2154
2082
  txIndex: 0
2155
2083
  };
2156
- inputClone.predicateGasUsed = (0, import_math8.bn)(0);
2084
+ inputClone.predicateGasUsed = (0, import_math7.bn)(0);
2157
2085
  return inputClone;
2158
2086
  }
2159
- case import_transactions7.InputType.Message: {
2160
- inputClone.predicateGasUsed = (0, import_math8.bn)(0);
2087
+ case import_transactions6.InputType.Message: {
2088
+ inputClone.predicateGasUsed = (0, import_math7.bn)(0);
2161
2089
  return inputClone;
2162
2090
  }
2163
- case import_transactions7.InputType.Contract: {
2091
+ case import_transactions6.InputType.Contract: {
2164
2092
  inputClone.txPointer = {
2165
2093
  blockHeight: 0,
2166
2094
  txIndex: 0
2167
2095
  };
2168
- inputClone.txID = import_configs7.ZeroBytes32;
2096
+ inputClone.txID = import_configs6.ZeroBytes32;
2169
2097
  inputClone.outputIndex = 0;
2170
- inputClone.balanceRoot = import_configs7.ZeroBytes32;
2171
- inputClone.stateRoot = import_configs7.ZeroBytes32;
2098
+ inputClone.balanceRoot = import_configs6.ZeroBytes32;
2099
+ inputClone.stateRoot = import_configs6.ZeroBytes32;
2172
2100
  return inputClone;
2173
2101
  }
2174
2102
  default:
@@ -2178,19 +2106,19 @@ function hashTransaction(transactionRequest, chainId) {
2178
2106
  transaction.outputs = transaction.outputs.map((output) => {
2179
2107
  const outputClone = (0, import_ramda2.clone)(output);
2180
2108
  switch (outputClone.type) {
2181
- case import_transactions7.OutputType.Contract: {
2182
- outputClone.balanceRoot = import_configs7.ZeroBytes32;
2183
- outputClone.stateRoot = import_configs7.ZeroBytes32;
2109
+ case import_transactions6.OutputType.Contract: {
2110
+ outputClone.balanceRoot = import_configs6.ZeroBytes32;
2111
+ outputClone.stateRoot = import_configs6.ZeroBytes32;
2184
2112
  return outputClone;
2185
2113
  }
2186
- case import_transactions7.OutputType.Change: {
2187
- outputClone.amount = (0, import_math8.bn)(0);
2114
+ case import_transactions6.OutputType.Change: {
2115
+ outputClone.amount = (0, import_math7.bn)(0);
2188
2116
  return outputClone;
2189
2117
  }
2190
- case import_transactions7.OutputType.Variable: {
2191
- outputClone.to = import_configs7.ZeroBytes32;
2192
- outputClone.amount = (0, import_math8.bn)(0);
2193
- outputClone.assetId = import_configs7.ZeroBytes32;
2118
+ case import_transactions6.OutputType.Variable: {
2119
+ outputClone.to = import_configs6.ZeroBytes32;
2120
+ outputClone.amount = (0, import_math7.bn)(0);
2121
+ outputClone.assetId = import_configs6.ZeroBytes32;
2194
2122
  return outputClone;
2195
2123
  }
2196
2124
  default:
@@ -2200,7 +2128,7 @@ function hashTransaction(transactionRequest, chainId) {
2200
2128
  transaction.witnessesCount = 0;
2201
2129
  transaction.witnesses = [];
2202
2130
  const chainIdBytes = (0, import_hasher.uint64ToBytesBE)(chainId);
2203
- const concatenatedData = (0, import_utils11.concat)([chainIdBytes, new import_transactions7.TransactionCoder().encode(transaction)]);
2131
+ const concatenatedData = (0, import_utils11.concat)([chainIdBytes, new import_transactions6.TransactionCoder().encode(transaction)]);
2204
2132
  return (0, import_hasher.sha256)(concatenatedData);
2205
2133
  }
2206
2134
 
@@ -2236,7 +2164,7 @@ var CreateTransactionRequest = class extends BaseTransactionRequest {
2236
2164
  return new this(obj);
2237
2165
  }
2238
2166
  /** Type of the transaction */
2239
- type = import_transactions8.TransactionType.Create;
2167
+ type = import_transactions7.TransactionType.Create;
2240
2168
  /** Witness index of contract bytecode to create */
2241
2169
  bytecodeWitnessIndex;
2242
2170
  /** Salt */
@@ -2256,7 +2184,7 @@ var CreateTransactionRequest = class extends BaseTransactionRequest {
2256
2184
  } = {}) {
2257
2185
  super(rest);
2258
2186
  this.bytecodeWitnessIndex = bytecodeWitnessIndex ?? 0;
2259
- this.salt = (0, import_utils13.hexlify)(salt ?? import_configs8.ZeroBytes32);
2187
+ this.salt = (0, import_utils13.hexlify)(salt ?? import_configs7.ZeroBytes32);
2260
2188
  this.storageSlots = [...storageSlots ?? []];
2261
2189
  }
2262
2190
  /**
@@ -2269,12 +2197,12 @@ var CreateTransactionRequest = class extends BaseTransactionRequest {
2269
2197
  const bytecodeWitnessIndex = this.bytecodeWitnessIndex;
2270
2198
  const storageSlots = this.storageSlots?.map(storageSlotify) ?? [];
2271
2199
  return {
2272
- type: import_transactions8.TransactionType.Create,
2200
+ type: import_transactions7.TransactionType.Create,
2273
2201
  ...baseTransaction,
2274
2202
  bytecodeLength: baseTransaction.witnesses[bytecodeWitnessIndex].dataLength / 4,
2275
2203
  bytecodeWitnessIndex,
2276
2204
  storageSlotsCount: storageSlots.length,
2277
- salt: this.salt ? (0, import_utils13.hexlify)(this.salt) : import_configs8.ZeroBytes32,
2205
+ salt: this.salt ? (0, import_utils13.hexlify)(this.salt) : import_configs7.ZeroBytes32,
2278
2206
  storageSlots
2279
2207
  };
2280
2208
  }
@@ -2285,7 +2213,7 @@ var CreateTransactionRequest = class extends BaseTransactionRequest {
2285
2213
  */
2286
2214
  getContractCreatedOutputs() {
2287
2215
  return this.outputs.filter(
2288
- (output) => output.type === import_transactions8.OutputType.ContractCreated
2216
+ (output) => output.type === import_transactions7.OutputType.ContractCreated
2289
2217
  );
2290
2218
  }
2291
2219
  /**
@@ -2306,14 +2234,14 @@ var CreateTransactionRequest = class extends BaseTransactionRequest {
2306
2234
  */
2307
2235
  addContractCreatedOutput(contractId, stateRoot) {
2308
2236
  this.pushOutput({
2309
- type: import_transactions8.OutputType.ContractCreated,
2237
+ type: import_transactions7.OutputType.ContractCreated,
2310
2238
  contractId,
2311
2239
  stateRoot
2312
2240
  });
2313
2241
  }
2314
2242
  metadataGas(gasCosts) {
2315
2243
  return calculateMetadataGasForTxCreate({
2316
- contractBytesSize: (0, import_math9.bn)((0, import_utils13.arrayify)(this.witnesses[this.bytecodeWitnessIndex] || "0x").length),
2244
+ contractBytesSize: (0, import_math8.bn)((0, import_utils13.arrayify)(this.witnesses[this.bytecodeWitnessIndex] || "0x").length),
2317
2245
  gasCosts,
2318
2246
  stateRootSize: this.storageSlots.length,
2319
2247
  txBytesSize: this.byteSize()
@@ -2324,9 +2252,9 @@ var CreateTransactionRequest = class extends BaseTransactionRequest {
2324
2252
  // src/providers/transaction-request/script-transaction-request.ts
2325
2253
  var import_abi_coder = require("@fuel-ts/abi-coder");
2326
2254
  var import_address2 = require("@fuel-ts/address");
2327
- var import_configs9 = require("@fuel-ts/address/configs");
2328
- var import_math10 = require("@fuel-ts/math");
2329
- var import_transactions9 = require("@fuel-ts/transactions");
2255
+ var import_configs8 = require("@fuel-ts/address/configs");
2256
+ var import_math9 = require("@fuel-ts/math");
2257
+ var import_transactions8 = require("@fuel-ts/transactions");
2330
2258
  var import_utils15 = require("@fuel-ts/utils");
2331
2259
 
2332
2260
  // src/providers/transaction-request/scripts.ts
@@ -2364,7 +2292,7 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
2364
2292
  return new this(obj);
2365
2293
  }
2366
2294
  /** Type of the transaction */
2367
- type = import_transactions9.TransactionType.Script;
2295
+ type = import_transactions8.TransactionType.Script;
2368
2296
  /** Gas limit for transaction */
2369
2297
  gasLimit;
2370
2298
  /** Script to execute */
@@ -2379,7 +2307,7 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
2379
2307
  */
2380
2308
  constructor({ script, scriptData, gasLimit, ...rest } = {}) {
2381
2309
  super(rest);
2382
- this.gasLimit = (0, import_math10.bn)(gasLimit);
2310
+ this.gasLimit = (0, import_math9.bn)(gasLimit);
2383
2311
  this.script = (0, import_utils15.arrayify)(script ?? returnZeroScript.bytes);
2384
2312
  this.scriptData = (0, import_utils15.arrayify)(scriptData ?? returnZeroScript.encodeScriptData());
2385
2313
  this.abis = rest.abis;
@@ -2393,12 +2321,12 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
2393
2321
  const script = (0, import_utils15.arrayify)(this.script ?? "0x");
2394
2322
  const scriptData = (0, import_utils15.arrayify)(this.scriptData ?? "0x");
2395
2323
  return {
2396
- type: import_transactions9.TransactionType.Script,
2324
+ type: import_transactions8.TransactionType.Script,
2397
2325
  scriptGasLimit: this.gasLimit,
2398
2326
  ...super.getBaseTransaction(),
2399
2327
  scriptLength: script.length,
2400
2328
  scriptDataLength: scriptData.length,
2401
- receiptsRoot: import_configs9.ZeroBytes32,
2329
+ receiptsRoot: import_configs8.ZeroBytes32,
2402
2330
  script: (0, import_utils15.hexlify)(script),
2403
2331
  scriptData: (0, import_utils15.hexlify)(scriptData)
2404
2332
  };
@@ -2410,7 +2338,7 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
2410
2338
  */
2411
2339
  getContractInputs() {
2412
2340
  return this.inputs.filter(
2413
- (input) => input.type === import_transactions9.InputType.Contract
2341
+ (input) => input.type === import_transactions8.InputType.Contract
2414
2342
  );
2415
2343
  }
2416
2344
  /**
@@ -2420,7 +2348,7 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
2420
2348
  */
2421
2349
  getContractOutputs() {
2422
2350
  return this.outputs.filter(
2423
- (output) => output.type === import_transactions9.OutputType.Contract
2351
+ (output) => output.type === import_transactions8.OutputType.Contract
2424
2352
  );
2425
2353
  }
2426
2354
  /**
@@ -2430,7 +2358,7 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
2430
2358
  */
2431
2359
  getVariableOutputs() {
2432
2360
  return this.outputs.filter(
2433
- (output) => output.type === import_transactions9.OutputType.Variable
2361
+ (output) => output.type === import_transactions8.OutputType.Variable
2434
2362
  );
2435
2363
  }
2436
2364
  /**
@@ -2453,7 +2381,7 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
2453
2381
  let outputsNumber = numberOfVariables;
2454
2382
  while (outputsNumber) {
2455
2383
  this.pushOutput({
2456
- type: import_transactions9.OutputType.Variable
2384
+ type: import_transactions8.OutputType.Variable
2457
2385
  });
2458
2386
  outputsNumber -= 1;
2459
2387
  }
@@ -2486,12 +2414,12 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
2486
2414
  return this;
2487
2415
  }
2488
2416
  const inputIndex = super.pushInput({
2489
- type: import_transactions9.InputType.Contract,
2417
+ type: import_transactions8.InputType.Contract,
2490
2418
  contractId: contractAddress.toB256(),
2491
2419
  txPointer: "0x00000000000000000000000000000000"
2492
2420
  });
2493
2421
  this.pushOutput({
2494
- type: import_transactions9.OutputType.Contract,
2422
+ type: import_transactions8.OutputType.Contract,
2495
2423
  inputIndex
2496
2424
  });
2497
2425
  return this;
@@ -2527,38 +2455,38 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
2527
2455
  };
2528
2456
 
2529
2457
  // src/providers/transaction-request/utils.ts
2530
- var import_errors9 = require("@fuel-ts/errors");
2531
- var import_transactions10 = require("@fuel-ts/transactions");
2458
+ var import_errors8 = require("@fuel-ts/errors");
2459
+ var import_transactions9 = require("@fuel-ts/transactions");
2532
2460
  var transactionRequestify = (obj) => {
2533
2461
  if (obj instanceof ScriptTransactionRequest || obj instanceof CreateTransactionRequest) {
2534
2462
  return obj;
2535
2463
  }
2536
2464
  const { type } = obj;
2537
2465
  switch (obj.type) {
2538
- case import_transactions10.TransactionType.Script: {
2466
+ case import_transactions9.TransactionType.Script: {
2539
2467
  return ScriptTransactionRequest.from(obj);
2540
2468
  }
2541
- case import_transactions10.TransactionType.Create: {
2469
+ case import_transactions9.TransactionType.Create: {
2542
2470
  return CreateTransactionRequest.from(obj);
2543
2471
  }
2544
2472
  default: {
2545
- throw new import_errors9.FuelError(import_errors9.ErrorCode.INVALID_TRANSACTION_TYPE, `Invalid transaction type: ${type}.`);
2473
+ throw new import_errors8.FuelError(import_errors8.ErrorCode.INVALID_TRANSACTION_TYPE, `Invalid transaction type: ${type}.`);
2546
2474
  }
2547
2475
  }
2548
2476
  };
2549
2477
 
2550
2478
  // src/providers/transaction-response/transaction-response.ts
2551
- var import_errors13 = require("@fuel-ts/errors");
2552
- var import_math14 = require("@fuel-ts/math");
2553
- var import_transactions17 = require("@fuel-ts/transactions");
2479
+ var import_errors12 = require("@fuel-ts/errors");
2480
+ var import_math13 = require("@fuel-ts/math");
2481
+ var import_transactions16 = require("@fuel-ts/transactions");
2554
2482
  var import_utils21 = require("@fuel-ts/utils");
2555
2483
 
2556
2484
  // src/providers/transaction-summary/assemble-transaction-summary.ts
2557
2485
  var import_utils19 = require("@fuel-ts/utils");
2558
2486
 
2559
2487
  // src/providers/transaction-summary/calculate-transaction-fee.ts
2560
- var import_math11 = require("@fuel-ts/math");
2561
- var import_transactions11 = require("@fuel-ts/transactions");
2488
+ var import_math10 = require("@fuel-ts/math");
2489
+ var import_transactions10 = require("@fuel-ts/transactions");
2562
2490
  var import_utils16 = require("@fuel-ts/utils");
2563
2491
  var calculateTransactionFee = (params) => {
2564
2492
  const {
@@ -2566,24 +2494,24 @@ var calculateTransactionFee = (params) => {
2566
2494
  rawPayload,
2567
2495
  consensusParameters: { gasCosts, feeParams }
2568
2496
  } = params;
2569
- const gasPerByte = (0, import_math11.bn)(feeParams.gasPerByte);
2570
- const gasPriceFactor = (0, import_math11.bn)(feeParams.gasPriceFactor);
2497
+ const gasPerByte = (0, import_math10.bn)(feeParams.gasPerByte);
2498
+ const gasPriceFactor = (0, import_math10.bn)(feeParams.gasPriceFactor);
2571
2499
  const transactionBytes = (0, import_utils16.arrayify)(rawPayload);
2572
- const [transaction] = new import_transactions11.TransactionCoder().decode(transactionBytes, 0);
2573
- if (transaction.type === import_transactions11.TransactionType.Mint) {
2500
+ const [transaction] = new import_transactions10.TransactionCoder().decode(transactionBytes, 0);
2501
+ if (transaction.type === import_transactions10.TransactionType.Mint) {
2574
2502
  return {
2575
- fee: (0, import_math11.bn)(0),
2576
- minFee: (0, import_math11.bn)(0),
2577
- maxFee: (0, import_math11.bn)(0),
2578
- feeFromGasUsed: (0, import_math11.bn)(0)
2503
+ fee: (0, import_math10.bn)(0),
2504
+ minFee: (0, import_math10.bn)(0),
2505
+ maxFee: (0, import_math10.bn)(0),
2506
+ feeFromGasUsed: (0, import_math10.bn)(0)
2579
2507
  };
2580
2508
  }
2581
2509
  const { type, witnesses, inputs, policies } = transaction;
2582
- let metadataGas = (0, import_math11.bn)(0);
2583
- let gasLimit = (0, import_math11.bn)(0);
2584
- if (type === import_transactions11.TransactionType.Create) {
2510
+ let metadataGas = (0, import_math10.bn)(0);
2511
+ let gasLimit = (0, import_math10.bn)(0);
2512
+ if (type === import_transactions10.TransactionType.Create) {
2585
2513
  const { bytecodeWitnessIndex, storageSlots } = transaction;
2586
- const contractBytesSize = (0, import_math11.bn)((0, import_utils16.arrayify)(witnesses[bytecodeWitnessIndex].data).length);
2514
+ const contractBytesSize = (0, import_math10.bn)((0, import_utils16.arrayify)(witnesses[bytecodeWitnessIndex].data).length);
2587
2515
  metadataGas = calculateMetadataGasForTxCreate({
2588
2516
  contractBytesSize,
2589
2517
  gasCosts,
@@ -2602,13 +2530,13 @@ var calculateTransactionFee = (params) => {
2602
2530
  }
2603
2531
  const minGas = getMinGas({
2604
2532
  gasCosts,
2605
- gasPerByte: (0, import_math11.bn)(gasPerByte),
2533
+ gasPerByte: (0, import_math10.bn)(gasPerByte),
2606
2534
  inputs,
2607
2535
  metadataGas,
2608
2536
  txBytesSize: transactionBytes.length
2609
2537
  });
2610
- const gasPrice = (0, import_math11.bn)(policies.find((policy) => policy.type === import_transactions11.PolicyType.GasPrice)?.data);
2611
- const witnessLimit = policies.find((policy) => policy.type === import_transactions11.PolicyType.WitnessLimit)?.data;
2538
+ const gasPrice = (0, import_math10.bn)(policies.find((policy) => policy.type === import_transactions10.PolicyType.GasPrice)?.data);
2539
+ const witnessLimit = policies.find((policy) => policy.type === import_transactions10.PolicyType.WitnessLimit)?.data;
2612
2540
  const witnessesLength = witnesses.reduce((acc, wit) => acc + wit.dataLength, 0);
2613
2541
  const maxGas = getMaxGas({
2614
2542
  gasPerByte,
@@ -2630,14 +2558,14 @@ var calculateTransactionFee = (params) => {
2630
2558
  };
2631
2559
 
2632
2560
  // src/providers/transaction-summary/operations.ts
2633
- var import_configs10 = require("@fuel-ts/address/configs");
2634
- var import_errors11 = require("@fuel-ts/errors");
2635
- var import_math13 = require("@fuel-ts/math");
2636
- var import_transactions14 = require("@fuel-ts/transactions");
2561
+ var import_configs9 = 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");
2637
2565
 
2638
2566
  // src/providers/transaction-summary/call.ts
2639
2567
  var import_abi_coder2 = require("@fuel-ts/abi-coder");
2640
- var import_math12 = require("@fuel-ts/math");
2568
+ var import_math11 = require("@fuel-ts/math");
2641
2569
  var getFunctionCall = ({ abi, receipt, rawPayload, maxInputs }) => {
2642
2570
  const abiInterface = new import_abi_coder2.Interface(abi);
2643
2571
  const callFunctionSelector = receipt.param1.toHex(8);
@@ -2646,7 +2574,7 @@ var getFunctionCall = ({ abi, receipt, rawPayload, maxInputs }) => {
2646
2574
  let encodedArgs;
2647
2575
  if (functionFragment.isInputDataPointer) {
2648
2576
  if (rawPayload) {
2649
- const argsOffset = (0, import_math12.bn)(receipt.param2).sub((0, import_abi_coder2.calculateVmTxMemory)({ maxInputs: maxInputs.toNumber() })).toNumber();
2577
+ const argsOffset = (0, import_math11.bn)(receipt.param2).sub((0, import_abi_coder2.calculateVmTxMemory)({ maxInputs: maxInputs.toNumber() })).toNumber();
2650
2578
  encodedArgs = `0x${rawPayload.slice(2).slice(argsOffset * 2)}`;
2651
2579
  }
2652
2580
  } else {
@@ -2680,8 +2608,8 @@ var getFunctionCall = ({ abi, receipt, rawPayload, maxInputs }) => {
2680
2608
  };
2681
2609
 
2682
2610
  // src/providers/transaction-summary/input.ts
2683
- var import_errors10 = require("@fuel-ts/errors");
2684
- var import_transactions12 = require("@fuel-ts/transactions");
2611
+ var import_errors9 = require("@fuel-ts/errors");
2612
+ var import_transactions11 = require("@fuel-ts/transactions");
2685
2613
  function getInputsByTypes(inputs, types) {
2686
2614
  return inputs.filter((i) => types.includes(i.type));
2687
2615
  }
@@ -2689,16 +2617,16 @@ function getInputsByType(inputs, type) {
2689
2617
  return inputs.filter((i) => i.type === type);
2690
2618
  }
2691
2619
  function getInputsCoin(inputs) {
2692
- return getInputsByType(inputs, import_transactions12.InputType.Coin);
2620
+ return getInputsByType(inputs, import_transactions11.InputType.Coin);
2693
2621
  }
2694
2622
  function getInputsMessage(inputs) {
2695
- return getInputsByType(inputs, import_transactions12.InputType.Message);
2623
+ return getInputsByType(inputs, import_transactions11.InputType.Message);
2696
2624
  }
2697
2625
  function getInputsCoinAndMessage(inputs) {
2698
- return getInputsByTypes(inputs, [import_transactions12.InputType.Coin, import_transactions12.InputType.Message]);
2626
+ return getInputsByTypes(inputs, [import_transactions11.InputType.Coin, import_transactions11.InputType.Message]);
2699
2627
  }
2700
2628
  function getInputsContract(inputs) {
2701
- return getInputsByType(inputs, import_transactions12.InputType.Contract);
2629
+ return getInputsByType(inputs, import_transactions11.InputType.Contract);
2702
2630
  }
2703
2631
  function getInputFromAssetId(inputs, assetId) {
2704
2632
  const coinInputs = getInputsCoin(inputs);
@@ -2717,40 +2645,40 @@ function getInputContractFromIndex(inputs, inputIndex) {
2717
2645
  if (!contractInput) {
2718
2646
  return void 0;
2719
2647
  }
2720
- if (contractInput.type !== import_transactions12.InputType.Contract) {
2721
- throw new import_errors10.FuelError(
2722
- import_errors10.ErrorCode.INVALID_TRANSACTION_INPUT,
2648
+ if (contractInput.type !== import_transactions11.InputType.Contract) {
2649
+ throw new import_errors9.FuelError(
2650
+ import_errors9.ErrorCode.INVALID_TRANSACTION_INPUT,
2723
2651
  `Contract input should be of type 'contract'.`
2724
2652
  );
2725
2653
  }
2726
2654
  return contractInput;
2727
2655
  }
2728
2656
  function getInputAccountAddress(input) {
2729
- if (input.type === import_transactions12.InputType.Coin) {
2657
+ if (input.type === import_transactions11.InputType.Coin) {
2730
2658
  return input.owner.toString();
2731
2659
  }
2732
- if (input.type === import_transactions12.InputType.Message) {
2660
+ if (input.type === import_transactions11.InputType.Message) {
2733
2661
  return input.recipient.toString();
2734
2662
  }
2735
2663
  return "";
2736
2664
  }
2737
2665
 
2738
2666
  // src/providers/transaction-summary/output.ts
2739
- var import_transactions13 = require("@fuel-ts/transactions");
2667
+ var import_transactions12 = require("@fuel-ts/transactions");
2740
2668
  function getOutputsByType(outputs, type) {
2741
2669
  return outputs.filter((o) => o.type === type);
2742
2670
  }
2743
2671
  function getOutputsContractCreated(outputs) {
2744
- return getOutputsByType(outputs, import_transactions13.OutputType.ContractCreated);
2672
+ return getOutputsByType(outputs, import_transactions12.OutputType.ContractCreated);
2745
2673
  }
2746
2674
  function getOutputsCoin(outputs) {
2747
- return getOutputsByType(outputs, import_transactions13.OutputType.Coin);
2675
+ return getOutputsByType(outputs, import_transactions12.OutputType.Coin);
2748
2676
  }
2749
2677
  function getOutputsChange(outputs) {
2750
- return getOutputsByType(outputs, import_transactions13.OutputType.Change);
2678
+ return getOutputsByType(outputs, import_transactions12.OutputType.Change);
2751
2679
  }
2752
2680
  function getOutputsContract(outputs) {
2753
- return getOutputsByType(outputs, import_transactions13.OutputType.Contract);
2681
+ return getOutputsByType(outputs, import_transactions12.OutputType.Contract);
2754
2682
  }
2755
2683
 
2756
2684
  // src/providers/transaction-summary/operations.ts
@@ -2759,15 +2687,15 @@ function getReceiptsByType(receipts, type) {
2759
2687
  }
2760
2688
  function getTransactionTypeName(transactionType) {
2761
2689
  switch (transactionType) {
2762
- case import_transactions14.TransactionType.Mint:
2690
+ case import_transactions13.TransactionType.Mint:
2763
2691
  return "Mint" /* Mint */;
2764
- case import_transactions14.TransactionType.Create:
2692
+ case import_transactions13.TransactionType.Create:
2765
2693
  return "Create" /* Create */;
2766
- case import_transactions14.TransactionType.Script:
2694
+ case import_transactions13.TransactionType.Script:
2767
2695
  return "Script" /* Script */;
2768
2696
  default:
2769
- throw new import_errors11.FuelError(
2770
- import_errors11.ErrorCode.INVALID_TRANSACTION_TYPE,
2697
+ throw new import_errors10.FuelError(
2698
+ import_errors10.ErrorCode.INVALID_TRANSACTION_TYPE,
2771
2699
  `Invalid transaction type: ${transactionType}.`
2772
2700
  );
2773
2701
  }
@@ -2786,10 +2714,10 @@ function isTypeScript(transactionType) {
2786
2714
  return isType(transactionType, "Script" /* Script */);
2787
2715
  }
2788
2716
  function getReceiptsCall(receipts) {
2789
- return getReceiptsByType(receipts, import_transactions14.ReceiptType.Call);
2717
+ return getReceiptsByType(receipts, import_transactions13.ReceiptType.Call);
2790
2718
  }
2791
2719
  function getReceiptsMessageOut(receipts) {
2792
- return getReceiptsByType(receipts, import_transactions14.ReceiptType.MessageOut);
2720
+ return getReceiptsByType(receipts, import_transactions13.ReceiptType.MessageOut);
2793
2721
  }
2794
2722
  var mergeAssets = (op1, op2) => {
2795
2723
  const assets1 = op1.assetsSent || [];
@@ -2802,7 +2730,7 @@ var mergeAssets = (op1, op2) => {
2802
2730
  if (!matchingAsset) {
2803
2731
  return asset1;
2804
2732
  }
2805
- const mergedAmount = (0, import_math13.bn)(asset1.amount).add(matchingAsset.amount);
2733
+ const mergedAmount = (0, import_math12.bn)(asset1.amount).add(matchingAsset.amount);
2806
2734
  return { ...asset1, amount: mergedAmount };
2807
2735
  });
2808
2736
  return mergedAssets.concat(filteredAssets);
@@ -2928,7 +2856,7 @@ function extractTransferOperationFromReceipt(receipt, contractInputs, changeOutp
2928
2856
  const { to: toAddress, assetId, amount } = receipt;
2929
2857
  let { from: fromAddress } = receipt;
2930
2858
  const toType = contractInputs.some((input) => input.contractID === toAddress) ? 0 /* contract */ : 1 /* account */;
2931
- if (import_configs10.ZeroBytes32 === fromAddress) {
2859
+ if (import_configs9.ZeroBytes32 === fromAddress) {
2932
2860
  const change = changeOutputs.find((output) => output.assetId === assetId);
2933
2861
  fromAddress = change?.to || fromAddress;
2934
2862
  }
@@ -2985,11 +2913,11 @@ function getTransferOperations({
2985
2913
  });
2986
2914
  const transferReceipts = getReceiptsByType(
2987
2915
  receipts,
2988
- import_transactions14.ReceiptType.Transfer
2916
+ import_transactions13.ReceiptType.Transfer
2989
2917
  );
2990
2918
  const transferOutReceipts = getReceiptsByType(
2991
2919
  receipts,
2992
- import_transactions14.ReceiptType.TransferOut
2920
+ import_transactions13.ReceiptType.TransferOut
2993
2921
  );
2994
2922
  [...transferReceipts, ...transferOutReceipts].forEach((receipt) => {
2995
2923
  const operation = extractTransferOperationFromReceipt(receipt, contractInputs, changeOutputs);
@@ -3074,17 +3002,17 @@ function getOperations({
3074
3002
  }
3075
3003
 
3076
3004
  // src/providers/transaction-summary/receipt.ts
3077
- var import_transactions15 = require("@fuel-ts/transactions");
3005
+ var import_transactions14 = require("@fuel-ts/transactions");
3078
3006
  var processGqlReceipt = (gqlReceipt) => {
3079
3007
  const receipt = assembleReceiptByType(gqlReceipt);
3080
3008
  switch (receipt.type) {
3081
- case import_transactions15.ReceiptType.ReturnData: {
3009
+ case import_transactions14.ReceiptType.ReturnData: {
3082
3010
  return {
3083
3011
  ...receipt,
3084
3012
  data: gqlReceipt.data || "0x"
3085
3013
  };
3086
3014
  }
3087
- case import_transactions15.ReceiptType.LogData: {
3015
+ case import_transactions14.ReceiptType.LogData: {
3088
3016
  return {
3089
3017
  ...receipt,
3090
3018
  data: gqlReceipt.data || "0x"
@@ -3097,7 +3025,7 @@ var processGqlReceipt = (gqlReceipt) => {
3097
3025
  var extractMintedAssetsFromReceipts = (receipts) => {
3098
3026
  const mintedAssets = [];
3099
3027
  receipts.forEach((receipt) => {
3100
- if (receipt.type === import_transactions15.ReceiptType.Mint) {
3028
+ if (receipt.type === import_transactions14.ReceiptType.Mint) {
3101
3029
  mintedAssets.push({
3102
3030
  subId: receipt.subId,
3103
3031
  contractId: receipt.contractId,
@@ -3111,7 +3039,7 @@ var extractMintedAssetsFromReceipts = (receipts) => {
3111
3039
  var extractBurnedAssetsFromReceipts = (receipts) => {
3112
3040
  const burnedAssets = [];
3113
3041
  receipts.forEach((receipt) => {
3114
- if (receipt.type === import_transactions15.ReceiptType.Burn) {
3042
+ if (receipt.type === import_transactions14.ReceiptType.Burn) {
3115
3043
  burnedAssets.push({
3116
3044
  subId: receipt.subId,
3117
3045
  contractId: receipt.contractId,
@@ -3124,7 +3052,7 @@ var extractBurnedAssetsFromReceipts = (receipts) => {
3124
3052
  };
3125
3053
 
3126
3054
  // src/providers/transaction-summary/status.ts
3127
- var import_errors12 = require("@fuel-ts/errors");
3055
+ var import_errors11 = require("@fuel-ts/errors");
3128
3056
  var getTransactionStatusName = (gqlStatus) => {
3129
3057
  switch (gqlStatus) {
3130
3058
  case "FailureStatus":
@@ -3136,8 +3064,8 @@ var getTransactionStatusName = (gqlStatus) => {
3136
3064
  case "SqueezedOutStatus":
3137
3065
  return "squeezedout" /* squeezedout */;
3138
3066
  default:
3139
- throw new import_errors12.FuelError(
3140
- import_errors12.ErrorCode.INVALID_TRANSACTION_STATUS,
3067
+ throw new import_errors11.FuelError(
3068
+ import_errors11.ErrorCode.INVALID_TRANSACTION_STATUS,
3141
3069
  `Invalid transaction status: ${gqlStatus}.`
3142
3070
  );
3143
3071
  }
@@ -3250,12 +3178,12 @@ function assembleTransactionSummary(params) {
3250
3178
 
3251
3179
  // src/providers/transaction-response/getDecodedLogs.ts
3252
3180
  var import_abi_coder3 = require("@fuel-ts/abi-coder");
3253
- var import_transactions16 = require("@fuel-ts/transactions");
3181
+ var import_transactions15 = require("@fuel-ts/transactions");
3254
3182
  function getDecodedLogs(receipts, mainAbi, externalAbis = {}) {
3255
3183
  return receipts.reduce((logs, receipt) => {
3256
- if (receipt.type === import_transactions16.ReceiptType.LogData || receipt.type === import_transactions16.ReceiptType.Log) {
3184
+ if (receipt.type === import_transactions15.ReceiptType.LogData || receipt.type === import_transactions15.ReceiptType.Log) {
3257
3185
  const interfaceToUse = new import_abi_coder3.Interface(externalAbis[receipt.id] || mainAbi);
3258
- const data = receipt.type === import_transactions16.ReceiptType.Log ? new import_abi_coder3.BigNumberCoder("u64").encode(receipt.val0) : receipt.data;
3186
+ const data = receipt.type === import_transactions15.ReceiptType.Log ? new import_abi_coder3.BigNumberCoder("u64").encode(receipt.val0) : receipt.data;
3259
3187
  const [decodedLog] = interfaceToUse.decodeLog(data, receipt.val1.toNumber());
3260
3188
  logs.push(decodedLog);
3261
3189
  }
@@ -3270,7 +3198,7 @@ var TransactionResponse = class {
3270
3198
  /** Current provider */
3271
3199
  provider;
3272
3200
  /** Gas used on the transaction */
3273
- gasUsed = (0, import_math14.bn)(0);
3201
+ gasUsed = (0, import_math13.bn)(0);
3274
3202
  /** The graphql Transaction with receipts object. */
3275
3203
  gqlTransaction;
3276
3204
  abis;
@@ -3328,7 +3256,7 @@ var TransactionResponse = class {
3328
3256
  * @returns The decoded transaction.
3329
3257
  */
3330
3258
  decodeTransaction(transactionWithReceipts) {
3331
- return new import_transactions17.TransactionCoder().decode(
3259
+ return new import_transactions16.TransactionCoder().decode(
3332
3260
  (0, import_utils21.arrayify)(transactionWithReceipts.rawPayload),
3333
3261
  0
3334
3262
  )?.[0];
@@ -3375,8 +3303,8 @@ var TransactionResponse = class {
3375
3303
  });
3376
3304
  for await (const { statusChange } of subscription) {
3377
3305
  if (statusChange.type === "SqueezedOutStatus") {
3378
- throw new import_errors13.FuelError(
3379
- import_errors13.ErrorCode.TRANSACTION_SQUEEZED_OUT,
3306
+ throw new import_errors12.FuelError(
3307
+ import_errors12.ErrorCode.TRANSACTION_SQUEEZED_OUT,
3380
3308
  `Transaction Squeezed Out with reason: ${statusChange.reason}`
3381
3309
  );
3382
3310
  }
@@ -3398,26 +3326,14 @@ var TransactionResponse = class {
3398
3326
  gqlTransaction: this.gqlTransaction,
3399
3327
  ...transactionSummary
3400
3328
  };
3401
- let logs = [];
3402
3329
  if (this.abis) {
3403
- logs = getDecodedLogs(
3330
+ const logs = getDecodedLogs(
3404
3331
  transactionSummary.receipts,
3405
3332
  this.abis.main,
3406
3333
  this.abis.otherContractsAbis
3407
3334
  );
3408
3335
  transactionResult.logs = logs;
3409
3336
  }
3410
- if (transactionResult.isStatusFailure) {
3411
- const {
3412
- receipts,
3413
- gqlTransaction: { status }
3414
- } = transactionResult;
3415
- throw extractTxError({
3416
- receipts,
3417
- status,
3418
- logs
3419
- });
3420
- }
3421
3337
  return transactionResult;
3422
3338
  }
3423
3339
  /**
@@ -3426,7 +3342,14 @@ var TransactionResponse = class {
3426
3342
  * @param contractsAbiMap - The contracts ABI map.
3427
3343
  */
3428
3344
  async wait(contractsAbiMap) {
3429
- return this.waitForResult(contractsAbiMap);
3345
+ const result = await this.waitForResult(contractsAbiMap);
3346
+ if (result.isStatusFailure) {
3347
+ throw new import_errors12.FuelError(
3348
+ import_errors12.ErrorCode.TRANSACTION_FAILED,
3349
+ `Transaction failed: ${result.gqlTransaction.status.reason}`
3350
+ );
3351
+ }
3352
+ return result;
3430
3353
  }
3431
3354
  };
3432
3355
 
@@ -3488,30 +3411,30 @@ var processGqlChain = (chain) => {
3488
3411
  const { contractParams, feeParams, predicateParams, scriptParams, txParams, gasCosts } = consensusParameters;
3489
3412
  return {
3490
3413
  name,
3491
- baseChainHeight: (0, import_math15.bn)(daHeight),
3414
+ baseChainHeight: (0, import_math14.bn)(daHeight),
3492
3415
  consensusParameters: {
3493
- contractMaxSize: (0, import_math15.bn)(contractParams.contractMaxSize),
3494
- maxInputs: (0, import_math15.bn)(txParams.maxInputs),
3495
- maxOutputs: (0, import_math15.bn)(txParams.maxOutputs),
3496
- maxWitnesses: (0, import_math15.bn)(txParams.maxWitnesses),
3497
- maxGasPerTx: (0, import_math15.bn)(txParams.maxGasPerTx),
3498
- maxScriptLength: (0, import_math15.bn)(scriptParams.maxScriptLength),
3499
- maxScriptDataLength: (0, import_math15.bn)(scriptParams.maxScriptDataLength),
3500
- maxStorageSlots: (0, import_math15.bn)(contractParams.maxStorageSlots),
3501
- maxPredicateLength: (0, import_math15.bn)(predicateParams.maxPredicateLength),
3502
- maxPredicateDataLength: (0, import_math15.bn)(predicateParams.maxPredicateDataLength),
3503
- maxGasPerPredicate: (0, import_math15.bn)(predicateParams.maxGasPerPredicate),
3504
- gasPriceFactor: (0, import_math15.bn)(feeParams.gasPriceFactor),
3505
- gasPerByte: (0, import_math15.bn)(feeParams.gasPerByte),
3506
- maxMessageDataLength: (0, import_math15.bn)(predicateParams.maxMessageDataLength),
3507
- chainId: (0, import_math15.bn)(consensusParameters.chainId),
3416
+ contractMaxSize: (0, import_math14.bn)(contractParams.contractMaxSize),
3417
+ maxInputs: (0, import_math14.bn)(txParams.maxInputs),
3418
+ maxOutputs: (0, import_math14.bn)(txParams.maxOutputs),
3419
+ maxWitnesses: (0, import_math14.bn)(txParams.maxWitnesses),
3420
+ maxGasPerTx: (0, import_math14.bn)(txParams.maxGasPerTx),
3421
+ maxScriptLength: (0, import_math14.bn)(scriptParams.maxScriptLength),
3422
+ maxScriptDataLength: (0, import_math14.bn)(scriptParams.maxScriptDataLength),
3423
+ maxStorageSlots: (0, import_math14.bn)(contractParams.maxStorageSlots),
3424
+ maxPredicateLength: (0, import_math14.bn)(predicateParams.maxPredicateLength),
3425
+ maxPredicateDataLength: (0, import_math14.bn)(predicateParams.maxPredicateDataLength),
3426
+ maxGasPerPredicate: (0, import_math14.bn)(predicateParams.maxGasPerPredicate),
3427
+ gasPriceFactor: (0, import_math14.bn)(feeParams.gasPriceFactor),
3428
+ gasPerByte: (0, import_math14.bn)(feeParams.gasPerByte),
3429
+ maxMessageDataLength: (0, import_math14.bn)(predicateParams.maxMessageDataLength),
3430
+ chainId: (0, import_math14.bn)(consensusParameters.chainId),
3508
3431
  baseAssetId: consensusParameters.baseAssetId,
3509
3432
  gasCosts
3510
3433
  },
3511
3434
  gasCosts,
3512
3435
  latestBlock: {
3513
3436
  id: latestBlock.id,
3514
- height: (0, import_math15.bn)(latestBlock.header.height),
3437
+ height: (0, import_math14.bn)(latestBlock.header.height),
3515
3438
  time: latestBlock.header.time,
3516
3439
  transactions: latestBlock.transactions.map((i) => ({
3517
3440
  id: i.id
@@ -3581,8 +3504,8 @@ var _Provider = class {
3581
3504
  getChain() {
3582
3505
  const chain = _Provider.chainInfoCache[this.url];
3583
3506
  if (!chain) {
3584
- throw new import_errors14.FuelError(
3585
- import_errors14.ErrorCode.CHAIN_INFO_CACHE_EMPTY,
3507
+ throw new import_errors13.FuelError(
3508
+ import_errors13.ErrorCode.CHAIN_INFO_CACHE_EMPTY,
3586
3509
  "Chain info cache is empty. Make sure you have called `Provider.create` to initialize the provider."
3587
3510
  );
3588
3511
  }
@@ -3594,8 +3517,8 @@ var _Provider = class {
3594
3517
  getNode() {
3595
3518
  const node = _Provider.nodeInfoCache[this.url];
3596
3519
  if (!node) {
3597
- throw new import_errors14.FuelError(
3598
- import_errors14.ErrorCode.NODE_INFO_CACHE_EMPTY,
3520
+ throw new import_errors13.FuelError(
3521
+ import_errors13.ErrorCode.NODE_INFO_CACHE_EMPTY,
3599
3522
  "Node info cache is empty. Make sure you have called `Provider.create` to initialize the provider."
3600
3523
  );
3601
3524
  }
@@ -3642,8 +3565,8 @@ var _Provider = class {
3642
3565
  static ensureClientVersionIsSupported(nodeInfo) {
3643
3566
  const { isMajorSupported, isMinorSupported, supportedVersion } = (0, import_versions.checkFuelCoreVersionCompatibility)(nodeInfo.nodeVersion);
3644
3567
  if (!isMajorSupported || !isMinorSupported) {
3645
- throw new import_errors14.FuelError(
3646
- import_errors14.FuelError.CODES.UNSUPPORTED_FUEL_CLIENT_VERSION,
3568
+ throw new import_errors13.FuelError(
3569
+ import_errors13.FuelError.CODES.UNSUPPORTED_FUEL_CLIENT_VERSION,
3647
3570
  `Fuel client version: ${nodeInfo.nodeVersion}, Supported version: ${supportedVersion}`
3648
3571
  );
3649
3572
  }
@@ -3706,7 +3629,7 @@ var _Provider = class {
3706
3629
  */
3707
3630
  async getBlockNumber() {
3708
3631
  const { chain } = await this.operations.getChain();
3709
- return (0, import_math15.bn)(chain.latestBlock.header.height, 10);
3632
+ return (0, import_math14.bn)(chain.latestBlock.header.height, 10);
3710
3633
  }
3711
3634
  /**
3712
3635
  * Returns the chain information.
@@ -3716,9 +3639,9 @@ var _Provider = class {
3716
3639
  async fetchNode() {
3717
3640
  const { nodeInfo } = await this.operations.getNodeInfo();
3718
3641
  const processedNodeInfo = {
3719
- maxDepth: (0, import_math15.bn)(nodeInfo.maxDepth),
3720
- maxTx: (0, import_math15.bn)(nodeInfo.maxTx),
3721
- minGasPrice: (0, import_math15.bn)(nodeInfo.minGasPrice),
3642
+ maxDepth: (0, import_math14.bn)(nodeInfo.maxDepth),
3643
+ maxTx: (0, import_math14.bn)(nodeInfo.maxTx),
3644
+ minGasPrice: (0, import_math14.bn)(nodeInfo.minGasPrice),
3722
3645
  nodeVersion: nodeInfo.nodeVersion,
3723
3646
  utxoValidation: nodeInfo.utxoValidation,
3724
3647
  vmBacktrace: nodeInfo.vmBacktrace,
@@ -3775,17 +3698,17 @@ var _Provider = class {
3775
3698
  if (estimateTxDependencies) {
3776
3699
  await this.estimateTxDependencies(transactionRequest);
3777
3700
  }
3778
- const encodedTransaction = (0, import_utils23.hexlify)(transactionRequest.toTransactionBytes());
3701
+ const encodedTransaction = (0, import_utils22.hexlify)(transactionRequest.toTransactionBytes());
3779
3702
  let abis;
3780
- if (transactionRequest.type === import_transactions18.TransactionType.Script) {
3703
+ if (transactionRequest.type === import_transactions17.TransactionType.Script) {
3781
3704
  abis = transactionRequest.abis;
3782
3705
  }
3783
3706
  if (awaitExecution) {
3784
3707
  const subscription = this.operations.submitAndAwait({ encodedTransaction });
3785
3708
  for await (const { submitAndAwait } of subscription) {
3786
3709
  if (submitAndAwait.type === "SqueezedOutStatus") {
3787
- throw new import_errors14.FuelError(
3788
- import_errors14.ErrorCode.TRANSACTION_SQUEEZED_OUT,
3710
+ throw new import_errors13.FuelError(
3711
+ import_errors13.ErrorCode.TRANSACTION_SQUEEZED_OUT,
3789
3712
  `Transaction Squeezed Out with reason: ${submitAndAwait.reason}`
3790
3713
  );
3791
3714
  }
@@ -3818,7 +3741,7 @@ var _Provider = class {
3818
3741
  if (estimateTxDependencies) {
3819
3742
  return this.estimateTxDependencies(transactionRequest);
3820
3743
  }
3821
- const encodedTransaction = (0, import_utils23.hexlify)(transactionRequest.toTransactionBytes());
3744
+ const encodedTransaction = (0, import_utils22.hexlify)(transactionRequest.toTransactionBytes());
3822
3745
  const { dryRun: gqlReceipts } = await this.operations.dryRun({
3823
3746
  encodedTransaction,
3824
3747
  utxoValidation: utxoValidation || false
@@ -3837,13 +3760,13 @@ var _Provider = class {
3837
3760
  async estimatePredicates(transactionRequest) {
3838
3761
  const shouldEstimatePredicates = Boolean(
3839
3762
  transactionRequest.inputs.find(
3840
- (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()
3763
+ (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()
3841
3764
  )
3842
3765
  );
3843
3766
  if (!shouldEstimatePredicates) {
3844
3767
  return transactionRequest;
3845
3768
  }
3846
- const encodedTransaction = (0, import_utils23.hexlify)(transactionRequest.toTransactionBytes());
3769
+ const encodedTransaction = (0, import_utils22.hexlify)(transactionRequest.toTransactionBytes());
3847
3770
  const response = await this.operations.estimatePredicates({
3848
3771
  encodedTransaction
3849
3772
  });
@@ -3852,7 +3775,7 @@ var _Provider = class {
3852
3775
  } = response;
3853
3776
  if (inputs) {
3854
3777
  inputs.forEach((input, index) => {
3855
- if ("predicateGasUsed" in input && (0, import_math15.bn)(input.predicateGasUsed).gt(0)) {
3778
+ if ("predicateGasUsed" in input && (0, import_math14.bn)(input.predicateGasUsed).gt(0)) {
3856
3779
  transactionRequest.inputs[index].predicateGasUsed = input.predicateGasUsed;
3857
3780
  }
3858
3781
  });
@@ -3873,7 +3796,7 @@ var _Provider = class {
3873
3796
  * @returns A promise.
3874
3797
  */
3875
3798
  async estimateTxDependencies(transactionRequest) {
3876
- if (transactionRequest.type === import_transactions18.TransactionType.Create) {
3799
+ if (transactionRequest.type === import_transactions17.TransactionType.Create) {
3877
3800
  return {
3878
3801
  receipts: [],
3879
3802
  outputVariables: 0,
@@ -3886,7 +3809,7 @@ var _Provider = class {
3886
3809
  let outputVariables = 0;
3887
3810
  for (let attempt = 0; attempt < MAX_RETRIES; attempt++) {
3888
3811
  const { dryRun: gqlReceipts } = await this.operations.dryRun({
3889
- encodedTransaction: (0, import_utils23.hexlify)(transactionRequest.toTransactionBytes()),
3812
+ encodedTransaction: (0, import_utils22.hexlify)(transactionRequest.toTransactionBytes()),
3890
3813
  utxoValidation: false
3891
3814
  });
3892
3815
  receipts = gqlReceipts.map(processGqlReceipt);
@@ -3924,7 +3847,7 @@ var _Provider = class {
3924
3847
  if (estimateTxDependencies) {
3925
3848
  return this.estimateTxDependencies(transactionRequest);
3926
3849
  }
3927
- const encodedTransaction = (0, import_utils23.hexlify)(transactionRequest.toTransactionBytes());
3850
+ const encodedTransaction = (0, import_utils22.hexlify)(transactionRequest.toTransactionBytes());
3928
3851
  const { dryRun: gqlReceipts } = await this.operations.dryRun({
3929
3852
  encodedTransaction,
3930
3853
  utxoValidation: true
@@ -3958,14 +3881,14 @@ var _Provider = class {
3958
3881
  const txRequestClone = (0, import_ramda3.clone)(transactionRequestify(transactionRequestLike));
3959
3882
  const chainInfo = this.getChain();
3960
3883
  const { gasPriceFactor, minGasPrice, maxGasPerTx } = this.getGasConfig();
3961
- const gasPrice = (0, import_math15.max)(txRequestClone.gasPrice, minGasPrice);
3962
- const isScriptTransaction = txRequestClone.type === import_transactions18.TransactionType.Script;
3884
+ const gasPrice = (0, import_math14.max)(txRequestClone.gasPrice, minGasPrice);
3885
+ const isScriptTransaction = txRequestClone.type === import_transactions17.TransactionType.Script;
3963
3886
  const coinOutputsQuantities = txRequestClone.getCoinOutputsQuantities();
3964
3887
  const allQuantities = mergeQuantities(coinOutputsQuantities, forwardingQuantities);
3965
3888
  txRequestClone.fundWithFakeUtxos(allQuantities, resourcesOwner?.address);
3966
3889
  if (estimatePredicates) {
3967
3890
  if (isScriptTransaction) {
3968
- txRequestClone.gasLimit = (0, import_math15.bn)(0);
3891
+ txRequestClone.gasLimit = (0, import_math14.bn)(0);
3969
3892
  }
3970
3893
  if (resourcesOwner && "populateTransactionPredicateData" in resourcesOwner) {
3971
3894
  resourcesOwner.populateTransactionPredicateData(txRequestClone);
@@ -3981,8 +3904,8 @@ var _Provider = class {
3981
3904
  let missingContractIds = [];
3982
3905
  let outputVariables = 0;
3983
3906
  if (isScriptTransaction && estimateTxDependencies) {
3984
- txRequestClone.gasPrice = (0, import_math15.bn)(0);
3985
- txRequestClone.gasLimit = (0, import_math15.bn)(maxGasPerTx.sub(maxGas).toNumber() * 0.9);
3907
+ txRequestClone.gasPrice = (0, import_math14.bn)(0);
3908
+ txRequestClone.gasLimit = (0, import_math14.bn)(maxGasPerTx.sub(maxGas).toNumber() * 0.9);
3986
3909
  const result = await this.estimateTxDependencies(txRequestClone);
3987
3910
  receipts = result.receipts;
3988
3911
  outputVariables = result.outputVariables;
@@ -4038,17 +3961,17 @@ var _Provider = class {
4038
3961
  const result = await this.operations.getCoins({
4039
3962
  first: 10,
4040
3963
  ...paginationArgs,
4041
- filter: { owner: ownerAddress.toB256(), assetId: assetId && (0, import_utils23.hexlify)(assetId) }
3964
+ filter: { owner: ownerAddress.toB256(), assetId: assetId && (0, import_utils22.hexlify)(assetId) }
4042
3965
  });
4043
3966
  const coins = result.coins.edges.map((edge) => edge.node);
4044
3967
  return coins.map((coin) => ({
4045
3968
  id: coin.utxoId,
4046
3969
  assetId: coin.assetId,
4047
- amount: (0, import_math15.bn)(coin.amount),
3970
+ amount: (0, import_math14.bn)(coin.amount),
4048
3971
  owner: import_address3.Address.fromAddressOrString(coin.owner),
4049
- maturity: (0, import_math15.bn)(coin.maturity).toNumber(),
4050
- blockCreated: (0, import_math15.bn)(coin.blockCreated),
4051
- txCreatedIdx: (0, import_math15.bn)(coin.txCreatedIdx)
3972
+ maturity: (0, import_math14.bn)(coin.maturity).toNumber(),
3973
+ blockCreated: (0, import_math14.bn)(coin.blockCreated),
3974
+ txCreatedIdx: (0, import_math14.bn)(coin.txCreatedIdx)
4052
3975
  }));
4053
3976
  }
4054
3977
  /**
@@ -4062,19 +3985,19 @@ var _Provider = class {
4062
3985
  async getResourcesToSpend(owner, quantities, excludedIds) {
4063
3986
  const ownerAddress = import_address3.Address.fromAddressOrString(owner);
4064
3987
  const excludeInput = {
4065
- messages: excludedIds?.messages?.map((nonce) => (0, import_utils23.hexlify)(nonce)) || [],
4066
- utxos: excludedIds?.utxos?.map((id) => (0, import_utils23.hexlify)(id)) || []
3988
+ messages: excludedIds?.messages?.map((nonce) => (0, import_utils22.hexlify)(nonce)) || [],
3989
+ utxos: excludedIds?.utxos?.map((id) => (0, import_utils22.hexlify)(id)) || []
4067
3990
  };
4068
3991
  if (this.cache) {
4069
3992
  const uniqueUtxos = new Set(
4070
- excludeInput.utxos.concat(this.cache?.getActiveData().map((id) => (0, import_utils23.hexlify)(id)))
3993
+ excludeInput.utxos.concat(this.cache?.getActiveData().map((id) => (0, import_utils22.hexlify)(id)))
4071
3994
  );
4072
3995
  excludeInput.utxos = Array.from(uniqueUtxos);
4073
3996
  }
4074
3997
  const coinsQuery = {
4075
3998
  owner: ownerAddress.toB256(),
4076
3999
  queryPerAsset: quantities.map(coinQuantityfy).map(({ assetId, amount, max: maxPerAsset }) => ({
4077
- assetId: (0, import_utils23.hexlify)(assetId),
4000
+ assetId: (0, import_utils22.hexlify)(assetId),
4078
4001
  amount: amount.toString(10),
4079
4002
  max: maxPerAsset ? maxPerAsset.toString(10) : void 0
4080
4003
  })),
@@ -4085,9 +4008,9 @@ var _Provider = class {
4085
4008
  switch (coin.__typename) {
4086
4009
  case "MessageCoin":
4087
4010
  return {
4088
- amount: (0, import_math15.bn)(coin.amount),
4011
+ amount: (0, import_math14.bn)(coin.amount),
4089
4012
  assetId: coin.assetId,
4090
- daHeight: (0, import_math15.bn)(coin.daHeight),
4013
+ daHeight: (0, import_math14.bn)(coin.daHeight),
4091
4014
  sender: import_address3.Address.fromAddressOrString(coin.sender),
4092
4015
  recipient: import_address3.Address.fromAddressOrString(coin.recipient),
4093
4016
  nonce: coin.nonce
@@ -4095,12 +4018,12 @@ var _Provider = class {
4095
4018
  case "Coin":
4096
4019
  return {
4097
4020
  id: coin.utxoId,
4098
- amount: (0, import_math15.bn)(coin.amount),
4021
+ amount: (0, import_math14.bn)(coin.amount),
4099
4022
  assetId: coin.assetId,
4100
4023
  owner: import_address3.Address.fromAddressOrString(coin.owner),
4101
- maturity: (0, import_math15.bn)(coin.maturity).toNumber(),
4102
- blockCreated: (0, import_math15.bn)(coin.blockCreated),
4103
- txCreatedIdx: (0, import_math15.bn)(coin.txCreatedIdx)
4024
+ maturity: (0, import_math14.bn)(coin.maturity).toNumber(),
4025
+ blockCreated: (0, import_math14.bn)(coin.blockCreated),
4026
+ txCreatedIdx: (0, import_math14.bn)(coin.txCreatedIdx)
4104
4027
  };
4105
4028
  default:
4106
4029
  return null;
@@ -4117,13 +4040,13 @@ var _Provider = class {
4117
4040
  async getBlock(idOrHeight) {
4118
4041
  let variables;
4119
4042
  if (typeof idOrHeight === "number") {
4120
- variables = { height: (0, import_math15.bn)(idOrHeight).toString(10) };
4043
+ variables = { height: (0, import_math14.bn)(idOrHeight).toString(10) };
4121
4044
  } else if (idOrHeight === "latest") {
4122
4045
  variables = { height: (await this.getBlockNumber()).toString(10) };
4123
4046
  } else if (idOrHeight.length === 66) {
4124
4047
  variables = { blockId: idOrHeight };
4125
4048
  } else {
4126
- variables = { blockId: (0, import_math15.bn)(idOrHeight).toString(10) };
4049
+ variables = { blockId: (0, import_math14.bn)(idOrHeight).toString(10) };
4127
4050
  }
4128
4051
  const { block } = await this.operations.getBlock(variables);
4129
4052
  if (!block) {
@@ -4131,7 +4054,7 @@ var _Provider = class {
4131
4054
  }
4132
4055
  return {
4133
4056
  id: block.id,
4134
- height: (0, import_math15.bn)(block.header.height),
4057
+ height: (0, import_math14.bn)(block.header.height),
4135
4058
  time: block.header.time,
4136
4059
  transactionIds: block.transactions.map((tx) => tx.id)
4137
4060
  };
@@ -4146,7 +4069,7 @@ var _Provider = class {
4146
4069
  const { blocks: fetchedData } = await this.operations.getBlocks(params);
4147
4070
  const blocks = fetchedData.edges.map(({ node: block }) => ({
4148
4071
  id: block.id,
4149
- height: (0, import_math15.bn)(block.header.height),
4072
+ height: (0, import_math14.bn)(block.header.height),
4150
4073
  time: block.header.time,
4151
4074
  transactionIds: block.transactions.map((tx) => tx.id)
4152
4075
  }));
@@ -4161,7 +4084,7 @@ var _Provider = class {
4161
4084
  async getBlockWithTransactions(idOrHeight) {
4162
4085
  let variables;
4163
4086
  if (typeof idOrHeight === "number") {
4164
- variables = { blockHeight: (0, import_math15.bn)(idOrHeight).toString(10) };
4087
+ variables = { blockHeight: (0, import_math14.bn)(idOrHeight).toString(10) };
4165
4088
  } else if (idOrHeight === "latest") {
4166
4089
  variables = { blockHeight: (await this.getBlockNumber()).toString() };
4167
4090
  } else {
@@ -4173,11 +4096,11 @@ var _Provider = class {
4173
4096
  }
4174
4097
  return {
4175
4098
  id: block.id,
4176
- height: (0, import_math15.bn)(block.header.height, 10),
4099
+ height: (0, import_math14.bn)(block.header.height, 10),
4177
4100
  time: block.header.time,
4178
4101
  transactionIds: block.transactions.map((tx) => tx.id),
4179
4102
  transactions: block.transactions.map(
4180
- (tx) => new import_transactions18.TransactionCoder().decode((0, import_utils23.arrayify)(tx.rawPayload), 0)?.[0]
4103
+ (tx) => new import_transactions17.TransactionCoder().decode((0, import_utils22.arrayify)(tx.rawPayload), 0)?.[0]
4181
4104
  )
4182
4105
  };
4183
4106
  }
@@ -4192,8 +4115,8 @@ var _Provider = class {
4192
4115
  if (!transaction) {
4193
4116
  return null;
4194
4117
  }
4195
- return new import_transactions18.TransactionCoder().decode(
4196
- (0, import_utils23.arrayify)(transaction.rawPayload),
4118
+ return new import_transactions17.TransactionCoder().decode(
4119
+ (0, import_utils22.arrayify)(transaction.rawPayload),
4197
4120
  0
4198
4121
  )?.[0];
4199
4122
  }
@@ -4220,9 +4143,9 @@ var _Provider = class {
4220
4143
  async getContractBalance(contractId, assetId) {
4221
4144
  const { contractBalance } = await this.operations.getContractBalance({
4222
4145
  contract: import_address3.Address.fromAddressOrString(contractId).toB256(),
4223
- asset: (0, import_utils23.hexlify)(assetId)
4146
+ asset: (0, import_utils22.hexlify)(assetId)
4224
4147
  });
4225
- return (0, import_math15.bn)(contractBalance.amount, 10);
4148
+ return (0, import_math14.bn)(contractBalance.amount, 10);
4226
4149
  }
4227
4150
  /**
4228
4151
  * Returns the balance for the given owner for the given asset ID.
@@ -4234,9 +4157,9 @@ var _Provider = class {
4234
4157
  async getBalance(owner, assetId) {
4235
4158
  const { balance } = await this.operations.getBalance({
4236
4159
  owner: import_address3.Address.fromAddressOrString(owner).toB256(),
4237
- assetId: (0, import_utils23.hexlify)(assetId)
4160
+ assetId: (0, import_utils22.hexlify)(assetId)
4238
4161
  });
4239
- return (0, import_math15.bn)(balance.amount, 10);
4162
+ return (0, import_math14.bn)(balance.amount, 10);
4240
4163
  }
4241
4164
  /**
4242
4165
  * Returns balances for the given owner.
@@ -4254,7 +4177,7 @@ var _Provider = class {
4254
4177
  const balances = result.balances.edges.map((edge) => edge.node);
4255
4178
  return balances.map((balance) => ({
4256
4179
  assetId: balance.assetId,
4257
- amount: (0, import_math15.bn)(balance.amount)
4180
+ amount: (0, import_math14.bn)(balance.amount)
4258
4181
  }));
4259
4182
  }
4260
4183
  /**
@@ -4272,19 +4195,19 @@ var _Provider = class {
4272
4195
  });
4273
4196
  const messages = result.messages.edges.map((edge) => edge.node);
4274
4197
  return messages.map((message) => ({
4275
- messageId: import_transactions18.InputMessageCoder.getMessageId({
4198
+ messageId: import_transactions17.InputMessageCoder.getMessageId({
4276
4199
  sender: message.sender,
4277
4200
  recipient: message.recipient,
4278
4201
  nonce: message.nonce,
4279
- amount: (0, import_math15.bn)(message.amount),
4202
+ amount: (0, import_math14.bn)(message.amount),
4280
4203
  data: message.data
4281
4204
  }),
4282
4205
  sender: import_address3.Address.fromAddressOrString(message.sender),
4283
4206
  recipient: import_address3.Address.fromAddressOrString(message.recipient),
4284
4207
  nonce: message.nonce,
4285
- amount: (0, import_math15.bn)(message.amount),
4286
- data: import_transactions18.InputMessageCoder.decodeData(message.data),
4287
- daHeight: (0, import_math15.bn)(message.daHeight)
4208
+ amount: (0, import_math14.bn)(message.amount),
4209
+ data: import_transactions17.InputMessageCoder.decodeData(message.data),
4210
+ daHeight: (0, import_math14.bn)(message.daHeight)
4288
4211
  }));
4289
4212
  }
4290
4213
  /**
@@ -4302,8 +4225,8 @@ var _Provider = class {
4302
4225
  nonce
4303
4226
  };
4304
4227
  if (commitBlockId && commitBlockHeight) {
4305
- throw new import_errors14.FuelError(
4306
- import_errors14.ErrorCode.INVALID_INPUT_PARAMETERS,
4228
+ throw new import_errors13.FuelError(
4229
+ import_errors13.ErrorCode.INVALID_INPUT_PARAMETERS,
4307
4230
  "commitBlockId and commitBlockHeight cannot be used together"
4308
4231
  );
4309
4232
  }
@@ -4337,41 +4260,41 @@ var _Provider = class {
4337
4260
  } = result.messageProof;
4338
4261
  return {
4339
4262
  messageProof: {
4340
- proofIndex: (0, import_math15.bn)(messageProof.proofIndex),
4263
+ proofIndex: (0, import_math14.bn)(messageProof.proofIndex),
4341
4264
  proofSet: messageProof.proofSet
4342
4265
  },
4343
4266
  blockProof: {
4344
- proofIndex: (0, import_math15.bn)(blockProof.proofIndex),
4267
+ proofIndex: (0, import_math14.bn)(blockProof.proofIndex),
4345
4268
  proofSet: blockProof.proofSet
4346
4269
  },
4347
4270
  messageBlockHeader: {
4348
4271
  id: messageBlockHeader.id,
4349
- daHeight: (0, import_math15.bn)(messageBlockHeader.daHeight),
4350
- transactionsCount: (0, import_math15.bn)(messageBlockHeader.transactionsCount),
4272
+ daHeight: (0, import_math14.bn)(messageBlockHeader.daHeight),
4273
+ transactionsCount: (0, import_math14.bn)(messageBlockHeader.transactionsCount),
4351
4274
  transactionsRoot: messageBlockHeader.transactionsRoot,
4352
- height: (0, import_math15.bn)(messageBlockHeader.height),
4275
+ height: (0, import_math14.bn)(messageBlockHeader.height),
4353
4276
  prevRoot: messageBlockHeader.prevRoot,
4354
4277
  time: messageBlockHeader.time,
4355
4278
  applicationHash: messageBlockHeader.applicationHash,
4356
4279
  messageReceiptRoot: messageBlockHeader.messageReceiptRoot,
4357
- messageReceiptCount: (0, import_math15.bn)(messageBlockHeader.messageReceiptCount)
4280
+ messageReceiptCount: (0, import_math14.bn)(messageBlockHeader.messageReceiptCount)
4358
4281
  },
4359
4282
  commitBlockHeader: {
4360
4283
  id: commitBlockHeader.id,
4361
- daHeight: (0, import_math15.bn)(commitBlockHeader.daHeight),
4362
- transactionsCount: (0, import_math15.bn)(commitBlockHeader.transactionsCount),
4284
+ daHeight: (0, import_math14.bn)(commitBlockHeader.daHeight),
4285
+ transactionsCount: (0, import_math14.bn)(commitBlockHeader.transactionsCount),
4363
4286
  transactionsRoot: commitBlockHeader.transactionsRoot,
4364
- height: (0, import_math15.bn)(commitBlockHeader.height),
4287
+ height: (0, import_math14.bn)(commitBlockHeader.height),
4365
4288
  prevRoot: commitBlockHeader.prevRoot,
4366
4289
  time: commitBlockHeader.time,
4367
4290
  applicationHash: commitBlockHeader.applicationHash,
4368
4291
  messageReceiptRoot: commitBlockHeader.messageReceiptRoot,
4369
- messageReceiptCount: (0, import_math15.bn)(commitBlockHeader.messageReceiptCount)
4292
+ messageReceiptCount: (0, import_math14.bn)(commitBlockHeader.messageReceiptCount)
4370
4293
  },
4371
4294
  sender: import_address3.Address.fromAddressOrString(sender),
4372
4295
  recipient: import_address3.Address.fromAddressOrString(recipient),
4373
4296
  nonce,
4374
- amount: (0, import_math15.bn)(amount),
4297
+ amount: (0, import_math14.bn)(amount),
4375
4298
  data
4376
4299
  };
4377
4300
  }
@@ -4394,10 +4317,10 @@ var _Provider = class {
4394
4317
  */
4395
4318
  async produceBlocks(amount, startTime) {
4396
4319
  const { produceBlocks: latestBlockHeight } = await this.operations.produceBlocks({
4397
- blocksToProduce: (0, import_math15.bn)(amount).toString(10),
4398
- startTimestamp: startTime ? import_utils23.DateTime.fromUnixMilliseconds(startTime).toTai64() : void 0
4320
+ blocksToProduce: (0, import_math14.bn)(amount).toString(10),
4321
+ startTimestamp: startTime ? import_utils22.DateTime.fromUnixMilliseconds(startTime).toTai64() : void 0
4399
4322
  });
4400
- return (0, import_math15.bn)(latestBlockHeight);
4323
+ return (0, import_math14.bn)(latestBlockHeight);
4401
4324
  }
4402
4325
  // eslint-disable-next-line @typescript-eslint/require-await
4403
4326
  async getTransactionResponse(transactionId) {
@@ -4411,7 +4334,7 @@ cacheInputs_fn = function(inputs) {
4411
4334
  return;
4412
4335
  }
4413
4336
  inputs.forEach((input) => {
4414
- if (input.type === import_transactions18.InputType.Coin) {
4337
+ if (input.type === import_transactions17.InputType.Coin) {
4415
4338
  this.cache?.set(input.id);
4416
4339
  }
4417
4340
  });
@@ -4420,10 +4343,10 @@ __publicField(Provider, "chainInfoCache", {});
4420
4343
  __publicField(Provider, "nodeInfoCache", {});
4421
4344
 
4422
4345
  // src/providers/transaction-summary/get-transaction-summary.ts
4423
- var import_errors15 = require("@fuel-ts/errors");
4424
- var import_math16 = require("@fuel-ts/math");
4425
- var import_transactions19 = require("@fuel-ts/transactions");
4426
- var import_utils26 = require("@fuel-ts/utils");
4346
+ var import_errors14 = require("@fuel-ts/errors");
4347
+ var import_math15 = require("@fuel-ts/math");
4348
+ var import_transactions18 = require("@fuel-ts/transactions");
4349
+ var import_utils25 = require("@fuel-ts/utils");
4427
4350
 
4428
4351
  // src/providers/chains.ts
4429
4352
  var CHAIN_IDS = {
@@ -4472,17 +4395,17 @@ var assets = [
4472
4395
 
4473
4396
  // src/utils/formatTransferToContractScriptData.ts
4474
4397
  var import_abi_coder4 = require("@fuel-ts/abi-coder");
4475
- var import_math17 = require("@fuel-ts/math");
4476
- var import_utils27 = require("@fuel-ts/utils");
4398
+ var import_math16 = require("@fuel-ts/math");
4399
+ var import_utils26 = require("@fuel-ts/utils");
4477
4400
  var asm = __toESM(require("@fuels/vm-asm"));
4478
4401
  var formatTransferToContractScriptData = (params) => {
4479
4402
  const { assetId, amountToTransfer, hexlifiedContractId } = params;
4480
4403
  const numberCoder = new import_abi_coder4.BigNumberCoder("u64");
4481
- const encoded = numberCoder.encode(new import_math17.BN(amountToTransfer).toNumber());
4404
+ const encoded = numberCoder.encode(new import_math16.BN(amountToTransfer).toNumber());
4482
4405
  const scriptData = Uint8Array.from([
4483
- ...(0, import_utils27.arrayify)(hexlifiedContractId),
4406
+ ...(0, import_utils26.arrayify)(hexlifiedContractId),
4484
4407
  ...encoded,
4485
- ...(0, import_utils27.arrayify)(assetId)
4408
+ ...(0, import_utils26.arrayify)(assetId)
4486
4409
  ]);
4487
4410
  return scriptData;
4488
4411
  };
@@ -4538,7 +4461,7 @@ var Account = class extends import_interfaces.AbstractAccount {
4538
4461
  */
4539
4462
  get provider() {
4540
4463
  if (!this._provider) {
4541
- throw new import_errors16.FuelError(import_errors16.ErrorCode.MISSING_PROVIDER, "Provider not set");
4464
+ throw new import_errors15.FuelError(import_errors15.ErrorCode.MISSING_PROVIDER, "Provider not set");
4542
4465
  }
4543
4466
  return this._provider;
4544
4467
  }
@@ -4590,8 +4513,8 @@ var Account = class extends import_interfaces.AbstractAccount {
4590
4513
  if (!hasNextPage) {
4591
4514
  break;
4592
4515
  }
4593
- throw new import_errors16.FuelError(
4594
- import_errors16.ErrorCode.NOT_SUPPORTED,
4516
+ throw new import_errors15.FuelError(
4517
+ import_errors15.ErrorCode.NOT_SUPPORTED,
4595
4518
  `Wallets containing more than ${pageSize} coins exceed the current supported limit.`
4596
4519
  );
4597
4520
  }
@@ -4616,8 +4539,8 @@ var Account = class extends import_interfaces.AbstractAccount {
4616
4539
  if (!hasNextPage) {
4617
4540
  break;
4618
4541
  }
4619
- throw new import_errors16.FuelError(
4620
- import_errors16.ErrorCode.NOT_SUPPORTED,
4542
+ throw new import_errors15.FuelError(
4543
+ import_errors15.ErrorCode.NOT_SUPPORTED,
4621
4544
  `Wallets containing more than ${pageSize} messages exceed the current supported limit.`
4622
4545
  );
4623
4546
  }
@@ -4653,8 +4576,8 @@ var Account = class extends import_interfaces.AbstractAccount {
4653
4576
  if (!hasNextPage) {
4654
4577
  break;
4655
4578
  }
4656
- throw new import_errors16.FuelError(
4657
- import_errors16.ErrorCode.NOT_SUPPORTED,
4579
+ throw new import_errors15.FuelError(
4580
+ import_errors15.ErrorCode.NOT_SUPPORTED,
4658
4581
  `Wallets containing more than ${pageSize} balances exceed the current supported limit.`
4659
4582
  );
4660
4583
  }
@@ -4671,7 +4594,7 @@ var Account = class extends import_interfaces.AbstractAccount {
4671
4594
  async fund(request, coinQuantities, fee) {
4672
4595
  const baseAssetId = this.provider.getBaseAssetId();
4673
4596
  const updatedQuantities = addAmountToAsset({
4674
- amount: (0, import_math18.bn)(fee),
4597
+ amount: (0, import_math17.bn)(fee),
4675
4598
  assetId: baseAssetId,
4676
4599
  coinQuantities
4677
4600
  });
@@ -4679,7 +4602,7 @@ var Account = class extends import_interfaces.AbstractAccount {
4679
4602
  updatedQuantities.forEach(({ amount, assetId }) => {
4680
4603
  quantitiesDict[assetId] = {
4681
4604
  required: amount,
4682
- owned: (0, import_math18.bn)(0)
4605
+ owned: (0, import_math17.bn)(0)
4683
4606
  };
4684
4607
  });
4685
4608
  const cachedUtxos = [];
@@ -4692,7 +4615,7 @@ var Account = class extends import_interfaces.AbstractAccount {
4692
4615
  if (isCoin2) {
4693
4616
  const assetId = String(input.assetId);
4694
4617
  if (input.owner === owner && quantitiesDict[assetId]) {
4695
- const amount = (0, import_math18.bn)(input.amount);
4618
+ const amount = (0, import_math17.bn)(input.amount);
4696
4619
  quantitiesDict[assetId].owned = quantitiesDict[assetId].owned.add(amount);
4697
4620
  cachedUtxos.push(input.id);
4698
4621
  }
@@ -4739,8 +4662,8 @@ var Account = class extends import_interfaces.AbstractAccount {
4739
4662
  estimateTxDependencies: true,
4740
4663
  resourcesOwner: this
4741
4664
  });
4742
- request.gasPrice = (0, import_math18.bn)(txParams.gasPrice ?? minGasPrice);
4743
- request.gasLimit = (0, import_math18.bn)(txParams.gasLimit ?? gasUsed);
4665
+ request.gasPrice = (0, import_math17.bn)(txParams.gasPrice ?? minGasPrice);
4666
+ request.gasLimit = (0, import_math17.bn)(txParams.gasLimit ?? gasUsed);
4744
4667
  this.validateGas({
4745
4668
  gasUsed,
4746
4669
  gasPrice: request.gasPrice,
@@ -4761,9 +4684,9 @@ var Account = class extends import_interfaces.AbstractAccount {
4761
4684
  * @returns A promise that resolves to the transaction response.
4762
4685
  */
4763
4686
  async transfer(destination, amount, assetId, txParams = {}) {
4764
- if ((0, import_math18.bn)(amount).lte(0)) {
4765
- throw new import_errors16.FuelError(
4766
- import_errors16.ErrorCode.INVALID_TRANSFER_AMOUNT,
4687
+ if ((0, import_math17.bn)(amount).lte(0)) {
4688
+ throw new import_errors15.FuelError(
4689
+ import_errors15.ErrorCode.INVALID_TRANSFER_AMOUNT,
4767
4690
  "Transfer amount must be a positive number."
4768
4691
  );
4769
4692
  }
@@ -4781,9 +4704,9 @@ var Account = class extends import_interfaces.AbstractAccount {
4781
4704
  * @returns A promise that resolves to the transaction response.
4782
4705
  */
4783
4706
  async transferToContract(contractId, amount, assetId, txParams = {}) {
4784
- if ((0, import_math18.bn)(amount).lte(0)) {
4785
- throw new import_errors16.FuelError(
4786
- import_errors16.ErrorCode.INVALID_TRANSFER_AMOUNT,
4707
+ if ((0, import_math17.bn)(amount).lte(0)) {
4708
+ throw new import_errors15.FuelError(
4709
+ import_errors15.ErrorCode.INVALID_TRANSFER_AMOUNT,
4787
4710
  "Transfer amount must be a positive number."
4788
4711
  );
4789
4712
  }
@@ -4793,7 +4716,7 @@ var Account = class extends import_interfaces.AbstractAccount {
4793
4716
  const params = { gasPrice: minGasPrice, ...txParams };
4794
4717
  const { script, scriptData } = await assembleTransferToContractScript({
4795
4718
  hexlifiedContractId: contractAddress.toB256(),
4796
- amountToTransfer: (0, import_math18.bn)(amount),
4719
+ amountToTransfer: (0, import_math17.bn)(amount),
4797
4720
  assetId: assetIdToTransfer
4798
4721
  });
4799
4722
  const request = new ScriptTransactionRequest({
@@ -4804,9 +4727,9 @@ var Account = class extends import_interfaces.AbstractAccount {
4804
4727
  request.addContractInputAndOutput(contractAddress);
4805
4728
  const { maxFee, requiredQuantities, gasUsed } = await this.provider.getTransactionCost(
4806
4729
  request,
4807
- [{ amount: (0, import_math18.bn)(amount), assetId: String(assetIdToTransfer) }]
4730
+ [{ amount: (0, import_math17.bn)(amount), assetId: String(assetIdToTransfer) }]
4808
4731
  );
4809
- request.gasLimit = (0, import_math18.bn)(params.gasLimit ?? gasUsed);
4732
+ request.gasLimit = (0, import_math17.bn)(params.gasLimit ?? gasUsed);
4810
4733
  this.validateGas({
4811
4734
  gasUsed,
4812
4735
  gasPrice: request.gasPrice,
@@ -4828,25 +4751,25 @@ var Account = class extends import_interfaces.AbstractAccount {
4828
4751
  const { minGasPrice } = this.provider.getGasConfig();
4829
4752
  const baseAssetId = this.provider.getBaseAssetId();
4830
4753
  const recipientAddress = import_address4.Address.fromAddressOrString(recipient);
4831
- const recipientDataArray = (0, import_utils28.arrayify)(
4754
+ const recipientDataArray = (0, import_utils27.arrayify)(
4832
4755
  "0x".concat(recipientAddress.toHexString().substring(2).padStart(64, "0"))
4833
4756
  );
4834
- const amountDataArray = (0, import_utils28.arrayify)(
4835
- "0x".concat((0, import_math18.bn)(amount).toHex().substring(2).padStart(16, "0"))
4757
+ const amountDataArray = (0, import_utils27.arrayify)(
4758
+ "0x".concat((0, import_math17.bn)(amount).toHex().substring(2).padStart(16, "0"))
4836
4759
  );
4837
4760
  const script = new Uint8Array([
4838
- ...(0, import_utils28.arrayify)(withdrawScript.bytes),
4761
+ ...(0, import_utils27.arrayify)(withdrawScript.bytes),
4839
4762
  ...recipientDataArray,
4840
4763
  ...amountDataArray
4841
4764
  ]);
4842
4765
  const params = { script, gasPrice: minGasPrice, ...txParams };
4843
4766
  const request = new ScriptTransactionRequest(params);
4844
- const forwardingQuantities = [{ amount: (0, import_math18.bn)(amount), assetId: baseAssetId }];
4767
+ const forwardingQuantities = [{ amount: (0, import_math17.bn)(amount), assetId: baseAssetId }];
4845
4768
  const { requiredQuantities, maxFee, gasUsed } = await this.provider.getTransactionCost(
4846
4769
  request,
4847
4770
  forwardingQuantities
4848
4771
  );
4849
- request.gasLimit = (0, import_math18.bn)(params.gasLimit ?? gasUsed);
4772
+ request.gasLimit = (0, import_math17.bn)(params.gasLimit ?? gasUsed);
4850
4773
  this.validateGas({
4851
4774
  gasUsed,
4852
4775
  gasPrice: request.gasPrice,
@@ -4858,7 +4781,7 @@ var Account = class extends import_interfaces.AbstractAccount {
4858
4781
  }
4859
4782
  async signMessage(message) {
4860
4783
  if (!this._connector) {
4861
- throw new import_errors16.FuelError(import_errors16.ErrorCode.MISSING_CONNECTOR, "A connector is required to sign messages.");
4784
+ throw new import_errors15.FuelError(import_errors15.ErrorCode.MISSING_CONNECTOR, "A connector is required to sign messages.");
4862
4785
  }
4863
4786
  return this._connector.signMessage(this.address.toString(), message);
4864
4787
  }
@@ -4870,8 +4793,8 @@ var Account = class extends import_interfaces.AbstractAccount {
4870
4793
  */
4871
4794
  async signTransaction(transactionRequestLike) {
4872
4795
  if (!this._connector) {
4873
- throw new import_errors16.FuelError(
4874
- import_errors16.ErrorCode.MISSING_CONNECTOR,
4796
+ throw new import_errors15.FuelError(
4797
+ import_errors15.ErrorCode.MISSING_CONNECTOR,
4875
4798
  "A connector is required to sign transactions."
4876
4799
  );
4877
4800
  }
@@ -4918,14 +4841,14 @@ var Account = class extends import_interfaces.AbstractAccount {
4918
4841
  minGasPrice
4919
4842
  }) {
4920
4843
  if (minGasPrice.gt(gasPrice)) {
4921
- throw new import_errors16.FuelError(
4922
- import_errors16.ErrorCode.GAS_PRICE_TOO_LOW,
4844
+ throw new import_errors15.FuelError(
4845
+ import_errors15.ErrorCode.GAS_PRICE_TOO_LOW,
4923
4846
  `Gas price '${gasPrice}' is lower than the required: '${minGasPrice}'.`
4924
4847
  );
4925
4848
  }
4926
4849
  if (gasUsed.gt(gasLimit)) {
4927
- throw new import_errors16.FuelError(
4928
- import_errors16.ErrorCode.GAS_LIMIT_TOO_LOW,
4850
+ throw new import_errors15.FuelError(
4851
+ import_errors15.ErrorCode.GAS_LIMIT_TOO_LOW,
4929
4852
  `Gas limit '${gasLimit}' is lower than the required: '${gasUsed}'.`
4930
4853
  );
4931
4854
  }
@@ -4936,8 +4859,8 @@ var Account = class extends import_interfaces.AbstractAccount {
4936
4859
  var import_address5 = require("@fuel-ts/address");
4937
4860
  var import_crypto = require("@fuel-ts/crypto");
4938
4861
  var import_hasher2 = require("@fuel-ts/hasher");
4939
- var import_math19 = require("@fuel-ts/math");
4940
- var import_utils29 = require("@fuel-ts/utils");
4862
+ var import_math18 = require("@fuel-ts/math");
4863
+ var import_utils28 = require("@fuel-ts/utils");
4941
4864
  var import_secp256k1 = require("@noble/curves/secp256k1");
4942
4865
  var Signer = class {
4943
4866
  address;
@@ -4956,10 +4879,10 @@ var Signer = class {
4956
4879
  privateKey = `0x${privateKey}`;
4957
4880
  }
4958
4881
  }
4959
- const privateKeyBytes = (0, import_math19.toBytes)(privateKey, 32);
4960
- this.privateKey = (0, import_utils29.hexlify)(privateKeyBytes);
4961
- this.publicKey = (0, import_utils29.hexlify)(import_secp256k1.secp256k1.getPublicKey(privateKeyBytes, false).slice(1));
4962
- this.compressedPublicKey = (0, import_utils29.hexlify)(import_secp256k1.secp256k1.getPublicKey(privateKeyBytes, true));
4882
+ const privateKeyBytes = (0, import_math18.toBytes)(privateKey, 32);
4883
+ this.privateKey = (0, import_utils28.hexlify)(privateKeyBytes);
4884
+ this.publicKey = (0, import_utils28.hexlify)(import_secp256k1.secp256k1.getPublicKey(privateKeyBytes, false).slice(1));
4885
+ this.compressedPublicKey = (0, import_utils28.hexlify)(import_secp256k1.secp256k1.getPublicKey(privateKeyBytes, true));
4963
4886
  this.address = import_address5.Address.fromPublicKey(this.publicKey);
4964
4887
  }
4965
4888
  /**
@@ -4973,11 +4896,11 @@ var Signer = class {
4973
4896
  * @returns hashed signature
4974
4897
  */
4975
4898
  sign(data) {
4976
- const signature = import_secp256k1.secp256k1.sign((0, import_utils29.arrayify)(data), (0, import_utils29.arrayify)(this.privateKey));
4977
- const r = (0, import_math19.toBytes)(`0x${signature.r.toString(16)}`, 32);
4978
- const s = (0, import_math19.toBytes)(`0x${signature.s.toString(16)}`, 32);
4899
+ const signature = import_secp256k1.secp256k1.sign((0, import_utils28.arrayify)(data), (0, import_utils28.arrayify)(this.privateKey));
4900
+ const r = (0, import_math18.toBytes)(`0x${signature.r.toString(16)}`, 32);
4901
+ const s = (0, import_math18.toBytes)(`0x${signature.s.toString(16)}`, 32);
4979
4902
  s[0] |= (signature.recovery || 0) << 7;
4980
- return (0, import_utils29.hexlify)((0, import_utils29.concat)([r, s]));
4903
+ return (0, import_utils28.hexlify)((0, import_utils28.concat)([r, s]));
4981
4904
  }
4982
4905
  /**
4983
4906
  * Add point on the current elliptic curve
@@ -4986,8 +4909,8 @@ var Signer = class {
4986
4909
  * @returns compressed point on the curve
4987
4910
  */
4988
4911
  addPoint(point) {
4989
- const p0 = import_secp256k1.secp256k1.ProjectivePoint.fromHex((0, import_utils29.arrayify)(this.compressedPublicKey));
4990
- const p1 = import_secp256k1.secp256k1.ProjectivePoint.fromHex((0, import_utils29.arrayify)(point));
4912
+ const p0 = import_secp256k1.secp256k1.ProjectivePoint.fromHex((0, import_utils28.arrayify)(this.compressedPublicKey));
4913
+ const p1 = import_secp256k1.secp256k1.ProjectivePoint.fromHex((0, import_utils28.arrayify)(point));
4991
4914
  const result = p0.add(p1);
4992
4915
  return `0x${result.toHex(true)}`;
4993
4916
  }
@@ -4999,16 +4922,16 @@ var Signer = class {
4999
4922
  * @returns public key from signature from the
5000
4923
  */
5001
4924
  static recoverPublicKey(data, signature) {
5002
- const signedMessageBytes = (0, import_utils29.arrayify)(signature);
4925
+ const signedMessageBytes = (0, import_utils28.arrayify)(signature);
5003
4926
  const r = signedMessageBytes.slice(0, 32);
5004
4927
  const s = signedMessageBytes.slice(32, 64);
5005
4928
  const recoveryParam = (s[0] & 128) >> 7;
5006
4929
  s[0] &= 127;
5007
- const sig = new import_secp256k1.secp256k1.Signature(BigInt((0, import_utils29.hexlify)(r)), BigInt((0, import_utils29.hexlify)(s))).addRecoveryBit(
4930
+ const sig = new import_secp256k1.secp256k1.Signature(BigInt((0, import_utils28.hexlify)(r)), BigInt((0, import_utils28.hexlify)(s))).addRecoveryBit(
5008
4931
  recoveryParam
5009
4932
  );
5010
- const publicKey = sig.recoverPublicKey((0, import_utils29.arrayify)(data)).toRawBytes(false).slice(1);
5011
- return (0, import_utils29.hexlify)(publicKey);
4933
+ const publicKey = sig.recoverPublicKey((0, import_utils28.arrayify)(data)).toRawBytes(false).slice(1);
4934
+ return (0, import_utils28.hexlify)(publicKey);
5012
4935
  }
5013
4936
  /**
5014
4937
  * Recover the address from a signature performed with [`sign`](#sign).
@@ -5027,7 +4950,7 @@ var Signer = class {
5027
4950
  * @returns random 32-byte hashed
5028
4951
  */
5029
4952
  static generatePrivateKey(entropy) {
5030
- 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);
4953
+ 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);
5031
4954
  }
5032
4955
  /**
5033
4956
  * Extended publicKey from a compact publicKey
@@ -5036,16 +4959,16 @@ var Signer = class {
5036
4959
  * @returns extended publicKey
5037
4960
  */
5038
4961
  static extendPublicKey(publicKey) {
5039
- const point = import_secp256k1.secp256k1.ProjectivePoint.fromHex((0, import_utils29.arrayify)(publicKey));
5040
- return (0, import_utils29.hexlify)(point.toRawBytes(false).slice(1));
4962
+ const point = import_secp256k1.secp256k1.ProjectivePoint.fromHex((0, import_utils28.arrayify)(publicKey));
4963
+ return (0, import_utils28.hexlify)(point.toRawBytes(false).slice(1));
5041
4964
  }
5042
4965
  };
5043
4966
 
5044
4967
  // src/wallet/keystore-wallet.ts
5045
4968
  var import_address6 = require("@fuel-ts/address");
5046
4969
  var import_crypto2 = require("@fuel-ts/crypto");
5047
- var import_errors17 = require("@fuel-ts/errors");
5048
- var import_utils30 = require("@fuel-ts/utils");
4970
+ var import_errors16 = require("@fuel-ts/errors");
4971
+ var import_utils29 = require("@fuel-ts/utils");
5049
4972
  var import_uuid = require("uuid");
5050
4973
  var DEFAULT_KDF_PARAMS_LOG_N = 13;
5051
4974
  var DEFAULT_KDF_PARAMS_R = 8;
@@ -5122,13 +5045,13 @@ async function decryptKeystoreWallet(jsonWallet, password) {
5122
5045
  const macHashUint8Array = (0, import_crypto2.keccak256)(data);
5123
5046
  const macHash = (0, import_crypto2.stringFromBuffer)(macHashUint8Array, "hex");
5124
5047
  if (mac !== macHash) {
5125
- throw new import_errors17.FuelError(
5126
- import_errors17.ErrorCode.INVALID_PASSWORD,
5048
+ throw new import_errors16.FuelError(
5049
+ import_errors16.ErrorCode.INVALID_PASSWORD,
5127
5050
  "Failed to decrypt the keystore wallet, the provided password is incorrect."
5128
5051
  );
5129
5052
  }
5130
5053
  const buffer = await (0, import_crypto2.decryptJsonWalletData)(ciphertextBuffer, key, ivBuffer);
5131
- const privateKey = (0, import_utils30.hexlify)(buffer);
5054
+ const privateKey = (0, import_utils29.hexlify)(buffer);
5132
5055
  return privateKey;
5133
5056
  }
5134
5057
 
@@ -5173,7 +5096,7 @@ var BaseWalletUnlocked = class extends Account {
5173
5096
  */
5174
5097
  async signMessage(message) {
5175
5098
  const signedMessage = await this.signer().sign((0, import_hasher3.hashMessage)(message));
5176
- return (0, import_utils31.hexlify)(signedMessage);
5099
+ return (0, import_utils30.hexlify)(signedMessage);
5177
5100
  }
5178
5101
  /**
5179
5102
  * Signs a transaction with the wallet's private key.
@@ -5186,7 +5109,7 @@ var BaseWalletUnlocked = class extends Account {
5186
5109
  const chainId = this.provider.getChainId();
5187
5110
  const hashedTransaction = transactionRequest.getTransactionId(chainId);
5188
5111
  const signature = await this.signer().sign(hashedTransaction);
5189
- return (0, import_utils31.hexlify)(signature);
5112
+ return (0, import_utils30.hexlify)(signature);
5190
5113
  }
5191
5114
  /**
5192
5115
  * Populates a transaction with the witnesses signature.
@@ -5245,17 +5168,17 @@ var BaseWalletUnlocked = class extends Account {
5245
5168
  __publicField(BaseWalletUnlocked, "defaultPath", "m/44'/1179993420'/0'/0/0");
5246
5169
 
5247
5170
  // src/hdwallet/hdwallet.ts
5248
- var import_errors20 = require("@fuel-ts/errors");
5171
+ var import_errors19 = require("@fuel-ts/errors");
5249
5172
  var import_hasher6 = require("@fuel-ts/hasher");
5250
- var import_math20 = require("@fuel-ts/math");
5251
- var import_utils35 = require("@fuel-ts/utils");
5173
+ var import_math19 = require("@fuel-ts/math");
5174
+ var import_utils34 = require("@fuel-ts/utils");
5252
5175
  var import_ethers3 = require("ethers");
5253
5176
 
5254
5177
  // src/mnemonic/mnemonic.ts
5255
5178
  var import_crypto3 = require("@fuel-ts/crypto");
5256
- var import_errors19 = require("@fuel-ts/errors");
5179
+ var import_errors18 = require("@fuel-ts/errors");
5257
5180
  var import_hasher5 = require("@fuel-ts/hasher");
5258
- var import_utils33 = require("@fuel-ts/utils");
5181
+ var import_utils32 = require("@fuel-ts/utils");
5259
5182
  var import_ethers2 = require("ethers");
5260
5183
 
5261
5184
  // src/wordlists/words/english.ts
@@ -7311,9 +7234,9 @@ var english = [
7311
7234
  ];
7312
7235
 
7313
7236
  // src/mnemonic/utils.ts
7314
- var import_errors18 = require("@fuel-ts/errors");
7237
+ var import_errors17 = require("@fuel-ts/errors");
7315
7238
  var import_hasher4 = require("@fuel-ts/hasher");
7316
- var import_utils32 = require("@fuel-ts/utils");
7239
+ var import_utils31 = require("@fuel-ts/utils");
7317
7240
  function toUtf8Bytes(stri) {
7318
7241
  const str = stri.normalize("NFKD");
7319
7242
  const result = [];
@@ -7328,8 +7251,8 @@ function toUtf8Bytes(stri) {
7328
7251
  i += 1;
7329
7252
  const c2 = str.charCodeAt(i);
7330
7253
  if (i >= str.length || (c2 & 64512) !== 56320) {
7331
- throw new import_errors18.FuelError(
7332
- import_errors18.ErrorCode.INVALID_INPUT_PARAMETERS,
7254
+ throw new import_errors17.FuelError(
7255
+ import_errors17.ErrorCode.INVALID_INPUT_PARAMETERS,
7333
7256
  "Invalid UTF-8 in the input string."
7334
7257
  );
7335
7258
  }
@@ -7380,20 +7303,20 @@ function entropyToMnemonicIndices(entropy) {
7380
7303
  }
7381
7304
  }
7382
7305
  const checksumBits = entropy.length / 4;
7383
- const checksum = (0, import_utils32.arrayify)((0, import_hasher4.sha256)(entropy))[0] & getUpperMask(checksumBits);
7306
+ const checksum = (0, import_utils31.arrayify)((0, import_hasher4.sha256)(entropy))[0] & getUpperMask(checksumBits);
7384
7307
  indices[indices.length - 1] <<= checksumBits;
7385
7308
  indices[indices.length - 1] |= checksum >> 8 - checksumBits;
7386
7309
  return indices;
7387
7310
  }
7388
7311
  function mnemonicWordsToEntropy(words, wordlist) {
7389
7312
  const size = Math.ceil(11 * words.length / 8);
7390
- const entropy = (0, import_utils32.arrayify)(new Uint8Array(size));
7313
+ const entropy = (0, import_utils31.arrayify)(new Uint8Array(size));
7391
7314
  let offset = 0;
7392
7315
  for (let i = 0; i < words.length; i += 1) {
7393
7316
  const index = wordlist.indexOf(words[i].normalize("NFKD"));
7394
7317
  if (index === -1) {
7395
- throw new import_errors18.FuelError(
7396
- import_errors18.ErrorCode.INVALID_MNEMONIC,
7318
+ throw new import_errors17.FuelError(
7319
+ import_errors17.ErrorCode.INVALID_MNEMONIC,
7397
7320
  `Invalid mnemonic: the word '${words[i]}' is not found in the provided wordlist.`
7398
7321
  );
7399
7322
  }
@@ -7407,10 +7330,10 @@ function mnemonicWordsToEntropy(words, wordlist) {
7407
7330
  const entropyBits = 32 * words.length / 3;
7408
7331
  const checksumBits = words.length / 3;
7409
7332
  const checksumMask = getUpperMask(checksumBits);
7410
- const checksum = (0, import_utils32.arrayify)((0, import_hasher4.sha256)(entropy.slice(0, entropyBits / 8)))[0] & checksumMask;
7333
+ const checksum = (0, import_utils31.arrayify)((0, import_hasher4.sha256)(entropy.slice(0, entropyBits / 8)))[0] & checksumMask;
7411
7334
  if (checksum !== (entropy[entropy.length - 1] & checksumMask)) {
7412
- throw new import_errors18.FuelError(
7413
- import_errors18.ErrorCode.INVALID_CHECKSUM,
7335
+ throw new import_errors17.FuelError(
7336
+ import_errors17.ErrorCode.INVALID_CHECKSUM,
7414
7337
  "Checksum validation failed for the provided mnemonic."
7415
7338
  );
7416
7339
  }
@@ -7424,16 +7347,16 @@ var TestnetPRV = "0x04358394";
7424
7347
  var MNEMONIC_SIZES = [12, 15, 18, 21, 24];
7425
7348
  function assertWordList(wordlist) {
7426
7349
  if (wordlist.length !== 2048) {
7427
- throw new import_errors19.FuelError(
7428
- import_errors19.ErrorCode.INVALID_WORD_LIST,
7350
+ throw new import_errors18.FuelError(
7351
+ import_errors18.ErrorCode.INVALID_WORD_LIST,
7429
7352
  `Expected word list length of 2048, but got ${wordlist.length}.`
7430
7353
  );
7431
7354
  }
7432
7355
  }
7433
7356
  function assertEntropy(entropy) {
7434
7357
  if (entropy.length % 4 !== 0 || entropy.length < 16 || entropy.length > 32) {
7435
- throw new import_errors19.FuelError(
7436
- import_errors19.ErrorCode.INVALID_ENTROPY,
7358
+ throw new import_errors18.FuelError(
7359
+ import_errors18.ErrorCode.INVALID_ENTROPY,
7437
7360
  `Entropy should be between 16 and 32 bytes and a multiple of 4, but got ${entropy.length} bytes.`
7438
7361
  );
7439
7362
  }
@@ -7443,7 +7366,7 @@ function assertMnemonic(words) {
7443
7366
  const errorMsg = `Invalid mnemonic size. Expected one of [${MNEMONIC_SIZES.join(
7444
7367
  ", "
7445
7368
  )}] words, but got ${words.length}.`;
7446
- throw new import_errors19.FuelError(import_errors19.ErrorCode.INVALID_MNEMONIC, errorMsg);
7369
+ throw new import_errors18.FuelError(import_errors18.ErrorCode.INVALID_MNEMONIC, errorMsg);
7447
7370
  }
7448
7371
  }
7449
7372
  var Mnemonic = class {
@@ -7482,7 +7405,7 @@ var Mnemonic = class {
7482
7405
  static mnemonicToEntropy(phrase, wordlist = english) {
7483
7406
  const words = getWords(phrase);
7484
7407
  assertMnemonic(words);
7485
- return (0, import_utils33.hexlify)(mnemonicWordsToEntropy(words, wordlist));
7408
+ return (0, import_utils32.hexlify)(mnemonicWordsToEntropy(words, wordlist));
7486
7409
  }
7487
7410
  /**
7488
7411
  * @param entropy - Entropy source to the mnemonic phrase.
@@ -7490,7 +7413,7 @@ var Mnemonic = class {
7490
7413
  * @returns 64-byte array contains privateKey and chainCode as described on BIP39
7491
7414
  */
7492
7415
  static entropyToMnemonic(entropy, wordlist = english) {
7493
- const entropyBytes = (0, import_utils33.arrayify)(entropy);
7416
+ const entropyBytes = (0, import_utils32.arrayify)(entropy);
7494
7417
  assertWordList(wordlist);
7495
7418
  assertEntropy(entropyBytes);
7496
7419
  return entropyToMnemonicIndices(entropyBytes).map((i) => wordlist[i]).join(" ");
@@ -7559,14 +7482,14 @@ var Mnemonic = class {
7559
7482
  * @returns 64-byte array contains privateKey and chainCode as described on BIP39
7560
7483
  */
7561
7484
  static masterKeysFromSeed(seed) {
7562
- const seedArray = (0, import_utils33.arrayify)(seed);
7485
+ const seedArray = (0, import_utils32.arrayify)(seed);
7563
7486
  if (seedArray.length < 16 || seedArray.length > 64) {
7564
- throw new import_errors19.FuelError(
7565
- import_errors19.ErrorCode.INVALID_SEED,
7487
+ throw new import_errors18.FuelError(
7488
+ import_errors18.ErrorCode.INVALID_SEED,
7566
7489
  `Seed length should be between 16 and 64 bytes, but received ${seedArray.length} bytes.`
7567
7490
  );
7568
7491
  }
7569
- return (0, import_utils33.arrayify)((0, import_ethers2.computeHmac)("sha512", MasterSecret, seedArray));
7492
+ return (0, import_utils32.arrayify)((0, import_ethers2.computeHmac)("sha512", MasterSecret, seedArray));
7570
7493
  }
7571
7494
  /**
7572
7495
  * Get the extendKey as defined on BIP-32 from the provided seed
@@ -7577,22 +7500,22 @@ var Mnemonic = class {
7577
7500
  */
7578
7501
  static seedToExtendedKey(seed, testnet = false) {
7579
7502
  const masterKey = Mnemonic.masterKeysFromSeed(seed);
7580
- const prefix = (0, import_utils33.arrayify)(testnet ? TestnetPRV : MainnetPRV);
7503
+ const prefix = (0, import_utils32.arrayify)(testnet ? TestnetPRV : MainnetPRV);
7581
7504
  const depth = "0x00";
7582
7505
  const fingerprint = "0x00000000";
7583
7506
  const index = "0x00000000";
7584
7507
  const chainCode = masterKey.slice(32);
7585
7508
  const privateKey = masterKey.slice(0, 32);
7586
- const extendedKey = (0, import_utils33.concat)([
7509
+ const extendedKey = (0, import_utils32.concat)([
7587
7510
  prefix,
7588
7511
  depth,
7589
7512
  fingerprint,
7590
7513
  index,
7591
7514
  chainCode,
7592
- (0, import_utils33.concat)(["0x00", privateKey])
7515
+ (0, import_utils32.concat)(["0x00", privateKey])
7593
7516
  ]);
7594
7517
  const checksum = (0, import_ethers2.dataSlice)((0, import_hasher5.sha256)((0, import_hasher5.sha256)(extendedKey)), 0, 4);
7595
- return (0, import_ethers2.encodeBase58)((0, import_utils33.concat)([extendedKey, checksum]));
7518
+ return (0, import_ethers2.encodeBase58)((0, import_utils32.concat)([extendedKey, checksum]));
7596
7519
  }
7597
7520
  /**
7598
7521
  * Create a new mnemonic using a randomly generated number as entropy.
@@ -7607,7 +7530,7 @@ var Mnemonic = class {
7607
7530
  * @returns A randomly generated mnemonic
7608
7531
  */
7609
7532
  static generate(size = 32, extraEntropy = "") {
7610
- 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);
7533
+ 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);
7611
7534
  return Mnemonic.entropyToMnemonic(entropy);
7612
7535
  }
7613
7536
  };
@@ -7615,12 +7538,12 @@ var mnemonic_default = Mnemonic;
7615
7538
 
7616
7539
  // src/hdwallet/hdwallet.ts
7617
7540
  var HARDENED_INDEX = 2147483648;
7618
- var MainnetPRV2 = (0, import_utils35.hexlify)("0x0488ade4");
7619
- var MainnetPUB = (0, import_utils35.hexlify)("0x0488b21e");
7620
- var TestnetPRV2 = (0, import_utils35.hexlify)("0x04358394");
7621
- var TestnetPUB = (0, import_utils35.hexlify)("0x043587cf");
7541
+ var MainnetPRV2 = (0, import_utils34.hexlify)("0x0488ade4");
7542
+ var MainnetPUB = (0, import_utils34.hexlify)("0x0488b21e");
7543
+ var TestnetPRV2 = (0, import_utils34.hexlify)("0x04358394");
7544
+ var TestnetPUB = (0, import_utils34.hexlify)("0x043587cf");
7622
7545
  function base58check(data) {
7623
- 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)]));
7546
+ 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)]));
7624
7547
  }
7625
7548
  function getExtendedKeyPrefix(isPublic = false, testnet = false) {
7626
7549
  if (isPublic) {
@@ -7629,17 +7552,17 @@ function getExtendedKeyPrefix(isPublic = false, testnet = false) {
7629
7552
  return testnet ? TestnetPRV2 : MainnetPRV2;
7630
7553
  }
7631
7554
  function isPublicExtendedKey(extendedKey) {
7632
- return [MainnetPUB, TestnetPUB].includes((0, import_utils35.hexlify)(extendedKey.slice(0, 4)));
7555
+ return [MainnetPUB, TestnetPUB].includes((0, import_utils34.hexlify)(extendedKey.slice(0, 4)));
7633
7556
  }
7634
7557
  function isValidExtendedKey(extendedKey) {
7635
7558
  return [MainnetPRV2, TestnetPRV2, MainnetPUB, TestnetPUB].includes(
7636
- (0, import_utils35.hexlify)(extendedKey.slice(0, 4))
7559
+ (0, import_utils34.hexlify)(extendedKey.slice(0, 4))
7637
7560
  );
7638
7561
  }
7639
7562
  function parsePath(path2, depth = 0) {
7640
7563
  const components = path2.split("/");
7641
7564
  if (components.length === 0 || components[0] === "m" && depth !== 0) {
7642
- throw new import_errors20.FuelError(import_errors20.ErrorCode.HD_WALLET_ERROR, `invalid path - ${path2}`);
7565
+ throw new import_errors19.FuelError(import_errors19.ErrorCode.HD_WALLET_ERROR, `invalid path - ${path2}`);
7643
7566
  }
7644
7567
  if (components[0] === "m") {
7645
7568
  components.shift();
@@ -7651,8 +7574,8 @@ function parsePath(path2, depth = 0) {
7651
7574
  var HDWallet = class {
7652
7575
  depth = 0;
7653
7576
  index = 0;
7654
- fingerprint = (0, import_utils35.hexlify)("0x00000000");
7655
- parentFingerprint = (0, import_utils35.hexlify)("0x00000000");
7577
+ fingerprint = (0, import_utils34.hexlify)("0x00000000");
7578
+ parentFingerprint = (0, import_utils34.hexlify)("0x00000000");
7656
7579
  privateKey;
7657
7580
  publicKey;
7658
7581
  chainCode;
@@ -7664,16 +7587,16 @@ var HDWallet = class {
7664
7587
  constructor(config) {
7665
7588
  if (config.privateKey) {
7666
7589
  const signer = new Signer(config.privateKey);
7667
- this.publicKey = (0, import_utils35.hexlify)(signer.compressedPublicKey);
7668
- this.privateKey = (0, import_utils35.hexlify)(config.privateKey);
7590
+ this.publicKey = (0, import_utils34.hexlify)(signer.compressedPublicKey);
7591
+ this.privateKey = (0, import_utils34.hexlify)(config.privateKey);
7669
7592
  } else {
7670
7593
  if (!config.publicKey) {
7671
- throw new import_errors20.FuelError(
7672
- import_errors20.ErrorCode.HD_WALLET_ERROR,
7594
+ throw new import_errors19.FuelError(
7595
+ import_errors19.ErrorCode.HD_WALLET_ERROR,
7673
7596
  "Both public and private Key cannot be missing. At least one should be provided."
7674
7597
  );
7675
7598
  }
7676
- this.publicKey = (0, import_utils35.hexlify)(config.publicKey);
7599
+ this.publicKey = (0, import_utils34.hexlify)(config.publicKey);
7677
7600
  }
7678
7601
  this.parentFingerprint = config.parentFingerprint || this.parentFingerprint;
7679
7602
  this.fingerprint = (0, import_ethers3.dataSlice)((0, import_ethers3.ripemd160)((0, import_hasher6.sha256)(this.publicKey)), 0, 4);
@@ -7692,28 +7615,28 @@ var HDWallet = class {
7692
7615
  * @returns A new instance of HDWallet on the derived index
7693
7616
  */
7694
7617
  deriveIndex(index) {
7695
- const privateKey = this.privateKey && (0, import_utils35.arrayify)(this.privateKey);
7696
- const publicKey = (0, import_utils35.arrayify)(this.publicKey);
7697
- const chainCode = (0, import_utils35.arrayify)(this.chainCode);
7618
+ const privateKey = this.privateKey && (0, import_utils34.arrayify)(this.privateKey);
7619
+ const publicKey = (0, import_utils34.arrayify)(this.publicKey);
7620
+ const chainCode = (0, import_utils34.arrayify)(this.chainCode);
7698
7621
  const data = new Uint8Array(37);
7699
7622
  if (index & HARDENED_INDEX) {
7700
7623
  if (!privateKey) {
7701
- throw new import_errors20.FuelError(
7702
- import_errors20.ErrorCode.HD_WALLET_ERROR,
7624
+ throw new import_errors19.FuelError(
7625
+ import_errors19.ErrorCode.HD_WALLET_ERROR,
7703
7626
  "Cannot derive a hardened index without a private Key."
7704
7627
  );
7705
7628
  }
7706
7629
  data.set(privateKey, 1);
7707
7630
  } else {
7708
- data.set((0, import_utils35.arrayify)(this.publicKey));
7631
+ data.set((0, import_utils34.arrayify)(this.publicKey));
7709
7632
  }
7710
- data.set((0, import_math20.toBytes)(index, 4), 33);
7711
- const bytes = (0, import_utils35.arrayify)((0, import_ethers3.computeHmac)("sha512", chainCode, data));
7633
+ data.set((0, import_math19.toBytes)(index, 4), 33);
7634
+ const bytes = (0, import_utils34.arrayify)((0, import_ethers3.computeHmac)("sha512", chainCode, data));
7712
7635
  const IL = bytes.slice(0, 32);
7713
7636
  const IR = bytes.slice(32);
7714
7637
  if (privateKey) {
7715
7638
  const N = "0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141";
7716
- const ki = (0, import_math20.bn)(IL).add(privateKey).mod(N).toBytes(32);
7639
+ const ki = (0, import_math19.bn)(IL).add(privateKey).mod(N).toBytes(32);
7717
7640
  return new HDWallet({
7718
7641
  privateKey: ki,
7719
7642
  chainCode: IR,
@@ -7722,7 +7645,7 @@ var HDWallet = class {
7722
7645
  parentFingerprint: this.fingerprint
7723
7646
  });
7724
7647
  }
7725
- const signer = new Signer((0, import_utils35.hexlify)(IL));
7648
+ const signer = new Signer((0, import_utils34.hexlify)(IL));
7726
7649
  const Ki = signer.addPoint(publicKey);
7727
7650
  return new HDWallet({
7728
7651
  publicKey: Ki,
@@ -7751,18 +7674,18 @@ var HDWallet = class {
7751
7674
  */
7752
7675
  toExtendedKey(isPublic = false, testnet = false) {
7753
7676
  if (this.depth >= 256) {
7754
- throw new import_errors20.FuelError(
7755
- import_errors20.ErrorCode.HD_WALLET_ERROR,
7677
+ throw new import_errors19.FuelError(
7678
+ import_errors19.ErrorCode.HD_WALLET_ERROR,
7756
7679
  `Exceeded max depth of 255. Current depth: ${this.depth}.`
7757
7680
  );
7758
7681
  }
7759
7682
  const prefix = getExtendedKeyPrefix(this.privateKey == null || isPublic, testnet);
7760
- const depth = (0, import_utils35.hexlify)(Uint8Array.from([this.depth]));
7683
+ const depth = (0, import_utils34.hexlify)(Uint8Array.from([this.depth]));
7761
7684
  const parentFingerprint = this.parentFingerprint;
7762
- const index = (0, import_math20.toHex)(this.index, 4);
7685
+ const index = (0, import_math19.toHex)(this.index, 4);
7763
7686
  const chainCode = this.chainCode;
7764
- const key = this.privateKey != null && !isPublic ? (0, import_utils35.concat)(["0x00", this.privateKey]) : this.publicKey;
7765
- const extendedKey = (0, import_utils35.arrayify)((0, import_utils35.concat)([prefix, depth, parentFingerprint, index, chainCode, key]));
7687
+ const key = this.privateKey != null && !isPublic ? (0, import_utils34.concat)(["0x00", this.privateKey]) : this.publicKey;
7688
+ const extendedKey = (0, import_utils34.arrayify)((0, import_utils34.concat)([prefix, depth, parentFingerprint, index, chainCode, key]));
7766
7689
  return base58check(extendedKey);
7767
7690
  }
7768
7691
  /**
@@ -7774,34 +7697,34 @@ var HDWallet = class {
7774
7697
  static fromSeed(seed) {
7775
7698
  const masterKey = mnemonic_default.masterKeysFromSeed(seed);
7776
7699
  return new HDWallet({
7777
- chainCode: (0, import_utils35.arrayify)(masterKey.slice(32)),
7778
- privateKey: (0, import_utils35.arrayify)(masterKey.slice(0, 32))
7700
+ chainCode: (0, import_utils34.arrayify)(masterKey.slice(32)),
7701
+ privateKey: (0, import_utils34.arrayify)(masterKey.slice(0, 32))
7779
7702
  });
7780
7703
  }
7781
7704
  static fromExtendedKey(extendedKey) {
7782
7705
  const decoded = (0, import_ethers3.toBeHex)((0, import_ethers3.decodeBase58)(extendedKey));
7783
- const bytes = (0, import_utils35.arrayify)(decoded);
7706
+ const bytes = (0, import_utils34.arrayify)(decoded);
7784
7707
  const validChecksum = base58check(bytes.slice(0, 78)) === extendedKey;
7785
7708
  if (bytes.length !== 82 || !isValidExtendedKey(bytes)) {
7786
- throw new import_errors20.FuelError(import_errors20.ErrorCode.HD_WALLET_ERROR, "Provided key is not a valid extended key.");
7709
+ throw new import_errors19.FuelError(import_errors19.ErrorCode.HD_WALLET_ERROR, "Provided key is not a valid extended key.");
7787
7710
  }
7788
7711
  if (!validChecksum) {
7789
- throw new import_errors20.FuelError(import_errors20.ErrorCode.HD_WALLET_ERROR, "Provided key has an invalid checksum.");
7712
+ throw new import_errors19.FuelError(import_errors19.ErrorCode.HD_WALLET_ERROR, "Provided key has an invalid checksum.");
7790
7713
  }
7791
7714
  const depth = bytes[4];
7792
- const parentFingerprint = (0, import_utils35.hexlify)(bytes.slice(5, 9));
7793
- const index = parseInt((0, import_utils35.hexlify)(bytes.slice(9, 13)).substring(2), 16);
7794
- const chainCode = (0, import_utils35.hexlify)(bytes.slice(13, 45));
7715
+ const parentFingerprint = (0, import_utils34.hexlify)(bytes.slice(5, 9));
7716
+ const index = parseInt((0, import_utils34.hexlify)(bytes.slice(9, 13)).substring(2), 16);
7717
+ const chainCode = (0, import_utils34.hexlify)(bytes.slice(13, 45));
7795
7718
  const key = bytes.slice(45, 78);
7796
7719
  if (depth === 0 && parentFingerprint !== "0x00000000" || depth === 0 && index !== 0) {
7797
- throw new import_errors20.FuelError(
7798
- import_errors20.ErrorCode.HD_WALLET_ERROR,
7720
+ throw new import_errors19.FuelError(
7721
+ import_errors19.ErrorCode.HD_WALLET_ERROR,
7799
7722
  "Inconsistency detected: Depth is zero but fingerprint/index is non-zero."
7800
7723
  );
7801
7724
  }
7802
7725
  if (isPublicExtendedKey(bytes)) {
7803
7726
  if (key[0] !== 3) {
7804
- throw new import_errors20.FuelError(import_errors20.ErrorCode.HD_WALLET_ERROR, "Invalid public extended key.");
7727
+ throw new import_errors19.FuelError(import_errors19.ErrorCode.HD_WALLET_ERROR, "Invalid public extended key.");
7805
7728
  }
7806
7729
  return new HDWallet({
7807
7730
  publicKey: key,
@@ -7812,7 +7735,7 @@ var HDWallet = class {
7812
7735
  });
7813
7736
  }
7814
7737
  if (key[0] !== 0) {
7815
- throw new import_errors20.FuelError(import_errors20.ErrorCode.HD_WALLET_ERROR, "Invalid private extended key.");
7738
+ throw new import_errors19.FuelError(import_errors19.ErrorCode.HD_WALLET_ERROR, "Invalid private extended key.");
7816
7739
  }
7817
7740
  return new HDWallet({
7818
7741
  privateKey: key.slice(1),
@@ -8005,9 +7928,9 @@ var generateTestWallet = async (provider, quantities) => {
8005
7928
  };
8006
7929
 
8007
7930
  // src/test-utils/launchNode.ts
8008
- var import_configs11 = require("@fuel-ts/address/configs");
8009
- var import_math21 = require("@fuel-ts/math");
8010
- var import_utils36 = require("@fuel-ts/utils");
7931
+ var import_configs10 = require("@fuel-ts/address/configs");
7932
+ var import_math20 = require("@fuel-ts/math");
7933
+ var import_utils35 = require("@fuel-ts/utils");
8011
7934
  var import_cli_utils = require("@fuel-ts/utils/cli-utils");
8012
7935
  var import_child_process = require("child_process");
8013
7936
  var import_crypto5 = require("crypto");
@@ -8065,7 +7988,7 @@ var launchNode = async ({
8065
7988
  "--poa-instant"
8066
7989
  ]);
8067
7990
  const chainConfigPath = getFlagValueFromArgs(args, "--chain");
8068
- const consensusKey = getFlagValueFromArgs(args, "--consensus-key") || import_utils36.defaultConsensusKey;
7991
+ const consensusKey = getFlagValueFromArgs(args, "--consensus-key") || import_utils35.defaultConsensusKey;
8069
7992
  const dbTypeFlagValue = getFlagValueFromArgs(args, "--db-type");
8070
7993
  const useInMemoryDb = dbTypeFlagValue === "in-memory" || dbTypeFlagValue === void 0;
8071
7994
  const poaInstantFlagValue = getFlagValueFromArgs(args, "--poa-instant");
@@ -8091,21 +8014,21 @@ var launchNode = async ({
8091
8014
  (0, import_fs.mkdirSync)(tempDirPath, { recursive: true });
8092
8015
  }
8093
8016
  const tempChainConfigFilePath = import_path.default.join(tempDirPath, "chainConfig.json");
8094
- let chainConfig = import_utils36.defaultChainConfig;
8017
+ let chainConfig = import_utils35.defaultChainConfig;
8095
8018
  if (!process.env.GENESIS_SECRET) {
8096
8019
  const pk = Signer.generatePrivateKey();
8097
8020
  const signer = new Signer(pk);
8098
- process.env.GENESIS_SECRET = (0, import_utils36.hexlify)(pk);
8021
+ process.env.GENESIS_SECRET = (0, import_utils35.hexlify)(pk);
8099
8022
  chainConfig = {
8100
- ...import_utils36.defaultChainConfig,
8023
+ ...import_utils35.defaultChainConfig,
8101
8024
  initial_state: {
8102
- ...import_utils36.defaultChainConfig.initial_state,
8025
+ ...import_utils35.defaultChainConfig.initial_state,
8103
8026
  coins: [
8104
- ...import_utils36.defaultChainConfig.initial_state.coins,
8027
+ ...import_utils35.defaultChainConfig.initial_state.coins,
8105
8028
  {
8106
8029
  owner: signer.address.toHexString(),
8107
- amount: (0, import_math21.toHex)(1e9),
8108
- asset_id: import_utils36.defaultChainConfig?.consensus_parameters?.base_asset_id ?? import_configs11.ZeroBytes32
8030
+ amount: (0, import_math20.toHex)(1e9),
8031
+ asset_id: import_utils35.defaultChainConfig?.consensus_parameters?.base_asset_id ?? import_configs10.ZeroBytes32
8109
8032
  }
8110
8033
  ]
8111
8034
  }