@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.

@@ -38712,7 +38712,7 @@ ${PANIC_DOC_URL}#variant.${statusReason}`;
38712
38712
  * @param coin - Coin resource.
38713
38713
  */
38714
38714
  addCoinInput(coin) {
38715
- const { assetId, owner, amount, id, predicate } = coin;
38715
+ const { assetId, owner, amount, id, predicate, predicateData } = coin;
38716
38716
  let witnessIndex;
38717
38717
  if (coin.predicate) {
38718
38718
  witnessIndex = 0;
@@ -38730,7 +38730,8 @@ ${PANIC_DOC_URL}#variant.${statusReason}`;
38730
38730
  assetId,
38731
38731
  txPointer: "0x00000000000000000000000000000000",
38732
38732
  witnessIndex,
38733
- predicate
38733
+ predicate,
38734
+ predicateData
38734
38735
  };
38735
38736
  this.pushInput(input);
38736
38737
  this.addChangeOutput(owner, assetId);
@@ -38742,7 +38743,7 @@ ${PANIC_DOC_URL}#variant.${statusReason}`;
38742
38743
  * @param message - Message resource.
38743
38744
  */
38744
38745
  addMessageInput(message) {
38745
- const { recipient, sender, amount, predicate, nonce, assetId } = message;
38746
+ const { recipient, sender, amount, predicate, nonce, assetId, predicateData } = message;
38746
38747
  let witnessIndex;
38747
38748
  if (message.predicate) {
38748
38749
  witnessIndex = 0;
@@ -38759,7 +38760,8 @@ ${PANIC_DOC_URL}#variant.${statusReason}`;
38759
38760
  recipient: recipient.toB256(),
38760
38761
  amount,
38761
38762
  witnessIndex,
38762
- predicate
38763
+ predicate,
38764
+ predicateData
38763
38765
  };
38764
38766
  this.pushInput(input);
38765
38767
  this.addChangeOutput(recipient, assetId);
@@ -38961,23 +38963,13 @@ ${PANIC_DOC_URL}#variant.${statusReason}`;
38961
38963
  });
38962
38964
  }
38963
38965
  updatePredicateGasUsed(inputs) {
38964
- this.inputs.forEach((i) => {
38965
- let correspondingInput;
38966
- switch (i.type) {
38967
- case InputType.Coin:
38968
- correspondingInput = inputs.find((x) => x.type === InputType.Coin && x.owner === i.owner);
38969
- break;
38970
- case InputType.Message:
38971
- correspondingInput = inputs.find(
38972
- (x) => x.type === InputType.Message && x.sender === i.sender
38973
- );
38974
- break;
38975
- default:
38976
- return;
38977
- }
38966
+ const inputsToExtractGasUsed = inputs.filter(isRequestInputResource);
38967
+ this.inputs.filter(isRequestInputResource).forEach((i) => {
38968
+ const owner = getRequestInputResourceOwner(i);
38969
+ const correspondingInput = inputsToExtractGasUsed.find(
38970
+ (x) => isRequestInputResourceFromOwner(x, Address.fromString(String(owner)))
38971
+ );
38978
38972
  if (correspondingInput && "predicateGasUsed" in correspondingInput && bn(correspondingInput.predicateGasUsed).gt(0)) {
38979
- i.predicate = correspondingInput.predicate;
38980
- i.predicateData = correspondingInput.predicateData;
38981
38973
  i.predicateGasUsed = correspondingInput.predicateGasUsed;
38982
38974
  }
38983
38975
  });
@@ -47290,7 +47282,8 @@ Supported fuel-core version: ${supportedVersion}.`
47290
47282
  );
47291
47283
  return resources.map((resource) => ({
47292
47284
  ...resource,
47293
- predicate: hexlify(this.bytes)
47285
+ predicate: hexlify(this.bytes),
47286
+ predicateData: hexlify(this.getPredicateData())
47294
47287
  }));
47295
47288
  }
47296
47289
  /**