Refactor for GRAM (ex TON) integration

- Updated imports and references from TON to GRAM across multiple modules.
- Renamed functions and variables to reflect the change from TON to GRAM.
- Adjusted validation checks for top-up and recharge amounts to use GRAM limits.
- Modified error messages and exceptions to indicate GRAM instead of TON.
- Updated tests to ensure they reflect the new GRAM terminology and functionality.
- Introduced new constants for GRAM-related configurations.
This commit is contained in:
bohd4nx
2026-06-16 00:47:49 +03:00
parent 3481769757
commit 8f865f4911
38 changed files with 227 additions and 181 deletions
+8 -8
View File
@@ -1,8 +1,11 @@
from __future__ import annotations
from pyfragment.core.constants.gram import DEVICE_INFO, USDT_GRAM_MASTER_ADDRESS
from pyfragment.core.constants.headers import BASE_HEADERS, DEFAULT_TIMEOUT, REQUIRED_COOKIE_KEYS
from pyfragment.core.constants.limits import (
MIN_TON_BALANCE,
GRAM_TOPUP_MAX,
GRAM_TOPUP_MIN,
MIN_GRAM_BALANCE,
MIN_USDT_BALANCE,
MNEMONIC_WORD_COUNTS_VALID,
PREMIUM_MONTHS_VALID,
@@ -14,11 +17,8 @@ from pyfragment.core.constants.limits import (
STARS_PURCHASE_MIN,
STARS_WINNERS_MAX,
STARS_WINNERS_MIN,
TON_TOPUP_MAX,
TON_TOPUP_MIN,
TONAPI_KEY_MIN_LENGTH,
)
from pyfragment.core.constants.ton import DEVICE_INFO, USDT_TON_MASTER_ADDRESS
from pyfragment.core.constants.urls import (
ADS_TOPUP_PAGE,
FRAGMENT_BASE_URL,
@@ -39,7 +39,9 @@ __all__ = [
"FRAGMENT_BASE_URL",
"FRAGMENT_DOMAIN",
"GIFTS_PAGE",
"MIN_TON_BALANCE",
"GRAM_TOPUP_MAX",
"GRAM_TOPUP_MIN",
"MIN_GRAM_BALANCE",
"MIN_USDT_BALANCE",
"MNEMONIC_WORD_COUNTS_VALID",
"NUMBERS_PAGE",
@@ -58,7 +60,5 @@ __all__ = [
"STARS_WINNERS_MAX",
"STARS_WINNERS_MIN",
"TONAPI_KEY_MIN_LENGTH",
"TON_TOPUP_MAX",
"TON_TOPUP_MIN",
"USDT_TON_MASTER_ADDRESS",
"USDT_GRAM_MASTER_ADDRESS",
]
@@ -2,7 +2,7 @@ from __future__ import annotations
from typing import Any
USDT_TON_MASTER_ADDRESS: str = "EQCxE6mUtQJKFnGfaROTKOt1lZbDiiX1kCixRv7Nw2Id_sDs"
USDT_GRAM_MASTER_ADDRESS: str = "EQCxE6mUtQJKFnGfaROTKOt1lZbDiiX1kCixRv7Nw2Id_sDs"
DEVICE_INFO: dict[str, Any] = {
"platform": "iphone",
+4 -4
View File
@@ -16,12 +16,12 @@ STARS_WINNERS_MAX: int = 15
PREMIUM_WINNERS_MIN: int = 1
PREMIUM_WINNERS_MAX: int = 24_000
# TON topup / Ads recharge amount
TON_TOPUP_MIN: int = 1
TON_TOPUP_MAX: int = 1_000_000_000
# GRAM (ex TON) topup / Ads recharge amount
GRAM_TOPUP_MIN: int = 1
GRAM_TOPUP_MAX: int = 1_000_000_000
# Wallet minimum balances
MIN_TON_BALANCE: float = 0.33
MIN_GRAM_BALANCE: float = 0.33
MIN_USDT_BALANCE: float = 0.75
# Premium subscription durations (months)