(args: string)
| 126 | } |
| 127 | |
| 128 | function handleSetLimit(args: string): string { |
| 129 | const parts = args.trim().split(/\s+/) |
| 130 | const amount = parseFloat(parts[1] ?? '') |
| 131 | |
| 132 | if (isNaN(amount) || amount <= 0) { |
| 133 | return 'Usage: /x402 set-limit <amount>\nAmount must be a positive number (USD).\nExample: /x402 set-limit 0.25' |
| 134 | } |
| 135 | |
| 136 | try { |
| 137 | setX402MaxPayment(amount) |
| 138 | return `Max payment per request set to $${amount.toFixed(2)}` |
| 139 | } catch (err) { |
| 140 | return `Error: ${err instanceof Error ? err.message : String(err)}` |
| 141 | } |
| 142 | } |
| 143 | |
| 144 | function handleSetSession(args: string): string { |
| 145 | const parts = args.trim().split(/\s+/) |
no test coverage detected