Skip to main content
Glama

deposit

Generate a deposit invoice (bolt11) for a specified amount and mint. If no mint is provided, all mints are tried concurrently, ensuring immediate invoice creation for payment. Facilitates secure and efficient fund deposits.

Instructions

Create a deposit invoice (bolt11) for the specified amount and mint. Returns the invoice immediately for payment. If no mint is specified, all mints will be tried concurrently and the first successful response will be used.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
amountYesAmount in satoshis
mintUrlNoMint URL to deposit to (optional - all mints tried concurrently if not provided)

Implementation Reference

  • MCP tool handler for 'deposit': parses arguments, calls wallet.createDepositInvoice, returns formatted response with invoice.
    case 'deposit': const { amount, mintUrl } = args; if (!amount) { throw new Error('Amount is required'); } const invoice = await this.wallet.createDepositInvoice(amount, mintUrl); return { content: [{ type: 'text', text: `Deposit invoice created. Pay this invoice: ${invoice.bolt11}` }], invoice: invoice.bolt11, amount: invoice.amount, mintUrl: invoice.mintUrl, depositId: invoice.depositId };
  • Input schema definition for the 'deposit' tool in the ListTools response.
    name: 'deposit', description: 'Create a deposit invoice (bolt11) for the specified amount and mint. Returns the invoice immediately for payment. If no mint is specified, all mints will be tried concurrently and the first successful response will be used.', inputSchema: { type: 'object', properties: { amount: { type: 'number', description: 'Amount in satoshis' }, mintUrl: { type: 'string', description: 'Mint URL to deposit to (optional - all mints tried concurrently if not provided)' } }, required: ['amount'] }
  • Core helper function createDepositInvoice that creates the Lightning invoice for deposit using NDKCashuWallet.deposit and sets up event listeners.
    async createDepositInvoice(amount: number, mintUrl?: string): Promise<{ bolt11: string; amount: number; mintUrl: string; depositId: string }> { if (!this.wallet || !this.walletData) throw new Error('Wallet not initialized'); try { // If no mint URL provided, use first available mint if (!mintUrl) { if (!this.walletData.mints || this.walletData.mints.length === 0) { throw new Error('No mints configured. Please add a mint first.'); } mintUrl = this.walletData.mints[0]; } // Add mint to wallet configuration if not already present if (!this.walletData.mints.includes(mintUrl)) { this.walletData.mints.push(mintUrl); this.wallet.mints = this.walletData.mints; this.saveWallet(); } const deposit: NDKCashuDeposit = this.wallet.deposit(amount, mintUrl); const invoice = await deposit.start(); // Generate unique ID for tracking this deposit const depositId = `deposit_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`; // Set up background monitoring for this deposit deposit.on("success", () => { console.log(`✅ Deposit ${depositId} completed successfully`); this.saveWallet(); }); deposit.on("error", (error) => { console.error(`❌ Deposit ${depositId} failed:`, error); }); return { bolt11: invoice, amount, mintUrl, depositId }; } catch (error) { console.error('Error creating deposit invoice:', error); throw error; } }

Other Tools

Related Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/pablof7z/mcp-money'

If you have feedback or need assistance with the MCP directory API, please join our Discord server