From 957515b0fe79b54ff3bb04fa4c1adf8f937d23ac Mon Sep 17 00:00:00 2001 From: Ivan Raszl Date: Wed, 14 Jul 2021 11:14:49 +0800 Subject: [PATCH 1/3] Fix typo in README.md Just a misspelled word. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b6148b0..df8ac49 100644 --- a/README.md +++ b/README.md @@ -75,7 +75,7 @@ lnd = Lnrpc::Client.new({credentials_path: '/path/to.cert.cls', macaroon_path: ' lnd.lightning # => Lnrpc::Lightning::Stub lnd.router # => Lnrpc::Router::Stub -lnd.ligthning.get_info +lnd.lightning.get_info ``` Also have a look at [examples.rb](https://github.com/bumi/lnrpc/blob/master/examples.rb) From fcf2486af32eaa42b159f417e34e14342909c570 Mon Sep 17 00:00:00 2001 From: Ivan Raszl Date: Sun, 15 Aug 2021 23:44:21 +0800 Subject: [PATCH 2/3] add examples for message signing/verification, get node/channel info --- examples.rb | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/examples.rb b/examples.rb index 9e9b2fc..4be9928 100644 --- a/examples.rb +++ b/examples.rb @@ -24,3 +24,33 @@ puts lnd.wallet_kit.next_addr lnd.lightning.subscribe_invoices(settle_index: 1).each do |invoice| puts invoice.payment_request end + +# sign a message with your node +signed_message = lnd.lightning.sign_message({ msg: "Money printer goes brrr" }) +puts "Signature: " + signed_message.signature + +# verify a signed message by another node +verification_response = lnd.lightning.verify_message({ + msg: "Money printer goes brrr", + signature: signed_message.signature +}) +puts "Pubkey: " + verification_response.pubkey # pubkey of the node that signed +puts "Valid: " + verification_response.valid.to_s + +# get information on a node +node_info_response = lnd.lightning.get_node_info(pub_key: verification_response.pubkey, include_channels: true) +puts "Updated: " + Time.at(node_info_response.node.last_update).to_s +puts "Pubkey: " + node_info_response.node.pub_key.to_s +puts "Alias: " + node_info_response.node.alias.to_s +puts "Color: " + node_info_response.node.color.to_s +puts "Channels: " + node_info_response.num_channels.to_s +puts "Capacity SAT: " + node_info_response.total_capacity.to_s +puts "Address: " + node_info_response.node.addresses.first["addr"].to_s + +# extract channel information +node_info_response.channels.each do |channel| + puts "Channel ID: " + channel["channel_id"].to_s + puts "Channel 1:" + channel["node1_pub"].to_s # pubkey of the first node + puts "Channel 2:" + channel["node2_pub"].to_s # pubkey of the second node + puts "Channel Capacity:" + channel["capacity"].to_s +end \ No newline at end of file From cb549f4fe67a6bfdd403f6e385455284e963f3c9 Mon Sep 17 00:00:00 2001 From: azuchi Date: Mon, 22 Nov 2021 11:03:39 +0900 Subject: [PATCH 3/3] Fix typo --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index df8ac49..1dbcd37 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ 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. +This gem makes the gRPC client classes created from the [LND service definitions](https://github.com/lightningnetwork/lnd/tree/master/lnrpc) available. ```ruby require "lnrpc" @@ -32,7 +32,7 @@ require "lnrpc" # With the changes in LND v.10.0 this load the `Lnrpc` and `Routerrpc` namespace Lnrpc::Lightning::Stub -Routerrpc:::Routerrpc::Stub +Routerrpc::Routerrpc::Stub Lnrpc::GetInfoRequest ... ``` @@ -130,7 +130,7 @@ client.lightning.grpc.list_channels(request) client.lightning.wallet_balance.total_balance # is the same as: -request = Lnrpc::WalletBalanceRequest.new() +request = Lnrpc::WalletBalanceRequest.new client.lightning.grpc.wallet_balance(request).total_balance ``` @@ -141,7 +141,7 @@ If you have a running BTC Pay Server with LND support, integrating with lnrpc is - Navigate to Services on the Server Settings page - Click "see information" for your gRPC Server - The link by "More details..." will expose the address and various macaroon hex strings -- Initialize your client with the options detailed above. BTC Pay Server utilizes LetsEncrypt for trusted TLC Certificates so set that option to nil. +- Initialize your client with the options detailed above. BTC Pay Server utilizes LetsEncrypt for trusted TLC Certificates so set that option to nil. Don't have a BTC Pay Server? [Setting one up is easy.](https://medium.com/@BtcpayServer/launch-btcpay-server-via-web-interface-and-deploy-full-bitcoin-node-lnd-in-less-than-a-minute-dc8bc6f06a3)