> For the complete documentation index, see [llms.txt](https://docs.megaeth.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.megaeth.com/moss-docs/methods/methods/transfer.md).

# mega.transfer()

Send native ETH, ERC-20, ERC-721, or ERC-1155 transfers from the connected wallet. Returns a `TransactionResult` with status, receipt, and optional error. The wallet always prompts for transfers — for silent delegated execution, use [`callContract()`](/moss-docs/methods/methods/call-contract.md) with matching permissions.

## Signature

`mega.transfer(request: TransferRequest): Promise<TransactionResult>`

## Parameters

| Field             | Type                                              | Required | Notes                                                                                                 |
| ----------------- | ------------------------------------------------- | -------- | ----------------------------------------------------------------------------------------------------- |
| `type`            | `'native'` / `'erc20'` / `'erc721'` / `'erc1155'` | required | Asset type.                                                                                           |
| `to`              | `` `0x${string}` ``                               | required | Recipient address.                                                                                    |
| `amount`          | `string`                                          | required | Wei (native) or smallest token unit.                                                                  |
| `contractAddress` | `string`                                          | optional | Required for ERC-20 / 721 / 1155.                                                                     |
| `tokenId`         | `number`                                          | optional | Required for ERC-721 / 1155.                                                                          |
| `sponsor`         | `boolean`                                         | optional | Request sponsorship in `explicit` mode — see [Paymaster Guide](/moss-docs/wallet/paymaster-setup.md). |

## Example

```typescript
import { parseEther } from 'viem';

const result = await mega.transfer({
  type: 'native',
  to: '0xRecipientAddress',
  amount: parseEther('0.1').toString(),
});

if (result.status === 'approved') {
  console.log(result.receipt?.hash);
} else if (result.status === 'cancelled') {
  console.log('User cancelled transfer');
} else {
  console.error(result.error);
}
```

## Response

```typescript
type TransactionResult = {
  status: 'approved' | 'cancelled' | 'error';
  receipt?: {
    hash: `0x${string}`;
    blockHash: string;
    blockNumber: number;
    chainId: number;
    gasUsed: number;
    logs: { address: `0x${string}`; data: `0x${string}`; topics: string[] }[];
    status: string;
    transactionHash: `0x${string}`;
  };
  receipts?: TransactionResult['receipt'][];  // populated for batch callContract
  error?: string;
  silentHasUsedFallback?: boolean;
};
```

| Status      | Meaning                                      | Action                             |
| ----------- | -------------------------------------------- | ---------------------------------- |
| `approved`  | Transaction confirmed                        | Use `result.receipt?.hash`         |
| `cancelled` | User rejected in-wallet confirmation         | Treat as neutral, reset UI         |
| `error`     | Operational failure (RPC, balance, contract) | Inspect `result.error`, show retry |

`silentHasUsedFallback` is set to `true` when `silent: true` was attempted on a `callContract()` call but fell back to UI approval — typically because the matching session permission had expired and `silentUIApproveFallback: true` triggered the fallback path.

## Notes

* Show amount, asset, and destination before opening the wallet.
* If the wallet is disconnected, prompt [`connect()`](/moss-docs/methods/methods/connect.md) first.


---

# 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:

```
GET https://docs.megaeth.com/moss-docs/methods/methods/transfer.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.
