@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.js CHANGED
@@ -1839,27 +1839,13 @@ var BaseTransactionRequest = class {
1839
1839
  this.outputs.push(output);
1840
1840
  return this.outputs.length - 1;
1841
1841
  }
1842
- /**
1843
- * @hidden
1844
- *
1845
- * Pushes a witness to the list and returns the index
1846
- *
1847
- * @param signature - The signature to add to the witness.
1848
- * @returns The index of the created witness.
1849
- */
1850
- addWitness(signature) {
1851
- this.witnesses.push(signature);
1852
- return this.witnesses.length - 1;
1853
- }
1854
1842
  /**
1855
1843
  * @hidden
1856
1844
  *
1857
1845
  * Creates an empty witness without any side effects and returns the index
1858
- *
1859
- * @returns The index of the created witness.
1860
1846
  */
1861
- addEmptyWitness() {
1862
- this.addWitness((0, import_utils9.concat)([import_configs6.ZeroBytes32, import_configs6.ZeroBytes32]));
1847
+ createWitness() {
1848
+ this.witnesses.push((0, import_utils9.concat)([import_configs6.ZeroBytes32, import_configs6.ZeroBytes32]));
1863
1849
  return this.witnesses.length - 1;
1864
1850
  }
1865
1851
  /**
@@ -1888,21 +1874,6 @@ var BaseTransactionRequest = class {
1888
1874
  }
1889
1875
  this.witnesses[index] = witness;
1890
1876
  }
1891
- /**
1892
- * Helper function to add an external signature to the transaction.
1893
- *
1894
- * @param account - The account/s to sign to the transaction.
1895
- * @returns The transaction with the signature witness added.
1896
- */
1897
- async addAccountWitnesses(account) {
1898
- const accounts = Array.isArray(account) ? account : [account];
1899
- await Promise.all(
1900
- accounts.map(async (acc) => {
1901
- this.addWitness(await acc.signTransaction(this));
1902
- })
1903
- );
1904
- return this;
1905
- }
1906
1877
  /**
1907
1878
  * Gets the coin inputs for a transaction.
1908
1879
  *
@@ -1968,7 +1939,7 @@ var BaseTransactionRequest = class {
1968
1939
  } else {
1969
1940
  witnessIndex = this.getCoinInputWitnessIndexByOwner(owner);
1970
1941
  if (typeof witnessIndex !== "number") {
1971
- witnessIndex = this.addEmptyWitness();
1942
+ witnessIndex = this.createWitness();
1972
1943
  }
1973
1944
  }
1974
1945
  const input = {
@@ -2002,7 +1973,7 @@ var BaseTransactionRequest = class {
2002
1973
  } else {
2003
1974
  witnessIndex = this.getCoinInputWitnessIndexByOwner(recipient);
2004
1975
  if (typeof witnessIndex !== "number") {
2005
- witnessIndex = this.addEmptyWitness();
1976
+ witnessIndex = this.createWitness();
2006
1977
  }
2007
1978
  }
2008
1979
  const input = {
@@ -4089,8 +4060,7 @@ var _Provider = class {
4089
4060
  async getTransactionCost(transactionRequestLike, forwardingQuantities = [], {
4090
4061
  estimateTxDependencies = true,
4091
4062
  estimatePredicates = true,
4092
- resourcesOwner,
4093
- signatureCallback
4063
+ resourcesOwner
4094
4064
  } = {}) {
4095
4065
  const txRequestClone = (0, import_ramda3.clone)(transactionRequestify(transactionRequestLike));
4096
4066
  const chainInfo = this.getChain();
@@ -4109,9 +4079,6 @@ var _Provider = class {
4109
4079
  }
4110
4080
  await this.estimatePredicates(txRequestClone);
4111
4081
  }
4112
- if (signatureCallback && isScriptTransaction) {
4113
- await signatureCallback(txRequestClone);
4114
- }
4115
4082
  const minGas = txRequestClone.calculateMinGas(chainInfo);
4116
4083
  const maxGas = txRequestClone.calculateMaxGas(chainInfo, minGas);
4117
4084
  let receipts = [];
@@ -5159,21 +5126,6 @@ var Account = class extends import_interfaces.AbstractAccount {
5159
5126
  }
5160
5127
  return this._connector.signMessage(this.address.toString(), message);
5161
5128
  }
5162
- /**
5163
- * Signs a transaction with the wallet's private key.
5164
- *
5165
- * @param transactionRequestLike - The transaction request to sign.
5166
- * @returns A promise that resolves to the signature of the transaction.
5167
- */
5168
- async signTransaction(transactionRequestLike) {
5169
- if (!this._connector) {
5170
- throw new import_errors15.FuelError(
5171
- import_errors15.ErrorCode.MISSING_CONNECTOR,
5172
- "A connector is required to sign transactions."
5173
- );
5174
- }
5175
- return this._connector.signTransaction(this.address.toString(), transactionRequestLike);
5176
- }
5177
5129
  /**
5178
5130
  * Sends a transaction to the network.
5179
5131
  *
@@ -5484,7 +5436,7 @@ var BaseWalletUnlocked = class extends Account {
5484
5436
  */
5485
5437
  async signTransaction(transactionRequestLike) {
5486
5438
  const transactionRequest = transactionRequestify(transactionRequestLike);
5487
- const chainId = this.provider.getChainId();
5439
+ const chainId = this.provider.getChain().consensusParameters.chainId.toNumber();
5488
5440
  const hashedTransaction = transactionRequest.getTransactionId(chainId);
5489
5441
  const signature = await this.signer().sign(hashedTransaction);
5490
5442
  return (0, import_utils30.hexlify)(signature);
@@ -9025,18 +8977,6 @@ var FuelConnector = class extends import_events2.EventEmitter {
9025
8977
  async signMessage(_address, _message) {
9026
8978
  throw new Error("Method not implemented.");
9027
8979
  }
9028
- /**
9029
- * Should start the sign transaction process and return
9030
- * the signed transaction.
9031
- *
9032
- * @param address - The address to sign the transaction
9033
- * @param transaction - The transaction to sign
9034
- *
9035
- * @returns Transaction signature
9036
- */
9037
- async signTransaction(_address, _transaction) {
9038
- throw new Error("Method not implemented.");
9039
- }
9040
8980
  /**
9041
8981
  * Should start the send transaction process and return
9042
8982
  * the transaction id submitted to the network.