rack-lightning 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,307 @@
1
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
2
+ # Source: rpc.proto for package 'lnrpc'
3
+
4
+ require 'grpc'
5
+ require_relative 'rpc_pb'
6
+
7
+ module Lnrpc
8
+ module WalletUnlocker
9
+ # The WalletUnlocker service is used to set up a wallet password for
10
+ # lnd at first startup, and unlock a previously set up wallet.
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 = 'lnrpc.WalletUnlocker'
18
+
19
+ # *
20
+ # GenSeed is the first method that should be used to instantiate a new lnd
21
+ # instance. This method allows a caller to generate a new aezeed cipher seed
22
+ # given an optional passphrase. If provided, the passphrase will be necessary
23
+ # to decrypt the cipherseed to expose the internal wallet seed.
24
+ #
25
+ # Once the cipherseed is obtained and verified by the user, the InitWallet
26
+ # method should be used to commit the newly generated seed, and create the
27
+ # wallet.
28
+ rpc :GenSeed, GenSeedRequest, GenSeedResponse
29
+ # *
30
+ # InitWallet is used when lnd is starting up for the first time to fully
31
+ # initialize the daemon and its internal wallet. At the very least a wallet
32
+ # password must be provided. This will be used to encrypt sensitive material
33
+ # on disk.
34
+ #
35
+ # In the case of a recovery scenario, the user can also specify their aezeed
36
+ # mnemonic and passphrase. If set, then the daemon will use this prior state
37
+ # to initialize its internal wallet.
38
+ #
39
+ # Alternatively, this can be used along with the GenSeed RPC to obtain a
40
+ # seed, then present it to the user. Once it has been verified by the user,
41
+ # the seed can be fed into this RPC in order to commit the new wallet.
42
+ rpc :InitWallet, InitWalletRequest, InitWalletResponse
43
+ # * lncli: `unlock`
44
+ # UnlockWallet is used at startup of lnd to provide a password to unlock
45
+ # the wallet database.
46
+ rpc :UnlockWallet, UnlockWalletRequest, UnlockWalletResponse
47
+ # * lncli: `changepassword`
48
+ # ChangePassword changes the password of the encrypted wallet. This will
49
+ # automatically unlock the wallet database if successful.
50
+ rpc :ChangePassword, ChangePasswordRequest, ChangePasswordResponse
51
+ end
52
+
53
+ Stub = Service.rpc_stub_class
54
+ end
55
+ module Lightning
56
+ class Service
57
+
58
+ include GRPC::GenericService
59
+
60
+ self.marshal_class_method = :encode
61
+ self.unmarshal_class_method = :decode
62
+ self.service_name = 'lnrpc.Lightning'
63
+
64
+ # * lncli: `walletbalance`
65
+ # WalletBalance returns total unspent outputs(confirmed and unconfirmed), all
66
+ # confirmed unspent outputs and all unconfirmed unspent outputs under control
67
+ # of the wallet.
68
+ rpc :WalletBalance, WalletBalanceRequest, WalletBalanceResponse
69
+ # * lncli: `channelbalance`
70
+ # ChannelBalance returns the total funds available across all open channels
71
+ # in satoshis.
72
+ rpc :ChannelBalance, ChannelBalanceRequest, ChannelBalanceResponse
73
+ # * lncli: `listchaintxns`
74
+ # GetTransactions returns a list describing all the known transactions
75
+ # relevant to the wallet.
76
+ rpc :GetTransactions, GetTransactionsRequest, TransactionDetails
77
+ # * lncli: `sendcoins`
78
+ # SendCoins executes a request to send coins to a particular address. Unlike
79
+ # SendMany, this RPC call only allows creating a single output at a time. If
80
+ # neither target_conf, or sat_per_byte are set, then the internal wallet will
81
+ # consult its fee model to determine a fee for the default confirmation
82
+ # target.
83
+ rpc :SendCoins, SendCoinsRequest, SendCoinsResponse
84
+ # *
85
+ # SubscribeTransactions creates a uni-directional stream from the server to
86
+ # the client in which any newly discovered transactions relevant to the
87
+ # wallet are sent over.
88
+ rpc :SubscribeTransactions, GetTransactionsRequest, stream(Transaction)
89
+ # * lncli: `sendmany`
90
+ # SendMany handles a request for a transaction that creates multiple specified
91
+ # outputs in parallel. If neither target_conf, or sat_per_byte are set, then
92
+ # the internal wallet will consult its fee model to determine a fee for the
93
+ # default confirmation target.
94
+ rpc :SendMany, SendManyRequest, SendManyResponse
95
+ # * lncli: `newaddress`
96
+ # NewAddress creates a new address under control of the local wallet.
97
+ rpc :NewAddress, NewAddressRequest, NewAddressResponse
98
+ # * lncli: `signmessage`
99
+ # SignMessage signs a message with this node's private key. The returned
100
+ # signature string is `zbase32` encoded and pubkey recoverable, meaning that
101
+ # only the message digest and signature are needed for verification.
102
+ rpc :SignMessage, SignMessageRequest, SignMessageResponse
103
+ # * lncli: `verifymessage`
104
+ # VerifyMessage verifies a signature over a msg. The signature must be
105
+ # zbase32 encoded and signed by an active node in the resident node's
106
+ # channel database. In addition to returning the validity of the signature,
107
+ # VerifyMessage also returns the recovered pubkey from the signature.
108
+ rpc :VerifyMessage, VerifyMessageRequest, VerifyMessageResponse
109
+ # * lncli: `connect`
110
+ # ConnectPeer attempts to establish a connection to a remote peer. This is at
111
+ # the networking level, and is used for communication between nodes. This is
112
+ # distinct from establishing a channel with a peer.
113
+ rpc :ConnectPeer, ConnectPeerRequest, ConnectPeerResponse
114
+ # * lncli: `disconnect`
115
+ # DisconnectPeer attempts to disconnect one peer from another identified by a
116
+ # given pubKey. In the case that we currently have a pending or active channel
117
+ # with the target peer, then this action will be not be allowed.
118
+ rpc :DisconnectPeer, DisconnectPeerRequest, DisconnectPeerResponse
119
+ # * lncli: `listpeers`
120
+ # ListPeers returns a verbose listing of all currently active peers.
121
+ rpc :ListPeers, ListPeersRequest, ListPeersResponse
122
+ # * lncli: `getinfo`
123
+ # GetInfo returns general information concerning the lightning node including
124
+ # it's identity pubkey, alias, the chains it is connected to, and information
125
+ # concerning the number of open+pending channels.
126
+ rpc :GetInfo, GetInfoRequest, GetInfoResponse
127
+ # TODO(roasbeef): merge with below with bool?
128
+ #
129
+ # * lncli: `pendingchannels`
130
+ # PendingChannels returns a list of all the channels that are currently
131
+ # considered "pending". A channel is pending if it has finished the funding
132
+ # workflow and is waiting for confirmations for the funding txn, or is in the
133
+ # process of closure, either initiated cooperatively or non-cooperatively.
134
+ rpc :PendingChannels, PendingChannelsRequest, PendingChannelsResponse
135
+ # * lncli: `listchannels`
136
+ # ListChannels returns a description of all the open channels that this node
137
+ # is a participant in.
138
+ rpc :ListChannels, ListChannelsRequest, ListChannelsResponse
139
+ # * lncli: `closedchannels`
140
+ # ClosedChannels returns a description of all the closed channels that
141
+ # this node was a participant in.
142
+ rpc :ClosedChannels, ClosedChannelsRequest, ClosedChannelsResponse
143
+ # *
144
+ # OpenChannelSync is a synchronous version of the OpenChannel RPC call. This
145
+ # call is meant to be consumed by clients to the REST proxy. As with all
146
+ # other sync calls, all byte slices are intended to be populated as hex
147
+ # encoded strings.
148
+ rpc :OpenChannelSync, OpenChannelRequest, ChannelPoint
149
+ # * lncli: `openchannel`
150
+ # OpenChannel attempts to open a singly funded channel specified in the
151
+ # request to a remote peer. Users are able to specify a target number of
152
+ # blocks that the funding transaction should be confirmed in, or a manual fee
153
+ # rate to us for the funding transaction. If neither are specified, then a
154
+ # lax block confirmation target is used.
155
+ rpc :OpenChannel, OpenChannelRequest, stream(OpenStatusUpdate)
156
+ # * lncli: `closechannel`
157
+ # CloseChannel attempts to close an active channel identified by its channel
158
+ # outpoint (ChannelPoint). The actions of this method can additionally be
159
+ # augmented to attempt a force close after a timeout period in the case of an
160
+ # inactive peer. If a non-force close (cooperative closure) is requested,
161
+ # then the user can specify either a target number of blocks until the
162
+ # closure transaction is confirmed, or a manual fee rate. If neither are
163
+ # specified, then a default lax, block confirmation target is used.
164
+ rpc :CloseChannel, CloseChannelRequest, stream(CloseStatusUpdate)
165
+ # * lncli: `abandonchannel`
166
+ # AbandonChannel removes all channel state from the database except for a
167
+ # close summary. This method can be used to get rid of permanently unusable
168
+ # channels due to bugs fixed in newer versions of lnd. Only available
169
+ # when in debug builds of lnd.
170
+ rpc :AbandonChannel, AbandonChannelRequest, AbandonChannelResponse
171
+ # * lncli: `sendpayment`
172
+ # SendPayment dispatches a bi-directional streaming RPC for sending payments
173
+ # through the Lightning Network. A single RPC invocation creates a persistent
174
+ # bi-directional stream allowing clients to rapidly send payments through the
175
+ # Lightning Network with a single persistent connection.
176
+ rpc :SendPayment, stream(SendRequest), stream(SendResponse)
177
+ # *
178
+ # SendPaymentSync is the synchronous non-streaming version of SendPayment.
179
+ # This RPC is intended to be consumed by clients of the REST proxy.
180
+ # Additionally, this RPC expects the destination's public key and the payment
181
+ # hash (if any) to be encoded as hex strings.
182
+ rpc :SendPaymentSync, SendRequest, SendResponse
183
+ # * lncli: `sendtoroute`
184
+ # SendToRoute is a bi-directional streaming RPC for sending payment through
185
+ # the Lightning Network. This method differs from SendPayment in that it
186
+ # allows users to specify a full route manually. This can be used for things
187
+ # like rebalancing, and atomic swaps.
188
+ rpc :SendToRoute, stream(SendToRouteRequest), stream(SendResponse)
189
+ # *
190
+ # SendToRouteSync is a synchronous version of SendToRoute. It Will block
191
+ # until the payment either fails or succeeds.
192
+ rpc :SendToRouteSync, SendToRouteRequest, SendResponse
193
+ # * lncli: `addinvoice`
194
+ # AddInvoice attempts to add a new invoice to the invoice database. Any
195
+ # duplicated invoices are rejected, therefore all invoices *must* have a
196
+ # unique payment preimage.
197
+ rpc :AddInvoice, Invoice, AddInvoiceResponse
198
+ # * lncli: `listinvoices`
199
+ # ListInvoices returns a list of all the invoices currently stored within the
200
+ # database. Any active debug invoices are ignored. It has full support for
201
+ # paginated responses, allowing users to query for specific invoices through
202
+ # their add_index. This can be done by using either the first_index_offset or
203
+ # last_index_offset fields included in the response as the index_offset of the
204
+ # next request. The reversed flag is set by default in order to paginate
205
+ # backwards. If you wish to paginate forwards, you must explicitly set the
206
+ # flag to false. If none of the parameters are specified, then the last 100
207
+ # invoices will be returned.
208
+ rpc :ListInvoices, ListInvoiceRequest, ListInvoiceResponse
209
+ # * lncli: `lookupinvoice`
210
+ # LookupInvoice attempts to look up an invoice according to its payment hash.
211
+ # The passed payment hash *must* be exactly 32 bytes, if not, an error is
212
+ # returned.
213
+ rpc :LookupInvoice, PaymentHash, Invoice
214
+ # *
215
+ # SubscribeInvoices returns a uni-directional stream (server -> client) for
216
+ # notifying the client of newly added/settled invoices. The caller can
217
+ # optionally specify the add_index and/or the settle_index. If the add_index
218
+ # is specified, then we'll first start by sending add invoice events for all
219
+ # invoices with an add_index greater than the specified value. If the
220
+ # settle_index is specified, the next, we'll send out all settle events for
221
+ # invoices with a settle_index greater than the specified value. One or both
222
+ # of these fields can be set. If no fields are set, then we'll only send out
223
+ # the latest add/settle events.
224
+ rpc :SubscribeInvoices, InvoiceSubscription, stream(Invoice)
225
+ # * lncli: `decodepayreq`
226
+ # DecodePayReq takes an encoded payment request string and attempts to decode
227
+ # it, returning a full description of the conditions encoded within the
228
+ # payment request.
229
+ rpc :DecodePayReq, PayReqString, PayReq
230
+ # * lncli: `listpayments`
231
+ # ListPayments returns a list of all outgoing payments.
232
+ rpc :ListPayments, ListPaymentsRequest, ListPaymentsResponse
233
+ # *
234
+ # DeleteAllPayments deletes all outgoing payments from DB.
235
+ rpc :DeleteAllPayments, DeleteAllPaymentsRequest, DeleteAllPaymentsResponse
236
+ # * lncli: `describegraph`
237
+ # DescribeGraph returns a description of the latest graph state from the
238
+ # point of view of the node. The graph information is partitioned into two
239
+ # components: all the nodes/vertexes, and all the edges that connect the
240
+ # vertexes themselves. As this is a directed graph, the edges also contain
241
+ # the node directional specific routing policy which includes: the time lock
242
+ # delta, fee information, etc.
243
+ rpc :DescribeGraph, ChannelGraphRequest, ChannelGraph
244
+ # * lncli: `getchaninfo`
245
+ # GetChanInfo returns the latest authenticated network announcement for the
246
+ # given channel identified by its channel ID: an 8-byte integer which
247
+ # uniquely identifies the location of transaction's funding output within the
248
+ # blockchain.
249
+ rpc :GetChanInfo, ChanInfoRequest, ChannelEdge
250
+ # * lncli: `getnodeinfo`
251
+ # GetNodeInfo returns the latest advertised, aggregated, and authenticated
252
+ # channel information for the specified node identified by its public key.
253
+ rpc :GetNodeInfo, NodeInfoRequest, NodeInfo
254
+ # * lncli: `queryroutes`
255
+ # QueryRoutes attempts to query the daemon's Channel Router for a possible
256
+ # route to a target destination capable of carrying a specific amount of
257
+ # satoshis. The retuned route contains the full details required to craft and
258
+ # send an HTLC, also including the necessary information that should be
259
+ # present within the Sphinx packet encapsulated within the HTLC.
260
+ rpc :QueryRoutes, QueryRoutesRequest, QueryRoutesResponse
261
+ # * lncli: `getnetworkinfo`
262
+ # GetNetworkInfo returns some basic stats about the known channel graph from
263
+ # the point of view of the node.
264
+ rpc :GetNetworkInfo, NetworkInfoRequest, NetworkInfo
265
+ # * lncli: `stop`
266
+ # StopDaemon will send a shutdown request to the interrupt handler, triggering
267
+ # a graceful shutdown of the daemon.
268
+ rpc :StopDaemon, StopRequest, StopResponse
269
+ # *
270
+ # SubscribeChannelGraph launches a streaming RPC that allows the caller to
271
+ # receive notifications upon any changes to the channel graph topology from
272
+ # the point of view of the responding node. Events notified include: new
273
+ # nodes coming online, nodes updating their authenticated attributes, new
274
+ # channels being advertised, updates in the routing policy for a directional
275
+ # channel edge, and when channels are closed on-chain.
276
+ rpc :SubscribeChannelGraph, GraphTopologySubscription, stream(GraphTopologyUpdate)
277
+ # * lncli: `debuglevel`
278
+ # DebugLevel allows a caller to programmatically set the logging verbosity of
279
+ # lnd. The logging can be targeted according to a coarse daemon-wide logging
280
+ # level, or in a granular fashion to specify the logging for a target
281
+ # sub-system.
282
+ rpc :DebugLevel, DebugLevelRequest, DebugLevelResponse
283
+ # * lncli: `feereport`
284
+ # FeeReport allows the caller to obtain a report detailing the current fee
285
+ # schedule enforced by the node globally for each channel.
286
+ rpc :FeeReport, FeeReportRequest, FeeReportResponse
287
+ # * lncli: `updatechanpolicy`
288
+ # UpdateChannelPolicy allows the caller to update the fee schedule and
289
+ # channel policies for all channels globally, or a particular channel.
290
+ rpc :UpdateChannelPolicy, PolicyUpdateRequest, PolicyUpdateResponse
291
+ # * lncli: `fwdinghistory`
292
+ # ForwardingHistory allows the caller to query the htlcswitch for a record of
293
+ # all HTLC's forwarded within the target time range, and integer offset
294
+ # within that time range. If no time-range is specified, then the first chunk
295
+ # of the past 24 hrs of forwarding history are returned.
296
+ #
297
+ # A list of forwarding events are returned. The size of each forwarding event
298
+ # is 40 bytes, and the max message size able to be returned in gRPC is 4 MiB.
299
+ # As a result each message can only contain 50k entries. Each response has
300
+ # the index offset of the last entry. The index offset can be provided to the
301
+ # request to allow the caller to skip a series of records.
302
+ rpc :ForwardingHistory, ForwardingHistoryRequest, ForwardingHistoryResponse
303
+ end
304
+
305
+ Stub = Service.rpc_stub_class
306
+ end
307
+ end
@@ -0,0 +1,5 @@
1
+ module Rack
2
+ class Lightning
3
+ VERSION = "0.1.0"
4
+ end
5
+ end
@@ -0,0 +1,30 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path("../lib", __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require "rack/lightning/version"
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "rack-lightning"
8
+ spec.version = Rack::Lightning::VERSION
9
+ spec.authors = ["bumi"]
10
+ spec.email = ["hello@michaelbumann.com"]
11
+
12
+ spec.summary = %q{Rack middleware to request Bitcoin lightning payments}
13
+ spec.description = %q{Rack middleware that generates and validates paid lightning invoices}
14
+ spec.homepage = "https://github.com/bumi/rack-lightning"
15
+ spec.license = "MIT"
16
+
17
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
18
+ f.match(%r{^(test|spec|features)/})
19
+ end
20
+ spec.bindir = "exe"
21
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
22
+ spec.require_paths = ["lib"]
23
+
24
+ spec.add_development_dependency "bundler", "~> 1.15"
25
+ spec.add_development_dependency "rake", "~> 10.0"
26
+ spec.add_development_dependency "rspec", "~> 3.0"
27
+
28
+ spec.add_dependency "grpc", ">= 1.16.0"
29
+ spec.add_dependency "rack"
30
+ end
metadata ADDED
@@ -0,0 +1,129 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rack-lightning
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - bumi
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2018-11-21 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.15'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.15'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '3.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '3.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: grpc
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: 1.16.0
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: 1.16.0
69
+ - !ruby/object:Gem::Dependency
70
+ name: rack
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ description: Rack middleware that generates and validates paid lightning invoices
84
+ email:
85
+ - hello@michaelbumann.com
86
+ executables: []
87
+ extensions: []
88
+ extra_rdoc_files: []
89
+ files:
90
+ - ".gitignore"
91
+ - ".rspec"
92
+ - ".travis.yml"
93
+ - Gemfile
94
+ - LICENSE.txt
95
+ - README.md
96
+ - Rakefile
97
+ - bin/console
98
+ - bin/setup
99
+ - lib/rack/lightning.rb
100
+ - lib/rack/lightning/rpc.proto
101
+ - lib/rack/lightning/rpc_pb.rb
102
+ - lib/rack/lightning/rpc_services_pb.rb
103
+ - lib/rack/lightning/version.rb
104
+ - rack-lightning.gemspec
105
+ homepage: https://github.com/bumi/rack-lightning
106
+ licenses:
107
+ - MIT
108
+ metadata: {}
109
+ post_install_message:
110
+ rdoc_options: []
111
+ require_paths:
112
+ - lib
113
+ required_ruby_version: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ required_rubygems_version: !ruby/object:Gem::Requirement
119
+ requirements:
120
+ - - ">="
121
+ - !ruby/object:Gem::Version
122
+ version: '0'
123
+ requirements: []
124
+ rubyforge_project:
125
+ rubygems_version: 2.6.11
126
+ signing_key:
127
+ specification_version: 4
128
+ summary: Rack middleware to request Bitcoin lightning payments
129
+ test_files: []