@fuel-ts/account 0.0.0-rc-1895-20240328115555 → 0.0.0-rc-1964-20240328130004

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 ErrorCode15, FuelError as FuelError15 } from "@fuel-ts/errors";
33
+ import { ErrorCode as ErrorCode14, FuelError as FuelError14 } from "@fuel-ts/errors";
34
34
  import { AbstractAccount } from "@fuel-ts/interfaces";
35
- import { bn as bn17 } from "@fuel-ts/math";
35
+ import { bn as bn16 } 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 ErrorCode13, FuelError as FuelError13 } from "@fuel-ts/errors";
77
- import { BN, bn as bn15, max } from "@fuel-ts/math";
76
+ import { ErrorCode as ErrorCode12, FuelError as FuelError12 } from "@fuel-ts/errors";
77
+ import { BN, bn as bn14, 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 bn7 } from "@fuel-ts/math";
1160
+ import { bn as bn6 } from "@fuel-ts/math";
1161
1161
  import {
1162
1162
  PolicyType,
1163
1163
  TransactionCoder,
@@ -1562,76 +1562,6 @@ 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
- if (PANIC_REASONS.includes(status.reason)) {
1581
- errorMessage = `${errorMessage}
1582
-
1583
- You can read more about this error at:
1584
-
1585
- ${PANIC_DOC_URL}#variant.${status.reason}`;
1586
- }
1587
- return errorMessage;
1588
- };
1589
- var stringify = (obj) => JSON.stringify(obj, null, 2);
1590
- var assembleRevertError = (receipts, logs) => {
1591
- let errorMessage = "The transaction reverted with an unknown reason.";
1592
- const revertReceipt = receipts.find(({ type }) => type === ReceiptType3.Revert);
1593
- if (revertReceipt) {
1594
- const reasonHex = bn6(revertReceipt.val).toHex();
1595
- switch (reasonHex) {
1596
- case FAILED_REQUIRE_SIGNAL: {
1597
- errorMessage = `The transaction reverted because a "require" statement has thrown ${logs.length ? stringify(logs[0]) : "an error."}.`;
1598
- break;
1599
- }
1600
- case FAILED_ASSERT_EQ_SIGNAL: {
1601
- const sufix = logs.length >= 2 ? ` comparing ${stringify(logs[1])} and ${stringify(logs[0])}.` : ".";
1602
- errorMessage = `The transaction reverted because of an "assert_eq" statement${sufix}`;
1603
- break;
1604
- }
1605
- case FAILED_ASSERT_NE_SIGNAL: {
1606
- const sufix = logs.length >= 2 ? ` comparing ${stringify(logs[1])} and ${stringify(logs[0])}.` : ".";
1607
- errorMessage = `The transaction reverted because of an "assert_ne" statement${sufix}`;
1608
- break;
1609
- }
1610
- case FAILED_ASSERT_SIGNAL:
1611
- errorMessage = `The transaction reverted because an "assert" statement failed to evaluate to true.`;
1612
- break;
1613
- case FAILED_TRANSFER_TO_ADDRESS_SIGNAL2:
1614
- errorMessage = `The transaction reverted because it's missing an "OutputChange".`;
1615
- break;
1616
- default:
1617
- errorMessage = `The transaction reverted with an unknown reason: ${revertReceipt.val}`;
1618
- }
1619
- }
1620
- return errorMessage;
1621
- };
1622
- var extractTxError = (params) => {
1623
- const { receipts, status, logs } = params;
1624
- const isPanic = receipts.some(({ type }) => type === ReceiptType3.Panic);
1625
- let err = status?.type === "FailureStatus" && isPanic ? assemblePanicError(status) : assembleRevertError(receipts, logs);
1626
- err += `
1627
-
1628
- logs: ${JSON.stringify(logs, null, 2)}`;
1629
- err += `
1630
-
1631
- receipts: ${JSON.stringify(receipts, null, 2)}`;
1632
- return new FuelError7(ErrorCode7.SCRIPT_REVERTED, err);
1633
- };
1634
-
1635
1565
  // src/providers/transaction-request/errors.ts
1636
1566
  var ChangeOutputCollisionError = class extends Error {
1637
1567
  name = "ChangeOutputCollisionError";
@@ -1694,10 +1624,10 @@ var BaseTransactionRequest = class {
1694
1624
  outputs,
1695
1625
  witnesses
1696
1626
  } = {}) {
1697
- this.gasPrice = bn7(gasPrice);
1627
+ this.gasPrice = bn6(gasPrice);
1698
1628
  this.maturity = maturity ?? 0;
1699
- this.witnessLimit = witnessLimit ? bn7(witnessLimit) : void 0;
1700
- this.maxFee = maxFee ? bn7(maxFee) : void 0;
1629
+ this.witnessLimit = witnessLimit ? bn6(witnessLimit) : void 0;
1630
+ this.maxFee = maxFee ? bn6(maxFee) : void 0;
1701
1631
  this.inputs = inputs ?? [];
1702
1632
  this.outputs = outputs ?? [];
1703
1633
  this.witnesses = witnesses ?? [];
@@ -2127,13 +2057,13 @@ var BaseTransactionRequest = class {
2127
2057
  assetId,
2128
2058
  owner: resourcesOwner || Address.fromRandom(),
2129
2059
  maturity: 0,
2130
- blockCreated: bn7(1),
2131
- txCreatedIdx: bn7(1)
2060
+ blockCreated: bn6(1),
2061
+ txCreatedIdx: bn6(1)
2132
2062
  }
2133
2063
  ]);
2134
2064
  }
2135
2065
  };
2136
- updateAssetInput(BaseAssetId2, bn7(1e11));
2066
+ updateAssetInput(BaseAssetId2, bn6(1e11));
2137
2067
  quantities.forEach((q) => updateAssetInput(q.assetId, q.amount));
2138
2068
  }
2139
2069
  /**
@@ -2144,7 +2074,7 @@ var BaseTransactionRequest = class {
2144
2074
  */
2145
2075
  getCoinOutputsQuantities() {
2146
2076
  const coinsQuantities = this.getCoinOutputs().map(({ amount, assetId }) => ({
2147
- amount: bn7(amount),
2077
+ amount: bn6(amount),
2148
2078
  assetId: assetId.toString()
2149
2079
  }));
2150
2080
  return coinsQuantities;
@@ -2173,7 +2103,7 @@ var BaseTransactionRequest = class {
2173
2103
  default:
2174
2104
  return;
2175
2105
  }
2176
- if (correspondingInput && "predicateGasUsed" in correspondingInput && bn7(correspondingInput.predicateGasUsed).gt(0)) {
2106
+ if (correspondingInput && "predicateGasUsed" in correspondingInput && bn6(correspondingInput.predicateGasUsed).gt(0)) {
2177
2107
  i.predicate = correspondingInput.predicate;
2178
2108
  i.predicateData = correspondingInput.predicateData;
2179
2109
  i.predicateGasUsed = correspondingInput.predicateGasUsed;
@@ -2184,14 +2114,14 @@ var BaseTransactionRequest = class {
2184
2114
 
2185
2115
  // src/providers/transaction-request/create-transaction-request.ts
2186
2116
  import { ZeroBytes32 as ZeroBytes326 } from "@fuel-ts/address/configs";
2187
- import { bn as bn9 } from "@fuel-ts/math";
2117
+ import { bn as bn8 } from "@fuel-ts/math";
2188
2118
  import { TransactionType as TransactionType3, OutputType as OutputType4 } from "@fuel-ts/transactions";
2189
2119
  import { arrayify as arrayify6, hexlify as hexlify9 } from "@fuel-ts/utils";
2190
2120
 
2191
2121
  // src/providers/transaction-request/hash-transaction.ts
2192
2122
  import { ZeroBytes32 as ZeroBytes325 } from "@fuel-ts/address/configs";
2193
2123
  import { uint64ToBytesBE, sha256 } from "@fuel-ts/hasher";
2194
- import { bn as bn8 } from "@fuel-ts/math";
2124
+ import { bn as bn7 } from "@fuel-ts/math";
2195
2125
  import { TransactionType as TransactionType2, InputType as InputType3, OutputType as OutputType3, TransactionCoder as TransactionCoder2 } from "@fuel-ts/transactions";
2196
2126
  import { concat as concat2 } from "@fuel-ts/utils";
2197
2127
  import { clone as clone2 } from "ramda";
@@ -2208,11 +2138,11 @@ function hashTransaction(transactionRequest, chainId) {
2208
2138
  blockHeight: 0,
2209
2139
  txIndex: 0
2210
2140
  };
2211
- inputClone.predicateGasUsed = bn8(0);
2141
+ inputClone.predicateGasUsed = bn7(0);
2212
2142
  return inputClone;
2213
2143
  }
2214
2144
  case InputType3.Message: {
2215
- inputClone.predicateGasUsed = bn8(0);
2145
+ inputClone.predicateGasUsed = bn7(0);
2216
2146
  return inputClone;
2217
2147
  }
2218
2148
  case InputType3.Contract: {
@@ -2239,12 +2169,12 @@ function hashTransaction(transactionRequest, chainId) {
2239
2169
  return outputClone;
2240
2170
  }
2241
2171
  case OutputType3.Change: {
2242
- outputClone.amount = bn8(0);
2172
+ outputClone.amount = bn7(0);
2243
2173
  return outputClone;
2244
2174
  }
2245
2175
  case OutputType3.Variable: {
2246
2176
  outputClone.to = ZeroBytes325;
2247
- outputClone.amount = bn8(0);
2177
+ outputClone.amount = bn7(0);
2248
2178
  outputClone.assetId = ZeroBytes325;
2249
2179
  return outputClone;
2250
2180
  }
@@ -2368,7 +2298,7 @@ var CreateTransactionRequest = class extends BaseTransactionRequest {
2368
2298
  }
2369
2299
  metadataGas(gasCosts) {
2370
2300
  return calculateMetadataGasForTxCreate({
2371
- contractBytesSize: bn9(arrayify6(this.witnesses[this.bytecodeWitnessIndex] || "0x").length),
2301
+ contractBytesSize: bn8(arrayify6(this.witnesses[this.bytecodeWitnessIndex] || "0x").length),
2372
2302
  gasCosts,
2373
2303
  stateRootSize: this.storageSlots.length,
2374
2304
  txBytesSize: this.byteSize()
@@ -2380,7 +2310,7 @@ var CreateTransactionRequest = class extends BaseTransactionRequest {
2380
2310
  import { Interface } from "@fuel-ts/abi-coder";
2381
2311
  import { addressify as addressify2 } from "@fuel-ts/address";
2382
2312
  import { ZeroBytes32 as ZeroBytes327 } from "@fuel-ts/address/configs";
2383
- import { bn as bn10 } from "@fuel-ts/math";
2313
+ import { bn as bn9 } from "@fuel-ts/math";
2384
2314
  import { InputType as InputType4, OutputType as OutputType5, TransactionType as TransactionType4 } from "@fuel-ts/transactions";
2385
2315
  import { arrayify as arrayify8, hexlify as hexlify10 } from "@fuel-ts/utils";
2386
2316
 
@@ -2434,7 +2364,7 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
2434
2364
  */
2435
2365
  constructor({ script, scriptData, gasLimit, ...rest } = {}) {
2436
2366
  super(rest);
2437
- this.gasLimit = bn10(gasLimit);
2367
+ this.gasLimit = bn9(gasLimit);
2438
2368
  this.script = arrayify8(script ?? returnZeroScript.bytes);
2439
2369
  this.scriptData = arrayify8(scriptData ?? returnZeroScript.encodeScriptData());
2440
2370
  this.abis = rest.abis;
@@ -2582,7 +2512,7 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
2582
2512
  };
2583
2513
 
2584
2514
  // src/providers/transaction-request/utils.ts
2585
- import { ErrorCode as ErrorCode8, FuelError as FuelError8 } from "@fuel-ts/errors";
2515
+ import { ErrorCode as ErrorCode7, FuelError as FuelError7 } from "@fuel-ts/errors";
2586
2516
  import { TransactionType as TransactionType5 } from "@fuel-ts/transactions";
2587
2517
  var transactionRequestify = (obj) => {
2588
2518
  if (obj instanceof ScriptTransactionRequest || obj instanceof CreateTransactionRequest) {
@@ -2597,14 +2527,14 @@ var transactionRequestify = (obj) => {
2597
2527
  return CreateTransactionRequest.from(obj);
2598
2528
  }
2599
2529
  default: {
2600
- throw new FuelError8(ErrorCode8.INVALID_TRANSACTION_TYPE, `Invalid transaction type: ${type}.`);
2530
+ throw new FuelError7(ErrorCode7.INVALID_TRANSACTION_TYPE, `Invalid transaction type: ${type}.`);
2601
2531
  }
2602
2532
  }
2603
2533
  };
2604
2534
 
2605
2535
  // src/providers/transaction-response/transaction-response.ts
2606
- import { ErrorCode as ErrorCode12, FuelError as FuelError12 } from "@fuel-ts/errors";
2607
- import { bn as bn14 } from "@fuel-ts/math";
2536
+ import { ErrorCode as ErrorCode11, FuelError as FuelError11 } from "@fuel-ts/errors";
2537
+ import { bn as bn13 } from "@fuel-ts/math";
2608
2538
  import { TransactionCoder as TransactionCoder4 } from "@fuel-ts/transactions";
2609
2539
  import { arrayify as arrayify10 } from "@fuel-ts/utils";
2610
2540
 
@@ -2612,7 +2542,7 @@ import { arrayify as arrayify10 } from "@fuel-ts/utils";
2612
2542
  import { DateTime, hexlify as hexlify11 } from "@fuel-ts/utils";
2613
2543
 
2614
2544
  // src/providers/transaction-summary/calculate-transaction-fee.ts
2615
- import { bn as bn11 } from "@fuel-ts/math";
2545
+ import { bn as bn10 } from "@fuel-ts/math";
2616
2546
  import { PolicyType as PolicyType2, TransactionCoder as TransactionCoder3, TransactionType as TransactionType6 } from "@fuel-ts/transactions";
2617
2547
  import { arrayify as arrayify9 } from "@fuel-ts/utils";
2618
2548
  var calculateTransactionFee = (params) => {
@@ -2621,24 +2551,24 @@ var calculateTransactionFee = (params) => {
2621
2551
  rawPayload,
2622
2552
  consensusParameters: { gasCosts, feeParams }
2623
2553
  } = params;
2624
- const gasPerByte = bn11(feeParams.gasPerByte);
2625
- const gasPriceFactor = bn11(feeParams.gasPriceFactor);
2554
+ const gasPerByte = bn10(feeParams.gasPerByte);
2555
+ const gasPriceFactor = bn10(feeParams.gasPriceFactor);
2626
2556
  const transactionBytes = arrayify9(rawPayload);
2627
2557
  const [transaction] = new TransactionCoder3().decode(transactionBytes, 0);
2628
2558
  if (transaction.type === TransactionType6.Mint) {
2629
2559
  return {
2630
- fee: bn11(0),
2631
- minFee: bn11(0),
2632
- maxFee: bn11(0),
2633
- feeFromGasUsed: bn11(0)
2560
+ fee: bn10(0),
2561
+ minFee: bn10(0),
2562
+ maxFee: bn10(0),
2563
+ feeFromGasUsed: bn10(0)
2634
2564
  };
2635
2565
  }
2636
2566
  const { type, witnesses, inputs, policies } = transaction;
2637
- let metadataGas = bn11(0);
2638
- let gasLimit = bn11(0);
2567
+ let metadataGas = bn10(0);
2568
+ let gasLimit = bn10(0);
2639
2569
  if (type === TransactionType6.Create) {
2640
2570
  const { bytecodeWitnessIndex, storageSlots } = transaction;
2641
- const contractBytesSize = bn11(arrayify9(witnesses[bytecodeWitnessIndex].data).length);
2571
+ const contractBytesSize = bn10(arrayify9(witnesses[bytecodeWitnessIndex].data).length);
2642
2572
  metadataGas = calculateMetadataGasForTxCreate({
2643
2573
  contractBytesSize,
2644
2574
  gasCosts,
@@ -2657,12 +2587,12 @@ var calculateTransactionFee = (params) => {
2657
2587
  }
2658
2588
  const minGas = getMinGas({
2659
2589
  gasCosts,
2660
- gasPerByte: bn11(gasPerByte),
2590
+ gasPerByte: bn10(gasPerByte),
2661
2591
  inputs,
2662
2592
  metadataGas,
2663
2593
  txBytesSize: transactionBytes.length
2664
2594
  });
2665
- const gasPrice = bn11(policies.find((policy) => policy.type === PolicyType2.GasPrice)?.data);
2595
+ const gasPrice = bn10(policies.find((policy) => policy.type === PolicyType2.GasPrice)?.data);
2666
2596
  const witnessLimit = policies.find((policy) => policy.type === PolicyType2.WitnessLimit)?.data;
2667
2597
  const witnessesLength = witnesses.reduce((acc, wit) => acc + wit.dataLength, 0);
2668
2598
  const maxGas = getMaxGas({
@@ -2686,13 +2616,13 @@ var calculateTransactionFee = (params) => {
2686
2616
 
2687
2617
  // src/providers/transaction-summary/operations.ts
2688
2618
  import { ZeroBytes32 as ZeroBytes328 } from "@fuel-ts/address/configs";
2689
- import { ErrorCode as ErrorCode10, FuelError as FuelError10 } from "@fuel-ts/errors";
2690
- import { bn as bn13 } from "@fuel-ts/math";
2691
- import { ReceiptType as ReceiptType4, TransactionType as TransactionType7 } from "@fuel-ts/transactions";
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";
2692
2622
 
2693
2623
  // src/providers/transaction-summary/call.ts
2694
2624
  import { Interface as Interface2, calculateVmTxMemory } from "@fuel-ts/abi-coder";
2695
- import { bn as bn12 } from "@fuel-ts/math";
2625
+ import { bn as bn11 } from "@fuel-ts/math";
2696
2626
  var getFunctionCall = ({ abi, receipt, rawPayload, maxInputs }) => {
2697
2627
  const abiInterface = new Interface2(abi);
2698
2628
  const callFunctionSelector = receipt.param1.toHex(8);
@@ -2701,7 +2631,7 @@ var getFunctionCall = ({ abi, receipt, rawPayload, maxInputs }) => {
2701
2631
  let encodedArgs;
2702
2632
  if (functionFragment.isInputDataPointer) {
2703
2633
  if (rawPayload) {
2704
- const argsOffset = bn12(receipt.param2).sub(calculateVmTxMemory({ maxInputs: maxInputs.toNumber() })).toNumber();
2634
+ const argsOffset = bn11(receipt.param2).sub(calculateVmTxMemory({ maxInputs: maxInputs.toNumber() })).toNumber();
2705
2635
  encodedArgs = `0x${rawPayload.slice(2).slice(argsOffset * 2)}`;
2706
2636
  }
2707
2637
  } else {
@@ -2735,7 +2665,7 @@ var getFunctionCall = ({ abi, receipt, rawPayload, maxInputs }) => {
2735
2665
  };
2736
2666
 
2737
2667
  // src/providers/transaction-summary/input.ts
2738
- import { ErrorCode as ErrorCode9, FuelError as FuelError9 } from "@fuel-ts/errors";
2668
+ import { ErrorCode as ErrorCode8, FuelError as FuelError8 } from "@fuel-ts/errors";
2739
2669
  import { InputType as InputType5 } from "@fuel-ts/transactions";
2740
2670
  function getInputsByTypes(inputs, types) {
2741
2671
  return inputs.filter((i) => types.includes(i.type));
@@ -2773,8 +2703,8 @@ function getInputContractFromIndex(inputs, inputIndex) {
2773
2703
  return void 0;
2774
2704
  }
2775
2705
  if (contractInput.type !== InputType5.Contract) {
2776
- throw new FuelError9(
2777
- ErrorCode9.INVALID_TRANSACTION_INPUT,
2706
+ throw new FuelError8(
2707
+ ErrorCode8.INVALID_TRANSACTION_INPUT,
2778
2708
  `Contract input should be of type 'contract'.`
2779
2709
  );
2780
2710
  }
@@ -2862,8 +2792,8 @@ function getTransactionTypeName(transactionType) {
2862
2792
  case TransactionType7.Script:
2863
2793
  return "Script" /* Script */;
2864
2794
  default:
2865
- throw new FuelError10(
2866
- ErrorCode10.INVALID_TRANSACTION_TYPE,
2795
+ throw new FuelError9(
2796
+ ErrorCode9.INVALID_TRANSACTION_TYPE,
2867
2797
  `Invalid transaction type: ${transactionType}.`
2868
2798
  );
2869
2799
  }
@@ -2885,10 +2815,10 @@ function hasSameAssetId(a) {
2885
2815
  return (b) => a.assetId === b.assetId;
2886
2816
  }
2887
2817
  function getReceiptsCall(receipts) {
2888
- return getReceiptsByType(receipts, ReceiptType4.Call);
2818
+ return getReceiptsByType(receipts, ReceiptType3.Call);
2889
2819
  }
2890
2820
  function getReceiptsMessageOut(receipts) {
2891
- return getReceiptsByType(receipts, ReceiptType4.MessageOut);
2821
+ return getReceiptsByType(receipts, ReceiptType3.MessageOut);
2892
2822
  }
2893
2823
  var mergeAssets = (op1, op2) => {
2894
2824
  const assets1 = op1.assetsSent || [];
@@ -2901,7 +2831,7 @@ var mergeAssets = (op1, op2) => {
2901
2831
  if (!matchingAsset) {
2902
2832
  return asset1;
2903
2833
  }
2904
- const mergedAmount = bn13(asset1.amount).add(matchingAsset.amount);
2834
+ const mergedAmount = bn12(asset1.amount).add(matchingAsset.amount);
2905
2835
  return { ...asset1, amount: mergedAmount };
2906
2836
  });
2907
2837
  return mergedAssets.concat(filteredAssets);
@@ -2927,7 +2857,7 @@ function addOperation(operations, toAdd) {
2927
2857
  return allOperations;
2928
2858
  }
2929
2859
  function getReceiptsTransferOut(receipts) {
2930
- return getReceiptsByType(receipts, ReceiptType4.TransferOut);
2860
+ return getReceiptsByType(receipts, ReceiptType3.TransferOut);
2931
2861
  }
2932
2862
  function getWithdrawFromFuelOperations({
2933
2863
  inputs,
@@ -3087,11 +3017,11 @@ function getTransferOperations({
3087
3017
  });
3088
3018
  const transferReceipts = getReceiptsByType(
3089
3019
  receipts,
3090
- ReceiptType4.Transfer
3020
+ ReceiptType3.Transfer
3091
3021
  );
3092
3022
  const transferOutReceipts = getReceiptsByType(
3093
3023
  receipts,
3094
- ReceiptType4.TransferOut
3024
+ ReceiptType3.TransferOut
3095
3025
  );
3096
3026
  [...transferReceipts, ...transferOutReceipts].forEach((receipt) => {
3097
3027
  const operation = extractTransferOperationFromReceipt(receipt, contractInputs, changeOutputs);
@@ -3176,17 +3106,17 @@ function getOperations({
3176
3106
  }
3177
3107
 
3178
3108
  // src/providers/transaction-summary/receipt.ts
3179
- import { ReceiptType as ReceiptType5 } from "@fuel-ts/transactions";
3109
+ import { ReceiptType as ReceiptType4 } from "@fuel-ts/transactions";
3180
3110
  var processGqlReceipt = (gqlReceipt) => {
3181
3111
  const receipt = assembleReceiptByType(gqlReceipt);
3182
3112
  switch (receipt.type) {
3183
- case ReceiptType5.ReturnData: {
3113
+ case ReceiptType4.ReturnData: {
3184
3114
  return {
3185
3115
  ...receipt,
3186
3116
  data: gqlReceipt.data || "0x"
3187
3117
  };
3188
3118
  }
3189
- case ReceiptType5.LogData: {
3119
+ case ReceiptType4.LogData: {
3190
3120
  return {
3191
3121
  ...receipt,
3192
3122
  data: gqlReceipt.data || "0x"
@@ -3199,7 +3129,7 @@ var processGqlReceipt = (gqlReceipt) => {
3199
3129
  var extractMintedAssetsFromReceipts = (receipts) => {
3200
3130
  const mintedAssets = [];
3201
3131
  receipts.forEach((receipt) => {
3202
- if (receipt.type === ReceiptType5.Mint) {
3132
+ if (receipt.type === ReceiptType4.Mint) {
3203
3133
  mintedAssets.push({
3204
3134
  subId: receipt.subId,
3205
3135
  contractId: receipt.contractId,
@@ -3213,7 +3143,7 @@ var extractMintedAssetsFromReceipts = (receipts) => {
3213
3143
  var extractBurnedAssetsFromReceipts = (receipts) => {
3214
3144
  const burnedAssets = [];
3215
3145
  receipts.forEach((receipt) => {
3216
- if (receipt.type === ReceiptType5.Burn) {
3146
+ if (receipt.type === ReceiptType4.Burn) {
3217
3147
  burnedAssets.push({
3218
3148
  subId: receipt.subId,
3219
3149
  contractId: receipt.contractId,
@@ -3226,7 +3156,7 @@ var extractBurnedAssetsFromReceipts = (receipts) => {
3226
3156
  };
3227
3157
 
3228
3158
  // src/providers/transaction-summary/status.ts
3229
- import { ErrorCode as ErrorCode11, FuelError as FuelError11 } from "@fuel-ts/errors";
3159
+ import { ErrorCode as ErrorCode10, FuelError as FuelError10 } from "@fuel-ts/errors";
3230
3160
  var getTransactionStatusName = (gqlStatus) => {
3231
3161
  switch (gqlStatus) {
3232
3162
  case "FailureStatus":
@@ -3238,8 +3168,8 @@ var getTransactionStatusName = (gqlStatus) => {
3238
3168
  case "SqueezedOutStatus":
3239
3169
  return "squeezedout" /* squeezedout */;
3240
3170
  default:
3241
- throw new FuelError11(
3242
- ErrorCode11.INVALID_TRANSACTION_STATUS,
3171
+ throw new FuelError10(
3172
+ ErrorCode10.INVALID_TRANSACTION_STATUS,
3243
3173
  `Invalid transaction status: ${gqlStatus}.`
3244
3174
  );
3245
3175
  }
@@ -3352,12 +3282,12 @@ function assembleTransactionSummary(params) {
3352
3282
 
3353
3283
  // src/providers/transaction-response/getDecodedLogs.ts
3354
3284
  import { Interface as Interface3, BigNumberCoder } from "@fuel-ts/abi-coder";
3355
- import { ReceiptType as ReceiptType6 } from "@fuel-ts/transactions";
3285
+ import { ReceiptType as ReceiptType5 } from "@fuel-ts/transactions";
3356
3286
  function getDecodedLogs(receipts, mainAbi, externalAbis = {}) {
3357
3287
  return receipts.reduce((logs, receipt) => {
3358
- if (receipt.type === ReceiptType6.LogData || receipt.type === ReceiptType6.Log) {
3288
+ if (receipt.type === ReceiptType5.LogData || receipt.type === ReceiptType5.Log) {
3359
3289
  const interfaceToUse = new Interface3(externalAbis[receipt.id] || mainAbi);
3360
- const data = receipt.type === ReceiptType6.Log ? new BigNumberCoder("u64").encode(receipt.val0) : receipt.data;
3290
+ const data = receipt.type === ReceiptType5.Log ? new BigNumberCoder("u64").encode(receipt.val0) : receipt.data;
3361
3291
  const [decodedLog] = interfaceToUse.decodeLog(data, receipt.val1.toNumber());
3362
3292
  logs.push(decodedLog);
3363
3293
  }
@@ -3372,7 +3302,7 @@ var TransactionResponse = class {
3372
3302
  /** Current provider */
3373
3303
  provider;
3374
3304
  /** Gas used on the transaction */
3375
- gasUsed = bn14(0);
3305
+ gasUsed = bn13(0);
3376
3306
  /** The graphql Transaction with receipts object. */
3377
3307
  gqlTransaction;
3378
3308
  abis;
@@ -3477,8 +3407,8 @@ var TransactionResponse = class {
3477
3407
  });
3478
3408
  for await (const { statusChange } of subscription) {
3479
3409
  if (statusChange.type === "SqueezedOutStatus") {
3480
- throw new FuelError12(
3481
- ErrorCode12.TRANSACTION_SQUEEZED_OUT,
3410
+ throw new FuelError11(
3411
+ ErrorCode11.TRANSACTION_SQUEEZED_OUT,
3482
3412
  `Transaction Squeezed Out with reason: ${statusChange.reason}`
3483
3413
  );
3484
3414
  }
@@ -3500,26 +3430,14 @@ var TransactionResponse = class {
3500
3430
  gqlTransaction: this.gqlTransaction,
3501
3431
  ...transactionSummary
3502
3432
  };
3503
- let logs = [];
3504
3433
  if (this.abis) {
3505
- logs = getDecodedLogs(
3434
+ const logs = getDecodedLogs(
3506
3435
  transactionSummary.receipts,
3507
3436
  this.abis.main,
3508
3437
  this.abis.otherContractsAbis
3509
3438
  );
3510
3439
  transactionResult.logs = logs;
3511
3440
  }
3512
- if (transactionResult.isStatusFailure) {
3513
- const {
3514
- receipts,
3515
- gqlTransaction: { status }
3516
- } = transactionResult;
3517
- throw extractTxError({
3518
- receipts,
3519
- status,
3520
- logs
3521
- });
3522
- }
3523
3441
  return transactionResult;
3524
3442
  }
3525
3443
  /**
@@ -3528,7 +3446,14 @@ var TransactionResponse = class {
3528
3446
  * @param contractsAbiMap - The contracts ABI map.
3529
3447
  */
3530
3448
  async wait(contractsAbiMap) {
3531
- return this.waitForResult(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;
3532
3457
  }
3533
3458
  };
3534
3459
 
@@ -3590,29 +3515,29 @@ var processGqlChain = (chain) => {
3590
3515
  const { contractParams, feeParams, predicateParams, scriptParams, txParams, gasCosts } = consensusParameters;
3591
3516
  return {
3592
3517
  name,
3593
- baseChainHeight: bn15(daHeight),
3518
+ baseChainHeight: bn14(daHeight),
3594
3519
  consensusParameters: {
3595
- contractMaxSize: bn15(contractParams.contractMaxSize),
3596
- maxInputs: bn15(txParams.maxInputs),
3597
- maxOutputs: bn15(txParams.maxOutputs),
3598
- maxWitnesses: bn15(txParams.maxWitnesses),
3599
- maxGasPerTx: bn15(txParams.maxGasPerTx),
3600
- maxScriptLength: bn15(scriptParams.maxScriptLength),
3601
- maxScriptDataLength: bn15(scriptParams.maxScriptDataLength),
3602
- maxStorageSlots: bn15(contractParams.maxStorageSlots),
3603
- maxPredicateLength: bn15(predicateParams.maxPredicateLength),
3604
- maxPredicateDataLength: bn15(predicateParams.maxPredicateDataLength),
3605
- maxGasPerPredicate: bn15(predicateParams.maxGasPerPredicate),
3606
- gasPriceFactor: bn15(feeParams.gasPriceFactor),
3607
- gasPerByte: bn15(feeParams.gasPerByte),
3608
- maxMessageDataLength: bn15(predicateParams.maxMessageDataLength),
3609
- chainId: bn15(consensusParameters.chainId),
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),
3610
3535
  gasCosts
3611
3536
  },
3612
3537
  gasCosts,
3613
3538
  latestBlock: {
3614
3539
  id: latestBlock.id,
3615
- height: bn15(latestBlock.header.height),
3540
+ height: bn14(latestBlock.header.height),
3616
3541
  time: latestBlock.header.time,
3617
3542
  transactions: latestBlock.transactions.map((i) => ({
3618
3543
  id: i.id
@@ -3682,8 +3607,8 @@ var _Provider = class {
3682
3607
  getChain() {
3683
3608
  const chain = _Provider.chainInfoCache[this.url];
3684
3609
  if (!chain) {
3685
- throw new FuelError13(
3686
- ErrorCode13.CHAIN_INFO_CACHE_EMPTY,
3610
+ throw new FuelError12(
3611
+ ErrorCode12.CHAIN_INFO_CACHE_EMPTY,
3687
3612
  "Chain info cache is empty. Make sure you have called `Provider.create` to initialize the provider."
3688
3613
  );
3689
3614
  }
@@ -3695,8 +3620,8 @@ var _Provider = class {
3695
3620
  getNode() {
3696
3621
  const node = _Provider.nodeInfoCache[this.url];
3697
3622
  if (!node) {
3698
- throw new FuelError13(
3699
- ErrorCode13.NODE_INFO_CACHE_EMPTY,
3623
+ throw new FuelError12(
3624
+ ErrorCode12.NODE_INFO_CACHE_EMPTY,
3700
3625
  "Node info cache is empty. Make sure you have called `Provider.create` to initialize the provider."
3701
3626
  );
3702
3627
  }
@@ -3743,8 +3668,8 @@ var _Provider = class {
3743
3668
  static ensureClientVersionIsSupported(nodeInfo) {
3744
3669
  const { isMajorSupported, isMinorSupported, supportedVersion } = checkFuelCoreVersionCompatibility(nodeInfo.nodeVersion);
3745
3670
  if (!isMajorSupported || !isMinorSupported) {
3746
- throw new FuelError13(
3747
- FuelError13.CODES.UNSUPPORTED_FUEL_CLIENT_VERSION,
3671
+ throw new FuelError12(
3672
+ FuelError12.CODES.UNSUPPORTED_FUEL_CLIENT_VERSION,
3748
3673
  `Fuel client version: ${nodeInfo.nodeVersion}, Supported version: ${supportedVersion}`
3749
3674
  );
3750
3675
  }
@@ -3807,7 +3732,7 @@ var _Provider = class {
3807
3732
  */
3808
3733
  async getBlockNumber() {
3809
3734
  const { chain } = await this.operations.getChain();
3810
- return bn15(chain.latestBlock.header.height, 10);
3735
+ return bn14(chain.latestBlock.header.height, 10);
3811
3736
  }
3812
3737
  /**
3813
3738
  * Returns the chain information.
@@ -3817,9 +3742,9 @@ var _Provider = class {
3817
3742
  async fetchNode() {
3818
3743
  const { nodeInfo } = await this.operations.getNodeInfo();
3819
3744
  const processedNodeInfo = {
3820
- maxDepth: bn15(nodeInfo.maxDepth),
3821
- maxTx: bn15(nodeInfo.maxTx),
3822
- minGasPrice: bn15(nodeInfo.minGasPrice),
3745
+ maxDepth: bn14(nodeInfo.maxDepth),
3746
+ maxTx: bn14(nodeInfo.maxTx),
3747
+ minGasPrice: bn14(nodeInfo.minGasPrice),
3823
3748
  nodeVersion: nodeInfo.nodeVersion,
3824
3749
  utxoValidation: nodeInfo.utxoValidation,
3825
3750
  vmBacktrace: nodeInfo.vmBacktrace,
@@ -3874,8 +3799,8 @@ var _Provider = class {
3874
3799
  const subscription = this.operations.submitAndAwait({ encodedTransaction });
3875
3800
  for await (const { submitAndAwait } of subscription) {
3876
3801
  if (submitAndAwait.type === "SqueezedOutStatus") {
3877
- throw new FuelError13(
3878
- ErrorCode13.TRANSACTION_SQUEEZED_OUT,
3802
+ throw new FuelError12(
3803
+ ErrorCode12.TRANSACTION_SQUEEZED_OUT,
3879
3804
  `Transaction Squeezed Out with reason: ${submitAndAwait.reason}`
3880
3805
  );
3881
3806
  }
@@ -3942,7 +3867,7 @@ var _Provider = class {
3942
3867
  } = response;
3943
3868
  if (inputs) {
3944
3869
  inputs.forEach((input, index) => {
3945
- if ("predicateGasUsed" in input && bn15(input.predicateGasUsed).gt(0)) {
3870
+ if ("predicateGasUsed" in input && bn14(input.predicateGasUsed).gt(0)) {
3946
3871
  transactionRequest.inputs[index].predicateGasUsed = input.predicateGasUsed;
3947
3872
  }
3948
3873
  });
@@ -4055,7 +3980,7 @@ var _Provider = class {
4055
3980
  txRequestClone.fundWithFakeUtxos(allQuantities, resourcesOwner?.address);
4056
3981
  if (estimatePredicates) {
4057
3982
  if (isScriptTransaction) {
4058
- txRequestClone.gasLimit = bn15(0);
3983
+ txRequestClone.gasLimit = bn14(0);
4059
3984
  }
4060
3985
  if (resourcesOwner && "populateTransactionPredicateData" in resourcesOwner) {
4061
3986
  resourcesOwner.populateTransactionPredicateData(txRequestClone);
@@ -4071,8 +3996,8 @@ var _Provider = class {
4071
3996
  let missingContractIds = [];
4072
3997
  let outputVariables = 0;
4073
3998
  if (isScriptTransaction && estimateTxDependencies) {
4074
- txRequestClone.gasPrice = bn15(0);
4075
- txRequestClone.gasLimit = bn15(maxGasPerTx.sub(maxGas).toNumber() * 0.9);
3999
+ txRequestClone.gasPrice = bn14(0);
4000
+ txRequestClone.gasLimit = bn14(maxGasPerTx.sub(maxGas).toNumber() * 0.9);
4076
4001
  const result = await this.estimateTxDependencies(txRequestClone);
4077
4002
  receipts = result.receipts;
4078
4003
  outputVariables = result.outputVariables;
@@ -4134,11 +4059,11 @@ var _Provider = class {
4134
4059
  return coins.map((coin) => ({
4135
4060
  id: coin.utxoId,
4136
4061
  assetId: coin.assetId,
4137
- amount: bn15(coin.amount),
4062
+ amount: bn14(coin.amount),
4138
4063
  owner: Address2.fromAddressOrString(coin.owner),
4139
- maturity: bn15(coin.maturity).toNumber(),
4140
- blockCreated: bn15(coin.blockCreated),
4141
- txCreatedIdx: bn15(coin.txCreatedIdx)
4064
+ maturity: bn14(coin.maturity).toNumber(),
4065
+ blockCreated: bn14(coin.blockCreated),
4066
+ txCreatedIdx: bn14(coin.txCreatedIdx)
4142
4067
  }));
4143
4068
  }
4144
4069
  /**
@@ -4175,9 +4100,9 @@ var _Provider = class {
4175
4100
  switch (coin.__typename) {
4176
4101
  case "MessageCoin":
4177
4102
  return {
4178
- amount: bn15(coin.amount),
4103
+ amount: bn14(coin.amount),
4179
4104
  assetId: coin.assetId,
4180
- daHeight: bn15(coin.daHeight),
4105
+ daHeight: bn14(coin.daHeight),
4181
4106
  sender: Address2.fromAddressOrString(coin.sender),
4182
4107
  recipient: Address2.fromAddressOrString(coin.recipient),
4183
4108
  nonce: coin.nonce
@@ -4185,12 +4110,12 @@ var _Provider = class {
4185
4110
  case "Coin":
4186
4111
  return {
4187
4112
  id: coin.utxoId,
4188
- amount: bn15(coin.amount),
4113
+ amount: bn14(coin.amount),
4189
4114
  assetId: coin.assetId,
4190
4115
  owner: Address2.fromAddressOrString(coin.owner),
4191
- maturity: bn15(coin.maturity).toNumber(),
4192
- blockCreated: bn15(coin.blockCreated),
4193
- txCreatedIdx: bn15(coin.txCreatedIdx)
4116
+ maturity: bn14(coin.maturity).toNumber(),
4117
+ blockCreated: bn14(coin.blockCreated),
4118
+ txCreatedIdx: bn14(coin.txCreatedIdx)
4194
4119
  };
4195
4120
  default:
4196
4121
  return null;
@@ -4207,13 +4132,13 @@ var _Provider = class {
4207
4132
  async getBlock(idOrHeight) {
4208
4133
  let variables;
4209
4134
  if (typeof idOrHeight === "number") {
4210
- variables = { height: bn15(idOrHeight).toString(10) };
4135
+ variables = { height: bn14(idOrHeight).toString(10) };
4211
4136
  } else if (idOrHeight === "latest") {
4212
4137
  variables = { height: (await this.getBlockNumber()).toString(10) };
4213
4138
  } else if (idOrHeight.length === 66) {
4214
4139
  variables = { blockId: idOrHeight };
4215
4140
  } else {
4216
- variables = { blockId: bn15(idOrHeight).toString(10) };
4141
+ variables = { blockId: bn14(idOrHeight).toString(10) };
4217
4142
  }
4218
4143
  const { block } = await this.operations.getBlock(variables);
4219
4144
  if (!block) {
@@ -4221,7 +4146,7 @@ var _Provider = class {
4221
4146
  }
4222
4147
  return {
4223
4148
  id: block.id,
4224
- height: bn15(block.header.height),
4149
+ height: bn14(block.header.height),
4225
4150
  time: block.header.time,
4226
4151
  transactionIds: block.transactions.map((tx) => tx.id)
4227
4152
  };
@@ -4236,7 +4161,7 @@ var _Provider = class {
4236
4161
  const { blocks: fetchedData } = await this.operations.getBlocks(params);
4237
4162
  const blocks = fetchedData.edges.map(({ node: block }) => ({
4238
4163
  id: block.id,
4239
- height: bn15(block.header.height),
4164
+ height: bn14(block.header.height),
4240
4165
  time: block.header.time,
4241
4166
  transactionIds: block.transactions.map((tx) => tx.id)
4242
4167
  }));
@@ -4251,7 +4176,7 @@ var _Provider = class {
4251
4176
  async getBlockWithTransactions(idOrHeight) {
4252
4177
  let variables;
4253
4178
  if (typeof idOrHeight === "number") {
4254
- variables = { blockHeight: bn15(idOrHeight).toString(10) };
4179
+ variables = { blockHeight: bn14(idOrHeight).toString(10) };
4255
4180
  } else if (idOrHeight === "latest") {
4256
4181
  variables = { blockHeight: (await this.getBlockNumber()).toString() };
4257
4182
  } else {
@@ -4263,7 +4188,7 @@ var _Provider = class {
4263
4188
  }
4264
4189
  return {
4265
4190
  id: block.id,
4266
- height: bn15(block.header.height, 10),
4191
+ height: bn14(block.header.height, 10),
4267
4192
  time: block.header.time,
4268
4193
  transactionIds: block.transactions.map((tx) => tx.id),
4269
4194
  transactions: block.transactions.map(
@@ -4312,7 +4237,7 @@ var _Provider = class {
4312
4237
  contract: Address2.fromAddressOrString(contractId).toB256(),
4313
4238
  asset: hexlify12(assetId)
4314
4239
  });
4315
- return bn15(contractBalance.amount, 10);
4240
+ return bn14(contractBalance.amount, 10);
4316
4241
  }
4317
4242
  /**
4318
4243
  * Returns the balance for the given owner for the given asset ID.
@@ -4326,7 +4251,7 @@ var _Provider = class {
4326
4251
  owner: Address2.fromAddressOrString(owner).toB256(),
4327
4252
  assetId: hexlify12(assetId)
4328
4253
  });
4329
- return bn15(balance.amount, 10);
4254
+ return bn14(balance.amount, 10);
4330
4255
  }
4331
4256
  /**
4332
4257
  * Returns balances for the given owner.
@@ -4344,7 +4269,7 @@ var _Provider = class {
4344
4269
  const balances = result.balances.edges.map((edge) => edge.node);
4345
4270
  return balances.map((balance) => ({
4346
4271
  assetId: balance.assetId,
4347
- amount: bn15(balance.amount)
4272
+ amount: bn14(balance.amount)
4348
4273
  }));
4349
4274
  }
4350
4275
  /**
@@ -4366,15 +4291,15 @@ var _Provider = class {
4366
4291
  sender: message.sender,
4367
4292
  recipient: message.recipient,
4368
4293
  nonce: message.nonce,
4369
- amount: bn15(message.amount),
4294
+ amount: bn14(message.amount),
4370
4295
  data: message.data
4371
4296
  }),
4372
4297
  sender: Address2.fromAddressOrString(message.sender),
4373
4298
  recipient: Address2.fromAddressOrString(message.recipient),
4374
4299
  nonce: message.nonce,
4375
- amount: bn15(message.amount),
4300
+ amount: bn14(message.amount),
4376
4301
  data: InputMessageCoder.decodeData(message.data),
4377
- daHeight: bn15(message.daHeight)
4302
+ daHeight: bn14(message.daHeight)
4378
4303
  }));
4379
4304
  }
4380
4305
  /**
@@ -4392,8 +4317,8 @@ var _Provider = class {
4392
4317
  nonce
4393
4318
  };
4394
4319
  if (commitBlockId && commitBlockHeight) {
4395
- throw new FuelError13(
4396
- ErrorCode13.INVALID_INPUT_PARAMETERS,
4320
+ throw new FuelError12(
4321
+ ErrorCode12.INVALID_INPUT_PARAMETERS,
4397
4322
  "commitBlockId and commitBlockHeight cannot be used together"
4398
4323
  );
4399
4324
  }
@@ -4427,41 +4352,41 @@ var _Provider = class {
4427
4352
  } = result.messageProof;
4428
4353
  return {
4429
4354
  messageProof: {
4430
- proofIndex: bn15(messageProof.proofIndex),
4355
+ proofIndex: bn14(messageProof.proofIndex),
4431
4356
  proofSet: messageProof.proofSet
4432
4357
  },
4433
4358
  blockProof: {
4434
- proofIndex: bn15(blockProof.proofIndex),
4359
+ proofIndex: bn14(blockProof.proofIndex),
4435
4360
  proofSet: blockProof.proofSet
4436
4361
  },
4437
4362
  messageBlockHeader: {
4438
4363
  id: messageBlockHeader.id,
4439
- daHeight: bn15(messageBlockHeader.daHeight),
4440
- transactionsCount: bn15(messageBlockHeader.transactionsCount),
4364
+ daHeight: bn14(messageBlockHeader.daHeight),
4365
+ transactionsCount: bn14(messageBlockHeader.transactionsCount),
4441
4366
  transactionsRoot: messageBlockHeader.transactionsRoot,
4442
- height: bn15(messageBlockHeader.height),
4367
+ height: bn14(messageBlockHeader.height),
4443
4368
  prevRoot: messageBlockHeader.prevRoot,
4444
4369
  time: messageBlockHeader.time,
4445
4370
  applicationHash: messageBlockHeader.applicationHash,
4446
4371
  messageReceiptRoot: messageBlockHeader.messageReceiptRoot,
4447
- messageReceiptCount: bn15(messageBlockHeader.messageReceiptCount)
4372
+ messageReceiptCount: bn14(messageBlockHeader.messageReceiptCount)
4448
4373
  },
4449
4374
  commitBlockHeader: {
4450
4375
  id: commitBlockHeader.id,
4451
- daHeight: bn15(commitBlockHeader.daHeight),
4452
- transactionsCount: bn15(commitBlockHeader.transactionsCount),
4376
+ daHeight: bn14(commitBlockHeader.daHeight),
4377
+ transactionsCount: bn14(commitBlockHeader.transactionsCount),
4453
4378
  transactionsRoot: commitBlockHeader.transactionsRoot,
4454
- height: bn15(commitBlockHeader.height),
4379
+ height: bn14(commitBlockHeader.height),
4455
4380
  prevRoot: commitBlockHeader.prevRoot,
4456
4381
  time: commitBlockHeader.time,
4457
4382
  applicationHash: commitBlockHeader.applicationHash,
4458
4383
  messageReceiptRoot: commitBlockHeader.messageReceiptRoot,
4459
- messageReceiptCount: bn15(commitBlockHeader.messageReceiptCount)
4384
+ messageReceiptCount: bn14(commitBlockHeader.messageReceiptCount)
4460
4385
  },
4461
4386
  sender: Address2.fromAddressOrString(sender),
4462
4387
  recipient: Address2.fromAddressOrString(recipient),
4463
4388
  nonce,
4464
- amount: bn15(amount),
4389
+ amount: bn14(amount),
4465
4390
  data
4466
4391
  };
4467
4392
  }
@@ -4484,10 +4409,10 @@ var _Provider = class {
4484
4409
  */
4485
4410
  async produceBlocks(amount, startTime) {
4486
4411
  const { produceBlocks: latestBlockHeight } = await this.operations.produceBlocks({
4487
- blocksToProduce: bn15(amount).toString(10),
4412
+ blocksToProduce: bn14(amount).toString(10),
4488
4413
  startTimestamp: startTime ? DateTime2.fromUnixMilliseconds(startTime).toTai64() : void 0
4489
4414
  });
4490
- return bn15(latestBlockHeight);
4415
+ return bn14(latestBlockHeight);
4491
4416
  }
4492
4417
  // eslint-disable-next-line @typescript-eslint/require-await
4493
4418
  async getTransactionResponse(transactionId) {
@@ -4510,8 +4435,8 @@ __publicField(Provider, "chainInfoCache", {});
4510
4435
  __publicField(Provider, "nodeInfoCache", {});
4511
4436
 
4512
4437
  // src/providers/transaction-summary/get-transaction-summary.ts
4513
- import { ErrorCode as ErrorCode14, FuelError as FuelError14 } from "@fuel-ts/errors";
4514
- import { bn as bn16 } from "@fuel-ts/math";
4438
+ import { ErrorCode as ErrorCode13, FuelError as FuelError13 } from "@fuel-ts/errors";
4439
+ import { bn as bn15 } from "@fuel-ts/math";
4515
4440
  import { TransactionCoder as TransactionCoder6 } from "@fuel-ts/transactions";
4516
4441
  import { arrayify as arrayify12 } from "@fuel-ts/utils";
4517
4442
  async function getTransactionSummary(params) {
@@ -4520,8 +4445,8 @@ async function getTransactionSummary(params) {
4520
4445
  transactionId: id
4521
4446
  });
4522
4447
  if (!gqlTransaction) {
4523
- throw new FuelError14(
4524
- ErrorCode14.TRANSACTION_NOT_FOUND,
4448
+ throw new FuelError13(
4449
+ ErrorCode13.TRANSACTION_NOT_FOUND,
4525
4450
  `Transaction not found for given id: ${id}.`
4526
4451
  );
4527
4452
  }
@@ -4539,8 +4464,8 @@ async function getTransactionSummary(params) {
4539
4464
  transaction: decodedTransaction,
4540
4465
  transactionBytes: arrayify12(gqlTransaction.rawPayload),
4541
4466
  gqlTransactionStatus: gqlTransaction.status,
4542
- gasPerByte: bn16(gasPerByte),
4543
- gasPriceFactor: bn16(gasPriceFactor),
4467
+ gasPerByte: bn15(gasPerByte),
4468
+ gasPriceFactor: bn15(gasPriceFactor),
4544
4469
  abiMap,
4545
4470
  maxInputs,
4546
4471
  gasCosts
@@ -4794,7 +4719,7 @@ var Account = class extends AbstractAccount {
4794
4719
  */
4795
4720
  get provider() {
4796
4721
  if (!this._provider) {
4797
- throw new FuelError15(ErrorCode15.MISSING_PROVIDER, "Provider not set");
4722
+ throw new FuelError14(ErrorCode14.MISSING_PROVIDER, "Provider not set");
4798
4723
  }
4799
4724
  return this._provider;
4800
4725
  }
@@ -4846,8 +4771,8 @@ var Account = class extends AbstractAccount {
4846
4771
  if (!hasNextPage) {
4847
4772
  break;
4848
4773
  }
4849
- throw new FuelError15(
4850
- ErrorCode15.NOT_SUPPORTED,
4774
+ throw new FuelError14(
4775
+ ErrorCode14.NOT_SUPPORTED,
4851
4776
  `Wallets containing more than ${pageSize} coins exceed the current supported limit.`
4852
4777
  );
4853
4778
  }
@@ -4872,8 +4797,8 @@ var Account = class extends AbstractAccount {
4872
4797
  if (!hasNextPage) {
4873
4798
  break;
4874
4799
  }
4875
- throw new FuelError15(
4876
- ErrorCode15.NOT_SUPPORTED,
4800
+ throw new FuelError14(
4801
+ ErrorCode14.NOT_SUPPORTED,
4877
4802
  `Wallets containing more than ${pageSize} messages exceed the current supported limit.`
4878
4803
  );
4879
4804
  }
@@ -4908,8 +4833,8 @@ var Account = class extends AbstractAccount {
4908
4833
  if (!hasNextPage) {
4909
4834
  break;
4910
4835
  }
4911
- throw new FuelError15(
4912
- ErrorCode15.NOT_SUPPORTED,
4836
+ throw new FuelError14(
4837
+ ErrorCode14.NOT_SUPPORTED,
4913
4838
  `Wallets containing more than ${pageSize} balances exceed the current supported limit.`
4914
4839
  );
4915
4840
  }
@@ -4925,7 +4850,7 @@ var Account = class extends AbstractAccount {
4925
4850
  */
4926
4851
  async fund(request, coinQuantities, fee) {
4927
4852
  const updatedQuantities = addAmountToAsset({
4928
- amount: bn17(fee),
4853
+ amount: bn16(fee),
4929
4854
  assetId: BaseAssetId3,
4930
4855
  coinQuantities
4931
4856
  });
@@ -4933,7 +4858,7 @@ var Account = class extends AbstractAccount {
4933
4858
  updatedQuantities.forEach(({ amount, assetId }) => {
4934
4859
  quantitiesDict[assetId] = {
4935
4860
  required: amount,
4936
- owned: bn17(0)
4861
+ owned: bn16(0)
4937
4862
  };
4938
4863
  });
4939
4864
  const cachedUtxos = [];
@@ -4946,7 +4871,7 @@ var Account = class extends AbstractAccount {
4946
4871
  if (isCoin2) {
4947
4872
  const assetId = String(input.assetId);
4948
4873
  if (input.owner === owner && quantitiesDict[assetId]) {
4949
- const amount = bn17(input.amount);
4874
+ const amount = bn16(input.amount);
4950
4875
  quantitiesDict[assetId].owned = quantitiesDict[assetId].owned.add(amount);
4951
4876
  cachedUtxos.push(input.id);
4952
4877
  }
@@ -4992,8 +4917,8 @@ var Account = class extends AbstractAccount {
4992
4917
  estimateTxDependencies: true,
4993
4918
  resourcesOwner: this
4994
4919
  });
4995
- request.gasPrice = bn17(txParams.gasPrice ?? minGasPrice);
4996
- request.gasLimit = bn17(txParams.gasLimit ?? gasUsed);
4920
+ request.gasPrice = bn16(txParams.gasPrice ?? minGasPrice);
4921
+ request.gasLimit = bn16(txParams.gasLimit ?? gasUsed);
4997
4922
  this.validateGas({
4998
4923
  gasUsed,
4999
4924
  gasPrice: request.gasPrice,
@@ -5014,9 +4939,9 @@ var Account = class extends AbstractAccount {
5014
4939
  * @returns A promise that resolves to the transaction response.
5015
4940
  */
5016
4941
  async transfer(destination, amount, assetId = BaseAssetId3, txParams = {}) {
5017
- if (bn17(amount).lte(0)) {
5018
- throw new FuelError15(
5019
- ErrorCode15.INVALID_TRANSFER_AMOUNT,
4942
+ if (bn16(amount).lte(0)) {
4943
+ throw new FuelError14(
4944
+ ErrorCode14.INVALID_TRANSFER_AMOUNT,
5020
4945
  "Transfer amount must be a positive number."
5021
4946
  );
5022
4947
  }
@@ -5033,9 +4958,9 @@ var Account = class extends AbstractAccount {
5033
4958
  * @returns A promise that resolves to the transaction response.
5034
4959
  */
5035
4960
  async transferToContract(contractId, amount, assetId = BaseAssetId3, txParams = {}) {
5036
- if (bn17(amount).lte(0)) {
5037
- throw new FuelError15(
5038
- ErrorCode15.INVALID_TRANSFER_AMOUNT,
4961
+ if (bn16(amount).lte(0)) {
4962
+ throw new FuelError14(
4963
+ ErrorCode14.INVALID_TRANSFER_AMOUNT,
5039
4964
  "Transfer amount must be a positive number."
5040
4965
  );
5041
4966
  }
@@ -5044,7 +4969,7 @@ var Account = class extends AbstractAccount {
5044
4969
  const params = { gasPrice: minGasPrice, ...txParams };
5045
4970
  const { script, scriptData } = await assembleTransferToContractScript({
5046
4971
  hexlifiedContractId: contractAddress.toB256(),
5047
- amountToTransfer: bn17(amount),
4972
+ amountToTransfer: bn16(amount),
5048
4973
  assetId
5049
4974
  });
5050
4975
  const request = new ScriptTransactionRequest({
@@ -5055,9 +4980,9 @@ var Account = class extends AbstractAccount {
5055
4980
  request.addContractInputAndOutput(contractAddress);
5056
4981
  const { maxFee, requiredQuantities, gasUsed } = await this.provider.getTransactionCost(
5057
4982
  request,
5058
- [{ amount: bn17(amount), assetId: String(assetId) }]
4983
+ [{ amount: bn16(amount), assetId: String(assetId) }]
5059
4984
  );
5060
- request.gasLimit = bn17(params.gasLimit ?? gasUsed);
4985
+ request.gasLimit = bn16(params.gasLimit ?? gasUsed);
5061
4986
  this.validateGas({
5062
4987
  gasUsed,
5063
4988
  gasPrice: request.gasPrice,
@@ -5082,7 +5007,7 @@ var Account = class extends AbstractAccount {
5082
5007
  "0x".concat(recipientAddress.toHexString().substring(2).padStart(64, "0"))
5083
5008
  );
5084
5009
  const amountDataArray = arrayify14(
5085
- "0x".concat(bn17(amount).toHex().substring(2).padStart(16, "0"))
5010
+ "0x".concat(bn16(amount).toHex().substring(2).padStart(16, "0"))
5086
5011
  );
5087
5012
  const script = new Uint8Array([
5088
5013
  ...arrayify14(withdrawScript.bytes),
@@ -5091,12 +5016,12 @@ var Account = class extends AbstractAccount {
5091
5016
  ]);
5092
5017
  const params = { script, gasPrice: minGasPrice, ...txParams };
5093
5018
  const request = new ScriptTransactionRequest(params);
5094
- const forwardingQuantities = [{ amount: bn17(amount), assetId: BaseAssetId3 }];
5019
+ const forwardingQuantities = [{ amount: bn16(amount), assetId: BaseAssetId3 }];
5095
5020
  const { requiredQuantities, maxFee, gasUsed } = await this.provider.getTransactionCost(
5096
5021
  request,
5097
5022
  forwardingQuantities
5098
5023
  );
5099
- request.gasLimit = bn17(params.gasLimit ?? gasUsed);
5024
+ request.gasLimit = bn16(params.gasLimit ?? gasUsed);
5100
5025
  this.validateGas({
5101
5026
  gasUsed,
5102
5027
  gasPrice: request.gasPrice,
@@ -5108,7 +5033,7 @@ var Account = class extends AbstractAccount {
5108
5033
  }
5109
5034
  async signMessage(message) {
5110
5035
  if (!this._connector) {
5111
- throw new FuelError15(ErrorCode15.MISSING_CONNECTOR, "A connector is required to sign messages.");
5036
+ throw new FuelError14(ErrorCode14.MISSING_CONNECTOR, "A connector is required to sign messages.");
5112
5037
  }
5113
5038
  return this._connector.signMessage(this.address.toString(), message);
5114
5039
  }
@@ -5120,8 +5045,8 @@ var Account = class extends AbstractAccount {
5120
5045
  */
5121
5046
  async signTransaction(transactionRequestLike) {
5122
5047
  if (!this._connector) {
5123
- throw new FuelError15(
5124
- ErrorCode15.MISSING_CONNECTOR,
5048
+ throw new FuelError14(
5049
+ ErrorCode14.MISSING_CONNECTOR,
5125
5050
  "A connector is required to sign transactions."
5126
5051
  );
5127
5052
  }
@@ -5168,14 +5093,14 @@ var Account = class extends AbstractAccount {
5168
5093
  minGasPrice
5169
5094
  }) {
5170
5095
  if (minGasPrice.gt(gasPrice)) {
5171
- throw new FuelError15(
5172
- ErrorCode15.GAS_PRICE_TOO_LOW,
5096
+ throw new FuelError14(
5097
+ ErrorCode14.GAS_PRICE_TOO_LOW,
5173
5098
  `Gas price '${gasPrice}' is lower than the required: '${minGasPrice}'.`
5174
5099
  );
5175
5100
  }
5176
5101
  if (gasUsed.gt(gasLimit)) {
5177
- throw new FuelError15(
5178
- ErrorCode15.GAS_LIMIT_TOO_LOW,
5102
+ throw new FuelError14(
5103
+ ErrorCode14.GAS_LIMIT_TOO_LOW,
5179
5104
  `Gas limit '${gasLimit}' is lower than the required: '${gasUsed}'.`
5180
5105
  );
5181
5106
  }
@@ -5306,7 +5231,7 @@ import {
5306
5231
  decryptJsonWalletData,
5307
5232
  encryptJsonWalletData
5308
5233
  } from "@fuel-ts/crypto";
5309
- import { ErrorCode as ErrorCode16, FuelError as FuelError16 } from "@fuel-ts/errors";
5234
+ import { ErrorCode as ErrorCode15, FuelError as FuelError15 } from "@fuel-ts/errors";
5310
5235
  import { hexlify as hexlify14 } from "@fuel-ts/utils";
5311
5236
  import { v4 as uuidv4 } from "uuid";
5312
5237
  var DEFAULT_KDF_PARAMS_LOG_N = 13;
@@ -5384,8 +5309,8 @@ async function decryptKeystoreWallet(jsonWallet, password) {
5384
5309
  const macHashUint8Array = keccak256(data);
5385
5310
  const macHash = stringFromBuffer(macHashUint8Array, "hex");
5386
5311
  if (mac !== macHash) {
5387
- throw new FuelError16(
5388
- ErrorCode16.INVALID_PASSWORD,
5312
+ throw new FuelError15(
5313
+ ErrorCode15.INVALID_PASSWORD,
5389
5314
  "Failed to decrypt the keystore wallet, the provided password is incorrect."
5390
5315
  );
5391
5316
  }
@@ -5507,15 +5432,15 @@ var BaseWalletUnlocked = class extends Account {
5507
5432
  __publicField(BaseWalletUnlocked, "defaultPath", "m/44'/1179993420'/0'/0/0");
5508
5433
 
5509
5434
  // src/hdwallet/hdwallet.ts
5510
- import { ErrorCode as ErrorCode19, FuelError as FuelError19 } from "@fuel-ts/errors";
5435
+ import { ErrorCode as ErrorCode18, FuelError as FuelError18 } from "@fuel-ts/errors";
5511
5436
  import { sha256 as sha2564 } from "@fuel-ts/hasher";
5512
- import { bn as bn18, toBytes as toBytes2, toHex } from "@fuel-ts/math";
5437
+ import { bn as bn17, toBytes as toBytes2, toHex } from "@fuel-ts/math";
5513
5438
  import { arrayify as arrayify18, hexlify as hexlify17, concat as concat5 } from "@fuel-ts/utils";
5514
5439
  import { toBeHex, dataSlice as dataSlice2, encodeBase58 as encodeBase582, decodeBase58, computeHmac as computeHmac2, ripemd160 } from "ethers";
5515
5440
 
5516
5441
  // src/mnemonic/mnemonic.ts
5517
5442
  import { randomBytes as randomBytes3 } from "@fuel-ts/crypto";
5518
- import { ErrorCode as ErrorCode18, FuelError as FuelError18 } from "@fuel-ts/errors";
5443
+ import { ErrorCode as ErrorCode17, FuelError as FuelError17 } from "@fuel-ts/errors";
5519
5444
  import { sha256 as sha2563 } from "@fuel-ts/hasher";
5520
5445
  import { arrayify as arrayify17, hexlify as hexlify16, concat as concat4 } from "@fuel-ts/utils";
5521
5446
  import { dataSlice, pbkdf2, computeHmac, encodeBase58 } from "ethers";
@@ -7579,7 +7504,7 @@ var Language = /* @__PURE__ */ ((Language2) => {
7579
7504
  })(Language || {});
7580
7505
 
7581
7506
  // src/mnemonic/utils.ts
7582
- import { ErrorCode as ErrorCode17, FuelError as FuelError17 } from "@fuel-ts/errors";
7507
+ import { ErrorCode as ErrorCode16, FuelError as FuelError16 } from "@fuel-ts/errors";
7583
7508
  import { sha256 as sha2562 } from "@fuel-ts/hasher";
7584
7509
  import { arrayify as arrayify16 } from "@fuel-ts/utils";
7585
7510
  function toUtf8Bytes(stri) {
@@ -7596,8 +7521,8 @@ function toUtf8Bytes(stri) {
7596
7521
  i += 1;
7597
7522
  const c2 = str.charCodeAt(i);
7598
7523
  if (i >= str.length || (c2 & 64512) !== 56320) {
7599
- throw new FuelError17(
7600
- ErrorCode17.INVALID_INPUT_PARAMETERS,
7524
+ throw new FuelError16(
7525
+ ErrorCode16.INVALID_INPUT_PARAMETERS,
7601
7526
  "Invalid UTF-8 in the input string."
7602
7527
  );
7603
7528
  }
@@ -7660,8 +7585,8 @@ function mnemonicWordsToEntropy(words, wordlist) {
7660
7585
  for (let i = 0; i < words.length; i += 1) {
7661
7586
  const index = wordlist.indexOf(words[i].normalize("NFKD"));
7662
7587
  if (index === -1) {
7663
- throw new FuelError17(
7664
- ErrorCode17.INVALID_MNEMONIC,
7588
+ throw new FuelError16(
7589
+ ErrorCode16.INVALID_MNEMONIC,
7665
7590
  `Invalid mnemonic: the word '${words[i]}' is not found in the provided wordlist.`
7666
7591
  );
7667
7592
  }
@@ -7677,8 +7602,8 @@ function mnemonicWordsToEntropy(words, wordlist) {
7677
7602
  const checksumMask = getUpperMask(checksumBits);
7678
7603
  const checksum = arrayify16(sha2562(entropy.slice(0, entropyBits / 8)))[0] & checksumMask;
7679
7604
  if (checksum !== (entropy[entropy.length - 1] & checksumMask)) {
7680
- throw new FuelError17(
7681
- ErrorCode17.INVALID_CHECKSUM,
7605
+ throw new FuelError16(
7606
+ ErrorCode16.INVALID_CHECKSUM,
7682
7607
  "Checksum validation failed for the provided mnemonic."
7683
7608
  );
7684
7609
  }
@@ -7692,16 +7617,16 @@ var TestnetPRV = "0x04358394";
7692
7617
  var MNEMONIC_SIZES = [12, 15, 18, 21, 24];
7693
7618
  function assertWordList(wordlist) {
7694
7619
  if (wordlist.length !== 2048) {
7695
- throw new FuelError18(
7696
- ErrorCode18.INVALID_WORD_LIST,
7620
+ throw new FuelError17(
7621
+ ErrorCode17.INVALID_WORD_LIST,
7697
7622
  `Expected word list length of 2048, but got ${wordlist.length}.`
7698
7623
  );
7699
7624
  }
7700
7625
  }
7701
7626
  function assertEntropy(entropy) {
7702
7627
  if (entropy.length % 4 !== 0 || entropy.length < 16 || entropy.length > 32) {
7703
- throw new FuelError18(
7704
- ErrorCode18.INVALID_ENTROPY,
7628
+ throw new FuelError17(
7629
+ ErrorCode17.INVALID_ENTROPY,
7705
7630
  `Entropy should be between 16 and 32 bytes and a multiple of 4, but got ${entropy.length} bytes.`
7706
7631
  );
7707
7632
  }
@@ -7711,7 +7636,7 @@ function assertMnemonic(words) {
7711
7636
  const errorMsg = `Invalid mnemonic size. Expected one of [${MNEMONIC_SIZES.join(
7712
7637
  ", "
7713
7638
  )}] words, but got ${words.length}.`;
7714
- throw new FuelError18(ErrorCode18.INVALID_MNEMONIC, errorMsg);
7639
+ throw new FuelError17(ErrorCode17.INVALID_MNEMONIC, errorMsg);
7715
7640
  }
7716
7641
  }
7717
7642
  var Mnemonic = class {
@@ -7829,8 +7754,8 @@ var Mnemonic = class {
7829
7754
  static masterKeysFromSeed(seed) {
7830
7755
  const seedArray = arrayify17(seed);
7831
7756
  if (seedArray.length < 16 || seedArray.length > 64) {
7832
- throw new FuelError18(
7833
- ErrorCode18.INVALID_SEED,
7757
+ throw new FuelError17(
7758
+ ErrorCode17.INVALID_SEED,
7834
7759
  `Seed length should be between 16 and 64 bytes, but received ${seedArray.length} bytes.`
7835
7760
  );
7836
7761
  }
@@ -7907,7 +7832,7 @@ function isValidExtendedKey(extendedKey) {
7907
7832
  function parsePath(path, depth = 0) {
7908
7833
  const components = path.split("/");
7909
7834
  if (components.length === 0 || components[0] === "m" && depth !== 0) {
7910
- throw new FuelError19(ErrorCode19.HD_WALLET_ERROR, `invalid path - ${path}`);
7835
+ throw new FuelError18(ErrorCode18.HD_WALLET_ERROR, `invalid path - ${path}`);
7911
7836
  }
7912
7837
  if (components[0] === "m") {
7913
7838
  components.shift();
@@ -7936,8 +7861,8 @@ var HDWallet = class {
7936
7861
  this.privateKey = hexlify17(config.privateKey);
7937
7862
  } else {
7938
7863
  if (!config.publicKey) {
7939
- throw new FuelError19(
7940
- ErrorCode19.HD_WALLET_ERROR,
7864
+ throw new FuelError18(
7865
+ ErrorCode18.HD_WALLET_ERROR,
7941
7866
  "Both public and private Key cannot be missing. At least one should be provided."
7942
7867
  );
7943
7868
  }
@@ -7966,8 +7891,8 @@ var HDWallet = class {
7966
7891
  const data = new Uint8Array(37);
7967
7892
  if (index & HARDENED_INDEX) {
7968
7893
  if (!privateKey) {
7969
- throw new FuelError19(
7970
- ErrorCode19.HD_WALLET_ERROR,
7894
+ throw new FuelError18(
7895
+ ErrorCode18.HD_WALLET_ERROR,
7971
7896
  "Cannot derive a hardened index without a private Key."
7972
7897
  );
7973
7898
  }
@@ -7981,7 +7906,7 @@ var HDWallet = class {
7981
7906
  const IR = bytes.slice(32);
7982
7907
  if (privateKey) {
7983
7908
  const N = "0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141";
7984
- const ki = bn18(IL).add(privateKey).mod(N).toBytes(32);
7909
+ const ki = bn17(IL).add(privateKey).mod(N).toBytes(32);
7985
7910
  return new HDWallet({
7986
7911
  privateKey: ki,
7987
7912
  chainCode: IR,
@@ -8019,8 +7944,8 @@ var HDWallet = class {
8019
7944
  */
8020
7945
  toExtendedKey(isPublic = false, testnet = false) {
8021
7946
  if (this.depth >= 256) {
8022
- throw new FuelError19(
8023
- ErrorCode19.HD_WALLET_ERROR,
7947
+ throw new FuelError18(
7948
+ ErrorCode18.HD_WALLET_ERROR,
8024
7949
  `Exceeded max depth of 255. Current depth: ${this.depth}.`
8025
7950
  );
8026
7951
  }
@@ -8051,10 +7976,10 @@ var HDWallet = class {
8051
7976
  const bytes = arrayify18(decoded);
8052
7977
  const validChecksum = base58check(bytes.slice(0, 78)) === extendedKey;
8053
7978
  if (bytes.length !== 82 || !isValidExtendedKey(bytes)) {
8054
- throw new FuelError19(ErrorCode19.HD_WALLET_ERROR, "Provided key is not a valid extended key.");
7979
+ throw new FuelError18(ErrorCode18.HD_WALLET_ERROR, "Provided key is not a valid extended key.");
8055
7980
  }
8056
7981
  if (!validChecksum) {
8057
- throw new FuelError19(ErrorCode19.HD_WALLET_ERROR, "Provided key has an invalid checksum.");
7982
+ throw new FuelError18(ErrorCode18.HD_WALLET_ERROR, "Provided key has an invalid checksum.");
8058
7983
  }
8059
7984
  const depth = bytes[4];
8060
7985
  const parentFingerprint = hexlify17(bytes.slice(5, 9));
@@ -8062,14 +7987,14 @@ var HDWallet = class {
8062
7987
  const chainCode = hexlify17(bytes.slice(13, 45));
8063
7988
  const key = bytes.slice(45, 78);
8064
7989
  if (depth === 0 && parentFingerprint !== "0x00000000" || depth === 0 && index !== 0) {
8065
- throw new FuelError19(
8066
- ErrorCode19.HD_WALLET_ERROR,
7990
+ throw new FuelError18(
7991
+ ErrorCode18.HD_WALLET_ERROR,
8067
7992
  "Inconsistency detected: Depth is zero but fingerprint/index is non-zero."
8068
7993
  );
8069
7994
  }
8070
7995
  if (isPublicExtendedKey(bytes)) {
8071
7996
  if (key[0] !== 3) {
8072
- throw new FuelError19(ErrorCode19.HD_WALLET_ERROR, "Invalid public extended key.");
7997
+ throw new FuelError18(ErrorCode18.HD_WALLET_ERROR, "Invalid public extended key.");
8073
7998
  }
8074
7999
  return new HDWallet({
8075
8000
  publicKey: key,
@@ -8080,7 +8005,7 @@ var HDWallet = class {
8080
8005
  });
8081
8006
  }
8082
8007
  if (key[0] !== 0) {
8083
- throw new FuelError19(ErrorCode19.HD_WALLET_ERROR, "Invalid private extended key.");
8008
+ throw new FuelError18(ErrorCode18.HD_WALLET_ERROR, "Invalid private extended key.");
8084
8009
  }
8085
8010
  return new HDWallet({
8086
8011
  privateKey: key.slice(1),
@@ -8248,7 +8173,7 @@ __publicField(Wallet, "fromEncryptedJson", WalletUnlocked.fromEncryptedJson);
8248
8173
  // src/wallet-manager/wallet-manager.ts
8249
8174
  import { Address as Address8 } from "@fuel-ts/address";
8250
8175
  import { encrypt, decrypt } from "@fuel-ts/crypto";
8251
- import { ErrorCode as ErrorCode22, FuelError as FuelError22 } from "@fuel-ts/errors";
8176
+ import { ErrorCode as ErrorCode21, FuelError as FuelError21 } from "@fuel-ts/errors";
8252
8177
  import { EventEmitter } from "events";
8253
8178
 
8254
8179
  // src/wallet-manager/storages/memory-storage.ts
@@ -8271,7 +8196,7 @@ var MemoryStorage = class {
8271
8196
 
8272
8197
  // src/wallet-manager/vaults/mnemonic-vault.ts
8273
8198
  import { Address as Address6 } from "@fuel-ts/address";
8274
- import { ErrorCode as ErrorCode20, FuelError as FuelError20 } from "@fuel-ts/errors";
8199
+ import { ErrorCode as ErrorCode19, FuelError as FuelError19 } from "@fuel-ts/errors";
8275
8200
  var _secret;
8276
8201
  var MnemonicVault = class {
8277
8202
  constructor(options) {
@@ -8327,8 +8252,8 @@ var MnemonicVault = class {
8327
8252
  }
8328
8253
  numberOfAccounts += 1;
8329
8254
  } while (numberOfAccounts < this.numberOfAccounts);
8330
- throw new FuelError20(
8331
- ErrorCode20.WALLET_MANAGER_ERROR,
8255
+ throw new FuelError19(
8256
+ ErrorCode19.WALLET_MANAGER_ERROR,
8332
8257
  `Account with address '${address}' not found in derived wallets.`
8333
8258
  );
8334
8259
  }
@@ -8342,7 +8267,7 @@ __publicField(MnemonicVault, "type", "mnemonic");
8342
8267
 
8343
8268
  // src/wallet-manager/vaults/privatekey-vault.ts
8344
8269
  import { Address as Address7 } from "@fuel-ts/address";
8345
- import { ErrorCode as ErrorCode21, FuelError as FuelError21 } from "@fuel-ts/errors";
8270
+ import { ErrorCode as ErrorCode20, FuelError as FuelError20 } from "@fuel-ts/errors";
8346
8271
  var _privateKeys;
8347
8272
  var PrivateKeyVault = class {
8348
8273
  /**
@@ -8383,8 +8308,8 @@ var PrivateKeyVault = class {
8383
8308
  (pk) => Wallet.fromPrivateKey(pk).address.equals(ownerAddress)
8384
8309
  );
8385
8310
  if (!privateKey) {
8386
- throw new FuelError21(
8387
- ErrorCode21.WALLET_MANAGER_ERROR,
8311
+ throw new FuelError20(
8312
+ ErrorCode20.WALLET_MANAGER_ERROR,
8388
8313
  `No private key found for address '${address}'.`
8389
8314
  );
8390
8315
  }
@@ -8408,7 +8333,7 @@ var ERROR_MESSAGES = {
8408
8333
  };
8409
8334
  function assert(condition, message) {
8410
8335
  if (!condition) {
8411
- throw new FuelError22(ErrorCode22.WALLET_MANAGER_ERROR, message);
8336
+ throw new FuelError21(ErrorCode21.WALLET_MANAGER_ERROR, message);
8412
8337
  }
8413
8338
  }
8414
8339
  var _vaults, _passphrase, _isLocked, _serializeVaults, serializeVaults_fn, _deserializeVaults, deserializeVaults_fn;
@@ -8634,25 +8559,25 @@ deserializeVaults_fn = function(vaults) {
8634
8559
  __publicField(WalletManager, "Vaults", [MnemonicVault, PrivateKeyVault]);
8635
8560
 
8636
8561
  // src/wallet-manager/types.ts
8637
- import { ErrorCode as ErrorCode23, FuelError as FuelError23 } from "@fuel-ts/errors";
8562
+ import { ErrorCode as ErrorCode22, FuelError as FuelError22 } from "@fuel-ts/errors";
8638
8563
  var Vault = class {
8639
8564
  constructor(_options) {
8640
- throw new FuelError23(ErrorCode23.NOT_IMPLEMENTED, "Not implemented.");
8565
+ throw new FuelError22(ErrorCode22.NOT_IMPLEMENTED, "Not implemented.");
8641
8566
  }
8642
8567
  serialize() {
8643
- throw new FuelError23(ErrorCode23.NOT_IMPLEMENTED, "Not implemented.");
8568
+ throw new FuelError22(ErrorCode22.NOT_IMPLEMENTED, "Not implemented.");
8644
8569
  }
8645
8570
  getAccounts() {
8646
- throw new FuelError23(ErrorCode23.NOT_IMPLEMENTED, "Not implemented.");
8571
+ throw new FuelError22(ErrorCode22.NOT_IMPLEMENTED, "Not implemented.");
8647
8572
  }
8648
8573
  addAccount() {
8649
- throw new FuelError23(ErrorCode23.NOT_IMPLEMENTED, "Not implemented.");
8574
+ throw new FuelError22(ErrorCode22.NOT_IMPLEMENTED, "Not implemented.");
8650
8575
  }
8651
8576
  exportAccount(_address) {
8652
- throw new FuelError23(ErrorCode23.NOT_IMPLEMENTED, "Not implemented.");
8577
+ throw new FuelError22(ErrorCode22.NOT_IMPLEMENTED, "Not implemented.");
8653
8578
  }
8654
8579
  getWallet(_address) {
8655
- throw new FuelError23(ErrorCode23.NOT_IMPLEMENTED, "Not implemented.");
8580
+ throw new FuelError22(ErrorCode22.NOT_IMPLEMENTED, "Not implemented.");
8656
8581
  }
8657
8582
  };
8658
8583
  __publicField(Vault, "type");
@@ -8669,7 +8594,7 @@ import {
8669
8594
  } from "@fuel-ts/abi-coder";
8670
8595
  import { Address as Address9 } from "@fuel-ts/address";
8671
8596
  import { BaseAssetId as BaseAssetId4 } from "@fuel-ts/address/configs";
8672
- import { ErrorCode as ErrorCode24, FuelError as FuelError24 } from "@fuel-ts/errors";
8597
+ import { ErrorCode as ErrorCode23, FuelError as FuelError23 } from "@fuel-ts/errors";
8673
8598
  import { ByteArrayCoder, InputType as InputType7 } from "@fuel-ts/transactions";
8674
8599
  import { arrayify as arrayify20, hexlify as hexlify19 } from "@fuel-ts/utils";
8675
8600
 
@@ -8797,8 +8722,8 @@ var Predicate = class extends Account {
8797
8722
  if (jsonAbi) {
8798
8723
  abiInterface = new Interface4(jsonAbi);
8799
8724
  if (abiInterface.functions.main === void 0) {
8800
- throw new FuelError24(
8801
- ErrorCode24.ABI_MAIN_METHOD_MISSING,
8725
+ throw new FuelError23(
8726
+ ErrorCode23.ABI_MAIN_METHOD_MISSING,
8802
8727
  'Cannot use ABI without "main" function.'
8803
8728
  );
8804
8729
  }
@@ -8843,8 +8768,8 @@ var Predicate = class extends Account {
8843
8768
  mutatedBytes.set(encoded, offset);
8844
8769
  });
8845
8770
  } catch (err) {
8846
- throw new FuelError24(
8847
- ErrorCode24.INVALID_CONFIGURABLE_CONSTANTS,
8771
+ throw new FuelError23(
8772
+ ErrorCode23.INVALID_CONFIGURABLE_CONSTANTS,
8848
8773
  `Error setting configurable constants: ${err.message}.`
8849
8774
  );
8850
8775
  }
@@ -8853,7 +8778,7 @@ var Predicate = class extends Account {
8853
8778
  };
8854
8779
 
8855
8780
  // src/connectors/fuel.ts
8856
- import { ErrorCode as ErrorCode25, FuelError as FuelError25 } from "@fuel-ts/errors";
8781
+ import { ErrorCode as ErrorCode24, FuelError as FuelError24 } from "@fuel-ts/errors";
8857
8782
 
8858
8783
  // src/connectors/fuel-connector.ts
8859
8784
  import { EventEmitter as EventEmitter2 } from "events";
@@ -9486,7 +9411,7 @@ var _Fuel = class extends FuelConnector {
9486
9411
  const currentNetwork = await this.currentNetwork();
9487
9412
  provider = await Provider.create(currentNetwork.url);
9488
9413
  } else {
9489
- throw new FuelError25(ErrorCode25.INVALID_PROVIDER, "Provider is not valid.");
9414
+ throw new FuelError24(ErrorCode24.INVALID_PROVIDER, "Provider is not valid.");
9490
9415
  }
9491
9416
  return provider;
9492
9417
  }
@@ -9565,9 +9490,7 @@ export {
9565
9490
  WalletUnlocked,
9566
9491
  addAmountToAsset,
9567
9492
  addOperation,
9568
- assemblePanicError,
9569
9493
  assembleReceiptByType,
9570
- assembleRevertError,
9571
9494
  assembleTransactionSummary,
9572
9495
  assets,
9573
9496
  buildBlockExplorerUrl,
@@ -9582,7 +9505,6 @@ export {
9582
9505
  english,
9583
9506
  extractBurnedAssetsFromReceipts,
9584
9507
  extractMintedAssetsFromReceipts,
9585
- extractTxError,
9586
9508
  gasUsedByInputs,
9587
9509
  getAssetEth,
9588
9510
  getAssetFuel,