Skip to main content

SDK для работы с TON Rocket

🔐 Авторизация

Как получить токен написано тут.

Mainnet:

import aiorocket
api = aiorocket.Rocket('токен')

Testnet:

import aiorocket
api = aiorocket.Rocket('токен', testnet=True)

🚀 Методы

Получение информации о приложении

Документация

Пример:

await api.info()

Перевод

Все параметры как в документации

Пример:

await api.send(
    tgUserId=1448705322,
    currency="TONCOIN",
    amount=0.123,
    description="Всем совятам привет!"
)

Вывод

Все параметры как в документации

Пример:

await api.withdraw(
    address="EQAJkw0RC9s_FAEmKr4GftJsNbA0IK0o4cfEH3bNoSbKJHAy",
    currency="TONCOIN",
    amount=0.123,
    comment="Всем совятам привет!"
)

Создание чека

Все параметры как в документации

Пример:

cheque = await api.create_cheque({
    chequePerUser=0.005,
    usersNumber=100,
    refProgram=50,
    password="пароль :D",
    description="Чек для вас",
    sendNotifications=True,
    enableCaptcha=True,
    telegramResourcesIds=[
        "-1001799549067"
    ]
})

Получение чеков

Документация

Пример:

await api.get_cheques()

Получение чека по ID

Все параметры как в документации

Пример:

await api.get_cheque(1234)

Удаление чека

Все параметры как в документации

Пример:

await api.delete_cheque(1234)
# ИЛИ ТАК
await cheque.delete() # в стиле ООП

Создание счёта

Все параметры как в документации

Пример:

invoice = await api.createInvoice(
    amount=1.23,
    description="покупка лучшой вещи в мире",
    hiddenMessage="спасибо",
    callbackUrl="https://t.me/ton_rocket",
    payload="some payload",
    expiredIn=10
)

Получение счетов

Документация

Пример:

await api.get_invoices()

Получение счёта по ID

Все параметры как в документации

Пример:

await api.get_invoice(1234)

Удаление счёта

Все параметры как в документации

Пример:

await api.delete_invoice(1234)
# ИЛИ ТАК
await invoice.delete() # в стиле ООП

Доступные валюты

Документация

Пример:

await api.available_currencies()

⚠ Обработка ошибок

try:
    api.get_invoice(1234) # вызов метода
except aiorocket.classes.RocketAPIError as err:
    print(err.errors)

Результат:

{
    "property": "somePropertyName",
    "error": "somePropertyName should be less than X"
}

Metadata

Release files for aiorocket 1.3.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for aiorocket 1.3.1
File Size Uploaded Provenance Actions
aiorocket-1.3.1.tar.gz 17.0 kB Without provenance Details for aiorocket-1.3.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for aiorocket 1.3.1
File Interpreter ABI Platform Actions
aiorocket-1.3.1-py3-none-any.whl Python 3 none any Details for aiorocket-1.3.1-py3-none-any.whl

Total release size: 34.4 kB

Release files / aiorocket-1.3.1.tar.gz

Download URL aiorocket-1.3.1.tar.gz
Size 17.0 kB
Tags Source
SHA-256 checksum
How to use checksums
f261f02f5bfdb3d13f0ccd521b7c9bacb84732508fd7acd943aafb0361297d85
BLAKE2b-256 checksum
How to use checksums
c0b43c2886e3fe2e677e545b6073e6609ea4a82074a87ee4b7c4de1e8d9c266d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.10

Release files / aiorocket-1.3.1-py3-none-any.whl

Download URL aiorocket-1.3.1-py3-none-any.whl
Size 17.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4625befa7df42633a2b9b6a3385845f7ecad6e0f06b046c15e257ca3f6c50f40
BLAKE2b-256 checksum
How to use checksums
5e670bc1db23db193feaff707129015c1f2e5ebca6206fb2ef5ce6a39c8da5a7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.10

Security for aiorocket 1.3.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page