danke_balance
Check your current Bitcoin Lightning balance and view earning/spending statistics on the Danke network for micropayments.
Instructions
Check your current sats balance and earning/spending statistics.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/server.ts:78-92 (handler)The handler function for danke_balance tool. It calls agent.balance() to fetch balance data and returns formatted text showing balance, total received, and total sent statistics.
async () => { try { const bal = await agent.balance(); const text = [ '💰 Danke Balance', ` Balance: ${formatNumber(bal.balance_sats)} sats`, ` Received: ${formatNumber(bal.total_received)} sats (from ${formatNumber(bal.dankes_received)} dankes)`, ` Sent: ${formatNumber(bal.total_sent)} sats (in ${formatNumber(bal.dankes_sent)} dankes)`, ].join('\n'); return { content: [{ type: 'text', text }] }; } catch (err) { const msg = err instanceof Error ? err.message : String(err); return { content: [{ type: 'text', text: `❌ Error: ${msg}` }], isError: true }; } } - src/server.ts:75-93 (registration)Registration of the danke_balance tool with the MCP server. It registers with name 'danke_balance' and description 'Check your current sats balance and earning/spending statistics.' This tool takes no input parameters.
server.tool( 'danke_balance', 'Check your current sats balance and earning/spending statistics.', async () => { try { const bal = await agent.balance(); const text = [ '💰 Danke Balance', ` Balance: ${formatNumber(bal.balance_sats)} sats`, ` Received: ${formatNumber(bal.total_received)} sats (from ${formatNumber(bal.dankes_received)} dankes)`, ` Sent: ${formatNumber(bal.total_sent)} sats (in ${formatNumber(bal.dankes_sent)} dankes)`, ].join('\n'); return { content: [{ type: 'text', text }] }; } catch (err) { const msg = err instanceof Error ? err.message : String(err); return { content: [{ type: 'text', text: `❌ Error: ${msg}` }], isError: true }; } } ); - src/server.ts:7-9 (helper)Helper function used by danke_balance (and other tools) to format numbers with locale-specific separators (e.g., 1,234,567).
function formatNumber(n: number): string { return n.toLocaleString('en-US'); }