Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: custom names for snap accounts (Flask only) (#12198)
## **Description** This PR allows enables the following... 1. Keyring snaps to suggest account names 2. Users to set custom account names during the snap account creation flow 3. deny adding an account This will be used to create Bitcoin accounts in the future. Equivalent extension PR: MetaMask/metamask-extension#25191 ## **Related issues** Fixes: MetaMask/accounts-planning#604 ## **Manual testing steps** 1. open `.js.env` in your editor and set `export METAMASK_BUILD_TYPE="flask"` 2. run the app and build the create a wallet 3. in the in app browser open this url: https://metamask.github.io/snap-simple-keyring/latest/ 4. click connect and approve the permissions and install confirmation 5. now that you are connected, click the create account button in the dapp 6. EXPECT: a popup with the suggested account name should appear. Assuming this is your first snap account the suggested name should be `SSK Account` 7. click `Add account` 8. EXPECT: `SSK Account` should be added to the account list in the wallet view and be the currently selected account. 9. navigate back to the browser and click the create account button again. 10. EXPECT: a new popup should appear with the suggested name being `SSK Account 1` 11. If you remove the `1` from `SSK Account 1` you should see a an error popup on the screen saying `This account name already exists` AND the `Add account` button should be disabled. 12. Change the text input value to something unique and click `Add account` 13. again this account should be added to the wallet and set as the currently selected account. #### Testing Add account denial 1. open `.js.env` in your editor and set `export METAMASK_BUILD_TYPE="flask"` 2. run the app and build the create a wallet 3. in the in app browser open this url: https://metamask.github.io/snap-simple-keyring/latest/ 4. click connect and approve the permissions and install confirmation 5. now that you are connected, click the create account button in the dapp 6. EXPECT: a popup with the suggested account name should appear 7. click cancel 8. EXPECT: the an error should appear in the SSK dapp indicating that the user denied the account creation and the account should not have been added to metamask. ## **Screenshots/Recordings** Extension version <img width="363" alt="Screenshot 2024-11-06 at 3 47 12 PM" src="https://github.com/user-attachments/assets/2a73fd12-bdba-425c-87ef-d98e1b0e1307"> Mobile: <img width="363" alt="Screenshot 2024-11-06 at 3 47 12 PM" src="https://github.com/user-attachments/assets/7934e7fe-4575-4ee6-af99-6950c070087c"> ### **Before** https://github.com/user-attachments/assets/2f8dbdfd-92bc-4a68-8e19-68b295e67f88 ### **After** https://github.com/user-attachments/assets/1139fa9f-af31-497d-9680-c71f5abd1a84 ## **Pre-merge author checklist** - [ ] I’ve followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile Coding Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md). - [ ] I've completed the PR template to the best of my ability - [ ] I’ve included tests if applicable - [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [ ] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **Pre-merge reviewer checklist** - [ ] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed). - [ ] I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots. --------- Co-authored-by: Daniel Cross <dan.s.cross@icloud.com>
- Loading branch information