refactor: migrate to tonutils 2.0.0 and restructure codebase

- Migrate from tonutils 0.5.x to 2.0.0 API:
  - ToncenterClient → TonapiClient with NetworkGlobalID
  - tonutils.client → tonutils.clients
  - tonutils.wallet → tonutils.contracts.wallet
  - pub_key.as_hex property, wallet.balance nanotons
  - async with client context manager

- Centralize TON client init into initialize_ton_client() in wallet.py
- Move process_transaction logic into wallet.py, transaction.py re-exports
- Add WALLET_VERSION config (V4R2/V5R1, default V5R1)
- Add WALLET_CLASSES and SUPPORTED_WALLET_VERSIONS to constants.py
- Restore balance check before broadcasting
- Wait for seqno confirmation after transfer (120×2s) to prevent duplicate seqno

- Fix Fragment hash fetching: use browser navigation headers
- Remove accept-encoding from BASE_HEADERS (httpx handles decompression)
- Add cookies.example.json template
- Add cookies.json to .gitignore
This commit is contained in:
bohd4nx
2026-03-05 05:47:27 +02:00
parent b9c02646be
commit efcdda6b74
19 changed files with 274 additions and 159 deletions
+8 -9
View File
@@ -1,15 +1,14 @@
from app.utils.client import execute_transaction_request, parse_json_response
from app.utils.decoder import clean_decode
from app.utils.hash import get_fragment_hash
from app.utils.transaction import process_transaction
from app.utils.wallet import get_account_info, link_wallet
from app.utils.wallet import get_account_info, link_wallet, process_transaction
__all__ = [
'clean_decode',
'execute_transaction_request',
'get_account_info',
'get_fragment_hash',
'link_wallet',
'parse_json_response',
'process_transaction',
"clean_decode",
"execute_transaction_request",
"get_account_info",
"get_fragment_hash",
"link_wallet",
"parse_json_response",
"process_transaction",
]