@fuel-ts/account 0.0.0-rc-1935-20240325115321 → 0.0.0-rc-1936-20240325123930

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.

@@ -33196,18 +33196,9 @@ This unreleased fuel-core build may include features and updates not yet support
33196
33196
  var Interface = class {
33197
33197
  functions;
33198
33198
  configurables;
33199
- /*
33200
- TODO: Refactor so that there's no need for externalLoggedTypes
33201
-
33202
- This is dedicated to external contracts added via `<base-invocation-scope.ts>.addContracts()` method.
33203
- This is used to decode logs from contracts other than the main contract
33204
- we're interacting with.
33205
- */
33206
- externalLoggedTypes;
33207
33199
  jsonAbi;
33208
33200
  constructor(jsonAbi) {
33209
33201
  this.jsonAbi = jsonAbi;
33210
- this.externalLoggedTypes = {};
33211
33202
  this.functions = Object.fromEntries(
33212
33203
  this.jsonAbi.functions.map((x) => [x.name, new FunctionFragment(this.jsonAbi, x.name)])
33213
33204
  );
@@ -33248,20 +33239,12 @@ This unreleased fuel-core build may include features and updates not yet support
33248
33239
  const fragment = typeof functionFragment === "string" ? this.getFunction(functionFragment) : functionFragment;
33249
33240
  return fragment.decodeOutput(data);
33250
33241
  }
33251
- decodeLog(data, logId, receiptId) {
33252
- const isExternalLoggedType = this.externalLoggedTypes[receiptId];
33253
- if (isExternalLoggedType) {
33254
- const externalInterface = this.externalLoggedTypes[receiptId];
33255
- return externalInterface.decodeLog(data, logId, receiptId);
33256
- }
33242
+ decodeLog(data, logId) {
33257
33243
  const { loggedType } = findOrThrow(this.jsonAbi.loggedTypes, (type3) => type3.logId === logId);
33258
33244
  return AbiCoder.decode(this.jsonAbi, loggedType, arrayify(data), 0, {
33259
33245
  encoding: this.jsonAbi.encoding
33260
33246
  });
33261
33247
  }
33262
- updateExternalLoggedTypes(id, loggedTypes) {
33263
- this.externalLoggedTypes[id] = loggedTypes;
33264
- }
33265
33248
  encodeConfigurable(name, value) {
33266
33249
  const configurable = findOrThrow(
33267
33250
  this.jsonAbi.configurables,
@@ -41172,15 +41155,13 @@ ${MessageCoinFragmentFragmentDoc}`;
41172
41155
  };
41173
41156
 
41174
41157
  // src/providers/transaction-response/getDecodedLogs.ts
41175
- function getDecodedLogs(receipts, abiInterface) {
41176
- return receipts.reduce((logs, r) => {
41177
- if (r.type === ReceiptType.LogData) {
41178
- logs.push(abiInterface.decodeLog(r.data, r.val1.toNumber(), r.id)[0]);
41179
- }
41180
- if (r.type === ReceiptType.Log) {
41181
- logs.push(
41182
- abiInterface.decodeLog(new BigNumberCoder("u64").encode(r.val0), r.val1.toNumber(), r.id)[0]
41183
- );
41158
+ function getDecodedLogs(receipts, mainAbiInterface, externalAbis = {}) {
41159
+ return receipts.reduce((logs, receipt) => {
41160
+ if (receipt.type === ReceiptType.LogData || receipt.type === ReceiptType.Log) {
41161
+ const interfaceToUse = externalAbis[receipt.id] ? new Interface(externalAbis[receipt.id]) : new Interface(mainAbiInterface);
41162
+ const data = receipt.type === ReceiptType.Log ? new BigNumberCoder("u64").encode(receipt.val0) : receipt.data;
41163
+ const [decodedLog] = interfaceToUse.decodeLog(data, receipt.val1.toNumber());
41164
+ logs.push(decodedLog);
41184
41165
  }
41185
41166
  return logs;
41186
41167
  }, []);