@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/test-utils.mjs
CHANGED
@@ -2277,6 +2277,7 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
|
|
2277
2277
|
script;
|
2278
2278
|
/** Script input data (parameters) */
|
2279
2279
|
scriptData;
|
2280
|
+
abis;
|
2280
2281
|
/**
|
2281
2282
|
* Constructor for `ScriptTransactionRequest`.
|
2282
2283
|
*
|
@@ -2287,6 +2288,7 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
|
|
2287
2288
|
this.gasLimit = bn9(gasLimit);
|
2288
2289
|
this.script = arrayify8(script ?? returnZeroScript.bytes);
|
2289
2290
|
this.scriptData = arrayify8(scriptData ?? returnZeroScript.encodeScriptData());
|
2291
|
+
this.abis = rest.abis;
|
2290
2292
|
}
|
2291
2293
|
/**
|
2292
2294
|
* Converts the transaction request to a `TransactionScript`.
|
@@ -3152,6 +3154,21 @@ function assembleTransactionSummary(params) {
|
|
3152
3154
|
return transactionSummary;
|
3153
3155
|
}
|
3154
3156
|
|
3157
|
+
// src/providers/transaction-response/getDecodedLogs.ts
|
3158
|
+
import { Interface as Interface3, BigNumberCoder } from "@fuel-ts/abi-coder";
|
3159
|
+
import { ReceiptType as ReceiptType5 } from "@fuel-ts/transactions";
|
3160
|
+
function getDecodedLogs(receipts, mainAbi, externalAbis = {}) {
|
3161
|
+
return receipts.reduce((logs, receipt) => {
|
3162
|
+
if (receipt.type === ReceiptType5.LogData || receipt.type === ReceiptType5.Log) {
|
3163
|
+
const interfaceToUse = new Interface3(externalAbis[receipt.id] || mainAbi);
|
3164
|
+
const data = receipt.type === ReceiptType5.Log ? new BigNumberCoder("u64").encode(receipt.val0) : receipt.data;
|
3165
|
+
const [decodedLog] = interfaceToUse.decodeLog(data, receipt.val1.toNumber());
|
3166
|
+
logs.push(decodedLog);
|
3167
|
+
}
|
3168
|
+
return logs;
|
3169
|
+
}, []);
|
3170
|
+
}
|
3171
|
+
|
3155
3172
|
// src/providers/transaction-response/transaction-response.ts
|
3156
3173
|
var TransactionResponse = class {
|
3157
3174
|
/** Transaction ID */
|
@@ -3162,15 +3179,17 @@ var TransactionResponse = class {
|
|
3162
3179
|
gasUsed = bn13(0);
|
3163
3180
|
/** The graphql Transaction with receipts object. */
|
3164
3181
|
gqlTransaction;
|
3182
|
+
abis;
|
3165
3183
|
/**
|
3166
3184
|
* Constructor for `TransactionResponse`.
|
3167
3185
|
*
|
3168
3186
|
* @param id - The transaction ID.
|
3169
3187
|
* @param provider - The provider.
|
3170
3188
|
*/
|
3171
|
-
constructor(id, provider) {
|
3189
|
+
constructor(id, provider, abis) {
|
3172
3190
|
this.id = id;
|
3173
3191
|
this.provider = provider;
|
3192
|
+
this.abis = abis;
|
3174
3193
|
}
|
3175
3194
|
/**
|
3176
3195
|
* Async constructor for `TransactionResponse`. This method can be used to create
|
@@ -3180,8 +3199,8 @@ var TransactionResponse = class {
|
|
3180
3199
|
* @param id - The transaction ID.
|
3181
3200
|
* @param provider - The provider.
|
3182
3201
|
*/
|
3183
|
-
static async create(id, provider) {
|
3184
|
-
const response = new TransactionResponse(id, provider);
|
3202
|
+
static async create(id, provider, abis) {
|
3203
|
+
const response = new TransactionResponse(id, provider, abis);
|
3185
3204
|
await response.fetch();
|
3186
3205
|
return response;
|
3187
3206
|
}
|
@@ -3285,6 +3304,14 @@ var TransactionResponse = class {
|
|
3285
3304
|
gqlTransaction: this.gqlTransaction,
|
3286
3305
|
...transactionSummary
|
3287
3306
|
};
|
3307
|
+
if (this.abis) {
|
3308
|
+
const logs = getDecodedLogs(
|
3309
|
+
transactionSummary.receipts,
|
3310
|
+
this.abis.main,
|
3311
|
+
this.abis.otherContractsAbis
|
3312
|
+
);
|
3313
|
+
transactionResult.logs = logs;
|
3314
|
+
}
|
3288
3315
|
return transactionResult;
|
3289
3316
|
}
|
3290
3317
|
/**
|
@@ -3304,10 +3331,6 @@ var TransactionResponse = class {
|
|
3304
3331
|
}
|
3305
3332
|
};
|
3306
3333
|
|
3307
|
-
// src/providers/transaction-response/getDecodedLogs.ts
|
3308
|
-
import { BigNumberCoder } from "@fuel-ts/abi-coder";
|
3309
|
-
import { ReceiptType as ReceiptType5 } from "@fuel-ts/transactions";
|
3310
|
-
|
3311
3334
|
// src/providers/utils/auto-retry-fetch.ts
|
3312
3335
|
function getWaitDelay(options, retryAttemptNum) {
|
3313
3336
|
const duration = options.baseDelay ?? 150;
|
@@ -3642,6 +3665,10 @@ var _Provider = class {
|
|
3642
3665
|
await this.estimateTxDependencies(transactionRequest);
|
3643
3666
|
}
|
3644
3667
|
const encodedTransaction = hexlify12(transactionRequest.toTransactionBytes());
|
3668
|
+
let abis;
|
3669
|
+
if (transactionRequest.type === TransactionType8.Script) {
|
3670
|
+
abis = transactionRequest.abis;
|
3671
|
+
}
|
3645
3672
|
if (awaitExecution) {
|
3646
3673
|
const subscription = this.operations.submitAndAwait({ encodedTransaction });
|
3647
3674
|
for await (const { submitAndAwait } of subscription) {
|
@@ -3656,14 +3683,14 @@ var _Provider = class {
|
|
3656
3683
|
}
|
3657
3684
|
}
|
3658
3685
|
const transactionId2 = transactionRequest.getTransactionId(this.getChainId());
|
3659
|
-
const response = new TransactionResponse(transactionId2, this);
|
3686
|
+
const response = new TransactionResponse(transactionId2, this, abis);
|
3660
3687
|
await response.fetch();
|
3661
3688
|
return response;
|
3662
3689
|
}
|
3663
3690
|
const {
|
3664
3691
|
submit: { id: transactionId }
|
3665
3692
|
} = await this.operations.submit({ encodedTransaction });
|
3666
|
-
return new TransactionResponse(transactionId, this);
|
3693
|
+
return new TransactionResponse(transactionId, this, abis);
|
3667
3694
|
}
|
3668
3695
|
/**
|
3669
3696
|
* Executes a transaction without actually submitting it to the chain.
|