()
| 96 | } |
| 97 | |
| 98 | function handleStatus(): string { |
| 99 | const config = getX402Config() |
| 100 | const address = getX402WalletAddress() |
| 101 | const enabled = isX402Enabled() |
| 102 | const sessionSpent = getX402SessionSpentUSD() |
| 103 | const paymentCount = getX402PaymentCount() |
| 104 | |
| 105 | const lines: string[] = [] |
| 106 | lines.push('x402 Payment Status') |
| 107 | lines.push('─'.repeat(40)) |
| 108 | lines.push(`Enabled: ${config.enabled ? 'Yes' : 'No'}`) |
| 109 | lines.push(`Wallet: ${address ?? 'Not configured'}`) |
| 110 | lines.push(`Network: ${config.network}`) |
| 111 | lines.push(`Max per request: $${config.maxPaymentPerRequestUSD.toFixed(2)}`) |
| 112 | lines.push(`Max per session: $${config.maxSessionSpendUSD.toFixed(2)}`) |
| 113 | lines.push(`Ready: ${enabled ? 'Yes' : 'No (need wallet + enabled)'}`) |
| 114 | lines.push('') |
| 115 | lines.push('Session:') |
| 116 | lines.push(` Payments: ${paymentCount}`) |
| 117 | lines.push(` Total spent: $${sessionSpent.toFixed(4)}`) |
| 118 | |
| 119 | const x402Summary = formatX402Cost() |
| 120 | if (x402Summary) { |
| 121 | lines.push('') |
| 122 | lines.push(x402Summary) |
| 123 | } |
| 124 | |
| 125 | return lines.join('\n') |
| 126 | } |
| 127 | |
| 128 | function handleSetLimit(args: string): string { |
| 129 | const parts = args.trim().split(/\s+/) |
no test coverage detected