// Node 22: read-only 402; no wallet or spending. const product=process.argv[2]||'flp'; const limits={flp:'10000',fli:'10000',gfc:'20000'}; if(!Object.hasOwn(limits,product))throw Error('Unknown index'); const url='https://skylark-x402-testnet-discovery.vercel.app/api/v1/'+product+'/current'; const r=await fetch(url,{redirect:'error',signal:AbortSignal.timeout(12000)}); if(r.status!==402)throw Error('Expected 402, got '+r.status); const h=r.headers.get('payment-required');if(!h||h.length>30000)throw Error('Invalid challenge'); const c=JSON.parse(Buffer.from(h,'base64').toString('utf8'));const a=c.accepts?.[0]; if(c.x402Version!==2||c.accepts?.length!==1||c.resource?.url!==url||a?.network!=='eip155:84532'||String(a?.amount)!==limits[product]||String(a?.payTo).toLowerCase()!=='0xc58d304313c60fcad5a923164ddf9fbedec564b9'||String(a?.asset).toLowerCase()!=='0x036cbd53842c5426634e7929541ec2318f3dcf7e'||!c.extensions?.bazaar)throw Error('Unsafe requirements'); console.log(JSON.stringify({product,network:a.network,amount_atomic:a.amount,bazaar:true,paid:false},null,2));