Building a Telegram Bot with Breeze SDK This guide demonstrates how to build a fully functional Telegram bot for DeFi yield farming using the Breeze SDK. The bot provides a conversational interface for users to deposit stablecoins, earn yield, and withdraw funds seamlessly. 
Functionality Your browser does not support the video tag. Test it yourself If the bot will be running on our hardware, then you will be able to test it yourself.
You can find it under @breeze_integration_bot  handle or under this link . 
Code Location GitHub Repo Find out the github repository with the full code 
Overview The Breeze SDK Telegram Bot enables users to: 
Manage Wallets : Generate new keypairs or import existing onesReal-time Portfolio Tracking : View current balances and yield positions with live APY dataDetailed Balance Views : See comprehensive breakdowns of all fund positionsYield History : Track earnings over time with pagination supportSeamless Deposits : Deposit USDC into yield-generating fundsFlexible Withdrawals : Withdraw funds with percentage-based or custom amountsTransaction Management : Sign and submit transactions directly through Telegram 
The Breeze SDK (@breezebaby/breeze-sdk) abstracts away complex API interactions, providing a clean interface for deposit/withdraw operations and real-time portfolio management. 
Project Setup Dependencies {   "dependencies" : {     "@solana/web3.js" :  "^1.98.2" ,     "@solana/spl-token" :  "^0.4.13" ,     "node-telegram-bot-api" :  "^0.66.0" ,     "@breezebaby/breeze-sdk" :  "^1.5.0" ,     "bs58" :  "^6.0.0" ,     "dotenv" :  "^16.5.0"   },   "devDependencies" : {     "typescript" :  "^5.0.0" ,     "@types/node" :  "^20.0.0" ,     "@types/node-telegram-bot-api" :  "^0.64.9"   } } TypeScript Configuration {   "compilerOptions" : {     "target" :  "ES2020" ,     "module" :  "ES2020" ,     "moduleResolution" :  "bundler" ,     "esModuleInterop" :  true ,     "allowSyntheticDefaultImports" :  true ,     "skipLibCheck" :  true ,     "outDir" :  "./dist" ,     "rootDir" :  "./src"   } } Make sure to set "type": "module" in your package.json to use ES modules with the Breeze SDK. 
Core Implementation SDK Initialization import  TelegramBot  from  'node-telegram-bot-api' ; import  {  Connection ,  PublicKey ,  Keypair ,  VersionedTransaction  }  from  '@solana/web3.js' ; import  {  BreezeSDK  }  from  '@breezebaby/breeze-sdk' ; import  dotenv  from  'dotenv' ; dotenv . config (); class  BreezeBot  {     private  bot :  TelegramBot ;     private  connection :  Connection ;     private  breezeSDK :  BreezeSDK ;     private  users :  Map < number ,  UserData >  =  new  Map ();     constructor () {         this . bot  =  new  TelegramBot ( process . env . BOT_TOKEN ! , {  polling:  true  });         this . connection  =  new  Connection ( process . env . SOLANA_RPC_URL  ||  'https://api.mainnet-beta.solana.com' );                  // Initialize Breeze SDK         this . breezeSDK  =  new  BreezeSDK ({             baseUrl:  'https://api.breeze.baby/' ,             apiKey:  process . env . BREEZE_API_KEY !         });                  this . setupHandlers ();     } } User Data Management interface  UserData  {     keypair ?:  Keypair ;     publicKey ?:  string ;     currentMenu ?:  string ;     pendingTransaction ?:  {         serializedTx :  string ;         type :  'deposit'  |  'withdraw' ;         amount ?:  number ;         asset ?:  string ;     }; } Token Configuration const  TOKEN_DECIMALS  =  {     USDC:  6 ,     USDT:  6 ,     PYUSD:  6 ,     USDS:  6 ,     SOL:  9 }; const  TOKEN_MINTS  =  {     USDC:  'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v' ,     USDT:  'Es9vMFrzaCERmJfrF4H2FYD4KCoNkY7xgxACzBn3wqHg' ,     PYUSD:  'CXk2AMBfi3TwaEL2468s6zP8xq9NxTXjp9gjMgzeUynM' ,     USDS:  '2b1kV6DkPAnxd5ixfnxCpjxmKwqjjaYmCZfHsFu24GXo' }; SDK Integration Methods Real-time Portfolio Tracking private  async  getUserCurrentValue ( userPublicKey :  string ):  Promise < number >  {     try {         const  data  =  await  this . breezeSDK . getUserBalances ({             userId:  userPublicKey         });         // Calculate total from data array         let  total  =  0 ;         for  ( const  balance  of  data . data ) {             if  ( balance . yield_balance ) {                 total  +=  parseFloat ( balance . yield_balance . funds )  /  Math . pow ( 10 ,  balance . decimals );             }         }         return  total ;     } catch (error) {         console. error ( 'Error fetching user current value:' ,  error );         return  0 ;     } } Real-time Yield Data private  async  getBreezeYieldFromAPI ( userPublicKey :  string ):  Promise < number >  {     try {         const  yieldData  =  await  this . breezeSDK . getUserYield ({             userId:  userPublicKey         });         if  ( ! yieldData  ||  ! yieldData . data  ||  yieldData . data . length  ===  0 ) {             return  0 ;         }         // Calculate average APY from all positions         let  totalAPY  =  0 ;         let  count  =  0 ;                  for  ( const  position  of  yieldData . data ) {             const  apy  =  parseFloat ( position . apy );             if  ( ! isNaN ( apy )) {                 totalAPY  +=  apy ;                 count ++ ;             }         }         return  count  >  0  ?  totalAPY  /  count  :  0 ;     } catch (error) {         console. error ( 'Error calculating Breeze yield:' ,  error );         return  0 ;     } } Deposit Transaction Processing private  async  processDeposit ( chatId :  number ,  percentage ?:  number ,  customAmount ?:  number ) {     const  userData  =  this . users . get ( chatId ) ! ;     const  balances  =  await  this . getBalances ( userData . publicKey ! );     let  tokenAmount :  bigint ;     let  humanAmount :  number ;     let  isAll  =  false ;     // Calculate amounts based on user selection     if  ( percentage  ===  100 ) {         tokenAmount  =  balances . usdc . raw ;         humanAmount  =  balances . usdc . human ;         isAll  =  true ;     }  else  if  ( percentage  ===  50 ) {         tokenAmount  =  balances . usdc . raw  /  BigInt ( 2 );         humanAmount  =  this . convertFromTokenAmount ( tokenAmount ,  'USDC' );     }  else  if  ( customAmount ) {         humanAmount  =  customAmount ;         tokenAmount  =  this . convertToTokenAmount ( customAmount ,  'USDC' );     }     if  ( tokenAmount  <=  0 ) {         await  this . bot . sendMessage ( chatId ,  '❌ Insufficient USDC balance!' );         return ;     }     try  {         // Call Breeze SDK for deposit         const  data  =  await  this . breezeSDK . createDepositTransaction ({             fundId:  process . env . BREEZE_FUND_ID ! ,             amount:  Number ( tokenAmount ),             all:  isAll ,             userKey:  userData . publicKey ! ,             payerKey:  undefined         });         // Check if response is string (success) or error object         if  ( typeof  data  ===  'object'  &&  'message'  in  data ) {             await  this . bot . sendMessage ( chatId ,  `❌ Error:  ${ data . message } ` );             return ;         }         // Store pending transaction for user confirmation         userData . pendingTransaction  =  {             serializedTx:  data  as  string ,             type:  'deposit' ,             amount:  humanAmount ,             asset:  'USDC'         };         await  this . showTransactionConfirmation ( chatId ,  'deposit' ,  humanAmount ,  'USDC' );     }  catch  ( error ) {         console . error ( 'Deposit error:' ,  error );         await  this . bot . sendMessage ( chatId ,  '❌ Failed to create deposit transaction. Please try again.' );     } } Withdraw Transaction Processing private  async  processWithdraw ( chatId :  number ,  percentage ?:  number ,  customAmount ?:  number ) {     const  userData  =  this . users . get ( chatId ) ! ;     const  breezeBalance  =  await  this . getUserCurrentValue ( userData . publicKey ! );     let  humanAmount :  number ;     let  isAll  =  false ;     let  tokenAmount :  number ;     if  ( percentage  ===  100 ) {         humanAmount  =  breezeBalance ;         isAll  =  true ;         // For 100% withdrawals, we pass 0 as amount and set all=true         tokenAmount  =  0 ;     }  else  if  ( percentage  ===  50 ) {         humanAmount  =  breezeBalance  *  0.5 ;         tokenAmount  =  Number ( this . convertToTokenAmount ( humanAmount ,  'USDC' ));     }  else  if  ( customAmount ) {         humanAmount  =  customAmount ;         tokenAmount  =  Number ( this . convertToTokenAmount ( customAmount ,  'USDC' ));     }     if  ( humanAmount  <=  0 ) {         await  this . bot . sendMessage ( chatId ,  '❌ No funds available to withdraw!' );         return ;     }     try  {         // Call Breeze SDK for withdraw         const  data  =  await  this . breezeSDK . createWithdrawTransaction ({             fundId:  process . env . BREEZE_FUND_ID ! ,             amount:  tokenAmount ,             all:  isAll ,             userKey:  userData . publicKey ! ,             payerKey:  undefined         });         // Check if response is string (success) or error object         if  ( typeof  data  ===  'object'  &&  'message'  in  data ) {             await  this . bot . sendMessage ( chatId ,  `❌ Error:  ${ data . message } ` );             return ;         }         userData . pendingTransaction  =  {             serializedTx:  data  as  string ,             type:  'withdraw' ,             amount:  humanAmount ,             asset:  'USDC'         };         await  this . showTransactionConfirmation ( chatId ,  'withdraw' ,  humanAmount ,  'USDC' );     }  catch  ( error ) {         console . error ( 'Withdraw error:' ,  error );         await  this . bot . sendMessage ( chatId ,  '❌ Failed to create withdrawal transaction. Please try again.' );     } } New SDK-Powered Features Detailed Balance View private  async  showDetailedBalances ( chatId :  number ) {     const  userData  =  this . users . get ( chatId ) ! ;     const  publicKey  =  userData . publicKey ! ;     try  {         const  breezeBalances  =  await  this . breezeSDK . getUserBalances ({             userId:  publicKey         });         let  message  =  '💳 **Detailed Breeze Balances** 💳 \n\n ' ;                  // Calculate totals from data array         let  totalPortfolioValue  =  0 ;         let  totalYieldEarned  =  0 ;                  for  ( const  balance  of  breezeBalances . data ) {             if  ( balance . yield_balance ) {                 const  funds  =  parseFloat ( balance . yield_balance . funds )  /  Math . pow ( 10 ,  balance . decimals );                 const  yieldAmount  =  parseFloat ( balance . yield_balance . amount_of_yield )  /  Math . pow ( 10 ,  balance . decimals );                 totalPortfolioValue  +=  funds ;                 totalYieldEarned  +=  yieldAmount ;             }         }         message  +=  `💰 **Total Portfolio Value:** $ ${ totalPortfolioValue . toFixed ( 2 ) } \n ` ;         message  +=  `🎯 **Total Yield Earned:** $ ${ totalYieldEarned . toFixed ( 2 ) } \n\n ` ;         if  ( breezeBalances . data . length  ===  0 ) {             message  +=  'No positions found in Breeze.' ;         }  else  {             for  ( const  balance  of  breezeBalances . data ) {                 const  totalBalance  =  balance . total_balance  /  Math . pow ( 10 ,  balance . decimals );                                  message  +=  `** ${ balance . token_symbol } ** \n ` ;                 message  +=  `• Total Balance:  ${ totalBalance . toFixed ( 6 ) } \n ` ;                 if  ( balance . yield_balance ) {                     const  funds  =  parseFloat ( balance . yield_balance . funds )  /  Math . pow ( 10 ,  balance . decimals );                     const  yieldAmount  =  parseFloat ( balance . yield_balance . amount_of_yield )  /  Math . pow ( 10 ,  balance . decimals );                     const  apy  =  balance . yield_balance . fund_apy ;                                          message  +=  `• Breeze Position:  ${ funds . toFixed ( 6 ) } \n ` ;                     message  +=  `• Yield Earned: $ ${ yieldAmount . toFixed ( 6 ) } \n ` ;                     message  +=  `• APY:  ${ apy . toFixed ( 2 ) } % \n ` ;                 }  else  {                     message  +=  `• No Breeze position \n ` ;                 }                 message  +=  ' \n ' ;             }         }         const  keyboard  =  {             inline_keyboard:  [                 [{  text:  '🔙 Back to Main' ,  callback_data:  'back_to_main'  }]             ]         };         await  this . bot . sendMessage ( chatId ,  message , {             parse_mode:  'Markdown' ,             reply_markup:  keyboard         });     }  catch  ( error ) {         console . error ( 'Error fetching detailed balances:' ,  error );         await  this . bot . sendMessage ( chatId ,  '❌ Unable to fetch Breeze balances. Please try again later.' );     } } Yield History Tracking private  async  showYieldHistory ( chatId :  number ) {     const  userData  =  this . users . get ( chatId ) ! ;     const  publicKey  =  userData . publicKey ! ;     try  {         const  yieldData  =  await  this . breezeSDK . getUserYield ({             userId:  publicKey         });         let  message  =  '📈 **Yield History** 📈 \n\n ' ;                  // Calculate total yield earned from data array         let  totalYieldEarned  =  0 ;         for  ( const  yieldEntry  of  yieldData . data ) {             totalYieldEarned  +=  parseFloat ( yieldEntry . yield_earned );         }                  message  +=  `💰 **Total Yield Earned:** $ ${ totalYieldEarned . toFixed ( 2 ) } \n\n ` ;         if  ( yieldData . data . length  ===  0 ) {             message  +=  'No yield history found.' ;         }  else  {             for  ( const  yieldEntry  of  yieldData . data ) {                 const  entryDate  =  new  Date ( yieldEntry . entry_date ). toLocaleDateString ();                 const  lastUpdated  =  new  Date ( yieldEntry . last_updated ). toLocaleDateString ();                                  message  +=  `** ${ yieldEntry . fund_name } ** ( ${ yieldEntry . base_asset } ) \n ` ;                 message  +=  `• Position Value: $ ${ parseFloat ( yieldEntry . position_value ). toFixed ( 2 ) } \n ` ;                 message  +=  `• Yield Earned: $ ${ parseFloat ( yieldEntry . yield_earned ). toFixed ( 2 ) } \n ` ;                 message  +=  `• APY:  ${ parseFloat ( yieldEntry . apy ). toFixed ( 2 ) } % \n ` ;                 message  +=  `• Entry Date:  ${ entryDate } \n ` ;                 message  +=  `• Last Updated:  ${ lastUpdated } \n\n ` ;             }             if  ( yieldData . meta . total_pages  >  1 ) {                 message  +=  `📄 Page  ${ yieldData . meta . page }  of  ${ yieldData . meta . total_pages }  ( ${ yieldData . meta . total }  total items)` ;             }         }         const  keyboard  =  {             inline_keyboard:  [                 [{  text:  '🔙 Back to Main' ,  callback_data:  'back_to_main'  }]             ]         };         await  this . bot . sendMessage ( chatId ,  message , {             parse_mode:  'Markdown' ,             reply_markup:  keyboard         });     }  catch  ( error ) {         console . error ( 'Error fetching yield history:' ,  error );         await  this . bot . sendMessage ( chatId ,  '❌ Unable to fetch yield history. Please try again later.' );     } } User Interface Components Enhanced Main Dashboard private  async  showMainInterface ( chatId :  number ) {     const  userData  =  this . users . get ( chatId ) ! ;     const  publicKey  =  userData . publicKey ! ;     const  balances  =  await  this . getBalances ( publicKey );     const  breezeBalance  =  await  this . getUserCurrentValue ( publicKey );     const  currentYield  =  await  this . getBreezeYieldFromAPI ( publicKey );     const  message  =         '🌊 **BREEZE INTEGRATION BOT** 🌊 \n\n '  +         `💳 Wallet:  \` ${ publicKey . slice ( 0 ,  8 ) } ... ${ publicKey . slice ( - 8 ) } \`\n\n `  +         '💰 **Balances:** \n '  +         `• SOL:  ${ balances . sol . toFixed ( 4 ) }  ◎ \n `  +         `• USDC:  ${ balances . usdc . human . toFixed ( 2 ) }  💵 \n `  +         `• USDT:  ${ balances . usdt . human . toFixed ( 2 ) }  💵 \n `  +         `• PYUSD:  ${ balances . pyusd . human . toFixed ( 2 ) }  💵 \n `  +         `• USDS:  ${ balances . usds . human . toFixed ( 2 ) }  💵 \n\n `  +         `🌊 **Breeze Balance:** $ ${ breezeBalance . toFixed ( 2 ) } \n `  +         `📈 **Current APY:**  ${ currentYield . toFixed ( 2 ) } % \n\n `  +         '🚀 Ready to earn yield with Breeze!' ;     const  keyboard  =  {         inline_keyboard:  [             [{  text:  '🌊 Earn Yield with Breeze' ,  callback_data:  'earn_yield'  }],             [                 {  text:  '💳 Detailed Balances' ,  callback_data:  'view_balances'  },                 {  text:  '📈 Yield History' ,  callback_data:  'view_yield_history'  }             ],             [                 {  text:  '💸 Buy' ,  callback_data:  'buy_mock'  },                 {  text:  '💰 Sell' ,  callback_data:  'sell_mock'  }             ],             [                 {  text:  '📊 Positions' ,  callback_data:  'positions_mock'  },                 {  text:  '📋 Limit Orders' ,  callback_data:  'limit_orders_mock'  }             ]         ]     };     await  this . bot . sendMessage ( chatId ,  message , {         parse_mode:  'Markdown' ,         reply_markup:  keyboard     }); } Yield Interface with Real Data private  async  showEarnYieldInterface ( chatId :  number ) {     const  userData  =  this . users . get ( chatId ) ! ;     const  publicKey  =  userData . publicKey ! ;     const  balances  =  await  this . getBalances ( publicKey );     const  currentYield  =  await  this . getBreezeYieldFromAPI ( publicKey );     const  breezeBalance  =  await  this . getUserCurrentValue ( publicKey );     const  message  =         '🌊 **Earn Yield with Breeze** 🌊 \n\n '  +         '💰 **Current Balances:** \n '  +         `• USDC:  ${ balances . usdc . human . toFixed ( 2 ) }  💵 \n `  +         `• USDT:  ${ balances . usdt . human . toFixed ( 2 ) }  💵 \n `  +         `• PYUSD:  ${ balances . pyusd . human . toFixed ( 2 ) }  💵 \n `  +         `• USDS:  ${ balances . usds . human . toFixed ( 2 ) }  💵 \n\n `  +         `📈 **Current Breeze Yield:**  ${ currentYield . toFixed ( 1 ) } % APY \n `  +         `🌊 **Deposited in Breeze:** $ ${ breezeBalance . toFixed ( 2 ) } \n\n `  +         '💡 Earn passive yield on your stablecoins!' ;     const  keyboard  =  {         inline_keyboard:  [             [                 {  text:  '📥 Deposit' ,  callback_data:  'deposit'  },                 {  text:  '📤 Withdraw' ,  callback_data:  'withdraw'  }             ],             [{  text:  '🔙 Back to Main' ,  callback_data:  'back_to_main'  }]         ]     };     await  this . bot . sendMessage ( chatId ,  message , {         parse_mode:  'Markdown' ,         reply_markup:  keyboard     }); } Transaction Management Transaction Confirmation Flow private  async  showTransactionConfirmation ( chatId :  number ,  type :  string ,  amount :  number ,  asset :  string ) {     const  message  =         `✅ **Confirm  ${ type . charAt ( 0 ). toUpperCase ()  +  type . slice ( 1 ) } ** ✅ \n\n `  +         `💰 Amount:  ${ amount . toFixed ( 6 ) }  ${ asset } \n `  +         `🎯 Action:  ${ type . charAt ( 0 ). toUpperCase ()  +  type . slice ( 1 ) }  ${ type  ===  'deposit'  ?  'to'  :  'from' }  Breeze \n\n `  +         '⚠️ Please confirm this transaction:' ;     const  keyboard  =  {         inline_keyboard:  [             [{  text:  '✅ Confirm Transaction' ,  callback_data:  'confirm_transaction'  }],             [{  text:  '❌ Cancel' ,  callback_data:  'earn_yield'  }]         ]     };     await  this . bot . sendMessage ( chatId ,  message , {         parse_mode:  'Markdown' ,         reply_markup:  keyboard     }); } Transaction Signing and Submission private  async  confirmTransaction ( chatId :  number ) {     const  userData  =  this . users . get ( chatId ) ! ;     const  pendingTx  =  userData . pendingTransaction ;     if  ( ! pendingTx ) {         await  this . bot . sendMessage ( chatId ,  '❌ No pending transaction found.' );         return ;     }     try  {         // Deserialize and sign the transaction         const  transaction  =  VersionedTransaction . deserialize (             Buffer . from ( pendingTx . serializedTx ,  'base64' )         );                  transaction . sign ([ userData . keypair ! ]);         // Submit to Solana network         const  signature  =  await  this . connection . sendTransaction ( transaction );                  await  this . bot . sendMessage ( chatId ,  '⏳ Transaction sent! Waiting for confirmation...' );         // Wait for confirmation         const  confirmation  =  await  this . connection . confirmTransaction ( signature ,  'confirmed' );                  if  ( confirmation . value . err ) {             await  this . bot . sendMessage ( chatId ,  '❌ Transaction failed!' );             return ;         }         const  action  =  pendingTx . type  ===  'deposit'  ?  'deposited to'  :  'withdrawn from' ;         await  this . bot . sendMessage ( chatId ,             `🎉 **Successfully  ${ action }  Breeze!** \n\n `  +             `💰 Amount:  ${ pendingTx . amount ?. toFixed ( 2 ) }  ${ pendingTx . asset } \n `  +             `🔗 Transaction:  \` ${ signature } \` ` ,             {  parse_mode:  'Markdown'  }         );         // Clear pending transaction         userData . pendingTransaction  =  undefined ;                  setTimeout (()  =>  this . showMainInterface ( chatId ),  2000 );     }  catch  ( error ) {         console . error ( 'Transaction error:' ,  error );         await  this . bot . sendMessage ( chatId ,  '❌ Failed to process transaction. Please try again.' );     } } Event Handling Complete Callback Handler private  async  handleCallbackQuery ( query :  TelegramBot . CallbackQuery ) {     const  chatId  =  query . message ! . chat . id ;     const  data  =  query . data ! ;          await  this . bot . answerCallbackQuery ( query . id );          switch  ( data ) {         case  'earn_yield' :             await  this . showEarnYieldInterface ( chatId );             break ;         case  'deposit' :             await  this . showDepositInterface ( chatId );             break ;         case  'withdraw' :             await  this . showWithdrawInterface ( chatId );             break ;         case  'deposit_usdc_100' :             await  this . processDeposit ( chatId ,  100 );             break ;         case  'withdraw_100' :             await  this . processWithdraw ( chatId ,  100 );             break ;         case  'confirm_transaction' :             await  this . confirmTransaction ( chatId );             break ;         case  'view_balances' :             await  this . showDetailedBalances ( chatId );             break ;         case  'view_yield_history' :             await  this . showYieldHistory ( chatId );             break ;         case  'back_to_main' :             await  this . showMainInterface ( chatId );             break ;         // ... other cases     } } Key Features Wallet Management 
Keypair Generation : Create new Solana keypairs securelyPrivate Key Import : Import existing wallets using base58 encoded private keysBalance Tracking : Real-time SOL and SPL token balance monitoringMulti-Asset Support : USDC, USDT, PYUSD, and USDS compatibility 
Advanced Yield Farming 
Seamless Deposits : Deposit stablecoins into Breeze yield fundsFlexible Withdrawals : Withdraw with percentage options (50%, 100%) or custom amountsReal-time Portfolio : Live tracking of deposited amounts and yield earningsLive APY Data : Real-time yield rates from the Breeze APIDetailed Analytics : Comprehensive balance breakdowns by asset and fundYield History : Track earnings over time with pagination support 
Enhanced User Experience 
Inline Keyboards : Rich interactive interfaces with buttons and menusProgressive Disclosure : Step-by-step flows for complex operationsReal-time Data : All data fetched live from Breeze APIsError Handling : Comprehensive error messages and recovery optionsTransaction Feedback : Real-time updates during transaction processing 
SDK Integration Benefits 
Simplified API : Clean abstraction over complex DeFi operationsType Safety : Full TypeScript support with proper type definitionsError Handling : Structured error responses for debuggingLive Data : Real-time balance and yield information 
Environment Setup # Required environment variables BOT_TOKEN = your_telegram_bot_token SOLANA_RPC_URL = https://api.mainnet-beta.solana.com BREEZE_API_KEY = your_breeze_api_key BREEZE_FUND_ID = your_fund_id Build and Run # Install dependencies npm  install # Build the project npm  run  build # Start the bot npm  start API Methods Used The bot integrates with these Breeze SDK methods: 
getUserBalances Get detailed user balance information including yield positions 
getUserYield Get user yield history and stats with pagination support 
createDepositTransaction Create deposit transactions for yield-generating funds 
createWithdrawTransaction Create withdraw transactions with flexible amount options 
UserBalances Response {   data : [     {       token_address:  string ;       token_symbol :  string ;       token_name :  string ;       decimals :  number ;       total_balance :  number ;       yield_balance : {         fund_id:  string ;         funds :  string ;         amount_of_yield :  string ;         fund_apy :  number ;       }  |  null ;     }   ];   meta : {     page :  number ;     per_page :  number ;     total :  number ;     total_pages :  number ;     has_more :  boolean ;   }; } UserYield Response {   data : [     {       fund_id:  string ;       fund_name :  string ;       base_asset :  string ;       position_value :  string ;       yield_earned :  string ;       apy :  string ;       entry_date :  string ;       last_updated :  string ;     }   ];   meta : {     page :  number ;     per_page :  number ;     total :  number ;     total_pages :  number ;     has_more :  boolean ;   }; } Transaction Responses Transaction methods return either: 
string - Base64 encoded transaction (success){ message: string } - Error object with error message 
Best Practices Security Considerations 
Private Key Handling : Never log or expose private keys in plain textEnvironment Variables : Use secure environment variable managementInput Validation : Validate all user inputs before processingRate Limiting : Implement rate limiting to prevent abuse 
Connection Pooling : Reuse Solana RPC connectionsSDK Caching : SDK handles caching appropriatelyAsync Operations : Use async/await for all I/O operationsError Recovery : Implement robust error handling and retry logic 
Troubleshooting SDK Connection Issues 
Verify API key is correct and active 
Check network connectivity to Breeze API 
Ensure proper environment variable configuration 
Review API rate limits and quotas 
 
Transaction Failures 
Check user has sufficient SOL for transaction fees 
Verify token account exists and has sufficient balance 
Ensure transaction isn’t expired or malformed 
Check Solana network status 
 
Balance Discrepancies 
SDK provides real-time data from Breeze API 
Check for pending transactions 
Verify decimal conversion accuracy 
Review fund calculation logic 
 
Conclusion The updated Breeze SDK integration provides powerful real-time portfolio tracking and yield farming capabilities. The bot now offers: 
Live Data : Real-time balances, yields, and APY informationEnhanced UX : Detailed balance views and yield history trackingReliable Transactions : SDK-powered deposit and withdraw operationsType Safety : Full TypeScript support for robust development 
This implementation demonstrates how the Breeze SDK simplifies DeFi integration while providing comprehensive functionality for yield farming applications. 
This implementation provides a solid foundation that can be extended with additional features like multi-asset support, advanced analytics, automated rebalancing, and more sophisticated user management. 
For additional support and advanced integration patterns, consult the Breeze SDK documentation  or reach out to the development team.