MetaMask / MetaMask/metamask-extension
Add token selecting API
- Dominant language
- TypeScript
- Stars
- 13.2k
- Forks
- 5.6k
- Avg merge
- 2d 5h
- Merged PRs (30d)
- 451
Description
Sometimes an app might want a user to specify a token they want to use. For example:
- An exchange might want to know what token a user wants to sell.
- A bounty app might want to know what token the user wants to offer as the fee.
Many tokens may not be auto-detected by MetaMask (especially in a very pluralistic token future), and so an API for a site to ask for a token, and for a user to reply from their current token list would be useful.
Sample API pseudo-code:
```javascript
const tokenDetails = await ethereum.send({
method: 'wallet_requestToken',
params: ['Please choose a token to post a bounty with.'], // The declared usage
})
```
The user would then be shown a menu of their current tokens, and asked to choose one, with the provided text as prompt. That token's address and metadata would be returned to the app as `tokenDetails`.
Contributor guide
Research direction
The issue names no files, tests, or implementation entry points. Start by locating the extension's provider API handling and token-list UI, then compare the proposed wallet_requestToken flow with existing wallet methods; done means a site can request a token with a prompt and receive its address and metadata after user selection.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- api
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100