class Node::Channels

Public Instance Methods

channel_balance() click to toggle source
# File lib/node.rb, line 77
def channel_balance
  stub.channel_balance(Lnrpc::ChannelBalanceRequest.new())
end
close_channel(channel_point) click to toggle source
# File lib/node.rb, line 59
def close_channel(channel_point)

  cp = Lnrpc::ChannelPoint.new(funding_txid_str: channel_point)

  stub.close_channel(Lnrpc::CloseChannelRequest.new(channel_point: cp,
                                                    force: true,
                                                    target_conf: 6,
                                                    sat_per_byte: 150000))
end
close_channels() click to toggle source
# File lib/node.rb, line 70
def close_channels
  Node::Payments.new.list_channels["channels"].map do |r|
    puts "Closing #{r["channel_point"]}"
    Node::Payments.new.close_channel( r["channel_point"] )
  end
end
fee_report() click to toggle source
# File lib/node.rb, line 98
def fee_report
  stub.fee_report(Lnrpc::FeeReportRequest.new())
end
get_chain_info(chain_id) click to toggle source
# File lib/node.rb, line 89
def get_chain_info(chain_id)
  # TODO: ERROR OUT
  stub.get_chain_info(Lnrpc::ChainInfoRequest.new(chain_id: chain_id))
end
get_network_info() click to toggle source
# File lib/node.rb, line 94
def get_network_info
  stub.get_network_info(Lnrpc::FeeReportRequest.new())
end
list_channels() click to toggle source
# File lib/node.rb, line 85
def list_channels
  stub.list_channels(Lnrpc::ListChannelsRequest.new())
end
open_channel(addr, amt) click to toggle source
# File lib/node.rb, line 43
def open_channel(addr, amt)

  r = addr.split("@")
  pubkey = r[0]
  host = r[1]


  hex = bin_to_hex(pubkey)

  request = Lnrpc::OpenChannelRequest.new(node_pubkey_string: pubkey,
                                          local_funding_amount: amt, 
                                          push_sat: (amt / 100))

  r = stub.open_channel_sync(request)
end
pending_channels() click to toggle source
# File lib/node.rb, line 81
def pending_channels
  stub.pending_channels(Lnrpc::PendingChannelsRequest.new())
end
update_chan_policy() click to toggle source
# File lib/node.rb, line 102
def update_chan_policy
  # TODO: Raise won't do
  raise "won't do :) "
end