import asyncio import logging from app.core import setup_logging from app.methods import buy_premium, buy_stars, topup_ton logger = logging.getLogger(__name__) async def topup_ton_example(): logger.info("Starting TON topup example") # @bohd4nx - target username, 100 - TON amount (integer 1-1000000000 (one billion)) # show_sender=True — recipient sees who sent the topup result = await topup_ton("@bohd4nx", 100, show_sender=True) if result["success"]: pass # Transaction successful, details are logged in the method else: logger.error(f"TON topup failed: {result['error']}") async def buy_premium_example(): logger.info("Starting Premium purchase example") # @bohd4nx - target username, 12 - months duration (3, 6, or 12 only) # show_sender=True — recipient sees who gifted the Premium result = await buy_premium("@bohd4nx", 12, show_sender=True) if result["success"]: pass # Transaction successful, details are logged in the method else: logger.error(f"Premium purchase failed: {result['error']}") async def buy_stars_example(): logger.info("Starting Stars purchase example") # @bohd4nx - target username, 1000000 - stars amount (integer 50-1000000 (one million)) # show_sender=True — recipient sees who sent the Stars result = await buy_stars("@bohd4nx", 1000000, show_sender=True) if result["success"]: pass # Transaction successful, details are logged in the method else: logger.error(f"Stars purchase failed: {result['error']}") async def main(): setup_logging() logger.info("Starting Fragment API by @bohd4nx - examples") await topup_ton_example() await buy_premium_example() await buy_stars_example() logger.info("All examples completed") if __name__ == "__main__": logger.info("Fragment API by @bohd4nx - Usage Examples") logger.info("Supported username formats: @username, username") logger.info("Limits: TON minimum 1, Premium 3/6/12 months, Stars minimum 50") logger.info("Setup: Copy .env.example to .env and fill all fields") asyncio.run(main())