@toon-protocol/swap — swap tokens across chains through a TOON relay, with no server in
between. A maker publishes an order; a taker streams it small fills; each side verifies the
other's signed payment-channel claim; the newest claim is redeemed on chain once. A pair can
cross assets and decimal scales (an 18-decimal ERC-20 against a 6-decimal SPL mint), not just
USDC↔USDC.
👉 New here? Start with the guide: packages/swap/README.md
It takes you from npm i to USDC redeemed on chain, on the devnet, in six steps.
| Then | |
|---|---|
| How it works — the sequence, and the one number you turn (δ) | docs/how-it-works.md |
| Design record — why the swap is relay-mediated, what does not change | docs/relay-swap.md |
| Operator & config reference | deploy/swap/README.md |
| The proof — EVM↔Solana through a real relay, redeemed on chain | packages/swap/tests/e2e |
History — rolling/1, the protocol's first shape |
toon-meta docs/rolling-swap.md |
Published on npm as @toon-protocol/swap
by CI (changesets + pnpm, authed by the org NPM_TOKEN secret). The relay's
Rust connector charges for each write and never
opens a message.
Devbox pins the exact toolchain (Node 22, pnpm 8.15.x, Foundry 1.7.1) so every contributor builds with the same environment.
# Install devbox (one-time)
curl -fsSL https://get.jetify.com/devbox | bash
# Enter the pinned shell
devbox shell
# Inside the devbox shell:
node --version # v22.x
pnpm --version # 8.15.x
forge --version # foundry (anvil-gated integration/e2e suites)
anvil --version
# Build and test
devbox run build # pnpm install --no-frozen-lockfile && pnpm build
devbox run test # pnpm test
devbox run lint # pnpm lintNode 22 matters: the relay used by the e2e suite pulls in better-sqlite3, which has no prebuilt
binary for newer Node majors and then tries (and fails) to compile from source.
The end-to-end suite — a real relay, a real connector, anvil and solana-test-validator — is the
fastest way to watch a whole swap without funding anything:
SWAP_E2E_CONNECTOR_IMAGE=ghcr.io/toon-protocol/connector:rust-sha-5c1b222 \
pnpm --filter @toon-protocol/swap test:e2e