Support for EIP-747 #3171
Replies: 3 comments 2 replies
-
The exact forwarding method is not implemented in ethers currently. But for the time being you can use the rpc send on the provider: provider.send('wallet_watchAsset', [ {type: ...} ])
// or
signer.provider.send('wallet_watchAsset', [ {type: ...} ]) |
Beta Was this translation helpful? Give feedback.
-
There is not currently any plan to add support to watching assets to the Signer class, since that only makes sense in a handful (albeit a common) set of Signer options. It could make sense as an Extension package, which v6 makes easier by providing a WrappedSigner object for sub-classing. It may make sense to add to a future JsonRpcSigner though, which already has the additional method I'm moving this to "Ideas" to keep track of it for the future. :) |
Beta Was this translation helpful? Give feedback.
-
@zemse Even trying with send, ethers sends the transaction request to an HttpProviderError, so as @ricmoo said, it's not supported. But, @Joetoledano you can set a "workaround" by providing a standard window.ethereum.request(method, params..) from a simple frontend app, or simply from the Chrome console filled with all the data. Metamask will print out all the information setted on the request. |
Beta Was this translation helpful? Give feedback.
-
Describe the Feature
Hi!
I was wondering if there's a current Ethers method that invokes an RPC request that follows EIP 747 (https://eips.ethereum.org/EIPS/eip-747), an "RPC method to allow any website to suggest a token for the user’s wallet to track."
To my understanding it's only available by directly interacting with an injected provider, such as MetaMask, by doing something like this:
ethereum .request({ method: 'wallet_watchAsset', params: { type: 'ERC20', options: { address: tokenAddress, symbol: tokenSymbol, decimals: 18, image: tokenImage, }, },
Here is a reference from the MetaMask docs (https://docs.metamask.io/guide/rpc-api.html#unrestricted-methods)
At a moment of your convenience, please let me know if this is currently available on Ethers, as I was having trouble locating the specific method.
Code Example
Beta Was this translation helpful? Give feedback.
All reactions