@fuel-ts/account 0.87.0 → 0.88.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/configs.d.ts +1 -1
- package/dist/configs.d.ts.map +1 -1
- package/dist/configs.global.js +1 -1
- package/dist/configs.global.js.map +1 -1
- package/dist/configs.js +5 -5
- package/dist/configs.js.map +1 -1
- package/dist/configs.mjs +3 -3
- package/dist/configs.mjs.map +1 -1
- package/dist/index.global.js +61 -29
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +35 -17
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +35 -17
- package/dist/index.mjs.map +1 -1
- package/dist/providers/__generated__/operations.d.ts +8 -0
- package/dist/providers/__generated__/operations.d.ts.map +1 -1
- package/dist/providers/provider.d.ts +4 -1
- package/dist/providers/provider.d.ts.map +1 -1
- package/dist/providers/transaction-response/transaction-response.d.ts.map +1 -1
- package/dist/providers/utils/extract-tx-error.d.ts +2 -4
- package/dist/providers/utils/extract-tx-error.d.ts.map +1 -1
- package/dist/test-utils.global.js +60 -28
- package/dist/test-utils.global.js.map +1 -1
- package/dist/test-utils.js +34 -16
- package/dist/test-utils.js.map +1 -1
- package/dist/test-utils.mjs +34 -16
- package/dist/test-utils.mjs.map +1 -1
- package/package.json +15 -15
package/dist/test-utils.mjs
CHANGED
@@ -215,6 +215,7 @@ var TransactionEstimatePredicatesFragmentDoc = gql`
|
|
215
215
|
${InputEstimatePredicatesFragmentDoc}`;
|
216
216
|
var DryRunFailureStatusFragmentDoc = gql`
|
217
217
|
fragment dryRunFailureStatusFragment on DryRunFailureStatus {
|
218
|
+
type: __typename
|
218
219
|
totalGas
|
219
220
|
totalFee
|
220
221
|
reason
|
@@ -226,6 +227,7 @@ var DryRunFailureStatusFragmentDoc = gql`
|
|
226
227
|
`;
|
227
228
|
var DryRunSuccessStatusFragmentDoc = gql`
|
228
229
|
fragment dryRunSuccessStatusFragment on DryRunSuccessStatus {
|
230
|
+
type: __typename
|
229
231
|
totalGas
|
230
232
|
totalFee
|
231
233
|
programState {
|
@@ -1667,17 +1669,16 @@ import {
|
|
1667
1669
|
PANIC_REASONS,
|
1668
1670
|
PANIC_DOC_URL
|
1669
1671
|
} from "@fuel-ts/transactions/configs";
|
1670
|
-
var assemblePanicError = (
|
1671
|
-
let errorMessage = `The transaction reverted with reason: "${
|
1672
|
-
|
1673
|
-
if (PANIC_REASONS.includes(status.reason)) {
|
1672
|
+
var assemblePanicError = (statusReason) => {
|
1673
|
+
let errorMessage = `The transaction reverted with reason: "${statusReason}".`;
|
1674
|
+
if (PANIC_REASONS.includes(statusReason)) {
|
1674
1675
|
errorMessage = `${errorMessage}
|
1675
1676
|
|
1676
1677
|
You can read more about this error at:
|
1677
1678
|
|
1678
|
-
${PANIC_DOC_URL}#variant.${
|
1679
|
+
${PANIC_DOC_URL}#variant.${statusReason}`;
|
1679
1680
|
}
|
1680
|
-
return { errorMessage, reason };
|
1681
|
+
return { errorMessage, reason: statusReason };
|
1681
1682
|
};
|
1682
1683
|
var stringify = (obj) => JSON.stringify(obj, null, 2);
|
1683
1684
|
var assembleRevertError = (receipts, logs) => {
|
@@ -1720,10 +1721,10 @@ var assembleRevertError = (receipts, logs) => {
|
|
1720
1721
|
return { errorMessage, reason };
|
1721
1722
|
};
|
1722
1723
|
var extractTxError = (params) => {
|
1723
|
-
const { receipts,
|
1724
|
+
const { receipts, statusReason, logs } = params;
|
1724
1725
|
const isPanic = receipts.some(({ type }) => type === ReceiptType3.Panic);
|
1725
1726
|
const isRevert = receipts.some(({ type }) => type === ReceiptType3.Revert);
|
1726
|
-
const { errorMessage, reason } =
|
1727
|
+
const { errorMessage, reason } = isPanic ? assemblePanicError(statusReason) : assembleRevertError(receipts, logs);
|
1727
1728
|
const metadata = {
|
1728
1729
|
logs,
|
1729
1730
|
receipts,
|
@@ -3423,7 +3424,7 @@ function getDecodedLogs(receipts, mainAbi, externalAbis = {}) {
|
|
3423
3424
|
if (receipt.type === ReceiptType6.LogData || receipt.type === ReceiptType6.Log) {
|
3424
3425
|
const interfaceToUse = new Interface3(externalAbis[receipt.id] || mainAbi);
|
3425
3426
|
const data = receipt.type === ReceiptType6.Log ? new BigNumberCoder("u64").encode(receipt.val0) : receipt.data;
|
3426
|
-
const [decodedLog] = interfaceToUse.decodeLog(data, receipt.val1.
|
3427
|
+
const [decodedLog] = interfaceToUse.decodeLog(data, receipt.val1.toString());
|
3427
3428
|
logs.push(decodedLog);
|
3428
3429
|
}
|
3429
3430
|
return logs;
|
@@ -3581,14 +3582,12 @@ var TransactionResponse = class {
|
|
3581
3582
|
);
|
3582
3583
|
transactionResult.logs = logs;
|
3583
3584
|
}
|
3584
|
-
|
3585
|
-
|
3586
|
-
|
3587
|
-
gqlTransaction: { status }
|
3588
|
-
} = transactionResult;
|
3585
|
+
const { gqlTransaction, receipts } = transactionResult;
|
3586
|
+
if (gqlTransaction.status?.type === "FailureStatus") {
|
3587
|
+
const { reason } = gqlTransaction.status;
|
3589
3588
|
throw extractTxError({
|
3590
3589
|
receipts,
|
3591
|
-
|
3590
|
+
statusReason: reason,
|
3592
3591
|
logs
|
3593
3592
|
});
|
3594
3593
|
}
|
@@ -4320,7 +4319,10 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4320
4319
|
await signatureCallback(txRequestClone);
|
4321
4320
|
}
|
4322
4321
|
({ receipts, missingContractIds, outputVariables, dryRunStatus } = await this.estimateTxDependencies(txRequestClone));
|
4323
|
-
|
4322
|
+
if (dryRunStatus && "reason" in dryRunStatus) {
|
4323
|
+
throw this.extractDryRunError(txRequestClone, receipts, dryRunStatus);
|
4324
|
+
}
|
4325
|
+
gasUsed = getGasUsedFromReceipts(receipts);
|
4324
4326
|
txRequestClone.gasLimit = gasUsed;
|
4325
4327
|
({ maxFee, maxGas, minFee, minGas, gasPrice } = await this.estimateTxGasAndFee({
|
4326
4328
|
transactionRequest: txRequestClone,
|
@@ -4772,6 +4774,22 @@ Supported fuel-core version: ${supportedVersion}.`
|
|
4772
4774
|
}
|
4773
4775
|
return relayedTransactionStatus;
|
4774
4776
|
}
|
4777
|
+
extractDryRunError(transactionRequest, receipts, dryRunStatus) {
|
4778
|
+
const status = dryRunStatus;
|
4779
|
+
let logs = [];
|
4780
|
+
if (transactionRequest.abis) {
|
4781
|
+
logs = getDecodedLogs(
|
4782
|
+
receipts,
|
4783
|
+
transactionRequest.abis.main,
|
4784
|
+
transactionRequest.abis.otherContractsAbis
|
4785
|
+
);
|
4786
|
+
}
|
4787
|
+
return extractTxError({
|
4788
|
+
logs,
|
4789
|
+
receipts,
|
4790
|
+
statusReason: status.reason
|
4791
|
+
});
|
4792
|
+
}
|
4775
4793
|
};
|
4776
4794
|
var Provider = _Provider;
|
4777
4795
|
_cacheInputs = new WeakSet();
|