Metadata-Version: 2.0
Name: lndgrpc
Version: 0.1.2
Summary: An rpc client for LND (lightning network deamon)
Home-page: https://github.com/adrienemery/lnd-grpc-client
Author: Adrien Emery
Author-email: adrien.emery@gmail.com
License: MIT
Download-URL: https://github.com/adrienemery/lnd-grpc-client/archive/0.1.1.tar.gz
Description-Content-Type: UNKNOWN
Keywords: lnd,lightning-network,bitcoin,grpc,rpc,async
Platform: UNKNOWN
Classifier: Development Status :: 3 - Alpha
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3.4
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
Requires-Python: >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, <4
Requires-Dist: aiogrpc
Requires-Dist: googleapis-common-protos
Requires-Dist: grpcio
Requires-Dist: grpcio-tools

# lnd-grpc-client
A python grpc client for LND (Lightning Network Daemon) ⚡⚡⚡

This is a wrapper around the default grpc interface that handles setting up credentials (including macaroons). An async client is also available to do fun async stuff like listening for invoices in the background. 

Because of async support this only works with python 3.5+.

## Installation
```bash
$ pip install lndgrpc
```

## How to use
The api mirrors the underlying lnd grpc api (http://api.lightning.community/) but methods will be in pep8 style. ie. `.GetInfo()` becomes `.get_info()`.

```python
from lndgrpc import LNDClient

# pass in the ip-address with RPC port
lnd = LNDClient("127.0.0.1:10009")

lnd.get_info()

print('Listening for invoices...')
for invoice in lnd.subscribe_invoices():
    print(invoice)
```

### Async

```python
import asyncio
from lndgrpc import AsyncLNDClient

# pass in the ip-address with RPC port
async_lnd = AsyncLNDClient("127.0.0.1:10009")

async def subscribe_invoices():
    print('Listening for invoices...')
    async for invoice in async_lnd.subscribe_invoices():
        print(invoice)

async def get_info():
    while True:
        info = await async_lnd.get_info()
        print(info)
        await asyncio.sleep(5)

async def run():
    coros = [subscribe_invoices(), get_info()]
    await asyncio.gather(*coros)

loop = asyncio.get_event_loop()
loop.run_until_complete(run())
```


### TODO
- [ ] improve docs
- [ ] add tests



