Skip to main content

A simple, async-first wrapper for the Prestmit crypto wallet balance API.

Project description

Prestmit 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 prestmit

Asynchronous Usage

import asyncio
from prestmit 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 prestmit 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

prestmit-0.1.1.tar.gz (3.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

prestmit-0.1.1-py3-none-any.whl (3.8 kB view details)

Uploaded Python 3

File details

Details for the file prestmit-0.1.1.tar.gz.

File metadata

  • Download URL: prestmit-0.1.1.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

Hashes for prestmit-0.1.1.tar.gz
Algorithm Hash digest
SHA256 c39dfdcbed15d2aa0298a21255c547e9f963c143e2f06dca8a19e1f00b4f8462
MD5 16a36d0859d7694d4753a4c1cfac9cde
BLAKE2b-256 02f778c6c22632cb7ac7bc30d5e0a76bdb0548af734a2fcaa2f9b32263778efa

See more details on using hashes here.

File details

Details for the file prestmit-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: prestmit-0.1.1-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

Hashes for prestmit-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 32300288a71c473c35c40353493972a0625badd276e04f682a5c3da1cccdc619
MD5 736485d1849f8828dcd8312c5d504ff6
BLAKE2b-256 ae23e0d28da30c3b461dcc5c7cb17313ae9c3a3a1971ad95374dc516ffb70c2a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page