lnrpc 0.1.0 → 0.5.2.beta
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/lnrpc.rb +3 -2
- data/lib/lnrpc/client.rb +23 -9
- data/lib/lnrpc/rpc.proto +9 -1
- data/lib/lnrpc/rpc_pb.rb +2 -0
- data/lib/lnrpc/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c9f1749c1fa4257d3624d77aa15e4b8d47f1c6ef2bc19c33965a9bbc8c544b39
|
4
|
+
data.tar.gz: b7792de3c448b8a2d53376befe522bdfa819e15cecd0387934742233152a5912
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 27ebcf6544a548ab97d5bdeeb2452ebdaa5f5ea1a1870339e8c54e38e23b576c15dfb1ea6b0a5421e854beed8ccc645f8dbd5cc6c030e61f19d9a834b28e1f31
|
7
|
+
data.tar.gz: f3fa6207e3c74da86a8d4054163eb028be1b07ef146b4be10370da210c11684f46503c18d9d67ddfae332c67e1e61b34c8a3a9615a4161ced4a266e394751d64
|
data/Gemfile.lock
CHANGED
data/lib/lnrpc.rb
CHANGED
data/lib/lnrpc/client.rb
CHANGED
@@ -2,11 +2,12 @@ module Lnrpc
|
|
2
2
|
class Client
|
3
3
|
attr_accessor :address, :credentials, :macaroon, :grpc_client
|
4
4
|
|
5
|
+
LND_HOME_DIR = ENV['LND_HOME'] || "~/.lnd"
|
5
6
|
DEFAULT_ADDRESS = 'localhost:10009'
|
6
|
-
DEFAULT_CREDENTIALS_PATH = "
|
7
|
-
DEFAULT_MACAROON_PATH = "
|
7
|
+
DEFAULT_CREDENTIALS_PATH = "#{LND_HOME_DIR}/tls.cert"
|
8
|
+
DEFAULT_MACAROON_PATH = "#{LND_HOME_DIR}/data/chain/bitcoin/mainnet/admin.macaroon"
|
8
9
|
|
9
|
-
def initialize(options)
|
10
|
+
def initialize(options={})
|
10
11
|
self.address = options[:address] || DEFAULT_ADDRESS
|
11
12
|
|
12
13
|
options[:credentials] ||= ::File.read(::File.expand_path(options[:credentials_path] || DEFAULT_CREDENTIALS_PATH))
|
@@ -14,21 +15,34 @@ module Lnrpc
|
|
14
15
|
|
15
16
|
options[:macaroon] ||= begin
|
16
17
|
macaroon_binary = ::File.read(::File.expand_path(options[:macaroon_path] || DEFAULT_MACAROON_PATH))
|
17
|
-
macaroon_binary.
|
18
|
+
macaroon_binary.unpack("H*")
|
18
19
|
end
|
19
20
|
self.macaroon = options[:macaroon]
|
20
21
|
|
21
22
|
self.grpc_client = Lnrpc::Lightning::Stub.new(self.address, GRPC::Core::ChannelCredentials.new(self.credentials))
|
22
23
|
end
|
23
24
|
|
25
|
+
def pay(payreq)
|
26
|
+
self.send_payment_sync(Lnrpc::SendRequest.new(payment_request: payreq))
|
27
|
+
end
|
28
|
+
|
24
29
|
def method_missing(m, *args, &block)
|
25
|
-
if
|
26
|
-
args[
|
27
|
-
args[
|
30
|
+
if self.grpc_client.respond_to?(m)
|
31
|
+
params = args[0]
|
32
|
+
options = args[1] || { metadata: { macaroon: self.macaroon } }
|
33
|
+
|
34
|
+
request = params.nil? ? request_class_for(m).new : request_class_for(m).new(params)
|
35
|
+
self.grpc_client.send(m, request, options)
|
28
36
|
else
|
29
|
-
|
37
|
+
super
|
30
38
|
end
|
31
|
-
|
39
|
+
end
|
40
|
+
|
41
|
+
private
|
42
|
+
def request_class_for(method_name)
|
43
|
+
string = method_name.to_s.sub(/^[a-z\d]*/) { |match| match.capitalize }
|
44
|
+
string.gsub!(/(?:_|(\/))([a-z\d]*)/i) { "#{$1}#{$2.capitalize}" }
|
45
|
+
Lnrpc.const_get("#{string}Request")
|
32
46
|
end
|
33
47
|
end
|
34
48
|
end
|
data/lib/lnrpc/rpc.proto
CHANGED
@@ -392,7 +392,7 @@ service Lightning {
|
|
392
392
|
*/
|
393
393
|
rpc AbandonChannel (AbandonChannelRequest) returns (AbandonChannelResponse) {
|
394
394
|
option (google.api.http) = {
|
395
|
-
delete: "/v1/channels/{channel_point.funding_txid_str}/{channel_point.output_index}"
|
395
|
+
delete: "/v1/channels/abandon/{channel_point.funding_txid_str}/{channel_point.output_index}"
|
396
396
|
};
|
397
397
|
}
|
398
398
|
|
@@ -1090,6 +1090,8 @@ message GetInfoResponse {
|
|
1090
1090
|
/// The version of the LND software that the node is running.
|
1091
1091
|
string version = 14 [ json_name = "version" ];
|
1092
1092
|
|
1093
|
+
/// Number of inactive channels
|
1094
|
+
uint32 num_inactive_channels = 15 [json_name = "num_inactive_channels"];
|
1093
1095
|
}
|
1094
1096
|
|
1095
1097
|
message ConfirmationUpdate {
|
@@ -1365,6 +1367,12 @@ message Hop {
|
|
1365
1367
|
uint32 expiry = 5 [json_name = "expiry"];
|
1366
1368
|
int64 amt_to_forward_msat = 6 [json_name = "amt_to_forward_msat"];
|
1367
1369
|
int64 fee_msat = 7 [json_name = "fee_msat"];
|
1370
|
+
|
1371
|
+
/**
|
1372
|
+
An optional public key of the hop. If the public key is given, the payment
|
1373
|
+
can be executed without relying on a copy of the channel graph.
|
1374
|
+
*/
|
1375
|
+
string pub_key = 8 [json_name = "pub_key"];
|
1368
1376
|
}
|
1369
1377
|
|
1370
1378
|
/**
|
data/lib/lnrpc/rpc_pb.rb
CHANGED
@@ -233,6 +233,7 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
|
|
233
233
|
repeated :uris, :string, 12
|
234
234
|
optional :best_header_timestamp, :int64, 13
|
235
235
|
optional :version, :string, 14
|
236
|
+
optional :num_inactive_channels, :uint32, 15
|
236
237
|
end
|
237
238
|
add_message "lnrpc.ConfirmationUpdate" do
|
238
239
|
optional :block_sha, :bytes, 1
|
@@ -362,6 +363,7 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
|
|
362
363
|
optional :expiry, :uint32, 5
|
363
364
|
optional :amt_to_forward_msat, :int64, 6
|
364
365
|
optional :fee_msat, :int64, 7
|
366
|
+
optional :pub_key, :string, 8
|
365
367
|
end
|
366
368
|
add_message "lnrpc.Route" do
|
367
369
|
optional :total_time_lock, :uint32, 1
|
data/lib/lnrpc/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lnrpc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.2.beta
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Bumann
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-02-
|
11
|
+
date: 2019-02-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -105,9 +105,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
105
105
|
version: '0'
|
106
106
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
|
-
- - "
|
108
|
+
- - ">"
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version:
|
110
|
+
version: 1.3.1
|
111
111
|
requirements: []
|
112
112
|
rubyforge_project:
|
113
113
|
rubygems_version: 2.7.6
|