// Lists lax-offer.json on the LAX registry, paying the 0.01 USDC fee on Base over x402.
// Usage: LAX_PAYER_KEY=0x... npx tsx scripts/list.ts (the key is read here and never printed)
// Set MAX_FEE_ATOMIC to change the spend cap (default 10000 = 0.01 USDC).
import { readFileSync } from 'node:fs';
import { privateKeyToAccount } from 'viem/accounts';
import { listOffer } from '../src/list.js';
import { exactPaymentHeader } from '../src/evm-pay.js';
const key = process.env.LAX_PAYER_KEY;
if (!key) {
process.stderr.write('Set LAX_PAYER_KEY in the environment.\n');
process.exit(1);
}
const account = privateKeyToAccount(key as `0x${string}`);
const offer = JSON.parse(readFileSync(new URL('../lax-offer.json', import.meta.url), 'utf8'));
const cap = BigInt(process.env.MAX_FEE_ATOMIC ?? '10000');
const { id } = await listOffer({ offer, pay: (terms) => exactPaymentHeader(terms, account, { maxAtomic: cap }) });
process.stdout.write(`listed: ${id}\n`);
agentgate-source: code mirror on Cloudflare Pages. All repos