@fuel-ts/account 0.0.0-rc-1895-20240404023124 → 0.0.0-rc-1832-20240404064601

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 ErrorCode15, FuelError as FuelError15 } from "@fuel-ts/errors";
28
+ import { ErrorCode as ErrorCode14, FuelError as FuelError14 } from "@fuel-ts/errors";
29
29
  import { AbstractAccount } from "@fuel-ts/interfaces";
30
- import { bn as bn17 } from "@fuel-ts/math";
30
+ import { bn as bn16 } 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 ErrorCode13, FuelError as FuelError13 } from "@fuel-ts/errors";
72
- import { BN, bn as bn15, max } from "@fuel-ts/math";
71
+ import { ErrorCode as ErrorCode12, FuelError as FuelError12 } from "@fuel-ts/errors";
72
+ import { BN, bn as bn14, 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 bn7 } from "@fuel-ts/math";
1155
+ import { bn as bn6 } from "@fuel-ts/math";
1156
1156
  import {
1157
1157
  PolicyType,
1158
1158
  TransactionCoder,
@@ -1495,86 +1495,6 @@ 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
- const reason = status.reason;
1514
- if (PANIC_REASONS.includes(status.reason)) {
1515
- errorMessage = `${errorMessage}
1516
-
1517
- You can read more about this error at:
1518
-
1519
- ${PANIC_DOC_URL}#variant.${status.reason}`;
1520
- }
1521
- return { errorMessage, reason };
1522
- };
1523
- var stringify = (obj) => JSON.stringify(obj, null, 2);
1524
- var assembleRevertError = (receipts, logs) => {
1525
- let errorMessage = "The transaction reverted with an unknown reason.";
1526
- const revertReceipt = receipts.find(({ type }) => type === ReceiptType3.Revert);
1527
- let reason = "";
1528
- if (revertReceipt) {
1529
- const reasonHex = bn6(revertReceipt.val).toHex();
1530
- switch (reasonHex) {
1531
- case FAILED_REQUIRE_SIGNAL: {
1532
- reason = "require";
1533
- errorMessage = `The transaction reverted because a "require" statement has thrown ${logs.length ? stringify(logs[0]) : "an error."}.`;
1534
- break;
1535
- }
1536
- case FAILED_ASSERT_EQ_SIGNAL: {
1537
- const sufix = logs.length >= 2 ? ` comparing ${stringify(logs[1])} and ${stringify(logs[0])}.` : ".";
1538
- reason = "assert_eq";
1539
- errorMessage = `The transaction reverted because of an "assert_eq" statement${sufix}`;
1540
- break;
1541
- }
1542
- case FAILED_ASSERT_NE_SIGNAL: {
1543
- const sufix = logs.length >= 2 ? ` comparing ${stringify(logs[1])} and ${stringify(logs[0])}.` : ".";
1544
- reason = "assert_ne";
1545
- errorMessage = `The transaction reverted because of an "assert_ne" statement${sufix}`;
1546
- break;
1547
- }
1548
- case FAILED_ASSERT_SIGNAL:
1549
- reason = "assert";
1550
- errorMessage = `The transaction reverted because an "assert" statement failed to evaluate to true.`;
1551
- break;
1552
- case FAILED_TRANSFER_TO_ADDRESS_SIGNAL2:
1553
- reason = "MissingOutputChange";
1554
- errorMessage = `The transaction reverted because it's missing an "OutputChange".`;
1555
- break;
1556
- default:
1557
- reason = "unknown";
1558
- errorMessage = `The transaction reverted with an unknown reason: ${revertReceipt.val}`;
1559
- }
1560
- }
1561
- return { errorMessage, reason };
1562
- };
1563
- var extractTxError = (params) => {
1564
- const { receipts, status, logs } = params;
1565
- const isPanic = receipts.some(({ type }) => type === ReceiptType3.Panic);
1566
- const isRevert = receipts.some(({ type }) => type === ReceiptType3.Revert);
1567
- const { errorMessage, reason } = status?.type === "FailureStatus" && isPanic ? assemblePanicError(status) : assembleRevertError(receipts, logs);
1568
- const metadata = {
1569
- logs,
1570
- receipts,
1571
- panic: isPanic,
1572
- revert: isRevert,
1573
- reason
1574
- };
1575
- return new FuelError7(ErrorCode7.SCRIPT_REVERTED, errorMessage, metadata);
1576
- };
1577
-
1578
1498
  // src/providers/transaction-request/errors.ts
1579
1499
  var NoWitnessAtIndexError = class extends Error {
1580
1500
  constructor(index) {
@@ -1625,10 +1545,10 @@ var BaseTransactionRequest = class {
1625
1545
  outputs,
1626
1546
  witnesses
1627
1547
  } = {}) {
1628
- this.gasPrice = bn7(gasPrice);
1548
+ this.gasPrice = bn6(gasPrice);
1629
1549
  this.maturity = maturity ?? 0;
1630
- this.witnessLimit = witnessLimit ? bn7(witnessLimit) : void 0;
1631
- this.maxFee = maxFee ? bn7(maxFee) : void 0;
1550
+ this.witnessLimit = witnessLimit ? bn6(witnessLimit) : void 0;
1551
+ this.maxFee = maxFee ? bn6(maxFee) : void 0;
1632
1552
  this.inputs = inputs ?? [];
1633
1553
  this.outputs = outputs ?? [];
1634
1554
  this.witnesses = witnesses ?? [];
@@ -2058,13 +1978,13 @@ var BaseTransactionRequest = class {
2058
1978
  assetId,
2059
1979
  owner: resourcesOwner || Address.fromRandom(),
2060
1980
  maturity: 0,
2061
- blockCreated: bn7(1),
2062
- txCreatedIdx: bn7(1)
1981
+ blockCreated: bn6(1),
1982
+ txCreatedIdx: bn6(1)
2063
1983
  }
2064
1984
  ]);
2065
1985
  }
2066
1986
  };
2067
- updateAssetInput(BaseAssetId2, bn7(1e11));
1987
+ updateAssetInput(BaseAssetId2, bn6(1e11));
2068
1988
  quantities.forEach((q) => updateAssetInput(q.assetId, q.amount));
2069
1989
  }
2070
1990
  /**
@@ -2075,7 +1995,7 @@ var BaseTransactionRequest = class {
2075
1995
  */
2076
1996
  getCoinOutputsQuantities() {
2077
1997
  const coinsQuantities = this.getCoinOutputs().map(({ amount, assetId }) => ({
2078
- amount: bn7(amount),
1998
+ amount: bn6(amount),
2079
1999
  assetId: assetId.toString()
2080
2000
  }));
2081
2001
  return coinsQuantities;
@@ -2104,7 +2024,7 @@ var BaseTransactionRequest = class {
2104
2024
  default:
2105
2025
  return;
2106
2026
  }
2107
- if (correspondingInput && "predicateGasUsed" in correspondingInput && bn7(correspondingInput.predicateGasUsed).gt(0)) {
2027
+ if (correspondingInput && "predicateGasUsed" in correspondingInput && bn6(correspondingInput.predicateGasUsed).gt(0)) {
2108
2028
  i.predicate = correspondingInput.predicate;
2109
2029
  i.predicateData = correspondingInput.predicateData;
2110
2030
  i.predicateGasUsed = correspondingInput.predicateGasUsed;
@@ -2115,14 +2035,14 @@ var BaseTransactionRequest = class {
2115
2035
 
2116
2036
  // src/providers/transaction-request/create-transaction-request.ts
2117
2037
  import { ZeroBytes32 as ZeroBytes326 } from "@fuel-ts/address/configs";
2118
- import { bn as bn9 } from "@fuel-ts/math";
2038
+ import { bn as bn8 } from "@fuel-ts/math";
2119
2039
  import { TransactionType as TransactionType3, OutputType as OutputType4 } from "@fuel-ts/transactions";
2120
2040
  import { arrayify as arrayify6, hexlify as hexlify9 } from "@fuel-ts/utils";
2121
2041
 
2122
2042
  // src/providers/transaction-request/hash-transaction.ts
2123
2043
  import { ZeroBytes32 as ZeroBytes325 } from "@fuel-ts/address/configs";
2124
2044
  import { uint64ToBytesBE, sha256 } from "@fuel-ts/hasher";
2125
- import { bn as bn8 } from "@fuel-ts/math";
2045
+ import { bn as bn7 } from "@fuel-ts/math";
2126
2046
  import { TransactionType as TransactionType2, InputType as InputType3, OutputType as OutputType3, TransactionCoder as TransactionCoder2 } from "@fuel-ts/transactions";
2127
2047
  import { concat as concat2 } from "@fuel-ts/utils";
2128
2048
  import { clone as clone2 } from "ramda";
@@ -2139,11 +2059,11 @@ function hashTransaction(transactionRequest, chainId) {
2139
2059
  blockHeight: 0,
2140
2060
  txIndex: 0
2141
2061
  };
2142
- inputClone.predicateGasUsed = bn8(0);
2062
+ inputClone.predicateGasUsed = bn7(0);
2143
2063
  return inputClone;
2144
2064
  }
2145
2065
  case InputType3.Message: {
2146
- inputClone.predicateGasUsed = bn8(0);
2066
+ inputClone.predicateGasUsed = bn7(0);
2147
2067
  return inputClone;
2148
2068
  }
2149
2069
  case InputType3.Contract: {
@@ -2170,12 +2090,12 @@ function hashTransaction(transactionRequest, chainId) {
2170
2090
  return outputClone;
2171
2091
  }
2172
2092
  case OutputType3.Change: {
2173
- outputClone.amount = bn8(0);
2093
+ outputClone.amount = bn7(0);
2174
2094
  return outputClone;
2175
2095
  }
2176
2096
  case OutputType3.Variable: {
2177
2097
  outputClone.to = ZeroBytes325;
2178
- outputClone.amount = bn8(0);
2098
+ outputClone.amount = bn7(0);
2179
2099
  outputClone.assetId = ZeroBytes325;
2180
2100
  return outputClone;
2181
2101
  }
@@ -2299,7 +2219,7 @@ var CreateTransactionRequest = class extends BaseTransactionRequest {
2299
2219
  }
2300
2220
  metadataGas(gasCosts) {
2301
2221
  return calculateMetadataGasForTxCreate({
2302
- contractBytesSize: bn9(arrayify6(this.witnesses[this.bytecodeWitnessIndex] || "0x").length),
2222
+ contractBytesSize: bn8(arrayify6(this.witnesses[this.bytecodeWitnessIndex] || "0x").length),
2303
2223
  gasCosts,
2304
2224
  stateRootSize: this.storageSlots.length,
2305
2225
  txBytesSize: this.byteSize()
@@ -2311,7 +2231,7 @@ var CreateTransactionRequest = class extends BaseTransactionRequest {
2311
2231
  import { Interface } from "@fuel-ts/abi-coder";
2312
2232
  import { addressify as addressify2 } from "@fuel-ts/address";
2313
2233
  import { ZeroBytes32 as ZeroBytes327 } from "@fuel-ts/address/configs";
2314
- import { bn as bn10 } from "@fuel-ts/math";
2234
+ import { bn as bn9 } from "@fuel-ts/math";
2315
2235
  import { InputType as InputType4, OutputType as OutputType5, TransactionType as TransactionType4 } from "@fuel-ts/transactions";
2316
2236
  import { arrayify as arrayify8, hexlify as hexlify10 } from "@fuel-ts/utils";
2317
2237
 
@@ -2365,7 +2285,7 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
2365
2285
  */
2366
2286
  constructor({ script, scriptData, gasLimit, ...rest } = {}) {
2367
2287
  super(rest);
2368
- this.gasLimit = bn10(gasLimit);
2288
+ this.gasLimit = bn9(gasLimit);
2369
2289
  this.script = arrayify8(script ?? returnZeroScript.bytes);
2370
2290
  this.scriptData = arrayify8(scriptData ?? returnZeroScript.encodeScriptData());
2371
2291
  this.abis = rest.abis;
@@ -2513,7 +2433,7 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
2513
2433
  };
2514
2434
 
2515
2435
  // src/providers/transaction-request/utils.ts
2516
- import { ErrorCode as ErrorCode8, FuelError as FuelError8 } from "@fuel-ts/errors";
2436
+ import { ErrorCode as ErrorCode7, FuelError as FuelError7 } from "@fuel-ts/errors";
2517
2437
  import { TransactionType as TransactionType5 } from "@fuel-ts/transactions";
2518
2438
  var transactionRequestify = (obj) => {
2519
2439
  if (obj instanceof ScriptTransactionRequest || obj instanceof CreateTransactionRequest) {
@@ -2528,14 +2448,14 @@ var transactionRequestify = (obj) => {
2528
2448
  return CreateTransactionRequest.from(obj);
2529
2449
  }
2530
2450
  default: {
2531
- throw new FuelError8(ErrorCode8.INVALID_TRANSACTION_TYPE, `Invalid transaction type: ${type}.`);
2451
+ throw new FuelError7(ErrorCode7.INVALID_TRANSACTION_TYPE, `Invalid transaction type: ${type}.`);
2532
2452
  }
2533
2453
  }
2534
2454
  };
2535
2455
 
2536
2456
  // src/providers/transaction-response/transaction-response.ts
2537
- import { ErrorCode as ErrorCode12, FuelError as FuelError12 } from "@fuel-ts/errors";
2538
- import { bn as bn14 } from "@fuel-ts/math";
2457
+ import { ErrorCode as ErrorCode11, FuelError as FuelError11 } from "@fuel-ts/errors";
2458
+ import { bn as bn13 } from "@fuel-ts/math";
2539
2459
  import { TransactionCoder as TransactionCoder4 } from "@fuel-ts/transactions";
2540
2460
  import { arrayify as arrayify10 } from "@fuel-ts/utils";
2541
2461
 
@@ -2543,7 +2463,7 @@ import { arrayify as arrayify10 } from "@fuel-ts/utils";
2543
2463
  import { DateTime, hexlify as hexlify11 } from "@fuel-ts/utils";
2544
2464
 
2545
2465
  // src/providers/transaction-summary/calculate-transaction-fee.ts
2546
- import { bn as bn11 } from "@fuel-ts/math";
2466
+ import { bn as bn10 } from "@fuel-ts/math";
2547
2467
  import { PolicyType as PolicyType2, TransactionCoder as TransactionCoder3, TransactionType as TransactionType6 } from "@fuel-ts/transactions";
2548
2468
  import { arrayify as arrayify9 } from "@fuel-ts/utils";
2549
2469
  var calculateTransactionFee = (params) => {
@@ -2552,24 +2472,24 @@ var calculateTransactionFee = (params) => {
2552
2472
  rawPayload,
2553
2473
  consensusParameters: { gasCosts, feeParams }
2554
2474
  } = params;
2555
- const gasPerByte = bn11(feeParams.gasPerByte);
2556
- const gasPriceFactor = bn11(feeParams.gasPriceFactor);
2475
+ const gasPerByte = bn10(feeParams.gasPerByte);
2476
+ const gasPriceFactor = bn10(feeParams.gasPriceFactor);
2557
2477
  const transactionBytes = arrayify9(rawPayload);
2558
2478
  const [transaction] = new TransactionCoder3().decode(transactionBytes, 0);
2559
2479
  if (transaction.type === TransactionType6.Mint) {
2560
2480
  return {
2561
- fee: bn11(0),
2562
- minFee: bn11(0),
2563
- maxFee: bn11(0),
2564
- feeFromGasUsed: bn11(0)
2481
+ fee: bn10(0),
2482
+ minFee: bn10(0),
2483
+ maxFee: bn10(0),
2484
+ feeFromGasUsed: bn10(0)
2565
2485
  };
2566
2486
  }
2567
2487
  const { type, witnesses, inputs, policies } = transaction;
2568
- let metadataGas = bn11(0);
2569
- let gasLimit = bn11(0);
2488
+ let metadataGas = bn10(0);
2489
+ let gasLimit = bn10(0);
2570
2490
  if (type === TransactionType6.Create) {
2571
2491
  const { bytecodeWitnessIndex, storageSlots } = transaction;
2572
- const contractBytesSize = bn11(arrayify9(witnesses[bytecodeWitnessIndex].data).length);
2492
+ const contractBytesSize = bn10(arrayify9(witnesses[bytecodeWitnessIndex].data).length);
2573
2493
  metadataGas = calculateMetadataGasForTxCreate({
2574
2494
  contractBytesSize,
2575
2495
  gasCosts,
@@ -2588,12 +2508,12 @@ var calculateTransactionFee = (params) => {
2588
2508
  }
2589
2509
  const minGas = getMinGas({
2590
2510
  gasCosts,
2591
- gasPerByte: bn11(gasPerByte),
2511
+ gasPerByte: bn10(gasPerByte),
2592
2512
  inputs,
2593
2513
  metadataGas,
2594
2514
  txBytesSize: transactionBytes.length
2595
2515
  });
2596
- const gasPrice = bn11(policies.find((policy) => policy.type === PolicyType2.GasPrice)?.data);
2516
+ const gasPrice = bn10(policies.find((policy) => policy.type === PolicyType2.GasPrice)?.data);
2597
2517
  const witnessLimit = policies.find((policy) => policy.type === PolicyType2.WitnessLimit)?.data;
2598
2518
  const witnessesLength = witnesses.reduce((acc, wit) => acc + wit.dataLength, 0);
2599
2519
  const maxGas = getMaxGas({
@@ -2617,13 +2537,13 @@ var calculateTransactionFee = (params) => {
2617
2537
 
2618
2538
  // src/providers/transaction-summary/operations.ts
2619
2539
  import { ZeroBytes32 as ZeroBytes328 } from "@fuel-ts/address/configs";
2620
- import { ErrorCode as ErrorCode10, FuelError as FuelError10 } from "@fuel-ts/errors";
2621
- import { bn as bn13 } from "@fuel-ts/math";
2622
- import { ReceiptType as ReceiptType4, TransactionType as TransactionType7 } from "@fuel-ts/transactions";
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";
2623
2543
 
2624
2544
  // src/providers/transaction-summary/call.ts
2625
2545
  import { Interface as Interface2, calculateVmTxMemory } from "@fuel-ts/abi-coder";
2626
- import { bn as bn12 } from "@fuel-ts/math";
2546
+ import { bn as bn11 } from "@fuel-ts/math";
2627
2547
  var getFunctionCall = ({ abi, receipt, rawPayload, maxInputs }) => {
2628
2548
  const abiInterface = new Interface2(abi);
2629
2549
  const callFunctionSelector = receipt.param1.toHex(8);
@@ -2632,7 +2552,7 @@ var getFunctionCall = ({ abi, receipt, rawPayload, maxInputs }) => {
2632
2552
  let encodedArgs;
2633
2553
  if (functionFragment.isInputDataPointer) {
2634
2554
  if (rawPayload) {
2635
- const argsOffset = bn12(receipt.param2).sub(calculateVmTxMemory({ maxInputs: maxInputs.toNumber() })).toNumber();
2555
+ const argsOffset = bn11(receipt.param2).sub(calculateVmTxMemory({ maxInputs: maxInputs.toNumber() })).toNumber();
2636
2556
  encodedArgs = `0x${rawPayload.slice(2).slice(argsOffset * 2)}`;
2637
2557
  }
2638
2558
  } else {
@@ -2666,7 +2586,7 @@ var getFunctionCall = ({ abi, receipt, rawPayload, maxInputs }) => {
2666
2586
  };
2667
2587
 
2668
2588
  // src/providers/transaction-summary/input.ts
2669
- import { ErrorCode as ErrorCode9, FuelError as FuelError9 } from "@fuel-ts/errors";
2589
+ import { ErrorCode as ErrorCode8, FuelError as FuelError8 } from "@fuel-ts/errors";
2670
2590
  import { InputType as InputType5 } from "@fuel-ts/transactions";
2671
2591
  function getInputsByTypes(inputs, types) {
2672
2592
  return inputs.filter((i) => types.includes(i.type));
@@ -2704,8 +2624,8 @@ function getInputContractFromIndex(inputs, inputIndex) {
2704
2624
  return void 0;
2705
2625
  }
2706
2626
  if (contractInput.type !== InputType5.Contract) {
2707
- throw new FuelError9(
2708
- ErrorCode9.INVALID_TRANSACTION_INPUT,
2627
+ throw new FuelError8(
2628
+ ErrorCode8.INVALID_TRANSACTION_INPUT,
2709
2629
  `Contract input should be of type 'contract'.`
2710
2630
  );
2711
2631
  }
@@ -2752,8 +2672,8 @@ function getTransactionTypeName(transactionType) {
2752
2672
  case TransactionType7.Script:
2753
2673
  return "Script" /* Script */;
2754
2674
  default:
2755
- throw new FuelError10(
2756
- ErrorCode10.INVALID_TRANSACTION_TYPE,
2675
+ throw new FuelError9(
2676
+ ErrorCode9.INVALID_TRANSACTION_TYPE,
2757
2677
  `Invalid transaction type: ${transactionType}.`
2758
2678
  );
2759
2679
  }
@@ -2772,10 +2692,10 @@ function isTypeScript(transactionType) {
2772
2692
  return isType(transactionType, "Script" /* Script */);
2773
2693
  }
2774
2694
  function getReceiptsCall(receipts) {
2775
- return getReceiptsByType(receipts, ReceiptType4.Call);
2695
+ return getReceiptsByType(receipts, ReceiptType3.Call);
2776
2696
  }
2777
2697
  function getReceiptsMessageOut(receipts) {
2778
- return getReceiptsByType(receipts, ReceiptType4.MessageOut);
2698
+ return getReceiptsByType(receipts, ReceiptType3.MessageOut);
2779
2699
  }
2780
2700
  var mergeAssets = (op1, op2) => {
2781
2701
  const assets1 = op1.assetsSent || [];
@@ -2788,7 +2708,7 @@ var mergeAssets = (op1, op2) => {
2788
2708
  if (!matchingAsset) {
2789
2709
  return asset1;
2790
2710
  }
2791
- const mergedAmount = bn13(asset1.amount).add(matchingAsset.amount);
2711
+ const mergedAmount = bn12(asset1.amount).add(matchingAsset.amount);
2792
2712
  return { ...asset1, amount: mergedAmount };
2793
2713
  });
2794
2714
  return mergedAssets.concat(filteredAssets);
@@ -2971,11 +2891,11 @@ function getTransferOperations({
2971
2891
  });
2972
2892
  const transferReceipts = getReceiptsByType(
2973
2893
  receipts,
2974
- ReceiptType4.Transfer
2894
+ ReceiptType3.Transfer
2975
2895
  );
2976
2896
  const transferOutReceipts = getReceiptsByType(
2977
2897
  receipts,
2978
- ReceiptType4.TransferOut
2898
+ ReceiptType3.TransferOut
2979
2899
  );
2980
2900
  [...transferReceipts, ...transferOutReceipts].forEach((receipt) => {
2981
2901
  const operation = extractTransferOperationFromReceipt(receipt, contractInputs, changeOutputs);
@@ -3060,17 +2980,17 @@ function getOperations({
3060
2980
  }
3061
2981
 
3062
2982
  // src/providers/transaction-summary/receipt.ts
3063
- import { ReceiptType as ReceiptType5 } from "@fuel-ts/transactions";
2983
+ import { ReceiptType as ReceiptType4 } from "@fuel-ts/transactions";
3064
2984
  var processGqlReceipt = (gqlReceipt) => {
3065
2985
  const receipt = assembleReceiptByType(gqlReceipt);
3066
2986
  switch (receipt.type) {
3067
- case ReceiptType5.ReturnData: {
2987
+ case ReceiptType4.ReturnData: {
3068
2988
  return {
3069
2989
  ...receipt,
3070
2990
  data: gqlReceipt.data || "0x"
3071
2991
  };
3072
2992
  }
3073
- case ReceiptType5.LogData: {
2993
+ case ReceiptType4.LogData: {
3074
2994
  return {
3075
2995
  ...receipt,
3076
2996
  data: gqlReceipt.data || "0x"
@@ -3083,7 +3003,7 @@ var processGqlReceipt = (gqlReceipt) => {
3083
3003
  var extractMintedAssetsFromReceipts = (receipts) => {
3084
3004
  const mintedAssets = [];
3085
3005
  receipts.forEach((receipt) => {
3086
- if (receipt.type === ReceiptType5.Mint) {
3006
+ if (receipt.type === ReceiptType4.Mint) {
3087
3007
  mintedAssets.push({
3088
3008
  subId: receipt.subId,
3089
3009
  contractId: receipt.contractId,
@@ -3097,7 +3017,7 @@ var extractMintedAssetsFromReceipts = (receipts) => {
3097
3017
  var extractBurnedAssetsFromReceipts = (receipts) => {
3098
3018
  const burnedAssets = [];
3099
3019
  receipts.forEach((receipt) => {
3100
- if (receipt.type === ReceiptType5.Burn) {
3020
+ if (receipt.type === ReceiptType4.Burn) {
3101
3021
  burnedAssets.push({
3102
3022
  subId: receipt.subId,
3103
3023
  contractId: receipt.contractId,
@@ -3110,7 +3030,7 @@ var extractBurnedAssetsFromReceipts = (receipts) => {
3110
3030
  };
3111
3031
 
3112
3032
  // src/providers/transaction-summary/status.ts
3113
- import { ErrorCode as ErrorCode11, FuelError as FuelError11 } from "@fuel-ts/errors";
3033
+ import { ErrorCode as ErrorCode10, FuelError as FuelError10 } from "@fuel-ts/errors";
3114
3034
  var getTransactionStatusName = (gqlStatus) => {
3115
3035
  switch (gqlStatus) {
3116
3036
  case "FailureStatus":
@@ -3122,8 +3042,8 @@ var getTransactionStatusName = (gqlStatus) => {
3122
3042
  case "SqueezedOutStatus":
3123
3043
  return "squeezedout" /* squeezedout */;
3124
3044
  default:
3125
- throw new FuelError11(
3126
- ErrorCode11.INVALID_TRANSACTION_STATUS,
3045
+ throw new FuelError10(
3046
+ ErrorCode10.INVALID_TRANSACTION_STATUS,
3127
3047
  `Invalid transaction status: ${gqlStatus}.`
3128
3048
  );
3129
3049
  }
@@ -3236,12 +3156,12 @@ function assembleTransactionSummary(params) {
3236
3156
 
3237
3157
  // src/providers/transaction-response/getDecodedLogs.ts
3238
3158
  import { Interface as Interface3, BigNumberCoder } from "@fuel-ts/abi-coder";
3239
- import { ReceiptType as ReceiptType6 } from "@fuel-ts/transactions";
3159
+ import { ReceiptType as ReceiptType5 } from "@fuel-ts/transactions";
3240
3160
  function getDecodedLogs(receipts, mainAbi, externalAbis = {}) {
3241
3161
  return receipts.reduce((logs, receipt) => {
3242
- if (receipt.type === ReceiptType6.LogData || receipt.type === ReceiptType6.Log) {
3162
+ if (receipt.type === ReceiptType5.LogData || receipt.type === ReceiptType5.Log) {
3243
3163
  const interfaceToUse = new Interface3(externalAbis[receipt.id] || mainAbi);
3244
- const data = receipt.type === ReceiptType6.Log ? new BigNumberCoder("u64").encode(receipt.val0) : receipt.data;
3164
+ const data = receipt.type === ReceiptType5.Log ? new BigNumberCoder("u64").encode(receipt.val0) : receipt.data;
3245
3165
  const [decodedLog] = interfaceToUse.decodeLog(data, receipt.val1.toNumber());
3246
3166
  logs.push(decodedLog);
3247
3167
  }
@@ -3256,7 +3176,7 @@ var TransactionResponse = class {
3256
3176
  /** Current provider */
3257
3177
  provider;
3258
3178
  /** Gas used on the transaction */
3259
- gasUsed = bn14(0);
3179
+ gasUsed = bn13(0);
3260
3180
  /** The graphql Transaction with receipts object. */
3261
3181
  gqlTransaction;
3262
3182
  abis;
@@ -3361,8 +3281,8 @@ var TransactionResponse = class {
3361
3281
  });
3362
3282
  for await (const { statusChange } of subscription) {
3363
3283
  if (statusChange.type === "SqueezedOutStatus") {
3364
- throw new FuelError12(
3365
- ErrorCode12.TRANSACTION_SQUEEZED_OUT,
3284
+ throw new FuelError11(
3285
+ ErrorCode11.TRANSACTION_SQUEEZED_OUT,
3366
3286
  `Transaction Squeezed Out with reason: ${statusChange.reason}`
3367
3287
  );
3368
3288
  }
@@ -3384,26 +3304,14 @@ var TransactionResponse = class {
3384
3304
  gqlTransaction: this.gqlTransaction,
3385
3305
  ...transactionSummary
3386
3306
  };
3387
- let logs = [];
3388
3307
  if (this.abis) {
3389
- logs = getDecodedLogs(
3308
+ const logs = getDecodedLogs(
3390
3309
  transactionSummary.receipts,
3391
3310
  this.abis.main,
3392
3311
  this.abis.otherContractsAbis
3393
3312
  );
3394
3313
  transactionResult.logs = logs;
3395
3314
  }
3396
- if (transactionResult.isStatusFailure) {
3397
- const {
3398
- receipts,
3399
- gqlTransaction: { status }
3400
- } = transactionResult;
3401
- throw extractTxError({
3402
- receipts,
3403
- status,
3404
- logs
3405
- });
3406
- }
3407
3315
  return transactionResult;
3408
3316
  }
3409
3317
  /**
@@ -3412,7 +3320,14 @@ var TransactionResponse = class {
3412
3320
  * @param contractsAbiMap - The contracts ABI map.
3413
3321
  */
3414
3322
  async wait(contractsAbiMap) {
3415
- return this.waitForResult(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;
3416
3331
  }
3417
3332
  };
3418
3333
 
@@ -3474,29 +3389,29 @@ var processGqlChain = (chain) => {
3474
3389
  const { contractParams, feeParams, predicateParams, scriptParams, txParams, gasCosts } = consensusParameters;
3475
3390
  return {
3476
3391
  name,
3477
- baseChainHeight: bn15(daHeight),
3392
+ baseChainHeight: bn14(daHeight),
3478
3393
  consensusParameters: {
3479
- contractMaxSize: bn15(contractParams.contractMaxSize),
3480
- maxInputs: bn15(txParams.maxInputs),
3481
- maxOutputs: bn15(txParams.maxOutputs),
3482
- maxWitnesses: bn15(txParams.maxWitnesses),
3483
- maxGasPerTx: bn15(txParams.maxGasPerTx),
3484
- maxScriptLength: bn15(scriptParams.maxScriptLength),
3485
- maxScriptDataLength: bn15(scriptParams.maxScriptDataLength),
3486
- maxStorageSlots: bn15(contractParams.maxStorageSlots),
3487
- maxPredicateLength: bn15(predicateParams.maxPredicateLength),
3488
- maxPredicateDataLength: bn15(predicateParams.maxPredicateDataLength),
3489
- maxGasPerPredicate: bn15(predicateParams.maxGasPerPredicate),
3490
- gasPriceFactor: bn15(feeParams.gasPriceFactor),
3491
- gasPerByte: bn15(feeParams.gasPerByte),
3492
- maxMessageDataLength: bn15(predicateParams.maxMessageDataLength),
3493
- chainId: bn15(consensusParameters.chainId),
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),
3494
3409
  gasCosts
3495
3410
  },
3496
3411
  gasCosts,
3497
3412
  latestBlock: {
3498
3413
  id: latestBlock.id,
3499
- height: bn15(latestBlock.header.height),
3414
+ height: bn14(latestBlock.header.height),
3500
3415
  time: latestBlock.header.time,
3501
3416
  transactions: latestBlock.transactions.map((i) => ({
3502
3417
  id: i.id
@@ -3566,8 +3481,8 @@ var _Provider = class {
3566
3481
  getChain() {
3567
3482
  const chain = _Provider.chainInfoCache[this.url];
3568
3483
  if (!chain) {
3569
- throw new FuelError13(
3570
- ErrorCode13.CHAIN_INFO_CACHE_EMPTY,
3484
+ throw new FuelError12(
3485
+ ErrorCode12.CHAIN_INFO_CACHE_EMPTY,
3571
3486
  "Chain info cache is empty. Make sure you have called `Provider.create` to initialize the provider."
3572
3487
  );
3573
3488
  }
@@ -3579,8 +3494,8 @@ var _Provider = class {
3579
3494
  getNode() {
3580
3495
  const node = _Provider.nodeInfoCache[this.url];
3581
3496
  if (!node) {
3582
- throw new FuelError13(
3583
- ErrorCode13.NODE_INFO_CACHE_EMPTY,
3497
+ throw new FuelError12(
3498
+ ErrorCode12.NODE_INFO_CACHE_EMPTY,
3584
3499
  "Node info cache is empty. Make sure you have called `Provider.create` to initialize the provider."
3585
3500
  );
3586
3501
  }
@@ -3627,8 +3542,8 @@ var _Provider = class {
3627
3542
  static ensureClientVersionIsSupported(nodeInfo) {
3628
3543
  const { isMajorSupported, isMinorSupported, supportedVersion } = checkFuelCoreVersionCompatibility(nodeInfo.nodeVersion);
3629
3544
  if (!isMajorSupported || !isMinorSupported) {
3630
- throw new FuelError13(
3631
- FuelError13.CODES.UNSUPPORTED_FUEL_CLIENT_VERSION,
3545
+ throw new FuelError12(
3546
+ FuelError12.CODES.UNSUPPORTED_FUEL_CLIENT_VERSION,
3632
3547
  `Fuel client version: ${nodeInfo.nodeVersion}, Supported version: ${supportedVersion}`
3633
3548
  );
3634
3549
  }
@@ -3691,7 +3606,7 @@ var _Provider = class {
3691
3606
  */
3692
3607
  async getBlockNumber() {
3693
3608
  const { chain } = await this.operations.getChain();
3694
- return bn15(chain.latestBlock.header.height, 10);
3609
+ return bn14(chain.latestBlock.header.height, 10);
3695
3610
  }
3696
3611
  /**
3697
3612
  * Returns the chain information.
@@ -3701,9 +3616,9 @@ var _Provider = class {
3701
3616
  async fetchNode() {
3702
3617
  const { nodeInfo } = await this.operations.getNodeInfo();
3703
3618
  const processedNodeInfo = {
3704
- maxDepth: bn15(nodeInfo.maxDepth),
3705
- maxTx: bn15(nodeInfo.maxTx),
3706
- minGasPrice: bn15(nodeInfo.minGasPrice),
3619
+ maxDepth: bn14(nodeInfo.maxDepth),
3620
+ maxTx: bn14(nodeInfo.maxTx),
3621
+ minGasPrice: bn14(nodeInfo.minGasPrice),
3707
3622
  nodeVersion: nodeInfo.nodeVersion,
3708
3623
  utxoValidation: nodeInfo.utxoValidation,
3709
3624
  vmBacktrace: nodeInfo.vmBacktrace,
@@ -3758,8 +3673,8 @@ var _Provider = class {
3758
3673
  const subscription = this.operations.submitAndAwait({ encodedTransaction });
3759
3674
  for await (const { submitAndAwait } of subscription) {
3760
3675
  if (submitAndAwait.type === "SqueezedOutStatus") {
3761
- throw new FuelError13(
3762
- ErrorCode13.TRANSACTION_SQUEEZED_OUT,
3676
+ throw new FuelError12(
3677
+ ErrorCode12.TRANSACTION_SQUEEZED_OUT,
3763
3678
  `Transaction Squeezed Out with reason: ${submitAndAwait.reason}`
3764
3679
  );
3765
3680
  }
@@ -3826,7 +3741,7 @@ var _Provider = class {
3826
3741
  } = response;
3827
3742
  if (inputs) {
3828
3743
  inputs.forEach((input, index) => {
3829
- if ("predicateGasUsed" in input && bn15(input.predicateGasUsed).gt(0)) {
3744
+ if ("predicateGasUsed" in input && bn14(input.predicateGasUsed).gt(0)) {
3830
3745
  transactionRequest.inputs[index].predicateGasUsed = input.predicateGasUsed;
3831
3746
  }
3832
3747
  });
@@ -3939,7 +3854,7 @@ var _Provider = class {
3939
3854
  txRequestClone.fundWithFakeUtxos(allQuantities, resourcesOwner?.address);
3940
3855
  if (estimatePredicates) {
3941
3856
  if (isScriptTransaction) {
3942
- txRequestClone.gasLimit = bn15(0);
3857
+ txRequestClone.gasLimit = bn14(0);
3943
3858
  }
3944
3859
  if (resourcesOwner && "populateTransactionPredicateData" in resourcesOwner) {
3945
3860
  resourcesOwner.populateTransactionPredicateData(txRequestClone);
@@ -3955,8 +3870,8 @@ var _Provider = class {
3955
3870
  let missingContractIds = [];
3956
3871
  let outputVariables = 0;
3957
3872
  if (isScriptTransaction && estimateTxDependencies) {
3958
- txRequestClone.gasPrice = bn15(0);
3959
- txRequestClone.gasLimit = bn15(maxGasPerTx.sub(maxGas).toNumber() * 0.9);
3873
+ txRequestClone.gasPrice = bn14(0);
3874
+ txRequestClone.gasLimit = bn14(maxGasPerTx.sub(maxGas).toNumber() * 0.9);
3960
3875
  const result = await this.estimateTxDependencies(txRequestClone);
3961
3876
  receipts = result.receipts;
3962
3877
  outputVariables = result.outputVariables;
@@ -4018,11 +3933,11 @@ var _Provider = class {
4018
3933
  return coins.map((coin) => ({
4019
3934
  id: coin.utxoId,
4020
3935
  assetId: coin.assetId,
4021
- amount: bn15(coin.amount),
3936
+ amount: bn14(coin.amount),
4022
3937
  owner: Address2.fromAddressOrString(coin.owner),
4023
- maturity: bn15(coin.maturity).toNumber(),
4024
- blockCreated: bn15(coin.blockCreated),
4025
- txCreatedIdx: bn15(coin.txCreatedIdx)
3938
+ maturity: bn14(coin.maturity).toNumber(),
3939
+ blockCreated: bn14(coin.blockCreated),
3940
+ txCreatedIdx: bn14(coin.txCreatedIdx)
4026
3941
  }));
4027
3942
  }
4028
3943
  /**
@@ -4059,9 +3974,9 @@ var _Provider = class {
4059
3974
  switch (coin.__typename) {
4060
3975
  case "MessageCoin":
4061
3976
  return {
4062
- amount: bn15(coin.amount),
3977
+ amount: bn14(coin.amount),
4063
3978
  assetId: coin.assetId,
4064
- daHeight: bn15(coin.daHeight),
3979
+ daHeight: bn14(coin.daHeight),
4065
3980
  sender: Address2.fromAddressOrString(coin.sender),
4066
3981
  recipient: Address2.fromAddressOrString(coin.recipient),
4067
3982
  nonce: coin.nonce
@@ -4069,12 +3984,12 @@ var _Provider = class {
4069
3984
  case "Coin":
4070
3985
  return {
4071
3986
  id: coin.utxoId,
4072
- amount: bn15(coin.amount),
3987
+ amount: bn14(coin.amount),
4073
3988
  assetId: coin.assetId,
4074
3989
  owner: Address2.fromAddressOrString(coin.owner),
4075
- maturity: bn15(coin.maturity).toNumber(),
4076
- blockCreated: bn15(coin.blockCreated),
4077
- txCreatedIdx: bn15(coin.txCreatedIdx)
3990
+ maturity: bn14(coin.maturity).toNumber(),
3991
+ blockCreated: bn14(coin.blockCreated),
3992
+ txCreatedIdx: bn14(coin.txCreatedIdx)
4078
3993
  };
4079
3994
  default:
4080
3995
  return null;
@@ -4091,13 +4006,13 @@ var _Provider = class {
4091
4006
  async getBlock(idOrHeight) {
4092
4007
  let variables;
4093
4008
  if (typeof idOrHeight === "number") {
4094
- variables = { height: bn15(idOrHeight).toString(10) };
4009
+ variables = { height: bn14(idOrHeight).toString(10) };
4095
4010
  } else if (idOrHeight === "latest") {
4096
4011
  variables = { height: (await this.getBlockNumber()).toString(10) };
4097
4012
  } else if (idOrHeight.length === 66) {
4098
4013
  variables = { blockId: idOrHeight };
4099
4014
  } else {
4100
- variables = { blockId: bn15(idOrHeight).toString(10) };
4015
+ variables = { blockId: bn14(idOrHeight).toString(10) };
4101
4016
  }
4102
4017
  const { block } = await this.operations.getBlock(variables);
4103
4018
  if (!block) {
@@ -4105,7 +4020,7 @@ var _Provider = class {
4105
4020
  }
4106
4021
  return {
4107
4022
  id: block.id,
4108
- height: bn15(block.header.height),
4023
+ height: bn14(block.header.height),
4109
4024
  time: block.header.time,
4110
4025
  transactionIds: block.transactions.map((tx) => tx.id)
4111
4026
  };
@@ -4120,7 +4035,7 @@ var _Provider = class {
4120
4035
  const { blocks: fetchedData } = await this.operations.getBlocks(params);
4121
4036
  const blocks = fetchedData.edges.map(({ node: block }) => ({
4122
4037
  id: block.id,
4123
- height: bn15(block.header.height),
4038
+ height: bn14(block.header.height),
4124
4039
  time: block.header.time,
4125
4040
  transactionIds: block.transactions.map((tx) => tx.id)
4126
4041
  }));
@@ -4135,7 +4050,7 @@ var _Provider = class {
4135
4050
  async getBlockWithTransactions(idOrHeight) {
4136
4051
  let variables;
4137
4052
  if (typeof idOrHeight === "number") {
4138
- variables = { blockHeight: bn15(idOrHeight).toString(10) };
4053
+ variables = { blockHeight: bn14(idOrHeight).toString(10) };
4139
4054
  } else if (idOrHeight === "latest") {
4140
4055
  variables = { blockHeight: (await this.getBlockNumber()).toString() };
4141
4056
  } else {
@@ -4147,7 +4062,7 @@ var _Provider = class {
4147
4062
  }
4148
4063
  return {
4149
4064
  id: block.id,
4150
- height: bn15(block.header.height, 10),
4065
+ height: bn14(block.header.height, 10),
4151
4066
  time: block.header.time,
4152
4067
  transactionIds: block.transactions.map((tx) => tx.id),
4153
4068
  transactions: block.transactions.map(
@@ -4196,7 +4111,7 @@ var _Provider = class {
4196
4111
  contract: Address2.fromAddressOrString(contractId).toB256(),
4197
4112
  asset: hexlify12(assetId)
4198
4113
  });
4199
- return bn15(contractBalance.amount, 10);
4114
+ return bn14(contractBalance.amount, 10);
4200
4115
  }
4201
4116
  /**
4202
4117
  * Returns the balance for the given owner for the given asset ID.
@@ -4210,7 +4125,7 @@ var _Provider = class {
4210
4125
  owner: Address2.fromAddressOrString(owner).toB256(),
4211
4126
  assetId: hexlify12(assetId)
4212
4127
  });
4213
- return bn15(balance.amount, 10);
4128
+ return bn14(balance.amount, 10);
4214
4129
  }
4215
4130
  /**
4216
4131
  * Returns balances for the given owner.
@@ -4228,7 +4143,7 @@ var _Provider = class {
4228
4143
  const balances = result.balances.edges.map((edge) => edge.node);
4229
4144
  return balances.map((balance) => ({
4230
4145
  assetId: balance.assetId,
4231
- amount: bn15(balance.amount)
4146
+ amount: bn14(balance.amount)
4232
4147
  }));
4233
4148
  }
4234
4149
  /**
@@ -4250,15 +4165,15 @@ var _Provider = class {
4250
4165
  sender: message.sender,
4251
4166
  recipient: message.recipient,
4252
4167
  nonce: message.nonce,
4253
- amount: bn15(message.amount),
4168
+ amount: bn14(message.amount),
4254
4169
  data: message.data
4255
4170
  }),
4256
4171
  sender: Address2.fromAddressOrString(message.sender),
4257
4172
  recipient: Address2.fromAddressOrString(message.recipient),
4258
4173
  nonce: message.nonce,
4259
- amount: bn15(message.amount),
4174
+ amount: bn14(message.amount),
4260
4175
  data: InputMessageCoder.decodeData(message.data),
4261
- daHeight: bn15(message.daHeight)
4176
+ daHeight: bn14(message.daHeight)
4262
4177
  }));
4263
4178
  }
4264
4179
  /**
@@ -4276,8 +4191,8 @@ var _Provider = class {
4276
4191
  nonce
4277
4192
  };
4278
4193
  if (commitBlockId && commitBlockHeight) {
4279
- throw new FuelError13(
4280
- ErrorCode13.INVALID_INPUT_PARAMETERS,
4194
+ throw new FuelError12(
4195
+ ErrorCode12.INVALID_INPUT_PARAMETERS,
4281
4196
  "commitBlockId and commitBlockHeight cannot be used together"
4282
4197
  );
4283
4198
  }
@@ -4311,41 +4226,41 @@ var _Provider = class {
4311
4226
  } = result.messageProof;
4312
4227
  return {
4313
4228
  messageProof: {
4314
- proofIndex: bn15(messageProof.proofIndex),
4229
+ proofIndex: bn14(messageProof.proofIndex),
4315
4230
  proofSet: messageProof.proofSet
4316
4231
  },
4317
4232
  blockProof: {
4318
- proofIndex: bn15(blockProof.proofIndex),
4233
+ proofIndex: bn14(blockProof.proofIndex),
4319
4234
  proofSet: blockProof.proofSet
4320
4235
  },
4321
4236
  messageBlockHeader: {
4322
4237
  id: messageBlockHeader.id,
4323
- daHeight: bn15(messageBlockHeader.daHeight),
4324
- transactionsCount: bn15(messageBlockHeader.transactionsCount),
4238
+ daHeight: bn14(messageBlockHeader.daHeight),
4239
+ transactionsCount: bn14(messageBlockHeader.transactionsCount),
4325
4240
  transactionsRoot: messageBlockHeader.transactionsRoot,
4326
- height: bn15(messageBlockHeader.height),
4241
+ height: bn14(messageBlockHeader.height),
4327
4242
  prevRoot: messageBlockHeader.prevRoot,
4328
4243
  time: messageBlockHeader.time,
4329
4244
  applicationHash: messageBlockHeader.applicationHash,
4330
4245
  messageReceiptRoot: messageBlockHeader.messageReceiptRoot,
4331
- messageReceiptCount: bn15(messageBlockHeader.messageReceiptCount)
4246
+ messageReceiptCount: bn14(messageBlockHeader.messageReceiptCount)
4332
4247
  },
4333
4248
  commitBlockHeader: {
4334
4249
  id: commitBlockHeader.id,
4335
- daHeight: bn15(commitBlockHeader.daHeight),
4336
- transactionsCount: bn15(commitBlockHeader.transactionsCount),
4250
+ daHeight: bn14(commitBlockHeader.daHeight),
4251
+ transactionsCount: bn14(commitBlockHeader.transactionsCount),
4337
4252
  transactionsRoot: commitBlockHeader.transactionsRoot,
4338
- height: bn15(commitBlockHeader.height),
4253
+ height: bn14(commitBlockHeader.height),
4339
4254
  prevRoot: commitBlockHeader.prevRoot,
4340
4255
  time: commitBlockHeader.time,
4341
4256
  applicationHash: commitBlockHeader.applicationHash,
4342
4257
  messageReceiptRoot: commitBlockHeader.messageReceiptRoot,
4343
- messageReceiptCount: bn15(commitBlockHeader.messageReceiptCount)
4258
+ messageReceiptCount: bn14(commitBlockHeader.messageReceiptCount)
4344
4259
  },
4345
4260
  sender: Address2.fromAddressOrString(sender),
4346
4261
  recipient: Address2.fromAddressOrString(recipient),
4347
4262
  nonce,
4348
- amount: bn15(amount),
4263
+ amount: bn14(amount),
4349
4264
  data
4350
4265
  };
4351
4266
  }
@@ -4368,10 +4283,10 @@ var _Provider = class {
4368
4283
  */
4369
4284
  async produceBlocks(amount, startTime) {
4370
4285
  const { produceBlocks: latestBlockHeight } = await this.operations.produceBlocks({
4371
- blocksToProduce: bn15(amount).toString(10),
4286
+ blocksToProduce: bn14(amount).toString(10),
4372
4287
  startTimestamp: startTime ? DateTime2.fromUnixMilliseconds(startTime).toTai64() : void 0
4373
4288
  });
4374
- return bn15(latestBlockHeight);
4289
+ return bn14(latestBlockHeight);
4375
4290
  }
4376
4291
  // eslint-disable-next-line @typescript-eslint/require-await
4377
4292
  async getTransactionResponse(transactionId) {
@@ -4394,8 +4309,8 @@ __publicField(Provider, "chainInfoCache", {});
4394
4309
  __publicField(Provider, "nodeInfoCache", {});
4395
4310
 
4396
4311
  // src/providers/transaction-summary/get-transaction-summary.ts
4397
- import { ErrorCode as ErrorCode14, FuelError as FuelError14 } from "@fuel-ts/errors";
4398
- import { bn as bn16 } from "@fuel-ts/math";
4312
+ import { ErrorCode as ErrorCode13, FuelError as FuelError13 } from "@fuel-ts/errors";
4313
+ import { bn as bn15 } from "@fuel-ts/math";
4399
4314
  import { TransactionCoder as TransactionCoder6 } from "@fuel-ts/transactions";
4400
4315
  import { arrayify as arrayify12 } from "@fuel-ts/utils";
4401
4316
 
@@ -4512,7 +4427,7 @@ var Account = class extends AbstractAccount {
4512
4427
  */
4513
4428
  get provider() {
4514
4429
  if (!this._provider) {
4515
- throw new FuelError15(ErrorCode15.MISSING_PROVIDER, "Provider not set");
4430
+ throw new FuelError14(ErrorCode14.MISSING_PROVIDER, "Provider not set");
4516
4431
  }
4517
4432
  return this._provider;
4518
4433
  }
@@ -4564,8 +4479,8 @@ var Account = class extends AbstractAccount {
4564
4479
  if (!hasNextPage) {
4565
4480
  break;
4566
4481
  }
4567
- throw new FuelError15(
4568
- ErrorCode15.NOT_SUPPORTED,
4482
+ throw new FuelError14(
4483
+ ErrorCode14.NOT_SUPPORTED,
4569
4484
  `Wallets containing more than ${pageSize} coins exceed the current supported limit.`
4570
4485
  );
4571
4486
  }
@@ -4590,8 +4505,8 @@ var Account = class extends AbstractAccount {
4590
4505
  if (!hasNextPage) {
4591
4506
  break;
4592
4507
  }
4593
- throw new FuelError15(
4594
- ErrorCode15.NOT_SUPPORTED,
4508
+ throw new FuelError14(
4509
+ ErrorCode14.NOT_SUPPORTED,
4595
4510
  `Wallets containing more than ${pageSize} messages exceed the current supported limit.`
4596
4511
  );
4597
4512
  }
@@ -4626,8 +4541,8 @@ var Account = class extends AbstractAccount {
4626
4541
  if (!hasNextPage) {
4627
4542
  break;
4628
4543
  }
4629
- throw new FuelError15(
4630
- ErrorCode15.NOT_SUPPORTED,
4544
+ throw new FuelError14(
4545
+ ErrorCode14.NOT_SUPPORTED,
4631
4546
  `Wallets containing more than ${pageSize} balances exceed the current supported limit.`
4632
4547
  );
4633
4548
  }
@@ -4643,7 +4558,7 @@ var Account = class extends AbstractAccount {
4643
4558
  */
4644
4559
  async fund(request, coinQuantities, fee) {
4645
4560
  const updatedQuantities = addAmountToAsset({
4646
- amount: bn17(fee),
4561
+ amount: bn16(fee),
4647
4562
  assetId: BaseAssetId3,
4648
4563
  coinQuantities
4649
4564
  });
@@ -4651,7 +4566,7 @@ var Account = class extends AbstractAccount {
4651
4566
  updatedQuantities.forEach(({ amount, assetId }) => {
4652
4567
  quantitiesDict[assetId] = {
4653
4568
  required: amount,
4654
- owned: bn17(0)
4569
+ owned: bn16(0)
4655
4570
  };
4656
4571
  });
4657
4572
  const cachedUtxos = [];
@@ -4664,7 +4579,7 @@ var Account = class extends AbstractAccount {
4664
4579
  if (isCoin2) {
4665
4580
  const assetId = String(input.assetId);
4666
4581
  if (input.owner === owner && quantitiesDict[assetId]) {
4667
- const amount = bn17(input.amount);
4582
+ const amount = bn16(input.amount);
4668
4583
  quantitiesDict[assetId].owned = quantitiesDict[assetId].owned.add(amount);
4669
4584
  cachedUtxos.push(input.id);
4670
4585
  }
@@ -4710,8 +4625,8 @@ var Account = class extends AbstractAccount {
4710
4625
  estimateTxDependencies: true,
4711
4626
  resourcesOwner: this
4712
4627
  });
4713
- request.gasPrice = bn17(txParams.gasPrice ?? minGasPrice);
4714
- request.gasLimit = bn17(txParams.gasLimit ?? gasUsed);
4628
+ request.gasPrice = bn16(txParams.gasPrice ?? minGasPrice);
4629
+ request.gasLimit = bn16(txParams.gasLimit ?? gasUsed);
4715
4630
  this.validateGas({
4716
4631
  gasUsed,
4717
4632
  gasPrice: request.gasPrice,
@@ -4732,9 +4647,9 @@ var Account = class extends AbstractAccount {
4732
4647
  * @returns A promise that resolves to the transaction response.
4733
4648
  */
4734
4649
  async transfer(destination, amount, assetId = BaseAssetId3, txParams = {}) {
4735
- if (bn17(amount).lte(0)) {
4736
- throw new FuelError15(
4737
- ErrorCode15.INVALID_TRANSFER_AMOUNT,
4650
+ if (bn16(amount).lte(0)) {
4651
+ throw new FuelError14(
4652
+ ErrorCode14.INVALID_TRANSFER_AMOUNT,
4738
4653
  "Transfer amount must be a positive number."
4739
4654
  );
4740
4655
  }
@@ -4751,9 +4666,9 @@ var Account = class extends AbstractAccount {
4751
4666
  * @returns A promise that resolves to the transaction response.
4752
4667
  */
4753
4668
  async transferToContract(contractId, amount, assetId = BaseAssetId3, txParams = {}) {
4754
- if (bn17(amount).lte(0)) {
4755
- throw new FuelError15(
4756
- ErrorCode15.INVALID_TRANSFER_AMOUNT,
4669
+ if (bn16(amount).lte(0)) {
4670
+ throw new FuelError14(
4671
+ ErrorCode14.INVALID_TRANSFER_AMOUNT,
4757
4672
  "Transfer amount must be a positive number."
4758
4673
  );
4759
4674
  }
@@ -4762,7 +4677,7 @@ var Account = class extends AbstractAccount {
4762
4677
  const params = { gasPrice: minGasPrice, ...txParams };
4763
4678
  const { script, scriptData } = await assembleTransferToContractScript({
4764
4679
  hexlifiedContractId: contractAddress.toB256(),
4765
- amountToTransfer: bn17(amount),
4680
+ amountToTransfer: bn16(amount),
4766
4681
  assetId
4767
4682
  });
4768
4683
  const request = new ScriptTransactionRequest({
@@ -4773,9 +4688,9 @@ var Account = class extends AbstractAccount {
4773
4688
  request.addContractInputAndOutput(contractAddress);
4774
4689
  const { maxFee, requiredQuantities, gasUsed } = await this.provider.getTransactionCost(
4775
4690
  request,
4776
- [{ amount: bn17(amount), assetId: String(assetId) }]
4691
+ [{ amount: bn16(amount), assetId: String(assetId) }]
4777
4692
  );
4778
- request.gasLimit = bn17(params.gasLimit ?? gasUsed);
4693
+ request.gasLimit = bn16(params.gasLimit ?? gasUsed);
4779
4694
  this.validateGas({
4780
4695
  gasUsed,
4781
4696
  gasPrice: request.gasPrice,
@@ -4800,7 +4715,7 @@ var Account = class extends AbstractAccount {
4800
4715
  "0x".concat(recipientAddress.toHexString().substring(2).padStart(64, "0"))
4801
4716
  );
4802
4717
  const amountDataArray = arrayify14(
4803
- "0x".concat(bn17(amount).toHex().substring(2).padStart(16, "0"))
4718
+ "0x".concat(bn16(amount).toHex().substring(2).padStart(16, "0"))
4804
4719
  );
4805
4720
  const script = new Uint8Array([
4806
4721
  ...arrayify14(withdrawScript.bytes),
@@ -4809,12 +4724,12 @@ var Account = class extends AbstractAccount {
4809
4724
  ]);
4810
4725
  const params = { script, gasPrice: minGasPrice, ...txParams };
4811
4726
  const request = new ScriptTransactionRequest(params);
4812
- const forwardingQuantities = [{ amount: bn17(amount), assetId: BaseAssetId3 }];
4727
+ const forwardingQuantities = [{ amount: bn16(amount), assetId: BaseAssetId3 }];
4813
4728
  const { requiredQuantities, maxFee, gasUsed } = await this.provider.getTransactionCost(
4814
4729
  request,
4815
4730
  forwardingQuantities
4816
4731
  );
4817
- request.gasLimit = bn17(params.gasLimit ?? gasUsed);
4732
+ request.gasLimit = bn16(params.gasLimit ?? gasUsed);
4818
4733
  this.validateGas({
4819
4734
  gasUsed,
4820
4735
  gasPrice: request.gasPrice,
@@ -4826,7 +4741,7 @@ var Account = class extends AbstractAccount {
4826
4741
  }
4827
4742
  async signMessage(message) {
4828
4743
  if (!this._connector) {
4829
- throw new FuelError15(ErrorCode15.MISSING_CONNECTOR, "A connector is required to sign messages.");
4744
+ throw new FuelError14(ErrorCode14.MISSING_CONNECTOR, "A connector is required to sign messages.");
4830
4745
  }
4831
4746
  return this._connector.signMessage(this.address.toString(), message);
4832
4747
  }
@@ -4838,8 +4753,8 @@ var Account = class extends AbstractAccount {
4838
4753
  */
4839
4754
  async signTransaction(transactionRequestLike) {
4840
4755
  if (!this._connector) {
4841
- throw new FuelError15(
4842
- ErrorCode15.MISSING_CONNECTOR,
4756
+ throw new FuelError14(
4757
+ ErrorCode14.MISSING_CONNECTOR,
4843
4758
  "A connector is required to sign transactions."
4844
4759
  );
4845
4760
  }
@@ -4886,14 +4801,14 @@ var Account = class extends AbstractAccount {
4886
4801
  minGasPrice
4887
4802
  }) {
4888
4803
  if (minGasPrice.gt(gasPrice)) {
4889
- throw new FuelError15(
4890
- ErrorCode15.GAS_PRICE_TOO_LOW,
4804
+ throw new FuelError14(
4805
+ ErrorCode14.GAS_PRICE_TOO_LOW,
4891
4806
  `Gas price '${gasPrice}' is lower than the required: '${minGasPrice}'.`
4892
4807
  );
4893
4808
  }
4894
4809
  if (gasUsed.gt(gasLimit)) {
4895
- throw new FuelError15(
4896
- ErrorCode15.GAS_LIMIT_TOO_LOW,
4810
+ throw new FuelError14(
4811
+ ErrorCode14.GAS_LIMIT_TOO_LOW,
4897
4812
  `Gas limit '${gasLimit}' is lower than the required: '${gasUsed}'.`
4898
4813
  );
4899
4814
  }
@@ -5020,7 +4935,7 @@ import {
5020
4935
  decryptJsonWalletData,
5021
4936
  encryptJsonWalletData
5022
4937
  } from "@fuel-ts/crypto";
5023
- import { ErrorCode as ErrorCode16, FuelError as FuelError16 } from "@fuel-ts/errors";
4938
+ import { ErrorCode as ErrorCode15, FuelError as FuelError15 } from "@fuel-ts/errors";
5024
4939
  import { hexlify as hexlify14 } from "@fuel-ts/utils";
5025
4940
  import { v4 as uuidv4 } from "uuid";
5026
4941
  var DEFAULT_KDF_PARAMS_LOG_N = 13;
@@ -5098,8 +5013,8 @@ async function decryptKeystoreWallet(jsonWallet, password) {
5098
5013
  const macHashUint8Array = keccak256(data);
5099
5014
  const macHash = stringFromBuffer(macHashUint8Array, "hex");
5100
5015
  if (mac !== macHash) {
5101
- throw new FuelError16(
5102
- ErrorCode16.INVALID_PASSWORD,
5016
+ throw new FuelError15(
5017
+ ErrorCode15.INVALID_PASSWORD,
5103
5018
  "Failed to decrypt the keystore wallet, the provided password is incorrect."
5104
5019
  );
5105
5020
  }
@@ -5221,15 +5136,15 @@ var BaseWalletUnlocked = class extends Account {
5221
5136
  __publicField(BaseWalletUnlocked, "defaultPath", "m/44'/1179993420'/0'/0/0");
5222
5137
 
5223
5138
  // src/hdwallet/hdwallet.ts
5224
- import { ErrorCode as ErrorCode19, FuelError as FuelError19 } from "@fuel-ts/errors";
5139
+ import { ErrorCode as ErrorCode18, FuelError as FuelError18 } from "@fuel-ts/errors";
5225
5140
  import { sha256 as sha2564 } from "@fuel-ts/hasher";
5226
- import { bn as bn18, toBytes as toBytes2, toHex } from "@fuel-ts/math";
5141
+ import { bn as bn17, toBytes as toBytes2, toHex } from "@fuel-ts/math";
5227
5142
  import { arrayify as arrayify18, hexlify as hexlify17, concat as concat5 } from "@fuel-ts/utils";
5228
5143
  import { toBeHex, dataSlice as dataSlice2, encodeBase58 as encodeBase582, decodeBase58, computeHmac as computeHmac2, ripemd160 } from "ethers";
5229
5144
 
5230
5145
  // src/mnemonic/mnemonic.ts
5231
5146
  import { randomBytes as randomBytes3 } from "@fuel-ts/crypto";
5232
- import { ErrorCode as ErrorCode18, FuelError as FuelError18 } from "@fuel-ts/errors";
5147
+ import { ErrorCode as ErrorCode17, FuelError as FuelError17 } from "@fuel-ts/errors";
5233
5148
  import { sha256 as sha2563 } from "@fuel-ts/hasher";
5234
5149
  import { arrayify as arrayify17, hexlify as hexlify16, concat as concat4 } from "@fuel-ts/utils";
5235
5150
  import { dataSlice, pbkdf2, computeHmac, encodeBase58 } from "ethers";
@@ -7287,7 +7202,7 @@ var english = [
7287
7202
  ];
7288
7203
 
7289
7204
  // src/mnemonic/utils.ts
7290
- import { ErrorCode as ErrorCode17, FuelError as FuelError17 } from "@fuel-ts/errors";
7205
+ import { ErrorCode as ErrorCode16, FuelError as FuelError16 } from "@fuel-ts/errors";
7291
7206
  import { sha256 as sha2562 } from "@fuel-ts/hasher";
7292
7207
  import { arrayify as arrayify16 } from "@fuel-ts/utils";
7293
7208
  function toUtf8Bytes(stri) {
@@ -7304,8 +7219,8 @@ function toUtf8Bytes(stri) {
7304
7219
  i += 1;
7305
7220
  const c2 = str.charCodeAt(i);
7306
7221
  if (i >= str.length || (c2 & 64512) !== 56320) {
7307
- throw new FuelError17(
7308
- ErrorCode17.INVALID_INPUT_PARAMETERS,
7222
+ throw new FuelError16(
7223
+ ErrorCode16.INVALID_INPUT_PARAMETERS,
7309
7224
  "Invalid UTF-8 in the input string."
7310
7225
  );
7311
7226
  }
@@ -7368,8 +7283,8 @@ function mnemonicWordsToEntropy(words, wordlist) {
7368
7283
  for (let i = 0; i < words.length; i += 1) {
7369
7284
  const index = wordlist.indexOf(words[i].normalize("NFKD"));
7370
7285
  if (index === -1) {
7371
- throw new FuelError17(
7372
- ErrorCode17.INVALID_MNEMONIC,
7286
+ throw new FuelError16(
7287
+ ErrorCode16.INVALID_MNEMONIC,
7373
7288
  `Invalid mnemonic: the word '${words[i]}' is not found in the provided wordlist.`
7374
7289
  );
7375
7290
  }
@@ -7385,8 +7300,8 @@ function mnemonicWordsToEntropy(words, wordlist) {
7385
7300
  const checksumMask = getUpperMask(checksumBits);
7386
7301
  const checksum = arrayify16(sha2562(entropy.slice(0, entropyBits / 8)))[0] & checksumMask;
7387
7302
  if (checksum !== (entropy[entropy.length - 1] & checksumMask)) {
7388
- throw new FuelError17(
7389
- ErrorCode17.INVALID_CHECKSUM,
7303
+ throw new FuelError16(
7304
+ ErrorCode16.INVALID_CHECKSUM,
7390
7305
  "Checksum validation failed for the provided mnemonic."
7391
7306
  );
7392
7307
  }
@@ -7400,16 +7315,16 @@ var TestnetPRV = "0x04358394";
7400
7315
  var MNEMONIC_SIZES = [12, 15, 18, 21, 24];
7401
7316
  function assertWordList(wordlist) {
7402
7317
  if (wordlist.length !== 2048) {
7403
- throw new FuelError18(
7404
- ErrorCode18.INVALID_WORD_LIST,
7318
+ throw new FuelError17(
7319
+ ErrorCode17.INVALID_WORD_LIST,
7405
7320
  `Expected word list length of 2048, but got ${wordlist.length}.`
7406
7321
  );
7407
7322
  }
7408
7323
  }
7409
7324
  function assertEntropy(entropy) {
7410
7325
  if (entropy.length % 4 !== 0 || entropy.length < 16 || entropy.length > 32) {
7411
- throw new FuelError18(
7412
- ErrorCode18.INVALID_ENTROPY,
7326
+ throw new FuelError17(
7327
+ ErrorCode17.INVALID_ENTROPY,
7413
7328
  `Entropy should be between 16 and 32 bytes and a multiple of 4, but got ${entropy.length} bytes.`
7414
7329
  );
7415
7330
  }
@@ -7419,7 +7334,7 @@ function assertMnemonic(words) {
7419
7334
  const errorMsg = `Invalid mnemonic size. Expected one of [${MNEMONIC_SIZES.join(
7420
7335
  ", "
7421
7336
  )}] words, but got ${words.length}.`;
7422
- throw new FuelError18(ErrorCode18.INVALID_MNEMONIC, errorMsg);
7337
+ throw new FuelError17(ErrorCode17.INVALID_MNEMONIC, errorMsg);
7423
7338
  }
7424
7339
  }
7425
7340
  var Mnemonic = class {
@@ -7537,8 +7452,8 @@ var Mnemonic = class {
7537
7452
  static masterKeysFromSeed(seed) {
7538
7453
  const seedArray = arrayify17(seed);
7539
7454
  if (seedArray.length < 16 || seedArray.length > 64) {
7540
- throw new FuelError18(
7541
- ErrorCode18.INVALID_SEED,
7455
+ throw new FuelError17(
7456
+ ErrorCode17.INVALID_SEED,
7542
7457
  `Seed length should be between 16 and 64 bytes, but received ${seedArray.length} bytes.`
7543
7458
  );
7544
7459
  }
@@ -7615,7 +7530,7 @@ function isValidExtendedKey(extendedKey) {
7615
7530
  function parsePath(path2, depth = 0) {
7616
7531
  const components = path2.split("/");
7617
7532
  if (components.length === 0 || components[0] === "m" && depth !== 0) {
7618
- throw new FuelError19(ErrorCode19.HD_WALLET_ERROR, `invalid path - ${path2}`);
7533
+ throw new FuelError18(ErrorCode18.HD_WALLET_ERROR, `invalid path - ${path2}`);
7619
7534
  }
7620
7535
  if (components[0] === "m") {
7621
7536
  components.shift();
@@ -7644,8 +7559,8 @@ var HDWallet = class {
7644
7559
  this.privateKey = hexlify17(config.privateKey);
7645
7560
  } else {
7646
7561
  if (!config.publicKey) {
7647
- throw new FuelError19(
7648
- ErrorCode19.HD_WALLET_ERROR,
7562
+ throw new FuelError18(
7563
+ ErrorCode18.HD_WALLET_ERROR,
7649
7564
  "Both public and private Key cannot be missing. At least one should be provided."
7650
7565
  );
7651
7566
  }
@@ -7674,8 +7589,8 @@ var HDWallet = class {
7674
7589
  const data = new Uint8Array(37);
7675
7590
  if (index & HARDENED_INDEX) {
7676
7591
  if (!privateKey) {
7677
- throw new FuelError19(
7678
- ErrorCode19.HD_WALLET_ERROR,
7592
+ throw new FuelError18(
7593
+ ErrorCode18.HD_WALLET_ERROR,
7679
7594
  "Cannot derive a hardened index without a private Key."
7680
7595
  );
7681
7596
  }
@@ -7689,7 +7604,7 @@ var HDWallet = class {
7689
7604
  const IR = bytes.slice(32);
7690
7605
  if (privateKey) {
7691
7606
  const N = "0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141";
7692
- const ki = bn18(IL).add(privateKey).mod(N).toBytes(32);
7607
+ const ki = bn17(IL).add(privateKey).mod(N).toBytes(32);
7693
7608
  return new HDWallet({
7694
7609
  privateKey: ki,
7695
7610
  chainCode: IR,
@@ -7727,8 +7642,8 @@ var HDWallet = class {
7727
7642
  */
7728
7643
  toExtendedKey(isPublic = false, testnet = false) {
7729
7644
  if (this.depth >= 256) {
7730
- throw new FuelError19(
7731
- ErrorCode19.HD_WALLET_ERROR,
7645
+ throw new FuelError18(
7646
+ ErrorCode18.HD_WALLET_ERROR,
7732
7647
  `Exceeded max depth of 255. Current depth: ${this.depth}.`
7733
7648
  );
7734
7649
  }
@@ -7759,10 +7674,10 @@ var HDWallet = class {
7759
7674
  const bytes = arrayify18(decoded);
7760
7675
  const validChecksum = base58check(bytes.slice(0, 78)) === extendedKey;
7761
7676
  if (bytes.length !== 82 || !isValidExtendedKey(bytes)) {
7762
- throw new FuelError19(ErrorCode19.HD_WALLET_ERROR, "Provided key is not a valid extended key.");
7677
+ throw new FuelError18(ErrorCode18.HD_WALLET_ERROR, "Provided key is not a valid extended key.");
7763
7678
  }
7764
7679
  if (!validChecksum) {
7765
- throw new FuelError19(ErrorCode19.HD_WALLET_ERROR, "Provided key has an invalid checksum.");
7680
+ throw new FuelError18(ErrorCode18.HD_WALLET_ERROR, "Provided key has an invalid checksum.");
7766
7681
  }
7767
7682
  const depth = bytes[4];
7768
7683
  const parentFingerprint = hexlify17(bytes.slice(5, 9));
@@ -7770,14 +7685,14 @@ var HDWallet = class {
7770
7685
  const chainCode = hexlify17(bytes.slice(13, 45));
7771
7686
  const key = bytes.slice(45, 78);
7772
7687
  if (depth === 0 && parentFingerprint !== "0x00000000" || depth === 0 && index !== 0) {
7773
- throw new FuelError19(
7774
- ErrorCode19.HD_WALLET_ERROR,
7688
+ throw new FuelError18(
7689
+ ErrorCode18.HD_WALLET_ERROR,
7775
7690
  "Inconsistency detected: Depth is zero but fingerprint/index is non-zero."
7776
7691
  );
7777
7692
  }
7778
7693
  if (isPublicExtendedKey(bytes)) {
7779
7694
  if (key[0] !== 3) {
7780
- throw new FuelError19(ErrorCode19.HD_WALLET_ERROR, "Invalid public extended key.");
7695
+ throw new FuelError18(ErrorCode18.HD_WALLET_ERROR, "Invalid public extended key.");
7781
7696
  }
7782
7697
  return new HDWallet({
7783
7698
  publicKey: key,
@@ -7788,7 +7703,7 @@ var HDWallet = class {
7788
7703
  });
7789
7704
  }
7790
7705
  if (key[0] !== 0) {
7791
- throw new FuelError19(ErrorCode19.HD_WALLET_ERROR, "Invalid private extended key.");
7706
+ throw new FuelError18(ErrorCode18.HD_WALLET_ERROR, "Invalid private extended key.");
7792
7707
  }
7793
7708
  return new HDWallet({
7794
7709
  privateKey: key.slice(1),