@fuel-ts/account 0.0.0-rc-1815-20240322131329 → 0.0.0-rc-1832-20240322144804

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.

package/dist/index.mjs CHANGED
@@ -1703,27 +1703,13 @@ var BaseTransactionRequest = class {
1703
1703
  this.outputs.push(output);
1704
1704
  return this.outputs.length - 1;
1705
1705
  }
1706
- /**
1707
- * @hidden
1708
- *
1709
- * Pushes a witness to the list and returns the index
1710
- *
1711
- * @param signature - The signature to add to the witness.
1712
- * @returns The index of the created witness.
1713
- */
1714
- addWitness(signature) {
1715
- this.witnesses.push(signature);
1716
- return this.witnesses.length - 1;
1717
- }
1718
1706
  /**
1719
1707
  * @hidden
1720
1708
  *
1721
1709
  * Creates an empty witness without any side effects and returns the index
1722
- *
1723
- * @returns The index of the created witness.
1724
1710
  */
1725
- addEmptyWitness() {
1726
- this.addWitness(concat([ZeroBytes324, ZeroBytes324]));
1711
+ createWitness() {
1712
+ this.witnesses.push(concat([ZeroBytes324, ZeroBytes324]));
1727
1713
  return this.witnesses.length - 1;
1728
1714
  }
1729
1715
  /**
@@ -1752,21 +1738,6 @@ var BaseTransactionRequest = class {
1752
1738
  }
1753
1739
  this.witnesses[index] = witness;
1754
1740
  }
1755
- /**
1756
- * Helper function to add an external signature to the transaction.
1757
- *
1758
- * @param account - The account/s to sign to the transaction.
1759
- * @returns The transaction with the signature witness added.
1760
- */
1761
- async addAccountWitnesses(account) {
1762
- const accounts = Array.isArray(account) ? account : [account];
1763
- await Promise.all(
1764
- accounts.map(async (acc) => {
1765
- this.addWitness(await acc.signTransaction(this));
1766
- })
1767
- );
1768
- return this;
1769
- }
1770
1741
  /**
1771
1742
  * Gets the coin inputs for a transaction.
1772
1743
  *
@@ -1832,7 +1803,7 @@ var BaseTransactionRequest = class {
1832
1803
  } else {
1833
1804
  witnessIndex = this.getCoinInputWitnessIndexByOwner(owner);
1834
1805
  if (typeof witnessIndex !== "number") {
1835
- witnessIndex = this.addEmptyWitness();
1806
+ witnessIndex = this.createWitness();
1836
1807
  }
1837
1808
  }
1838
1809
  const input = {
@@ -1866,7 +1837,7 @@ var BaseTransactionRequest = class {
1866
1837
  } else {
1867
1838
  witnessIndex = this.getCoinInputWitnessIndexByOwner(recipient);
1868
1839
  if (typeof witnessIndex !== "number") {
1869
- witnessIndex = this.addEmptyWitness();
1840
+ witnessIndex = this.createWitness();
1870
1841
  }
1871
1842
  }
1872
1843
  const input = {
@@ -3953,8 +3924,7 @@ var _Provider = class {
3953
3924
  async getTransactionCost(transactionRequestLike, forwardingQuantities = [], {
3954
3925
  estimateTxDependencies = true,
3955
3926
  estimatePredicates = true,
3956
- resourcesOwner,
3957
- signatureCallback
3927
+ resourcesOwner
3958
3928
  } = {}) {
3959
3929
  const txRequestClone = clone3(transactionRequestify(transactionRequestLike));
3960
3930
  const chainInfo = this.getChain();
@@ -3973,9 +3943,6 @@ var _Provider = class {
3973
3943
  }
3974
3944
  await this.estimatePredicates(txRequestClone);
3975
3945
  }
3976
- if (signatureCallback && isScriptTransaction) {
3977
- await signatureCallback(txRequestClone);
3978
- }
3979
3946
  const minGas = txRequestClone.calculateMinGas(chainInfo);
3980
3947
  const maxGas = txRequestClone.calculateMaxGas(chainInfo, minGas);
3981
3948
  let receipts = [];
@@ -5023,21 +4990,6 @@ var Account = class extends AbstractAccount {
5023
4990
  }
5024
4991
  return this._connector.signMessage(this.address.toString(), message);
5025
4992
  }
5026
- /**
5027
- * Signs a transaction with the wallet's private key.
5028
- *
5029
- * @param transactionRequestLike - The transaction request to sign.
5030
- * @returns A promise that resolves to the signature of the transaction.
5031
- */
5032
- async signTransaction(transactionRequestLike) {
5033
- if (!this._connector) {
5034
- throw new FuelError14(
5035
- ErrorCode14.MISSING_CONNECTOR,
5036
- "A connector is required to sign transactions."
5037
- );
5038
- }
5039
- return this._connector.signTransaction(this.address.toString(), transactionRequestLike);
5040
- }
5041
4993
  /**
5042
4994
  * Sends a transaction to the network.
5043
4995
  *
@@ -5356,7 +5308,7 @@ var BaseWalletUnlocked = class extends Account {
5356
5308
  */
5357
5309
  async signTransaction(transactionRequestLike) {
5358
5310
  const transactionRequest = transactionRequestify(transactionRequestLike);
5359
- const chainId = this.provider.getChainId();
5311
+ const chainId = this.provider.getChain().consensusParameters.chainId.toNumber();
5360
5312
  const hashedTransaction = transactionRequest.getTransactionId(chainId);
5361
5313
  const signature = await this.signer().sign(hashedTransaction);
5362
5314
  return hexlify15(signature);
@@ -8903,18 +8855,6 @@ var FuelConnector = class extends EventEmitter2 {
8903
8855
  async signMessage(_address, _message) {
8904
8856
  throw new Error("Method not implemented.");
8905
8857
  }
8906
- /**
8907
- * Should start the sign transaction process and return
8908
- * the signed transaction.
8909
- *
8910
- * @param address - The address to sign the transaction
8911
- * @param transaction - The transaction to sign
8912
- *
8913
- * @returns Transaction signature
8914
- */
8915
- async signTransaction(_address, _transaction) {
8916
- throw new Error("Method not implemented.");
8917
- }
8918
8858
  /**
8919
8859
  * Should start the send transaction process and return
8920
8860
  * the transaction id submitted to the network.