lnrpc 0.13.0 → 0.14.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6d2fb416e8943338d511be049cc495ca6bd3cb2c2b46ff370034a54645504966
4
- data.tar.gz: 60a51a4b3610a855b7cd485b83e3c9b820287dd0bbc18044294fd1e38e20ff1b
3
+ metadata.gz: d8892aec70e15ec43c6f400d7042cc385dad68fc911b68effa920d878dfdd7ca
4
+ data.tar.gz: d490c7df3eb0ad9a2f6fffe41abd5d28e8b9c322cc5b38c94d9948e5cfbc36ae
5
5
  SHA512:
6
- metadata.gz: b1fd8c5907a282ff844e8b9b5684665a280fd1ef43188962d9bd448502a17428a114a76b20afe284130348fb584fc2f0b812c5228e4f0eddb3506e5232e3c5b5
7
- data.tar.gz: 2da8d1e1b9455954a93e86f37e54018268293c5c4091151a79e7b0296109fc59fb20de89cb75424f5c0cf56713fcebc585340be1af20863d4f7b876f34429ca1
6
+ metadata.gz: b6964abbe9f69647d61d8af3d4ea07622dc84d6b015558b8ee0a6b77d825ea8ff4192b42cb0e087d4aff1ea78f700ef66cabae359a6778f646d749ea165b106b
7
+ data.tar.gz: 613b5b9d4492b568483611214dd4ddf263bdf34061613c05a3d3c2b4df1643bcf110443889cd0eafc72ff180bd7572f89c17948ab2afc3c46ece30b5e96b2107
data/Gemfile.lock CHANGED
@@ -1,34 +1,34 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- lnrpc (0.11.1)
5
- google-protobuf (>= 3.12)
4
+ lnrpc (0.14.1)
5
+ google-protobuf (>= 3.15.7)
6
6
  grpc (>= 1.28.0)
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- diff-lcs (1.4.4)
12
- google-protobuf (3.17.3)
13
- googleapis-common-protos-types (1.1.0)
11
+ diff-lcs (1.5.0)
12
+ google-protobuf (3.21.1)
13
+ googleapis-common-protos-types (1.3.1)
14
14
  google-protobuf (~> 3.14)
15
- grpc (1.38.0)
16
- google-protobuf (~> 3.15)
15
+ grpc (1.46.3)
16
+ google-protobuf (~> 3.19)
17
17
  googleapis-common-protos-types (~> 1.0)
18
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)
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.10.0)
28
- rspec-mocks (3.10.2)
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.10.0)
31
- rspec-support (3.10.2)
30
+ rspec-support (~> 3.11.0)
31
+ rspec-support (3.11.0)
32
32
 
33
33
  PLATFORMS
34
34
  ruby
@@ -40,4 +40,4 @@ DEPENDENCIES
40
40
  rspec (~> 3.0)
41
41
 
42
42
  BUNDLED WITH
43
- 2.1.4
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.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 defintions](https://github.com/lightningnetwork/lnd/tree/master/lnrpc) available.
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:::Routerrpc::Stub
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.ligthning.get_info
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 Certificates so set that option to nil.
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
 
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
+ })
@@ -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
@@ -34,6 +34,10 @@ module Invoicesrpc
34
34
  # SettleInvoice settles an accepted invoice. If the invoice is already
35
35
  # settled, this call will succeed.
36
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 'verrpc/verrpc_pb'
7
+
7
8
  Google::Protobuf::DescriptorPool.generated_pool.build do
8
9
  add_file("lnclipb/lncli.proto", :syntax => :proto3) do
9
10
  add_message "lnclipb.VersionResponse" do
@@ -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
@@ -147,6 +148,7 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
147
148
  add_message "routerrpc.ForwardFailEvent" do
148
149
  end
149
150
  add_message "routerrpc.SettleEvent" do
151
+ optional :preimage, :bytes, 1
150
152
  end
151
153
  add_message "routerrpc.LinkFailEvent" do
152
154
  optional :info, :message, 1, "routerrpc.HtlcInfo"
@@ -43,6 +43,8 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
43
43
  add_message "signrpc.SignMessageReq" do
44
44
  optional :msg, :bytes, 1
45
45
  optional :key_loc, :message, 2, "signrpc.KeyLocator"
46
+ optional :double_hash, :bool, 3
47
+ optional :compact_sig, :bool, 4
46
48
  end
47
49
  add_message "signrpc.SignMessageResp" do
48
50
  optional :signature, :bytes, 1
@@ -5,6 +5,7 @@ require 'google/protobuf'
5
5
 
6
6
  require 'rpc_pb'
7
7
  require 'signrpc/signer_pb'
8
+
8
9
  Google::Protobuf::DescriptorPool.generated_pool.build do
9
10
  add_file("walletrpc/walletkit.proto", :syntax => :proto3) do
10
11
  add_message "walletrpc.ListUnspentRequest" do
@@ -35,6 +36,8 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
35
36
  end
36
37
  add_message "walletrpc.AddrRequest" do
37
38
  optional :account, :string, 1
39
+ optional :type, :enum, 2, "walletrpc.AddressType"
40
+ optional :change, :bool, 3
38
41
  end
39
42
  add_message "walletrpc.AddrResponse" do
40
43
  optional :addr, :string, 1
@@ -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("walletunlocker.proto", :syntax => :proto3) do
9
10
  add_message "lnrpc.GenSeedRequest" do
@@ -21,10 +22,24 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
21
22
  optional :recovery_window, :int32, 4
22
23
  optional :channel_backups, :message, 5, "lnrpc.ChanBackupSnapshot"
23
24
  optional :stateless_init, :bool, 6
25
+ optional :extended_master_key, :string, 7
26
+ optional :extended_master_key_birthday_timestamp, :uint64, 8
27
+ optional :watch_only, :message, 9, "lnrpc.WatchOnly"
24
28
  end
25
29
  add_message "lnrpc.InitWalletResponse" do
26
30
  optional :admin_macaroon, :bytes, 1
27
31
  end
32
+ add_message "lnrpc.WatchOnly" do
33
+ optional :master_key_birthday_timestamp, :uint64, 1
34
+ optional :master_key_fingerprint, :bytes, 2
35
+ repeated :accounts, :message, 3, "lnrpc.WatchOnlyAccount"
36
+ end
37
+ add_message "lnrpc.WatchOnlyAccount" do
38
+ optional :purpose, :uint32, 1
39
+ optional :coin_type, :uint32, 2
40
+ optional :account, :uint32, 3
41
+ optional :xpub, :string, 4
42
+ end
28
43
  add_message "lnrpc.UnlockWalletRequest" do
29
44
  optional :wallet_password, :bytes, 1
30
45
  optional :recovery_window, :int32, 2
@@ -50,6 +65,8 @@ module Lnrpc
50
65
  GenSeedResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("lnrpc.GenSeedResponse").msgclass
51
66
  InitWalletRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("lnrpc.InitWalletRequest").msgclass
52
67
  InitWalletResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("lnrpc.InitWalletResponse").msgclass
68
+ WatchOnly = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("lnrpc.WatchOnly").msgclass
69
+ WatchOnlyAccount = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("lnrpc.WatchOnlyAccount").msgclass
53
70
  UnlockWalletRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("lnrpc.UnlockWalletRequest").msgclass
54
71
  UnlockWalletResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("lnrpc.UnlockWalletResponse").msgclass
55
72
  ChangePasswordRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("lnrpc.ChangePasswordRequest").msgclass
data/lib/lnrpc/client.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  require "grpc"
2
+ require "digest"
2
3
  require "lnrpc/macaroon_interceptor"
3
4
  module Lnrpc
4
5
  class Client
data/lib/lnrpc/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Lnrpc
2
- VERSION = "0.13.0"
2
+ VERSION = "0.14.1"
3
3
  end
data/lnrpc.gemspec CHANGED
@@ -30,5 +30,5 @@ Gem::Specification.new do |spec|
30
30
  spec.add_development_dependency "rspec", "~> 3.0"
31
31
 
32
32
  spec.add_dependency "grpc", ">= 1.28.0"
33
- spec.add_dependency "google-protobuf", ">=3.12"
33
+ spec.add_dependency "google-protobuf", ">=3.15.7"
34
34
  end
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.13.0
4
+ version: 0.14.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Bumann
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-07-09 00:00:00.000000000 Z
11
+ date: 2022-06-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -72,14 +72,14 @@ dependencies:
72
72
  requirements:
73
73
  - - ">="
74
74
  - !ruby/object:Gem::Version
75
- version: '3.12'
75
+ version: 3.15.7
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - ">="
81
81
  - !ruby/object:Gem::Version
82
- version: '3.12'
82
+ version: 3.15.7
83
83
  description: gRPC service definitions for the Lightning Network Daemon (lnd) gRPC
84
84
  interface packed as ruby gem
85
85
  email:
@@ -149,7 +149,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
149
149
  - !ruby/object:Gem::Version
150
150
  version: '0'
151
151
  requirements: []
152
- rubygems_version: 3.1.4
152
+ rubygems_version: 3.1.6
153
153
  signing_key:
154
154
  specification_version: 4
155
155
  summary: gRPC interface for lnd packed as ruby gem