feat: Refactor cookie handling and hash retrieval; update environment configuration and improve logging levels

This commit is contained in:
bohd4nx
2026-01-19 19:02:28 +02:00
parent d299a1f804
commit b1eae1dcb7
15 changed files with 290 additions and 137 deletions
+5 -6
View File
@@ -2,15 +2,14 @@ from typing import Any
import httpx
from app.core import config
class WalletLinker:
def __init__(self, headers: dict, transaction_processor):
def __init__(self, headers: dict, cookies: dict, transaction_processor):
self.headers = headers
self.cookies = cookies
self.transaction_processor = transaction_processor
async def link_wallet(self, account: dict[str, Any]) -> bool:
async def link_wallet(self, account: dict[str, Any], fragment_hash: str) -> bool:
async with httpx.AsyncClient() as client:
data = {
'account': account,
@@ -18,8 +17,8 @@ class WalletLinker:
'method': 'linkWallet'
}
response = await client.post(f"https://fragment.com/api?hash={config.HASH}",
headers=self.headers, data=data)
response = await client.post(f"https://fragment.com/api?hash={fragment_hash}",
headers=self.headers, cookies=self.cookies, data=data)
result = response.json()
if result.get("ok"):