> For the complete documentation index, see [llms.txt](https://docs.kanalabs.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.kanalabs.io/smart-wallet-sdk/mirai-sdk-the-evm-smart-wallet-and-paymaster/examples/transfer-erc20-tokens.md).

# Transfer ERC20 Tokens

```typescript
import { BigNumber } from 'ethers';
import 'dotenv/config';
import { NetworkNames, initializeSdkGateway } from '@kanalabs/mirai';

const tokenAddress = '0xc2132D05D31c914a87C6611C10748AEb04B58e8F'; // Sender address
const receiverAddress = '0x97a57d9CE2889E2E8DFb6019f8Eb51F5d119Bde3'; // Receiver address

(async () => {

    // initializating sdk...
    const sdk = await initializeSdkGateway(
        { privateKey: process.env.PRIVATE_KEY as string },
        {
          networks: [NetworkNames.Mumbai],
          bundlerApiKey: process.env.BUNDLER_API_KEY
        },
      );

    // set mumbai as default current instance
    const networkInstance = sdk.setCurrentInstance(NetworkNames.Mumbai);

    //initialize erc20 sdk instance
    const erc20 = sdk.erc20(tokenAddress, NetworkNames.Mumbai);

    const native = await sdk.getNativeBalance();
    console.log('native: ', native);

    // clear any previous transactions in batch
    await networkInstance.clearUserOpsFromBatch();

    // add erc20 transfer function to the batch
    await erc20.transfer(receiverAddress, 1000000 as unknown as BigNumber);

    // estimate transactions added to the batch and get the fee data for the UserOp
    const op = await networkInstance.estimate();
    console.log('op: ', op);

    //sign the UserOp and sending to the bundler...
    const uoHash = await networkInstance.send(op);

    // log the uoHash
    console.log(`UserOpHash: ${uoHash}`);
})()
```


---

# 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.kanalabs.io/smart-wallet-sdk/mirai-sdk-the-evm-smart-wallet-and-paymaster/examples/transfer-erc20-tokens.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.
