@fuel-ts/account 0.0.0-rc-2272-20240517113706 → 0.0.0-rc-2143-20240517135655

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.

@@ -248,6 +248,7 @@ var TransactionEstimatePredicatesFragmentDoc = import_graphql_tag.default`
248
248
  ${InputEstimatePredicatesFragmentDoc}`;
249
249
  var DryRunFailureStatusFragmentDoc = import_graphql_tag.default`
250
250
  fragment dryRunFailureStatusFragment on DryRunFailureStatus {
251
+ type: __typename
251
252
  totalGas
252
253
  totalFee
253
254
  reason
@@ -259,6 +260,7 @@ var DryRunFailureStatusFragmentDoc = import_graphql_tag.default`
259
260
  `;
260
261
  var DryRunSuccessStatusFragmentDoc = import_graphql_tag.default`
261
262
  fragment dryRunSuccessStatusFragment on DryRunSuccessStatus {
263
+ type: __typename
262
264
  totalGas
263
265
  totalFee
264
266
  programState {
@@ -1681,17 +1683,16 @@ var import_errors7 = require("@fuel-ts/errors");
1681
1683
  var import_math6 = require("@fuel-ts/math");
1682
1684
  var import_transactions5 = require("@fuel-ts/transactions");
1683
1685
  var import_configs5 = require("@fuel-ts/transactions/configs");
1684
- var assemblePanicError = (status) => {
1685
- let errorMessage = `The transaction reverted with reason: "${status.reason}".`;
1686
- const reason = status.reason;
1687
- if (import_configs5.PANIC_REASONS.includes(status.reason)) {
1686
+ var assemblePanicError = (statusReason) => {
1687
+ let errorMessage = `The transaction reverted with reason: "${statusReason}".`;
1688
+ if (import_configs5.PANIC_REASONS.includes(statusReason)) {
1688
1689
  errorMessage = `${errorMessage}
1689
1690
 
1690
1691
  You can read more about this error at:
1691
1692
 
1692
- ${import_configs5.PANIC_DOC_URL}#variant.${status.reason}`;
1693
+ ${import_configs5.PANIC_DOC_URL}#variant.${statusReason}`;
1693
1694
  }
1694
- return { errorMessage, reason };
1695
+ return { errorMessage, reason: statusReason };
1695
1696
  };
1696
1697
  var stringify = (obj) => JSON.stringify(obj, null, 2);
1697
1698
  var assembleRevertError = (receipts, logs) => {
@@ -1734,10 +1735,10 @@ var assembleRevertError = (receipts, logs) => {
1734
1735
  return { errorMessage, reason };
1735
1736
  };
1736
1737
  var extractTxError = (params) => {
1737
- const { receipts, status, logs } = params;
1738
+ const { receipts, statusReason, logs } = params;
1738
1739
  const isPanic = receipts.some(({ type }) => type === import_transactions5.ReceiptType.Panic);
1739
1740
  const isRevert = receipts.some(({ type }) => type === import_transactions5.ReceiptType.Revert);
1740
- const { errorMessage, reason } = status?.type === "FailureStatus" && isPanic ? assemblePanicError(status) : assembleRevertError(receipts, logs);
1741
+ const { errorMessage, reason } = isPanic ? assemblePanicError(statusReason) : assembleRevertError(receipts, logs);
1741
1742
  const metadata = {
1742
1743
  logs,
1743
1744
  receipts,
@@ -3595,14 +3596,12 @@ var TransactionResponse = class {
3595
3596
  );
3596
3597
  transactionResult.logs = logs;
3597
3598
  }
3598
- if (transactionResult.isStatusFailure) {
3599
- const {
3600
- receipts,
3601
- gqlTransaction: { status }
3602
- } = transactionResult;
3599
+ const { gqlTransaction, receipts } = transactionResult;
3600
+ if (gqlTransaction.status?.type === "FailureStatus") {
3601
+ const { reason } = gqlTransaction.status;
3603
3602
  throw extractTxError({
3604
3603
  receipts,
3605
- status,
3604
+ statusReason: reason,
3606
3605
  logs
3607
3606
  });
3608
3607
  }
@@ -4334,7 +4333,10 @@ Supported fuel-core version: ${supportedVersion}.`
4334
4333
  await signatureCallback(txRequestClone);
4335
4334
  }
4336
4335
  ({ receipts, missingContractIds, outputVariables, dryRunStatus } = await this.estimateTxDependencies(txRequestClone));
4337
- gasUsed = isScriptTransaction ? getGasUsedFromReceipts(receipts) : gasUsed;
4336
+ if (dryRunStatus && "reason" in dryRunStatus) {
4337
+ throw this.extractDryRunError(txRequestClone, receipts, dryRunStatus);
4338
+ }
4339
+ gasUsed = getGasUsedFromReceipts(receipts);
4338
4340
  txRequestClone.gasLimit = gasUsed;
4339
4341
  ({ maxFee, maxGas, minFee, minGas, gasPrice } = await this.estimateTxGasAndFee({
4340
4342
  transactionRequest: txRequestClone,
@@ -4786,6 +4788,22 @@ Supported fuel-core version: ${supportedVersion}.`
4786
4788
  }
4787
4789
  return relayedTransactionStatus;
4788
4790
  }
4791
+ extractDryRunError(transactionRequest, receipts, dryRunStatus) {
4792
+ const status = dryRunStatus;
4793
+ let logs = [];
4794
+ if (transactionRequest.abis) {
4795
+ logs = getDecodedLogs(
4796
+ receipts,
4797
+ transactionRequest.abis.main,
4798
+ transactionRequest.abis.otherContractsAbis
4799
+ );
4800
+ }
4801
+ return extractTxError({
4802
+ logs,
4803
+ receipts,
4804
+ statusReason: status.reason
4805
+ });
4806
+ }
4789
4807
  };
4790
4808
  var Provider = _Provider;
4791
4809
  _cacheInputs = new WeakSet();
@@ -8415,7 +8433,6 @@ var generateTestWallet = async (provider, quantities) => {
8415
8433
  var import_abi_coder7 = require("@fuel-ts/abi-coder");
8416
8434
  var import_crypto7 = require("@fuel-ts/crypto");
8417
8435
  var import_utils36 = require("@fuel-ts/utils");
8418
- var import_cli_utils = require("@fuel-ts/utils/cli-utils");
8419
8436
  var import_child_process = require("child_process");
8420
8437
  var import_crypto8 = require("crypto");
8421
8438
  var import_fs = require("fs");
@@ -8458,7 +8475,7 @@ var launchNode = async ({
8458
8475
  ip,
8459
8476
  port,
8460
8477
  args = [],
8461
- useSystemFuelCore = false,
8478
+ fuelCorePath = process.env.FUEL_CORE_PATH ?? void 0,
8462
8479
  loggingEnabled = true,
8463
8480
  debugEnabled = false,
8464
8481
  basePath
@@ -8478,8 +8495,7 @@ var launchNode = async ({
8478
8495
  const poaInstantFlagValue = getFlagValueFromArgs(args, "--poa-instant");
8479
8496
  const poaInstant = poaInstantFlagValue === "true" || poaInstantFlagValue === void 0;
8480
8497
  const graphQLStartSubstring = "Binding GraphQL provider to";
8481
- const binPath = (0, import_cli_utils.findBinPath)("fuels-core", __dirname);
8482
- const command = useSystemFuelCore ? "fuel-core" : binPath;
8498
+ const command = fuelCorePath ?? "fuel-core";
8483
8499
  const ipToUse = ip || "0.0.0.0";
8484
8500
  const portToUse = port || (await (0, import_portfinder.getPortPromise)({
8485
8501
  port: 4e3,