@fuel-ts/account 0.0.0-pr-2143-20240514173839 → 0.0.0-pr-2328-20240517121917

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.

Files changed (45) hide show
  1. package/dist/account.d.ts.map +1 -1
  2. package/dist/configs.d.ts +1 -1
  3. package/dist/configs.d.ts.map +1 -1
  4. package/dist/configs.global.js +1 -1
  5. package/dist/configs.global.js.map +1 -1
  6. package/dist/configs.js +5 -5
  7. package/dist/configs.js.map +1 -1
  8. package/dist/configs.mjs +3 -3
  9. package/dist/configs.mjs.map +1 -1
  10. package/dist/index.global.js +627 -1542
  11. package/dist/index.global.js.map +1 -1
  12. package/dist/index.js +153 -197
  13. package/dist/index.js.map +1 -1
  14. package/dist/index.mjs +143 -193
  15. package/dist/index.mjs.map +1 -1
  16. package/dist/mnemonic/mnemonic.d.ts.map +1 -1
  17. package/dist/mnemonic/utils.d.ts +0 -1
  18. package/dist/mnemonic/utils.d.ts.map +1 -1
  19. package/dist/predicate/predicate.d.ts.map +1 -1
  20. package/dist/providers/__generated__/operations.d.ts +8 -0
  21. package/dist/providers/__generated__/operations.d.ts.map +1 -1
  22. package/dist/providers/coin.d.ts +0 -1
  23. package/dist/providers/coin.d.ts.map +1 -1
  24. package/dist/providers/message.d.ts +0 -1
  25. package/dist/providers/message.d.ts.map +1 -1
  26. package/dist/providers/provider.d.ts +4 -1
  27. package/dist/providers/provider.d.ts.map +1 -1
  28. package/dist/providers/transaction-request/input.d.ts +0 -2
  29. package/dist/providers/transaction-request/input.d.ts.map +1 -1
  30. package/dist/providers/transaction-request/transaction-request.d.ts +0 -1
  31. package/dist/providers/transaction-request/transaction-request.d.ts.map +1 -1
  32. package/dist/providers/transaction-response/transaction-response.d.ts.map +1 -1
  33. package/dist/providers/transaction-summary/call.d.ts +1 -1
  34. package/dist/providers/transaction-summary/call.d.ts.map +1 -1
  35. package/dist/providers/utils/extract-tx-error.d.ts +2 -4
  36. package/dist/providers/utils/extract-tx-error.d.ts.map +1 -1
  37. package/dist/test-utils/launchNode.d.ts +2 -4
  38. package/dist/test-utils/launchNode.d.ts.map +1 -1
  39. package/dist/test-utils.global.js +734 -3868
  40. package/dist/test-utils.global.js.map +1 -1
  41. package/dist/test-utils.js +147 -184
  42. package/dist/test-utils.js.map +1 -1
  43. package/dist/test-utils.mjs +136 -173
  44. package/dist/test-utils.mjs.map +1 -1
  45. package/package.json +15 -15
@@ -26,7 +26,7 @@ import { hexlify as hexlify15 } from "@fuel-ts/utils";
26
26
  import { Address as Address3 } from "@fuel-ts/address";
27
27
  import { ErrorCode as ErrorCode15, FuelError as FuelError15 } from "@fuel-ts/errors";
28
28
  import { AbstractAccount } from "@fuel-ts/interfaces";
29
- import { bn as bn20 } from "@fuel-ts/math";
29
+ import { bn as bn19 } from "@fuel-ts/math";
30
30
  import { arrayify as arrayify14, isDefined as isDefined2 } from "@fuel-ts/utils";
31
31
  import { clone as clone4 } from "ramda";
32
32
 
@@ -68,7 +68,7 @@ var addAmountToCoinQuantities = (params) => {
68
68
  // src/providers/provider.ts
69
69
  import { Address as Address2 } from "@fuel-ts/address";
70
70
  import { ErrorCode as ErrorCode13, FuelError as FuelError13 } from "@fuel-ts/errors";
71
- import { BN, bn as bn18 } from "@fuel-ts/math";
71
+ import { BN, bn as bn17 } from "@fuel-ts/math";
72
72
  import {
73
73
  InputType as InputType7,
74
74
  TransactionType as TransactionType8,
@@ -215,6 +215,7 @@ var TransactionEstimatePredicatesFragmentDoc = gql`
215
215
  ${InputEstimatePredicatesFragmentDoc}`;
216
216
  var DryRunFailureStatusFragmentDoc = gql`
217
217
  fragment dryRunFailureStatusFragment on DryRunFailureStatus {
218
+ type: __typename
218
219
  totalGas
219
220
  totalFee
220
221
  reason
@@ -226,6 +227,7 @@ var DryRunFailureStatusFragmentDoc = gql`
226
227
  `;
227
228
  var DryRunSuccessStatusFragmentDoc = gql`
228
229
  fragment dryRunSuccessStatusFragment on DryRunSuccessStatus {
230
+ type: __typename
229
231
  totalGas
230
232
  totalFee
231
233
  programState {
@@ -1667,17 +1669,16 @@ import {
1667
1669
  PANIC_REASONS,
1668
1670
  PANIC_DOC_URL
1669
1671
  } from "@fuel-ts/transactions/configs";
1670
- var assemblePanicError = (status) => {
1671
- let errorMessage = `The transaction reverted with reason: "${status.reason}".`;
1672
- const reason = status.reason;
1673
- if (PANIC_REASONS.includes(status.reason)) {
1672
+ var assemblePanicError = (statusReason) => {
1673
+ let errorMessage = `The transaction reverted with reason: "${statusReason}".`;
1674
+ if (PANIC_REASONS.includes(statusReason)) {
1674
1675
  errorMessage = `${errorMessage}
1675
1676
 
1676
1677
  You can read more about this error at:
1677
1678
 
1678
- ${PANIC_DOC_URL}#variant.${status.reason}`;
1679
+ ${PANIC_DOC_URL}#variant.${statusReason}`;
1679
1680
  }
1680
- return { errorMessage, reason };
1681
+ return { errorMessage, reason: statusReason };
1681
1682
  };
1682
1683
  var stringify = (obj) => JSON.stringify(obj, null, 2);
1683
1684
  var assembleRevertError = (receipts, logs) => {
@@ -1720,10 +1721,10 @@ var assembleRevertError = (receipts, logs) => {
1720
1721
  return { errorMessage, reason };
1721
1722
  };
1722
1723
  var extractTxError = (params) => {
1723
- const { receipts, status, logs } = params;
1724
+ const { receipts, statusReason, logs } = params;
1724
1725
  const isPanic = receipts.some(({ type }) => type === ReceiptType3.Panic);
1725
1726
  const isRevert = receipts.some(({ type }) => type === ReceiptType3.Revert);
1726
- const { errorMessage, reason } = status?.type === "FailureStatus" && isPanic ? assemblePanicError(status) : assembleRevertError(receipts, logs);
1727
+ const { errorMessage, reason } = isPanic ? assemblePanicError(statusReason) : assembleRevertError(receipts, logs);
1727
1728
  const metadata = {
1728
1729
  logs,
1729
1730
  receipts,
@@ -2282,15 +2283,6 @@ var BaseTransactionRequest = class {
2282
2283
  }
2283
2284
  });
2284
2285
  }
2285
- shiftPredicateData() {
2286
- this.inputs.forEach((input) => {
2287
- if ("predicateData" in input && "padPredicateData" in input && typeof input.padPredicateData === "function") {
2288
- input.predicateData = input.padPredicateData(
2289
- BaseTransactionRequest.getPolicyMeta(this).policies.length
2290
- );
2291
- }
2292
- });
2293
- }
2294
2286
  };
2295
2287
 
2296
2288
  // src/providers/transaction-request/create-transaction-request.ts
@@ -2713,12 +2705,12 @@ var transactionRequestify = (obj) => {
2713
2705
 
2714
2706
  // src/providers/transaction-response/transaction-response.ts
2715
2707
  import { ErrorCode as ErrorCode12, FuelError as FuelError12 } from "@fuel-ts/errors";
2716
- import { bn as bn17 } from "@fuel-ts/math";
2708
+ import { bn as bn16 } from "@fuel-ts/math";
2717
2709
  import { TransactionCoder as TransactionCoder4 } from "@fuel-ts/transactions";
2718
2710
  import { arrayify as arrayify10 } from "@fuel-ts/utils";
2719
2711
 
2720
2712
  // src/providers/transaction-summary/assemble-transaction-summary.ts
2721
- import { bn as bn16 } from "@fuel-ts/math";
2713
+ import { bn as bn15 } from "@fuel-ts/math";
2722
2714
  import { PolicyType as PolicyType3 } from "@fuel-ts/transactions";
2723
2715
  import { DateTime, hexlify as hexlify11 } from "@fuel-ts/utils";
2724
2716
 
@@ -2795,43 +2787,32 @@ var calculateTXFeeForSummary = (params) => {
2795
2787
  // src/providers/transaction-summary/operations.ts
2796
2788
  import { ZeroBytes32 as ZeroBytes328 } from "@fuel-ts/address/configs";
2797
2789
  import { ErrorCode as ErrorCode10, FuelError as FuelError10 } from "@fuel-ts/errors";
2798
- import { bn as bn14 } from "@fuel-ts/math";
2790
+ import { bn as bn13 } from "@fuel-ts/math";
2799
2791
  import { ReceiptType as ReceiptType4, TransactionType as TransactionType7 } from "@fuel-ts/transactions";
2800
2792
 
2801
2793
  // src/providers/transaction-summary/call.ts
2802
- import { Interface as Interface2, calculateVmTxMemory } from "@fuel-ts/abi-coder";
2803
- import { bn as bn13 } from "@fuel-ts/math";
2804
- var getFunctionCall = ({ abi, receipt, rawPayload, maxInputs }) => {
2794
+ import { Interface as Interface2 } from "@fuel-ts/abi-coder";
2795
+ var getFunctionCall = ({ abi, receipt }) => {
2805
2796
  const abiInterface = new Interface2(abi);
2806
2797
  const callFunctionSelector = receipt.param1.toHex(8);
2807
2798
  const functionFragment = abiInterface.getFunction(callFunctionSelector);
2808
2799
  const inputs = functionFragment.jsonFn.inputs;
2809
- let encodedArgs;
2810
- if (functionFragment.isInputDataPointer) {
2811
- if (rawPayload) {
2812
- const argsOffset = bn13(receipt.param2).sub(calculateVmTxMemory({ maxInputs: maxInputs.toNumber() })).toNumber();
2813
- encodedArgs = `0x${rawPayload.slice(2).slice(argsOffset * 2)}`;
2814
- }
2815
- } else {
2816
- encodedArgs = receipt.param2.toHex();
2817
- }
2800
+ const encodedArgs = receipt.param2.toHex();
2818
2801
  let argumentsProvided;
2819
- if (encodedArgs) {
2820
- const data = functionFragment.decodeArguments(encodedArgs);
2821
- if (data) {
2822
- argumentsProvided = inputs.reduce((prev, input, index) => {
2823
- const value = data[index];
2824
- const name = input.name;
2825
- if (name) {
2826
- return {
2827
- ...prev,
2828
- // reparse to remove bn
2829
- [name]: JSON.parse(JSON.stringify(value))
2830
- };
2831
- }
2832
- return prev;
2833
- }, {});
2834
- }
2802
+ const data = functionFragment.decodeArguments(encodedArgs);
2803
+ if (data) {
2804
+ argumentsProvided = inputs.reduce((prev, input, index) => {
2805
+ const value = data[index];
2806
+ const name = input.name;
2807
+ if (name) {
2808
+ return {
2809
+ ...prev,
2810
+ // reparse to remove bn
2811
+ [name]: JSON.parse(JSON.stringify(value))
2812
+ };
2813
+ }
2814
+ return prev;
2815
+ }, {});
2835
2816
  }
2836
2817
  const call = {
2837
2818
  functionSignature: functionFragment.signature,
@@ -2971,7 +2952,7 @@ var mergeAssets = (op1, op2) => {
2971
2952
  if (!matchingAsset) {
2972
2953
  return asset1;
2973
2954
  }
2974
- const mergedAmount = bn14(asset1.amount).add(matchingAsset.amount);
2955
+ const mergedAmount = bn13(asset1.amount).add(matchingAsset.amount);
2975
2956
  return { ...asset1, amount: mergedAmount };
2976
2957
  });
2977
2958
  return mergedAssets.concat(filteredAssets);
@@ -3294,7 +3275,7 @@ var extractBurnedAssetsFromReceipts = (receipts) => {
3294
3275
 
3295
3276
  // src/providers/transaction-summary/status.ts
3296
3277
  import { ErrorCode as ErrorCode11, FuelError as FuelError11 } from "@fuel-ts/errors";
3297
- import { bn as bn15 } from "@fuel-ts/math";
3278
+ import { bn as bn14 } from "@fuel-ts/math";
3298
3279
  var getTransactionStatusName = (gqlStatus) => {
3299
3280
  switch (gqlStatus) {
3300
3281
  case "FailureStatus":
@@ -3328,15 +3309,15 @@ var processGraphqlStatus = (gqlTransactionStatus) => {
3328
3309
  time = gqlTransactionStatus.time;
3329
3310
  blockId = gqlTransactionStatus.block.id;
3330
3311
  isStatusSuccess = true;
3331
- totalFee = bn15(gqlTransactionStatus.totalFee);
3332
- totalGas = bn15(gqlTransactionStatus.totalGas);
3312
+ totalFee = bn14(gqlTransactionStatus.totalFee);
3313
+ totalGas = bn14(gqlTransactionStatus.totalGas);
3333
3314
  break;
3334
3315
  case "FailureStatus":
3335
3316
  time = gqlTransactionStatus.time;
3336
3317
  blockId = gqlTransactionStatus.block.id;
3337
3318
  isStatusFailure = true;
3338
- totalFee = bn15(gqlTransactionStatus.totalFee);
3339
- totalGas = bn15(gqlTransactionStatus.totalGas);
3319
+ totalFee = bn14(gqlTransactionStatus.totalFee);
3320
+ totalGas = bn14(gqlTransactionStatus.totalGas);
3340
3321
  break;
3341
3322
  case "SubmittedStatus":
3342
3323
  time = gqlTransactionStatus.time;
@@ -3386,7 +3367,7 @@ function assembleTransactionSummary(params) {
3386
3367
  maxInputs
3387
3368
  });
3388
3369
  const typeName = getTransactionTypeName(transaction.type);
3389
- const tip = bn16(transaction.policies?.find((policy) => policy.type === PolicyType3.Tip)?.data);
3370
+ const tip = bn15(transaction.policies?.find((policy) => policy.type === PolicyType3.Tip)?.data);
3390
3371
  const { isStatusFailure, isStatusPending, isStatusSuccess, blockId, status, time, totalFee } = processGraphqlStatus(gqlTransactionStatus);
3391
3372
  const fee = calculateTXFeeForSummary({
3392
3373
  totalFee,
@@ -3457,7 +3438,7 @@ var TransactionResponse = class {
3457
3438
  /** Current provider */
3458
3439
  provider;
3459
3440
  /** Gas used on the transaction */
3460
- gasUsed = bn17(0);
3441
+ gasUsed = bn16(0);
3461
3442
  /** The graphql Transaction with receipts object. */
3462
3443
  gqlTransaction;
3463
3444
  abis;
@@ -3601,14 +3582,12 @@ var TransactionResponse = class {
3601
3582
  );
3602
3583
  transactionResult.logs = logs;
3603
3584
  }
3604
- if (transactionResult.isStatusFailure) {
3605
- const {
3606
- receipts,
3607
- gqlTransaction: { status }
3608
- } = transactionResult;
3585
+ const { gqlTransaction, receipts } = transactionResult;
3586
+ if (gqlTransaction.status?.type === "FailureStatus") {
3587
+ const { reason } = gqlTransaction.status;
3609
3588
  throw extractTxError({
3610
3589
  receipts,
3611
- status,
3590
+ statusReason: reason,
3612
3591
  logs
3613
3592
  });
3614
3593
  }
@@ -3691,47 +3670,47 @@ var processGqlChain = (chain) => {
3691
3670
  } = consensusParameters;
3692
3671
  return {
3693
3672
  name,
3694
- baseChainHeight: bn18(daHeight),
3673
+ baseChainHeight: bn17(daHeight),
3695
3674
  consensusParameters: {
3696
3675
  version,
3697
- chainId: bn18(chainId),
3676
+ chainId: bn17(chainId),
3698
3677
  baseAssetId,
3699
3678
  feeParameters: {
3700
3679
  version: feeParams.version,
3701
- gasPerByte: bn18(feeParams.gasPerByte),
3702
- gasPriceFactor: bn18(feeParams.gasPriceFactor)
3680
+ gasPerByte: bn17(feeParams.gasPerByte),
3681
+ gasPriceFactor: bn17(feeParams.gasPriceFactor)
3703
3682
  },
3704
3683
  contractParameters: {
3705
3684
  version: contractParams.version,
3706
- contractMaxSize: bn18(contractParams.contractMaxSize),
3707
- maxStorageSlots: bn18(contractParams.maxStorageSlots)
3685
+ contractMaxSize: bn17(contractParams.contractMaxSize),
3686
+ maxStorageSlots: bn17(contractParams.maxStorageSlots)
3708
3687
  },
3709
3688
  txParameters: {
3710
3689
  version: txParams.version,
3711
- maxInputs: bn18(txParams.maxInputs),
3712
- maxOutputs: bn18(txParams.maxOutputs),
3713
- maxWitnesses: bn18(txParams.maxWitnesses),
3714
- maxGasPerTx: bn18(txParams.maxGasPerTx),
3715
- maxSize: bn18(txParams.maxSize),
3716
- maxBytecodeSubsections: bn18(txParams.maxBytecodeSubsections)
3690
+ maxInputs: bn17(txParams.maxInputs),
3691
+ maxOutputs: bn17(txParams.maxOutputs),
3692
+ maxWitnesses: bn17(txParams.maxWitnesses),
3693
+ maxGasPerTx: bn17(txParams.maxGasPerTx),
3694
+ maxSize: bn17(txParams.maxSize),
3695
+ maxBytecodeSubsections: bn17(txParams.maxBytecodeSubsections)
3717
3696
  },
3718
3697
  predicateParameters: {
3719
3698
  version: predicateParams.version,
3720
- maxPredicateLength: bn18(predicateParams.maxPredicateLength),
3721
- maxPredicateDataLength: bn18(predicateParams.maxPredicateDataLength),
3722
- maxGasPerPredicate: bn18(predicateParams.maxGasPerPredicate),
3723
- maxMessageDataLength: bn18(predicateParams.maxMessageDataLength)
3699
+ maxPredicateLength: bn17(predicateParams.maxPredicateLength),
3700
+ maxPredicateDataLength: bn17(predicateParams.maxPredicateDataLength),
3701
+ maxGasPerPredicate: bn17(predicateParams.maxGasPerPredicate),
3702
+ maxMessageDataLength: bn17(predicateParams.maxMessageDataLength)
3724
3703
  },
3725
3704
  scriptParameters: {
3726
3705
  version: scriptParams.version,
3727
- maxScriptLength: bn18(scriptParams.maxScriptLength),
3728
- maxScriptDataLength: bn18(scriptParams.maxScriptDataLength)
3706
+ maxScriptLength: bn17(scriptParams.maxScriptLength),
3707
+ maxScriptDataLength: bn17(scriptParams.maxScriptDataLength)
3729
3708
  },
3730
3709
  gasCosts
3731
3710
  },
3732
3711
  latestBlock: {
3733
3712
  id: latestBlock.id,
3734
- height: bn18(latestBlock.height),
3713
+ height: bn17(latestBlock.height),
3735
3714
  time: latestBlock.header.time,
3736
3715
  transactions: latestBlock.transactions.map((i) => ({
3737
3716
  id: i.id
@@ -3927,7 +3906,7 @@ Supported fuel-core version: ${supportedVersion}.`
3927
3906
  */
3928
3907
  async getBlockNumber() {
3929
3908
  const { chain } = await this.operations.getChain();
3930
- return bn18(chain.latestBlock.height, 10);
3909
+ return bn17(chain.latestBlock.height, 10);
3931
3910
  }
3932
3911
  /**
3933
3912
  * Returns the chain information.
@@ -3937,8 +3916,8 @@ Supported fuel-core version: ${supportedVersion}.`
3937
3916
  async fetchNode() {
3938
3917
  const { nodeInfo } = await this.operations.getNodeInfo();
3939
3918
  const processedNodeInfo = {
3940
- maxDepth: bn18(nodeInfo.maxDepth),
3941
- maxTx: bn18(nodeInfo.maxTx),
3919
+ maxDepth: bn17(nodeInfo.maxDepth),
3920
+ maxTx: bn17(nodeInfo.maxTx),
3942
3921
  nodeVersion: nodeInfo.nodeVersion,
3943
3922
  utxoValidation: nodeInfo.utxoValidation,
3944
3923
  vmBacktrace: nodeInfo.vmBacktrace
@@ -4070,7 +4049,7 @@ Supported fuel-core version: ${supportedVersion}.`
4070
4049
  } = response;
4071
4050
  if (inputs) {
4072
4051
  inputs.forEach((input, index) => {
4073
- if ("predicateGasUsed" in input && bn18(input.predicateGasUsed).gt(0)) {
4052
+ if ("predicateGasUsed" in input && bn17(input.predicateGasUsed).gt(0)) {
4074
4053
  transactionRequest.inputs[index].predicateGasUsed = input.predicateGasUsed;
4075
4054
  }
4076
4055
  });
@@ -4228,12 +4207,12 @@ Supported fuel-core version: ${supportedVersion}.`
4228
4207
  gasPrice = await this.estimateGasPrice(10);
4229
4208
  }
4230
4209
  const minFee = calculateGasFee({
4231
- gasPrice: bn18(gasPrice),
4210
+ gasPrice: bn17(gasPrice),
4232
4211
  gas: minGas,
4233
4212
  priceFactor: gasPriceFactor,
4234
4213
  tip: transactionRequest.tip
4235
4214
  }).add(1);
4236
- let gasLimit = bn18(0);
4215
+ let gasLimit = bn17(0);
4237
4216
  if (transactionRequest.type === TransactionType8.Script) {
4238
4217
  gasLimit = transactionRequest.gasLimit;
4239
4218
  if (transactionRequest.gasLimit.eq(0)) {
@@ -4246,7 +4225,7 @@ Supported fuel-core version: ${supportedVersion}.`
4246
4225
  }
4247
4226
  const maxGas = transactionRequest.calculateMaxGas(chainInfo, minGas);
4248
4227
  const maxFee = calculateGasFee({
4249
- gasPrice: bn18(gasPrice),
4228
+ gasPrice: bn17(gasPrice),
4250
4229
  gas: maxGas,
4251
4230
  priceFactor: gasPriceFactor,
4252
4231
  tip: transactionRequest.tip
@@ -4311,7 +4290,7 @@ Supported fuel-core version: ${supportedVersion}.`
4311
4290
  const allQuantities = mergeQuantities(coinOutputsQuantities, quantitiesToContract);
4312
4291
  txRequestClone.fundWithFakeUtxos(allQuantities, baseAssetId, resourcesOwner?.address);
4313
4292
  if (isScriptTransaction) {
4314
- txRequestClone.gasLimit = bn18(0);
4293
+ txRequestClone.gasLimit = bn17(0);
4315
4294
  }
4316
4295
  if (resourcesOwner && "populateTransactionPredicateData" in resourcesOwner) {
4317
4296
  resourcesOwner.populateTransactionPredicateData(txRequestClone);
@@ -4332,7 +4311,7 @@ Supported fuel-core version: ${supportedVersion}.`
4332
4311
  let dryRunStatus;
4333
4312
  let missingContractIds = [];
4334
4313
  let outputVariables = 0;
4335
- let gasUsed = bn18(0);
4314
+ let gasUsed = bn17(0);
4336
4315
  txRequestClone.maxFee = maxFee;
4337
4316
  if (isScriptTransaction) {
4338
4317
  txRequestClone.gasLimit = gasLimit;
@@ -4340,7 +4319,10 @@ Supported fuel-core version: ${supportedVersion}.`
4340
4319
  await signatureCallback(txRequestClone);
4341
4320
  }
4342
4321
  ({ receipts, missingContractIds, outputVariables, dryRunStatus } = await this.estimateTxDependencies(txRequestClone));
4343
- gasUsed = isScriptTransaction ? getGasUsedFromReceipts(receipts) : gasUsed;
4322
+ if (dryRunStatus && "reason" in dryRunStatus) {
4323
+ throw this.extractDryRunError(txRequestClone, receipts, dryRunStatus);
4324
+ }
4325
+ gasUsed = getGasUsedFromReceipts(receipts);
4344
4326
  txRequestClone.gasLimit = gasUsed;
4345
4327
  ({ maxFee, maxGas, minFee, minGas, gasPrice } = await this.estimateTxGasAndFee({
4346
4328
  transactionRequest: txRequestClone,
@@ -4397,10 +4379,10 @@ Supported fuel-core version: ${supportedVersion}.`
4397
4379
  return coins.map((coin) => ({
4398
4380
  id: coin.utxoId,
4399
4381
  assetId: coin.assetId,
4400
- amount: bn18(coin.amount),
4382
+ amount: bn17(coin.amount),
4401
4383
  owner: Address2.fromAddressOrString(coin.owner),
4402
- blockCreated: bn18(coin.blockCreated),
4403
- txCreatedIdx: bn18(coin.txCreatedIdx)
4384
+ blockCreated: bn17(coin.blockCreated),
4385
+ txCreatedIdx: bn17(coin.txCreatedIdx)
4404
4386
  }));
4405
4387
  }
4406
4388
  /**
@@ -4437,9 +4419,9 @@ Supported fuel-core version: ${supportedVersion}.`
4437
4419
  switch (coin.type) {
4438
4420
  case "MessageCoin":
4439
4421
  return {
4440
- amount: bn18(coin.amount),
4422
+ amount: bn17(coin.amount),
4441
4423
  assetId: coin.assetId,
4442
- daHeight: bn18(coin.daHeight),
4424
+ daHeight: bn17(coin.daHeight),
4443
4425
  sender: Address2.fromAddressOrString(coin.sender),
4444
4426
  recipient: Address2.fromAddressOrString(coin.recipient),
4445
4427
  nonce: coin.nonce
@@ -4447,11 +4429,11 @@ Supported fuel-core version: ${supportedVersion}.`
4447
4429
  case "Coin":
4448
4430
  return {
4449
4431
  id: coin.utxoId,
4450
- amount: bn18(coin.amount),
4432
+ amount: bn17(coin.amount),
4451
4433
  assetId: coin.assetId,
4452
4434
  owner: Address2.fromAddressOrString(coin.owner),
4453
- blockCreated: bn18(coin.blockCreated),
4454
- txCreatedIdx: bn18(coin.txCreatedIdx)
4435
+ blockCreated: bn17(coin.blockCreated),
4436
+ txCreatedIdx: bn17(coin.txCreatedIdx)
4455
4437
  };
4456
4438
  default:
4457
4439
  return null;
@@ -4468,13 +4450,13 @@ Supported fuel-core version: ${supportedVersion}.`
4468
4450
  async getBlock(idOrHeight) {
4469
4451
  let variables;
4470
4452
  if (typeof idOrHeight === "number") {
4471
- variables = { height: bn18(idOrHeight).toString(10) };
4453
+ variables = { height: bn17(idOrHeight).toString(10) };
4472
4454
  } else if (idOrHeight === "latest") {
4473
4455
  variables = { height: (await this.getBlockNumber()).toString(10) };
4474
4456
  } else if (idOrHeight.length === 66) {
4475
4457
  variables = { blockId: idOrHeight };
4476
4458
  } else {
4477
- variables = { blockId: bn18(idOrHeight).toString(10) };
4459
+ variables = { blockId: bn17(idOrHeight).toString(10) };
4478
4460
  }
4479
4461
  const { block } = await this.operations.getBlock(variables);
4480
4462
  if (!block) {
@@ -4482,7 +4464,7 @@ Supported fuel-core version: ${supportedVersion}.`
4482
4464
  }
4483
4465
  return {
4484
4466
  id: block.id,
4485
- height: bn18(block.height),
4467
+ height: bn17(block.height),
4486
4468
  time: block.header.time,
4487
4469
  transactionIds: block.transactions.map((tx) => tx.id)
4488
4470
  };
@@ -4497,7 +4479,7 @@ Supported fuel-core version: ${supportedVersion}.`
4497
4479
  const { blocks: fetchedData } = await this.operations.getBlocks(params);
4498
4480
  const blocks = fetchedData.edges.map(({ node: block }) => ({
4499
4481
  id: block.id,
4500
- height: bn18(block.height),
4482
+ height: bn17(block.height),
4501
4483
  time: block.header.time,
4502
4484
  transactionIds: block.transactions.map((tx) => tx.id)
4503
4485
  }));
@@ -4512,7 +4494,7 @@ Supported fuel-core version: ${supportedVersion}.`
4512
4494
  async getBlockWithTransactions(idOrHeight) {
4513
4495
  let variables;
4514
4496
  if (typeof idOrHeight === "number") {
4515
- variables = { blockHeight: bn18(idOrHeight).toString(10) };
4497
+ variables = { blockHeight: bn17(idOrHeight).toString(10) };
4516
4498
  } else if (idOrHeight === "latest") {
4517
4499
  variables = { blockHeight: (await this.getBlockNumber()).toString() };
4518
4500
  } else {
@@ -4524,7 +4506,7 @@ Supported fuel-core version: ${supportedVersion}.`
4524
4506
  }
4525
4507
  return {
4526
4508
  id: block.id,
4527
- height: bn18(block.height, 10),
4509
+ height: bn17(block.height, 10),
4528
4510
  time: block.header.time,
4529
4511
  transactionIds: block.transactions.map((tx) => tx.id),
4530
4512
  transactions: block.transactions.map(
@@ -4573,7 +4555,7 @@ Supported fuel-core version: ${supportedVersion}.`
4573
4555
  contract: Address2.fromAddressOrString(contractId).toB256(),
4574
4556
  asset: hexlify12(assetId)
4575
4557
  });
4576
- return bn18(contractBalance.amount, 10);
4558
+ return bn17(contractBalance.amount, 10);
4577
4559
  }
4578
4560
  /**
4579
4561
  * Returns the balance for the given owner for the given asset ID.
@@ -4587,7 +4569,7 @@ Supported fuel-core version: ${supportedVersion}.`
4587
4569
  owner: Address2.fromAddressOrString(owner).toB256(),
4588
4570
  assetId: hexlify12(assetId)
4589
4571
  });
4590
- return bn18(balance.amount, 10);
4572
+ return bn17(balance.amount, 10);
4591
4573
  }
4592
4574
  /**
4593
4575
  * Returns balances for the given owner.
@@ -4605,7 +4587,7 @@ Supported fuel-core version: ${supportedVersion}.`
4605
4587
  const balances = result.balances.edges.map((edge) => edge.node);
4606
4588
  return balances.map((balance) => ({
4607
4589
  assetId: balance.assetId,
4608
- amount: bn18(balance.amount)
4590
+ amount: bn17(balance.amount)
4609
4591
  }));
4610
4592
  }
4611
4593
  /**
@@ -4627,15 +4609,15 @@ Supported fuel-core version: ${supportedVersion}.`
4627
4609
  sender: message.sender,
4628
4610
  recipient: message.recipient,
4629
4611
  nonce: message.nonce,
4630
- amount: bn18(message.amount),
4612
+ amount: bn17(message.amount),
4631
4613
  data: message.data
4632
4614
  }),
4633
4615
  sender: Address2.fromAddressOrString(message.sender),
4634
4616
  recipient: Address2.fromAddressOrString(message.recipient),
4635
4617
  nonce: message.nonce,
4636
- amount: bn18(message.amount),
4618
+ amount: bn17(message.amount),
4637
4619
  data: InputMessageCoder.decodeData(message.data),
4638
- daHeight: bn18(message.daHeight)
4620
+ daHeight: bn17(message.daHeight)
4639
4621
  }));
4640
4622
  }
4641
4623
  /**
@@ -4688,19 +4670,19 @@ Supported fuel-core version: ${supportedVersion}.`
4688
4670
  } = result.messageProof;
4689
4671
  return {
4690
4672
  messageProof: {
4691
- proofIndex: bn18(messageProof.proofIndex),
4673
+ proofIndex: bn17(messageProof.proofIndex),
4692
4674
  proofSet: messageProof.proofSet
4693
4675
  },
4694
4676
  blockProof: {
4695
- proofIndex: bn18(blockProof.proofIndex),
4677
+ proofIndex: bn17(blockProof.proofIndex),
4696
4678
  proofSet: blockProof.proofSet
4697
4679
  },
4698
4680
  messageBlockHeader: {
4699
4681
  id: messageBlockHeader.id,
4700
- daHeight: bn18(messageBlockHeader.daHeight),
4682
+ daHeight: bn17(messageBlockHeader.daHeight),
4701
4683
  transactionsCount: Number(messageBlockHeader.transactionsCount),
4702
4684
  transactionsRoot: messageBlockHeader.transactionsRoot,
4703
- height: bn18(messageBlockHeader.height),
4685
+ height: bn17(messageBlockHeader.height),
4704
4686
  prevRoot: messageBlockHeader.prevRoot,
4705
4687
  time: messageBlockHeader.time,
4706
4688
  applicationHash: messageBlockHeader.applicationHash,
@@ -4712,10 +4694,10 @@ Supported fuel-core version: ${supportedVersion}.`
4712
4694
  },
4713
4695
  commitBlockHeader: {
4714
4696
  id: commitBlockHeader.id,
4715
- daHeight: bn18(commitBlockHeader.daHeight),
4697
+ daHeight: bn17(commitBlockHeader.daHeight),
4716
4698
  transactionsCount: Number(commitBlockHeader.transactionsCount),
4717
4699
  transactionsRoot: commitBlockHeader.transactionsRoot,
4718
- height: bn18(commitBlockHeader.height),
4700
+ height: bn17(commitBlockHeader.height),
4719
4701
  prevRoot: commitBlockHeader.prevRoot,
4720
4702
  time: commitBlockHeader.time,
4721
4703
  applicationHash: commitBlockHeader.applicationHash,
@@ -4728,19 +4710,19 @@ Supported fuel-core version: ${supportedVersion}.`
4728
4710
  sender: Address2.fromAddressOrString(sender),
4729
4711
  recipient: Address2.fromAddressOrString(recipient),
4730
4712
  nonce,
4731
- amount: bn18(amount),
4713
+ amount: bn17(amount),
4732
4714
  data
4733
4715
  };
4734
4716
  }
4735
4717
  async getLatestGasPrice() {
4736
4718
  const { latestGasPrice } = await this.operations.getLatestGasPrice();
4737
- return bn18(latestGasPrice.gasPrice);
4719
+ return bn17(latestGasPrice.gasPrice);
4738
4720
  }
4739
4721
  async estimateGasPrice(blockHorizon) {
4740
4722
  const { estimateGasPrice } = await this.operations.estimateGasPrice({
4741
4723
  blockHorizon: String(blockHorizon)
4742
4724
  });
4743
- return bn18(estimateGasPrice.gasPrice);
4725
+ return bn17(estimateGasPrice.gasPrice);
4744
4726
  }
4745
4727
  /**
4746
4728
  * Returns Message Proof for given transaction id and the message id from MessageOut receipt.
@@ -4761,10 +4743,10 @@ Supported fuel-core version: ${supportedVersion}.`
4761
4743
  */
4762
4744
  async produceBlocks(amount, startTime) {
4763
4745
  const { produceBlocks: latestBlockHeight } = await this.operations.produceBlocks({
4764
- blocksToProduce: bn18(amount).toString(10),
4746
+ blocksToProduce: bn17(amount).toString(10),
4765
4747
  startTimestamp: startTime ? DateTime2.fromUnixMilliseconds(startTime).toTai64() : void 0
4766
4748
  });
4767
- return bn18(latestBlockHeight);
4749
+ return bn17(latestBlockHeight);
4768
4750
  }
4769
4751
  // eslint-disable-next-line @typescript-eslint/require-await
4770
4752
  async getTransactionResponse(transactionId) {
@@ -4792,6 +4774,22 @@ Supported fuel-core version: ${supportedVersion}.`
4792
4774
  }
4793
4775
  return relayedTransactionStatus;
4794
4776
  }
4777
+ extractDryRunError(transactionRequest, receipts, dryRunStatus) {
4778
+ const status = dryRunStatus;
4779
+ let logs = [];
4780
+ if (transactionRequest.abis) {
4781
+ logs = getDecodedLogs(
4782
+ receipts,
4783
+ transactionRequest.abis.main,
4784
+ transactionRequest.abis.otherContractsAbis
4785
+ );
4786
+ }
4787
+ return extractTxError({
4788
+ logs,
4789
+ receipts,
4790
+ statusReason: status.reason
4791
+ });
4792
+ }
4795
4793
  };
4796
4794
  var Provider = _Provider;
4797
4795
  _cacheInputs = new WeakSet();
@@ -4810,7 +4808,7 @@ __publicField(Provider, "nodeInfoCache", {});
4810
4808
 
4811
4809
  // src/providers/transaction-summary/get-transaction-summary.ts
4812
4810
  import { ErrorCode as ErrorCode14, FuelError as FuelError14 } from "@fuel-ts/errors";
4813
- import { bn as bn19 } from "@fuel-ts/math";
4811
+ import { bn as bn18 } from "@fuel-ts/math";
4814
4812
  import { TransactionCoder as TransactionCoder6 } from "@fuel-ts/transactions";
4815
4813
  import { arrayify as arrayify12 } from "@fuel-ts/utils";
4816
4814
 
@@ -5088,9 +5086,9 @@ var Account = class extends AbstractAccount {
5088
5086
  const { addedSignatures, estimatedPredicates, requiredQuantities, updateMaxFee } = params;
5089
5087
  const fee = request.maxFee;
5090
5088
  const baseAssetId = this.provider.getBaseAssetId();
5091
- const requiredInBaseAsset = requiredQuantities.find((quantity) => quantity.assetId === baseAssetId)?.amount || bn20(0);
5089
+ const requiredInBaseAsset = requiredQuantities.find((quantity) => quantity.assetId === baseAssetId)?.amount || bn19(0);
5092
5090
  const requiredQuantitiesWithFee = addAmountToCoinQuantities({
5093
- amount: bn20(fee),
5091
+ amount: bn19(fee),
5094
5092
  assetId: baseAssetId,
5095
5093
  coinQuantities: requiredQuantities
5096
5094
  });
@@ -5098,7 +5096,7 @@ var Account = class extends AbstractAccount {
5098
5096
  requiredQuantitiesWithFee.forEach(({ amount, assetId }) => {
5099
5097
  quantitiesDict[assetId] = {
5100
5098
  required: amount,
5101
- owned: bn20(0)
5099
+ owned: bn19(0)
5102
5100
  };
5103
5101
  });
5104
5102
  request.inputs.filter(isRequestInputResource).forEach((input) => {
@@ -5125,7 +5123,6 @@ var Account = class extends AbstractAccount {
5125
5123
  cacheRequestInputsResourcesFromOwner(request.inputs, this.address)
5126
5124
  );
5127
5125
  request.addResources(resources);
5128
- request.shiftPredicateData();
5129
5126
  request.updatePredicateGasUsed(estimatedPredicates);
5130
5127
  const requestToReestimate2 = clone4(request);
5131
5128
  if (addedSignatures) {
@@ -5157,7 +5154,6 @@ var Account = class extends AbstractAccount {
5157
5154
  }
5158
5155
  fundingAttempts += 1;
5159
5156
  }
5160
- request.shiftPredicateData();
5161
5157
  request.updatePredicateGasUsed(estimatedPredicates);
5162
5158
  const requestToReestimate = clone4(request);
5163
5159
  if (addedSignatures) {
@@ -5208,7 +5204,7 @@ var Account = class extends AbstractAccount {
5208
5204
  * @returns A promise that resolves to the transaction response.
5209
5205
  */
5210
5206
  async transfer(destination, amount, assetId, txParams = {}) {
5211
- if (bn20(amount).lte(0)) {
5207
+ if (bn19(amount).lte(0)) {
5212
5208
  throw new FuelError15(
5213
5209
  ErrorCode15.INVALID_TRANSFER_AMOUNT,
5214
5210
  "Transfer amount must be a positive number."
@@ -5228,7 +5224,7 @@ var Account = class extends AbstractAccount {
5228
5224
  * @returns A promise that resolves to the transaction response.
5229
5225
  */
5230
5226
  async transferToContract(contractId, amount, assetId, txParams = {}) {
5231
- if (bn20(amount).lte(0)) {
5227
+ if (bn19(amount).lte(0)) {
5232
5228
  throw new FuelError15(
5233
5229
  ErrorCode15.INVALID_TRANSFER_AMOUNT,
5234
5230
  "Transfer amount must be a positive number."
@@ -5238,7 +5234,7 @@ var Account = class extends AbstractAccount {
5238
5234
  const assetIdToTransfer = assetId ?? this.provider.getBaseAssetId();
5239
5235
  const { script, scriptData } = await assembleTransferToContractScript({
5240
5236
  hexlifiedContractId: contractAddress.toB256(),
5241
- amountToTransfer: bn20(amount),
5237
+ amountToTransfer: bn19(amount),
5242
5238
  assetId: assetIdToTransfer
5243
5239
  });
5244
5240
  let request = new ScriptTransactionRequest({
@@ -5249,7 +5245,7 @@ var Account = class extends AbstractAccount {
5249
5245
  request.addContractInputAndOutput(contractAddress);
5250
5246
  const txCost = await this.provider.getTransactionCost(request, {
5251
5247
  resourcesOwner: this,
5252
- quantitiesToContract: [{ amount: bn20(amount), assetId: String(assetIdToTransfer) }]
5248
+ quantitiesToContract: [{ amount: bn19(amount), assetId: String(assetIdToTransfer) }]
5253
5249
  });
5254
5250
  request = this.validateGasLimitAndMaxFee({
5255
5251
  transactionRequest: request,
@@ -5274,7 +5270,7 @@ var Account = class extends AbstractAccount {
5274
5270
  "0x".concat(recipientAddress.toHexString().substring(2).padStart(64, "0"))
5275
5271
  );
5276
5272
  const amountDataArray = arrayify14(
5277
- "0x".concat(bn20(amount).toHex().substring(2).padStart(16, "0"))
5273
+ "0x".concat(bn19(amount).toHex().substring(2).padStart(16, "0"))
5278
5274
  );
5279
5275
  const script = new Uint8Array([
5280
5276
  ...arrayify14(withdrawScript.bytes),
@@ -5284,7 +5280,7 @@ var Account = class extends AbstractAccount {
5284
5280
  const params = { script, ...txParams };
5285
5281
  const baseAssetId = this.provider.getBaseAssetId();
5286
5282
  let request = new ScriptTransactionRequest(params);
5287
- const quantitiesToContract = [{ amount: bn20(amount), assetId: baseAssetId }];
5283
+ const quantitiesToContract = [{ amount: bn19(amount), assetId: baseAssetId }];
5288
5284
  const txCost = await this.provider.getTransactionCost(request, { quantitiesToContract });
5289
5285
  request = this.validateGasLimitAndMaxFee({
5290
5286
  transactionRequest: request,
@@ -5701,14 +5697,14 @@ __publicField(BaseWalletUnlocked, "defaultPath", "m/44'/1179993420'/0'/0/0");
5701
5697
  import { computeHmac as computeHmac2, ripemd160 } from "@fuel-ts/crypto";
5702
5698
  import { ErrorCode as ErrorCode19, FuelError as FuelError19 } from "@fuel-ts/errors";
5703
5699
  import { sha256 as sha2564 } from "@fuel-ts/hasher";
5704
- import { bn as bn21, toBytes as toBytes2, toHex } from "@fuel-ts/math";
5700
+ import { bn as bn20, toBytes as toBytes2, toHex } from "@fuel-ts/math";
5705
5701
  import { arrayify as arrayify18, hexlify as hexlify17, concat as concat5, dataSlice as dataSlice2, encodeBase58 as encodeBase582, decodeBase58 } from "@fuel-ts/utils";
5706
5702
 
5707
5703
  // src/mnemonic/mnemonic.ts
5708
5704
  import { randomBytes as randomBytes4, pbkdf2, computeHmac } from "@fuel-ts/crypto";
5709
5705
  import { ErrorCode as ErrorCode18, FuelError as FuelError18 } from "@fuel-ts/errors";
5710
5706
  import { sha256 as sha2563 } from "@fuel-ts/hasher";
5711
- import { arrayify as arrayify17, hexlify as hexlify16, concat as concat4, dataSlice, encodeBase58 } from "@fuel-ts/utils";
5707
+ import { arrayify as arrayify17, hexlify as hexlify16, concat as concat4, dataSlice, encodeBase58, toUtf8Bytes } from "@fuel-ts/utils";
5712
5708
 
5713
5709
  // src/wordlists/words/english.ts
5714
5710
  var english = [
@@ -7766,38 +7762,6 @@ var english = [
7766
7762
  import { ErrorCode as ErrorCode17, FuelError as FuelError17 } from "@fuel-ts/errors";
7767
7763
  import { sha256 as sha2562 } from "@fuel-ts/hasher";
7768
7764
  import { arrayify as arrayify16 } from "@fuel-ts/utils";
7769
- function toUtf8Bytes(stri) {
7770
- const str = stri.normalize("NFKD");
7771
- const result = [];
7772
- for (let i = 0; i < str.length; i += 1) {
7773
- const c = str.charCodeAt(i);
7774
- if (c < 128) {
7775
- result.push(c);
7776
- } else if (c < 2048) {
7777
- result.push(c >> 6 | 192);
7778
- result.push(c & 63 | 128);
7779
- } else if ((c & 64512) === 55296) {
7780
- i += 1;
7781
- const c2 = str.charCodeAt(i);
7782
- if (i >= str.length || (c2 & 64512) !== 56320) {
7783
- throw new FuelError17(
7784
- ErrorCode17.INVALID_INPUT_PARAMETERS,
7785
- "Invalid UTF-8 in the input string."
7786
- );
7787
- }
7788
- const pair = 65536 + ((c & 1023) << 10) + (c2 & 1023);
7789
- result.push(pair >> 18 | 240);
7790
- result.push(pair >> 12 & 63 | 128);
7791
- result.push(pair >> 6 & 63 | 128);
7792
- result.push(pair & 63 | 128);
7793
- } else {
7794
- result.push(c >> 12 | 224);
7795
- result.push(c >> 6 & 63 | 128);
7796
- result.push(c & 63 | 128);
7797
- }
7798
- }
7799
- return Uint8Array.from(result);
7800
- }
7801
7765
  function getLowerMask(bits) {
7802
7766
  return (1 << bits) - 1;
7803
7767
  }
@@ -8165,7 +8129,7 @@ var HDWallet = class {
8165
8129
  const IR = bytes.slice(32);
8166
8130
  if (privateKey) {
8167
8131
  const N = "0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141";
8168
- const ki = bn21(IL).add(privateKey).mod(N).toBytes(32);
8132
+ const ki = bn20(IL).add(privateKey).mod(N).toBytes(32);
8169
8133
  return new HDWallet({
8170
8134
  privateKey: ki,
8171
8135
  chainCode: IR,
@@ -8506,7 +8470,6 @@ var launchNode = async ({
8506
8470
  ip,
8507
8471
  port,
8508
8472
  args = [],
8509
- fuelCorePath = void 0,
8510
8473
  useSystemFuelCore = false,
8511
8474
  loggingEnabled = true,
8512
8475
  debugEnabled = false,
@@ -8527,7 +8490,7 @@ var launchNode = async ({
8527
8490
  const poaInstantFlagValue = getFlagValueFromArgs(args, "--poa-instant");
8528
8491
  const poaInstant = poaInstantFlagValue === "true" || poaInstantFlagValue === void 0;
8529
8492
  const graphQLStartSubstring = "Binding GraphQL provider to";
8530
- const binPath = fuelCorePath ?? findBinPath("fuels-core", __dirname);
8493
+ const binPath = findBinPath("fuels-core", __dirname);
8531
8494
  const command = useSystemFuelCore ? "fuel-core" : binPath;
8532
8495
  const ipToUse = ip || "0.0.0.0";
8533
8496
  const portToUse = port || (await getPortPromise({