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

@@ -1646,27 +1646,13 @@ var BaseTransactionRequest = class {
1646
1646
  this.outputs.push(output);
1647
1647
  return this.outputs.length - 1;
1648
1648
  }
1649
- /**
1650
- * @hidden
1651
- *
1652
- * Pushes a witness to the list and returns the index
1653
- *
1654
- * @param signature - The signature to add to the witness.
1655
- * @returns The index of the created witness.
1656
- */
1657
- addWitness(signature) {
1658
- this.witnesses.push(signature);
1659
- return this.witnesses.length - 1;
1660
- }
1661
1649
  /**
1662
1650
  * @hidden
1663
1651
  *
1664
1652
  * Creates an empty witness without any side effects and returns the index
1665
- *
1666
- * @returns The index of the created witness.
1667
1653
  */
1668
- addEmptyWitness() {
1669
- this.addWitness((0, import_utils9.concat)([import_configs6.ZeroBytes32, import_configs6.ZeroBytes32]));
1654
+ createWitness() {
1655
+ this.witnesses.push((0, import_utils9.concat)([import_configs6.ZeroBytes32, import_configs6.ZeroBytes32]));
1670
1656
  return this.witnesses.length - 1;
1671
1657
  }
1672
1658
  /**
@@ -1695,21 +1681,6 @@ var BaseTransactionRequest = class {
1695
1681
  }
1696
1682
  this.witnesses[index] = witness;
1697
1683
  }
1698
- /**
1699
- * Helper function to add an external signature to the transaction.
1700
- *
1701
- * @param account - The account/s to sign to the transaction.
1702
- * @returns The transaction with the signature witness added.
1703
- */
1704
- async addAccountWitnesses(account) {
1705
- const accounts = Array.isArray(account) ? account : [account];
1706
- await Promise.all(
1707
- accounts.map(async (acc) => {
1708
- this.addWitness(await acc.signTransaction(this));
1709
- })
1710
- );
1711
- return this;
1712
- }
1713
1684
  /**
1714
1685
  * Gets the coin inputs for a transaction.
1715
1686
  *
@@ -1775,7 +1746,7 @@ var BaseTransactionRequest = class {
1775
1746
  } else {
1776
1747
  witnessIndex = this.getCoinInputWitnessIndexByOwner(owner);
1777
1748
  if (typeof witnessIndex !== "number") {
1778
- witnessIndex = this.addEmptyWitness();
1749
+ witnessIndex = this.createWitness();
1779
1750
  }
1780
1751
  }
1781
1752
  const input = {
@@ -1809,7 +1780,7 @@ var BaseTransactionRequest = class {
1809
1780
  } else {
1810
1781
  witnessIndex = this.getCoinInputWitnessIndexByOwner(recipient);
1811
1782
  if (typeof witnessIndex !== "number") {
1812
- witnessIndex = this.addEmptyWitness();
1783
+ witnessIndex = this.createWitness();
1813
1784
  }
1814
1785
  }
1815
1786
  const input = {
@@ -3836,8 +3807,7 @@ var _Provider = class {
3836
3807
  async getTransactionCost(transactionRequestLike, forwardingQuantities = [], {
3837
3808
  estimateTxDependencies = true,
3838
3809
  estimatePredicates = true,
3839
- resourcesOwner,
3840
- signatureCallback
3810
+ resourcesOwner
3841
3811
  } = {}) {
3842
3812
  const txRequestClone = (0, import_ramda3.clone)(transactionRequestify(transactionRequestLike));
3843
3813
  const chainInfo = this.getChain();
@@ -3856,9 +3826,6 @@ var _Provider = class {
3856
3826
  }
3857
3827
  await this.estimatePredicates(txRequestClone);
3858
3828
  }
3859
- if (signatureCallback && isScriptTransaction) {
3860
- await signatureCallback(txRequestClone);
3861
- }
3862
3829
  const minGas = txRequestClone.calculateMinGas(chainInfo);
3863
3830
  const maxGas = txRequestClone.calculateMaxGas(chainInfo, minGas);
3864
3831
  let receipts = [];
@@ -4740,21 +4707,6 @@ var Account = class extends import_interfaces.AbstractAccount {
4740
4707
  }
4741
4708
  return this._connector.signMessage(this.address.toString(), message);
4742
4709
  }
4743
- /**
4744
- * Signs a transaction with the wallet's private key.
4745
- *
4746
- * @param transactionRequestLike - The transaction request to sign.
4747
- * @returns A promise that resolves to the signature of the transaction.
4748
- */
4749
- async signTransaction(transactionRequestLike) {
4750
- if (!this._connector) {
4751
- throw new import_errors15.FuelError(
4752
- import_errors15.ErrorCode.MISSING_CONNECTOR,
4753
- "A connector is required to sign transactions."
4754
- );
4755
- }
4756
- return this._connector.signTransaction(this.address.toString(), transactionRequestLike);
4757
- }
4758
4710
  /**
4759
4711
  * Sends a transaction to the network.
4760
4712
  *
@@ -5061,7 +5013,7 @@ var BaseWalletUnlocked = class extends Account {
5061
5013
  */
5062
5014
  async signTransaction(transactionRequestLike) {
5063
5015
  const transactionRequest = transactionRequestify(transactionRequestLike);
5064
- const chainId = this.provider.getChainId();
5016
+ const chainId = this.provider.getChain().consensusParameters.chainId.toNumber();
5065
5017
  const hashedTransaction = transactionRequest.getTransactionId(chainId);
5066
5018
  const signature = await this.signer().sign(hashedTransaction);
5067
5019
  return (0, import_utils30.hexlify)(signature);