Skip to main content

Async Python library for Fragment.com API with seqno/balance confirmation and confirmReq

Project description

Fragment API Python

Fragment API Python SDK

Professional Python library for Fragment.com automation
v7.0.0 — EVM Payments | Anonymous Telemetry | Live Stats Dashboard

PyPI Python Versions Downloads Telegram License

GitHub Docs Dashboard


✨ What's New in v7.0.0

Feature Description
💳 EVM Payments 5 new methods: usdt_eth, usdt_pol, usdc_eth, usdc_base, usdc_pol
📦 EvmInvoice Full invoice details: address, token, chain_id, amount, expiration
📊 Anonymous Telemetry Helps improve the library — no sensitive data ever sent
📈 Live Dashboard fragment.s1qwy.ru/statistic — real-time usage stats

🚀 Features

  • Async-onlyFragmentClient with full async/await support
  • EVM Payments — USDT/USDC on Ethereum, BASE, Polygon
  • Purchases — Stars (50–10M), Premium (3/6/12 months), TON Ads
  • Giveaways — Stars and Premium for channels (up to 24k winners)
  • Bidsplace_bid(item_type=1|3|5, slug, bid) — instant buy if bid = buy-now price
  • Marketplace — search usernames, numbers, gifts with filters and pagination
  • Wallet — V4R2 and V5R1 (W5) support
  • Auto-authentication — obtain cookies via TON wallet and Telegram
  • Anonymous numbers — manage login codes, terminate sessions (+888)
  • NFT Management — withdraw gifts to wallet, transfer to users
  • Stars Revenue — withdraw earned Stars to wallet
  • Error hierarchy — complete exception handling

📦 Installation

pip install fragment-api-py

🧪 Requirements

  • Python 3.10+
  • Fragment cookies: stel_ssid, stel_dt, stel_token, stel_ton_token
  • TON wallet seed phrase (12/18/24 words)

🎯 Quick Start

import asyncio
from FragmentAPI import FragmentClient
from FragmentAPI.types.results import EvmPaymentResult, StarsResult

async def main():
    async with FragmentClient(
        seed="24 words...",
        cookies={"stel_ssid": "...", "stel_token": "...", "stel_dt": "...", "stel_ton_token": "..."},
        wallet_version="V5R1",
    ) as client:
        
        # Wallet info
        wallet = await client.get_wallet()
        print(f"{wallet.balance_ton} TON, {wallet.balance_usdt} USDT")
        
        # TON payment (automatic)
        result = await client.purchase_stars("@durov", 100)
        print(f"TX: {result.transaction_id}")
        
        # EVM payment (returns invoice)
        result = await client.purchase_stars("@durov", 50, payment_method="usdc_base")
        if isinstance(result, EvmPaymentResult):
            inv = result.invoice
            print(f"Send {inv.invoice_amount} {inv.token_symbol}")
            print(f"To: {inv.invoice_address}")
            print(f"Chain: {inv.invoice_chain_name}")
        
        # Purchase Premium
        await client.purchase_premium("@durov", 6, show_sender=True)
        
        # Place bid (type 1=username, 3=number, 5=gift)
        await client.place_bid(1, "username", bid=150)
        
        # Stars giveaway
        await client.giveaway_stars("@channel", winners=5, amount=1000)
        
        # Search marketplace
        items = await client.search_usernames("gold", filter="sale")

asyncio.run(main())

🔐 Auto-cookie Authentication

import asyncio
from FragmentAPI import FragmentClient

async def main():
    # Automatic authentication via TON wallet and Telegram
    cookies = await FragmentClient.authenticate(
        seed="24 words...",
        wallet_version="V5R1",
        telegram_phone="+71234567890"  # or telegram_auth_data
    )
    
    async with FragmentClient(seed="24 words...", cookies=cookies) as client:
        profile = await client.get_profile()
        print(f"Logged in as: {profile.name}")

asyncio.run(main())

📊 Anonymous Telemetry

The library sends anonymous usage statistics to help understand which features are used and what errors users encounter.

✅ Collected:

  • Library version, wallet version (V4R2/V5R1)
  • Method name, status (ok/error), duration
  • Error class name, scrubbed error message (first 200 chars)

❌ NEVER Collected:

  • Seed phrases, cookies, API keys
  • Usernames (replaced with <username>)
  • Wallet addresses (replaced with <ton_addr> or <eth_addr>)
  • Transaction hashes, amounts
  • IP addresses

Disable telemetry:

FragmentClient(seed="...", cookies=..., stats_enabled=False)

Or set environment variable: export FRAGMENT_DISABLE_STATS=1

Live Dashboard: fragment.s1qwy.ru/statistic


💳 EVM Payment Methods (v7.0.0)

Method Chain Token Flow
ton TON TON Automatic TX
usdt_ton TON USDT Automatic TX
usdt_eth Ethereum USDT Returns invoice
usdt_pol Polygon USDT Returns invoice
usdc_eth Ethereum USDC Returns invoice
usdc_base BASE USDC Returns invoice
usdc_pol Polygon USDC Returns invoice
# EVM example — you send the transaction
result = await client.purchase_stars("@durov", 50, payment_method="usdc_base")

if isinstance(result, EvmPaymentResult):
    inv = result.invoice
    # Send {inv.invoice_amount} {inv.token_symbol} 
    # to {inv.invoice_address} on chain_id={inv.invoice_chain_id}
    # before {inv.expires_at}

🐛 Reporting Errors

Create an Issue or message in Telegram chat.


💖 Support the Project

If you find this library useful, consider supporting its development:

Donate TON

UQBsyxZvyQxDwAeOxoaWwO2HJoAmCKUoJlS_OpLzWHD9i2Xj


📄 License

MIT License — free for commercial and personal use.


GitHubDocumentationTelegramLive Stats

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_py-7.0.0.tar.gz (44.2 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_py-7.0.0-py3-none-any.whl (55.9 kB view details)

Uploaded Python 3

File details

Details for the file fragment_api_py-7.0.0.tar.gz.

File metadata

  • Download URL: fragment_api_py-7.0.0.tar.gz
  • Upload date:
  • Size: 44.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.12

File hashes

Hashes for fragment_api_py-7.0.0.tar.gz
Algorithm Hash digest
SHA256 76d000500f46ff035eb1e60701c8c3f674f3ee94f00b8e62a7e565abfc431343
MD5 ea036c4a5224e1eb5a54010d16681e76
BLAKE2b-256 94a351bb958b0057ac2764b53d371c03cdc0294ed52b2839dc17a1c274f6ae45

See more details on using hashes here.

File details

Details for the file fragment_api_py-7.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for fragment_api_py-7.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 aa55e4f5b492e39787b6c9ef5d9bed7ee769f557790afc1f20d9e8b40e436000
MD5 56a29f035efac900e30adfdf0bd8b410
BLAKE2b-256 2b92a68245182b6eba24296a56beff84feb41d34278627a7c0d47aea74dbb081

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