agentgate-examples / tree / langchain/js/src/dry-run.ts ยท raw (this view has old GitHub links rewritten for the mirror; raw is byte-exact)
// Dry run with a throwaway, unfunded key: the facilitator rejects the payment, so nothing is spent.
import { generatePrivateKey, privateKeyToAccount } from 'viem/accounts';
import { agentgateTools } from './agentgateTools.js';

const tools = agentgateTools(privateKeyToAccount(generatePrivateKey()));
console.log('tools:', tools.map((t) => t.name).join(', '));
const payguard = tools.find((t) => t.name === 'payguard_screen_address')!;
console.log('invoke with unfunded wallet ->', await payguard.invoke({ address: '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913' }));

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