Update README.md

This commit is contained in:
bumi 2019-02-12 05:22:07 +00:00 committed by GitHub
parent 342c286115
commit 8cbda248c8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 18 additions and 3 deletions

View File

@ -1,4 +1,4 @@
# Lnrpc - gRPC client for LND, the Lightning Network Daemon
# Lnrpc - ruby gRPC client for LND
a [gRPC](https://grpc.io/) client for [LND, the Lightning Network Daemon](https://github.com/lightningnetwork/lnd/) packed as ruby gem.
@ -22,7 +22,17 @@ Or install it yourself as:
## Usage
This gem makes the gRPC client classes created from the [LND service defintions](https://github.com/lightningnetwork/lnd/tree/master/lnrpc) available.
You should get familiar with [gRPC](https://grpc.io/).
```ruby
require "lnrpc"
# the gRPC client is available under the Lnrpc namespace, e.g.
Lnrpc::Lightning::Stub
Lnrpc::GetInfoRequest
```
Learn more about [gRPC](https://grpc.io/) on [gRPC.io](https://grpc.io/).
The LND API reference can be found here: [https://api.lightning.community/](https://api.lightning.community/)
@ -41,7 +51,6 @@ client = Lnrpc::Lightning::Stub.new("localhost:10009", GRPC::Core::ChannelCreden
request = Lnrpc::GetInfoRequest.new
response = client.get_info(request, { metadata: { macaroon: macaroon } }) #=> Lnrpc::GetInfoResponse
puts response.alias
```
### Client wrapper
@ -49,6 +58,12 @@ puts response.alias
An optional client wrapper ([Lnrpc::Client](https://github.com/bumi/lnrpc/blob/master/lib/lnrpc/client.rb")) makes
initializing the gRPC client easier and removes the need for some boilerplate code for calling RPC methods.
#### Example
```ruby
lnd = Lnrpc::Client.new({credentials_path: '/path/to.cert.cls', macaroon_path: '/path/to/admin.macaroon'})
lnd.get_info
```
#### Initializing a new client
The Lnrpc::Client constructor allows the following options: