@metamask-previews/account-tree-controller 4.1.1-preview-567bc78af → 4.1.1-preview-0866a6f
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 +17 -0
- package/dist/AccountTreeController-method-action-types.cjs +7 -0
- package/dist/AccountTreeController-method-action-types.cjs.map +1 -0
- package/dist/AccountTreeController-method-action-types.d.cts +167 -0
- package/dist/AccountTreeController-method-action-types.d.cts.map +1 -0
- package/dist/AccountTreeController-method-action-types.d.mts +167 -0
- package/dist/AccountTreeController-method-action-types.d.mts.map +1 -0
- package/dist/AccountTreeController-method-action-types.mjs +6 -0
- package/dist/AccountTreeController-method-action-types.mjs.map +1 -0
- package/dist/AccountTreeController.cjs +29 -32
- package/dist/AccountTreeController.cjs.map +1 -1
- package/dist/AccountTreeController.d.cts +0 -10
- package/dist/AccountTreeController.d.cts.map +1 -1
- package/dist/AccountTreeController.d.mts +0 -10
- package/dist/AccountTreeController.d.mts.map +1 -1
- package/dist/AccountTreeController.mjs +29 -32
- package/dist/AccountTreeController.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/types.cjs.map +1 -1
- package/dist/types.d.cts +4 -35
- package/dist/types.d.cts.map +1 -1
- package/dist/types.d.mts +4 -35
- package/dist/types.d.mts.map +1 -1
- package/dist/types.mjs.map +1 -1
- package/package.json +3 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,10 +7,27 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- Expose missing public `AccountTreeController` methods through its messenger ([#7976](https://github.com/MetaMask/core/pull/7976/))
|
|
13
|
+
- The following actions are now available:
|
|
14
|
+
- `AccountTreeController:getAccountWalletObject`
|
|
15
|
+
- `AccountTreeController:getAccountWalletObjects`
|
|
16
|
+
- `AccountTreeController:getAccountGroupObject`
|
|
17
|
+
- `AccountTreeController:clearState`
|
|
18
|
+
- `AccountTreeController:syncWithUserStorage`
|
|
19
|
+
- `AccountTreeController:syncWithUserStorageAtLeastOnce`
|
|
20
|
+
- Corresponding action types (e.g. `AccountTreeControllerGetAccountWalletObjectAction`) are available as well.
|
|
21
|
+
|
|
10
22
|
### Changed
|
|
11
23
|
|
|
12
24
|
- Bump `@metamask/accounts-controller` from `^36.0.0` to `^36.0.1` ([#7996](https://github.com/MetaMask/core/pull/7996))
|
|
13
25
|
|
|
26
|
+
### Removed
|
|
27
|
+
|
|
28
|
+
- **BREAKING:** Remove `resolveNameConflict` from `AccountTreeController` ([#7976](https://github.com/MetaMask/core/pull/7976))
|
|
29
|
+
- This method was only used internally.
|
|
30
|
+
|
|
14
31
|
## [4.1.1]
|
|
15
32
|
|
|
16
33
|
### Changed
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AccountTreeController-method-action-types.cjs","sourceRoot":"","sources":["../src/AccountTreeController-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 { AccountTreeController } from './AccountTreeController';\n\n/**\n * Gets the account wallet object from its ID.\n *\n * @param walletId - Account wallet ID.\n * @returns The account wallet object if found, undefined otherwise.\n */\nexport type AccountTreeControllerGetAccountWalletObjectAction = {\n type: `AccountTreeController:getAccountWalletObject`;\n handler: AccountTreeController['getAccountWalletObject'];\n};\n\n/**\n * Gets all account wallet objects.\n *\n * @returns All account wallet objects.\n */\nexport type AccountTreeControllerGetAccountWalletObjectsAction = {\n type: `AccountTreeController:getAccountWalletObjects`;\n handler: AccountTreeController['getAccountWalletObjects'];\n};\n\n/**\n * Gets all underlying accounts from the currently selected account\n * group.\n *\n * It also support account selector, which allows to filter specific\n * accounts given some criterias (account type, address, scopes, etc...).\n *\n * @param selector - Optional account selector.\n * @returns Underlying accounts for the currently selected account (filtered\n * by the selector if provided).\n */\nexport type AccountTreeControllerGetAccountsFromSelectedAccountGroupAction = {\n type: `AccountTreeController:getAccountsFromSelectedAccountGroup`;\n handler: AccountTreeController['getAccountsFromSelectedAccountGroup'];\n};\n\n/**\n * Gets the account group object from its ID.\n *\n * @param groupId - Account group ID.\n * @returns The account group object if found, undefined otherwise.\n */\nexport type AccountTreeControllerGetAccountGroupObjectAction = {\n type: `AccountTreeController:getAccountGroupObject`;\n handler: AccountTreeController['getAccountGroupObject'];\n};\n\n/**\n * Gets the account's context which contains its wallet ID, group ID, and sort order.\n *\n * @param accountId - Account ID.\n * @returns The account context if found, undefined otherwise.\n */\nexport type AccountTreeControllerGetAccountContextAction = {\n type: `AccountTreeController:getAccountContext`;\n handler: AccountTreeController['getAccountContext'];\n};\n\n/**\n * Gets the currently selected account group ID.\n *\n * @returns The selected account group ID or empty string if none selected.\n */\nexport type AccountTreeControllerGetSelectedAccountGroupAction = {\n type: `AccountTreeController:getSelectedAccountGroup`;\n handler: AccountTreeController['getSelectedAccountGroup'];\n};\n\n/**\n * Sets the selected account group and updates the AccountsController selectedAccount accordingly.\n *\n * @param groupId - The account group ID to select.\n */\nexport type AccountTreeControllerSetSelectedAccountGroupAction = {\n type: `AccountTreeController:setSelectedAccountGroup`;\n handler: AccountTreeController['setSelectedAccountGroup'];\n};\n\n/**\n * Sets a custom name for an account group.\n *\n * @param groupId - The account group ID.\n * @param name - The custom name to set.\n * @param autoHandleConflict - If true, automatically resolves name conflicts by adding a suffix. If false, throws on conflicts.\n * @throws If the account group ID is not found in the current tree.\n * @throws If the account group name already exists and autoHandleConflict is false.\n */\nexport type AccountTreeControllerSetAccountGroupNameAction = {\n type: `AccountTreeController:setAccountGroupName`;\n handler: AccountTreeController['setAccountGroupName'];\n};\n\n/**\n * Sets a custom name for an account wallet.\n *\n * @param walletId - The account wallet ID.\n * @param name - The custom name to set.\n * @throws If the account wallet ID is not found in the current tree.\n */\nexport type AccountTreeControllerSetAccountWalletNameAction = {\n type: `AccountTreeController:setAccountWalletName`;\n handler: AccountTreeController['setAccountWalletName'];\n};\n\n/**\n * Toggles the pinned state of an account group.\n *\n * @param groupId - The account group ID.\n * @param pinned - Whether the group should be pinned.\n * @throws If the account group ID is not found in the current tree.\n */\nexport type AccountTreeControllerSetAccountGroupPinnedAction = {\n type: `AccountTreeController:setAccountGroupPinned`;\n handler: AccountTreeController['setAccountGroupPinned'];\n};\n\n/**\n * Toggles the hidden state of an account group.\n *\n * @param groupId - The account group ID.\n * @param hidden - Whether the group should be hidden.\n * @throws If the account group ID is not found in the current tree.\n */\nexport type AccountTreeControllerSetAccountGroupHiddenAction = {\n type: `AccountTreeController:setAccountGroupHidden`;\n handler: AccountTreeController['setAccountGroupHidden'];\n};\n\n/**\n * Clears the controller state and resets to default values.\n * Also clears the backup and sync service state.\n */\nexport type AccountTreeControllerClearStateAction = {\n type: `AccountTreeController:clearState`;\n handler: AccountTreeController['clearState'];\n};\n\n/**\n * Bi-directionally syncs the account tree with user storage.\n * This will perform a full sync, including both pulling updates\n * from user storage and pushing local changes to user storage.\n * This also performs legacy account syncing if needed.\n *\n * IMPORTANT:\n * If a full sync is already in progress, it will return the ongoing promise.\n *\n * @returns A promise that resolves when the sync is complete.\n */\nexport type AccountTreeControllerSyncWithUserStorageAction = {\n type: `AccountTreeController:syncWithUserStorage`;\n handler: AccountTreeController['syncWithUserStorage'];\n};\n\n/**\n * Bi-directionally syncs the account tree with user storage.\n * This will ensure at least one full sync is ran, including both pulling updates\n * from user storage and pushing local changes to user storage.\n * This also performs legacy account syncing if needed.\n *\n * IMPORTANT:\n * If the first ever full sync is already in progress, it will return the ongoing promise.\n * If the first ever full sync was previously completed, it will NOT start a new sync, and will resolve immediately.\n *\n * @returns A promise that resolves when the first ever full sync is complete.\n */\nexport type AccountTreeControllerSyncWithUserStorageAtLeastOnceAction = {\n type: `AccountTreeController:syncWithUserStorageAtLeastOnce`;\n handler: AccountTreeController['syncWithUserStorageAtLeastOnce'];\n};\n\n/**\n * Union of all AccountTreeController action types.\n */\nexport type AccountTreeControllerMethodActions =\n | AccountTreeControllerGetAccountWalletObjectAction\n | AccountTreeControllerGetAccountWalletObjectsAction\n | AccountTreeControllerGetAccountsFromSelectedAccountGroupAction\n | AccountTreeControllerGetAccountGroupObjectAction\n | AccountTreeControllerGetAccountContextAction\n | AccountTreeControllerGetSelectedAccountGroupAction\n | AccountTreeControllerSetSelectedAccountGroupAction\n | AccountTreeControllerSetAccountGroupNameAction\n | AccountTreeControllerSetAccountWalletNameAction\n | AccountTreeControllerSetAccountGroupPinnedAction\n | AccountTreeControllerSetAccountGroupHiddenAction\n | AccountTreeControllerClearStateAction\n | AccountTreeControllerSyncWithUserStorageAction\n | AccountTreeControllerSyncWithUserStorageAtLeastOnceAction;\n"]}
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is auto generated by `scripts/generate-method-action-types.ts`.
|
|
3
|
+
* Do not edit manually.
|
|
4
|
+
*/
|
|
5
|
+
import type { AccountTreeController } from "./AccountTreeController.cjs";
|
|
6
|
+
/**
|
|
7
|
+
* Gets the account wallet object from its ID.
|
|
8
|
+
*
|
|
9
|
+
* @param walletId - Account wallet ID.
|
|
10
|
+
* @returns The account wallet object if found, undefined otherwise.
|
|
11
|
+
*/
|
|
12
|
+
export type AccountTreeControllerGetAccountWalletObjectAction = {
|
|
13
|
+
type: `AccountTreeController:getAccountWalletObject`;
|
|
14
|
+
handler: AccountTreeController['getAccountWalletObject'];
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Gets all account wallet objects.
|
|
18
|
+
*
|
|
19
|
+
* @returns All account wallet objects.
|
|
20
|
+
*/
|
|
21
|
+
export type AccountTreeControllerGetAccountWalletObjectsAction = {
|
|
22
|
+
type: `AccountTreeController:getAccountWalletObjects`;
|
|
23
|
+
handler: AccountTreeController['getAccountWalletObjects'];
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Gets all underlying accounts from the currently selected account
|
|
27
|
+
* group.
|
|
28
|
+
*
|
|
29
|
+
* It also support account selector, which allows to filter specific
|
|
30
|
+
* accounts given some criterias (account type, address, scopes, etc...).
|
|
31
|
+
*
|
|
32
|
+
* @param selector - Optional account selector.
|
|
33
|
+
* @returns Underlying accounts for the currently selected account (filtered
|
|
34
|
+
* by the selector if provided).
|
|
35
|
+
*/
|
|
36
|
+
export type AccountTreeControllerGetAccountsFromSelectedAccountGroupAction = {
|
|
37
|
+
type: `AccountTreeController:getAccountsFromSelectedAccountGroup`;
|
|
38
|
+
handler: AccountTreeController['getAccountsFromSelectedAccountGroup'];
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* Gets the account group object from its ID.
|
|
42
|
+
*
|
|
43
|
+
* @param groupId - Account group ID.
|
|
44
|
+
* @returns The account group object if found, undefined otherwise.
|
|
45
|
+
*/
|
|
46
|
+
export type AccountTreeControllerGetAccountGroupObjectAction = {
|
|
47
|
+
type: `AccountTreeController:getAccountGroupObject`;
|
|
48
|
+
handler: AccountTreeController['getAccountGroupObject'];
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* Gets the account's context which contains its wallet ID, group ID, and sort order.
|
|
52
|
+
*
|
|
53
|
+
* @param accountId - Account ID.
|
|
54
|
+
* @returns The account context if found, undefined otherwise.
|
|
55
|
+
*/
|
|
56
|
+
export type AccountTreeControllerGetAccountContextAction = {
|
|
57
|
+
type: `AccountTreeController:getAccountContext`;
|
|
58
|
+
handler: AccountTreeController['getAccountContext'];
|
|
59
|
+
};
|
|
60
|
+
/**
|
|
61
|
+
* Gets the currently selected account group ID.
|
|
62
|
+
*
|
|
63
|
+
* @returns The selected account group ID or empty string if none selected.
|
|
64
|
+
*/
|
|
65
|
+
export type AccountTreeControllerGetSelectedAccountGroupAction = {
|
|
66
|
+
type: `AccountTreeController:getSelectedAccountGroup`;
|
|
67
|
+
handler: AccountTreeController['getSelectedAccountGroup'];
|
|
68
|
+
};
|
|
69
|
+
/**
|
|
70
|
+
* Sets the selected account group and updates the AccountsController selectedAccount accordingly.
|
|
71
|
+
*
|
|
72
|
+
* @param groupId - The account group ID to select.
|
|
73
|
+
*/
|
|
74
|
+
export type AccountTreeControllerSetSelectedAccountGroupAction = {
|
|
75
|
+
type: `AccountTreeController:setSelectedAccountGroup`;
|
|
76
|
+
handler: AccountTreeController['setSelectedAccountGroup'];
|
|
77
|
+
};
|
|
78
|
+
/**
|
|
79
|
+
* Sets a custom name for an account group.
|
|
80
|
+
*
|
|
81
|
+
* @param groupId - The account group ID.
|
|
82
|
+
* @param name - The custom name to set.
|
|
83
|
+
* @param autoHandleConflict - If true, automatically resolves name conflicts by adding a suffix. If false, throws on conflicts.
|
|
84
|
+
* @throws If the account group ID is not found in the current tree.
|
|
85
|
+
* @throws If the account group name already exists and autoHandleConflict is false.
|
|
86
|
+
*/
|
|
87
|
+
export type AccountTreeControllerSetAccountGroupNameAction = {
|
|
88
|
+
type: `AccountTreeController:setAccountGroupName`;
|
|
89
|
+
handler: AccountTreeController['setAccountGroupName'];
|
|
90
|
+
};
|
|
91
|
+
/**
|
|
92
|
+
* Sets a custom name for an account wallet.
|
|
93
|
+
*
|
|
94
|
+
* @param walletId - The account wallet ID.
|
|
95
|
+
* @param name - The custom name to set.
|
|
96
|
+
* @throws If the account wallet ID is not found in the current tree.
|
|
97
|
+
*/
|
|
98
|
+
export type AccountTreeControllerSetAccountWalletNameAction = {
|
|
99
|
+
type: `AccountTreeController:setAccountWalletName`;
|
|
100
|
+
handler: AccountTreeController['setAccountWalletName'];
|
|
101
|
+
};
|
|
102
|
+
/**
|
|
103
|
+
* Toggles the pinned state of an account group.
|
|
104
|
+
*
|
|
105
|
+
* @param groupId - The account group ID.
|
|
106
|
+
* @param pinned - Whether the group should be pinned.
|
|
107
|
+
* @throws If the account group ID is not found in the current tree.
|
|
108
|
+
*/
|
|
109
|
+
export type AccountTreeControllerSetAccountGroupPinnedAction = {
|
|
110
|
+
type: `AccountTreeController:setAccountGroupPinned`;
|
|
111
|
+
handler: AccountTreeController['setAccountGroupPinned'];
|
|
112
|
+
};
|
|
113
|
+
/**
|
|
114
|
+
* Toggles the hidden state of an account group.
|
|
115
|
+
*
|
|
116
|
+
* @param groupId - The account group ID.
|
|
117
|
+
* @param hidden - Whether the group should be hidden.
|
|
118
|
+
* @throws If the account group ID is not found in the current tree.
|
|
119
|
+
*/
|
|
120
|
+
export type AccountTreeControllerSetAccountGroupHiddenAction = {
|
|
121
|
+
type: `AccountTreeController:setAccountGroupHidden`;
|
|
122
|
+
handler: AccountTreeController['setAccountGroupHidden'];
|
|
123
|
+
};
|
|
124
|
+
/**
|
|
125
|
+
* Clears the controller state and resets to default values.
|
|
126
|
+
* Also clears the backup and sync service state.
|
|
127
|
+
*/
|
|
128
|
+
export type AccountTreeControllerClearStateAction = {
|
|
129
|
+
type: `AccountTreeController:clearState`;
|
|
130
|
+
handler: AccountTreeController['clearState'];
|
|
131
|
+
};
|
|
132
|
+
/**
|
|
133
|
+
* Bi-directionally syncs the account tree with user storage.
|
|
134
|
+
* This will perform a full sync, including both pulling updates
|
|
135
|
+
* from user storage and pushing local changes to user storage.
|
|
136
|
+
* This also performs legacy account syncing if needed.
|
|
137
|
+
*
|
|
138
|
+
* IMPORTANT:
|
|
139
|
+
* If a full sync is already in progress, it will return the ongoing promise.
|
|
140
|
+
*
|
|
141
|
+
* @returns A promise that resolves when the sync is complete.
|
|
142
|
+
*/
|
|
143
|
+
export type AccountTreeControllerSyncWithUserStorageAction = {
|
|
144
|
+
type: `AccountTreeController:syncWithUserStorage`;
|
|
145
|
+
handler: AccountTreeController['syncWithUserStorage'];
|
|
146
|
+
};
|
|
147
|
+
/**
|
|
148
|
+
* Bi-directionally syncs the account tree with user storage.
|
|
149
|
+
* This will ensure at least one full sync is ran, including both pulling updates
|
|
150
|
+
* from user storage and pushing local changes to user storage.
|
|
151
|
+
* This also performs legacy account syncing if needed.
|
|
152
|
+
*
|
|
153
|
+
* IMPORTANT:
|
|
154
|
+
* If the first ever full sync is already in progress, it will return the ongoing promise.
|
|
155
|
+
* If the first ever full sync was previously completed, it will NOT start a new sync, and will resolve immediately.
|
|
156
|
+
*
|
|
157
|
+
* @returns A promise that resolves when the first ever full sync is complete.
|
|
158
|
+
*/
|
|
159
|
+
export type AccountTreeControllerSyncWithUserStorageAtLeastOnceAction = {
|
|
160
|
+
type: `AccountTreeController:syncWithUserStorageAtLeastOnce`;
|
|
161
|
+
handler: AccountTreeController['syncWithUserStorageAtLeastOnce'];
|
|
162
|
+
};
|
|
163
|
+
/**
|
|
164
|
+
* Union of all AccountTreeController action types.
|
|
165
|
+
*/
|
|
166
|
+
export type AccountTreeControllerMethodActions = AccountTreeControllerGetAccountWalletObjectAction | AccountTreeControllerGetAccountWalletObjectsAction | AccountTreeControllerGetAccountsFromSelectedAccountGroupAction | AccountTreeControllerGetAccountGroupObjectAction | AccountTreeControllerGetAccountContextAction | AccountTreeControllerGetSelectedAccountGroupAction | AccountTreeControllerSetSelectedAccountGroupAction | AccountTreeControllerSetAccountGroupNameAction | AccountTreeControllerSetAccountWalletNameAction | AccountTreeControllerSetAccountGroupPinnedAction | AccountTreeControllerSetAccountGroupHiddenAction | AccountTreeControllerClearStateAction | AccountTreeControllerSyncWithUserStorageAction | AccountTreeControllerSyncWithUserStorageAtLeastOnceAction;
|
|
167
|
+
//# sourceMappingURL=AccountTreeController-method-action-types.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AccountTreeController-method-action-types.d.cts","sourceRoot":"","sources":["../src/AccountTreeController-method-action-types.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is auto generated by `scripts/generate-method-action-types.ts`.
|
|
3
|
+
* Do not edit manually.
|
|
4
|
+
*/
|
|
5
|
+
import type { AccountTreeController } from "./AccountTreeController.mjs";
|
|
6
|
+
/**
|
|
7
|
+
* Gets the account wallet object from its ID.
|
|
8
|
+
*
|
|
9
|
+
* @param walletId - Account wallet ID.
|
|
10
|
+
* @returns The account wallet object if found, undefined otherwise.
|
|
11
|
+
*/
|
|
12
|
+
export type AccountTreeControllerGetAccountWalletObjectAction = {
|
|
13
|
+
type: `AccountTreeController:getAccountWalletObject`;
|
|
14
|
+
handler: AccountTreeController['getAccountWalletObject'];
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Gets all account wallet objects.
|
|
18
|
+
*
|
|
19
|
+
* @returns All account wallet objects.
|
|
20
|
+
*/
|
|
21
|
+
export type AccountTreeControllerGetAccountWalletObjectsAction = {
|
|
22
|
+
type: `AccountTreeController:getAccountWalletObjects`;
|
|
23
|
+
handler: AccountTreeController['getAccountWalletObjects'];
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Gets all underlying accounts from the currently selected account
|
|
27
|
+
* group.
|
|
28
|
+
*
|
|
29
|
+
* It also support account selector, which allows to filter specific
|
|
30
|
+
* accounts given some criterias (account type, address, scopes, etc...).
|
|
31
|
+
*
|
|
32
|
+
* @param selector - Optional account selector.
|
|
33
|
+
* @returns Underlying accounts for the currently selected account (filtered
|
|
34
|
+
* by the selector if provided).
|
|
35
|
+
*/
|
|
36
|
+
export type AccountTreeControllerGetAccountsFromSelectedAccountGroupAction = {
|
|
37
|
+
type: `AccountTreeController:getAccountsFromSelectedAccountGroup`;
|
|
38
|
+
handler: AccountTreeController['getAccountsFromSelectedAccountGroup'];
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* Gets the account group object from its ID.
|
|
42
|
+
*
|
|
43
|
+
* @param groupId - Account group ID.
|
|
44
|
+
* @returns The account group object if found, undefined otherwise.
|
|
45
|
+
*/
|
|
46
|
+
export type AccountTreeControllerGetAccountGroupObjectAction = {
|
|
47
|
+
type: `AccountTreeController:getAccountGroupObject`;
|
|
48
|
+
handler: AccountTreeController['getAccountGroupObject'];
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* Gets the account's context which contains its wallet ID, group ID, and sort order.
|
|
52
|
+
*
|
|
53
|
+
* @param accountId - Account ID.
|
|
54
|
+
* @returns The account context if found, undefined otherwise.
|
|
55
|
+
*/
|
|
56
|
+
export type AccountTreeControllerGetAccountContextAction = {
|
|
57
|
+
type: `AccountTreeController:getAccountContext`;
|
|
58
|
+
handler: AccountTreeController['getAccountContext'];
|
|
59
|
+
};
|
|
60
|
+
/**
|
|
61
|
+
* Gets the currently selected account group ID.
|
|
62
|
+
*
|
|
63
|
+
* @returns The selected account group ID or empty string if none selected.
|
|
64
|
+
*/
|
|
65
|
+
export type AccountTreeControllerGetSelectedAccountGroupAction = {
|
|
66
|
+
type: `AccountTreeController:getSelectedAccountGroup`;
|
|
67
|
+
handler: AccountTreeController['getSelectedAccountGroup'];
|
|
68
|
+
};
|
|
69
|
+
/**
|
|
70
|
+
* Sets the selected account group and updates the AccountsController selectedAccount accordingly.
|
|
71
|
+
*
|
|
72
|
+
* @param groupId - The account group ID to select.
|
|
73
|
+
*/
|
|
74
|
+
export type AccountTreeControllerSetSelectedAccountGroupAction = {
|
|
75
|
+
type: `AccountTreeController:setSelectedAccountGroup`;
|
|
76
|
+
handler: AccountTreeController['setSelectedAccountGroup'];
|
|
77
|
+
};
|
|
78
|
+
/**
|
|
79
|
+
* Sets a custom name for an account group.
|
|
80
|
+
*
|
|
81
|
+
* @param groupId - The account group ID.
|
|
82
|
+
* @param name - The custom name to set.
|
|
83
|
+
* @param autoHandleConflict - If true, automatically resolves name conflicts by adding a suffix. If false, throws on conflicts.
|
|
84
|
+
* @throws If the account group ID is not found in the current tree.
|
|
85
|
+
* @throws If the account group name already exists and autoHandleConflict is false.
|
|
86
|
+
*/
|
|
87
|
+
export type AccountTreeControllerSetAccountGroupNameAction = {
|
|
88
|
+
type: `AccountTreeController:setAccountGroupName`;
|
|
89
|
+
handler: AccountTreeController['setAccountGroupName'];
|
|
90
|
+
};
|
|
91
|
+
/**
|
|
92
|
+
* Sets a custom name for an account wallet.
|
|
93
|
+
*
|
|
94
|
+
* @param walletId - The account wallet ID.
|
|
95
|
+
* @param name - The custom name to set.
|
|
96
|
+
* @throws If the account wallet ID is not found in the current tree.
|
|
97
|
+
*/
|
|
98
|
+
export type AccountTreeControllerSetAccountWalletNameAction = {
|
|
99
|
+
type: `AccountTreeController:setAccountWalletName`;
|
|
100
|
+
handler: AccountTreeController['setAccountWalletName'];
|
|
101
|
+
};
|
|
102
|
+
/**
|
|
103
|
+
* Toggles the pinned state of an account group.
|
|
104
|
+
*
|
|
105
|
+
* @param groupId - The account group ID.
|
|
106
|
+
* @param pinned - Whether the group should be pinned.
|
|
107
|
+
* @throws If the account group ID is not found in the current tree.
|
|
108
|
+
*/
|
|
109
|
+
export type AccountTreeControllerSetAccountGroupPinnedAction = {
|
|
110
|
+
type: `AccountTreeController:setAccountGroupPinned`;
|
|
111
|
+
handler: AccountTreeController['setAccountGroupPinned'];
|
|
112
|
+
};
|
|
113
|
+
/**
|
|
114
|
+
* Toggles the hidden state of an account group.
|
|
115
|
+
*
|
|
116
|
+
* @param groupId - The account group ID.
|
|
117
|
+
* @param hidden - Whether the group should be hidden.
|
|
118
|
+
* @throws If the account group ID is not found in the current tree.
|
|
119
|
+
*/
|
|
120
|
+
export type AccountTreeControllerSetAccountGroupHiddenAction = {
|
|
121
|
+
type: `AccountTreeController:setAccountGroupHidden`;
|
|
122
|
+
handler: AccountTreeController['setAccountGroupHidden'];
|
|
123
|
+
};
|
|
124
|
+
/**
|
|
125
|
+
* Clears the controller state and resets to default values.
|
|
126
|
+
* Also clears the backup and sync service state.
|
|
127
|
+
*/
|
|
128
|
+
export type AccountTreeControllerClearStateAction = {
|
|
129
|
+
type: `AccountTreeController:clearState`;
|
|
130
|
+
handler: AccountTreeController['clearState'];
|
|
131
|
+
};
|
|
132
|
+
/**
|
|
133
|
+
* Bi-directionally syncs the account tree with user storage.
|
|
134
|
+
* This will perform a full sync, including both pulling updates
|
|
135
|
+
* from user storage and pushing local changes to user storage.
|
|
136
|
+
* This also performs legacy account syncing if needed.
|
|
137
|
+
*
|
|
138
|
+
* IMPORTANT:
|
|
139
|
+
* If a full sync is already in progress, it will return the ongoing promise.
|
|
140
|
+
*
|
|
141
|
+
* @returns A promise that resolves when the sync is complete.
|
|
142
|
+
*/
|
|
143
|
+
export type AccountTreeControllerSyncWithUserStorageAction = {
|
|
144
|
+
type: `AccountTreeController:syncWithUserStorage`;
|
|
145
|
+
handler: AccountTreeController['syncWithUserStorage'];
|
|
146
|
+
};
|
|
147
|
+
/**
|
|
148
|
+
* Bi-directionally syncs the account tree with user storage.
|
|
149
|
+
* This will ensure at least one full sync is ran, including both pulling updates
|
|
150
|
+
* from user storage and pushing local changes to user storage.
|
|
151
|
+
* This also performs legacy account syncing if needed.
|
|
152
|
+
*
|
|
153
|
+
* IMPORTANT:
|
|
154
|
+
* If the first ever full sync is already in progress, it will return the ongoing promise.
|
|
155
|
+
* If the first ever full sync was previously completed, it will NOT start a new sync, and will resolve immediately.
|
|
156
|
+
*
|
|
157
|
+
* @returns A promise that resolves when the first ever full sync is complete.
|
|
158
|
+
*/
|
|
159
|
+
export type AccountTreeControllerSyncWithUserStorageAtLeastOnceAction = {
|
|
160
|
+
type: `AccountTreeController:syncWithUserStorageAtLeastOnce`;
|
|
161
|
+
handler: AccountTreeController['syncWithUserStorageAtLeastOnce'];
|
|
162
|
+
};
|
|
163
|
+
/**
|
|
164
|
+
* Union of all AccountTreeController action types.
|
|
165
|
+
*/
|
|
166
|
+
export type AccountTreeControllerMethodActions = AccountTreeControllerGetAccountWalletObjectAction | AccountTreeControllerGetAccountWalletObjectsAction | AccountTreeControllerGetAccountsFromSelectedAccountGroupAction | AccountTreeControllerGetAccountGroupObjectAction | AccountTreeControllerGetAccountContextAction | AccountTreeControllerGetSelectedAccountGroupAction | AccountTreeControllerSetSelectedAccountGroupAction | AccountTreeControllerSetAccountGroupNameAction | AccountTreeControllerSetAccountWalletNameAction | AccountTreeControllerSetAccountGroupPinnedAction | AccountTreeControllerSetAccountGroupHiddenAction | AccountTreeControllerClearStateAction | AccountTreeControllerSyncWithUserStorageAction | AccountTreeControllerSyncWithUserStorageAtLeastOnceAction;
|
|
167
|
+
//# sourceMappingURL=AccountTreeController-method-action-types.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AccountTreeController-method-action-types.d.mts","sourceRoot":"","sources":["../src/AccountTreeController-method-action-types.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AccountTreeController-method-action-types.mjs","sourceRoot":"","sources":["../src/AccountTreeController-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 { AccountTreeController } from './AccountTreeController';\n\n/**\n * Gets the account wallet object from its ID.\n *\n * @param walletId - Account wallet ID.\n * @returns The account wallet object if found, undefined otherwise.\n */\nexport type AccountTreeControllerGetAccountWalletObjectAction = {\n type: `AccountTreeController:getAccountWalletObject`;\n handler: AccountTreeController['getAccountWalletObject'];\n};\n\n/**\n * Gets all account wallet objects.\n *\n * @returns All account wallet objects.\n */\nexport type AccountTreeControllerGetAccountWalletObjectsAction = {\n type: `AccountTreeController:getAccountWalletObjects`;\n handler: AccountTreeController['getAccountWalletObjects'];\n};\n\n/**\n * Gets all underlying accounts from the currently selected account\n * group.\n *\n * It also support account selector, which allows to filter specific\n * accounts given some criterias (account type, address, scopes, etc...).\n *\n * @param selector - Optional account selector.\n * @returns Underlying accounts for the currently selected account (filtered\n * by the selector if provided).\n */\nexport type AccountTreeControllerGetAccountsFromSelectedAccountGroupAction = {\n type: `AccountTreeController:getAccountsFromSelectedAccountGroup`;\n handler: AccountTreeController['getAccountsFromSelectedAccountGroup'];\n};\n\n/**\n * Gets the account group object from its ID.\n *\n * @param groupId - Account group ID.\n * @returns The account group object if found, undefined otherwise.\n */\nexport type AccountTreeControllerGetAccountGroupObjectAction = {\n type: `AccountTreeController:getAccountGroupObject`;\n handler: AccountTreeController['getAccountGroupObject'];\n};\n\n/**\n * Gets the account's context which contains its wallet ID, group ID, and sort order.\n *\n * @param accountId - Account ID.\n * @returns The account context if found, undefined otherwise.\n */\nexport type AccountTreeControllerGetAccountContextAction = {\n type: `AccountTreeController:getAccountContext`;\n handler: AccountTreeController['getAccountContext'];\n};\n\n/**\n * Gets the currently selected account group ID.\n *\n * @returns The selected account group ID or empty string if none selected.\n */\nexport type AccountTreeControllerGetSelectedAccountGroupAction = {\n type: `AccountTreeController:getSelectedAccountGroup`;\n handler: AccountTreeController['getSelectedAccountGroup'];\n};\n\n/**\n * Sets the selected account group and updates the AccountsController selectedAccount accordingly.\n *\n * @param groupId - The account group ID to select.\n */\nexport type AccountTreeControllerSetSelectedAccountGroupAction = {\n type: `AccountTreeController:setSelectedAccountGroup`;\n handler: AccountTreeController['setSelectedAccountGroup'];\n};\n\n/**\n * Sets a custom name for an account group.\n *\n * @param groupId - The account group ID.\n * @param name - The custom name to set.\n * @param autoHandleConflict - If true, automatically resolves name conflicts by adding a suffix. If false, throws on conflicts.\n * @throws If the account group ID is not found in the current tree.\n * @throws If the account group name already exists and autoHandleConflict is false.\n */\nexport type AccountTreeControllerSetAccountGroupNameAction = {\n type: `AccountTreeController:setAccountGroupName`;\n handler: AccountTreeController['setAccountGroupName'];\n};\n\n/**\n * Sets a custom name for an account wallet.\n *\n * @param walletId - The account wallet ID.\n * @param name - The custom name to set.\n * @throws If the account wallet ID is not found in the current tree.\n */\nexport type AccountTreeControllerSetAccountWalletNameAction = {\n type: `AccountTreeController:setAccountWalletName`;\n handler: AccountTreeController['setAccountWalletName'];\n};\n\n/**\n * Toggles the pinned state of an account group.\n *\n * @param groupId - The account group ID.\n * @param pinned - Whether the group should be pinned.\n * @throws If the account group ID is not found in the current tree.\n */\nexport type AccountTreeControllerSetAccountGroupPinnedAction = {\n type: `AccountTreeController:setAccountGroupPinned`;\n handler: AccountTreeController['setAccountGroupPinned'];\n};\n\n/**\n * Toggles the hidden state of an account group.\n *\n * @param groupId - The account group ID.\n * @param hidden - Whether the group should be hidden.\n * @throws If the account group ID is not found in the current tree.\n */\nexport type AccountTreeControllerSetAccountGroupHiddenAction = {\n type: `AccountTreeController:setAccountGroupHidden`;\n handler: AccountTreeController['setAccountGroupHidden'];\n};\n\n/**\n * Clears the controller state and resets to default values.\n * Also clears the backup and sync service state.\n */\nexport type AccountTreeControllerClearStateAction = {\n type: `AccountTreeController:clearState`;\n handler: AccountTreeController['clearState'];\n};\n\n/**\n * Bi-directionally syncs the account tree with user storage.\n * This will perform a full sync, including both pulling updates\n * from user storage and pushing local changes to user storage.\n * This also performs legacy account syncing if needed.\n *\n * IMPORTANT:\n * If a full sync is already in progress, it will return the ongoing promise.\n *\n * @returns A promise that resolves when the sync is complete.\n */\nexport type AccountTreeControllerSyncWithUserStorageAction = {\n type: `AccountTreeController:syncWithUserStorage`;\n handler: AccountTreeController['syncWithUserStorage'];\n};\n\n/**\n * Bi-directionally syncs the account tree with user storage.\n * This will ensure at least one full sync is ran, including both pulling updates\n * from user storage and pushing local changes to user storage.\n * This also performs legacy account syncing if needed.\n *\n * IMPORTANT:\n * If the first ever full sync is already in progress, it will return the ongoing promise.\n * If the first ever full sync was previously completed, it will NOT start a new sync, and will resolve immediately.\n *\n * @returns A promise that resolves when the first ever full sync is complete.\n */\nexport type AccountTreeControllerSyncWithUserStorageAtLeastOnceAction = {\n type: `AccountTreeController:syncWithUserStorageAtLeastOnce`;\n handler: AccountTreeController['syncWithUserStorageAtLeastOnce'];\n};\n\n/**\n * Union of all AccountTreeController action types.\n */\nexport type AccountTreeControllerMethodActions =\n | AccountTreeControllerGetAccountWalletObjectAction\n | AccountTreeControllerGetAccountWalletObjectsAction\n | AccountTreeControllerGetAccountsFromSelectedAccountGroupAction\n | AccountTreeControllerGetAccountGroupObjectAction\n | AccountTreeControllerGetAccountContextAction\n | AccountTreeControllerGetSelectedAccountGroupAction\n | AccountTreeControllerSetSelectedAccountGroupAction\n | AccountTreeControllerSetAccountGroupNameAction\n | AccountTreeControllerSetAccountWalletNameAction\n | AccountTreeControllerSetAccountGroupPinnedAction\n | AccountTreeControllerSetAccountGroupHiddenAction\n | AccountTreeControllerClearStateAction\n | AccountTreeControllerSyncWithUserStorageAction\n | AccountTreeControllerSyncWithUserStorageAtLeastOnceAction;\n"]}
|
|
@@ -10,7 +10,7 @@ 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 _AccountTreeController_instances, _AccountTreeController_accountIdToContext, _AccountTreeController_groupIdToWalletId, _AccountTreeController_backupAndSyncService, _AccountTreeController_rules, _AccountTreeController_trace, _AccountTreeController_backupAndSyncConfig, _AccountTreeController_accountOrderCallbacks, _AccountTreeController_initialized, _AccountTreeController_getEntropyRule, _AccountTreeController_getSnapRule, _AccountTreeController_getKeyringRule, _AccountTreeController_applyAccountWalletMetadata, _AccountTreeController_getRuleForWallet, _AccountTreeController_getComputedAccountGroupName, _AccountTreeController_getDefaultAccountGroupName, _AccountTreeController_applyAccountGroupMetadata, _AccountTreeController_handleAccountAdded, _AccountTreeController_handleAccountRemoved, _AccountTreeController_pruneEmptyGroupAndWallet, _AccountTreeController_insert, _AccountTreeController_listAccounts, _AccountTreeController_assertAccountGroupExists, _AccountTreeController_assertAccountWalletExists, _AccountTreeController_assertAccountGroupNameIsUnique, _AccountTreeController_getDefaultSelectedAccountGroup, _AccountTreeController_handleSelectedAccountChange, _AccountTreeController_handleMultichainAccountWalletStatusChange, _AccountTreeController_getAccountGroup, _AccountTreeController_getDefaultAccountFromAccountGroupId, _AccountTreeController_getDefaultAccountGroupId,
|
|
13
|
+
var _AccountTreeController_instances, _AccountTreeController_accountIdToContext, _AccountTreeController_groupIdToWalletId, _AccountTreeController_backupAndSyncService, _AccountTreeController_rules, _AccountTreeController_trace, _AccountTreeController_backupAndSyncConfig, _AccountTreeController_accountOrderCallbacks, _AccountTreeController_initialized, _AccountTreeController_getEntropyRule, _AccountTreeController_getSnapRule, _AccountTreeController_getKeyringRule, _AccountTreeController_applyAccountWalletMetadata, _AccountTreeController_getRuleForWallet, _AccountTreeController_getComputedAccountGroupName, _AccountTreeController_getDefaultAccountGroupName, _AccountTreeController_applyAccountGroupMetadata, _AccountTreeController_handleAccountAdded, _AccountTreeController_handleAccountRemoved, _AccountTreeController_pruneEmptyGroupAndWallet, _AccountTreeController_insert, _AccountTreeController_listAccounts, _AccountTreeController_assertAccountGroupExists, _AccountTreeController_assertAccountWalletExists, _AccountTreeController_assertAccountGroupNameIsUnique, _AccountTreeController_getDefaultSelectedAccountGroup, _AccountTreeController_handleSelectedAccountChange, _AccountTreeController_handleMultichainAccountWalletStatusChange, _AccountTreeController_getAccountGroup, _AccountTreeController_getDefaultAccountFromAccountGroupId, _AccountTreeController_getDefaultAccountGroupId, _AccountTreeController_resolveNameConflict, _AccountTreeController_createBackupAndSyncContext;
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.AccountTreeController = exports.getDefaultAccountTreeControllerState = exports.controllerName = void 0;
|
|
16
16
|
const account_api_1 = require("@metamask/account-api");
|
|
@@ -25,6 +25,22 @@ const entropy_1 = require("./rules/entropy.cjs");
|
|
|
25
25
|
const keyring_1 = require("./rules/keyring.cjs");
|
|
26
26
|
const snap_1 = require("./rules/snap.cjs");
|
|
27
27
|
exports.controllerName = 'AccountTreeController';
|
|
28
|
+
const MESSENGER_EXPOSED_METHODS = [
|
|
29
|
+
'getSelectedAccountGroup',
|
|
30
|
+
'setSelectedAccountGroup',
|
|
31
|
+
'getAccountsFromSelectedAccountGroup',
|
|
32
|
+
'getAccountContext',
|
|
33
|
+
'setAccountWalletName',
|
|
34
|
+
'setAccountGroupName',
|
|
35
|
+
'setAccountGroupPinned',
|
|
36
|
+
'setAccountGroupHidden',
|
|
37
|
+
'getAccountWalletObject',
|
|
38
|
+
'getAccountWalletObjects',
|
|
39
|
+
'getAccountGroupObject',
|
|
40
|
+
'clearState',
|
|
41
|
+
'syncWithUserStorage',
|
|
42
|
+
'syncWithUserStorageAtLeastOnce',
|
|
43
|
+
];
|
|
28
44
|
const accountTreeControllerMetadata = {
|
|
29
45
|
accountTree: {
|
|
30
46
|
includeInStateLogs: true,
|
|
@@ -151,7 +167,7 @@ class AccountTreeController extends base_controller_1.BaseController {
|
|
|
151
167
|
this.messenger.subscribe('MultichainAccountService:walletStatusChange', (walletId, status) => {
|
|
152
168
|
__classPrivateFieldGet(this, _AccountTreeController_instances, "m", _AccountTreeController_handleMultichainAccountWalletStatusChange).call(this, walletId, status);
|
|
153
169
|
});
|
|
154
|
-
|
|
170
|
+
this.messenger.registerMethodActionHandlers(this, MESSENGER_EXPOSED_METHODS);
|
|
155
171
|
}
|
|
156
172
|
/**
|
|
157
173
|
* Initialize the controller's state.
|
|
@@ -364,25 +380,6 @@ class AccountTreeController extends base_controller_1.BaseController {
|
|
|
364
380
|
// but our handler is idempotent so it won't cause infinite loop
|
|
365
381
|
this.messenger.call('AccountsController:setSelectedAccount', accountToSelect);
|
|
366
382
|
}
|
|
367
|
-
/**
|
|
368
|
-
* Resolves name conflicts by adding a suffix to make the name unique.
|
|
369
|
-
*
|
|
370
|
-
* @internal
|
|
371
|
-
* @param wallet - The wallet to check within.
|
|
372
|
-
* @param groupId - The account group ID to exclude from the check.
|
|
373
|
-
* @param name - The desired name that has a conflict.
|
|
374
|
-
* @returns A unique name with suffix added if necessary.
|
|
375
|
-
*/
|
|
376
|
-
resolveNameConflict(wallet, groupId, name) {
|
|
377
|
-
let suffix = 2;
|
|
378
|
-
let candidateName = `${name} (${suffix})`;
|
|
379
|
-
// Keep incrementing suffix until we find a unique name
|
|
380
|
-
while (!(0, group_1.isAccountGroupNameUniqueFromWallet)(wallet, groupId, candidateName)) {
|
|
381
|
-
suffix += 1;
|
|
382
|
-
candidateName = `${name} (${suffix})`;
|
|
383
|
-
}
|
|
384
|
-
return candidateName;
|
|
385
|
-
}
|
|
386
383
|
/**
|
|
387
384
|
* Sets a custom name for an account group.
|
|
388
385
|
*
|
|
@@ -402,7 +399,7 @@ class AccountTreeController extends base_controller_1.BaseController {
|
|
|
402
399
|
// Handle name conflicts based on the autoHandleConflict flag
|
|
403
400
|
if (autoHandleConflict &&
|
|
404
401
|
!(0, group_1.isAccountGroupNameUniqueFromWallet)(wallet, groupId, name)) {
|
|
405
|
-
finalName = this.
|
|
402
|
+
finalName = __classPrivateFieldGet(this, _AccountTreeController_instances, "m", _AccountTreeController_resolveNameConflict).call(this, wallet, groupId, name);
|
|
406
403
|
}
|
|
407
404
|
else {
|
|
408
405
|
// Validate that the name is unique
|
|
@@ -628,7 +625,7 @@ _AccountTreeController_accountIdToContext = new WeakMap(), _AccountTreeControlle
|
|
|
628
625
|
// If this name already exists for whatever reason, we rename it to resolve this conflict.
|
|
629
626
|
if (proposedName.length &&
|
|
630
627
|
!(0, group_1.isAccountGroupNameUniqueFromWallet)(wallet, group.id, proposedName)) {
|
|
631
|
-
proposedName = this.
|
|
628
|
+
proposedName = __classPrivateFieldGet(this, _AccountTreeController_instances, "m", _AccountTreeController_resolveNameConflict).call(this, wallet, group.id, proposedName);
|
|
632
629
|
}
|
|
633
630
|
return proposedName;
|
|
634
631
|
}, _AccountTreeController_getDefaultAccountGroupName = function _AccountTreeController_getDefaultAccountGroupName(state, wallet, group, nextNaturalNameIndex) {
|
|
@@ -999,15 +996,15 @@ _AccountTreeController_accountIdToContext = new WeakMap(), _AccountTreeControlle
|
|
|
999
996
|
}
|
|
1000
997
|
}
|
|
1001
998
|
return candidate;
|
|
1002
|
-
},
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
999
|
+
}, _AccountTreeController_resolveNameConflict = function _AccountTreeController_resolveNameConflict(wallet, groupId, name) {
|
|
1000
|
+
let suffix = 2;
|
|
1001
|
+
let candidateName = `${name} (${suffix})`;
|
|
1002
|
+
// Keep incrementing suffix until we find a unique name
|
|
1003
|
+
while (!(0, group_1.isAccountGroupNameUniqueFromWallet)(wallet, groupId, candidateName)) {
|
|
1004
|
+
suffix += 1;
|
|
1005
|
+
candidateName = `${name} (${suffix})`;
|
|
1006
|
+
}
|
|
1007
|
+
return candidateName;
|
|
1011
1008
|
}, _AccountTreeController_createBackupAndSyncContext = function _AccountTreeController_createBackupAndSyncContext() {
|
|
1012
1009
|
return {
|
|
1013
1010
|
...__classPrivateFieldGet(this, _AccountTreeController_backupAndSyncConfig, "f"),
|