@fuel-ts/account 0.0.0-rc-1815-20240322115843 → 0.0.0-rc-1356-20240322130951

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.

Files changed (37) hide show
  1. package/dist/account.d.ts +0 -7
  2. package/dist/account.d.ts.map +1 -1
  3. package/dist/connectors/fuel-connector.d.ts +0 -10
  4. package/dist/connectors/fuel-connector.d.ts.map +1 -1
  5. package/dist/index.global.js +12 -70
  6. package/dist/index.global.js.map +1 -1
  7. package/dist/index.js +107 -173
  8. package/dist/index.js.map +1 -1
  9. package/dist/index.mjs +6 -71
  10. package/dist/index.mjs.map +1 -1
  11. package/dist/providers/transaction-request/transaction-request.d.ts +1 -20
  12. package/dist/providers/transaction-request/transaction-request.d.ts.map +1 -1
  13. package/dist/providers/utils/auto-retry-fetch.d.ts.map +1 -1
  14. package/dist/providers/utils/index.d.ts +0 -1
  15. package/dist/providers/utils/index.d.ts.map +1 -1
  16. package/dist/test-utils/asset-id.d.ts +9 -0
  17. package/dist/test-utils/asset-id.d.ts.map +1 -0
  18. package/dist/test-utils/index.d.ts +4 -0
  19. package/dist/test-utils/index.d.ts.map +1 -1
  20. package/dist/test-utils/launchNode.d.ts +8 -1
  21. package/dist/test-utils/launchNode.d.ts.map +1 -1
  22. package/dist/test-utils/setup-test-provider-and-wallets.d.ts +33 -0
  23. package/dist/test-utils/setup-test-provider-and-wallets.d.ts.map +1 -0
  24. package/dist/test-utils/test-message.d.ts +28 -0
  25. package/dist/test-utils/test-message.d.ts.map +1 -0
  26. package/dist/test-utils/wallet-config.d.ts +49 -0
  27. package/dist/test-utils/wallet-config.d.ts.map +1 -0
  28. package/dist/test-utils.global.js +328 -70
  29. package/dist/test-utils.global.js.map +1 -1
  30. package/dist/test-utils.js +332 -164
  31. package/dist/test-utils.js.map +1 -1
  32. package/dist/test-utils.mjs +235 -71
  33. package/dist/test-utils.mjs.map +1 -1
  34. package/dist/wallet/base-wallet-unlocked.d.ts.map +1 -1
  35. package/package.json +17 -16
  36. package/dist/providers/utils/sleep.d.ts +0 -3
  37. package/dist/providers/utils/sleep.d.ts.map +0 -1
package/dist/index.mjs CHANGED
@@ -1553,15 +1553,6 @@ function normalizeJSON(root) {
1553
1553
  return normalize(clone(root));
1554
1554
  }
1555
1555
 
1556
- // src/providers/utils/sleep.ts
1557
- function sleep(time) {
1558
- return new Promise((resolve) => {
1559
- setTimeout(() => {
1560
- resolve(true);
1561
- }, time);
1562
- });
1563
- }
1564
-
1565
1556
  // src/providers/transaction-request/errors.ts
1566
1557
  var ChangeOutputCollisionError = class extends Error {
1567
1558
  name = "ChangeOutputCollisionError";
@@ -1703,27 +1694,13 @@ var BaseTransactionRequest = class {
1703
1694
  this.outputs.push(output);
1704
1695
  return this.outputs.length - 1;
1705
1696
  }
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
1697
  /**
1719
1698
  * @hidden
1720
1699
  *
1721
1700
  * Creates an empty witness without any side effects and returns the index
1722
- *
1723
- * @returns The index of the created witness.
1724
1701
  */
1725
- addEmptyWitness() {
1726
- this.addWitness(concat([ZeroBytes324, ZeroBytes324]));
1702
+ createWitness() {
1703
+ this.witnesses.push(concat([ZeroBytes324, ZeroBytes324]));
1727
1704
  return this.witnesses.length - 1;
1728
1705
  }
1729
1706
  /**
@@ -1752,21 +1729,6 @@ var BaseTransactionRequest = class {
1752
1729
  }
1753
1730
  this.witnesses[index] = witness;
1754
1731
  }
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
1732
  /**
1771
1733
  * Gets the coin inputs for a transaction.
1772
1734
  *
@@ -1832,7 +1794,7 @@ var BaseTransactionRequest = class {
1832
1794
  } else {
1833
1795
  witnessIndex = this.getCoinInputWitnessIndexByOwner(owner);
1834
1796
  if (typeof witnessIndex !== "number") {
1835
- witnessIndex = this.addEmptyWitness();
1797
+ witnessIndex = this.createWitness();
1836
1798
  }
1837
1799
  }
1838
1800
  const input = {
@@ -1866,7 +1828,7 @@ var BaseTransactionRequest = class {
1866
1828
  } else {
1867
1829
  witnessIndex = this.getCoinInputWitnessIndexByOwner(recipient);
1868
1830
  if (typeof witnessIndex !== "number") {
1869
- witnessIndex = this.addEmptyWitness();
1831
+ witnessIndex = this.createWitness();
1870
1832
  }
1871
1833
  }
1872
1834
  const input = {
@@ -3448,6 +3410,7 @@ function getDecodedLogs(receipts, abiInterface) {
3448
3410
  }
3449
3411
 
3450
3412
  // src/providers/utils/auto-retry-fetch.ts
3413
+ import { sleep } from "@fuel-ts/utils";
3451
3414
  function getWaitDelay(options, retryAttemptNum) {
3452
3415
  const duration = options.baseDelay ?? 150;
3453
3416
  switch (options.backoff) {
@@ -5019,21 +4982,6 @@ var Account = class extends AbstractAccount {
5019
4982
  }
5020
4983
  return this._connector.signMessage(this.address.toString(), message);
5021
4984
  }
5022
- /**
5023
- * Signs a transaction with the wallet's private key.
5024
- *
5025
- * @param transactionRequestLike - The transaction request to sign.
5026
- * @returns A promise that resolves to the signature of the transaction.
5027
- */
5028
- async signTransaction(transactionRequestLike) {
5029
- if (!this._connector) {
5030
- throw new FuelError14(
5031
- ErrorCode14.MISSING_CONNECTOR,
5032
- "A connector is required to sign transactions."
5033
- );
5034
- }
5035
- return this._connector.signTransaction(this.address.toString(), transactionRequestLike);
5036
- }
5037
4985
  /**
5038
4986
  * Sends a transaction to the network.
5039
4987
  *
@@ -5352,7 +5300,7 @@ var BaseWalletUnlocked = class extends Account {
5352
5300
  */
5353
5301
  async signTransaction(transactionRequestLike) {
5354
5302
  const transactionRequest = transactionRequestify(transactionRequestLike);
5355
- const chainId = this.provider.getChainId();
5303
+ const chainId = this.provider.getChain().consensusParameters.chainId.toNumber();
5356
5304
  const hashedTransaction = transactionRequest.getTransactionId(chainId);
5357
5305
  const signature = await this.signer().sign(hashedTransaction);
5358
5306
  return hexlify15(signature);
@@ -8899,18 +8847,6 @@ var FuelConnector = class extends EventEmitter2 {
8899
8847
  async signMessage(_address, _message) {
8900
8848
  throw new Error("Method not implemented.");
8901
8849
  }
8902
- /**
8903
- * Should start the sign transaction process and return
8904
- * the signed transaction.
8905
- *
8906
- * @param address - The address to sign the transaction
8907
- * @param transaction - The transaction to sign
8908
- *
8909
- * @returns Transaction signature
8910
- */
8911
- async signTransaction(_address, _transaction) {
8912
- throw new Error("Method not implemented.");
8913
- }
8914
8850
  /**
8915
8851
  * Should start the send transaction process and return
8916
8852
  * the transaction id submitted to the network.
@@ -9546,7 +9482,6 @@ export {
9546
9482
  resolveGasDependentCosts,
9547
9483
  resolveIconPaths,
9548
9484
  returnZeroScript,
9549
- sleep,
9550
9485
  transactionRequestify,
9551
9486
  urlJoin,
9552
9487
  withTimeout,