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