@fuel-ts/account 0.78.0 → 0.79.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.global.js +37 -40
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +38 -24
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +38 -24
- package/dist/index.mjs.map +1 -1
- package/dist/providers/provider.d.ts.map +1 -1
- package/dist/providers/transaction-request/script-transaction-request.d.ts +3 -0
- package/dist/providers/transaction-request/script-transaction-request.d.ts.map +1 -1
- package/dist/providers/transaction-request/types.d.ts +5 -0
- package/dist/providers/transaction-request/types.d.ts.map +1 -1
- package/dist/providers/transaction-response/getDecodedLogs.d.ts +2 -2
- package/dist/providers/transaction-response/getDecodedLogs.d.ts.map +1 -1
- package/dist/providers/transaction-response/transaction-response.d.ts +5 -2
- package/dist/providers/transaction-response/transaction-response.d.ts.map +1 -1
- package/dist/test-utils.global.js +37 -25
- package/dist/test-utils.global.js.map +1 -1
- package/dist/test-utils.js +38 -11
- package/dist/test-utils.js.map +1 -1
- package/dist/test-utils.mjs +36 -9
- package/dist/test-utils.mjs.map +1 -1
- package/package.json +16 -16
package/dist/index.js
CHANGED
@@ -2492,6 +2492,7 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
|
|
2492
2492
|
script;
|
2493
2493
|
/** Script input data (parameters) */
|
2494
2494
|
scriptData;
|
2495
|
+
abis;
|
2495
2496
|
/**
|
2496
2497
|
* Constructor for `ScriptTransactionRequest`.
|
2497
2498
|
*
|
@@ -2502,6 +2503,7 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
|
|
2502
2503
|
this.gasLimit = (0, import_math9.bn)(gasLimit);
|
2503
2504
|
this.script = (0, import_utils15.arrayify)(script ?? returnZeroScript.bytes);
|
2504
2505
|
this.scriptData = (0, import_utils15.arrayify)(scriptData ?? returnZeroScript.encodeScriptData());
|
2506
|
+
this.abis = rest.abis;
|
2505
2507
|
}
|
2506
2508
|
/**
|
2507
2509
|
* Converts the transaction request to a `TransactionScript`.
|
@@ -2669,7 +2671,7 @@ var transactionRequestify = (obj) => {
|
|
2669
2671
|
// src/providers/transaction-response/transaction-response.ts
|
2670
2672
|
var import_errors12 = require("@fuel-ts/errors");
|
2671
2673
|
var import_math13 = require("@fuel-ts/math");
|
2672
|
-
var
|
2674
|
+
var import_transactions16 = require("@fuel-ts/transactions");
|
2673
2675
|
var import_utils21 = require("@fuel-ts/utils");
|
2674
2676
|
|
2675
2677
|
// src/providers/transaction-summary/assemble-transaction-summary.ts
|
@@ -3414,6 +3416,21 @@ function assembleTransactionSummary(params) {
|
|
3414
3416
|
return transactionSummary;
|
3415
3417
|
}
|
3416
3418
|
|
3419
|
+
// src/providers/transaction-response/getDecodedLogs.ts
|
3420
|
+
var import_abi_coder3 = require("@fuel-ts/abi-coder");
|
3421
|
+
var import_transactions15 = require("@fuel-ts/transactions");
|
3422
|
+
function getDecodedLogs(receipts, mainAbi, externalAbis = {}) {
|
3423
|
+
return receipts.reduce((logs, receipt) => {
|
3424
|
+
if (receipt.type === import_transactions15.ReceiptType.LogData || receipt.type === import_transactions15.ReceiptType.Log) {
|
3425
|
+
const interfaceToUse = new import_abi_coder3.Interface(externalAbis[receipt.id] || mainAbi);
|
3426
|
+
const data = receipt.type === import_transactions15.ReceiptType.Log ? new import_abi_coder3.BigNumberCoder("u64").encode(receipt.val0) : receipt.data;
|
3427
|
+
const [decodedLog] = interfaceToUse.decodeLog(data, receipt.val1.toNumber());
|
3428
|
+
logs.push(decodedLog);
|
3429
|
+
}
|
3430
|
+
return logs;
|
3431
|
+
}, []);
|
3432
|
+
}
|
3433
|
+
|
3417
3434
|
// src/providers/transaction-response/transaction-response.ts
|
3418
3435
|
var TransactionResponse = class {
|
3419
3436
|
/** Transaction ID */
|
@@ -3424,15 +3441,17 @@ var TransactionResponse = class {
|
|
3424
3441
|
gasUsed = (0, import_math13.bn)(0);
|
3425
3442
|
/** The graphql Transaction with receipts object. */
|
3426
3443
|
gqlTransaction;
|
3444
|
+
abis;
|
3427
3445
|
/**
|
3428
3446
|
* Constructor for `TransactionResponse`.
|
3429
3447
|
*
|
3430
3448
|
* @param id - The transaction ID.
|
3431
3449
|
* @param provider - The provider.
|
3432
3450
|
*/
|
3433
|
-
constructor(id, provider) {
|
3451
|
+
constructor(id, provider, abis) {
|
3434
3452
|
this.id = id;
|
3435
3453
|
this.provider = provider;
|
3454
|
+
this.abis = abis;
|
3436
3455
|
}
|
3437
3456
|
/**
|
3438
3457
|
* Async constructor for `TransactionResponse`. This method can be used to create
|
@@ -3442,8 +3461,8 @@ var TransactionResponse = class {
|
|
3442
3461
|
* @param id - The transaction ID.
|
3443
3462
|
* @param provider - The provider.
|
3444
3463
|
*/
|
3445
|
-
static async create(id, provider) {
|
3446
|
-
const response = new TransactionResponse(id, provider);
|
3464
|
+
static async create(id, provider, abis) {
|
3465
|
+
const response = new TransactionResponse(id, provider, abis);
|
3447
3466
|
await response.fetch();
|
3448
3467
|
return response;
|
3449
3468
|
}
|
@@ -3477,7 +3496,7 @@ var TransactionResponse = class {
|
|
3477
3496
|
* @returns The decoded transaction.
|
3478
3497
|
*/
|
3479
3498
|
decodeTransaction(transactionWithReceipts) {
|
3480
|
-
return new
|
3499
|
+
return new import_transactions16.TransactionCoder().decode(
|
3481
3500
|
(0, import_utils21.arrayify)(transactionWithReceipts.rawPayload),
|
3482
3501
|
0
|
3483
3502
|
)?.[0];
|
@@ -3547,6 +3566,14 @@ var TransactionResponse = class {
|
|
3547
3566
|
gqlTransaction: this.gqlTransaction,
|
3548
3567
|
...transactionSummary
|
3549
3568
|
};
|
3569
|
+
if (this.abis) {
|
3570
|
+
const logs = getDecodedLogs(
|
3571
|
+
transactionSummary.receipts,
|
3572
|
+
this.abis.main,
|
3573
|
+
this.abis.otherContractsAbis
|
3574
|
+
);
|
3575
|
+
transactionResult.logs = logs;
|
3576
|
+
}
|
3550
3577
|
return transactionResult;
|
3551
3578
|
}
|
3552
3579
|
/**
|
@@ -3566,23 +3593,6 @@ var TransactionResponse = class {
|
|
3566
3593
|
}
|
3567
3594
|
};
|
3568
3595
|
|
3569
|
-
// src/providers/transaction-response/getDecodedLogs.ts
|
3570
|
-
var import_abi_coder3 = require("@fuel-ts/abi-coder");
|
3571
|
-
var import_transactions16 = require("@fuel-ts/transactions");
|
3572
|
-
function getDecodedLogs(receipts, abiInterface) {
|
3573
|
-
return receipts.reduce((logs, r) => {
|
3574
|
-
if (r.type === import_transactions16.ReceiptType.LogData) {
|
3575
|
-
logs.push(abiInterface.decodeLog(r.data, r.val1.toNumber(), r.id)[0]);
|
3576
|
-
}
|
3577
|
-
if (r.type === import_transactions16.ReceiptType.Log) {
|
3578
|
-
logs.push(
|
3579
|
-
abiInterface.decodeLog(new import_abi_coder3.BigNumberCoder("u64").encode(r.val0), r.val1.toNumber(), r.id)[0]
|
3580
|
-
);
|
3581
|
-
}
|
3582
|
-
return logs;
|
3583
|
-
}, []);
|
3584
|
-
}
|
3585
|
-
|
3586
3596
|
// src/providers/utils/auto-retry-fetch.ts
|
3587
3597
|
function getWaitDelay(options, retryAttemptNum) {
|
3588
3598
|
const duration = options.baseDelay ?? 150;
|
@@ -3917,6 +3927,10 @@ var _Provider = class {
|
|
3917
3927
|
await this.estimateTxDependencies(transactionRequest);
|
3918
3928
|
}
|
3919
3929
|
const encodedTransaction = (0, import_utils22.hexlify)(transactionRequest.toTransactionBytes());
|
3930
|
+
let abis;
|
3931
|
+
if (transactionRequest.type === import_transactions17.TransactionType.Script) {
|
3932
|
+
abis = transactionRequest.abis;
|
3933
|
+
}
|
3920
3934
|
if (awaitExecution) {
|
3921
3935
|
const subscription = this.operations.submitAndAwait({ encodedTransaction });
|
3922
3936
|
for await (const { submitAndAwait } of subscription) {
|
@@ -3931,14 +3945,14 @@ var _Provider = class {
|
|
3931
3945
|
}
|
3932
3946
|
}
|
3933
3947
|
const transactionId2 = transactionRequest.getTransactionId(this.getChainId());
|
3934
|
-
const response = new TransactionResponse(transactionId2, this);
|
3948
|
+
const response = new TransactionResponse(transactionId2, this, abis);
|
3935
3949
|
await response.fetch();
|
3936
3950
|
return response;
|
3937
3951
|
}
|
3938
3952
|
const {
|
3939
3953
|
submit: { id: transactionId }
|
3940
3954
|
} = await this.operations.submit({ encodedTransaction });
|
3941
|
-
return new TransactionResponse(transactionId, this);
|
3955
|
+
return new TransactionResponse(transactionId, this, abis);
|
3942
3956
|
}
|
3943
3957
|
/**
|
3944
3958
|
* Executes a transaction without actually submitting it to the chain.
|