Asynchronous Python library for Heleket API
Project description
aioheleket
An asynchronous Python library for the Heleket cryptocurrency payment API.
pip
pip install aioheleket
uv
uv pip install aioheleket
Documentation
Official Heleket Documentation.
The library also includes docstrings.
Features
Creating a Client
import asyncio
from aioheleket import HeleketClient
async def main() -> None:
client = HeleketClient(
merchant_id="<merchant_id>",
payment_api_key="<payment_api_key>",
payout_api_key="<payout_api_key>"
)
await client.close_session() # <!>
if __name__ == "__main__":
asyncio.run(main())
Creating a Payment
import asyncio
from aioheleket import HeleketClient, CryptoCurrency, Network, Lifetime
async def main() -> None:
client = HeleketClient(
merchant_id="<merchant_id>",
payment_api_key="<payment_api_key>"
)
payment_service = await client.payment_service()
payment = await payment_service.create_invoice(
currency=CryptoCurrency.USDT,
network=Network.ETH,
order_id="order_3331",
amount="2",
lifetime=Lifetime.HOUR_5
)
print(payment.url, payment.uuid, payment.address)
await client.close_session() # <!>
if __name__ == "__main__":
asyncio.run(main())
Transferring Money from Business Wallet to Personal Wallet
import asyncio
from aioheleket import HeleketClient, CryptoCurrency
async def main() -> None:
client = HeleketClient(
merchant_id="<merchant_id>",
payout_api_key="<payout_api_key>"
)
payout_service = await client.payout_service()
transfer = await payout_service.transfer_to_personal_wallet(
currency=CryptoCurrency.USDT,
amount="4"
)
print(transfer.user_wallet_transaction_uuid, transfer.user_wallet_balance)
await client.close_session() # <!>
if __name__ == "__main__":
asyncio.run(main())
Creating a Static Wallet
import asyncio
from aioheleket import HeleketClient, Network, CryptoCurrency
async def main() -> None:
client = HeleketClient(
merchant_id="<merchant_id>",
payment_api_key="<payment_api_key>"
)
wallet_service = await client.static_wallet_service()
wallet = await wallet_service.create_wallet(
currency=CryptoCurrency.USDT,
network=Network.ETH,
order_id="wal_usdt"
)
print(wallet.uuid, wallet.url)
await client.close_session() # <!>
if __name__ == "__main__":
asyncio.run(main())
Viewing Balance
import asyncio
from aioheleket import HeleketClient
async def main() -> None:
client = HeleketClient(
merchant_id="<merchant_id>",
payment_api_key="<payment_api_key>"
)
finance_service = await client.finance_service()
balance = await finance_service.balance()
print("--- User Balance")
for i, balance_info in enumerate(balance.user, 1):
print(f"{i}) {balance_info.currency_code}\nAmount: {balance_info.crypto_amount}\nAmount in USD: {balance_info.usd_amount}\nUUID: {balance_info.uuid}\n")
print("\n--- Merchant Balance")
for i, balance_info in enumerate(balance.merchant, 1):
print(f"{i}) {balance_info.currency_code}\nAmount: {balance_info.crypto_amount}\nAmount in USD: {balance_info.usd_amount}\nUUID: {balance_info.uuid}\n")
await client.close_session() # <!>
if __name__ == "__main__":
asyncio.run(main())
Getting Exchange Rates
import asyncio
from aioheleket import HeleketClient, CryptoCurrency, FiatCurrency
async def main() -> None:
client = HeleketClient(
merchant_id="<merchant_id>",
payment_api_key="<payment_api_key>"
)
finance_service = await client.finance_service()
print("--- BTC Exchange Rates for RUB, KZT, and TRX")
target_currencies = (FiatCurrency.RUB, CryptoCurrency.TRX, FiatCurrency.KZT)
btc_rate = await finance_service.exchange_rate(CryptoCurrency.BTC, target_currencies)
for i, rate in enumerate(btc_rate, 1):
print(f"{i}) {rate.to}: {rate.course}")
print("\n--- All BTC Exchange Rates")
all_btc_rates = await finance_service.exchange_rate(CryptoCurrency.BTC)
for i, rate in enumerate(all_btc_rates, 1): # output all rates for BTC
print(f"{i}) {rate.to}: {rate.course}")
await client.close_session() # <!>
if __name__ == "__main__":
asyncio.run(main())
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
aioheleket-1.2.0.tar.gz
(21.1 kB
view details)
File details
Details for the file aioheleket-1.2.0.tar.gz.
File metadata
- Download URL: aioheleket-1.2.0.tar.gz
- Upload date:
- Size: 21.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
393d7ac83ff2558d2d3986f73ce6e6ed2f7dd92f513d0ccb82d352bc14d01b3a
|
|
| MD5 |
4f36fd4d485ec77212ab510b6d509cd6
|
|
| BLAKE2b-256 |
9a2f6140cff2280f3c2bb69c3542832d6d0d700e2d5e3fea2d0d94b9d4d292b3
|