bohd4nx
c7b6c6c933
feat: add comprehensive unit tests for FragmentClient methods; include shared test constants
2026-03-21 16:30:44 +02:00
bohd4nx
8135a9da7e
Refactor FragmentAPI to pyfragment
...
- Renamed the package from `fragmentapi` to `pyfragment` across all modules and tests.
- Removed the old wallet utility functions and replaced them with new implementations.
- Updated the `pyproject.toml` to reflect the new package name and repository links.
- Adjusted all import statements in tests to use the new package name.
- Implemented new methods for gifting Telegram Premium, Stars, and topping up TON balance.
- Added exception handling for various error scenarios in the API interactions.
- Created new utility functions for handling HTTP requests and decoding payloads.
- Established a clear structure for types and constants used throughout the library.
2026-03-15 22:07:01 +02:00
bohd4nx
7f269d9a87
refactor: rename error classes for consistency and clarity; update related code and tests
2026-03-15 22:03:32 +02:00
bohd4nx
d2d046a2b9
refactor: restructure as installable PyPI package
...
- Rename app/ → fragmentapi/ for proper package naming
- Add FragmentClient class with gift_premium, gift_stars, topup_ton methods
- Restructure core/ → types/ (exceptions, results, constants)
- Merge utils/hash.py into utils/client.py
- Replace _version.py with importlib.metadata
- Add input validation with min/max bounds
- Add unit tests: decode, client init/cookies
- Rename 002_test_hash → 003_test_hash
- Clean up pyproject.toml: pin deps, production classifiers
2026-03-15 21:03:03 +02:00
bohd4nx
efcdda6b74
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
2026-03-05 05:47:27 +02:00
bohd4nx
f57f8271c3
test: add pytest test files (were missing from previous commit)
2026-03-05 04:18:55 +02:00