@metamask/accounts-controller 39.0.5 → 39.0.6
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 +10 -1
- package/LICENSE +1 -0
- package/dist/AccountsController-method-action-types.cjs.map +1 -1
- package/dist/AccountsController-method-action-types.d.cts.map +1 -1
- package/dist/AccountsController-method-action-types.d.mts.map +1 -1
- package/dist/AccountsController-method-action-types.mjs.map +1 -1
- package/dist/AccountsController.cjs +20 -20
- package/dist/AccountsController.cjs.map +1 -1
- package/dist/AccountsController.d.cts.map +1 -1
- package/dist/AccountsController.d.mts.map +1 -1
- package/dist/AccountsController.mjs.map +1 -1
- package/dist/index.cjs +8 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs.map +1 -1
- package/dist/typing.cjs.map +1 -1
- package/dist/typing.d.cts.map +1 -1
- package/dist/typing.d.mts.map +1 -1
- package/dist/typing.mjs.map +1 -1
- package/dist/utils.cjs.map +1 -1
- package/dist/utils.d.cts.map +1 -1
- package/dist/utils.d.mts.map +1 -1
- package/dist/utils.mjs.map +1 -1
- package/package.json +11 -9
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [39.0.6]
|
|
11
|
+
|
|
12
|
+
### Changed
|
|
13
|
+
|
|
14
|
+
- Bump `@metamask/keyring-api` from `^23.5.0` to `^23.7.0` ([#9676](https://github.com/MetaMask/core/pull/9676))
|
|
15
|
+
- Bump `@metamask/keyring-internal-api` from `^11.0.1` to `^11.0.2` ([#9676](https://github.com/MetaMask/core/pull/9676))
|
|
16
|
+
- Bump `@metamask/network-controller` from `^34.0.0` to `^35.0.0` ([#9735](https://github.com/MetaMask/core/pull/9735))
|
|
17
|
+
|
|
10
18
|
## [39.0.5]
|
|
11
19
|
|
|
12
20
|
### Changed
|
|
@@ -855,7 +863,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
855
863
|
|
|
856
864
|
- Initial release ([#1637](https://github.com/MetaMask/core/pull/1637))
|
|
857
865
|
|
|
858
|
-
[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/accounts-controller@39.0.
|
|
866
|
+
[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/accounts-controller@39.0.6...HEAD
|
|
867
|
+
[39.0.6]: https://github.com/MetaMask/core/compare/@metamask/accounts-controller@39.0.5...@metamask/accounts-controller@39.0.6
|
|
859
868
|
[39.0.5]: https://github.com/MetaMask/core/compare/@metamask/accounts-controller@39.0.4...@metamask/accounts-controller@39.0.5
|
|
860
869
|
[39.0.4]: https://github.com/MetaMask/core/compare/@metamask/accounts-controller@39.0.3...@metamask/accounts-controller@39.0.4
|
|
861
870
|
[39.0.3]: https://github.com/MetaMask/core/compare/@metamask/accounts-controller@39.0.2...@metamask/accounts-controller@39.0.3
|
package/LICENSE
CHANGED
|
@@ -18,3 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
18
18
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
19
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
20
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -1 +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.\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"]}
|
|
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.\n * Do not edit manually.\n */\n\nimport type { AccountsController } from './AccountsController.js';\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"]}
|
|
@@ -1 +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,
|
|
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,iCAAgC;AAElE;;;;;;;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"}
|
|
@@ -1 +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,
|
|
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,iCAAgC;AAElE;;;;;;;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"}
|
|
@@ -1 +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.\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"]}
|
|
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.\n * Do not edit manually.\n */\n\nimport type { AccountsController } from './AccountsController.js';\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"]}
|
|
@@ -16,8 +16,8 @@ const v2_3 = require("@metamask/keyring-sdk/v2");
|
|
|
16
16
|
const keyring_utils_1 = require("@metamask/keyring-utils");
|
|
17
17
|
const utils_1 = require("@metamask/utils");
|
|
18
18
|
const lodash_1 = require("lodash");
|
|
19
|
-
const
|
|
20
|
-
const
|
|
19
|
+
const logger_js_1 = require("./logger.cjs");
|
|
20
|
+
const utils_js_1 = require("./utils.cjs");
|
|
21
21
|
const controllerName = 'AccountsController';
|
|
22
22
|
const MESSENGER_EXPOSED_METHODS = [
|
|
23
23
|
'setSelectedAccount',
|
|
@@ -93,7 +93,7 @@ class AccountsController extends base_controller_1.BaseController {
|
|
|
93
93
|
* @param options.state - Initial state to set on this controller
|
|
94
94
|
*/
|
|
95
95
|
constructor({ messenger, state, }) {
|
|
96
|
-
const accountIdByAddress = (0,
|
|
96
|
+
const accountIdByAddress = (0, utils_js_1.constructAccountIdByAddress)(state?.internalAccounts?.accounts ?? {});
|
|
97
97
|
super({
|
|
98
98
|
messenger,
|
|
99
99
|
name: controllerName,
|
|
@@ -230,7 +230,7 @@ class AccountsController extends base_controller_1.BaseController {
|
|
|
230
230
|
const lowercasedAddress = address.toLowerCase();
|
|
231
231
|
accountId = this.state.accountIdByAddress[lowercasedAddress];
|
|
232
232
|
if (accountId) {
|
|
233
|
-
(0,
|
|
233
|
+
(0, logger_js_1.projectLogger)(`Cache missed for account ID: ${accountId}, received address: "${address}", matched address: "${lowercasedAddress}"`);
|
|
234
234
|
}
|
|
235
235
|
}
|
|
236
236
|
return accountId ? this.getAccount(accountId) : undefined;
|
|
@@ -330,7 +330,7 @@ class AccountsController extends base_controller_1.BaseController {
|
|
|
330
330
|
* @returns A Promise that resolves when the accounts have been updated.
|
|
331
331
|
*/
|
|
332
332
|
async updateAccounts() {
|
|
333
|
-
(0,
|
|
333
|
+
(0, logger_js_1.projectLogger)('Synchronizing accounts with keyrings...');
|
|
334
334
|
const keyringAccountIndexes = new Map();
|
|
335
335
|
const existingInternalAccounts = this.state.internalAccounts.accounts;
|
|
336
336
|
const internalAccounts = {};
|
|
@@ -338,10 +338,10 @@ class AccountsController extends base_controller_1.BaseController {
|
|
|
338
338
|
for (const keyring of keyrings) {
|
|
339
339
|
// Money accounts are not treated as real accounts, they are owned by the `MoneyAccountController`, so
|
|
340
340
|
// we need to filter them out here.
|
|
341
|
-
if ((0,
|
|
341
|
+
if ((0, utils_js_1.isMoneyKeyringType)(keyring.type)) {
|
|
342
342
|
continue;
|
|
343
343
|
}
|
|
344
|
-
const keyringTypeName = (0,
|
|
344
|
+
const keyringTypeName = (0, utils_js_1.keyringTypeToName)(keyring.type);
|
|
345
345
|
for (const address of keyring.accounts) {
|
|
346
346
|
const internalAccount = __classPrivateFieldGet(this, _AccountsController_instances, "m", _AccountsController_getInternalAccountFromAddressAndType).call(this, address, keyring);
|
|
347
347
|
// This should never really happen, but if for some reason we're not
|
|
@@ -371,9 +371,9 @@ class AccountsController extends base_controller_1.BaseController {
|
|
|
371
371
|
}
|
|
372
372
|
__classPrivateFieldGet(this, _AccountsController_instances, "m", _AccountsController_update).call(this, (state) => {
|
|
373
373
|
state.internalAccounts.accounts = internalAccounts;
|
|
374
|
-
state.accountIdByAddress = (0,
|
|
374
|
+
state.accountIdByAddress = (0, utils_js_1.constructAccountIdByAddress)(internalAccounts);
|
|
375
375
|
});
|
|
376
|
-
(0,
|
|
376
|
+
(0, logger_js_1.projectLogger)('Accounts synchronized!');
|
|
377
377
|
}
|
|
378
378
|
/**
|
|
379
379
|
* Loads the backup state of the accounts controller.
|
|
@@ -384,7 +384,7 @@ class AccountsController extends base_controller_1.BaseController {
|
|
|
384
384
|
*/
|
|
385
385
|
loadBackup(backup) {
|
|
386
386
|
if (backup.internalAccounts) {
|
|
387
|
-
const accountIdByAddress = (0,
|
|
387
|
+
const accountIdByAddress = (0, utils_js_1.constructAccountIdByAddress)(backup.internalAccounts.accounts);
|
|
388
388
|
this.update((currentState) => {
|
|
389
389
|
currentState.internalAccounts = backup.internalAccounts;
|
|
390
390
|
currentState.accountIdByAddress = accountIdByAddress;
|
|
@@ -405,7 +405,7 @@ _AccountsController_instances = new WeakSet(), _AccountsController_getAccountExp
|
|
|
405
405
|
throw new Error('Account name already exists');
|
|
406
406
|
}
|
|
407
407
|
}, _AccountsController_getInternalAccountForNonSnapAccount = function _AccountsController_getInternalAccountForNonSnapAccount(address, keyring) {
|
|
408
|
-
const id = (0,
|
|
408
|
+
const id = (0, utils_js_1.getUUIDFromAddressOfNormalAccount)(address);
|
|
409
409
|
// We might have an account for this ID already, so we'll just re-use
|
|
410
410
|
// the same metadata
|
|
411
411
|
const account = this.getAccount(id);
|
|
@@ -423,9 +423,9 @@ _AccountsController_instances = new WeakSet(), _AccountsController_getAccountExp
|
|
|
423
423
|
},
|
|
424
424
|
};
|
|
425
425
|
let options = {};
|
|
426
|
-
if ((0,
|
|
426
|
+
if ((0, utils_js_1.isHdKeyringType)(keyring.type)) {
|
|
427
427
|
// We need to find the account index from its HD keyring.
|
|
428
|
-
const groupIndex = (0,
|
|
428
|
+
const groupIndex = (0, utils_js_1.getEvmGroupIndexFromAddressIndex)(keyring, address);
|
|
429
429
|
// If for some reason, we cannot find this address, then the caller made a mistake
|
|
430
430
|
// and it did not use the proper keyring object. For now, we do not fail and just
|
|
431
431
|
// consider this account as "simple account".
|
|
@@ -433,7 +433,7 @@ _AccountsController_instances = new WeakSet(), _AccountsController_getAccountExp
|
|
|
433
433
|
// NOTE: We are not using the `hdPath` from the associated keyring here and
|
|
434
434
|
// getting the keyring instance here feels a bit overkill.
|
|
435
435
|
// This will be naturally fixed once every keyring start using `KeyringAccount` and implement the keyring API.
|
|
436
|
-
const derivationPath = (0,
|
|
436
|
+
const derivationPath = (0, utils_js_1.getEvmDerivationPathForIndex)(groupIndex);
|
|
437
437
|
// Those are "legacy options" and they were used before `KeyringAccount` added
|
|
438
438
|
// support for type options. We keep those temporarily until we update everything
|
|
439
439
|
// to use the new typed options.
|
|
@@ -532,7 +532,7 @@ _AccountsController_instances = new WeakSet(), _AccountsController_getAccountExp
|
|
|
532
532
|
if (!isUnlocked || keyrings.length === 0) {
|
|
533
533
|
return;
|
|
534
534
|
}
|
|
535
|
-
(0,
|
|
535
|
+
(0, logger_js_1.projectLogger)('Synchronizing accounts with keyrings (through :stateChange)...');
|
|
536
536
|
// State patches.
|
|
537
537
|
const patch = {
|
|
538
538
|
previous: {},
|
|
@@ -550,7 +550,7 @@ _AccountsController_instances = new WeakSet(), _AccountsController_getAccountExp
|
|
|
550
550
|
for (const keyring of keyrings) {
|
|
551
551
|
// Money accounts are not treated as real accounts, they are owned by the `MoneyAccountController`, so
|
|
552
552
|
// we need to filter them out here.
|
|
553
|
-
if ((0,
|
|
553
|
+
if ((0, utils_js_1.isMoneyKeyringType)(keyring.type)) {
|
|
554
554
|
continue;
|
|
555
555
|
}
|
|
556
556
|
for (const accountAddress of keyring.accounts) {
|
|
@@ -628,7 +628,7 @@ _AccountsController_instances = new WeakSet(), _AccountsController_getAccountExp
|
|
|
628
628
|
this.messenger.publish('AccountsController:accountsAdded', diff.added);
|
|
629
629
|
}
|
|
630
630
|
});
|
|
631
|
-
(0,
|
|
631
|
+
(0, logger_js_1.projectLogger)('Accounts synchronized (through :stateChange)!');
|
|
632
632
|
// NOTE: Since we also track "updated" accounts with our patches, we could fire a new event
|
|
633
633
|
// like `accountUpdated` (we would still need to check if anything really changed on the account).
|
|
634
634
|
}, _AccountsController_update = function _AccountsController_update(callback, beforeAutoSelectAccount) {
|
|
@@ -680,8 +680,8 @@ _AccountsController_instances = new WeakSet(), _AccountsController_getAccountExp
|
|
|
680
680
|
// will always be higher than any already selected account index.
|
|
681
681
|
return Date.now();
|
|
682
682
|
}, _AccountsController_getInternalAccountFromAddressAndType = function _AccountsController_getInternalAccountFromAddressAndType(address, keyring) {
|
|
683
|
-
const isSnapKeyringV1 = (0,
|
|
684
|
-
const isSnapKeyringV2 = (0,
|
|
683
|
+
const isSnapKeyringV1 = (0, utils_js_1.isSnapKeyringType)(keyring.type);
|
|
684
|
+
const isSnapKeyringV2 = (0, utils_js_1.isSnapKeyringV2Type)(keyring.type);
|
|
685
685
|
if (isSnapKeyringV1 || isSnapKeyringV2) {
|
|
686
686
|
let account;
|
|
687
687
|
if (isSnapKeyringV1) {
|
|
@@ -697,7 +697,7 @@ _AccountsController_instances = new WeakSet(), _AccountsController_getAccountExp
|
|
|
697
697
|
// just "adding" the new typed options that we need for multichain
|
|
698
698
|
// accounts. Ultimately, we would need a real Snap account migrations
|
|
699
699
|
// (being handled by each Snaps).
|
|
700
|
-
if ((0,
|
|
700
|
+
if ((0, utils_js_1.isHdSnapKeyringAccount)(account)) {
|
|
701
701
|
const options = {
|
|
702
702
|
...account.options,
|
|
703
703
|
entropy: {
|