Cross-chain / Bridge·EVM · Solana · Multi-chain
Socket (Bungee)
Chain-abstraction protocol powering Bungee. Aggregates 15+ bridges and DEXs across 300+ networks with a quote/build API and an embeddable widget.
- 01cross-chain swaps
- 02bridge aggregation
- 03Refuel (gas drops on destination)
- 04embeddable bridge widgets
- 05chain-abstracted UX
- pnpm add @socket.tech/bungee viem
| Variable | Scope | Description |
|---|---|---|
| SOCKET_API_KEY | Server | Socket / Bungee API key from the Socket dashboard. Required for production traffic. |
Use the Bungee/Socket REST API: call `GET /v2/quote` with `fromChainId`, `toChainId`, `fromTokenAddress`, `toTokenAddress`, `fromAmount`, `userAddress`, `recipient`, sending `API-KEY` in the header. Pick `result.routes[0]` and call `POST /v2/build-tx` with the route to receive the `txData`/approval payloads. Submit approvals first, then the bridge tx via viem, and poll `GET /v2/bridge-status?transactionHash=...&fromChainId=...&toChainId=...` until `destinationTxStatus === 'COMPLETED'`. For drop-in UX embed `@socket.tech/bungee` and pass an EVM/Solana adapter — v1.0+ no longer bundles wagmi.
- ⚑v1.0+ of `@socket.tech/bungee` is a breaking change — the widget no longer ships wagmi or a wallet provider; you must wire your own adapter.
- ⚑`fromAmount` must be in raw base units; mixing decimals up is the most common integration bug.
- ⚑Bridge status can stay `PENDING` for many minutes (especially optimistic bridges); never block the UI on completion — surface destination tx hash when available.
- ⚑Some routes require a separate ERC20 approval to a route-specific spender (not a single canonical router) — always read `approvalData.allowanceTarget` from the build response.
- ⚑Refuel adds a separate native-token leg with its own min/max — check `refuel.minAmount` per chain pair.
- ⚑Free tier is rate-limited; cache quotes briefly but always re-quote before signing.