-
Notifications
You must be signed in to change notification settings - Fork 5.3k
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
New Web3 Provider Method: eth_watchToken #747
Comments
This would be a useful convenience function. Practically speaking, in the workaday life of an Ethereum developer, we're dealing with ERC-20 tokens a lot these days. |
If this is to be implemented, it would need some changes: Type might not be implemented in web3 browsers, but should really be considered as it would allow thin clients to provide different functionality based on used token standard. |
This seems too high level for an RPC method. The node (which is what the RPC communicates with, not the browser) shouldn't have to care about tokens. |
I mostly agree
@Arachnid this is incorrect. The dapp uses rpc to talk to the node (data lookups) and the browser (identity mgmt) |
@mickys you listed token type -- what types are there? |
@kumavis Back to the "eth_watchToken" metod, i would personally like to see this implemented in a smart contract rather than a RPC method. As that would also allow contracts to use it for validation. |
@kumavis why would the dapp need an rpc to communicate with the browser? It can do that directly via js. |
@Arachnid asked:
Sorry for replying slow, this isn't a very urgent proposal. I'm not actually proposing a new RPC method, never once said "RPC" in the original post. Currently, the JS interface actually uses an API (the Ethereum Provider API, poorly documented) that passes very RPC-looking strings to their data provider (wallet). Something like:
In this context, I am not suggesting RPC providers implement By being on the It's unfortunate that we basically have to have this conversation whenever trying to iterate on the JS API, I'll try to write a general distinction post at some point and start linking to it when proposing provider (not RPC) changes. |
Adding a new token can be quite a hassle for new users. By taking this away from the user the usability of many dapps will probably increase. I think that increasing the usability of dapps is very important to increase user adoption. |
This would be a provider-based version of #961 I now am starting to think it may also make sense for sites to suggest the token's logo. At MetaMask, we've tried to curate a list of tokens for a while, but it's clearly unsustainable. It seems like a good solution to me to allow users to trust whatever source of token logos they want to find around the web. Thoughts? |
Contract metadata stored on swarm could help with that last issue perhaps? |
The draft has been merged. It designates https://ethereum-magicians.org/t/eip-747-wallet-watchasset/1048 as the official discussion URL. |
Scam link removed manually |
Today, most web3-compatible browsers have a notion of watching tokens, usually to help a user watch their current balances of tokens.
While it is possible to derive an account's token balances by walking the full history of the blockchain, this is especially impractical in the context of light clients, and so users are frequently instructed to "add this token to your wallet", to help their wallet identify tokens they care about.
To help ease this experience, I'd like to propose a new optional method to be exposed in web3-compatible browsers,
eth_watchToken
.This method would take a single parameter, a JavaScript object with the following keys:
symbol() returns string
method.decimals() returns uint8
method.Web3 browsers should then show some confirmation to the user, requesting their permission to track the given token.
If one of the options (symbol, decimals, name) differs from the result of the token's own public method, I'm not sure what's best, probably default to the page? Open to opinions here, for now this is undefined behavior for the proposed spec.
Valid error messages:
Valid errors I'd like to propose, for the sake of cross-client consistency, are:
Problem prompting the user.
Problem tracking the token.
User rejected request.
The text was updated successfully, but these errors were encountered: