@metamask-previews/accounts-controller 36.0.1-preview-567bc78af → 36.0.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 +12 -0
- package/dist/AccountsController-method-action-types.cjs +7 -0
- package/dist/AccountsController-method-action-types.cjs.map +1 -0
- package/dist/AccountsController-method-action-types.d.cts +167 -0
- package/dist/AccountsController-method-action-types.d.cts.map +1 -0
- package/dist/AccountsController-method-action-types.d.mts +167 -0
- package/dist/AccountsController-method-action-types.d.mts.map +1 -0
- package/dist/AccountsController-method-action-types.mjs +6 -0
- package/dist/AccountsController-method-action-types.mjs.map +1 -0
- package/dist/AccountsController.cjs +29 -37
- package/dist/AccountsController.cjs.map +1 -1
- package/dist/AccountsController.d.cts +2 -107
- package/dist/AccountsController.d.cts.map +1 -1
- package/dist/AccountsController.d.mts +2 -107
- package/dist/AccountsController.d.mts.map +1 -1
- package/dist/AccountsController.mjs +29 -37
- package/dist/AccountsController.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/package.json +3 -1
- package/dist/tests/mocks.cjs +0 -89
- package/dist/tests/mocks.cjs.map +0 -1
- package/dist/tests/mocks.d.cts +0 -26
- package/dist/tests/mocks.d.cts.map +0 -1
- package/dist/tests/mocks.d.mts +0 -26
- package/dist/tests/mocks.d.mts.map +0 -1
- package/dist/tests/mocks.mjs +0 -83
- package/dist/tests/mocks.mjs.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,10 +7,22 @@ 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 `AccountsController` methods through its messenger ([#7976](https://github.com/MetaMask/core/pull/7976/))
|
|
13
|
+
- The following actions are now available:
|
|
14
|
+
- `AccountController:loadBackupAction`
|
|
15
|
+
- Corresponding action types (e.g. `AccountControllerLoadBackupAction`) are available as well.
|
|
16
|
+
|
|
10
17
|
### Deprecated
|
|
11
18
|
|
|
12
19
|
- Mark `AccountsController`, all of its public methods, and all exported types as deprecated in favor of `AccountTreeController`, `MultichainAccountService`, and Keyring API v2 ([#8027](https://github.com/MetaMask/core/pull/8027))
|
|
13
20
|
|
|
21
|
+
### Removed
|
|
22
|
+
|
|
23
|
+
- **BREAKING:** Remove `getAccountExpect` from `AccountsController` ([#7976](https://github.com/MetaMask/core/pull/7976))
|
|
24
|
+
- This method was only used internally.
|
|
25
|
+
|
|
14
26
|
## [36.0.1]
|
|
15
27
|
|
|
16
28
|
### Changed
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AccountsController-method-action-types.cjs","sourceRoot":"","sources":["../src/AccountsController-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 { AccountsController } from './AccountsController';\n\n/**\n * Returns the internal account object for the given account ID, if it exists.\n *\n * @deprecated This method is deprecated and will be removed in a future version.\n * Use `AccountTreeController`, `MultichainAccountService`, or the Keyring API v2 instead.\n * @param accountId - The ID of the account to retrieve.\n * @returns The internal account object, or undefined if the account does not exist.\n */\nexport type AccountsControllerGetAccountAction = {\n type: `AccountsController:getAccount`;\n handler: AccountsController['getAccount'];\n};\n\n/**\n * Returns the internal account objects for the given account IDs, if they exist.\n *\n * @deprecated This method is deprecated and will be removed in a future version.\n * Use `AccountTreeController`, `MultichainAccountService`, or the Keyring API v2 instead.\n * @param accountIds - The IDs of the accounts to retrieve.\n * @returns The internal account objects, or undefined if the account(s) do not exist.\n */\nexport type AccountsControllerGetAccountsAction = {\n type: `AccountsController:getAccounts`;\n handler: AccountsController['getAccounts'];\n};\n\n/**\n * Returns an array of all evm internal accounts.\n *\n * @deprecated This method is deprecated and will be removed in a future version.\n * Use `AccountTreeController`, `MultichainAccountService`, or the Keyring API v2 instead.\n * @returns An array of InternalAccount objects.\n */\nexport type AccountsControllerListAccountsAction = {\n type: `AccountsController:listAccounts`;\n handler: AccountsController['listAccounts'];\n};\n\n/**\n * Returns an array of all internal accounts.\n *\n * @deprecated This method is deprecated and will be removed in a future version.\n * Use `AccountTreeController`, `MultichainAccountService`, or the Keyring API v2 instead.\n * @param chainId - The chain ID.\n * @returns An array of InternalAccount objects.\n */\nexport type AccountsControllerListMultichainAccountsAction = {\n type: `AccountsController:listMultichainAccounts`;\n handler: AccountsController['listMultichainAccounts'];\n};\n\n/**\n * Returns the last selected EVM account.\n *\n * @deprecated This method is deprecated and will be removed in a future version.\n * Use `AccountTreeController`, `MultichainAccountService`, or the Keyring API v2 instead.\n * @returns The selected internal account.\n */\nexport type AccountsControllerGetSelectedAccountAction = {\n type: `AccountsController:getSelectedAccount`;\n handler: AccountsController['getSelectedAccount'];\n};\n\n/**\n * __WARNING The return value may be undefined if there isn't an account for that chain id.__\n *\n * Retrieves the last selected account by chain ID.\n *\n * @deprecated This method is deprecated and will be removed in a future version.\n * Use `AccountTreeController`, `MultichainAccountService`, or the Keyring API v2 instead.\n * @param chainId - The chain ID to filter the accounts.\n * @returns The last selected account compatible with the specified chain ID or undefined.\n */\nexport type AccountsControllerGetSelectedMultichainAccountAction = {\n type: `AccountsController:getSelectedMultichainAccount`;\n handler: AccountsController['getSelectedMultichainAccount'];\n};\n\n/**\n * Returns the account with the specified address.\n * ! This method will only return the first account that matches the address\n *\n * @deprecated This method is deprecated and will be removed in a future version.\n * Use `AccountTreeController`, `MultichainAccountService`, or the Keyring API v2 instead.\n * @param address - The address of the account to retrieve.\n * @returns The account with the specified address, or undefined if not found.\n */\nexport type AccountsControllerGetAccountByAddressAction = {\n type: `AccountsController:getAccountByAddress`;\n handler: AccountsController['getAccountByAddress'];\n};\n\n/**\n * Sets the selected account by its ID.\n *\n * @deprecated This method is deprecated and will be removed in a future version.\n * Use `AccountTreeController`, `MultichainAccountService`, or the Keyring API v2 instead.\n * @param accountId - The ID of the account to be selected.\n */\nexport type AccountsControllerSetSelectedAccountAction = {\n type: `AccountsController:setSelectedAccount`;\n handler: AccountsController['setSelectedAccount'];\n};\n\n/**\n * Sets the name of the account with the given ID.\n *\n * @deprecated This method is deprecated and will be removed in a future version.\n * Use `AccountTreeController`, `MultichainAccountService`, or the Keyring API v2 instead.\n * @param accountId - The ID of the account to set the name for.\n * @param accountName - The new name for the account.\n * @throws An error if an account with the same name already exists.\n */\nexport type AccountsControllerSetAccountNameAction = {\n type: `AccountsController:setAccountName`;\n handler: AccountsController['setAccountName'];\n};\n\n/**\n * Sets the name of the account with the given ID and select it.\n *\n * @deprecated This method is deprecated and will be removed in a future version.\n * Use `AccountTreeController`, `MultichainAccountService`, or the Keyring API v2 instead.\n * @param accountId - The ID of the account to set the name for and select.\n * @param accountName - The new name for the account.\n * @throws An error if an account with the same name already exists.\n */\nexport type AccountsControllerSetAccountNameAndSelectAccountAction = {\n type: `AccountsController:setAccountNameAndSelectAccount`;\n handler: AccountsController['setAccountNameAndSelectAccount'];\n};\n\n/**\n * Updates the metadata of the account with the given ID.\n *\n * @deprecated This method is deprecated and will be removed in a future version.\n * Use `AccountTreeController`, `MultichainAccountService`, or the Keyring API v2 instead.\n * @param accountId - The ID of the account for which the metadata will be updated.\n * @param metadata - The new metadata for the account.\n */\nexport type AccountsControllerUpdateAccountMetadataAction = {\n type: `AccountsController:updateAccountMetadata`;\n handler: AccountsController['updateAccountMetadata'];\n};\n\n/**\n * Updates the internal accounts list by retrieving normal and snap accounts,\n * removing duplicates, and updating the metadata of each account.\n *\n * @deprecated This method is deprecated and will be removed in a future version.\n * Use `AccountTreeController`, `MultichainAccountService`, or the Keyring API v2 instead.\n * @returns A Promise that resolves when the accounts have been updated.\n */\nexport type AccountsControllerUpdateAccountsAction = {\n type: `AccountsController:updateAccounts`;\n handler: AccountsController['updateAccounts'];\n};\n\n/**\n * Loads the backup state of the accounts controller.\n *\n * @deprecated This method is deprecated and will be removed in a future version.\n * Use `AccountTreeController`, `MultichainAccountService`, or the Keyring API v2 instead.\n * @param backup - The backup state to load.\n */\nexport type AccountsControllerLoadBackupAction = {\n type: `AccountsController:loadBackup`;\n handler: AccountsController['loadBackup'];\n};\n\n/**\n * Union of all AccountsController action types.\n */\nexport type AccountsControllerMethodActions =\n | AccountsControllerGetAccountAction\n | AccountsControllerGetAccountsAction\n | AccountsControllerListAccountsAction\n | AccountsControllerListMultichainAccountsAction\n | AccountsControllerGetSelectedAccountAction\n | AccountsControllerGetSelectedMultichainAccountAction\n | AccountsControllerGetAccountByAddressAction\n | AccountsControllerSetSelectedAccountAction\n | AccountsControllerSetAccountNameAction\n | AccountsControllerSetAccountNameAndSelectAccountAction\n | AccountsControllerUpdateAccountMetadataAction\n | AccountsControllerUpdateAccountsAction\n | AccountsControllerLoadBackupAction;\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 { AccountsController } from "./AccountsController.cjs";
|
|
6
|
+
/**
|
|
7
|
+
* Returns the internal account object for the given account ID, if it exists.
|
|
8
|
+
*
|
|
9
|
+
* @deprecated This method is deprecated and will be removed in a future version.
|
|
10
|
+
* Use `AccountTreeController`, `MultichainAccountService`, or the Keyring API v2 instead.
|
|
11
|
+
* @param accountId - The ID of the account to retrieve.
|
|
12
|
+
* @returns The internal account object, or undefined if the account does not exist.
|
|
13
|
+
*/
|
|
14
|
+
export type AccountsControllerGetAccountAction = {
|
|
15
|
+
type: `AccountsController:getAccount`;
|
|
16
|
+
handler: AccountsController['getAccount'];
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Returns the internal account objects for the given account IDs, if they exist.
|
|
20
|
+
*
|
|
21
|
+
* @deprecated This method is deprecated and will be removed in a future version.
|
|
22
|
+
* Use `AccountTreeController`, `MultichainAccountService`, or the Keyring API v2 instead.
|
|
23
|
+
* @param accountIds - The IDs of the accounts to retrieve.
|
|
24
|
+
* @returns The internal account objects, or undefined if the account(s) do not exist.
|
|
25
|
+
*/
|
|
26
|
+
export type AccountsControllerGetAccountsAction = {
|
|
27
|
+
type: `AccountsController:getAccounts`;
|
|
28
|
+
handler: AccountsController['getAccounts'];
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* Returns an array of all evm internal accounts.
|
|
32
|
+
*
|
|
33
|
+
* @deprecated This method is deprecated and will be removed in a future version.
|
|
34
|
+
* Use `AccountTreeController`, `MultichainAccountService`, or the Keyring API v2 instead.
|
|
35
|
+
* @returns An array of InternalAccount objects.
|
|
36
|
+
*/
|
|
37
|
+
export type AccountsControllerListAccountsAction = {
|
|
38
|
+
type: `AccountsController:listAccounts`;
|
|
39
|
+
handler: AccountsController['listAccounts'];
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* Returns an array of all internal accounts.
|
|
43
|
+
*
|
|
44
|
+
* @deprecated This method is deprecated and will be removed in a future version.
|
|
45
|
+
* Use `AccountTreeController`, `MultichainAccountService`, or the Keyring API v2 instead.
|
|
46
|
+
* @param chainId - The chain ID.
|
|
47
|
+
* @returns An array of InternalAccount objects.
|
|
48
|
+
*/
|
|
49
|
+
export type AccountsControllerListMultichainAccountsAction = {
|
|
50
|
+
type: `AccountsController:listMultichainAccounts`;
|
|
51
|
+
handler: AccountsController['listMultichainAccounts'];
|
|
52
|
+
};
|
|
53
|
+
/**
|
|
54
|
+
* Returns the last selected EVM account.
|
|
55
|
+
*
|
|
56
|
+
* @deprecated This method is deprecated and will be removed in a future version.
|
|
57
|
+
* Use `AccountTreeController`, `MultichainAccountService`, or the Keyring API v2 instead.
|
|
58
|
+
* @returns The selected internal account.
|
|
59
|
+
*/
|
|
60
|
+
export type AccountsControllerGetSelectedAccountAction = {
|
|
61
|
+
type: `AccountsController:getSelectedAccount`;
|
|
62
|
+
handler: AccountsController['getSelectedAccount'];
|
|
63
|
+
};
|
|
64
|
+
/**
|
|
65
|
+
* __WARNING The return value may be undefined if there isn't an account for that chain id.__
|
|
66
|
+
*
|
|
67
|
+
* Retrieves the last selected account by chain ID.
|
|
68
|
+
*
|
|
69
|
+
* @deprecated This method is deprecated and will be removed in a future version.
|
|
70
|
+
* Use `AccountTreeController`, `MultichainAccountService`, or the Keyring API v2 instead.
|
|
71
|
+
* @param chainId - The chain ID to filter the accounts.
|
|
72
|
+
* @returns The last selected account compatible with the specified chain ID or undefined.
|
|
73
|
+
*/
|
|
74
|
+
export type AccountsControllerGetSelectedMultichainAccountAction = {
|
|
75
|
+
type: `AccountsController:getSelectedMultichainAccount`;
|
|
76
|
+
handler: AccountsController['getSelectedMultichainAccount'];
|
|
77
|
+
};
|
|
78
|
+
/**
|
|
79
|
+
* Returns the account with the specified address.
|
|
80
|
+
* ! This method will only return the first account that matches the address
|
|
81
|
+
*
|
|
82
|
+
* @deprecated This method is deprecated and will be removed in a future version.
|
|
83
|
+
* Use `AccountTreeController`, `MultichainAccountService`, or the Keyring API v2 instead.
|
|
84
|
+
* @param address - The address of the account to retrieve.
|
|
85
|
+
* @returns The account with the specified address, or undefined if not found.
|
|
86
|
+
*/
|
|
87
|
+
export type AccountsControllerGetAccountByAddressAction = {
|
|
88
|
+
type: `AccountsController:getAccountByAddress`;
|
|
89
|
+
handler: AccountsController['getAccountByAddress'];
|
|
90
|
+
};
|
|
91
|
+
/**
|
|
92
|
+
* Sets the selected account by its ID.
|
|
93
|
+
*
|
|
94
|
+
* @deprecated This method is deprecated and will be removed in a future version.
|
|
95
|
+
* Use `AccountTreeController`, `MultichainAccountService`, or the Keyring API v2 instead.
|
|
96
|
+
* @param accountId - The ID of the account to be selected.
|
|
97
|
+
*/
|
|
98
|
+
export type AccountsControllerSetSelectedAccountAction = {
|
|
99
|
+
type: `AccountsController:setSelectedAccount`;
|
|
100
|
+
handler: AccountsController['setSelectedAccount'];
|
|
101
|
+
};
|
|
102
|
+
/**
|
|
103
|
+
* Sets the name of the account with the given ID.
|
|
104
|
+
*
|
|
105
|
+
* @deprecated This method is deprecated and will be removed in a future version.
|
|
106
|
+
* Use `AccountTreeController`, `MultichainAccountService`, or the Keyring API v2 instead.
|
|
107
|
+
* @param accountId - The ID of the account to set the name for.
|
|
108
|
+
* @param accountName - The new name for the account.
|
|
109
|
+
* @throws An error if an account with the same name already exists.
|
|
110
|
+
*/
|
|
111
|
+
export type AccountsControllerSetAccountNameAction = {
|
|
112
|
+
type: `AccountsController:setAccountName`;
|
|
113
|
+
handler: AccountsController['setAccountName'];
|
|
114
|
+
};
|
|
115
|
+
/**
|
|
116
|
+
* Sets the name of the account with the given ID and select it.
|
|
117
|
+
*
|
|
118
|
+
* @deprecated This method is deprecated and will be removed in a future version.
|
|
119
|
+
* Use `AccountTreeController`, `MultichainAccountService`, or the Keyring API v2 instead.
|
|
120
|
+
* @param accountId - The ID of the account to set the name for and select.
|
|
121
|
+
* @param accountName - The new name for the account.
|
|
122
|
+
* @throws An error if an account with the same name already exists.
|
|
123
|
+
*/
|
|
124
|
+
export type AccountsControllerSetAccountNameAndSelectAccountAction = {
|
|
125
|
+
type: `AccountsController:setAccountNameAndSelectAccount`;
|
|
126
|
+
handler: AccountsController['setAccountNameAndSelectAccount'];
|
|
127
|
+
};
|
|
128
|
+
/**
|
|
129
|
+
* Updates the metadata of the account with the given ID.
|
|
130
|
+
*
|
|
131
|
+
* @deprecated This method is deprecated and will be removed in a future version.
|
|
132
|
+
* Use `AccountTreeController`, `MultichainAccountService`, or the Keyring API v2 instead.
|
|
133
|
+
* @param accountId - The ID of the account for which the metadata will be updated.
|
|
134
|
+
* @param metadata - The new metadata for the account.
|
|
135
|
+
*/
|
|
136
|
+
export type AccountsControllerUpdateAccountMetadataAction = {
|
|
137
|
+
type: `AccountsController:updateAccountMetadata`;
|
|
138
|
+
handler: AccountsController['updateAccountMetadata'];
|
|
139
|
+
};
|
|
140
|
+
/**
|
|
141
|
+
* Updates the internal accounts list by retrieving normal and snap accounts,
|
|
142
|
+
* removing duplicates, and updating the metadata of each account.
|
|
143
|
+
*
|
|
144
|
+
* @deprecated This method is deprecated and will be removed in a future version.
|
|
145
|
+
* Use `AccountTreeController`, `MultichainAccountService`, or the Keyring API v2 instead.
|
|
146
|
+
* @returns A Promise that resolves when the accounts have been updated.
|
|
147
|
+
*/
|
|
148
|
+
export type AccountsControllerUpdateAccountsAction = {
|
|
149
|
+
type: `AccountsController:updateAccounts`;
|
|
150
|
+
handler: AccountsController['updateAccounts'];
|
|
151
|
+
};
|
|
152
|
+
/**
|
|
153
|
+
* Loads the backup state of the accounts controller.
|
|
154
|
+
*
|
|
155
|
+
* @deprecated This method is deprecated and will be removed in a future version.
|
|
156
|
+
* Use `AccountTreeController`, `MultichainAccountService`, or the Keyring API v2 instead.
|
|
157
|
+
* @param backup - The backup state to load.
|
|
158
|
+
*/
|
|
159
|
+
export type AccountsControllerLoadBackupAction = {
|
|
160
|
+
type: `AccountsController:loadBackup`;
|
|
161
|
+
handler: AccountsController['loadBackup'];
|
|
162
|
+
};
|
|
163
|
+
/**
|
|
164
|
+
* Union of all AccountsController action types.
|
|
165
|
+
*/
|
|
166
|
+
export type AccountsControllerMethodActions = AccountsControllerGetAccountAction | AccountsControllerGetAccountsAction | AccountsControllerListAccountsAction | AccountsControllerListMultichainAccountsAction | AccountsControllerGetSelectedAccountAction | AccountsControllerGetSelectedMultichainAccountAction | AccountsControllerGetAccountByAddressAction | AccountsControllerSetSelectedAccountAction | AccountsControllerSetAccountNameAction | AccountsControllerSetAccountNameAndSelectAccountAction | AccountsControllerUpdateAccountMetadataAction | AccountsControllerUpdateAccountsAction | AccountsControllerLoadBackupAction;
|
|
167
|
+
//# sourceMappingURL=AccountsController-method-action-types.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AccountsController-method-action-types.d.cts","sourceRoot":"","sources":["../src/AccountsController-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,kBAAkB,EAAE,iCAA6B;AAE/D;;;;;;;GAOG;AACH,MAAM,MAAM,kCAAkC,GAAG;IAC/C,IAAI,EAAE,+BAA+B,CAAC;IACtC,OAAO,EAAE,kBAAkB,CAAC,YAAY,CAAC,CAAC;CAC3C,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,MAAM,mCAAmC,GAAG;IAChD,IAAI,EAAE,gCAAgC,CAAC;IACvC,OAAO,EAAE,kBAAkB,CAAC,aAAa,CAAC,CAAC;CAC5C,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,MAAM,oCAAoC,GAAG;IACjD,IAAI,EAAE,iCAAiC,CAAC;IACxC,OAAO,EAAE,kBAAkB,CAAC,cAAc,CAAC,CAAC;CAC7C,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,MAAM,8CAA8C,GAAG;IAC3D,IAAI,EAAE,2CAA2C,CAAC;IAClD,OAAO,EAAE,kBAAkB,CAAC,wBAAwB,CAAC,CAAC;CACvD,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,MAAM,0CAA0C,GAAG;IACvD,IAAI,EAAE,uCAAuC,CAAC;IAC9C,OAAO,EAAE,kBAAkB,CAAC,oBAAoB,CAAC,CAAC;CACnD,CAAC;AAEF;;;;;;;;;GASG;AACH,MAAM,MAAM,oDAAoD,GAAG;IACjE,IAAI,EAAE,iDAAiD,CAAC;IACxD,OAAO,EAAE,kBAAkB,CAAC,8BAA8B,CAAC,CAAC;CAC7D,CAAC;AAEF;;;;;;;;GAQG;AACH,MAAM,MAAM,2CAA2C,GAAG;IACxD,IAAI,EAAE,wCAAwC,CAAC;IAC/C,OAAO,EAAE,kBAAkB,CAAC,qBAAqB,CAAC,CAAC;CACpD,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,MAAM,0CAA0C,GAAG;IACvD,IAAI,EAAE,uCAAuC,CAAC;IAC9C,OAAO,EAAE,kBAAkB,CAAC,oBAAoB,CAAC,CAAC;CACnD,CAAC;AAEF;;;;;;;;GAQG;AACH,MAAM,MAAM,sCAAsC,GAAG;IACnD,IAAI,EAAE,mCAAmC,CAAC;IAC1C,OAAO,EAAE,kBAAkB,CAAC,gBAAgB,CAAC,CAAC;CAC/C,CAAC;AAEF;;;;;;;;GAQG;AACH,MAAM,MAAM,sDAAsD,GAAG;IACnE,IAAI,EAAE,mDAAmD,CAAC;IAC1D,OAAO,EAAE,kBAAkB,CAAC,gCAAgC,CAAC,CAAC;CAC/D,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,MAAM,6CAA6C,GAAG;IAC1D,IAAI,EAAE,0CAA0C,CAAC;IACjD,OAAO,EAAE,kBAAkB,CAAC,uBAAuB,CAAC,CAAC;CACtD,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,MAAM,sCAAsC,GAAG;IACnD,IAAI,EAAE,mCAAmC,CAAC;IAC1C,OAAO,EAAE,kBAAkB,CAAC,gBAAgB,CAAC,CAAC;CAC/C,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,MAAM,kCAAkC,GAAG;IAC/C,IAAI,EAAE,+BAA+B,CAAC;IACtC,OAAO,EAAE,kBAAkB,CAAC,YAAY,CAAC,CAAC;CAC3C,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,+BAA+B,GACvC,kCAAkC,GAClC,mCAAmC,GACnC,oCAAoC,GACpC,8CAA8C,GAC9C,0CAA0C,GAC1C,oDAAoD,GACpD,2CAA2C,GAC3C,0CAA0C,GAC1C,sCAAsC,GACtC,sDAAsD,GACtD,6CAA6C,GAC7C,sCAAsC,GACtC,kCAAkC,CAAC"}
|
|
@@ -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 { AccountsController } from "./AccountsController.mjs";
|
|
6
|
+
/**
|
|
7
|
+
* Returns the internal account object for the given account ID, if it exists.
|
|
8
|
+
*
|
|
9
|
+
* @deprecated This method is deprecated and will be removed in a future version.
|
|
10
|
+
* Use `AccountTreeController`, `MultichainAccountService`, or the Keyring API v2 instead.
|
|
11
|
+
* @param accountId - The ID of the account to retrieve.
|
|
12
|
+
* @returns The internal account object, or undefined if the account does not exist.
|
|
13
|
+
*/
|
|
14
|
+
export type AccountsControllerGetAccountAction = {
|
|
15
|
+
type: `AccountsController:getAccount`;
|
|
16
|
+
handler: AccountsController['getAccount'];
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Returns the internal account objects for the given account IDs, if they exist.
|
|
20
|
+
*
|
|
21
|
+
* @deprecated This method is deprecated and will be removed in a future version.
|
|
22
|
+
* Use `AccountTreeController`, `MultichainAccountService`, or the Keyring API v2 instead.
|
|
23
|
+
* @param accountIds - The IDs of the accounts to retrieve.
|
|
24
|
+
* @returns The internal account objects, or undefined if the account(s) do not exist.
|
|
25
|
+
*/
|
|
26
|
+
export type AccountsControllerGetAccountsAction = {
|
|
27
|
+
type: `AccountsController:getAccounts`;
|
|
28
|
+
handler: AccountsController['getAccounts'];
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* Returns an array of all evm internal accounts.
|
|
32
|
+
*
|
|
33
|
+
* @deprecated This method is deprecated and will be removed in a future version.
|
|
34
|
+
* Use `AccountTreeController`, `MultichainAccountService`, or the Keyring API v2 instead.
|
|
35
|
+
* @returns An array of InternalAccount objects.
|
|
36
|
+
*/
|
|
37
|
+
export type AccountsControllerListAccountsAction = {
|
|
38
|
+
type: `AccountsController:listAccounts`;
|
|
39
|
+
handler: AccountsController['listAccounts'];
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* Returns an array of all internal accounts.
|
|
43
|
+
*
|
|
44
|
+
* @deprecated This method is deprecated and will be removed in a future version.
|
|
45
|
+
* Use `AccountTreeController`, `MultichainAccountService`, or the Keyring API v2 instead.
|
|
46
|
+
* @param chainId - The chain ID.
|
|
47
|
+
* @returns An array of InternalAccount objects.
|
|
48
|
+
*/
|
|
49
|
+
export type AccountsControllerListMultichainAccountsAction = {
|
|
50
|
+
type: `AccountsController:listMultichainAccounts`;
|
|
51
|
+
handler: AccountsController['listMultichainAccounts'];
|
|
52
|
+
};
|
|
53
|
+
/**
|
|
54
|
+
* Returns the last selected EVM account.
|
|
55
|
+
*
|
|
56
|
+
* @deprecated This method is deprecated and will be removed in a future version.
|
|
57
|
+
* Use `AccountTreeController`, `MultichainAccountService`, or the Keyring API v2 instead.
|
|
58
|
+
* @returns The selected internal account.
|
|
59
|
+
*/
|
|
60
|
+
export type AccountsControllerGetSelectedAccountAction = {
|
|
61
|
+
type: `AccountsController:getSelectedAccount`;
|
|
62
|
+
handler: AccountsController['getSelectedAccount'];
|
|
63
|
+
};
|
|
64
|
+
/**
|
|
65
|
+
* __WARNING The return value may be undefined if there isn't an account for that chain id.__
|
|
66
|
+
*
|
|
67
|
+
* Retrieves the last selected account by chain ID.
|
|
68
|
+
*
|
|
69
|
+
* @deprecated This method is deprecated and will be removed in a future version.
|
|
70
|
+
* Use `AccountTreeController`, `MultichainAccountService`, or the Keyring API v2 instead.
|
|
71
|
+
* @param chainId - The chain ID to filter the accounts.
|
|
72
|
+
* @returns The last selected account compatible with the specified chain ID or undefined.
|
|
73
|
+
*/
|
|
74
|
+
export type AccountsControllerGetSelectedMultichainAccountAction = {
|
|
75
|
+
type: `AccountsController:getSelectedMultichainAccount`;
|
|
76
|
+
handler: AccountsController['getSelectedMultichainAccount'];
|
|
77
|
+
};
|
|
78
|
+
/**
|
|
79
|
+
* Returns the account with the specified address.
|
|
80
|
+
* ! This method will only return the first account that matches the address
|
|
81
|
+
*
|
|
82
|
+
* @deprecated This method is deprecated and will be removed in a future version.
|
|
83
|
+
* Use `AccountTreeController`, `MultichainAccountService`, or the Keyring API v2 instead.
|
|
84
|
+
* @param address - The address of the account to retrieve.
|
|
85
|
+
* @returns The account with the specified address, or undefined if not found.
|
|
86
|
+
*/
|
|
87
|
+
export type AccountsControllerGetAccountByAddressAction = {
|
|
88
|
+
type: `AccountsController:getAccountByAddress`;
|
|
89
|
+
handler: AccountsController['getAccountByAddress'];
|
|
90
|
+
};
|
|
91
|
+
/**
|
|
92
|
+
* Sets the selected account by its ID.
|
|
93
|
+
*
|
|
94
|
+
* @deprecated This method is deprecated and will be removed in a future version.
|
|
95
|
+
* Use `AccountTreeController`, `MultichainAccountService`, or the Keyring API v2 instead.
|
|
96
|
+
* @param accountId - The ID of the account to be selected.
|
|
97
|
+
*/
|
|
98
|
+
export type AccountsControllerSetSelectedAccountAction = {
|
|
99
|
+
type: `AccountsController:setSelectedAccount`;
|
|
100
|
+
handler: AccountsController['setSelectedAccount'];
|
|
101
|
+
};
|
|
102
|
+
/**
|
|
103
|
+
* Sets the name of the account with the given ID.
|
|
104
|
+
*
|
|
105
|
+
* @deprecated This method is deprecated and will be removed in a future version.
|
|
106
|
+
* Use `AccountTreeController`, `MultichainAccountService`, or the Keyring API v2 instead.
|
|
107
|
+
* @param accountId - The ID of the account to set the name for.
|
|
108
|
+
* @param accountName - The new name for the account.
|
|
109
|
+
* @throws An error if an account with the same name already exists.
|
|
110
|
+
*/
|
|
111
|
+
export type AccountsControllerSetAccountNameAction = {
|
|
112
|
+
type: `AccountsController:setAccountName`;
|
|
113
|
+
handler: AccountsController['setAccountName'];
|
|
114
|
+
};
|
|
115
|
+
/**
|
|
116
|
+
* Sets the name of the account with the given ID and select it.
|
|
117
|
+
*
|
|
118
|
+
* @deprecated This method is deprecated and will be removed in a future version.
|
|
119
|
+
* Use `AccountTreeController`, `MultichainAccountService`, or the Keyring API v2 instead.
|
|
120
|
+
* @param accountId - The ID of the account to set the name for and select.
|
|
121
|
+
* @param accountName - The new name for the account.
|
|
122
|
+
* @throws An error if an account with the same name already exists.
|
|
123
|
+
*/
|
|
124
|
+
export type AccountsControllerSetAccountNameAndSelectAccountAction = {
|
|
125
|
+
type: `AccountsController:setAccountNameAndSelectAccount`;
|
|
126
|
+
handler: AccountsController['setAccountNameAndSelectAccount'];
|
|
127
|
+
};
|
|
128
|
+
/**
|
|
129
|
+
* Updates the metadata of the account with the given ID.
|
|
130
|
+
*
|
|
131
|
+
* @deprecated This method is deprecated and will be removed in a future version.
|
|
132
|
+
* Use `AccountTreeController`, `MultichainAccountService`, or the Keyring API v2 instead.
|
|
133
|
+
* @param accountId - The ID of the account for which the metadata will be updated.
|
|
134
|
+
* @param metadata - The new metadata for the account.
|
|
135
|
+
*/
|
|
136
|
+
export type AccountsControllerUpdateAccountMetadataAction = {
|
|
137
|
+
type: `AccountsController:updateAccountMetadata`;
|
|
138
|
+
handler: AccountsController['updateAccountMetadata'];
|
|
139
|
+
};
|
|
140
|
+
/**
|
|
141
|
+
* Updates the internal accounts list by retrieving normal and snap accounts,
|
|
142
|
+
* removing duplicates, and updating the metadata of each account.
|
|
143
|
+
*
|
|
144
|
+
* @deprecated This method is deprecated and will be removed in a future version.
|
|
145
|
+
* Use `AccountTreeController`, `MultichainAccountService`, or the Keyring API v2 instead.
|
|
146
|
+
* @returns A Promise that resolves when the accounts have been updated.
|
|
147
|
+
*/
|
|
148
|
+
export type AccountsControllerUpdateAccountsAction = {
|
|
149
|
+
type: `AccountsController:updateAccounts`;
|
|
150
|
+
handler: AccountsController['updateAccounts'];
|
|
151
|
+
};
|
|
152
|
+
/**
|
|
153
|
+
* Loads the backup state of the accounts controller.
|
|
154
|
+
*
|
|
155
|
+
* @deprecated This method is deprecated and will be removed in a future version.
|
|
156
|
+
* Use `AccountTreeController`, `MultichainAccountService`, or the Keyring API v2 instead.
|
|
157
|
+
* @param backup - The backup state to load.
|
|
158
|
+
*/
|
|
159
|
+
export type AccountsControllerLoadBackupAction = {
|
|
160
|
+
type: `AccountsController:loadBackup`;
|
|
161
|
+
handler: AccountsController['loadBackup'];
|
|
162
|
+
};
|
|
163
|
+
/**
|
|
164
|
+
* Union of all AccountsController action types.
|
|
165
|
+
*/
|
|
166
|
+
export type AccountsControllerMethodActions = AccountsControllerGetAccountAction | AccountsControllerGetAccountsAction | AccountsControllerListAccountsAction | AccountsControllerListMultichainAccountsAction | AccountsControllerGetSelectedAccountAction | AccountsControllerGetSelectedMultichainAccountAction | AccountsControllerGetAccountByAddressAction | AccountsControllerSetSelectedAccountAction | AccountsControllerSetAccountNameAction | AccountsControllerSetAccountNameAndSelectAccountAction | AccountsControllerUpdateAccountMetadataAction | AccountsControllerUpdateAccountsAction | AccountsControllerLoadBackupAction;
|
|
167
|
+
//# sourceMappingURL=AccountsController-method-action-types.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AccountsController-method-action-types.d.mts","sourceRoot":"","sources":["../src/AccountsController-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,kBAAkB,EAAE,iCAA6B;AAE/D;;;;;;;GAOG;AACH,MAAM,MAAM,kCAAkC,GAAG;IAC/C,IAAI,EAAE,+BAA+B,CAAC;IACtC,OAAO,EAAE,kBAAkB,CAAC,YAAY,CAAC,CAAC;CAC3C,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,MAAM,mCAAmC,GAAG;IAChD,IAAI,EAAE,gCAAgC,CAAC;IACvC,OAAO,EAAE,kBAAkB,CAAC,aAAa,CAAC,CAAC;CAC5C,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,MAAM,oCAAoC,GAAG;IACjD,IAAI,EAAE,iCAAiC,CAAC;IACxC,OAAO,EAAE,kBAAkB,CAAC,cAAc,CAAC,CAAC;CAC7C,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,MAAM,8CAA8C,GAAG;IAC3D,IAAI,EAAE,2CAA2C,CAAC;IAClD,OAAO,EAAE,kBAAkB,CAAC,wBAAwB,CAAC,CAAC;CACvD,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,MAAM,0CAA0C,GAAG;IACvD,IAAI,EAAE,uCAAuC,CAAC;IAC9C,OAAO,EAAE,kBAAkB,CAAC,oBAAoB,CAAC,CAAC;CACnD,CAAC;AAEF;;;;;;;;;GASG;AACH,MAAM,MAAM,oDAAoD,GAAG;IACjE,IAAI,EAAE,iDAAiD,CAAC;IACxD,OAAO,EAAE,kBAAkB,CAAC,8BAA8B,CAAC,CAAC;CAC7D,CAAC;AAEF;;;;;;;;GAQG;AACH,MAAM,MAAM,2CAA2C,GAAG;IACxD,IAAI,EAAE,wCAAwC,CAAC;IAC/C,OAAO,EAAE,kBAAkB,CAAC,qBAAqB,CAAC,CAAC;CACpD,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,MAAM,0CAA0C,GAAG;IACvD,IAAI,EAAE,uCAAuC,CAAC;IAC9C,OAAO,EAAE,kBAAkB,CAAC,oBAAoB,CAAC,CAAC;CACnD,CAAC;AAEF;;;;;;;;GAQG;AACH,MAAM,MAAM,sCAAsC,GAAG;IACnD,IAAI,EAAE,mCAAmC,CAAC;IAC1C,OAAO,EAAE,kBAAkB,CAAC,gBAAgB,CAAC,CAAC;CAC/C,CAAC;AAEF;;;;;;;;GAQG;AACH,MAAM,MAAM,sDAAsD,GAAG;IACnE,IAAI,EAAE,mDAAmD,CAAC;IAC1D,OAAO,EAAE,kBAAkB,CAAC,gCAAgC,CAAC,CAAC;CAC/D,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,MAAM,6CAA6C,GAAG;IAC1D,IAAI,EAAE,0CAA0C,CAAC;IACjD,OAAO,EAAE,kBAAkB,CAAC,uBAAuB,CAAC,CAAC;CACtD,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,MAAM,sCAAsC,GAAG;IACnD,IAAI,EAAE,mCAAmC,CAAC;IAC1C,OAAO,EAAE,kBAAkB,CAAC,gBAAgB,CAAC,CAAC;CAC/C,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,MAAM,kCAAkC,GAAG;IAC/C,IAAI,EAAE,+BAA+B,CAAC;IACtC,OAAO,EAAE,kBAAkB,CAAC,YAAY,CAAC,CAAC;CAC3C,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,+BAA+B,GACvC,kCAAkC,GAClC,mCAAmC,GACnC,oCAAoC,GACpC,8CAA8C,GAC9C,0CAA0C,GAC1C,oDAAoD,GACpD,2CAA2C,GAC3C,0CAA0C,GAC1C,sCAAsC,GACtC,sDAAsD,GACtD,6CAA6C,GAC7C,sCAAsC,GACtC,kCAAkC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AccountsController-method-action-types.mjs","sourceRoot":"","sources":["../src/AccountsController-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 { AccountsController } from './AccountsController';\n\n/**\n * Returns the internal account object for the given account ID, if it exists.\n *\n * @deprecated This method is deprecated and will be removed in a future version.\n * Use `AccountTreeController`, `MultichainAccountService`, or the Keyring API v2 instead.\n * @param accountId - The ID of the account to retrieve.\n * @returns The internal account object, or undefined if the account does not exist.\n */\nexport type AccountsControllerGetAccountAction = {\n type: `AccountsController:getAccount`;\n handler: AccountsController['getAccount'];\n};\n\n/**\n * Returns the internal account objects for the given account IDs, if they exist.\n *\n * @deprecated This method is deprecated and will be removed in a future version.\n * Use `AccountTreeController`, `MultichainAccountService`, or the Keyring API v2 instead.\n * @param accountIds - The IDs of the accounts to retrieve.\n * @returns The internal account objects, or undefined if the account(s) do not exist.\n */\nexport type AccountsControllerGetAccountsAction = {\n type: `AccountsController:getAccounts`;\n handler: AccountsController['getAccounts'];\n};\n\n/**\n * Returns an array of all evm internal accounts.\n *\n * @deprecated This method is deprecated and will be removed in a future version.\n * Use `AccountTreeController`, `MultichainAccountService`, or the Keyring API v2 instead.\n * @returns An array of InternalAccount objects.\n */\nexport type AccountsControllerListAccountsAction = {\n type: `AccountsController:listAccounts`;\n handler: AccountsController['listAccounts'];\n};\n\n/**\n * Returns an array of all internal accounts.\n *\n * @deprecated This method is deprecated and will be removed in a future version.\n * Use `AccountTreeController`, `MultichainAccountService`, or the Keyring API v2 instead.\n * @param chainId - The chain ID.\n * @returns An array of InternalAccount objects.\n */\nexport type AccountsControllerListMultichainAccountsAction = {\n type: `AccountsController:listMultichainAccounts`;\n handler: AccountsController['listMultichainAccounts'];\n};\n\n/**\n * Returns the last selected EVM account.\n *\n * @deprecated This method is deprecated and will be removed in a future version.\n * Use `AccountTreeController`, `MultichainAccountService`, or the Keyring API v2 instead.\n * @returns The selected internal account.\n */\nexport type AccountsControllerGetSelectedAccountAction = {\n type: `AccountsController:getSelectedAccount`;\n handler: AccountsController['getSelectedAccount'];\n};\n\n/**\n * __WARNING The return value may be undefined if there isn't an account for that chain id.__\n *\n * Retrieves the last selected account by chain ID.\n *\n * @deprecated This method is deprecated and will be removed in a future version.\n * Use `AccountTreeController`, `MultichainAccountService`, or the Keyring API v2 instead.\n * @param chainId - The chain ID to filter the accounts.\n * @returns The last selected account compatible with the specified chain ID or undefined.\n */\nexport type AccountsControllerGetSelectedMultichainAccountAction = {\n type: `AccountsController:getSelectedMultichainAccount`;\n handler: AccountsController['getSelectedMultichainAccount'];\n};\n\n/**\n * Returns the account with the specified address.\n * ! This method will only return the first account that matches the address\n *\n * @deprecated This method is deprecated and will be removed in a future version.\n * Use `AccountTreeController`, `MultichainAccountService`, or the Keyring API v2 instead.\n * @param address - The address of the account to retrieve.\n * @returns The account with the specified address, or undefined if not found.\n */\nexport type AccountsControllerGetAccountByAddressAction = {\n type: `AccountsController:getAccountByAddress`;\n handler: AccountsController['getAccountByAddress'];\n};\n\n/**\n * Sets the selected account by its ID.\n *\n * @deprecated This method is deprecated and will be removed in a future version.\n * Use `AccountTreeController`, `MultichainAccountService`, or the Keyring API v2 instead.\n * @param accountId - The ID of the account to be selected.\n */\nexport type AccountsControllerSetSelectedAccountAction = {\n type: `AccountsController:setSelectedAccount`;\n handler: AccountsController['setSelectedAccount'];\n};\n\n/**\n * Sets the name of the account with the given ID.\n *\n * @deprecated This method is deprecated and will be removed in a future version.\n * Use `AccountTreeController`, `MultichainAccountService`, or the Keyring API v2 instead.\n * @param accountId - The ID of the account to set the name for.\n * @param accountName - The new name for the account.\n * @throws An error if an account with the same name already exists.\n */\nexport type AccountsControllerSetAccountNameAction = {\n type: `AccountsController:setAccountName`;\n handler: AccountsController['setAccountName'];\n};\n\n/**\n * Sets the name of the account with the given ID and select it.\n *\n * @deprecated This method is deprecated and will be removed in a future version.\n * Use `AccountTreeController`, `MultichainAccountService`, or the Keyring API v2 instead.\n * @param accountId - The ID of the account to set the name for and select.\n * @param accountName - The new name for the account.\n * @throws An error if an account with the same name already exists.\n */\nexport type AccountsControllerSetAccountNameAndSelectAccountAction = {\n type: `AccountsController:setAccountNameAndSelectAccount`;\n handler: AccountsController['setAccountNameAndSelectAccount'];\n};\n\n/**\n * Updates the metadata of the account with the given ID.\n *\n * @deprecated This method is deprecated and will be removed in a future version.\n * Use `AccountTreeController`, `MultichainAccountService`, or the Keyring API v2 instead.\n * @param accountId - The ID of the account for which the metadata will be updated.\n * @param metadata - The new metadata for the account.\n */\nexport type AccountsControllerUpdateAccountMetadataAction = {\n type: `AccountsController:updateAccountMetadata`;\n handler: AccountsController['updateAccountMetadata'];\n};\n\n/**\n * Updates the internal accounts list by retrieving normal and snap accounts,\n * removing duplicates, and updating the metadata of each account.\n *\n * @deprecated This method is deprecated and will be removed in a future version.\n * Use `AccountTreeController`, `MultichainAccountService`, or the Keyring API v2 instead.\n * @returns A Promise that resolves when the accounts have been updated.\n */\nexport type AccountsControllerUpdateAccountsAction = {\n type: `AccountsController:updateAccounts`;\n handler: AccountsController['updateAccounts'];\n};\n\n/**\n * Loads the backup state of the accounts controller.\n *\n * @deprecated This method is deprecated and will be removed in a future version.\n * Use `AccountTreeController`, `MultichainAccountService`, or the Keyring API v2 instead.\n * @param backup - The backup state to load.\n */\nexport type AccountsControllerLoadBackupAction = {\n type: `AccountsController:loadBackup`;\n handler: AccountsController['loadBackup'];\n};\n\n/**\n * Union of all AccountsController action types.\n */\nexport type AccountsControllerMethodActions =\n | AccountsControllerGetAccountAction\n | AccountsControllerGetAccountsAction\n | AccountsControllerListAccountsAction\n | AccountsControllerListMultichainAccountsAction\n | AccountsControllerGetSelectedAccountAction\n | AccountsControllerGetSelectedMultichainAccountAction\n | AccountsControllerGetAccountByAddressAction\n | AccountsControllerSetSelectedAccountAction\n | AccountsControllerSetAccountNameAction\n | AccountsControllerSetAccountNameAndSelectAccountAction\n | AccountsControllerUpdateAccountMetadataAction\n | AccountsControllerUpdateAccountsAction\n | AccountsControllerLoadBackupAction;\n"]}
|
|
@@ -4,7 +4,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
4
4
|
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");
|
|
5
5
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
6
6
|
};
|
|
7
|
-
var _AccountsController_instances, _AccountsController_assertAccountCanBeRenamed, _AccountsController_getInternalAccountForNonSnapAccount, _AccountsController_getSnapKeyring, _AccountsController_handleOnSnapKeyringAccountEvent, _AccountsController_handleOnKeyringStateChange, _AccountsController_update, _AccountsController_handleOnSnapStateChange, _AccountsController_getLastSelectedAccount, _AccountsController_getLastSelectedIndex, _AccountsController_getInternalAccountFromAddressAndType, _AccountsController_handleOnMultichainNetworkDidChange, _AccountsController_subscribeToMessageEvents
|
|
7
|
+
var _AccountsController_instances, _AccountsController_getAccountExpect, _AccountsController_assertAccountCanBeRenamed, _AccountsController_getInternalAccountForNonSnapAccount, _AccountsController_getSnapKeyring, _AccountsController_handleOnSnapKeyringAccountEvent, _AccountsController_handleOnKeyringStateChange, _AccountsController_update, _AccountsController_handleOnSnapStateChange, _AccountsController_getLastSelectedAccount, _AccountsController_getLastSelectedIndex, _AccountsController_getInternalAccountFromAddressAndType, _AccountsController_handleOnMultichainNetworkDidChange, _AccountsController_subscribeToMessageEvents;
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.AccountsController = exports.EMPTY_ACCOUNT = void 0;
|
|
10
10
|
const base_controller_1 = require("@metamask/base-controller");
|
|
@@ -15,6 +15,21 @@ const utils_1 = require("@metamask/utils");
|
|
|
15
15
|
const lodash_1 = require("lodash");
|
|
16
16
|
const utils_2 = require("./utils.cjs");
|
|
17
17
|
const controllerName = 'AccountsController';
|
|
18
|
+
const MESSENGER_EXPOSED_METHODS = [
|
|
19
|
+
'setSelectedAccount',
|
|
20
|
+
'setAccountName',
|
|
21
|
+
'setAccountNameAndSelectAccount',
|
|
22
|
+
'listAccounts',
|
|
23
|
+
'listMultichainAccounts',
|
|
24
|
+
'updateAccounts',
|
|
25
|
+
'getSelectedAccount',
|
|
26
|
+
'getSelectedMultichainAccount',
|
|
27
|
+
'getAccountByAddress',
|
|
28
|
+
'getAccount',
|
|
29
|
+
'getAccounts',
|
|
30
|
+
'updateAccountMetadata',
|
|
31
|
+
'loadBackup',
|
|
32
|
+
];
|
|
18
33
|
const accountsControllerMetadata = {
|
|
19
34
|
internalAccounts: {
|
|
20
35
|
includeInStateLogs: true,
|
|
@@ -77,8 +92,8 @@ class AccountsController extends base_controller_1.BaseController {
|
|
|
77
92
|
},
|
|
78
93
|
});
|
|
79
94
|
_AccountsController_instances.add(this);
|
|
95
|
+
this.messenger.registerMethodActionHandlers(this, MESSENGER_EXPOSED_METHODS);
|
|
80
96
|
__classPrivateFieldGet(this, _AccountsController_instances, "m", _AccountsController_subscribeToMessageEvents).call(this);
|
|
81
|
-
__classPrivateFieldGet(this, _AccountsController_instances, "m", _AccountsController_registerMessageHandlers).call(this);
|
|
82
97
|
}
|
|
83
98
|
/**
|
|
84
99
|
* Returns the internal account object for the given account ID, if it exists.
|
|
@@ -131,22 +146,6 @@ class AccountsController extends base_controller_1.BaseController {
|
|
|
131
146
|
}
|
|
132
147
|
return accounts.filter((account) => (0, keyring_utils_1.isScopeEqualToAny)(chainId, account.scopes));
|
|
133
148
|
}
|
|
134
|
-
/**
|
|
135
|
-
* Returns the internal account object for the given account ID.
|
|
136
|
-
*
|
|
137
|
-
* @deprecated This method is deprecated and will be removed in a future version.
|
|
138
|
-
* Use `AccountTreeController`, `MultichainAccountService`, or the Keyring API v2 instead.
|
|
139
|
-
* @param accountId - The ID of the account to retrieve.
|
|
140
|
-
* @returns The internal account object.
|
|
141
|
-
* @throws An error if the account ID is not found.
|
|
142
|
-
*/
|
|
143
|
-
getAccountExpect(accountId) {
|
|
144
|
-
const account = this.getAccount(accountId);
|
|
145
|
-
if (account === undefined) {
|
|
146
|
-
throw new Error(`Account Id "${accountId}" not found`);
|
|
147
|
-
}
|
|
148
|
-
return account;
|
|
149
|
-
}
|
|
150
149
|
/**
|
|
151
150
|
* Returns the last selected EVM account.
|
|
152
151
|
*
|
|
@@ -161,7 +160,7 @@ class AccountsController extends base_controller_1.BaseController {
|
|
|
161
160
|
if (selectedAccount === '') {
|
|
162
161
|
return exports.EMPTY_ACCOUNT;
|
|
163
162
|
}
|
|
164
|
-
const account = this.
|
|
163
|
+
const account = __classPrivateFieldGet(this, _AccountsController_instances, "m", _AccountsController_getAccountExpect).call(this, selectedAccount);
|
|
165
164
|
if ((0, keyring_api_1.isEvmAccountType)(account.type)) {
|
|
166
165
|
return account;
|
|
167
166
|
}
|
|
@@ -192,7 +191,7 @@ class AccountsController extends base_controller_1.BaseController {
|
|
|
192
191
|
return exports.EMPTY_ACCOUNT;
|
|
193
192
|
}
|
|
194
193
|
if (!chainId) {
|
|
195
|
-
return this.
|
|
194
|
+
return __classPrivateFieldGet(this, _AccountsController_instances, "m", _AccountsController_getAccountExpect).call(this, selectedAccount);
|
|
196
195
|
}
|
|
197
196
|
const accounts = this.listMultichainAccounts(chainId);
|
|
198
197
|
return __classPrivateFieldGet(this, _AccountsController_instances, "m", _AccountsController_getLastSelectedAccount).call(this, accounts);
|
|
@@ -217,7 +216,7 @@ class AccountsController extends base_controller_1.BaseController {
|
|
|
217
216
|
* @param accountId - The ID of the account to be selected.
|
|
218
217
|
*/
|
|
219
218
|
setSelectedAccount(accountId) {
|
|
220
|
-
const account = this.
|
|
219
|
+
const account = __classPrivateFieldGet(this, _AccountsController_instances, "m", _AccountsController_getAccountExpect).call(this, accountId);
|
|
221
220
|
if (this.state.internalAccounts.selectedAccount === account.id) {
|
|
222
221
|
return;
|
|
223
222
|
}
|
|
@@ -254,7 +253,7 @@ class AccountsController extends base_controller_1.BaseController {
|
|
|
254
253
|
* @throws An error if an account with the same name already exists.
|
|
255
254
|
*/
|
|
256
255
|
setAccountNameAndSelectAccount(accountId, accountName) {
|
|
257
|
-
const account = this.
|
|
256
|
+
const account = __classPrivateFieldGet(this, _AccountsController_instances, "m", _AccountsController_getAccountExpect).call(this, accountId);
|
|
258
257
|
__classPrivateFieldGet(this, _AccountsController_instances, "m", _AccountsController_assertAccountCanBeRenamed).call(this, account, accountName);
|
|
259
258
|
const internalAccount = {
|
|
260
259
|
...account,
|
|
@@ -280,7 +279,7 @@ class AccountsController extends base_controller_1.BaseController {
|
|
|
280
279
|
* @param metadata - The new metadata for the account.
|
|
281
280
|
*/
|
|
282
281
|
updateAccountMetadata(accountId, metadata) {
|
|
283
|
-
const account = this.
|
|
282
|
+
const account = __classPrivateFieldGet(this, _AccountsController_instances, "m", _AccountsController_getAccountExpect).call(this, accountId);
|
|
284
283
|
if (metadata.name) {
|
|
285
284
|
__classPrivateFieldGet(this, _AccountsController_instances, "m", _AccountsController_assertAccountCanBeRenamed).call(this, account, metadata.name);
|
|
286
285
|
}
|
|
@@ -357,7 +356,13 @@ class AccountsController extends base_controller_1.BaseController {
|
|
|
357
356
|
}
|
|
358
357
|
}
|
|
359
358
|
exports.AccountsController = AccountsController;
|
|
360
|
-
_AccountsController_instances = new WeakSet(),
|
|
359
|
+
_AccountsController_instances = new WeakSet(), _AccountsController_getAccountExpect = function _AccountsController_getAccountExpect(accountId) {
|
|
360
|
+
const account = this.getAccount(accountId);
|
|
361
|
+
if (account === undefined) {
|
|
362
|
+
throw new Error(`Account Id "${accountId}" not found`);
|
|
363
|
+
}
|
|
364
|
+
return account;
|
|
365
|
+
}, _AccountsController_assertAccountCanBeRenamed = function _AccountsController_assertAccountCanBeRenamed(account, accountName) {
|
|
361
366
|
if (this.listMultichainAccounts().find((internalAccount) => internalAccount.metadata.name === accountName &&
|
|
362
367
|
internalAccount.id !== account.id)) {
|
|
363
368
|
throw new Error('Account name already exists');
|
|
@@ -694,18 +699,5 @@ _AccountsController_instances = new WeakSet(), _AccountsController_assertAccount
|
|
|
694
699
|
this.messenger.subscribe('SnapKeyring:accountTransactionsUpdated', (snapAccountEvent) => __classPrivateFieldGet(this, _AccountsController_instances, "m", _AccountsController_handleOnSnapKeyringAccountEvent).call(this, 'AccountsController:accountTransactionsUpdated', snapAccountEvent));
|
|
695
700
|
// Handle account change when multichain network is changed
|
|
696
701
|
this.messenger.subscribe('MultichainNetworkController:networkDidChange', (id) => __classPrivateFieldGet(this, _AccountsController_instances, "m", _AccountsController_handleOnMultichainNetworkDidChange).call(this, id));
|
|
697
|
-
}, _AccountsController_registerMessageHandlers = function _AccountsController_registerMessageHandlers() {
|
|
698
|
-
this.messenger.registerActionHandler(`${controllerName}:setSelectedAccount`, this.setSelectedAccount.bind(this));
|
|
699
|
-
this.messenger.registerActionHandler(`${controllerName}:listAccounts`, this.listAccounts.bind(this));
|
|
700
|
-
this.messenger.registerActionHandler(`${controllerName}:listMultichainAccounts`, this.listMultichainAccounts.bind(this));
|
|
701
|
-
this.messenger.registerActionHandler(`${controllerName}:setAccountName`, this.setAccountName.bind(this));
|
|
702
|
-
this.messenger.registerActionHandler(`${controllerName}:setAccountNameAndSelectAccount`, this.setAccountNameAndSelectAccount.bind(this));
|
|
703
|
-
this.messenger.registerActionHandler(`${controllerName}:updateAccounts`, this.updateAccounts.bind(this));
|
|
704
|
-
this.messenger.registerActionHandler(`${controllerName}:getSelectedAccount`, this.getSelectedAccount.bind(this));
|
|
705
|
-
this.messenger.registerActionHandler(`${controllerName}:getSelectedMultichainAccount`, this.getSelectedMultichainAccount.bind(this));
|
|
706
|
-
this.messenger.registerActionHandler(`${controllerName}:getAccountByAddress`, this.getAccountByAddress.bind(this));
|
|
707
|
-
this.messenger.registerActionHandler(`AccountsController:getAccount`, this.getAccount.bind(this));
|
|
708
|
-
this.messenger.registerActionHandler(`AccountsController:getAccounts`, this.getAccounts.bind(this));
|
|
709
|
-
this.messenger.registerActionHandler(`AccountsController:updateAccountMetadata`, this.updateAccountMetadata.bind(this));
|
|
710
702
|
};
|
|
711
703
|
//# sourceMappingURL=AccountsController.cjs.map
|