Async No-KYC Fragment.com client. Buys Stars / Premium / Ads top-up via a remote backend without KYC.
Project description
Fragment API Python SDK โ No KYC Edition
Lightweight Python library for Fragment.com automation
No KYC required โ Send Stars, Premium, and TON Ads directly from your wallet
๐ What is This?
This is the No KYC edition of the Fragment API Python library.
Key differences from the full KYC version:
| Feature | No KYC Edition | Full KYC Edition |
|---|---|---|
| KYC Required | โ No | โ Yes |
| Purchase Stars | โ Yes | โ Yes |
| Purchase Premium | โ Yes | โ Yes |
| TON Ads Top-up | โ Yes | โ Yes |
| Giveaways (Stars/Premium) | โ Yes | โ Yes |
| Marketplace Search | โ No | โ Yes |
| Place Bids | โ No | โ Yes |
| Full Wallet Info | โ No | โ Yes |
| NFT/Gift Management | โ No | โ Yes |
โจ Features
- No KYC Required โ start using immediately
- Async-only โ full async/await support
- Direct TON Payments โ send from your wallet (V4R2/V5R1)
- Purchases โ Stars (50โ10M), Premium (3/6/12 months), TON Ads
- Giveaways โ Stars and Premium for Telegram channels (up to 24k winners)
- TON Payment Gateway โ automatic invoice generation and payment
- Status Tracking โ monitor operation status
- Complete Error Hierarchy โ proper exception handling
๐ฆ Installation
pip install fragment-api-nk
๐งช Requirements
- Python 3.10+
- Fragment API token (get from Fragment.com after login)
- TON wallet seed phrase (12/18/24 words)
๐ฏ Quick Start
import asyncio
from FragmentNK import FragmentNK
async def main():
async with FragmentNK(
seed="your 12/18/24 word seed phrase...",
api_token="your_fragment_api_token",
wallet_version="V5R1", # or "V4R2"
) as client:
# Get wallet info
address = await client.get_wallet_address()
balance = await client.get_wallet_balance()
print(f"Wallet: {address}")
print(f"Balance: {balance} TON")
# Check recipient before sending
recipient = await client.get_stars_recipient("@durov")
if recipient:
print(f"Sending to: {recipient.name}")
# Purchase Stars
result = await client.purchase_stars("@durov", 100)
print(f"Sent 100 Stars! TX: {result.transaction_id}")
# Purchase Telegram Premium (3, 6, or 12 months)
premium = await client.purchase_premium("@durov", 6)
print(f"Sent 6 months Premium! TX: {premium.transaction_id}")
# Top-up TON Ads balance
topup = await client.topup_ton("@durov", 10)
print(f"Topped up 10 TON! TX: {topup.transaction_id}")
# Stars Giveaway for channel
giveaway = await client.giveaway_stars("@channel", winners=10, amount=500)
print(f"Giveaway created! TX: {giveaway.transaction_id}")
# Premium Giveaway
giveaway_prem = await client.giveaway_premium("@channel", winners=5, months=3)
print(f"Premium giveaway created! TX: {giveaway_prem.transaction_id}")
asyncio.run(main())
๐ API Reference
Initialization
from FragmentNK import FragmentNK
client = FragmentNK(
seed="24 words...", # Required: TON wallet mnemonic
api_token="your_token", # Required: Fragment API token
api_key=None, # Optional: tonapi.io API key
wallet_version="V5R1", # Optional: "V4R2" or "V5R1" (default: "V5R1")
backend_url="https://fragment-api.tech", # Optional: custom backend
timeout=30.0, # Optional: request timeout
)
Methods
| Method | Description | Returns |
|---|---|---|
get_wallet_address() |
Get wallet address | str |
get_wallet_balance() |
Get wallet balance in TON | float |
get_stars_recipient(username) |
Check Stars recipient info | RecipientInfo | None |
get_premium_recipient(username, months) |
Check Premium recipient info | RecipientInfo | None |
get_ads_topup_recipient(username) |
Check Ads top-up recipient | RecipientInfo | None |
purchase_stars(username, amount, show_sender) |
Send Telegram Stars | StarsResult |
purchase_premium(username, months, show_sender) |
Send Telegram Premium | PremiumResult |
topup_ton(username, amount, show_sender) |
Top-up TON Ads balance | AdsTopupResult |
giveaway_stars(channel, winners, amount) |
Create Stars giveaway | GiveawayStarsResult |
giveaway_premium(channel, winners, months) |
Create Premium giveaway | GiveawayPremiumResult |
get_status(req_id) |
Check operation status | OperationStatus |
Types
@dataclass
class RecipientInfo:
recipient: str # @username
name: str # Display name
photo_url: str | None
myself: bool
@dataclass
class StarsResult:
transaction_id: str
username: str
amount: int
@dataclass
class PremiumResult:
transaction_id: str
username: str
amount: int # months (3, 6, 12)
@dataclass
class OperationStatus:
status: str # "completed", "failed", "pending", "timeout"
req_id: str
transaction_id: str | None
error: str | None
๐ง Error Handling
from FragmentNK import (
FragmentNK,
KYCRequiredError,
PaymentError,
WalletError,
ConfigError,
BackendError,
)
try:
async with FragmentNK(seed="...", api_token="...") as client:
result = await client.purchase_stars("@username", 100)
except KYCRequiredError as e:
print(f"This operation requires KYC: {e}")
except PaymentError as e:
print(f"Payment failed: {e}")
except WalletError as e:
print(f"Wallet error: {e}")
except ConfigError as e:
print(f"Configuration error: {e}")
except BackendError as e:
print(f"Backend error (status {e.status_code}): {e}")
๐ณ Purchase Limits
| Purchase Type | Limits |
|---|---|
| Stars | 50 โ 10,000,000 |
| Premium | 3, 6, or 12 months |
| TON Ads | 1 โ 1,000,000,000 TON |
| Giveaway Stars | 1 โ 24,000 winners |
| Giveaway Premium | 1 โ 24,000 winners |
๐ Getting an API Token
- Log in to fragment-api.tech
- Login in your Telegram Account with OAuth2
- The token will be automatically generated and displayed to you."
- Copy the token and keep it secure
โ ๏ธ Important Notes
- No KYC required โ use immediately
- Marketplace features (search, bids) require KYC โ use the full version
- TON balance must cover amount + ~0.05 TON for fees
- Supported wallets: V4R2 and V5R1 (W5)
๐ Full Version vs No KYC Version
| No KYC (this) | Full KYC | |
|---|---|---|
| Stars/Premium/Ads | โ | โ |
| Giveaways | โ | โ |
| Marketplace Search | โ | โ |
| Place Bids | โ | โ |
| NFT Management | โ | โ |
| EVM Payments | โ | โ |
| KYC Required | โ | โ |
For full features with KYC, install:
pip install fragment-api-py
๐ Support the Project
UQBsyxZvyQxDwAeOxoaWwO2HJoAmCKUoJlS_OpLzWHD9i2Xj
๐ License
MIT License โ free for commercial and personal use.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file fragment_api_nk-1.0.0.tar.gz.
File metadata
- Download URL: fragment_api_nk-1.0.0.tar.gz
- Upload date:
- Size: 10.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9ff58aca8c02441c1abc741b86ac6aa6b742139172b7c157f1fcc60174b478bc
|
|
| MD5 |
d32fd1d0dc65de1bb9e3aa9357d9c14e
|
|
| BLAKE2b-256 |
5e0b47c1bcbe29d90e1f8ed2ae480b4b757f98148db6cb8bee63288c074cdf6b
|
File details
Details for the file fragment_api_nk-1.0.0-py3-none-any.whl.
File metadata
- Download URL: fragment_api_nk-1.0.0-py3-none-any.whl
- Upload date:
- Size: 11.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b4ef16ca299379c6f512ec3ee13cde85d7ad33555cbbe3073f81aff4cd7375e7
|
|
| MD5 |
0de45cc77ef100d7e6fc4d580918bb6c
|
|
| BLAKE2b-256 |
c4fe70f847a316795c2ae0ce944f14f9c266224b9a095f48ba78aabb148dd2e5
|