Tools¶
Additional functionality.
- CryptoPay.exchange(amount, source, target)¶
Exchange currency.
Wrapper for
aiosend.CryptoPay.get_exchange_rates().Use this method to get the equivalent amount in the target currency for the source currency.
- Return type:
float- Raise:
aiosend.exceptions.CryptoPayErrorif there is no such exchange rate.
Usage example
import asyncio
from aiosend import CryptoPay
async def main() -> None:
cp = CryptoPay(token="TOKEN")
print(await cp.exchange(10, "USDT", "USD")) # 9.998635
if __name__ == "__main__":
asyncio.run(main())
- CryptoPay.get_balance_by_asset(asset)¶
Get the balance of a specific asset.
Wrapper for
aiosend.CryptoPay.get_balance().Use this method to get the balance of a specific asset.
- Return type:
- Raise:
aiosend.exceptions.CryptoPayErrorif there is no such asset.
Usage example
import asyncio
from aiosend import CryptoPay
async def main() -> None:
cp = CryptoPay(token="TOKEN")
print(await cp.get_balance_by_asset("USDT")) # 1.2345
if __name__ == "__main__":
asyncio.run(main())
- CryptoPay.get_invoice(invoice)¶
Get exactly one invoice or none.
Wrapper for
aiosend.CryptoPay.get_invoices()Use this method to update status of an existing invoice object or to get this object by passing the invoice id.
- Return type:
Invoice|None
Usage example
import asyncio
from aiosend import CryptoPay
async def main() -> None:
cp = CryptoPay(token="TOKEN")
invoice = await cp.create_invoice(1, "TON")
print(invoice.status) # active
await asyncio.sleep(10) # payment
new_invoice = await cp.get_invoice(invoice)
print(new_invoice.status) # paid
if __name__ == "__main__":
asyncio.run(main())
- CryptoPay.get_check(check)¶
Get exactly one check or none.
Wrapper for
aiosend.CryptoPay.get_checks()Use this method to update status of an existing check object or to get this object by passing the check id.
- Return type:
Check|None
- CryptoPay.delete_all_checks()¶
Delete all checks.
Wrapper for
aiosend.CryptoPay.get_checks()andaiosend.CryptoPay.delete_check()Use this method to delete all existing checks created by your app.
- Return type:
None
- CryptoPay.delete_all_invoices()¶
Delete all invoices.
Wrapper for
aiosend.CryptoPay.get_invoices()andaiosend.CryptoPay.delete_invoice()Use this method to delete all existing invoices created by your app.
- Return type:
None
- CryptoPay.get_rates_image(base, quote, rate, percent)¶
Get rates image.
Use this method to get exchange rates image.
- Return type:
str