# SDK для работы с TON Rocket
## Это ещё бета-версия, просьба сообщать о любых проблемах
## 🔐 Авторизация
Как получить токен написано [тут](https://pay.ton-rocket.com/api/).
Mainnet:
```python
import aiorocket
api = aiorocket.Rocket('токен')
```
Testnet:
```python
import aiorocket
api = aiorocket.Rocket('токен', True)
```
## 🚀 Методы
### Получение информации о приложении
[Документация](https://pay.ton-rocket.com/api/#/app/AppsController_getAppInfo)
Пример:
```python
await api.info()
```
### Перевод
Все параметры как в [документации](https://pay.ton-rocket.com/api/#/app/AppsController_transfer)
Пример:
```python
await api.send(
tgUserId=87209764,
currency="TONCOIN",
amount=1.23,
description="Hello, Owls!"
)
```
### Вывод
Все параметры как в [документации](https://pay.ton-rocket.com/api/#/app/AppsController_withdrawal)
Пример:
```python
await api.withdraw(
address="EQAJkw0RC9s_FAEmKr4GftJsNbA0IK0o4cfEH3bNoSbKJHAy",
currency="TONCOIN",
amount=1.23,
comment="Hello, Owls!"
)
```
### Создание чека
Все параметры как в [документации](https://pay.ton-rocket.com/api/#/multi-cheques/ChequesController_createCheque)
Пример:
```python
await api.create_cheque({
chequePerUser=0.005,
usersNumber=100,
refProgram=50,
password="pwd",
description="This cheque is the best",
sendNotifications=True,
enableCaptcha=True,
telegramResourcesIds=[
"-1001799549067"
]
})
```
### Получение чеков
[Документация](https://pay.ton-rocket.com/api/#/multi-cheques/ChequesController_getCheques)
Пример:
```python
await api.get_cheques()
```
### Получение чека
Все параметры как в [документации](https://pay.ton-rocket.com/api/#/multi-cheques/ChequesController_getCheque)
Пример:
```python
await api.get_cheque(1234)
```
### Удаление чека
Все параметры как в [документации](https://pay.ton-rocket.com/api/#/multi-cheques/ChequesController_deleteCheque)
Пример:
```python
await api.delete_cheque(1234)
```
### Создание счёта
Все параметры как в [документации](https://pay.ton-rocket.com/api/#/tg-invoices/InvoicesController_createInvoice)
Пример:
```python
await api.createInvoice(
amount=1.23,
description="покупка лучшой вещи в мире",
hiddenMessage="спасибо",
callbackUrl="https://t.me/ton_rocket",
payload="полезна нагрузку, которую я хочу видеть в webhook или когда я запрашиваю счет-фактуру",
expiredIn=10
)
```
### Получение счетов
[Документация](https://pay.ton-rocket.com/api/#/tg-invoices/InvoicesController_deleteInvoice)
Пример:
```python
await api.get_invoices()
```
### Получение счёта по ID
Все параметры как в [документации](https://pay.ton-rocket.com/api/#/tg-invoices/InvoicesController_getInvoice)
Пример:
```python
await api.get_invoice(1234)
```
### Удаление счёта
Все параметры как в [документации](https://pay.ton-rocket.com/api/#/tg-invoices/InvoicesController_deleteInvoice)
Пример:
```python
await api.delete_invoice(1234)
```
### Доступные валюты
[Документация](https://pay.ton-rocket.com/api/#/currencies/CurrenciesController_getCoins)
Пример:
```python
await api.available_currencies()
```
## ⚠ Обработка ошибок
```python
try:
api.get_invoice(1234) # вызов метода
except aiorocket.classes.RocketAPIError as err:
print(err.errors)
```
Результат:
```json
{
"property": "somePropertyName",
"error": "somePropertyName should be less than X"
}
```
Raw data
{
"_id": null,
"home_page": "",
"name": "aiorocket",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": "",
"keywords": "ton,rocket,sdk,async,the open network,bot,telegram,crypto,cryptocurrency",
"author": "",
"author_email": "Sovenok-Hacker <artemka.hvostov@yandex.ru>",
"download_url": "https://files.pythonhosted.org/packages/70/1f/a32106d06e9f656b99ed70d9d3b153380647977163be0b30b32583ee3247/aiorocket-1.3.1b2.tar.gz",
"platform": null,
"description": "# SDK \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 TON Rocket\n\n## \u042d\u0442\u043e \u0435\u0449\u0451 \u0431\u0435\u0442\u0430-\u0432\u0435\u0440\u0441\u0438\u044f, \u043f\u0440\u043e\u0441\u044c\u0431\u0430 \u0441\u043e\u043e\u0431\u0449\u0430\u0442\u044c \u043e \u043b\u044e\u0431\u044b\u0445 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430\u0445\n\n## \ud83d\udd10 \u0410\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u044f\n\n\u041a\u0430\u043a \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0442\u043e\u043a\u0435\u043d \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043e [\u0442\u0443\u0442](https://pay.ton-rocket.com/api/).\n\nMainnet:\n\n```python\nimport aiorocket\napi = aiorocket.Rocket('\u0442\u043e\u043a\u0435\u043d')\n```\n\nTestnet:\n\n```python\nimport aiorocket\napi = aiorocket.Rocket('\u0442\u043e\u043a\u0435\u043d', True)\n```\n\n## \ud83d\ude80 \u041c\u0435\u0442\u043e\u0434\u044b\n\n### \u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438\n[\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f](https://pay.ton-rocket.com/api/#/app/AppsController_getAppInfo)\n\n\u041f\u0440\u0438\u043c\u0435\u0440:\n```python\nawait api.info()\n```\n\n### \u041f\u0435\u0440\u0435\u0432\u043e\u0434\n\u0412\u0441\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u043a\u0430\u043a \u0432 [\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438](https://pay.ton-rocket.com/api/#/app/AppsController_transfer)\n\n\u041f\u0440\u0438\u043c\u0435\u0440:\n```python\nawait api.send(\n tgUserId=87209764,\n currency=\"TONCOIN\",\n amount=1.23,\n description=\"Hello, Owls!\"\n)\n```\n\n### \u0412\u044b\u0432\u043e\u0434\n\n\u0412\u0441\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u043a\u0430\u043a \u0432 [\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438](https://pay.ton-rocket.com/api/#/app/AppsController_withdrawal)\n\n\u041f\u0440\u0438\u043c\u0435\u0440:\n```python\nawait api.withdraw(\n address=\"EQAJkw0RC9s_FAEmKr4GftJsNbA0IK0o4cfEH3bNoSbKJHAy\",\n currency=\"TONCOIN\",\n amount=1.23,\n comment=\"Hello, Owls!\"\n)\n```\n\n### \u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0447\u0435\u043a\u0430\n\u0412\u0441\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u043a\u0430\u043a \u0432 [\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438](https://pay.ton-rocket.com/api/#/multi-cheques/ChequesController_createCheque)\n\n\u041f\u0440\u0438\u043c\u0435\u0440:\n```python\nawait api.create_cheque({\n chequePerUser=0.005,\n usersNumber=100,\n refProgram=50,\n password=\"pwd\",\n description=\"This cheque is the best\",\n sendNotifications=True,\n enableCaptcha=True,\n telegramResourcesIds=[\n \"-1001799549067\"\n ]\n})\n```\n\n### \u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0447\u0435\u043a\u043e\u0432\n[\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f](https://pay.ton-rocket.com/api/#/multi-cheques/ChequesController_getCheques)\n\n\u041f\u0440\u0438\u043c\u0435\u0440:\n```python\nawait api.get_cheques()\n```\n\n### \u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0447\u0435\u043a\u0430\n\u0412\u0441\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u043a\u0430\u043a \u0432 [\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438](https://pay.ton-rocket.com/api/#/multi-cheques/ChequesController_getCheque)\n\n\u041f\u0440\u0438\u043c\u0435\u0440:\n```python\nawait api.get_cheque(1234)\n```\n\n### \u0423\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u0447\u0435\u043a\u0430\n\u0412\u0441\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u043a\u0430\u043a \u0432 [\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438](https://pay.ton-rocket.com/api/#/multi-cheques/ChequesController_deleteCheque)\n\n\u041f\u0440\u0438\u043c\u0435\u0440:\n```python\nawait api.delete_cheque(1234)\n```\n\n### \u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0441\u0447\u0451\u0442\u0430\n\u0412\u0441\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u043a\u0430\u043a \u0432 [\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438](https://pay.ton-rocket.com/api/#/tg-invoices/InvoicesController_createInvoice)\n\n\u041f\u0440\u0438\u043c\u0435\u0440:\n```python\nawait api.createInvoice(\n amount=1.23,\n description=\"\u043f\u043e\u043a\u0443\u043f\u043a\u0430 \u043b\u0443\u0447\u0448\u043e\u0439 \u0432\u0435\u0449\u0438 \u0432 \u043c\u0438\u0440\u0435\",\n hiddenMessage=\"\u0441\u043f\u0430\u0441\u0438\u0431\u043e\",\n callbackUrl=\"https://t.me/ton_rocket\",\n payload=\"\u043f\u043e\u043b\u0435\u0437\u043d\u0430 \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0443, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u044f \u0445\u043e\u0447\u0443 \u0432\u0438\u0434\u0435\u0442\u044c \u0432 webhook \u0438\u043b\u0438 \u043a\u043e\u0433\u0434\u0430 \u044f \u0437\u0430\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u044e \u0441\u0447\u0435\u0442-\u0444\u0430\u043a\u0442\u0443\u0440\u0443\",\n expiredIn=10\n)\n```\n\n### \u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0441\u0447\u0435\u0442\u043e\u0432\n[\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f](https://pay.ton-rocket.com/api/#/tg-invoices/InvoicesController_deleteInvoice)\n\n\u041f\u0440\u0438\u043c\u0435\u0440:\n```python\nawait api.get_invoices()\n```\n\n### \u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0441\u0447\u0451\u0442\u0430 \u043f\u043e ID\n\u0412\u0441\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u043a\u0430\u043a \u0432 [\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438](https://pay.ton-rocket.com/api/#/tg-invoices/InvoicesController_getInvoice)\n\n\u041f\u0440\u0438\u043c\u0435\u0440:\n```python\nawait api.get_invoice(1234)\n```\n\n### \u0423\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u0441\u0447\u0451\u0442\u0430\n\u0412\u0441\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u043a\u0430\u043a \u0432 [\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438](https://pay.ton-rocket.com/api/#/tg-invoices/InvoicesController_deleteInvoice)\n\n\u041f\u0440\u0438\u043c\u0435\u0440:\n```python\nawait api.delete_invoice(1234)\n```\n\n### \u0414\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0435 \u0432\u0430\u043b\u044e\u0442\u044b\n[\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f](https://pay.ton-rocket.com/api/#/currencies/CurrenciesController_getCoins)\n\n\u041f\u0440\u0438\u043c\u0435\u0440:\n```python\nawait api.available_currencies()\n```\n\n## \u26a0 \u041e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u043e\u0448\u0438\u0431\u043e\u043a\n\n```python\ntry:\n api.get_invoice(1234) # \u0432\u044b\u0437\u043e\u0432 \u043c\u0435\u0442\u043e\u0434\u0430\nexcept aiorocket.classes.RocketAPIError as err:\n print(err.errors)\n```\n\n\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442:\n```json\n{\n \"property\": \"somePropertyName\",\n \"error\": \"somePropertyName should be less than X\"\n}\n```\n",
"bugtrack_url": null,
"license": "",
"summary": "Async Python SDK for TON Rocket",
"version": "1.3.1b2",
"split_keywords": [
"ton",
"rocket",
"sdk",
"async",
"the open network",
"bot",
"telegram",
"crypto",
"cryptocurrency"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "bff48b9d7d7362d07167f20ca928fb402b2715519f404025ff3405fcff7d9a58",
"md5": "4e226a1d66518a83e5c785e573aca0c5",
"sha256": "53fa292d98b80a6a25fe4023407018f963bfc6bd7f8ee9c4a022d72cdbd82dbf"
},
"downloads": -1,
"filename": "aiorocket-1.3.1b2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "4e226a1d66518a83e5c785e573aca0c5",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 17304,
"upload_time": "2023-04-04T15:51:01",
"upload_time_iso_8601": "2023-04-04T15:51:01.387462Z",
"url": "https://files.pythonhosted.org/packages/bf/f4/8b9d7d7362d07167f20ca928fb402b2715519f404025ff3405fcff7d9a58/aiorocket-1.3.1b2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "701fa32106d06e9f656b99ed70d9d3b153380647977163be0b30b32583ee3247",
"md5": "c8223a8ba966a88e1c631ef43016c54a",
"sha256": "ba452579dad0734c682a35310f390144ac8530f508096835c6c8a225a481d537"
},
"downloads": -1,
"filename": "aiorocket-1.3.1b2.tar.gz",
"has_sig": false,
"md5_digest": "c8223a8ba966a88e1c631ef43016c54a",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 16975,
"upload_time": "2023-04-04T15:51:03",
"upload_time_iso_8601": "2023-04-04T15:51:03.737519Z",
"url": "https://files.pythonhosted.org/packages/70/1f/a32106d06e9f656b99ed70d9d3b153380647977163be0b30b32583ee3247/aiorocket-1.3.1b2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-04-04 15:51:03",
"github": false,
"gitlab": false,
"bitbucket": false,
"lcname": "aiorocket"
}