Skip to main content

Provide access to indexed TON blockchain.

Project description

📦 PyTONAPI

TON PyPI Python Versions License

Image

Downloads Downloads Downloads

Python SDK for tonapi.io.
Information about the API can be found in the documentation.
To use the API you need an API key, you can get it here tonconsole.com.

For creating wallets, transferring TON, Jetton, NFTs, and other operations, recommend using tonutils in combination with TonapiClient. For more information, refer to the library documentation.

Usage

Installation

pip install pytonapi

Examples

from pytonapi import AsyncTonapi


# Declare an asynchronous function for using await
async def main():
    # Create a new Tonapi object with the provided API key
    tonapi = AsyncTonapi(api_key="Your API key")

    # Specify the account ID
    account_id = "EQC-3ilVr-W0Uc3pLrGJElwSaFxvhXXfkiQA3EwdVBHNNess"  # noqa

    # Retrieve account information asynchronously
    account = await tonapi.accounts.get_info(account_id=account_id)

    # Print account details
    print(f"Account Address (raw): {account.address.to_raw()}")
    print(f"Account Address (userfriendly): {account.address.to_userfriendly(is_bounceable=True)}")
    print(f"Account Balance (nanoton): {account.balance.to_nano()}")
    print(f"Account Balance (amount): {account.balance.to_amount()}")


if __name__ == '__main__':
    import asyncio

    # Run the asynchronous function
    asyncio.run(main())
  • Additional examples can be found examples folder.

Donations

TON - UQCDrgGaI6gWK-qlyw69xWZosurGxrpRgIgSkVsgahUtxZR0

USDT (TRC-20) - TDHMG7JRkmJBDD1qd4bNhdfoy2uzVd8ixA

Contribution

We welcome your contributions! If you have ideas for improvement or have identified a bug, please create an issue or submit a pull request.

Support

Supported by TONAPI and TON Society (Grants and Bounties program).

License

This repository is distributed under the MIT License. Feel free to use, modify, and distribute the code in accordance with the terms of the license.

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

pytonapi-0.5.0.tar.gz (37.8 kB view details)

Uploaded Source

Built Distribution

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

pytonapi-0.5.0-py3-none-any.whl (46.7 kB view details)

Uploaded Python 3

File details

Details for the file pytonapi-0.5.0.tar.gz.

File metadata

  • Download URL: pytonapi-0.5.0.tar.gz
  • Upload date:
  • Size: 37.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.12

File hashes

Hashes for pytonapi-0.5.0.tar.gz
Algorithm Hash digest
SHA256 cb6e1513d36ff2a47a989b2bcd80c8ca81bbcaae71561e4db5b39ee3b1d8d8f5
MD5 b3b36acca12cf138ff769500ef4e3747
BLAKE2b-256 ad7f16e593f457c58af4f15259441a623179fdfaaa15852df8c0088aeee692df

See more details on using hashes here.

File details

Details for the file pytonapi-0.5.0-py3-none-any.whl.

File metadata

  • Download URL: pytonapi-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 46.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.12

File hashes

Hashes for pytonapi-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 eeea5cf24a062d64b95517acd5bd10dc9f1533a094c7c0eb1b4c06e4a809b91a
MD5 bb68c5ba201c200ef89d32dbb1fab83a
BLAKE2b-256 6a2389cd54a58a58ca596673576a4a367ff09f8ec579d4efe5ed7d1f6a152099

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