@metamask/multichain-account-service 7.0.0 → 8.0.0

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.
Files changed (210) hide show
  1. package/CHANGELOG.md +63 -1
  2. package/dist/MultichainAccountGroup.cjs +4 -69
  3. package/dist/MultichainAccountGroup.cjs.map +1 -1
  4. package/dist/MultichainAccountGroup.d.cts +0 -6
  5. package/dist/MultichainAccountGroup.d.cts.map +1 -1
  6. package/dist/MultichainAccountGroup.d.mts +0 -6
  7. package/dist/MultichainAccountGroup.d.mts.map +1 -1
  8. package/dist/MultichainAccountGroup.mjs +5 -70
  9. package/dist/MultichainAccountGroup.mjs.map +1 -1
  10. package/dist/MultichainAccountService-method-action-types.cjs +7 -0
  11. package/dist/MultichainAccountService-method-action-types.cjs.map +1 -0
  12. package/dist/MultichainAccountService-method-action-types.d.cts +177 -0
  13. package/dist/MultichainAccountService-method-action-types.d.cts.map +1 -0
  14. package/dist/MultichainAccountService-method-action-types.d.mts +177 -0
  15. package/dist/MultichainAccountService-method-action-types.d.mts.map +1 -0
  16. package/dist/MultichainAccountService-method-action-types.mjs +6 -0
  17. package/dist/MultichainAccountService-method-action-types.mjs.map +1 -0
  18. package/dist/MultichainAccountService.cjs +59 -28
  19. package/dist/MultichainAccountService.cjs.map +1 -1
  20. package/dist/MultichainAccountService.d.cts +24 -2
  21. package/dist/MultichainAccountService.d.cts.map +1 -1
  22. package/dist/MultichainAccountService.d.mts +24 -2
  23. package/dist/MultichainAccountService.d.mts.map +1 -1
  24. package/dist/MultichainAccountService.mjs +60 -29
  25. package/dist/MultichainAccountService.mjs.map +1 -1
  26. package/dist/MultichainAccountWallet.cjs +302 -164
  27. package/dist/MultichainAccountWallet.cjs.map +1 -1
  28. package/dist/MultichainAccountWallet.d.cts +27 -7
  29. package/dist/MultichainAccountWallet.d.cts.map +1 -1
  30. package/dist/MultichainAccountWallet.d.mts +27 -7
  31. package/dist/MultichainAccountWallet.d.mts.map +1 -1
  32. package/dist/MultichainAccountWallet.mjs +303 -165
  33. package/dist/MultichainAccountWallet.mjs.map +1 -1
  34. package/dist/analytics/perf.cjs +65 -0
  35. package/dist/analytics/perf.cjs.map +1 -0
  36. package/dist/analytics/perf.d.cts +34 -0
  37. package/dist/analytics/perf.d.cts.map +1 -0
  38. package/dist/analytics/perf.d.mts +34 -0
  39. package/dist/analytics/perf.d.mts.map +1 -0
  40. package/dist/analytics/perf.mjs +59 -0
  41. package/dist/analytics/perf.mjs.map +1 -0
  42. package/dist/analytics/timer.cjs +14 -0
  43. package/dist/analytics/timer.cjs.map +1 -0
  44. package/dist/analytics/timer.d.cts +8 -0
  45. package/dist/analytics/timer.d.cts.map +1 -0
  46. package/dist/analytics/timer.d.mts +8 -0
  47. package/dist/analytics/timer.d.mts.map +1 -0
  48. package/dist/analytics/timer.mjs +10 -0
  49. package/dist/analytics/timer.mjs.map +1 -0
  50. package/dist/analytics/traces.cjs +49 -1
  51. package/dist/analytics/traces.cjs.map +1 -1
  52. package/dist/analytics/traces.d.cts +28 -0
  53. package/dist/analytics/traces.d.cts.map +1 -1
  54. package/dist/analytics/traces.d.mts +28 -0
  55. package/dist/analytics/traces.d.mts.map +1 -1
  56. package/dist/analytics/traces.mjs +46 -0
  57. package/dist/analytics/traces.mjs.map +1 -1
  58. package/dist/errors.cjs +32 -0
  59. package/dist/errors.cjs.map +1 -0
  60. package/dist/errors.d.cts +16 -0
  61. package/dist/errors.d.cts.map +1 -0
  62. package/dist/errors.d.mts +16 -0
  63. package/dist/errors.d.mts.map +1 -0
  64. package/dist/errors.mjs +28 -0
  65. package/dist/errors.mjs.map +1 -0
  66. package/dist/index.cjs.map +1 -1
  67. package/dist/index.d.cts +2 -1
  68. package/dist/index.d.cts.map +1 -1
  69. package/dist/index.d.mts +2 -1
  70. package/dist/index.d.mts.map +1 -1
  71. package/dist/index.mjs.map +1 -1
  72. package/dist/logger.cjs +14 -1
  73. package/dist/logger.cjs.map +1 -1
  74. package/dist/logger.d.cts +8 -0
  75. package/dist/logger.d.cts.map +1 -1
  76. package/dist/logger.d.mts +8 -0
  77. package/dist/logger.d.mts.map +1 -1
  78. package/dist/logger.mjs +12 -0
  79. package/dist/logger.mjs.map +1 -1
  80. package/dist/providers/AccountProviderWrapper.cjs +5 -6
  81. package/dist/providers/AccountProviderWrapper.cjs.map +1 -1
  82. package/dist/providers/AccountProviderWrapper.d.cts +5 -4
  83. package/dist/providers/AccountProviderWrapper.d.cts.map +1 -1
  84. package/dist/providers/AccountProviderWrapper.d.mts +5 -4
  85. package/dist/providers/AccountProviderWrapper.d.mts.map +1 -1
  86. package/dist/providers/AccountProviderWrapper.mjs +5 -6
  87. package/dist/providers/AccountProviderWrapper.mjs.map +1 -1
  88. package/dist/providers/BaseBip44AccountProvider.cjs +0 -10
  89. package/dist/providers/BaseBip44AccountProvider.cjs.map +1 -1
  90. package/dist/providers/BaseBip44AccountProvider.d.cts +1 -17
  91. package/dist/providers/BaseBip44AccountProvider.d.cts.map +1 -1
  92. package/dist/providers/BaseBip44AccountProvider.d.mts +1 -17
  93. package/dist/providers/BaseBip44AccountProvider.d.mts.map +1 -1
  94. package/dist/providers/BaseBip44AccountProvider.mjs +0 -10
  95. package/dist/providers/BaseBip44AccountProvider.mjs.map +1 -1
  96. package/dist/providers/BtcAccountProvider.cjs +15 -33
  97. package/dist/providers/BtcAccountProvider.cjs.map +1 -1
  98. package/dist/providers/BtcAccountProvider.d.cts +6 -4
  99. package/dist/providers/BtcAccountProvider.d.cts.map +1 -1
  100. package/dist/providers/BtcAccountProvider.d.mts +6 -4
  101. package/dist/providers/BtcAccountProvider.d.mts.map +1 -1
  102. package/dist/providers/BtcAccountProvider.mjs +16 -34
  103. package/dist/providers/BtcAccountProvider.mjs.map +1 -1
  104. package/dist/providers/EvmAccountProvider.cjs +44 -3
  105. package/dist/providers/EvmAccountProvider.cjs.map +1 -1
  106. package/dist/providers/EvmAccountProvider.d.cts.map +1 -1
  107. package/dist/providers/EvmAccountProvider.d.mts.map +1 -1
  108. package/dist/providers/EvmAccountProvider.mjs +44 -3
  109. package/dist/providers/EvmAccountProvider.mjs.map +1 -1
  110. package/dist/providers/SnapAccountProvider.cjs +111 -21
  111. package/dist/providers/SnapAccountProvider.cjs.map +1 -1
  112. package/dist/providers/SnapAccountProvider.d.cts +33 -2
  113. package/dist/providers/SnapAccountProvider.d.cts.map +1 -1
  114. package/dist/providers/SnapAccountProvider.d.mts +33 -2
  115. package/dist/providers/SnapAccountProvider.d.mts.map +1 -1
  116. package/dist/providers/SnapAccountProvider.mjs +113 -23
  117. package/dist/providers/SnapAccountProvider.mjs.map +1 -1
  118. package/dist/providers/SolAccountProvider.cjs +31 -39
  119. package/dist/providers/SolAccountProvider.cjs.map +1 -1
  120. package/dist/providers/SolAccountProvider.d.cts +10 -3
  121. package/dist/providers/SolAccountProvider.d.cts.map +1 -1
  122. package/dist/providers/SolAccountProvider.d.mts +10 -3
  123. package/dist/providers/SolAccountProvider.d.mts.map +1 -1
  124. package/dist/providers/SolAccountProvider.mjs +32 -40
  125. package/dist/providers/SolAccountProvider.mjs.map +1 -1
  126. package/dist/providers/TrxAccountProvider.cjs +15 -37
  127. package/dist/providers/TrxAccountProvider.cjs.map +1 -1
  128. package/dist/providers/TrxAccountProvider.d.cts +6 -4
  129. package/dist/providers/TrxAccountProvider.d.cts.map +1 -1
  130. package/dist/providers/TrxAccountProvider.d.mts +6 -4
  131. package/dist/providers/TrxAccountProvider.d.mts.map +1 -1
  132. package/dist/providers/TrxAccountProvider.mjs +16 -38
  133. package/dist/providers/TrxAccountProvider.mjs.map +1 -1
  134. package/dist/providers/index.cjs +2 -1
  135. package/dist/providers/index.cjs.map +1 -1
  136. package/dist/providers/index.d.cts +1 -1
  137. package/dist/providers/index.d.cts.map +1 -1
  138. package/dist/providers/index.d.mts +1 -1
  139. package/dist/providers/index.d.mts.map +1 -1
  140. package/dist/providers/index.mjs +1 -1
  141. package/dist/providers/index.mjs.map +1 -1
  142. package/dist/providers/utils.cjs +15 -5
  143. package/dist/providers/utils.cjs.map +1 -1
  144. package/dist/providers/utils.d.cts +9 -2
  145. package/dist/providers/utils.d.cts.map +1 -1
  146. package/dist/providers/utils.d.mts +9 -2
  147. package/dist/providers/utils.d.mts.map +1 -1
  148. package/dist/providers/utils.mjs +13 -4
  149. package/dist/providers/utils.mjs.map +1 -1
  150. package/dist/snaps/SnapPlatformWatcher.cjs +72 -8
  151. package/dist/snaps/SnapPlatformWatcher.cjs.map +1 -1
  152. package/dist/snaps/SnapPlatformWatcher.d.cts +15 -1
  153. package/dist/snaps/SnapPlatformWatcher.d.cts.map +1 -1
  154. package/dist/snaps/SnapPlatformWatcher.d.mts +15 -1
  155. package/dist/snaps/SnapPlatformWatcher.d.mts.map +1 -1
  156. package/dist/snaps/SnapPlatformWatcher.mjs +72 -8
  157. package/dist/snaps/SnapPlatformWatcher.mjs.map +1 -1
  158. package/dist/tests/accounts.cjs +7 -1
  159. package/dist/tests/accounts.cjs.map +1 -1
  160. package/dist/tests/accounts.d.cts +9 -0
  161. package/dist/tests/accounts.d.cts.map +1 -1
  162. package/dist/tests/accounts.d.mts +9 -0
  163. package/dist/tests/accounts.d.mts.map +1 -1
  164. package/dist/tests/accounts.mjs +6 -0
  165. package/dist/tests/accounts.mjs.map +1 -1
  166. package/dist/tests/index.cjs.map +1 -1
  167. package/dist/tests/index.d.cts +1 -0
  168. package/dist/tests/index.d.cts.map +1 -1
  169. package/dist/tests/index.d.mts +1 -0
  170. package/dist/tests/index.d.mts.map +1 -1
  171. package/dist/tests/index.mjs.map +1 -1
  172. package/dist/tests/providers.cjs +14 -16
  173. package/dist/tests/providers.cjs.map +1 -1
  174. package/dist/tests/providers.d.cts +11 -0
  175. package/dist/tests/providers.d.cts.map +1 -1
  176. package/dist/tests/providers.d.mts +11 -0
  177. package/dist/tests/providers.d.mts.map +1 -1
  178. package/dist/tests/providers.mjs +14 -17
  179. package/dist/tests/providers.mjs.map +1 -1
  180. package/dist/tests/types.cjs +3 -0
  181. package/dist/tests/types.cjs.map +1 -0
  182. package/dist/tests/types.d.cts +7 -0
  183. package/dist/tests/types.d.cts.map +1 -0
  184. package/dist/tests/types.d.mts +7 -0
  185. package/dist/tests/types.d.mts.map +1 -0
  186. package/dist/tests/types.mjs +2 -0
  187. package/dist/tests/types.mjs.map +1 -0
  188. package/dist/types.cjs.map +1 -1
  189. package/dist/types.d.cts +13 -54
  190. package/dist/types.d.cts.map +1 -1
  191. package/dist/types.d.mts +13 -54
  192. package/dist/types.d.mts.map +1 -1
  193. package/dist/types.mjs.map +1 -1
  194. package/dist/utils.cjs +49 -5
  195. package/dist/utils.cjs.map +1 -1
  196. package/dist/utils.d.cts +32 -5
  197. package/dist/utils.d.cts.map +1 -1
  198. package/dist/utils.d.mts +32 -5
  199. package/dist/utils.d.mts.map +1 -1
  200. package/dist/utils.mjs +45 -4
  201. package/dist/utils.mjs.map +1 -1
  202. package/package.json +9 -7
  203. package/dist/constants/traces.cjs +0 -9
  204. package/dist/constants/traces.cjs.map +0 -1
  205. package/dist/constants/traces.d.cts +0 -5
  206. package/dist/constants/traces.d.cts.map +0 -1
  207. package/dist/constants/traces.d.mts +0 -5
  208. package/dist/constants/traces.d.mts.map +0 -1
  209. package/dist/constants/traces.mjs +0 -6
  210. package/dist/constants/traces.mjs.map +0 -1
@@ -0,0 +1,177 @@
1
+ /**
2
+ * This file is auto generated.
3
+ * Do not edit manually.
4
+ */
5
+ import type { MultichainAccountService } from "./MultichainAccountService.cjs";
6
+ /**
7
+ * Re-synchronize MetaMask accounts and the providers accounts if needed.
8
+ *
9
+ * NOTE: This is mostly required if one of the providers (keyrings or Snaps)
10
+ * have different sets of accounts. This method would ensure that both are
11
+ * in-sync and use the same accounts (and same IDs).
12
+ *
13
+ * READ THIS CAREFULLY (State inconsistency bugs/de-sync)
14
+ * We've seen some problems were keyring accounts on some Snaps were not synchronized
15
+ * with the accounts on MM side. This causes problems where we cannot interact with
16
+ * those accounts because the Snap does know about them.
17
+ * To "workaround" this de-sync problem for now, we make sure that both parties are
18
+ * in-sync when the service boots up.
19
+ * ----------------------------------------------------------------------------------
20
+ */
21
+ export type MultichainAccountServiceResyncAccountsAction = {
22
+ type: `MultichainAccountService:resyncAccounts`;
23
+ handler: MultichainAccountService['resyncAccounts'];
24
+ };
25
+ export type MultichainAccountServiceEnsureCanUseSnapPlatformAction = {
26
+ type: `MultichainAccountService:ensureCanUseSnapPlatform`;
27
+ handler: MultichainAccountService['ensureCanUseSnapPlatform'];
28
+ };
29
+ /**
30
+ * Gets a reference to the multichain account wallet matching this entropy source.
31
+ *
32
+ * @param options - Options.
33
+ * @param options.entropySource - The entropy source of the multichain account.
34
+ * @throws If none multichain account match this entropy.
35
+ * @returns A reference to the multichain account wallet.
36
+ */
37
+ export type MultichainAccountServiceGetMultichainAccountWalletAction = {
38
+ type: `MultichainAccountService:getMultichainAccountWallet`;
39
+ handler: MultichainAccountService['getMultichainAccountWallet'];
40
+ };
41
+ /**
42
+ * Gets an array of all multichain account wallets.
43
+ *
44
+ * @returns An array of all multichain account wallets.
45
+ */
46
+ export type MultichainAccountServiceGetMultichainAccountWalletsAction = {
47
+ type: `MultichainAccountService:getMultichainAccountWallets`;
48
+ handler: MultichainAccountService['getMultichainAccountWallets'];
49
+ };
50
+ /**
51
+ * Creates a new multichain account wallet by either importing an existing mnemonic,
52
+ * creating a new vault and keychain, or restoring a vault and keyring.
53
+ *
54
+ * NOTE: This method should only be called in client code where a mutex lock is acquired.
55
+ * `discoverAccounts` should be called after this method to discover and create accounts.
56
+ *
57
+ * @param params - The parameters to use to create the new wallet.
58
+ * @param params.mnemonic - The mnemonic to use to create the new wallet.
59
+ * @param params.password - The password to encrypt the vault with.
60
+ * @param params.type - The flow type to use to create the new wallet.
61
+ * @throws If the mnemonic has already been imported.
62
+ * @returns The new multichain account wallet.
63
+ */
64
+ export type MultichainAccountServiceCreateMultichainAccountWalletAction = {
65
+ type: `MultichainAccountService:createMultichainAccountWallet`;
66
+ handler: MultichainAccountService['createMultichainAccountWallet'];
67
+ };
68
+ /**
69
+ * Removes a multichain account wallet.
70
+ *
71
+ * NOTE: This method should only be called in client code as a revert mechanism.
72
+ * At the point that this code is called, discovery shouldn't have been triggered.
73
+ * This is meant to be used in the scenario where a seed phrase backup is not successful.
74
+ *
75
+ * @param entropySource - The entropy source of the multichain account wallet.
76
+ * @param accountAddress - The address of the account to remove.
77
+ * @returns The removed multichain account wallet.
78
+ */
79
+ export type MultichainAccountServiceRemoveMultichainAccountWalletAction = {
80
+ type: `MultichainAccountService:removeMultichainAccountWallet`;
81
+ handler: MultichainAccountService['removeMultichainAccountWallet'];
82
+ };
83
+ /**
84
+ * Gets a reference to the multichain account group matching this entropy source
85
+ * and a group index.
86
+ *
87
+ * @param options - Options.
88
+ * @param options.entropySource - The entropy source of the multichain account.
89
+ * @param options.groupIndex - The group index of the multichain account.
90
+ * @throws If none multichain account match this entropy source and group index.
91
+ * @returns A reference to the multichain account.
92
+ */
93
+ export type MultichainAccountServiceGetMultichainAccountGroupAction = {
94
+ type: `MultichainAccountService:getMultichainAccountGroup`;
95
+ handler: MultichainAccountService['getMultichainAccountGroup'];
96
+ };
97
+ /**
98
+ * Gets all multichain account groups for a given entropy source.
99
+ *
100
+ * @param options - Options.
101
+ * @param options.entropySource - The entropy source to query.
102
+ * @throws If no multichain accounts match this entropy source.
103
+ * @returns A list of all multichain accounts.
104
+ */
105
+ export type MultichainAccountServiceGetMultichainAccountGroupsAction = {
106
+ type: `MultichainAccountService:getMultichainAccountGroups`;
107
+ handler: MultichainAccountService['getMultichainAccountGroups'];
108
+ };
109
+ /**
110
+ * Creates the next multichain account group.
111
+ *
112
+ * @param options - Options.
113
+ * @param options.entropySource - The wallet's entropy source.
114
+ * @returns The next multichain account group.
115
+ */
116
+ export type MultichainAccountServiceCreateNextMultichainAccountGroupAction = {
117
+ type: `MultichainAccountService:createNextMultichainAccountGroup`;
118
+ handler: MultichainAccountService['createNextMultichainAccountGroup'];
119
+ };
120
+ /**
121
+ * Creates a multichain account group.
122
+ *
123
+ * @param options - Options.
124
+ * @param options.groupIndex - The group index to use.
125
+ * @param options.entropySource - The wallet's entropy source.
126
+ * @returns The multichain account group for this group index.
127
+ */
128
+ export type MultichainAccountServiceCreateMultichainAccountGroupAction = {
129
+ type: `MultichainAccountService:createMultichainAccountGroup`;
130
+ handler: MultichainAccountService['createMultichainAccountGroup'];
131
+ };
132
+ /**
133
+ * Creates multiple multichain account groups up to maxGroupIndex.
134
+ *
135
+ * @param params - Parameters for creating account groups.
136
+ * @param params.fromGroupIndex - Starting group index to create (inclusive) (defaults to 0).
137
+ * @param params.toGroupIndex - Maximum group index to create (inclusive).
138
+ * @param params.entropySource - The entropy source ID.
139
+ * @returns Array of created multichain account groups.
140
+ */
141
+ export type MultichainAccountServiceCreateMultichainAccountGroupsAction = {
142
+ type: `MultichainAccountService:createMultichainAccountGroups`;
143
+ handler: MultichainAccountService['createMultichainAccountGroups'];
144
+ };
145
+ /**
146
+ * Set basic functionality state and trigger alignment if enabled.
147
+ * When basic functionality is disabled, snap-based providers are disabled.
148
+ * When enabled, all snap providers are enabled and wallet alignment is triggered.
149
+ * EVM providers are never disabled as they're required for basic wallet functionality.
150
+ *
151
+ * @param enabled - Whether basic functionality is enabled.
152
+ */
153
+ export type MultichainAccountServiceSetBasicFunctionalityAction = {
154
+ type: `MultichainAccountService:setBasicFunctionality`;
155
+ handler: MultichainAccountService['setBasicFunctionality'];
156
+ };
157
+ /**
158
+ * Align all multichain account wallets.
159
+ */
160
+ export type MultichainAccountServiceAlignWalletsAction = {
161
+ type: `MultichainAccountService:alignWallets`;
162
+ handler: MultichainAccountService['alignWallets'];
163
+ };
164
+ /**
165
+ * Align a specific multichain account wallet.
166
+ *
167
+ * @param entropySource - The entropy source of the multichain account wallet.
168
+ */
169
+ export type MultichainAccountServiceAlignWalletAction = {
170
+ type: `MultichainAccountService:alignWallet`;
171
+ handler: MultichainAccountService['alignWallet'];
172
+ };
173
+ /**
174
+ * Union of all MultichainAccountService action types.
175
+ */
176
+ export type MultichainAccountServiceMethodActions = MultichainAccountServiceResyncAccountsAction | MultichainAccountServiceEnsureCanUseSnapPlatformAction | MultichainAccountServiceGetMultichainAccountWalletAction | MultichainAccountServiceGetMultichainAccountWalletsAction | MultichainAccountServiceCreateMultichainAccountWalletAction | MultichainAccountServiceRemoveMultichainAccountWalletAction | MultichainAccountServiceGetMultichainAccountGroupAction | MultichainAccountServiceGetMultichainAccountGroupsAction | MultichainAccountServiceCreateNextMultichainAccountGroupAction | MultichainAccountServiceCreateMultichainAccountGroupAction | MultichainAccountServiceCreateMultichainAccountGroupsAction | MultichainAccountServiceSetBasicFunctionalityAction | MultichainAccountServiceAlignWalletsAction | MultichainAccountServiceAlignWalletAction;
177
+ //# sourceMappingURL=MultichainAccountService-method-action-types.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MultichainAccountService-method-action-types.d.cts","sourceRoot":"","sources":["../src/MultichainAccountService-method-action-types.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,177 @@
1
+ /**
2
+ * This file is auto generated.
3
+ * Do not edit manually.
4
+ */
5
+ import type { MultichainAccountService } from "./MultichainAccountService.mjs";
6
+ /**
7
+ * Re-synchronize MetaMask accounts and the providers accounts if needed.
8
+ *
9
+ * NOTE: This is mostly required if one of the providers (keyrings or Snaps)
10
+ * have different sets of accounts. This method would ensure that both are
11
+ * in-sync and use the same accounts (and same IDs).
12
+ *
13
+ * READ THIS CAREFULLY (State inconsistency bugs/de-sync)
14
+ * We've seen some problems were keyring accounts on some Snaps were not synchronized
15
+ * with the accounts on MM side. This causes problems where we cannot interact with
16
+ * those accounts because the Snap does know about them.
17
+ * To "workaround" this de-sync problem for now, we make sure that both parties are
18
+ * in-sync when the service boots up.
19
+ * ----------------------------------------------------------------------------------
20
+ */
21
+ export type MultichainAccountServiceResyncAccountsAction = {
22
+ type: `MultichainAccountService:resyncAccounts`;
23
+ handler: MultichainAccountService['resyncAccounts'];
24
+ };
25
+ export type MultichainAccountServiceEnsureCanUseSnapPlatformAction = {
26
+ type: `MultichainAccountService:ensureCanUseSnapPlatform`;
27
+ handler: MultichainAccountService['ensureCanUseSnapPlatform'];
28
+ };
29
+ /**
30
+ * Gets a reference to the multichain account wallet matching this entropy source.
31
+ *
32
+ * @param options - Options.
33
+ * @param options.entropySource - The entropy source of the multichain account.
34
+ * @throws If none multichain account match this entropy.
35
+ * @returns A reference to the multichain account wallet.
36
+ */
37
+ export type MultichainAccountServiceGetMultichainAccountWalletAction = {
38
+ type: `MultichainAccountService:getMultichainAccountWallet`;
39
+ handler: MultichainAccountService['getMultichainAccountWallet'];
40
+ };
41
+ /**
42
+ * Gets an array of all multichain account wallets.
43
+ *
44
+ * @returns An array of all multichain account wallets.
45
+ */
46
+ export type MultichainAccountServiceGetMultichainAccountWalletsAction = {
47
+ type: `MultichainAccountService:getMultichainAccountWallets`;
48
+ handler: MultichainAccountService['getMultichainAccountWallets'];
49
+ };
50
+ /**
51
+ * Creates a new multichain account wallet by either importing an existing mnemonic,
52
+ * creating a new vault and keychain, or restoring a vault and keyring.
53
+ *
54
+ * NOTE: This method should only be called in client code where a mutex lock is acquired.
55
+ * `discoverAccounts` should be called after this method to discover and create accounts.
56
+ *
57
+ * @param params - The parameters to use to create the new wallet.
58
+ * @param params.mnemonic - The mnemonic to use to create the new wallet.
59
+ * @param params.password - The password to encrypt the vault with.
60
+ * @param params.type - The flow type to use to create the new wallet.
61
+ * @throws If the mnemonic has already been imported.
62
+ * @returns The new multichain account wallet.
63
+ */
64
+ export type MultichainAccountServiceCreateMultichainAccountWalletAction = {
65
+ type: `MultichainAccountService:createMultichainAccountWallet`;
66
+ handler: MultichainAccountService['createMultichainAccountWallet'];
67
+ };
68
+ /**
69
+ * Removes a multichain account wallet.
70
+ *
71
+ * NOTE: This method should only be called in client code as a revert mechanism.
72
+ * At the point that this code is called, discovery shouldn't have been triggered.
73
+ * This is meant to be used in the scenario where a seed phrase backup is not successful.
74
+ *
75
+ * @param entropySource - The entropy source of the multichain account wallet.
76
+ * @param accountAddress - The address of the account to remove.
77
+ * @returns The removed multichain account wallet.
78
+ */
79
+ export type MultichainAccountServiceRemoveMultichainAccountWalletAction = {
80
+ type: `MultichainAccountService:removeMultichainAccountWallet`;
81
+ handler: MultichainAccountService['removeMultichainAccountWallet'];
82
+ };
83
+ /**
84
+ * Gets a reference to the multichain account group matching this entropy source
85
+ * and a group index.
86
+ *
87
+ * @param options - Options.
88
+ * @param options.entropySource - The entropy source of the multichain account.
89
+ * @param options.groupIndex - The group index of the multichain account.
90
+ * @throws If none multichain account match this entropy source and group index.
91
+ * @returns A reference to the multichain account.
92
+ */
93
+ export type MultichainAccountServiceGetMultichainAccountGroupAction = {
94
+ type: `MultichainAccountService:getMultichainAccountGroup`;
95
+ handler: MultichainAccountService['getMultichainAccountGroup'];
96
+ };
97
+ /**
98
+ * Gets all multichain account groups for a given entropy source.
99
+ *
100
+ * @param options - Options.
101
+ * @param options.entropySource - The entropy source to query.
102
+ * @throws If no multichain accounts match this entropy source.
103
+ * @returns A list of all multichain accounts.
104
+ */
105
+ export type MultichainAccountServiceGetMultichainAccountGroupsAction = {
106
+ type: `MultichainAccountService:getMultichainAccountGroups`;
107
+ handler: MultichainAccountService['getMultichainAccountGroups'];
108
+ };
109
+ /**
110
+ * Creates the next multichain account group.
111
+ *
112
+ * @param options - Options.
113
+ * @param options.entropySource - The wallet's entropy source.
114
+ * @returns The next multichain account group.
115
+ */
116
+ export type MultichainAccountServiceCreateNextMultichainAccountGroupAction = {
117
+ type: `MultichainAccountService:createNextMultichainAccountGroup`;
118
+ handler: MultichainAccountService['createNextMultichainAccountGroup'];
119
+ };
120
+ /**
121
+ * Creates a multichain account group.
122
+ *
123
+ * @param options - Options.
124
+ * @param options.groupIndex - The group index to use.
125
+ * @param options.entropySource - The wallet's entropy source.
126
+ * @returns The multichain account group for this group index.
127
+ */
128
+ export type MultichainAccountServiceCreateMultichainAccountGroupAction = {
129
+ type: `MultichainAccountService:createMultichainAccountGroup`;
130
+ handler: MultichainAccountService['createMultichainAccountGroup'];
131
+ };
132
+ /**
133
+ * Creates multiple multichain account groups up to maxGroupIndex.
134
+ *
135
+ * @param params - Parameters for creating account groups.
136
+ * @param params.fromGroupIndex - Starting group index to create (inclusive) (defaults to 0).
137
+ * @param params.toGroupIndex - Maximum group index to create (inclusive).
138
+ * @param params.entropySource - The entropy source ID.
139
+ * @returns Array of created multichain account groups.
140
+ */
141
+ export type MultichainAccountServiceCreateMultichainAccountGroupsAction = {
142
+ type: `MultichainAccountService:createMultichainAccountGroups`;
143
+ handler: MultichainAccountService['createMultichainAccountGroups'];
144
+ };
145
+ /**
146
+ * Set basic functionality state and trigger alignment if enabled.
147
+ * When basic functionality is disabled, snap-based providers are disabled.
148
+ * When enabled, all snap providers are enabled and wallet alignment is triggered.
149
+ * EVM providers are never disabled as they're required for basic wallet functionality.
150
+ *
151
+ * @param enabled - Whether basic functionality is enabled.
152
+ */
153
+ export type MultichainAccountServiceSetBasicFunctionalityAction = {
154
+ type: `MultichainAccountService:setBasicFunctionality`;
155
+ handler: MultichainAccountService['setBasicFunctionality'];
156
+ };
157
+ /**
158
+ * Align all multichain account wallets.
159
+ */
160
+ export type MultichainAccountServiceAlignWalletsAction = {
161
+ type: `MultichainAccountService:alignWallets`;
162
+ handler: MultichainAccountService['alignWallets'];
163
+ };
164
+ /**
165
+ * Align a specific multichain account wallet.
166
+ *
167
+ * @param entropySource - The entropy source of the multichain account wallet.
168
+ */
169
+ export type MultichainAccountServiceAlignWalletAction = {
170
+ type: `MultichainAccountService:alignWallet`;
171
+ handler: MultichainAccountService['alignWallet'];
172
+ };
173
+ /**
174
+ * Union of all MultichainAccountService action types.
175
+ */
176
+ export type MultichainAccountServiceMethodActions = MultichainAccountServiceResyncAccountsAction | MultichainAccountServiceEnsureCanUseSnapPlatformAction | MultichainAccountServiceGetMultichainAccountWalletAction | MultichainAccountServiceGetMultichainAccountWalletsAction | MultichainAccountServiceCreateMultichainAccountWalletAction | MultichainAccountServiceRemoveMultichainAccountWalletAction | MultichainAccountServiceGetMultichainAccountGroupAction | MultichainAccountServiceGetMultichainAccountGroupsAction | MultichainAccountServiceCreateNextMultichainAccountGroupAction | MultichainAccountServiceCreateMultichainAccountGroupAction | MultichainAccountServiceCreateMultichainAccountGroupsAction | MultichainAccountServiceSetBasicFunctionalityAction | MultichainAccountServiceAlignWalletsAction | MultichainAccountServiceAlignWalletAction;
177
+ //# sourceMappingURL=MultichainAccountService-method-action-types.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MultichainAccountService-method-action-types.d.mts","sourceRoot":"","sources":["../src/MultichainAccountService-method-action-types.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * This file is auto generated.
3
+ * Do not edit manually.
4
+ */
5
+ export {};
6
+ //# sourceMappingURL=MultichainAccountService-method-action-types.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MultichainAccountService-method-action-types.mjs","sourceRoot":"","sources":["../src/MultichainAccountService-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/**\n * This file is auto generated.\n * Do not edit manually.\n */\n\nimport type { MultichainAccountService } from './MultichainAccountService';\n\n/**\n * Re-synchronize MetaMask accounts and the providers accounts if needed.\n *\n * NOTE: This is mostly required if one of the providers (keyrings or Snaps)\n * have different sets of accounts. This method would ensure that both are\n * in-sync and use the same accounts (and same IDs).\n *\n * READ THIS CAREFULLY (State inconsistency bugs/de-sync)\n * We've seen some problems were keyring accounts on some Snaps were not synchronized\n * with the accounts on MM side. This causes problems where we cannot interact with\n * those accounts because the Snap does know about them.\n * To \"workaround\" this de-sync problem for now, we make sure that both parties are\n * in-sync when the service boots up.\n * ----------------------------------------------------------------------------------\n */\nexport type MultichainAccountServiceResyncAccountsAction = {\n type: `MultichainAccountService:resyncAccounts`;\n handler: MultichainAccountService['resyncAccounts'];\n};\n\nexport type MultichainAccountServiceEnsureCanUseSnapPlatformAction = {\n type: `MultichainAccountService:ensureCanUseSnapPlatform`;\n handler: MultichainAccountService['ensureCanUseSnapPlatform'];\n};\n\n/**\n * Gets a reference to the multichain account wallet matching this entropy source.\n *\n * @param options - Options.\n * @param options.entropySource - The entropy source of the multichain account.\n * @throws If none multichain account match this entropy.\n * @returns A reference to the multichain account wallet.\n */\nexport type MultichainAccountServiceGetMultichainAccountWalletAction = {\n type: `MultichainAccountService:getMultichainAccountWallet`;\n handler: MultichainAccountService['getMultichainAccountWallet'];\n};\n\n/**\n * Gets an array of all multichain account wallets.\n *\n * @returns An array of all multichain account wallets.\n */\nexport type MultichainAccountServiceGetMultichainAccountWalletsAction = {\n type: `MultichainAccountService:getMultichainAccountWallets`;\n handler: MultichainAccountService['getMultichainAccountWallets'];\n};\n\n/**\n * Creates a new multichain account wallet by either importing an existing mnemonic,\n * creating a new vault and keychain, or restoring a vault and keyring.\n *\n * NOTE: This method should only be called in client code where a mutex lock is acquired.\n * `discoverAccounts` should be called after this method to discover and create accounts.\n *\n * @param params - The parameters to use to create the new wallet.\n * @param params.mnemonic - The mnemonic to use to create the new wallet.\n * @param params.password - The password to encrypt the vault with.\n * @param params.type - The flow type to use to create the new wallet.\n * @throws If the mnemonic has already been imported.\n * @returns The new multichain account wallet.\n */\nexport type MultichainAccountServiceCreateMultichainAccountWalletAction = {\n type: `MultichainAccountService:createMultichainAccountWallet`;\n handler: MultichainAccountService['createMultichainAccountWallet'];\n};\n\n/**\n * Removes a multichain account wallet.\n *\n * NOTE: This method should only be called in client code as a revert mechanism.\n * At the point that this code is called, discovery shouldn't have been triggered.\n * This is meant to be used in the scenario where a seed phrase backup is not successful.\n *\n * @param entropySource - The entropy source of the multichain account wallet.\n * @param accountAddress - The address of the account to remove.\n * @returns The removed multichain account wallet.\n */\nexport type MultichainAccountServiceRemoveMultichainAccountWalletAction = {\n type: `MultichainAccountService:removeMultichainAccountWallet`;\n handler: MultichainAccountService['removeMultichainAccountWallet'];\n};\n\n/**\n * Gets a reference to the multichain account group matching this entropy source\n * and a group index.\n *\n * @param options - Options.\n * @param options.entropySource - The entropy source of the multichain account.\n * @param options.groupIndex - The group index of the multichain account.\n * @throws If none multichain account match this entropy source and group index.\n * @returns A reference to the multichain account.\n */\nexport type MultichainAccountServiceGetMultichainAccountGroupAction = {\n type: `MultichainAccountService:getMultichainAccountGroup`;\n handler: MultichainAccountService['getMultichainAccountGroup'];\n};\n\n/**\n * Gets all multichain account groups for a given entropy source.\n *\n * @param options - Options.\n * @param options.entropySource - The entropy source to query.\n * @throws If no multichain accounts match this entropy source.\n * @returns A list of all multichain accounts.\n */\nexport type MultichainAccountServiceGetMultichainAccountGroupsAction = {\n type: `MultichainAccountService:getMultichainAccountGroups`;\n handler: MultichainAccountService['getMultichainAccountGroups'];\n};\n\n/**\n * Creates the next multichain account group.\n *\n * @param options - Options.\n * @param options.entropySource - The wallet's entropy source.\n * @returns The next multichain account group.\n */\nexport type MultichainAccountServiceCreateNextMultichainAccountGroupAction = {\n type: `MultichainAccountService:createNextMultichainAccountGroup`;\n handler: MultichainAccountService['createNextMultichainAccountGroup'];\n};\n\n/**\n * Creates a multichain account group.\n *\n * @param options - Options.\n * @param options.groupIndex - The group index to use.\n * @param options.entropySource - The wallet's entropy source.\n * @returns The multichain account group for this group index.\n */\nexport type MultichainAccountServiceCreateMultichainAccountGroupAction = {\n type: `MultichainAccountService:createMultichainAccountGroup`;\n handler: MultichainAccountService['createMultichainAccountGroup'];\n};\n\n/**\n * Creates multiple multichain account groups up to maxGroupIndex.\n *\n * @param params - Parameters for creating account groups.\n * @param params.fromGroupIndex - Starting group index to create (inclusive) (defaults to 0).\n * @param params.toGroupIndex - Maximum group index to create (inclusive).\n * @param params.entropySource - The entropy source ID.\n * @returns Array of created multichain account groups.\n */\nexport type MultichainAccountServiceCreateMultichainAccountGroupsAction = {\n type: `MultichainAccountService:createMultichainAccountGroups`;\n handler: MultichainAccountService['createMultichainAccountGroups'];\n};\n\n/**\n * Set basic functionality state and trigger alignment if enabled.\n * When basic functionality is disabled, snap-based providers are disabled.\n * When enabled, all snap providers are enabled and wallet alignment is triggered.\n * EVM providers are never disabled as they're required for basic wallet functionality.\n *\n * @param enabled - Whether basic functionality is enabled.\n */\nexport type MultichainAccountServiceSetBasicFunctionalityAction = {\n type: `MultichainAccountService:setBasicFunctionality`;\n handler: MultichainAccountService['setBasicFunctionality'];\n};\n\n/**\n * Align all multichain account wallets.\n */\nexport type MultichainAccountServiceAlignWalletsAction = {\n type: `MultichainAccountService:alignWallets`;\n handler: MultichainAccountService['alignWallets'];\n};\n\n/**\n * Align a specific multichain account wallet.\n *\n * @param entropySource - The entropy source of the multichain account wallet.\n */\nexport type MultichainAccountServiceAlignWalletAction = {\n type: `MultichainAccountService:alignWallet`;\n handler: MultichainAccountService['alignWallet'];\n};\n\n/**\n * Union of all MultichainAccountService action types.\n */\nexport type MultichainAccountServiceMethodActions =\n | MultichainAccountServiceResyncAccountsAction\n | MultichainAccountServiceEnsureCanUseSnapPlatformAction\n | MultichainAccountServiceGetMultichainAccountWalletAction\n | MultichainAccountServiceGetMultichainAccountWalletsAction\n | MultichainAccountServiceCreateMultichainAccountWalletAction\n | MultichainAccountServiceRemoveMultichainAccountWalletAction\n | MultichainAccountServiceGetMultichainAccountGroupAction\n | MultichainAccountServiceGetMultichainAccountGroupsAction\n | MultichainAccountServiceCreateNextMultichainAccountGroupAction\n | MultichainAccountServiceCreateMultichainAccountGroupAction\n | MultichainAccountServiceCreateMultichainAccountGroupsAction\n | MultichainAccountServiceSetBasicFunctionalityAction\n | MultichainAccountServiceAlignWalletsAction\n | MultichainAccountServiceAlignWalletAction;\n"]}
@@ -10,13 +10,15 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
10
10
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
11
11
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
12
12
  };
13
- var _MultichainAccountService_instances, _MultichainAccountService_messenger, _MultichainAccountService_watcher, _MultichainAccountService_providers, _MultichainAccountService_wallets, _MultichainAccountService_getStateKeys, _MultichainAccountService_constructServiceState, _MultichainAccountService_getWallet, _MultichainAccountService_getPrimaryEntropySourceId, _MultichainAccountService_createWalletByImport, _MultichainAccountService_createWalletByNewVault, _MultichainAccountService_createWalletByRestore;
13
+ var _MultichainAccountService_instances, _MultichainAccountService_messenger, _MultichainAccountService_watcher, _MultichainAccountService_providers, _MultichainAccountService_trace, _MultichainAccountService_wallets, _MultichainAccountService_getStateKeys, _MultichainAccountService_constructServiceState, _MultichainAccountService_getWallet, _MultichainAccountService_getPrimaryEntropySourceId, _MultichainAccountService_createWalletByImport, _MultichainAccountService_createWalletByNewVault, _MultichainAccountService_createWalletByRestore;
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
15
  exports.MultichainAccountService = exports.serviceName = void 0;
16
16
  const account_api_1 = require("@metamask/account-api");
17
17
  const keyring_controller_1 = require("@metamask/keyring-controller");
18
18
  const utils_1 = require("@metamask/utils");
19
19
  const analytics_1 = require("./analytics/index.cjs");
20
+ const perf_1 = require("./analytics/perf.cjs");
21
+ const errors_1 = require("./errors.cjs");
20
22
  const logger_1 = require("./logger.cjs");
21
23
  const MultichainAccountWallet_1 = require("./MultichainAccountWallet.cjs");
22
24
  const providers_1 = require("./providers/index.cjs");
@@ -25,8 +27,23 @@ const EvmAccountProvider_1 = require("./providers/EvmAccountProvider.cjs");
25
27
  const SolAccountProvider_1 = require("./providers/SolAccountProvider.cjs");
26
28
  const SolAccountProvider_2 = require("./providers/SolAccountProvider.cjs");
27
29
  const SnapPlatformWatcher_1 = require("./snaps/SnapPlatformWatcher.cjs");
28
- const utils_2 = require("./utils.cjs");
29
30
  exports.serviceName = 'MultichainAccountService';
31
+ const MESSENGER_EXPOSED_METHODS = [
32
+ 'getMultichainAccountGroup',
33
+ 'getMultichainAccountGroups',
34
+ 'getMultichainAccountWallet',
35
+ 'getMultichainAccountWallets',
36
+ 'createNextMultichainAccountGroup',
37
+ 'createMultichainAccountGroup',
38
+ 'createMultichainAccountGroups',
39
+ 'setBasicFunctionality',
40
+ 'alignWallets',
41
+ 'alignWallet',
42
+ 'createMultichainAccountWallet',
43
+ 'resyncAccounts',
44
+ 'removeMultichainAccountWallet',
45
+ 'ensureCanUseSnapPlatform',
46
+ ];
30
47
  /**
31
48
  * Service to expose multichain accounts capabilities.
32
49
  */
@@ -40,12 +57,15 @@ class MultichainAccountService {
40
57
  * @param options.providers - Optional list of account
41
58
  * @param options.providerConfigs - Optional provider configs
42
59
  * @param options.config - Optional config.
60
+ * @param options.ensureOnboardingComplete - Optional callback to ensure
61
+ * onboarding is completed before using the Snap platform.
43
62
  */
44
- constructor({ messenger, providers = [], providerConfigs, config, }) {
63
+ constructor({ messenger, providers = [], providerConfigs, config, ensureOnboardingComplete, }) {
45
64
  _MultichainAccountService_instances.add(this);
46
65
  _MultichainAccountService_messenger.set(this, void 0);
47
66
  _MultichainAccountService_watcher.set(this, void 0);
48
67
  _MultichainAccountService_providers.set(this, void 0);
68
+ _MultichainAccountService_trace.set(this, void 0);
49
69
  _MultichainAccountService_wallets.set(this, void 0);
50
70
  /**
51
71
  * The name of the service.
@@ -53,30 +73,29 @@ class MultichainAccountService {
53
73
  this.name = exports.serviceName;
54
74
  __classPrivateFieldSet(this, _MultichainAccountService_messenger, messenger, "f");
55
75
  __classPrivateFieldSet(this, _MultichainAccountService_wallets, new Map(), "f");
56
- // Pass trace callback directly to preserve original 'this' context
57
- // This avoids binding the callback to the MultichainAccountService instance
58
- const traceCallback = config?.trace ?? analytics_1.traceFallback;
76
+ // Pass trace callback directly to preserve original 'this' context.
77
+ // This avoids binding the callback to the MultichainAccountService instance.
78
+ let trace = config?.trace ?? analytics_1.traceFallback;
79
+ // Wrap the trace callback with local performance tracing if performance logging is enabled.
80
+ if ((0, perf_1.isPerfEnabled)()) {
81
+ trace = (0, perf_1.withLocalPerfTrace)(trace);
82
+ }
83
+ // This trace is passed down to wallets and providers to be used for tracing operations within them.
84
+ __classPrivateFieldSet(this, _MultichainAccountService_trace, trace, "f");
59
85
  // TODO: Rely on keyring capabilities once the keyring API is used by all keyrings.
60
86
  __classPrivateFieldSet(this, _MultichainAccountService_providers, [
61
- new EvmAccountProvider_1.EvmAccountProvider(__classPrivateFieldGet(this, _MultichainAccountService_messenger, "f"), providerConfigs?.[providers_1.EVM_ACCOUNT_PROVIDER_NAME], traceCallback),
62
- new AccountProviderWrapper_1.AccountProviderWrapper(__classPrivateFieldGet(this, _MultichainAccountService_messenger, "f"), new SolAccountProvider_1.SolAccountProvider(__classPrivateFieldGet(this, _MultichainAccountService_messenger, "f"), providerConfigs?.[SolAccountProvider_2.SOL_ACCOUNT_PROVIDER_NAME], traceCallback)),
87
+ new EvmAccountProvider_1.EvmAccountProvider(__classPrivateFieldGet(this, _MultichainAccountService_messenger, "f"), providerConfigs?.[providers_1.EVM_ACCOUNT_PROVIDER_NAME], trace),
88
+ new AccountProviderWrapper_1.AccountProviderWrapper(__classPrivateFieldGet(this, _MultichainAccountService_messenger, "f"), new SolAccountProvider_1.SolAccountProvider(__classPrivateFieldGet(this, _MultichainAccountService_messenger, "f"), providerConfigs?.[SolAccountProvider_2.SOL_ACCOUNT_PROVIDER_NAME], trace)),
89
+ new AccountProviderWrapper_1.AccountProviderWrapper(__classPrivateFieldGet(this, _MultichainAccountService_messenger, "f"), new providers_1.BtcAccountProvider(__classPrivateFieldGet(this, _MultichainAccountService_messenger, "f"), providerConfigs?.[providers_1.BTC_ACCOUNT_PROVIDER_NAME], trace)),
90
+ new AccountProviderWrapper_1.AccountProviderWrapper(__classPrivateFieldGet(this, _MultichainAccountService_messenger, "f"), new providers_1.TrxAccountProvider(__classPrivateFieldGet(this, _MultichainAccountService_messenger, "f"), providerConfigs?.[providers_1.TRX_ACCOUNT_PROVIDER_NAME], trace)),
63
91
  // Custom account providers that can be provided by the MetaMask client.
64
92
  ...providers,
65
93
  ], "f");
66
- __classPrivateFieldSet(this, _MultichainAccountService_watcher, new SnapPlatformWatcher_1.SnapPlatformWatcher(messenger), "f");
67
- __classPrivateFieldGet(this, _MultichainAccountService_messenger, "f").registerActionHandler('MultichainAccountService:getMultichainAccountGroup', (...args) => this.getMultichainAccountGroup(...args));
68
- __classPrivateFieldGet(this, _MultichainAccountService_messenger, "f").registerActionHandler('MultichainAccountService:getMultichainAccountGroups', (...args) => this.getMultichainAccountGroups(...args));
69
- __classPrivateFieldGet(this, _MultichainAccountService_messenger, "f").registerActionHandler('MultichainAccountService:getMultichainAccountWallet', (...args) => this.getMultichainAccountWallet(...args));
70
- __classPrivateFieldGet(this, _MultichainAccountService_messenger, "f").registerActionHandler('MultichainAccountService:getMultichainAccountWallets', (...args) => this.getMultichainAccountWallets(...args));
71
- __classPrivateFieldGet(this, _MultichainAccountService_messenger, "f").registerActionHandler('MultichainAccountService:createNextMultichainAccountGroup', (...args) => this.createNextMultichainAccountGroup(...args));
72
- __classPrivateFieldGet(this, _MultichainAccountService_messenger, "f").registerActionHandler('MultichainAccountService:createMultichainAccountGroup', (...args) => this.createMultichainAccountGroup(...args));
73
- __classPrivateFieldGet(this, _MultichainAccountService_messenger, "f").registerActionHandler('MultichainAccountService:setBasicFunctionality', (...args) => this.setBasicFunctionality(...args));
74
- __classPrivateFieldGet(this, _MultichainAccountService_messenger, "f").registerActionHandler('MultichainAccountService:alignWallets', (...args) => this.alignWallets(...args));
75
- __classPrivateFieldGet(this, _MultichainAccountService_messenger, "f").registerActionHandler('MultichainAccountService:alignWallet', (...args) => this.alignWallet(...args));
76
- __classPrivateFieldGet(this, _MultichainAccountService_messenger, "f").registerActionHandler('MultichainAccountService:createMultichainAccountWallet', (...args) => this.createMultichainAccountWallet(...args));
77
- __classPrivateFieldGet(this, _MultichainAccountService_messenger, "f").registerActionHandler('MultichainAccountService:resyncAccounts', (...args) => this.resyncAccounts(...args));
78
- __classPrivateFieldGet(this, _MultichainAccountService_messenger, "f").registerActionHandler('MultichainAccountService:removeMultichainAccountWallet', (...args) => this.removeMultichainAccountWallet(...args));
79
- __classPrivateFieldGet(this, _MultichainAccountService_messenger, "f").registerActionHandler('MultichainAccountService:ensureCanUseSnapPlatform', (...args) => this.ensureCanUseSnapPlatform(...args));
94
+ __classPrivateFieldSet(this, _MultichainAccountService_watcher, new SnapPlatformWatcher_1.SnapPlatformWatcher(messenger, {
95
+ ensureOnboardingComplete,
96
+ snapKeyringWaitTimeoutMs: config?.snapPlatformWatcher?.timeoutMs,
97
+ }), "f");
98
+ __classPrivateFieldGet(this, _MultichainAccountService_messenger, "f").registerMethodActionHandlers(this, MESSENGER_EXPOSED_METHODS);
80
99
  }
81
100
  /**
82
101
  * Initialize the service and constructs the internal reprensentation of
@@ -98,6 +117,7 @@ class MultichainAccountService {
98
117
  entropySource,
99
118
  providers: __classPrivateFieldGet(this, _MultichainAccountService_providers, "f"),
100
119
  messenger: __classPrivateFieldGet(this, _MultichainAccountService_messenger, "f"),
120
+ trace: __classPrivateFieldGet(this, _MultichainAccountService_trace, "f"),
101
121
  });
102
122
  wallet.init(serviceState[entropySource]);
103
123
  __classPrivateFieldGet(this, _MultichainAccountService_wallets, "f").set(wallet.id, wallet);
@@ -131,13 +151,9 @@ class MultichainAccountService {
131
151
  await provider.resyncAccounts(accounts);
132
152
  }
133
153
  catch (error) {
134
- const errorMessage = `Unable to re-sync provider "${provider.getName()}"`;
135
- (0, logger_1.projectLogger)(errorMessage);
136
- console.error(errorMessage);
137
- const sentryError = (0, utils_2.createSentryError)(errorMessage, error, {
154
+ (0, errors_1.reportError)(__classPrivateFieldGet(this, _MultichainAccountService_messenger, "f"), `Unable to re-sync provider "${provider.getName()}"`, error, {
138
155
  provider: provider.getName(),
139
156
  });
140
- __classPrivateFieldGet(this, _MultichainAccountService_messenger, "f").captureException?.(sentryError);
141
157
  }
142
158
  }));
143
159
  (0, logger_1.projectLogger)('Providers got re-synced!');
@@ -267,6 +283,18 @@ class MultichainAccountService {
267
283
  async createMultichainAccountGroup({ groupIndex, entropySource, }) {
268
284
  return await __classPrivateFieldGet(this, _MultichainAccountService_instances, "m", _MultichainAccountService_getWallet).call(this, entropySource).createMultichainAccountGroup(groupIndex);
269
285
  }
286
+ /**
287
+ * Creates multiple multichain account groups up to maxGroupIndex.
288
+ *
289
+ * @param params - Parameters for creating account groups.
290
+ * @param params.fromGroupIndex - Starting group index to create (inclusive) (defaults to 0).
291
+ * @param params.toGroupIndex - Maximum group index to create (inclusive).
292
+ * @param params.entropySource - The entropy source ID.
293
+ * @returns Array of created multichain account groups.
294
+ */
295
+ async createMultichainAccountGroups({ fromGroupIndex = 0, toGroupIndex, entropySource, }) {
296
+ return await __classPrivateFieldGet(this, _MultichainAccountService_instances, "m", _MultichainAccountService_getWallet).call(this, entropySource).createMultichainAccountGroups({ from: fromGroupIndex, to: toGroupIndex }, { waitForAllProvidersToFinishCreatingAccounts: false });
297
+ }
270
298
  /**
271
299
  * Set basic functionality state and trigger alignment if enabled.
272
300
  * When basic functionality is disabled, snap-based providers are disabled.
@@ -312,7 +340,7 @@ class MultichainAccountService {
312
340
  }
313
341
  }
314
342
  exports.MultichainAccountService = MultichainAccountService;
315
- _MultichainAccountService_messenger = new WeakMap(), _MultichainAccountService_watcher = new WeakMap(), _MultichainAccountService_providers = new WeakMap(), _MultichainAccountService_wallets = new WeakMap(), _MultichainAccountService_instances = new WeakSet(), _MultichainAccountService_getStateKeys = function _MultichainAccountService_getStateKeys(account) {
343
+ _MultichainAccountService_messenger = new WeakMap(), _MultichainAccountService_watcher = new WeakMap(), _MultichainAccountService_providers = new WeakMap(), _MultichainAccountService_trace = new WeakMap(), _MultichainAccountService_wallets = new WeakMap(), _MultichainAccountService_instances = new WeakSet(), _MultichainAccountService_getStateKeys = function _MultichainAccountService_getStateKeys(account) {
316
344
  for (const provider of __classPrivateFieldGet(this, _MultichainAccountService_providers, "f")) {
317
345
  if ((0, account_api_1.isBip44Account)(account) && provider.isAccountCompatible(account)) {
318
346
  return {
@@ -376,6 +404,7 @@ async function _MultichainAccountService_createWalletByImport(mnemonic) {
376
404
  providers: __classPrivateFieldGet(this, _MultichainAccountService_providers, "f"),
377
405
  entropySource: result.id,
378
406
  messenger: __classPrivateFieldGet(this, _MultichainAccountService_messenger, "f"),
407
+ trace: __classPrivateFieldGet(this, _MultichainAccountService_trace, "f"),
379
408
  });
380
409
  }, _MultichainAccountService_createWalletByNewVault =
381
410
  /**
@@ -392,6 +421,7 @@ async function _MultichainAccountService_createWalletByNewVault(password) {
392
421
  providers: __classPrivateFieldGet(this, _MultichainAccountService_providers, "f"),
393
422
  entropySource: entropySourceId,
394
423
  messenger: __classPrivateFieldGet(this, _MultichainAccountService_messenger, "f"),
424
+ trace: __classPrivateFieldGet(this, _MultichainAccountService_trace, "f"),
395
425
  });
396
426
  }, _MultichainAccountService_createWalletByRestore =
397
427
  /**
@@ -409,6 +439,7 @@ async function _MultichainAccountService_createWalletByRestore(password, mnemoni
409
439
  providers: __classPrivateFieldGet(this, _MultichainAccountService_providers, "f"),
410
440
  entropySource: entropySourceId,
411
441
  messenger: __classPrivateFieldGet(this, _MultichainAccountService_messenger, "f"),
442
+ trace: __classPrivateFieldGet(this, _MultichainAccountService_trace, "f"),
412
443
  });
413
444
  };
414
445
  //# sourceMappingURL=MultichainAccountService.cjs.map