Skip to main content

Outcome

A Next.js 14 page that runs the full Delta flow: quote → build → EIP-712 sign → submit → poll. The user pays no gas; the solver network fills.

Prompt

You are working in a Next.js 14 App Router project with Wagmi v2 and Viem already configured.

Build a `/swap-gasless` page that lets the user place a Velora Delta intent for any ERC-20 → any ERC-20.

Requirements:
- Use the Velora Delta V2 REST API at `https://api.velora.xyz`. Endpoints: `GET /v2/quote` (with `mode=DELTA`), `POST /v2/delta/orders/build`, `POST /v2/delta/orders`, `GET /v2/delta/orders/{orderId}`.
- Always set `partner` to the host app's partner identifier on every quote call (`my-app-name` is only a placeholder).
- For the native ETH placeholder, use `0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE`.
- Pass `slippage` (basis points) to `POST /v2/delta/orders/build`; it defaults to 100 (1%) if omitted.
- Pass the `delta.route` returned by `/v2/quote` verbatim to `/v2/delta/orders/build`, with `owner` set to the user address. Do not normalize, sort, or re-stringify it.
- Use Viem's `signTypedData` to sign the `toSign` payload returned by `/v2/delta/orders/build`. Then submit to `/v2/delta/orders` with `order` set to `toSign.value`, the `signature`, `chainId`, and `partner`.
- Poll `GET /v2/delta/orders/{orderId}` and display lifecycle states (`PENDING` → `COMPLETED` / `FAILED`).
- Token approvals must be granted to the **Delta contract** (not Augustus). The address is per-chain: fetch from /resources/chains-and-contracts, use the `delta.spender` from the quote response, or read it from the typed-data `domain.verifyingContract`.

Reference these docs and follow them exactly:
- https://velora.xyz/docs/delta/overview
- https://velora.xyz/docs/delta/how-it-works
- https://velora.xyz/docs/api-reference/delta/quote
- https://velora.xyz/docs/api-reference/delta/orders-build
- https://velora.xyz/docs/api-reference/delta/orders-submit

Do NOT mutate the `delta.route` between quote and build. Do NOT grant approval to Augustus; Delta has its own spender contract.

End-state check

  • The user signs once (EIP-712 typed data) and pays no gas.
  • The order transitions through PENDINGCOMPLETED and the user receives the destToken.
  • The token approval was granted to the Delta contract address from the typed-data domain, not Augustus.
Last modified on June 14, 2026