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

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

Potentially problematic release.


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

@@ -25,9 +25,9 @@ import { hexlify as hexlify15 } from "@fuel-ts/utils";
25
25
  // src/account.ts
26
26
  import { Address as Address3 } from "@fuel-ts/address";
27
27
  import { BaseAssetId as BaseAssetId3 } from "@fuel-ts/address/configs";
28
- import { ErrorCode as ErrorCode14, FuelError as FuelError14 } from "@fuel-ts/errors";
28
+ import { ErrorCode as ErrorCode15, FuelError as FuelError15 } from "@fuel-ts/errors";
29
29
  import { AbstractAccount } from "@fuel-ts/interfaces";
30
- import { bn as bn16 } from "@fuel-ts/math";
30
+ import { bn as bn17 } from "@fuel-ts/math";
31
31
  import { arrayify as arrayify14 } from "@fuel-ts/utils";
32
32
 
33
33
  // src/providers/coin-quantity.ts
@@ -68,8 +68,8 @@ var addAmountToAsset = (params) => {
68
68
 
69
69
  // src/providers/provider.ts
70
70
  import { Address as Address2 } from "@fuel-ts/address";
71
- import { ErrorCode as ErrorCode12, FuelError as FuelError12 } from "@fuel-ts/errors";
72
- import { BN, bn as bn14, max } from "@fuel-ts/math";
71
+ import { ErrorCode as ErrorCode13, FuelError as FuelError13 } from "@fuel-ts/errors";
72
+ import { BN, bn as bn15, max } from "@fuel-ts/math";
73
73
  import {
74
74
  InputType as InputType6,
75
75
  TransactionType as TransactionType8,
@@ -1152,7 +1152,7 @@ var outputify = (value) => {
1152
1152
  // src/providers/transaction-request/transaction-request.ts
1153
1153
  import { Address, addressify } from "@fuel-ts/address";
1154
1154
  import { BaseAssetId as BaseAssetId2, ZeroBytes32 as ZeroBytes324 } from "@fuel-ts/address/configs";
1155
- import { bn as bn6 } from "@fuel-ts/math";
1155
+ import { bn as bn7 } from "@fuel-ts/math";
1156
1156
  import {
1157
1157
  PolicyType,
1158
1158
  TransactionCoder,
@@ -1495,6 +1495,76 @@ function sleep(time) {
1495
1495
  });
1496
1496
  }
1497
1497
 
1498
+ // src/providers/utils/extract-tx-error.ts
1499
+ import { ErrorCode as ErrorCode7, FuelError as FuelError7 } from "@fuel-ts/errors";
1500
+ import { bn as bn6 } from "@fuel-ts/math";
1501
+ import { ReceiptType as ReceiptType3 } from "@fuel-ts/transactions";
1502
+ import {
1503
+ FAILED_REQUIRE_SIGNAL,
1504
+ FAILED_ASSERT_EQ_SIGNAL,
1505
+ FAILED_ASSERT_NE_SIGNAL,
1506
+ FAILED_ASSERT_SIGNAL,
1507
+ FAILED_TRANSFER_TO_ADDRESS_SIGNAL as FAILED_TRANSFER_TO_ADDRESS_SIGNAL2,
1508
+ PANIC_REASONS,
1509
+ PANIC_DOC_URL
1510
+ } from "@fuel-ts/transactions/configs";
1511
+ var assemblePanicError = (status) => {
1512
+ let errorMessage = `The transaction reverted with reason: "${status.reason}".`;
1513
+ if (PANIC_REASONS.includes(status.reason)) {
1514
+ errorMessage = `${errorMessage}
1515
+
1516
+ You can read more about this error at:
1517
+
1518
+ ${PANIC_DOC_URL}#variant.${status.reason}`;
1519
+ }
1520
+ return errorMessage;
1521
+ };
1522
+ var stringify = (obj) => JSON.stringify(obj, null, 2);
1523
+ var assembleRevertError = (receipts, logs) => {
1524
+ let errorMessage = "The transaction reverted with an unknown reason.";
1525
+ const revertReceipt = receipts.find(({ type }) => type === ReceiptType3.Revert);
1526
+ if (revertReceipt) {
1527
+ const reasonHex = bn6(revertReceipt.val).toHex();
1528
+ switch (reasonHex) {
1529
+ case FAILED_REQUIRE_SIGNAL: {
1530
+ errorMessage = `The transaction reverted because a "require" statement has thrown ${logs.length ? stringify(logs[0]) : "an error."}.`;
1531
+ break;
1532
+ }
1533
+ case FAILED_ASSERT_EQ_SIGNAL: {
1534
+ const sufix = logs.length >= 2 ? ` comparing ${stringify(logs[1])} and ${stringify(logs[0])}.` : ".";
1535
+ errorMessage = `The transaction reverted because of an "assert_eq" statement${sufix}`;
1536
+ break;
1537
+ }
1538
+ case FAILED_ASSERT_NE_SIGNAL: {
1539
+ const sufix = logs.length >= 2 ? ` comparing ${stringify(logs[1])} and ${stringify(logs[0])}.` : ".";
1540
+ errorMessage = `The transaction reverted because of an "assert_ne" statement${sufix}`;
1541
+ break;
1542
+ }
1543
+ case FAILED_ASSERT_SIGNAL:
1544
+ errorMessage = `The transaction reverted because an "assert" statement failed to evaluate to true.`;
1545
+ break;
1546
+ case FAILED_TRANSFER_TO_ADDRESS_SIGNAL2:
1547
+ errorMessage = `The transaction reverted because it's missing an "OutputChange".`;
1548
+ break;
1549
+ default:
1550
+ errorMessage = `The transaction reverted with an unknown reason: ${revertReceipt.val}`;
1551
+ }
1552
+ }
1553
+ return errorMessage;
1554
+ };
1555
+ var extractTxError = (params) => {
1556
+ const { receipts, status, logs } = params;
1557
+ const isPanic = receipts.some(({ type }) => type === ReceiptType3.Panic);
1558
+ let err = status?.type === "FailureStatus" && isPanic ? assemblePanicError(status) : assembleRevertError(receipts, logs);
1559
+ err += `
1560
+
1561
+ logs: ${JSON.stringify(logs, null, 2)}`;
1562
+ err += `
1563
+
1564
+ receipts: ${JSON.stringify(receipts, null, 2)}`;
1565
+ return new FuelError7(ErrorCode7.SCRIPT_REVERTED, err);
1566
+ };
1567
+
1498
1568
  // src/providers/transaction-request/errors.ts
1499
1569
  var NoWitnessAtIndexError = class extends Error {
1500
1570
  constructor(index) {
@@ -1545,10 +1615,10 @@ var BaseTransactionRequest = class {
1545
1615
  outputs,
1546
1616
  witnesses
1547
1617
  } = {}) {
1548
- this.gasPrice = bn6(gasPrice);
1618
+ this.gasPrice = bn7(gasPrice);
1549
1619
  this.maturity = maturity ?? 0;
1550
- this.witnessLimit = witnessLimit ? bn6(witnessLimit) : void 0;
1551
- this.maxFee = maxFee ? bn6(maxFee) : void 0;
1620
+ this.witnessLimit = witnessLimit ? bn7(witnessLimit) : void 0;
1621
+ this.maxFee = maxFee ? bn7(maxFee) : void 0;
1552
1622
  this.inputs = inputs ?? [];
1553
1623
  this.outputs = outputs ?? [];
1554
1624
  this.witnesses = witnesses ?? [];
@@ -1978,13 +2048,13 @@ var BaseTransactionRequest = class {
1978
2048
  assetId,
1979
2049
  owner: resourcesOwner || Address.fromRandom(),
1980
2050
  maturity: 0,
1981
- blockCreated: bn6(1),
1982
- txCreatedIdx: bn6(1)
2051
+ blockCreated: bn7(1),
2052
+ txCreatedIdx: bn7(1)
1983
2053
  }
1984
2054
  ]);
1985
2055
  }
1986
2056
  };
1987
- updateAssetInput(BaseAssetId2, bn6(1e11));
2057
+ updateAssetInput(BaseAssetId2, bn7(1e11));
1988
2058
  quantities.forEach((q) => updateAssetInput(q.assetId, q.amount));
1989
2059
  }
1990
2060
  /**
@@ -1995,7 +2065,7 @@ var BaseTransactionRequest = class {
1995
2065
  */
1996
2066
  getCoinOutputsQuantities() {
1997
2067
  const coinsQuantities = this.getCoinOutputs().map(({ amount, assetId }) => ({
1998
- amount: bn6(amount),
2068
+ amount: bn7(amount),
1999
2069
  assetId: assetId.toString()
2000
2070
  }));
2001
2071
  return coinsQuantities;
@@ -2024,7 +2094,7 @@ var BaseTransactionRequest = class {
2024
2094
  default:
2025
2095
  return;
2026
2096
  }
2027
- if (correspondingInput && "predicateGasUsed" in correspondingInput && bn6(correspondingInput.predicateGasUsed).gt(0)) {
2097
+ if (correspondingInput && "predicateGasUsed" in correspondingInput && bn7(correspondingInput.predicateGasUsed).gt(0)) {
2028
2098
  i.predicate = correspondingInput.predicate;
2029
2099
  i.predicateData = correspondingInput.predicateData;
2030
2100
  i.predicateGasUsed = correspondingInput.predicateGasUsed;
@@ -2035,14 +2105,14 @@ var BaseTransactionRequest = class {
2035
2105
 
2036
2106
  // src/providers/transaction-request/create-transaction-request.ts
2037
2107
  import { ZeroBytes32 as ZeroBytes326 } from "@fuel-ts/address/configs";
2038
- import { bn as bn8 } from "@fuel-ts/math";
2108
+ import { bn as bn9 } from "@fuel-ts/math";
2039
2109
  import { TransactionType as TransactionType3, OutputType as OutputType4 } from "@fuel-ts/transactions";
2040
2110
  import { arrayify as arrayify6, hexlify as hexlify9 } from "@fuel-ts/utils";
2041
2111
 
2042
2112
  // src/providers/transaction-request/hash-transaction.ts
2043
2113
  import { ZeroBytes32 as ZeroBytes325 } from "@fuel-ts/address/configs";
2044
2114
  import { uint64ToBytesBE, sha256 } from "@fuel-ts/hasher";
2045
- import { bn as bn7 } from "@fuel-ts/math";
2115
+ import { bn as bn8 } from "@fuel-ts/math";
2046
2116
  import { TransactionType as TransactionType2, InputType as InputType3, OutputType as OutputType3, TransactionCoder as TransactionCoder2 } from "@fuel-ts/transactions";
2047
2117
  import { concat as concat2 } from "@fuel-ts/utils";
2048
2118
  import { clone as clone2 } from "ramda";
@@ -2059,11 +2129,11 @@ function hashTransaction(transactionRequest, chainId) {
2059
2129
  blockHeight: 0,
2060
2130
  txIndex: 0
2061
2131
  };
2062
- inputClone.predicateGasUsed = bn7(0);
2132
+ inputClone.predicateGasUsed = bn8(0);
2063
2133
  return inputClone;
2064
2134
  }
2065
2135
  case InputType3.Message: {
2066
- inputClone.predicateGasUsed = bn7(0);
2136
+ inputClone.predicateGasUsed = bn8(0);
2067
2137
  return inputClone;
2068
2138
  }
2069
2139
  case InputType3.Contract: {
@@ -2090,12 +2160,12 @@ function hashTransaction(transactionRequest, chainId) {
2090
2160
  return outputClone;
2091
2161
  }
2092
2162
  case OutputType3.Change: {
2093
- outputClone.amount = bn7(0);
2163
+ outputClone.amount = bn8(0);
2094
2164
  return outputClone;
2095
2165
  }
2096
2166
  case OutputType3.Variable: {
2097
2167
  outputClone.to = ZeroBytes325;
2098
- outputClone.amount = bn7(0);
2168
+ outputClone.amount = bn8(0);
2099
2169
  outputClone.assetId = ZeroBytes325;
2100
2170
  return outputClone;
2101
2171
  }
@@ -2219,7 +2289,7 @@ var CreateTransactionRequest = class extends BaseTransactionRequest {
2219
2289
  }
2220
2290
  metadataGas(gasCosts) {
2221
2291
  return calculateMetadataGasForTxCreate({
2222
- contractBytesSize: bn8(arrayify6(this.witnesses[this.bytecodeWitnessIndex] || "0x").length),
2292
+ contractBytesSize: bn9(arrayify6(this.witnesses[this.bytecodeWitnessIndex] || "0x").length),
2223
2293
  gasCosts,
2224
2294
  stateRootSize: this.storageSlots.length,
2225
2295
  txBytesSize: this.byteSize()
@@ -2231,7 +2301,7 @@ var CreateTransactionRequest = class extends BaseTransactionRequest {
2231
2301
  import { Interface } from "@fuel-ts/abi-coder";
2232
2302
  import { addressify as addressify2 } from "@fuel-ts/address";
2233
2303
  import { ZeroBytes32 as ZeroBytes327 } from "@fuel-ts/address/configs";
2234
- import { bn as bn9 } from "@fuel-ts/math";
2304
+ import { bn as bn10 } from "@fuel-ts/math";
2235
2305
  import { InputType as InputType4, OutputType as OutputType5, TransactionType as TransactionType4 } from "@fuel-ts/transactions";
2236
2306
  import { arrayify as arrayify8, hexlify as hexlify10 } from "@fuel-ts/utils";
2237
2307
 
@@ -2285,7 +2355,7 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
2285
2355
  */
2286
2356
  constructor({ script, scriptData, gasLimit, ...rest } = {}) {
2287
2357
  super(rest);
2288
- this.gasLimit = bn9(gasLimit);
2358
+ this.gasLimit = bn10(gasLimit);
2289
2359
  this.script = arrayify8(script ?? returnZeroScript.bytes);
2290
2360
  this.scriptData = arrayify8(scriptData ?? returnZeroScript.encodeScriptData());
2291
2361
  this.abis = rest.abis;
@@ -2433,7 +2503,7 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
2433
2503
  };
2434
2504
 
2435
2505
  // src/providers/transaction-request/utils.ts
2436
- import { ErrorCode as ErrorCode7, FuelError as FuelError7 } from "@fuel-ts/errors";
2506
+ import { ErrorCode as ErrorCode8, FuelError as FuelError8 } from "@fuel-ts/errors";
2437
2507
  import { TransactionType as TransactionType5 } from "@fuel-ts/transactions";
2438
2508
  var transactionRequestify = (obj) => {
2439
2509
  if (obj instanceof ScriptTransactionRequest || obj instanceof CreateTransactionRequest) {
@@ -2448,14 +2518,14 @@ var transactionRequestify = (obj) => {
2448
2518
  return CreateTransactionRequest.from(obj);
2449
2519
  }
2450
2520
  default: {
2451
- throw new FuelError7(ErrorCode7.INVALID_TRANSACTION_TYPE, `Invalid transaction type: ${type}.`);
2521
+ throw new FuelError8(ErrorCode8.INVALID_TRANSACTION_TYPE, `Invalid transaction type: ${type}.`);
2452
2522
  }
2453
2523
  }
2454
2524
  };
2455
2525
 
2456
2526
  // src/providers/transaction-response/transaction-response.ts
2457
- import { ErrorCode as ErrorCode11, FuelError as FuelError11 } from "@fuel-ts/errors";
2458
- import { bn as bn13 } from "@fuel-ts/math";
2527
+ import { ErrorCode as ErrorCode12, FuelError as FuelError12 } from "@fuel-ts/errors";
2528
+ import { bn as bn14 } from "@fuel-ts/math";
2459
2529
  import { TransactionCoder as TransactionCoder4 } from "@fuel-ts/transactions";
2460
2530
  import { arrayify as arrayify10 } from "@fuel-ts/utils";
2461
2531
 
@@ -2463,7 +2533,7 @@ import { arrayify as arrayify10 } from "@fuel-ts/utils";
2463
2533
  import { DateTime, hexlify as hexlify11 } from "@fuel-ts/utils";
2464
2534
 
2465
2535
  // src/providers/transaction-summary/calculate-transaction-fee.ts
2466
- import { bn as bn10 } from "@fuel-ts/math";
2536
+ import { bn as bn11 } from "@fuel-ts/math";
2467
2537
  import { PolicyType as PolicyType2, TransactionCoder as TransactionCoder3, TransactionType as TransactionType6 } from "@fuel-ts/transactions";
2468
2538
  import { arrayify as arrayify9 } from "@fuel-ts/utils";
2469
2539
  var calculateTransactionFee = (params) => {
@@ -2472,24 +2542,24 @@ var calculateTransactionFee = (params) => {
2472
2542
  rawPayload,
2473
2543
  consensusParameters: { gasCosts, feeParams }
2474
2544
  } = params;
2475
- const gasPerByte = bn10(feeParams.gasPerByte);
2476
- const gasPriceFactor = bn10(feeParams.gasPriceFactor);
2545
+ const gasPerByte = bn11(feeParams.gasPerByte);
2546
+ const gasPriceFactor = bn11(feeParams.gasPriceFactor);
2477
2547
  const transactionBytes = arrayify9(rawPayload);
2478
2548
  const [transaction] = new TransactionCoder3().decode(transactionBytes, 0);
2479
2549
  if (transaction.type === TransactionType6.Mint) {
2480
2550
  return {
2481
- fee: bn10(0),
2482
- minFee: bn10(0),
2483
- maxFee: bn10(0),
2484
- feeFromGasUsed: bn10(0)
2551
+ fee: bn11(0),
2552
+ minFee: bn11(0),
2553
+ maxFee: bn11(0),
2554
+ feeFromGasUsed: bn11(0)
2485
2555
  };
2486
2556
  }
2487
2557
  const { type, witnesses, inputs, policies } = transaction;
2488
- let metadataGas = bn10(0);
2489
- let gasLimit = bn10(0);
2558
+ let metadataGas = bn11(0);
2559
+ let gasLimit = bn11(0);
2490
2560
  if (type === TransactionType6.Create) {
2491
2561
  const { bytecodeWitnessIndex, storageSlots } = transaction;
2492
- const contractBytesSize = bn10(arrayify9(witnesses[bytecodeWitnessIndex].data).length);
2562
+ const contractBytesSize = bn11(arrayify9(witnesses[bytecodeWitnessIndex].data).length);
2493
2563
  metadataGas = calculateMetadataGasForTxCreate({
2494
2564
  contractBytesSize,
2495
2565
  gasCosts,
@@ -2508,12 +2578,12 @@ var calculateTransactionFee = (params) => {
2508
2578
  }
2509
2579
  const minGas = getMinGas({
2510
2580
  gasCosts,
2511
- gasPerByte: bn10(gasPerByte),
2581
+ gasPerByte: bn11(gasPerByte),
2512
2582
  inputs,
2513
2583
  metadataGas,
2514
2584
  txBytesSize: transactionBytes.length
2515
2585
  });
2516
- const gasPrice = bn10(policies.find((policy) => policy.type === PolicyType2.GasPrice)?.data);
2586
+ const gasPrice = bn11(policies.find((policy) => policy.type === PolicyType2.GasPrice)?.data);
2517
2587
  const witnessLimit = policies.find((policy) => policy.type === PolicyType2.WitnessLimit)?.data;
2518
2588
  const witnessesLength = witnesses.reduce((acc, wit) => acc + wit.dataLength, 0);
2519
2589
  const maxGas = getMaxGas({
@@ -2537,13 +2607,13 @@ var calculateTransactionFee = (params) => {
2537
2607
 
2538
2608
  // src/providers/transaction-summary/operations.ts
2539
2609
  import { ZeroBytes32 as ZeroBytes328 } from "@fuel-ts/address/configs";
2540
- import { ErrorCode as ErrorCode9, FuelError as FuelError9 } from "@fuel-ts/errors";
2541
- import { bn as bn12 } from "@fuel-ts/math";
2542
- import { ReceiptType as ReceiptType3, TransactionType as TransactionType7 } from "@fuel-ts/transactions";
2610
+ import { ErrorCode as ErrorCode10, FuelError as FuelError10 } from "@fuel-ts/errors";
2611
+ import { bn as bn13 } from "@fuel-ts/math";
2612
+ import { ReceiptType as ReceiptType4, TransactionType as TransactionType7 } from "@fuel-ts/transactions";
2543
2613
 
2544
2614
  // src/providers/transaction-summary/call.ts
2545
2615
  import { Interface as Interface2, calculateVmTxMemory } from "@fuel-ts/abi-coder";
2546
- import { bn as bn11 } from "@fuel-ts/math";
2616
+ import { bn as bn12 } from "@fuel-ts/math";
2547
2617
  var getFunctionCall = ({ abi, receipt, rawPayload, maxInputs }) => {
2548
2618
  const abiInterface = new Interface2(abi);
2549
2619
  const callFunctionSelector = receipt.param1.toHex(8);
@@ -2552,7 +2622,7 @@ var getFunctionCall = ({ abi, receipt, rawPayload, maxInputs }) => {
2552
2622
  let encodedArgs;
2553
2623
  if (functionFragment.isInputDataPointer) {
2554
2624
  if (rawPayload) {
2555
- const argsOffset = bn11(receipt.param2).sub(calculateVmTxMemory({ maxInputs: maxInputs.toNumber() })).toNumber();
2625
+ const argsOffset = bn12(receipt.param2).sub(calculateVmTxMemory({ maxInputs: maxInputs.toNumber() })).toNumber();
2556
2626
  encodedArgs = `0x${rawPayload.slice(2).slice(argsOffset * 2)}`;
2557
2627
  }
2558
2628
  } else {
@@ -2586,7 +2656,7 @@ var getFunctionCall = ({ abi, receipt, rawPayload, maxInputs }) => {
2586
2656
  };
2587
2657
 
2588
2658
  // src/providers/transaction-summary/input.ts
2589
- import { ErrorCode as ErrorCode8, FuelError as FuelError8 } from "@fuel-ts/errors";
2659
+ import { ErrorCode as ErrorCode9, FuelError as FuelError9 } from "@fuel-ts/errors";
2590
2660
  import { InputType as InputType5 } from "@fuel-ts/transactions";
2591
2661
  function getInputsByTypes(inputs, types) {
2592
2662
  return inputs.filter((i) => types.includes(i.type));
@@ -2624,8 +2694,8 @@ function getInputContractFromIndex(inputs, inputIndex) {
2624
2694
  return void 0;
2625
2695
  }
2626
2696
  if (contractInput.type !== InputType5.Contract) {
2627
- throw new FuelError8(
2628
- ErrorCode8.INVALID_TRANSACTION_INPUT,
2697
+ throw new FuelError9(
2698
+ ErrorCode9.INVALID_TRANSACTION_INPUT,
2629
2699
  `Contract input should be of type 'contract'.`
2630
2700
  );
2631
2701
  }
@@ -2672,8 +2742,8 @@ function getTransactionTypeName(transactionType) {
2672
2742
  case TransactionType7.Script:
2673
2743
  return "Script" /* Script */;
2674
2744
  default:
2675
- throw new FuelError9(
2676
- ErrorCode9.INVALID_TRANSACTION_TYPE,
2745
+ throw new FuelError10(
2746
+ ErrorCode10.INVALID_TRANSACTION_TYPE,
2677
2747
  `Invalid transaction type: ${transactionType}.`
2678
2748
  );
2679
2749
  }
@@ -2692,10 +2762,10 @@ function isTypeScript(transactionType) {
2692
2762
  return isType(transactionType, "Script" /* Script */);
2693
2763
  }
2694
2764
  function getReceiptsCall(receipts) {
2695
- return getReceiptsByType(receipts, ReceiptType3.Call);
2765
+ return getReceiptsByType(receipts, ReceiptType4.Call);
2696
2766
  }
2697
2767
  function getReceiptsMessageOut(receipts) {
2698
- return getReceiptsByType(receipts, ReceiptType3.MessageOut);
2768
+ return getReceiptsByType(receipts, ReceiptType4.MessageOut);
2699
2769
  }
2700
2770
  var mergeAssets = (op1, op2) => {
2701
2771
  const assets1 = op1.assetsSent || [];
@@ -2708,7 +2778,7 @@ var mergeAssets = (op1, op2) => {
2708
2778
  if (!matchingAsset) {
2709
2779
  return asset1;
2710
2780
  }
2711
- const mergedAmount = bn12(asset1.amount).add(matchingAsset.amount);
2781
+ const mergedAmount = bn13(asset1.amount).add(matchingAsset.amount);
2712
2782
  return { ...asset1, amount: mergedAmount };
2713
2783
  });
2714
2784
  return mergedAssets.concat(filteredAssets);
@@ -2891,11 +2961,11 @@ function getTransferOperations({
2891
2961
  });
2892
2962
  const transferReceipts = getReceiptsByType(
2893
2963
  receipts,
2894
- ReceiptType3.Transfer
2964
+ ReceiptType4.Transfer
2895
2965
  );
2896
2966
  const transferOutReceipts = getReceiptsByType(
2897
2967
  receipts,
2898
- ReceiptType3.TransferOut
2968
+ ReceiptType4.TransferOut
2899
2969
  );
2900
2970
  [...transferReceipts, ...transferOutReceipts].forEach((receipt) => {
2901
2971
  const operation = extractTransferOperationFromReceipt(receipt, contractInputs, changeOutputs);
@@ -2980,17 +3050,17 @@ function getOperations({
2980
3050
  }
2981
3051
 
2982
3052
  // src/providers/transaction-summary/receipt.ts
2983
- import { ReceiptType as ReceiptType4 } from "@fuel-ts/transactions";
3053
+ import { ReceiptType as ReceiptType5 } from "@fuel-ts/transactions";
2984
3054
  var processGqlReceipt = (gqlReceipt) => {
2985
3055
  const receipt = assembleReceiptByType(gqlReceipt);
2986
3056
  switch (receipt.type) {
2987
- case ReceiptType4.ReturnData: {
3057
+ case ReceiptType5.ReturnData: {
2988
3058
  return {
2989
3059
  ...receipt,
2990
3060
  data: gqlReceipt.data || "0x"
2991
3061
  };
2992
3062
  }
2993
- case ReceiptType4.LogData: {
3063
+ case ReceiptType5.LogData: {
2994
3064
  return {
2995
3065
  ...receipt,
2996
3066
  data: gqlReceipt.data || "0x"
@@ -3003,7 +3073,7 @@ var processGqlReceipt = (gqlReceipt) => {
3003
3073
  var extractMintedAssetsFromReceipts = (receipts) => {
3004
3074
  const mintedAssets = [];
3005
3075
  receipts.forEach((receipt) => {
3006
- if (receipt.type === ReceiptType4.Mint) {
3076
+ if (receipt.type === ReceiptType5.Mint) {
3007
3077
  mintedAssets.push({
3008
3078
  subId: receipt.subId,
3009
3079
  contractId: receipt.contractId,
@@ -3017,7 +3087,7 @@ var extractMintedAssetsFromReceipts = (receipts) => {
3017
3087
  var extractBurnedAssetsFromReceipts = (receipts) => {
3018
3088
  const burnedAssets = [];
3019
3089
  receipts.forEach((receipt) => {
3020
- if (receipt.type === ReceiptType4.Burn) {
3090
+ if (receipt.type === ReceiptType5.Burn) {
3021
3091
  burnedAssets.push({
3022
3092
  subId: receipt.subId,
3023
3093
  contractId: receipt.contractId,
@@ -3030,7 +3100,7 @@ var extractBurnedAssetsFromReceipts = (receipts) => {
3030
3100
  };
3031
3101
 
3032
3102
  // src/providers/transaction-summary/status.ts
3033
- import { ErrorCode as ErrorCode10, FuelError as FuelError10 } from "@fuel-ts/errors";
3103
+ import { ErrorCode as ErrorCode11, FuelError as FuelError11 } from "@fuel-ts/errors";
3034
3104
  var getTransactionStatusName = (gqlStatus) => {
3035
3105
  switch (gqlStatus) {
3036
3106
  case "FailureStatus":
@@ -3042,8 +3112,8 @@ var getTransactionStatusName = (gqlStatus) => {
3042
3112
  case "SqueezedOutStatus":
3043
3113
  return "squeezedout" /* squeezedout */;
3044
3114
  default:
3045
- throw new FuelError10(
3046
- ErrorCode10.INVALID_TRANSACTION_STATUS,
3115
+ throw new FuelError11(
3116
+ ErrorCode11.INVALID_TRANSACTION_STATUS,
3047
3117
  `Invalid transaction status: ${gqlStatus}.`
3048
3118
  );
3049
3119
  }
@@ -3156,12 +3226,12 @@ function assembleTransactionSummary(params) {
3156
3226
 
3157
3227
  // src/providers/transaction-response/getDecodedLogs.ts
3158
3228
  import { Interface as Interface3, BigNumberCoder } from "@fuel-ts/abi-coder";
3159
- import { ReceiptType as ReceiptType5 } from "@fuel-ts/transactions";
3229
+ import { ReceiptType as ReceiptType6 } from "@fuel-ts/transactions";
3160
3230
  function getDecodedLogs(receipts, mainAbi, externalAbis = {}) {
3161
3231
  return receipts.reduce((logs, receipt) => {
3162
- if (receipt.type === ReceiptType5.LogData || receipt.type === ReceiptType5.Log) {
3232
+ if (receipt.type === ReceiptType6.LogData || receipt.type === ReceiptType6.Log) {
3163
3233
  const interfaceToUse = new Interface3(externalAbis[receipt.id] || mainAbi);
3164
- const data = receipt.type === ReceiptType5.Log ? new BigNumberCoder("u64").encode(receipt.val0) : receipt.data;
3234
+ const data = receipt.type === ReceiptType6.Log ? new BigNumberCoder("u64").encode(receipt.val0) : receipt.data;
3165
3235
  const [decodedLog] = interfaceToUse.decodeLog(data, receipt.val1.toNumber());
3166
3236
  logs.push(decodedLog);
3167
3237
  }
@@ -3176,7 +3246,7 @@ var TransactionResponse = class {
3176
3246
  /** Current provider */
3177
3247
  provider;
3178
3248
  /** Gas used on the transaction */
3179
- gasUsed = bn13(0);
3249
+ gasUsed = bn14(0);
3180
3250
  /** The graphql Transaction with receipts object. */
3181
3251
  gqlTransaction;
3182
3252
  abis;
@@ -3281,8 +3351,8 @@ var TransactionResponse = class {
3281
3351
  });
3282
3352
  for await (const { statusChange } of subscription) {
3283
3353
  if (statusChange.type === "SqueezedOutStatus") {
3284
- throw new FuelError11(
3285
- ErrorCode11.TRANSACTION_SQUEEZED_OUT,
3354
+ throw new FuelError12(
3355
+ ErrorCode12.TRANSACTION_SQUEEZED_OUT,
3286
3356
  `Transaction Squeezed Out with reason: ${statusChange.reason}`
3287
3357
  );
3288
3358
  }
@@ -3304,14 +3374,26 @@ var TransactionResponse = class {
3304
3374
  gqlTransaction: this.gqlTransaction,
3305
3375
  ...transactionSummary
3306
3376
  };
3377
+ let logs = [];
3307
3378
  if (this.abis) {
3308
- const logs = getDecodedLogs(
3379
+ logs = getDecodedLogs(
3309
3380
  transactionSummary.receipts,
3310
3381
  this.abis.main,
3311
3382
  this.abis.otherContractsAbis
3312
3383
  );
3313
3384
  transactionResult.logs = logs;
3314
3385
  }
3386
+ if (transactionResult.isStatusFailure) {
3387
+ const {
3388
+ receipts,
3389
+ gqlTransaction: { status }
3390
+ } = transactionResult;
3391
+ throw extractTxError({
3392
+ receipts,
3393
+ status,
3394
+ logs
3395
+ });
3396
+ }
3315
3397
  return transactionResult;
3316
3398
  }
3317
3399
  /**
@@ -3320,14 +3402,7 @@ var TransactionResponse = class {
3320
3402
  * @param contractsAbiMap - The contracts ABI map.
3321
3403
  */
3322
3404
  async wait(contractsAbiMap) {
3323
- const result = await this.waitForResult(contractsAbiMap);
3324
- if (result.isStatusFailure) {
3325
- throw new FuelError11(
3326
- ErrorCode11.TRANSACTION_FAILED,
3327
- `Transaction failed: ${result.gqlTransaction.status.reason}`
3328
- );
3329
- }
3330
- return result;
3405
+ return this.waitForResult(contractsAbiMap);
3331
3406
  }
3332
3407
  };
3333
3408
 
@@ -3389,29 +3464,29 @@ var processGqlChain = (chain) => {
3389
3464
  const { contractParams, feeParams, predicateParams, scriptParams, txParams, gasCosts } = consensusParameters;
3390
3465
  return {
3391
3466
  name,
3392
- baseChainHeight: bn14(daHeight),
3467
+ baseChainHeight: bn15(daHeight),
3393
3468
  consensusParameters: {
3394
- contractMaxSize: bn14(contractParams.contractMaxSize),
3395
- maxInputs: bn14(txParams.maxInputs),
3396
- maxOutputs: bn14(txParams.maxOutputs),
3397
- maxWitnesses: bn14(txParams.maxWitnesses),
3398
- maxGasPerTx: bn14(txParams.maxGasPerTx),
3399
- maxScriptLength: bn14(scriptParams.maxScriptLength),
3400
- maxScriptDataLength: bn14(scriptParams.maxScriptDataLength),
3401
- maxStorageSlots: bn14(contractParams.maxStorageSlots),
3402
- maxPredicateLength: bn14(predicateParams.maxPredicateLength),
3403
- maxPredicateDataLength: bn14(predicateParams.maxPredicateDataLength),
3404
- maxGasPerPredicate: bn14(predicateParams.maxGasPerPredicate),
3405
- gasPriceFactor: bn14(feeParams.gasPriceFactor),
3406
- gasPerByte: bn14(feeParams.gasPerByte),
3407
- maxMessageDataLength: bn14(predicateParams.maxMessageDataLength),
3408
- chainId: bn14(consensusParameters.chainId),
3469
+ contractMaxSize: bn15(contractParams.contractMaxSize),
3470
+ maxInputs: bn15(txParams.maxInputs),
3471
+ maxOutputs: bn15(txParams.maxOutputs),
3472
+ maxWitnesses: bn15(txParams.maxWitnesses),
3473
+ maxGasPerTx: bn15(txParams.maxGasPerTx),
3474
+ maxScriptLength: bn15(scriptParams.maxScriptLength),
3475
+ maxScriptDataLength: bn15(scriptParams.maxScriptDataLength),
3476
+ maxStorageSlots: bn15(contractParams.maxStorageSlots),
3477
+ maxPredicateLength: bn15(predicateParams.maxPredicateLength),
3478
+ maxPredicateDataLength: bn15(predicateParams.maxPredicateDataLength),
3479
+ maxGasPerPredicate: bn15(predicateParams.maxGasPerPredicate),
3480
+ gasPriceFactor: bn15(feeParams.gasPriceFactor),
3481
+ gasPerByte: bn15(feeParams.gasPerByte),
3482
+ maxMessageDataLength: bn15(predicateParams.maxMessageDataLength),
3483
+ chainId: bn15(consensusParameters.chainId),
3409
3484
  gasCosts
3410
3485
  },
3411
3486
  gasCosts,
3412
3487
  latestBlock: {
3413
3488
  id: latestBlock.id,
3414
- height: bn14(latestBlock.header.height),
3489
+ height: bn15(latestBlock.header.height),
3415
3490
  time: latestBlock.header.time,
3416
3491
  transactions: latestBlock.transactions.map((i) => ({
3417
3492
  id: i.id
@@ -3481,8 +3556,8 @@ var _Provider = class {
3481
3556
  getChain() {
3482
3557
  const chain = _Provider.chainInfoCache[this.url];
3483
3558
  if (!chain) {
3484
- throw new FuelError12(
3485
- ErrorCode12.CHAIN_INFO_CACHE_EMPTY,
3559
+ throw new FuelError13(
3560
+ ErrorCode13.CHAIN_INFO_CACHE_EMPTY,
3486
3561
  "Chain info cache is empty. Make sure you have called `Provider.create` to initialize the provider."
3487
3562
  );
3488
3563
  }
@@ -3494,8 +3569,8 @@ var _Provider = class {
3494
3569
  getNode() {
3495
3570
  const node = _Provider.nodeInfoCache[this.url];
3496
3571
  if (!node) {
3497
- throw new FuelError12(
3498
- ErrorCode12.NODE_INFO_CACHE_EMPTY,
3572
+ throw new FuelError13(
3573
+ ErrorCode13.NODE_INFO_CACHE_EMPTY,
3499
3574
  "Node info cache is empty. Make sure you have called `Provider.create` to initialize the provider."
3500
3575
  );
3501
3576
  }
@@ -3542,8 +3617,8 @@ var _Provider = class {
3542
3617
  static ensureClientVersionIsSupported(nodeInfo) {
3543
3618
  const { isMajorSupported, isMinorSupported, supportedVersion } = checkFuelCoreVersionCompatibility(nodeInfo.nodeVersion);
3544
3619
  if (!isMajorSupported || !isMinorSupported) {
3545
- throw new FuelError12(
3546
- FuelError12.CODES.UNSUPPORTED_FUEL_CLIENT_VERSION,
3620
+ throw new FuelError13(
3621
+ FuelError13.CODES.UNSUPPORTED_FUEL_CLIENT_VERSION,
3547
3622
  `Fuel client version: ${nodeInfo.nodeVersion}, Supported version: ${supportedVersion}`
3548
3623
  );
3549
3624
  }
@@ -3606,7 +3681,7 @@ var _Provider = class {
3606
3681
  */
3607
3682
  async getBlockNumber() {
3608
3683
  const { chain } = await this.operations.getChain();
3609
- return bn14(chain.latestBlock.header.height, 10);
3684
+ return bn15(chain.latestBlock.header.height, 10);
3610
3685
  }
3611
3686
  /**
3612
3687
  * Returns the chain information.
@@ -3616,9 +3691,9 @@ var _Provider = class {
3616
3691
  async fetchNode() {
3617
3692
  const { nodeInfo } = await this.operations.getNodeInfo();
3618
3693
  const processedNodeInfo = {
3619
- maxDepth: bn14(nodeInfo.maxDepth),
3620
- maxTx: bn14(nodeInfo.maxTx),
3621
- minGasPrice: bn14(nodeInfo.minGasPrice),
3694
+ maxDepth: bn15(nodeInfo.maxDepth),
3695
+ maxTx: bn15(nodeInfo.maxTx),
3696
+ minGasPrice: bn15(nodeInfo.minGasPrice),
3622
3697
  nodeVersion: nodeInfo.nodeVersion,
3623
3698
  utxoValidation: nodeInfo.utxoValidation,
3624
3699
  vmBacktrace: nodeInfo.vmBacktrace,
@@ -3673,8 +3748,8 @@ var _Provider = class {
3673
3748
  const subscription = this.operations.submitAndAwait({ encodedTransaction });
3674
3749
  for await (const { submitAndAwait } of subscription) {
3675
3750
  if (submitAndAwait.type === "SqueezedOutStatus") {
3676
- throw new FuelError12(
3677
- ErrorCode12.TRANSACTION_SQUEEZED_OUT,
3751
+ throw new FuelError13(
3752
+ ErrorCode13.TRANSACTION_SQUEEZED_OUT,
3678
3753
  `Transaction Squeezed Out with reason: ${submitAndAwait.reason}`
3679
3754
  );
3680
3755
  }
@@ -3741,7 +3816,7 @@ var _Provider = class {
3741
3816
  } = response;
3742
3817
  if (inputs) {
3743
3818
  inputs.forEach((input, index) => {
3744
- if ("predicateGasUsed" in input && bn14(input.predicateGasUsed).gt(0)) {
3819
+ if ("predicateGasUsed" in input && bn15(input.predicateGasUsed).gt(0)) {
3745
3820
  transactionRequest.inputs[index].predicateGasUsed = input.predicateGasUsed;
3746
3821
  }
3747
3822
  });
@@ -3854,7 +3929,7 @@ var _Provider = class {
3854
3929
  txRequestClone.fundWithFakeUtxos(allQuantities, resourcesOwner?.address);
3855
3930
  if (estimatePredicates) {
3856
3931
  if (isScriptTransaction) {
3857
- txRequestClone.gasLimit = bn14(0);
3932
+ txRequestClone.gasLimit = bn15(0);
3858
3933
  }
3859
3934
  if (resourcesOwner && "populateTransactionPredicateData" in resourcesOwner) {
3860
3935
  resourcesOwner.populateTransactionPredicateData(txRequestClone);
@@ -3870,8 +3945,8 @@ var _Provider = class {
3870
3945
  let missingContractIds = [];
3871
3946
  let outputVariables = 0;
3872
3947
  if (isScriptTransaction && estimateTxDependencies) {
3873
- txRequestClone.gasPrice = bn14(0);
3874
- txRequestClone.gasLimit = bn14(maxGasPerTx.sub(maxGas).toNumber() * 0.9);
3948
+ txRequestClone.gasPrice = bn15(0);
3949
+ txRequestClone.gasLimit = bn15(maxGasPerTx.sub(maxGas).toNumber() * 0.9);
3875
3950
  const result = await this.estimateTxDependencies(txRequestClone);
3876
3951
  receipts = result.receipts;
3877
3952
  outputVariables = result.outputVariables;
@@ -3933,11 +4008,11 @@ var _Provider = class {
3933
4008
  return coins.map((coin) => ({
3934
4009
  id: coin.utxoId,
3935
4010
  assetId: coin.assetId,
3936
- amount: bn14(coin.amount),
4011
+ amount: bn15(coin.amount),
3937
4012
  owner: Address2.fromAddressOrString(coin.owner),
3938
- maturity: bn14(coin.maturity).toNumber(),
3939
- blockCreated: bn14(coin.blockCreated),
3940
- txCreatedIdx: bn14(coin.txCreatedIdx)
4013
+ maturity: bn15(coin.maturity).toNumber(),
4014
+ blockCreated: bn15(coin.blockCreated),
4015
+ txCreatedIdx: bn15(coin.txCreatedIdx)
3941
4016
  }));
3942
4017
  }
3943
4018
  /**
@@ -3974,9 +4049,9 @@ var _Provider = class {
3974
4049
  switch (coin.__typename) {
3975
4050
  case "MessageCoin":
3976
4051
  return {
3977
- amount: bn14(coin.amount),
4052
+ amount: bn15(coin.amount),
3978
4053
  assetId: coin.assetId,
3979
- daHeight: bn14(coin.daHeight),
4054
+ daHeight: bn15(coin.daHeight),
3980
4055
  sender: Address2.fromAddressOrString(coin.sender),
3981
4056
  recipient: Address2.fromAddressOrString(coin.recipient),
3982
4057
  nonce: coin.nonce
@@ -3984,12 +4059,12 @@ var _Provider = class {
3984
4059
  case "Coin":
3985
4060
  return {
3986
4061
  id: coin.utxoId,
3987
- amount: bn14(coin.amount),
4062
+ amount: bn15(coin.amount),
3988
4063
  assetId: coin.assetId,
3989
4064
  owner: Address2.fromAddressOrString(coin.owner),
3990
- maturity: bn14(coin.maturity).toNumber(),
3991
- blockCreated: bn14(coin.blockCreated),
3992
- txCreatedIdx: bn14(coin.txCreatedIdx)
4065
+ maturity: bn15(coin.maturity).toNumber(),
4066
+ blockCreated: bn15(coin.blockCreated),
4067
+ txCreatedIdx: bn15(coin.txCreatedIdx)
3993
4068
  };
3994
4069
  default:
3995
4070
  return null;
@@ -4006,13 +4081,13 @@ var _Provider = class {
4006
4081
  async getBlock(idOrHeight) {
4007
4082
  let variables;
4008
4083
  if (typeof idOrHeight === "number") {
4009
- variables = { height: bn14(idOrHeight).toString(10) };
4084
+ variables = { height: bn15(idOrHeight).toString(10) };
4010
4085
  } else if (idOrHeight === "latest") {
4011
4086
  variables = { height: (await this.getBlockNumber()).toString(10) };
4012
4087
  } else if (idOrHeight.length === 66) {
4013
4088
  variables = { blockId: idOrHeight };
4014
4089
  } else {
4015
- variables = { blockId: bn14(idOrHeight).toString(10) };
4090
+ variables = { blockId: bn15(idOrHeight).toString(10) };
4016
4091
  }
4017
4092
  const { block } = await this.operations.getBlock(variables);
4018
4093
  if (!block) {
@@ -4020,7 +4095,7 @@ var _Provider = class {
4020
4095
  }
4021
4096
  return {
4022
4097
  id: block.id,
4023
- height: bn14(block.header.height),
4098
+ height: bn15(block.header.height),
4024
4099
  time: block.header.time,
4025
4100
  transactionIds: block.transactions.map((tx) => tx.id)
4026
4101
  };
@@ -4035,7 +4110,7 @@ var _Provider = class {
4035
4110
  const { blocks: fetchedData } = await this.operations.getBlocks(params);
4036
4111
  const blocks = fetchedData.edges.map(({ node: block }) => ({
4037
4112
  id: block.id,
4038
- height: bn14(block.header.height),
4113
+ height: bn15(block.header.height),
4039
4114
  time: block.header.time,
4040
4115
  transactionIds: block.transactions.map((tx) => tx.id)
4041
4116
  }));
@@ -4050,7 +4125,7 @@ var _Provider = class {
4050
4125
  async getBlockWithTransactions(idOrHeight) {
4051
4126
  let variables;
4052
4127
  if (typeof idOrHeight === "number") {
4053
- variables = { blockHeight: bn14(idOrHeight).toString(10) };
4128
+ variables = { blockHeight: bn15(idOrHeight).toString(10) };
4054
4129
  } else if (idOrHeight === "latest") {
4055
4130
  variables = { blockHeight: (await this.getBlockNumber()).toString() };
4056
4131
  } else {
@@ -4062,7 +4137,7 @@ var _Provider = class {
4062
4137
  }
4063
4138
  return {
4064
4139
  id: block.id,
4065
- height: bn14(block.header.height, 10),
4140
+ height: bn15(block.header.height, 10),
4066
4141
  time: block.header.time,
4067
4142
  transactionIds: block.transactions.map((tx) => tx.id),
4068
4143
  transactions: block.transactions.map(
@@ -4111,7 +4186,7 @@ var _Provider = class {
4111
4186
  contract: Address2.fromAddressOrString(contractId).toB256(),
4112
4187
  asset: hexlify12(assetId)
4113
4188
  });
4114
- return bn14(contractBalance.amount, 10);
4189
+ return bn15(contractBalance.amount, 10);
4115
4190
  }
4116
4191
  /**
4117
4192
  * Returns the balance for the given owner for the given asset ID.
@@ -4125,7 +4200,7 @@ var _Provider = class {
4125
4200
  owner: Address2.fromAddressOrString(owner).toB256(),
4126
4201
  assetId: hexlify12(assetId)
4127
4202
  });
4128
- return bn14(balance.amount, 10);
4203
+ return bn15(balance.amount, 10);
4129
4204
  }
4130
4205
  /**
4131
4206
  * Returns balances for the given owner.
@@ -4143,7 +4218,7 @@ var _Provider = class {
4143
4218
  const balances = result.balances.edges.map((edge) => edge.node);
4144
4219
  return balances.map((balance) => ({
4145
4220
  assetId: balance.assetId,
4146
- amount: bn14(balance.amount)
4221
+ amount: bn15(balance.amount)
4147
4222
  }));
4148
4223
  }
4149
4224
  /**
@@ -4165,15 +4240,15 @@ var _Provider = class {
4165
4240
  sender: message.sender,
4166
4241
  recipient: message.recipient,
4167
4242
  nonce: message.nonce,
4168
- amount: bn14(message.amount),
4243
+ amount: bn15(message.amount),
4169
4244
  data: message.data
4170
4245
  }),
4171
4246
  sender: Address2.fromAddressOrString(message.sender),
4172
4247
  recipient: Address2.fromAddressOrString(message.recipient),
4173
4248
  nonce: message.nonce,
4174
- amount: bn14(message.amount),
4249
+ amount: bn15(message.amount),
4175
4250
  data: InputMessageCoder.decodeData(message.data),
4176
- daHeight: bn14(message.daHeight)
4251
+ daHeight: bn15(message.daHeight)
4177
4252
  }));
4178
4253
  }
4179
4254
  /**
@@ -4191,8 +4266,8 @@ var _Provider = class {
4191
4266
  nonce
4192
4267
  };
4193
4268
  if (commitBlockId && commitBlockHeight) {
4194
- throw new FuelError12(
4195
- ErrorCode12.INVALID_INPUT_PARAMETERS,
4269
+ throw new FuelError13(
4270
+ ErrorCode13.INVALID_INPUT_PARAMETERS,
4196
4271
  "commitBlockId and commitBlockHeight cannot be used together"
4197
4272
  );
4198
4273
  }
@@ -4226,41 +4301,41 @@ var _Provider = class {
4226
4301
  } = result.messageProof;
4227
4302
  return {
4228
4303
  messageProof: {
4229
- proofIndex: bn14(messageProof.proofIndex),
4304
+ proofIndex: bn15(messageProof.proofIndex),
4230
4305
  proofSet: messageProof.proofSet
4231
4306
  },
4232
4307
  blockProof: {
4233
- proofIndex: bn14(blockProof.proofIndex),
4308
+ proofIndex: bn15(blockProof.proofIndex),
4234
4309
  proofSet: blockProof.proofSet
4235
4310
  },
4236
4311
  messageBlockHeader: {
4237
4312
  id: messageBlockHeader.id,
4238
- daHeight: bn14(messageBlockHeader.daHeight),
4239
- transactionsCount: bn14(messageBlockHeader.transactionsCount),
4313
+ daHeight: bn15(messageBlockHeader.daHeight),
4314
+ transactionsCount: bn15(messageBlockHeader.transactionsCount),
4240
4315
  transactionsRoot: messageBlockHeader.transactionsRoot,
4241
- height: bn14(messageBlockHeader.height),
4316
+ height: bn15(messageBlockHeader.height),
4242
4317
  prevRoot: messageBlockHeader.prevRoot,
4243
4318
  time: messageBlockHeader.time,
4244
4319
  applicationHash: messageBlockHeader.applicationHash,
4245
4320
  messageReceiptRoot: messageBlockHeader.messageReceiptRoot,
4246
- messageReceiptCount: bn14(messageBlockHeader.messageReceiptCount)
4321
+ messageReceiptCount: bn15(messageBlockHeader.messageReceiptCount)
4247
4322
  },
4248
4323
  commitBlockHeader: {
4249
4324
  id: commitBlockHeader.id,
4250
- daHeight: bn14(commitBlockHeader.daHeight),
4251
- transactionsCount: bn14(commitBlockHeader.transactionsCount),
4325
+ daHeight: bn15(commitBlockHeader.daHeight),
4326
+ transactionsCount: bn15(commitBlockHeader.transactionsCount),
4252
4327
  transactionsRoot: commitBlockHeader.transactionsRoot,
4253
- height: bn14(commitBlockHeader.height),
4328
+ height: bn15(commitBlockHeader.height),
4254
4329
  prevRoot: commitBlockHeader.prevRoot,
4255
4330
  time: commitBlockHeader.time,
4256
4331
  applicationHash: commitBlockHeader.applicationHash,
4257
4332
  messageReceiptRoot: commitBlockHeader.messageReceiptRoot,
4258
- messageReceiptCount: bn14(commitBlockHeader.messageReceiptCount)
4333
+ messageReceiptCount: bn15(commitBlockHeader.messageReceiptCount)
4259
4334
  },
4260
4335
  sender: Address2.fromAddressOrString(sender),
4261
4336
  recipient: Address2.fromAddressOrString(recipient),
4262
4337
  nonce,
4263
- amount: bn14(amount),
4338
+ amount: bn15(amount),
4264
4339
  data
4265
4340
  };
4266
4341
  }
@@ -4283,10 +4358,10 @@ var _Provider = class {
4283
4358
  */
4284
4359
  async produceBlocks(amount, startTime) {
4285
4360
  const { produceBlocks: latestBlockHeight } = await this.operations.produceBlocks({
4286
- blocksToProduce: bn14(amount).toString(10),
4361
+ blocksToProduce: bn15(amount).toString(10),
4287
4362
  startTimestamp: startTime ? DateTime2.fromUnixMilliseconds(startTime).toTai64() : void 0
4288
4363
  });
4289
- return bn14(latestBlockHeight);
4364
+ return bn15(latestBlockHeight);
4290
4365
  }
4291
4366
  // eslint-disable-next-line @typescript-eslint/require-await
4292
4367
  async getTransactionResponse(transactionId) {
@@ -4309,8 +4384,8 @@ __publicField(Provider, "chainInfoCache", {});
4309
4384
  __publicField(Provider, "nodeInfoCache", {});
4310
4385
 
4311
4386
  // src/providers/transaction-summary/get-transaction-summary.ts
4312
- import { ErrorCode as ErrorCode13, FuelError as FuelError13 } from "@fuel-ts/errors";
4313
- import { bn as bn15 } from "@fuel-ts/math";
4387
+ import { ErrorCode as ErrorCode14, FuelError as FuelError14 } from "@fuel-ts/errors";
4388
+ import { bn as bn16 } from "@fuel-ts/math";
4314
4389
  import { TransactionCoder as TransactionCoder6 } from "@fuel-ts/transactions";
4315
4390
  import { arrayify as arrayify12 } from "@fuel-ts/utils";
4316
4391
 
@@ -4427,7 +4502,7 @@ var Account = class extends AbstractAccount {
4427
4502
  */
4428
4503
  get provider() {
4429
4504
  if (!this._provider) {
4430
- throw new FuelError14(ErrorCode14.MISSING_PROVIDER, "Provider not set");
4505
+ throw new FuelError15(ErrorCode15.MISSING_PROVIDER, "Provider not set");
4431
4506
  }
4432
4507
  return this._provider;
4433
4508
  }
@@ -4479,8 +4554,8 @@ var Account = class extends AbstractAccount {
4479
4554
  if (!hasNextPage) {
4480
4555
  break;
4481
4556
  }
4482
- throw new FuelError14(
4483
- ErrorCode14.NOT_SUPPORTED,
4557
+ throw new FuelError15(
4558
+ ErrorCode15.NOT_SUPPORTED,
4484
4559
  `Wallets containing more than ${pageSize} coins exceed the current supported limit.`
4485
4560
  );
4486
4561
  }
@@ -4505,8 +4580,8 @@ var Account = class extends AbstractAccount {
4505
4580
  if (!hasNextPage) {
4506
4581
  break;
4507
4582
  }
4508
- throw new FuelError14(
4509
- ErrorCode14.NOT_SUPPORTED,
4583
+ throw new FuelError15(
4584
+ ErrorCode15.NOT_SUPPORTED,
4510
4585
  `Wallets containing more than ${pageSize} messages exceed the current supported limit.`
4511
4586
  );
4512
4587
  }
@@ -4541,8 +4616,8 @@ var Account = class extends AbstractAccount {
4541
4616
  if (!hasNextPage) {
4542
4617
  break;
4543
4618
  }
4544
- throw new FuelError14(
4545
- ErrorCode14.NOT_SUPPORTED,
4619
+ throw new FuelError15(
4620
+ ErrorCode15.NOT_SUPPORTED,
4546
4621
  `Wallets containing more than ${pageSize} balances exceed the current supported limit.`
4547
4622
  );
4548
4623
  }
@@ -4558,7 +4633,7 @@ var Account = class extends AbstractAccount {
4558
4633
  */
4559
4634
  async fund(request, coinQuantities, fee) {
4560
4635
  const updatedQuantities = addAmountToAsset({
4561
- amount: bn16(fee),
4636
+ amount: bn17(fee),
4562
4637
  assetId: BaseAssetId3,
4563
4638
  coinQuantities
4564
4639
  });
@@ -4566,7 +4641,7 @@ var Account = class extends AbstractAccount {
4566
4641
  updatedQuantities.forEach(({ amount, assetId }) => {
4567
4642
  quantitiesDict[assetId] = {
4568
4643
  required: amount,
4569
- owned: bn16(0)
4644
+ owned: bn17(0)
4570
4645
  };
4571
4646
  });
4572
4647
  const cachedUtxos = [];
@@ -4579,7 +4654,7 @@ var Account = class extends AbstractAccount {
4579
4654
  if (isCoin2) {
4580
4655
  const assetId = String(input.assetId);
4581
4656
  if (input.owner === owner && quantitiesDict[assetId]) {
4582
- const amount = bn16(input.amount);
4657
+ const amount = bn17(input.amount);
4583
4658
  quantitiesDict[assetId].owned = quantitiesDict[assetId].owned.add(amount);
4584
4659
  cachedUtxos.push(input.id);
4585
4660
  }
@@ -4625,8 +4700,8 @@ var Account = class extends AbstractAccount {
4625
4700
  estimateTxDependencies: true,
4626
4701
  resourcesOwner: this
4627
4702
  });
4628
- request.gasPrice = bn16(txParams.gasPrice ?? minGasPrice);
4629
- request.gasLimit = bn16(txParams.gasLimit ?? gasUsed);
4703
+ request.gasPrice = bn17(txParams.gasPrice ?? minGasPrice);
4704
+ request.gasLimit = bn17(txParams.gasLimit ?? gasUsed);
4630
4705
  this.validateGas({
4631
4706
  gasUsed,
4632
4707
  gasPrice: request.gasPrice,
@@ -4647,9 +4722,9 @@ var Account = class extends AbstractAccount {
4647
4722
  * @returns A promise that resolves to the transaction response.
4648
4723
  */
4649
4724
  async transfer(destination, amount, assetId = BaseAssetId3, txParams = {}) {
4650
- if (bn16(amount).lte(0)) {
4651
- throw new FuelError14(
4652
- ErrorCode14.INVALID_TRANSFER_AMOUNT,
4725
+ if (bn17(amount).lte(0)) {
4726
+ throw new FuelError15(
4727
+ ErrorCode15.INVALID_TRANSFER_AMOUNT,
4653
4728
  "Transfer amount must be a positive number."
4654
4729
  );
4655
4730
  }
@@ -4666,9 +4741,9 @@ var Account = class extends AbstractAccount {
4666
4741
  * @returns A promise that resolves to the transaction response.
4667
4742
  */
4668
4743
  async transferToContract(contractId, amount, assetId = BaseAssetId3, txParams = {}) {
4669
- if (bn16(amount).lte(0)) {
4670
- throw new FuelError14(
4671
- ErrorCode14.INVALID_TRANSFER_AMOUNT,
4744
+ if (bn17(amount).lte(0)) {
4745
+ throw new FuelError15(
4746
+ ErrorCode15.INVALID_TRANSFER_AMOUNT,
4672
4747
  "Transfer amount must be a positive number."
4673
4748
  );
4674
4749
  }
@@ -4677,7 +4752,7 @@ var Account = class extends AbstractAccount {
4677
4752
  const params = { gasPrice: minGasPrice, ...txParams };
4678
4753
  const { script, scriptData } = await assembleTransferToContractScript({
4679
4754
  hexlifiedContractId: contractAddress.toB256(),
4680
- amountToTransfer: bn16(amount),
4755
+ amountToTransfer: bn17(amount),
4681
4756
  assetId
4682
4757
  });
4683
4758
  const request = new ScriptTransactionRequest({
@@ -4688,9 +4763,9 @@ var Account = class extends AbstractAccount {
4688
4763
  request.addContractInputAndOutput(contractAddress);
4689
4764
  const { maxFee, requiredQuantities, gasUsed } = await this.provider.getTransactionCost(
4690
4765
  request,
4691
- [{ amount: bn16(amount), assetId: String(assetId) }]
4766
+ [{ amount: bn17(amount), assetId: String(assetId) }]
4692
4767
  );
4693
- request.gasLimit = bn16(params.gasLimit ?? gasUsed);
4768
+ request.gasLimit = bn17(params.gasLimit ?? gasUsed);
4694
4769
  this.validateGas({
4695
4770
  gasUsed,
4696
4771
  gasPrice: request.gasPrice,
@@ -4715,7 +4790,7 @@ var Account = class extends AbstractAccount {
4715
4790
  "0x".concat(recipientAddress.toHexString().substring(2).padStart(64, "0"))
4716
4791
  );
4717
4792
  const amountDataArray = arrayify14(
4718
- "0x".concat(bn16(amount).toHex().substring(2).padStart(16, "0"))
4793
+ "0x".concat(bn17(amount).toHex().substring(2).padStart(16, "0"))
4719
4794
  );
4720
4795
  const script = new Uint8Array([
4721
4796
  ...arrayify14(withdrawScript.bytes),
@@ -4724,12 +4799,12 @@ var Account = class extends AbstractAccount {
4724
4799
  ]);
4725
4800
  const params = { script, gasPrice: minGasPrice, ...txParams };
4726
4801
  const request = new ScriptTransactionRequest(params);
4727
- const forwardingQuantities = [{ amount: bn16(amount), assetId: BaseAssetId3 }];
4802
+ const forwardingQuantities = [{ amount: bn17(amount), assetId: BaseAssetId3 }];
4728
4803
  const { requiredQuantities, maxFee, gasUsed } = await this.provider.getTransactionCost(
4729
4804
  request,
4730
4805
  forwardingQuantities
4731
4806
  );
4732
- request.gasLimit = bn16(params.gasLimit ?? gasUsed);
4807
+ request.gasLimit = bn17(params.gasLimit ?? gasUsed);
4733
4808
  this.validateGas({
4734
4809
  gasUsed,
4735
4810
  gasPrice: request.gasPrice,
@@ -4741,7 +4816,7 @@ var Account = class extends AbstractAccount {
4741
4816
  }
4742
4817
  async signMessage(message) {
4743
4818
  if (!this._connector) {
4744
- throw new FuelError14(ErrorCode14.MISSING_CONNECTOR, "A connector is required to sign messages.");
4819
+ throw new FuelError15(ErrorCode15.MISSING_CONNECTOR, "A connector is required to sign messages.");
4745
4820
  }
4746
4821
  return this._connector.signMessage(this.address.toString(), message);
4747
4822
  }
@@ -4753,8 +4828,8 @@ var Account = class extends AbstractAccount {
4753
4828
  */
4754
4829
  async signTransaction(transactionRequestLike) {
4755
4830
  if (!this._connector) {
4756
- throw new FuelError14(
4757
- ErrorCode14.MISSING_CONNECTOR,
4831
+ throw new FuelError15(
4832
+ ErrorCode15.MISSING_CONNECTOR,
4758
4833
  "A connector is required to sign transactions."
4759
4834
  );
4760
4835
  }
@@ -4801,14 +4876,14 @@ var Account = class extends AbstractAccount {
4801
4876
  minGasPrice
4802
4877
  }) {
4803
4878
  if (minGasPrice.gt(gasPrice)) {
4804
- throw new FuelError14(
4805
- ErrorCode14.GAS_PRICE_TOO_LOW,
4879
+ throw new FuelError15(
4880
+ ErrorCode15.GAS_PRICE_TOO_LOW,
4806
4881
  `Gas price '${gasPrice}' is lower than the required: '${minGasPrice}'.`
4807
4882
  );
4808
4883
  }
4809
4884
  if (gasUsed.gt(gasLimit)) {
4810
- throw new FuelError14(
4811
- ErrorCode14.GAS_LIMIT_TOO_LOW,
4885
+ throw new FuelError15(
4886
+ ErrorCode15.GAS_LIMIT_TOO_LOW,
4812
4887
  `Gas limit '${gasLimit}' is lower than the required: '${gasUsed}'.`
4813
4888
  );
4814
4889
  }
@@ -4935,7 +5010,7 @@ import {
4935
5010
  decryptJsonWalletData,
4936
5011
  encryptJsonWalletData
4937
5012
  } from "@fuel-ts/crypto";
4938
- import { ErrorCode as ErrorCode15, FuelError as FuelError15 } from "@fuel-ts/errors";
5013
+ import { ErrorCode as ErrorCode16, FuelError as FuelError16 } from "@fuel-ts/errors";
4939
5014
  import { hexlify as hexlify14 } from "@fuel-ts/utils";
4940
5015
  import { v4 as uuidv4 } from "uuid";
4941
5016
  var DEFAULT_KDF_PARAMS_LOG_N = 13;
@@ -5013,8 +5088,8 @@ async function decryptKeystoreWallet(jsonWallet, password) {
5013
5088
  const macHashUint8Array = keccak256(data);
5014
5089
  const macHash = stringFromBuffer(macHashUint8Array, "hex");
5015
5090
  if (mac !== macHash) {
5016
- throw new FuelError15(
5017
- ErrorCode15.INVALID_PASSWORD,
5091
+ throw new FuelError16(
5092
+ ErrorCode16.INVALID_PASSWORD,
5018
5093
  "Failed to decrypt the keystore wallet, the provided password is incorrect."
5019
5094
  );
5020
5095
  }
@@ -5136,15 +5211,15 @@ var BaseWalletUnlocked = class extends Account {
5136
5211
  __publicField(BaseWalletUnlocked, "defaultPath", "m/44'/1179993420'/0'/0/0");
5137
5212
 
5138
5213
  // src/hdwallet/hdwallet.ts
5139
- import { ErrorCode as ErrorCode18, FuelError as FuelError18 } from "@fuel-ts/errors";
5214
+ import { ErrorCode as ErrorCode19, FuelError as FuelError19 } from "@fuel-ts/errors";
5140
5215
  import { sha256 as sha2564 } from "@fuel-ts/hasher";
5141
- import { bn as bn17, toBytes as toBytes2, toHex } from "@fuel-ts/math";
5216
+ import { bn as bn18, toBytes as toBytes2, toHex } from "@fuel-ts/math";
5142
5217
  import { arrayify as arrayify18, hexlify as hexlify17, concat as concat5 } from "@fuel-ts/utils";
5143
5218
  import { toBeHex, dataSlice as dataSlice2, encodeBase58 as encodeBase582, decodeBase58, computeHmac as computeHmac2, ripemd160 } from "ethers";
5144
5219
 
5145
5220
  // src/mnemonic/mnemonic.ts
5146
5221
  import { randomBytes as randomBytes3 } from "@fuel-ts/crypto";
5147
- import { ErrorCode as ErrorCode17, FuelError as FuelError17 } from "@fuel-ts/errors";
5222
+ import { ErrorCode as ErrorCode18, FuelError as FuelError18 } from "@fuel-ts/errors";
5148
5223
  import { sha256 as sha2563 } from "@fuel-ts/hasher";
5149
5224
  import { arrayify as arrayify17, hexlify as hexlify16, concat as concat4 } from "@fuel-ts/utils";
5150
5225
  import { dataSlice, pbkdf2, computeHmac, encodeBase58 } from "ethers";
@@ -7202,7 +7277,7 @@ var english = [
7202
7277
  ];
7203
7278
 
7204
7279
  // src/mnemonic/utils.ts
7205
- import { ErrorCode as ErrorCode16, FuelError as FuelError16 } from "@fuel-ts/errors";
7280
+ import { ErrorCode as ErrorCode17, FuelError as FuelError17 } from "@fuel-ts/errors";
7206
7281
  import { sha256 as sha2562 } from "@fuel-ts/hasher";
7207
7282
  import { arrayify as arrayify16 } from "@fuel-ts/utils";
7208
7283
  function toUtf8Bytes(stri) {
@@ -7219,8 +7294,8 @@ function toUtf8Bytes(stri) {
7219
7294
  i += 1;
7220
7295
  const c2 = str.charCodeAt(i);
7221
7296
  if (i >= str.length || (c2 & 64512) !== 56320) {
7222
- throw new FuelError16(
7223
- ErrorCode16.INVALID_INPUT_PARAMETERS,
7297
+ throw new FuelError17(
7298
+ ErrorCode17.INVALID_INPUT_PARAMETERS,
7224
7299
  "Invalid UTF-8 in the input string."
7225
7300
  );
7226
7301
  }
@@ -7283,8 +7358,8 @@ function mnemonicWordsToEntropy(words, wordlist) {
7283
7358
  for (let i = 0; i < words.length; i += 1) {
7284
7359
  const index = wordlist.indexOf(words[i].normalize("NFKD"));
7285
7360
  if (index === -1) {
7286
- throw new FuelError16(
7287
- ErrorCode16.INVALID_MNEMONIC,
7361
+ throw new FuelError17(
7362
+ ErrorCode17.INVALID_MNEMONIC,
7288
7363
  `Invalid mnemonic: the word '${words[i]}' is not found in the provided wordlist.`
7289
7364
  );
7290
7365
  }
@@ -7300,8 +7375,8 @@ function mnemonicWordsToEntropy(words, wordlist) {
7300
7375
  const checksumMask = getUpperMask(checksumBits);
7301
7376
  const checksum = arrayify16(sha2562(entropy.slice(0, entropyBits / 8)))[0] & checksumMask;
7302
7377
  if (checksum !== (entropy[entropy.length - 1] & checksumMask)) {
7303
- throw new FuelError16(
7304
- ErrorCode16.INVALID_CHECKSUM,
7378
+ throw new FuelError17(
7379
+ ErrorCode17.INVALID_CHECKSUM,
7305
7380
  "Checksum validation failed for the provided mnemonic."
7306
7381
  );
7307
7382
  }
@@ -7315,16 +7390,16 @@ var TestnetPRV = "0x04358394";
7315
7390
  var MNEMONIC_SIZES = [12, 15, 18, 21, 24];
7316
7391
  function assertWordList(wordlist) {
7317
7392
  if (wordlist.length !== 2048) {
7318
- throw new FuelError17(
7319
- ErrorCode17.INVALID_WORD_LIST,
7393
+ throw new FuelError18(
7394
+ ErrorCode18.INVALID_WORD_LIST,
7320
7395
  `Expected word list length of 2048, but got ${wordlist.length}.`
7321
7396
  );
7322
7397
  }
7323
7398
  }
7324
7399
  function assertEntropy(entropy) {
7325
7400
  if (entropy.length % 4 !== 0 || entropy.length < 16 || entropy.length > 32) {
7326
- throw new FuelError17(
7327
- ErrorCode17.INVALID_ENTROPY,
7401
+ throw new FuelError18(
7402
+ ErrorCode18.INVALID_ENTROPY,
7328
7403
  `Entropy should be between 16 and 32 bytes and a multiple of 4, but got ${entropy.length} bytes.`
7329
7404
  );
7330
7405
  }
@@ -7334,7 +7409,7 @@ function assertMnemonic(words) {
7334
7409
  const errorMsg = `Invalid mnemonic size. Expected one of [${MNEMONIC_SIZES.join(
7335
7410
  ", "
7336
7411
  )}] words, but got ${words.length}.`;
7337
- throw new FuelError17(ErrorCode17.INVALID_MNEMONIC, errorMsg);
7412
+ throw new FuelError18(ErrorCode18.INVALID_MNEMONIC, errorMsg);
7338
7413
  }
7339
7414
  }
7340
7415
  var Mnemonic = class {
@@ -7452,8 +7527,8 @@ var Mnemonic = class {
7452
7527
  static masterKeysFromSeed(seed) {
7453
7528
  const seedArray = arrayify17(seed);
7454
7529
  if (seedArray.length < 16 || seedArray.length > 64) {
7455
- throw new FuelError17(
7456
- ErrorCode17.INVALID_SEED,
7530
+ throw new FuelError18(
7531
+ ErrorCode18.INVALID_SEED,
7457
7532
  `Seed length should be between 16 and 64 bytes, but received ${seedArray.length} bytes.`
7458
7533
  );
7459
7534
  }
@@ -7530,7 +7605,7 @@ function isValidExtendedKey(extendedKey) {
7530
7605
  function parsePath(path2, depth = 0) {
7531
7606
  const components = path2.split("/");
7532
7607
  if (components.length === 0 || components[0] === "m" && depth !== 0) {
7533
- throw new FuelError18(ErrorCode18.HD_WALLET_ERROR, `invalid path - ${path2}`);
7608
+ throw new FuelError19(ErrorCode19.HD_WALLET_ERROR, `invalid path - ${path2}`);
7534
7609
  }
7535
7610
  if (components[0] === "m") {
7536
7611
  components.shift();
@@ -7559,8 +7634,8 @@ var HDWallet = class {
7559
7634
  this.privateKey = hexlify17(config.privateKey);
7560
7635
  } else {
7561
7636
  if (!config.publicKey) {
7562
- throw new FuelError18(
7563
- ErrorCode18.HD_WALLET_ERROR,
7637
+ throw new FuelError19(
7638
+ ErrorCode19.HD_WALLET_ERROR,
7564
7639
  "Both public and private Key cannot be missing. At least one should be provided."
7565
7640
  );
7566
7641
  }
@@ -7589,8 +7664,8 @@ var HDWallet = class {
7589
7664
  const data = new Uint8Array(37);
7590
7665
  if (index & HARDENED_INDEX) {
7591
7666
  if (!privateKey) {
7592
- throw new FuelError18(
7593
- ErrorCode18.HD_WALLET_ERROR,
7667
+ throw new FuelError19(
7668
+ ErrorCode19.HD_WALLET_ERROR,
7594
7669
  "Cannot derive a hardened index without a private Key."
7595
7670
  );
7596
7671
  }
@@ -7604,7 +7679,7 @@ var HDWallet = class {
7604
7679
  const IR = bytes.slice(32);
7605
7680
  if (privateKey) {
7606
7681
  const N = "0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141";
7607
- const ki = bn17(IL).add(privateKey).mod(N).toBytes(32);
7682
+ const ki = bn18(IL).add(privateKey).mod(N).toBytes(32);
7608
7683
  return new HDWallet({
7609
7684
  privateKey: ki,
7610
7685
  chainCode: IR,
@@ -7642,8 +7717,8 @@ var HDWallet = class {
7642
7717
  */
7643
7718
  toExtendedKey(isPublic = false, testnet = false) {
7644
7719
  if (this.depth >= 256) {
7645
- throw new FuelError18(
7646
- ErrorCode18.HD_WALLET_ERROR,
7720
+ throw new FuelError19(
7721
+ ErrorCode19.HD_WALLET_ERROR,
7647
7722
  `Exceeded max depth of 255. Current depth: ${this.depth}.`
7648
7723
  );
7649
7724
  }
@@ -7674,10 +7749,10 @@ var HDWallet = class {
7674
7749
  const bytes = arrayify18(decoded);
7675
7750
  const validChecksum = base58check(bytes.slice(0, 78)) === extendedKey;
7676
7751
  if (bytes.length !== 82 || !isValidExtendedKey(bytes)) {
7677
- throw new FuelError18(ErrorCode18.HD_WALLET_ERROR, "Provided key is not a valid extended key.");
7752
+ throw new FuelError19(ErrorCode19.HD_WALLET_ERROR, "Provided key is not a valid extended key.");
7678
7753
  }
7679
7754
  if (!validChecksum) {
7680
- throw new FuelError18(ErrorCode18.HD_WALLET_ERROR, "Provided key has an invalid checksum.");
7755
+ throw new FuelError19(ErrorCode19.HD_WALLET_ERROR, "Provided key has an invalid checksum.");
7681
7756
  }
7682
7757
  const depth = bytes[4];
7683
7758
  const parentFingerprint = hexlify17(bytes.slice(5, 9));
@@ -7685,14 +7760,14 @@ var HDWallet = class {
7685
7760
  const chainCode = hexlify17(bytes.slice(13, 45));
7686
7761
  const key = bytes.slice(45, 78);
7687
7762
  if (depth === 0 && parentFingerprint !== "0x00000000" || depth === 0 && index !== 0) {
7688
- throw new FuelError18(
7689
- ErrorCode18.HD_WALLET_ERROR,
7763
+ throw new FuelError19(
7764
+ ErrorCode19.HD_WALLET_ERROR,
7690
7765
  "Inconsistency detected: Depth is zero but fingerprint/index is non-zero."
7691
7766
  );
7692
7767
  }
7693
7768
  if (isPublicExtendedKey(bytes)) {
7694
7769
  if (key[0] !== 3) {
7695
- throw new FuelError18(ErrorCode18.HD_WALLET_ERROR, "Invalid public extended key.");
7770
+ throw new FuelError19(ErrorCode19.HD_WALLET_ERROR, "Invalid public extended key.");
7696
7771
  }
7697
7772
  return new HDWallet({
7698
7773
  publicKey: key,
@@ -7703,7 +7778,7 @@ var HDWallet = class {
7703
7778
  });
7704
7779
  }
7705
7780
  if (key[0] !== 0) {
7706
- throw new FuelError18(ErrorCode18.HD_WALLET_ERROR, "Invalid private extended key.");
7781
+ throw new FuelError19(ErrorCode19.HD_WALLET_ERROR, "Invalid private extended key.");
7707
7782
  }
7708
7783
  return new HDWallet({
7709
7784
  privateKey: key.slice(1),