Skip to main content

📚 Introduction

Unofficial Python client for Fragment — buy Telegram goods (Stars, Premium, TON) via Fragment

⚠️ This library is not affiliated with Telegram or Fragment.
Use at your own risk.

🚀 Features

Currently, the library only supports one feature, as it is still under development. The remaining features will be implemented in the very next update.

  • Purchase Telegram Stars

  • Purchase Telegram Premium

  • Top up Telegram Ads (TON) balance

📦 Usage

pip3 install fragment-sdk

Before you start coding, make sure you have:

  • TON wallet (v4r2 or v5r1)
  • Fragment account with KYC. Auth cookies string
  • Tonapi.io API key

To get auth cookies use Cookie-Editor extension (Header string).

⭐ Purchase Stars example:

from fragment_sdk import FragmentClient
from fragment_sdk.wallet import WalletClient
import asyncio

async def main():
  wallet = WalletClient(
    tonapi_key="TONAPI_KEY",
    mnemonic="WORD1 WORD2 WORD3 ...",
    version='v5r1' # v5r1 by default (v4r2 supported)
  )
  fragment = FragmentClient(
    cookies="FRAGMENT_COOKIES_STRING", # Cookies in Header string format.
    wallet=wallet
  )
  
  response = await fragment.stars.buy_stars(username="whicencer", quantity=50)
  
  error = response.error
  tx_hash = response.data
  return tx_hash, error

asyncio.run(main())

💖 Support the Project

💎 TON Donations: UQCaKFm1d4CavB2aqZK1ypHFaAMIgpAz2D58hDyrT7RITfl2
🌟 Star the repo: it really helps others discover the library

Metadata

Release files for fragment-sdk 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for fragment-sdk 0.2.0
File Size Uploaded Provenance Actions
fragment_sdk-0.2.0.tar.gz 9.9 kB Without provenance Details for fragment_sdk-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for fragment-sdk 0.2.0
File Interpreter ABI Platform Actions
fragment_sdk-0.2.0-py3-none-any.whl Python 3 none any Details for fragment_sdk-0.2.0-py3-none-any.whl

Total release size: 22.3 kB

Release files / fragment_sdk-0.2.0.tar.gz

Download URL fragment_sdk-0.2.0.tar.gz
Size 9.9 kB
Tags Source
SHA-256 checksum
How to use checksums
a39ce956bbae6676386cbb7071034cff78cb4434986d21b5a48117dadd71070c
BLAKE2b-256 checksum
How to use checksums
c192b0d5b5bc725d160ece88ccdf3315a3519e987caf906e5c6ca2bce442262d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.2

Release files / fragment_sdk-0.2.0-py3-none-any.whl

Download URL fragment_sdk-0.2.0-py3-none-any.whl
Size 12.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4614cb5c660b00e3ff044fa0cdfcedf3738467ee9fa7c02ef61dfa8b95e6795b
BLAKE2b-256 checksum
How to use checksums
6ec98db2bd17dcda0ad348295e8ae37843cdbb69fea2965afdb9399d0805f879
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.2

Security for fragment-sdk 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page