@fuel-ts/account 0.0.0-rc-1895-20240328113714 → 0.0.0-rc-1964-20240328124253
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.global.js +10 -126
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +468 -541
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +240 -318
- package/dist/index.mjs.map +1 -1
- package/dist/providers/transaction-response/transaction-response.d.ts.map +1 -1
- package/dist/providers/utils/index.d.ts +0 -1
- package/dist/providers/utils/index.d.ts.map +1 -1
- package/dist/test-utils.global.js +10 -126
- package/dist/test-utils.global.js.map +1 -1
- package/dist/test-utils.js +434 -501
- package/dist/test-utils.js.map +1 -1
- package/dist/test-utils.mjs +213 -288
- package/dist/test-utils.mjs.map +1 -1
- package/package.json +16 -16
- package/dist/providers/utils/extract-tx-error.d.ts +0 -14
- package/dist/providers/utils/extract-tx-error.d.ts.map +0 -1
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"transaction-response.d.ts","sourceRoot":"","sources":["../../../src/providers/transaction-response/transaction-response.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,eAAe,CAAC;AAExC,OAAO,KAAK,EACV,WAAW,EACX,UAAU,EACV,cAAc,EACd,YAAY,EACZ,aAAa,EACb,iBAAiB,EACjB,aAAa,EACb,eAAe,EACf,kBAAkB,EAClB,mBAAmB,EACnB,iBAAiB,EACjB,WAAW,EACX,WAAW,EACX,WAAW,EACZ,MAAM,uBAAuB,CAAC;AAI/B,OAAO,KAAK,QAAQ,MAAM,aAAa,CAAC;AACxC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAGnE,OAAO,KAAK,
|
1
|
+
{"version":3,"file":"transaction-response.d.ts","sourceRoot":"","sources":["../../../src/providers/transaction-response/transaction-response.ts"],"names":[],"mapp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AgB,GAAG,IAAI,EACjD,eAAe,CAAC,EAAE,MAAM,GACvB,OAAO,CAAC,kBAAkB,CAAC,gBAAgB,CAAC,CAAC;YAgClC,mBAAmB;IAyBjC;;;;OAIG;IACG,aAAa,CAAC,gBAAgB,GAAG,IAAI,EACzC,eAAe,CAAC,EAAE,MAAM,GACvB,OAAO,CAAC,iBAAiB,CAAC,gBAAgB,CAAC,CAAC;IAuB/C;;;;OAIG;IACG,IAAI,CAAC,gBAAgB,GAAG,IAAI,EAChC,eAAe,CAAC,EAAE,MAAM,GACvB,OAAO,CAAC,iBAAiB,CAAC,gBAAgB,CAAC,CAAC;CAYhD"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/providers/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC;AACjC,cAAc,OAAO,CAAC;AACtB,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/providers/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC;AACjC,cAAc,OAAO,CAAC;AACtB,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC"}
|
@@ -31914,7 +31914,7 @@ spurious results.`);
|
|
31914
31914
|
// ../versions/dist/index.mjs
|
31915
31915
|
function getBuiltinVersions() {
|
31916
31916
|
return {
|
31917
|
-
FORC: "0.
|
31917
|
+
FORC: "0.49.3",
|
31918
31918
|
FUEL_CORE: "0.22.1",
|
31919
31919
|
FUELS: "0.78.0"
|
31920
31920
|
};
|
@@ -42424,60 +42424,7 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
42424
42424
|
var MAX_SCRIPT_DATA_LENGTH = 1024 * 1024 * 1024;
|
42425
42425
|
var MAX_PREDICATE_LENGTH = 1024 * 1024;
|
42426
42426
|
var MAX_PREDICATE_DATA_LENGTH = 1024 * 1024;
|
42427
|
-
var FAILED_REQUIRE_SIGNAL = "0xffffffffffff0000";
|
42428
42427
|
var FAILED_TRANSFER_TO_ADDRESS_SIGNAL = "0xffffffffffff0001";
|
42429
|
-
var FAILED_ASSERT_EQ_SIGNAL = "0xffffffffffff0003";
|
42430
|
-
var FAILED_ASSERT_SIGNAL = "0xffffffffffff0004";
|
42431
|
-
var FAILED_ASSERT_NE_SIGNAL = "0xffffffffffff0005";
|
42432
|
-
var PANIC_REASONS = [
|
42433
|
-
"UnknownPanicReason",
|
42434
|
-
"Revert",
|
42435
|
-
"OutOfGas",
|
42436
|
-
"TransactionValidity",
|
42437
|
-
"MemoryOverflow",
|
42438
|
-
"ArithmeticOverflow",
|
42439
|
-
"ContractNotFound",
|
42440
|
-
"MemoryOwnership",
|
42441
|
-
"NotEnoughBalance",
|
42442
|
-
"ExpectedInternalContext",
|
42443
|
-
"AssetIdNotFound",
|
42444
|
-
"InputNotFound",
|
42445
|
-
"OutputNotFound",
|
42446
|
-
"WitnessNotFound",
|
42447
|
-
"TransactionMaturity",
|
42448
|
-
"InvalidMetadataIdentifier",
|
42449
|
-
"MalformedCallStructure",
|
42450
|
-
"ReservedRegisterNotWritable",
|
42451
|
-
"InvalidFlags",
|
42452
|
-
"InvalidImmediateValue",
|
42453
|
-
"ExpectedCoinInput",
|
42454
|
-
"EcalError",
|
42455
|
-
"MemoryWriteOverlap",
|
42456
|
-
"ContractNotInInputs",
|
42457
|
-
"InternalBalanceOverflow",
|
42458
|
-
"ContractMaxSize",
|
42459
|
-
"ExpectedUnallocatedStack",
|
42460
|
-
"MaxStaticContractsReached",
|
42461
|
-
"TransferAmountCannotBeZero",
|
42462
|
-
"ExpectedOutputVariable",
|
42463
|
-
"ExpectedParentInternalContext",
|
42464
|
-
"PredicateReturnedNonOne",
|
42465
|
-
"ContractIdAlreadyDeployed",
|
42466
|
-
"ContractMismatch",
|
42467
|
-
"MessageDataTooLong",
|
42468
|
-
"ArithmeticError",
|
42469
|
-
"ContractInstructionNotAllowed",
|
42470
|
-
"TransferZeroCoins",
|
42471
|
-
"InvalidInstruction",
|
42472
|
-
"MemoryNotExecutable",
|
42473
|
-
"PolicyIsNotSet",
|
42474
|
-
"PolicyNotFound",
|
42475
|
-
"TooManyReceipts",
|
42476
|
-
"BalanceOverflow",
|
42477
|
-
"InvalidBlockHeight",
|
42478
|
-
"TooManySlots"
|
42479
|
-
];
|
42480
|
-
var PANIC_DOC_URL = "https://docs.rs/fuel-asm/latest/fuel_asm/enum.PanicReason.html";
|
42481
42428
|
|
42482
42429
|
// src/providers/utils/receipts.ts
|
42483
42430
|
var doesReceiptHaveMissingOutputVariables = (receipt) => receipt.type === ReceiptType.Revert && receipt.val.toString("hex") === FAILED_TRANSFER_TO_ADDRESS_SIGNAL;
|
@@ -42790,64 +42737,6 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
42790
42737
|
});
|
42791
42738
|
}
|
42792
42739
|
|
42793
|
-
// src/providers/utils/extract-tx-error.ts
|
42794
|
-
var assemblePanicError = (status) => {
|
42795
|
-
let errorMessage = `The transaction reverted with reason: "${status.reason}".`;
|
42796
|
-
if (PANIC_REASONS.includes(status.reason)) {
|
42797
|
-
errorMessage = `${errorMessage}
|
42798
|
-
|
42799
|
-
You can read more about this error at:
|
42800
|
-
|
42801
|
-
${PANIC_DOC_URL}#variant.${status.reason}`;
|
42802
|
-
}
|
42803
|
-
return errorMessage;
|
42804
|
-
};
|
42805
|
-
var stringify2 = (obj) => JSON.stringify(obj, null, 2);
|
42806
|
-
var assembleRevertError = (receipts, logs) => {
|
42807
|
-
let errorMessage = "The transaction reverted with an unknown reason.";
|
42808
|
-
const revertReceipt = receipts.find(({ type: type3 }) => type3 === ReceiptType.Revert);
|
42809
|
-
if (revertReceipt) {
|
42810
|
-
const reasonHex = bn(revertReceipt.val).toHex();
|
42811
|
-
switch (reasonHex) {
|
42812
|
-
case FAILED_REQUIRE_SIGNAL: {
|
42813
|
-
errorMessage = `The transaction reverted because a "require" statement has thrown ${logs.length ? stringify2(logs[0]) : "an error."}.`;
|
42814
|
-
break;
|
42815
|
-
}
|
42816
|
-
case FAILED_ASSERT_EQ_SIGNAL: {
|
42817
|
-
const sufix = logs.length >= 2 ? ` comparing ${stringify2(logs[1])} and ${stringify2(logs[0])}.` : ".";
|
42818
|
-
errorMessage = `The transaction reverted because of an "assert_eq" statement${sufix}`;
|
42819
|
-
break;
|
42820
|
-
}
|
42821
|
-
case FAILED_ASSERT_NE_SIGNAL: {
|
42822
|
-
const sufix = logs.length >= 2 ? ` comparing ${stringify2(logs[1])} and ${stringify2(logs[0])}.` : ".";
|
42823
|
-
errorMessage = `The transaction reverted because of an "assert_ne" statement${sufix}`;
|
42824
|
-
break;
|
42825
|
-
}
|
42826
|
-
case FAILED_ASSERT_SIGNAL:
|
42827
|
-
errorMessage = `The transaction reverted because an "assert" statement failed to evaluate to true.`;
|
42828
|
-
break;
|
42829
|
-
case FAILED_TRANSFER_TO_ADDRESS_SIGNAL:
|
42830
|
-
errorMessage = `The transaction reverted because it's missing an "OutputChange".`;
|
42831
|
-
break;
|
42832
|
-
default:
|
42833
|
-
errorMessage = `The transaction reverted with an unknown reason: ${revertReceipt.val}`;
|
42834
|
-
}
|
42835
|
-
}
|
42836
|
-
return errorMessage;
|
42837
|
-
};
|
42838
|
-
var extractTxError = (params) => {
|
42839
|
-
const { receipts, status, logs } = params;
|
42840
|
-
const isPanic = receipts.some(({ type: type3 }) => type3 === ReceiptType.Panic);
|
42841
|
-
let err = status?.type === "FailureStatus" && isPanic ? assemblePanicError(status) : assembleRevertError(receipts, logs);
|
42842
|
-
err += `
|
42843
|
-
|
42844
|
-
logs: ${JSON.stringify(logs, null, 2)}`;
|
42845
|
-
err += `
|
42846
|
-
|
42847
|
-
receipts: ${JSON.stringify(receipts, null, 2)}`;
|
42848
|
-
return new FuelError(ErrorCode.SCRIPT_REVERTED, err);
|
42849
|
-
};
|
42850
|
-
|
42851
42740
|
// src/providers/transaction-request/errors.ts
|
42852
42741
|
var NoWitnessAtIndexError = class extends Error {
|
42853
42742
|
constructor(index) {
|
@@ -44605,26 +44494,14 @@ receipts: ${JSON.stringify(receipts, null, 2)}`;
|
|
44605
44494
|
gqlTransaction: this.gqlTransaction,
|
44606
44495
|
...transactionSummary
|
44607
44496
|
};
|
44608
|
-
let logs = [];
|
44609
44497
|
if (this.abis) {
|
44610
|
-
logs = getDecodedLogs(
|
44498
|
+
const logs = getDecodedLogs(
|
44611
44499
|
transactionSummary.receipts,
|
44612
44500
|
this.abis.main,
|
44613
44501
|
this.abis.otherContractsAbis
|
44614
44502
|
);
|
44615
44503
|
transactionResult.logs = logs;
|
44616
44504
|
}
|
44617
|
-
if (transactionResult.isStatusFailure) {
|
44618
|
-
const {
|
44619
|
-
receipts,
|
44620
|
-
gqlTransaction: { status }
|
44621
|
-
} = transactionResult;
|
44622
|
-
throw extractTxError({
|
44623
|
-
receipts,
|
44624
|
-
status,
|
44625
|
-
logs
|
44626
|
-
});
|
44627
|
-
}
|
44628
44505
|
return transactionResult;
|
44629
44506
|
}
|
44630
44507
|
/**
|
@@ -44633,7 +44510,14 @@ receipts: ${JSON.stringify(receipts, null, 2)}`;
|
|
44633
44510
|
* @param contractsAbiMap - The contracts ABI map.
|
44634
44511
|
*/
|
44635
44512
|
async wait(contractsAbiMap) {
|
44636
|
-
|
44513
|
+
const result = await this.waitForResult(contractsAbiMap);
|
44514
|
+
if (result.isStatusFailure) {
|
44515
|
+
throw new FuelError(
|
44516
|
+
ErrorCode.TRANSACTION_FAILED,
|
44517
|
+
`Transaction failed: ${result.gqlTransaction.status.reason}`
|
44518
|
+
);
|
44519
|
+
}
|
44520
|
+
return result;
|
44637
44521
|
}
|
44638
44522
|
};
|
44639
44523
|
|