@fuel-ts/account 0.79.0 → 0.80.0

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

Potentially problematic release.


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

package/dist/index.mjs CHANGED
@@ -30,9 +30,9 @@ var __privateMethod = (obj, member, method) => {
30
30
  // src/account.ts
31
31
  import { Address as Address3 } from "@fuel-ts/address";
32
32
  import { BaseAssetId as BaseAssetId3 } from "@fuel-ts/address/configs";
33
- import { ErrorCode as ErrorCode14, FuelError as FuelError14 } from "@fuel-ts/errors";
33
+ import { ErrorCode as ErrorCode15, FuelError as FuelError15 } from "@fuel-ts/errors";
34
34
  import { AbstractAccount } from "@fuel-ts/interfaces";
35
- import { bn as bn16 } from "@fuel-ts/math";
35
+ import { bn as bn17 } from "@fuel-ts/math";
36
36
  import { arrayify as arrayify14 } from "@fuel-ts/utils";
37
37
 
38
38
  // src/providers/coin-quantity.ts
@@ -73,8 +73,8 @@ var addAmountToAsset = (params) => {
73
73
 
74
74
  // src/providers/provider.ts
75
75
  import { Address as Address2 } from "@fuel-ts/address";
76
- import { ErrorCode as ErrorCode12, FuelError as FuelError12 } from "@fuel-ts/errors";
77
- import { BN, bn as bn14, max } from "@fuel-ts/math";
76
+ import { ErrorCode as ErrorCode13, FuelError as FuelError13 } from "@fuel-ts/errors";
77
+ import { BN, bn as bn15, max } from "@fuel-ts/math";
78
78
  import {
79
79
  InputType as InputType6,
80
80
  TransactionType as TransactionType8,
@@ -1023,6 +1023,7 @@ var MemoryCache = class {
1023
1023
  };
1024
1024
 
1025
1025
  // src/providers/transaction-request/input.ts
1026
+ import { BYTES_32, UTXO_ID_LEN } from "@fuel-ts/abi-coder";
1026
1027
  import { ZeroBytes32 } from "@fuel-ts/address/configs";
1027
1028
  import { ErrorCode as ErrorCode3, FuelError as FuelError3 } from "@fuel-ts/errors";
1028
1029
  import { bn as bn2, toNumber } from "@fuel-ts/math";
@@ -1036,8 +1037,8 @@ var inputify = (value) => {
1036
1037
  const predicateData = arrayify(value.predicateData ?? "0x");
1037
1038
  return {
1038
1039
  type: InputType.Coin,
1039
- txID: hexlify3(arrayify(value.id).slice(0, 32)),
1040
- outputIndex: arrayify(value.id)[32],
1040
+ txID: hexlify3(arrayify(value.id).slice(0, BYTES_32)),
1041
+ outputIndex: toNumber(arrayify(value.id).slice(BYTES_32, UTXO_ID_LEN)),
1041
1042
  owner: hexlify3(value.owner),
1042
1043
  amount: bn2(value.amount),
1043
1044
  assetId: hexlify3(value.assetId),
@@ -1155,9 +1156,11 @@ var outputify = (value) => {
1155
1156
  };
1156
1157
 
1157
1158
  // src/providers/transaction-request/transaction-request.ts
1159
+ import { UTXO_ID_LEN as UTXO_ID_LEN2 } from "@fuel-ts/abi-coder";
1158
1160
  import { Address, addressify } from "@fuel-ts/address";
1159
1161
  import { BaseAssetId as BaseAssetId2, ZeroBytes32 as ZeroBytes324 } from "@fuel-ts/address/configs";
1160
- import { bn as bn6 } from "@fuel-ts/math";
1162
+ import { randomBytes } from "@fuel-ts/crypto";
1163
+ import { bn as bn7 } from "@fuel-ts/math";
1161
1164
  import {
1162
1165
  PolicyType,
1163
1166
  TransactionCoder,
@@ -1562,6 +1565,86 @@ function sleep(time) {
1562
1565
  });
1563
1566
  }
1564
1567
 
1568
+ // src/providers/utils/extract-tx-error.ts
1569
+ import { ErrorCode as ErrorCode7, FuelError as FuelError7 } from "@fuel-ts/errors";
1570
+ import { bn as bn6 } from "@fuel-ts/math";
1571
+ import { ReceiptType as ReceiptType3 } from "@fuel-ts/transactions";
1572
+ import {
1573
+ FAILED_REQUIRE_SIGNAL,
1574
+ FAILED_ASSERT_EQ_SIGNAL,
1575
+ FAILED_ASSERT_NE_SIGNAL,
1576
+ FAILED_ASSERT_SIGNAL,
1577
+ FAILED_TRANSFER_TO_ADDRESS_SIGNAL as FAILED_TRANSFER_TO_ADDRESS_SIGNAL2,
1578
+ PANIC_REASONS,
1579
+ PANIC_DOC_URL
1580
+ } from "@fuel-ts/transactions/configs";
1581
+ var assemblePanicError = (status) => {
1582
+ let errorMessage = `The transaction reverted with reason: "${status.reason}".`;
1583
+ const reason = status.reason;
1584
+ if (PANIC_REASONS.includes(status.reason)) {
1585
+ errorMessage = `${errorMessage}
1586
+
1587
+ You can read more about this error at:
1588
+
1589
+ ${PANIC_DOC_URL}#variant.${status.reason}`;
1590
+ }
1591
+ return { errorMessage, reason };
1592
+ };
1593
+ var stringify = (obj) => JSON.stringify(obj, null, 2);
1594
+ var assembleRevertError = (receipts, logs) => {
1595
+ let errorMessage = "The transaction reverted with an unknown reason.";
1596
+ const revertReceipt = receipts.find(({ type }) => type === ReceiptType3.Revert);
1597
+ let reason = "";
1598
+ if (revertReceipt) {
1599
+ const reasonHex = bn6(revertReceipt.val).toHex();
1600
+ switch (reasonHex) {
1601
+ case FAILED_REQUIRE_SIGNAL: {
1602
+ reason = "require";
1603
+ errorMessage = `The transaction reverted because a "require" statement has thrown ${logs.length ? stringify(logs[0]) : "an error."}.`;
1604
+ break;
1605
+ }
1606
+ case FAILED_ASSERT_EQ_SIGNAL: {
1607
+ const sufix = logs.length >= 2 ? ` comparing ${stringify(logs[1])} and ${stringify(logs[0])}.` : ".";
1608
+ reason = "assert_eq";
1609
+ errorMessage = `The transaction reverted because of an "assert_eq" statement${sufix}`;
1610
+ break;
1611
+ }
1612
+ case FAILED_ASSERT_NE_SIGNAL: {
1613
+ const sufix = logs.length >= 2 ? ` comparing ${stringify(logs[1])} and ${stringify(logs[0])}.` : ".";
1614
+ reason = "assert_ne";
1615
+ errorMessage = `The transaction reverted because of an "assert_ne" statement${sufix}`;
1616
+ break;
1617
+ }
1618
+ case FAILED_ASSERT_SIGNAL:
1619
+ reason = "assert";
1620
+ errorMessage = `The transaction reverted because an "assert" statement failed to evaluate to true.`;
1621
+ break;
1622
+ case FAILED_TRANSFER_TO_ADDRESS_SIGNAL2:
1623
+ reason = "MissingOutputChange";
1624
+ errorMessage = `The transaction reverted because it's missing an "OutputChange".`;
1625
+ break;
1626
+ default:
1627
+ reason = "unknown";
1628
+ errorMessage = `The transaction reverted with an unknown reason: ${revertReceipt.val}`;
1629
+ }
1630
+ }
1631
+ return { errorMessage, reason };
1632
+ };
1633
+ var extractTxError = (params) => {
1634
+ const { receipts, status, logs } = params;
1635
+ const isPanic = receipts.some(({ type }) => type === ReceiptType3.Panic);
1636
+ const isRevert = receipts.some(({ type }) => type === ReceiptType3.Revert);
1637
+ const { errorMessage, reason } = status?.type === "FailureStatus" && isPanic ? assemblePanicError(status) : assembleRevertError(receipts, logs);
1638
+ const metadata = {
1639
+ logs,
1640
+ receipts,
1641
+ panic: isPanic,
1642
+ revert: isRevert,
1643
+ reason
1644
+ };
1645
+ return new FuelError7(ErrorCode7.SCRIPT_REVERTED, errorMessage, metadata);
1646
+ };
1647
+
1565
1648
  // src/providers/transaction-request/errors.ts
1566
1649
  var ChangeOutputCollisionError = class extends Error {
1567
1650
  name = "ChangeOutputCollisionError";
@@ -1624,10 +1707,10 @@ var BaseTransactionRequest = class {
1624
1707
  outputs,
1625
1708
  witnesses
1626
1709
  } = {}) {
1627
- this.gasPrice = bn6(gasPrice);
1710
+ this.gasPrice = bn7(gasPrice);
1628
1711
  this.maturity = maturity ?? 0;
1629
- this.witnessLimit = witnessLimit ? bn6(witnessLimit) : void 0;
1630
- this.maxFee = maxFee ? bn6(maxFee) : void 0;
1712
+ this.witnessLimit = witnessLimit ? bn7(witnessLimit) : void 0;
1713
+ this.maxFee = maxFee ? bn7(maxFee) : void 0;
1631
1714
  this.inputs = inputs ?? [];
1632
1715
  this.outputs = outputs ?? [];
1633
1716
  this.witnesses = witnesses ?? [];
@@ -1843,8 +1926,7 @@ var BaseTransactionRequest = class {
1843
1926
  assetId,
1844
1927
  txPointer: "0x00000000000000000000000000000000",
1845
1928
  witnessIndex,
1846
- predicate: predicate?.bytes,
1847
- predicateData: predicate?.predicateDataBytes
1929
+ predicate: predicate?.bytes
1848
1930
  };
1849
1931
  this.pushInput(input);
1850
1932
  this.addChangeOutput(owner, assetId);
@@ -1876,8 +1958,7 @@ var BaseTransactionRequest = class {
1876
1958
  recipient: recipient.toB256(),
1877
1959
  amount,
1878
1960
  witnessIndex,
1879
- predicate: predicate?.bytes,
1880
- predicateData: predicate?.predicateDataBytes
1961
+ predicate: predicate?.bytes
1881
1962
  };
1882
1963
  this.pushInput(input);
1883
1964
  this.addChangeOutput(recipient, assetId);
@@ -2032,12 +2113,6 @@ var BaseTransactionRequest = class {
2032
2113
  * @param quantities - CoinQuantity Array.
2033
2114
  */
2034
2115
  fundWithFakeUtxos(quantities, resourcesOwner) {
2035
- let idCounter = 0;
2036
- const generateId = () => {
2037
- const counterString = String(idCounter++);
2038
- const id = ZeroBytes324.slice(0, -counterString.length).concat(counterString);
2039
- return id;
2040
- };
2041
2116
  const findAssetInput = (assetId) => this.inputs.find((input) => {
2042
2117
  if ("assetId" in input) {
2043
2118
  return input.assetId === assetId;
@@ -2047,23 +2122,23 @@ var BaseTransactionRequest = class {
2047
2122
  const updateAssetInput = (assetId, quantity) => {
2048
2123
  const assetInput = findAssetInput(assetId);
2049
2124
  if (assetInput && "assetId" in assetInput) {
2050
- assetInput.id = generateId();
2125
+ assetInput.id = hexlify7(randomBytes(UTXO_ID_LEN2));
2051
2126
  assetInput.amount = quantity;
2052
2127
  } else {
2053
2128
  this.addResources([
2054
2129
  {
2055
- id: generateId(),
2130
+ id: hexlify7(randomBytes(UTXO_ID_LEN2)),
2056
2131
  amount: quantity,
2057
2132
  assetId,
2058
2133
  owner: resourcesOwner || Address.fromRandom(),
2059
2134
  maturity: 0,
2060
- blockCreated: bn6(1),
2061
- txCreatedIdx: bn6(1)
2135
+ blockCreated: bn7(1),
2136
+ txCreatedIdx: bn7(1)
2062
2137
  }
2063
2138
  ]);
2064
2139
  }
2065
2140
  };
2066
- updateAssetInput(BaseAssetId2, bn6(1e11));
2141
+ updateAssetInput(BaseAssetId2, bn7(1e11));
2067
2142
  quantities.forEach((q) => updateAssetInput(q.assetId, q.amount));
2068
2143
  }
2069
2144
  /**
@@ -2074,7 +2149,7 @@ var BaseTransactionRequest = class {
2074
2149
  */
2075
2150
  getCoinOutputsQuantities() {
2076
2151
  const coinsQuantities = this.getCoinOutputs().map(({ amount, assetId }) => ({
2077
- amount: bn6(amount),
2152
+ amount: bn7(amount),
2078
2153
  assetId: assetId.toString()
2079
2154
  }));
2080
2155
  return coinsQuantities;
@@ -2103,7 +2178,7 @@ var BaseTransactionRequest = class {
2103
2178
  default:
2104
2179
  return;
2105
2180
  }
2106
- if (correspondingInput && "predicateGasUsed" in correspondingInput && bn6(correspondingInput.predicateGasUsed).gt(0)) {
2181
+ if (correspondingInput && "predicateGasUsed" in correspondingInput && bn7(correspondingInput.predicateGasUsed).gt(0)) {
2107
2182
  i.predicate = correspondingInput.predicate;
2108
2183
  i.predicateData = correspondingInput.predicateData;
2109
2184
  i.predicateGasUsed = correspondingInput.predicateGasUsed;
@@ -2114,14 +2189,14 @@ var BaseTransactionRequest = class {
2114
2189
 
2115
2190
  // src/providers/transaction-request/create-transaction-request.ts
2116
2191
  import { ZeroBytes32 as ZeroBytes326 } from "@fuel-ts/address/configs";
2117
- import { bn as bn8 } from "@fuel-ts/math";
2192
+ import { bn as bn9 } from "@fuel-ts/math";
2118
2193
  import { TransactionType as TransactionType3, OutputType as OutputType4 } from "@fuel-ts/transactions";
2119
2194
  import { arrayify as arrayify6, hexlify as hexlify9 } from "@fuel-ts/utils";
2120
2195
 
2121
2196
  // src/providers/transaction-request/hash-transaction.ts
2122
2197
  import { ZeroBytes32 as ZeroBytes325 } from "@fuel-ts/address/configs";
2123
2198
  import { uint64ToBytesBE, sha256 } from "@fuel-ts/hasher";
2124
- import { bn as bn7 } from "@fuel-ts/math";
2199
+ import { bn as bn8 } from "@fuel-ts/math";
2125
2200
  import { TransactionType as TransactionType2, InputType as InputType3, OutputType as OutputType3, TransactionCoder as TransactionCoder2 } from "@fuel-ts/transactions";
2126
2201
  import { concat as concat2 } from "@fuel-ts/utils";
2127
2202
  import { clone as clone2 } from "ramda";
@@ -2138,11 +2213,11 @@ function hashTransaction(transactionRequest, chainId) {
2138
2213
  blockHeight: 0,
2139
2214
  txIndex: 0
2140
2215
  };
2141
- inputClone.predicateGasUsed = bn7(0);
2216
+ inputClone.predicateGasUsed = bn8(0);
2142
2217
  return inputClone;
2143
2218
  }
2144
2219
  case InputType3.Message: {
2145
- inputClone.predicateGasUsed = bn7(0);
2220
+ inputClone.predicateGasUsed = bn8(0);
2146
2221
  return inputClone;
2147
2222
  }
2148
2223
  case InputType3.Contract: {
@@ -2169,12 +2244,12 @@ function hashTransaction(transactionRequest, chainId) {
2169
2244
  return outputClone;
2170
2245
  }
2171
2246
  case OutputType3.Change: {
2172
- outputClone.amount = bn7(0);
2247
+ outputClone.amount = bn8(0);
2173
2248
  return outputClone;
2174
2249
  }
2175
2250
  case OutputType3.Variable: {
2176
2251
  outputClone.to = ZeroBytes325;
2177
- outputClone.amount = bn7(0);
2252
+ outputClone.amount = bn8(0);
2178
2253
  outputClone.assetId = ZeroBytes325;
2179
2254
  return outputClone;
2180
2255
  }
@@ -2298,7 +2373,7 @@ var CreateTransactionRequest = class extends BaseTransactionRequest {
2298
2373
  }
2299
2374
  metadataGas(gasCosts) {
2300
2375
  return calculateMetadataGasForTxCreate({
2301
- contractBytesSize: bn8(arrayify6(this.witnesses[this.bytecodeWitnessIndex] || "0x").length),
2376
+ contractBytesSize: bn9(arrayify6(this.witnesses[this.bytecodeWitnessIndex] || "0x").length),
2302
2377
  gasCosts,
2303
2378
  stateRootSize: this.storageSlots.length,
2304
2379
  txBytesSize: this.byteSize()
@@ -2310,7 +2385,7 @@ var CreateTransactionRequest = class extends BaseTransactionRequest {
2310
2385
  import { Interface } from "@fuel-ts/abi-coder";
2311
2386
  import { addressify as addressify2 } from "@fuel-ts/address";
2312
2387
  import { ZeroBytes32 as ZeroBytes327 } from "@fuel-ts/address/configs";
2313
- import { bn as bn9 } from "@fuel-ts/math";
2388
+ import { bn as bn10 } from "@fuel-ts/math";
2314
2389
  import { InputType as InputType4, OutputType as OutputType5, TransactionType as TransactionType4 } from "@fuel-ts/transactions";
2315
2390
  import { arrayify as arrayify8, hexlify as hexlify10 } from "@fuel-ts/utils";
2316
2391
 
@@ -2364,7 +2439,7 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
2364
2439
  */
2365
2440
  constructor({ script, scriptData, gasLimit, ...rest } = {}) {
2366
2441
  super(rest);
2367
- this.gasLimit = bn9(gasLimit);
2442
+ this.gasLimit = bn10(gasLimit);
2368
2443
  this.script = arrayify8(script ?? returnZeroScript.bytes);
2369
2444
  this.scriptData = arrayify8(scriptData ?? returnZeroScript.encodeScriptData());
2370
2445
  this.abis = rest.abis;
@@ -2512,7 +2587,7 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
2512
2587
  };
2513
2588
 
2514
2589
  // src/providers/transaction-request/utils.ts
2515
- import { ErrorCode as ErrorCode7, FuelError as FuelError7 } from "@fuel-ts/errors";
2590
+ import { ErrorCode as ErrorCode8, FuelError as FuelError8 } from "@fuel-ts/errors";
2516
2591
  import { TransactionType as TransactionType5 } from "@fuel-ts/transactions";
2517
2592
  var transactionRequestify = (obj) => {
2518
2593
  if (obj instanceof ScriptTransactionRequest || obj instanceof CreateTransactionRequest) {
@@ -2527,14 +2602,14 @@ var transactionRequestify = (obj) => {
2527
2602
  return CreateTransactionRequest.from(obj);
2528
2603
  }
2529
2604
  default: {
2530
- throw new FuelError7(ErrorCode7.INVALID_TRANSACTION_TYPE, `Invalid transaction type: ${type}.`);
2605
+ throw new FuelError8(ErrorCode8.INVALID_TRANSACTION_TYPE, `Invalid transaction type: ${type}.`);
2531
2606
  }
2532
2607
  }
2533
2608
  };
2534
2609
 
2535
2610
  // src/providers/transaction-response/transaction-response.ts
2536
- import { ErrorCode as ErrorCode11, FuelError as FuelError11 } from "@fuel-ts/errors";
2537
- import { bn as bn13 } from "@fuel-ts/math";
2611
+ import { ErrorCode as ErrorCode12, FuelError as FuelError12 } from "@fuel-ts/errors";
2612
+ import { bn as bn14 } from "@fuel-ts/math";
2538
2613
  import { TransactionCoder as TransactionCoder4 } from "@fuel-ts/transactions";
2539
2614
  import { arrayify as arrayify10 } from "@fuel-ts/utils";
2540
2615
 
@@ -2542,7 +2617,7 @@ import { arrayify as arrayify10 } from "@fuel-ts/utils";
2542
2617
  import { DateTime, hexlify as hexlify11 } from "@fuel-ts/utils";
2543
2618
 
2544
2619
  // src/providers/transaction-summary/calculate-transaction-fee.ts
2545
- import { bn as bn10 } from "@fuel-ts/math";
2620
+ import { bn as bn11 } from "@fuel-ts/math";
2546
2621
  import { PolicyType as PolicyType2, TransactionCoder as TransactionCoder3, TransactionType as TransactionType6 } from "@fuel-ts/transactions";
2547
2622
  import { arrayify as arrayify9 } from "@fuel-ts/utils";
2548
2623
  var calculateTransactionFee = (params) => {
@@ -2551,24 +2626,24 @@ var calculateTransactionFee = (params) => {
2551
2626
  rawPayload,
2552
2627
  consensusParameters: { gasCosts, feeParams }
2553
2628
  } = params;
2554
- const gasPerByte = bn10(feeParams.gasPerByte);
2555
- const gasPriceFactor = bn10(feeParams.gasPriceFactor);
2629
+ const gasPerByte = bn11(feeParams.gasPerByte);
2630
+ const gasPriceFactor = bn11(feeParams.gasPriceFactor);
2556
2631
  const transactionBytes = arrayify9(rawPayload);
2557
2632
  const [transaction] = new TransactionCoder3().decode(transactionBytes, 0);
2558
2633
  if (transaction.type === TransactionType6.Mint) {
2559
2634
  return {
2560
- fee: bn10(0),
2561
- minFee: bn10(0),
2562
- maxFee: bn10(0),
2563
- feeFromGasUsed: bn10(0)
2635
+ fee: bn11(0),
2636
+ minFee: bn11(0),
2637
+ maxFee: bn11(0),
2638
+ feeFromGasUsed: bn11(0)
2564
2639
  };
2565
2640
  }
2566
2641
  const { type, witnesses, inputs, policies } = transaction;
2567
- let metadataGas = bn10(0);
2568
- let gasLimit = bn10(0);
2642
+ let metadataGas = bn11(0);
2643
+ let gasLimit = bn11(0);
2569
2644
  if (type === TransactionType6.Create) {
2570
2645
  const { bytecodeWitnessIndex, storageSlots } = transaction;
2571
- const contractBytesSize = bn10(arrayify9(witnesses[bytecodeWitnessIndex].data).length);
2646
+ const contractBytesSize = bn11(arrayify9(witnesses[bytecodeWitnessIndex].data).length);
2572
2647
  metadataGas = calculateMetadataGasForTxCreate({
2573
2648
  contractBytesSize,
2574
2649
  gasCosts,
@@ -2587,12 +2662,12 @@ var calculateTransactionFee = (params) => {
2587
2662
  }
2588
2663
  const minGas = getMinGas({
2589
2664
  gasCosts,
2590
- gasPerByte: bn10(gasPerByte),
2665
+ gasPerByte: bn11(gasPerByte),
2591
2666
  inputs,
2592
2667
  metadataGas,
2593
2668
  txBytesSize: transactionBytes.length
2594
2669
  });
2595
- const gasPrice = bn10(policies.find((policy) => policy.type === PolicyType2.GasPrice)?.data);
2670
+ const gasPrice = bn11(policies.find((policy) => policy.type === PolicyType2.GasPrice)?.data);
2596
2671
  const witnessLimit = policies.find((policy) => policy.type === PolicyType2.WitnessLimit)?.data;
2597
2672
  const witnessesLength = witnesses.reduce((acc, wit) => acc + wit.dataLength, 0);
2598
2673
  const maxGas = getMaxGas({
@@ -2616,13 +2691,13 @@ var calculateTransactionFee = (params) => {
2616
2691
 
2617
2692
  // src/providers/transaction-summary/operations.ts
2618
2693
  import { ZeroBytes32 as ZeroBytes328 } from "@fuel-ts/address/configs";
2619
- import { ErrorCode as ErrorCode9, FuelError as FuelError9 } from "@fuel-ts/errors";
2620
- import { bn as bn12 } from "@fuel-ts/math";
2621
- import { ReceiptType as ReceiptType3, TransactionType as TransactionType7 } from "@fuel-ts/transactions";
2694
+ import { ErrorCode as ErrorCode10, FuelError as FuelError10 } from "@fuel-ts/errors";
2695
+ import { bn as bn13 } from "@fuel-ts/math";
2696
+ import { ReceiptType as ReceiptType4, TransactionType as TransactionType7 } from "@fuel-ts/transactions";
2622
2697
 
2623
2698
  // src/providers/transaction-summary/call.ts
2624
2699
  import { Interface as Interface2, calculateVmTxMemory } from "@fuel-ts/abi-coder";
2625
- import { bn as bn11 } from "@fuel-ts/math";
2700
+ import { bn as bn12 } from "@fuel-ts/math";
2626
2701
  var getFunctionCall = ({ abi, receipt, rawPayload, maxInputs }) => {
2627
2702
  const abiInterface = new Interface2(abi);
2628
2703
  const callFunctionSelector = receipt.param1.toHex(8);
@@ -2631,7 +2706,7 @@ var getFunctionCall = ({ abi, receipt, rawPayload, maxInputs }) => {
2631
2706
  let encodedArgs;
2632
2707
  if (functionFragment.isInputDataPointer) {
2633
2708
  if (rawPayload) {
2634
- const argsOffset = bn11(receipt.param2).sub(calculateVmTxMemory({ maxInputs: maxInputs.toNumber() })).toNumber();
2709
+ const argsOffset = bn12(receipt.param2).sub(calculateVmTxMemory({ maxInputs: maxInputs.toNumber() })).toNumber();
2635
2710
  encodedArgs = `0x${rawPayload.slice(2).slice(argsOffset * 2)}`;
2636
2711
  }
2637
2712
  } else {
@@ -2665,7 +2740,7 @@ var getFunctionCall = ({ abi, receipt, rawPayload, maxInputs }) => {
2665
2740
  };
2666
2741
 
2667
2742
  // src/providers/transaction-summary/input.ts
2668
- import { ErrorCode as ErrorCode8, FuelError as FuelError8 } from "@fuel-ts/errors";
2743
+ import { ErrorCode as ErrorCode9, FuelError as FuelError9 } from "@fuel-ts/errors";
2669
2744
  import { InputType as InputType5 } from "@fuel-ts/transactions";
2670
2745
  function getInputsByTypes(inputs, types) {
2671
2746
  return inputs.filter((i) => types.includes(i.type));
@@ -2703,8 +2778,8 @@ function getInputContractFromIndex(inputs, inputIndex) {
2703
2778
  return void 0;
2704
2779
  }
2705
2780
  if (contractInput.type !== InputType5.Contract) {
2706
- throw new FuelError8(
2707
- ErrorCode8.INVALID_TRANSACTION_INPUT,
2781
+ throw new FuelError9(
2782
+ ErrorCode9.INVALID_TRANSACTION_INPUT,
2708
2783
  `Contract input should be of type 'contract'.`
2709
2784
  );
2710
2785
  }
@@ -2792,8 +2867,8 @@ function getTransactionTypeName(transactionType) {
2792
2867
  case TransactionType7.Script:
2793
2868
  return "Script" /* Script */;
2794
2869
  default:
2795
- throw new FuelError9(
2796
- ErrorCode9.INVALID_TRANSACTION_TYPE,
2870
+ throw new FuelError10(
2871
+ ErrorCode10.INVALID_TRANSACTION_TYPE,
2797
2872
  `Invalid transaction type: ${transactionType}.`
2798
2873
  );
2799
2874
  }
@@ -2815,10 +2890,10 @@ function hasSameAssetId(a) {
2815
2890
  return (b) => a.assetId === b.assetId;
2816
2891
  }
2817
2892
  function getReceiptsCall(receipts) {
2818
- return getReceiptsByType(receipts, ReceiptType3.Call);
2893
+ return getReceiptsByType(receipts, ReceiptType4.Call);
2819
2894
  }
2820
2895
  function getReceiptsMessageOut(receipts) {
2821
- return getReceiptsByType(receipts, ReceiptType3.MessageOut);
2896
+ return getReceiptsByType(receipts, ReceiptType4.MessageOut);
2822
2897
  }
2823
2898
  var mergeAssets = (op1, op2) => {
2824
2899
  const assets1 = op1.assetsSent || [];
@@ -2831,7 +2906,7 @@ var mergeAssets = (op1, op2) => {
2831
2906
  if (!matchingAsset) {
2832
2907
  return asset1;
2833
2908
  }
2834
- const mergedAmount = bn12(asset1.amount).add(matchingAsset.amount);
2909
+ const mergedAmount = bn13(asset1.amount).add(matchingAsset.amount);
2835
2910
  return { ...asset1, amount: mergedAmount };
2836
2911
  });
2837
2912
  return mergedAssets.concat(filteredAssets);
@@ -2857,7 +2932,7 @@ function addOperation(operations, toAdd) {
2857
2932
  return allOperations;
2858
2933
  }
2859
2934
  function getReceiptsTransferOut(receipts) {
2860
- return getReceiptsByType(receipts, ReceiptType3.TransferOut);
2935
+ return getReceiptsByType(receipts, ReceiptType4.TransferOut);
2861
2936
  }
2862
2937
  function getWithdrawFromFuelOperations({
2863
2938
  inputs,
@@ -3017,11 +3092,11 @@ function getTransferOperations({
3017
3092
  });
3018
3093
  const transferReceipts = getReceiptsByType(
3019
3094
  receipts,
3020
- ReceiptType3.Transfer
3095
+ ReceiptType4.Transfer
3021
3096
  );
3022
3097
  const transferOutReceipts = getReceiptsByType(
3023
3098
  receipts,
3024
- ReceiptType3.TransferOut
3099
+ ReceiptType4.TransferOut
3025
3100
  );
3026
3101
  [...transferReceipts, ...transferOutReceipts].forEach((receipt) => {
3027
3102
  const operation = extractTransferOperationFromReceipt(receipt, contractInputs, changeOutputs);
@@ -3106,17 +3181,17 @@ function getOperations({
3106
3181
  }
3107
3182
 
3108
3183
  // src/providers/transaction-summary/receipt.ts
3109
- import { ReceiptType as ReceiptType4 } from "@fuel-ts/transactions";
3184
+ import { ReceiptType as ReceiptType5 } from "@fuel-ts/transactions";
3110
3185
  var processGqlReceipt = (gqlReceipt) => {
3111
3186
  const receipt = assembleReceiptByType(gqlReceipt);
3112
3187
  switch (receipt.type) {
3113
- case ReceiptType4.ReturnData: {
3188
+ case ReceiptType5.ReturnData: {
3114
3189
  return {
3115
3190
  ...receipt,
3116
3191
  data: gqlReceipt.data || "0x"
3117
3192
  };
3118
3193
  }
3119
- case ReceiptType4.LogData: {
3194
+ case ReceiptType5.LogData: {
3120
3195
  return {
3121
3196
  ...receipt,
3122
3197
  data: gqlReceipt.data || "0x"
@@ -3129,7 +3204,7 @@ var processGqlReceipt = (gqlReceipt) => {
3129
3204
  var extractMintedAssetsFromReceipts = (receipts) => {
3130
3205
  const mintedAssets = [];
3131
3206
  receipts.forEach((receipt) => {
3132
- if (receipt.type === ReceiptType4.Mint) {
3207
+ if (receipt.type === ReceiptType5.Mint) {
3133
3208
  mintedAssets.push({
3134
3209
  subId: receipt.subId,
3135
3210
  contractId: receipt.contractId,
@@ -3143,7 +3218,7 @@ var extractMintedAssetsFromReceipts = (receipts) => {
3143
3218
  var extractBurnedAssetsFromReceipts = (receipts) => {
3144
3219
  const burnedAssets = [];
3145
3220
  receipts.forEach((receipt) => {
3146
- if (receipt.type === ReceiptType4.Burn) {
3221
+ if (receipt.type === ReceiptType5.Burn) {
3147
3222
  burnedAssets.push({
3148
3223
  subId: receipt.subId,
3149
3224
  contractId: receipt.contractId,
@@ -3156,7 +3231,7 @@ var extractBurnedAssetsFromReceipts = (receipts) => {
3156
3231
  };
3157
3232
 
3158
3233
  // src/providers/transaction-summary/status.ts
3159
- import { ErrorCode as ErrorCode10, FuelError as FuelError10 } from "@fuel-ts/errors";
3234
+ import { ErrorCode as ErrorCode11, FuelError as FuelError11 } from "@fuel-ts/errors";
3160
3235
  var getTransactionStatusName = (gqlStatus) => {
3161
3236
  switch (gqlStatus) {
3162
3237
  case "FailureStatus":
@@ -3168,8 +3243,8 @@ var getTransactionStatusName = (gqlStatus) => {
3168
3243
  case "SqueezedOutStatus":
3169
3244
  return "squeezedout" /* squeezedout */;
3170
3245
  default:
3171
- throw new FuelError10(
3172
- ErrorCode10.INVALID_TRANSACTION_STATUS,
3246
+ throw new FuelError11(
3247
+ ErrorCode11.INVALID_TRANSACTION_STATUS,
3173
3248
  `Invalid transaction status: ${gqlStatus}.`
3174
3249
  );
3175
3250
  }
@@ -3282,12 +3357,12 @@ function assembleTransactionSummary(params) {
3282
3357
 
3283
3358
  // src/providers/transaction-response/getDecodedLogs.ts
3284
3359
  import { Interface as Interface3, BigNumberCoder } from "@fuel-ts/abi-coder";
3285
- import { ReceiptType as ReceiptType5 } from "@fuel-ts/transactions";
3360
+ import { ReceiptType as ReceiptType6 } from "@fuel-ts/transactions";
3286
3361
  function getDecodedLogs(receipts, mainAbi, externalAbis = {}) {
3287
3362
  return receipts.reduce((logs, receipt) => {
3288
- if (receipt.type === ReceiptType5.LogData || receipt.type === ReceiptType5.Log) {
3363
+ if (receipt.type === ReceiptType6.LogData || receipt.type === ReceiptType6.Log) {
3289
3364
  const interfaceToUse = new Interface3(externalAbis[receipt.id] || mainAbi);
3290
- const data = receipt.type === ReceiptType5.Log ? new BigNumberCoder("u64").encode(receipt.val0) : receipt.data;
3365
+ const data = receipt.type === ReceiptType6.Log ? new BigNumberCoder("u64").encode(receipt.val0) : receipt.data;
3291
3366
  const [decodedLog] = interfaceToUse.decodeLog(data, receipt.val1.toNumber());
3292
3367
  logs.push(decodedLog);
3293
3368
  }
@@ -3302,7 +3377,7 @@ var TransactionResponse = class {
3302
3377
  /** Current provider */
3303
3378
  provider;
3304
3379
  /** Gas used on the transaction */
3305
- gasUsed = bn13(0);
3380
+ gasUsed = bn14(0);
3306
3381
  /** The graphql Transaction with receipts object. */
3307
3382
  gqlTransaction;
3308
3383
  abis;
@@ -3407,8 +3482,8 @@ var TransactionResponse = class {
3407
3482
  });
3408
3483
  for await (const { statusChange } of subscription) {
3409
3484
  if (statusChange.type === "SqueezedOutStatus") {
3410
- throw new FuelError11(
3411
- ErrorCode11.TRANSACTION_SQUEEZED_OUT,
3485
+ throw new FuelError12(
3486
+ ErrorCode12.TRANSACTION_SQUEEZED_OUT,
3412
3487
  `Transaction Squeezed Out with reason: ${statusChange.reason}`
3413
3488
  );
3414
3489
  }
@@ -3430,14 +3505,26 @@ var TransactionResponse = class {
3430
3505
  gqlTransaction: this.gqlTransaction,
3431
3506
  ...transactionSummary
3432
3507
  };
3508
+ let logs = [];
3433
3509
  if (this.abis) {
3434
- const logs = getDecodedLogs(
3510
+ logs = getDecodedLogs(
3435
3511
  transactionSummary.receipts,
3436
3512
  this.abis.main,
3437
3513
  this.abis.otherContractsAbis
3438
3514
  );
3439
3515
  transactionResult.logs = logs;
3440
3516
  }
3517
+ if (transactionResult.isStatusFailure) {
3518
+ const {
3519
+ receipts,
3520
+ gqlTransaction: { status }
3521
+ } = transactionResult;
3522
+ throw extractTxError({
3523
+ receipts,
3524
+ status,
3525
+ logs
3526
+ });
3527
+ }
3441
3528
  return transactionResult;
3442
3529
  }
3443
3530
  /**
@@ -3446,14 +3533,7 @@ var TransactionResponse = class {
3446
3533
  * @param contractsAbiMap - The contracts ABI map.
3447
3534
  */
3448
3535
  async wait(contractsAbiMap) {
3449
- const result = await this.waitForResult(contractsAbiMap);
3450
- if (result.isStatusFailure) {
3451
- throw new FuelError11(
3452
- ErrorCode11.TRANSACTION_FAILED,
3453
- `Transaction failed: ${result.gqlTransaction.status.reason}`
3454
- );
3455
- }
3456
- return result;
3536
+ return this.waitForResult(contractsAbiMap);
3457
3537
  }
3458
3538
  };
3459
3539
 
@@ -3515,29 +3595,29 @@ var processGqlChain = (chain) => {
3515
3595
  const { contractParams, feeParams, predicateParams, scriptParams, txParams, gasCosts } = consensusParameters;
3516
3596
  return {
3517
3597
  name,
3518
- baseChainHeight: bn14(daHeight),
3598
+ baseChainHeight: bn15(daHeight),
3519
3599
  consensusParameters: {
3520
- contractMaxSize: bn14(contractParams.contractMaxSize),
3521
- maxInputs: bn14(txParams.maxInputs),
3522
- maxOutputs: bn14(txParams.maxOutputs),
3523
- maxWitnesses: bn14(txParams.maxWitnesses),
3524
- maxGasPerTx: bn14(txParams.maxGasPerTx),
3525
- maxScriptLength: bn14(scriptParams.maxScriptLength),
3526
- maxScriptDataLength: bn14(scriptParams.maxScriptDataLength),
3527
- maxStorageSlots: bn14(contractParams.maxStorageSlots),
3528
- maxPredicateLength: bn14(predicateParams.maxPredicateLength),
3529
- maxPredicateDataLength: bn14(predicateParams.maxPredicateDataLength),
3530
- maxGasPerPredicate: bn14(predicateParams.maxGasPerPredicate),
3531
- gasPriceFactor: bn14(feeParams.gasPriceFactor),
3532
- gasPerByte: bn14(feeParams.gasPerByte),
3533
- maxMessageDataLength: bn14(predicateParams.maxMessageDataLength),
3534
- chainId: bn14(consensusParameters.chainId),
3600
+ contractMaxSize: bn15(contractParams.contractMaxSize),
3601
+ maxInputs: bn15(txParams.maxInputs),
3602
+ maxOutputs: bn15(txParams.maxOutputs),
3603
+ maxWitnesses: bn15(txParams.maxWitnesses),
3604
+ maxGasPerTx: bn15(txParams.maxGasPerTx),
3605
+ maxScriptLength: bn15(scriptParams.maxScriptLength),
3606
+ maxScriptDataLength: bn15(scriptParams.maxScriptDataLength),
3607
+ maxStorageSlots: bn15(contractParams.maxStorageSlots),
3608
+ maxPredicateLength: bn15(predicateParams.maxPredicateLength),
3609
+ maxPredicateDataLength: bn15(predicateParams.maxPredicateDataLength),
3610
+ maxGasPerPredicate: bn15(predicateParams.maxGasPerPredicate),
3611
+ gasPriceFactor: bn15(feeParams.gasPriceFactor),
3612
+ gasPerByte: bn15(feeParams.gasPerByte),
3613
+ maxMessageDataLength: bn15(predicateParams.maxMessageDataLength),
3614
+ chainId: bn15(consensusParameters.chainId),
3535
3615
  gasCosts
3536
3616
  },
3537
3617
  gasCosts,
3538
3618
  latestBlock: {
3539
3619
  id: latestBlock.id,
3540
- height: bn14(latestBlock.header.height),
3620
+ height: bn15(latestBlock.header.height),
3541
3621
  time: latestBlock.header.time,
3542
3622
  transactions: latestBlock.transactions.map((i) => ({
3543
3623
  id: i.id
@@ -3607,8 +3687,8 @@ var _Provider = class {
3607
3687
  getChain() {
3608
3688
  const chain = _Provider.chainInfoCache[this.url];
3609
3689
  if (!chain) {
3610
- throw new FuelError12(
3611
- ErrorCode12.CHAIN_INFO_CACHE_EMPTY,
3690
+ throw new FuelError13(
3691
+ ErrorCode13.CHAIN_INFO_CACHE_EMPTY,
3612
3692
  "Chain info cache is empty. Make sure you have called `Provider.create` to initialize the provider."
3613
3693
  );
3614
3694
  }
@@ -3620,8 +3700,8 @@ var _Provider = class {
3620
3700
  getNode() {
3621
3701
  const node = _Provider.nodeInfoCache[this.url];
3622
3702
  if (!node) {
3623
- throw new FuelError12(
3624
- ErrorCode12.NODE_INFO_CACHE_EMPTY,
3703
+ throw new FuelError13(
3704
+ ErrorCode13.NODE_INFO_CACHE_EMPTY,
3625
3705
  "Node info cache is empty. Make sure you have called `Provider.create` to initialize the provider."
3626
3706
  );
3627
3707
  }
@@ -3668,8 +3748,8 @@ var _Provider = class {
3668
3748
  static ensureClientVersionIsSupported(nodeInfo) {
3669
3749
  const { isMajorSupported, isMinorSupported, supportedVersion } = checkFuelCoreVersionCompatibility(nodeInfo.nodeVersion);
3670
3750
  if (!isMajorSupported || !isMinorSupported) {
3671
- throw new FuelError12(
3672
- FuelError12.CODES.UNSUPPORTED_FUEL_CLIENT_VERSION,
3751
+ throw new FuelError13(
3752
+ FuelError13.CODES.UNSUPPORTED_FUEL_CLIENT_VERSION,
3673
3753
  `Fuel client version: ${nodeInfo.nodeVersion}, Supported version: ${supportedVersion}`
3674
3754
  );
3675
3755
  }
@@ -3732,7 +3812,7 @@ var _Provider = class {
3732
3812
  */
3733
3813
  async getBlockNumber() {
3734
3814
  const { chain } = await this.operations.getChain();
3735
- return bn14(chain.latestBlock.header.height, 10);
3815
+ return bn15(chain.latestBlock.header.height, 10);
3736
3816
  }
3737
3817
  /**
3738
3818
  * Returns the chain information.
@@ -3742,9 +3822,9 @@ var _Provider = class {
3742
3822
  async fetchNode() {
3743
3823
  const { nodeInfo } = await this.operations.getNodeInfo();
3744
3824
  const processedNodeInfo = {
3745
- maxDepth: bn14(nodeInfo.maxDepth),
3746
- maxTx: bn14(nodeInfo.maxTx),
3747
- minGasPrice: bn14(nodeInfo.minGasPrice),
3825
+ maxDepth: bn15(nodeInfo.maxDepth),
3826
+ maxTx: bn15(nodeInfo.maxTx),
3827
+ minGasPrice: bn15(nodeInfo.minGasPrice),
3748
3828
  nodeVersion: nodeInfo.nodeVersion,
3749
3829
  utxoValidation: nodeInfo.utxoValidation,
3750
3830
  vmBacktrace: nodeInfo.vmBacktrace,
@@ -3799,8 +3879,8 @@ var _Provider = class {
3799
3879
  const subscription = this.operations.submitAndAwait({ encodedTransaction });
3800
3880
  for await (const { submitAndAwait } of subscription) {
3801
3881
  if (submitAndAwait.type === "SqueezedOutStatus") {
3802
- throw new FuelError12(
3803
- ErrorCode12.TRANSACTION_SQUEEZED_OUT,
3882
+ throw new FuelError13(
3883
+ ErrorCode13.TRANSACTION_SQUEEZED_OUT,
3804
3884
  `Transaction Squeezed Out with reason: ${submitAndAwait.reason}`
3805
3885
  );
3806
3886
  }
@@ -3867,7 +3947,7 @@ var _Provider = class {
3867
3947
  } = response;
3868
3948
  if (inputs) {
3869
3949
  inputs.forEach((input, index) => {
3870
- if ("predicateGasUsed" in input && bn14(input.predicateGasUsed).gt(0)) {
3950
+ if ("predicateGasUsed" in input && bn15(input.predicateGasUsed).gt(0)) {
3871
3951
  transactionRequest.inputs[index].predicateGasUsed = input.predicateGasUsed;
3872
3952
  }
3873
3953
  });
@@ -3924,6 +4004,36 @@ var _Provider = class {
3924
4004
  missingContractIds
3925
4005
  };
3926
4006
  }
4007
+ /**
4008
+ * Estimates the transaction gas and fee based on the provided transaction request.
4009
+ * @param transactionRequest - The transaction request object.
4010
+ * @returns An object containing the estimated minimum gas, minimum fee, maximum gas, and maximum fee.
4011
+ */
4012
+ estimateTxGasAndFee(params) {
4013
+ const { transactionRequest } = params;
4014
+ const { gasPriceFactor, minGasPrice, maxGasPerTx } = this.getGasConfig();
4015
+ const chainInfo = this.getChain();
4016
+ const gasPrice = transactionRequest.gasPrice.eq(0) ? minGasPrice : transactionRequest.gasPrice;
4017
+ transactionRequest.gasPrice = gasPrice;
4018
+ const minGas = transactionRequest.calculateMinGas(chainInfo);
4019
+ const minFee = calculatePriceWithFactor(minGas, gasPrice, gasPriceFactor).normalizeZeroToOne();
4020
+ if (transactionRequest.type === TransactionType8.Script) {
4021
+ if (transactionRequest.gasLimit.eq(0)) {
4022
+ transactionRequest.gasLimit = minGas;
4023
+ transactionRequest.gasLimit = maxGasPerTx.sub(
4024
+ transactionRequest.calculateMaxGas(chainInfo, minGas)
4025
+ );
4026
+ }
4027
+ }
4028
+ const maxGas = transactionRequest.calculateMaxGas(chainInfo, minGas);
4029
+ const maxFee = calculatePriceWithFactor(maxGas, gasPrice, gasPriceFactor).normalizeZeroToOne();
4030
+ return {
4031
+ minGas,
4032
+ minFee,
4033
+ maxGas,
4034
+ maxFee
4035
+ };
4036
+ }
3927
4037
  /**
3928
4038
  * Executes a signed transaction without applying the states changes
3929
4039
  * on the chain.
@@ -3971,17 +4081,16 @@ var _Provider = class {
3971
4081
  signatureCallback
3972
4082
  } = {}) {
3973
4083
  const txRequestClone = clone3(transactionRequestify(transactionRequestLike));
3974
- const chainInfo = this.getChain();
3975
- const { gasPriceFactor, minGasPrice, maxGasPerTx } = this.getGasConfig();
3976
- const gasPrice = max(txRequestClone.gasPrice, minGasPrice);
4084
+ const { minGasPrice } = this.getGasConfig();
4085
+ const setGasPrice = max(txRequestClone.gasPrice, minGasPrice);
3977
4086
  const isScriptTransaction = txRequestClone.type === TransactionType8.Script;
3978
4087
  const coinOutputsQuantities = txRequestClone.getCoinOutputsQuantities();
3979
4088
  const allQuantities = mergeQuantities(coinOutputsQuantities, forwardingQuantities);
3980
4089
  txRequestClone.fundWithFakeUtxos(allQuantities, resourcesOwner?.address);
4090
+ if (isScriptTransaction) {
4091
+ txRequestClone.gasLimit = bn15(0);
4092
+ }
3981
4093
  if (estimatePredicates) {
3982
- if (isScriptTransaction) {
3983
- txRequestClone.gasLimit = bn14(0);
3984
- }
3985
4094
  if (resourcesOwner && "populateTransactionPredicateData" in resourcesOwner) {
3986
4095
  resourcesOwner.populateTransactionPredicateData(txRequestClone);
3987
4096
  }
@@ -3990,36 +4099,34 @@ var _Provider = class {
3990
4099
  if (signatureCallback && isScriptTransaction) {
3991
4100
  await signatureCallback(txRequestClone);
3992
4101
  }
3993
- const minGas = txRequestClone.calculateMinGas(chainInfo);
3994
- const maxGas = txRequestClone.calculateMaxGas(chainInfo, minGas);
4102
+ let { maxFee, maxGas, minFee, minGas } = this.estimateTxGasAndFee({
4103
+ transactionRequest: txRequestClone
4104
+ });
3995
4105
  let receipts = [];
3996
4106
  let missingContractIds = [];
3997
4107
  let outputVariables = 0;
4108
+ let gasUsed = bn15(0);
3998
4109
  if (isScriptTransaction && estimateTxDependencies) {
3999
- txRequestClone.gasPrice = bn14(0);
4000
- txRequestClone.gasLimit = bn14(maxGasPerTx.sub(maxGas).toNumber() * 0.9);
4110
+ txRequestClone.gasPrice = bn15(0);
4001
4111
  const result = await this.estimateTxDependencies(txRequestClone);
4002
4112
  receipts = result.receipts;
4003
4113
  outputVariables = result.outputVariables;
4004
4114
  missingContractIds = result.missingContractIds;
4115
+ gasUsed = isScriptTransaction ? getGasUsedFromReceipts(receipts) : gasUsed;
4116
+ txRequestClone.gasLimit = gasUsed;
4117
+ txRequestClone.gasPrice = setGasPrice;
4118
+ ({ maxFee, maxGas, minFee, minGas } = this.estimateTxGasAndFee({
4119
+ transactionRequest: txRequestClone
4120
+ }));
4005
4121
  }
4006
- const gasUsed = isScriptTransaction ? getGasUsedFromReceipts(receipts) : minGas;
4007
- const usedFee = calculatePriceWithFactor(
4008
- gasUsed,
4009
- gasPrice,
4010
- gasPriceFactor
4011
- ).normalizeZeroToOne();
4012
- const minFee = calculatePriceWithFactor(minGas, gasPrice, gasPriceFactor).normalizeZeroToOne();
4013
- const maxFee = calculatePriceWithFactor(maxGas, gasPrice, gasPriceFactor).normalizeZeroToOne();
4014
4122
  return {
4015
4123
  requiredQuantities: allQuantities,
4016
4124
  receipts,
4017
4125
  gasUsed,
4018
4126
  minGasPrice,
4019
- gasPrice,
4127
+ gasPrice: setGasPrice,
4020
4128
  minGas,
4021
4129
  maxGas,
4022
- usedFee,
4023
4130
  minFee,
4024
4131
  maxFee,
4025
4132
  estimatedInputs: txRequestClone.inputs,
@@ -4059,11 +4166,11 @@ var _Provider = class {
4059
4166
  return coins.map((coin) => ({
4060
4167
  id: coin.utxoId,
4061
4168
  assetId: coin.assetId,
4062
- amount: bn14(coin.amount),
4169
+ amount: bn15(coin.amount),
4063
4170
  owner: Address2.fromAddressOrString(coin.owner),
4064
- maturity: bn14(coin.maturity).toNumber(),
4065
- blockCreated: bn14(coin.blockCreated),
4066
- txCreatedIdx: bn14(coin.txCreatedIdx)
4171
+ maturity: bn15(coin.maturity).toNumber(),
4172
+ blockCreated: bn15(coin.blockCreated),
4173
+ txCreatedIdx: bn15(coin.txCreatedIdx)
4067
4174
  }));
4068
4175
  }
4069
4176
  /**
@@ -4100,9 +4207,9 @@ var _Provider = class {
4100
4207
  switch (coin.__typename) {
4101
4208
  case "MessageCoin":
4102
4209
  return {
4103
- amount: bn14(coin.amount),
4210
+ amount: bn15(coin.amount),
4104
4211
  assetId: coin.assetId,
4105
- daHeight: bn14(coin.daHeight),
4212
+ daHeight: bn15(coin.daHeight),
4106
4213
  sender: Address2.fromAddressOrString(coin.sender),
4107
4214
  recipient: Address2.fromAddressOrString(coin.recipient),
4108
4215
  nonce: coin.nonce
@@ -4110,12 +4217,12 @@ var _Provider = class {
4110
4217
  case "Coin":
4111
4218
  return {
4112
4219
  id: coin.utxoId,
4113
- amount: bn14(coin.amount),
4220
+ amount: bn15(coin.amount),
4114
4221
  assetId: coin.assetId,
4115
4222
  owner: Address2.fromAddressOrString(coin.owner),
4116
- maturity: bn14(coin.maturity).toNumber(),
4117
- blockCreated: bn14(coin.blockCreated),
4118
- txCreatedIdx: bn14(coin.txCreatedIdx)
4223
+ maturity: bn15(coin.maturity).toNumber(),
4224
+ blockCreated: bn15(coin.blockCreated),
4225
+ txCreatedIdx: bn15(coin.txCreatedIdx)
4119
4226
  };
4120
4227
  default:
4121
4228
  return null;
@@ -4132,13 +4239,13 @@ var _Provider = class {
4132
4239
  async getBlock(idOrHeight) {
4133
4240
  let variables;
4134
4241
  if (typeof idOrHeight === "number") {
4135
- variables = { height: bn14(idOrHeight).toString(10) };
4242
+ variables = { height: bn15(idOrHeight).toString(10) };
4136
4243
  } else if (idOrHeight === "latest") {
4137
4244
  variables = { height: (await this.getBlockNumber()).toString(10) };
4138
4245
  } else if (idOrHeight.length === 66) {
4139
4246
  variables = { blockId: idOrHeight };
4140
4247
  } else {
4141
- variables = { blockId: bn14(idOrHeight).toString(10) };
4248
+ variables = { blockId: bn15(idOrHeight).toString(10) };
4142
4249
  }
4143
4250
  const { block } = await this.operations.getBlock(variables);
4144
4251
  if (!block) {
@@ -4146,7 +4253,7 @@ var _Provider = class {
4146
4253
  }
4147
4254
  return {
4148
4255
  id: block.id,
4149
- height: bn14(block.header.height),
4256
+ height: bn15(block.header.height),
4150
4257
  time: block.header.time,
4151
4258
  transactionIds: block.transactions.map((tx) => tx.id)
4152
4259
  };
@@ -4161,7 +4268,7 @@ var _Provider = class {
4161
4268
  const { blocks: fetchedData } = await this.operations.getBlocks(params);
4162
4269
  const blocks = fetchedData.edges.map(({ node: block }) => ({
4163
4270
  id: block.id,
4164
- height: bn14(block.header.height),
4271
+ height: bn15(block.header.height),
4165
4272
  time: block.header.time,
4166
4273
  transactionIds: block.transactions.map((tx) => tx.id)
4167
4274
  }));
@@ -4176,7 +4283,7 @@ var _Provider = class {
4176
4283
  async getBlockWithTransactions(idOrHeight) {
4177
4284
  let variables;
4178
4285
  if (typeof idOrHeight === "number") {
4179
- variables = { blockHeight: bn14(idOrHeight).toString(10) };
4286
+ variables = { blockHeight: bn15(idOrHeight).toString(10) };
4180
4287
  } else if (idOrHeight === "latest") {
4181
4288
  variables = { blockHeight: (await this.getBlockNumber()).toString() };
4182
4289
  } else {
@@ -4188,7 +4295,7 @@ var _Provider = class {
4188
4295
  }
4189
4296
  return {
4190
4297
  id: block.id,
4191
- height: bn14(block.header.height, 10),
4298
+ height: bn15(block.header.height, 10),
4192
4299
  time: block.header.time,
4193
4300
  transactionIds: block.transactions.map((tx) => tx.id),
4194
4301
  transactions: block.transactions.map(
@@ -4237,7 +4344,7 @@ var _Provider = class {
4237
4344
  contract: Address2.fromAddressOrString(contractId).toB256(),
4238
4345
  asset: hexlify12(assetId)
4239
4346
  });
4240
- return bn14(contractBalance.amount, 10);
4347
+ return bn15(contractBalance.amount, 10);
4241
4348
  }
4242
4349
  /**
4243
4350
  * Returns the balance for the given owner for the given asset ID.
@@ -4251,7 +4358,7 @@ var _Provider = class {
4251
4358
  owner: Address2.fromAddressOrString(owner).toB256(),
4252
4359
  assetId: hexlify12(assetId)
4253
4360
  });
4254
- return bn14(balance.amount, 10);
4361
+ return bn15(balance.amount, 10);
4255
4362
  }
4256
4363
  /**
4257
4364
  * Returns balances for the given owner.
@@ -4269,7 +4376,7 @@ var _Provider = class {
4269
4376
  const balances = result.balances.edges.map((edge) => edge.node);
4270
4377
  return balances.map((balance) => ({
4271
4378
  assetId: balance.assetId,
4272
- amount: bn14(balance.amount)
4379
+ amount: bn15(balance.amount)
4273
4380
  }));
4274
4381
  }
4275
4382
  /**
@@ -4291,15 +4398,15 @@ var _Provider = class {
4291
4398
  sender: message.sender,
4292
4399
  recipient: message.recipient,
4293
4400
  nonce: message.nonce,
4294
- amount: bn14(message.amount),
4401
+ amount: bn15(message.amount),
4295
4402
  data: message.data
4296
4403
  }),
4297
4404
  sender: Address2.fromAddressOrString(message.sender),
4298
4405
  recipient: Address2.fromAddressOrString(message.recipient),
4299
4406
  nonce: message.nonce,
4300
- amount: bn14(message.amount),
4407
+ amount: bn15(message.amount),
4301
4408
  data: InputMessageCoder.decodeData(message.data),
4302
- daHeight: bn14(message.daHeight)
4409
+ daHeight: bn15(message.daHeight)
4303
4410
  }));
4304
4411
  }
4305
4412
  /**
@@ -4317,8 +4424,8 @@ var _Provider = class {
4317
4424
  nonce
4318
4425
  };
4319
4426
  if (commitBlockId && commitBlockHeight) {
4320
- throw new FuelError12(
4321
- ErrorCode12.INVALID_INPUT_PARAMETERS,
4427
+ throw new FuelError13(
4428
+ ErrorCode13.INVALID_INPUT_PARAMETERS,
4322
4429
  "commitBlockId and commitBlockHeight cannot be used together"
4323
4430
  );
4324
4431
  }
@@ -4352,41 +4459,41 @@ var _Provider = class {
4352
4459
  } = result.messageProof;
4353
4460
  return {
4354
4461
  messageProof: {
4355
- proofIndex: bn14(messageProof.proofIndex),
4462
+ proofIndex: bn15(messageProof.proofIndex),
4356
4463
  proofSet: messageProof.proofSet
4357
4464
  },
4358
4465
  blockProof: {
4359
- proofIndex: bn14(blockProof.proofIndex),
4466
+ proofIndex: bn15(blockProof.proofIndex),
4360
4467
  proofSet: blockProof.proofSet
4361
4468
  },
4362
4469
  messageBlockHeader: {
4363
4470
  id: messageBlockHeader.id,
4364
- daHeight: bn14(messageBlockHeader.daHeight),
4365
- transactionsCount: bn14(messageBlockHeader.transactionsCount),
4471
+ daHeight: bn15(messageBlockHeader.daHeight),
4472
+ transactionsCount: bn15(messageBlockHeader.transactionsCount),
4366
4473
  transactionsRoot: messageBlockHeader.transactionsRoot,
4367
- height: bn14(messageBlockHeader.height),
4474
+ height: bn15(messageBlockHeader.height),
4368
4475
  prevRoot: messageBlockHeader.prevRoot,
4369
4476
  time: messageBlockHeader.time,
4370
4477
  applicationHash: messageBlockHeader.applicationHash,
4371
4478
  messageReceiptRoot: messageBlockHeader.messageReceiptRoot,
4372
- messageReceiptCount: bn14(messageBlockHeader.messageReceiptCount)
4479
+ messageReceiptCount: bn15(messageBlockHeader.messageReceiptCount)
4373
4480
  },
4374
4481
  commitBlockHeader: {
4375
4482
  id: commitBlockHeader.id,
4376
- daHeight: bn14(commitBlockHeader.daHeight),
4377
- transactionsCount: bn14(commitBlockHeader.transactionsCount),
4483
+ daHeight: bn15(commitBlockHeader.daHeight),
4484
+ transactionsCount: bn15(commitBlockHeader.transactionsCount),
4378
4485
  transactionsRoot: commitBlockHeader.transactionsRoot,
4379
- height: bn14(commitBlockHeader.height),
4486
+ height: bn15(commitBlockHeader.height),
4380
4487
  prevRoot: commitBlockHeader.prevRoot,
4381
4488
  time: commitBlockHeader.time,
4382
4489
  applicationHash: commitBlockHeader.applicationHash,
4383
4490
  messageReceiptRoot: commitBlockHeader.messageReceiptRoot,
4384
- messageReceiptCount: bn14(commitBlockHeader.messageReceiptCount)
4491
+ messageReceiptCount: bn15(commitBlockHeader.messageReceiptCount)
4385
4492
  },
4386
4493
  sender: Address2.fromAddressOrString(sender),
4387
4494
  recipient: Address2.fromAddressOrString(recipient),
4388
4495
  nonce,
4389
- amount: bn14(amount),
4496
+ amount: bn15(amount),
4390
4497
  data
4391
4498
  };
4392
4499
  }
@@ -4409,10 +4516,10 @@ var _Provider = class {
4409
4516
  */
4410
4517
  async produceBlocks(amount, startTime) {
4411
4518
  const { produceBlocks: latestBlockHeight } = await this.operations.produceBlocks({
4412
- blocksToProduce: bn14(amount).toString(10),
4519
+ blocksToProduce: bn15(amount).toString(10),
4413
4520
  startTimestamp: startTime ? DateTime2.fromUnixMilliseconds(startTime).toTai64() : void 0
4414
4521
  });
4415
- return bn14(latestBlockHeight);
4522
+ return bn15(latestBlockHeight);
4416
4523
  }
4417
4524
  // eslint-disable-next-line @typescript-eslint/require-await
4418
4525
  async getTransactionResponse(transactionId) {
@@ -4435,8 +4542,8 @@ __publicField(Provider, "chainInfoCache", {});
4435
4542
  __publicField(Provider, "nodeInfoCache", {});
4436
4543
 
4437
4544
  // src/providers/transaction-summary/get-transaction-summary.ts
4438
- import { ErrorCode as ErrorCode13, FuelError as FuelError13 } from "@fuel-ts/errors";
4439
- import { bn as bn15 } from "@fuel-ts/math";
4545
+ import { ErrorCode as ErrorCode14, FuelError as FuelError14 } from "@fuel-ts/errors";
4546
+ import { bn as bn16 } from "@fuel-ts/math";
4440
4547
  import { TransactionCoder as TransactionCoder6 } from "@fuel-ts/transactions";
4441
4548
  import { arrayify as arrayify12 } from "@fuel-ts/utils";
4442
4549
  async function getTransactionSummary(params) {
@@ -4445,8 +4552,8 @@ async function getTransactionSummary(params) {
4445
4552
  transactionId: id
4446
4553
  });
4447
4554
  if (!gqlTransaction) {
4448
- throw new FuelError13(
4449
- ErrorCode13.TRANSACTION_NOT_FOUND,
4555
+ throw new FuelError14(
4556
+ ErrorCode14.TRANSACTION_NOT_FOUND,
4450
4557
  `Transaction not found for given id: ${id}.`
4451
4558
  );
4452
4559
  }
@@ -4464,8 +4571,8 @@ async function getTransactionSummary(params) {
4464
4571
  transaction: decodedTransaction,
4465
4572
  transactionBytes: arrayify12(gqlTransaction.rawPayload),
4466
4573
  gqlTransactionStatus: gqlTransaction.status,
4467
- gasPerByte: bn15(gasPerByte),
4468
- gasPriceFactor: bn15(gasPriceFactor),
4574
+ gasPerByte: bn16(gasPerByte),
4575
+ gasPriceFactor: bn16(gasPriceFactor),
4469
4576
  abiMap,
4470
4577
  maxInputs,
4471
4578
  gasCosts
@@ -4719,7 +4826,7 @@ var Account = class extends AbstractAccount {
4719
4826
  */
4720
4827
  get provider() {
4721
4828
  if (!this._provider) {
4722
- throw new FuelError14(ErrorCode14.MISSING_PROVIDER, "Provider not set");
4829
+ throw new FuelError15(ErrorCode15.MISSING_PROVIDER, "Provider not set");
4723
4830
  }
4724
4831
  return this._provider;
4725
4832
  }
@@ -4771,8 +4878,8 @@ var Account = class extends AbstractAccount {
4771
4878
  if (!hasNextPage) {
4772
4879
  break;
4773
4880
  }
4774
- throw new FuelError14(
4775
- ErrorCode14.NOT_SUPPORTED,
4881
+ throw new FuelError15(
4882
+ ErrorCode15.NOT_SUPPORTED,
4776
4883
  `Wallets containing more than ${pageSize} coins exceed the current supported limit.`
4777
4884
  );
4778
4885
  }
@@ -4797,8 +4904,8 @@ var Account = class extends AbstractAccount {
4797
4904
  if (!hasNextPage) {
4798
4905
  break;
4799
4906
  }
4800
- throw new FuelError14(
4801
- ErrorCode14.NOT_SUPPORTED,
4907
+ throw new FuelError15(
4908
+ ErrorCode15.NOT_SUPPORTED,
4802
4909
  `Wallets containing more than ${pageSize} messages exceed the current supported limit.`
4803
4910
  );
4804
4911
  }
@@ -4833,8 +4940,8 @@ var Account = class extends AbstractAccount {
4833
4940
  if (!hasNextPage) {
4834
4941
  break;
4835
4942
  }
4836
- throw new FuelError14(
4837
- ErrorCode14.NOT_SUPPORTED,
4943
+ throw new FuelError15(
4944
+ ErrorCode15.NOT_SUPPORTED,
4838
4945
  `Wallets containing more than ${pageSize} balances exceed the current supported limit.`
4839
4946
  );
4840
4947
  }
@@ -4850,7 +4957,7 @@ var Account = class extends AbstractAccount {
4850
4957
  */
4851
4958
  async fund(request, coinQuantities, fee) {
4852
4959
  const updatedQuantities = addAmountToAsset({
4853
- amount: bn16(fee),
4960
+ amount: bn17(fee),
4854
4961
  assetId: BaseAssetId3,
4855
4962
  coinQuantities
4856
4963
  });
@@ -4858,7 +4965,7 @@ var Account = class extends AbstractAccount {
4858
4965
  updatedQuantities.forEach(({ amount, assetId }) => {
4859
4966
  quantitiesDict[assetId] = {
4860
4967
  required: amount,
4861
- owned: bn16(0)
4968
+ owned: bn17(0)
4862
4969
  };
4863
4970
  });
4864
4971
  const cachedUtxos = [];
@@ -4871,7 +4978,7 @@ var Account = class extends AbstractAccount {
4871
4978
  if (isCoin2) {
4872
4979
  const assetId = String(input.assetId);
4873
4980
  if (input.owner === owner && quantitiesDict[assetId]) {
4874
- const amount = bn16(input.amount);
4981
+ const amount = bn17(input.amount);
4875
4982
  quantitiesDict[assetId].owned = quantitiesDict[assetId].owned.add(amount);
4876
4983
  cachedUtxos.push(input.id);
4877
4984
  }
@@ -4917,8 +5024,8 @@ var Account = class extends AbstractAccount {
4917
5024
  estimateTxDependencies: true,
4918
5025
  resourcesOwner: this
4919
5026
  });
4920
- request.gasPrice = bn16(txParams.gasPrice ?? minGasPrice);
4921
- request.gasLimit = bn16(txParams.gasLimit ?? gasUsed);
5027
+ request.gasPrice = bn17(txParams.gasPrice ?? minGasPrice);
5028
+ request.gasLimit = bn17(txParams.gasLimit ?? gasUsed);
4922
5029
  this.validateGas({
4923
5030
  gasUsed,
4924
5031
  gasPrice: request.gasPrice,
@@ -4939,9 +5046,9 @@ var Account = class extends AbstractAccount {
4939
5046
  * @returns A promise that resolves to the transaction response.
4940
5047
  */
4941
5048
  async transfer(destination, amount, assetId = BaseAssetId3, txParams = {}) {
4942
- if (bn16(amount).lte(0)) {
4943
- throw new FuelError14(
4944
- ErrorCode14.INVALID_TRANSFER_AMOUNT,
5049
+ if (bn17(amount).lte(0)) {
5050
+ throw new FuelError15(
5051
+ ErrorCode15.INVALID_TRANSFER_AMOUNT,
4945
5052
  "Transfer amount must be a positive number."
4946
5053
  );
4947
5054
  }
@@ -4958,9 +5065,9 @@ var Account = class extends AbstractAccount {
4958
5065
  * @returns A promise that resolves to the transaction response.
4959
5066
  */
4960
5067
  async transferToContract(contractId, amount, assetId = BaseAssetId3, txParams = {}) {
4961
- if (bn16(amount).lte(0)) {
4962
- throw new FuelError14(
4963
- ErrorCode14.INVALID_TRANSFER_AMOUNT,
5068
+ if (bn17(amount).lte(0)) {
5069
+ throw new FuelError15(
5070
+ ErrorCode15.INVALID_TRANSFER_AMOUNT,
4964
5071
  "Transfer amount must be a positive number."
4965
5072
  );
4966
5073
  }
@@ -4969,7 +5076,7 @@ var Account = class extends AbstractAccount {
4969
5076
  const params = { gasPrice: minGasPrice, ...txParams };
4970
5077
  const { script, scriptData } = await assembleTransferToContractScript({
4971
5078
  hexlifiedContractId: contractAddress.toB256(),
4972
- amountToTransfer: bn16(amount),
5079
+ amountToTransfer: bn17(amount),
4973
5080
  assetId
4974
5081
  });
4975
5082
  const request = new ScriptTransactionRequest({
@@ -4980,9 +5087,9 @@ var Account = class extends AbstractAccount {
4980
5087
  request.addContractInputAndOutput(contractAddress);
4981
5088
  const { maxFee, requiredQuantities, gasUsed } = await this.provider.getTransactionCost(
4982
5089
  request,
4983
- [{ amount: bn16(amount), assetId: String(assetId) }]
5090
+ [{ amount: bn17(amount), assetId: String(assetId) }]
4984
5091
  );
4985
- request.gasLimit = bn16(params.gasLimit ?? gasUsed);
5092
+ request.gasLimit = bn17(params.gasLimit ?? gasUsed);
4986
5093
  this.validateGas({
4987
5094
  gasUsed,
4988
5095
  gasPrice: request.gasPrice,
@@ -5007,7 +5114,7 @@ var Account = class extends AbstractAccount {
5007
5114
  "0x".concat(recipientAddress.toHexString().substring(2).padStart(64, "0"))
5008
5115
  );
5009
5116
  const amountDataArray = arrayify14(
5010
- "0x".concat(bn16(amount).toHex().substring(2).padStart(16, "0"))
5117
+ "0x".concat(bn17(amount).toHex().substring(2).padStart(16, "0"))
5011
5118
  );
5012
5119
  const script = new Uint8Array([
5013
5120
  ...arrayify14(withdrawScript.bytes),
@@ -5016,12 +5123,12 @@ var Account = class extends AbstractAccount {
5016
5123
  ]);
5017
5124
  const params = { script, gasPrice: minGasPrice, ...txParams };
5018
5125
  const request = new ScriptTransactionRequest(params);
5019
- const forwardingQuantities = [{ amount: bn16(amount), assetId: BaseAssetId3 }];
5126
+ const forwardingQuantities = [{ amount: bn17(amount), assetId: BaseAssetId3 }];
5020
5127
  const { requiredQuantities, maxFee, gasUsed } = await this.provider.getTransactionCost(
5021
5128
  request,
5022
5129
  forwardingQuantities
5023
5130
  );
5024
- request.gasLimit = bn16(params.gasLimit ?? gasUsed);
5131
+ request.gasLimit = bn17(params.gasLimit ?? gasUsed);
5025
5132
  this.validateGas({
5026
5133
  gasUsed,
5027
5134
  gasPrice: request.gasPrice,
@@ -5033,7 +5140,7 @@ var Account = class extends AbstractAccount {
5033
5140
  }
5034
5141
  async signMessage(message) {
5035
5142
  if (!this._connector) {
5036
- throw new FuelError14(ErrorCode14.MISSING_CONNECTOR, "A connector is required to sign messages.");
5143
+ throw new FuelError15(ErrorCode15.MISSING_CONNECTOR, "A connector is required to sign messages.");
5037
5144
  }
5038
5145
  return this._connector.signMessage(this.address.toString(), message);
5039
5146
  }
@@ -5045,8 +5152,8 @@ var Account = class extends AbstractAccount {
5045
5152
  */
5046
5153
  async signTransaction(transactionRequestLike) {
5047
5154
  if (!this._connector) {
5048
- throw new FuelError14(
5049
- ErrorCode14.MISSING_CONNECTOR,
5155
+ throw new FuelError15(
5156
+ ErrorCode15.MISSING_CONNECTOR,
5050
5157
  "A connector is required to sign transactions."
5051
5158
  );
5052
5159
  }
@@ -5093,14 +5200,14 @@ var Account = class extends AbstractAccount {
5093
5200
  minGasPrice
5094
5201
  }) {
5095
5202
  if (minGasPrice.gt(gasPrice)) {
5096
- throw new FuelError14(
5097
- ErrorCode14.GAS_PRICE_TOO_LOW,
5203
+ throw new FuelError15(
5204
+ ErrorCode15.GAS_PRICE_TOO_LOW,
5098
5205
  `Gas price '${gasPrice}' is lower than the required: '${minGasPrice}'.`
5099
5206
  );
5100
5207
  }
5101
5208
  if (gasUsed.gt(gasLimit)) {
5102
- throw new FuelError14(
5103
- ErrorCode14.GAS_LIMIT_TOO_LOW,
5209
+ throw new FuelError15(
5210
+ ErrorCode15.GAS_LIMIT_TOO_LOW,
5104
5211
  `Gas limit '${gasLimit}' is lower than the required: '${gasUsed}'.`
5105
5212
  );
5106
5213
  }
@@ -5113,7 +5220,7 @@ import { hexlify as hexlify15 } from "@fuel-ts/utils";
5113
5220
 
5114
5221
  // src/signer/signer.ts
5115
5222
  import { Address as Address4 } from "@fuel-ts/address";
5116
- import { randomBytes } from "@fuel-ts/crypto";
5223
+ import { randomBytes as randomBytes2 } from "@fuel-ts/crypto";
5117
5224
  import { hash } from "@fuel-ts/hasher";
5118
5225
  import { toBytes } from "@fuel-ts/math";
5119
5226
  import { hexlify as hexlify13, concat as concat3, arrayify as arrayify15 } from "@fuel-ts/utils";
@@ -5206,7 +5313,7 @@ var Signer = class {
5206
5313
  * @returns random 32-byte hashed
5207
5314
  */
5208
5315
  static generatePrivateKey(entropy) {
5209
- return entropy ? hash(concat3([randomBytes(32), arrayify15(entropy)])) : randomBytes(32);
5316
+ return entropy ? hash(concat3([randomBytes2(32), arrayify15(entropy)])) : randomBytes2(32);
5210
5317
  }
5211
5318
  /**
5212
5319
  * Extended publicKey from a compact publicKey
@@ -5225,13 +5332,13 @@ import { Address as Address5 } from "@fuel-ts/address";
5225
5332
  import {
5226
5333
  bufferFromString,
5227
5334
  keccak256,
5228
- randomBytes as randomBytes2,
5335
+ randomBytes as randomBytes3,
5229
5336
  scrypt,
5230
5337
  stringFromBuffer,
5231
5338
  decryptJsonWalletData,
5232
5339
  encryptJsonWalletData
5233
5340
  } from "@fuel-ts/crypto";
5234
- import { ErrorCode as ErrorCode15, FuelError as FuelError15 } from "@fuel-ts/errors";
5341
+ import { ErrorCode as ErrorCode16, FuelError as FuelError16 } from "@fuel-ts/errors";
5235
5342
  import { hexlify as hexlify14 } from "@fuel-ts/utils";
5236
5343
  import { v4 as uuidv4 } from "uuid";
5237
5344
  var DEFAULT_KDF_PARAMS_LOG_N = 13;
@@ -5248,7 +5355,7 @@ var removeHexPrefix = (hexString) => {
5248
5355
  async function encryptKeystoreWallet(privateKey, address, password) {
5249
5356
  const privateKeyBuffer = bufferFromString(removeHexPrefix(privateKey), "hex");
5250
5357
  const ownerAddress = Address5.fromAddressOrString(address);
5251
- const salt = randomBytes2(DEFAULT_KEY_SIZE);
5358
+ const salt = randomBytes3(DEFAULT_KEY_SIZE);
5252
5359
  const key = scrypt({
5253
5360
  password: bufferFromString(password),
5254
5361
  salt,
@@ -5257,7 +5364,7 @@ async function encryptKeystoreWallet(privateKey, address, password) {
5257
5364
  r: DEFAULT_KDF_PARAMS_R,
5258
5365
  p: DEFAULT_KDF_PARAMS_P
5259
5366
  });
5260
- const iv = randomBytes2(DEFAULT_IV_SIZE);
5367
+ const iv = randomBytes3(DEFAULT_IV_SIZE);
5261
5368
  const ciphertext = await encryptJsonWalletData(privateKeyBuffer, key, iv);
5262
5369
  const data = Uint8Array.from([...key.subarray(16, 32), ...ciphertext]);
5263
5370
  const macHashUint8Array = keccak256(data);
@@ -5309,8 +5416,8 @@ async function decryptKeystoreWallet(jsonWallet, password) {
5309
5416
  const macHashUint8Array = keccak256(data);
5310
5417
  const macHash = stringFromBuffer(macHashUint8Array, "hex");
5311
5418
  if (mac !== macHash) {
5312
- throw new FuelError15(
5313
- ErrorCode15.INVALID_PASSWORD,
5419
+ throw new FuelError16(
5420
+ ErrorCode16.INVALID_PASSWORD,
5314
5421
  "Failed to decrypt the keystore wallet, the provided password is incorrect."
5315
5422
  );
5316
5423
  }
@@ -5432,15 +5539,15 @@ var BaseWalletUnlocked = class extends Account {
5432
5539
  __publicField(BaseWalletUnlocked, "defaultPath", "m/44'/1179993420'/0'/0/0");
5433
5540
 
5434
5541
  // src/hdwallet/hdwallet.ts
5435
- import { ErrorCode as ErrorCode18, FuelError as FuelError18 } from "@fuel-ts/errors";
5542
+ import { ErrorCode as ErrorCode19, FuelError as FuelError19 } from "@fuel-ts/errors";
5436
5543
  import { sha256 as sha2564 } from "@fuel-ts/hasher";
5437
- import { bn as bn17, toBytes as toBytes2, toHex } from "@fuel-ts/math";
5544
+ import { bn as bn18, toBytes as toBytes2, toHex } from "@fuel-ts/math";
5438
5545
  import { arrayify as arrayify18, hexlify as hexlify17, concat as concat5 } from "@fuel-ts/utils";
5439
5546
  import { toBeHex, dataSlice as dataSlice2, encodeBase58 as encodeBase582, decodeBase58, computeHmac as computeHmac2, ripemd160 } from "ethers";
5440
5547
 
5441
5548
  // src/mnemonic/mnemonic.ts
5442
- import { randomBytes as randomBytes3 } from "@fuel-ts/crypto";
5443
- import { ErrorCode as ErrorCode17, FuelError as FuelError17 } from "@fuel-ts/errors";
5549
+ import { randomBytes as randomBytes4 } from "@fuel-ts/crypto";
5550
+ import { ErrorCode as ErrorCode18, FuelError as FuelError18 } from "@fuel-ts/errors";
5444
5551
  import { sha256 as sha2563 } from "@fuel-ts/hasher";
5445
5552
  import { arrayify as arrayify17, hexlify as hexlify16, concat as concat4 } from "@fuel-ts/utils";
5446
5553
  import { dataSlice, pbkdf2, computeHmac, encodeBase58 } from "ethers";
@@ -7504,7 +7611,7 @@ var Language = /* @__PURE__ */ ((Language2) => {
7504
7611
  })(Language || {});
7505
7612
 
7506
7613
  // src/mnemonic/utils.ts
7507
- import { ErrorCode as ErrorCode16, FuelError as FuelError16 } from "@fuel-ts/errors";
7614
+ import { ErrorCode as ErrorCode17, FuelError as FuelError17 } from "@fuel-ts/errors";
7508
7615
  import { sha256 as sha2562 } from "@fuel-ts/hasher";
7509
7616
  import { arrayify as arrayify16 } from "@fuel-ts/utils";
7510
7617
  function toUtf8Bytes(stri) {
@@ -7521,8 +7628,8 @@ function toUtf8Bytes(stri) {
7521
7628
  i += 1;
7522
7629
  const c2 = str.charCodeAt(i);
7523
7630
  if (i >= str.length || (c2 & 64512) !== 56320) {
7524
- throw new FuelError16(
7525
- ErrorCode16.INVALID_INPUT_PARAMETERS,
7631
+ throw new FuelError17(
7632
+ ErrorCode17.INVALID_INPUT_PARAMETERS,
7526
7633
  "Invalid UTF-8 in the input string."
7527
7634
  );
7528
7635
  }
@@ -7585,8 +7692,8 @@ function mnemonicWordsToEntropy(words, wordlist) {
7585
7692
  for (let i = 0; i < words.length; i += 1) {
7586
7693
  const index = wordlist.indexOf(words[i].normalize("NFKD"));
7587
7694
  if (index === -1) {
7588
- throw new FuelError16(
7589
- ErrorCode16.INVALID_MNEMONIC,
7695
+ throw new FuelError17(
7696
+ ErrorCode17.INVALID_MNEMONIC,
7590
7697
  `Invalid mnemonic: the word '${words[i]}' is not found in the provided wordlist.`
7591
7698
  );
7592
7699
  }
@@ -7602,8 +7709,8 @@ function mnemonicWordsToEntropy(words, wordlist) {
7602
7709
  const checksumMask = getUpperMask(checksumBits);
7603
7710
  const checksum = arrayify16(sha2562(entropy.slice(0, entropyBits / 8)))[0] & checksumMask;
7604
7711
  if (checksum !== (entropy[entropy.length - 1] & checksumMask)) {
7605
- throw new FuelError16(
7606
- ErrorCode16.INVALID_CHECKSUM,
7712
+ throw new FuelError17(
7713
+ ErrorCode17.INVALID_CHECKSUM,
7607
7714
  "Checksum validation failed for the provided mnemonic."
7608
7715
  );
7609
7716
  }
@@ -7617,16 +7724,16 @@ var TestnetPRV = "0x04358394";
7617
7724
  var MNEMONIC_SIZES = [12, 15, 18, 21, 24];
7618
7725
  function assertWordList(wordlist) {
7619
7726
  if (wordlist.length !== 2048) {
7620
- throw new FuelError17(
7621
- ErrorCode17.INVALID_WORD_LIST,
7727
+ throw new FuelError18(
7728
+ ErrorCode18.INVALID_WORD_LIST,
7622
7729
  `Expected word list length of 2048, but got ${wordlist.length}.`
7623
7730
  );
7624
7731
  }
7625
7732
  }
7626
7733
  function assertEntropy(entropy) {
7627
7734
  if (entropy.length % 4 !== 0 || entropy.length < 16 || entropy.length > 32) {
7628
- throw new FuelError17(
7629
- ErrorCode17.INVALID_ENTROPY,
7735
+ throw new FuelError18(
7736
+ ErrorCode18.INVALID_ENTROPY,
7630
7737
  `Entropy should be between 16 and 32 bytes and a multiple of 4, but got ${entropy.length} bytes.`
7631
7738
  );
7632
7739
  }
@@ -7636,7 +7743,7 @@ function assertMnemonic(words) {
7636
7743
  const errorMsg = `Invalid mnemonic size. Expected one of [${MNEMONIC_SIZES.join(
7637
7744
  ", "
7638
7745
  )}] words, but got ${words.length}.`;
7639
- throw new FuelError17(ErrorCode17.INVALID_MNEMONIC, errorMsg);
7746
+ throw new FuelError18(ErrorCode18.INVALID_MNEMONIC, errorMsg);
7640
7747
  }
7641
7748
  }
7642
7749
  var Mnemonic = class {
@@ -7754,8 +7861,8 @@ var Mnemonic = class {
7754
7861
  static masterKeysFromSeed(seed) {
7755
7862
  const seedArray = arrayify17(seed);
7756
7863
  if (seedArray.length < 16 || seedArray.length > 64) {
7757
- throw new FuelError17(
7758
- ErrorCode17.INVALID_SEED,
7864
+ throw new FuelError18(
7865
+ ErrorCode18.INVALID_SEED,
7759
7866
  `Seed length should be between 16 and 64 bytes, but received ${seedArray.length} bytes.`
7760
7867
  );
7761
7868
  }
@@ -7800,7 +7907,7 @@ var Mnemonic = class {
7800
7907
  * @returns A randomly generated mnemonic
7801
7908
  */
7802
7909
  static generate(size = 32, extraEntropy = "") {
7803
- const entropy = extraEntropy ? sha2563(concat4([randomBytes3(size), arrayify17(extraEntropy)])) : randomBytes3(size);
7910
+ const entropy = extraEntropy ? sha2563(concat4([randomBytes4(size), arrayify17(extraEntropy)])) : randomBytes4(size);
7804
7911
  return Mnemonic.entropyToMnemonic(entropy);
7805
7912
  }
7806
7913
  };
@@ -7832,7 +7939,7 @@ function isValidExtendedKey(extendedKey) {
7832
7939
  function parsePath(path, depth = 0) {
7833
7940
  const components = path.split("/");
7834
7941
  if (components.length === 0 || components[0] === "m" && depth !== 0) {
7835
- throw new FuelError18(ErrorCode18.HD_WALLET_ERROR, `invalid path - ${path}`);
7942
+ throw new FuelError19(ErrorCode19.HD_WALLET_ERROR, `invalid path - ${path}`);
7836
7943
  }
7837
7944
  if (components[0] === "m") {
7838
7945
  components.shift();
@@ -7861,8 +7968,8 @@ var HDWallet = class {
7861
7968
  this.privateKey = hexlify17(config.privateKey);
7862
7969
  } else {
7863
7970
  if (!config.publicKey) {
7864
- throw new FuelError18(
7865
- ErrorCode18.HD_WALLET_ERROR,
7971
+ throw new FuelError19(
7972
+ ErrorCode19.HD_WALLET_ERROR,
7866
7973
  "Both public and private Key cannot be missing. At least one should be provided."
7867
7974
  );
7868
7975
  }
@@ -7891,8 +7998,8 @@ var HDWallet = class {
7891
7998
  const data = new Uint8Array(37);
7892
7999
  if (index & HARDENED_INDEX) {
7893
8000
  if (!privateKey) {
7894
- throw new FuelError18(
7895
- ErrorCode18.HD_WALLET_ERROR,
8001
+ throw new FuelError19(
8002
+ ErrorCode19.HD_WALLET_ERROR,
7896
8003
  "Cannot derive a hardened index without a private Key."
7897
8004
  );
7898
8005
  }
@@ -7906,7 +8013,7 @@ var HDWallet = class {
7906
8013
  const IR = bytes.slice(32);
7907
8014
  if (privateKey) {
7908
8015
  const N = "0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141";
7909
- const ki = bn17(IL).add(privateKey).mod(N).toBytes(32);
8016
+ const ki = bn18(IL).add(privateKey).mod(N).toBytes(32);
7910
8017
  return new HDWallet({
7911
8018
  privateKey: ki,
7912
8019
  chainCode: IR,
@@ -7944,8 +8051,8 @@ var HDWallet = class {
7944
8051
  */
7945
8052
  toExtendedKey(isPublic = false, testnet = false) {
7946
8053
  if (this.depth >= 256) {
7947
- throw new FuelError18(
7948
- ErrorCode18.HD_WALLET_ERROR,
8054
+ throw new FuelError19(
8055
+ ErrorCode19.HD_WALLET_ERROR,
7949
8056
  `Exceeded max depth of 255. Current depth: ${this.depth}.`
7950
8057
  );
7951
8058
  }
@@ -7976,10 +8083,10 @@ var HDWallet = class {
7976
8083
  const bytes = arrayify18(decoded);
7977
8084
  const validChecksum = base58check(bytes.slice(0, 78)) === extendedKey;
7978
8085
  if (bytes.length !== 82 || !isValidExtendedKey(bytes)) {
7979
- throw new FuelError18(ErrorCode18.HD_WALLET_ERROR, "Provided key is not a valid extended key.");
8086
+ throw new FuelError19(ErrorCode19.HD_WALLET_ERROR, "Provided key is not a valid extended key.");
7980
8087
  }
7981
8088
  if (!validChecksum) {
7982
- throw new FuelError18(ErrorCode18.HD_WALLET_ERROR, "Provided key has an invalid checksum.");
8089
+ throw new FuelError19(ErrorCode19.HD_WALLET_ERROR, "Provided key has an invalid checksum.");
7983
8090
  }
7984
8091
  const depth = bytes[4];
7985
8092
  const parentFingerprint = hexlify17(bytes.slice(5, 9));
@@ -7987,14 +8094,14 @@ var HDWallet = class {
7987
8094
  const chainCode = hexlify17(bytes.slice(13, 45));
7988
8095
  const key = bytes.slice(45, 78);
7989
8096
  if (depth === 0 && parentFingerprint !== "0x00000000" || depth === 0 && index !== 0) {
7990
- throw new FuelError18(
7991
- ErrorCode18.HD_WALLET_ERROR,
8097
+ throw new FuelError19(
8098
+ ErrorCode19.HD_WALLET_ERROR,
7992
8099
  "Inconsistency detected: Depth is zero but fingerprint/index is non-zero."
7993
8100
  );
7994
8101
  }
7995
8102
  if (isPublicExtendedKey(bytes)) {
7996
8103
  if (key[0] !== 3) {
7997
- throw new FuelError18(ErrorCode18.HD_WALLET_ERROR, "Invalid public extended key.");
8104
+ throw new FuelError19(ErrorCode19.HD_WALLET_ERROR, "Invalid public extended key.");
7998
8105
  }
7999
8106
  return new HDWallet({
8000
8107
  publicKey: key,
@@ -8005,7 +8112,7 @@ var HDWallet = class {
8005
8112
  });
8006
8113
  }
8007
8114
  if (key[0] !== 0) {
8008
- throw new FuelError18(ErrorCode18.HD_WALLET_ERROR, "Invalid private extended key.");
8115
+ throw new FuelError19(ErrorCode19.HD_WALLET_ERROR, "Invalid private extended key.");
8009
8116
  }
8010
8117
  return new HDWallet({
8011
8118
  privateKey: key.slice(1),
@@ -8173,7 +8280,7 @@ __publicField(Wallet, "fromEncryptedJson", WalletUnlocked.fromEncryptedJson);
8173
8280
  // src/wallet-manager/wallet-manager.ts
8174
8281
  import { Address as Address8 } from "@fuel-ts/address";
8175
8282
  import { encrypt, decrypt } from "@fuel-ts/crypto";
8176
- import { ErrorCode as ErrorCode21, FuelError as FuelError21 } from "@fuel-ts/errors";
8283
+ import { ErrorCode as ErrorCode22, FuelError as FuelError22 } from "@fuel-ts/errors";
8177
8284
  import { EventEmitter } from "events";
8178
8285
 
8179
8286
  // src/wallet-manager/storages/memory-storage.ts
@@ -8196,7 +8303,7 @@ var MemoryStorage = class {
8196
8303
 
8197
8304
  // src/wallet-manager/vaults/mnemonic-vault.ts
8198
8305
  import { Address as Address6 } from "@fuel-ts/address";
8199
- import { ErrorCode as ErrorCode19, FuelError as FuelError19 } from "@fuel-ts/errors";
8306
+ import { ErrorCode as ErrorCode20, FuelError as FuelError20 } from "@fuel-ts/errors";
8200
8307
  var _secret;
8201
8308
  var MnemonicVault = class {
8202
8309
  constructor(options) {
@@ -8252,8 +8359,8 @@ var MnemonicVault = class {
8252
8359
  }
8253
8360
  numberOfAccounts += 1;
8254
8361
  } while (numberOfAccounts < this.numberOfAccounts);
8255
- throw new FuelError19(
8256
- ErrorCode19.WALLET_MANAGER_ERROR,
8362
+ throw new FuelError20(
8363
+ ErrorCode20.WALLET_MANAGER_ERROR,
8257
8364
  `Account with address '${address}' not found in derived wallets.`
8258
8365
  );
8259
8366
  }
@@ -8267,7 +8374,7 @@ __publicField(MnemonicVault, "type", "mnemonic");
8267
8374
 
8268
8375
  // src/wallet-manager/vaults/privatekey-vault.ts
8269
8376
  import { Address as Address7 } from "@fuel-ts/address";
8270
- import { ErrorCode as ErrorCode20, FuelError as FuelError20 } from "@fuel-ts/errors";
8377
+ import { ErrorCode as ErrorCode21, FuelError as FuelError21 } from "@fuel-ts/errors";
8271
8378
  var _privateKeys;
8272
8379
  var PrivateKeyVault = class {
8273
8380
  /**
@@ -8308,8 +8415,8 @@ var PrivateKeyVault = class {
8308
8415
  (pk) => Wallet.fromPrivateKey(pk).address.equals(ownerAddress)
8309
8416
  );
8310
8417
  if (!privateKey) {
8311
- throw new FuelError20(
8312
- ErrorCode20.WALLET_MANAGER_ERROR,
8418
+ throw new FuelError21(
8419
+ ErrorCode21.WALLET_MANAGER_ERROR,
8313
8420
  `No private key found for address '${address}'.`
8314
8421
  );
8315
8422
  }
@@ -8333,7 +8440,7 @@ var ERROR_MESSAGES = {
8333
8440
  };
8334
8441
  function assert(condition, message) {
8335
8442
  if (!condition) {
8336
- throw new FuelError21(ErrorCode21.WALLET_MANAGER_ERROR, message);
8443
+ throw new FuelError22(ErrorCode22.WALLET_MANAGER_ERROR, message);
8337
8444
  }
8338
8445
  }
8339
8446
  var _vaults, _passphrase, _isLocked, _serializeVaults, serializeVaults_fn, _deserializeVaults, deserializeVaults_fn;
@@ -8559,25 +8666,25 @@ deserializeVaults_fn = function(vaults) {
8559
8666
  __publicField(WalletManager, "Vaults", [MnemonicVault, PrivateKeyVault]);
8560
8667
 
8561
8668
  // src/wallet-manager/types.ts
8562
- import { ErrorCode as ErrorCode22, FuelError as FuelError22 } from "@fuel-ts/errors";
8669
+ import { ErrorCode as ErrorCode23, FuelError as FuelError23 } from "@fuel-ts/errors";
8563
8670
  var Vault = class {
8564
8671
  constructor(_options) {
8565
- throw new FuelError22(ErrorCode22.NOT_IMPLEMENTED, "Not implemented.");
8672
+ throw new FuelError23(ErrorCode23.NOT_IMPLEMENTED, "Not implemented.");
8566
8673
  }
8567
8674
  serialize() {
8568
- throw new FuelError22(ErrorCode22.NOT_IMPLEMENTED, "Not implemented.");
8675
+ throw new FuelError23(ErrorCode23.NOT_IMPLEMENTED, "Not implemented.");
8569
8676
  }
8570
8677
  getAccounts() {
8571
- throw new FuelError22(ErrorCode22.NOT_IMPLEMENTED, "Not implemented.");
8678
+ throw new FuelError23(ErrorCode23.NOT_IMPLEMENTED, "Not implemented.");
8572
8679
  }
8573
8680
  addAccount() {
8574
- throw new FuelError22(ErrorCode22.NOT_IMPLEMENTED, "Not implemented.");
8681
+ throw new FuelError23(ErrorCode23.NOT_IMPLEMENTED, "Not implemented.");
8575
8682
  }
8576
8683
  exportAccount(_address) {
8577
- throw new FuelError22(ErrorCode22.NOT_IMPLEMENTED, "Not implemented.");
8684
+ throw new FuelError23(ErrorCode23.NOT_IMPLEMENTED, "Not implemented.");
8578
8685
  }
8579
8686
  getWallet(_address) {
8580
- throw new FuelError22(ErrorCode22.NOT_IMPLEMENTED, "Not implemented.");
8687
+ throw new FuelError23(ErrorCode23.NOT_IMPLEMENTED, "Not implemented.");
8581
8688
  }
8582
8689
  };
8583
8690
  __publicField(Vault, "type");
@@ -8594,7 +8701,7 @@ import {
8594
8701
  } from "@fuel-ts/abi-coder";
8595
8702
  import { Address as Address9 } from "@fuel-ts/address";
8596
8703
  import { BaseAssetId as BaseAssetId4 } from "@fuel-ts/address/configs";
8597
- import { ErrorCode as ErrorCode23, FuelError as FuelError23 } from "@fuel-ts/errors";
8704
+ import { ErrorCode as ErrorCode24, FuelError as FuelError24 } from "@fuel-ts/errors";
8598
8705
  import { ByteArrayCoder, InputType as InputType7 } from "@fuel-ts/transactions";
8599
8706
  import { arrayify as arrayify20, hexlify as hexlify19 } from "@fuel-ts/utils";
8600
8707
 
@@ -8614,7 +8721,6 @@ var getPredicateRoot = (bytecode) => {
8614
8721
  // src/predicate/predicate.ts
8615
8722
  var Predicate = class extends Account {
8616
8723
  bytes;
8617
- predicateDataBytes = Uint8Array.from([]);
8618
8724
  predicateData = [];
8619
8725
  interface;
8620
8726
  /**
@@ -8722,8 +8828,8 @@ var Predicate = class extends Account {
8722
8828
  if (jsonAbi) {
8723
8829
  abiInterface = new Interface4(jsonAbi);
8724
8830
  if (abiInterface.functions.main === void 0) {
8725
- throw new FuelError23(
8726
- ErrorCode23.ABI_MAIN_METHOD_MISSING,
8831
+ throw new FuelError24(
8832
+ ErrorCode24.ABI_MAIN_METHOD_MISSING,
8727
8833
  'Cannot use ABI without "main" function.'
8728
8834
  );
8729
8835
  }
@@ -8768,8 +8874,8 @@ var Predicate = class extends Account {
8768
8874
  mutatedBytes.set(encoded, offset);
8769
8875
  });
8770
8876
  } catch (err) {
8771
- throw new FuelError23(
8772
- ErrorCode23.INVALID_CONFIGURABLE_CONSTANTS,
8877
+ throw new FuelError24(
8878
+ ErrorCode24.INVALID_CONFIGURABLE_CONSTANTS,
8773
8879
  `Error setting configurable constants: ${err.message}.`
8774
8880
  );
8775
8881
  }
@@ -8778,7 +8884,7 @@ var Predicate = class extends Account {
8778
8884
  };
8779
8885
 
8780
8886
  // src/connectors/fuel.ts
8781
- import { ErrorCode as ErrorCode24, FuelError as FuelError24 } from "@fuel-ts/errors";
8887
+ import { ErrorCode as ErrorCode25, FuelError as FuelError25 } from "@fuel-ts/errors";
8782
8888
 
8783
8889
  // src/connectors/fuel-connector.ts
8784
8890
  import { EventEmitter as EventEmitter2 } from "events";
@@ -9411,7 +9517,7 @@ var _Fuel = class extends FuelConnector {
9411
9517
  const currentNetwork = await this.currentNetwork();
9412
9518
  provider = await Provider.create(currentNetwork.url);
9413
9519
  } else {
9414
- throw new FuelError24(ErrorCode24.INVALID_PROVIDER, "Provider is not valid.");
9520
+ throw new FuelError25(ErrorCode25.INVALID_PROVIDER, "Provider is not valid.");
9415
9521
  }
9416
9522
  return provider;
9417
9523
  }
@@ -9490,7 +9596,9 @@ export {
9490
9596
  WalletUnlocked,
9491
9597
  addAmountToAsset,
9492
9598
  addOperation,
9599
+ assemblePanicError,
9493
9600
  assembleReceiptByType,
9601
+ assembleRevertError,
9494
9602
  assembleTransactionSummary,
9495
9603
  assets,
9496
9604
  buildBlockExplorerUrl,
@@ -9505,6 +9613,7 @@ export {
9505
9613
  english,
9506
9614
  extractBurnedAssetsFromReceipts,
9507
9615
  extractMintedAssetsFromReceipts,
9616
+ extractTxError,
9508
9617
  gasUsedByInputs,
9509
9618
  getAssetEth,
9510
9619
  getAssetFuel,