Skip to main content
These hooks use the partner quote as the only quote/build contract. The browser calls your backend proxy so the partner API key is never shipped in JavaScript.

Backend proxy

This Next.js route validates the fields your UI uses and forwards them to AKKA. Add your own session, origin, and rate-limit checks before production.
app/api/akka/quote/route.ts
Never use NEXT_PUBLIC_AKKA_API_KEY. Executable quotes can contain signed RFQ calldata; do not cache responses in your proxy, service worker, CDN, or application state beyond their immediate UI lifecycle.

Shared response type

lib/akka.ts

useAkkaQuote

This hook debounces display quotes. Always request a fresh quote again when the user confirms execution.
hooks/useAkkaQuote.ts

useAkkaSwap

The execution hook requests a fresh quote on click, approves the exact AKKA allowanceTarget if required, then refreshes before broadcasting.
hooks/useAkkaSwap.ts
Use the quote hook for display and the swap hook for execution. Do not pass the display quote into the execution hook; refreshing on click protects against stale pool state and expired RFQ signatures.