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

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.

@@ -1842,8 +1842,8 @@ var BaseTransactionRequest = class {
1842
1842
  * @param predicate - Predicate bytes.
1843
1843
  * @param predicateData - Predicate data bytes.
1844
1844
  */
1845
- addCoinInput(coin) {
1846
- const { assetId, owner, amount, id, predicate } = coin;
1845
+ addCoinInput(coin, predicate) {
1846
+ const { assetId, owner, amount } = coin;
1847
1847
  let witnessIndex;
1848
1848
  if (predicate) {
1849
1849
  witnessIndex = 0;
@@ -1854,14 +1854,14 @@ var BaseTransactionRequest = class {
1854
1854
  }
1855
1855
  }
1856
1856
  const input = {
1857
- id,
1857
+ ...coin,
1858
1858
  type: import_transactions6.InputType.Coin,
1859
1859
  owner: owner.toB256(),
1860
1860
  amount,
1861
1861
  assetId,
1862
1862
  txPointer: "0x00000000000000000000000000000000",
1863
1863
  witnessIndex,
1864
- predicate
1864
+ predicate: predicate?.bytes
1865
1865
  };
1866
1866
  this.pushInput(input);
1867
1867
  this.addChangeOutput(owner, assetId);
@@ -1874,8 +1874,8 @@ var BaseTransactionRequest = class {
1874
1874
  * @param predicate - Predicate bytes.
1875
1875
  * @param predicateData - Predicate data bytes.
1876
1876
  */
1877
- addMessageInput(message) {
1878
- const { recipient, sender, amount, predicate, nonce } = message;
1877
+ addMessageInput(message, predicate) {
1878
+ const { recipient, sender, amount } = message;
1879
1879
  const assetId = import_configs7.BaseAssetId;
1880
1880
  let witnessIndex;
1881
1881
  if (predicate) {
@@ -1887,13 +1887,13 @@ var BaseTransactionRequest = class {
1887
1887
  }
1888
1888
  }
1889
1889
  const input = {
1890
- nonce,
1890
+ ...message,
1891
1891
  type: import_transactions6.InputType.Message,
1892
1892
  sender: sender.toB256(),
1893
1893
  recipient: recipient.toB256(),
1894
1894
  amount,
1895
1895
  witnessIndex,
1896
- predicate
1896
+ predicate: predicate?.bytes
1897
1897
  };
1898
1898
  this.pushInput(input);
1899
1899
  this.addChangeOutput(recipient, assetId);
@@ -1924,6 +1924,32 @@ var BaseTransactionRequest = class {
1924
1924
  resources.forEach((resource) => this.addResource(resource));
1925
1925
  return this;
1926
1926
  }
1927
+ /**
1928
+ * Adds multiple resources to the transaction by adding coin/message inputs and change
1929
+ * outputs from the related assetIds.
1930
+ *
1931
+ * @param resources - The resources to add.
1932
+ * @returns This transaction.
1933
+ */
1934
+ addPredicateResource(resource, predicate) {
1935
+ if (isCoin(resource)) {
1936
+ this.addCoinInput(resource, predicate);
1937
+ } else {
1938
+ this.addMessageInput(resource, predicate);
1939
+ }
1940
+ return this;
1941
+ }
1942
+ /**
1943
+ * Adds multiple predicate coin/message inputs to the transaction and change outputs
1944
+ * from the related assetIds.
1945
+ *
1946
+ * @param resources - The resources to add.
1947
+ * @returns This transaction.
1948
+ */
1949
+ addPredicateResources(resources, predicate) {
1950
+ resources.forEach((resource) => this.addPredicateResource(resource, predicate));
1951
+ return this;
1952
+ }
1927
1953
  /**
1928
1954
  * Adds a coin output to the transaction.
1929
1955
  *