get_deposit_invoice
Generate a Lightning invoice to deposit Bitcoin sats into your operator account balance for funding payments and accessing paid APIs.
Instructions
Create a Lightning invoice to fund your operator account. Pay this invoice to add sats to your balance.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| amount_sats | Yes | Amount in satoshis to deposit |
Implementation Reference
- src/index.ts:1017-1036 (handler)Handler for the "get_deposit_invoice" tool in the MCP server.
case 'get_deposit_invoice': { const parsed = GetDepositInvoiceSchema.parse(args); const result = await session.requireClient().getDepositInvoice(parsed.amount_sats); return { content: [ { type: 'text', text: JSON.stringify({ success: true, message: `Deposit invoice created for ${parsed.amount_sats} sats`, bolt11: result.bolt11, payment_hash: result.paymentHash, expires_at: result.expiresAt, payment_url: result.paymentUrl, qr_url: result.qrUrl, }, null, 2), }, ], }; } - src/lightning-faucet.ts:414-446 (handler)The actual API client method that communicates with the backend for 'get_deposit_invoice'.
async getDepositInvoice(amountSats: number): Promise<{ bolt11: string; paymentHash: string; expiresAt: string; paymentUrl?: string; qrUrl?: string; rawResponse: DepositInvoiceResponse; }> { const result = await this.request<DepositInvoiceResponse>('create_deposit', { amount_sats: amountSats, }); const bolt11 = result.bolt11 || result.invoice; if (!bolt11) { throw new Error('No invoice returned from API'); } // Compute expires_at from expires_in if not provided let expiresAt = result.expires_at || ''; if (!expiresAt && result.expires_in) { const expiryDate = new Date(Date.now() + result.expires_in * 1000); expiresAt = expiryDate.toISOString(); } return { bolt11, paymentHash: result.payment_hash || '', expiresAt, paymentUrl: result.payment_url, qrUrl: result.qr_url, rawResponse: result, }; } - src/index.ts:130-132 (schema)Input schema definition for the get_deposit_invoice tool.
const GetDepositInvoiceSchema = z.object({ amount_sats: z.number().int().min(100).max(10_000_000).describe('Amount in satoshis to deposit'), }); - src/index.ts:404-413 (registration)Registration definition for the get_deposit_invoice tool.
name: 'get_deposit_invoice', description: 'Create a Lightning invoice to fund your operator account. Pay this invoice to add sats to your balance.', inputSchema: { type: 'object', properties: { amount_sats: { type: 'integer', minimum: 100, description: 'Amount in satoshis to deposit' }, }, required: ['amount_sats'], }, },