@fuel-ts/account 0.0.0-rc-1832-20240402200757 → 0.0.0-rc-1895-20240403004459

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,
@@ -1157,7 +1157,7 @@ var outputify = (value) => {
1157
1157
  // src/providers/transaction-request/transaction-request.ts
1158
1158
  import { Address, addressify } from "@fuel-ts/address";
1159
1159
  import { BaseAssetId as BaseAssetId2, ZeroBytes32 as ZeroBytes324 } from "@fuel-ts/address/configs";
1160
- import { bn as bn6 } from "@fuel-ts/math";
1160
+ import { bn as bn7 } from "@fuel-ts/math";
1161
1161
  import {
1162
1162
  PolicyType,
1163
1163
  TransactionCoder,
@@ -1562,6 +1562,86 @@ function sleep(time) {
1562
1562
  });
1563
1563
  }
1564
1564
 
1565
+ // src/providers/utils/extract-tx-error.ts
1566
+ import { ErrorCode as ErrorCode7, FuelError as FuelError7 } from "@fuel-ts/errors";
1567
+ import { bn as bn6 } from "@fuel-ts/math";
1568
+ import { ReceiptType as ReceiptType3 } from "@fuel-ts/transactions";
1569
+ import {
1570
+ FAILED_REQUIRE_SIGNAL,
1571
+ FAILED_ASSERT_EQ_SIGNAL,
1572
+ FAILED_ASSERT_NE_SIGNAL,
1573
+ FAILED_ASSERT_SIGNAL,
1574
+ FAILED_TRANSFER_TO_ADDRESS_SIGNAL as FAILED_TRANSFER_TO_ADDRESS_SIGNAL2,
1575
+ PANIC_REASONS,
1576
+ PANIC_DOC_URL
1577
+ } from "@fuel-ts/transactions/configs";
1578
+ var assemblePanicError = (status) => {
1579
+ let errorMessage = `The transaction reverted with reason: "${status.reason}".`;
1580
+ const reason = status.reason;
1581
+ if (PANIC_REASONS.includes(status.reason)) {
1582
+ errorMessage = `${errorMessage}
1583
+
1584
+ You can read more about this error at:
1585
+
1586
+ ${PANIC_DOC_URL}#variant.${status.reason}`;
1587
+ }
1588
+ return { errorMessage, reason };
1589
+ };
1590
+ var stringify = (obj) => JSON.stringify(obj, null, 2);
1591
+ var assembleRevertError = (receipts, logs) => {
1592
+ let errorMessage = "The transaction reverted with an unknown reason.";
1593
+ const revertReceipt = receipts.find(({ type }) => type === ReceiptType3.Revert);
1594
+ let reason = "";
1595
+ if (revertReceipt) {
1596
+ const reasonHex = bn6(revertReceipt.val).toHex();
1597
+ switch (reasonHex) {
1598
+ case FAILED_REQUIRE_SIGNAL: {
1599
+ reason = "require";
1600
+ errorMessage = `The transaction reverted because a "require" statement has thrown ${logs.length ? stringify(logs[0]) : "an error."}.`;
1601
+ break;
1602
+ }
1603
+ case FAILED_ASSERT_EQ_SIGNAL: {
1604
+ const sufix = logs.length >= 2 ? ` comparing ${stringify(logs[1])} and ${stringify(logs[0])}.` : ".";
1605
+ reason = "assert_eq";
1606
+ errorMessage = `The transaction reverted because of an "assert_eq" statement${sufix}`;
1607
+ break;
1608
+ }
1609
+ case FAILED_ASSERT_NE_SIGNAL: {
1610
+ const sufix = logs.length >= 2 ? ` comparing ${stringify(logs[1])} and ${stringify(logs[0])}.` : ".";
1611
+ reason = "assert_ne";
1612
+ errorMessage = `The transaction reverted because of an "assert_ne" statement${sufix}`;
1613
+ break;
1614
+ }
1615
+ case FAILED_ASSERT_SIGNAL:
1616
+ reason = "assert";
1617
+ errorMessage = `The transaction reverted because an "assert" statement failed to evaluate to true.`;
1618
+ break;
1619
+ case FAILED_TRANSFER_TO_ADDRESS_SIGNAL2:
1620
+ reason = "MissingOutputChange";
1621
+ errorMessage = `The transaction reverted because it's missing an "OutputChange".`;
1622
+ break;
1623
+ default:
1624
+ reason = "unknown";
1625
+ errorMessage = `The transaction reverted with an unknown reason: ${revertReceipt.val}`;
1626
+ }
1627
+ }
1628
+ return { errorMessage, reason };
1629
+ };
1630
+ var extractTxError = (params) => {
1631
+ const { receipts, status, logs } = params;
1632
+ const isPanic = receipts.some(({ type }) => type === ReceiptType3.Panic);
1633
+ const isRevert = receipts.some(({ type }) => type === ReceiptType3.Revert);
1634
+ const { errorMessage, reason } = status?.type === "FailureStatus" && isPanic ? assemblePanicError(status) : assembleRevertError(receipts, logs);
1635
+ const metadata = {
1636
+ logs,
1637
+ receipts,
1638
+ panic: isPanic,
1639
+ revert: isRevert,
1640
+ reason
1641
+ };
1642
+ return new FuelError7(ErrorCode7.SCRIPT_REVERTED, errorMessage, metadata);
1643
+ };
1644
+
1565
1645
  // src/providers/transaction-request/errors.ts
1566
1646
  var ChangeOutputCollisionError = class extends Error {
1567
1647
  name = "ChangeOutputCollisionError";
@@ -1624,10 +1704,10 @@ var BaseTransactionRequest = class {
1624
1704
  outputs,
1625
1705
  witnesses
1626
1706
  } = {}) {
1627
- this.gasPrice = bn6(gasPrice);
1707
+ this.gasPrice = bn7(gasPrice);
1628
1708
  this.maturity = maturity ?? 0;
1629
- this.witnessLimit = witnessLimit ? bn6(witnessLimit) : void 0;
1630
- this.maxFee = maxFee ? bn6(maxFee) : void 0;
1709
+ this.witnessLimit = witnessLimit ? bn7(witnessLimit) : void 0;
1710
+ this.maxFee = maxFee ? bn7(maxFee) : void 0;
1631
1711
  this.inputs = inputs ?? [];
1632
1712
  this.outputs = outputs ?? [];
1633
1713
  this.witnesses = witnesses ?? [];
@@ -2057,13 +2137,13 @@ var BaseTransactionRequest = class {
2057
2137
  assetId,
2058
2138
  owner: resourcesOwner || Address.fromRandom(),
2059
2139
  maturity: 0,
2060
- blockCreated: bn6(1),
2061
- txCreatedIdx: bn6(1)
2140
+ blockCreated: bn7(1),
2141
+ txCreatedIdx: bn7(1)
2062
2142
  }
2063
2143
  ]);
2064
2144
  }
2065
2145
  };
2066
- updateAssetInput(BaseAssetId2, bn6(1e11));
2146
+ updateAssetInput(BaseAssetId2, bn7(1e11));
2067
2147
  quantities.forEach((q) => updateAssetInput(q.assetId, q.amount));
2068
2148
  }
2069
2149
  /**
@@ -2074,7 +2154,7 @@ var BaseTransactionRequest = class {
2074
2154
  */
2075
2155
  getCoinOutputsQuantities() {
2076
2156
  const coinsQuantities = this.getCoinOutputs().map(({ amount, assetId }) => ({
2077
- amount: bn6(amount),
2157
+ amount: bn7(amount),
2078
2158
  assetId: assetId.toString()
2079
2159
  }));
2080
2160
  return coinsQuantities;
@@ -2103,7 +2183,7 @@ var BaseTransactionRequest = class {
2103
2183
  default:
2104
2184
  return;
2105
2185
  }
2106
- if (correspondingInput && "predicateGasUsed" in correspondingInput && bn6(correspondingInput.predicateGasUsed).gt(0)) {
2186
+ if (correspondingInput && "predicateGasUsed" in correspondingInput && bn7(correspondingInput.predicateGasUsed).gt(0)) {
2107
2187
  i.predicate = correspondingInput.predicate;
2108
2188
  i.predicateData = correspondingInput.predicateData;
2109
2189
  i.predicateGasUsed = correspondingInput.predicateGasUsed;
@@ -2114,14 +2194,14 @@ var BaseTransactionRequest = class {
2114
2194
 
2115
2195
  // src/providers/transaction-request/create-transaction-request.ts
2116
2196
  import { ZeroBytes32 as ZeroBytes326 } from "@fuel-ts/address/configs";
2117
- import { bn as bn8 } from "@fuel-ts/math";
2197
+ import { bn as bn9 } from "@fuel-ts/math";
2118
2198
  import { TransactionType as TransactionType3, OutputType as OutputType4 } from "@fuel-ts/transactions";
2119
2199
  import { arrayify as arrayify6, hexlify as hexlify9 } from "@fuel-ts/utils";
2120
2200
 
2121
2201
  // src/providers/transaction-request/hash-transaction.ts
2122
2202
  import { ZeroBytes32 as ZeroBytes325 } from "@fuel-ts/address/configs";
2123
2203
  import { uint64ToBytesBE, sha256 } from "@fuel-ts/hasher";
2124
- import { bn as bn7 } from "@fuel-ts/math";
2204
+ import { bn as bn8 } from "@fuel-ts/math";
2125
2205
  import { TransactionType as TransactionType2, InputType as InputType3, OutputType as OutputType3, TransactionCoder as TransactionCoder2 } from "@fuel-ts/transactions";
2126
2206
  import { concat as concat2 } from "@fuel-ts/utils";
2127
2207
  import { clone as clone2 } from "ramda";
@@ -2138,11 +2218,11 @@ function hashTransaction(transactionRequest, chainId) {
2138
2218
  blockHeight: 0,
2139
2219
  txIndex: 0
2140
2220
  };
2141
- inputClone.predicateGasUsed = bn7(0);
2221
+ inputClone.predicateGasUsed = bn8(0);
2142
2222
  return inputClone;
2143
2223
  }
2144
2224
  case InputType3.Message: {
2145
- inputClone.predicateGasUsed = bn7(0);
2225
+ inputClone.predicateGasUsed = bn8(0);
2146
2226
  return inputClone;
2147
2227
  }
2148
2228
  case InputType3.Contract: {
@@ -2169,12 +2249,12 @@ function hashTransaction(transactionRequest, chainId) {
2169
2249
  return outputClone;
2170
2250
  }
2171
2251
  case OutputType3.Change: {
2172
- outputClone.amount = bn7(0);
2252
+ outputClone.amount = bn8(0);
2173
2253
  return outputClone;
2174
2254
  }
2175
2255
  case OutputType3.Variable: {
2176
2256
  outputClone.to = ZeroBytes325;
2177
- outputClone.amount = bn7(0);
2257
+ outputClone.amount = bn8(0);
2178
2258
  outputClone.assetId = ZeroBytes325;
2179
2259
  return outputClone;
2180
2260
  }
@@ -2298,7 +2378,7 @@ var CreateTransactionRequest = class extends BaseTransactionRequest {
2298
2378
  }
2299
2379
  metadataGas(gasCosts) {
2300
2380
  return calculateMetadataGasForTxCreate({
2301
- contractBytesSize: bn8(arrayify6(this.witnesses[this.bytecodeWitnessIndex] || "0x").length),
2381
+ contractBytesSize: bn9(arrayify6(this.witnesses[this.bytecodeWitnessIndex] || "0x").length),
2302
2382
  gasCosts,
2303
2383
  stateRootSize: this.storageSlots.length,
2304
2384
  txBytesSize: this.byteSize()
@@ -2310,7 +2390,7 @@ var CreateTransactionRequest = class extends BaseTransactionRequest {
2310
2390
  import { Interface } from "@fuel-ts/abi-coder";
2311
2391
  import { addressify as addressify2 } from "@fuel-ts/address";
2312
2392
  import { ZeroBytes32 as ZeroBytes327 } from "@fuel-ts/address/configs";
2313
- import { bn as bn9 } from "@fuel-ts/math";
2393
+ import { bn as bn10 } from "@fuel-ts/math";
2314
2394
  import { InputType as InputType4, OutputType as OutputType5, TransactionType as TransactionType4 } from "@fuel-ts/transactions";
2315
2395
  import { arrayify as arrayify8, hexlify as hexlify10 } from "@fuel-ts/utils";
2316
2396
 
@@ -2364,7 +2444,7 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
2364
2444
  */
2365
2445
  constructor({ script, scriptData, gasLimit, ...rest } = {}) {
2366
2446
  super(rest);
2367
- this.gasLimit = bn9(gasLimit);
2447
+ this.gasLimit = bn10(gasLimit);
2368
2448
  this.script = arrayify8(script ?? returnZeroScript.bytes);
2369
2449
  this.scriptData = arrayify8(scriptData ?? returnZeroScript.encodeScriptData());
2370
2450
  this.abis = rest.abis;
@@ -2512,7 +2592,7 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
2512
2592
  };
2513
2593
 
2514
2594
  // src/providers/transaction-request/utils.ts
2515
- import { ErrorCode as ErrorCode7, FuelError as FuelError7 } from "@fuel-ts/errors";
2595
+ import { ErrorCode as ErrorCode8, FuelError as FuelError8 } from "@fuel-ts/errors";
2516
2596
  import { TransactionType as TransactionType5 } from "@fuel-ts/transactions";
2517
2597
  var transactionRequestify = (obj) => {
2518
2598
  if (obj instanceof ScriptTransactionRequest || obj instanceof CreateTransactionRequest) {
@@ -2527,14 +2607,14 @@ var transactionRequestify = (obj) => {
2527
2607
  return CreateTransactionRequest.from(obj);
2528
2608
  }
2529
2609
  default: {
2530
- throw new FuelError7(ErrorCode7.INVALID_TRANSACTION_TYPE, `Invalid transaction type: ${type}.`);
2610
+ throw new FuelError8(ErrorCode8.INVALID_TRANSACTION_TYPE, `Invalid transaction type: ${type}.`);
2531
2611
  }
2532
2612
  }
2533
2613
  };
2534
2614
 
2535
2615
  // 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";
2616
+ import { ErrorCode as ErrorCode12, FuelError as FuelError12 } from "@fuel-ts/errors";
2617
+ import { bn as bn14 } from "@fuel-ts/math";
2538
2618
  import { TransactionCoder as TransactionCoder4 } from "@fuel-ts/transactions";
2539
2619
  import { arrayify as arrayify10 } from "@fuel-ts/utils";
2540
2620
 
@@ -2542,7 +2622,7 @@ import { arrayify as arrayify10 } from "@fuel-ts/utils";
2542
2622
  import { DateTime, hexlify as hexlify11 } from "@fuel-ts/utils";
2543
2623
 
2544
2624
  // src/providers/transaction-summary/calculate-transaction-fee.ts
2545
- import { bn as bn10 } from "@fuel-ts/math";
2625
+ import { bn as bn11 } from "@fuel-ts/math";
2546
2626
  import { PolicyType as PolicyType2, TransactionCoder as TransactionCoder3, TransactionType as TransactionType6 } from "@fuel-ts/transactions";
2547
2627
  import { arrayify as arrayify9 } from "@fuel-ts/utils";
2548
2628
  var calculateTransactionFee = (params) => {
@@ -2551,24 +2631,24 @@ var calculateTransactionFee = (params) => {
2551
2631
  rawPayload,
2552
2632
  consensusParameters: { gasCosts, feeParams }
2553
2633
  } = params;
2554
- const gasPerByte = bn10(feeParams.gasPerByte);
2555
- const gasPriceFactor = bn10(feeParams.gasPriceFactor);
2634
+ const gasPerByte = bn11(feeParams.gasPerByte);
2635
+ const gasPriceFactor = bn11(feeParams.gasPriceFactor);
2556
2636
  const transactionBytes = arrayify9(rawPayload);
2557
2637
  const [transaction] = new TransactionCoder3().decode(transactionBytes, 0);
2558
2638
  if (transaction.type === TransactionType6.Mint) {
2559
2639
  return {
2560
- fee: bn10(0),
2561
- minFee: bn10(0),
2562
- maxFee: bn10(0),
2563
- feeFromGasUsed: bn10(0)
2640
+ fee: bn11(0),
2641
+ minFee: bn11(0),
2642
+ maxFee: bn11(0),
2643
+ feeFromGasUsed: bn11(0)
2564
2644
  };
2565
2645
  }
2566
2646
  const { type, witnesses, inputs, policies } = transaction;
2567
- let metadataGas = bn10(0);
2568
- let gasLimit = bn10(0);
2647
+ let metadataGas = bn11(0);
2648
+ let gasLimit = bn11(0);
2569
2649
  if (type === TransactionType6.Create) {
2570
2650
  const { bytecodeWitnessIndex, storageSlots } = transaction;
2571
- const contractBytesSize = bn10(arrayify9(witnesses[bytecodeWitnessIndex].data).length);
2651
+ const contractBytesSize = bn11(arrayify9(witnesses[bytecodeWitnessIndex].data).length);
2572
2652
  metadataGas = calculateMetadataGasForTxCreate({
2573
2653
  contractBytesSize,
2574
2654
  gasCosts,
@@ -2587,12 +2667,12 @@ var calculateTransactionFee = (params) => {
2587
2667
  }
2588
2668
  const minGas = getMinGas({
2589
2669
  gasCosts,
2590
- gasPerByte: bn10(gasPerByte),
2670
+ gasPerByte: bn11(gasPerByte),
2591
2671
  inputs,
2592
2672
  metadataGas,
2593
2673
  txBytesSize: transactionBytes.length
2594
2674
  });
2595
- const gasPrice = bn10(policies.find((policy) => policy.type === PolicyType2.GasPrice)?.data);
2675
+ const gasPrice = bn11(policies.find((policy) => policy.type === PolicyType2.GasPrice)?.data);
2596
2676
  const witnessLimit = policies.find((policy) => policy.type === PolicyType2.WitnessLimit)?.data;
2597
2677
  const witnessesLength = witnesses.reduce((acc, wit) => acc + wit.dataLength, 0);
2598
2678
  const maxGas = getMaxGas({
@@ -2616,13 +2696,13 @@ var calculateTransactionFee = (params) => {
2616
2696
 
2617
2697
  // src/providers/transaction-summary/operations.ts
2618
2698
  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";
2699
+ import { ErrorCode as ErrorCode10, FuelError as FuelError10 } from "@fuel-ts/errors";
2700
+ import { bn as bn13 } from "@fuel-ts/math";
2701
+ import { ReceiptType as ReceiptType4, TransactionType as TransactionType7 } from "@fuel-ts/transactions";
2622
2702
 
2623
2703
  // src/providers/transaction-summary/call.ts
2624
2704
  import { Interface as Interface2, calculateVmTxMemory } from "@fuel-ts/abi-coder";
2625
- import { bn as bn11 } from "@fuel-ts/math";
2705
+ import { bn as bn12 } from "@fuel-ts/math";
2626
2706
  var getFunctionCall = ({ abi, receipt, rawPayload, maxInputs }) => {
2627
2707
  const abiInterface = new Interface2(abi);
2628
2708
  const callFunctionSelector = receipt.param1.toHex(8);
@@ -2631,7 +2711,7 @@ var getFunctionCall = ({ abi, receipt, rawPayload, maxInputs }) => {
2631
2711
  let encodedArgs;
2632
2712
  if (functionFragment.isInputDataPointer) {
2633
2713
  if (rawPayload) {
2634
- const argsOffset = bn11(receipt.param2).sub(calculateVmTxMemory({ maxInputs: maxInputs.toNumber() })).toNumber();
2714
+ const argsOffset = bn12(receipt.param2).sub(calculateVmTxMemory({ maxInputs: maxInputs.toNumber() })).toNumber();
2635
2715
  encodedArgs = `0x${rawPayload.slice(2).slice(argsOffset * 2)}`;
2636
2716
  }
2637
2717
  } else {
@@ -2665,7 +2745,7 @@ var getFunctionCall = ({ abi, receipt, rawPayload, maxInputs }) => {
2665
2745
  };
2666
2746
 
2667
2747
  // src/providers/transaction-summary/input.ts
2668
- import { ErrorCode as ErrorCode8, FuelError as FuelError8 } from "@fuel-ts/errors";
2748
+ import { ErrorCode as ErrorCode9, FuelError as FuelError9 } from "@fuel-ts/errors";
2669
2749
  import { InputType as InputType5 } from "@fuel-ts/transactions";
2670
2750
  function getInputsByTypes(inputs, types) {
2671
2751
  return inputs.filter((i) => types.includes(i.type));
@@ -2703,8 +2783,8 @@ function getInputContractFromIndex(inputs, inputIndex) {
2703
2783
  return void 0;
2704
2784
  }
2705
2785
  if (contractInput.type !== InputType5.Contract) {
2706
- throw new FuelError8(
2707
- ErrorCode8.INVALID_TRANSACTION_INPUT,
2786
+ throw new FuelError9(
2787
+ ErrorCode9.INVALID_TRANSACTION_INPUT,
2708
2788
  `Contract input should be of type 'contract'.`
2709
2789
  );
2710
2790
  }
@@ -2792,8 +2872,8 @@ function getTransactionTypeName(transactionType) {
2792
2872
  case TransactionType7.Script:
2793
2873
  return "Script" /* Script */;
2794
2874
  default:
2795
- throw new FuelError9(
2796
- ErrorCode9.INVALID_TRANSACTION_TYPE,
2875
+ throw new FuelError10(
2876
+ ErrorCode10.INVALID_TRANSACTION_TYPE,
2797
2877
  `Invalid transaction type: ${transactionType}.`
2798
2878
  );
2799
2879
  }
@@ -2815,10 +2895,10 @@ function hasSameAssetId(a) {
2815
2895
  return (b) => a.assetId === b.assetId;
2816
2896
  }
2817
2897
  function getReceiptsCall(receipts) {
2818
- return getReceiptsByType(receipts, ReceiptType3.Call);
2898
+ return getReceiptsByType(receipts, ReceiptType4.Call);
2819
2899
  }
2820
2900
  function getReceiptsMessageOut(receipts) {
2821
- return getReceiptsByType(receipts, ReceiptType3.MessageOut);
2901
+ return getReceiptsByType(receipts, ReceiptType4.MessageOut);
2822
2902
  }
2823
2903
  var mergeAssets = (op1, op2) => {
2824
2904
  const assets1 = op1.assetsSent || [];
@@ -2831,7 +2911,7 @@ var mergeAssets = (op1, op2) => {
2831
2911
  if (!matchingAsset) {
2832
2912
  return asset1;
2833
2913
  }
2834
- const mergedAmount = bn12(asset1.amount).add(matchingAsset.amount);
2914
+ const mergedAmount = bn13(asset1.amount).add(matchingAsset.amount);
2835
2915
  return { ...asset1, amount: mergedAmount };
2836
2916
  });
2837
2917
  return mergedAssets.concat(filteredAssets);
@@ -2857,7 +2937,7 @@ function addOperation(operations, toAdd) {
2857
2937
  return allOperations;
2858
2938
  }
2859
2939
  function getReceiptsTransferOut(receipts) {
2860
- return getReceiptsByType(receipts, ReceiptType3.TransferOut);
2940
+ return getReceiptsByType(receipts, ReceiptType4.TransferOut);
2861
2941
  }
2862
2942
  function getWithdrawFromFuelOperations({
2863
2943
  inputs,
@@ -3017,11 +3097,11 @@ function getTransferOperations({
3017
3097
  });
3018
3098
  const transferReceipts = getReceiptsByType(
3019
3099
  receipts,
3020
- ReceiptType3.Transfer
3100
+ ReceiptType4.Transfer
3021
3101
  );
3022
3102
  const transferOutReceipts = getReceiptsByType(
3023
3103
  receipts,
3024
- ReceiptType3.TransferOut
3104
+ ReceiptType4.TransferOut
3025
3105
  );
3026
3106
  [...transferReceipts, ...transferOutReceipts].forEach((receipt) => {
3027
3107
  const operation = extractTransferOperationFromReceipt(receipt, contractInputs, changeOutputs);
@@ -3106,17 +3186,17 @@ function getOperations({
3106
3186
  }
3107
3187
 
3108
3188
  // src/providers/transaction-summary/receipt.ts
3109
- import { ReceiptType as ReceiptType4 } from "@fuel-ts/transactions";
3189
+ import { ReceiptType as ReceiptType5 } from "@fuel-ts/transactions";
3110
3190
  var processGqlReceipt = (gqlReceipt) => {
3111
3191
  const receipt = assembleReceiptByType(gqlReceipt);
3112
3192
  switch (receipt.type) {
3113
- case ReceiptType4.ReturnData: {
3193
+ case ReceiptType5.ReturnData: {
3114
3194
  return {
3115
3195
  ...receipt,
3116
3196
  data: gqlReceipt.data || "0x"
3117
3197
  };
3118
3198
  }
3119
- case ReceiptType4.LogData: {
3199
+ case ReceiptType5.LogData: {
3120
3200
  return {
3121
3201
  ...receipt,
3122
3202
  data: gqlReceipt.data || "0x"
@@ -3129,7 +3209,7 @@ var processGqlReceipt = (gqlReceipt) => {
3129
3209
  var extractMintedAssetsFromReceipts = (receipts) => {
3130
3210
  const mintedAssets = [];
3131
3211
  receipts.forEach((receipt) => {
3132
- if (receipt.type === ReceiptType4.Mint) {
3212
+ if (receipt.type === ReceiptType5.Mint) {
3133
3213
  mintedAssets.push({
3134
3214
  subId: receipt.subId,
3135
3215
  contractId: receipt.contractId,
@@ -3143,7 +3223,7 @@ var extractMintedAssetsFromReceipts = (receipts) => {
3143
3223
  var extractBurnedAssetsFromReceipts = (receipts) => {
3144
3224
  const burnedAssets = [];
3145
3225
  receipts.forEach((receipt) => {
3146
- if (receipt.type === ReceiptType4.Burn) {
3226
+ if (receipt.type === ReceiptType5.Burn) {
3147
3227
  burnedAssets.push({
3148
3228
  subId: receipt.subId,
3149
3229
  contractId: receipt.contractId,
@@ -3156,7 +3236,7 @@ var extractBurnedAssetsFromReceipts = (receipts) => {
3156
3236
  };
3157
3237
 
3158
3238
  // src/providers/transaction-summary/status.ts
3159
- import { ErrorCode as ErrorCode10, FuelError as FuelError10 } from "@fuel-ts/errors";
3239
+ import { ErrorCode as ErrorCode11, FuelError as FuelError11 } from "@fuel-ts/errors";
3160
3240
  var getTransactionStatusName = (gqlStatus) => {
3161
3241
  switch (gqlStatus) {
3162
3242
  case "FailureStatus":
@@ -3168,8 +3248,8 @@ var getTransactionStatusName = (gqlStatus) => {
3168
3248
  case "SqueezedOutStatus":
3169
3249
  return "squeezedout" /* squeezedout */;
3170
3250
  default:
3171
- throw new FuelError10(
3172
- ErrorCode10.INVALID_TRANSACTION_STATUS,
3251
+ throw new FuelError11(
3252
+ ErrorCode11.INVALID_TRANSACTION_STATUS,
3173
3253
  `Invalid transaction status: ${gqlStatus}.`
3174
3254
  );
3175
3255
  }
@@ -3282,12 +3362,12 @@ function assembleTransactionSummary(params) {
3282
3362
 
3283
3363
  // src/providers/transaction-response/getDecodedLogs.ts
3284
3364
  import { Interface as Interface3, BigNumberCoder } from "@fuel-ts/abi-coder";
3285
- import { ReceiptType as ReceiptType5 } from "@fuel-ts/transactions";
3365
+ import { ReceiptType as ReceiptType6 } from "@fuel-ts/transactions";
3286
3366
  function getDecodedLogs(receipts, mainAbi, externalAbis = {}) {
3287
3367
  return receipts.reduce((logs, receipt) => {
3288
- if (receipt.type === ReceiptType5.LogData || receipt.type === ReceiptType5.Log) {
3368
+ if (receipt.type === ReceiptType6.LogData || receipt.type === ReceiptType6.Log) {
3289
3369
  const interfaceToUse = new Interface3(externalAbis[receipt.id] || mainAbi);
3290
- const data = receipt.type === ReceiptType5.Log ? new BigNumberCoder("u64").encode(receipt.val0) : receipt.data;
3370
+ const data = receipt.type === ReceiptType6.Log ? new BigNumberCoder("u64").encode(receipt.val0) : receipt.data;
3291
3371
  const [decodedLog] = interfaceToUse.decodeLog(data, receipt.val1.toNumber());
3292
3372
  logs.push(decodedLog);
3293
3373
  }
@@ -3302,7 +3382,7 @@ var TransactionResponse = class {
3302
3382
  /** Current provider */
3303
3383
  provider;
3304
3384
  /** Gas used on the transaction */
3305
- gasUsed = bn13(0);
3385
+ gasUsed = bn14(0);
3306
3386
  /** The graphql Transaction with receipts object. */
3307
3387
  gqlTransaction;
3308
3388
  abis;
@@ -3407,8 +3487,8 @@ var TransactionResponse = class {
3407
3487
  });
3408
3488
  for await (const { statusChange } of subscription) {
3409
3489
  if (statusChange.type === "SqueezedOutStatus") {
3410
- throw new FuelError11(
3411
- ErrorCode11.TRANSACTION_SQUEEZED_OUT,
3490
+ throw new FuelError12(
3491
+ ErrorCode12.TRANSACTION_SQUEEZED_OUT,
3412
3492
  `Transaction Squeezed Out with reason: ${statusChange.reason}`
3413
3493
  );
3414
3494
  }
@@ -3430,14 +3510,26 @@ var TransactionResponse = class {
3430
3510
  gqlTransaction: this.gqlTransaction,
3431
3511
  ...transactionSummary
3432
3512
  };
3513
+ let logs = [];
3433
3514
  if (this.abis) {
3434
- const logs = getDecodedLogs(
3515
+ logs = getDecodedLogs(
3435
3516
  transactionSummary.receipts,
3436
3517
  this.abis.main,
3437
3518
  this.abis.otherContractsAbis
3438
3519
  );
3439
3520
  transactionResult.logs = logs;
3440
3521
  }
3522
+ if (transactionResult.isStatusFailure) {
3523
+ const {
3524
+ receipts,
3525
+ gqlTransaction: { status }
3526
+ } = transactionResult;
3527
+ throw extractTxError({
3528
+ receipts,
3529
+ status,
3530
+ logs
3531
+ });
3532
+ }
3441
3533
  return transactionResult;
3442
3534
  }
3443
3535
  /**
@@ -3446,14 +3538,7 @@ var TransactionResponse = class {
3446
3538
  * @param contractsAbiMap - The contracts ABI map.
3447
3539
  */
3448
3540
  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;
3541
+ return this.waitForResult(contractsAbiMap);
3457
3542
  }
3458
3543
  };
3459
3544
 
@@ -3515,29 +3600,29 @@ var processGqlChain = (chain) => {
3515
3600
  const { contractParams, feeParams, predicateParams, scriptParams, txParams, gasCosts } = consensusParameters;
3516
3601
  return {
3517
3602
  name,
3518
- baseChainHeight: bn14(daHeight),
3603
+ baseChainHeight: bn15(daHeight),
3519
3604
  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),
3605
+ contractMaxSize: bn15(contractParams.contractMaxSize),
3606
+ maxInputs: bn15(txParams.maxInputs),
3607
+ maxOutputs: bn15(txParams.maxOutputs),
3608
+ maxWitnesses: bn15(txParams.maxWitnesses),
3609
+ maxGasPerTx: bn15(txParams.maxGasPerTx),
3610
+ maxScriptLength: bn15(scriptParams.maxScriptLength),
3611
+ maxScriptDataLength: bn15(scriptParams.maxScriptDataLength),
3612
+ maxStorageSlots: bn15(contractParams.maxStorageSlots),
3613
+ maxPredicateLength: bn15(predicateParams.maxPredicateLength),
3614
+ maxPredicateDataLength: bn15(predicateParams.maxPredicateDataLength),
3615
+ maxGasPerPredicate: bn15(predicateParams.maxGasPerPredicate),
3616
+ gasPriceFactor: bn15(feeParams.gasPriceFactor),
3617
+ gasPerByte: bn15(feeParams.gasPerByte),
3618
+ maxMessageDataLength: bn15(predicateParams.maxMessageDataLength),
3619
+ chainId: bn15(consensusParameters.chainId),
3535
3620
  gasCosts
3536
3621
  },
3537
3622
  gasCosts,
3538
3623
  latestBlock: {
3539
3624
  id: latestBlock.id,
3540
- height: bn14(latestBlock.header.height),
3625
+ height: bn15(latestBlock.header.height),
3541
3626
  time: latestBlock.header.time,
3542
3627
  transactions: latestBlock.transactions.map((i) => ({
3543
3628
  id: i.id
@@ -3607,8 +3692,8 @@ var _Provider = class {
3607
3692
  getChain() {
3608
3693
  const chain = _Provider.chainInfoCache[this.url];
3609
3694
  if (!chain) {
3610
- throw new FuelError12(
3611
- ErrorCode12.CHAIN_INFO_CACHE_EMPTY,
3695
+ throw new FuelError13(
3696
+ ErrorCode13.CHAIN_INFO_CACHE_EMPTY,
3612
3697
  "Chain info cache is empty. Make sure you have called `Provider.create` to initialize the provider."
3613
3698
  );
3614
3699
  }
@@ -3620,8 +3705,8 @@ var _Provider = class {
3620
3705
  getNode() {
3621
3706
  const node = _Provider.nodeInfoCache[this.url];
3622
3707
  if (!node) {
3623
- throw new FuelError12(
3624
- ErrorCode12.NODE_INFO_CACHE_EMPTY,
3708
+ throw new FuelError13(
3709
+ ErrorCode13.NODE_INFO_CACHE_EMPTY,
3625
3710
  "Node info cache is empty. Make sure you have called `Provider.create` to initialize the provider."
3626
3711
  );
3627
3712
  }
@@ -3668,8 +3753,8 @@ var _Provider = class {
3668
3753
  static ensureClientVersionIsSupported(nodeInfo) {
3669
3754
  const { isMajorSupported, isMinorSupported, supportedVersion } = checkFuelCoreVersionCompatibility(nodeInfo.nodeVersion);
3670
3755
  if (!isMajorSupported || !isMinorSupported) {
3671
- throw new FuelError12(
3672
- FuelError12.CODES.UNSUPPORTED_FUEL_CLIENT_VERSION,
3756
+ throw new FuelError13(
3757
+ FuelError13.CODES.UNSUPPORTED_FUEL_CLIENT_VERSION,
3673
3758
  `Fuel client version: ${nodeInfo.nodeVersion}, Supported version: ${supportedVersion}`
3674
3759
  );
3675
3760
  }
@@ -3732,7 +3817,7 @@ var _Provider = class {
3732
3817
  */
3733
3818
  async getBlockNumber() {
3734
3819
  const { chain } = await this.operations.getChain();
3735
- return bn14(chain.latestBlock.header.height, 10);
3820
+ return bn15(chain.latestBlock.header.height, 10);
3736
3821
  }
3737
3822
  /**
3738
3823
  * Returns the chain information.
@@ -3742,9 +3827,9 @@ var _Provider = class {
3742
3827
  async fetchNode() {
3743
3828
  const { nodeInfo } = await this.operations.getNodeInfo();
3744
3829
  const processedNodeInfo = {
3745
- maxDepth: bn14(nodeInfo.maxDepth),
3746
- maxTx: bn14(nodeInfo.maxTx),
3747
- minGasPrice: bn14(nodeInfo.minGasPrice),
3830
+ maxDepth: bn15(nodeInfo.maxDepth),
3831
+ maxTx: bn15(nodeInfo.maxTx),
3832
+ minGasPrice: bn15(nodeInfo.minGasPrice),
3748
3833
  nodeVersion: nodeInfo.nodeVersion,
3749
3834
  utxoValidation: nodeInfo.utxoValidation,
3750
3835
  vmBacktrace: nodeInfo.vmBacktrace,
@@ -3799,8 +3884,8 @@ var _Provider = class {
3799
3884
  const subscription = this.operations.submitAndAwait({ encodedTransaction });
3800
3885
  for await (const { submitAndAwait } of subscription) {
3801
3886
  if (submitAndAwait.type === "SqueezedOutStatus") {
3802
- throw new FuelError12(
3803
- ErrorCode12.TRANSACTION_SQUEEZED_OUT,
3887
+ throw new FuelError13(
3888
+ ErrorCode13.TRANSACTION_SQUEEZED_OUT,
3804
3889
  `Transaction Squeezed Out with reason: ${submitAndAwait.reason}`
3805
3890
  );
3806
3891
  }
@@ -3867,7 +3952,7 @@ var _Provider = class {
3867
3952
  } = response;
3868
3953
  if (inputs) {
3869
3954
  inputs.forEach((input, index) => {
3870
- if ("predicateGasUsed" in input && bn14(input.predicateGasUsed).gt(0)) {
3955
+ if ("predicateGasUsed" in input && bn15(input.predicateGasUsed).gt(0)) {
3871
3956
  transactionRequest.inputs[index].predicateGasUsed = input.predicateGasUsed;
3872
3957
  }
3873
3958
  });
@@ -3980,7 +4065,7 @@ var _Provider = class {
3980
4065
  txRequestClone.fundWithFakeUtxos(allQuantities, resourcesOwner?.address);
3981
4066
  if (estimatePredicates) {
3982
4067
  if (isScriptTransaction) {
3983
- txRequestClone.gasLimit = bn14(0);
4068
+ txRequestClone.gasLimit = bn15(0);
3984
4069
  }
3985
4070
  if (resourcesOwner && "populateTransactionPredicateData" in resourcesOwner) {
3986
4071
  resourcesOwner.populateTransactionPredicateData(txRequestClone);
@@ -3996,8 +4081,8 @@ var _Provider = class {
3996
4081
  let missingContractIds = [];
3997
4082
  let outputVariables = 0;
3998
4083
  if (isScriptTransaction && estimateTxDependencies) {
3999
- txRequestClone.gasPrice = bn14(0);
4000
- txRequestClone.gasLimit = bn14(maxGasPerTx.sub(maxGas).toNumber() * 0.9);
4084
+ txRequestClone.gasPrice = bn15(0);
4085
+ txRequestClone.gasLimit = bn15(maxGasPerTx.sub(maxGas).toNumber() * 0.9);
4001
4086
  const result = await this.estimateTxDependencies(txRequestClone);
4002
4087
  receipts = result.receipts;
4003
4088
  outputVariables = result.outputVariables;
@@ -4059,11 +4144,11 @@ var _Provider = class {
4059
4144
  return coins.map((coin) => ({
4060
4145
  id: coin.utxoId,
4061
4146
  assetId: coin.assetId,
4062
- amount: bn14(coin.amount),
4147
+ amount: bn15(coin.amount),
4063
4148
  owner: Address2.fromAddressOrString(coin.owner),
4064
- maturity: bn14(coin.maturity).toNumber(),
4065
- blockCreated: bn14(coin.blockCreated),
4066
- txCreatedIdx: bn14(coin.txCreatedIdx)
4149
+ maturity: bn15(coin.maturity).toNumber(),
4150
+ blockCreated: bn15(coin.blockCreated),
4151
+ txCreatedIdx: bn15(coin.txCreatedIdx)
4067
4152
  }));
4068
4153
  }
4069
4154
  /**
@@ -4100,9 +4185,9 @@ var _Provider = class {
4100
4185
  switch (coin.__typename) {
4101
4186
  case "MessageCoin":
4102
4187
  return {
4103
- amount: bn14(coin.amount),
4188
+ amount: bn15(coin.amount),
4104
4189
  assetId: coin.assetId,
4105
- daHeight: bn14(coin.daHeight),
4190
+ daHeight: bn15(coin.daHeight),
4106
4191
  sender: Address2.fromAddressOrString(coin.sender),
4107
4192
  recipient: Address2.fromAddressOrString(coin.recipient),
4108
4193
  nonce: coin.nonce
@@ -4110,12 +4195,12 @@ var _Provider = class {
4110
4195
  case "Coin":
4111
4196
  return {
4112
4197
  id: coin.utxoId,
4113
- amount: bn14(coin.amount),
4198
+ amount: bn15(coin.amount),
4114
4199
  assetId: coin.assetId,
4115
4200
  owner: Address2.fromAddressOrString(coin.owner),
4116
- maturity: bn14(coin.maturity).toNumber(),
4117
- blockCreated: bn14(coin.blockCreated),
4118
- txCreatedIdx: bn14(coin.txCreatedIdx)
4201
+ maturity: bn15(coin.maturity).toNumber(),
4202
+ blockCreated: bn15(coin.blockCreated),
4203
+ txCreatedIdx: bn15(coin.txCreatedIdx)
4119
4204
  };
4120
4205
  default:
4121
4206
  return null;
@@ -4132,13 +4217,13 @@ var _Provider = class {
4132
4217
  async getBlock(idOrHeight) {
4133
4218
  let variables;
4134
4219
  if (typeof idOrHeight === "number") {
4135
- variables = { height: bn14(idOrHeight).toString(10) };
4220
+ variables = { height: bn15(idOrHeight).toString(10) };
4136
4221
  } else if (idOrHeight === "latest") {
4137
4222
  variables = { height: (await this.getBlockNumber()).toString(10) };
4138
4223
  } else if (idOrHeight.length === 66) {
4139
4224
  variables = { blockId: idOrHeight };
4140
4225
  } else {
4141
- variables = { blockId: bn14(idOrHeight).toString(10) };
4226
+ variables = { blockId: bn15(idOrHeight).toString(10) };
4142
4227
  }
4143
4228
  const { block } = await this.operations.getBlock(variables);
4144
4229
  if (!block) {
@@ -4146,7 +4231,7 @@ var _Provider = class {
4146
4231
  }
4147
4232
  return {
4148
4233
  id: block.id,
4149
- height: bn14(block.header.height),
4234
+ height: bn15(block.header.height),
4150
4235
  time: block.header.time,
4151
4236
  transactionIds: block.transactions.map((tx) => tx.id)
4152
4237
  };
@@ -4161,7 +4246,7 @@ var _Provider = class {
4161
4246
  const { blocks: fetchedData } = await this.operations.getBlocks(params);
4162
4247
  const blocks = fetchedData.edges.map(({ node: block }) => ({
4163
4248
  id: block.id,
4164
- height: bn14(block.header.height),
4249
+ height: bn15(block.header.height),
4165
4250
  time: block.header.time,
4166
4251
  transactionIds: block.transactions.map((tx) => tx.id)
4167
4252
  }));
@@ -4176,7 +4261,7 @@ var _Provider = class {
4176
4261
  async getBlockWithTransactions(idOrHeight) {
4177
4262
  let variables;
4178
4263
  if (typeof idOrHeight === "number") {
4179
- variables = { blockHeight: bn14(idOrHeight).toString(10) };
4264
+ variables = { blockHeight: bn15(idOrHeight).toString(10) };
4180
4265
  } else if (idOrHeight === "latest") {
4181
4266
  variables = { blockHeight: (await this.getBlockNumber()).toString() };
4182
4267
  } else {
@@ -4188,7 +4273,7 @@ var _Provider = class {
4188
4273
  }
4189
4274
  return {
4190
4275
  id: block.id,
4191
- height: bn14(block.header.height, 10),
4276
+ height: bn15(block.header.height, 10),
4192
4277
  time: block.header.time,
4193
4278
  transactionIds: block.transactions.map((tx) => tx.id),
4194
4279
  transactions: block.transactions.map(
@@ -4237,7 +4322,7 @@ var _Provider = class {
4237
4322
  contract: Address2.fromAddressOrString(contractId).toB256(),
4238
4323
  asset: hexlify12(assetId)
4239
4324
  });
4240
- return bn14(contractBalance.amount, 10);
4325
+ return bn15(contractBalance.amount, 10);
4241
4326
  }
4242
4327
  /**
4243
4328
  * Returns the balance for the given owner for the given asset ID.
@@ -4251,7 +4336,7 @@ var _Provider = class {
4251
4336
  owner: Address2.fromAddressOrString(owner).toB256(),
4252
4337
  assetId: hexlify12(assetId)
4253
4338
  });
4254
- return bn14(balance.amount, 10);
4339
+ return bn15(balance.amount, 10);
4255
4340
  }
4256
4341
  /**
4257
4342
  * Returns balances for the given owner.
@@ -4269,7 +4354,7 @@ var _Provider = class {
4269
4354
  const balances = result.balances.edges.map((edge) => edge.node);
4270
4355
  return balances.map((balance) => ({
4271
4356
  assetId: balance.assetId,
4272
- amount: bn14(balance.amount)
4357
+ amount: bn15(balance.amount)
4273
4358
  }));
4274
4359
  }
4275
4360
  /**
@@ -4291,15 +4376,15 @@ var _Provider = class {
4291
4376
  sender: message.sender,
4292
4377
  recipient: message.recipient,
4293
4378
  nonce: message.nonce,
4294
- amount: bn14(message.amount),
4379
+ amount: bn15(message.amount),
4295
4380
  data: message.data
4296
4381
  }),
4297
4382
  sender: Address2.fromAddressOrString(message.sender),
4298
4383
  recipient: Address2.fromAddressOrString(message.recipient),
4299
4384
  nonce: message.nonce,
4300
- amount: bn14(message.amount),
4385
+ amount: bn15(message.amount),
4301
4386
  data: InputMessageCoder.decodeData(message.data),
4302
- daHeight: bn14(message.daHeight)
4387
+ daHeight: bn15(message.daHeight)
4303
4388
  }));
4304
4389
  }
4305
4390
  /**
@@ -4317,8 +4402,8 @@ var _Provider = class {
4317
4402
  nonce
4318
4403
  };
4319
4404
  if (commitBlockId && commitBlockHeight) {
4320
- throw new FuelError12(
4321
- ErrorCode12.INVALID_INPUT_PARAMETERS,
4405
+ throw new FuelError13(
4406
+ ErrorCode13.INVALID_INPUT_PARAMETERS,
4322
4407
  "commitBlockId and commitBlockHeight cannot be used together"
4323
4408
  );
4324
4409
  }
@@ -4352,41 +4437,41 @@ var _Provider = class {
4352
4437
  } = result.messageProof;
4353
4438
  return {
4354
4439
  messageProof: {
4355
- proofIndex: bn14(messageProof.proofIndex),
4440
+ proofIndex: bn15(messageProof.proofIndex),
4356
4441
  proofSet: messageProof.proofSet
4357
4442
  },
4358
4443
  blockProof: {
4359
- proofIndex: bn14(blockProof.proofIndex),
4444
+ proofIndex: bn15(blockProof.proofIndex),
4360
4445
  proofSet: blockProof.proofSet
4361
4446
  },
4362
4447
  messageBlockHeader: {
4363
4448
  id: messageBlockHeader.id,
4364
- daHeight: bn14(messageBlockHeader.daHeight),
4365
- transactionsCount: bn14(messageBlockHeader.transactionsCount),
4449
+ daHeight: bn15(messageBlockHeader.daHeight),
4450
+ transactionsCount: bn15(messageBlockHeader.transactionsCount),
4366
4451
  transactionsRoot: messageBlockHeader.transactionsRoot,
4367
- height: bn14(messageBlockHeader.height),
4452
+ height: bn15(messageBlockHeader.height),
4368
4453
  prevRoot: messageBlockHeader.prevRoot,
4369
4454
  time: messageBlockHeader.time,
4370
4455
  applicationHash: messageBlockHeader.applicationHash,
4371
4456
  messageReceiptRoot: messageBlockHeader.messageReceiptRoot,
4372
- messageReceiptCount: bn14(messageBlockHeader.messageReceiptCount)
4457
+ messageReceiptCount: bn15(messageBlockHeader.messageReceiptCount)
4373
4458
  },
4374
4459
  commitBlockHeader: {
4375
4460
  id: commitBlockHeader.id,
4376
- daHeight: bn14(commitBlockHeader.daHeight),
4377
- transactionsCount: bn14(commitBlockHeader.transactionsCount),
4461
+ daHeight: bn15(commitBlockHeader.daHeight),
4462
+ transactionsCount: bn15(commitBlockHeader.transactionsCount),
4378
4463
  transactionsRoot: commitBlockHeader.transactionsRoot,
4379
- height: bn14(commitBlockHeader.height),
4464
+ height: bn15(commitBlockHeader.height),
4380
4465
  prevRoot: commitBlockHeader.prevRoot,
4381
4466
  time: commitBlockHeader.time,
4382
4467
  applicationHash: commitBlockHeader.applicationHash,
4383
4468
  messageReceiptRoot: commitBlockHeader.messageReceiptRoot,
4384
- messageReceiptCount: bn14(commitBlockHeader.messageReceiptCount)
4469
+ messageReceiptCount: bn15(commitBlockHeader.messageReceiptCount)
4385
4470
  },
4386
4471
  sender: Address2.fromAddressOrString(sender),
4387
4472
  recipient: Address2.fromAddressOrString(recipient),
4388
4473
  nonce,
4389
- amount: bn14(amount),
4474
+ amount: bn15(amount),
4390
4475
  data
4391
4476
  };
4392
4477
  }
@@ -4409,10 +4494,10 @@ var _Provider = class {
4409
4494
  */
4410
4495
  async produceBlocks(amount, startTime) {
4411
4496
  const { produceBlocks: latestBlockHeight } = await this.operations.produceBlocks({
4412
- blocksToProduce: bn14(amount).toString(10),
4497
+ blocksToProduce: bn15(amount).toString(10),
4413
4498
  startTimestamp: startTime ? DateTime2.fromUnixMilliseconds(startTime).toTai64() : void 0
4414
4499
  });
4415
- return bn14(latestBlockHeight);
4500
+ return bn15(latestBlockHeight);
4416
4501
  }
4417
4502
  // eslint-disable-next-line @typescript-eslint/require-await
4418
4503
  async getTransactionResponse(transactionId) {
@@ -4435,8 +4520,8 @@ __publicField(Provider, "chainInfoCache", {});
4435
4520
  __publicField(Provider, "nodeInfoCache", {});
4436
4521
 
4437
4522
  // 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";
4523
+ import { ErrorCode as ErrorCode14, FuelError as FuelError14 } from "@fuel-ts/errors";
4524
+ import { bn as bn16 } from "@fuel-ts/math";
4440
4525
  import { TransactionCoder as TransactionCoder6 } from "@fuel-ts/transactions";
4441
4526
  import { arrayify as arrayify12 } from "@fuel-ts/utils";
4442
4527
  async function getTransactionSummary(params) {
@@ -4445,8 +4530,8 @@ async function getTransactionSummary(params) {
4445
4530
  transactionId: id
4446
4531
  });
4447
4532
  if (!gqlTransaction) {
4448
- throw new FuelError13(
4449
- ErrorCode13.TRANSACTION_NOT_FOUND,
4533
+ throw new FuelError14(
4534
+ ErrorCode14.TRANSACTION_NOT_FOUND,
4450
4535
  `Transaction not found for given id: ${id}.`
4451
4536
  );
4452
4537
  }
@@ -4464,8 +4549,8 @@ async function getTransactionSummary(params) {
4464
4549
  transaction: decodedTransaction,
4465
4550
  transactionBytes: arrayify12(gqlTransaction.rawPayload),
4466
4551
  gqlTransactionStatus: gqlTransaction.status,
4467
- gasPerByte: bn15(gasPerByte),
4468
- gasPriceFactor: bn15(gasPriceFactor),
4552
+ gasPerByte: bn16(gasPerByte),
4553
+ gasPriceFactor: bn16(gasPriceFactor),
4469
4554
  abiMap,
4470
4555
  maxInputs,
4471
4556
  gasCosts
@@ -4719,7 +4804,7 @@ var Account = class extends AbstractAccount {
4719
4804
  */
4720
4805
  get provider() {
4721
4806
  if (!this._provider) {
4722
- throw new FuelError14(ErrorCode14.MISSING_PROVIDER, "Provider not set");
4807
+ throw new FuelError15(ErrorCode15.MISSING_PROVIDER, "Provider not set");
4723
4808
  }
4724
4809
  return this._provider;
4725
4810
  }
@@ -4771,8 +4856,8 @@ var Account = class extends AbstractAccount {
4771
4856
  if (!hasNextPage) {
4772
4857
  break;
4773
4858
  }
4774
- throw new FuelError14(
4775
- ErrorCode14.NOT_SUPPORTED,
4859
+ throw new FuelError15(
4860
+ ErrorCode15.NOT_SUPPORTED,
4776
4861
  `Wallets containing more than ${pageSize} coins exceed the current supported limit.`
4777
4862
  );
4778
4863
  }
@@ -4797,8 +4882,8 @@ var Account = class extends AbstractAccount {
4797
4882
  if (!hasNextPage) {
4798
4883
  break;
4799
4884
  }
4800
- throw new FuelError14(
4801
- ErrorCode14.NOT_SUPPORTED,
4885
+ throw new FuelError15(
4886
+ ErrorCode15.NOT_SUPPORTED,
4802
4887
  `Wallets containing more than ${pageSize} messages exceed the current supported limit.`
4803
4888
  );
4804
4889
  }
@@ -4833,8 +4918,8 @@ var Account = class extends AbstractAccount {
4833
4918
  if (!hasNextPage) {
4834
4919
  break;
4835
4920
  }
4836
- throw new FuelError14(
4837
- ErrorCode14.NOT_SUPPORTED,
4921
+ throw new FuelError15(
4922
+ ErrorCode15.NOT_SUPPORTED,
4838
4923
  `Wallets containing more than ${pageSize} balances exceed the current supported limit.`
4839
4924
  );
4840
4925
  }
@@ -4850,7 +4935,7 @@ var Account = class extends AbstractAccount {
4850
4935
  */
4851
4936
  async fund(request, coinQuantities, fee) {
4852
4937
  const updatedQuantities = addAmountToAsset({
4853
- amount: bn16(fee),
4938
+ amount: bn17(fee),
4854
4939
  assetId: BaseAssetId3,
4855
4940
  coinQuantities
4856
4941
  });
@@ -4858,7 +4943,7 @@ var Account = class extends AbstractAccount {
4858
4943
  updatedQuantities.forEach(({ amount, assetId }) => {
4859
4944
  quantitiesDict[assetId] = {
4860
4945
  required: amount,
4861
- owned: bn16(0)
4946
+ owned: bn17(0)
4862
4947
  };
4863
4948
  });
4864
4949
  const cachedUtxos = [];
@@ -4871,7 +4956,7 @@ var Account = class extends AbstractAccount {
4871
4956
  if (isCoin2) {
4872
4957
  const assetId = String(input.assetId);
4873
4958
  if (input.owner === owner && quantitiesDict[assetId]) {
4874
- const amount = bn16(input.amount);
4959
+ const amount = bn17(input.amount);
4875
4960
  quantitiesDict[assetId].owned = quantitiesDict[assetId].owned.add(amount);
4876
4961
  cachedUtxos.push(input.id);
4877
4962
  }
@@ -4917,8 +5002,8 @@ var Account = class extends AbstractAccount {
4917
5002
  estimateTxDependencies: true,
4918
5003
  resourcesOwner: this
4919
5004
  });
4920
- request.gasPrice = bn16(txParams.gasPrice ?? minGasPrice);
4921
- request.gasLimit = bn16(txParams.gasLimit ?? gasUsed);
5005
+ request.gasPrice = bn17(txParams.gasPrice ?? minGasPrice);
5006
+ request.gasLimit = bn17(txParams.gasLimit ?? gasUsed);
4922
5007
  this.validateGas({
4923
5008
  gasUsed,
4924
5009
  gasPrice: request.gasPrice,
@@ -4939,9 +5024,9 @@ var Account = class extends AbstractAccount {
4939
5024
  * @returns A promise that resolves to the transaction response.
4940
5025
  */
4941
5026
  async transfer(destination, amount, assetId = BaseAssetId3, txParams = {}) {
4942
- if (bn16(amount).lte(0)) {
4943
- throw new FuelError14(
4944
- ErrorCode14.INVALID_TRANSFER_AMOUNT,
5027
+ if (bn17(amount).lte(0)) {
5028
+ throw new FuelError15(
5029
+ ErrorCode15.INVALID_TRANSFER_AMOUNT,
4945
5030
  "Transfer amount must be a positive number."
4946
5031
  );
4947
5032
  }
@@ -4958,9 +5043,9 @@ var Account = class extends AbstractAccount {
4958
5043
  * @returns A promise that resolves to the transaction response.
4959
5044
  */
4960
5045
  async transferToContract(contractId, amount, assetId = BaseAssetId3, txParams = {}) {
4961
- if (bn16(amount).lte(0)) {
4962
- throw new FuelError14(
4963
- ErrorCode14.INVALID_TRANSFER_AMOUNT,
5046
+ if (bn17(amount).lte(0)) {
5047
+ throw new FuelError15(
5048
+ ErrorCode15.INVALID_TRANSFER_AMOUNT,
4964
5049
  "Transfer amount must be a positive number."
4965
5050
  );
4966
5051
  }
@@ -4969,7 +5054,7 @@ var Account = class extends AbstractAccount {
4969
5054
  const params = { gasPrice: minGasPrice, ...txParams };
4970
5055
  const { script, scriptData } = await assembleTransferToContractScript({
4971
5056
  hexlifiedContractId: contractAddress.toB256(),
4972
- amountToTransfer: bn16(amount),
5057
+ amountToTransfer: bn17(amount),
4973
5058
  assetId
4974
5059
  });
4975
5060
  const request = new ScriptTransactionRequest({
@@ -4980,9 +5065,9 @@ var Account = class extends AbstractAccount {
4980
5065
  request.addContractInputAndOutput(contractAddress);
4981
5066
  const { maxFee, requiredQuantities, gasUsed } = await this.provider.getTransactionCost(
4982
5067
  request,
4983
- [{ amount: bn16(amount), assetId: String(assetId) }]
5068
+ [{ amount: bn17(amount), assetId: String(assetId) }]
4984
5069
  );
4985
- request.gasLimit = bn16(params.gasLimit ?? gasUsed);
5070
+ request.gasLimit = bn17(params.gasLimit ?? gasUsed);
4986
5071
  this.validateGas({
4987
5072
  gasUsed,
4988
5073
  gasPrice: request.gasPrice,
@@ -5007,7 +5092,7 @@ var Account = class extends AbstractAccount {
5007
5092
  "0x".concat(recipientAddress.toHexString().substring(2).padStart(64, "0"))
5008
5093
  );
5009
5094
  const amountDataArray = arrayify14(
5010
- "0x".concat(bn16(amount).toHex().substring(2).padStart(16, "0"))
5095
+ "0x".concat(bn17(amount).toHex().substring(2).padStart(16, "0"))
5011
5096
  );
5012
5097
  const script = new Uint8Array([
5013
5098
  ...arrayify14(withdrawScript.bytes),
@@ -5016,12 +5101,12 @@ var Account = class extends AbstractAccount {
5016
5101
  ]);
5017
5102
  const params = { script, gasPrice: minGasPrice, ...txParams };
5018
5103
  const request = new ScriptTransactionRequest(params);
5019
- const forwardingQuantities = [{ amount: bn16(amount), assetId: BaseAssetId3 }];
5104
+ const forwardingQuantities = [{ amount: bn17(amount), assetId: BaseAssetId3 }];
5020
5105
  const { requiredQuantities, maxFee, gasUsed } = await this.provider.getTransactionCost(
5021
5106
  request,
5022
5107
  forwardingQuantities
5023
5108
  );
5024
- request.gasLimit = bn16(params.gasLimit ?? gasUsed);
5109
+ request.gasLimit = bn17(params.gasLimit ?? gasUsed);
5025
5110
  this.validateGas({
5026
5111
  gasUsed,
5027
5112
  gasPrice: request.gasPrice,
@@ -5033,7 +5118,7 @@ var Account = class extends AbstractAccount {
5033
5118
  }
5034
5119
  async signMessage(message) {
5035
5120
  if (!this._connector) {
5036
- throw new FuelError14(ErrorCode14.MISSING_CONNECTOR, "A connector is required to sign messages.");
5121
+ throw new FuelError15(ErrorCode15.MISSING_CONNECTOR, "A connector is required to sign messages.");
5037
5122
  }
5038
5123
  return this._connector.signMessage(this.address.toString(), message);
5039
5124
  }
@@ -5045,8 +5130,8 @@ var Account = class extends AbstractAccount {
5045
5130
  */
5046
5131
  async signTransaction(transactionRequestLike) {
5047
5132
  if (!this._connector) {
5048
- throw new FuelError14(
5049
- ErrorCode14.MISSING_CONNECTOR,
5133
+ throw new FuelError15(
5134
+ ErrorCode15.MISSING_CONNECTOR,
5050
5135
  "A connector is required to sign transactions."
5051
5136
  );
5052
5137
  }
@@ -5093,14 +5178,14 @@ var Account = class extends AbstractAccount {
5093
5178
  minGasPrice
5094
5179
  }) {
5095
5180
  if (minGasPrice.gt(gasPrice)) {
5096
- throw new FuelError14(
5097
- ErrorCode14.GAS_PRICE_TOO_LOW,
5181
+ throw new FuelError15(
5182
+ ErrorCode15.GAS_PRICE_TOO_LOW,
5098
5183
  `Gas price '${gasPrice}' is lower than the required: '${minGasPrice}'.`
5099
5184
  );
5100
5185
  }
5101
5186
  if (gasUsed.gt(gasLimit)) {
5102
- throw new FuelError14(
5103
- ErrorCode14.GAS_LIMIT_TOO_LOW,
5187
+ throw new FuelError15(
5188
+ ErrorCode15.GAS_LIMIT_TOO_LOW,
5104
5189
  `Gas limit '${gasLimit}' is lower than the required: '${gasUsed}'.`
5105
5190
  );
5106
5191
  }
@@ -5231,7 +5316,7 @@ import {
5231
5316
  decryptJsonWalletData,
5232
5317
  encryptJsonWalletData
5233
5318
  } from "@fuel-ts/crypto";
5234
- import { ErrorCode as ErrorCode15, FuelError as FuelError15 } from "@fuel-ts/errors";
5319
+ import { ErrorCode as ErrorCode16, FuelError as FuelError16 } from "@fuel-ts/errors";
5235
5320
  import { hexlify as hexlify14 } from "@fuel-ts/utils";
5236
5321
  import { v4 as uuidv4 } from "uuid";
5237
5322
  var DEFAULT_KDF_PARAMS_LOG_N = 13;
@@ -5309,8 +5394,8 @@ async function decryptKeystoreWallet(jsonWallet, password) {
5309
5394
  const macHashUint8Array = keccak256(data);
5310
5395
  const macHash = stringFromBuffer(macHashUint8Array, "hex");
5311
5396
  if (mac !== macHash) {
5312
- throw new FuelError15(
5313
- ErrorCode15.INVALID_PASSWORD,
5397
+ throw new FuelError16(
5398
+ ErrorCode16.INVALID_PASSWORD,
5314
5399
  "Failed to decrypt the keystore wallet, the provided password is incorrect."
5315
5400
  );
5316
5401
  }
@@ -5432,15 +5517,15 @@ var BaseWalletUnlocked = class extends Account {
5432
5517
  __publicField(BaseWalletUnlocked, "defaultPath", "m/44'/1179993420'/0'/0/0");
5433
5518
 
5434
5519
  // src/hdwallet/hdwallet.ts
5435
- import { ErrorCode as ErrorCode18, FuelError as FuelError18 } from "@fuel-ts/errors";
5520
+ import { ErrorCode as ErrorCode19, FuelError as FuelError19 } from "@fuel-ts/errors";
5436
5521
  import { sha256 as sha2564 } from "@fuel-ts/hasher";
5437
- import { bn as bn17, toBytes as toBytes2, toHex } from "@fuel-ts/math";
5522
+ import { bn as bn18, toBytes as toBytes2, toHex } from "@fuel-ts/math";
5438
5523
  import { arrayify as arrayify18, hexlify as hexlify17, concat as concat5 } from "@fuel-ts/utils";
5439
5524
  import { toBeHex, dataSlice as dataSlice2, encodeBase58 as encodeBase582, decodeBase58, computeHmac as computeHmac2, ripemd160 } from "ethers";
5440
5525
 
5441
5526
  // src/mnemonic/mnemonic.ts
5442
5527
  import { randomBytes as randomBytes3 } from "@fuel-ts/crypto";
5443
- import { ErrorCode as ErrorCode17, FuelError as FuelError17 } from "@fuel-ts/errors";
5528
+ import { ErrorCode as ErrorCode18, FuelError as FuelError18 } from "@fuel-ts/errors";
5444
5529
  import { sha256 as sha2563 } from "@fuel-ts/hasher";
5445
5530
  import { arrayify as arrayify17, hexlify as hexlify16, concat as concat4 } from "@fuel-ts/utils";
5446
5531
  import { dataSlice, pbkdf2, computeHmac, encodeBase58 } from "ethers";
@@ -7504,7 +7589,7 @@ var Language = /* @__PURE__ */ ((Language2) => {
7504
7589
  })(Language || {});
7505
7590
 
7506
7591
  // src/mnemonic/utils.ts
7507
- import { ErrorCode as ErrorCode16, FuelError as FuelError16 } from "@fuel-ts/errors";
7592
+ import { ErrorCode as ErrorCode17, FuelError as FuelError17 } from "@fuel-ts/errors";
7508
7593
  import { sha256 as sha2562 } from "@fuel-ts/hasher";
7509
7594
  import { arrayify as arrayify16 } from "@fuel-ts/utils";
7510
7595
  function toUtf8Bytes(stri) {
@@ -7521,8 +7606,8 @@ function toUtf8Bytes(stri) {
7521
7606
  i += 1;
7522
7607
  const c2 = str.charCodeAt(i);
7523
7608
  if (i >= str.length || (c2 & 64512) !== 56320) {
7524
- throw new FuelError16(
7525
- ErrorCode16.INVALID_INPUT_PARAMETERS,
7609
+ throw new FuelError17(
7610
+ ErrorCode17.INVALID_INPUT_PARAMETERS,
7526
7611
  "Invalid UTF-8 in the input string."
7527
7612
  );
7528
7613
  }
@@ -7585,8 +7670,8 @@ function mnemonicWordsToEntropy(words, wordlist) {
7585
7670
  for (let i = 0; i < words.length; i += 1) {
7586
7671
  const index = wordlist.indexOf(words[i].normalize("NFKD"));
7587
7672
  if (index === -1) {
7588
- throw new FuelError16(
7589
- ErrorCode16.INVALID_MNEMONIC,
7673
+ throw new FuelError17(
7674
+ ErrorCode17.INVALID_MNEMONIC,
7590
7675
  `Invalid mnemonic: the word '${words[i]}' is not found in the provided wordlist.`
7591
7676
  );
7592
7677
  }
@@ -7602,8 +7687,8 @@ function mnemonicWordsToEntropy(words, wordlist) {
7602
7687
  const checksumMask = getUpperMask(checksumBits);
7603
7688
  const checksum = arrayify16(sha2562(entropy.slice(0, entropyBits / 8)))[0] & checksumMask;
7604
7689
  if (checksum !== (entropy[entropy.length - 1] & checksumMask)) {
7605
- throw new FuelError16(
7606
- ErrorCode16.INVALID_CHECKSUM,
7690
+ throw new FuelError17(
7691
+ ErrorCode17.INVALID_CHECKSUM,
7607
7692
  "Checksum validation failed for the provided mnemonic."
7608
7693
  );
7609
7694
  }
@@ -7617,16 +7702,16 @@ var TestnetPRV = "0x04358394";
7617
7702
  var MNEMONIC_SIZES = [12, 15, 18, 21, 24];
7618
7703
  function assertWordList(wordlist) {
7619
7704
  if (wordlist.length !== 2048) {
7620
- throw new FuelError17(
7621
- ErrorCode17.INVALID_WORD_LIST,
7705
+ throw new FuelError18(
7706
+ ErrorCode18.INVALID_WORD_LIST,
7622
7707
  `Expected word list length of 2048, but got ${wordlist.length}.`
7623
7708
  );
7624
7709
  }
7625
7710
  }
7626
7711
  function assertEntropy(entropy) {
7627
7712
  if (entropy.length % 4 !== 0 || entropy.length < 16 || entropy.length > 32) {
7628
- throw new FuelError17(
7629
- ErrorCode17.INVALID_ENTROPY,
7713
+ throw new FuelError18(
7714
+ ErrorCode18.INVALID_ENTROPY,
7630
7715
  `Entropy should be between 16 and 32 bytes and a multiple of 4, but got ${entropy.length} bytes.`
7631
7716
  );
7632
7717
  }
@@ -7636,7 +7721,7 @@ function assertMnemonic(words) {
7636
7721
  const errorMsg = `Invalid mnemonic size. Expected one of [${MNEMONIC_SIZES.join(
7637
7722
  ", "
7638
7723
  )}] words, but got ${words.length}.`;
7639
- throw new FuelError17(ErrorCode17.INVALID_MNEMONIC, errorMsg);
7724
+ throw new FuelError18(ErrorCode18.INVALID_MNEMONIC, errorMsg);
7640
7725
  }
7641
7726
  }
7642
7727
  var Mnemonic = class {
@@ -7754,8 +7839,8 @@ var Mnemonic = class {
7754
7839
  static masterKeysFromSeed(seed) {
7755
7840
  const seedArray = arrayify17(seed);
7756
7841
  if (seedArray.length < 16 || seedArray.length > 64) {
7757
- throw new FuelError17(
7758
- ErrorCode17.INVALID_SEED,
7842
+ throw new FuelError18(
7843
+ ErrorCode18.INVALID_SEED,
7759
7844
  `Seed length should be between 16 and 64 bytes, but received ${seedArray.length} bytes.`
7760
7845
  );
7761
7846
  }
@@ -7832,7 +7917,7 @@ function isValidExtendedKey(extendedKey) {
7832
7917
  function parsePath(path, depth = 0) {
7833
7918
  const components = path.split("/");
7834
7919
  if (components.length === 0 || components[0] === "m" && depth !== 0) {
7835
- throw new FuelError18(ErrorCode18.HD_WALLET_ERROR, `invalid path - ${path}`);
7920
+ throw new FuelError19(ErrorCode19.HD_WALLET_ERROR, `invalid path - ${path}`);
7836
7921
  }
7837
7922
  if (components[0] === "m") {
7838
7923
  components.shift();
@@ -7861,8 +7946,8 @@ var HDWallet = class {
7861
7946
  this.privateKey = hexlify17(config.privateKey);
7862
7947
  } else {
7863
7948
  if (!config.publicKey) {
7864
- throw new FuelError18(
7865
- ErrorCode18.HD_WALLET_ERROR,
7949
+ throw new FuelError19(
7950
+ ErrorCode19.HD_WALLET_ERROR,
7866
7951
  "Both public and private Key cannot be missing. At least one should be provided."
7867
7952
  );
7868
7953
  }
@@ -7891,8 +7976,8 @@ var HDWallet = class {
7891
7976
  const data = new Uint8Array(37);
7892
7977
  if (index & HARDENED_INDEX) {
7893
7978
  if (!privateKey) {
7894
- throw new FuelError18(
7895
- ErrorCode18.HD_WALLET_ERROR,
7979
+ throw new FuelError19(
7980
+ ErrorCode19.HD_WALLET_ERROR,
7896
7981
  "Cannot derive a hardened index without a private Key."
7897
7982
  );
7898
7983
  }
@@ -7906,7 +7991,7 @@ var HDWallet = class {
7906
7991
  const IR = bytes.slice(32);
7907
7992
  if (privateKey) {
7908
7993
  const N = "0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141";
7909
- const ki = bn17(IL).add(privateKey).mod(N).toBytes(32);
7994
+ const ki = bn18(IL).add(privateKey).mod(N).toBytes(32);
7910
7995
  return new HDWallet({
7911
7996
  privateKey: ki,
7912
7997
  chainCode: IR,
@@ -7944,8 +8029,8 @@ var HDWallet = class {
7944
8029
  */
7945
8030
  toExtendedKey(isPublic = false, testnet = false) {
7946
8031
  if (this.depth >= 256) {
7947
- throw new FuelError18(
7948
- ErrorCode18.HD_WALLET_ERROR,
8032
+ throw new FuelError19(
8033
+ ErrorCode19.HD_WALLET_ERROR,
7949
8034
  `Exceeded max depth of 255. Current depth: ${this.depth}.`
7950
8035
  );
7951
8036
  }
@@ -7976,10 +8061,10 @@ var HDWallet = class {
7976
8061
  const bytes = arrayify18(decoded);
7977
8062
  const validChecksum = base58check(bytes.slice(0, 78)) === extendedKey;
7978
8063
  if (bytes.length !== 82 || !isValidExtendedKey(bytes)) {
7979
- throw new FuelError18(ErrorCode18.HD_WALLET_ERROR, "Provided key is not a valid extended key.");
8064
+ throw new FuelError19(ErrorCode19.HD_WALLET_ERROR, "Provided key is not a valid extended key.");
7980
8065
  }
7981
8066
  if (!validChecksum) {
7982
- throw new FuelError18(ErrorCode18.HD_WALLET_ERROR, "Provided key has an invalid checksum.");
8067
+ throw new FuelError19(ErrorCode19.HD_WALLET_ERROR, "Provided key has an invalid checksum.");
7983
8068
  }
7984
8069
  const depth = bytes[4];
7985
8070
  const parentFingerprint = hexlify17(bytes.slice(5, 9));
@@ -7987,14 +8072,14 @@ var HDWallet = class {
7987
8072
  const chainCode = hexlify17(bytes.slice(13, 45));
7988
8073
  const key = bytes.slice(45, 78);
7989
8074
  if (depth === 0 && parentFingerprint !== "0x00000000" || depth === 0 && index !== 0) {
7990
- throw new FuelError18(
7991
- ErrorCode18.HD_WALLET_ERROR,
8075
+ throw new FuelError19(
8076
+ ErrorCode19.HD_WALLET_ERROR,
7992
8077
  "Inconsistency detected: Depth is zero but fingerprint/index is non-zero."
7993
8078
  );
7994
8079
  }
7995
8080
  if (isPublicExtendedKey(bytes)) {
7996
8081
  if (key[0] !== 3) {
7997
- throw new FuelError18(ErrorCode18.HD_WALLET_ERROR, "Invalid public extended key.");
8082
+ throw new FuelError19(ErrorCode19.HD_WALLET_ERROR, "Invalid public extended key.");
7998
8083
  }
7999
8084
  return new HDWallet({
8000
8085
  publicKey: key,
@@ -8005,7 +8090,7 @@ var HDWallet = class {
8005
8090
  });
8006
8091
  }
8007
8092
  if (key[0] !== 0) {
8008
- throw new FuelError18(ErrorCode18.HD_WALLET_ERROR, "Invalid private extended key.");
8093
+ throw new FuelError19(ErrorCode19.HD_WALLET_ERROR, "Invalid private extended key.");
8009
8094
  }
8010
8095
  return new HDWallet({
8011
8096
  privateKey: key.slice(1),
@@ -8173,7 +8258,7 @@ __publicField(Wallet, "fromEncryptedJson", WalletUnlocked.fromEncryptedJson);
8173
8258
  // src/wallet-manager/wallet-manager.ts
8174
8259
  import { Address as Address8 } from "@fuel-ts/address";
8175
8260
  import { encrypt, decrypt } from "@fuel-ts/crypto";
8176
- import { ErrorCode as ErrorCode21, FuelError as FuelError21 } from "@fuel-ts/errors";
8261
+ import { ErrorCode as ErrorCode22, FuelError as FuelError22 } from "@fuel-ts/errors";
8177
8262
  import { EventEmitter } from "events";
8178
8263
 
8179
8264
  // src/wallet-manager/storages/memory-storage.ts
@@ -8196,7 +8281,7 @@ var MemoryStorage = class {
8196
8281
 
8197
8282
  // src/wallet-manager/vaults/mnemonic-vault.ts
8198
8283
  import { Address as Address6 } from "@fuel-ts/address";
8199
- import { ErrorCode as ErrorCode19, FuelError as FuelError19 } from "@fuel-ts/errors";
8284
+ import { ErrorCode as ErrorCode20, FuelError as FuelError20 } from "@fuel-ts/errors";
8200
8285
  var _secret;
8201
8286
  var MnemonicVault = class {
8202
8287
  constructor(options) {
@@ -8252,8 +8337,8 @@ var MnemonicVault = class {
8252
8337
  }
8253
8338
  numberOfAccounts += 1;
8254
8339
  } while (numberOfAccounts < this.numberOfAccounts);
8255
- throw new FuelError19(
8256
- ErrorCode19.WALLET_MANAGER_ERROR,
8340
+ throw new FuelError20(
8341
+ ErrorCode20.WALLET_MANAGER_ERROR,
8257
8342
  `Account with address '${address}' not found in derived wallets.`
8258
8343
  );
8259
8344
  }
@@ -8267,7 +8352,7 @@ __publicField(MnemonicVault, "type", "mnemonic");
8267
8352
 
8268
8353
  // src/wallet-manager/vaults/privatekey-vault.ts
8269
8354
  import { Address as Address7 } from "@fuel-ts/address";
8270
- import { ErrorCode as ErrorCode20, FuelError as FuelError20 } from "@fuel-ts/errors";
8355
+ import { ErrorCode as ErrorCode21, FuelError as FuelError21 } from "@fuel-ts/errors";
8271
8356
  var _privateKeys;
8272
8357
  var PrivateKeyVault = class {
8273
8358
  /**
@@ -8308,8 +8393,8 @@ var PrivateKeyVault = class {
8308
8393
  (pk) => Wallet.fromPrivateKey(pk).address.equals(ownerAddress)
8309
8394
  );
8310
8395
  if (!privateKey) {
8311
- throw new FuelError20(
8312
- ErrorCode20.WALLET_MANAGER_ERROR,
8396
+ throw new FuelError21(
8397
+ ErrorCode21.WALLET_MANAGER_ERROR,
8313
8398
  `No private key found for address '${address}'.`
8314
8399
  );
8315
8400
  }
@@ -8333,7 +8418,7 @@ var ERROR_MESSAGES = {
8333
8418
  };
8334
8419
  function assert(condition, message) {
8335
8420
  if (!condition) {
8336
- throw new FuelError21(ErrorCode21.WALLET_MANAGER_ERROR, message);
8421
+ throw new FuelError22(ErrorCode22.WALLET_MANAGER_ERROR, message);
8337
8422
  }
8338
8423
  }
8339
8424
  var _vaults, _passphrase, _isLocked, _serializeVaults, serializeVaults_fn, _deserializeVaults, deserializeVaults_fn;
@@ -8559,25 +8644,25 @@ deserializeVaults_fn = function(vaults) {
8559
8644
  __publicField(WalletManager, "Vaults", [MnemonicVault, PrivateKeyVault]);
8560
8645
 
8561
8646
  // src/wallet-manager/types.ts
8562
- import { ErrorCode as ErrorCode22, FuelError as FuelError22 } from "@fuel-ts/errors";
8647
+ import { ErrorCode as ErrorCode23, FuelError as FuelError23 } from "@fuel-ts/errors";
8563
8648
  var Vault = class {
8564
8649
  constructor(_options) {
8565
- throw new FuelError22(ErrorCode22.NOT_IMPLEMENTED, "Not implemented.");
8650
+ throw new FuelError23(ErrorCode23.NOT_IMPLEMENTED, "Not implemented.");
8566
8651
  }
8567
8652
  serialize() {
8568
- throw new FuelError22(ErrorCode22.NOT_IMPLEMENTED, "Not implemented.");
8653
+ throw new FuelError23(ErrorCode23.NOT_IMPLEMENTED, "Not implemented.");
8569
8654
  }
8570
8655
  getAccounts() {
8571
- throw new FuelError22(ErrorCode22.NOT_IMPLEMENTED, "Not implemented.");
8656
+ throw new FuelError23(ErrorCode23.NOT_IMPLEMENTED, "Not implemented.");
8572
8657
  }
8573
8658
  addAccount() {
8574
- throw new FuelError22(ErrorCode22.NOT_IMPLEMENTED, "Not implemented.");
8659
+ throw new FuelError23(ErrorCode23.NOT_IMPLEMENTED, "Not implemented.");
8575
8660
  }
8576
8661
  exportAccount(_address) {
8577
- throw new FuelError22(ErrorCode22.NOT_IMPLEMENTED, "Not implemented.");
8662
+ throw new FuelError23(ErrorCode23.NOT_IMPLEMENTED, "Not implemented.");
8578
8663
  }
8579
8664
  getWallet(_address) {
8580
- throw new FuelError22(ErrorCode22.NOT_IMPLEMENTED, "Not implemented.");
8665
+ throw new FuelError23(ErrorCode23.NOT_IMPLEMENTED, "Not implemented.");
8581
8666
  }
8582
8667
  };
8583
8668
  __publicField(Vault, "type");
@@ -8594,7 +8679,7 @@ import {
8594
8679
  } from "@fuel-ts/abi-coder";
8595
8680
  import { Address as Address9 } from "@fuel-ts/address";
8596
8681
  import { BaseAssetId as BaseAssetId4 } from "@fuel-ts/address/configs";
8597
- import { ErrorCode as ErrorCode23, FuelError as FuelError23 } from "@fuel-ts/errors";
8682
+ import { ErrorCode as ErrorCode24, FuelError as FuelError24 } from "@fuel-ts/errors";
8598
8683
  import { ByteArrayCoder, InputType as InputType7 } from "@fuel-ts/transactions";
8599
8684
  import { arrayify as arrayify20, hexlify as hexlify19 } from "@fuel-ts/utils";
8600
8685
 
@@ -8722,8 +8807,8 @@ var Predicate = class extends Account {
8722
8807
  if (jsonAbi) {
8723
8808
  abiInterface = new Interface4(jsonAbi);
8724
8809
  if (abiInterface.functions.main === void 0) {
8725
- throw new FuelError23(
8726
- ErrorCode23.ABI_MAIN_METHOD_MISSING,
8810
+ throw new FuelError24(
8811
+ ErrorCode24.ABI_MAIN_METHOD_MISSING,
8727
8812
  'Cannot use ABI without "main" function.'
8728
8813
  );
8729
8814
  }
@@ -8768,8 +8853,8 @@ var Predicate = class extends Account {
8768
8853
  mutatedBytes.set(encoded, offset);
8769
8854
  });
8770
8855
  } catch (err) {
8771
- throw new FuelError23(
8772
- ErrorCode23.INVALID_CONFIGURABLE_CONSTANTS,
8856
+ throw new FuelError24(
8857
+ ErrorCode24.INVALID_CONFIGURABLE_CONSTANTS,
8773
8858
  `Error setting configurable constants: ${err.message}.`
8774
8859
  );
8775
8860
  }
@@ -8778,7 +8863,7 @@ var Predicate = class extends Account {
8778
8863
  };
8779
8864
 
8780
8865
  // src/connectors/fuel.ts
8781
- import { ErrorCode as ErrorCode24, FuelError as FuelError24 } from "@fuel-ts/errors";
8866
+ import { ErrorCode as ErrorCode25, FuelError as FuelError25 } from "@fuel-ts/errors";
8782
8867
 
8783
8868
  // src/connectors/fuel-connector.ts
8784
8869
  import { EventEmitter as EventEmitter2 } from "events";
@@ -9411,7 +9496,7 @@ var _Fuel = class extends FuelConnector {
9411
9496
  const currentNetwork = await this.currentNetwork();
9412
9497
  provider = await Provider.create(currentNetwork.url);
9413
9498
  } else {
9414
- throw new FuelError24(ErrorCode24.INVALID_PROVIDER, "Provider is not valid.");
9499
+ throw new FuelError25(ErrorCode25.INVALID_PROVIDER, "Provider is not valid.");
9415
9500
  }
9416
9501
  return provider;
9417
9502
  }
@@ -9490,7 +9575,9 @@ export {
9490
9575
  WalletUnlocked,
9491
9576
  addAmountToAsset,
9492
9577
  addOperation,
9578
+ assemblePanicError,
9493
9579
  assembleReceiptByType,
9580
+ assembleRevertError,
9494
9581
  assembleTransactionSummary,
9495
9582
  assets,
9496
9583
  buildBlockExplorerUrl,
@@ -9505,6 +9592,7 @@ export {
9505
9592
  english,
9506
9593
  extractBurnedAssetsFromReceipts,
9507
9594
  extractMintedAssetsFromReceipts,
9595
+ extractTxError,
9508
9596
  gasUsedByInputs,
9509
9597
  getAssetEth,
9510
9598
  getAssetFuel,