EVM Provider
The Tomo Telegram SDK implements the Ethereum Provider, allowing seamless integration with existing Ethereum-compatible DApps.
To use the EVM provider in your application, you need first to install the sdk and get the wallet provider:
Below are methods that developers can use with our EVM provider.
Connect with the Wallet
Before using the provider, the user needs to log in to the wallet through the modal by following the method:
The isConnected
method returns a boolean value indicating whether the wallet is connected or not.
Query Methods
The request
method is used to make an RPC request to the connected wallet. For detailed information on JSON-RPC methods, refer to:
We provide some frequently use methods as below:
Get accounts address
Connects to the wallet and returns the address of the connected wallet. In Tomo, the return value is the first address in the response.
Get chain ID
Returns the chain ID of the connected wallet.
Get balance
Returns the balance of eth in wei of hex format.
Sign Message
The Tomo Telegram SDK supports signing messages through the request method under Metamask standard:
personal_sign
eth_signTypedData
eth_signTypedData_v3
eth_signTypedData_v4
The return value is the signature data. For detailed usage, refer to:
Example of personal_sign
:
Example of eth_signTypedData_v4
:
Sign Transaction
eth_signTransaction
method will return a response with a signed transaction. For users to verify the transaction contents, we only support passing parameters to the SDK and letting the user decide whether to sign the created transaction or not.
Transfer transaction
Contract call transaction
Send Transaction
Currently, Tomo SDK does not connect to RPC nodes for EVM chains. Therefore, developers must send the transaction directly with a standard EVM library.
Switch Ethereum Chain
Switches the connected wallet to the specified chain ID.
Event Listeners
The SDK emits events for account and network changes.
accountsChanged
chainChanged
To remove listeners:
Last updated