mirror of
https://github.com/bohd4nx/FragmentAPI.git
synced 2026-07-30 00:37:51 +00:00
docs: update documentation to reflect changes from TON to GRAM, including method renaming and new top-up method
This commit is contained in:
@@ -11,6 +11,7 @@ Good error handling is the difference between a stable integration and random pr
|
||||
- `FragmentAPIError`
|
||||
- `FragmentPageError`
|
||||
- `UserNotFoundError`
|
||||
- `AlreadySubscribedError`
|
||||
- `AnonymousNumberError`
|
||||
- `TransactionError`
|
||||
- `ParseError`
|
||||
@@ -44,7 +45,9 @@ except FragmentError:
|
||||
|
||||
## Method-to-error mapping
|
||||
|
||||
- Stars/Premium purchase and giveaway: `ConfigurationError`, `UserNotFoundError`, `WalletError`, `VerificationError`
|
||||
- Stars purchase: `ConfigurationError`, `UserNotFoundError`, `WalletError`, `VerificationError`
|
||||
- Premium purchase: `ConfigurationError`, `UserNotFoundError`, `AlreadySubscribedError`, `WalletError`, `VerificationError`
|
||||
- Stars/Premium giveaway: `ConfigurationError`, `UserNotFoundError`, `WalletError`, `VerificationError`
|
||||
- Ads operations: `ConfigurationError`, `UserNotFoundError`, `WalletError`, `VerificationError`
|
||||
- Cookies/auth setup: `CookieError`, `ConfigurationError`, `FragmentPageError`
|
||||
|
||||
|
||||
@@ -2,22 +2,52 @@
|
||||
|
||||
These literals describe accepted string values for key method parameters.
|
||||
|
||||
## ApiProvider
|
||||
|
||||
```python
|
||||
from pyfragment.enums import ApiProvider
|
||||
|
||||
ApiProvider.TONAPI # tonconsole.com — default
|
||||
ApiProvider.TONCENTER # t.me/toncenter
|
||||
```
|
||||
|
||||
Pass as string to `FragmentClient(api_provider=...)`:
|
||||
|
||||
```python
|
||||
FragmentClient(..., api_provider="tonapi") # default
|
||||
FragmentClient(..., api_provider="toncenter")
|
||||
```
|
||||
|
||||
## PaymentMethod
|
||||
|
||||
```python
|
||||
PaymentMethod = Literal["ton", "usdt_ton"]
|
||||
from pyfragment.enums import PaymentMethod
|
||||
|
||||
PaymentMethod.GRAM # GRAM (ex TON) — default
|
||||
PaymentMethod.USDT_GRAM # USDT on GRAM (ex TON)
|
||||
PaymentMethod.USDT_ETH # USDT on Ethereum
|
||||
PaymentMethod.USDT_POL # USDT on Polygon
|
||||
PaymentMethod.USDC_ETH # USDC on Ethereum
|
||||
PaymentMethod.USDC_BASE # USDC on Base
|
||||
PaymentMethod.USDC_POL # USDC on Polygon
|
||||
```
|
||||
|
||||
## WalletVersion
|
||||
|
||||
```python
|
||||
WalletVersion = Literal["V4R2", "V5R1"]
|
||||
from pyfragment.enums import WalletVersion
|
||||
|
||||
WalletVersion.V5R1 # default
|
||||
WalletVersion.V4R2
|
||||
WalletVersion.HighloadV2
|
||||
WalletVersion.HighloadV3R1
|
||||
```
|
||||
|
||||
These literals are exported from `pyfragment` (top-level), `pyfragment.models`, and `pyfragment.models.enums`.
|
||||
All enums are exported from both `pyfragment` (top-level) and `pyfragment.enums`.
|
||||
|
||||
## Usage notes
|
||||
|
||||
- Use `ApiProvider` when configuring the blockchain API provider in `FragmentClient`.
|
||||
- Use `PaymentMethod` for purchase and giveaway operations.
|
||||
- Use `WalletVersion` when configuring `FragmentClient`.
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ Exported result models:
|
||||
- `AdsRechargeResult(transaction_id, amount)`
|
||||
- `StarsGiveawayResult(transaction_id, channel, winners, amount)`
|
||||
- `PremiumGiveawayResult(transaction_id, channel, winners, amount)`
|
||||
- `WalletInfo(address, state, ton_balance, usdt_balance)`
|
||||
- `WalletInfo(address, state, gram_balance, usdt_balance)`
|
||||
- `LoginCodeResult(number, code, active_sessions)`
|
||||
- `TerminateSessionsResult(number, message)`
|
||||
- `UsernamesResult(items, next_offset_id)`
|
||||
@@ -26,7 +26,7 @@ Most high-level methods return one of these dataclasses.
|
||||
- `purchase_premium()`: `PremiumResult`
|
||||
- `giveaway_stars()`: `StarsGiveawayResult`
|
||||
- `giveaway_premium()`: `PremiumGiveawayResult`
|
||||
- `topup_ton()`: `AdsTopupResult`
|
||||
- `topup_gram()`: `AdsTopupResult`
|
||||
- `recharge_ads()`: `AdsRechargeResult`
|
||||
- `get_wallet()`: `WalletInfo`
|
||||
- `get_login_code()`: `LoginCodeResult`
|
||||
|
||||
Reference in New Issue
Block a user