Class: Node::Peers

Inherits:
Object
  • Object
show all
Includes:
Lnd
Defined in:
lib/node.rb

Instance Method Summary collapse

Instance Method Details

#connect(addr) ⇒ Object



130
131
132
133
134
135
136
137
138
139
# File 'lib/node.rb', line 130

def connect(addr)
  # TODO: Create utility function to separate pub_key and host from full adress
  r = addr.split("@")
  pubkey = r[0]
  host = r[1]

  address = Lnrpc::LightningAddress.new(pubkey: pubkey, host: host)

  stub.connect_peer(Lnrpc::ConnectPeerRequest.new(addr: address, perm: false))
end

#describe_graphObject



149
150
151
# File 'lib/node.rb', line 149

def describe_graph
  stub.describe_graph(Lnrpc::ChannelGraphRequest.new())
end

#disconnect(pub_key) ⇒ Object



141
142
143
# File 'lib/node.rb', line 141

def disconnect(pub_key)
  stub.disconnect_peer(Lnrpc::DisconnectPeerRequest.new(pub_key: pub_key))
end

#get_node_info(pub_key) ⇒ Object



153
154
155
# File 'lib/node.rb', line 153

def get_node_info(pub_key)
  stub.get_node_info(Lnrpc::NodeInfoRequest.new(pub_key: pub_key))
end

#list_peersObject



145
146
147
# File 'lib/node.rb', line 145

def list_peers
  stub.list_peers(Lnrpc::ListPeersRequest.new())
end