Python SDK for t.me/xJetSwapBot
Project description
Python SDK for xJet Connect API
Authors
Installation
pip install xjet
If requires nacl package, install it manually:
pip install pynacl
Webhook analog
while True:
res = httpx.get(
'https://api.xjet.io/v1/account.events',
params={'timeout': 10},
headers={
'X-API-Key': api_key,
},
timeout=11,
)
print(res.json)
time.sleep(3)
Usage/Examples
Initialization
from xjet import JetAPI
# api_key: str
# private_key: str
api = JetAPI(
api_key="API_KEY",
private_key="PRIVATE_KEY",
network='mainnet' # mainnet / testnet
)
Info
await xjet.currencies() # Shows all saved xJetSwap currencies
Account
await api.me() # get API Application information.
# {'id': <str>, 'name: <str>, 'service_wallet': <str>}
await api.balance() # get balance
# {
# 'balances': [
# {'currency': <int>, 'amount': <float>,
# 'values': {'byn': 0.0, 'cny': 0.0, 'eur': 0.0, 'gbp': 0.0, 'kzt': 0.0, 'rub': 0.0, 'uah': 0.0, 'usd': 0.0}}],
# 'timestamp': <int>
# }
await api.submit_deposit() # check for deposit
# {'success': <bool>}
# ton_address: str
# currency: str
# amount: float
await api.withdraw(ton_address, currency, amount) # check for deposit
# limit: int
# offset: int
await xjet.operations(limit, offset) # operations
Cheque
# currency: str
# amount: float
# expires: [int, None]
# description: [str, None]
# activates_count: [int, None]
# groups_id: [int, None]
# personal_id: [int, None]
# password: [str, None]
await api.cheque_create(currency, amount, expires, description, activates_count, groups_id, personal_id, password) # create cheque
# {'cheque_id': <str>, 'external_link': 'https://t.me/xJetSwapBot?start=c_<cheque_id>'}
await api.cheque_status(cheque_id) # get cheque status
# {
# 'id': <str>,
# 'issuer_id': <str>,
# 'amount': <float>,
# 'activates_count': <int>,
# 'activates: <list[str]>,
# 'locked_value': <float>,
# 'currency': <Str>,
# 'expires': <bool>,
# 'description': <str>,
# 'status': 'activated/canceled/expired/active',
# 'password': <str | None>,
# 'groups_id': <list[str] | None>,
# 'personal_id': <int | None>,
# 'is_for_premium': <bool>
# }
await api.cheque_list() # get cheques on account
# list of cheque_status
await api.cheque_cancel(cheque_id) # delete cheque
# returns cheque_status
Invoice
# currency: str
# amount: float
# description: [str, None]
# max_payments: [int, None]
await api.invoice_create(currency, amount, description, max_payments) # create invoice
# {'invoice_id': <str>, 'external_link': 'https://t.me/xJetSwapBot?start=inv_<cheque_id>'}
await api.invoice_status(invoice_status) # get invoice status
# {
# 'id': <str>,
# 'description': <str>,
# 'currency': <str>,
# 'amount': <float>,
# 'max_amount': None,
# 'min_amount': None,
# 'payments': [{'telegram_id': <int>, 'amount': <float>, 'comment': [str | None}, ... ],
# 'max_payments': 1,
# 'after_pay': [],
# 'created': '2023-04-20T22:55:24.313000'
# }
await api.invoice_list() # get invoices on account
# list of invoice_status
# NFT methods
await api.nft_list()
await api.nft_transfer(nft_address, to_address)
License
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
xjet-0.1.5.tar.gz
(18.5 kB
view details)
Built Distribution
xjet-0.1.5-py3-none-any.whl
(18.3 kB
view details)
File details
Details for the file xjet-0.1.5.tar.gz
.
File metadata
- Download URL: xjet-0.1.5.tar.gz
- Upload date:
- Size: 18.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.3.2 CPython/3.11.3 Darwin/22.1.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a768c2cac7767dff81365d1f3b9f3538fbd2dc3955ecc61d709b2b373f1a3b4e |
|
MD5 | 9f581a6a012948e3d5c4775a00e352a9 |
|
BLAKE2b-256 | 17cf1ff9e862b0ec49539c3f5e58f1f3c8fd227330d2dfca850b122d791b584f |
File details
Details for the file xjet-0.1.5-py3-none-any.whl
.
File metadata
- Download URL: xjet-0.1.5-py3-none-any.whl
- Upload date:
- Size: 18.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.3.2 CPython/3.11.3 Darwin/22.1.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6705b5a1dac7a71d3ce394cd4c80ebe1f61b9d64c5798cb09b08a5561f19d137 |
|
MD5 | dca5df8d8aad95e8bca4c4fc7b4375cc |
|
BLAKE2b-256 | 15453d8d1a80ce8fa0a33917fd626ee477c3d0782fdcb2602fa2dd6806da7289 |