lnrpc 0.14.3.1 → 0.15.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +6 -6
- data/README.md +1 -1
- data/examples.rb +18 -1
- data/generate-grpc-service-files.sh +1 -1
- data/lib/grpc_services/chainrpc/chainnotifier_services_pb.rb +5 -3
- data/lib/grpc_services/devrpc/dev_pb.rb +17 -0
- data/lib/grpc_services/devrpc/dev_services_pb.rb +25 -0
- data/lib/grpc_services/invoicesrpc/invoices_pb.rb +1 -1
- data/lib/grpc_services/{rpc_pb.rb → lightning_pb.rb} +215 -7
- data/lib/grpc_services/{rpc_services_pb.rb → lightning_services_pb.rb} +49 -5
- data/lib/grpc_services/neutrinorpc/neutrino_pb.rb +106 -0
- data/lib/grpc_services/neutrinorpc/neutrino_services_pb.rb +51 -0
- data/lib/grpc_services/peersrpc/peers_pb.rb +48 -0
- data/lib/grpc_services/peersrpc/peers_services_pb.rb +27 -0
- data/lib/grpc_services/routerrpc/router_pb.rb +5 -1
- data/lib/grpc_services/signrpc/signer_pb.rb +86 -0
- data/lib/grpc_services/signrpc/signer_services_pb.rb +67 -2
- data/lib/grpc_services/stateservice_pb.rb +35 -0
- data/lib/grpc_services/stateservice_services_pb.rb +46 -0
- data/lib/grpc_services/walletrpc/walletkit_pb.rb +13 -1
- data/lib/grpc_services/walletrpc/walletkit_services_pb.rb +8 -1
- data/lib/grpc_services/walletunlocker_pb.rb +1 -1
- data/lib/lnrpc/client.rb +2 -2
- data/lib/lnrpc/version.rb +1 -1
- metadata +16 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 87e7353edb174ac9b45e6458caaf524ededd58250eb3533870593e960c484ca2
|
4
|
+
data.tar.gz: 2d6e030e7b69ee58af709f7a3e9bdab8cad97149b2a294e91b40323e37970ad5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 766f3d18b40f6cac545f17b1486cc511d94e0c58d7a1529ba6456783e9d16ecccd226773eb8c1dfe20ef18f4bcf7ac7a52d549f16e983252610ea0280a9f8882
|
7
|
+
data.tar.gz: 8ff36d206ec1e5777e4fd9e0da530193d67918b480a6e11a1e908c8dc71a9b9391724d430c8d938bb92604f9698156cab0fb59203e6a0df5e6904db37e061516
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
lnrpc (0.
|
4
|
+
lnrpc (0.15.5)
|
5
5
|
google-protobuf (>= 3.15.7)
|
6
6
|
grpc (>= 1.28.0)
|
7
7
|
|
@@ -9,11 +9,11 @@ GEM
|
|
9
9
|
remote: https://rubygems.org/
|
10
10
|
specs:
|
11
11
|
diff-lcs (1.5.0)
|
12
|
-
google-protobuf (3.
|
13
|
-
googleapis-common-protos-types (1.
|
12
|
+
google-protobuf (3.22.1)
|
13
|
+
googleapis-common-protos-types (1.5.0)
|
14
14
|
google-protobuf (~> 3.14)
|
15
|
-
grpc (1.
|
16
|
-
google-protobuf (~> 3.
|
15
|
+
grpc (1.52.0)
|
16
|
+
google-protobuf (~> 3.21)
|
17
17
|
googleapis-common-protos-types (~> 1.0)
|
18
18
|
rake (13.0.6)
|
19
19
|
rspec (3.11.0)
|
@@ -40,4 +40,4 @@ DEPENDENCIES
|
|
40
40
|
rspec (~> 3.0)
|
41
41
|
|
42
42
|
BUNDLED WITH
|
43
|
-
2.
|
43
|
+
2.4.4
|
data/README.md
CHANGED
@@ -8,7 +8,7 @@ a [gRPC](https://grpc.io/) client for [LND, the Lightning Network Daemon](https:
|
|
8
8
|
Add this line to your application's Gemfile:
|
9
9
|
|
10
10
|
```ruby
|
11
|
-
gem 'lnrpc', '~> 0.
|
11
|
+
gem 'lnrpc', '~> 0.15.5'
|
12
12
|
```
|
13
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)).
|
14
14
|
|
data/examples.rb
CHANGED
@@ -1,26 +1,34 @@
|
|
1
1
|
require "lnrpc"
|
2
2
|
|
3
|
-
|
3
|
+
# establish a connection
|
4
|
+
lnd = Lnrpc::Client.new() # use defaults for credentials, macaroon and address
|
4
5
|
|
6
|
+
# get basic info
|
5
7
|
get_info_res = lnd.lightning.get_info
|
6
8
|
puts get_info_res.alias
|
7
9
|
|
10
|
+
# get wallet balance
|
8
11
|
puts lnd.lightning.wallet_balance.total_balance
|
9
12
|
|
13
|
+
# pay an invoice
|
10
14
|
pay_request = "lntb50u1pw9mmndpp5nvnff958pxc9eqknwntyxapjw7l5grt5e2y70cmmnu0lljfa0sdqdpsgfkx7cmtwd68yetpd5s9xct5v4kxc6t5v5s8yatz0ysxwetdcqzysxqyz5vqjkhlyn40z76gyn7dx32p9j58dftve9xrlvnqqazht7w2fdauukhyhr9y4k3ngjn8s6srglj8swk7tm70ng54wdkq47ahytpwffvaeusp500csz"
|
11
15
|
lnd.pay(payment_request: pay_request) # or:
|
12
16
|
lnd.router.send_payment_v2(payment_request: pay_request)
|
13
17
|
|
18
|
+
# keysend payment
|
14
19
|
dest = Lnrpc.to_byte_array('038474ec195f497cf4036e5994bd820dd365bb0aaa7fb42bd9b536913a1a2dcc9e')
|
15
20
|
lnd.keysend(dest: dest, amt: 1000)
|
16
21
|
|
22
|
+
# create invoice
|
17
23
|
invoice_res = lnd.lightning.add_invoice(value: 1000, memo: 'I :heart: ruby')
|
18
24
|
puts invoice_res.payment_request
|
19
25
|
|
26
|
+
# get fee estimates
|
20
27
|
puts lnd.versioner.get_version
|
21
28
|
puts lnd.wallet_kit.estimate_fee(conf_target: 10)
|
22
29
|
puts lnd.wallet_kit.next_addr
|
23
30
|
|
31
|
+
# print incoming invoices
|
24
32
|
lnd.lightning.subscribe_invoices(settle_index: 1).each do |invoice|
|
25
33
|
puts invoice.payment_request
|
26
34
|
end
|
@@ -67,3 +75,12 @@ lnd.lightning.update_channel_policy({
|
|
67
75
|
base_fee_msat: 1100,
|
68
76
|
chan_point: channel_point
|
69
77
|
})
|
78
|
+
|
79
|
+
# peer node
|
80
|
+
address = {pubkey: "03423790614f023e3c0cdaa654a3578e919947e4c3a14bf5044e7c787ebd11af1a", host: "98.142.251.170:9735"}
|
81
|
+
response = lnd.lightning.connect_peer(addr: address)
|
82
|
+
|
83
|
+
# open channel
|
84
|
+
# note: Lnrpc needs to connect with an admin macaroon, and the node needs to be an existing peer.
|
85
|
+
pubkey = Lnrpc.to_byte_array("031f2669adab71548fad4432277a0d90233e3bc07ac29cfb0b3e01bd3fb26cb9fa")
|
86
|
+
response = lnd.lightning.open_channel({node_pubkey: pubkey, local_funding_amount: 21000})
|
@@ -10,7 +10,7 @@ cd $GOPATH/src/github.com/lightningnetwork/lnd/lnrpc
|
|
10
10
|
|
11
11
|
echo "Generating Ruby GRPC Service Files"
|
12
12
|
|
13
|
-
PROTOS="
|
13
|
+
PROTOS="lightning.proto walletunlocker.proto stateservice.proto **/*.proto"
|
14
14
|
|
15
15
|
# generate files for each proto
|
16
16
|
for file in $PROTOS; do
|
@@ -21,9 +21,11 @@ module Chainrpc
|
|
21
21
|
# registers an intent for a client to be notified once a confirmation request
|
22
22
|
# has reached its required number of confirmations on-chain.
|
23
23
|
#
|
24
|
-
# A
|
25
|
-
#
|
26
|
-
#
|
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.
|
27
29
|
rpc :RegisterConfirmationsNtfn, ::Chainrpc::ConfRequest, stream(::Chainrpc::ConfEvent)
|
28
30
|
#
|
29
31
|
# RegisterSpendNtfn is a synchronous response-streaming RPC that registers an
|
@@ -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 '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 '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
|