lnrpc 0.11.1 → 0.14.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +23 -23
- data/README.md +8 -9
- data/examples.rb +43 -0
- data/generate-grpc-service-files.sh +2 -3
- data/lib/grpc_services/autopilotrpc/autopilot_services_pb.rb +5 -5
- data/lib/grpc_services/chainrpc/chainnotifier_services_pb.rb +4 -4
- data/lib/grpc_services/invoicesrpc/invoices_pb.rb +18 -0
- data/lib/grpc_services/invoicesrpc/invoices_services_pb.rb +9 -5
- data/lib/grpc_services/lnclipb/lncli_pb.rb +1 -0
- data/lib/grpc_services/routerrpc/router_pb.rb +50 -0
- data/lib/grpc_services/routerrpc/router_services_pb.rb +33 -14
- data/lib/grpc_services/rpc_pb.rb +123 -0
- data/lib/grpc_services/rpc_services_pb.rb +77 -63
- data/lib/grpc_services/signrpc/signer_pb.rb +3 -0
- data/lib/grpc_services/signrpc/signer_services_pb.rb +9 -8
- data/lib/grpc_services/verrpc/verrpc_services_pb.rb +2 -2
- data/lib/grpc_services/walletrpc/walletkit_pb.rb +108 -0
- data/lib/grpc_services/walletrpc/walletkit_services_pb.rb +87 -14
- data/lib/grpc_services/walletunlocker_pb.rb +23 -0
- data/lib/grpc_services/walletunlocker_services_pb.rb +5 -5
- data/lib/grpc_services/watchtowerrpc/watchtower_services_pb.rb +2 -2
- data/lib/grpc_services/wtclientrpc/wtclient_pb.rb +8 -0
- data/lib/grpc_services/wtclientrpc/wtclient_services_pb.rb +7 -7
- data/lib/lnrpc/client.rb +1 -0
- data/lib/lnrpc/version.rb +1 -1
- data/lnrpc.gemspec +3 -3
- metadata +11 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d8892aec70e15ec43c6f400d7042cc385dad68fc911b68effa920d878dfdd7ca
|
4
|
+
data.tar.gz: d490c7df3eb0ad9a2f6fffe41abd5d28e8b9c322cc5b38c94d9948e5cfbc36ae
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b6964abbe9f69647d61d8af3d4ea07622dc84d6b015558b8ee0a6b77d825ea8ff4192b42cb0e087d4aff1ea78f700ef66cabae359a6778f646d749ea165b106b
|
7
|
+
data.tar.gz: 613b5b9d4492b568483611214dd4ddf263bdf34061613c05a3d3c2b4df1643bcf110443889cd0eafc72ff180bd7572f89c17948ab2afc3c46ece30b5e96b2107
|
data/Gemfile.lock
CHANGED
@@ -1,43 +1,43 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
lnrpc (0.
|
5
|
-
google-protobuf (>= 3.7)
|
6
|
-
grpc (>= 1.
|
4
|
+
lnrpc (0.14.1)
|
5
|
+
google-protobuf (>= 3.15.7)
|
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.
|
14
|
-
google-protobuf (~> 3.
|
15
|
-
grpc (1.
|
16
|
-
google-protobuf (~> 3.
|
11
|
+
diff-lcs (1.5.0)
|
12
|
+
google-protobuf (3.21.1)
|
13
|
+
googleapis-common-protos-types (1.3.1)
|
14
|
+
google-protobuf (~> 3.14)
|
15
|
+
grpc (1.46.3)
|
16
|
+
google-protobuf (~> 3.19)
|
17
17
|
googleapis-common-protos-types (~> 1.0)
|
18
|
-
rake (13.0.
|
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.11.0)
|
20
|
+
rspec-core (~> 3.11.0)
|
21
|
+
rspec-expectations (~> 3.11.0)
|
22
|
+
rspec-mocks (~> 3.11.0)
|
23
|
+
rspec-core (3.11.0)
|
24
|
+
rspec-support (~> 3.11.0)
|
25
|
+
rspec-expectations (3.11.0)
|
26
26
|
diff-lcs (>= 1.2.0, < 2.0)
|
27
|
-
rspec-support (~> 3.
|
28
|
-
rspec-mocks (3.
|
27
|
+
rspec-support (~> 3.11.0)
|
28
|
+
rspec-mocks (3.11.1)
|
29
29
|
diff-lcs (>= 1.2.0, < 2.0)
|
30
|
-
rspec-support (~> 3.
|
31
|
-
rspec-support (3.
|
30
|
+
rspec-support (~> 3.11.0)
|
31
|
+
rspec-support (3.11.0)
|
32
32
|
|
33
33
|
PLATFORMS
|
34
34
|
ruby
|
35
35
|
|
36
36
|
DEPENDENCIES
|
37
|
-
bundler (
|
37
|
+
bundler (> 2.0)
|
38
38
|
lnrpc!
|
39
39
|
rake (~> 13.0)
|
40
40
|
rspec (~> 3.0)
|
41
41
|
|
42
42
|
BUNDLED WITH
|
43
|
-
|
43
|
+
2.2.33
|
data/README.md
CHANGED
@@ -5,13 +5,10 @@ a [gRPC](https://grpc.io/) client for [LND, the Lightning Network Daemon](https:
|
|
5
5
|
|
6
6
|
## Installation
|
7
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
|
-
|
11
8
|
Add this line to your application's Gemfile:
|
12
9
|
|
13
10
|
```ruby
|
14
|
-
gem 'lnrpc', '~> 0.
|
11
|
+
gem 'lnrpc', '~> 0.13.0'
|
15
12
|
```
|
16
13
|
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)).
|
17
14
|
|
@@ -27,7 +24,7 @@ Or install it yourself as:
|
|
27
24
|
|
28
25
|
## Usage
|
29
26
|
|
30
|
-
This gem makes the gRPC client classes created from the [LND service
|
27
|
+
This gem makes the gRPC client classes created from the [LND service definitions](https://github.com/lightningnetwork/lnd/tree/master/lnrpc) available.
|
31
28
|
|
32
29
|
```ruby
|
33
30
|
require "lnrpc"
|
@@ -35,7 +32,7 @@ require "lnrpc"
|
|
35
32
|
# With the changes in LND v.10.0 this load the `Lnrpc` and `Routerrpc` namespace
|
36
33
|
|
37
34
|
Lnrpc::Lightning::Stub
|
38
|
-
Routerrpc
|
35
|
+
Routerrpc::Routerrpc::Stub
|
39
36
|
Lnrpc::GetInfoRequest
|
40
37
|
...
|
41
38
|
```
|
@@ -78,7 +75,7 @@ lnd = Lnrpc::Client.new({credentials_path: '/path/to.cert.cls', macaroon_path: '
|
|
78
75
|
lnd.lightning # => Lnrpc::Lightning::Stub
|
79
76
|
lnd.router # => Lnrpc::Router::Stub
|
80
77
|
|
81
|
-
lnd.
|
78
|
+
lnd.lightning.get_info
|
82
79
|
```
|
83
80
|
|
84
81
|
Also have a look at [examples.rb](https://github.com/bumi/lnrpc/blob/master/examples.rb)
|
@@ -133,7 +130,7 @@ client.lightning.grpc.list_channels(request)
|
|
133
130
|
|
134
131
|
client.lightning.wallet_balance.total_balance
|
135
132
|
# is the same as:
|
136
|
-
request = Lnrpc::WalletBalanceRequest.new
|
133
|
+
request = Lnrpc::WalletBalanceRequest.new
|
137
134
|
client.lightning.grpc.wallet_balance(request).total_balance
|
138
135
|
```
|
139
136
|
|
@@ -144,7 +141,7 @@ If you have a running BTC Pay Server with LND support, integrating with lnrpc is
|
|
144
141
|
- Navigate to Services on the Server Settings page
|
145
142
|
- Click "see information" for your gRPC Server
|
146
143
|
- The link by "More details..." will expose the address and various macaroon hex strings
|
147
|
-
- Initialize your client with the options detailed above. BTC Pay Server utilizes LetsEncrypt for trusted TLC
|
144
|
+
- Initialize your client with the options detailed above. BTC Pay Server utilizes LetsEncrypt for trusted TLC Certificates so set that option to nil.
|
148
145
|
|
149
146
|
Don't have a BTC Pay Server? [Setting one up is easy.](https://medium.com/@BtcpayServer/launch-btcpay-server-via-web-interface-and-deploy-full-bitcoin-node-lnd-in-less-than-a-minute-dc8bc6f06a3)
|
150
147
|
|
@@ -164,6 +161,8 @@ The files will be stored in `lib/grpc_services`
|
|
164
161
|
|
165
162
|
$ ./generate-grpc-service-files.sh
|
166
163
|
|
164
|
+
+ Make sure you have the [grpc-tools](https://rubygems.org/gems/grpc-tools) installed
|
165
|
+
+ Make sure you have the lnd source in your $GOPATH/src folder
|
167
166
|
|
168
167
|
## Other resources
|
169
168
|
|
data/examples.rb
CHANGED
@@ -24,3 +24,46 @@ puts lnd.wallet_kit.next_addr
|
|
24
24
|
lnd.lightning.subscribe_invoices(settle_index: 1).each do |invoice|
|
25
25
|
puts invoice.payment_request
|
26
26
|
end
|
27
|
+
|
28
|
+
# sign a message with your node
|
29
|
+
signed_message = lnd.lightning.sign_message({ msg: "Money printer goes brrr" })
|
30
|
+
puts "Signature: " + signed_message.signature
|
31
|
+
|
32
|
+
# verify a signed message by another node
|
33
|
+
verification_response = lnd.lightning.verify_message({
|
34
|
+
msg: "Money printer goes brrr",
|
35
|
+
signature: signed_message.signature
|
36
|
+
})
|
37
|
+
puts "Pubkey: " + verification_response.pubkey # pubkey of the node that signed
|
38
|
+
puts "Valid: " + verification_response.valid.to_s
|
39
|
+
|
40
|
+
# get information on a node
|
41
|
+
node_info_response = lnd.lightning.get_node_info(pub_key: verification_response.pubkey, include_channels: true)
|
42
|
+
puts "Updated: " + Time.at(node_info_response.node.last_update).to_s
|
43
|
+
puts "Pubkey: " + node_info_response.node.pub_key.to_s
|
44
|
+
puts "Alias: " + node_info_response.node.alias.to_s
|
45
|
+
puts "Color: " + node_info_response.node.color.to_s
|
46
|
+
puts "Channels: " + node_info_response.num_channels.to_s
|
47
|
+
puts "Capacity SAT: " + node_info_response.total_capacity.to_s
|
48
|
+
puts "Address: " + node_info_response.node.addresses.first["addr"].to_s
|
49
|
+
|
50
|
+
# extract channel information
|
51
|
+
node_info_response.channels.each do |channel|
|
52
|
+
puts "Channel ID: " + channel["channel_id"].to_s
|
53
|
+
puts "Channel 1:" + channel["node1_pub"].to_s # pubkey of the first node
|
54
|
+
puts "Channel 2:" + channel["node2_pub"].to_s # pubkey of the second node
|
55
|
+
puts "Channel Capacity:" + channel["capacity"].to_s
|
56
|
+
end
|
57
|
+
|
58
|
+
# update channel policy
|
59
|
+
channel = lnd.lightning.list_channels.channels[0]
|
60
|
+
puts lnd.lightning.get_chan_info(chan_id: channel.chan_id)
|
61
|
+
channel_point = {
|
62
|
+
funding_txid_str: channel.channel_point.split(":")[0],
|
63
|
+
output_index: channel.channel_point.split(":")[1].to_i
|
64
|
+
}
|
65
|
+
lnd.lightning.update_channel_policy({
|
66
|
+
time_lock_delta: 40,
|
67
|
+
base_fee_msat: 1100,
|
68
|
+
chan_point: channel_point
|
69
|
+
})
|
@@ -18,9 +18,8 @@ for file in $PROTOS; do
|
|
18
18
|
echo "Generating protos from ${file}, into ${LNRPC_TARGET_DIR}/${DIRECTORY}"
|
19
19
|
|
20
20
|
# writes all ruby files in the ruby directory
|
21
|
-
grpc_tools_ruby_protoc -I
|
22
|
-
-I. \
|
23
|
-
-I$GOPATH/src/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis \
|
21
|
+
grpc_tools_ruby_protoc -I. \
|
22
|
+
-I$GOPATH/src/github.com/googleapis/googleapis \
|
24
23
|
-I$GOPATH/src/github.com/lightningnetwork/lnd/lnrpc \
|
25
24
|
--ruby_out=plugins=grpc,paths=source_relative:${LNRPC_TARGET_DIR} \
|
26
25
|
--grpc_out=${LNRPC_TARGET_DIR} "${file}"
|
@@ -11,7 +11,7 @@ module Autopilotrpc
|
|
11
11
|
# that can be used when deciding where to open channels.
|
12
12
|
class Service
|
13
13
|
|
14
|
-
include GRPC::GenericService
|
14
|
+
include ::GRPC::GenericService
|
15
15
|
|
16
16
|
self.marshal_class_method = :encode
|
17
17
|
self.unmarshal_class_method = :decode
|
@@ -19,20 +19,20 @@ module Autopilotrpc
|
|
19
19
|
|
20
20
|
#
|
21
21
|
# Status returns whether the daemon's autopilot agent is active.
|
22
|
-
rpc :Status, StatusRequest, StatusResponse
|
22
|
+
rpc :Status, ::Autopilotrpc::StatusRequest, ::Autopilotrpc::StatusResponse
|
23
23
|
#
|
24
24
|
# ModifyStatus is used to modify the status of the autopilot agent, like
|
25
25
|
# enabling or disabling it.
|
26
|
-
rpc :ModifyStatus, ModifyStatusRequest, ModifyStatusResponse
|
26
|
+
rpc :ModifyStatus, ::Autopilotrpc::ModifyStatusRequest, ::Autopilotrpc::ModifyStatusResponse
|
27
27
|
#
|
28
28
|
# QueryScores queries all available autopilot heuristics, in addition to any
|
29
29
|
# active combination of these heruristics, for the scores they would give to
|
30
30
|
# the given nodes.
|
31
|
-
rpc :QueryScores, QueryScoresRequest, QueryScoresResponse
|
31
|
+
rpc :QueryScores, ::Autopilotrpc::QueryScoresRequest, ::Autopilotrpc::QueryScoresResponse
|
32
32
|
#
|
33
33
|
# SetScores attempts to set the scores used by the running autopilot agent,
|
34
34
|
# if the external scoring heuristic is enabled.
|
35
|
-
rpc :SetScores, SetScoresRequest, SetScoresResponse
|
35
|
+
rpc :SetScores, ::Autopilotrpc::SetScoresRequest, ::Autopilotrpc::SetScoresResponse
|
36
36
|
end
|
37
37
|
|
38
38
|
Stub = Service.rpc_stub_class
|
@@ -10,7 +10,7 @@ module Chainrpc
|
|
10
10
|
# chain backend by registering notifiers for chain events.
|
11
11
|
class Service
|
12
12
|
|
13
|
-
include GRPC::GenericService
|
13
|
+
include ::GRPC::GenericService
|
14
14
|
|
15
15
|
self.marshal_class_method = :encode
|
16
16
|
self.unmarshal_class_method = :decode
|
@@ -24,7 +24,7 @@ module Chainrpc
|
|
24
24
|
# A client can specify whether the confirmation request should be for a
|
25
25
|
# particular transaction by its hash or for an output script by specifying a
|
26
26
|
# zero hash.
|
27
|
-
rpc :RegisterConfirmationsNtfn, ConfRequest, stream(ConfEvent)
|
27
|
+
rpc :RegisterConfirmationsNtfn, ::Chainrpc::ConfRequest, stream(::Chainrpc::ConfEvent)
|
28
28
|
#
|
29
29
|
# RegisterSpendNtfn is a synchronous response-streaming RPC that registers an
|
30
30
|
# intent for a client to be notification once a spend request has been spent
|
@@ -32,7 +32,7 @@ module Chainrpc
|
|
32
32
|
#
|
33
33
|
# A client can specify whether the spend request should be for a particular
|
34
34
|
# outpoint or for an output script by specifying a zero outpoint.
|
35
|
-
rpc :RegisterSpendNtfn, SpendRequest, stream(SpendEvent)
|
35
|
+
rpc :RegisterSpendNtfn, ::Chainrpc::SpendRequest, stream(::Chainrpc::SpendEvent)
|
36
36
|
#
|
37
37
|
# RegisterBlockEpochNtfn is a synchronous response-streaming RPC that
|
38
38
|
# registers an intent for a client to be notified of blocks in the chain. The
|
@@ -43,7 +43,7 @@ module Chainrpc
|
|
43
43
|
# A client can also request a historical backlog of blocks from a particular
|
44
44
|
# point. This allows clients to be idempotent by ensuring that they do not
|
45
45
|
# missing processing a single block within the chain.
|
46
|
-
rpc :RegisterBlockEpochNtfn, BlockEpoch, stream(BlockEpoch)
|
46
|
+
rpc :RegisterBlockEpochNtfn, ::Chainrpc::BlockEpoch, stream(::Chainrpc::BlockEpoch)
|
47
47
|
end
|
48
48
|
|
49
49
|
Stub = Service.rpc_stub_class
|
@@ -4,6 +4,7 @@
|
|
4
4
|
require 'google/protobuf'
|
5
5
|
|
6
6
|
require 'rpc_pb'
|
7
|
+
|
7
8
|
Google::Protobuf::DescriptorPool.generated_pool.build do
|
8
9
|
add_file("invoicesrpc/invoices.proto", :syntax => :proto3) do
|
9
10
|
add_message "invoicesrpc.CancelInvoiceMsg" do
|
@@ -25,6 +26,8 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
|
|
25
26
|
end
|
26
27
|
add_message "invoicesrpc.AddHoldInvoiceResp" do
|
27
28
|
optional :payment_request, :string, 1
|
29
|
+
optional :add_index, :uint64, 2
|
30
|
+
optional :payment_addr, :bytes, 3
|
28
31
|
end
|
29
32
|
add_message "invoicesrpc.SettleInvoiceMsg" do
|
30
33
|
optional :preimage, :bytes, 1
|
@@ -34,6 +37,19 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
|
|
34
37
|
add_message "invoicesrpc.SubscribeSingleInvoiceRequest" do
|
35
38
|
optional :r_hash, :bytes, 2
|
36
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
|
37
53
|
end
|
38
54
|
end
|
39
55
|
|
@@ -45,4 +61,6 @@ module Invoicesrpc
|
|
45
61
|
SettleInvoiceMsg = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("invoicesrpc.SettleInvoiceMsg").msgclass
|
46
62
|
SettleInvoiceResp = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("invoicesrpc.SettleInvoiceResp").msgclass
|
47
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
|
48
66
|
end
|
@@ -10,7 +10,7 @@ module Invoicesrpc
|
|
10
10
|
# invoices.
|
11
11
|
class Service
|
12
12
|
|
13
|
-
include GRPC::GenericService
|
13
|
+
include ::GRPC::GenericService
|
14
14
|
|
15
15
|
self.marshal_class_method = :encode
|
16
16
|
self.unmarshal_class_method = :decode
|
@@ -20,20 +20,24 @@ module Invoicesrpc
|
|
20
20
|
# SubscribeSingleInvoice returns a uni-directional stream (server -> client)
|
21
21
|
# to notify the client of state transitions of the specified invoice.
|
22
22
|
# Initially the current invoice state is always sent out.
|
23
|
-
rpc :SubscribeSingleInvoice, SubscribeSingleInvoiceRequest, stream(Lnrpc::Invoice)
|
23
|
+
rpc :SubscribeSingleInvoice, ::Invoicesrpc::SubscribeSingleInvoiceRequest, stream(::Lnrpc::Invoice)
|
24
24
|
#
|
25
25
|
# CancelInvoice cancels a currently open invoice. If the invoice is already
|
26
26
|
# canceled, this call will succeed. If the invoice is already settled, it will
|
27
27
|
# fail.
|
28
|
-
rpc :CancelInvoice, CancelInvoiceMsg, CancelInvoiceResp
|
28
|
+
rpc :CancelInvoice, ::Invoicesrpc::CancelInvoiceMsg, ::Invoicesrpc::CancelInvoiceResp
|
29
29
|
#
|
30
30
|
# AddHoldInvoice creates a hold invoice. It ties the invoice to the hash
|
31
31
|
# supplied in the request.
|
32
|
-
rpc :AddHoldInvoice, AddHoldInvoiceRequest, AddHoldInvoiceResp
|
32
|
+
rpc :AddHoldInvoice, ::Invoicesrpc::AddHoldInvoiceRequest, ::Invoicesrpc::AddHoldInvoiceResp
|
33
33
|
#
|
34
34
|
# SettleInvoice settles an accepted invoice. If the invoice is already
|
35
35
|
# settled, this call will succeed.
|
36
|
-
rpc :SettleInvoice, SettleInvoiceMsg, SettleInvoiceResp
|
36
|
+
rpc :SettleInvoice, ::Invoicesrpc::SettleInvoiceMsg, ::Invoicesrpc::SettleInvoiceResp
|
37
|
+
#
|
38
|
+
# LookupInvoiceV2 attempts to look up at invoice. An invoice can be refrenced
|
39
|
+
# using either its payment hash, payment address, or set ID.
|
40
|
+
rpc :LookupInvoiceV2, ::Invoicesrpc::LookupInvoiceMsg, ::Lnrpc::Invoice
|
37
41
|
end
|
38
42
|
|
39
43
|
Stub = Service.rpc_stub_class
|
@@ -4,6 +4,7 @@
|
|
4
4
|
require 'google/protobuf'
|
5
5
|
|
6
6
|
require 'rpc_pb'
|
7
|
+
|
7
8
|
Google::Protobuf::DescriptorPool.generated_pool.build do
|
8
9
|
add_file("routerrpc/router.proto", :syntax => :proto3) do
|
9
10
|
add_message "routerrpc.SendPaymentRequest" do
|
@@ -12,6 +13,7 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
|
|
12
13
|
optional :amt_msat, :int64, 12
|
13
14
|
optional :payment_hash, :bytes, 3
|
14
15
|
optional :final_cltv_delta, :int32, 4
|
16
|
+
optional :payment_addr, :bytes, 20
|
15
17
|
optional :payment_request, :string, 5
|
16
18
|
optional :timeout_seconds, :int32, 6
|
17
19
|
optional :fee_limit_sat, :int64, 7
|
@@ -26,6 +28,8 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
|
|
26
28
|
repeated :dest_features, :enum, 16, "lnrpc.FeatureBit"
|
27
29
|
optional :max_parts, :uint32, 17
|
28
30
|
optional :no_inflight_updates, :bool, 18
|
31
|
+
optional :max_shard_size_msat, :uint64, 21
|
32
|
+
optional :amp, :bool, 22
|
29
33
|
end
|
30
34
|
add_message "routerrpc.TrackPaymentRequest" do
|
31
35
|
optional :payment_hash, :bytes, 1
|
@@ -56,6 +60,11 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
|
|
56
60
|
add_message "routerrpc.QueryMissionControlResponse" do
|
57
61
|
repeated :pairs, :message, 2, "routerrpc.PairHistory"
|
58
62
|
end
|
63
|
+
add_message "routerrpc.XImportMissionControlRequest" do
|
64
|
+
repeated :pairs, :message, 1, "routerrpc.PairHistory"
|
65
|
+
end
|
66
|
+
add_message "routerrpc.XImportMissionControlResponse" do
|
67
|
+
end
|
59
68
|
add_message "routerrpc.PairHistory" do
|
60
69
|
optional :node_from, :bytes, 1
|
61
70
|
optional :node_to, :bytes, 2
|
@@ -69,6 +78,23 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
|
|
69
78
|
optional :success_amt_sat, :int64, 6
|
70
79
|
optional :success_amt_msat, :int64, 7
|
71
80
|
end
|
81
|
+
add_message "routerrpc.GetMissionControlConfigRequest" do
|
82
|
+
end
|
83
|
+
add_message "routerrpc.GetMissionControlConfigResponse" do
|
84
|
+
optional :config, :message, 1, "routerrpc.MissionControlConfig"
|
85
|
+
end
|
86
|
+
add_message "routerrpc.SetMissionControlConfigRequest" do
|
87
|
+
optional :config, :message, 1, "routerrpc.MissionControlConfig"
|
88
|
+
end
|
89
|
+
add_message "routerrpc.SetMissionControlConfigResponse" do
|
90
|
+
end
|
91
|
+
add_message "routerrpc.MissionControlConfig" do
|
92
|
+
optional :half_life_seconds, :uint64, 1
|
93
|
+
optional :hop_probability, :float, 2
|
94
|
+
optional :weight, :float, 3
|
95
|
+
optional :maximum_payment_results, :uint32, 4
|
96
|
+
optional :minimum_failure_relax_interval, :uint64, 5
|
97
|
+
end
|
72
98
|
add_message "routerrpc.QueryProbabilityRequest" do
|
73
99
|
optional :from_node, :bytes, 1
|
74
100
|
optional :to_node, :bytes, 2
|
@@ -83,6 +109,7 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
|
|
83
109
|
optional :final_cltv_delta, :int32, 2
|
84
110
|
optional :outgoing_chan_id, :uint64, 3
|
85
111
|
repeated :hop_pubkeys, :bytes, 4
|
112
|
+
optional :payment_addr, :bytes, 5
|
86
113
|
end
|
87
114
|
add_message "routerrpc.BuildRouteResponse" do
|
88
115
|
optional :route, :message, 1, "lnrpc.Route"
|
@@ -121,6 +148,7 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
|
|
121
148
|
add_message "routerrpc.ForwardFailEvent" do
|
122
149
|
end
|
123
150
|
add_message "routerrpc.SettleEvent" do
|
151
|
+
optional :preimage, :bytes, 1
|
124
152
|
end
|
125
153
|
add_message "routerrpc.LinkFailEvent" do
|
126
154
|
optional :info, :message, 1, "routerrpc.HtlcInfo"
|
@@ -146,12 +174,19 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
|
|
146
174
|
optional :outgoing_amount_msat, :uint64, 3
|
147
175
|
optional :outgoing_expiry, :uint32, 4
|
148
176
|
map :custom_records, :uint64, :bytes, 8
|
177
|
+
optional :onion_blob, :bytes, 9
|
149
178
|
end
|
150
179
|
add_message "routerrpc.ForwardHtlcInterceptResponse" do
|
151
180
|
optional :incoming_circuit_key, :message, 1, "routerrpc.CircuitKey"
|
152
181
|
optional :action, :enum, 2, "routerrpc.ResolveHoldForwardAction"
|
153
182
|
optional :preimage, :bytes, 3
|
154
183
|
end
|
184
|
+
add_message "routerrpc.UpdateChanStatusRequest" do
|
185
|
+
optional :chan_point, :message, 1, "lnrpc.ChannelPoint"
|
186
|
+
optional :action, :enum, 2, "routerrpc.ChanStatusAction"
|
187
|
+
end
|
188
|
+
add_message "routerrpc.UpdateChanStatusResponse" do
|
189
|
+
end
|
155
190
|
add_enum "routerrpc.FailureDetail" do
|
156
191
|
value :UNKNOWN, 0
|
157
192
|
value :NO_DETAIL, 1
|
@@ -191,6 +226,11 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
|
|
191
226
|
value :FAIL, 1
|
192
227
|
value :RESUME, 2
|
193
228
|
end
|
229
|
+
add_enum "routerrpc.ChanStatusAction" do
|
230
|
+
value :ENABLE, 0
|
231
|
+
value :DISABLE, 1
|
232
|
+
value :AUTO, 2
|
233
|
+
end
|
194
234
|
end
|
195
235
|
end
|
196
236
|
|
@@ -205,8 +245,15 @@ module Routerrpc
|
|
205
245
|
ResetMissionControlResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("routerrpc.ResetMissionControlResponse").msgclass
|
206
246
|
QueryMissionControlRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("routerrpc.QueryMissionControlRequest").msgclass
|
207
247
|
QueryMissionControlResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("routerrpc.QueryMissionControlResponse").msgclass
|
248
|
+
XImportMissionControlRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("routerrpc.XImportMissionControlRequest").msgclass
|
249
|
+
XImportMissionControlResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("routerrpc.XImportMissionControlResponse").msgclass
|
208
250
|
PairHistory = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("routerrpc.PairHistory").msgclass
|
209
251
|
PairData = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("routerrpc.PairData").msgclass
|
252
|
+
GetMissionControlConfigRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("routerrpc.GetMissionControlConfigRequest").msgclass
|
253
|
+
GetMissionControlConfigResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("routerrpc.GetMissionControlConfigResponse").msgclass
|
254
|
+
SetMissionControlConfigRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("routerrpc.SetMissionControlConfigRequest").msgclass
|
255
|
+
SetMissionControlConfigResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("routerrpc.SetMissionControlConfigResponse").msgclass
|
256
|
+
MissionControlConfig = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("routerrpc.MissionControlConfig").msgclass
|
210
257
|
QueryProbabilityRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("routerrpc.QueryProbabilityRequest").msgclass
|
211
258
|
QueryProbabilityResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("routerrpc.QueryProbabilityResponse").msgclass
|
212
259
|
BuildRouteRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("routerrpc.BuildRouteRequest").msgclass
|
@@ -223,7 +270,10 @@ module Routerrpc
|
|
223
270
|
CircuitKey = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("routerrpc.CircuitKey").msgclass
|
224
271
|
ForwardHtlcInterceptRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("routerrpc.ForwardHtlcInterceptRequest").msgclass
|
225
272
|
ForwardHtlcInterceptResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("routerrpc.ForwardHtlcInterceptResponse").msgclass
|
273
|
+
UpdateChanStatusRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("routerrpc.UpdateChanStatusRequest").msgclass
|
274
|
+
UpdateChanStatusResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("routerrpc.UpdateChanStatusResponse").msgclass
|
226
275
|
FailureDetail = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("routerrpc.FailureDetail").enummodule
|
227
276
|
PaymentState = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("routerrpc.PaymentState").enummodule
|
228
277
|
ResolveHoldForwardAction = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("routerrpc.ResolveHoldForwardAction").enummodule
|
278
|
+
ChanStatusAction = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("routerrpc.ChanStatusAction").enummodule
|
229
279
|
end
|
@@ -10,7 +10,7 @@ module Routerrpc
|
|
10
10
|
# subsystem of the daemon.
|
11
11
|
class Service
|
12
12
|
|
13
|
-
include GRPC::GenericService
|
13
|
+
include ::GRPC::GenericService
|
14
14
|
|
15
15
|
self.marshal_class_method = :encode
|
16
16
|
self.unmarshal_class_method = :decode
|
@@ -20,65 +20,84 @@ module Routerrpc
|
|
20
20
|
# SendPaymentV2 attempts to route a payment described by the passed
|
21
21
|
# PaymentRequest to the final destination. The call returns a stream of
|
22
22
|
# payment updates.
|
23
|
-
rpc :SendPaymentV2, SendPaymentRequest, stream(Lnrpc::Payment)
|
23
|
+
rpc :SendPaymentV2, ::Routerrpc::SendPaymentRequest, stream(::Lnrpc::Payment)
|
24
24
|
#
|
25
25
|
# TrackPaymentV2 returns an update stream for the payment identified by the
|
26
26
|
# payment hash.
|
27
|
-
rpc :TrackPaymentV2, TrackPaymentRequest, stream(Lnrpc::Payment)
|
27
|
+
rpc :TrackPaymentV2, ::Routerrpc::TrackPaymentRequest, stream(::Lnrpc::Payment)
|
28
28
|
#
|
29
29
|
# EstimateRouteFee allows callers to obtain a lower bound w.r.t how much it
|
30
30
|
# may cost to send an HTLC to the target end destination.
|
31
|
-
rpc :EstimateRouteFee, RouteFeeRequest, RouteFeeResponse
|
31
|
+
rpc :EstimateRouteFee, ::Routerrpc::RouteFeeRequest, ::Routerrpc::RouteFeeResponse
|
32
32
|
#
|
33
33
|
# Deprecated, use SendToRouteV2. SendToRoute attempts to make a payment via
|
34
34
|
# the specified route. This method differs from SendPayment in that it
|
35
35
|
# allows users to specify a full route manually. This can be used for
|
36
36
|
# things like rebalancing, and atomic swaps. It differs from the newer
|
37
37
|
# SendToRouteV2 in that it doesn't return the full HTLC information.
|
38
|
-
rpc :SendToRoute, SendToRouteRequest, SendToRouteResponse
|
38
|
+
rpc :SendToRoute, ::Routerrpc::SendToRouteRequest, ::Routerrpc::SendToRouteResponse
|
39
39
|
#
|
40
40
|
# SendToRouteV2 attempts to make a payment via the specified route. This
|
41
41
|
# method differs from SendPayment in that it allows users to specify a full
|
42
42
|
# route manually. This can be used for things like rebalancing, and atomic
|
43
43
|
# swaps.
|
44
|
-
rpc :SendToRouteV2, SendToRouteRequest, Lnrpc::HTLCAttempt
|
44
|
+
rpc :SendToRouteV2, ::Routerrpc::SendToRouteRequest, ::Lnrpc::HTLCAttempt
|
45
45
|
#
|
46
46
|
# ResetMissionControl clears all mission control state and starts with a clean
|
47
47
|
# slate.
|
48
|
-
rpc :ResetMissionControl, ResetMissionControlRequest, ResetMissionControlResponse
|
48
|
+
rpc :ResetMissionControl, ::Routerrpc::ResetMissionControlRequest, ::Routerrpc::ResetMissionControlResponse
|
49
49
|
#
|
50
50
|
# QueryMissionControl exposes the internal mission control state to callers.
|
51
51
|
# It is a development feature.
|
52
|
-
rpc :QueryMissionControl, QueryMissionControlRequest, QueryMissionControlResponse
|
52
|
+
rpc :QueryMissionControl, ::Routerrpc::QueryMissionControlRequest, ::Routerrpc::QueryMissionControlResponse
|
53
|
+
#
|
54
|
+
# XImportMissionControl is an experimental API that imports the state provided
|
55
|
+
# to the internal mission control's state, using all results which are more
|
56
|
+
# recent than our existing values. These values will only be imported
|
57
|
+
# in-memory, and will not be persisted across restarts.
|
58
|
+
rpc :XImportMissionControl, ::Routerrpc::XImportMissionControlRequest, ::Routerrpc::XImportMissionControlResponse
|
59
|
+
#
|
60
|
+
# GetMissionControlConfig returns mission control's current config.
|
61
|
+
rpc :GetMissionControlConfig, ::Routerrpc::GetMissionControlConfigRequest, ::Routerrpc::GetMissionControlConfigResponse
|
62
|
+
#
|
63
|
+
# SetMissionControlConfig will set mission control's config, if the config
|
64
|
+
# provided is valid.
|
65
|
+
rpc :SetMissionControlConfig, ::Routerrpc::SetMissionControlConfigRequest, ::Routerrpc::SetMissionControlConfigResponse
|
53
66
|
#
|
54
67
|
# QueryProbability returns the current success probability estimate for a
|
55
68
|
# given node pair and amount.
|
56
|
-
rpc :QueryProbability, QueryProbabilityRequest, QueryProbabilityResponse
|
69
|
+
rpc :QueryProbability, ::Routerrpc::QueryProbabilityRequest, ::Routerrpc::QueryProbabilityResponse
|
57
70
|
#
|
58
71
|
# BuildRoute builds a fully specified route based on a list of hop public
|
59
72
|
# keys. It retrieves the relevant channel policies from the graph in order to
|
60
73
|
# calculate the correct fees and time locks.
|
61
|
-
rpc :BuildRoute, BuildRouteRequest, BuildRouteResponse
|
74
|
+
rpc :BuildRoute, ::Routerrpc::BuildRouteRequest, ::Routerrpc::BuildRouteResponse
|
62
75
|
#
|
63
76
|
# SubscribeHtlcEvents creates a uni-directional stream from the server to
|
64
77
|
# the client which delivers a stream of htlc events.
|
65
|
-
rpc :SubscribeHtlcEvents, SubscribeHtlcEventsRequest, stream(HtlcEvent)
|
78
|
+
rpc :SubscribeHtlcEvents, ::Routerrpc::SubscribeHtlcEventsRequest, stream(::Routerrpc::HtlcEvent)
|
66
79
|
#
|
67
80
|
# Deprecated, use SendPaymentV2. SendPayment attempts to route a payment
|
68
81
|
# described by the passed PaymentRequest to the final destination. The call
|
69
82
|
# returns a stream of payment status updates.
|
70
|
-
rpc :SendPayment, SendPaymentRequest, stream(PaymentStatus)
|
83
|
+
rpc :SendPayment, ::Routerrpc::SendPaymentRequest, stream(::Routerrpc::PaymentStatus)
|
71
84
|
#
|
72
85
|
# Deprecated, use TrackPaymentV2. TrackPayment returns an update stream for
|
73
86
|
# the payment identified by the payment hash.
|
74
|
-
rpc :TrackPayment, TrackPaymentRequest, stream(PaymentStatus)
|
87
|
+
rpc :TrackPayment, ::Routerrpc::TrackPaymentRequest, stream(::Routerrpc::PaymentStatus)
|
75
88
|
# *
|
76
89
|
# HtlcInterceptor dispatches a bi-directional streaming RPC in which
|
77
90
|
# Forwarded HTLC requests are sent to the client and the client responds with
|
78
91
|
# a boolean that tells LND if this htlc should be intercepted.
|
79
92
|
# In case of interception, the htlc can be either settled, cancelled or
|
80
93
|
# resumed later by using the ResolveHoldForward endpoint.
|
81
|
-
rpc :HtlcInterceptor, stream(ForwardHtlcInterceptResponse), stream(ForwardHtlcInterceptRequest)
|
94
|
+
rpc :HtlcInterceptor, stream(::Routerrpc::ForwardHtlcInterceptResponse), stream(::Routerrpc::ForwardHtlcInterceptRequest)
|
95
|
+
#
|
96
|
+
# UpdateChanStatus attempts to manually set the state of a channel
|
97
|
+
# (enabled, disabled, or auto). A manual "disable" request will cause the
|
98
|
+
# channel to stay disabled until a subsequent manual request of either
|
99
|
+
# "enable" or "auto".
|
100
|
+
rpc :UpdateChanStatus, ::Routerrpc::UpdateChanStatusRequest, ::Routerrpc::UpdateChanStatusResponse
|
82
101
|
end
|
83
102
|
|
84
103
|
Stub = Service.rpc_stub_class
|