Server route for your website
// app/api/yieldboost/veilsolver/route.ts
import { NextRequest, NextResponse } from "next/server";
export async function POST(req: NextRequest) {
const payload = await req.json();
const response = await fetch(
"https://dev.yieldboostai.xyz/api/dev/store/veilsolver",
{
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization: `Bearer ${process.env.YIELDBOOST_API_KEY}`,
},
body: JSON.stringify(payload),
},
);
const data = await response.json();
return NextResponse.json(data, { status: response.status });
}Browser calls your own backend
// Browser code in your web app
const response = await fetch("/api/yieldboost/veilsolver", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
"action": "SWAP",
"chainId": 16602,
"tokenIn": "0x0000000000000000000000000000000000000000",
"tokenOut": "0x0000000000000000000000000000000000000000",
"amountIn": "1.0",
"decimalsIn": 18,
"maxSlippageBps": 50,
"userAddress": "0x8a3c7524Aaed081825aC88eC7f4cCECFc583ee7D"
}),
});
const verified = await response.json();Node or edge runtime
const response = await fetch("https://dev.yieldboostai.xyz/api/dev/store/veilsolver", {
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization: `Bearer ${process.env.YIELDBOOST_API_KEY}`,
},
body: JSON.stringify({
"action": "SWAP",
"chainId": 16602,
"tokenIn": "0x0000000000000000000000000000000000000000",
"tokenOut": "0x0000000000000000000000000000000000000000",
"amountIn": "1.0",
"decimalsIn": 18,
"maxSlippageBps": 50,
"userAddress": "0x8a3c7524Aaed081825aC88eC7f4cCECFc583ee7D"
}),
});
const verified = await response.json();cURL smoke test
curl -X POST https://dev.yieldboostai.xyz/api/dev/store/veilsolver \
-H "Authorization: Bearer $YIELDBOOST_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "action": "SWAP", "chainId": 16602, "tokenIn": "0x0000000000000000000000000000000000000000", "tokenOut": "0x0000000000000000000000000000000000000000", "amountIn": "1.0", "decimalsIn": 18, "maxSlippageBps": 50, "userAddress": "0x8a3c7524Aaed081825aC88eC7f4cCECFc583ee7D"}'Response shape
{
"status": "success",
"security": "Isolated ZK Verified",
"data": { "...": "partner solver result" },
"zk_proof": "0x...",
"zk_envelope": {
"status": "verified-digest"
},
"0g_storage_url": "0g://..."
}