@fuel-ts/account 0.0.0-rc-1895-20240328115555 → 0.0.0-rc-1964-20240328130004

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.

@@ -28952,7 +28952,7 @@ spurious results.`);
28952
28952
  // ../versions/dist/index.mjs
28953
28953
  function getBuiltinVersions() {
28954
28954
  return {
28955
- FORC: "0.51.1",
28955
+ FORC: "0.49.3",
28956
28956
  FUEL_CORE: "0.22.1",
28957
28957
  FUELS: "0.78.0"
28958
28958
  };
@@ -38962,60 +38962,7 @@ ${MessageCoinFragmentFragmentDoc}`;
38962
38962
  var MAX_SCRIPT_DATA_LENGTH = 1024 * 1024 * 1024;
38963
38963
  var MAX_PREDICATE_LENGTH = 1024 * 1024;
38964
38964
  var MAX_PREDICATE_DATA_LENGTH = 1024 * 1024;
38965
- var FAILED_REQUIRE_SIGNAL = "0xffffffffffff0000";
38966
38965
  var FAILED_TRANSFER_TO_ADDRESS_SIGNAL = "0xffffffffffff0001";
38967
- var FAILED_ASSERT_EQ_SIGNAL = "0xffffffffffff0003";
38968
- var FAILED_ASSERT_SIGNAL = "0xffffffffffff0004";
38969
- var FAILED_ASSERT_NE_SIGNAL = "0xffffffffffff0005";
38970
- var PANIC_REASONS = [
38971
- "UnknownPanicReason",
38972
- "Revert",
38973
- "OutOfGas",
38974
- "TransactionValidity",
38975
- "MemoryOverflow",
38976
- "ArithmeticOverflow",
38977
- "ContractNotFound",
38978
- "MemoryOwnership",
38979
- "NotEnoughBalance",
38980
- "ExpectedInternalContext",
38981
- "AssetIdNotFound",
38982
- "InputNotFound",
38983
- "OutputNotFound",
38984
- "WitnessNotFound",
38985
- "TransactionMaturity",
38986
- "InvalidMetadataIdentifier",
38987
- "MalformedCallStructure",
38988
- "ReservedRegisterNotWritable",
38989
- "InvalidFlags",
38990
- "InvalidImmediateValue",
38991
- "ExpectedCoinInput",
38992
- "EcalError",
38993
- "MemoryWriteOverlap",
38994
- "ContractNotInInputs",
38995
- "InternalBalanceOverflow",
38996
- "ContractMaxSize",
38997
- "ExpectedUnallocatedStack",
38998
- "MaxStaticContractsReached",
38999
- "TransferAmountCannotBeZero",
39000
- "ExpectedOutputVariable",
39001
- "ExpectedParentInternalContext",
39002
- "PredicateReturnedNonOne",
39003
- "ContractIdAlreadyDeployed",
39004
- "ContractMismatch",
39005
- "MessageDataTooLong",
39006
- "ArithmeticError",
39007
- "ContractInstructionNotAllowed",
39008
- "TransferZeroCoins",
39009
- "InvalidInstruction",
39010
- "MemoryNotExecutable",
39011
- "PolicyIsNotSet",
39012
- "PolicyNotFound",
39013
- "TooManyReceipts",
39014
- "BalanceOverflow",
39015
- "InvalidBlockHeight",
39016
- "TooManySlots"
39017
- ];
39018
- var PANIC_DOC_URL = "https://docs.rs/fuel-asm/latest/fuel_asm/enum.PanicReason.html";
39019
38966
 
39020
38967
  // src/providers/utils/receipts.ts
39021
38968
  var doesReceiptHaveMissingOutputVariables = (receipt) => receipt.type === ReceiptType.Revert && receipt.val.toString("hex") === FAILED_TRANSFER_TO_ADDRESS_SIGNAL;
@@ -39389,64 +39336,6 @@ ${MessageCoinFragmentFragmentDoc}`;
39389
39336
  });
39390
39337
  }
39391
39338
 
39392
- // src/providers/utils/extract-tx-error.ts
39393
- var assemblePanicError = (status) => {
39394
- let errorMessage = `The transaction reverted with reason: "${status.reason}".`;
39395
- if (PANIC_REASONS.includes(status.reason)) {
39396
- errorMessage = `${errorMessage}
39397
-
39398
- You can read more about this error at:
39399
-
39400
- ${PANIC_DOC_URL}#variant.${status.reason}`;
39401
- }
39402
- return errorMessage;
39403
- };
39404
- var stringify2 = (obj) => JSON.stringify(obj, null, 2);
39405
- var assembleRevertError = (receipts, logs) => {
39406
- let errorMessage = "The transaction reverted with an unknown reason.";
39407
- const revertReceipt = receipts.find(({ type: type3 }) => type3 === ReceiptType.Revert);
39408
- if (revertReceipt) {
39409
- const reasonHex = bn(revertReceipt.val).toHex();
39410
- switch (reasonHex) {
39411
- case FAILED_REQUIRE_SIGNAL: {
39412
- errorMessage = `The transaction reverted because a "require" statement has thrown ${logs.length ? stringify2(logs[0]) : "an error."}.`;
39413
- break;
39414
- }
39415
- case FAILED_ASSERT_EQ_SIGNAL: {
39416
- const sufix = logs.length >= 2 ? ` comparing ${stringify2(logs[1])} and ${stringify2(logs[0])}.` : ".";
39417
- errorMessage = `The transaction reverted because of an "assert_eq" statement${sufix}`;
39418
- break;
39419
- }
39420
- case FAILED_ASSERT_NE_SIGNAL: {
39421
- const sufix = logs.length >= 2 ? ` comparing ${stringify2(logs[1])} and ${stringify2(logs[0])}.` : ".";
39422
- errorMessage = `The transaction reverted because of an "assert_ne" statement${sufix}`;
39423
- break;
39424
- }
39425
- case FAILED_ASSERT_SIGNAL:
39426
- errorMessage = `The transaction reverted because an "assert" statement failed to evaluate to true.`;
39427
- break;
39428
- case FAILED_TRANSFER_TO_ADDRESS_SIGNAL:
39429
- errorMessage = `The transaction reverted because it's missing an "OutputChange".`;
39430
- break;
39431
- default:
39432
- errorMessage = `The transaction reverted with an unknown reason: ${revertReceipt.val}`;
39433
- }
39434
- }
39435
- return errorMessage;
39436
- };
39437
- var extractTxError = (params) => {
39438
- const { receipts, status, logs } = params;
39439
- const isPanic = receipts.some(({ type: type3 }) => type3 === ReceiptType.Panic);
39440
- let err = status?.type === "FailureStatus" && isPanic ? assemblePanicError(status) : assembleRevertError(receipts, logs);
39441
- err += `
39442
-
39443
- logs: ${JSON.stringify(logs, null, 2)}`;
39444
- err += `
39445
-
39446
- receipts: ${JSON.stringify(receipts, null, 2)}`;
39447
- return new FuelError(ErrorCode.SCRIPT_REVERTED, err);
39448
- };
39449
-
39450
39339
  // src/providers/transaction-request/errors.ts
39451
39340
  var ChangeOutputCollisionError = class extends Error {
39452
39341
  name = "ChangeOutputCollisionError";
@@ -41263,26 +41152,14 @@ receipts: ${JSON.stringify(receipts, null, 2)}`;
41263
41152
  gqlTransaction: this.gqlTransaction,
41264
41153
  ...transactionSummary
41265
41154
  };
41266
- let logs = [];
41267
41155
  if (this.abis) {
41268
- logs = getDecodedLogs(
41156
+ const logs = getDecodedLogs(
41269
41157
  transactionSummary.receipts,
41270
41158
  this.abis.main,
41271
41159
  this.abis.otherContractsAbis
41272
41160
  );
41273
41161
  transactionResult.logs = logs;
41274
41162
  }
41275
- if (transactionResult.isStatusFailure) {
41276
- const {
41277
- receipts,
41278
- gqlTransaction: { status }
41279
- } = transactionResult;
41280
- throw extractTxError({
41281
- receipts,
41282
- status,
41283
- logs
41284
- });
41285
- }
41286
41163
  return transactionResult;
41287
41164
  }
41288
41165
  /**
@@ -41291,7 +41168,14 @@ receipts: ${JSON.stringify(receipts, null, 2)}`;
41291
41168
  * @param contractsAbiMap - The contracts ABI map.
41292
41169
  */
41293
41170
  async wait(contractsAbiMap) {
41294
- return this.waitForResult(contractsAbiMap);
41171
+ const result = await this.waitForResult(contractsAbiMap);
41172
+ if (result.isStatusFailure) {
41173
+ throw new FuelError(
41174
+ ErrorCode.TRANSACTION_FAILED,
41175
+ `Transaction failed: ${result.gqlTransaction.status.reason}`
41176
+ );
41177
+ }
41178
+ return result;
41295
41179
  }
41296
41180
  };
41297
41181