refactor: update API key source in .env.example and enhance README with badges and feature descriptions

feat: improve logging levels for HTTP clients and add detailed logging in premium and stars purchase methods
chore: remove unused transaction utility and adjust wallet processing logic
test: add end-to-end integration test for buying Stars
This commit is contained in:
bohd4nx
2026-03-05 06:26:49 +02:00
parent efcdda6b74
commit 7f3c3ea1c3
9 changed files with 162 additions and 163 deletions
+10
View File
@@ -81,14 +81,23 @@ async def topup_ton(username: str, amount: int) -> dict:
return {"success": False, "error": "Amount must be an integer >= 1 TON."}
try:
logger.info("Loading session cookies")
cookies = load_cookies()
logger.info("Fetching Fragment session hash")
fragment_hash = await get_fragment_hash(cookies, HEADERS, ADS_PAGE)
# logger.info("Retrieving TON wallet info")
account = await get_account_info()
async with httpx.AsyncClient() as client:
logger.info("Searching recipient: %s", username)
recipient = await search_ads_recipient(client, fragment_hash, cookies, username)
logger.info("Initializing topup request: %s TON to %s", amount, username)
req_id = await init_ads_topup(client, fragment_hash, cookies, recipient, amount)
# logger.info("Requesting transaction payload (req_id=%s)", req_id)
tx_data = {
"account": json.dumps(account),
"device": DEVICE,
@@ -101,6 +110,7 @@ async def topup_ton(username: str, amount: int) -> dict:
client, HEADERS, cookies, account, tx_data, fragment_hash
)
logger.info("Broadcasting transaction to TON blockchain")
tx_hash = await process_transaction(transaction)
return {
"success": True,