chain parameter.
Setup
Complete Transfer
Using ethers v6 instead of viem
Using ethers v6 instead of viem
Native ETH Transfers
For native ETH (not WETH), use the zero address and skip approval:value field in the transaction includes both the transfer amount and any native fee.
L2 Chains
The same code works for L2s — just change the chain config:Receiving on EVM (From NEAR)
When tokens come from NEAR to an EVM chain, the transfer finalizes automatically if the sender paid relayer fees. The tokens appear in the recipient’s address. If you need to finalize manually (no fees paid), see Manual Finalization.Approvals
For ERC20 tokens, you must approve the bridge contract before transferring. Exact approval — Approve only what you need:Transaction Format
buildTransfer() returns an EvmUnsignedTransaction:
Error Handling
Chain Reference
| Chain | ChainKind | Token Prefix | Mainnet ID | Testnet ID |
|---|---|---|---|---|
| Ethereum | Eth | eth: | 1 | 11155111 (Sepolia) |
| Base | Base | base: | 8453 | 84532 |
| Arbitrum | Arb | arb: | 42161 | 421614 |
| Polygon | Pol | pol: | 137 | 80002 (Amoy) |
| BNB Chain | Bnb | bnb: | 56 | 97 |