Giter Site home page Giter Site logo

lnd-client's Introduction

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

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

lnd-client's People

Contributors

icebaker avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.