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

@@ -1825,8 +1825,8 @@ var BaseTransactionRequest = class {
1825
1825
  * @param predicate - Predicate bytes.
1826
1826
  * @param predicateData - Predicate data bytes.
1827
1827
  */
1828
- addCoinInput(coin) {
1829
- const { assetId, owner, amount, id, predicate } = coin;
1828
+ addCoinInput(coin, predicate) {
1829
+ const { assetId, owner, amount } = coin;
1830
1830
  let witnessIndex;
1831
1831
  if (predicate) {
1832
1832
  witnessIndex = 0;
@@ -1837,14 +1837,14 @@ var BaseTransactionRequest = class {
1837
1837
  }
1838
1838
  }
1839
1839
  const input = {
1840
- id,
1840
+ ...coin,
1841
1841
  type: InputType2.Coin,
1842
1842
  owner: owner.toB256(),
1843
1843
  amount,
1844
1844
  assetId,
1845
1845
  txPointer: "0x00000000000000000000000000000000",
1846
1846
  witnessIndex,
1847
- predicate
1847
+ predicate: predicate?.bytes
1848
1848
  };
1849
1849
  this.pushInput(input);
1850
1850
  this.addChangeOutput(owner, assetId);
@@ -1857,8 +1857,8 @@ var BaseTransactionRequest = class {
1857
1857
  * @param predicate - Predicate bytes.
1858
1858
  * @param predicateData - Predicate data bytes.
1859
1859
  */
1860
- addMessageInput(message) {
1861
- const { recipient, sender, amount, predicate, nonce } = message;
1860
+ addMessageInput(message, predicate) {
1861
+ const { recipient, sender, amount } = message;
1862
1862
  const assetId = BaseAssetId2;
1863
1863
  let witnessIndex;
1864
1864
  if (predicate) {
@@ -1870,13 +1870,13 @@ var BaseTransactionRequest = class {
1870
1870
  }
1871
1871
  }
1872
1872
  const input = {
1873
- nonce,
1873
+ ...message,
1874
1874
  type: InputType2.Message,
1875
1875
  sender: sender.toB256(),
1876
1876
  recipient: recipient.toB256(),
1877
1877
  amount,
1878
1878
  witnessIndex,
1879
- predicate
1879
+ predicate: predicate?.bytes
1880
1880
  };
1881
1881
  this.pushInput(input);
1882
1882
  this.addChangeOutput(recipient, assetId);
@@ -1907,6 +1907,32 @@ var BaseTransactionRequest = class {
1907
1907
  resources.forEach((resource) => this.addResource(resource));
1908
1908
  return this;
1909
1909
  }
1910
+ /**
1911
+ * Adds multiple resources to the transaction by adding coin/message inputs and change
1912
+ * outputs from the related assetIds.
1913
+ *
1914
+ * @param resources - The resources to add.
1915
+ * @returns This transaction.
1916
+ */
1917
+ addPredicateResource(resource, predicate) {
1918
+ if (isCoin(resource)) {
1919
+ this.addCoinInput(resource, predicate);
1920
+ } else {
1921
+ this.addMessageInput(resource, predicate);
1922
+ }
1923
+ return this;
1924
+ }
1925
+ /**
1926
+ * Adds multiple predicate coin/message inputs to the transaction and change outputs
1927
+ * from the related assetIds.
1928
+ *
1929
+ * @param resources - The resources to add.
1930
+ * @returns This transaction.
1931
+ */
1932
+ addPredicateResources(resources, predicate) {
1933
+ resources.forEach((resource) => this.addPredicateResource(resource, predicate));
1934
+ return this;
1935
+ }
1910
1936
  /**
1911
1937
  * Adds a coin output to the transaction.
1912
1938
  *