lnrpc 0.9.0 → 0.13.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/Gemfile.lock +24 -24
- data/README.md +30 -16
- data/examples.rb +13 -6
- data/generate-grpc-service-files.sh +29 -0
- data/lib/grpc_services/autopilotrpc/autopilot_pb.rb +48 -0
- data/lib/grpc_services/autopilotrpc/autopilot_services_pb.rb +40 -0
- data/lib/grpc_services/chainrpc/chainnotifier_pb.rb +67 -0
- data/lib/grpc_services/chainrpc/chainnotifier_services_pb.rb +51 -0
- data/lib/grpc_services/invoicesrpc/invoices_pb.rb +48 -0
- data/lib/grpc_services/invoicesrpc/invoices_services_pb.rb +41 -0
- data/lib/grpc_services/lnclipb/lncli_pb.rb +18 -0
- data/lib/grpc_services/routerrpc/router_pb.rb +277 -0
- data/lib/grpc_services/routerrpc/router_services_pb.rb +105 -0
- data/lib/grpc_services/rpc_pb.rb +1388 -0
- data/lib/{lnrpc → grpc_services}/rpc_services_pb.rb +165 -178
- data/lib/grpc_services/signrpc/signer_pb.rb +84 -0
- data/lib/grpc_services/signrpc/signer_services_pb.rb +69 -0
- data/lib/grpc_services/verrpc/verrpc_pb.rb +27 -0
- data/lib/grpc_services/verrpc/verrpc_services_pb.rb +27 -0
- data/lib/grpc_services/walletrpc/walletkit_pb.rb +254 -0
- data/lib/grpc_services/walletrpc/walletkit_services_pb.rb +188 -0
- data/lib/grpc_services/walletunlocker_pb.rb +57 -0
- data/lib/grpc_services/walletunlocker_services_pb.rb +72 -0
- data/lib/grpc_services/watchtowerrpc/watchtower_pb.rb +21 -0
- data/lib/grpc_services/watchtowerrpc/watchtower_services_pb.rb +28 -0
- data/lib/grpc_services/wtclientrpc/wtclient_pb.rb +83 -0
- data/lib/grpc_services/wtclientrpc/wtclient_services_pb.rb +43 -0
- data/lib/lnrpc.rb +19 -3
- data/lib/lnrpc/client.rb +62 -46
- data/lib/lnrpc/grpc_wrapper.rb +43 -0
- data/lib/lnrpc/version.rb +1 -1
- data/lnrpc.gemspec +7 -5
- metadata +41 -17
- data/lib/lnrpc/rpc.proto +0 -3075
- data/lib/lnrpc/rpc_pb.rb +0 -1082
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6d2fb416e8943338d511be049cc495ca6bd3cb2c2b46ff370034a54645504966
|
4
|
+
data.tar.gz: 60a51a4b3610a855b7cd485b83e3c9b820287dd0bbc18044294fd1e38e20ff1b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b1fd8c5907a282ff844e8b9b5684665a280fd1ef43188962d9bd448502a17428a114a76b20afe284130348fb584fc2f0b812c5228e4f0eddb3506e5232e3c5b5
|
7
|
+
data.tar.gz: 2da8d1e1b9455954a93e86f37e54018268293c5c4091151a79e7b0296109fc59fb20de89cb75424f5c0cf56713fcebc585340be1af20863d4f7b876f34429ca1
|
data/.gitignore
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,43 +1,43 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
lnrpc (0.
|
5
|
-
google-protobuf (>= 3.
|
6
|
-
grpc (>= 1.
|
4
|
+
lnrpc (0.11.1)
|
5
|
+
google-protobuf (>= 3.12)
|
6
|
+
grpc (>= 1.28.0)
|
7
7
|
|
8
8
|
GEM
|
9
9
|
remote: https://rubygems.org/
|
10
10
|
specs:
|
11
|
-
diff-lcs (1.
|
12
|
-
google-protobuf (3.
|
13
|
-
googleapis-common-protos-types (1.0
|
14
|
-
google-protobuf (~> 3.
|
15
|
-
grpc (1.
|
16
|
-
google-protobuf (~> 3.
|
11
|
+
diff-lcs (1.4.4)
|
12
|
+
google-protobuf (3.17.3)
|
13
|
+
googleapis-common-protos-types (1.1.0)
|
14
|
+
google-protobuf (~> 3.14)
|
15
|
+
grpc (1.38.0)
|
16
|
+
google-protobuf (~> 3.15)
|
17
17
|
googleapis-common-protos-types (~> 1.0)
|
18
|
-
rake (
|
19
|
-
rspec (3.
|
20
|
-
rspec-core (~> 3.
|
21
|
-
rspec-expectations (~> 3.
|
22
|
-
rspec-mocks (~> 3.
|
23
|
-
rspec-core (3.
|
24
|
-
rspec-support (~> 3.
|
25
|
-
rspec-expectations (3.
|
18
|
+
rake (13.0.6)
|
19
|
+
rspec (3.10.0)
|
20
|
+
rspec-core (~> 3.10.0)
|
21
|
+
rspec-expectations (~> 3.10.0)
|
22
|
+
rspec-mocks (~> 3.10.0)
|
23
|
+
rspec-core (3.10.1)
|
24
|
+
rspec-support (~> 3.10.0)
|
25
|
+
rspec-expectations (3.10.1)
|
26
26
|
diff-lcs (>= 1.2.0, < 2.0)
|
27
|
-
rspec-support (~> 3.
|
28
|
-
rspec-mocks (3.
|
27
|
+
rspec-support (~> 3.10.0)
|
28
|
+
rspec-mocks (3.10.2)
|
29
29
|
diff-lcs (>= 1.2.0, < 2.0)
|
30
|
-
rspec-support (~> 3.
|
31
|
-
rspec-support (3.
|
30
|
+
rspec-support (~> 3.10.0)
|
31
|
+
rspec-support (3.10.2)
|
32
32
|
|
33
33
|
PLATFORMS
|
34
34
|
ruby
|
35
35
|
|
36
36
|
DEPENDENCIES
|
37
|
-
bundler (
|
37
|
+
bundler (> 2.0)
|
38
38
|
lnrpc!
|
39
|
-
rake (~>
|
39
|
+
rake (~> 13.0)
|
40
40
|
rspec (~> 3.0)
|
41
41
|
|
42
42
|
BUNDLED WITH
|
43
|
-
1.
|
43
|
+
2.1.4
|
data/README.md
CHANGED
@@ -3,13 +3,15 @@
|
|
3
3
|
|
4
4
|
a [gRPC](https://grpc.io/) client for [LND, the Lightning Network Daemon](https://github.com/lightningnetwork/lnd/) packed as ruby gem.
|
5
5
|
|
6
|
-
|
7
6
|
## Installation
|
8
7
|
|
8
|
+
Note: there is still an GRPC/protobuf [issue with Ruby 2.7](https://github.com/protocolbuffers/protobuf/issues/7070).
|
9
|
+
So lnrpc requires Ruby < 2.7.
|
10
|
+
|
9
11
|
Add this line to your application's Gemfile:
|
10
12
|
|
11
13
|
```ruby
|
12
|
-
gem 'lnrpc', '~> 0.
|
14
|
+
gem 'lnrpc', '~> 0.11.0'
|
13
15
|
```
|
14
16
|
lnrpc follows the lnd versioning, thus it is recommended to specify the exact version you need for your lnd node as dependency (see [#Versioning](#Versioning)).
|
15
17
|
|
@@ -30,10 +32,12 @@ This gem makes the gRPC client classes created from the [LND service defintions]
|
|
30
32
|
```ruby
|
31
33
|
require "lnrpc"
|
32
34
|
|
33
|
-
# the
|
35
|
+
# With the changes in LND v.10.0 this load the `Lnrpc` and `Routerrpc` namespace
|
34
36
|
|
35
37
|
Lnrpc::Lightning::Stub
|
38
|
+
Routerrpc:::Routerrpc::Stub
|
36
39
|
Lnrpc::GetInfoRequest
|
40
|
+
...
|
37
41
|
```
|
38
42
|
|
39
43
|
Learn more about [gRPC](https://grpc.io/) on [gRPC.io](https://grpc.io/).
|
@@ -55,17 +59,26 @@ client = Lnrpc::Lightning::Stub.new("localhost:10009", GRPC::Core::ChannelCreden
|
|
55
59
|
request = Lnrpc::GetInfoRequest.new
|
56
60
|
response = client.get_info(request, { metadata: { macaroon: macaroon } }) #=> Lnrpc::GetInfoResponse
|
57
61
|
puts response.alias
|
62
|
+
|
63
|
+
router = Routerprc::Router::Stub.new("localhost:10009", GRPC::Core::ChannelCredentials.new(self.credentials))
|
64
|
+
...
|
65
|
+
|
58
66
|
```
|
59
67
|
|
60
68
|
### Client wrapper
|
61
69
|
|
70
|
+
NOTE: v10.0 has breaking changes!
|
71
|
+
|
62
72
|
An optional client wrapper ([Lnrpc::Client](https://github.com/bumi/lnrpc/blob/master/lib/lnrpc/client.rb)) makes
|
63
73
|
initializing the gRPC client easier and removes the need for some boilerplate code for calling RPC methods.
|
64
74
|
|
65
75
|
#### Example
|
66
76
|
```ruby
|
67
77
|
lnd = Lnrpc::Client.new({credentials_path: '/path/to.cert.cls', macaroon_path: '/path/to/admin.macaroon'})
|
68
|
-
lnd.
|
78
|
+
lnd.lightning # => Lnrpc::Lightning::Stub
|
79
|
+
lnd.router # => Lnrpc::Router::Stub
|
80
|
+
|
81
|
+
lnd.ligthning.get_info
|
69
82
|
```
|
70
83
|
|
71
84
|
Also have a look at [examples.rb](https://github.com/bumi/lnrpc/blob/master/examples.rb)
|
@@ -96,7 +109,8 @@ lnd = Lnrpc::Client.new({
|
|
96
109
|
})
|
97
110
|
|
98
111
|
# the actual gRPC client is available through:
|
99
|
-
lnd.
|
112
|
+
lnd.lightning.grpc
|
113
|
+
lnd.router.grpc
|
100
114
|
```
|
101
115
|
|
102
116
|
#### Calling RPC methods
|
@@ -108,19 +122,19 @@ If the first parameter is a hash or blank the corresponding gRPC request object
|
|
108
122
|
Example:
|
109
123
|
|
110
124
|
```ruby
|
111
|
-
client.get_info
|
125
|
+
client.lightning.get_info
|
112
126
|
# is the same as:
|
113
|
-
client.
|
127
|
+
client.lightning.grpc.get_info(Lnrpc::GetInfoRequest.new)
|
114
128
|
|
115
|
-
client.list_channels(inactive_only: true)
|
129
|
+
client.lightning.list_channels(inactive_only: true)
|
116
130
|
# is the same as:
|
117
131
|
request = Lnrpc::ListChannelsRequest.new(inactive_only: true)
|
118
|
-
client.
|
132
|
+
client.lightning.grpc.list_channels(request)
|
119
133
|
|
120
|
-
client.wallet_balance.total_balance
|
134
|
+
client.lightning.wallet_balance.total_balance
|
121
135
|
# is the same as:
|
122
136
|
request = Lnrpc::WalletBalanceRequest.new()
|
123
|
-
client.
|
137
|
+
client.lightning.grpc.wallet_balance(request).total_balance
|
124
138
|
```
|
125
139
|
|
126
140
|
## Using with BTC Pay Server
|
@@ -145,13 +159,13 @@ see [rubygems](https://rubygems.org/gems/lnrpc) for all available releases.
|
|
145
159
|
|
146
160
|
### Update service definitions
|
147
161
|
|
148
|
-
|
149
|
-
|
150
|
-
$ grpc_tools_ruby_protoc -I/usr/local/include -I. -I$GOPATH/src/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis --ruby_out=plugins=grpc,paths=source_relative:. --grpc_out=. rpc.proto
|
162
|
+
The script `generate-grpc-service-files.sh` can be used to generate the GRPC ruby files.
|
163
|
+
The files will be stored in `lib/grpc_services`
|
151
164
|
|
152
|
-
|
165
|
+
$ ./generate-grpc-service-files.sh
|
153
166
|
|
154
|
-
|
167
|
+
+ Make sure you have the [grpc-tools](https://rubygems.org/gems/grpc-tools) installed
|
168
|
+
+ Make sure you have the lnd source in your $GOPATH/src folder
|
155
169
|
|
156
170
|
## Other resources
|
157
171
|
|
data/examples.rb
CHANGED
@@ -2,18 +2,25 @@ require "lnrpc"
|
|
2
2
|
|
3
3
|
lnd = Lnrpc::Client.new() # use defaults for credentials, macaraoon and address
|
4
4
|
|
5
|
-
get_info_res = lnd.get_info
|
5
|
+
get_info_res = lnd.lightning.get_info
|
6
6
|
puts get_info_res.alias
|
7
7
|
|
8
|
-
puts lnd.wallet_balance.total_balance
|
8
|
+
puts lnd.lightning.wallet_balance.total_balance
|
9
9
|
|
10
10
|
pay_request = "lntb50u1pw9mmndpp5nvnff958pxc9eqknwntyxapjw7l5grt5e2y70cmmnu0lljfa0sdqdpsgfkx7cmtwd68yetpd5s9xct5v4kxc6t5v5s8yatz0ysxwetdcqzysxqyz5vqjkhlyn40z76gyn7dx32p9j58dftve9xrlvnqqazht7w2fdauukhyhr9y4k3ngjn8s6srglj8swk7tm70ng54wdkq47ahytpwffvaeusp500csz"
|
11
|
-
lnd.pay(pay_request) # or:
|
12
|
-
lnd.
|
11
|
+
lnd.pay(payment_request: pay_request) # or:
|
12
|
+
lnd.router.send_payment_v2(payment_request: pay_request)
|
13
13
|
|
14
|
-
|
14
|
+
dest = Lnrpc.to_byte_array('038474ec195f497cf4036e5994bd820dd365bb0aaa7fb42bd9b536913a1a2dcc9e')
|
15
|
+
lnd.keysend(dest: dest, amt: 1000)
|
16
|
+
|
17
|
+
invoice_res = lnd.lightning.add_invoice(value: 1000, memo: 'I :heart: ruby')
|
15
18
|
puts invoice_res.payment_request
|
16
19
|
|
17
|
-
lnd.
|
20
|
+
puts lnd.versioner.get_version
|
21
|
+
puts lnd.wallet_kit.estimate_fee(conf_target: 10)
|
22
|
+
puts lnd.wallet_kit.next_addr
|
23
|
+
|
24
|
+
lnd.lightning.subscribe_invoices(settle_index: 1).each do |invoice|
|
18
25
|
puts invoice.payment_request
|
19
26
|
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
set -o xtrace
|
3
|
+
|
4
|
+
FULL_PATH=$(realpath $0)
|
5
|
+
GEM_DIR=$(dirname $FULL_PATH)
|
6
|
+
LNRPC_TARGET_DIR="$GEM_DIR/lib/grpc_services"
|
7
|
+
CURRENT_DIR=$(pwd)
|
8
|
+
echo $CURRENT_DIR
|
9
|
+
cd $GOPATH/src/github.com/lightningnetwork/lnd/lnrpc
|
10
|
+
|
11
|
+
echo "Generating Ruby GRPC Service Files"
|
12
|
+
|
13
|
+
PROTOS="rpc.proto walletunlocker.proto **/*.proto"
|
14
|
+
|
15
|
+
# generate files for each proto
|
16
|
+
for file in $PROTOS; do
|
17
|
+
DIRECTORY=$(dirname "${file}")
|
18
|
+
echo "Generating protos from ${file}, into ${LNRPC_TARGET_DIR}/${DIRECTORY}"
|
19
|
+
|
20
|
+
# writes all ruby files in the ruby directory
|
21
|
+
grpc_tools_ruby_protoc -I. \
|
22
|
+
-I$GOPATH/src/github.com/googleapis/googleapis \
|
23
|
+
-I$GOPATH/src/github.com/lightningnetwork/lnd/lnrpc \
|
24
|
+
--ruby_out=plugins=grpc,paths=source_relative:${LNRPC_TARGET_DIR} \
|
25
|
+
--grpc_out=${LNRPC_TARGET_DIR} "${file}"
|
26
|
+
|
27
|
+
done
|
28
|
+
|
29
|
+
cd $CURRENT_DIR
|
@@ -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 '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,67 @@
|
|
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
|
+
end
|
14
|
+
add_message "chainrpc.ConfDetails" do
|
15
|
+
optional :raw_tx, :bytes, 1
|
16
|
+
optional :block_hash, :bytes, 2
|
17
|
+
optional :block_height, :uint32, 3
|
18
|
+
optional :tx_index, :uint32, 4
|
19
|
+
end
|
20
|
+
add_message "chainrpc.Reorg" do
|
21
|
+
end
|
22
|
+
add_message "chainrpc.ConfEvent" do
|
23
|
+
oneof :event do
|
24
|
+
optional :conf, :message, 1, "chainrpc.ConfDetails"
|
25
|
+
optional :reorg, :message, 2, "chainrpc.Reorg"
|
26
|
+
end
|
27
|
+
end
|
28
|
+
add_message "chainrpc.Outpoint" do
|
29
|
+
optional :hash, :bytes, 1
|
30
|
+
optional :index, :uint32, 2
|
31
|
+
end
|
32
|
+
add_message "chainrpc.SpendRequest" do
|
33
|
+
optional :outpoint, :message, 1, "chainrpc.Outpoint"
|
34
|
+
optional :script, :bytes, 2
|
35
|
+
optional :height_hint, :uint32, 3
|
36
|
+
end
|
37
|
+
add_message "chainrpc.SpendDetails" do
|
38
|
+
optional :spending_outpoint, :message, 1, "chainrpc.Outpoint"
|
39
|
+
optional :raw_spending_tx, :bytes, 2
|
40
|
+
optional :spending_tx_hash, :bytes, 3
|
41
|
+
optional :spending_input_index, :uint32, 4
|
42
|
+
optional :spending_height, :uint32, 5
|
43
|
+
end
|
44
|
+
add_message "chainrpc.SpendEvent" do
|
45
|
+
oneof :event do
|
46
|
+
optional :spend, :message, 1, "chainrpc.SpendDetails"
|
47
|
+
optional :reorg, :message, 2, "chainrpc.Reorg"
|
48
|
+
end
|
49
|
+
end
|
50
|
+
add_message "chainrpc.BlockEpoch" do
|
51
|
+
optional :hash, :bytes, 1
|
52
|
+
optional :height, :uint32, 2
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
module Chainrpc
|
58
|
+
ConfRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("chainrpc.ConfRequest").msgclass
|
59
|
+
ConfDetails = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("chainrpc.ConfDetails").msgclass
|
60
|
+
Reorg = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("chainrpc.Reorg").msgclass
|
61
|
+
ConfEvent = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("chainrpc.ConfEvent").msgclass
|
62
|
+
Outpoint = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("chainrpc.Outpoint").msgclass
|
63
|
+
SpendRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("chainrpc.SpendRequest").msgclass
|
64
|
+
SpendDetails = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("chainrpc.SpendDetails").msgclass
|
65
|
+
SpendEvent = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("chainrpc.SpendEvent").msgclass
|
66
|
+
BlockEpoch = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("chainrpc.BlockEpoch").msgclass
|
67
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
2
|
+
# Source: chainrpc/chainnotifier.proto for package 'chainrpc'
|
3
|
+
|
4
|
+
require 'grpc'
|
5
|
+
require '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 client can specify whether the confirmation request should be for a
|
25
|
+
# particular transaction by its hash or for an output script by specifying a
|
26
|
+
# zero hash.
|
27
|
+
rpc :RegisterConfirmationsNtfn, ::Chainrpc::ConfRequest, stream(::Chainrpc::ConfEvent)
|
28
|
+
#
|
29
|
+
# RegisterSpendNtfn is a synchronous response-streaming RPC that registers an
|
30
|
+
# intent for a client to be notification once a spend request has been spent
|
31
|
+
# by a transaction that has confirmed on-chain.
|
32
|
+
#
|
33
|
+
# A client can specify whether the spend request should be for a particular
|
34
|
+
# outpoint or for an output script by specifying a zero outpoint.
|
35
|
+
rpc :RegisterSpendNtfn, ::Chainrpc::SpendRequest, stream(::Chainrpc::SpendEvent)
|
36
|
+
#
|
37
|
+
# RegisterBlockEpochNtfn is a synchronous response-streaming RPC that
|
38
|
+
# registers an intent for a client to be notified of blocks in the chain. The
|
39
|
+
# stream will return a hash and height tuple of a block for each new/stale
|
40
|
+
# block in the chain. It is the client's responsibility to determine whether
|
41
|
+
# the tuple returned is for a new or stale block in the chain.
|
42
|
+
#
|
43
|
+
# A client can also request a historical backlog of blocks from a particular
|
44
|
+
# point. This allows clients to be idempotent by ensuring that they do not
|
45
|
+
# missing processing a single block within the chain.
|
46
|
+
rpc :RegisterBlockEpochNtfn, ::Chainrpc::BlockEpoch, stream(::Chainrpc::BlockEpoch)
|
47
|
+
end
|
48
|
+
|
49
|
+
Stub = Service.rpc_stub_class
|
50
|
+
end
|
51
|
+
end
|