lnd-client 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +2 -0
- data/.rubocop.yml +15 -0
- data/Gemfile +16 -0
- data/Gemfile.lock +62 -0
- data/LICENSE +21 -0
- data/README.md +107 -0
- data/Rakefile +10 -0
- data/components/grpc/autopilotrpc/autopilot_pb.rb +48 -0
- data/components/grpc/autopilotrpc/autopilot_services_pb.rb +40 -0
- data/components/grpc/chainrpc/chainkit_pb.rb +36 -0
- data/components/grpc/chainrpc/chainkit_services_pb.rb +34 -0
- data/components/grpc/chainrpc/chainnotifier_pb.rb +69 -0
- data/components/grpc/chainrpc/chainnotifier_services_pb.rb +53 -0
- data/components/grpc/devrpc/dev_pb.rb +17 -0
- data/components/grpc/devrpc/dev_services_pb.rb +25 -0
- data/components/grpc/invoicesrpc/invoices_pb.rb +66 -0
- data/components/grpc/invoicesrpc/invoices_services_pb.rb +45 -0
- data/components/grpc/lightning_pb.rb +1621 -0
- data/components/grpc/lightning_services_pb.rb +441 -0
- data/components/grpc/lnclipb/lncli_pb.rb +19 -0
- data/components/grpc/neutrinorpc/neutrino_pb.rb +106 -0
- data/components/grpc/neutrinorpc/neutrino_services_pb.rb +51 -0
- data/components/grpc/peersrpc/peers_pb.rb +48 -0
- data/components/grpc/peersrpc/peers_services_pb.rb +27 -0
- data/components/grpc/routerrpc/router_pb.rb +299 -0
- data/components/grpc/routerrpc/router_services_pb.rb +115 -0
- data/components/grpc/signrpc/signer_pb.rb +172 -0
- data/components/grpc/signrpc/signer_services_pb.rb +134 -0
- data/components/grpc/stateservice_pb.rb +35 -0
- data/components/grpc/stateservice_services_pb.rb +46 -0
- data/components/grpc/verrpc/verrpc_pb.rb +27 -0
- data/components/grpc/verrpc/verrpc_services_pb.rb +27 -0
- data/components/grpc/walletrpc/walletkit_pb.rb +328 -0
- data/components/grpc/walletrpc/walletkit_services_pb.rb +230 -0
- data/components/grpc/walletunlocker_pb.rb +75 -0
- data/components/grpc/walletunlocker_services_pb.rb +72 -0
- data/components/grpc/watchtowerrpc/watchtower_pb.rb +21 -0
- data/components/grpc/watchtowerrpc/watchtower_services_pb.rb +28 -0
- data/components/grpc/wtclientrpc/wtclient_pb.rb +83 -0
- data/components/grpc/wtclientrpc/wtclient_services_pb.rb +43 -0
- data/components/grpc.rb +9 -0
- data/controllers/client.rb +31 -0
- data/controllers/config.rb +35 -0
- data/controllers/documentation.rb +45 -0
- data/controllers/grpc_generator.rb +80 -0
- data/controllers/service.rb +35 -0
- data/lnd-client.gemspec +35 -0
- data/logic/string.rb +11 -0
- data/ports/dsl/lnd-client.rb +14 -0
- data/static/spec.rb +13 -0
- metadata +110 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 4bf57c02d8b4aae6f9412c31c10316ef4ed0baa92e6bca2ed23ea37c448ff010
|
4
|
+
data.tar.gz: 6d0c315784f3f56909528d4cab5fe5dab1874fc5221a710c56c87f64b7c9dffc
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 55b36ccae8ae9daf7d0533278e79cd69b2a6fed17a7e4799fc22bf5e2cade28d4c30c9ebe34cb9738b4403ff78ee9775774427f3b3d6e68b8635fa12f66a0961
|
7
|
+
data.tar.gz: e0d9068fc28938c8a27df8e897effb727a94ab271daa63fb48303861e3418bc5d6941858f4156d9ab4bac154edafc4c575a278d43f240ea1ef981b7fd28039e3
|
data/.gitignore
ADDED
data/.rubocop.yml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
AllCops:
|
2
|
+
TargetRubyVersion: 3.2.0
|
3
|
+
NewCops: enable
|
4
|
+
Exclude:
|
5
|
+
- 'components/grpc/*'
|
6
|
+
- 'components/grpc/**/*'
|
7
|
+
|
8
|
+
Style/Documentation:
|
9
|
+
Enabled: false
|
10
|
+
|
11
|
+
Naming/FileName:
|
12
|
+
Exclude:
|
13
|
+
- 'ports/dsl/lnd-client.rb'
|
14
|
+
|
15
|
+
require: rubocop-rake
|
data/Gemfile
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
ruby '3.2.0'
|
4
|
+
|
5
|
+
source 'https://rubygems.org'
|
6
|
+
|
7
|
+
gem 'grpc', '~> 1.50'
|
8
|
+
|
9
|
+
group :test, :development do
|
10
|
+
gem 'grpc-tools', '~> 1.50'
|
11
|
+
gem 'pry-byebug', '~> 3.10', '>= 3.10.1'
|
12
|
+
gem 'rainbow', '~> 3.1', '>= 3.1.1'
|
13
|
+
gem 'rake', '~> 13.0', '>= 13.0.6'
|
14
|
+
gem 'rubocop', '~> 1.43'
|
15
|
+
gem 'rubocop-rake', '~> 0.6.0'
|
16
|
+
end
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,62 @@
|
|
1
|
+
GEM
|
2
|
+
remote: https://rubygems.org/
|
3
|
+
specs:
|
4
|
+
ast (2.4.2)
|
5
|
+
byebug (11.1.3)
|
6
|
+
coderay (1.1.3)
|
7
|
+
google-protobuf (3.21.12)
|
8
|
+
googleapis-common-protos-types (1.5.0)
|
9
|
+
google-protobuf (~> 3.14)
|
10
|
+
grpc (1.50.0)
|
11
|
+
google-protobuf (~> 3.21)
|
12
|
+
googleapis-common-protos-types (~> 1.0)
|
13
|
+
grpc-tools (1.50.0)
|
14
|
+
json (2.6.3)
|
15
|
+
method_source (1.0.0)
|
16
|
+
parallel (1.22.1)
|
17
|
+
parser (3.2.0.0)
|
18
|
+
ast (~> 2.4.1)
|
19
|
+
pry (0.14.2)
|
20
|
+
coderay (~> 1.1)
|
21
|
+
method_source (~> 1.0)
|
22
|
+
pry-byebug (3.10.1)
|
23
|
+
byebug (~> 11.0)
|
24
|
+
pry (>= 0.13, < 0.15)
|
25
|
+
rainbow (3.1.1)
|
26
|
+
rake (13.0.6)
|
27
|
+
regexp_parser (2.6.2)
|
28
|
+
rexml (3.2.5)
|
29
|
+
rubocop (1.43.0)
|
30
|
+
json (~> 2.3)
|
31
|
+
parallel (~> 1.10)
|
32
|
+
parser (>= 3.2.0.0)
|
33
|
+
rainbow (>= 2.2.2, < 4.0)
|
34
|
+
regexp_parser (>= 1.8, < 3.0)
|
35
|
+
rexml (>= 3.2.5, < 4.0)
|
36
|
+
rubocop-ast (>= 1.24.1, < 2.0)
|
37
|
+
ruby-progressbar (~> 1.7)
|
38
|
+
unicode-display_width (>= 2.4.0, < 3.0)
|
39
|
+
rubocop-ast (1.24.1)
|
40
|
+
parser (>= 3.1.1.0)
|
41
|
+
rubocop-rake (0.6.0)
|
42
|
+
rubocop (~> 1.0)
|
43
|
+
ruby-progressbar (1.11.0)
|
44
|
+
unicode-display_width (2.4.2)
|
45
|
+
|
46
|
+
PLATFORMS
|
47
|
+
x86_64-linux
|
48
|
+
|
49
|
+
DEPENDENCIES
|
50
|
+
grpc (~> 1.50)
|
51
|
+
grpc-tools (~> 1.50)
|
52
|
+
pry-byebug (~> 3.10, >= 3.10.1)
|
53
|
+
rainbow (~> 3.1, >= 3.1.1)
|
54
|
+
rake (~> 13.0, >= 13.0.6)
|
55
|
+
rubocop (~> 1.43)
|
56
|
+
rubocop-rake (~> 0.6.0)
|
57
|
+
|
58
|
+
RUBY VERSION
|
59
|
+
ruby 3.2.0p0
|
60
|
+
|
61
|
+
BUNDLED WITH
|
62
|
+
2.4.4
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2023 icebaker
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,107 @@
|
|
1
|
+
# Ruby _Lightning Network Daemon_ Client
|
2
|
+
|
3
|
+
- [Usage](#usage)
|
4
|
+
- [Documentation](#documentation)
|
5
|
+
- [Development](#development)
|
6
|
+
- [Upgrading gRPC Proto Files](#upgrading-grpc-proto-files)
|
7
|
+
- [Publish to RubyGems](#publish-to-rubygems)
|
8
|
+
|
9
|
+
## Usage
|
10
|
+
|
11
|
+
Add to your `Gemfile`:
|
12
|
+
|
13
|
+
```ruby
|
14
|
+
gem 'lnd-client', '~> 0.0.1'
|
15
|
+
```
|
16
|
+
|
17
|
+
```ruby
|
18
|
+
require 'lnd-client'
|
19
|
+
|
20
|
+
puts LNDClient.version # => 0.0.1
|
21
|
+
|
22
|
+
client = LNDClient.new(
|
23
|
+
certificate_path: '/lnd/tls.cert',
|
24
|
+
macaroon_path: '/lnd/data/chain/bitcoin/mainnet/admin.macaroon',
|
25
|
+
socket_address: '127.0.0.1:10009'
|
26
|
+
)
|
27
|
+
|
28
|
+
client.lightning.wallet_balance.total_balance # => 101527
|
29
|
+
|
30
|
+
client.lightning.wallet_balance.to_h # =>
|
31
|
+
# {:total_balance=>101527,
|
32
|
+
# :confirmed_balance=>101527,
|
33
|
+
# :unconfirmed_balance=>0,
|
34
|
+
# :locked_balance=>0,
|
35
|
+
# :reserved_balance_anchor_chan=>20000,
|
36
|
+
# :account_balance=>{"default"=>{:confirmed_balance=>101527, :unconfirmed_balance=>0}}}
|
37
|
+
|
38
|
+
client.lightning.get_node_info(
|
39
|
+
pub_key: '02d3c80335a8ccb2ed364c06875f32240f36f7edb37d80f8dbe321b4c364b6e997'
|
40
|
+
).node.alias # => 'icebaker/old-stone'
|
41
|
+
```
|
42
|
+
|
43
|
+
### Documentation
|
44
|
+
|
45
|
+
```ruby
|
46
|
+
require 'lnd-client'
|
47
|
+
|
48
|
+
puts LNDClient.version # => 0.0.1
|
49
|
+
|
50
|
+
client = LNDClient.new(
|
51
|
+
certificate_path: '/lnd/tls.cert',
|
52
|
+
macaroon_path: '/lnd/data/chain/bitcoin/mainnet/admin.macaroon',
|
53
|
+
socket_address: '127.0.0.1:10009'
|
54
|
+
)
|
55
|
+
|
56
|
+
client.doc.services # => ['lightning']
|
57
|
+
|
58
|
+
client.lightning.doc.available_methods # =>
|
59
|
+
# ['abandon_channel',
|
60
|
+
# 'add_invoice',
|
61
|
+
# 'bake_macaroon',
|
62
|
+
# 'batch_open_channel',
|
63
|
+
# 'channel_acceptor',
|
64
|
+
# 'channel_balance',
|
65
|
+
# 'check_macaroon_permissions',
|
66
|
+
# 'close_channel',
|
67
|
+
# 'closed_channels',
|
68
|
+
# # ...
|
69
|
+
# 'get_node_info'
|
70
|
+
# ]
|
71
|
+
|
72
|
+
client.lightning.doc.describe(:get_node_info) # =>
|
73
|
+
# { method: 'get_node_info',
|
74
|
+
# input: { pub_key: '', include_channels: false},
|
75
|
+
# output: { node: nil, num_channels: 0, total_capacity: 0, channels: []}}
|
76
|
+
|
77
|
+
client.lightning.doc.grpc(:get_node_info)
|
78
|
+
# #<struct GRPC::RpcDesc
|
79
|
+
# name=:GetNodeInfo,
|
80
|
+
# input=Lnrpc::NodeInfoRequest,
|
81
|
+
# output=Lnrpc::NodeInfo,
|
82
|
+
# marshal_method=:encode,
|
83
|
+
# unmarshal_method=:decode>
|
84
|
+
```
|
85
|
+
|
86
|
+
## Development
|
87
|
+
|
88
|
+
```ruby
|
89
|
+
# Gemfile
|
90
|
+
gem 'lnd-client', path: '/home/user/lnd-client'
|
91
|
+
|
92
|
+
# demo.rb
|
93
|
+
require 'lnd-client'
|
94
|
+
|
95
|
+
puts LNDClient.version
|
96
|
+
```
|
97
|
+
|
98
|
+
### Upgrading gRPC Proto Files
|
99
|
+
|
100
|
+
```sh
|
101
|
+
bundle exec rake grpc:upgrade
|
102
|
+
```
|
103
|
+
### Publish to RubyGems
|
104
|
+
|
105
|
+
```sh
|
106
|
+
gem build lnd-client.gemspec
|
107
|
+
```
|
data/Rakefile
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
2
|
+
# source: autopilotrpc/autopilot.proto
|
3
|
+
|
4
|
+
require 'google/protobuf'
|
5
|
+
|
6
|
+
Google::Protobuf::DescriptorPool.generated_pool.build do
|
7
|
+
add_file("autopilotrpc/autopilot.proto", :syntax => :proto3) do
|
8
|
+
add_message "autopilotrpc.StatusRequest" do
|
9
|
+
end
|
10
|
+
add_message "autopilotrpc.StatusResponse" do
|
11
|
+
optional :active, :bool, 1
|
12
|
+
end
|
13
|
+
add_message "autopilotrpc.ModifyStatusRequest" do
|
14
|
+
optional :enable, :bool, 1
|
15
|
+
end
|
16
|
+
add_message "autopilotrpc.ModifyStatusResponse" do
|
17
|
+
end
|
18
|
+
add_message "autopilotrpc.QueryScoresRequest" do
|
19
|
+
repeated :pubkeys, :string, 1
|
20
|
+
optional :ignore_local_state, :bool, 2
|
21
|
+
end
|
22
|
+
add_message "autopilotrpc.QueryScoresResponse" do
|
23
|
+
repeated :results, :message, 1, "autopilotrpc.QueryScoresResponse.HeuristicResult"
|
24
|
+
end
|
25
|
+
add_message "autopilotrpc.QueryScoresResponse.HeuristicResult" do
|
26
|
+
optional :heuristic, :string, 1
|
27
|
+
map :scores, :string, :double, 2
|
28
|
+
end
|
29
|
+
add_message "autopilotrpc.SetScoresRequest" do
|
30
|
+
optional :heuristic, :string, 1
|
31
|
+
map :scores, :string, :double, 2
|
32
|
+
end
|
33
|
+
add_message "autopilotrpc.SetScoresResponse" do
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
module Autopilotrpc
|
39
|
+
StatusRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("autopilotrpc.StatusRequest").msgclass
|
40
|
+
StatusResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("autopilotrpc.StatusResponse").msgclass
|
41
|
+
ModifyStatusRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("autopilotrpc.ModifyStatusRequest").msgclass
|
42
|
+
ModifyStatusResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("autopilotrpc.ModifyStatusResponse").msgclass
|
43
|
+
QueryScoresRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("autopilotrpc.QueryScoresRequest").msgclass
|
44
|
+
QueryScoresResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("autopilotrpc.QueryScoresResponse").msgclass
|
45
|
+
QueryScoresResponse::HeuristicResult = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("autopilotrpc.QueryScoresResponse.HeuristicResult").msgclass
|
46
|
+
SetScoresRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("autopilotrpc.SetScoresRequest").msgclass
|
47
|
+
SetScoresResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("autopilotrpc.SetScoresResponse").msgclass
|
48
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
2
|
+
# Source: autopilotrpc/autopilot.proto for package 'autopilotrpc'
|
3
|
+
|
4
|
+
require 'grpc'
|
5
|
+
require_relative 'autopilotrpc/autopilot_pb'
|
6
|
+
|
7
|
+
module Autopilotrpc
|
8
|
+
module Autopilot
|
9
|
+
# Autopilot is a service that can be used to get information about the current
|
10
|
+
# state of the daemon's autopilot agent, and also supply it with information
|
11
|
+
# that can be used when deciding where to open channels.
|
12
|
+
class Service
|
13
|
+
|
14
|
+
include ::GRPC::GenericService
|
15
|
+
|
16
|
+
self.marshal_class_method = :encode
|
17
|
+
self.unmarshal_class_method = :decode
|
18
|
+
self.service_name = 'autopilotrpc.Autopilot'
|
19
|
+
|
20
|
+
#
|
21
|
+
# Status returns whether the daemon's autopilot agent is active.
|
22
|
+
rpc :Status, ::Autopilotrpc::StatusRequest, ::Autopilotrpc::StatusResponse
|
23
|
+
#
|
24
|
+
# ModifyStatus is used to modify the status of the autopilot agent, like
|
25
|
+
# enabling or disabling it.
|
26
|
+
rpc :ModifyStatus, ::Autopilotrpc::ModifyStatusRequest, ::Autopilotrpc::ModifyStatusResponse
|
27
|
+
#
|
28
|
+
# QueryScores queries all available autopilot heuristics, in addition to any
|
29
|
+
# active combination of these heruristics, for the scores they would give to
|
30
|
+
# the given nodes.
|
31
|
+
rpc :QueryScores, ::Autopilotrpc::QueryScoresRequest, ::Autopilotrpc::QueryScoresResponse
|
32
|
+
#
|
33
|
+
# SetScores attempts to set the scores used by the running autopilot agent,
|
34
|
+
# if the external scoring heuristic is enabled.
|
35
|
+
rpc :SetScores, ::Autopilotrpc::SetScoresRequest, ::Autopilotrpc::SetScoresResponse
|
36
|
+
end
|
37
|
+
|
38
|
+
Stub = Service.rpc_stub_class
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
2
|
+
# source: chainrpc/chainkit.proto
|
3
|
+
|
4
|
+
require 'google/protobuf'
|
5
|
+
|
6
|
+
Google::Protobuf::DescriptorPool.generated_pool.build do
|
7
|
+
add_file("chainrpc/chainkit.proto", :syntax => :proto3) do
|
8
|
+
add_message "chainrpc.GetBlockRequest" do
|
9
|
+
optional :block_hash, :bytes, 1
|
10
|
+
end
|
11
|
+
add_message "chainrpc.GetBlockResponse" do
|
12
|
+
optional :raw_block, :bytes, 1
|
13
|
+
end
|
14
|
+
add_message "chainrpc.GetBestBlockRequest" do
|
15
|
+
end
|
16
|
+
add_message "chainrpc.GetBestBlockResponse" do
|
17
|
+
optional :block_hash, :bytes, 1
|
18
|
+
optional :block_height, :int32, 2
|
19
|
+
end
|
20
|
+
add_message "chainrpc.GetBlockHashRequest" do
|
21
|
+
optional :block_height, :int64, 1
|
22
|
+
end
|
23
|
+
add_message "chainrpc.GetBlockHashResponse" do
|
24
|
+
optional :block_hash, :bytes, 1
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
module Chainrpc
|
30
|
+
GetBlockRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("chainrpc.GetBlockRequest").msgclass
|
31
|
+
GetBlockResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("chainrpc.GetBlockResponse").msgclass
|
32
|
+
GetBestBlockRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("chainrpc.GetBestBlockRequest").msgclass
|
33
|
+
GetBestBlockResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("chainrpc.GetBestBlockResponse").msgclass
|
34
|
+
GetBlockHashRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("chainrpc.GetBlockHashRequest").msgclass
|
35
|
+
GetBlockHashResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("chainrpc.GetBlockHashResponse").msgclass
|
36
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
2
|
+
# Source: chainrpc/chainkit.proto for package 'chainrpc'
|
3
|
+
|
4
|
+
require 'grpc'
|
5
|
+
require_relative 'chainrpc/chainkit_pb'
|
6
|
+
|
7
|
+
module Chainrpc
|
8
|
+
module ChainKit
|
9
|
+
# ChainKit is a service that can be used to get information from the
|
10
|
+
# chain backend.
|
11
|
+
class Service
|
12
|
+
|
13
|
+
include ::GRPC::GenericService
|
14
|
+
|
15
|
+
self.marshal_class_method = :encode
|
16
|
+
self.unmarshal_class_method = :decode
|
17
|
+
self.service_name = 'chainrpc.ChainKit'
|
18
|
+
|
19
|
+
# lncli: `chain getblock`
|
20
|
+
# GetBlock returns a block given the corresponding block hash.
|
21
|
+
rpc :GetBlock, ::Chainrpc::GetBlockRequest, ::Chainrpc::GetBlockResponse
|
22
|
+
# lncli: `chain getbestblock`
|
23
|
+
# GetBestBlock returns the block hash and current height from the valid
|
24
|
+
# most-work chain.
|
25
|
+
rpc :GetBestBlock, ::Chainrpc::GetBestBlockRequest, ::Chainrpc::GetBestBlockResponse
|
26
|
+
# lncli: `chain getblockhash`
|
27
|
+
# GetBlockHash returns the hash of the block in the best blockchain
|
28
|
+
# at the given height.
|
29
|
+
rpc :GetBlockHash, ::Chainrpc::GetBlockHashRequest, ::Chainrpc::GetBlockHashResponse
|
30
|
+
end
|
31
|
+
|
32
|
+
Stub = Service.rpc_stub_class
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,69 @@
|
|
1
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
2
|
+
# source: chainrpc/chainnotifier.proto
|
3
|
+
|
4
|
+
require 'google/protobuf'
|
5
|
+
|
6
|
+
Google::Protobuf::DescriptorPool.generated_pool.build do
|
7
|
+
add_file("chainrpc/chainnotifier.proto", :syntax => :proto3) do
|
8
|
+
add_message "chainrpc.ConfRequest" do
|
9
|
+
optional :txid, :bytes, 1
|
10
|
+
optional :script, :bytes, 2
|
11
|
+
optional :num_confs, :uint32, 3
|
12
|
+
optional :height_hint, :uint32, 4
|
13
|
+
optional :include_block, :bool, 5
|
14
|
+
end
|
15
|
+
add_message "chainrpc.ConfDetails" do
|
16
|
+
optional :raw_tx, :bytes, 1
|
17
|
+
optional :block_hash, :bytes, 2
|
18
|
+
optional :block_height, :uint32, 3
|
19
|
+
optional :tx_index, :uint32, 4
|
20
|
+
optional :raw_block, :bytes, 5
|
21
|
+
end
|
22
|
+
add_message "chainrpc.Reorg" do
|
23
|
+
end
|
24
|
+
add_message "chainrpc.ConfEvent" do
|
25
|
+
oneof :event do
|
26
|
+
optional :conf, :message, 1, "chainrpc.ConfDetails"
|
27
|
+
optional :reorg, :message, 2, "chainrpc.Reorg"
|
28
|
+
end
|
29
|
+
end
|
30
|
+
add_message "chainrpc.Outpoint" do
|
31
|
+
optional :hash, :bytes, 1
|
32
|
+
optional :index, :uint32, 2
|
33
|
+
end
|
34
|
+
add_message "chainrpc.SpendRequest" do
|
35
|
+
optional :outpoint, :message, 1, "chainrpc.Outpoint"
|
36
|
+
optional :script, :bytes, 2
|
37
|
+
optional :height_hint, :uint32, 3
|
38
|
+
end
|
39
|
+
add_message "chainrpc.SpendDetails" do
|
40
|
+
optional :spending_outpoint, :message, 1, "chainrpc.Outpoint"
|
41
|
+
optional :raw_spending_tx, :bytes, 2
|
42
|
+
optional :spending_tx_hash, :bytes, 3
|
43
|
+
optional :spending_input_index, :uint32, 4
|
44
|
+
optional :spending_height, :uint32, 5
|
45
|
+
end
|
46
|
+
add_message "chainrpc.SpendEvent" do
|
47
|
+
oneof :event do
|
48
|
+
optional :spend, :message, 1, "chainrpc.SpendDetails"
|
49
|
+
optional :reorg, :message, 2, "chainrpc.Reorg"
|
50
|
+
end
|
51
|
+
end
|
52
|
+
add_message "chainrpc.BlockEpoch" do
|
53
|
+
optional :hash, :bytes, 1
|
54
|
+
optional :height, :uint32, 2
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
module Chainrpc
|
60
|
+
ConfRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("chainrpc.ConfRequest").msgclass
|
61
|
+
ConfDetails = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("chainrpc.ConfDetails").msgclass
|
62
|
+
Reorg = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("chainrpc.Reorg").msgclass
|
63
|
+
ConfEvent = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("chainrpc.ConfEvent").msgclass
|
64
|
+
Outpoint = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("chainrpc.Outpoint").msgclass
|
65
|
+
SpendRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("chainrpc.SpendRequest").msgclass
|
66
|
+
SpendDetails = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("chainrpc.SpendDetails").msgclass
|
67
|
+
SpendEvent = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("chainrpc.SpendEvent").msgclass
|
68
|
+
BlockEpoch = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("chainrpc.BlockEpoch").msgclass
|
69
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
2
|
+
# Source: chainrpc/chainnotifier.proto for package 'chainrpc'
|
3
|
+
|
4
|
+
require 'grpc'
|
5
|
+
require_relative 'chainrpc/chainnotifier_pb'
|
6
|
+
|
7
|
+
module Chainrpc
|
8
|
+
module ChainNotifier
|
9
|
+
# ChainNotifier is a service that can be used to get information about the
|
10
|
+
# chain backend by registering notifiers for chain events.
|
11
|
+
class Service
|
12
|
+
|
13
|
+
include ::GRPC::GenericService
|
14
|
+
|
15
|
+
self.marshal_class_method = :encode
|
16
|
+
self.unmarshal_class_method = :decode
|
17
|
+
self.service_name = 'chainrpc.ChainNotifier'
|
18
|
+
|
19
|
+
#
|
20
|
+
# RegisterConfirmationsNtfn is a synchronous response-streaming RPC that
|
21
|
+
# registers an intent for a client to be notified once a confirmation request
|
22
|
+
# has reached its required number of confirmations on-chain.
|
23
|
+
#
|
24
|
+
# A confirmation request must have a valid output script. It is also possible
|
25
|
+
# to give a transaction ID. If the transaction ID is not set, a notification
|
26
|
+
# is sent once the output script confirms. If the transaction ID is also set,
|
27
|
+
# a notification is sent once the output script confirms in the given
|
28
|
+
# transaction.
|
29
|
+
rpc :RegisterConfirmationsNtfn, ::Chainrpc::ConfRequest, stream(::Chainrpc::ConfEvent)
|
30
|
+
#
|
31
|
+
# RegisterSpendNtfn is a synchronous response-streaming RPC that registers an
|
32
|
+
# intent for a client to be notification once a spend request has been spent
|
33
|
+
# by a transaction that has confirmed on-chain.
|
34
|
+
#
|
35
|
+
# A client can specify whether the spend request should be for a particular
|
36
|
+
# outpoint or for an output script by specifying a zero outpoint.
|
37
|
+
rpc :RegisterSpendNtfn, ::Chainrpc::SpendRequest, stream(::Chainrpc::SpendEvent)
|
38
|
+
#
|
39
|
+
# RegisterBlockEpochNtfn is a synchronous response-streaming RPC that
|
40
|
+
# registers an intent for a client to be notified of blocks in the chain. The
|
41
|
+
# stream will return a hash and height tuple of a block for each new/stale
|
42
|
+
# block in the chain. It is the client's responsibility to determine whether
|
43
|
+
# the tuple returned is for a new or stale block in the chain.
|
44
|
+
#
|
45
|
+
# A client can also request a historical backlog of blocks from a particular
|
46
|
+
# point. This allows clients to be idempotent by ensuring that they do not
|
47
|
+
# missing processing a single block within the chain.
|
48
|
+
rpc :RegisterBlockEpochNtfn, ::Chainrpc::BlockEpoch, stream(::Chainrpc::BlockEpoch)
|
49
|
+
end
|
50
|
+
|
51
|
+
Stub = Service.rpc_stub_class
|
52
|
+
end
|
53
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
2
|
+
# source: devrpc/dev.proto
|
3
|
+
|
4
|
+
require 'google/protobuf'
|
5
|
+
|
6
|
+
require_relative 'lightning_pb'
|
7
|
+
|
8
|
+
Google::Protobuf::DescriptorPool.generated_pool.build do
|
9
|
+
add_file("devrpc/dev.proto", :syntax => :proto3) do
|
10
|
+
add_message "devrpc.ImportGraphResponse" do
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
module Devrpc
|
16
|
+
ImportGraphResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("devrpc.ImportGraphResponse").msgclass
|
17
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
2
|
+
# Source: devrpc/dev.proto for package 'devrpc'
|
3
|
+
|
4
|
+
require 'grpc'
|
5
|
+
require_relative 'devrpc/dev_pb'
|
6
|
+
|
7
|
+
module Devrpc
|
8
|
+
module Dev
|
9
|
+
class Service
|
10
|
+
|
11
|
+
include ::GRPC::GenericService
|
12
|
+
|
13
|
+
self.marshal_class_method = :encode
|
14
|
+
self.unmarshal_class_method = :decode
|
15
|
+
self.service_name = 'devrpc.Dev'
|
16
|
+
|
17
|
+
#
|
18
|
+
# ImportGraph imports a ChannelGraph into the graph database. Should only be
|
19
|
+
# used for development.
|
20
|
+
rpc :ImportGraph, ::Lnrpc::ChannelGraph, ::Devrpc::ImportGraphResponse
|
21
|
+
end
|
22
|
+
|
23
|
+
Stub = Service.rpc_stub_class
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,66 @@
|
|
1
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
2
|
+
# source: invoicesrpc/invoices.proto
|
3
|
+
|
4
|
+
require 'google/protobuf'
|
5
|
+
|
6
|
+
require_relative 'lightning_pb'
|
7
|
+
|
8
|
+
Google::Protobuf::DescriptorPool.generated_pool.build do
|
9
|
+
add_file("invoicesrpc/invoices.proto", :syntax => :proto3) do
|
10
|
+
add_message "invoicesrpc.CancelInvoiceMsg" do
|
11
|
+
optional :payment_hash, :bytes, 1
|
12
|
+
end
|
13
|
+
add_message "invoicesrpc.CancelInvoiceResp" do
|
14
|
+
end
|
15
|
+
add_message "invoicesrpc.AddHoldInvoiceRequest" do
|
16
|
+
optional :memo, :string, 1
|
17
|
+
optional :hash, :bytes, 2
|
18
|
+
optional :value, :int64, 3
|
19
|
+
optional :value_msat, :int64, 10
|
20
|
+
optional :description_hash, :bytes, 4
|
21
|
+
optional :expiry, :int64, 5
|
22
|
+
optional :fallback_addr, :string, 6
|
23
|
+
optional :cltv_expiry, :uint64, 7
|
24
|
+
repeated :route_hints, :message, 8, "lnrpc.RouteHint"
|
25
|
+
optional :private, :bool, 9
|
26
|
+
end
|
27
|
+
add_message "invoicesrpc.AddHoldInvoiceResp" do
|
28
|
+
optional :payment_request, :string, 1
|
29
|
+
optional :add_index, :uint64, 2
|
30
|
+
optional :payment_addr, :bytes, 3
|
31
|
+
end
|
32
|
+
add_message "invoicesrpc.SettleInvoiceMsg" do
|
33
|
+
optional :preimage, :bytes, 1
|
34
|
+
end
|
35
|
+
add_message "invoicesrpc.SettleInvoiceResp" do
|
36
|
+
end
|
37
|
+
add_message "invoicesrpc.SubscribeSingleInvoiceRequest" do
|
38
|
+
optional :r_hash, :bytes, 2
|
39
|
+
end
|
40
|
+
add_message "invoicesrpc.LookupInvoiceMsg" do
|
41
|
+
optional :lookup_modifier, :enum, 4, "invoicesrpc.LookupModifier"
|
42
|
+
oneof :invoice_ref do
|
43
|
+
optional :payment_hash, :bytes, 1
|
44
|
+
optional :payment_addr, :bytes, 2
|
45
|
+
optional :set_id, :bytes, 3
|
46
|
+
end
|
47
|
+
end
|
48
|
+
add_enum "invoicesrpc.LookupModifier" do
|
49
|
+
value :DEFAULT, 0
|
50
|
+
value :HTLC_SET_ONLY, 1
|
51
|
+
value :HTLC_SET_BLANK, 2
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
module Invoicesrpc
|
57
|
+
CancelInvoiceMsg = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("invoicesrpc.CancelInvoiceMsg").msgclass
|
58
|
+
CancelInvoiceResp = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("invoicesrpc.CancelInvoiceResp").msgclass
|
59
|
+
AddHoldInvoiceRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("invoicesrpc.AddHoldInvoiceRequest").msgclass
|
60
|
+
AddHoldInvoiceResp = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("invoicesrpc.AddHoldInvoiceResp").msgclass
|
61
|
+
SettleInvoiceMsg = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("invoicesrpc.SettleInvoiceMsg").msgclass
|
62
|
+
SettleInvoiceResp = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("invoicesrpc.SettleInvoiceResp").msgclass
|
63
|
+
SubscribeSingleInvoiceRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("invoicesrpc.SubscribeSingleInvoiceRequest").msgclass
|
64
|
+
LookupInvoiceMsg = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("invoicesrpc.LookupInvoiceMsg").msgclass
|
65
|
+
LookupModifier = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("invoicesrpc.LookupModifier").enummodule
|
66
|
+
end
|