@fuel-ts/account 0.0.0-rc-1889-20240322122653 → 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 (218) hide show
  1. package/dist/account.d.ts +177 -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 +188 -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 +461 -394
  40. package/dist/index.global.js.map +1 -1
  41. package/dist/index.js +350 -314
  42. package/dist/index.js.map +1 -1
  43. package/dist/index.mjs +251 -212
  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 +522 -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 +259 -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 +5 -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/signer/index.d.ts +2 -0
  160. package/dist/signer/index.d.ts.map +1 -0
  161. package/dist/signer/signer.d.ts +64 -0
  162. package/dist/signer/signer.d.ts.map +1 -0
  163. package/dist/test-utils/asset-id.d.ts +9 -0
  164. package/dist/test-utils/asset-id.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 +8 -0
  168. package/dist/test-utils/index.d.ts.map +1 -0
  169. package/dist/{test-utils.d.ts → test-utils/launchNode.d.ts} +19 -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/setup-test-provider-and-wallets.d.ts +33 -0
  174. package/dist/test-utils/setup-test-provider-and-wallets.d.ts.map +1 -0
  175. package/dist/test-utils/test-message.d.ts +28 -0
  176. package/dist/test-utils/test-message.d.ts.map +1 -0
  177. package/dist/test-utils/wallet-config.d.ts +49 -0
  178. package/dist/test-utils/wallet-config.d.ts.map +1 -0
  179. package/dist/test-utils.global.js +655 -310
  180. package/dist/test-utils.global.js.map +1 -1
  181. package/dist/test-utils.js +452 -217
  182. package/dist/test-utils.js.map +1 -1
  183. package/dist/test-utils.mjs +357 -124
  184. package/dist/test-utils.mjs.map +1 -1
  185. package/dist/utils/formatTransferToContractScriptData.d.ts +14 -0
  186. package/dist/utils/formatTransferToContractScriptData.d.ts.map +1 -0
  187. package/dist/wallet/base-wallet-unlocked.d.ts +73 -0
  188. package/dist/wallet/base-wallet-unlocked.d.ts.map +1 -0
  189. package/dist/wallet/index.d.ts +4 -0
  190. package/dist/wallet/index.d.ts.map +1 -0
  191. package/dist/wallet/keystore-wallet.d.ts +38 -0
  192. package/dist/wallet/keystore-wallet.d.ts.map +1 -0
  193. package/dist/wallet/wallet.d.ts +68 -0
  194. package/dist/wallet/wallet.d.ts.map +1 -0
  195. package/dist/wallet/wallets.d.ts +76 -0
  196. package/dist/wallet/wallets.d.ts.map +1 -0
  197. package/dist/wallet-manager/index.d.ts +6 -0
  198. package/dist/wallet-manager/index.d.ts.map +1 -0
  199. package/dist/wallet-manager/storages/memory-storage.d.ts +9 -0
  200. package/dist/wallet-manager/storages/memory-storage.d.ts.map +1 -0
  201. package/dist/wallet-manager/types.d.ts +42 -0
  202. package/dist/wallet-manager/types.d.ts.map +1 -0
  203. package/dist/wallet-manager/vaults/mnemonic-vault.d.ts +29 -0
  204. package/dist/wallet-manager/vaults/mnemonic-vault.d.ts.map +1 -0
  205. package/dist/wallet-manager/vaults/privatekey-vault.d.ts +29 -0
  206. package/dist/wallet-manager/vaults/privatekey-vault.d.ts.map +1 -0
  207. package/dist/wallet-manager/wallet-manager.d.ts +104 -0
  208. package/dist/wallet-manager/wallet-manager.d.ts.map +1 -0
  209. package/dist/wordlists/index.d.ts +5 -0
  210. package/dist/wordlists/index.d.ts.map +1 -0
  211. package/dist/wordlists/words/english.d.ts +2 -0
  212. package/dist/wordlists/words/english.d.ts.map +1 -0
  213. package/package.json +26 -21
  214. package/dist/account-E9nGNf5X.d.mts +0 -3837
  215. package/dist/account-E9nGNf5X.d.ts +0 -3837
  216. package/dist/configs.d.mts +0 -3
  217. package/dist/index.d.mts +0 -904
  218. package/dist/test-utils.d.mts +0 -66
package/dist/index.js CHANGED
@@ -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,32 @@ 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 __privateGet = (obj, member, getter) => {
39
+ __accessCheck(obj, member, "read from private field");
40
+ return getter ? getter.call(obj) : member.get(obj);
41
+ };
42
+ var __privateAdd = (obj, member, value) => {
43
+ if (member.has(obj))
44
+ throw TypeError("Cannot add the same private member more than once");
45
+ member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
46
+ };
47
+ var __privateSet = (obj, member, value, setter) => {
48
+ __accessCheck(obj, member, "write to private field");
49
+ setter ? setter.call(obj, value) : member.set(obj, value);
50
+ return value;
51
+ };
52
+ var __privateMethod = (obj, member, method) => {
53
+ __accessCheck(obj, member, "access private method");
54
+ return method;
55
+ };
29
56
 
30
57
  // src/index.ts
31
58
  var src_exports = {};
@@ -144,7 +171,6 @@ __export(src_exports, {
144
171
  resolveGasDependentCosts: () => resolveGasDependentCosts,
145
172
  resolveIconPaths: () => resolveIconPaths,
146
173
  returnZeroScript: () => returnZeroScript,
147
- sleep: () => sleep,
148
174
  transactionRequestify: () => transactionRequestify,
149
175
  urlJoin: () => urlJoin,
150
176
  withTimeout: () => withTimeout,
@@ -158,7 +184,7 @@ var import_configs11 = require("@fuel-ts/address/configs");
158
184
  var import_errors15 = require("@fuel-ts/errors");
159
185
  var import_interfaces = require("@fuel-ts/interfaces");
160
186
  var import_math17 = require("@fuel-ts/math");
161
- var import_utils27 = require("@fuel-ts/utils");
187
+ var import_utils28 = require("@fuel-ts/utils");
162
188
 
163
189
  // src/providers/coin-quantity.ts
164
190
  var import_configs = require("@fuel-ts/address/configs");
@@ -201,9 +227,9 @@ var import_address3 = require("@fuel-ts/address");
201
227
  var import_errors13 = require("@fuel-ts/errors");
202
228
  var import_math14 = require("@fuel-ts/math");
203
229
  var import_transactions17 = require("@fuel-ts/transactions");
204
- var import_utils22 = require("@fuel-ts/utils");
230
+ var import_utils23 = require("@fuel-ts/utils");
205
231
  var import_versions = require("@fuel-ts/versions");
206
- var import_utils23 = require("@noble/curves/abstract/utils");
232
+ var import_utils24 = require("@noble/curves/abstract/utils");
207
233
  var import_ethers = require("ethers");
208
234
  var import_graphql_request = require("graphql-request");
209
235
  var import_ramda3 = require("ramda");
@@ -1016,12 +1042,11 @@ function getSdk(requester) {
1016
1042
  // src/providers/fuel-graphql-subscriber.ts
1017
1043
  var import_errors = require("@fuel-ts/errors");
1018
1044
  var import_graphql = require("graphql");
1019
- var FuelGraphqlSubscriber = class _FuelGraphqlSubscriber {
1045
+ var _FuelGraphqlSubscriber = class {
1020
1046
  constructor(options) {
1021
1047
  this.options = options;
1022
1048
  }
1023
1049
  stream;
1024
- static textDecoder = new TextDecoder();
1025
1050
  async setStream() {
1026
1051
  const { url, query, variables, fetchFn } = this.options;
1027
1052
  const response = await fetchFn(`${url}-sub`, {
@@ -1081,6 +1106,8 @@ var FuelGraphqlSubscriber = class _FuelGraphqlSubscriber {
1081
1106
  return this;
1082
1107
  }
1083
1108
  };
1109
+ var FuelGraphqlSubscriber = _FuelGraphqlSubscriber;
1110
+ __publicField(FuelGraphqlSubscriber, "textDecoder", new TextDecoder());
1084
1111
 
1085
1112
  // src/providers/memory-cache.ts
1086
1113
  var import_errors2 = require("@fuel-ts/errors");
@@ -1661,15 +1688,6 @@ function normalizeJSON(root) {
1661
1688
  return normalize((0, import_ramda.clone)(root));
1662
1689
  }
1663
1690
 
1664
- // src/providers/utils/sleep.ts
1665
- function sleep(time) {
1666
- return new Promise((resolve) => {
1667
- setTimeout(() => {
1668
- resolve(true);
1669
- }, time);
1670
- });
1671
- }
1672
-
1673
1691
  // src/providers/transaction-request/errors.ts
1674
1692
  var ChangeOutputCollisionError = class extends Error {
1675
1693
  name = "ChangeOutputCollisionError";
@@ -1703,7 +1721,7 @@ var witnessify = (value) => {
1703
1721
  };
1704
1722
 
1705
1723
  // src/providers/transaction-request/transaction-request.ts
1706
- var BaseTransactionRequest = class _BaseTransactionRequest {
1724
+ var BaseTransactionRequest = class {
1707
1725
  /** Gas price for transaction */
1708
1726
  gasPrice;
1709
1727
  /** Block until which tx cannot be included */
@@ -1773,7 +1791,7 @@ var BaseTransactionRequest = class _BaseTransactionRequest {
1773
1791
  const inputs = this.inputs?.map(inputify) ?? [];
1774
1792
  const outputs = this.outputs?.map(outputify) ?? [];
1775
1793
  const witnesses = this.witnesses?.map(witnessify) ?? [];
1776
- const { policyTypes, policies } = _BaseTransactionRequest.getPolicyMeta(this);
1794
+ const { policyTypes, policies } = BaseTransactionRequest.getPolicyMeta(this);
1777
1795
  return {
1778
1796
  policyTypes,
1779
1797
  inputs,
@@ -3358,7 +3376,7 @@ function assembleTransactionSummary(params) {
3358
3376
  }
3359
3377
 
3360
3378
  // src/providers/transaction-response/transaction-response.ts
3361
- var TransactionResponse = class _TransactionResponse {
3379
+ var TransactionResponse = class {
3362
3380
  /** Transaction ID */
3363
3381
  id;
3364
3382
  /** Current provider */
@@ -3386,7 +3404,7 @@ var TransactionResponse = class _TransactionResponse {
3386
3404
  * @param provider - The provider.
3387
3405
  */
3388
3406
  static async create(id, provider) {
3389
- const response = new _TransactionResponse(id, provider);
3407
+ const response = new TransactionResponse(id, provider);
3390
3408
  await response.fetch();
3391
3409
  return response;
3392
3410
  }
@@ -3527,6 +3545,7 @@ function getDecodedLogs(receipts, abiInterface) {
3527
3545
  }
3528
3546
 
3529
3547
  // src/providers/utils/auto-retry-fetch.ts
3548
+ var import_utils22 = require("@fuel-ts/utils");
3530
3549
  function getWaitDelay(options, retryAttemptNum) {
3531
3550
  const duration = options.baseDelay ?? 150;
3532
3551
  switch (options.backoff) {
@@ -3556,7 +3575,7 @@ function autoRetryFetch(fetchFn, options, retryAttemptNum = 0) {
3556
3575
  throw error;
3557
3576
  }
3558
3577
  const delay = getWaitDelay(options, retryNum);
3559
- await sleep(delay);
3578
+ await (0, import_utils22.sleep)(delay);
3560
3579
  return autoRetryFetch(fetchFn, options, retryNum)(...args);
3561
3580
  }
3562
3581
  };
@@ -3614,7 +3633,8 @@ var processGqlChain = (chain) => {
3614
3633
  }
3615
3634
  };
3616
3635
  };
3617
- var Provider = class _Provider {
3636
+ var _cacheInputs, cacheInputs_fn;
3637
+ var _Provider = class {
3618
3638
  /**
3619
3639
  * Constructor to initialize a Provider.
3620
3640
  *
@@ -3625,25 +3645,27 @@ var Provider = class _Provider {
3625
3645
  */
3626
3646
  constructor(url, options = {}) {
3627
3647
  this.url = url;
3648
+ /**
3649
+ * @hidden
3650
+ */
3651
+ __privateAdd(this, _cacheInputs);
3652
+ __publicField(this, "operations");
3653
+ __publicField(this, "cache");
3654
+ __publicField(this, "options", {
3655
+ timeout: void 0,
3656
+ cacheUtxo: void 0,
3657
+ fetch: void 0,
3658
+ retryOptions: void 0
3659
+ });
3628
3660
  this.options = { ...this.options, ...options };
3629
3661
  this.url = url;
3630
3662
  this.operations = this.createOperations();
3631
3663
  this.cache = options.cacheUtxo ? new MemoryCache(options.cacheUtxo) : void 0;
3632
3664
  }
3633
- operations;
3634
- cache;
3635
3665
  static clearChainAndNodeCaches() {
3636
3666
  _Provider.nodeInfoCache = {};
3637
3667
  _Provider.chainInfoCache = {};
3638
3668
  }
3639
- static chainInfoCache = {};
3640
- static nodeInfoCache = {};
3641
- options = {
3642
- timeout: void 0,
3643
- cacheUtxo: void 0,
3644
- fetch: void 0,
3645
- retryOptions: void 0
3646
- };
3647
3669
  static getFetchFn(options) {
3648
3670
  const { retryOptions, timeout } = options;
3649
3671
  return autoRetryFetch(async (...args) => {
@@ -3840,19 +3862,6 @@ var Provider = class _Provider {
3840
3862
  } = this.getChain();
3841
3863
  return chainId.toNumber();
3842
3864
  }
3843
- /**
3844
- * @hidden
3845
- */
3846
- #cacheInputs(inputs) {
3847
- if (!this.cache) {
3848
- return;
3849
- }
3850
- inputs.forEach((input) => {
3851
- if (input.type === import_transactions17.InputType.Coin) {
3852
- this.cache?.set(input.id);
3853
- }
3854
- });
3855
- }
3856
3865
  /**
3857
3866
  * Submits a transaction to the chain to be executed.
3858
3867
  *
@@ -3865,11 +3874,11 @@ var Provider = class _Provider {
3865
3874
  // #region Provider-sendTransaction
3866
3875
  async sendTransaction(transactionRequestLike, { estimateTxDependencies = true, awaitExecution = false } = {}) {
3867
3876
  const transactionRequest = transactionRequestify(transactionRequestLike);
3868
- this.#cacheInputs(transactionRequest.inputs);
3877
+ __privateMethod(this, _cacheInputs, cacheInputs_fn).call(this, transactionRequest.inputs);
3869
3878
  if (estimateTxDependencies) {
3870
3879
  await this.estimateTxDependencies(transactionRequest);
3871
3880
  }
3872
- const encodedTransaction = (0, import_utils22.hexlify)(transactionRequest.toTransactionBytes());
3881
+ const encodedTransaction = (0, import_utils23.hexlify)(transactionRequest.toTransactionBytes());
3873
3882
  if (awaitExecution) {
3874
3883
  const subscription = this.operations.submitAndAwait({ encodedTransaction });
3875
3884
  for await (const { submitAndAwait } of subscription) {
@@ -3908,7 +3917,7 @@ var Provider = class _Provider {
3908
3917
  if (estimateTxDependencies) {
3909
3918
  return this.estimateTxDependencies(transactionRequest);
3910
3919
  }
3911
- const encodedTransaction = (0, import_utils22.hexlify)(transactionRequest.toTransactionBytes());
3920
+ const encodedTransaction = (0, import_utils23.hexlify)(transactionRequest.toTransactionBytes());
3912
3921
  const { dryRun: gqlReceipts } = await this.operations.dryRun({
3913
3922
  encodedTransaction,
3914
3923
  utxoValidation: utxoValidation || false
@@ -3927,13 +3936,13 @@ var Provider = class _Provider {
3927
3936
  async estimatePredicates(transactionRequest) {
3928
3937
  const shouldEstimatePredicates = Boolean(
3929
3938
  transactionRequest.inputs.find(
3930
- (input) => "predicate" in input && input.predicate && !(0, import_utils23.equalBytes)((0, import_utils22.arrayify)(input.predicate), (0, import_utils22.arrayify)("0x")) && new import_math14.BN(input.predicateGasUsed).isZero()
3939
+ (input) => "predicate" in input && input.predicate && !(0, import_utils24.equalBytes)((0, import_utils23.arrayify)(input.predicate), (0, import_utils23.arrayify)("0x")) && new import_math14.BN(input.predicateGasUsed).isZero()
3931
3940
  )
3932
3941
  );
3933
3942
  if (!shouldEstimatePredicates) {
3934
3943
  return transactionRequest;
3935
3944
  }
3936
- const encodedTransaction = (0, import_utils22.hexlify)(transactionRequest.toTransactionBytes());
3945
+ const encodedTransaction = (0, import_utils23.hexlify)(transactionRequest.toTransactionBytes());
3937
3946
  const response = await this.operations.estimatePredicates({
3938
3947
  encodedTransaction
3939
3948
  });
@@ -3976,7 +3985,7 @@ var Provider = class _Provider {
3976
3985
  let outputVariables = 0;
3977
3986
  for (let attempt = 0; attempt < MAX_RETRIES; attempt++) {
3978
3987
  const { dryRun: gqlReceipts } = await this.operations.dryRun({
3979
- encodedTransaction: (0, import_utils22.hexlify)(transactionRequest.toTransactionBytes()),
3988
+ encodedTransaction: (0, import_utils23.hexlify)(transactionRequest.toTransactionBytes()),
3980
3989
  utxoValidation: false
3981
3990
  });
3982
3991
  receipts = gqlReceipts.map(processGqlReceipt);
@@ -4014,7 +4023,7 @@ var Provider = class _Provider {
4014
4023
  if (estimateTxDependencies) {
4015
4024
  return this.estimateTxDependencies(transactionRequest);
4016
4025
  }
4017
- const encodedTransaction = (0, import_utils22.hexlify)(transactionRequest.toTransactionBytes());
4026
+ const encodedTransaction = (0, import_utils23.hexlify)(transactionRequest.toTransactionBytes());
4018
4027
  const { dryRun: gqlReceipts } = await this.operations.dryRun({
4019
4028
  encodedTransaction,
4020
4029
  utxoValidation: true
@@ -4124,7 +4133,7 @@ var Provider = class _Provider {
4124
4133
  const result = await this.operations.getCoins({
4125
4134
  first: 10,
4126
4135
  ...paginationArgs,
4127
- filter: { owner: ownerAddress.toB256(), assetId: assetId && (0, import_utils22.hexlify)(assetId) }
4136
+ filter: { owner: ownerAddress.toB256(), assetId: assetId && (0, import_utils23.hexlify)(assetId) }
4128
4137
  });
4129
4138
  const coins = result.coins.edges.map((edge) => edge.node);
4130
4139
  return coins.map((coin) => ({
@@ -4148,19 +4157,19 @@ var Provider = class _Provider {
4148
4157
  async getResourcesToSpend(owner, quantities, excludedIds) {
4149
4158
  const ownerAddress = import_address3.Address.fromAddressOrString(owner);
4150
4159
  const excludeInput = {
4151
- messages: excludedIds?.messages?.map((nonce) => (0, import_utils22.hexlify)(nonce)) || [],
4152
- utxos: excludedIds?.utxos?.map((id) => (0, import_utils22.hexlify)(id)) || []
4160
+ messages: excludedIds?.messages?.map((nonce) => (0, import_utils23.hexlify)(nonce)) || [],
4161
+ utxos: excludedIds?.utxos?.map((id) => (0, import_utils23.hexlify)(id)) || []
4153
4162
  };
4154
4163
  if (this.cache) {
4155
4164
  const uniqueUtxos = new Set(
4156
- excludeInput.utxos.concat(this.cache?.getActiveData().map((id) => (0, import_utils22.hexlify)(id)))
4165
+ excludeInput.utxos.concat(this.cache?.getActiveData().map((id) => (0, import_utils23.hexlify)(id)))
4157
4166
  );
4158
4167
  excludeInput.utxos = Array.from(uniqueUtxos);
4159
4168
  }
4160
4169
  const coinsQuery = {
4161
4170
  owner: ownerAddress.toB256(),
4162
4171
  queryPerAsset: quantities.map(coinQuantityfy).map(({ assetId, amount, max: maxPerAsset }) => ({
4163
- assetId: (0, import_utils22.hexlify)(assetId),
4172
+ assetId: (0, import_utils23.hexlify)(assetId),
4164
4173
  amount: amount.toString(10),
4165
4174
  max: maxPerAsset ? maxPerAsset.toString(10) : void 0
4166
4175
  })),
@@ -4263,7 +4272,7 @@ var Provider = class _Provider {
4263
4272
  time: block.header.time,
4264
4273
  transactionIds: block.transactions.map((tx) => tx.id),
4265
4274
  transactions: block.transactions.map(
4266
- (tx) => new import_transactions17.TransactionCoder().decode((0, import_utils22.arrayify)(tx.rawPayload), 0)?.[0]
4275
+ (tx) => new import_transactions17.TransactionCoder().decode((0, import_utils23.arrayify)(tx.rawPayload), 0)?.[0]
4267
4276
  )
4268
4277
  };
4269
4278
  }
@@ -4279,7 +4288,7 @@ var Provider = class _Provider {
4279
4288
  return null;
4280
4289
  }
4281
4290
  return new import_transactions17.TransactionCoder().decode(
4282
- (0, import_utils22.arrayify)(transaction.rawPayload),
4291
+ (0, import_utils23.arrayify)(transaction.rawPayload),
4283
4292
  0
4284
4293
  )?.[0];
4285
4294
  }
@@ -4306,7 +4315,7 @@ var Provider = class _Provider {
4306
4315
  async getContractBalance(contractId, assetId) {
4307
4316
  const { contractBalance } = await this.operations.getContractBalance({
4308
4317
  contract: import_address3.Address.fromAddressOrString(contractId).toB256(),
4309
- asset: (0, import_utils22.hexlify)(assetId)
4318
+ asset: (0, import_utils23.hexlify)(assetId)
4310
4319
  });
4311
4320
  return (0, import_math14.bn)(contractBalance.amount, 10);
4312
4321
  }
@@ -4320,7 +4329,7 @@ var Provider = class _Provider {
4320
4329
  async getBalance(owner, assetId) {
4321
4330
  const { balance } = await this.operations.getBalance({
4322
4331
  owner: import_address3.Address.fromAddressOrString(owner).toB256(),
4323
- assetId: (0, import_utils22.hexlify)(assetId)
4332
+ assetId: (0, import_utils23.hexlify)(assetId)
4324
4333
  });
4325
4334
  return (0, import_math14.bn)(balance.amount, 10);
4326
4335
  }
@@ -4481,7 +4490,7 @@ var Provider = class _Provider {
4481
4490
  async produceBlocks(amount, startTime) {
4482
4491
  const { produceBlocks: latestBlockHeight } = await this.operations.produceBlocks({
4483
4492
  blocksToProduce: (0, import_math14.bn)(amount).toString(10),
4484
- startTimestamp: startTime ? import_utils22.DateTime.fromUnixMilliseconds(startTime).toTai64() : void 0
4493
+ startTimestamp: startTime ? import_utils23.DateTime.fromUnixMilliseconds(startTime).toTai64() : void 0
4485
4494
  });
4486
4495
  return (0, import_math14.bn)(latestBlockHeight);
4487
4496
  }
@@ -4490,12 +4499,26 @@ var Provider = class _Provider {
4490
4499
  return new TransactionResponse(transactionId, this);
4491
4500
  }
4492
4501
  };
4502
+ var Provider = _Provider;
4503
+ _cacheInputs = new WeakSet();
4504
+ cacheInputs_fn = function(inputs) {
4505
+ if (!this.cache) {
4506
+ return;
4507
+ }
4508
+ inputs.forEach((input) => {
4509
+ if (input.type === import_transactions17.InputType.Coin) {
4510
+ this.cache?.set(input.id);
4511
+ }
4512
+ });
4513
+ };
4514
+ __publicField(Provider, "chainInfoCache", {});
4515
+ __publicField(Provider, "nodeInfoCache", {});
4493
4516
 
4494
4517
  // src/providers/transaction-summary/get-transaction-summary.ts
4495
4518
  var import_errors14 = require("@fuel-ts/errors");
4496
4519
  var import_math15 = require("@fuel-ts/math");
4497
4520
  var import_transactions18 = require("@fuel-ts/transactions");
4498
- var import_utils25 = require("@fuel-ts/utils");
4521
+ var import_utils26 = require("@fuel-ts/utils");
4499
4522
  async function getTransactionSummary(params) {
4500
4523
  const { id, provider, abiMap } = params;
4501
4524
  const { transaction: gqlTransaction } = await provider.operations.getTransactionWithReceipts({
@@ -4508,7 +4531,7 @@ async function getTransactionSummary(params) {
4508
4531
  );
4509
4532
  }
4510
4533
  const [decodedTransaction] = new import_transactions18.TransactionCoder().decode(
4511
- (0, import_utils25.arrayify)(gqlTransaction.rawPayload),
4534
+ (0, import_utils26.arrayify)(gqlTransaction.rawPayload),
4512
4535
  0
4513
4536
  );
4514
4537
  const receipts = gqlTransaction.receipts?.map(processGqlReceipt) || [];
@@ -4519,7 +4542,7 @@ async function getTransactionSummary(params) {
4519
4542
  id: gqlTransaction.id,
4520
4543
  receipts,
4521
4544
  transaction: decodedTransaction,
4522
- transactionBytes: (0, import_utils25.arrayify)(gqlTransaction.rawPayload),
4545
+ transactionBytes: (0, import_utils26.arrayify)(gqlTransaction.rawPayload),
4523
4546
  gqlTransactionStatus: gqlTransaction.status,
4524
4547
  gasPerByte: (0, import_math15.bn)(gasPerByte),
4525
4548
  gasPriceFactor: (0, import_math15.bn)(gasPriceFactor),
@@ -4561,13 +4584,13 @@ async function getTransactionsSummaries(params) {
4561
4584
  const transactions = edges.map((edge) => {
4562
4585
  const { node: gqlTransaction } = edge;
4563
4586
  const { id, rawPayload, receipts: gqlReceipts, status } = gqlTransaction;
4564
- const [decodedTransaction] = new import_transactions18.TransactionCoder().decode((0, import_utils25.arrayify)(rawPayload), 0);
4587
+ const [decodedTransaction] = new import_transactions18.TransactionCoder().decode((0, import_utils26.arrayify)(rawPayload), 0);
4565
4588
  const receipts = gqlReceipts?.map(processGqlReceipt) || [];
4566
4589
  const transactionSummary = assembleTransactionSummary({
4567
4590
  id,
4568
4591
  receipts,
4569
4592
  transaction: decodedTransaction,
4570
- transactionBytes: (0, import_utils25.arrayify)(rawPayload),
4593
+ transactionBytes: (0, import_utils26.arrayify)(rawPayload),
4571
4594
  gqlTransactionStatus: status,
4572
4595
  abiMap,
4573
4596
  gasPerByte,
@@ -4711,16 +4734,16 @@ var assets = [
4711
4734
  // src/utils/formatTransferToContractScriptData.ts
4712
4735
  var import_abi_coder4 = require("@fuel-ts/abi-coder");
4713
4736
  var import_math16 = require("@fuel-ts/math");
4714
- var import_utils26 = require("@fuel-ts/utils");
4737
+ var import_utils27 = require("@fuel-ts/utils");
4715
4738
  var asm = __toESM(require("@fuels/vm-asm"));
4716
4739
  var formatTransferToContractScriptData = (params) => {
4717
4740
  const { assetId, amountToTransfer, hexlifiedContractId } = params;
4718
4741
  const numberCoder = new import_abi_coder4.BigNumberCoder("u64");
4719
4742
  const encoded = numberCoder.encode(new import_math16.BN(amountToTransfer).toNumber());
4720
4743
  const scriptData = Uint8Array.from([
4721
- ...(0, import_utils26.arrayify)(hexlifiedContractId),
4744
+ ...(0, import_utils27.arrayify)(hexlifiedContractId),
4722
4745
  ...encoded,
4723
- ...(0, import_utils26.arrayify)(assetId)
4746
+ ...(0, import_utils27.arrayify)(assetId)
4724
4747
  ]);
4725
4748
  return scriptData;
4726
4749
  };
@@ -5060,14 +5083,14 @@ var Account = class extends import_interfaces.AbstractAccount {
5060
5083
  async withdrawToBaseLayer(recipient, amount, txParams = {}) {
5061
5084
  const { minGasPrice } = this.provider.getGasConfig();
5062
5085
  const recipientAddress = import_address4.Address.fromAddressOrString(recipient);
5063
- const recipientDataArray = (0, import_utils27.arrayify)(
5086
+ const recipientDataArray = (0, import_utils28.arrayify)(
5064
5087
  "0x".concat(recipientAddress.toHexString().substring(2).padStart(64, "0"))
5065
5088
  );
5066
- const amountDataArray = (0, import_utils27.arrayify)(
5089
+ const amountDataArray = (0, import_utils28.arrayify)(
5067
5090
  "0x".concat((0, import_math17.bn)(amount).toHex().substring(2).padStart(16, "0"))
5068
5091
  );
5069
5092
  const script = new Uint8Array([
5070
- ...(0, import_utils27.arrayify)(withdrawScript.bytes),
5093
+ ...(0, import_utils28.arrayify)(withdrawScript.bytes),
5071
5094
  ...recipientDataArray,
5072
5095
  ...amountDataArray
5073
5096
  ]);
@@ -5151,16 +5174,16 @@ var Account = class extends import_interfaces.AbstractAccount {
5151
5174
 
5152
5175
  // src/wallet/base-wallet-unlocked.ts
5153
5176
  var import_hasher3 = require("@fuel-ts/hasher");
5154
- var import_utils30 = require("@fuel-ts/utils");
5177
+ var import_utils31 = require("@fuel-ts/utils");
5155
5178
 
5156
5179
  // src/signer/signer.ts
5157
5180
  var import_address5 = require("@fuel-ts/address");
5158
5181
  var import_crypto = require("@fuel-ts/crypto");
5159
5182
  var import_hasher2 = require("@fuel-ts/hasher");
5160
5183
  var import_math18 = require("@fuel-ts/math");
5161
- var import_utils28 = require("@fuel-ts/utils");
5184
+ var import_utils29 = require("@fuel-ts/utils");
5162
5185
  var import_secp256k1 = require("@noble/curves/secp256k1");
5163
- var Signer = class _Signer {
5186
+ var Signer = class {
5164
5187
  address;
5165
5188
  publicKey;
5166
5189
  compressedPublicKey;
@@ -5178,9 +5201,9 @@ var Signer = class _Signer {
5178
5201
  }
5179
5202
  }
5180
5203
  const privateKeyBytes = (0, import_math18.toBytes)(privateKey, 32);
5181
- this.privateKey = (0, import_utils28.hexlify)(privateKeyBytes);
5182
- this.publicKey = (0, import_utils28.hexlify)(import_secp256k1.secp256k1.getPublicKey(privateKeyBytes, false).slice(1));
5183
- this.compressedPublicKey = (0, import_utils28.hexlify)(import_secp256k1.secp256k1.getPublicKey(privateKeyBytes, true));
5204
+ this.privateKey = (0, import_utils29.hexlify)(privateKeyBytes);
5205
+ this.publicKey = (0, import_utils29.hexlify)(import_secp256k1.secp256k1.getPublicKey(privateKeyBytes, false).slice(1));
5206
+ this.compressedPublicKey = (0, import_utils29.hexlify)(import_secp256k1.secp256k1.getPublicKey(privateKeyBytes, true));
5184
5207
  this.address = import_address5.Address.fromPublicKey(this.publicKey);
5185
5208
  }
5186
5209
  /**
@@ -5194,11 +5217,11 @@ var Signer = class _Signer {
5194
5217
  * @returns hashed signature
5195
5218
  */
5196
5219
  sign(data) {
5197
- const signature = import_secp256k1.secp256k1.sign((0, import_utils28.arrayify)(data), (0, import_utils28.arrayify)(this.privateKey));
5220
+ const signature = import_secp256k1.secp256k1.sign((0, import_utils29.arrayify)(data), (0, import_utils29.arrayify)(this.privateKey));
5198
5221
  const r = (0, import_math18.toBytes)(`0x${signature.r.toString(16)}`, 32);
5199
5222
  const s = (0, import_math18.toBytes)(`0x${signature.s.toString(16)}`, 32);
5200
5223
  s[0] |= (signature.recovery || 0) << 7;
5201
- return (0, import_utils28.hexlify)((0, import_utils28.concat)([r, s]));
5224
+ return (0, import_utils29.hexlify)((0, import_utils29.concat)([r, s]));
5202
5225
  }
5203
5226
  /**
5204
5227
  * Add point on the current elliptic curve
@@ -5207,8 +5230,8 @@ var Signer = class _Signer {
5207
5230
  * @returns compressed point on the curve
5208
5231
  */
5209
5232
  addPoint(point) {
5210
- const p0 = import_secp256k1.secp256k1.ProjectivePoint.fromHex((0, import_utils28.arrayify)(this.compressedPublicKey));
5211
- const p1 = import_secp256k1.secp256k1.ProjectivePoint.fromHex((0, import_utils28.arrayify)(point));
5233
+ const p0 = import_secp256k1.secp256k1.ProjectivePoint.fromHex((0, import_utils29.arrayify)(this.compressedPublicKey));
5234
+ const p1 = import_secp256k1.secp256k1.ProjectivePoint.fromHex((0, import_utils29.arrayify)(point));
5212
5235
  const result = p0.add(p1);
5213
5236
  return `0x${result.toHex(true)}`;
5214
5237
  }
@@ -5220,16 +5243,16 @@ var Signer = class _Signer {
5220
5243
  * @returns public key from signature from the
5221
5244
  */
5222
5245
  static recoverPublicKey(data, signature) {
5223
- const signedMessageBytes = (0, import_utils28.arrayify)(signature);
5246
+ const signedMessageBytes = (0, import_utils29.arrayify)(signature);
5224
5247
  const r = signedMessageBytes.slice(0, 32);
5225
5248
  const s = signedMessageBytes.slice(32, 64);
5226
5249
  const recoveryParam = (s[0] & 128) >> 7;
5227
5250
  s[0] &= 127;
5228
- const sig = new import_secp256k1.secp256k1.Signature(BigInt((0, import_utils28.hexlify)(r)), BigInt((0, import_utils28.hexlify)(s))).addRecoveryBit(
5251
+ const sig = new import_secp256k1.secp256k1.Signature(BigInt((0, import_utils29.hexlify)(r)), BigInt((0, import_utils29.hexlify)(s))).addRecoveryBit(
5229
5252
  recoveryParam
5230
5253
  );
5231
- const publicKey = sig.recoverPublicKey((0, import_utils28.arrayify)(data)).toRawBytes(false).slice(1);
5232
- return (0, import_utils28.hexlify)(publicKey);
5254
+ const publicKey = sig.recoverPublicKey((0, import_utils29.arrayify)(data)).toRawBytes(false).slice(1);
5255
+ return (0, import_utils29.hexlify)(publicKey);
5233
5256
  }
5234
5257
  /**
5235
5258
  * Recover the address from a signature performed with [`sign`](#sign).
@@ -5239,7 +5262,7 @@ var Signer = class _Signer {
5239
5262
  * @returns Address from signature
5240
5263
  */
5241
5264
  static recoverAddress(data, signature) {
5242
- return import_address5.Address.fromPublicKey(_Signer.recoverPublicKey(data, signature));
5265
+ return import_address5.Address.fromPublicKey(Signer.recoverPublicKey(data, signature));
5243
5266
  }
5244
5267
  /**
5245
5268
  * Generate a random privateKey
@@ -5248,7 +5271,7 @@ var Signer = class _Signer {
5248
5271
  * @returns random 32-byte hashed
5249
5272
  */
5250
5273
  static generatePrivateKey(entropy) {
5251
- return entropy ? (0, import_hasher2.hash)((0, import_utils28.concat)([(0, import_crypto.randomBytes)(32), (0, import_utils28.arrayify)(entropy)])) : (0, import_crypto.randomBytes)(32);
5274
+ return entropy ? (0, import_hasher2.hash)((0, import_utils29.concat)([(0, import_crypto.randomBytes)(32), (0, import_utils29.arrayify)(entropy)])) : (0, import_crypto.randomBytes)(32);
5252
5275
  }
5253
5276
  /**
5254
5277
  * Extended publicKey from a compact publicKey
@@ -5257,8 +5280,8 @@ var Signer = class _Signer {
5257
5280
  * @returns extended publicKey
5258
5281
  */
5259
5282
  static extendPublicKey(publicKey) {
5260
- const point = import_secp256k1.secp256k1.ProjectivePoint.fromHex((0, import_utils28.arrayify)(publicKey));
5261
- return (0, import_utils28.hexlify)(point.toRawBytes(false).slice(1));
5283
+ const point = import_secp256k1.secp256k1.ProjectivePoint.fromHex((0, import_utils29.arrayify)(publicKey));
5284
+ return (0, import_utils29.hexlify)(point.toRawBytes(false).slice(1));
5262
5285
  }
5263
5286
  };
5264
5287
 
@@ -5266,7 +5289,7 @@ var Signer = class _Signer {
5266
5289
  var import_address6 = require("@fuel-ts/address");
5267
5290
  var import_crypto2 = require("@fuel-ts/crypto");
5268
5291
  var import_errors16 = require("@fuel-ts/errors");
5269
- var import_utils29 = require("@fuel-ts/utils");
5292
+ var import_utils30 = require("@fuel-ts/utils");
5270
5293
  var import_uuid = require("uuid");
5271
5294
  var DEFAULT_KDF_PARAMS_LOG_N = 13;
5272
5295
  var DEFAULT_KDF_PARAMS_R = 8;
@@ -5349,16 +5372,12 @@ async function decryptKeystoreWallet(jsonWallet, password) {
5349
5372
  );
5350
5373
  }
5351
5374
  const buffer = await (0, import_crypto2.decryptJsonWalletData)(ciphertextBuffer, key, ivBuffer);
5352
- const privateKey = (0, import_utils29.hexlify)(buffer);
5375
+ const privateKey = (0, import_utils30.hexlify)(buffer);
5353
5376
  return privateKey;
5354
5377
  }
5355
5378
 
5356
5379
  // src/wallet/base-wallet-unlocked.ts
5357
5380
  var BaseWalletUnlocked = class extends Account {
5358
- /**
5359
- * Default HDWallet path.
5360
- */
5361
- static defaultPath = "m/44'/1179993420'/0'/0/0";
5362
5381
  /**
5363
5382
  * A function that returns the wallet's signer.
5364
5383
  */
@@ -5398,7 +5417,7 @@ var BaseWalletUnlocked = class extends Account {
5398
5417
  */
5399
5418
  async signMessage(message) {
5400
5419
  const signedMessage = await this.signer().sign((0, import_hasher3.hashMessage)(message));
5401
- return (0, import_utils30.hexlify)(signedMessage);
5420
+ return (0, import_utils31.hexlify)(signedMessage);
5402
5421
  }
5403
5422
  /**
5404
5423
  * Signs a transaction with the wallet's private key.
@@ -5411,7 +5430,7 @@ var BaseWalletUnlocked = class extends Account {
5411
5430
  const chainId = this.provider.getChain().consensusParameters.chainId.toNumber();
5412
5431
  const hashedTransaction = transactionRequest.getTransactionId(chainId);
5413
5432
  const signature = await this.signer().sign(hashedTransaction);
5414
- return (0, import_utils30.hexlify)(signature);
5433
+ return (0, import_utils31.hexlify)(signature);
5415
5434
  }
5416
5435
  /**
5417
5436
  * Populates a transaction with the witnesses signature.
@@ -5464,19 +5483,23 @@ var BaseWalletUnlocked = class extends Account {
5464
5483
  return encryptKeystoreWallet(this.privateKey, this.address, password);
5465
5484
  }
5466
5485
  };
5486
+ /**
5487
+ * Default HDWallet path.
5488
+ */
5489
+ __publicField(BaseWalletUnlocked, "defaultPath", "m/44'/1179993420'/0'/0/0");
5467
5490
 
5468
5491
  // src/hdwallet/hdwallet.ts
5469
5492
  var import_errors19 = require("@fuel-ts/errors");
5470
5493
  var import_hasher6 = require("@fuel-ts/hasher");
5471
5494
  var import_math19 = require("@fuel-ts/math");
5472
- var import_utils34 = require("@fuel-ts/utils");
5495
+ var import_utils35 = require("@fuel-ts/utils");
5473
5496
  var import_ethers3 = require("ethers");
5474
5497
 
5475
5498
  // src/mnemonic/mnemonic.ts
5476
5499
  var import_crypto3 = require("@fuel-ts/crypto");
5477
5500
  var import_errors18 = require("@fuel-ts/errors");
5478
5501
  var import_hasher5 = require("@fuel-ts/hasher");
5479
- var import_utils32 = require("@fuel-ts/utils");
5502
+ var import_utils33 = require("@fuel-ts/utils");
5480
5503
  var import_ethers2 = require("ethers");
5481
5504
 
5482
5505
  // src/wordlists/words/english.ts
@@ -7540,7 +7563,7 @@ var Language = /* @__PURE__ */ ((Language2) => {
7540
7563
  // src/mnemonic/utils.ts
7541
7564
  var import_errors17 = require("@fuel-ts/errors");
7542
7565
  var import_hasher4 = require("@fuel-ts/hasher");
7543
- var import_utils31 = require("@fuel-ts/utils");
7566
+ var import_utils32 = require("@fuel-ts/utils");
7544
7567
  function toUtf8Bytes(stri) {
7545
7568
  const str = stri.normalize("NFKD");
7546
7569
  const result = [];
@@ -7607,14 +7630,14 @@ function entropyToMnemonicIndices(entropy) {
7607
7630
  }
7608
7631
  }
7609
7632
  const checksumBits = entropy.length / 4;
7610
- const checksum = (0, import_utils31.arrayify)((0, import_hasher4.sha256)(entropy))[0] & getUpperMask(checksumBits);
7633
+ const checksum = (0, import_utils32.arrayify)((0, import_hasher4.sha256)(entropy))[0] & getUpperMask(checksumBits);
7611
7634
  indices[indices.length - 1] <<= checksumBits;
7612
7635
  indices[indices.length - 1] |= checksum >> 8 - checksumBits;
7613
7636
  return indices;
7614
7637
  }
7615
7638
  function mnemonicWordsToEntropy(words, wordlist) {
7616
7639
  const size = Math.ceil(11 * words.length / 8);
7617
- const entropy = (0, import_utils31.arrayify)(new Uint8Array(size));
7640
+ const entropy = (0, import_utils32.arrayify)(new Uint8Array(size));
7618
7641
  let offset = 0;
7619
7642
  for (let i = 0; i < words.length; i += 1) {
7620
7643
  const index = wordlist.indexOf(words[i].normalize("NFKD"));
@@ -7634,7 +7657,7 @@ function mnemonicWordsToEntropy(words, wordlist) {
7634
7657
  const entropyBits = 32 * words.length / 3;
7635
7658
  const checksumBits = words.length / 3;
7636
7659
  const checksumMask = getUpperMask(checksumBits);
7637
- const checksum = (0, import_utils31.arrayify)((0, import_hasher4.sha256)(entropy.slice(0, entropyBits / 8)))[0] & checksumMask;
7660
+ const checksum = (0, import_utils32.arrayify)((0, import_hasher4.sha256)(entropy.slice(0, entropyBits / 8)))[0] & checksumMask;
7638
7661
  if (checksum !== (entropy[entropy.length - 1] & checksumMask)) {
7639
7662
  throw new import_errors17.FuelError(
7640
7663
  import_errors17.ErrorCode.INVALID_CHECKSUM,
@@ -7673,7 +7696,7 @@ function assertMnemonic(words) {
7673
7696
  throw new import_errors18.FuelError(import_errors18.ErrorCode.INVALID_MNEMONIC, errorMsg);
7674
7697
  }
7675
7698
  }
7676
- var Mnemonic = class _Mnemonic {
7699
+ var Mnemonic = class {
7677
7700
  wordlist;
7678
7701
  /**
7679
7702
  *
@@ -7690,7 +7713,7 @@ var Mnemonic = class _Mnemonic {
7690
7713
  * @returns Entropy hash
7691
7714
  */
7692
7715
  mnemonicToEntropy(phrase) {
7693
- return _Mnemonic.mnemonicToEntropy(phrase, this.wordlist);
7716
+ return Mnemonic.mnemonicToEntropy(phrase, this.wordlist);
7694
7717
  }
7695
7718
  /**
7696
7719
  *
@@ -7698,7 +7721,7 @@ var Mnemonic = class _Mnemonic {
7698
7721
  * @returns Mnemonic phrase
7699
7722
  */
7700
7723
  entropyToMnemonic(entropy) {
7701
- return _Mnemonic.entropyToMnemonic(entropy, this.wordlist);
7724
+ return Mnemonic.entropyToMnemonic(entropy, this.wordlist);
7702
7725
  }
7703
7726
  /**
7704
7727
  *
@@ -7709,7 +7732,7 @@ var Mnemonic = class _Mnemonic {
7709
7732
  static mnemonicToEntropy(phrase, wordlist = english) {
7710
7733
  const words = getWords(phrase);
7711
7734
  assertMnemonic(words);
7712
- return (0, import_utils32.hexlify)(mnemonicWordsToEntropy(words, wordlist));
7735
+ return (0, import_utils33.hexlify)(mnemonicWordsToEntropy(words, wordlist));
7713
7736
  }
7714
7737
  /**
7715
7738
  * @param entropy - Entropy source to the mnemonic phrase.
@@ -7717,7 +7740,7 @@ var Mnemonic = class _Mnemonic {
7717
7740
  * @returns 64-byte array contains privateKey and chainCode as described on BIP39
7718
7741
  */
7719
7742
  static entropyToMnemonic(entropy, wordlist = english) {
7720
- const entropyBytes = (0, import_utils32.arrayify)(entropy);
7743
+ const entropyBytes = (0, import_utils33.arrayify)(entropy);
7721
7744
  assertWordList(wordlist);
7722
7745
  assertEntropy(entropyBytes);
7723
7746
  return entropyToMnemonicIndices(entropyBytes).map((i) => wordlist[i]).join(" ");
@@ -7739,8 +7762,8 @@ var Mnemonic = class _Mnemonic {
7739
7762
  * @returns 64-byte array contains privateKey and chainCode as described on BIP39
7740
7763
  */
7741
7764
  static mnemonicToMasterKeys(phrase, passphrase = "") {
7742
- const seed = _Mnemonic.mnemonicToSeed(phrase, passphrase);
7743
- return _Mnemonic.masterKeysFromSeed(seed);
7765
+ const seed = Mnemonic.mnemonicToSeed(phrase, passphrase);
7766
+ return Mnemonic.masterKeysFromSeed(seed);
7744
7767
  }
7745
7768
  /**
7746
7769
  * Validates if given mnemonic is valid
@@ -7756,7 +7779,7 @@ var Mnemonic = class _Mnemonic {
7756
7779
  return false;
7757
7780
  }
7758
7781
  while (i < words.length) {
7759
- if (_Mnemonic.binarySearch(words[i]) === false) {
7782
+ if (Mnemonic.binarySearch(words[i]) === false) {
7760
7783
  return false;
7761
7784
  }
7762
7785
  i += 1;
@@ -7786,14 +7809,14 @@ var Mnemonic = class _Mnemonic {
7786
7809
  * @returns 64-byte array contains privateKey and chainCode as described on BIP39
7787
7810
  */
7788
7811
  static masterKeysFromSeed(seed) {
7789
- const seedArray = (0, import_utils32.arrayify)(seed);
7812
+ const seedArray = (0, import_utils33.arrayify)(seed);
7790
7813
  if (seedArray.length < 16 || seedArray.length > 64) {
7791
7814
  throw new import_errors18.FuelError(
7792
7815
  import_errors18.ErrorCode.INVALID_SEED,
7793
7816
  `Seed length should be between 16 and 64 bytes, but received ${seedArray.length} bytes.`
7794
7817
  );
7795
7818
  }
7796
- return (0, import_utils32.arrayify)((0, import_ethers2.computeHmac)("sha512", MasterSecret, seedArray));
7819
+ return (0, import_utils33.arrayify)((0, import_ethers2.computeHmac)("sha512", MasterSecret, seedArray));
7797
7820
  }
7798
7821
  /**
7799
7822
  * Get the extendKey as defined on BIP-32 from the provided seed
@@ -7803,23 +7826,23 @@ var Mnemonic = class _Mnemonic {
7803
7826
  * @returns BIP-32 extended private key
7804
7827
  */
7805
7828
  static seedToExtendedKey(seed, testnet = false) {
7806
- const masterKey = _Mnemonic.masterKeysFromSeed(seed);
7807
- const prefix = (0, import_utils32.arrayify)(testnet ? TestnetPRV : MainnetPRV);
7829
+ const masterKey = Mnemonic.masterKeysFromSeed(seed);
7830
+ const prefix = (0, import_utils33.arrayify)(testnet ? TestnetPRV : MainnetPRV);
7808
7831
  const depth = "0x00";
7809
7832
  const fingerprint = "0x00000000";
7810
7833
  const index = "0x00000000";
7811
7834
  const chainCode = masterKey.slice(32);
7812
7835
  const privateKey = masterKey.slice(0, 32);
7813
- const extendedKey = (0, import_utils32.concat)([
7836
+ const extendedKey = (0, import_utils33.concat)([
7814
7837
  prefix,
7815
7838
  depth,
7816
7839
  fingerprint,
7817
7840
  index,
7818
7841
  chainCode,
7819
- (0, import_utils32.concat)(["0x00", privateKey])
7842
+ (0, import_utils33.concat)(["0x00", privateKey])
7820
7843
  ]);
7821
7844
  const checksum = (0, import_ethers2.dataSlice)((0, import_hasher5.sha256)((0, import_hasher5.sha256)(extendedKey)), 0, 4);
7822
- return (0, import_ethers2.encodeBase58)((0, import_utils32.concat)([extendedKey, checksum]));
7845
+ return (0, import_ethers2.encodeBase58)((0, import_utils33.concat)([extendedKey, checksum]));
7823
7846
  }
7824
7847
  /**
7825
7848
  * Create a new mnemonic using a randomly generated number as entropy.
@@ -7834,20 +7857,20 @@ var Mnemonic = class _Mnemonic {
7834
7857
  * @returns A randomly generated mnemonic
7835
7858
  */
7836
7859
  static generate(size = 32, extraEntropy = "") {
7837
- 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);
7838
- return _Mnemonic.entropyToMnemonic(entropy);
7860
+ const entropy = extraEntropy ? (0, import_hasher5.sha256)((0, import_utils33.concat)([(0, import_crypto3.randomBytes)(size), (0, import_utils33.arrayify)(extraEntropy)])) : (0, import_crypto3.randomBytes)(size);
7861
+ return Mnemonic.entropyToMnemonic(entropy);
7839
7862
  }
7840
7863
  };
7841
7864
  var mnemonic_default = Mnemonic;
7842
7865
 
7843
7866
  // src/hdwallet/hdwallet.ts
7844
7867
  var HARDENED_INDEX = 2147483648;
7845
- var MainnetPRV2 = (0, import_utils34.hexlify)("0x0488ade4");
7846
- var MainnetPUB = (0, import_utils34.hexlify)("0x0488b21e");
7847
- var TestnetPRV2 = (0, import_utils34.hexlify)("0x04358394");
7848
- var TestnetPUB = (0, import_utils34.hexlify)("0x043587cf");
7868
+ var MainnetPRV2 = (0, import_utils35.hexlify)("0x0488ade4");
7869
+ var MainnetPUB = (0, import_utils35.hexlify)("0x0488b21e");
7870
+ var TestnetPRV2 = (0, import_utils35.hexlify)("0x04358394");
7871
+ var TestnetPUB = (0, import_utils35.hexlify)("0x043587cf");
7849
7872
  function base58check(data) {
7850
- return (0, import_ethers3.encodeBase58)((0, import_utils34.concat)([data, (0, import_ethers3.dataSlice)((0, import_hasher6.sha256)((0, import_hasher6.sha256)(data)), 0, 4)]));
7873
+ return (0, import_ethers3.encodeBase58)((0, import_utils35.concat)([data, (0, import_ethers3.dataSlice)((0, import_hasher6.sha256)((0, import_hasher6.sha256)(data)), 0, 4)]));
7851
7874
  }
7852
7875
  function getExtendedKeyPrefix(isPublic = false, testnet = false) {
7853
7876
  if (isPublic) {
@@ -7856,11 +7879,11 @@ function getExtendedKeyPrefix(isPublic = false, testnet = false) {
7856
7879
  return testnet ? TestnetPRV2 : MainnetPRV2;
7857
7880
  }
7858
7881
  function isPublicExtendedKey(extendedKey) {
7859
- return [MainnetPUB, TestnetPUB].includes((0, import_utils34.hexlify)(extendedKey.slice(0, 4)));
7882
+ return [MainnetPUB, TestnetPUB].includes((0, import_utils35.hexlify)(extendedKey.slice(0, 4)));
7860
7883
  }
7861
7884
  function isValidExtendedKey(extendedKey) {
7862
7885
  return [MainnetPRV2, TestnetPRV2, MainnetPUB, TestnetPUB].includes(
7863
- (0, import_utils34.hexlify)(extendedKey.slice(0, 4))
7886
+ (0, import_utils35.hexlify)(extendedKey.slice(0, 4))
7864
7887
  );
7865
7888
  }
7866
7889
  function parsePath(path, depth = 0) {
@@ -7875,11 +7898,11 @@ function parsePath(path, depth = 0) {
7875
7898
  (p) => ~p.indexOf(`'`) ? parseInt(p, 10) + HARDENED_INDEX : parseInt(p, 10)
7876
7899
  );
7877
7900
  }
7878
- var HDWallet = class _HDWallet {
7901
+ var HDWallet = class {
7879
7902
  depth = 0;
7880
7903
  index = 0;
7881
- fingerprint = (0, import_utils34.hexlify)("0x00000000");
7882
- parentFingerprint = (0, import_utils34.hexlify)("0x00000000");
7904
+ fingerprint = (0, import_utils35.hexlify)("0x00000000");
7905
+ parentFingerprint = (0, import_utils35.hexlify)("0x00000000");
7883
7906
  privateKey;
7884
7907
  publicKey;
7885
7908
  chainCode;
@@ -7891,8 +7914,8 @@ var HDWallet = class _HDWallet {
7891
7914
  constructor(config) {
7892
7915
  if (config.privateKey) {
7893
7916
  const signer = new Signer(config.privateKey);
7894
- this.publicKey = (0, import_utils34.hexlify)(signer.compressedPublicKey);
7895
- this.privateKey = (0, import_utils34.hexlify)(config.privateKey);
7917
+ this.publicKey = (0, import_utils35.hexlify)(signer.compressedPublicKey);
7918
+ this.privateKey = (0, import_utils35.hexlify)(config.privateKey);
7896
7919
  } else {
7897
7920
  if (!config.publicKey) {
7898
7921
  throw new import_errors19.FuelError(
@@ -7900,7 +7923,7 @@ var HDWallet = class _HDWallet {
7900
7923
  "Both public and private Key cannot be missing. At least one should be provided."
7901
7924
  );
7902
7925
  }
7903
- this.publicKey = (0, import_utils34.hexlify)(config.publicKey);
7926
+ this.publicKey = (0, import_utils35.hexlify)(config.publicKey);
7904
7927
  }
7905
7928
  this.parentFingerprint = config.parentFingerprint || this.parentFingerprint;
7906
7929
  this.fingerprint = (0, import_ethers3.dataSlice)((0, import_ethers3.ripemd160)((0, import_hasher6.sha256)(this.publicKey)), 0, 4);
@@ -7919,9 +7942,9 @@ var HDWallet = class _HDWallet {
7919
7942
  * @returns A new instance of HDWallet on the derived index
7920
7943
  */
7921
7944
  deriveIndex(index) {
7922
- const privateKey = this.privateKey && (0, import_utils34.arrayify)(this.privateKey);
7923
- const publicKey = (0, import_utils34.arrayify)(this.publicKey);
7924
- const chainCode = (0, import_utils34.arrayify)(this.chainCode);
7945
+ const privateKey = this.privateKey && (0, import_utils35.arrayify)(this.privateKey);
7946
+ const publicKey = (0, import_utils35.arrayify)(this.publicKey);
7947
+ const chainCode = (0, import_utils35.arrayify)(this.chainCode);
7925
7948
  const data = new Uint8Array(37);
7926
7949
  if (index & HARDENED_INDEX) {
7927
7950
  if (!privateKey) {
@@ -7932,16 +7955,16 @@ var HDWallet = class _HDWallet {
7932
7955
  }
7933
7956
  data.set(privateKey, 1);
7934
7957
  } else {
7935
- data.set((0, import_utils34.arrayify)(this.publicKey));
7958
+ data.set((0, import_utils35.arrayify)(this.publicKey));
7936
7959
  }
7937
7960
  data.set((0, import_math19.toBytes)(index, 4), 33);
7938
- const bytes = (0, import_utils34.arrayify)((0, import_ethers3.computeHmac)("sha512", chainCode, data));
7961
+ const bytes = (0, import_utils35.arrayify)((0, import_ethers3.computeHmac)("sha512", chainCode, data));
7939
7962
  const IL = bytes.slice(0, 32);
7940
7963
  const IR = bytes.slice(32);
7941
7964
  if (privateKey) {
7942
7965
  const N = "0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141";
7943
7966
  const ki = (0, import_math19.bn)(IL).add(privateKey).mod(N).toBytes(32);
7944
- return new _HDWallet({
7967
+ return new HDWallet({
7945
7968
  privateKey: ki,
7946
7969
  chainCode: IR,
7947
7970
  index,
@@ -7949,9 +7972,9 @@ var HDWallet = class _HDWallet {
7949
7972
  parentFingerprint: this.fingerprint
7950
7973
  });
7951
7974
  }
7952
- const signer = new Signer((0, import_utils34.hexlify)(IL));
7975
+ const signer = new Signer((0, import_utils35.hexlify)(IL));
7953
7976
  const Ki = signer.addPoint(publicKey);
7954
- return new _HDWallet({
7977
+ return new HDWallet({
7955
7978
  publicKey: Ki,
7956
7979
  chainCode: IR,
7957
7980
  index,
@@ -7984,12 +8007,12 @@ var HDWallet = class _HDWallet {
7984
8007
  );
7985
8008
  }
7986
8009
  const prefix = getExtendedKeyPrefix(this.privateKey == null || isPublic, testnet);
7987
- const depth = (0, import_utils34.hexlify)(Uint8Array.from([this.depth]));
8010
+ const depth = (0, import_utils35.hexlify)(Uint8Array.from([this.depth]));
7988
8011
  const parentFingerprint = this.parentFingerprint;
7989
8012
  const index = (0, import_math19.toHex)(this.index, 4);
7990
8013
  const chainCode = this.chainCode;
7991
- const key = this.privateKey != null && !isPublic ? (0, import_utils34.concat)(["0x00", this.privateKey]) : this.publicKey;
7992
- const extendedKey = (0, import_utils34.arrayify)((0, import_utils34.concat)([prefix, depth, parentFingerprint, index, chainCode, key]));
8014
+ const key = this.privateKey != null && !isPublic ? (0, import_utils35.concat)(["0x00", this.privateKey]) : this.publicKey;
8015
+ const extendedKey = (0, import_utils35.arrayify)((0, import_utils35.concat)([prefix, depth, parentFingerprint, index, chainCode, key]));
7993
8016
  return base58check(extendedKey);
7994
8017
  }
7995
8018
  /**
@@ -8000,14 +8023,14 @@ var HDWallet = class _HDWallet {
8000
8023
  */
8001
8024
  static fromSeed(seed) {
8002
8025
  const masterKey = mnemonic_default.masterKeysFromSeed(seed);
8003
- return new _HDWallet({
8004
- chainCode: (0, import_utils34.arrayify)(masterKey.slice(32)),
8005
- privateKey: (0, import_utils34.arrayify)(masterKey.slice(0, 32))
8026
+ return new HDWallet({
8027
+ chainCode: (0, import_utils35.arrayify)(masterKey.slice(32)),
8028
+ privateKey: (0, import_utils35.arrayify)(masterKey.slice(0, 32))
8006
8029
  });
8007
8030
  }
8008
8031
  static fromExtendedKey(extendedKey) {
8009
8032
  const decoded = (0, import_ethers3.toBeHex)((0, import_ethers3.decodeBase58)(extendedKey));
8010
- const bytes = (0, import_utils34.arrayify)(decoded);
8033
+ const bytes = (0, import_utils35.arrayify)(decoded);
8011
8034
  const validChecksum = base58check(bytes.slice(0, 78)) === extendedKey;
8012
8035
  if (bytes.length !== 82 || !isValidExtendedKey(bytes)) {
8013
8036
  throw new import_errors19.FuelError(import_errors19.ErrorCode.HD_WALLET_ERROR, "Provided key is not a valid extended key.");
@@ -8016,9 +8039,9 @@ var HDWallet = class _HDWallet {
8016
8039
  throw new import_errors19.FuelError(import_errors19.ErrorCode.HD_WALLET_ERROR, "Provided key has an invalid checksum.");
8017
8040
  }
8018
8041
  const depth = bytes[4];
8019
- const parentFingerprint = (0, import_utils34.hexlify)(bytes.slice(5, 9));
8020
- const index = parseInt((0, import_utils34.hexlify)(bytes.slice(9, 13)).substring(2), 16);
8021
- const chainCode = (0, import_utils34.hexlify)(bytes.slice(13, 45));
8042
+ const parentFingerprint = (0, import_utils35.hexlify)(bytes.slice(5, 9));
8043
+ const index = parseInt((0, import_utils35.hexlify)(bytes.slice(9, 13)).substring(2), 16);
8044
+ const chainCode = (0, import_utils35.hexlify)(bytes.slice(13, 45));
8022
8045
  const key = bytes.slice(45, 78);
8023
8046
  if (depth === 0 && parentFingerprint !== "0x00000000" || depth === 0 && index !== 0) {
8024
8047
  throw new import_errors19.FuelError(
@@ -8030,7 +8053,7 @@ var HDWallet = class _HDWallet {
8030
8053
  if (key[0] !== 3) {
8031
8054
  throw new import_errors19.FuelError(import_errors19.ErrorCode.HD_WALLET_ERROR, "Invalid public extended key.");
8032
8055
  }
8033
- return new _HDWallet({
8056
+ return new HDWallet({
8034
8057
  publicKey: key,
8035
8058
  chainCode,
8036
8059
  index,
@@ -8041,7 +8064,7 @@ var HDWallet = class _HDWallet {
8041
8064
  if (key[0] !== 0) {
8042
8065
  throw new import_errors19.FuelError(import_errors19.ErrorCode.HD_WALLET_ERROR, "Invalid private extended key.");
8043
8066
  }
8044
- return new _HDWallet({
8067
+ return new HDWallet({
8045
8068
  privateKey: key.slice(1),
8046
8069
  chainCode,
8047
8070
  index,
@@ -8064,7 +8087,7 @@ var WalletLocked = class extends Account {
8064
8087
  return new WalletUnlocked(privateKey, this._provider);
8065
8088
  }
8066
8089
  };
8067
- var WalletUnlocked = class _WalletUnlocked extends BaseWalletUnlocked {
8090
+ var WalletUnlocked = class extends BaseWalletUnlocked {
8068
8091
  /**
8069
8092
  * Locks the wallet and returns an instance of WalletLocked.
8070
8093
  *
@@ -8082,7 +8105,7 @@ var WalletUnlocked = class _WalletUnlocked extends BaseWalletUnlocked {
8082
8105
  */
8083
8106
  static generate(generateOptions) {
8084
8107
  const privateKey = Signer.generatePrivateKey(generateOptions?.entropy);
8085
- return new _WalletUnlocked(privateKey, generateOptions?.provider);
8108
+ return new WalletUnlocked(privateKey, generateOptions?.provider);
8086
8109
  }
8087
8110
  /**
8088
8111
  * Create a Wallet Unlocked from a seed.
@@ -8094,8 +8117,8 @@ var WalletUnlocked = class _WalletUnlocked extends BaseWalletUnlocked {
8094
8117
  */
8095
8118
  static fromSeed(seed, path, provider) {
8096
8119
  const hdWallet = hdwallet_default.fromSeed(seed);
8097
- const childWallet = hdWallet.derivePath(path || _WalletUnlocked.defaultPath);
8098
- return new _WalletUnlocked(childWallet.privateKey, provider);
8120
+ const childWallet = hdWallet.derivePath(path || WalletUnlocked.defaultPath);
8121
+ return new WalletUnlocked(childWallet.privateKey, provider);
8099
8122
  }
8100
8123
  /**
8101
8124
  * Create a Wallet Unlocked from a mnemonic phrase.
@@ -8109,8 +8132,8 @@ var WalletUnlocked = class _WalletUnlocked extends BaseWalletUnlocked {
8109
8132
  static fromMnemonic(mnemonic, path, passphrase, provider) {
8110
8133
  const seed = mnemonic_default.mnemonicToSeed(mnemonic, passphrase);
8111
8134
  const hdWallet = hdwallet_default.fromSeed(seed);
8112
- const childWallet = hdWallet.derivePath(path || _WalletUnlocked.defaultPath);
8113
- return new _WalletUnlocked(childWallet.privateKey, provider);
8135
+ const childWallet = hdWallet.derivePath(path || WalletUnlocked.defaultPath);
8136
+ return new WalletUnlocked(childWallet.privateKey, provider);
8114
8137
  }
8115
8138
  /**
8116
8139
  * Create a Wallet Unlocked from an extended key.
@@ -8121,7 +8144,7 @@ var WalletUnlocked = class _WalletUnlocked extends BaseWalletUnlocked {
8121
8144
  */
8122
8145
  static fromExtendedKey(extendedKey, provider) {
8123
8146
  const hdWallet = hdwallet_default.fromExtendedKey(extendedKey);
8124
- return new _WalletUnlocked(hdWallet.privateKey, provider);
8147
+ return new WalletUnlocked(hdWallet.privateKey, provider);
8125
8148
  }
8126
8149
  /**
8127
8150
  * Create a Wallet Unlocked from an encrypted JSON.
@@ -8133,7 +8156,7 @@ var WalletUnlocked = class _WalletUnlocked extends BaseWalletUnlocked {
8133
8156
  */
8134
8157
  static async fromEncryptedJson(jsonWallet, password, provider) {
8135
8158
  const privateKey = await decryptKeystoreWallet(jsonWallet, password);
8136
- return new _WalletUnlocked(privateKey, provider);
8159
+ return new WalletUnlocked(privateKey, provider);
8137
8160
  }
8138
8161
  };
8139
8162
 
@@ -8159,50 +8182,50 @@ var Wallet = class {
8159
8182
  static fromPrivateKey(privateKey, provider) {
8160
8183
  return new WalletUnlocked(privateKey, provider);
8161
8184
  }
8162
- /**
8163
- * Generate a new Wallet Unlocked with a random key pair.
8164
- *
8165
- * @param generateOptions - Options to customize the generation process (optional).
8166
- * @returns An unlocked wallet instance.
8167
- */
8168
- static generate = WalletUnlocked.generate;
8169
- /**
8170
- * Create a Wallet Unlocked from a seed.
8171
- *
8172
- * @param seed - The seed phrase.
8173
- * @param provider - A Provider instance (optional).
8174
- * @param path - The derivation path (optional).
8175
- * @returns An unlocked wallet instance.
8176
- */
8177
- static fromSeed = WalletUnlocked.fromSeed;
8178
- /**
8179
- * Create a Wallet Unlocked from a mnemonic phrase.
8180
- *
8181
- * @param mnemonic - The mnemonic phrase.
8182
- * @param provider - A Provider instance (optional).
8183
- * @param path - The derivation path (optional).
8184
- * @param passphrase - The passphrase for the mnemonic (optional).
8185
- * @returns An unlocked wallet instance.
8186
- */
8187
- static fromMnemonic = WalletUnlocked.fromMnemonic;
8188
- /**
8189
- * Create a Wallet Unlocked from an extended key.
8190
- *
8191
- * @param extendedKey - The extended key.
8192
- * @param provider - A Provider instance (optional).
8193
- * @returns An unlocked wallet instance.
8194
- */
8195
- static fromExtendedKey = WalletUnlocked.fromExtendedKey;
8196
- /**
8197
- * Create a Wallet Unlocked from an encrypted JSON.
8198
- *
8199
- * @param jsonWallet - The encrypted JSON keystore.
8200
- * @param password - The password to decrypt the JSON.
8201
- * @param provider - A Provider instance (optional).
8202
- * @returns An unlocked wallet instance.
8203
- */
8204
- static fromEncryptedJson = WalletUnlocked.fromEncryptedJson;
8205
8185
  };
8186
+ /**
8187
+ * Generate a new Wallet Unlocked with a random key pair.
8188
+ *
8189
+ * @param generateOptions - Options to customize the generation process (optional).
8190
+ * @returns An unlocked wallet instance.
8191
+ */
8192
+ __publicField(Wallet, "generate", WalletUnlocked.generate);
8193
+ /**
8194
+ * Create a Wallet Unlocked from a seed.
8195
+ *
8196
+ * @param seed - The seed phrase.
8197
+ * @param provider - A Provider instance (optional).
8198
+ * @param path - The derivation path (optional).
8199
+ * @returns An unlocked wallet instance.
8200
+ */
8201
+ __publicField(Wallet, "fromSeed", WalletUnlocked.fromSeed);
8202
+ /**
8203
+ * Create a Wallet Unlocked from a mnemonic phrase.
8204
+ *
8205
+ * @param mnemonic - The mnemonic phrase.
8206
+ * @param provider - A Provider instance (optional).
8207
+ * @param path - The derivation path (optional).
8208
+ * @param passphrase - The passphrase for the mnemonic (optional).
8209
+ * @returns An unlocked wallet instance.
8210
+ */
8211
+ __publicField(Wallet, "fromMnemonic", WalletUnlocked.fromMnemonic);
8212
+ /**
8213
+ * Create a Wallet Unlocked from an extended key.
8214
+ *
8215
+ * @param extendedKey - The extended key.
8216
+ * @param provider - A Provider instance (optional).
8217
+ * @returns An unlocked wallet instance.
8218
+ */
8219
+ __publicField(Wallet, "fromExtendedKey", WalletUnlocked.fromExtendedKey);
8220
+ /**
8221
+ * Create a Wallet Unlocked from an encrypted JSON.
8222
+ *
8223
+ * @param jsonWallet - The encrypted JSON keystore.
8224
+ * @param password - The password to decrypt the JSON.
8225
+ * @param provider - A Provider instance (optional).
8226
+ * @returns An unlocked wallet instance.
8227
+ */
8228
+ __publicField(Wallet, "fromEncryptedJson", WalletUnlocked.fromEncryptedJson);
8206
8229
 
8207
8230
  // src/wallet-manager/wallet-manager.ts
8208
8231
  var import_address9 = require("@fuel-ts/address");
@@ -8231,14 +8254,14 @@ var MemoryStorage = class {
8231
8254
  // src/wallet-manager/vaults/mnemonic-vault.ts
8232
8255
  var import_address7 = require("@fuel-ts/address");
8233
8256
  var import_errors20 = require("@fuel-ts/errors");
8257
+ var _secret;
8234
8258
  var MnemonicVault = class {
8235
- static type = "mnemonic";
8236
- #secret;
8237
- pathKey = "{}";
8238
- rootPath = `m/44'/1179993420'/${this.pathKey}'/0/0`;
8239
- numberOfAccounts = 0;
8240
8259
  constructor(options) {
8241
- this.#secret = options.secret || mnemonic_default.generate();
8260
+ __privateAdd(this, _secret, void 0);
8261
+ __publicField(this, "pathKey", "{}");
8262
+ __publicField(this, "rootPath", `m/44'/1179993420'/${this.pathKey}'/0/0`);
8263
+ __publicField(this, "numberOfAccounts", 0);
8264
+ __privateSet(this, _secret, options.secret || mnemonic_default.generate());
8242
8265
  this.rootPath = options.rootPath || this.rootPath;
8243
8266
  this.numberOfAccounts = options.numberOfAccounts || 1;
8244
8267
  }
@@ -8250,7 +8273,7 @@ var MnemonicVault = class {
8250
8273
  }
8251
8274
  serialize() {
8252
8275
  return {
8253
- secret: this.#secret,
8276
+ secret: __privateGet(this, _secret),
8254
8277
  rootPath: this.rootPath,
8255
8278
  numberOfAccounts: this.numberOfAccounts
8256
8279
  };
@@ -8259,7 +8282,7 @@ var MnemonicVault = class {
8259
8282
  const accounts = [];
8260
8283
  let numberOfAccounts = 0;
8261
8284
  do {
8262
- const wallet = Wallet.fromMnemonic(this.#secret, this.getDerivePath(numberOfAccounts));
8285
+ const wallet = Wallet.fromMnemonic(__privateGet(this, _secret), this.getDerivePath(numberOfAccounts));
8263
8286
  accounts.push({
8264
8287
  publicKey: wallet.publicKey,
8265
8288
  address: wallet.address
@@ -8270,7 +8293,7 @@ var MnemonicVault = class {
8270
8293
  }
8271
8294
  addAccount() {
8272
8295
  this.numberOfAccounts += 1;
8273
- const wallet = Wallet.fromMnemonic(this.#secret, this.getDerivePath(this.numberOfAccounts - 1));
8296
+ const wallet = Wallet.fromMnemonic(__privateGet(this, _secret), this.getDerivePath(this.numberOfAccounts - 1));
8274
8297
  return {
8275
8298
  publicKey: wallet.publicKey,
8276
8299
  address: wallet.address
@@ -8280,7 +8303,7 @@ var MnemonicVault = class {
8280
8303
  let numberOfAccounts = 0;
8281
8304
  const ownerAddress = import_address7.Address.fromAddressOrString(address);
8282
8305
  do {
8283
- const wallet = Wallet.fromMnemonic(this.#secret, this.getDerivePath(numberOfAccounts));
8306
+ const wallet = Wallet.fromMnemonic(__privateGet(this, _secret), this.getDerivePath(numberOfAccounts));
8284
8307
  if (wallet.address.equals(ownerAddress)) {
8285
8308
  return wallet.privateKey;
8286
8309
  }
@@ -8296,27 +8319,29 @@ var MnemonicVault = class {
8296
8319
  return Wallet.fromPrivateKey(privateKey);
8297
8320
  }
8298
8321
  };
8322
+ _secret = new WeakMap();
8323
+ __publicField(MnemonicVault, "type", "mnemonic");
8299
8324
 
8300
8325
  // src/wallet-manager/vaults/privatekey-vault.ts
8301
8326
  var import_address8 = require("@fuel-ts/address");
8302
8327
  var import_errors21 = require("@fuel-ts/errors");
8328
+ var _privateKeys;
8303
8329
  var PrivateKeyVault = class {
8304
- static type = "privateKey";
8305
- #privateKeys = [];
8306
8330
  /**
8307
8331
  * If privateKey vault is initialized with a secretKey, it creates
8308
8332
  * one account with the fallowing secret
8309
8333
  */
8310
8334
  constructor(options = {}) {
8335
+ __privateAdd(this, _privateKeys, []);
8311
8336
  if (options.secret) {
8312
- this.#privateKeys = [options.secret];
8337
+ __privateSet(this, _privateKeys, [options.secret]);
8313
8338
  } else {
8314
- this.#privateKeys = options.accounts || [Wallet.generate().privateKey];
8339
+ __privateSet(this, _privateKeys, options.accounts || [Wallet.generate().privateKey]);
8315
8340
  }
8316
8341
  }
8317
8342
  serialize() {
8318
8343
  return {
8319
- accounts: this.#privateKeys
8344
+ accounts: __privateGet(this, _privateKeys)
8320
8345
  };
8321
8346
  }
8322
8347
  getPublicAccount(privateKey) {
@@ -8327,16 +8352,16 @@ var PrivateKeyVault = class {
8327
8352
  };
8328
8353
  }
8329
8354
  getAccounts() {
8330
- return this.#privateKeys.map((pk) => this.getPublicAccount(pk));
8355
+ return __privateGet(this, _privateKeys).map((pk) => this.getPublicAccount(pk));
8331
8356
  }
8332
8357
  addAccount() {
8333
8358
  const wallet = Wallet.generate();
8334
- this.#privateKeys.push(wallet.privateKey);
8359
+ __privateGet(this, _privateKeys).push(wallet.privateKey);
8335
8360
  return this.getPublicAccount(wallet.privateKey);
8336
8361
  }
8337
8362
  exportAccount(address) {
8338
8363
  const ownerAddress = import_address8.Address.fromAddressOrString(address);
8339
- const privateKey = this.#privateKeys.find(
8364
+ const privateKey = __privateGet(this, _privateKeys).find(
8340
8365
  (pk) => Wallet.fromPrivateKey(pk).address.equals(ownerAddress)
8341
8366
  );
8342
8367
  if (!privateKey) {
@@ -8352,6 +8377,8 @@ var PrivateKeyVault = class {
8352
8377
  return Wallet.fromPrivateKey(privateKey);
8353
8378
  }
8354
8379
  };
8380
+ _privateKeys = new WeakMap();
8381
+ __publicField(PrivateKeyVault, "type", "privateKey");
8355
8382
 
8356
8383
  // src/wallet-manager/wallet-manager.ts
8357
8384
  var ERROR_MESSAGES = {
@@ -8366,43 +8393,46 @@ function assert(condition, message) {
8366
8393
  throw new import_errors22.FuelError(import_errors22.ErrorCode.WALLET_MANAGER_ERROR, message);
8367
8394
  }
8368
8395
  }
8369
- var WalletManager = class _WalletManager extends import_events.EventEmitter {
8370
- /**
8371
- * Vaults
8372
- *
8373
- * Vaults are responsible to store secret keys and return an `Wallet` instance,
8374
- * to interact with the network.
8375
- *
8376
- * Each vault has access to its own state
8377
- *
8378
- */
8379
- static Vaults = [MnemonicVault, PrivateKeyVault];
8380
- /**
8381
- * Storage
8382
- *
8383
- * Persistent encrypted data. `The default storage works only on memory`.
8384
- */
8385
- storage = new MemoryStorage();
8386
- /* Key name passed to the storage */
8387
- STORAGE_KEY = "WalletManager";
8388
- // `This variables are only accessible from inside the class`
8389
- #vaults = [];
8390
- #passphrase = "";
8391
- #isLocked = true;
8396
+ var _vaults, _passphrase, _isLocked, _serializeVaults, serializeVaults_fn, _deserializeVaults, deserializeVaults_fn;
8397
+ var _WalletManager = class extends import_events.EventEmitter {
8392
8398
  constructor(options) {
8393
8399
  super();
8400
+ /**
8401
+ * Serialize all vaults to store
8402
+ *
8403
+ * `This is only accessible from inside the class`
8404
+ */
8405
+ __privateAdd(this, _serializeVaults);
8406
+ /**
8407
+ * Deserialize all vaults to state
8408
+ *
8409
+ * `This is only accessible from inside the class`
8410
+ */
8411
+ __privateAdd(this, _deserializeVaults);
8412
+ /**
8413
+ * Storage
8414
+ *
8415
+ * Persistent encrypted data. `The default storage works only on memory`.
8416
+ */
8417
+ __publicField(this, "storage", new MemoryStorage());
8418
+ /* Key name passed to the storage */
8419
+ __publicField(this, "STORAGE_KEY", "WalletManager");
8420
+ // `This variables are only accessible from inside the class`
8421
+ __privateAdd(this, _vaults, []);
8422
+ __privateAdd(this, _passphrase, "");
8423
+ __privateAdd(this, _isLocked, true);
8394
8424
  this.storage = options?.storage || this.storage;
8395
8425
  }
8396
8426
  get isLocked() {
8397
- return this.#isLocked;
8427
+ return __privateGet(this, _isLocked);
8398
8428
  }
8399
8429
  /**
8400
8430
  * Return the vault serialized object containing all the privateKeys,
8401
8431
  * the format of the return depends on the Vault type.
8402
8432
  */
8403
8433
  exportVault(vaultId) {
8404
- assert(!this.#isLocked, ERROR_MESSAGES.wallet_not_unlocked);
8405
- const vaultState = this.#vaults.find((_, idx) => idx === vaultId);
8434
+ assert(!__privateGet(this, _isLocked), ERROR_MESSAGES.wallet_not_unlocked);
8435
+ const vaultState = __privateGet(this, _vaults).find((_, idx) => idx === vaultId);
8406
8436
  assert(vaultState, ERROR_MESSAGES.vault_not_found);
8407
8437
  return vaultState.vault.serialize();
8408
8438
  }
@@ -8410,7 +8440,7 @@ var WalletManager = class _WalletManager extends import_events.EventEmitter {
8410
8440
  * List all vaults on the Wallet Manager, this function not return secret's
8411
8441
  */
8412
8442
  getVaults() {
8413
- return this.#vaults.map((v, idx) => ({
8443
+ return __privateGet(this, _vaults).map((v, idx) => ({
8414
8444
  title: v.title,
8415
8445
  type: v.type,
8416
8446
  vaultId: idx
@@ -8420,7 +8450,7 @@ var WalletManager = class _WalletManager extends import_events.EventEmitter {
8420
8450
  * List all accounts on the Wallet Manager not vault information is revealed
8421
8451
  */
8422
8452
  getAccounts() {
8423
- return this.#vaults.flatMap(
8453
+ return __privateGet(this, _vaults).flatMap(
8424
8454
  (vaultState, vaultId) => vaultState.vault.getAccounts().map((account) => ({ ...account, vaultId }))
8425
8455
  );
8426
8456
  }
@@ -8429,7 +8459,7 @@ var WalletManager = class _WalletManager extends import_events.EventEmitter {
8429
8459
  */
8430
8460
  getWallet(address) {
8431
8461
  const ownerAddress = import_address9.Address.fromAddressOrString(address);
8432
- const vaultState = this.#vaults.find(
8462
+ const vaultState = __privateGet(this, _vaults).find(
8433
8463
  (vs) => vs.vault.getAccounts().find((a) => a.address.equals(ownerAddress))
8434
8464
  );
8435
8465
  assert(vaultState, ERROR_MESSAGES.address_not_found);
@@ -8440,8 +8470,8 @@ var WalletManager = class _WalletManager extends import_events.EventEmitter {
8440
8470
  */
8441
8471
  exportPrivateKey(address) {
8442
8472
  const ownerAddress = import_address9.Address.fromAddressOrString(address);
8443
- assert(!this.#isLocked, ERROR_MESSAGES.wallet_not_unlocked);
8444
- const vaultState = this.#vaults.find(
8473
+ assert(!__privateGet(this, _isLocked), ERROR_MESSAGES.wallet_not_unlocked);
8474
+ const vaultState = __privateGet(this, _vaults).find(
8445
8475
  (vs) => vs.vault.getAccounts().find((a) => a.address.equals(ownerAddress))
8446
8476
  );
8447
8477
  assert(vaultState, ERROR_MESSAGES.address_not_found);
@@ -8453,7 +8483,7 @@ var WalletManager = class _WalletManager extends import_events.EventEmitter {
8453
8483
  */
8454
8484
  async addAccount(options) {
8455
8485
  await this.loadState();
8456
- const vaultState = this.#vaults[options?.vaultId || 0];
8486
+ const vaultState = __privateGet(this, _vaults)[options?.vaultId || 0];
8457
8487
  await assert(vaultState, ERROR_MESSAGES.vault_not_found);
8458
8488
  const account = vaultState.vault.addAccount();
8459
8489
  await this.saveState();
@@ -8464,7 +8494,7 @@ var WalletManager = class _WalletManager extends import_events.EventEmitter {
8464
8494
  * created by the vault.
8465
8495
  */
8466
8496
  async removeVault(index) {
8467
- this.#vaults.splice(index, 1);
8497
+ __privateGet(this, _vaults).splice(index, 1);
8468
8498
  await this.saveState();
8469
8499
  }
8470
8500
  /**
@@ -8475,11 +8505,11 @@ var WalletManager = class _WalletManager extends import_events.EventEmitter {
8475
8505
  await this.loadState();
8476
8506
  const Vault2 = this.getVaultClass(vaultConfig.type);
8477
8507
  const vault = new Vault2(vaultConfig);
8478
- this.#vaults = this.#vaults.concat({
8508
+ __privateSet(this, _vaults, __privateGet(this, _vaults).concat({
8479
8509
  title: vaultConfig.title,
8480
8510
  type: vaultConfig.type,
8481
8511
  vault
8482
- });
8512
+ }));
8483
8513
  await this.saveState();
8484
8514
  }
8485
8515
  /**
@@ -8487,9 +8517,9 @@ var WalletManager = class _WalletManager extends import_events.EventEmitter {
8487
8517
  * secrets.
8488
8518
  */
8489
8519
  lock() {
8490
- this.#isLocked = true;
8491
- this.#vaults = [];
8492
- this.#passphrase = "";
8520
+ __privateSet(this, _isLocked, true);
8521
+ __privateSet(this, _vaults, []);
8522
+ __privateSet(this, _passphrase, "");
8493
8523
  this.emit("lock");
8494
8524
  }
8495
8525
  /**
@@ -8497,8 +8527,8 @@ var WalletManager = class _WalletManager extends import_events.EventEmitter {
8497
8527
  * Vaults with secrets are not unlocked or instantiated on this moment.
8498
8528
  */
8499
8529
  async unlock(passphrase) {
8500
- this.#passphrase = passphrase;
8501
- this.#isLocked = false;
8530
+ __privateSet(this, _passphrase, passphrase);
8531
+ __privateSet(this, _isLocked, false);
8502
8532
  try {
8503
8533
  await this.loadState();
8504
8534
  this.emit("unlock");
@@ -8511,9 +8541,9 @@ var WalletManager = class _WalletManager extends import_events.EventEmitter {
8511
8541
  * Update WalletManager encryption passphrase
8512
8542
  */
8513
8543
  async updatePassphrase(oldpass, newpass) {
8514
- const isLocked = this.#isLocked;
8544
+ const isLocked = __privateGet(this, _isLocked);
8515
8545
  await this.unlock(oldpass);
8516
- this.#passphrase = newpass;
8546
+ __privateSet(this, _passphrase, newpass);
8517
8547
  await this.saveState();
8518
8548
  await this.loadState();
8519
8549
  if (isLocked) {
@@ -8524,51 +8554,24 @@ var WalletManager = class _WalletManager extends import_events.EventEmitter {
8524
8554
  * Retrieve and decrypt WalletManager state from storage
8525
8555
  */
8526
8556
  async loadState() {
8527
- await assert(!this.#isLocked, ERROR_MESSAGES.wallet_not_unlocked);
8557
+ await assert(!__privateGet(this, _isLocked), ERROR_MESSAGES.wallet_not_unlocked);
8528
8558
  const data = await this.storage.getItem(this.STORAGE_KEY);
8529
8559
  if (data) {
8530
- const state = await (0, import_crypto4.decrypt)(this.#passphrase, JSON.parse(data));
8531
- this.#vaults = this.#deserializeVaults(state.vaults);
8560
+ const state = await (0, import_crypto4.decrypt)(__privateGet(this, _passphrase), JSON.parse(data));
8561
+ __privateSet(this, _vaults, __privateMethod(this, _deserializeVaults, deserializeVaults_fn).call(this, state.vaults));
8532
8562
  }
8533
8563
  }
8534
8564
  /**
8535
8565
  * Store encrypted WalletManager state on storage
8536
8566
  */
8537
8567
  async saveState() {
8538
- await assert(!this.#isLocked, ERROR_MESSAGES.wallet_not_unlocked);
8539
- const encryptedData = await (0, import_crypto4.encrypt)(this.#passphrase, {
8540
- vaults: this.#serializeVaults(this.#vaults)
8568
+ await assert(!__privateGet(this, _isLocked), ERROR_MESSAGES.wallet_not_unlocked);
8569
+ const encryptedData = await (0, import_crypto4.encrypt)(__privateGet(this, _passphrase), {
8570
+ vaults: __privateMethod(this, _serializeVaults, serializeVaults_fn).call(this, __privateGet(this, _vaults))
8541
8571
  });
8542
8572
  await this.storage.setItem(this.STORAGE_KEY, JSON.stringify(encryptedData));
8543
8573
  this.emit("update");
8544
8574
  }
8545
- /**
8546
- * Serialize all vaults to store
8547
- *
8548
- * `This is only accessible from inside the class`
8549
- */
8550
- #serializeVaults(vaults) {
8551
- return vaults.map(({ title, type, vault }) => ({
8552
- title,
8553
- type,
8554
- data: vault.serialize()
8555
- }));
8556
- }
8557
- /**
8558
- * Deserialize all vaults to state
8559
- *
8560
- * `This is only accessible from inside the class`
8561
- */
8562
- #deserializeVaults(vaults) {
8563
- return vaults.map(({ title, type, data: vaultConfig }) => {
8564
- const VaultClass = this.getVaultClass(type);
8565
- return {
8566
- title,
8567
- type,
8568
- vault: new VaultClass(vaultConfig)
8569
- };
8570
- });
8571
- }
8572
8575
  /**
8573
8576
  * Return a instantiable Class reference from `WalletManager.Vaults` supported list.
8574
8577
  */
@@ -8578,11 +8581,43 @@ var WalletManager = class _WalletManager extends import_events.EventEmitter {
8578
8581
  return VaultClass;
8579
8582
  }
8580
8583
  };
8584
+ var WalletManager = _WalletManager;
8585
+ _vaults = new WeakMap();
8586
+ _passphrase = new WeakMap();
8587
+ _isLocked = new WeakMap();
8588
+ _serializeVaults = new WeakSet();
8589
+ serializeVaults_fn = function(vaults) {
8590
+ return vaults.map(({ title, type, vault }) => ({
8591
+ title,
8592
+ type,
8593
+ data: vault.serialize()
8594
+ }));
8595
+ };
8596
+ _deserializeVaults = new WeakSet();
8597
+ deserializeVaults_fn = function(vaults) {
8598
+ return vaults.map(({ title, type, data: vaultConfig }) => {
8599
+ const VaultClass = this.getVaultClass(type);
8600
+ return {
8601
+ title,
8602
+ type,
8603
+ vault: new VaultClass(vaultConfig)
8604
+ };
8605
+ });
8606
+ };
8607
+ /**
8608
+ * Vaults
8609
+ *
8610
+ * Vaults are responsible to store secret keys and return an `Wallet` instance,
8611
+ * to interact with the network.
8612
+ *
8613
+ * Each vault has access to its own state
8614
+ *
8615
+ */
8616
+ __publicField(WalletManager, "Vaults", [MnemonicVault, PrivateKeyVault]);
8581
8617
 
8582
8618
  // src/wallet-manager/types.ts
8583
8619
  var import_errors23 = require("@fuel-ts/errors");
8584
8620
  var Vault = class {
8585
- static type;
8586
8621
  constructor(_options) {
8587
8622
  throw new import_errors23.FuelError(import_errors23.ErrorCode.NOT_IMPLEMENTED, "Not implemented.");
8588
8623
  }
@@ -8602,6 +8637,7 @@ var Vault = class {
8602
8637
  throw new import_errors23.FuelError(import_errors23.ErrorCode.NOT_IMPLEMENTED, "Not implemented.");
8603
8638
  }
8604
8639
  };
8640
+ __publicField(Vault, "type");
8605
8641
  var StorageAbstract = class {
8606
8642
  };
8607
8643
 
@@ -8611,23 +8647,23 @@ var import_address10 = require("@fuel-ts/address");
8611
8647
  var import_configs12 = require("@fuel-ts/address/configs");
8612
8648
  var import_errors24 = require("@fuel-ts/errors");
8613
8649
  var import_transactions19 = require("@fuel-ts/transactions");
8614
- var import_utils36 = require("@fuel-ts/utils");
8650
+ var import_utils37 = require("@fuel-ts/utils");
8615
8651
 
8616
8652
  // src/predicate/utils/getPredicateRoot.ts
8617
8653
  var import_hasher7 = require("@fuel-ts/hasher");
8618
8654
  var import_merkle = require("@fuel-ts/merkle");
8619
- var import_utils35 = require("@fuel-ts/utils");
8655
+ var import_utils36 = require("@fuel-ts/utils");
8620
8656
  var getPredicateRoot = (bytecode) => {
8621
8657
  const chunkSize = 16 * 1024;
8622
- const bytes = (0, import_utils35.arrayify)(bytecode);
8623
- const chunks = (0, import_utils35.chunkAndPadBytes)(bytes, chunkSize);
8624
- const codeRoot = (0, import_merkle.calcRoot)(chunks.map((c) => (0, import_utils35.hexlify)(c)));
8625
- const predicateRoot = (0, import_hasher7.hash)((0, import_utils35.concat)(["0x4655454C", codeRoot]));
8658
+ const bytes = (0, import_utils36.arrayify)(bytecode);
8659
+ const chunks = (0, import_utils36.chunkAndPadBytes)(bytes, chunkSize);
8660
+ const codeRoot = (0, import_merkle.calcRoot)(chunks.map((c) => (0, import_utils36.hexlify)(c)));
8661
+ const predicateRoot = (0, import_hasher7.hash)((0, import_utils36.concat)(["0x4655454C", codeRoot]));
8626
8662
  return predicateRoot;
8627
8663
  };
8628
8664
 
8629
8665
  // src/predicate/predicate.ts
8630
- var Predicate = class _Predicate extends Account {
8666
+ var Predicate = class extends Account {
8631
8667
  bytes;
8632
8668
  predicateDataBytes = Uint8Array.from([]);
8633
8669
  predicateData = [];
@@ -8648,7 +8684,7 @@ var Predicate = class _Predicate extends Account {
8648
8684
  inputData,
8649
8685
  configurableConstants
8650
8686
  }) {
8651
- const { predicateBytes, predicateInterface } = _Predicate.processPredicateData(
8687
+ const { predicateBytes, predicateInterface } = Predicate.processPredicateData(
8652
8688
  bytecode,
8653
8689
  abi,
8654
8690
  configurableConstants
@@ -8671,7 +8707,7 @@ var Predicate = class _Predicate extends Account {
8671
8707
  const request = transactionRequestify(transactionRequestLike);
8672
8708
  const { policies } = BaseTransactionRequest.getPolicyMeta(request);
8673
8709
  request.inputs?.forEach((input) => {
8674
- if (input.type === import_transactions19.InputType.Coin && (0, import_utils36.hexlify)(input.owner) === this.address.toB256()) {
8710
+ if (input.type === import_transactions19.InputType.Coin && (0, import_utils37.hexlify)(input.owner) === this.address.toB256()) {
8675
8711
  input.predicate = this.bytes;
8676
8712
  input.predicateData = this.getPredicateData(policies.length);
8677
8713
  }
@@ -8732,7 +8768,7 @@ var Predicate = class _Predicate extends Account {
8732
8768
  * @returns An object containing the new predicate bytes and interface.
8733
8769
  */
8734
8770
  static processPredicateData(bytes, jsonAbi, configurableConstants) {
8735
- let predicateBytes = (0, import_utils36.arrayify)(bytes);
8771
+ let predicateBytes = (0, import_utils37.arrayify)(bytes);
8736
8772
  let abiInterface;
8737
8773
  if (jsonAbi) {
8738
8774
  abiInterface = new import_abi_coder5.Interface(jsonAbi);
@@ -8744,7 +8780,7 @@ var Predicate = class _Predicate extends Account {
8744
8780
  }
8745
8781
  }
8746
8782
  if (configurableConstants && Object.keys(configurableConstants).length) {
8747
- predicateBytes = _Predicate.setConfigurableConstants(
8783
+ predicateBytes = Predicate.setConfigurableConstants(
8748
8784
  predicateBytes,
8749
8785
  configurableConstants,
8750
8786
  abiInterface
@@ -9124,9 +9160,7 @@ async function withTimeout(promise, timeout = 1050) {
9124
9160
  var HAS_CONNECTOR_TIMEOUT = 2e3;
9125
9161
  var PING_CACHE_TIME = 5e3;
9126
9162
  var { warn } = console;
9127
- var Fuel = class _Fuel extends FuelConnector {
9128
- static STORAGE_KEY = "fuel-current-connector";
9129
- static defaultConfig = {};
9163
+ var _Fuel = class extends FuelConnector {
9130
9164
  _storage = null;
9131
9165
  _connectors = [];
9132
9166
  _targetObject = null;
@@ -9451,6 +9485,9 @@ var Fuel = class _Fuel extends FuelConnector {
9451
9485
  await this.clean();
9452
9486
  }
9453
9487
  };
9488
+ var Fuel = _Fuel;
9489
+ __publicField(Fuel, "STORAGE_KEY", "fuel-current-connector");
9490
+ __publicField(Fuel, "defaultConfig", {});
9454
9491
  // Annotate the CommonJS export names for ESM import in node:
9455
9492
  0 && (module.exports = {
9456
9493
  Account,
@@ -9567,7 +9604,6 @@ var Fuel = class _Fuel extends FuelConnector {
9567
9604
  resolveGasDependentCosts,
9568
9605
  resolveIconPaths,
9569
9606
  returnZeroScript,
9570
- sleep,
9571
9607
  transactionRequestify,
9572
9608
  urlJoin,
9573
9609
  withTimeout,