x402-payguard / tree / scripts/gen-examples.mjs ยท raw (this view has old GitHub links rewritten for the mirror; raw is byte-exact)
// Regenerates src/examples.js from the engine and the bundled list (run after scripts/build-sdn.py).
import { writeFileSync } from 'node:fs';
import { screenAddress, screenBatch } from '../src/screen.js';
import { SDN } from '../src/data/sdn.js';
const SANCTIONED = '0x098B716B8Aaf21512996dC57EB0615e2383E2f96'; // Lazarus Group (Ronin bridge), Digital Currency Address - ETH on the SDN list
const CLEAN = '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913';      // USDC token contract on Base
const now = Date.parse(`${SDN.publish_date}T16:00:00Z`);
const j = (o) => JSON.stringify(o, null, 1);
const hit = screenAddress(SANCTIONED, { now });
if (!hit.sanctioned) throw new Error(`${SANCTIONED} is no longer on the list: pick another example from src/data/sdn.js`);
writeFileSync(new URL('../src/examples.js', import.meta.url), `// GENERATED by scripts/gen-examples.mjs: real engine outputs on the bundled list (Bazaar / OpenAPI examples).
// SANCTIONED_EXAMPLE is a Lazarus Group address taken from the SDN list itself; CLEAN_EXAMPLE is the USDC contract on Base.
export const SANCTIONED_ADDRESS = '${SANCTIONED}';
export const CLEAN_ADDRESS = '${CLEAN}';
export const SANCTIONED_EXAMPLE = ${j(hit)};
export const CLEAN_EXAMPLE = ${j(screenAddress(CLEAN, { now }))};
export const BATCH_EXAMPLE = ${j(screenBatch([SANCTIONED, CLEAN], { now }))};
`);
console.log('examples written', SDN.publish_date);

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