## AioTonapi
Asynchronous Python wrapper for [tonapi](https://tonapi.io/swagger-ui/).\
You need an api key to use it, get it here [telegram-bot](https://tonapi_bot.t.me/)
#### Requirements
* aiohttp >= 3.8.3
* pydantic >= 1.10.4
* libscrc >= 1.8.1
### Installation
```bash
pip install aiotonapi
```
### Examples
Get wallet balance:
```python
# Importing required package
import asyncio
from aiotonapi import Tonapi
# Declaring asynchronous function for using await
async def main():
# Creating new Tonapi object
tonapi = Tonapi(api_key="Insert your api key")
address = "EQC-3ilVr-W0Uc3pLrGJElwSaFxvhXXfkiQA3EwdVBHNNess"
account = await tonapi.account.get_info(account=address)
# print account balance (default returned in nanoton)
print(account.balance)
# 1550000000
# print account balance in amount
print(account.balance.to_amount(2))
# 1.5
if __name__ == '__main__':
# Running asynchronous function
asyncio.run(main())
```
\
Get transactions by wallet address:
```python
...
search = await tonapi.raw_blockchain.get_transactions(
account=adresss, limit=100
)
for transaction in search.transactions:
# print transaction value (default returned in nanoton)
print(transaction.in_msg.value)
# 1000000000
# print transaction value in amount
print(transaction.in_msg.value.to_amount(2))
# 1.0
# print transaction comment (if the comment is missing will return the None)
print(transaction.in_msg.msg_data.to_text())
# Hello, World!
...
```
\
Search for NFT items in the wallet using filters:
```python
...
search = await tonapi.nft.search_items(
owner=address, include_on_sale=True, limit=10
)
for nft in search.nft_items:
# print nft address (default returned in raw)
print(nft.address)
# 0:5208588c1643b4cef7a673a57ee00a3967e485fcc8418c1581a8120444f199e1
# print nft address to userfriendly
print(nft.address.to_userfriendly())
# EQBSCFiMFkO0zvemc6V-4Ao5Z-SF_MhBjBWBqBIERPGZ4aYe
...
```
\
Get all NFT items from collection by collection address:
```python
...
collection_address = "EQAUxYSo-UwoqAGixaD3d7CNLp9PthgmEZfnr6BvsijzJHdA"
search = await tonapi.nft.search_items(
collection=collection_address, include_on_sale=True, limit=1000
)
for nft in search.nft_items:
# print nft owner address (default returned in raw)
print(nft.owner.address)
# 0:5208588c1643b4cef7a673a57ee00a3967e485fcc8418c1581a8120444f199e1
# print nft owner address to userfriendly
print(nft.owner.address.to_userfriendly())
# EQBSCFiMFkO0zvemc6V-4Ao5Z-SF_MhBjBWBqBIERPGZ4aYe
...
```
And more . . .\
\
\
**Buy Me a Coffee**\
<a href="https://app.tonkeeper.com/transfer/EQC-3ilVr-W0Uc3pLrGJElwSaFxvhXXfkiQA3EwdVBHNNess"><img src="https://telegra.ph//file/8e0ac22311be3fa6f772c.png" width="55"/></a>
<a href="https://tonhub.com/transfer/EQC-3ilVr-W0Uc3pLrGJElwSaFxvhXXfkiQA3EwdVBHNNess"><img src="https://telegra.ph//file/7fa75a1b454a00816d83b.png" width="55"/></a>\
```EQC-3ilVr-W0Uc3pLrGJElwSaFxvhXXfkiQA3EwdVBHNNess```
Raw data
{
"_id": null,
"home_page": "https://github.com/nessshon/aiotonapi",
"name": "aiotonapi",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.10",
"maintainer_email": "",
"keywords": "",
"author": "nessshon",
"author_email": "",
"download_url": "https://files.pythonhosted.org/packages/50/61/bc04e39eebab1fc9fca1510516ef23ebb7471c611a27b49aaf3a90c9e65b/aiotonapi-0.0.4.tar.gz",
"platform": null,
"description": "## AioTonapi\n\nAsynchronous Python wrapper for [tonapi](https://tonapi.io/swagger-ui/).\\\nYou need an api key to use it, get it here [telegram-bot](https://tonapi_bot.t.me/)\n\n#### Requirements\n\n* aiohttp >= 3.8.3\n* pydantic >= 1.10.4\n* libscrc >= 1.8.1\n\n### Installation\n\n```bash\npip install aiotonapi\n```\n\n### Examples\n\nGet wallet balance:\n\n```python\n# Importing required package\nimport asyncio\nfrom aiotonapi import Tonapi\n\n\n# Declaring asynchronous function for using await\nasync def main():\n # Creating new Tonapi object\n tonapi = Tonapi(api_key=\"Insert your api key\")\n\n address = \"EQC-3ilVr-W0Uc3pLrGJElwSaFxvhXXfkiQA3EwdVBHNNess\"\n account = await tonapi.account.get_info(account=address)\n\n # print account balance (default returned in nanoton)\n print(account.balance)\n # 1550000000\n\n # print account balance in amount\n print(account.balance.to_amount(2))\n # 1.5\n\n\nif __name__ == '__main__':\n # Running asynchronous function\n asyncio.run(main())\n```\n\n\\\nGet transactions by wallet address:\n\n```python\n...\n search = await tonapi.raw_blockchain.get_transactions(\n account=adresss, limit=100\n )\n for transaction in search.transactions:\n # print transaction value (default returned in nanoton)\n print(transaction.in_msg.value)\n # 1000000000\n \n # print transaction value in amount\n print(transaction.in_msg.value.to_amount(2))\n # 1.0\n \n # print transaction comment (if the comment is missing will return the None)\n print(transaction.in_msg.msg_data.to_text())\n # Hello, World!\n...\n```\n\n\\\nSearch for NFT items in the wallet using filters:\n\n```python\n...\n search = await tonapi.nft.search_items(\n owner=address, include_on_sale=True, limit=10\n )\n for nft in search.nft_items:\n # print nft address (default returned in raw)\n print(nft.address)\n # 0:5208588c1643b4cef7a673a57ee00a3967e485fcc8418c1581a8120444f199e1\n \n # print nft address to userfriendly\n print(nft.address.to_userfriendly())\n # EQBSCFiMFkO0zvemc6V-4Ao5Z-SF_MhBjBWBqBIERPGZ4aYe\n...\n```\n\n\\\nGet all NFT items from collection by collection address:\n\n```python\n...\n collection_address = \"EQAUxYSo-UwoqAGixaD3d7CNLp9PthgmEZfnr6BvsijzJHdA\"\n search = await tonapi.nft.search_items(\n collection=collection_address, include_on_sale=True, limit=1000\n )\n for nft in search.nft_items:\n # print nft owner address (default returned in raw)\n print(nft.owner.address)\n # 0:5208588c1643b4cef7a673a57ee00a3967e485fcc8418c1581a8120444f199e1\n \n # print nft owner address to userfriendly\n print(nft.owner.address.to_userfriendly())\n # EQBSCFiMFkO0zvemc6V-4Ao5Z-SF_MhBjBWBqBIERPGZ4aYe\n...\n```\n\nAnd more . . .\\\n\\\n\\\n**Buy Me a Coffee**\\\n<a href=\"https://app.tonkeeper.com/transfer/EQC-3ilVr-W0Uc3pLrGJElwSaFxvhXXfkiQA3EwdVBHNNess\"><img src=\"https://telegra.ph//file/8e0ac22311be3fa6f772c.png\" width=\"55\"/></a>\n<a href=\"https://tonhub.com/transfer/EQC-3ilVr-W0Uc3pLrGJElwSaFxvhXXfkiQA3EwdVBHNNess\"><img src=\"https://telegra.ph//file/7fa75a1b454a00816d83b.png\" width=\"55\"/></a>\\\n```EQC-3ilVr-W0Uc3pLrGJElwSaFxvhXXfkiQA3EwdVBHNNess```\n",
"bugtrack_url": null,
"license": "",
"summary": "Provide access to indexed TON blockchain.",
"version": "0.0.4",
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "6bd798a23fe995aeacb5f9ad88c582b9873eb00f27dcacb51f23f01d8097b46f",
"md5": "650a2546edd0d3d80963a9a0d0f7b68c",
"sha256": "60c82818a645c735ae4a4a2a34b22605e84035d626d8e527affa376d988e68f4"
},
"downloads": -1,
"filename": "aiotonapi-0.0.4-py3-none-any.whl",
"has_sig": false,
"md5_digest": "650a2546edd0d3d80963a9a0d0f7b68c",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10",
"size": 12443,
"upload_time": "2023-01-16T02:25:16",
"upload_time_iso_8601": "2023-01-16T02:25:16.774551Z",
"url": "https://files.pythonhosted.org/packages/6b/d7/98a23fe995aeacb5f9ad88c582b9873eb00f27dcacb51f23f01d8097b46f/aiotonapi-0.0.4-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "5061bc04e39eebab1fc9fca1510516ef23ebb7471c611a27b49aaf3a90c9e65b",
"md5": "57dfa640bd8d11aec4e9eec2f904196c",
"sha256": "16d85270329a030460cc5c85a5bdcad54c3ad4a9b09fabfd1ba280fbc90d5d23"
},
"downloads": -1,
"filename": "aiotonapi-0.0.4.tar.gz",
"has_sig": false,
"md5_digest": "57dfa640bd8d11aec4e9eec2f904196c",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10",
"size": 10143,
"upload_time": "2023-01-16T02:25:18",
"upload_time_iso_8601": "2023-01-16T02:25:18.594654Z",
"url": "https://files.pythonhosted.org/packages/50/61/bc04e39eebab1fc9fca1510516ef23ebb7471c611a27b49aaf3a90c9e65b/aiotonapi-0.0.4.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-01-16 02:25:18",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "nessshon",
"github_project": "aiotonapi",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [],
"lcname": "aiotonapi"
}