A simple, async-first wrapper for the Prestmit crypto wallet balance API.
Project description
Wallets API Wrapper
A simple Python wrapper for the Prestmit crypto wallet balance API, with support for both synchronous and asynchronous clients. Fetches full balance details, including the complete transaction list.
Installation
pip install wallets
Asynchronous Usage
import asyncio
from wallets import AsyncWalletClient, AddressNotFoundError
async def main():
async with AsyncWalletClient() as client:
try:
btc_balance = await client.get_balance("btc", "bc1qar0srrr7xfkvy5l643lydnw9re59gtzzwf5mdq")
print(f"Address: {btc_balance.address}")
print(f"Final Balance: {btc_balance.balance} BTC")
print(f"Total Transactions: {btc_balance.n_tx}")
print("\nRecent Transactions:")
for tx in btc_balance.transactions[:5]: # Print first 5 transactions
print(f" - Hash: {tx.tx_hash[:10]}..., Value: {tx.value}, Confirmations: {tx.confirmations}")
except AddressNotFoundError as e:
print(e)
if __name__ == "__main__":
asyncio.run(main())
Synchronous Usage
from wallets import SyncWalletClient, AddressNotFoundError
def main():
with SyncWalletClient() as client:
try:
eth_balance = client.get_balance("eth", "0xde0B295669a9FD93d5F28D9Ec85E40f4cb697BAe")
print(f"ETH Balance: {eth_balance.balance} ETH")
if eth_balance.transactions:
print(f"First transaction hash: {eth_balance.transactions[0].tx_hash}")
except AddressNotFoundError as e:
print(e)
if __name__ == "__main__":
main()
Data Objects
A successful call returns a WalletBalance object containing a list of Transaction objects.
WalletBalance Attributes
address(str)crypto_type(str)balance(float)total_received(float)total_sent(float)n_tx(int)transactions(List[Transaction])
Transaction Attributes
tx_hash(str)block_height(int)value(float)ref_balance(float)confirmations(int)confirmed_at(str)double_spend(bool)
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file prestmit-0.1.0.tar.gz.
File metadata
- Download URL: prestmit-0.1.0.tar.gz
- Upload date:
- Size: 3.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
21196d7b3a0b6f66a2ad0dd5ab91f4d898f1d54d62626512c5f3eea42e664e3f
|
|
| MD5 |
7b6c1196e83c65109b3d6a9631228a1c
|
|
| BLAKE2b-256 |
117a7d43a2c3eb29f1878becf1c136fc6e3923dd48887598e81e6ed0f5b9b7e4
|
File details
Details for the file prestmit-0.1.0-py3-none-any.whl.
File metadata
- Download URL: prestmit-0.1.0-py3-none-any.whl
- Upload date:
- Size: 3.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7670ead3cdeb6f09daa10c2a1b4c5b2ae8734dccc87efb23a72b3cf88ce2c328
|
|
| MD5 |
3a7a8d8a1eee2b16bb42c2cdc204476f
|
|
| BLAKE2b-256 |
df281ab922d5f9656a6fc56d4b4739b93bc26c11b0cbbeee3e300dca4a2a7c26
|