# 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
* ...


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.tomo.inc/tomo-wallet/extension-wallet/developer-manual/evm-integration.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
