@fuel-ts/account 0.90.0 → 0.91.0

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

Potentially problematic release.


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

package/dist/index.mjs CHANGED
@@ -515,6 +515,12 @@ var GasCostsFragmentDoc = gql`
515
515
  alocDependentCost {
516
516
  ...DependentCostFragment
517
517
  }
518
+ cfe {
519
+ ...DependentCostFragment
520
+ }
521
+ cfeiDependentCost {
522
+ ...DependentCostFragment
523
+ }
518
524
  call {
519
525
  ...DependentCostFragment
520
526
  }
@@ -1742,7 +1748,7 @@ import {
1742
1748
  PANIC_REASONS,
1743
1749
  PANIC_DOC_URL
1744
1750
  } from "@fuel-ts/transactions/configs";
1745
- var assemblePanicError = (statusReason) => {
1751
+ var assemblePanicError = (statusReason, metadata) => {
1746
1752
  let errorMessage = `The transaction reverted with reason: "${statusReason}".`;
1747
1753
  if (PANIC_REASONS.includes(statusReason)) {
1748
1754
  errorMessage = `${errorMessage}
@@ -1751,10 +1757,13 @@ You can read more about this error at:
1751
1757
 
1752
1758
  ${PANIC_DOC_URL}#variant.${statusReason}`;
1753
1759
  }
1754
- return { errorMessage, reason: statusReason };
1760
+ return new FuelError7(ErrorCode7.SCRIPT_REVERTED, errorMessage, {
1761
+ ...metadata,
1762
+ reason: statusReason
1763
+ });
1755
1764
  };
1756
1765
  var stringify = (obj) => JSON.stringify(obj, null, 2);
1757
- var assembleRevertError = (receipts, logs) => {
1766
+ var assembleRevertError = (receipts, logs, metadata) => {
1758
1767
  let errorMessage = "The transaction reverted with an unknown reason.";
1759
1768
  const revertReceipt = receipts.find(({ type }) => type === ReceiptType3.Revert);
1760
1769
  let reason = "";
@@ -1787,25 +1796,36 @@ var assembleRevertError = (receipts, logs) => {
1787
1796
  errorMessage = `The transaction reverted because it's missing an "OutputChange".`;
1788
1797
  break;
1789
1798
  default:
1790
- reason = "unknown";
1791
- errorMessage = `The transaction reverted with an unknown reason: ${revertReceipt.val}`;
1799
+ throw new FuelError7(
1800
+ ErrorCode7.UNKNOWN,
1801
+ `The transaction reverted with an unknown reason: ${revertReceipt.val}`,
1802
+ {
1803
+ ...metadata,
1804
+ reason: "unknown"
1805
+ }
1806
+ );
1792
1807
  }
1793
1808
  }
1794
- return { errorMessage, reason };
1809
+ return new FuelError7(ErrorCode7.SCRIPT_REVERTED, errorMessage, {
1810
+ ...metadata,
1811
+ reason
1812
+ });
1795
1813
  };
1796
1814
  var extractTxError = (params) => {
1797
1815
  const { receipts, statusReason, logs } = params;
1798
1816
  const isPanic = receipts.some(({ type }) => type === ReceiptType3.Panic);
1799
1817
  const isRevert = receipts.some(({ type }) => type === ReceiptType3.Revert);
1800
- const { errorMessage, reason } = isPanic ? assemblePanicError(statusReason) : assembleRevertError(receipts, logs);
1801
1818
  const metadata = {
1802
1819
  logs,
1803
1820
  receipts,
1804
1821
  panic: isPanic,
1805
1822
  revert: isRevert,
1806
- reason
1823
+ reason: ""
1807
1824
  };
1808
- return new FuelError7(ErrorCode7.SCRIPT_REVERTED, errorMessage, metadata);
1825
+ if (isPanic) {
1826
+ return assemblePanicError(statusReason, metadata);
1827
+ }
1828
+ return assembleRevertError(receipts, logs, metadata);
1809
1829
  };
1810
1830
 
1811
1831
  // src/providers/transaction-request/errors.ts