@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.js CHANGED
@@ -2251,7 +2251,7 @@ var BaseTransactionRequest = class {
2251
2251
  * @param coin - Coin resource.
2252
2252
  */
2253
2253
  addCoinInput(coin) {
2254
- const { assetId, owner, amount, id, predicate } = coin;
2254
+ const { assetId, owner, amount, id, predicate, predicateData } = coin;
2255
2255
  let witnessIndex;
2256
2256
  if (coin.predicate) {
2257
2257
  witnessIndex = 0;
@@ -2269,7 +2269,8 @@ var BaseTransactionRequest = class {
2269
2269
  assetId,
2270
2270
  txPointer: "0x00000000000000000000000000000000",
2271
2271
  witnessIndex,
2272
- predicate
2272
+ predicate,
2273
+ predicateData
2273
2274
  };
2274
2275
  this.pushInput(input);
2275
2276
  this.addChangeOutput(owner, assetId);
@@ -2281,7 +2282,7 @@ var BaseTransactionRequest = class {
2281
2282
  * @param message - Message resource.
2282
2283
  */
2283
2284
  addMessageInput(message) {
2284
- const { recipient, sender, amount, predicate, nonce, assetId } = message;
2285
+ const { recipient, sender, amount, predicate, nonce, assetId, predicateData } = message;
2285
2286
  let witnessIndex;
2286
2287
  if (message.predicate) {
2287
2288
  witnessIndex = 0;
@@ -2298,7 +2299,8 @@ var BaseTransactionRequest = class {
2298
2299
  recipient: recipient.toB256(),
2299
2300
  amount,
2300
2301
  witnessIndex,
2301
- predicate
2302
+ predicate,
2303
+ predicateData
2302
2304
  };
2303
2305
  this.pushInput(input);
2304
2306
  this.addChangeOutput(recipient, assetId);
@@ -2500,23 +2502,13 @@ var BaseTransactionRequest = class {
2500
2502
  });
2501
2503
  }
2502
2504
  updatePredicateGasUsed(inputs) {
2503
- this.inputs.forEach((i) => {
2504
- let correspondingInput;
2505
- switch (i.type) {
2506
- case import_transactions7.InputType.Coin:
2507
- correspondingInput = inputs.find((x) => x.type === import_transactions7.InputType.Coin && x.owner === i.owner);
2508
- break;
2509
- case import_transactions7.InputType.Message:
2510
- correspondingInput = inputs.find(
2511
- (x) => x.type === import_transactions7.InputType.Message && x.sender === i.sender
2512
- );
2513
- break;
2514
- default:
2515
- return;
2516
- }
2505
+ const inputsToExtractGasUsed = inputs.filter(isRequestInputResource);
2506
+ this.inputs.filter(isRequestInputResource).forEach((i) => {
2507
+ const owner = getRequestInputResourceOwner(i);
2508
+ const correspondingInput = inputsToExtractGasUsed.find(
2509
+ (x) => isRequestInputResourceFromOwner(x, import_address.Address.fromString(String(owner)))
2510
+ );
2517
2511
  if (correspondingInput && "predicateGasUsed" in correspondingInput && (0, import_math8.bn)(correspondingInput.predicateGasUsed).gt(0)) {
2518
- i.predicate = correspondingInput.predicate;
2519
- i.predicateData = correspondingInput.predicateData;
2520
2512
  i.predicateGasUsed = correspondingInput.predicateGasUsed;
2521
2513
  }
2522
2514
  });
@@ -9564,7 +9556,8 @@ var Predicate = class extends Account {
9564
9556
  );
9565
9557
  return resources.map((resource) => ({
9566
9558
  ...resource,
9567
- predicate: (0, import_utils37.hexlify)(this.bytes)
9559
+ predicate: (0, import_utils37.hexlify)(this.bytes),
9560
+ predicateData: (0, import_utils37.hexlify)(this.getPredicateData())
9568
9561
  }));
9569
9562
  }
9570
9563
  /**