@metamask/multichain-account-service 6.0.0 → 7.1.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.
- package/CHANGELOG.md +29 -1
- package/dist/MultichainAccountService-method-action-types.cjs +7 -0
- package/dist/MultichainAccountService-method-action-types.cjs.map +1 -0
- package/dist/MultichainAccountService-method-action-types.d.cts +164 -0
- package/dist/MultichainAccountService-method-action-types.d.cts.map +1 -0
- package/dist/MultichainAccountService-method-action-types.d.mts +164 -0
- package/dist/MultichainAccountService-method-action-types.d.mts.map +1 -0
- package/dist/MultichainAccountService-method-action-types.mjs +6 -0
- package/dist/MultichainAccountService-method-action-types.mjs.map +1 -0
- package/dist/MultichainAccountService.cjs +22 -15
- package/dist/MultichainAccountService.cjs.map +1 -1
- package/dist/MultichainAccountService.d.cts +7 -1
- package/dist/MultichainAccountService.d.cts.map +1 -1
- package/dist/MultichainAccountService.d.mts +7 -1
- package/dist/MultichainAccountService.d.mts.map +1 -1
- package/dist/MultichainAccountService.mjs +22 -15
- package/dist/MultichainAccountService.mjs.map +1 -1
- package/dist/MultichainAccountWallet.cjs +4 -0
- package/dist/MultichainAccountWallet.cjs.map +1 -1
- package/dist/MultichainAccountWallet.d.cts.map +1 -1
- package/dist/MultichainAccountWallet.d.mts.map +1 -1
- package/dist/MultichainAccountWallet.mjs +4 -0
- package/dist/MultichainAccountWallet.mjs.map +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -1
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +2 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs.map +1 -1
- package/dist/providers/AccountProviderWrapper.cjs +3 -2
- package/dist/providers/AccountProviderWrapper.cjs.map +1 -1
- package/dist/providers/AccountProviderWrapper.d.cts +3 -7
- package/dist/providers/AccountProviderWrapper.d.cts.map +1 -1
- package/dist/providers/AccountProviderWrapper.d.mts +3 -7
- package/dist/providers/AccountProviderWrapper.d.mts.map +1 -1
- package/dist/providers/AccountProviderWrapper.mjs +3 -2
- package/dist/providers/AccountProviderWrapper.mjs.map +1 -1
- package/dist/providers/BaseBip44AccountProvider.cjs +2 -0
- package/dist/providers/BaseBip44AccountProvider.cjs.map +1 -1
- package/dist/providers/BaseBip44AccountProvider.d.cts +19 -5
- package/dist/providers/BaseBip44AccountProvider.d.cts.map +1 -1
- package/dist/providers/BaseBip44AccountProvider.d.mts +19 -5
- package/dist/providers/BaseBip44AccountProvider.d.mts.map +1 -1
- package/dist/providers/BaseBip44AccountProvider.mjs +2 -0
- package/dist/providers/BaseBip44AccountProvider.mjs.map +1 -1
- package/dist/providers/BtcAccountProvider.cjs +11 -1
- package/dist/providers/BtcAccountProvider.cjs.map +1 -1
- package/dist/providers/BtcAccountProvider.d.cts +3 -5
- package/dist/providers/BtcAccountProvider.d.cts.map +1 -1
- package/dist/providers/BtcAccountProvider.d.mts +3 -5
- package/dist/providers/BtcAccountProvider.d.mts.map +1 -1
- package/dist/providers/BtcAccountProvider.mjs +12 -2
- package/dist/providers/BtcAccountProvider.mjs.map +1 -1
- package/dist/providers/EvmAccountProvider.cjs +12 -4
- package/dist/providers/EvmAccountProvider.cjs.map +1 -1
- package/dist/providers/EvmAccountProvider.d.cts +4 -8
- package/dist/providers/EvmAccountProvider.d.cts.map +1 -1
- package/dist/providers/EvmAccountProvider.d.mts +4 -8
- package/dist/providers/EvmAccountProvider.d.mts.map +1 -1
- package/dist/providers/EvmAccountProvider.mjs +13 -5
- package/dist/providers/EvmAccountProvider.mjs.map +1 -1
- package/dist/providers/SnapAccountProvider.cjs +3 -1
- package/dist/providers/SnapAccountProvider.cjs.map +1 -1
- package/dist/providers/SnapAccountProvider.d.cts +2 -5
- package/dist/providers/SnapAccountProvider.d.cts.map +1 -1
- package/dist/providers/SnapAccountProvider.d.mts +2 -5
- package/dist/providers/SnapAccountProvider.d.mts.map +1 -1
- package/dist/providers/SnapAccountProvider.mjs +3 -1
- package/dist/providers/SnapAccountProvider.mjs.map +1 -1
- package/dist/providers/SolAccountProvider.cjs +13 -4
- package/dist/providers/SolAccountProvider.cjs.map +1 -1
- package/dist/providers/SolAccountProvider.d.cts +3 -5
- package/dist/providers/SolAccountProvider.d.cts.map +1 -1
- package/dist/providers/SolAccountProvider.d.mts +3 -5
- package/dist/providers/SolAccountProvider.d.mts.map +1 -1
- package/dist/providers/SolAccountProvider.mjs +12 -3
- package/dist/providers/SolAccountProvider.mjs.map +1 -1
- package/dist/providers/TrxAccountProvider.cjs +12 -2
- package/dist/providers/TrxAccountProvider.cjs.map +1 -1
- package/dist/providers/TrxAccountProvider.d.cts +3 -5
- package/dist/providers/TrxAccountProvider.d.cts.map +1 -1
- package/dist/providers/TrxAccountProvider.d.mts +3 -5
- package/dist/providers/TrxAccountProvider.d.mts.map +1 -1
- package/dist/providers/TrxAccountProvider.mjs +13 -3
- package/dist/providers/TrxAccountProvider.mjs.map +1 -1
- package/dist/snaps/SnapPlatformWatcher.cjs +8 -7
- package/dist/snaps/SnapPlatformWatcher.cjs.map +1 -1
- package/dist/snaps/SnapPlatformWatcher.d.cts +7 -1
- package/dist/snaps/SnapPlatformWatcher.d.cts.map +1 -1
- package/dist/snaps/SnapPlatformWatcher.d.mts +7 -1
- package/dist/snaps/SnapPlatformWatcher.d.mts.map +1 -1
- package/dist/snaps/SnapPlatformWatcher.mjs +8 -7
- package/dist/snaps/SnapPlatformWatcher.mjs.map +1 -1
- package/dist/tests/accounts.d.cts +21 -7
- package/dist/tests/accounts.d.cts.map +1 -1
- package/dist/tests/accounts.d.mts +21 -7
- package/dist/tests/accounts.d.mts.map +1 -1
- package/dist/tests/providers.cjs +12 -0
- package/dist/tests/providers.cjs.map +1 -1
- package/dist/tests/providers.d.cts +2 -1
- package/dist/tests/providers.d.cts.map +1 -1
- package/dist/tests/providers.d.mts +2 -1
- package/dist/tests/providers.d.mts.map +1 -1
- package/dist/tests/providers.mjs +12 -0
- package/dist/tests/providers.mjs.map +1 -1
- package/dist/types.cjs.map +1 -1
- package/dist/types.d.cts +3 -54
- package/dist/types.d.cts.map +1 -1
- package/dist/types.d.mts +3 -54
- package/dist/types.d.mts.map +1 -1
- package/dist/types.mjs.map +1 -1
- package/package.json +14 -13
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,32 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [7.1.0]
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- Add new optional `ensureOnboardingComplete` callback ([#8124](https://github.com/MetaMask/core/pull/8124))
|
|
15
|
+
- This allows the service to wait for the user to re-onboard after a wallet reset.
|
|
16
|
+
|
|
17
|
+
### Changed
|
|
18
|
+
|
|
19
|
+
- 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))
|
|
20
|
+
|
|
21
|
+
## [7.0.0]
|
|
22
|
+
|
|
23
|
+
### Changed
|
|
24
|
+
|
|
25
|
+
- **BREAKING:** Bump peer dependency `@metamask/account-api` from `^0.12.0` to `^1.0.0` ([#7857](https://github.com/MetaMask/core/pull/7857))
|
|
26
|
+
- **BREAKING:** Bump `@metamask/eth-snap-keyring` from `^18.0.0` to `^19.0.0` ([#7857](https://github.com/MetaMask/core/pull/7857))
|
|
27
|
+
- Required to invoke `createAccounts` on any account management Snaps.
|
|
28
|
+
- **BREAKING:** Use new `AccountProvider.createAccounts` method with `CreateAccountOptions` ([#7857](https://github.com/MetaMask/core/pull/7857))
|
|
29
|
+
- All account providers now accept `CreateAccountOptions` with `type` field.
|
|
30
|
+
- Added `capabilities` property to all account providers defining supported account creation types.
|
|
31
|
+
- Bump `@metamask/accounts-controller` from `^35.0.2` to `^36.0.0` ([#7897](https://github.com/MetaMask/core/pull/7897))
|
|
32
|
+
- Bump `@metamask/keyring-api` from `^21.0.0` to `^21.5.0` ([#7857](https://github.com/MetaMask/core/pull/7857))
|
|
33
|
+
- Bump `@metamask/keyring-internal-api` from `^9.0.0` to `^10.0.0` ([#7857](https://github.com/MetaMask/core/pull/7857))
|
|
34
|
+
- Bump `@metamask/keyring-snap-client` from `^8.0.0` to `^8.2.0` ([#7857](https://github.com/MetaMask/core/pull/7857))
|
|
35
|
+
|
|
10
36
|
## [6.0.0]
|
|
11
37
|
|
|
12
38
|
### Changed
|
|
@@ -364,7 +390,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
364
390
|
- Add `MultichainAccountService` ([#6141](https://github.com/MetaMask/core/pull/6141)), ([#6165](https://github.com/MetaMask/core/pull/6165))
|
|
365
391
|
- This service manages multichain accounts/wallets.
|
|
366
392
|
|
|
367
|
-
[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/multichain-account-service@
|
|
393
|
+
[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/multichain-account-service@7.1.0...HEAD
|
|
394
|
+
[7.1.0]: https://github.com/MetaMask/core/compare/@metamask/multichain-account-service@7.0.0...@metamask/multichain-account-service@7.1.0
|
|
395
|
+
[7.0.0]: https://github.com/MetaMask/core/compare/@metamask/multichain-account-service@6.0.0...@metamask/multichain-account-service@7.0.0
|
|
368
396
|
[6.0.0]: https://github.com/MetaMask/core/compare/@metamask/multichain-account-service@5.1.0...@metamask/multichain-account-service@6.0.0
|
|
369
397
|
[5.1.0]: https://github.com/MetaMask/core/compare/@metamask/multichain-account-service@5.0.0...@metamask/multichain-account-service@5.1.0
|
|
370
398
|
[5.0.0]: https://github.com/MetaMask/core/compare/@metamask/multichain-account-service@4.1.0...@metamask/multichain-account-service@5.0.0
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* This file is auto generated by `scripts/generate-method-action-types.ts`.
|
|
4
|
+
* Do not edit manually.
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
//# sourceMappingURL=MultichainAccountService-method-action-types.cjs.map
|
|
@@ -0,0 +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 by `scripts/generate-method-action-types.ts`.\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 * 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 | MultichainAccountServiceSetBasicFunctionalityAction\n | MultichainAccountServiceAlignWalletsAction\n | MultichainAccountServiceAlignWalletAction;\n"]}
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is auto generated by `scripts/generate-method-action-types.ts`.
|
|
3
|
+
* Do not edit manually.
|
|
4
|
+
*/
|
|
5
|
+
import type { MultichainAccountService } from "./MultichainAccountService.cjs";
|
|
6
|
+
/**
|
|
7
|
+
* Re-synchronize MetaMask accounts and the providers accounts if needed.
|
|
8
|
+
*
|
|
9
|
+
* NOTE: This is mostly required if one of the providers (keyrings or Snaps)
|
|
10
|
+
* have different sets of accounts. This method would ensure that both are
|
|
11
|
+
* in-sync and use the same accounts (and same IDs).
|
|
12
|
+
*
|
|
13
|
+
* READ THIS CAREFULLY (State inconsistency bugs/de-sync)
|
|
14
|
+
* We've seen some problems were keyring accounts on some Snaps were not synchronized
|
|
15
|
+
* with the accounts on MM side. This causes problems where we cannot interact with
|
|
16
|
+
* those accounts because the Snap does know about them.
|
|
17
|
+
* To "workaround" this de-sync problem for now, we make sure that both parties are
|
|
18
|
+
* in-sync when the service boots up.
|
|
19
|
+
* ----------------------------------------------------------------------------------
|
|
20
|
+
*/
|
|
21
|
+
export type MultichainAccountServiceResyncAccountsAction = {
|
|
22
|
+
type: `MultichainAccountService:resyncAccounts`;
|
|
23
|
+
handler: MultichainAccountService['resyncAccounts'];
|
|
24
|
+
};
|
|
25
|
+
export type MultichainAccountServiceEnsureCanUseSnapPlatformAction = {
|
|
26
|
+
type: `MultichainAccountService:ensureCanUseSnapPlatform`;
|
|
27
|
+
handler: MultichainAccountService['ensureCanUseSnapPlatform'];
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Gets a reference to the multichain account wallet matching this entropy source.
|
|
31
|
+
*
|
|
32
|
+
* @param options - Options.
|
|
33
|
+
* @param options.entropySource - The entropy source of the multichain account.
|
|
34
|
+
* @throws If none multichain account match this entropy.
|
|
35
|
+
* @returns A reference to the multichain account wallet.
|
|
36
|
+
*/
|
|
37
|
+
export type MultichainAccountServiceGetMultichainAccountWalletAction = {
|
|
38
|
+
type: `MultichainAccountService:getMultichainAccountWallet`;
|
|
39
|
+
handler: MultichainAccountService['getMultichainAccountWallet'];
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* Gets an array of all multichain account wallets.
|
|
43
|
+
*
|
|
44
|
+
* @returns An array of all multichain account wallets.
|
|
45
|
+
*/
|
|
46
|
+
export type MultichainAccountServiceGetMultichainAccountWalletsAction = {
|
|
47
|
+
type: `MultichainAccountService:getMultichainAccountWallets`;
|
|
48
|
+
handler: MultichainAccountService['getMultichainAccountWallets'];
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* Creates a new multichain account wallet by either importing an existing mnemonic,
|
|
52
|
+
* creating a new vault and keychain, or restoring a vault and keyring.
|
|
53
|
+
*
|
|
54
|
+
* NOTE: This method should only be called in client code where a mutex lock is acquired.
|
|
55
|
+
* `discoverAccounts` should be called after this method to discover and create accounts.
|
|
56
|
+
*
|
|
57
|
+
* @param params - The parameters to use to create the new wallet.
|
|
58
|
+
* @param params.mnemonic - The mnemonic to use to create the new wallet.
|
|
59
|
+
* @param params.password - The password to encrypt the vault with.
|
|
60
|
+
* @param params.type - The flow type to use to create the new wallet.
|
|
61
|
+
* @throws If the mnemonic has already been imported.
|
|
62
|
+
* @returns The new multichain account wallet.
|
|
63
|
+
*/
|
|
64
|
+
export type MultichainAccountServiceCreateMultichainAccountWalletAction = {
|
|
65
|
+
type: `MultichainAccountService:createMultichainAccountWallet`;
|
|
66
|
+
handler: MultichainAccountService['createMultichainAccountWallet'];
|
|
67
|
+
};
|
|
68
|
+
/**
|
|
69
|
+
* Removes a multichain account wallet.
|
|
70
|
+
*
|
|
71
|
+
* NOTE: This method should only be called in client code as a revert mechanism.
|
|
72
|
+
* At the point that this code is called, discovery shouldn't have been triggered.
|
|
73
|
+
* This is meant to be used in the scenario where a seed phrase backup is not successful.
|
|
74
|
+
*
|
|
75
|
+
* @param entropySource - The entropy source of the multichain account wallet.
|
|
76
|
+
* @param accountAddress - The address of the account to remove.
|
|
77
|
+
* @returns The removed multichain account wallet.
|
|
78
|
+
*/
|
|
79
|
+
export type MultichainAccountServiceRemoveMultichainAccountWalletAction = {
|
|
80
|
+
type: `MultichainAccountService:removeMultichainAccountWallet`;
|
|
81
|
+
handler: MultichainAccountService['removeMultichainAccountWallet'];
|
|
82
|
+
};
|
|
83
|
+
/**
|
|
84
|
+
* Gets a reference to the multichain account group matching this entropy source
|
|
85
|
+
* and a group index.
|
|
86
|
+
*
|
|
87
|
+
* @param options - Options.
|
|
88
|
+
* @param options.entropySource - The entropy source of the multichain account.
|
|
89
|
+
* @param options.groupIndex - The group index of the multichain account.
|
|
90
|
+
* @throws If none multichain account match this entropy source and group index.
|
|
91
|
+
* @returns A reference to the multichain account.
|
|
92
|
+
*/
|
|
93
|
+
export type MultichainAccountServiceGetMultichainAccountGroupAction = {
|
|
94
|
+
type: `MultichainAccountService:getMultichainAccountGroup`;
|
|
95
|
+
handler: MultichainAccountService['getMultichainAccountGroup'];
|
|
96
|
+
};
|
|
97
|
+
/**
|
|
98
|
+
* Gets all multichain account groups for a given entropy source.
|
|
99
|
+
*
|
|
100
|
+
* @param options - Options.
|
|
101
|
+
* @param options.entropySource - The entropy source to query.
|
|
102
|
+
* @throws If no multichain accounts match this entropy source.
|
|
103
|
+
* @returns A list of all multichain accounts.
|
|
104
|
+
*/
|
|
105
|
+
export type MultichainAccountServiceGetMultichainAccountGroupsAction = {
|
|
106
|
+
type: `MultichainAccountService:getMultichainAccountGroups`;
|
|
107
|
+
handler: MultichainAccountService['getMultichainAccountGroups'];
|
|
108
|
+
};
|
|
109
|
+
/**
|
|
110
|
+
* Creates the next multichain account group.
|
|
111
|
+
*
|
|
112
|
+
* @param options - Options.
|
|
113
|
+
* @param options.entropySource - The wallet's entropy source.
|
|
114
|
+
* @returns The next multichain account group.
|
|
115
|
+
*/
|
|
116
|
+
export type MultichainAccountServiceCreateNextMultichainAccountGroupAction = {
|
|
117
|
+
type: `MultichainAccountService:createNextMultichainAccountGroup`;
|
|
118
|
+
handler: MultichainAccountService['createNextMultichainAccountGroup'];
|
|
119
|
+
};
|
|
120
|
+
/**
|
|
121
|
+
* Creates a multichain account group.
|
|
122
|
+
*
|
|
123
|
+
* @param options - Options.
|
|
124
|
+
* @param options.groupIndex - The group index to use.
|
|
125
|
+
* @param options.entropySource - The wallet's entropy source.
|
|
126
|
+
* @returns The multichain account group for this group index.
|
|
127
|
+
*/
|
|
128
|
+
export type MultichainAccountServiceCreateMultichainAccountGroupAction = {
|
|
129
|
+
type: `MultichainAccountService:createMultichainAccountGroup`;
|
|
130
|
+
handler: MultichainAccountService['createMultichainAccountGroup'];
|
|
131
|
+
};
|
|
132
|
+
/**
|
|
133
|
+
* Set basic functionality state and trigger alignment if enabled.
|
|
134
|
+
* When basic functionality is disabled, snap-based providers are disabled.
|
|
135
|
+
* When enabled, all snap providers are enabled and wallet alignment is triggered.
|
|
136
|
+
* EVM providers are never disabled as they're required for basic wallet functionality.
|
|
137
|
+
*
|
|
138
|
+
* @param enabled - Whether basic functionality is enabled.
|
|
139
|
+
*/
|
|
140
|
+
export type MultichainAccountServiceSetBasicFunctionalityAction = {
|
|
141
|
+
type: `MultichainAccountService:setBasicFunctionality`;
|
|
142
|
+
handler: MultichainAccountService['setBasicFunctionality'];
|
|
143
|
+
};
|
|
144
|
+
/**
|
|
145
|
+
* Align all multichain account wallets.
|
|
146
|
+
*/
|
|
147
|
+
export type MultichainAccountServiceAlignWalletsAction = {
|
|
148
|
+
type: `MultichainAccountService:alignWallets`;
|
|
149
|
+
handler: MultichainAccountService['alignWallets'];
|
|
150
|
+
};
|
|
151
|
+
/**
|
|
152
|
+
* Align a specific multichain account wallet.
|
|
153
|
+
*
|
|
154
|
+
* @param entropySource - The entropy source of the multichain account wallet.
|
|
155
|
+
*/
|
|
156
|
+
export type MultichainAccountServiceAlignWalletAction = {
|
|
157
|
+
type: `MultichainAccountService:alignWallet`;
|
|
158
|
+
handler: MultichainAccountService['alignWallet'];
|
|
159
|
+
};
|
|
160
|
+
/**
|
|
161
|
+
* Union of all MultichainAccountService action types.
|
|
162
|
+
*/
|
|
163
|
+
export type MultichainAccountServiceMethodActions = MultichainAccountServiceResyncAccountsAction | MultichainAccountServiceEnsureCanUseSnapPlatformAction | MultichainAccountServiceGetMultichainAccountWalletAction | MultichainAccountServiceGetMultichainAccountWalletsAction | MultichainAccountServiceCreateMultichainAccountWalletAction | MultichainAccountServiceRemoveMultichainAccountWalletAction | MultichainAccountServiceGetMultichainAccountGroupAction | MultichainAccountServiceGetMultichainAccountGroupsAction | MultichainAccountServiceCreateNextMultichainAccountGroupAction | MultichainAccountServiceCreateMultichainAccountGroupAction | MultichainAccountServiceSetBasicFunctionalityAction | MultichainAccountServiceAlignWalletsAction | MultichainAccountServiceAlignWalletAction;
|
|
164
|
+
//# sourceMappingURL=MultichainAccountService-method-action-types.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MultichainAccountService-method-action-types.d.cts","sourceRoot":"","sources":["../src/MultichainAccountService-method-action-types.ts"],"names":[],"mappings":"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,wDAAwD,GAAG;IACrE,IAAI,EAAE,qDAAqD,CAAC;IAC5D,OAAO,EAAE,wBAAwB,CAAC,4BAA4B,CAAC,CAAC;CACjE,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,yDAAyD,GAAG;IACtE,IAAI,EAAE,sDAAsD,CAAC;IAC7D,OAAO,EAAE,wBAAwB,CAAC,6BAA6B,CAAC,CAAC;CAClE,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,2DAA2D,GAAG;IACxE,IAAI,EAAE,wDAAwD,CAAC;IAC/D,OAAO,EAAE,wBAAwB,CAAC,+BAA+B,CAAC,CAAC;CACpE,CAAC;AAEF;;;;;;;;;;GAUG;AACH,MAAM,MAAM,2DAA2D,GAAG;IACxE,IAAI,EAAE,wDAAwD,CAAC;IAC/D,OAAO,EAAE,wBAAwB,CAAC,+BAA+B,CAAC,CAAC;CACpE,CAAC;AAEF;;;;;;;;;GASG;AACH,MAAM,MAAM,uDAAuD,GAAG;IACpE,IAAI,EAAE,oDAAoD,CAAC;IAC3D,OAAO,EAAE,wBAAwB,CAAC,2BAA2B,CAAC,CAAC;CAChE,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,MAAM,wDAAwD,GAAG;IACrE,IAAI,EAAE,qDAAqD,CAAC;IAC5D,OAAO,EAAE,wBAAwB,CAAC,4BAA4B,CAAC,CAAC;CACjE,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,MAAM,8DAA8D,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;;;;;;;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,mDAAmD,GACnD,0CAA0C,GAC1C,yCAAyC,CAAC"}
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is auto generated by `scripts/generate-method-action-types.ts`.
|
|
3
|
+
* Do not edit manually.
|
|
4
|
+
*/
|
|
5
|
+
import type { MultichainAccountService } from "./MultichainAccountService.mjs";
|
|
6
|
+
/**
|
|
7
|
+
* Re-synchronize MetaMask accounts and the providers accounts if needed.
|
|
8
|
+
*
|
|
9
|
+
* NOTE: This is mostly required if one of the providers (keyrings or Snaps)
|
|
10
|
+
* have different sets of accounts. This method would ensure that both are
|
|
11
|
+
* in-sync and use the same accounts (and same IDs).
|
|
12
|
+
*
|
|
13
|
+
* READ THIS CAREFULLY (State inconsistency bugs/de-sync)
|
|
14
|
+
* We've seen some problems were keyring accounts on some Snaps were not synchronized
|
|
15
|
+
* with the accounts on MM side. This causes problems where we cannot interact with
|
|
16
|
+
* those accounts because the Snap does know about them.
|
|
17
|
+
* To "workaround" this de-sync problem for now, we make sure that both parties are
|
|
18
|
+
* in-sync when the service boots up.
|
|
19
|
+
* ----------------------------------------------------------------------------------
|
|
20
|
+
*/
|
|
21
|
+
export type MultichainAccountServiceResyncAccountsAction = {
|
|
22
|
+
type: `MultichainAccountService:resyncAccounts`;
|
|
23
|
+
handler: MultichainAccountService['resyncAccounts'];
|
|
24
|
+
};
|
|
25
|
+
export type MultichainAccountServiceEnsureCanUseSnapPlatformAction = {
|
|
26
|
+
type: `MultichainAccountService:ensureCanUseSnapPlatform`;
|
|
27
|
+
handler: MultichainAccountService['ensureCanUseSnapPlatform'];
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Gets a reference to the multichain account wallet matching this entropy source.
|
|
31
|
+
*
|
|
32
|
+
* @param options - Options.
|
|
33
|
+
* @param options.entropySource - The entropy source of the multichain account.
|
|
34
|
+
* @throws If none multichain account match this entropy.
|
|
35
|
+
* @returns A reference to the multichain account wallet.
|
|
36
|
+
*/
|
|
37
|
+
export type MultichainAccountServiceGetMultichainAccountWalletAction = {
|
|
38
|
+
type: `MultichainAccountService:getMultichainAccountWallet`;
|
|
39
|
+
handler: MultichainAccountService['getMultichainAccountWallet'];
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* Gets an array of all multichain account wallets.
|
|
43
|
+
*
|
|
44
|
+
* @returns An array of all multichain account wallets.
|
|
45
|
+
*/
|
|
46
|
+
export type MultichainAccountServiceGetMultichainAccountWalletsAction = {
|
|
47
|
+
type: `MultichainAccountService:getMultichainAccountWallets`;
|
|
48
|
+
handler: MultichainAccountService['getMultichainAccountWallets'];
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* Creates a new multichain account wallet by either importing an existing mnemonic,
|
|
52
|
+
* creating a new vault and keychain, or restoring a vault and keyring.
|
|
53
|
+
*
|
|
54
|
+
* NOTE: This method should only be called in client code where a mutex lock is acquired.
|
|
55
|
+
* `discoverAccounts` should be called after this method to discover and create accounts.
|
|
56
|
+
*
|
|
57
|
+
* @param params - The parameters to use to create the new wallet.
|
|
58
|
+
* @param params.mnemonic - The mnemonic to use to create the new wallet.
|
|
59
|
+
* @param params.password - The password to encrypt the vault with.
|
|
60
|
+
* @param params.type - The flow type to use to create the new wallet.
|
|
61
|
+
* @throws If the mnemonic has already been imported.
|
|
62
|
+
* @returns The new multichain account wallet.
|
|
63
|
+
*/
|
|
64
|
+
export type MultichainAccountServiceCreateMultichainAccountWalletAction = {
|
|
65
|
+
type: `MultichainAccountService:createMultichainAccountWallet`;
|
|
66
|
+
handler: MultichainAccountService['createMultichainAccountWallet'];
|
|
67
|
+
};
|
|
68
|
+
/**
|
|
69
|
+
* Removes a multichain account wallet.
|
|
70
|
+
*
|
|
71
|
+
* NOTE: This method should only be called in client code as a revert mechanism.
|
|
72
|
+
* At the point that this code is called, discovery shouldn't have been triggered.
|
|
73
|
+
* This is meant to be used in the scenario where a seed phrase backup is not successful.
|
|
74
|
+
*
|
|
75
|
+
* @param entropySource - The entropy source of the multichain account wallet.
|
|
76
|
+
* @param accountAddress - The address of the account to remove.
|
|
77
|
+
* @returns The removed multichain account wallet.
|
|
78
|
+
*/
|
|
79
|
+
export type MultichainAccountServiceRemoveMultichainAccountWalletAction = {
|
|
80
|
+
type: `MultichainAccountService:removeMultichainAccountWallet`;
|
|
81
|
+
handler: MultichainAccountService['removeMultichainAccountWallet'];
|
|
82
|
+
};
|
|
83
|
+
/**
|
|
84
|
+
* Gets a reference to the multichain account group matching this entropy source
|
|
85
|
+
* and a group index.
|
|
86
|
+
*
|
|
87
|
+
* @param options - Options.
|
|
88
|
+
* @param options.entropySource - The entropy source of the multichain account.
|
|
89
|
+
* @param options.groupIndex - The group index of the multichain account.
|
|
90
|
+
* @throws If none multichain account match this entropy source and group index.
|
|
91
|
+
* @returns A reference to the multichain account.
|
|
92
|
+
*/
|
|
93
|
+
export type MultichainAccountServiceGetMultichainAccountGroupAction = {
|
|
94
|
+
type: `MultichainAccountService:getMultichainAccountGroup`;
|
|
95
|
+
handler: MultichainAccountService['getMultichainAccountGroup'];
|
|
96
|
+
};
|
|
97
|
+
/**
|
|
98
|
+
* Gets all multichain account groups for a given entropy source.
|
|
99
|
+
*
|
|
100
|
+
* @param options - Options.
|
|
101
|
+
* @param options.entropySource - The entropy source to query.
|
|
102
|
+
* @throws If no multichain accounts match this entropy source.
|
|
103
|
+
* @returns A list of all multichain accounts.
|
|
104
|
+
*/
|
|
105
|
+
export type MultichainAccountServiceGetMultichainAccountGroupsAction = {
|
|
106
|
+
type: `MultichainAccountService:getMultichainAccountGroups`;
|
|
107
|
+
handler: MultichainAccountService['getMultichainAccountGroups'];
|
|
108
|
+
};
|
|
109
|
+
/**
|
|
110
|
+
* Creates the next multichain account group.
|
|
111
|
+
*
|
|
112
|
+
* @param options - Options.
|
|
113
|
+
* @param options.entropySource - The wallet's entropy source.
|
|
114
|
+
* @returns The next multichain account group.
|
|
115
|
+
*/
|
|
116
|
+
export type MultichainAccountServiceCreateNextMultichainAccountGroupAction = {
|
|
117
|
+
type: `MultichainAccountService:createNextMultichainAccountGroup`;
|
|
118
|
+
handler: MultichainAccountService['createNextMultichainAccountGroup'];
|
|
119
|
+
};
|
|
120
|
+
/**
|
|
121
|
+
* Creates a multichain account group.
|
|
122
|
+
*
|
|
123
|
+
* @param options - Options.
|
|
124
|
+
* @param options.groupIndex - The group index to use.
|
|
125
|
+
* @param options.entropySource - The wallet's entropy source.
|
|
126
|
+
* @returns The multichain account group for this group index.
|
|
127
|
+
*/
|
|
128
|
+
export type MultichainAccountServiceCreateMultichainAccountGroupAction = {
|
|
129
|
+
type: `MultichainAccountService:createMultichainAccountGroup`;
|
|
130
|
+
handler: MultichainAccountService['createMultichainAccountGroup'];
|
|
131
|
+
};
|
|
132
|
+
/**
|
|
133
|
+
* Set basic functionality state and trigger alignment if enabled.
|
|
134
|
+
* When basic functionality is disabled, snap-based providers are disabled.
|
|
135
|
+
* When enabled, all snap providers are enabled and wallet alignment is triggered.
|
|
136
|
+
* EVM providers are never disabled as they're required for basic wallet functionality.
|
|
137
|
+
*
|
|
138
|
+
* @param enabled - Whether basic functionality is enabled.
|
|
139
|
+
*/
|
|
140
|
+
export type MultichainAccountServiceSetBasicFunctionalityAction = {
|
|
141
|
+
type: `MultichainAccountService:setBasicFunctionality`;
|
|
142
|
+
handler: MultichainAccountService['setBasicFunctionality'];
|
|
143
|
+
};
|
|
144
|
+
/**
|
|
145
|
+
* Align all multichain account wallets.
|
|
146
|
+
*/
|
|
147
|
+
export type MultichainAccountServiceAlignWalletsAction = {
|
|
148
|
+
type: `MultichainAccountService:alignWallets`;
|
|
149
|
+
handler: MultichainAccountService['alignWallets'];
|
|
150
|
+
};
|
|
151
|
+
/**
|
|
152
|
+
* Align a specific multichain account wallet.
|
|
153
|
+
*
|
|
154
|
+
* @param entropySource - The entropy source of the multichain account wallet.
|
|
155
|
+
*/
|
|
156
|
+
export type MultichainAccountServiceAlignWalletAction = {
|
|
157
|
+
type: `MultichainAccountService:alignWallet`;
|
|
158
|
+
handler: MultichainAccountService['alignWallet'];
|
|
159
|
+
};
|
|
160
|
+
/**
|
|
161
|
+
* Union of all MultichainAccountService action types.
|
|
162
|
+
*/
|
|
163
|
+
export type MultichainAccountServiceMethodActions = MultichainAccountServiceResyncAccountsAction | MultichainAccountServiceEnsureCanUseSnapPlatformAction | MultichainAccountServiceGetMultichainAccountWalletAction | MultichainAccountServiceGetMultichainAccountWalletsAction | MultichainAccountServiceCreateMultichainAccountWalletAction | MultichainAccountServiceRemoveMultichainAccountWalletAction | MultichainAccountServiceGetMultichainAccountGroupAction | MultichainAccountServiceGetMultichainAccountGroupsAction | MultichainAccountServiceCreateNextMultichainAccountGroupAction | MultichainAccountServiceCreateMultichainAccountGroupAction | MultichainAccountServiceSetBasicFunctionalityAction | MultichainAccountServiceAlignWalletsAction | MultichainAccountServiceAlignWalletAction;
|
|
164
|
+
//# sourceMappingURL=MultichainAccountService-method-action-types.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MultichainAccountService-method-action-types.d.mts","sourceRoot":"","sources":["../src/MultichainAccountService-method-action-types.ts"],"names":[],"mappings":"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,wDAAwD,GAAG;IACrE,IAAI,EAAE,qDAAqD,CAAC;IAC5D,OAAO,EAAE,wBAAwB,CAAC,4BAA4B,CAAC,CAAC;CACjE,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,yDAAyD,GAAG;IACtE,IAAI,EAAE,sDAAsD,CAAC;IAC7D,OAAO,EAAE,wBAAwB,CAAC,6BAA6B,CAAC,CAAC;CAClE,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,2DAA2D,GAAG;IACxE,IAAI,EAAE,wDAAwD,CAAC;IAC/D,OAAO,EAAE,wBAAwB,CAAC,+BAA+B,CAAC,CAAC;CACpE,CAAC;AAEF;;;;;;;;;;GAUG;AACH,MAAM,MAAM,2DAA2D,GAAG;IACxE,IAAI,EAAE,wDAAwD,CAAC;IAC/D,OAAO,EAAE,wBAAwB,CAAC,+BAA+B,CAAC,CAAC;CACpE,CAAC;AAEF;;;;;;;;;GASG;AACH,MAAM,MAAM,uDAAuD,GAAG;IACpE,IAAI,EAAE,oDAAoD,CAAC;IAC3D,OAAO,EAAE,wBAAwB,CAAC,2BAA2B,CAAC,CAAC;CAChE,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,MAAM,wDAAwD,GAAG;IACrE,IAAI,EAAE,qDAAqD,CAAC;IAC5D,OAAO,EAAE,wBAAwB,CAAC,4BAA4B,CAAC,CAAC;CACjE,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,MAAM,8DAA8D,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;;;;;;;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,mDAAmD,GACnD,0CAA0C,GAC1C,yCAAyC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MultichainAccountService-method-action-types.mjs","sourceRoot":"","sources":["../src/MultichainAccountService-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/**\n * This file is auto generated by `scripts/generate-method-action-types.ts`.\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 * 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 | MultichainAccountServiceSetBasicFunctionalityAction\n | MultichainAccountServiceAlignWalletsAction\n | MultichainAccountServiceAlignWalletAction;\n"]}
|
|
@@ -27,6 +27,21 @@ const SolAccountProvider_2 = require("./providers/SolAccountProvider.cjs");
|
|
|
27
27
|
const SnapPlatformWatcher_1 = require("./snaps/SnapPlatformWatcher.cjs");
|
|
28
28
|
const utils_2 = require("./utils.cjs");
|
|
29
29
|
exports.serviceName = 'MultichainAccountService';
|
|
30
|
+
const MESSENGER_EXPOSED_METHODS = [
|
|
31
|
+
'getMultichainAccountGroup',
|
|
32
|
+
'getMultichainAccountGroups',
|
|
33
|
+
'getMultichainAccountWallet',
|
|
34
|
+
'getMultichainAccountWallets',
|
|
35
|
+
'createNextMultichainAccountGroup',
|
|
36
|
+
'createMultichainAccountGroup',
|
|
37
|
+
'setBasicFunctionality',
|
|
38
|
+
'alignWallets',
|
|
39
|
+
'alignWallet',
|
|
40
|
+
'createMultichainAccountWallet',
|
|
41
|
+
'resyncAccounts',
|
|
42
|
+
'removeMultichainAccountWallet',
|
|
43
|
+
'ensureCanUseSnapPlatform',
|
|
44
|
+
];
|
|
30
45
|
/**
|
|
31
46
|
* Service to expose multichain accounts capabilities.
|
|
32
47
|
*/
|
|
@@ -40,8 +55,10 @@ class MultichainAccountService {
|
|
|
40
55
|
* @param options.providers - Optional list of account
|
|
41
56
|
* @param options.providerConfigs - Optional provider configs
|
|
42
57
|
* @param options.config - Optional config.
|
|
58
|
+
* @param options.ensureOnboardingComplete - Optional callback to ensure
|
|
59
|
+
* onboarding is completed before using the Snap platform.
|
|
43
60
|
*/
|
|
44
|
-
constructor({ messenger, providers = [], providerConfigs, config, }) {
|
|
61
|
+
constructor({ messenger, providers = [], providerConfigs, config, ensureOnboardingComplete, }) {
|
|
45
62
|
_MultichainAccountService_instances.add(this);
|
|
46
63
|
_MultichainAccountService_messenger.set(this, void 0);
|
|
47
64
|
_MultichainAccountService_watcher.set(this, void 0);
|
|
@@ -63,20 +80,10 @@ class MultichainAccountService {
|
|
|
63
80
|
// Custom account providers that can be provided by the MetaMask client.
|
|
64
81
|
...providers,
|
|
65
82
|
], "f");
|
|
66
|
-
__classPrivateFieldSet(this, _MultichainAccountService_watcher, new SnapPlatformWatcher_1.SnapPlatformWatcher(messenger
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
__classPrivateFieldGet(this, _MultichainAccountService_messenger, "f").
|
|
70
|
-
__classPrivateFieldGet(this, _MultichainAccountService_messenger, "f").registerActionHandler('MultichainAccountService:getMultichainAccountWallets', (...args) => this.getMultichainAccountWallets(...args));
|
|
71
|
-
__classPrivateFieldGet(this, _MultichainAccountService_messenger, "f").registerActionHandler('MultichainAccountService:createNextMultichainAccountGroup', (...args) => this.createNextMultichainAccountGroup(...args));
|
|
72
|
-
__classPrivateFieldGet(this, _MultichainAccountService_messenger, "f").registerActionHandler('MultichainAccountService:createMultichainAccountGroup', (...args) => this.createMultichainAccountGroup(...args));
|
|
73
|
-
__classPrivateFieldGet(this, _MultichainAccountService_messenger, "f").registerActionHandler('MultichainAccountService:setBasicFunctionality', (...args) => this.setBasicFunctionality(...args));
|
|
74
|
-
__classPrivateFieldGet(this, _MultichainAccountService_messenger, "f").registerActionHandler('MultichainAccountService:alignWallets', (...args) => this.alignWallets(...args));
|
|
75
|
-
__classPrivateFieldGet(this, _MultichainAccountService_messenger, "f").registerActionHandler('MultichainAccountService:alignWallet', (...args) => this.alignWallet(...args));
|
|
76
|
-
__classPrivateFieldGet(this, _MultichainAccountService_messenger, "f").registerActionHandler('MultichainAccountService:createMultichainAccountWallet', (...args) => this.createMultichainAccountWallet(...args));
|
|
77
|
-
__classPrivateFieldGet(this, _MultichainAccountService_messenger, "f").registerActionHandler('MultichainAccountService:resyncAccounts', (...args) => this.resyncAccounts(...args));
|
|
78
|
-
__classPrivateFieldGet(this, _MultichainAccountService_messenger, "f").registerActionHandler('MultichainAccountService:removeMultichainAccountWallet', (...args) => this.removeMultichainAccountWallet(...args));
|
|
79
|
-
__classPrivateFieldGet(this, _MultichainAccountService_messenger, "f").registerActionHandler('MultichainAccountService:ensureCanUseSnapPlatform', (...args) => this.ensureCanUseSnapPlatform(...args));
|
|
83
|
+
__classPrivateFieldSet(this, _MultichainAccountService_watcher, new SnapPlatformWatcher_1.SnapPlatformWatcher(messenger, {
|
|
84
|
+
ensureOnboardingComplete,
|
|
85
|
+
}), "f");
|
|
86
|
+
__classPrivateFieldGet(this, _MultichainAccountService_messenger, "f").registerMethodActionHandlers(this, MESSENGER_EXPOSED_METHODS);
|
|
80
87
|
}
|
|
81
88
|
/**
|
|
82
89
|
* Initialize the service and constructs the internal reprensentation of
|