MetaMask / MetaMask/core

Create ADR for keyring to allow adding an account non-sequentially

Open
#5,154 1 comment 0 reactions 0 assignees View on GitHub
Epic team-wallet-framework wf-keyring
Dominant language
TypeScript
Stars
413
Forks
308
Avg merge
1d 4h
Merged PRs (30d)
253

Description

Currently, our [Keyring type](https://github.com/MetaMask/utils/blob/main/src/keyring.ts) only allows adding new accounts sequentially, or more specifically, does not provide a standardized way to specify which index (or even derivation path) should be used to derive the next available account.

This is fine for our current hierarchical deterministic wallet mechanics as users are only allowed to derive sequential indexes, but presents a limit for hardware device interactions since:
- Users can preview the derivable accounts in a paginated manner
- Users can select specific indexes to derive, which are not required to be sequential

This limitation is currently worked around by clients, that interact directly with each keyring that is _known_ to support specific methods to handle pagination and to set derivation path index, but it would be nice to have a standard way to support this (e.g. through new methods on the shared Keyring type or by creating a pagination helper wrapper)

We should propose a solution to this problem through an ADR.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with src/keyring.ts and review how the current Keyring type represents sequential account derivation. Then document a proposed standard for selecting non-sequential indexes or derivation paths, considering the pagination and hardware-device constraints described here. Done means the ADR clearly records the problem, alternatives, and recommended approach.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
documentation
Issue type
Documentation
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.