From 8cbda248c8d5c1ff32d6a4e1d33a0b6e42c6b48d Mon Sep 17 00:00:00 2001 From: Michael Bumann Date: Tue, 12 Feb 2019 05:22:07 +0000 Subject: [PATCH] Update README.md --- README.md | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 09a0501..a304346 100644 --- a/README.md +++ b/README.md @@ -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: