๐Ÿ” Smart Wallet โ€” MetaMask Test

1. Connect MetaMask

Not connected

2. Create Smart Wallet

Computes the deterministic wallet address for your EOA. No gas needed.

โ€”

3. Fund Smart Wallet (EOA โ†’ Smart Wallet)

Sends tokens from your MetaMask EOA directly to your smart wallet. MetaMask will switch to the correct network automatically. The smart wallet can receive tokens even before deployment.

โ€”

3b. Prepare EOA Transfer via API

Builds an EOA transaction (native or ERC20) and estimates gas cost โ€” no MetaMask needed. Returns the raw tx fields ready for eth_sendTransaction.

โ€”

4. Check Balance

โ€”

5. CowSwap Swap (Smart Wallet)

Swap tokens using your smart wallet via CowSwap presign. The smart wallet approves CowSwap and presigns the order โ€” all in one UserOperation. Your EOA signs the UserOp with MetaMask. Gas is sponsored by ZeroDev paymaster.

โ„น๏ธ Flow: (1) Get quote โ†’ submit presign order to CowSwap โ†’ (2) Build UserOp (approve + setPreSignature, wrap ETH if needed) โ†’ sign with MetaMask โ†’ (3) Bundler executes UserOp โ†’ CowSwap solver fills the order.
Arbitrum One โ€” CowSwap presign
โ€”
โ€”
๐Ÿ”ง Paymaster Diagnostic

Tests a minimal sponsored UserOp (0 ETH self-transfer) to verify the ZeroDev gas policy works. If this fails with AA21, fix the gas policy in ZeroDev dashboard first.

โ€”

6. Best Route Finder

Queries CowSwap, Uniswap v3 and Squid in parallel. Token addresses are resolved automatically via Paraswap + CoinGecko APIs. Supports cross-chain pairs via Squid.

Unknown tokens are resolved via Paraswap + CoinGecko
โ€”

7. Uniswap v3 Quote

On-chain quote via QuoterV2 deployed natively on Arbitrum One. Leave fee tier blank to auto-find the best pool across all tiers.

โ„น๏ธ Mainnet pools have real liquidity. Quotes should work for common pairs (WETH/USDC, etc.).
Arbitrum One โ€” native on-chain
โ€”

8. Squid Router Quote

Cross-chain & same-chain quote via Squid Router v2. Works natively on Arbitrum One โ€” no pool creation needed.

โš ๏ธ Mainnet prices: Squid only supports mainnet chains. Arbitrum Sepolia (421614) is automatically mapped to Arbitrum One (42161) โ€” quotes use real mainnet liquidity. Token addresses must be mainnet addresses.
Also requires a free Squid Integrator ID in .env โ†’ register here.
Arbitrum Sepolia โ†’ Squid Arbitrum One
โ€”

9. Transfer FROM Smart Wallet

Sends native or ERC20 tokens FROM your smart wallet to another address via UserOperation. Your smart wallet must have balance. Gas is sponsored by the paymaster. If the wallet isn't deployed yet, the first transfer will deploy it automatically.

โ€”

9b. Resolve Smart Wallet Index

Find which index was used to create a given smart wallet address for your EOA. Scans indices 0โ€“19 in parallel.

โ€”

10. Execute Best Route Swap (MetaMask EOA)

Finds the best route across CowSwap, Uniswap v3, Squid and 31Third, then builds and sends the transactions directly from your MetaMask EOA.

โ€”