Skip to main content
Glama
Bichev
by Bichev
CHAT_WALLET_INTEGRATION.mdโ€ข7.9 kB
# ๐Ÿบโ‚ฟ Chat Wallet Integration Guide ## Overview The chat interface now supports **interactive wallet transactions**! You can buy crypto, check balances, and view transaction history directly through natural conversation! ๐ŸŽ‰ ## ๐ŸŽฏ What You Can Do ### 1. **Buy Crypto with Beer Analogy** ๐Ÿบ Ask the AI to buy you "a beer worth of Bitcoin" and watch the magic happen! **Example Conversation:** ``` You: "Buy me a beer worth of Bitcoin" AI: Let me help you with that! First, I'll calculate how much Bitcoin $5 gets you... ๐Ÿ”ง Tool calls executed: ๐Ÿบโ‚ฟ calculate_beer_cost โœ… Success ๐Ÿบ $5 = 0.00004531 BTC ๐Ÿบโ‚ฟ simulate_btc_purchase โœ… Transaction Successful! Type: BUY From: 5.00 USD To: 0.00004531 BTC Price: $110,360 ID: tx_1735234567_abc123 โœ… Great! I've purchased 0.00004531 BTC for $5 (one beer's worth!). Your new balance: - USD: $995.00 - BTC: 0.00004531 ``` ### 2. **Buy Specific Amounts** ๐Ÿ’ฐ Purchase any amount of cryptocurrency! **Examples:** ``` "Buy $10 worth of Ethereum" "Purchase $25 of Solana" "Buy $50 worth of Bitcoin for long-term investment" ``` ### 3. **Check Your Wallet** ๐Ÿ‘› View your virtual balance at any time! **Examples:** ``` "Show my wallet" "What's my balance?" "How much crypto do I have?" "What's in my virtual wallet?" ``` ### 4. **View Transaction History** ๐Ÿ“ See all your past purchases! **Examples:** ``` "Show my transaction history" "What have I bought?" "Show my last 5 transactions" "Show Bitcoin transactions only" ``` ## ๐ŸŽจ Enhanced UI Features ### Transaction Display in Chat When you buy crypto through chat, you'll see: โœ… **Green Success Box** with: - Transaction type (BUY/SELL) - Amount converted - Current price - Transaction ID - Timestamp ๐Ÿบ **Orange Beer Calculator** showing: - USD amount - Crypto amount - Current price ๐Ÿ‘› **Purple Wallet Display** showing: - All currency balances - USD and crypto holdings - Real-time updates ## ๐Ÿ”ง Available Chat Commands ### Quick Actions - **"Buy me a beer worth of Bitcoin"** - Fun $5 BTC purchase - **"Buy $X of [CRYPTO]"** - Purchase any amount - **"Show my wallet"** - View balance - **"Transaction history"** - View purchases - **"How much is a beer in Bitcoin?"** - Just calculate, don't buy ### Supported Cryptocurrencies - Bitcoin (BTC) - Ethereum (ETH) - Solana (SOL) - Cardano (ADA) - Polygon (MATIC) - Avalanche (AVAX) - Litecoin (LTC) - And many more! ## ๐Ÿ’ก Example Conversations ### Scenario 1: First Beer Purchase ``` You: Hey! How much Bitcoin is a beer worth? AI: [Calls calculate_beer_cost] At the current BTC price of $110,360, one $5 beer equals approximately 0.00004531 BTC! You: That's cool! Let's buy it! AI: [Calls simulate_btc_purchase] โœ… Transaction Successful! You've purchased 0.00004531 BTC for $5.00 Transaction ID: tx_1735234567_abc123 You: Show me my wallet AI: [Calls get_virtual_wallet] ๐Ÿ‘› Your Demo Wallet: ๐Ÿ’ต USD: $995.00 ๐Ÿช™ BTC: 0.00004531 ๐Ÿ“Š Total Transactions: 1 ๐Ÿ’ฐ Total Spent: $5.00 ``` ### Scenario 2: Building a Portfolio ``` You: Buy $100 of Bitcoin AI: [Processes purchase] โœ… Purchased 0.000906 BTC for $100.00 You: Also buy $50 of Ethereum AI: [Processes purchase] โœ… Purchased 0.0131 ETH for $50.00 You: What's my portfolio now? AI: [Shows wallet] ๐Ÿ‘› Your Portfolio: ๐Ÿ’ต USD: $850.00 ๐Ÿช™ BTC: 0.000906 ๐Ÿช™ ETH: 0.0131 ๐Ÿ“Š Total Spent: $150.00 ``` ### Scenario 3: Comparing Cryptocurrencies ``` You: How much is 3 beers in Bitcoin vs Ethereum? AI: [Calculates both] ๐Ÿบ Beer Comparison ($15 total): - Bitcoin: 0.00013593 BTC - Ethereum: 0.00394 ETH Would you like to buy either? ``` ## ๐ŸŽ Special Features ### 1. **Visual Transaction Receipts** Every purchase shows: - โœ… Success confirmation - ๐Ÿ’ฐ Amount details - ๐Ÿ“Š Current price - ๐Ÿ†” Transaction ID - ๐Ÿ• Timestamp ### 2. **Real-Time Prices** All calculations use **live Coinbase data**! ### 3. **Smart Tool Selection** The AI automatically: - Calculates before purchasing - Shows wallet after transactions - Suggests related actions ### 4. **Color-Coded Tools** - ๐ŸŸข Green = Transaction success - ๐ŸŸ  Orange = Beer calculator - ๐ŸŸฃ Purple = Wallet info - ๐Ÿ”ต Blue = Market data ## ๐Ÿš€ How It Works (Technical) ### Tool Flow ``` User Query โ†“ AI Analysis (GPT-4) โ†“ Tool Selection (12 available) โ†“ API Call to Backend โ†“ DemoWalletClient Execution โ†“ Real Coinbase Price Fetch โ†“ Transaction Simulation โ†“ Enhanced UI Display โ†“ AI Response with Details ``` ### Available Tools in Chat 1. **get_spot_price** - Current prices 2. **get_market_stats** - 24h statistics 3. **analyze_price_data** - Technical analysis 4. **get_popular_pairs** - Popular trading pairs 5. **search_assets** - Find cryptocurrencies 6. **get_exchange_rates** - Currency rates 7. **calculate_beer_cost** ๐Ÿบ - Beer to crypto 8. **simulate_btc_purchase** ๐Ÿ’ฐ - Buy crypto 9. **get_virtual_wallet** ๐Ÿ‘› - Check balance 10. **get_transaction_history** ๐Ÿ“ - View purchases ## ๐ŸŽฎ Try These Now! ### Fun Queries ``` "How many beers equal 1 full Bitcoin?" "Buy me 2 beers worth of Ethereum" "If I stopped buying coffee for a month ($150), how much SOL could I buy?" "Compare the price of a pizza ($20) in BTC vs ETH" ``` ### Portfolio Building ``` "Buy $50 of Bitcoin" "Buy $30 of Ethereum" "Buy $20 of Cardano" "Show my portfolio value" "What's my transaction history?" ``` ### Market Analysis + Trading ``` "What's the current Bitcoin price?" "Analyze Ethereum's volatility" "Buy $100 of the most stable crypto" "Show me what I've bought and their current values" ``` ## ๐ŸŽจ UI Enhancements ### Chat Message Improvements - **Wallet tool indicator**: ๐Ÿบโ‚ฟ icon on wallet tools - **Colored borders**: Purple for wallet tools - **Expandable details**: Transaction breakdowns - **Balance displays**: Inline wallet balances - **Quick buttons**: New suggested actions ### Suggested Questions Updated to include: - ๐Ÿบ "Buy me a beer worth of Bitcoin" - ๐Ÿ‘› "What's in my virtual wallet?" - ๐Ÿ’ฐ "Buy $10 worth of Ethereum" - ๐Ÿ“ "Show my transaction history" ## ๐Ÿ“Š API Integration ### New Endpoints Used by Chat ```bash GET /api/v1/wallet/calculate-beer-cost?currency=BTC&beerCount=1 POST /api/v1/wallet/purchase GET /api/v1/wallet GET /api/v1/wallet/transactions?limit=10 ``` ### Response Format All wallet tools return structured data that's automatically formatted in the chat UI. ## ๐Ÿ” Safety & Education - โœ… **100% Safe** - All transactions are simulated - โœ… **Real Prices** - Uses live Coinbase data - โœ… **Educational** - Learn transaction flows - โœ… **No Risk** - Virtual money only - โœ… **Persistent** - Wallet persists during session - โœ… **Resettable** - Can reset anytime ## ๐ŸŒŸ Pro Tips 1. **Combine Tools**: Ask complex questions that use multiple tools - "Check Bitcoin price, then buy $10 worth" - "Show my wallet, then buy more if I have enough" 2. **Natural Language**: Talk naturally! - "Get me some Bitcoin" works just as well as technical commands 3. **Voice Input**: Use the microphone to speak your requests! - ๐ŸŽค "Buy me a beer worth of Bitcoin" 4. **Context Aware**: The AI remembers your conversation - "Buy another one" after buying beer - "Show me what I just bought" ## ๐ŸŽฏ Next Steps ### Want More Features? We can add: - Portfolio performance tracking - Price alerts - Crypto-to-crypto swaps - Export transaction history - Visual charts of holdings - Real Coinbase API integration ## ๐Ÿš€ Start Using It! 1. **Make sure API server is running** ```bash cd api-server && npm run dev ``` 2. **Open the chat**: `http://localhost:5173/` 3. **Try it**: "Buy me a beer worth of Bitcoin!" 4. **Check wallet**: Navigate to "Virtual Wallet" page or ask in chat! --- **Have fun buying virtual beer worth of Bitcoin!** ๐Ÿบโ‚ฟ๐ŸŽ‰

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/Bichev/coinbase-chat-mcp'

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