@fuel-ts/account 0.0.0-rc-2037-20240411020051 → 0.0.0-rc-2040-20240411095959

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.

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