@fuel-ts/account 0.0.0-rc-2037-20240411163513 → 0.0.0-rc-2045-20240411190910

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.

@@ -28952,7 +28952,7 @@ spurious results.`);
28952
28952
  // ../versions/dist/index.mjs
28953
28953
  function getBuiltinVersions() {
28954
28954
  return {
28955
- FORC: "0.49.3",
28955
+ FORC: "0.53.0",
28956
28956
  FUEL_CORE: "0.22.1",
28957
28957
  FUELS: "0.79.0"
28958
28958
  };
@@ -31144,7 +31144,7 @@ This unreleased fuel-core build may include features and updates not yet support
31144
31144
  toEvmAddress() {
31145
31145
  const b256Address = toB256(this.bech32Address);
31146
31146
  return {
31147
- value: clearFirst12BytesFromB256(b256Address)
31147
+ bits: clearFirst12BytesFromB256(b256Address)
31148
31148
  };
31149
31149
  }
31150
31150
  /**
@@ -31154,7 +31154,7 @@ This unreleased fuel-core build may include features and updates not yet support
31154
31154
  */
31155
31155
  toAssetId() {
31156
31156
  return {
31157
- value: this.toB256()
31157
+ bits: this.toB256()
31158
31158
  };
31159
31159
  }
31160
31160
  /**
@@ -39755,8 +39755,8 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
39755
39755
  * @param predicate - Predicate bytes.
39756
39756
  * @param predicateData - Predicate data bytes.
39757
39757
  */
39758
- addCoinInput(coin) {
39759
- const { assetId, owner, amount, id, predicate } = coin;
39758
+ addCoinInput(coin, predicate) {
39759
+ const { assetId, owner, amount } = coin;
39760
39760
  let witnessIndex;
39761
39761
  if (predicate) {
39762
39762
  witnessIndex = 0;
@@ -39767,14 +39767,14 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
39767
39767
  }
39768
39768
  }
39769
39769
  const input = {
39770
- id,
39770
+ ...coin,
39771
39771
  type: InputType.Coin,
39772
39772
  owner: owner.toB256(),
39773
39773
  amount,
39774
39774
  assetId,
39775
39775
  txPointer: "0x00000000000000000000000000000000",
39776
39776
  witnessIndex,
39777
- predicate
39777
+ predicate: predicate?.bytes
39778
39778
  };
39779
39779
  this.pushInput(input);
39780
39780
  this.addChangeOutput(owner, assetId);
@@ -39787,8 +39787,8 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
39787
39787
  * @param predicate - Predicate bytes.
39788
39788
  * @param predicateData - Predicate data bytes.
39789
39789
  */
39790
- addMessageInput(message) {
39791
- const { recipient, sender, amount, predicate, nonce } = message;
39790
+ addMessageInput(message, predicate) {
39791
+ const { recipient, sender, amount } = message;
39792
39792
  const assetId = BaseAssetId;
39793
39793
  let witnessIndex;
39794
39794
  if (predicate) {
@@ -39800,13 +39800,13 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
39800
39800
  }
39801
39801
  }
39802
39802
  const input = {
39803
- nonce,
39803
+ ...message,
39804
39804
  type: InputType.Message,
39805
39805
  sender: sender.toB256(),
39806
39806
  recipient: recipient.toB256(),
39807
39807
  amount,
39808
39808
  witnessIndex,
39809
- predicate
39809
+ predicate: predicate?.bytes
39810
39810
  };
39811
39811
  this.pushInput(input);
39812
39812
  this.addChangeOutput(recipient, assetId);
@@ -39837,6 +39837,32 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
39837
39837
  resources.forEach((resource) => this.addResource(resource));
39838
39838
  return this;
39839
39839
  }
39840
+ /**
39841
+ * Adds multiple resources to the transaction by adding coin/message inputs and change
39842
+ * outputs from the related assetIds.
39843
+ *
39844
+ * @param resources - The resources to add.
39845
+ * @returns This transaction.
39846
+ */
39847
+ addPredicateResource(resource, predicate) {
39848
+ if (isCoin(resource)) {
39849
+ this.addCoinInput(resource, predicate);
39850
+ } else {
39851
+ this.addMessageInput(resource, predicate);
39852
+ }
39853
+ return this;
39854
+ }
39855
+ /**
39856
+ * Adds multiple predicate coin/message inputs to the transaction and change outputs
39857
+ * from the related assetIds.
39858
+ *
39859
+ * @param resources - The resources to add.
39860
+ * @returns This transaction.
39861
+ */
39862
+ addPredicateResources(resources, predicate) {
39863
+ resources.forEach((resource) => this.addPredicateResource(resource, predicate));
39864
+ return this;
39865
+ }
39840
39866
  /**
39841
39867
  * Adds a coin output to the transaction.
39842
39868
  *
@@ -47837,7 +47863,6 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
47837
47863
  if (input.type === InputType.Coin && hexlify(input.owner) === this.address.toB256()) {
47838
47864
  input.predicate = this.bytes;
47839
47865
  input.predicateData = this.getPredicateData(policies.length);
47840
- input.witnessIndex = 0;
47841
47866
  }
47842
47867
  });
47843
47868
  return request;
@@ -47875,20 +47900,6 @@ ${PANIC_DOC_URL}#variant.${status.reason}`;
47875
47900
  const transactionRequest = this.populateTransactionPredicateData(transactionRequestLike);
47876
47901
  return super.simulateTransaction(transactionRequest);
47877
47902
  }
47878
- /**
47879
- * Retrieves resources satisfying the spend query for the account.
47880
- *
47881
- * @param quantities - IDs of coins to exclude.
47882
- * @param excludedIds - IDs of resources to be excluded from the query.
47883
- * @returns A promise that resolves to an array of Resources.
47884
- */
47885
- async getResourcesToSpend(quantities, excludedIds) {
47886
- const resources = await super.getResourcesToSpend(quantities, excludedIds);
47887
- return resources.map((resource) => ({
47888
- ...resource,
47889
- predicate: hexlify(this.bytes)
47890
- }));
47891
- }
47892
47903
  getPredicateData(policiesLength) {
47893
47904
  if (!this.predicateData.length) {
47894
47905
  return new Uint8Array();