x402-perpcheck / tree / tools/gen-examples.mjs ยท raw (this view has old GitHub links rewritten for the mirror; raw is byte-exact)
// Record example outputs for the discovery declaration, OpenAPI and landing page from real (read-only) engine runs.
//   node tools/gen-examples.mjs   (writes src/examples.js)
import { writeFileSync } from 'node:fs';
import { parseOrder, checkOrder, liteView, DISCLAIMER } from '../src/engine.js';
const full = { ...(await checkOrder(parseOrder({ coin: 'BTC', side: 'long', size: '0.001', leverage: 10 }))), tier: 'full', disclaimer: DISCLAIMER };
const bad = await checkOrder(parseOrder({ coin: 'ETH', side: 'long', size: '0.0012345', price: '3000.123', leverage: 60 }));
const lite = { ...liteView(bad), tier: 'lite', disclaimer: DISCLAIMER };
writeFileSync(new URL('../src/examples.js', import.meta.url), `// Example outputs for the discovery declaration, OpenAPI and landing page (recorded ${full.checked_at} from the live public Hyperliquid info API).\nexport const LITE_EXAMPLE = ${JSON.stringify(lite)};\nexport const FULL_EXAMPLE = ${JSON.stringify(full)};\n`);
console.log(full.verdict, full.sources_failed, lite.verdict, JSON.stringify(lite).length, JSON.stringify(full).length);

agentgate-source: code mirror on Cloudflare Pages. All repos