📦 PyTONAPI
![License](https://img.shields.io/github/license/tonkeeper/pytonapi)
![Image](https://telegra.ph//file/f88bcf9051073973edbd6.jpg)
![Downloads](https://pepy.tech/badge/pytonapi/week)
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
async def main():
tonapi = AsyncTonapi(api_key="Your API key")
account_id = "EQC-3ilVr-W0Uc3pLrGJElwSaFxvhXXfkiQA3EwdVBHNNess"
account = await tonapi.accounts.get_info(account_id=account_id)
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
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.