@metamask/multichain-account-service 8.0.1 → 9.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 (126) hide show
  1. package/CHANGELOG.md +35 -12
  2. package/dist/MultichainAccountGroup.cjs.map +1 -1
  3. package/dist/MultichainAccountGroup.d.cts.map +1 -1
  4. package/dist/MultichainAccountGroup.d.mts.map +1 -1
  5. package/dist/MultichainAccountGroup.mjs.map +1 -1
  6. package/dist/MultichainAccountService-method-action-types.cjs.map +1 -1
  7. package/dist/MultichainAccountService-method-action-types.d.cts +9 -1
  8. package/dist/MultichainAccountService-method-action-types.d.cts.map +1 -1
  9. package/dist/MultichainAccountService-method-action-types.d.mts +9 -1
  10. package/dist/MultichainAccountService-method-action-types.d.mts.map +1 -1
  11. package/dist/MultichainAccountService-method-action-types.mjs.map +1 -1
  12. package/dist/MultichainAccountService.cjs +1 -0
  13. package/dist/MultichainAccountService.cjs.map +1 -1
  14. package/dist/MultichainAccountService.d.cts.map +1 -1
  15. package/dist/MultichainAccountService.d.mts.map +1 -1
  16. package/dist/MultichainAccountService.mjs +1 -0
  17. package/dist/MultichainAccountService.mjs.map +1 -1
  18. package/dist/MultichainAccountWallet.cjs.map +1 -1
  19. package/dist/MultichainAccountWallet.d.cts.map +1 -1
  20. package/dist/MultichainAccountWallet.d.mts.map +1 -1
  21. package/dist/MultichainAccountWallet.mjs.map +1 -1
  22. package/dist/analytics/perf.cjs +1 -1
  23. package/dist/analytics/perf.cjs.map +1 -1
  24. package/dist/analytics/perf.mjs +1 -1
  25. package/dist/analytics/perf.mjs.map +1 -1
  26. package/dist/errors.cjs +1 -1
  27. package/dist/errors.cjs.map +1 -1
  28. package/dist/errors.d.cts.map +1 -1
  29. package/dist/errors.d.mts.map +1 -1
  30. package/dist/errors.mjs +2 -2
  31. package/dist/errors.mjs.map +1 -1
  32. package/dist/index.cjs.map +1 -1
  33. package/dist/index.d.cts +1 -1
  34. package/dist/index.d.cts.map +1 -1
  35. package/dist/index.d.mts +1 -1
  36. package/dist/index.d.mts.map +1 -1
  37. package/dist/index.mjs.map +1 -1
  38. package/dist/providers/AccountProviderWrapper.cjs.map +1 -1
  39. package/dist/providers/AccountProviderWrapper.d.cts +3 -2
  40. package/dist/providers/AccountProviderWrapper.d.cts.map +1 -1
  41. package/dist/providers/AccountProviderWrapper.d.mts +3 -2
  42. package/dist/providers/AccountProviderWrapper.d.mts.map +1 -1
  43. package/dist/providers/AccountProviderWrapper.mjs.map +1 -1
  44. package/dist/providers/BaseBip44AccountProvider.cjs +29 -0
  45. package/dist/providers/BaseBip44AccountProvider.cjs.map +1 -1
  46. package/dist/providers/BaseBip44AccountProvider.d.cts +29 -2
  47. package/dist/providers/BaseBip44AccountProvider.d.cts.map +1 -1
  48. package/dist/providers/BaseBip44AccountProvider.d.mts +29 -2
  49. package/dist/providers/BaseBip44AccountProvider.d.mts.map +1 -1
  50. package/dist/providers/BaseBip44AccountProvider.mjs +29 -0
  51. package/dist/providers/BaseBip44AccountProvider.mjs.map +1 -1
  52. package/dist/providers/BtcAccountProvider.cjs +2 -2
  53. package/dist/providers/BtcAccountProvider.cjs.map +1 -1
  54. package/dist/providers/BtcAccountProvider.d.cts +3 -2
  55. package/dist/providers/BtcAccountProvider.d.cts.map +1 -1
  56. package/dist/providers/BtcAccountProvider.d.mts +3 -2
  57. package/dist/providers/BtcAccountProvider.d.mts.map +1 -1
  58. package/dist/providers/BtcAccountProvider.mjs +2 -2
  59. package/dist/providers/BtcAccountProvider.mjs.map +1 -1
  60. package/dist/providers/EvmAccountProvider.cjs +63 -46
  61. package/dist/providers/EvmAccountProvider.cjs.map +1 -1
  62. package/dist/providers/EvmAccountProvider.d.cts +3 -2
  63. package/dist/providers/EvmAccountProvider.d.cts.map +1 -1
  64. package/dist/providers/EvmAccountProvider.d.mts +3 -2
  65. package/dist/providers/EvmAccountProvider.d.mts.map +1 -1
  66. package/dist/providers/EvmAccountProvider.mjs +63 -46
  67. package/dist/providers/EvmAccountProvider.mjs.map +1 -1
  68. package/dist/providers/SnapAccountProvider.cjs +2 -2
  69. package/dist/providers/SnapAccountProvider.cjs.map +1 -1
  70. package/dist/providers/SnapAccountProvider.d.cts +1 -1
  71. package/dist/providers/SnapAccountProvider.d.cts.map +1 -1
  72. package/dist/providers/SnapAccountProvider.d.mts +1 -1
  73. package/dist/providers/SnapAccountProvider.d.mts.map +1 -1
  74. package/dist/providers/SnapAccountProvider.mjs +2 -2
  75. package/dist/providers/SnapAccountProvider.mjs.map +1 -1
  76. package/dist/providers/SolAccountProvider.cjs +2 -2
  77. package/dist/providers/SolAccountProvider.cjs.map +1 -1
  78. package/dist/providers/SolAccountProvider.d.cts +3 -2
  79. package/dist/providers/SolAccountProvider.d.cts.map +1 -1
  80. package/dist/providers/SolAccountProvider.d.mts +3 -2
  81. package/dist/providers/SolAccountProvider.d.mts.map +1 -1
  82. package/dist/providers/SolAccountProvider.mjs +2 -2
  83. package/dist/providers/SolAccountProvider.mjs.map +1 -1
  84. package/dist/providers/TrxAccountProvider.cjs +2 -2
  85. package/dist/providers/TrxAccountProvider.cjs.map +1 -1
  86. package/dist/providers/TrxAccountProvider.d.cts +3 -2
  87. package/dist/providers/TrxAccountProvider.d.cts.map +1 -1
  88. package/dist/providers/TrxAccountProvider.d.mts +3 -2
  89. package/dist/providers/TrxAccountProvider.d.mts.map +1 -1
  90. package/dist/providers/TrxAccountProvider.mjs +2 -2
  91. package/dist/providers/TrxAccountProvider.mjs.map +1 -1
  92. package/dist/providers/utils.cjs +13 -1
  93. package/dist/providers/utils.cjs.map +1 -1
  94. package/dist/providers/utils.d.cts +7 -0
  95. package/dist/providers/utils.d.cts.map +1 -1
  96. package/dist/providers/utils.d.mts +7 -0
  97. package/dist/providers/utils.d.mts.map +1 -1
  98. package/dist/providers/utils.mjs +11 -0
  99. package/dist/providers/utils.mjs.map +1 -1
  100. package/dist/tests/accounts.cjs +4 -6
  101. package/dist/tests/accounts.cjs.map +1 -1
  102. package/dist/tests/accounts.d.cts +8 -21
  103. package/dist/tests/accounts.d.cts.map +1 -1
  104. package/dist/tests/accounts.d.mts +8 -21
  105. package/dist/tests/accounts.d.mts.map +1 -1
  106. package/dist/tests/accounts.mjs +4 -6
  107. package/dist/tests/accounts.mjs.map +1 -1
  108. package/dist/tests/messenger.cjs +1 -0
  109. package/dist/tests/messenger.cjs.map +1 -1
  110. package/dist/tests/messenger.d.cts.map +1 -1
  111. package/dist/tests/messenger.d.mts.map +1 -1
  112. package/dist/tests/messenger.mjs +1 -0
  113. package/dist/tests/messenger.mjs.map +1 -1
  114. package/dist/tests/providers.cjs.map +1 -1
  115. package/dist/tests/providers.d.cts +2 -1
  116. package/dist/tests/providers.d.cts.map +1 -1
  117. package/dist/tests/providers.d.mts +2 -1
  118. package/dist/tests/providers.d.mts.map +1 -1
  119. package/dist/tests/providers.mjs.map +1 -1
  120. package/dist/types.cjs.map +1 -1
  121. package/dist/types.d.cts +2 -2
  122. package/dist/types.d.cts.map +1 -1
  123. package/dist/types.d.mts +2 -2
  124. package/dist/types.d.mts.map +1 -1
  125. package/dist/types.mjs.map +1 -1
  126. package/package.json +29 -28
package/CHANGELOG.md CHANGED
@@ -7,6 +7,28 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [9.0.0]
11
+
12
+ ### Added
13
+
14
+ - Expose missing `MultichainAccountService:init` action through its messenger ([#8717](https://github.com/MetaMask/core/pull/8717))
15
+ - Corresponding action type is available as well.
16
+ - Filter out `KeyringController` locked errors from sentry reporting ([#8619](https://github.com/MetaMask/core/pull/8619))
17
+
18
+ ### Changed
19
+
20
+ - **BREAKING:** Replace `KeyringController:withKeyring` with `KeyringController:withKeyringV2` for the EVM account provider ([#8491](https://github.com/MetaMask/core/pull/8491))
21
+ - Bump `@metamask/accounts-controller` from `^37.1.1` to `^38.0.0` ([#8363](https://github.com/MetaMask/core/pull/8363), [#8665](https://github.com/MetaMask/core/pull/8665))
22
+ - Bump `@metamask/keyring-controller` from `^25.1.1` to `^25.5.0` ([#8363](https://github.com/MetaMask/core/pull/8363), [#8634](https://github.com/MetaMask/core/pull/8634), [#8665](https://github.com/MetaMask/core/pull/8665), [#8722](https://github.com/MetaMask/core/pull/8722))
23
+ - Bump `@metamask/messenger` from `^1.0.0` to `^1.2.0` ([#8364](https://github.com/MetaMask/core/pull/8364), [#8373](https://github.com/MetaMask/core/pull/8373), [#8632](https://github.com/MetaMask/core/pull/8632))
24
+ - Bump `@metamask/base-controller` from `^9.0.1` to `^9.1.0` ([#8457](https://github.com/MetaMask/core/pull/8457))
25
+ - Bump `@metamask/account-api` from `^1.0.0` to `^1.0.4` ([#8464](https://github.com/MetaMask/core/pull/8464), [#8647](https://github.com/MetaMask/core/pull/8647))
26
+ - Bump `@metamask/eth-snap-keyring` from `^19.0.0` to `^22.0.1` ([#8464](https://github.com/MetaMask/core/pull/8464), [#8584](https://github.com/MetaMask/core/pull/8584), [#8647](https://github.com/MetaMask/core/pull/8647))
27
+ - Bump `@metamask/keyring-api` from `^21.6.0` to `^23.1.0` ([#8464](https://github.com/MetaMask/core/pull/8464), [#8647](https://github.com/MetaMask/core/pull/8647))
28
+ - Bump `@metamask/keyring-internal-api` from `^10.0.0` to `^11.0.1` ([#8464](https://github.com/MetaMask/core/pull/8464), [#8584](https://github.com/MetaMask/core/pull/8584), [#8647](https://github.com/MetaMask/core/pull/8647))
29
+ - Bump `@metamask/keyring-snap-client` from `^8.2.0` to `^9.0.2` ([#8464](https://github.com/MetaMask/core/pull/8464), [#8647](https://github.com/MetaMask/core/pull/8647))
30
+ - Bump `@metamask/keyring-utils` from `^3.1.0` to `^3.2.1` ([#8703](https://github.com/MetaMask/core/pull/8703))
31
+
10
32
  ## [8.0.1]
11
33
 
12
34
  ### Changed
@@ -22,7 +44,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
22
44
 
23
45
  - Use `{Btc,Sol}AccountProvider` as default providers ([#8262](https://github.com/MetaMask/core/pull/8262))
24
46
  - Those providers were initially provided by the clients.
25
- - Add new `createMultichainAccountGroups` support to create multiple groups in batch ([#7801](https://github.com/MetaMask/core/pull/7801)), ([#8190](https://github.com/MetaMask/core/pull/8190))
47
+ - Add new `createMultichainAccountGroups` support to create multiple groups in batch ([#7801](https://github.com/MetaMask/core/pull/7801), [#8190](https://github.com/MetaMask/core/pull/8190))
26
48
  - Add new `resyncAccounts.autoRemoveExtraSnapAccounts` configuration on Snap-based providers ([#8200](https://github.com/MetaMask/core/pull/8200))
27
49
  - When enabled, this will make the `resyncAccounts` method automatically remove any extra accounts that exist on the Snap side but not on MetaMask side.
28
50
  - This behavior was enabled by default and can now be turned off by the clients.
@@ -74,7 +96,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
74
96
 
75
97
  ### Changed
76
98
 
77
- - Bump `@metamask/accounts-controller` from `^36.0.0` to `^37.0.0` ([#7996](https://github.com/MetaMask/core/pull/7996)), ([#8140](https://github.com/MetaMask/core/pull/8140))
99
+ - Bump `@metamask/accounts-controller` from `^36.0.0` to `^37.0.0` ([#7996](https://github.com/MetaMask/core/pull/7996), [#8140](https://github.com/MetaMask/core/pull/8140))
78
100
 
79
101
  ## [7.0.0]
80
102
 
@@ -186,7 +208,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
186
208
 
187
209
  - **BREAKING:** Added error reporting around account creation with the `ErrorReportingService` ([#7044](https://github.com/MetaMask/core/pull/7044))
188
210
  - The `@metamask/error-reporting-service` is now a peer dependency.
189
- - Add `MultichainAccountService.resyncAccounts` method and action ([#7087](https://github.com/MetaMask/core/pull/7087)), ([#7093](https://github.com/MetaMask/core/pull/7093))
211
+ - Add `MultichainAccountService.resyncAccounts` method and action ([#7087](https://github.com/MetaMask/core/pull/7087), [#7093](https://github.com/MetaMask/core/pull/7093))
190
212
  - Add `*AccountProvider.resyncAccounts` method ([#7087](https://github.com/MetaMask/core/pull/7087))
191
213
 
192
214
  ### Changed
@@ -209,7 +231,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
209
231
 
210
232
  ### Fixed
211
233
 
212
- - Use `groupIndex` for account creations on `TrxAccountProvider` instead of the outdated `derivationPath` ([#7010](https://github.com/MetaMask/core/pull/7010)), ([#7018](https://github.com/MetaMask/core/pull/7018))
234
+ - Use `groupIndex` for account creations on `TrxAccountProvider` instead of the outdated `derivationPath` ([#7010](https://github.com/MetaMask/core/pull/7010), [#7018](https://github.com/MetaMask/core/pull/7018))
213
235
 
214
236
  ## [2.0.0]
215
237
 
@@ -319,7 +341,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
319
341
 
320
342
  - **BREAKING:** Rename `MultichainAccountWallet.alignGroup` to `alignAccountsOf` ([#6595](https://github.com/MetaMask/core/pull/6595))
321
343
  - **BREAKING:** Rename `MultichainAccountGroup.align` to `alignAccounts` ([#6595](https://github.com/MetaMask/core/pull/6595))
322
- - Add timeout and retry mechanism to EVM discovery ([#6609](https://github.com/MetaMask/core/pull/6609)), ([#6621](https://github.com/MetaMask/core/pull/6621))
344
+ - Add timeout and retry mechanism to EVM discovery ([#6609](https://github.com/MetaMask/core/pull/6609), [#6621](https://github.com/MetaMask/core/pull/6621))
323
345
  - Bump `@metamask/utils` from `^11.4.2` to `^11.8.0` ([#6588](https://github.com/MetaMask/core/pull/6588))
324
346
  - Bump `@metamask/base-controller` from `^8.3.0` to `^8.4.0` ([#6632](https://github.com/MetaMask/core/pull/6632))
325
347
 
@@ -404,17 +426,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
404
426
 
405
427
  - Allow custom account providers ([#6231](https://github.com/MetaMask/core/pull/6231))
406
428
  - You can now pass an extra option `providers` in the service's constructor.
407
- - Add multichain account group creation support ([#6222](https://github.com/MetaMask/core/pull/6222)), ([#6238](https://github.com/MetaMask/core/pull/6238)), ([#6240](https://github.com/MetaMask/core/pull/6240))
429
+ - Add multichain account group creation support ([#6222](https://github.com/MetaMask/core/pull/6222), [#6238](https://github.com/MetaMask/core/pull/6238), [#6240](https://github.com/MetaMask/core/pull/6240))
408
430
  - This includes the new actions `MultichainAccountService:createNextMultichainAccountGroup` and `MultichainAccountService:createMultichainAccountGroup`.
409
431
  - Export `MultichainAccountWallet` and `MultichainAccountGroup` types ([#6220](https://github.com/MetaMask/core/pull/6220))
410
432
 
411
433
  ### Changed
412
434
 
413
435
  - **BREAKING:** Use `KeyringAccount` instead of `InternalAccount` ([#6227](https://github.com/MetaMask/core/pull/6227))
414
- - **BREAKING:** Bump peer dependency `@metamask/account-api` from `^0.3.0` to `^0.9.0` ([#6214](https://github.com/MetaMask/core/pull/6214)), ([#6216](https://github.com/MetaMask/core/pull/6216)), ([#6222](https://github.com/MetaMask/core/pull/6222)), ([#6248](https://github.com/MetaMask/core/pull/6248))
415
- - **BREAKING:** Rename `MultichainAccount` to `MultichainAccountGroup` ([#6216](https://github.com/MetaMask/core/pull/6216)), ([#6219](https://github.com/MetaMask/core/pull/6219))
436
+ - **BREAKING:** Bump peer dependency `@metamask/account-api` from `^0.3.0` to `^0.9.0` ([#6214](https://github.com/MetaMask/core/pull/6214), [#6216](https://github.com/MetaMask/core/pull/6216), [#6222](https://github.com/MetaMask/core/pull/6222), [#6248](https://github.com/MetaMask/core/pull/6248))
437
+ - **BREAKING:** Rename `MultichainAccount` to `MultichainAccountGroup` ([#6216](https://github.com/MetaMask/core/pull/6216), [#6219](https://github.com/MetaMask/core/pull/6219))
416
438
  - The naming was confusing and since a `MultichainAccount` is also an `AccountGroup` it makes sense to have the suffix there too.
417
- - **BREAKING:** Rename `getMultichainAccount*` to `getMultichainAccountGroup*` ([#6216](https://github.com/MetaMask/core/pull/6216)), ([#6219](https://github.com/MetaMask/core/pull/6219))
439
+ - **BREAKING:** Rename `getMultichainAccount*` to `getMultichainAccountGroup*` ([#6216](https://github.com/MetaMask/core/pull/6216), [#6219](https://github.com/MetaMask/core/pull/6219))
418
440
  - The naming was confusing and since a `MultichainAccount` is also an `AccountGroup` it makes sense to have the suffix there too.
419
441
 
420
442
  ## [0.3.0]
@@ -427,7 +449,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
427
449
 
428
450
  ### Changed
429
451
 
430
- - **BREAKING:** Add `@metamask/account-api` peer dependency ([#6115](https://github.com/MetaMask/core/pull/6115)), ([#6146](https://github.com/MetaMask/core/pull/6146))
452
+ - **BREAKING:** Add `@metamask/account-api` peer dependency ([#6115](https://github.com/MetaMask/core/pull/6115), [#6146](https://github.com/MetaMask/core/pull/6146))
431
453
 
432
454
  ## [0.2.1]
433
455
 
@@ -445,10 +467,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
445
467
 
446
468
  ### Added
447
469
 
448
- - Add `MultichainAccountService` ([#6141](https://github.com/MetaMask/core/pull/6141)), ([#6165](https://github.com/MetaMask/core/pull/6165))
470
+ - Add `MultichainAccountService` ([#6141](https://github.com/MetaMask/core/pull/6141), [#6165](https://github.com/MetaMask/core/pull/6165))
449
471
  - This service manages multichain accounts/wallets.
450
472
 
451
- [Unreleased]: https://github.com/MetaMask/core/compare/@metamask/multichain-account-service@8.0.1...HEAD
473
+ [Unreleased]: https://github.com/MetaMask/core/compare/@metamask/multichain-account-service@9.0.0...HEAD
474
+ [9.0.0]: https://github.com/MetaMask/core/compare/@metamask/multichain-account-service@8.0.1...@metamask/multichain-account-service@9.0.0
452
475
  [8.0.1]: https://github.com/MetaMask/core/compare/@metamask/multichain-account-service@8.0.0...@metamask/multichain-account-service@8.0.1
453
476
  [8.0.0]: https://github.com/MetaMask/core/compare/@metamask/multichain-account-service@7.1.0...@metamask/multichain-account-service@8.0.0
454
477
  [7.1.0]: https://github.com/MetaMask/core/compare/@metamask/multichain-account-service@7.0.0...@metamask/multichain-account-service@7.1.0
@@ -1 +1 @@
1
- {"version":3,"file":"MultichainAccountGroup.cjs","sourceRoot":"","sources":["../src/MultichainAccountGroup.ts"],"names":[],"m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C,CAAC;YAEnD,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE,CAAC;gBACnC,uBAAA,IAAI,iDAAmB,CAAC,GAAG,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;YACnD,CAAC;QACH,CAAC;IACH,CAAC;AACH,CAAC","sourcesContent":["import { AccountGroupType, select, selectOne } from '@metamask/account-api';\nimport { toMultichainAccountGroupId } from '@metamask/account-api';\nimport type {\n MultichainAccountGroupId,\n MultichainAccountGroup as MultichainAccountGroupDefinition,\n} from '@metamask/account-api';\nimport type { Bip44Account } from '@metamask/account-api';\nimport type { AccountSelector } from '@metamask/account-api';\nimport type { KeyringAccount } from '@metamask/keyring-api';\n\nimport type { Logger } from './logger';\nimport { projectLogger as log, createModuleLogger } from './logger';\nimport type { ServiceState, StateKeys } from './MultichainAccountService';\nimport type { MultichainAccountWallet } from './MultichainAccountWallet';\nimport type { Bip44AccountProvider } from './providers';\nimport type { MultichainAccountServiceMessenger } from './types';\n\nexport type GroupState =\n ServiceState[StateKeys['entropySource']][StateKeys['groupIndex']];\n\n/**\n * A multichain account group that holds multiple accounts.\n */\nexport class MultichainAccountGroup<\n Account extends Bip44Account<KeyringAccount>,\n> implements MultichainAccountGroupDefinition<Account>\n{\n readonly #id: MultichainAccountGroupId;\n\n readonly #wallet: MultichainAccountWallet<Account>;\n\n readonly #groupIndex: number;\n\n readonly #providers: Bip44AccountProvider<Account>[];\n\n readonly #providerToAccounts: Map<\n Bip44AccountProvider<Account>,\n Account['id'][]\n >;\n\n readonly #accountToProvider: Map<\n Account['id'],\n Bip44AccountProvider<Account>\n >;\n\n readonly #messenger: MultichainAccountServiceMessenger;\n\n readonly #log: Logger;\n\n #initialized = false;\n\n constructor({\n groupIndex,\n wallet,\n providers,\n messenger,\n }: {\n groupIndex: number;\n wallet: MultichainAccountWallet<Account>;\n providers: Bip44AccountProvider<Account>[];\n messenger: MultichainAccountServiceMessenger;\n }) {\n this.#id = toMultichainAccountGroupId(wallet.id, groupIndex);\n this.#groupIndex = groupIndex;\n this.#wallet = wallet;\n this.#providers = providers;\n this.#messenger = messenger;\n this.#providerToAccounts = new Map();\n this.#accountToProvider = new Map();\n\n this.#log = createModuleLogger(log, `[${this.#id}]`);\n }\n\n /**\n * Clear the account to provider state for a given provider.\n *\n * @param provider - The provider to clear the account to provider state for.\n */\n #clearAccountToProviderState(provider: Bip44AccountProvider<Account>): void {\n this.#accountToProvider.forEach((accountProvider, id) => {\n if (accountProvider === provider) {\n this.#accountToProvider.delete(id);\n }\n });\n }\n\n /**\n * Update the internal representation of accounts with the given group state.\n *\n * @param groupState - The group state.\n */\n #setState(groupState: GroupState): void {\n for (const provider of this.#providers) {\n const accountIds = groupState[provider.getName()];\n\n if (accountIds) {\n this.#clearAccountToProviderState(provider);\n this.#providerToAccounts.set(provider, accountIds);\n\n for (const accountId of accountIds) {\n this.#accountToProvider.set(accountId, provider);\n }\n }\n }\n }\n\n /**\n * Initialize the multichain account group and construct the internal representation of accounts.\n *\n * @param groupState - The group state.\n */\n init(groupState: GroupState): void {\n this.#log('Initializing group state...');\n this.#setState(groupState);\n this.#log('Finished initializing group state...');\n\n this.#initialized = true;\n }\n\n /**\n * Update the group state.\n *\n * @param groupState - The group state.\n */\n update(groupState: GroupState): void {\n this.#log('Updating group state...');\n this.#setState(groupState);\n this.#log('Finished updating group state...');\n\n if (this.#initialized) {\n this.#messenger.publish(\n 'MultichainAccountService:multichainAccountGroupUpdated',\n this,\n );\n }\n }\n\n /**\n * Gets the multichain account group ID.\n *\n * @returns The multichain account group ID.\n */\n get id(): MultichainAccountGroupId {\n return this.#id;\n }\n\n /**\n * Gets the multichain account group type.\n *\n * @returns The multichain account type.\n */\n get type(): AccountGroupType.MultichainAccount {\n return AccountGroupType.MultichainAccount;\n }\n\n /**\n * Gets the multichain account's wallet reference (parent).\n *\n * @returns The multichain account's wallet.\n */\n get wallet(): MultichainAccountWallet<Account> {\n return this.#wallet;\n }\n\n /**\n * Gets the multichain account group index.\n *\n * @returns The multichain account group index.\n */\n get groupIndex(): number {\n return this.#groupIndex;\n }\n\n /**\n * Checks if there's any underlying accounts for this multichain accounts.\n *\n * @returns True if there's any underlying accounts, false otherwise.\n */\n hasAccounts(): boolean {\n // If there's anything in the reverse-map, it means we have some accounts.\n return this.#accountToProvider.size > 0;\n }\n\n /**\n * Gets the accounts for this multichain account.\n *\n * @returns The accounts.\n */\n getAccounts(): Account[] {\n const allAccounts: Account[] = [];\n\n for (const [provider, accounts] of this.#providerToAccounts.entries()) {\n for (const id of accounts) {\n const account = provider.getAccount(id);\n\n if (account) {\n // If for some reason we cannot get this account from the provider, it\n // might means it has been deleted or something, so we just filter it\n // out.\n allAccounts.push(account);\n }\n }\n }\n\n return allAccounts;\n }\n\n /**\n * Gets the account IDs for this multichain account.\n *\n * @returns The account IDs.\n */\n getAccountIds(): Account['id'][] {\n return [...this.#accountToProvider.keys()];\n }\n\n /**\n * Gets the account for a given account ID.\n *\n * @param id - Account ID.\n * @returns The account or undefined if not found.\n */\n getAccount(id: Account['id']): Account | undefined {\n const provider = this.#accountToProvider.get(id);\n\n // If there's nothing in the map, it means we tried to get an account\n // that does not belong to this multichain account.\n if (!provider) {\n return undefined;\n }\n\n return provider.getAccount(id);\n }\n\n /**\n * Query an account matching the selector.\n *\n * @param selector - Query selector.\n * @returns The account matching the selector or undefined if not matching.\n * @throws If multiple accounts match the selector.\n */\n get(selector: AccountSelector<Account>): Account | undefined {\n return selectOne(this.getAccounts(), selector);\n }\n\n /**\n * Query accounts matching the selector.\n *\n * @param selector - Query selector.\n * @returns The accounts matching the selector.\n */\n select(selector: AccountSelector<Account>): Account[] {\n return select(this.getAccounts(), selector);\n }\n}\n"]}
1
+ {"version":3,"file":"MultichainAccountGroup.cjs","sourceRoot":"","sources":["../src/MultichainAccountGroup.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,uDAA4E;AAC5E,uDAAmE;AAUnE,yCAAoE;AASpE;;GAEG;AACH,MAAa,sBAAsB;IA2BjC,YAA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AAE,QAAQ,CAAC,CAAC;YACnD,CAAC;QACH,CAAC;IACH,CAAC;AACH,CAAC","sourcesContent":["import { AccountGroupType, select, selectOne } from '@metamask/account-api';\nimport { toMultichainAccountGroupId } from '@metamask/account-api';\nimport type {\n MultichainAccountGroupId,\n MultichainAccountGroup as MultichainAccountGroupDefinition,\n} from '@metamask/account-api';\nimport type { Bip44Account } from '@metamask/account-api';\nimport type { AccountSelector } from '@metamask/account-api';\nimport type { KeyringAccount } from '@metamask/keyring-api';\n\nimport type { Logger } from './logger';\nimport { projectLogger as log, createModuleLogger } from './logger';\nimport type { ServiceState, StateKeys } from './MultichainAccountService';\nimport type { MultichainAccountWallet } from './MultichainAccountWallet';\nimport type { Bip44AccountProvider } from './providers';\nimport type { MultichainAccountServiceMessenger } from './types';\n\nexport type GroupState =\n ServiceState[StateKeys['entropySource']][StateKeys['groupIndex']];\n\n/**\n * A multichain account group that holds multiple accounts.\n */\nexport class MultichainAccountGroup<\n Account extends Bip44Account<KeyringAccount>,\n> implements MultichainAccountGroupDefinition<Account> {\n readonly #id: MultichainAccountGroupId;\n\n readonly #wallet: MultichainAccountWallet<Account>;\n\n readonly #groupIndex: number;\n\n readonly #providers: Bip44AccountProvider<Account>[];\n\n readonly #providerToAccounts: Map<\n Bip44AccountProvider<Account>,\n Account['id'][]\n >;\n\n readonly #accountToProvider: Map<\n Account['id'],\n Bip44AccountProvider<Account>\n >;\n\n readonly #messenger: MultichainAccountServiceMessenger;\n\n readonly #log: Logger;\n\n #initialized = false;\n\n constructor({\n groupIndex,\n wallet,\n providers,\n messenger,\n }: {\n groupIndex: number;\n wallet: MultichainAccountWallet<Account>;\n providers: Bip44AccountProvider<Account>[];\n messenger: MultichainAccountServiceMessenger;\n }) {\n this.#id = toMultichainAccountGroupId(wallet.id, groupIndex);\n this.#groupIndex = groupIndex;\n this.#wallet = wallet;\n this.#providers = providers;\n this.#messenger = messenger;\n this.#providerToAccounts = new Map();\n this.#accountToProvider = new Map();\n\n this.#log = createModuleLogger(log, `[${this.#id}]`);\n }\n\n /**\n * Clear the account to provider state for a given provider.\n *\n * @param provider - The provider to clear the account to provider state for.\n */\n #clearAccountToProviderState(provider: Bip44AccountProvider<Account>): void {\n this.#accountToProvider.forEach((accountProvider, id) => {\n if (accountProvider === provider) {\n this.#accountToProvider.delete(id);\n }\n });\n }\n\n /**\n * Update the internal representation of accounts with the given group state.\n *\n * @param groupState - The group state.\n */\n #setState(groupState: GroupState): void {\n for (const provider of this.#providers) {\n const accountIds = groupState[provider.getName()];\n\n if (accountIds) {\n this.#clearAccountToProviderState(provider);\n this.#providerToAccounts.set(provider, accountIds);\n\n for (const accountId of accountIds) {\n this.#accountToProvider.set(accountId, provider);\n }\n }\n }\n }\n\n /**\n * Initialize the multichain account group and construct the internal representation of accounts.\n *\n * @param groupState - The group state.\n */\n init(groupState: GroupState): void {\n this.#log('Initializing group state...');\n this.#setState(groupState);\n this.#log('Finished initializing group state...');\n\n this.#initialized = true;\n }\n\n /**\n * Update the group state.\n *\n * @param groupState - The group state.\n */\n update(groupState: GroupState): void {\n this.#log('Updating group state...');\n this.#setState(groupState);\n this.#log('Finished updating group state...');\n\n if (this.#initialized) {\n this.#messenger.publish(\n 'MultichainAccountService:multichainAccountGroupUpdated',\n this,\n );\n }\n }\n\n /**\n * Gets the multichain account group ID.\n *\n * @returns The multichain account group ID.\n */\n get id(): MultichainAccountGroupId {\n return this.#id;\n }\n\n /**\n * Gets the multichain account group type.\n *\n * @returns The multichain account type.\n */\n get type(): AccountGroupType.MultichainAccount {\n return AccountGroupType.MultichainAccount;\n }\n\n /**\n * Gets the multichain account's wallet reference (parent).\n *\n * @returns The multichain account's wallet.\n */\n get wallet(): MultichainAccountWallet<Account> {\n return this.#wallet;\n }\n\n /**\n * Gets the multichain account group index.\n *\n * @returns The multichain account group index.\n */\n get groupIndex(): number {\n return this.#groupIndex;\n }\n\n /**\n * Checks if there's any underlying accounts for this multichain accounts.\n *\n * @returns True if there's any underlying accounts, false otherwise.\n */\n hasAccounts(): boolean {\n // If there's anything in the reverse-map, it means we have some accounts.\n return this.#accountToProvider.size > 0;\n }\n\n /**\n * Gets the accounts for this multichain account.\n *\n * @returns The accounts.\n */\n getAccounts(): Account[] {\n const allAccounts: Account[] = [];\n\n for (const [provider, accounts] of this.#providerToAccounts.entries()) {\n for (const id of accounts) {\n const account = provider.getAccount(id);\n\n if (account) {\n // If for some reason we cannot get this account from the provider, it\n // might means it has been deleted or something, so we just filter it\n // out.\n allAccounts.push(account);\n }\n }\n }\n\n return allAccounts;\n }\n\n /**\n * Gets the account IDs for this multichain account.\n *\n * @returns The account IDs.\n */\n getAccountIds(): Account['id'][] {\n return [...this.#accountToProvider.keys()];\n }\n\n /**\n * Gets the account for a given account ID.\n *\n * @param id - Account ID.\n * @returns The account or undefined if not found.\n */\n getAccount(id: Account['id']): Account | undefined {\n const provider = this.#accountToProvider.get(id);\n\n // If there's nothing in the map, it means we tried to get an account\n // that does not belong to this multichain account.\n if (!provider) {\n return undefined;\n }\n\n return provider.getAccount(id);\n }\n\n /**\n * Query an account matching the selector.\n *\n * @param selector - Query selector.\n * @returns The account matching the selector or undefined if not matching.\n * @throws If multiple accounts match the selector.\n */\n get(selector: AccountSelector<Account>): Account | undefined {\n return selectOne(this.getAccounts(), selector);\n }\n\n /**\n * Query accounts matching the selector.\n *\n * @param selector - Query selector.\n * @returns The accounts matching the selector.\n */\n select(selector: AccountSelector<Account>): Account[] {\n return select(this.getAccounts(), selector);\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"MultichainAccountGroup.d.cts","sourceRoot":"","sources":["../src/MultichainAccountGroup.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAqB,8BAA8B;AAE5E,OAAO,KAAK,EACV,wBAAwB,EACxB,sBAAsB,IAAI,gCAAgC,EAC3D,8BAA8B;AAC/B,OAAO,KAAK,EAAE,YAAY,EAAE,8BAA8B;AAC1D,OAAO,KAAK,EAAE,eAAe,EAAE,8BAA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ourcesContent":["import { AccountGroupType, select, selectOne } from '@metamask/account-api';\nimport { toMultichainAccountGroupId } from '@metamask/account-api';\nimport type {\n MultichainAccountGroupId,\n MultichainAccountGroup as MultichainAccountGroupDefinition,\n} from '@metamask/account-api';\nimport type { Bip44Account } from '@metamask/account-api';\nimport type { AccountSelector } from '@metamask/account-api';\nimport type { KeyringAccount } from '@metamask/keyring-api';\n\nimport type { Logger } from './logger';\nimport { projectLogger as log, createModuleLogger } from './logger';\nimport type { ServiceState, StateKeys } from './MultichainAccountService';\nimport type { MultichainAccountWallet } from './MultichainAccountWallet';\nimport type { Bip44AccountProvider } from './providers';\nimport type { MultichainAccountServiceMessenger } from './types';\n\nexport type GroupState =\n ServiceState[StateKeys['entropySource']][StateKeys['groupIndex']];\n\n/**\n * A multichain account group that holds multiple accounts.\n */\nexport class MultichainAccountGroup<\n Account extends Bip44Account<KeyringAccount>,\n> implements MultichainAccountGroupDefinition<Account>\n{\n readonly #id: MultichainAccountGroupId;\n\n readonly #wallet: MultichainAccountWallet<Account>;\n\n readonly #groupIndex: number;\n\n readonly #providers: Bip44AccountProvider<Account>[];\n\n readonly #providerToAccounts: Map<\n Bip44AccountProvider<Account>,\n Account['id'][]\n >;\n\n readonly #accountToProvider: Map<\n Account['id'],\n Bip44AccountProvider<Account>\n >;\n\n readonly #messenger: MultichainAccountServiceMessenger;\n\n readonly #log: Logger;\n\n #initialized = false;\n\n constructor({\n groupIndex,\n wallet,\n providers,\n messenger,\n }: {\n groupIndex: number;\n wallet: MultichainAccountWallet<Account>;\n providers: Bip44AccountProvider<Account>[];\n messenger: MultichainAccountServiceMessenger;\n }) {\n this.#id = toMultichainAccountGroupId(wallet.id, groupIndex);\n this.#groupIndex = groupIndex;\n this.#wallet = wallet;\n this.#providers = providers;\n this.#messenger = messenger;\n this.#providerToAccounts = new Map();\n this.#accountToProvider = new Map();\n\n this.#log = createModuleLogger(log, `[${this.#id}]`);\n }\n\n /**\n * Clear the account to provider state for a given provider.\n *\n * @param provider - The provider to clear the account to provider state for.\n */\n #clearAccountToProviderState(provider: Bip44AccountProvider<Account>): void {\n this.#accountToProvider.forEach((accountProvider, id) => {\n if (accountProvider === provider) {\n this.#accountToProvider.delete(id);\n }\n });\n }\n\n /**\n * Update the internal representation of accounts with the given group state.\n *\n * @param groupState - The group state.\n */\n #setState(groupState: GroupState): void {\n for (const provider of this.#providers) {\n const accountIds = groupState[provider.getName()];\n\n if (accountIds) {\n this.#clearAccountToProviderState(provider);\n this.#providerToAccounts.set(provider, accountIds);\n\n for (const accountId of accountIds) {\n this.#accountToProvider.set(accountId, provider);\n }\n }\n }\n }\n\n /**\n * Initialize the multichain account group and construct the internal representation of accounts.\n *\n * @param groupState - The group state.\n */\n init(groupState: GroupState): void {\n this.#log('Initializing group state...');\n this.#setState(groupState);\n this.#log('Finished initializing group state...');\n\n this.#initialized = true;\n }\n\n /**\n * Update the group state.\n *\n * @param groupState - The group state.\n */\n update(groupState: GroupState): void {\n this.#log('Updating group state...');\n this.#setState(groupState);\n this.#log('Finished updating group state...');\n\n if (this.#initialized) {\n this.#messenger.publish(\n 'MultichainAccountService:multichainAccountGroupUpdated',\n this,\n );\n }\n }\n\n /**\n * Gets the multichain account group ID.\n *\n * @returns The multichain account group ID.\n */\n get id(): MultichainAccountGroupId {\n return this.#id;\n }\n\n /**\n * Gets the multichain account group type.\n *\n * @returns The multichain account type.\n */\n get type(): AccountGroupType.MultichainAccount {\n return AccountGroupType.MultichainAccount;\n }\n\n /**\n * Gets the multichain account's wallet reference (parent).\n *\n * @returns The multichain account's wallet.\n */\n get wallet(): MultichainAccountWallet<Account> {\n return this.#wallet;\n }\n\n /**\n * Gets the multichain account group index.\n *\n * @returns The multichain account group index.\n */\n get groupIndex(): number {\n return this.#groupIndex;\n }\n\n /**\n * Checks if there's any underlying accounts for this multichain accounts.\n *\n * @returns True if there's any underlying accounts, false otherwise.\n */\n hasAccounts(): boolean {\n // If there's anything in the reverse-map, it means we have some accounts.\n return this.#accountToProvider.size > 0;\n }\n\n /**\n * Gets the accounts for this multichain account.\n *\n * @returns The accounts.\n */\n getAccounts(): Account[] {\n const allAccounts: Account[] = [];\n\n for (const [provider, accounts] of this.#providerToAccounts.entries()) {\n for (const id of accounts) {\n const account = provider.getAccount(id);\n\n if (account) {\n // If for some reason we cannot get this account from the provider, it\n // might means it has been deleted or something, so we just filter it\n // out.\n allAccounts.push(account);\n }\n }\n }\n\n return allAccounts;\n }\n\n /**\n * Gets the account IDs for this multichain account.\n *\n * @returns The account IDs.\n */\n getAccountIds(): Account['id'][] {\n return [...this.#accountToProvider.keys()];\n }\n\n /**\n * Gets the account for a given account ID.\n *\n * @param id - Account ID.\n * @returns The account or undefined if not found.\n */\n getAccount(id: Account['id']): Account | undefined {\n const provider = this.#accountToProvider.get(id);\n\n // If there's nothing in the map, it means we tried to get an account\n // that does not belong to this multichain account.\n if (!provider) {\n return undefined;\n }\n\n return provider.getAccount(id);\n }\n\n /**\n * Query an account matching the selector.\n *\n * @param selector - Query selector.\n * @returns The account matching the selector or undefined if not matching.\n * @throws If multiple accounts match the selector.\n */\n get(selector: AccountSelector<Account>): Account | undefined {\n return selectOne(this.getAccounts(), selector);\n }\n\n /**\n * Query accounts matching the selector.\n *\n * @param selector - Query selector.\n * @returns The accounts matching the selector.\n */\n select(selector: AccountSelector<Account>): Account[] {\n return select(this.getAccounts(), selector);\n }\n}\n"]}
1
+ {"version":3,"file":"MultichainAccountGroup.mjs","sourceRoot":"","sources":["../src/MultichainAccountGroup.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,EAAE,SAAS,EAAE,8BAA8B;AAC5E,OAAO,EAAE,0BAA0B,EAAE,8BAA8B;AAUnE,OAAO,EAAE,aAAa,IAAI,GAAG,EAAE,kBAAkB,EAAE,qBAAiB;AASpE;;GAEG;AACH,MAAM,OAAO,sBAAsB;IA2BjC,YAAY,EACV,UAAU,EACV,MAAM,EACN,SAAS,EACT,SAAS,GAMV;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One } from '@metamask/account-api';\nimport { toMultichainAccountGroupId } from '@metamask/account-api';\nimport type {\n MultichainAccountGroupId,\n MultichainAccountGroup as MultichainAccountGroupDefinition,\n} from '@metamask/account-api';\nimport type { Bip44Account } from '@metamask/account-api';\nimport type { AccountSelector } from '@metamask/account-api';\nimport type { KeyringAccount } from '@metamask/keyring-api';\n\nimport type { Logger } from './logger';\nimport { projectLogger as log, createModuleLogger } from './logger';\nimport type { ServiceState, StateKeys } from './MultichainAccountService';\nimport type { MultichainAccountWallet } from './MultichainAccountWallet';\nimport type { Bip44AccountProvider } from './providers';\nimport type { MultichainAccountServiceMessenger } from './types';\n\nexport type GroupState =\n ServiceState[StateKeys['entropySource']][StateKeys['groupIndex']];\n\n/**\n * A multichain account group that holds multiple accounts.\n */\nexport class MultichainAccountGroup<\n Account extends Bip44Account<KeyringAccount>,\n> implements MultichainAccountGroupDefinition<Account> {\n readonly #id: MultichainAccountGroupId;\n\n readonly #wallet: MultichainAccountWallet<Account>;\n\n readonly #groupIndex: number;\n\n readonly #providers: Bip44AccountProvider<Account>[];\n\n readonly #providerToAccounts: Map<\n Bip44AccountProvider<Account>,\n Account['id'][]\n >;\n\n readonly #accountToProvider: Map<\n Account['id'],\n Bip44AccountProvider<Account>\n >;\n\n readonly #messenger: MultichainAccountServiceMessenger;\n\n readonly #log: Logger;\n\n #initialized = false;\n\n constructor({\n groupIndex,\n wallet,\n providers,\n messenger,\n }: {\n groupIndex: number;\n wallet: MultichainAccountWallet<Account>;\n providers: Bip44AccountProvider<Account>[];\n messenger: MultichainAccountServiceMessenger;\n }) {\n this.#id = toMultichainAccountGroupId(wallet.id, groupIndex);\n this.#groupIndex = groupIndex;\n this.#wallet = wallet;\n this.#providers = providers;\n this.#messenger = messenger;\n this.#providerToAccounts = new Map();\n this.#accountToProvider = new Map();\n\n this.#log = createModuleLogger(log, `[${this.#id}]`);\n }\n\n /**\n * Clear the account to provider state for a given provider.\n *\n * @param provider - The provider to clear the account to provider state for.\n */\n #clearAccountToProviderState(provider: Bip44AccountProvider<Account>): void {\n this.#accountToProvider.forEach((accountProvider, id) => {\n if (accountProvider === provider) {\n this.#accountToProvider.delete(id);\n }\n });\n }\n\n /**\n * Update the internal representation of accounts with the given group state.\n *\n * @param groupState - The group state.\n */\n #setState(groupState: GroupState): void {\n for (const provider of this.#providers) {\n const accountIds = groupState[provider.getName()];\n\n if (accountIds) {\n this.#clearAccountToProviderState(provider);\n this.#providerToAccounts.set(provider, accountIds);\n\n for (const accountId of accountIds) {\n this.#accountToProvider.set(accountId, provider);\n }\n }\n }\n }\n\n /**\n * Initialize the multichain account group and construct the internal representation of accounts.\n *\n * @param groupState - The group state.\n */\n init(groupState: GroupState): void {\n this.#log('Initializing group state...');\n this.#setState(groupState);\n this.#log('Finished initializing group state...');\n\n this.#initialized = true;\n }\n\n /**\n * Update the group state.\n *\n * @param groupState - The group state.\n */\n update(groupState: GroupState): void {\n this.#log('Updating group state...');\n this.#setState(groupState);\n this.#log('Finished updating group state...');\n\n if (this.#initialized) {\n this.#messenger.publish(\n 'MultichainAccountService:multichainAccountGroupUpdated',\n this,\n );\n }\n }\n\n /**\n * Gets the multichain account group ID.\n *\n * @returns The multichain account group ID.\n */\n get id(): MultichainAccountGroupId {\n return this.#id;\n }\n\n /**\n * Gets the multichain account group type.\n *\n * @returns The multichain account type.\n */\n get type(): AccountGroupType.MultichainAccount {\n return AccountGroupType.MultichainAccount;\n }\n\n /**\n * Gets the multichain account's wallet reference (parent).\n *\n * @returns The multichain account's wallet.\n */\n get wallet(): MultichainAccountWallet<Account> {\n return this.#wallet;\n }\n\n /**\n * Gets the multichain account group index.\n *\n * @returns The multichain account group index.\n */\n get groupIndex(): number {\n return this.#groupIndex;\n }\n\n /**\n * Checks if there's any underlying accounts for this multichain accounts.\n *\n * @returns True if there's any underlying accounts, false otherwise.\n */\n hasAccounts(): boolean {\n // If there's anything in the reverse-map, it means we have some accounts.\n return this.#accountToProvider.size > 0;\n }\n\n /**\n * Gets the accounts for this multichain account.\n *\n * @returns The accounts.\n */\n getAccounts(): Account[] {\n const allAccounts: Account[] = [];\n\n for (const [provider, accounts] of this.#providerToAccounts.entries()) {\n for (const id of accounts) {\n const account = provider.getAccount(id);\n\n if (account) {\n // If for some reason we cannot get this account from the provider, it\n // might means it has been deleted or something, so we just filter it\n // out.\n allAccounts.push(account);\n }\n }\n }\n\n return allAccounts;\n }\n\n /**\n * Gets the account IDs for this multichain account.\n *\n * @returns The account IDs.\n */\n getAccountIds(): Account['id'][] {\n return [...this.#accountToProvider.keys()];\n }\n\n /**\n * Gets the account for a given account ID.\n *\n * @param id - Account ID.\n * @returns The account or undefined if not found.\n */\n getAccount(id: Account['id']): Account | undefined {\n const provider = this.#accountToProvider.get(id);\n\n // If there's nothing in the map, it means we tried to get an account\n // that does not belong to this multichain account.\n if (!provider) {\n return undefined;\n }\n\n return provider.getAccount(id);\n }\n\n /**\n * Query an account matching the selector.\n *\n * @param selector - Query selector.\n * @returns The account matching the selector or undefined if not matching.\n * @throws If multiple accounts match the selector.\n */\n get(selector: AccountSelector<Account>): Account | undefined {\n return selectOne(this.getAccounts(), selector);\n }\n\n /**\n * Query accounts matching the selector.\n *\n * @param selector - Query selector.\n * @returns The accounts matching the selector.\n */\n select(selector: AccountSelector<Account>): Account[] {\n return select(this.getAccounts(), selector);\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"MultichainAccountService-method-action-types.cjs","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"]}
1
+ {"version":3,"file":"MultichainAccountService-method-action-types.cjs","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 * Initialize the service and constructs the internal reprensentation of\n * multichain accounts and wallets.\n */\nexport type MultichainAccountServiceInitAction = {\n type: `MultichainAccountService:init`;\n handler: MultichainAccountService['init'];\n};\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 | MultichainAccountServiceInitAction\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"]}
@@ -3,6 +3,14 @@
3
3
  * Do not edit manually.
4
4
  */
5
5
  import type { MultichainAccountService } from "./MultichainAccountService.cjs";
6
+ /**
7
+ * Initialize the service and constructs the internal reprensentation of
8
+ * multichain accounts and wallets.
9
+ */
10
+ export type MultichainAccountServiceInitAction = {
11
+ type: `MultichainAccountService:init`;
12
+ handler: MultichainAccountService['init'];
13
+ };
6
14
  /**
7
15
  * Re-synchronize MetaMask accounts and the providers accounts if needed.
8
16
  *
@@ -173,5 +181,5 @@ export type MultichainAccountServiceAlignWalletAction = {
173
181
  /**
174
182
  * Union of all MultichainAccountService action types.
175
183
  */
176
- export type MultichainAccountServiceMethodActions = MultichainAccountServiceResyncAccountsAction | MultichainAccountServiceEnsureCanUseSnapPlatformAction | MultichainAccountServiceGetMultichainAccountWalletAction | MultichainAccountServiceGetMultichainAccountWalletsAction | MultichainAccountServiceCreateMultichainAccountWalletAction | MultichainAccountServiceRemoveMultichainAccountWalletAction | MultichainAccountServiceGetMultichainAccountGroupAction | MultichainAccountServiceGetMultichainAccountGroupsAction | MultichainAccountServiceCreateNextMultichainAccountGroupAction | MultichainAccountServiceCreateMultichainAccountGroupAction | MultichainAccountServiceCreateMultichainAccountGroupsAction | MultichainAccountServiceSetBasicFunctionalityAction | MultichainAccountServiceAlignWalletsAction | MultichainAccountServiceAlignWalletAction;
184
+ export type MultichainAccountServiceMethodActions = MultichainAccountServiceInitAction | MultichainAccountServiceResyncAccountsAction | MultichainAccountServiceEnsureCanUseSnapPlatformAction | MultichainAccountServiceGetMultichainAccountWalletAction | MultichainAccountServiceGetMultichainAccountWalletsAction | MultichainAccountServiceCreateMultichainAccountWalletAction | MultichainAccountServiceRemoveMultichainAccountWalletAction | MultichainAccountServiceGetMultichainAccountGroupAction | MultichainAccountServiceGetMultichainAccountGroupsAction | MultichainAccountServiceCreateNextMultichainAccountGroupAction | MultichainAccountServiceCreateMultichainAccountGroupAction | MultichainAccountServiceCreateMultichainAccountGroupsAction | MultichainAccountServiceSetBasicFunctionalityAction | MultichainAccountServiceAlignWalletsAction | MultichainAccountServiceAlignWalletAction;
177
185
  //# sourceMappingURL=MultichainAccountService-method-action-types.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"MultichainAccountService-method-action-types.d.cts","sourceRoot":"","sources":["../src/MultichainAccountService-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,wBAAwB,EAAE,uCAAmC;AAE3E;;;;;;;;;;;;;;GAcG;AACH,MAAM,MAAM,4CAA4C,GAAG;IACzD,IAAI,EAAE,yCAAyC,CAAC;IAChD,OAAO,EAAE,wBAAwB,CAAC,gBAAgB,CAAC,CAAC;CACrD,CAAC;AAEF,MAAM,MAAM,sDAAsD,GAAG;IACnE,IAAI,EAAE,mDAAmD,CAAC;IAC1D,OAAO,EAAE,wBAAwB,CAAC,0BAA0B,CAAC,CAAC;CAC/D,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,MAAM,wD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wDAAwD,CAAC;IAC/D,OAAO,EAAE,wBAAwB,CAAC,+BAA+B,CAAC,CAAC;CACpE,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,MAAM,mDAAmD,GAAG;IAChE,IAAI,EAAE,gDAAgD,CAAC;IACvD,OAAO,EAAE,wBAAwB,CAAC,uBAAuB,CAAC,CAAC;CAC5D,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,0CAA0C,GAAG;IACvD,IAAI,EAAE,uCAAuC,CAAC;IAC9C,OAAO,EAAE,wBAAwB,CAAC,cAAc,CAAC,CAAC;CACnD,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,yCAAyC,GAAG;IACtD,IAAI,EAAE,sCAAsC,CAAC;IAC7C,OAAO,EAAE,wBAAwB,CAAC,aAAa,CAAC,CAAC;CAClD,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,qCAAqC,GAC7C,4CAA4C,GAC5C,sDAAsD,GACtD,wDAAwD,GACxD,yDAAyD,GACzD,2DAA2D,GAC3D,2DAA2D,GAC3D,uDAAuD,GACvD,wDAAwD,GACxD,8DAA8D,GAC9D,0DAA0D,GAC1D,2DAA2D,GAC3D,mDAAmD,GACnD,0CAA0C,GAC1C,yCAAyC,CAAC"}
1
+ {"version":3,"file":"MultichainAccountService-method-action-types.d.cts","sourceRoot":"","sources":["../src/MultichainAccountService-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,wBAAwB,EAAE,uCAAmC;AAE3E;;;GAGG;AACH,MAAM,MAAM,kCAAkC,GAAG;IAC/C,IAAI,EAAE,+BAA+B,CAAC;IACtC,OAAO,EAAE,wBAAwB,CAAC,MAAM,CAAC,CAAC;CAC3C,CAAC;AAEF;;;;;;;;;;;;;;GAcG;AACH,MAAM,MAAM,4CAA4C,GAAG;IACzD,IAAI,EAAE,yCAAyC,CAAC;IAChD,OAAO,EAAE,wBAAwB,CAAC,gBAAgB,CAAC,CAAC;CACrD,CAAC;A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;IACvE,IAAI,EAAE,uDAAuD,CAAC;IAC9D,OAAO,EAAE,wBAAwB,CAAC,8BAA8B,CAAC,CAAC;CACnE,CAAC;AAEF;;;;;;;;GAQG;AACH,MAAM,MAAM,2DAA2D,GAAG;IACxE,IAAI,EAAE,wDAAwD,CAAC;IAC/D,OAAO,EAAE,wBAAwB,CAAC,+BAA+B,CAAC,CAAC;CACpE,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,MAAM,mDAAmD,GAAG;IAChE,IAAI,EAAE,gDAAgD,CAAC;IACvD,OAAO,EAAE,wBAAwB,CAAC,uBAAuB,CAAC,CAAC;CAC5D,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,0CAA0C,GAAG;IACvD,IAAI,EAAE,uCAAuC,CAAC;IAC9C,OAAO,EAAE,wBAAwB,CAAC,cAAc,CAAC,CAAC;CACnD,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,yCAAyC,GAAG;IACtD,IAAI,EAAE,sCAAsC,CAAC;IAC7C,OAAO,EAAE,wBAAwB,CAAC,aAAa,CAAC,CAAC;CAClD,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,qCAAqC,GAC7C,kCAAkC,GAClC,4CAA4C,GAC5C,sDAAsD,GACtD,wDAAwD,GACxD,yDAAyD,GACzD,2DAA2D,GAC3D,2DAA2D,GAC3D,uDAAuD,GACvD,wDAAwD,GACxD,8DAA8D,GAC9D,0DAA0D,GAC1D,2DAA2D,GAC3D,mDAAmD,GACnD,0CAA0C,GAC1C,yCAAyC,CAAC"}
@@ -3,6 +3,14 @@
3
3
  * Do not edit manually.
4
4
  */
5
5
  import type { MultichainAccountService } from "./MultichainAccountService.mjs";
6
+ /**
7
+ * Initialize the service and constructs the internal reprensentation of
8
+ * multichain accounts and wallets.
9
+ */
10
+ export type MultichainAccountServiceInitAction = {
11
+ type: `MultichainAccountService:init`;
12
+ handler: MultichainAccountService['init'];
13
+ };
6
14
  /**
7
15
  * Re-synchronize MetaMask accounts and the providers accounts if needed.
8
16
  *
@@ -173,5 +181,5 @@ export type MultichainAccountServiceAlignWalletAction = {
173
181
  /**
174
182
  * Union of all MultichainAccountService action types.
175
183
  */
176
- export type MultichainAccountServiceMethodActions = MultichainAccountServiceResyncAccountsAction | MultichainAccountServiceEnsureCanUseSnapPlatformAction | MultichainAccountServiceGetMultichainAccountWalletAction | MultichainAccountServiceGetMultichainAccountWalletsAction | MultichainAccountServiceCreateMultichainAccountWalletAction | MultichainAccountServiceRemoveMultichainAccountWalletAction | MultichainAccountServiceGetMultichainAccountGroupAction | MultichainAccountServiceGetMultichainAccountGroupsAction | MultichainAccountServiceCreateNextMultichainAccountGroupAction | MultichainAccountServiceCreateMultichainAccountGroupAction | MultichainAccountServiceCreateMultichainAccountGroupsAction | MultichainAccountServiceSetBasicFunctionalityAction | MultichainAccountServiceAlignWalletsAction | MultichainAccountServiceAlignWalletAction;
184
+ export type MultichainAccountServiceMethodActions = MultichainAccountServiceInitAction | MultichainAccountServiceResyncAccountsAction | MultichainAccountServiceEnsureCanUseSnapPlatformAction | MultichainAccountServiceGetMultichainAccountWalletAction | MultichainAccountServiceGetMultichainAccountWalletsAction | MultichainAccountServiceCreateMultichainAccountWalletAction | MultichainAccountServiceRemoveMultichainAccountWalletAction | MultichainAccountServiceGetMultichainAccountGroupAction | MultichainAccountServiceGetMultichainAccountGroupsAction | MultichainAccountServiceCreateNextMultichainAccountGroupAction | MultichainAccountServiceCreateMultichainAccountGroupAction | MultichainAccountServiceCreateMultichainAccountGroupsAction | MultichainAccountServiceSetBasicFunctionalityAction | MultichainAccountServiceAlignWalletsAction | MultichainAccountServiceAlignWalletAction;
177
185
  //# sourceMappingURL=MultichainAccountService-method-action-types.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"MultichainAccountService-method-action-types.d.mts","sourceRoot":"","sources":["../src/MultichainAccountService-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,wBAAwB,EAAE,uCAAmC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AA8D,GAAG;IAC3E,IAAI,EAAE,2DAA2D,CAAC;IAClE,OAAO,EAAE,wBAAwB,CAAC,kCAAkC,CAAC,CAAC;CACvE,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,MAAM,0DAA0D,GAAG;IACvE,IAAI,EAAE,uDAAuD,CAAC;IAC9D,OAAO,EAAE,wBAAwB,CAAC,8BAA8B,CAAC,CAAC;CACnE,CAAC;AAEF;;;;;;;;GAQG;AACH,MAAM,MAAM,2DAA2D,GAAG;IACxE,IAAI,EAAE,wDAAwD,CAAC;IAC/D,OAAO,EAAE,wBAAwB,CAAC,+BAA+B,CAAC,CAAC;CACpE,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,MAAM,mDAAmD,GAAG;IAChE,IAAI,EAAE,gDAAgD,CAAC;IACvD,OAAO,EAAE,wBAAwB,CAAC,uBAAuB,CAAC,CAAC;CAC5D,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,0CAA0C,GAAG;IACvD,IAAI,EAAE,uCAAuC,CAAC;IAC9C,OAAO,EAAE,wBAAwB,CAAC,cAAc,CAAC,CAAC;CACnD,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,yCAAyC,GAAG;IACtD,IAAI,EAAE,sCAAsC,CAAC;IAC7C,OAAO,EAAE,wBAAwB,CAAC,aAAa,CAAC,CAAC;CAClD,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,qCAAqC,GAC7C,4CAA4C,GAC5C,sDAAsD,GACtD,wDAAwD,GACxD,yDAAyD,GACzD,2DAA2D,GAC3D,2DAA2D,GAC3D,uDAAuD,GACvD,wDAAwD,GACxD,8DAA8D,GAC9D,0DAA0D,GAC1D,2DAA2D,GAC3D,mDAAmD,GACnD,0CAA0C,GAC1C,yCAAyC,CAAC"}
1
+ {"version":3,"file":"MultichainAccountService-method-action-types.d.mts","sourceRoot":"","sources":["../src/MultichainAccountService-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,E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GAC3D,mDAAmD,GACnD,0CAA0C,GAC1C,yCAAyC,CAAC"}
@@ -1 +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"]}
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 * Initialize the service and constructs the internal reprensentation of\n * multichain accounts and wallets.\n */\nexport type MultichainAccountServiceInitAction = {\n type: `MultichainAccountService:init`;\n handler: MultichainAccountService['init'];\n};\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 | MultichainAccountServiceInitAction\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"]}
@@ -43,6 +43,7 @@ const MESSENGER_EXPOSED_METHODS = [
43
43
  'resyncAccounts',
44
44
  'removeMultichainAccountWallet',
45
45
  'ensureCanUseSnapPlatform',
46
+ 'init',
46
47
  ];
47
48
  /**
48
49
  * Service to expose multichain accounts capabilities.