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


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
