@fuel-ts/account 0.0.0-rc-2272-20240517113706 → 0.0.0-rc-2143-20240517135655
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 +33 -15
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +33 -15
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +33 -15
- 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/launchNode.d.ts +3 -3
- package/dist/test-utils/launchNode.d.ts.map +1 -1
- package/dist/test-utils.global.js +99 -97
- package/dist/test-utils.global.js.map +1 -1
- package/dist/test-utils.js +35 -19
- package/dist/test-utils.js.map +1 -1
- package/dist/test-utils.mjs +35 -19
- 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,
|
@@ -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();
|
@@ -8409,7 +8427,6 @@ var generateTestWallet = async (provider, quantities) => {
|
|
8409
8427
|
import { UTXO_ID_LEN as UTXO_ID_LEN3 } from "@fuel-ts/abi-coder";
|
8410
8428
|
import { randomBytes as randomBytes6 } from "@fuel-ts/crypto";
|
8411
8429
|
import { defaultSnapshotConfigs, defaultConsensusKey, hexlify as hexlify18 } from "@fuel-ts/utils";
|
8412
|
-
import { findBinPath } from "@fuel-ts/utils/cli-utils";
|
8413
8430
|
import { spawn } from "child_process";
|
8414
8431
|
import { randomUUID } from "crypto";
|
8415
8432
|
import { existsSync, mkdirSync, rmSync, writeFileSync } from "fs";
|
@@ -8452,7 +8469,7 @@ var launchNode = async ({
|
|
8452
8469
|
ip,
|
8453
8470
|
port,
|
8454
8471
|
args = [],
|
8455
|
-
|
8472
|
+
fuelCorePath = process.env.FUEL_CORE_PATH ?? void 0,
|
8456
8473
|
loggingEnabled = true,
|
8457
8474
|
debugEnabled = false,
|
8458
8475
|
basePath
|
@@ -8472,8 +8489,7 @@ var launchNode = async ({
|
|
8472
8489
|
const poaInstantFlagValue = getFlagValueFromArgs(args, "--poa-instant");
|
8473
8490
|
const poaInstant = poaInstantFlagValue === "true" || poaInstantFlagValue === void 0;
|
8474
8491
|
const graphQLStartSubstring = "Binding GraphQL provider to";
|
8475
|
-
const
|
8476
|
-
const command = useSystemFuelCore ? "fuel-core" : binPath;
|
8492
|
+
const command = fuelCorePath ?? "fuel-core";
|
8477
8493
|
const ipToUse = ip || "0.0.0.0";
|
8478
8494
|
const portToUse = port || (await getPortPromise({
|
8479
8495
|
port: 4e3,
|