Skip to main content

An asynchronous nano currency library

Project description

aio-nano

Overview

This library contains an asynchronous python RPC client for Nano nodes, allowing you to more easily develop on the Nano network with fully type annnotated methods and responses.

Installation

PIP

pip install aio-nano

Poetry

poetry add aio-nano

Example Async HTTP RPC Call

from aio_nano import Client
import asyncio

async def main():
  api_key = ...
  client = Client('https://mynano.ninja/api/node', {'Authorization': api_key})

  supply = await client.available_supply()
  print(supply)

asyncio.run(main())

Example Async WebSocket RPC Subscription

import asyncio
from time import time

from aio_nano import WSClient


async def main():
  ws = await WSClient("ws://localhost:7078").connect()
  start = time() * 1000
  await ws.subscribe("confirmation", lambda x: print(x), ack=True)
  print(f"Acked in {time() * 1000 - start}ms")

  await asyncio.Future()


asyncio.run(main())

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

aio-nano-0.1.9.tar.gz (11.7 kB view hashes)

Uploaded Source

Built Distribution

aio_nano-0.1.9-py3-none-any.whl (13.1 kB view hashes)

Uploaded Python 3

Supported by

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