Project

lnd-client

0.0
No release in over a year
Ruby Lightning Network Daemon (lnd) Client
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

~> 1.53
 Project Readme

lnd-client Gem Version RSpec Tests Status

Ruby Lightning Network Daemon Client: Straightforward access to lnd gRPC API

This is a low-level client library. For a better experience, you may want to check out the Lighstorm abstraction.

  • Usage
  • Available Supported Services
  • Development
    • Upgrading gRPC Proto Files
    • Generating Documentation
    • Publish to RubyGems

Usage

Add to your Gemfile:

gem 'lnd-client', '~> 0.0.9'
require 'lnd-client'

puts LNDClient.version # => 0.0.9

client = LNDClient.new(
  'lndconnect://127.0.0.1:10009?cert=MIICJz...JBEERQ&macaroon=AgEDbG...45ukJ4'
)

client.lightning.wallet_balance.total_balance # => 101527

client.lightning.wallet_balance.to_h # =>
# { total_balance: 101_527,
#   confirmed_balance: 101_527,
#   unconfirmed_balance: 0,
#   locked_balance: 0,
#   reserved_balance_anchor_chan: 20_000,
#   account_balance: {
#     'default' => {
#       confirmed_balance: 101_527,
#       unconfirmed_balance: 0 } } }

client.lightning.get_node_info(
  pub_key: '02d3c80335a8ccb2ed364c06875f32240f36f7edb37d80f8dbe321b4c364b6e997'
).node.alias # => 'icebaker/old-stone'

client.lightning.subscribe_channel_graph do |data|
  puts data.inspect # => { ... }
end

client.router.subscribe_htlc_events do |data|
  puts data.inspect # => { ... }
end

Check the full documentation.

Available Supported Services

Development

Copy the .env.example file to .env and provide the required data.

# Gemfile
gem 'lnd-client', path: '/home/user/lnd-client'

# demo.rb
require 'lnd-client'

puts LNDClient.version
bundle
rubocop -A

Upgrading gRPC Proto Files

bundle exec rake grpc:upgrade

Generating Documentation

bundle exec rake grpc:docs

npm i docsify-cli -g

docsify serve ./docs

Publish to RubyGems

gem build lnd-client.gemspec

gem signin

gem push lnd-client-0.0.9.gem