Skip to main content

Async No-KYC Fragment.com client. Buys Stars / Premium / Ads top-up via a remote backend without KYC.

Project description

Fragment API Python

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

PyPI Python Versions License

GitHub


๐Ÿš€ 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

  1. Log in to fragment-api.tech
  2. Login in your Telegram Account with OAuth2
  3. The token will be automatically generated and displayed to you."
  4. 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

Donate TON

UQBsyxZvyQxDwAeOxoaWwO2HJoAmCKUoJlS_OpLzWHD9i2Xj


๐Ÿ“„ License

MIT License โ€” free for commercial and personal use.


GitHub (nokyc branch) โ€ข PyPI

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fragment_api_nk-1.0.0.tar.gz (10.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fragment_api_nk-1.0.0-py3-none-any.whl (11.2 kB view details)

Uploaded Python 3

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

Hashes for fragment_api_nk-1.0.0.tar.gz
Algorithm Hash digest
SHA256 9ff58aca8c02441c1abc741b86ac6aa6b742139172b7c157f1fcc60174b478bc
MD5 d32fd1d0dc65de1bb9e3aa9357d9c14e
BLAKE2b-256 5e0b47c1bcbe29d90e1f8ed2ae480b4b757f98148db6cb8bee63288c074cdf6b

See more details on using hashes here.

File details

Details for the file fragment_api_nk-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for fragment_api_nk-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b4ef16ca299379c6f512ec3ee13cde85d7ad33555cbbe3073f81aff4cd7375e7
MD5 0de45cc77ef100d7e6fc4d580918bb6c
BLAKE2b-256 c4fe70f847a316795c2ae0ce944f14f9c266224b9a095f48ba78aabb148dd2e5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page