copy Copy chevron-down
products chevron-right WebView RPC Methods Ethereum RPCs implemented in the imToken application.
Here is the list of all Ethereum RPCs currently supported by the imToken App, for more information you can also refer to the Ethereum RPCsarrow-up-right .
imToken's DApp browser no longer injects web3 into the DApp , we only inject the Provider.(you can get it using window.ethereum) For more information on how to start connecting to your wallet using Provider, please refer to:
Or refer to the following simplified code:
Copy // Modern application
window . web3 = new Web3 ( ethereum )
// Or with ethers
await window . ethereum . enable ()
const provider = new ethers . providers . Web3Provider ( window . ethereum ) Implemented RPCs
eth_requestAccounts
This method is specified by EIP-1102arrow-up-right .
Requests that the user provides an Ethereum address to be identified by.
Returns
string[] - An array of a single, hexadecimal Ethereum address string.
This method is specified by the Ethereum RPCs#eth_accountsarrow-up-right .
eth_sendTransaction
This method is specified by the Ethereum RPCs#eth_sendtransactionarrow-up-right .
alias: personal_sign , eth_signTypedData , eth_signTypedData_v3 eth_signTypedData_v4
Please refer to the metamask docs (a-brief-history)arrow-up-right for the differences between the signature methods.
This method (personal_sign) is similar to eth_sign, but has better security, see Technical Referencearrow-up-right for details.
This method is specified by the Ethereum RPCs#eth_signarrow-up-right .
This method is specified by the Ethereum RPCs#net_versionarrow-up-right .
This method is specified by EIP-695arrow-up-right
wallet_addEthereumChain
This method is specified by EIP-3085arrow-up-right .
An API for adding Ethereum chains to wallet applications.
circle-exclamation
API wallet_addEthereumChain only works on versions higher than 2.8.4.
Returns
null - The method returns null if the request was successful, and an error otherwise.
Params
Example
wallet_switchEthereumChain
This method is specified by EIP-3326arrow-up-right .
An RPC method for switching the wallet’s active Ethereum chain.
circle-exclamation
API wallet_switchEthereumChain only works on versions higher than 2.10.0.
Returns
null - The method returns null if the request was successful, and an error otherwise.
Params
Example
enable (DEPRECATED)
circle-exclamation
Use ethereum.request({ method: 'eth_requestAccounts' }) instead.
sendAsync (DEPRECATED)
circle-exclamation
Use ethereum.request() instead.
send (DEPRECATED)
circle-exclamation
Use ethereum.request() instead.
circle-exclamation
Use personal_sign instead.
This RPC interface is not currently implemented in imToken.
Feedback and help
If you need to leave feedback or request help from the developers, please create a topic in the GitHub Discussionarrow-up-right .
Last updated 8 months ago