@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.js CHANGED
@@ -676,6 +676,12 @@ var GasCostsFragmentDoc = import_graphql_tag.default`
676
676
  alocDependentCost {
677
677
  ...DependentCostFragment
678
678
  }
679
+ cfe {
680
+ ...DependentCostFragment
681
+ }
682
+ cfeiDependentCost {
683
+ ...DependentCostFragment
684
+ }
679
685
  call {
680
686
  ...DependentCostFragment
681
687
  }
@@ -1884,7 +1890,7 @@ var import_errors7 = require("@fuel-ts/errors");
1884
1890
  var import_math6 = require("@fuel-ts/math");
1885
1891
  var import_transactions5 = require("@fuel-ts/transactions");
1886
1892
  var import_configs5 = require("@fuel-ts/transactions/configs");
1887
- var assemblePanicError = (statusReason) => {
1893
+ var assemblePanicError = (statusReason, metadata) => {
1888
1894
  let errorMessage = `The transaction reverted with reason: "${statusReason}".`;
1889
1895
  if (import_configs5.PANIC_REASONS.includes(statusReason)) {
1890
1896
  errorMessage = `${errorMessage}
@@ -1893,10 +1899,13 @@ You can read more about this error at:
1893
1899
 
1894
1900
  ${import_configs5.PANIC_DOC_URL}#variant.${statusReason}`;
1895
1901
  }
1896
- return { errorMessage, reason: statusReason };
1902
+ return new import_errors7.FuelError(import_errors7.ErrorCode.SCRIPT_REVERTED, errorMessage, {
1903
+ ...metadata,
1904
+ reason: statusReason
1905
+ });
1897
1906
  };
1898
1907
  var stringify = (obj) => JSON.stringify(obj, null, 2);
1899
- var assembleRevertError = (receipts, logs) => {
1908
+ var assembleRevertError = (receipts, logs, metadata) => {
1900
1909
  let errorMessage = "The transaction reverted with an unknown reason.";
1901
1910
  const revertReceipt = receipts.find(({ type }) => type === import_transactions5.ReceiptType.Revert);
1902
1911
  let reason = "";
@@ -1929,25 +1938,36 @@ var assembleRevertError = (receipts, logs) => {
1929
1938
  errorMessage = `The transaction reverted because it's missing an "OutputChange".`;
1930
1939
  break;
1931
1940
  default:
1932
- reason = "unknown";
1933
- errorMessage = `The transaction reverted with an unknown reason: ${revertReceipt.val}`;
1941
+ throw new import_errors7.FuelError(
1942
+ import_errors7.ErrorCode.UNKNOWN,
1943
+ `The transaction reverted with an unknown reason: ${revertReceipt.val}`,
1944
+ {
1945
+ ...metadata,
1946
+ reason: "unknown"
1947
+ }
1948
+ );
1934
1949
  }
1935
1950
  }
1936
- return { errorMessage, reason };
1951
+ return new import_errors7.FuelError(import_errors7.ErrorCode.SCRIPT_REVERTED, errorMessage, {
1952
+ ...metadata,
1953
+ reason
1954
+ });
1937
1955
  };
1938
1956
  var extractTxError = (params) => {
1939
1957
  const { receipts, statusReason, logs } = params;
1940
1958
  const isPanic = receipts.some(({ type }) => type === import_transactions5.ReceiptType.Panic);
1941
1959
  const isRevert = receipts.some(({ type }) => type === import_transactions5.ReceiptType.Revert);
1942
- const { errorMessage, reason } = isPanic ? assemblePanicError(statusReason) : assembleRevertError(receipts, logs);
1943
1960
  const metadata = {
1944
1961
  logs,
1945
1962
  receipts,
1946
1963
  panic: isPanic,
1947
1964
  revert: isRevert,
1948
- reason
1965
+ reason: ""
1949
1966
  };
1950
- return new import_errors7.FuelError(import_errors7.ErrorCode.SCRIPT_REVERTED, errorMessage, metadata);
1967
+ if (isPanic) {
1968
+ return assemblePanicError(statusReason, metadata);
1969
+ }
1970
+ return assembleRevertError(receipts, logs, metadata);
1951
1971
  };
1952
1972
 
1953
1973
  // src/providers/transaction-request/errors.ts