> For the complete documentation index, see [llms.txt](https://docs.tomo.inc/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.tomo.inc/tomo-wallet/extension-wallet/developer-manual/evm-integration.md).

# EVM Integration

Tomo Extension Wallet injects `tomo_evm` into the window object in your browser. dApp can easily interact with the wallet via `window.tomo_evm`. The following demo code shows how it works:

```javascript
const example = async () => {
    // connect to tomo wallet and get accounts
    const accounts = await window.tomo_evm.request({ method: 'eth_requestAccounts' })
    
    // the first account is the selected account
    const account = accounts[0]
        
    // get chain id
    const chainId = await window.tomo_evm.request({ method: 'eth_chainId' });
    
    const txParams = {
        nonce: '0x0',
        gasPrice: '0x3e95ba80', // set by user from dApp
        gas: '0x2710', // set by user from dApp
        to: '0x0000000000000000000000000000000000000000',
        from: account,
        value: '0x2386f26fc10000',
        chainId: chainId,
    };
    
    const txHash = await window.tomo_evm.request({
      method: 'eth_sendTransaction',
      params: [txParams],
    });
}

const handleAccountsChanged = async (accounts) => {
    // do something when account changed
}

window.tomo_evm.on('accountsChanged', handleAccountsChanged);

const handleChainChanged = async (chainId) => {
    // do something when chain changed
}
window.tomo_evm.on('chainChanged', handleChainChanged)
```

Tomo extension wallet support the following standard JSON-RPC API:

* eth\_requestAccounts
* eth\_accounts
* wallet\_addEthereumChain
* wallet\_switchEthereumChain
* wallet\_watchAsset
* eth\_sign
* personal\_sign
* eth\_signTypedData\_v4
* eth\_chainId
* eth\_gasPrice
* eth\_getBalance
* eth\_call
* eth\_sendTransaction
* ...
