@fuel-ts/account 0.0.0-pr-2364-20240523174104 → 0.0.0-pr-2364-20240524224403

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
@@ -2108,7 +2108,7 @@ var BaseTransactionRequest = class {
2108
2108
  * @param coin - Coin resource.
2109
2109
  */
2110
2110
  addCoinInput(coin) {
2111
- const { assetId, owner, amount, id, predicate } = coin;
2111
+ const { assetId, owner, amount, id, predicate, predicateData } = coin;
2112
2112
  let witnessIndex;
2113
2113
  if (coin.predicate) {
2114
2114
  witnessIndex = 0;
@@ -2126,7 +2126,8 @@ var BaseTransactionRequest = class {
2126
2126
  assetId,
2127
2127
  txPointer: "0x00000000000000000000000000000000",
2128
2128
  witnessIndex,
2129
- predicate
2129
+ predicate,
2130
+ predicateData
2130
2131
  };
2131
2132
  this.pushInput(input);
2132
2133
  this.addChangeOutput(owner, assetId);
@@ -2138,7 +2139,7 @@ var BaseTransactionRequest = class {
2138
2139
  * @param message - Message resource.
2139
2140
  */
2140
2141
  addMessageInput(message) {
2141
- const { recipient, sender, amount, predicate, nonce, assetId } = message;
2142
+ const { recipient, sender, amount, predicate, nonce, assetId, predicateData } = message;
2142
2143
  let witnessIndex;
2143
2144
  if (message.predicate) {
2144
2145
  witnessIndex = 0;
@@ -2155,7 +2156,8 @@ var BaseTransactionRequest = class {
2155
2156
  recipient: recipient.toB256(),
2156
2157
  amount,
2157
2158
  witnessIndex,
2158
- predicate
2159
+ predicate,
2160
+ predicateData
2159
2161
  };
2160
2162
  this.pushInput(input);
2161
2163
  this.addChangeOutput(recipient, assetId);
@@ -2357,23 +2359,13 @@ var BaseTransactionRequest = class {
2357
2359
  });
2358
2360
  }
2359
2361
  updatePredicateGasUsed(inputs) {
2360
- this.inputs.forEach((i) => {
2361
- let correspondingInput;
2362
- switch (i.type) {
2363
- case InputType3.Coin:
2364
- correspondingInput = inputs.find((x) => x.type === InputType3.Coin && x.owner === i.owner);
2365
- break;
2366
- case InputType3.Message:
2367
- correspondingInput = inputs.find(
2368
- (x) => x.type === InputType3.Message && x.sender === i.sender
2369
- );
2370
- break;
2371
- default:
2372
- return;
2373
- }
2362
+ const inputsToExtractGasUsed = inputs.filter(isRequestInputResource);
2363
+ this.inputs.filter(isRequestInputResource).forEach((i) => {
2364
+ const owner = getRequestInputResourceOwner(i);
2365
+ const correspondingInput = inputsToExtractGasUsed.find(
2366
+ (x) => isRequestInputResourceFromOwner(x, Address.fromString(String(owner)))
2367
+ );
2374
2368
  if (correspondingInput && "predicateGasUsed" in correspondingInput && bn8(correspondingInput.predicateGasUsed).gt(0)) {
2375
- i.predicate = correspondingInput.predicate;
2376
- i.predicateData = correspondingInput.predicateData;
2377
2369
  i.predicateGasUsed = correspondingInput.predicateGasUsed;
2378
2370
  }
2379
2371
  });
@@ -9429,7 +9421,8 @@ var Predicate = class extends Account {
9429
9421
  );
9430
9422
  return resources.map((resource) => ({
9431
9423
  ...resource,
9432
- predicate: hexlify19(this.bytes)
9424
+ predicate: hexlify19(this.bytes),
9425
+ predicateData: hexlify19(this.getPredicateData())
9433
9426
  }));
9434
9427
  }
9435
9428
  /**