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

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