@fuel-ts/account 0.0.0-rc-1889-20240322122653 → 0.0.0-rc-1815-20240322131329

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 (212) hide show
  1. package/dist/account.d.ts +184 -0
  2. package/dist/account.d.ts.map +1 -0
  3. package/dist/configs.d.ts +2 -3
  4. package/dist/configs.d.ts.map +1 -0
  5. package/dist/connectors/fuel-connector.d.ts +198 -0
  6. package/dist/connectors/fuel-connector.d.ts.map +1 -0
  7. package/dist/connectors/fuel.d.ts +133 -0
  8. package/dist/connectors/fuel.d.ts.map +1 -0
  9. package/dist/connectors/index.d.ts +5 -0
  10. package/dist/connectors/index.d.ts.map +1 -0
  11. package/dist/connectors/types/connector-metadata.d.ts +12 -0
  12. package/dist/connectors/types/connector-metadata.d.ts.map +1 -0
  13. package/dist/connectors/types/connector-types.d.ts +34 -0
  14. package/dist/connectors/types/connector-types.d.ts.map +1 -0
  15. package/dist/connectors/types/data-type.d.ts +34 -0
  16. package/dist/connectors/types/data-type.d.ts.map +1 -0
  17. package/dist/connectors/types/events.d.ts +111 -0
  18. package/dist/connectors/types/events.d.ts.map +1 -0
  19. package/dist/connectors/types/index.d.ts +7 -0
  20. package/dist/connectors/types/index.d.ts.map +1 -0
  21. package/dist/connectors/types/local-storage.d.ts +11 -0
  22. package/dist/connectors/types/local-storage.d.ts.map +1 -0
  23. package/dist/connectors/types/target-object.d.ts +14 -0
  24. package/dist/connectors/types/target-object.d.ts.map +1 -0
  25. package/dist/connectors/utils/cache.d.ts +14 -0
  26. package/dist/connectors/utils/cache.d.ts.map +1 -0
  27. package/dist/connectors/utils/dispatch-fuel-connector-event.d.ts +7 -0
  28. package/dist/connectors/utils/dispatch-fuel-connector-event.d.ts.map +1 -0
  29. package/dist/connectors/utils/index.d.ts +4 -0
  30. package/dist/connectors/utils/index.d.ts.map +1 -0
  31. package/dist/connectors/utils/promises.d.ts +8 -0
  32. package/dist/connectors/utils/promises.d.ts.map +1 -0
  33. package/dist/hdwallet/hdwallet.d.ts +58 -0
  34. package/dist/hdwallet/hdwallet.d.ts.map +1 -0
  35. package/dist/hdwallet/index.d.ts +2 -0
  36. package/dist/hdwallet/index.d.ts.map +1 -0
  37. package/dist/index.d.ts +13 -904
  38. package/dist/index.d.ts.map +1 -0
  39. package/dist/index.global.js +520 -391
  40. package/dist/index.global.js.map +1 -1
  41. package/dist/index.js +314 -208
  42. package/dist/index.js.map +1 -1
  43. package/dist/index.mjs +316 -208
  44. package/dist/index.mjs.map +1 -1
  45. package/dist/mnemonic/index.d.ts +3 -0
  46. package/dist/mnemonic/index.d.ts.map +1 -0
  47. package/dist/mnemonic/mnemonic.d.ts +85 -0
  48. package/dist/mnemonic/mnemonic.d.ts.map +1 -0
  49. package/dist/mnemonic/utils.d.ts +8 -0
  50. package/dist/mnemonic/utils.d.ts.map +1 -0
  51. package/dist/predicate/index.d.ts +3 -0
  52. package/dist/predicate/index.d.ts.map +1 -0
  53. package/dist/predicate/predicate.d.ts +94 -0
  54. package/dist/predicate/predicate.d.ts.map +1 -0
  55. package/dist/predicate/utils/getPredicateRoot.d.ts +12 -0
  56. package/dist/predicate/utils/getPredicateRoot.d.ts.map +1 -0
  57. package/dist/predicate/utils/index.d.ts +2 -0
  58. package/dist/predicate/utils/index.d.ts.map +1 -0
  59. package/dist/providers/__generated__/operations.d.ts +3477 -0
  60. package/dist/providers/__generated__/operations.d.ts.map +1 -0
  61. package/dist/providers/assets/index.d.ts +5 -0
  62. package/dist/providers/assets/index.d.ts.map +1 -0
  63. package/dist/providers/assets/types.d.ts +36 -0
  64. package/dist/providers/assets/types.d.ts.map +1 -0
  65. package/dist/providers/assets/utils/index.d.ts +4 -0
  66. package/dist/providers/assets/utils/index.d.ts.map +1 -0
  67. package/dist/providers/assets/utils/network.d.ts +33 -0
  68. package/dist/providers/assets/utils/network.d.ts.map +1 -0
  69. package/dist/providers/assets/utils/resolveIconPaths.d.ts +14 -0
  70. package/dist/providers/assets/utils/resolveIconPaths.d.ts.map +1 -0
  71. package/dist/providers/assets/utils/url.d.ts +2 -0
  72. package/dist/providers/assets/utils/url.d.ts.map +1 -0
  73. package/dist/providers/chains.d.ts +11 -0
  74. package/dist/providers/chains.d.ts.map +1 -0
  75. package/dist/providers/coin-quantity.d.ts +21 -0
  76. package/dist/providers/coin-quantity.d.ts.map +1 -0
  77. package/dist/providers/coin.d.ts +15 -0
  78. package/dist/providers/coin.d.ts.map +1 -0
  79. package/dist/providers/fuel-graphql-subscriber.d.ts +23 -0
  80. package/dist/providers/fuel-graphql-subscriber.d.ts.map +1 -0
  81. package/dist/providers/index.d.ts +13 -0
  82. package/dist/providers/index.d.ts.map +1 -0
  83. package/dist/providers/memory-cache.d.ts +11 -0
  84. package/dist/providers/memory-cache.d.ts.map +1 -0
  85. package/dist/providers/message.d.ts +60 -0
  86. package/dist/providers/message.d.ts.map +1 -0
  87. package/dist/providers/provider.d.ts +523 -0
  88. package/dist/providers/provider.d.ts.map +1 -0
  89. package/dist/providers/resource.d.ts +37 -0
  90. package/dist/providers/resource.d.ts.map +1 -0
  91. package/dist/providers/transaction-request/create-transaction-request.d.ts +73 -0
  92. package/dist/providers/transaction-request/create-transaction-request.d.ts.map +1 -0
  93. package/dist/providers/transaction-request/errors.d.ts +25 -0
  94. package/dist/providers/transaction-request/errors.d.ts.map +1 -0
  95. package/dist/providers/transaction-request/hash-transaction.d.ts +9 -0
  96. package/dist/providers/transaction-request/hash-transaction.d.ts.map +1 -0
  97. package/dist/providers/transaction-request/index.d.ts +10 -0
  98. package/dist/providers/transaction-request/index.d.ts.map +1 -0
  99. package/dist/providers/transaction-request/input.d.ts +59 -0
  100. package/dist/providers/transaction-request/input.d.ts.map +1 -0
  101. package/dist/providers/transaction-request/output.d.ts +39 -0
  102. package/dist/providers/transaction-request/output.d.ts.map +1 -0
  103. package/dist/providers/transaction-request/script-transaction-request.d.ts +106 -0
  104. package/dist/providers/transaction-request/script-transaction-request.d.ts.map +1 -0
  105. package/dist/providers/transaction-request/scripts.d.ts +6 -0
  106. package/dist/providers/transaction-request/scripts.d.ts.map +1 -0
  107. package/dist/providers/transaction-request/storage-slot.d.ts +10 -0
  108. package/dist/providers/transaction-request/storage-slot.d.ts.map +1 -0
  109. package/dist/providers/transaction-request/transaction-request.d.ts +278 -0
  110. package/dist/providers/transaction-request/transaction-request.d.ts.map +1 -0
  111. package/dist/providers/transaction-request/types.d.ts +10 -0
  112. package/dist/providers/transaction-request/types.d.ts.map +1 -0
  113. package/dist/providers/transaction-request/utils.d.ts +4 -0
  114. package/dist/providers/transaction-request/utils.d.ts.map +1 -0
  115. package/dist/providers/transaction-request/witness.d.ts +5 -0
  116. package/dist/providers/transaction-request/witness.d.ts.map +1 -0
  117. package/dist/providers/transaction-response/getDecodedLogs.d.ts +5 -0
  118. package/dist/providers/transaction-response/getDecodedLogs.d.ts.map +1 -0
  119. package/dist/providers/transaction-response/index.d.ts +3 -0
  120. package/dist/providers/transaction-response/index.d.ts.map +1 -0
  121. package/dist/providers/transaction-response/transaction-response.d.ts +106 -0
  122. package/dist/providers/transaction-response/transaction-response.d.ts.map +1 -0
  123. package/dist/providers/transaction-summary/assemble-transaction-summary.d.ts +20 -0
  124. package/dist/providers/transaction-summary/assemble-transaction-summary.d.ts.map +1 -0
  125. package/dist/providers/transaction-summary/calculate-transaction-fee.d.ts +21 -0
  126. package/dist/providers/transaction-summary/calculate-transaction-fee.d.ts.map +1 -0
  127. package/dist/providers/transaction-summary/call.d.ts +18 -0
  128. package/dist/providers/transaction-summary/call.d.ts.map +1 -0
  129. package/dist/providers/transaction-summary/get-transaction-summary.d.ts +31 -0
  130. package/dist/providers/transaction-summary/get-transaction-summary.d.ts.map +1 -0
  131. package/dist/providers/transaction-summary/index.d.ts +10 -0
  132. package/dist/providers/transaction-summary/index.d.ts.map +1 -0
  133. package/dist/providers/transaction-summary/input.d.ts +21 -0
  134. package/dist/providers/transaction-summary/input.d.ts.map +1 -0
  135. package/dist/providers/transaction-summary/operations.d.ts +40 -0
  136. package/dist/providers/transaction-summary/operations.d.ts.map +1 -0
  137. package/dist/providers/transaction-summary/output.d.ts +15 -0
  138. package/dist/providers/transaction-summary/output.d.ts.map +1 -0
  139. package/dist/providers/transaction-summary/receipt.d.ts +7 -0
  140. package/dist/providers/transaction-summary/receipt.d.ts.map +1 -0
  141. package/dist/providers/transaction-summary/status.d.ts +9 -0
  142. package/dist/providers/transaction-summary/status.d.ts.map +1 -0
  143. package/dist/providers/transaction-summary/types.d.ts +146 -0
  144. package/dist/providers/transaction-summary/types.d.ts.map +1 -0
  145. package/dist/providers/utils/auto-retry-fetch.d.ts +36 -0
  146. package/dist/providers/utils/auto-retry-fetch.d.ts.map +1 -0
  147. package/dist/providers/utils/block-explorer.d.ts +14 -0
  148. package/dist/providers/utils/block-explorer.d.ts.map +1 -0
  149. package/dist/providers/utils/gas.d.ts +38 -0
  150. package/dist/providers/utils/gas.d.ts.map +1 -0
  151. package/dist/providers/utils/index.d.ts +6 -0
  152. package/dist/providers/utils/index.d.ts.map +1 -0
  153. package/dist/providers/utils/json.d.ts +7 -0
  154. package/dist/providers/utils/json.d.ts.map +1 -0
  155. package/dist/providers/utils/merge-quantities.d.ts +3 -0
  156. package/dist/providers/utils/merge-quantities.d.ts.map +1 -0
  157. package/dist/providers/utils/receipts.d.ts +10 -0
  158. package/dist/providers/utils/receipts.d.ts.map +1 -0
  159. package/dist/providers/utils/sleep.d.ts +3 -0
  160. package/dist/providers/utils/sleep.d.ts.map +1 -0
  161. package/dist/signer/index.d.ts +2 -0
  162. package/dist/signer/index.d.ts.map +1 -0
  163. package/dist/signer/signer.d.ts +64 -0
  164. package/dist/signer/signer.d.ts.map +1 -0
  165. package/dist/test-utils/generateTestWallet.d.ts +4 -0
  166. package/dist/test-utils/generateTestWallet.d.ts.map +1 -0
  167. package/dist/test-utils/index.d.ts +4 -0
  168. package/dist/test-utils/index.d.ts.map +1 -0
  169. package/dist/{test-utils.d.ts → test-utils/launchNode.d.ts} +12 -24
  170. package/dist/test-utils/launchNode.d.ts.map +1 -0
  171. package/dist/test-utils/seedTestWallet.d.ts +4 -0
  172. package/dist/test-utils/seedTestWallet.d.ts.map +1 -0
  173. package/dist/test-utils.global.js +386 -295
  174. package/dist/test-utils.global.js.map +1 -1
  175. package/dist/test-utils.js +179 -108
  176. package/dist/test-utils.js.map +1 -1
  177. package/dist/test-utils.mjs +181 -108
  178. package/dist/test-utils.mjs.map +1 -1
  179. package/dist/utils/formatTransferToContractScriptData.d.ts +14 -0
  180. package/dist/utils/formatTransferToContractScriptData.d.ts.map +1 -0
  181. package/dist/wallet/base-wallet-unlocked.d.ts +73 -0
  182. package/dist/wallet/base-wallet-unlocked.d.ts.map +1 -0
  183. package/dist/wallet/index.d.ts +4 -0
  184. package/dist/wallet/index.d.ts.map +1 -0
  185. package/dist/wallet/keystore-wallet.d.ts +38 -0
  186. package/dist/wallet/keystore-wallet.d.ts.map +1 -0
  187. package/dist/wallet/wallet.d.ts +68 -0
  188. package/dist/wallet/wallet.d.ts.map +1 -0
  189. package/dist/wallet/wallets.d.ts +76 -0
  190. package/dist/wallet/wallets.d.ts.map +1 -0
  191. package/dist/wallet-manager/index.d.ts +6 -0
  192. package/dist/wallet-manager/index.d.ts.map +1 -0
  193. package/dist/wallet-manager/storages/memory-storage.d.ts +9 -0
  194. package/dist/wallet-manager/storages/memory-storage.d.ts.map +1 -0
  195. package/dist/wallet-manager/types.d.ts +42 -0
  196. package/dist/wallet-manager/types.d.ts.map +1 -0
  197. package/dist/wallet-manager/vaults/mnemonic-vault.d.ts +29 -0
  198. package/dist/wallet-manager/vaults/mnemonic-vault.d.ts.map +1 -0
  199. package/dist/wallet-manager/vaults/privatekey-vault.d.ts +29 -0
  200. package/dist/wallet-manager/vaults/privatekey-vault.d.ts.map +1 -0
  201. package/dist/wallet-manager/wallet-manager.d.ts +104 -0
  202. package/dist/wallet-manager/wallet-manager.d.ts.map +1 -0
  203. package/dist/wordlists/index.d.ts +5 -0
  204. package/dist/wordlists/index.d.ts.map +1 -0
  205. package/dist/wordlists/words/english.d.ts +2 -0
  206. package/dist/wordlists/words/english.d.ts.map +1 -0
  207. package/package.json +25 -21
  208. package/dist/account-E9nGNf5X.d.mts +0 -3837
  209. package/dist/account-E9nGNf5X.d.ts +0 -3837
  210. package/dist/configs.d.mts +0 -3
  211. package/dist/index.d.mts +0 -904
  212. package/dist/test-utils.d.mts +0 -66
@@ -5,6 +5,7 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
6
  var __getProtoOf = Object.getPrototypeOf;
7
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
9
  var __export = (target, all) => {
9
10
  for (var name in all)
10
11
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -26,6 +27,23 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
26
27
  mod
27
28
  ));
28
29
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
30
+ var __publicField = (obj, key, value) => {
31
+ __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
32
+ return value;
33
+ };
34
+ var __accessCheck = (obj, member, msg) => {
35
+ if (!member.has(obj))
36
+ throw TypeError("Cannot " + msg);
37
+ };
38
+ var __privateAdd = (obj, member, value) => {
39
+ if (member.has(obj))
40
+ throw TypeError("Cannot add the same private member more than once");
41
+ member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
42
+ };
43
+ var __privateMethod = (obj, member, method) => {
44
+ __accessCheck(obj, member, "access private method");
45
+ return method;
46
+ };
29
47
 
30
48
  // src/test-utils/index.ts
31
49
  var test_utils_exports = {};
@@ -906,12 +924,11 @@ function getSdk(requester) {
906
924
  // src/providers/fuel-graphql-subscriber.ts
907
925
  var import_errors = require("@fuel-ts/errors");
908
926
  var import_graphql = require("graphql");
909
- var FuelGraphqlSubscriber = class _FuelGraphqlSubscriber {
927
+ var _FuelGraphqlSubscriber = class {
910
928
  constructor(options) {
911
929
  this.options = options;
912
930
  }
913
931
  stream;
914
- static textDecoder = new TextDecoder();
915
932
  async setStream() {
916
933
  const { url, query, variables, fetchFn } = this.options;
917
934
  const response = await fetchFn(`${url}-sub`, {
@@ -971,6 +988,8 @@ var FuelGraphqlSubscriber = class _FuelGraphqlSubscriber {
971
988
  return this;
972
989
  }
973
990
  };
991
+ var FuelGraphqlSubscriber = _FuelGraphqlSubscriber;
992
+ __publicField(FuelGraphqlSubscriber, "textDecoder", new TextDecoder());
974
993
 
975
994
  // src/providers/memory-cache.ts
976
995
  var import_errors2 = require("@fuel-ts/errors");
@@ -1519,7 +1538,7 @@ var witnessify = (value) => {
1519
1538
  };
1520
1539
 
1521
1540
  // src/providers/transaction-request/transaction-request.ts
1522
- var BaseTransactionRequest = class _BaseTransactionRequest {
1541
+ var BaseTransactionRequest = class {
1523
1542
  /** Gas price for transaction */
1524
1543
  gasPrice;
1525
1544
  /** Block until which tx cannot be included */
@@ -1589,7 +1608,7 @@ var BaseTransactionRequest = class _BaseTransactionRequest {
1589
1608
  const inputs = this.inputs?.map(inputify) ?? [];
1590
1609
  const outputs = this.outputs?.map(outputify) ?? [];
1591
1610
  const witnesses = this.witnesses?.map(witnessify) ?? [];
1592
- const { policyTypes, policies } = _BaseTransactionRequest.getPolicyMeta(this);
1611
+ const { policyTypes, policies } = BaseTransactionRequest.getPolicyMeta(this);
1593
1612
  return {
1594
1613
  policyTypes,
1595
1614
  inputs,
@@ -1627,13 +1646,27 @@ var BaseTransactionRequest = class _BaseTransactionRequest {
1627
1646
  this.outputs.push(output);
1628
1647
  return this.outputs.length - 1;
1629
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
+ }
1630
1661
  /**
1631
1662
  * @hidden
1632
1663
  *
1633
1664
  * Creates an empty witness without any side effects and returns the index
1665
+ *
1666
+ * @returns The index of the created witness.
1634
1667
  */
1635
- createWitness() {
1636
- this.witnesses.push((0, import_utils9.concat)([import_configs6.ZeroBytes32, import_configs6.ZeroBytes32]));
1668
+ addEmptyWitness() {
1669
+ this.addWitness((0, import_utils9.concat)([import_configs6.ZeroBytes32, import_configs6.ZeroBytes32]));
1637
1670
  return this.witnesses.length - 1;
1638
1671
  }
1639
1672
  /**
@@ -1662,6 +1695,21 @@ var BaseTransactionRequest = class _BaseTransactionRequest {
1662
1695
  }
1663
1696
  this.witnesses[index] = witness;
1664
1697
  }
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
+ }
1665
1713
  /**
1666
1714
  * Gets the coin inputs for a transaction.
1667
1715
  *
@@ -1727,7 +1775,7 @@ var BaseTransactionRequest = class _BaseTransactionRequest {
1727
1775
  } else {
1728
1776
  witnessIndex = this.getCoinInputWitnessIndexByOwner(owner);
1729
1777
  if (typeof witnessIndex !== "number") {
1730
- witnessIndex = this.createWitness();
1778
+ witnessIndex = this.addEmptyWitness();
1731
1779
  }
1732
1780
  }
1733
1781
  const input = {
@@ -1761,7 +1809,7 @@ var BaseTransactionRequest = class _BaseTransactionRequest {
1761
1809
  } else {
1762
1810
  witnessIndex = this.getCoinInputWitnessIndexByOwner(recipient);
1763
1811
  if (typeof witnessIndex !== "number") {
1764
- witnessIndex = this.createWitness();
1812
+ witnessIndex = this.addEmptyWitness();
1765
1813
  }
1766
1814
  }
1767
1815
  const input = {
@@ -3127,7 +3175,7 @@ function assembleTransactionSummary(params) {
3127
3175
  }
3128
3176
 
3129
3177
  // src/providers/transaction-response/transaction-response.ts
3130
- var TransactionResponse = class _TransactionResponse {
3178
+ var TransactionResponse = class {
3131
3179
  /** Transaction ID */
3132
3180
  id;
3133
3181
  /** Current provider */
@@ -3155,7 +3203,7 @@ var TransactionResponse = class _TransactionResponse {
3155
3203
  * @param provider - The provider.
3156
3204
  */
3157
3205
  static async create(id, provider) {
3158
- const response = new _TransactionResponse(id, provider);
3206
+ const response = new TransactionResponse(id, provider);
3159
3207
  await response.fetch();
3160
3208
  return response;
3161
3209
  }
@@ -3370,7 +3418,8 @@ var processGqlChain = (chain) => {
3370
3418
  }
3371
3419
  };
3372
3420
  };
3373
- var Provider = class _Provider {
3421
+ var _cacheInputs, cacheInputs_fn;
3422
+ var _Provider = class {
3374
3423
  /**
3375
3424
  * Constructor to initialize a Provider.
3376
3425
  *
@@ -3381,25 +3430,27 @@ var Provider = class _Provider {
3381
3430
  */
3382
3431
  constructor(url, options = {}) {
3383
3432
  this.url = url;
3433
+ /**
3434
+ * @hidden
3435
+ */
3436
+ __privateAdd(this, _cacheInputs);
3437
+ __publicField(this, "operations");
3438
+ __publicField(this, "cache");
3439
+ __publicField(this, "options", {
3440
+ timeout: void 0,
3441
+ cacheUtxo: void 0,
3442
+ fetch: void 0,
3443
+ retryOptions: void 0
3444
+ });
3384
3445
  this.options = { ...this.options, ...options };
3385
3446
  this.url = url;
3386
3447
  this.operations = this.createOperations();
3387
3448
  this.cache = options.cacheUtxo ? new MemoryCache(options.cacheUtxo) : void 0;
3388
3449
  }
3389
- operations;
3390
- cache;
3391
3450
  static clearChainAndNodeCaches() {
3392
3451
  _Provider.nodeInfoCache = {};
3393
3452
  _Provider.chainInfoCache = {};
3394
3453
  }
3395
- static chainInfoCache = {};
3396
- static nodeInfoCache = {};
3397
- options = {
3398
- timeout: void 0,
3399
- cacheUtxo: void 0,
3400
- fetch: void 0,
3401
- retryOptions: void 0
3402
- };
3403
3454
  static getFetchFn(options) {
3404
3455
  const { retryOptions, timeout } = options;
3405
3456
  return autoRetryFetch(async (...args) => {
@@ -3596,19 +3647,6 @@ var Provider = class _Provider {
3596
3647
  } = this.getChain();
3597
3648
  return chainId.toNumber();
3598
3649
  }
3599
- /**
3600
- * @hidden
3601
- */
3602
- #cacheInputs(inputs) {
3603
- if (!this.cache) {
3604
- return;
3605
- }
3606
- inputs.forEach((input) => {
3607
- if (input.type === import_transactions17.InputType.Coin) {
3608
- this.cache?.set(input.id);
3609
- }
3610
- });
3611
- }
3612
3650
  /**
3613
3651
  * Submits a transaction to the chain to be executed.
3614
3652
  *
@@ -3621,7 +3659,7 @@ var Provider = class _Provider {
3621
3659
  // #region Provider-sendTransaction
3622
3660
  async sendTransaction(transactionRequestLike, { estimateTxDependencies = true, awaitExecution = false } = {}) {
3623
3661
  const transactionRequest = transactionRequestify(transactionRequestLike);
3624
- this.#cacheInputs(transactionRequest.inputs);
3662
+ __privateMethod(this, _cacheInputs, cacheInputs_fn).call(this, transactionRequest.inputs);
3625
3663
  if (estimateTxDependencies) {
3626
3664
  await this.estimateTxDependencies(transactionRequest);
3627
3665
  }
@@ -3798,7 +3836,8 @@ var Provider = class _Provider {
3798
3836
  async getTransactionCost(transactionRequestLike, forwardingQuantities = [], {
3799
3837
  estimateTxDependencies = true,
3800
3838
  estimatePredicates = true,
3801
- resourcesOwner
3839
+ resourcesOwner,
3840
+ signatureCallback
3802
3841
  } = {}) {
3803
3842
  const txRequestClone = (0, import_ramda3.clone)(transactionRequestify(transactionRequestLike));
3804
3843
  const chainInfo = this.getChain();
@@ -3817,6 +3856,9 @@ var Provider = class _Provider {
3817
3856
  }
3818
3857
  await this.estimatePredicates(txRequestClone);
3819
3858
  }
3859
+ if (signatureCallback && isScriptTransaction) {
3860
+ await signatureCallback(txRequestClone);
3861
+ }
3820
3862
  const minGas = txRequestClone.calculateMinGas(chainInfo);
3821
3863
  const maxGas = txRequestClone.calculateMaxGas(chainInfo, minGas);
3822
3864
  let receipts = [];
@@ -4246,6 +4288,20 @@ var Provider = class _Provider {
4246
4288
  return new TransactionResponse(transactionId, this);
4247
4289
  }
4248
4290
  };
4291
+ var Provider = _Provider;
4292
+ _cacheInputs = new WeakSet();
4293
+ cacheInputs_fn = function(inputs) {
4294
+ if (!this.cache) {
4295
+ return;
4296
+ }
4297
+ inputs.forEach((input) => {
4298
+ if (input.type === import_transactions17.InputType.Coin) {
4299
+ this.cache?.set(input.id);
4300
+ }
4301
+ });
4302
+ };
4303
+ __publicField(Provider, "chainInfoCache", {});
4304
+ __publicField(Provider, "nodeInfoCache", {});
4249
4305
 
4250
4306
  // src/providers/transaction-summary/get-transaction-summary.ts
4251
4307
  var import_errors14 = require("@fuel-ts/errors");
@@ -4684,6 +4740,21 @@ var Account = class extends import_interfaces.AbstractAccount {
4684
4740
  }
4685
4741
  return this._connector.signMessage(this.address.toString(), message);
4686
4742
  }
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
+ }
4687
4758
  /**
4688
4759
  * Sends a transaction to the network.
4689
4760
  *
@@ -4746,7 +4817,7 @@ var import_hasher2 = require("@fuel-ts/hasher");
4746
4817
  var import_math18 = require("@fuel-ts/math");
4747
4818
  var import_utils28 = require("@fuel-ts/utils");
4748
4819
  var import_secp256k1 = require("@noble/curves/secp256k1");
4749
- var Signer = class _Signer {
4820
+ var Signer = class {
4750
4821
  address;
4751
4822
  publicKey;
4752
4823
  compressedPublicKey;
@@ -4825,7 +4896,7 @@ var Signer = class _Signer {
4825
4896
  * @returns Address from signature
4826
4897
  */
4827
4898
  static recoverAddress(data, signature) {
4828
- return import_address5.Address.fromPublicKey(_Signer.recoverPublicKey(data, signature));
4899
+ return import_address5.Address.fromPublicKey(Signer.recoverPublicKey(data, signature));
4829
4900
  }
4830
4901
  /**
4831
4902
  * Generate a random privateKey
@@ -4941,10 +5012,6 @@ async function decryptKeystoreWallet(jsonWallet, password) {
4941
5012
 
4942
5013
  // src/wallet/base-wallet-unlocked.ts
4943
5014
  var BaseWalletUnlocked = class extends Account {
4944
- /**
4945
- * Default HDWallet path.
4946
- */
4947
- static defaultPath = "m/44'/1179993420'/0'/0/0";
4948
5015
  /**
4949
5016
  * A function that returns the wallet's signer.
4950
5017
  */
@@ -4994,7 +5061,7 @@ var BaseWalletUnlocked = class extends Account {
4994
5061
  */
4995
5062
  async signTransaction(transactionRequestLike) {
4996
5063
  const transactionRequest = transactionRequestify(transactionRequestLike);
4997
- const chainId = this.provider.getChain().consensusParameters.chainId.toNumber();
5064
+ const chainId = this.provider.getChainId();
4998
5065
  const hashedTransaction = transactionRequest.getTransactionId(chainId);
4999
5066
  const signature = await this.signer().sign(hashedTransaction);
5000
5067
  return (0, import_utils30.hexlify)(signature);
@@ -5050,6 +5117,10 @@ var BaseWalletUnlocked = class extends Account {
5050
5117
  return encryptKeystoreWallet(this.privateKey, this.address, password);
5051
5118
  }
5052
5119
  };
5120
+ /**
5121
+ * Default HDWallet path.
5122
+ */
5123
+ __publicField(BaseWalletUnlocked, "defaultPath", "m/44'/1179993420'/0'/0/0");
5053
5124
 
5054
5125
  // src/hdwallet/hdwallet.ts
5055
5126
  var import_errors19 = require("@fuel-ts/errors");
@@ -7253,7 +7324,7 @@ function assertMnemonic(words) {
7253
7324
  throw new import_errors18.FuelError(import_errors18.ErrorCode.INVALID_MNEMONIC, errorMsg);
7254
7325
  }
7255
7326
  }
7256
- var Mnemonic = class _Mnemonic {
7327
+ var Mnemonic = class {
7257
7328
  wordlist;
7258
7329
  /**
7259
7330
  *
@@ -7270,7 +7341,7 @@ var Mnemonic = class _Mnemonic {
7270
7341
  * @returns Entropy hash
7271
7342
  */
7272
7343
  mnemonicToEntropy(phrase) {
7273
- return _Mnemonic.mnemonicToEntropy(phrase, this.wordlist);
7344
+ return Mnemonic.mnemonicToEntropy(phrase, this.wordlist);
7274
7345
  }
7275
7346
  /**
7276
7347
  *
@@ -7278,7 +7349,7 @@ var Mnemonic = class _Mnemonic {
7278
7349
  * @returns Mnemonic phrase
7279
7350
  */
7280
7351
  entropyToMnemonic(entropy) {
7281
- return _Mnemonic.entropyToMnemonic(entropy, this.wordlist);
7352
+ return Mnemonic.entropyToMnemonic(entropy, this.wordlist);
7282
7353
  }
7283
7354
  /**
7284
7355
  *
@@ -7319,8 +7390,8 @@ var Mnemonic = class _Mnemonic {
7319
7390
  * @returns 64-byte array contains privateKey and chainCode as described on BIP39
7320
7391
  */
7321
7392
  static mnemonicToMasterKeys(phrase, passphrase = "") {
7322
- const seed = _Mnemonic.mnemonicToSeed(phrase, passphrase);
7323
- return _Mnemonic.masterKeysFromSeed(seed);
7393
+ const seed = Mnemonic.mnemonicToSeed(phrase, passphrase);
7394
+ return Mnemonic.masterKeysFromSeed(seed);
7324
7395
  }
7325
7396
  /**
7326
7397
  * Validates if given mnemonic is valid
@@ -7336,7 +7407,7 @@ var Mnemonic = class _Mnemonic {
7336
7407
  return false;
7337
7408
  }
7338
7409
  while (i < words.length) {
7339
- if (_Mnemonic.binarySearch(words[i]) === false) {
7410
+ if (Mnemonic.binarySearch(words[i]) === false) {
7340
7411
  return false;
7341
7412
  }
7342
7413
  i += 1;
@@ -7383,7 +7454,7 @@ var Mnemonic = class _Mnemonic {
7383
7454
  * @returns BIP-32 extended private key
7384
7455
  */
7385
7456
  static seedToExtendedKey(seed, testnet = false) {
7386
- const masterKey = _Mnemonic.masterKeysFromSeed(seed);
7457
+ const masterKey = Mnemonic.masterKeysFromSeed(seed);
7387
7458
  const prefix = (0, import_utils32.arrayify)(testnet ? TestnetPRV : MainnetPRV);
7388
7459
  const depth = "0x00";
7389
7460
  const fingerprint = "0x00000000";
@@ -7415,7 +7486,7 @@ var Mnemonic = class _Mnemonic {
7415
7486
  */
7416
7487
  static generate(size = 32, extraEntropy = "") {
7417
7488
  const entropy = extraEntropy ? (0, import_hasher5.sha256)((0, import_utils32.concat)([(0, import_crypto3.randomBytes)(size), (0, import_utils32.arrayify)(extraEntropy)])) : (0, import_crypto3.randomBytes)(size);
7418
- return _Mnemonic.entropyToMnemonic(entropy);
7489
+ return Mnemonic.entropyToMnemonic(entropy);
7419
7490
  }
7420
7491
  };
7421
7492
  var mnemonic_default = Mnemonic;
@@ -7455,7 +7526,7 @@ function parsePath(path2, depth = 0) {
7455
7526
  (p) => ~p.indexOf(`'`) ? parseInt(p, 10) + HARDENED_INDEX : parseInt(p, 10)
7456
7527
  );
7457
7528
  }
7458
- var HDWallet = class _HDWallet {
7529
+ var HDWallet = class {
7459
7530
  depth = 0;
7460
7531
  index = 0;
7461
7532
  fingerprint = (0, import_utils34.hexlify)("0x00000000");
@@ -7521,7 +7592,7 @@ var HDWallet = class _HDWallet {
7521
7592
  if (privateKey) {
7522
7593
  const N = "0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141";
7523
7594
  const ki = (0, import_math19.bn)(IL).add(privateKey).mod(N).toBytes(32);
7524
- return new _HDWallet({
7595
+ return new HDWallet({
7525
7596
  privateKey: ki,
7526
7597
  chainCode: IR,
7527
7598
  index,
@@ -7531,7 +7602,7 @@ var HDWallet = class _HDWallet {
7531
7602
  }
7532
7603
  const signer = new Signer((0, import_utils34.hexlify)(IL));
7533
7604
  const Ki = signer.addPoint(publicKey);
7534
- return new _HDWallet({
7605
+ return new HDWallet({
7535
7606
  publicKey: Ki,
7536
7607
  chainCode: IR,
7537
7608
  index,
@@ -7580,7 +7651,7 @@ var HDWallet = class _HDWallet {
7580
7651
  */
7581
7652
  static fromSeed(seed) {
7582
7653
  const masterKey = mnemonic_default.masterKeysFromSeed(seed);
7583
- return new _HDWallet({
7654
+ return new HDWallet({
7584
7655
  chainCode: (0, import_utils34.arrayify)(masterKey.slice(32)),
7585
7656
  privateKey: (0, import_utils34.arrayify)(masterKey.slice(0, 32))
7586
7657
  });
@@ -7610,7 +7681,7 @@ var HDWallet = class _HDWallet {
7610
7681
  if (key[0] !== 3) {
7611
7682
  throw new import_errors19.FuelError(import_errors19.ErrorCode.HD_WALLET_ERROR, "Invalid public extended key.");
7612
7683
  }
7613
- return new _HDWallet({
7684
+ return new HDWallet({
7614
7685
  publicKey: key,
7615
7686
  chainCode,
7616
7687
  index,
@@ -7621,7 +7692,7 @@ var HDWallet = class _HDWallet {
7621
7692
  if (key[0] !== 0) {
7622
7693
  throw new import_errors19.FuelError(import_errors19.ErrorCode.HD_WALLET_ERROR, "Invalid private extended key.");
7623
7694
  }
7624
- return new _HDWallet({
7695
+ return new HDWallet({
7625
7696
  privateKey: key.slice(1),
7626
7697
  chainCode,
7627
7698
  index,
@@ -7644,7 +7715,7 @@ var WalletLocked = class extends Account {
7644
7715
  return new WalletUnlocked(privateKey, this._provider);
7645
7716
  }
7646
7717
  };
7647
- var WalletUnlocked = class _WalletUnlocked extends BaseWalletUnlocked {
7718
+ var WalletUnlocked = class extends BaseWalletUnlocked {
7648
7719
  /**
7649
7720
  * Locks the wallet and returns an instance of WalletLocked.
7650
7721
  *
@@ -7662,7 +7733,7 @@ var WalletUnlocked = class _WalletUnlocked extends BaseWalletUnlocked {
7662
7733
  */
7663
7734
  static generate(generateOptions) {
7664
7735
  const privateKey = Signer.generatePrivateKey(generateOptions?.entropy);
7665
- return new _WalletUnlocked(privateKey, generateOptions?.provider);
7736
+ return new WalletUnlocked(privateKey, generateOptions?.provider);
7666
7737
  }
7667
7738
  /**
7668
7739
  * Create a Wallet Unlocked from a seed.
@@ -7674,8 +7745,8 @@ var WalletUnlocked = class _WalletUnlocked extends BaseWalletUnlocked {
7674
7745
  */
7675
7746
  static fromSeed(seed, path2, provider) {
7676
7747
  const hdWallet = hdwallet_default.fromSeed(seed);
7677
- const childWallet = hdWallet.derivePath(path2 || _WalletUnlocked.defaultPath);
7678
- return new _WalletUnlocked(childWallet.privateKey, provider);
7748
+ const childWallet = hdWallet.derivePath(path2 || WalletUnlocked.defaultPath);
7749
+ return new WalletUnlocked(childWallet.privateKey, provider);
7679
7750
  }
7680
7751
  /**
7681
7752
  * Create a Wallet Unlocked from a mnemonic phrase.
@@ -7689,8 +7760,8 @@ var WalletUnlocked = class _WalletUnlocked extends BaseWalletUnlocked {
7689
7760
  static fromMnemonic(mnemonic, path2, passphrase, provider) {
7690
7761
  const seed = mnemonic_default.mnemonicToSeed(mnemonic, passphrase);
7691
7762
  const hdWallet = hdwallet_default.fromSeed(seed);
7692
- const childWallet = hdWallet.derivePath(path2 || _WalletUnlocked.defaultPath);
7693
- return new _WalletUnlocked(childWallet.privateKey, provider);
7763
+ const childWallet = hdWallet.derivePath(path2 || WalletUnlocked.defaultPath);
7764
+ return new WalletUnlocked(childWallet.privateKey, provider);
7694
7765
  }
7695
7766
  /**
7696
7767
  * Create a Wallet Unlocked from an extended key.
@@ -7701,7 +7772,7 @@ var WalletUnlocked = class _WalletUnlocked extends BaseWalletUnlocked {
7701
7772
  */
7702
7773
  static fromExtendedKey(extendedKey, provider) {
7703
7774
  const hdWallet = hdwallet_default.fromExtendedKey(extendedKey);
7704
- return new _WalletUnlocked(hdWallet.privateKey, provider);
7775
+ return new WalletUnlocked(hdWallet.privateKey, provider);
7705
7776
  }
7706
7777
  /**
7707
7778
  * Create a Wallet Unlocked from an encrypted JSON.
@@ -7713,7 +7784,7 @@ var WalletUnlocked = class _WalletUnlocked extends BaseWalletUnlocked {
7713
7784
  */
7714
7785
  static async fromEncryptedJson(jsonWallet, password, provider) {
7715
7786
  const privateKey = await decryptKeystoreWallet(jsonWallet, password);
7716
- return new _WalletUnlocked(privateKey, provider);
7787
+ return new WalletUnlocked(privateKey, provider);
7717
7788
  }
7718
7789
  };
7719
7790
 
@@ -7739,50 +7810,50 @@ var Wallet = class {
7739
7810
  static fromPrivateKey(privateKey, provider) {
7740
7811
  return new WalletUnlocked(privateKey, provider);
7741
7812
  }
7742
- /**
7743
- * Generate a new Wallet Unlocked with a random key pair.
7744
- *
7745
- * @param generateOptions - Options to customize the generation process (optional).
7746
- * @returns An unlocked wallet instance.
7747
- */
7748
- static generate = WalletUnlocked.generate;
7749
- /**
7750
- * Create a Wallet Unlocked from a seed.
7751
- *
7752
- * @param seed - The seed phrase.
7753
- * @param provider - A Provider instance (optional).
7754
- * @param path - The derivation path (optional).
7755
- * @returns An unlocked wallet instance.
7756
- */
7757
- static fromSeed = WalletUnlocked.fromSeed;
7758
- /**
7759
- * Create a Wallet Unlocked from a mnemonic phrase.
7760
- *
7761
- * @param mnemonic - The mnemonic phrase.
7762
- * @param provider - A Provider instance (optional).
7763
- * @param path - The derivation path (optional).
7764
- * @param passphrase - The passphrase for the mnemonic (optional).
7765
- * @returns An unlocked wallet instance.
7766
- */
7767
- static fromMnemonic = WalletUnlocked.fromMnemonic;
7768
- /**
7769
- * Create a Wallet Unlocked from an extended key.
7770
- *
7771
- * @param extendedKey - The extended key.
7772
- * @param provider - A Provider instance (optional).
7773
- * @returns An unlocked wallet instance.
7774
- */
7775
- static fromExtendedKey = WalletUnlocked.fromExtendedKey;
7776
- /**
7777
- * Create a Wallet Unlocked from an encrypted JSON.
7778
- *
7779
- * @param jsonWallet - The encrypted JSON keystore.
7780
- * @param password - The password to decrypt the JSON.
7781
- * @param provider - A Provider instance (optional).
7782
- * @returns An unlocked wallet instance.
7783
- */
7784
- static fromEncryptedJson = WalletUnlocked.fromEncryptedJson;
7785
7813
  };
7814
+ /**
7815
+ * Generate a new Wallet Unlocked with a random key pair.
7816
+ *
7817
+ * @param generateOptions - Options to customize the generation process (optional).
7818
+ * @returns An unlocked wallet instance.
7819
+ */
7820
+ __publicField(Wallet, "generate", WalletUnlocked.generate);
7821
+ /**
7822
+ * Create a Wallet Unlocked from a seed.
7823
+ *
7824
+ * @param seed - The seed phrase.
7825
+ * @param provider - A Provider instance (optional).
7826
+ * @param path - The derivation path (optional).
7827
+ * @returns An unlocked wallet instance.
7828
+ */
7829
+ __publicField(Wallet, "fromSeed", WalletUnlocked.fromSeed);
7830
+ /**
7831
+ * Create a Wallet Unlocked from a mnemonic phrase.
7832
+ *
7833
+ * @param mnemonic - The mnemonic phrase.
7834
+ * @param provider - A Provider instance (optional).
7835
+ * @param path - The derivation path (optional).
7836
+ * @param passphrase - The passphrase for the mnemonic (optional).
7837
+ * @returns An unlocked wallet instance.
7838
+ */
7839
+ __publicField(Wallet, "fromMnemonic", WalletUnlocked.fromMnemonic);
7840
+ /**
7841
+ * Create a Wallet Unlocked from an extended key.
7842
+ *
7843
+ * @param extendedKey - The extended key.
7844
+ * @param provider - A Provider instance (optional).
7845
+ * @returns An unlocked wallet instance.
7846
+ */
7847
+ __publicField(Wallet, "fromExtendedKey", WalletUnlocked.fromExtendedKey);
7848
+ /**
7849
+ * Create a Wallet Unlocked from an encrypted JSON.
7850
+ *
7851
+ * @param jsonWallet - The encrypted JSON keystore.
7852
+ * @param password - The password to decrypt the JSON.
7853
+ * @param provider - A Provider instance (optional).
7854
+ * @returns An unlocked wallet instance.
7855
+ */
7856
+ __publicField(Wallet, "fromEncryptedJson", WalletUnlocked.fromEncryptedJson);
7786
7857
 
7787
7858
  // src/test-utils/seedTestWallet.ts
7788
7859
  var import_crypto4 = require("@fuel-ts/crypto");