-
-
Notifications
You must be signed in to change notification settings - Fork 225
feat: enhance account name generation for multichain accounts #5382
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
ab5de2b
to
95a6811
Compare
@metamaskbot publish-preview |
Preview builds have been published. See these instructions for more information about preview builds. Expand for full list of packages and versions.
|
95a6811
to
def92ff
Compare
@metamaskbot publish-preview |
Preview builds have been published. See these instructions for more information about preview builds. Expand for full list of packages and versions.
|
def92ff
to
9882740
Compare
No dependency changes detected. Learn more about Socket for GitHub ↗︎ 👍 No dependency changes detected in pull request |
509bc9d
to
5547897
Compare
c348f27
to
edbe12d
Compare
@metamaskbot publish-preview |
Preview builds have been published. See these instructions for more information about preview builds. Expand for full list of packages and versions.
|
Explanation
This PR updates the
getNextAvailableAccountName
function in the AccountsController to change the way new acocunts is generated, allowing to support Solana and Bitcoin accounts names generation. It makesgetNextAvailableAccountName
function parameter optional with a default value of KeyringTypes.hd.New Account Naming Rules:
Calculate the Number of Accounts:
Accounts are named using the format: prefix + "Account" + Account number.
The Account number is determined by summing the following:
All eth-hd-keyring accounts.
All simple keyring accounts.
All snap accounts that have an account.options.entropySource referring to an eth-hd-keyring.
Add 1 to the total sum.
Check the Highest Existing Account Number:
Identify the highest Account number currently in the state that starts with Account, Solana Account, or Bitcoin Account.
Determine the Higher Number:
References
Jira ricket
Changelog
@metamask/accounts-controller
getNextAvailableAccountName
parameter single, optional property with default KeyringTypes.hdgetNextAvailableAccountName
follows different logic of name generationChecklist