@fuel-ts/account 0.0.0-rc-1936-20240328132956 → 0.0.0-rc-1962-20240328134623

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.mjs CHANGED
@@ -2356,6 +2356,7 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
2356
2356
  script;
2357
2357
  /** Script input data (parameters) */
2358
2358
  scriptData;
2359
+ abis;
2359
2360
  /**
2360
2361
  * Constructor for `ScriptTransactionRequest`.
2361
2362
  *
@@ -2366,6 +2367,7 @@ var ScriptTransactionRequest = class extends BaseTransactionRequest {
2366
2367
  this.gasLimit = bn9(gasLimit);
2367
2368
  this.script = arrayify8(script ?? returnZeroScript.bytes);
2368
2369
  this.scriptData = arrayify8(scriptData ?? returnZeroScript.encodeScriptData());
2370
+ this.abis = rest.abis;
2369
2371
  }
2370
2372
  /**
2371
2373
  * Converts the transaction request to a `TransactionScript`.
@@ -3278,6 +3280,21 @@ function assembleTransactionSummary(params) {
3278
3280
  return transactionSummary;
3279
3281
  }
3280
3282
 
3283
+ // src/providers/transaction-response/getDecodedLogs.ts
3284
+ import { Interface as Interface3, BigNumberCoder } from "@fuel-ts/abi-coder";
3285
+ import { ReceiptType as ReceiptType5 } from "@fuel-ts/transactions";
3286
+ function getDecodedLogs(receipts, mainAbi, externalAbis = {}) {
3287
+ return receipts.reduce((logs, receipt) => {
3288
+ if (receipt.type === ReceiptType5.LogData || receipt.type === ReceiptType5.Log) {
3289
+ const interfaceToUse = new Interface3(externalAbis[receipt.id] || mainAbi);
3290
+ const data = receipt.type === ReceiptType5.Log ? new BigNumberCoder("u64").encode(receipt.val0) : receipt.data;
3291
+ const [decodedLog] = interfaceToUse.decodeLog(data, receipt.val1.toNumber());
3292
+ logs.push(decodedLog);
3293
+ }
3294
+ return logs;
3295
+ }, []);
3296
+ }
3297
+
3281
3298
  // src/providers/transaction-response/transaction-response.ts
3282
3299
  var TransactionResponse = class {
3283
3300
  /** Transaction ID */
@@ -3288,15 +3305,17 @@ var TransactionResponse = class {
3288
3305
  gasUsed = bn13(0);
3289
3306
  /** The graphql Transaction with receipts object. */
3290
3307
  gqlTransaction;
3308
+ abis;
3291
3309
  /**
3292
3310
  * Constructor for `TransactionResponse`.
3293
3311
  *
3294
3312
  * @param id - The transaction ID.
3295
3313
  * @param provider - The provider.
3296
3314
  */
3297
- constructor(id, provider) {
3315
+ constructor(id, provider, abis) {
3298
3316
  this.id = id;
3299
3317
  this.provider = provider;
3318
+ this.abis = abis;
3300
3319
  }
3301
3320
  /**
3302
3321
  * Async constructor for `TransactionResponse`. This method can be used to create
@@ -3306,8 +3325,8 @@ var TransactionResponse = class {
3306
3325
  * @param id - The transaction ID.
3307
3326
  * @param provider - The provider.
3308
3327
  */
3309
- static async create(id, provider) {
3310
- const response = new TransactionResponse(id, provider);
3328
+ static async create(id, provider, abis) {
3329
+ const response = new TransactionResponse(id, provider, abis);
3311
3330
  await response.fetch();
3312
3331
  return response;
3313
3332
  }
@@ -3411,6 +3430,14 @@ var TransactionResponse = class {
3411
3430
  gqlTransaction: this.gqlTransaction,
3412
3431
  ...transactionSummary
3413
3432
  };
3433
+ if (this.abis) {
3434
+ const logs = getDecodedLogs(
3435
+ transactionSummary.receipts,
3436
+ this.abis.main,
3437
+ this.abis.otherContractsAbis
3438
+ );
3439
+ transactionResult.logs = logs;
3440
+ }
3414
3441
  return transactionResult;
3415
3442
  }
3416
3443
  /**
@@ -3430,21 +3457,6 @@ var TransactionResponse = class {
3430
3457
  }
3431
3458
  };
3432
3459
 
3433
- // src/providers/transaction-response/getDecodedLogs.ts
3434
- import { Interface as Interface3, BigNumberCoder } from "@fuel-ts/abi-coder";
3435
- import { ReceiptType as ReceiptType5 } from "@fuel-ts/transactions";
3436
- function getDecodedLogs(receipts, mainAbi, externalAbis = {}) {
3437
- return receipts.reduce((logs, receipt) => {
3438
- if (receipt.type === ReceiptType5.LogData || receipt.type === ReceiptType5.Log) {
3439
- const interfaceToUse = externalAbis[receipt.id] ? new Interface3(externalAbis[receipt.id]) : new Interface3(mainAbi);
3440
- const data = receipt.type === ReceiptType5.Log ? new BigNumberCoder("u64").encode(receipt.val0) : receipt.data;
3441
- const [decodedLog] = interfaceToUse.decodeLog(data, receipt.val1.toNumber());
3442
- logs.push(decodedLog);
3443
- }
3444
- return logs;
3445
- }, []);
3446
- }
3447
-
3448
3460
  // src/providers/utils/auto-retry-fetch.ts
3449
3461
  function getWaitDelay(options, retryAttemptNum) {
3450
3462
  const duration = options.baseDelay ?? 150;
@@ -3779,6 +3791,10 @@ var _Provider = class {
3779
3791
  await this.estimateTxDependencies(transactionRequest);
3780
3792
  }
3781
3793
  const encodedTransaction = hexlify12(transactionRequest.toTransactionBytes());
3794
+ let abis;
3795
+ if (transactionRequest.type === TransactionType8.Script) {
3796
+ abis = transactionRequest.abis;
3797
+ }
3782
3798
  if (awaitExecution) {
3783
3799
  const subscription = this.operations.submitAndAwait({ encodedTransaction });
3784
3800
  for await (const { submitAndAwait } of subscription) {
@@ -3793,14 +3809,14 @@ var _Provider = class {
3793
3809
  }
3794
3810
  }
3795
3811
  const transactionId2 = transactionRequest.getTransactionId(this.getChainId());
3796
- const response = new TransactionResponse(transactionId2, this);
3812
+ const response = new TransactionResponse(transactionId2, this, abis);
3797
3813
  await response.fetch();
3798
3814
  return response;
3799
3815
  }
3800
3816
  const {
3801
3817
  submit: { id: transactionId }
3802
3818
  } = await this.operations.submit({ encodedTransaction });
3803
- return new TransactionResponse(transactionId, this);
3819
+ return new TransactionResponse(transactionId, this, abis);
3804
3820
  }
3805
3821
  /**
3806
3822
  * Executes a transaction without actually submitting it to the chain.