How dawsbot/drain works
Drain is a non-custodial EVM wallet migration and rescue app. The main flow connects a source wallet, discovers balances for the active chain, lets the user select assets and a destination, then submits ERC-20 and native-token transfers. README documents additional batch-send, ENS, pricing, and compromised-wallet guidance capabilities. Source excerpts show the main UI and transfer logic; route wiring is partly supported by the SOURCE INDEX, so unsampled implementation details are not expanded.
Main entry points: SendTokens.tsx Send form · index.tsx Home flow · GetTokens.tsx Token review · [evmAddress].ts Chain balance API
Components 17
App experience
- Home flow
pages/index.tsx - Rescue guide
pages/compromised-wallet-rescue.tsx - Token review
components/contract/GetTokens.tsx
Token discovery
- Token fetch client
src/fetch-tokens.ts - Chain balance API
pages/api/chain-info/[chainId]/[evmAddress].ts - Moralis client
src/moralis-client.ts - Token address lists
src/token-lists.ts
Shared state
- Token state
src/atoms/global-tokens-atom.ts - Selection state
src/atoms/checked-tokens-atom.ts - Destination state
src/atoms/destination-address-atom.ts
Transfer execution
- Send form
components/contract/SendTokens.tsx - ENS lookup API
pages/api/ens/[name].ts
Other components
- Wallet owner
- Moralis API
- ENS resolution
- Connected wallet
- EVM network
Connections 19
- Wallet owner → Home flow: opens
README.md - Home flow → Token review: renders
pages/index.tsx - Home flow → Send form: renders
pages/index.tsx - Home flow → Rescue guide: links
pages/index.tsx - Token review → Token fetch client: requests balances
components/contract/GetTokens.tsx - Token fetch client → Chain balance API: fetches route
src/fetch-tokens.ts - Chain balance API → Moralis client: uses client
pages/api/chain-info/[chainId]/[evmAddress].ts - Chain balance API → Token address lists: uses lists
pages/api/chain-info/[chainId]/[evmAddress].ts - Moralis client → Moralis API: fetches balances
src/moralis-client.ts - Token review → Token state: updates
components/contract/GetTokens.tsx - Token review → Selection state: updates selection
components/contract/GetTokens.tsx - Send form → Token state: reads balances
components/contract/SendTokens.tsx - Send form → Selection state: reads selection
components/contract/SendTokens.tsx - Send form → Destination state: reads and updates
components/contract/SendTokens.tsx - Send form → ENS lookup API: requests resolution
components/contract/SendTokens.tsx - ENS lookup API → ENS resolution: resolves name
- Send form → Connected wallet: submits transfers
components/contract/SendTokens.tsx - Send form → EVM network: simulates and checks gas
components/contract/SendTokens.tsx - Wallet owner → Connected wallet: connects
README.md