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) - TGKmm9H3FApFw8xcgRcZDHSku68vozAjo9

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.4.9.tar.gz (35.3 kB view details)

Uploaded Source

Built Distribution

pytonapi-0.4.9-py3-none-any.whl (45.5 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for pytonapi-0.4.9.tar.gz
Algorithm Hash digest
SHA256 188fb2e9efaec5e1eba02570ea3e8968efd6fc281c9ddd7fb007241bcf62fb2e
MD5 42635b66e4907cf27ad20175a57bb1a8
BLAKE2b-256 fc350f5b9e80386cd7ed1ad622dde172a27e15e2ff36c45e581bb294c52de10b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pytonapi-0.4.9-py3-none-any.whl
  • Upload date:
  • Size: 45.5 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.4.9-py3-none-any.whl
Algorithm Hash digest
SHA256 6485b8b55622b5983ffaac39e8c01fdd6a9bae9ae3d98b7005154d861308013b
MD5 201bbd41ed5d81a8328fc65f7eb86123
BLAKE2b-256 4e47977555be4f7f57bf4d789c49834cbd4381ba11d68117117232e0f913a47a

See more details on using hashes here.

Supported by

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