From 669a0dff8085674a2fe7c24b169985ee6b91e25d Mon Sep 17 00:00:00 2001 From: Michael Bumann Date: Fri, 8 Feb 2019 06:51:42 +0100 Subject: [PATCH] hello lnd world --- .gitignore | 13 + .rspec | 3 + Gemfile | 6 + Gemfile.lock | 42 + LICENSE.txt | 21 + README.md | 39 + Rakefile | 6 + bin/console | 14 + bin/setup | 8 + lib/lnrpc.rb | 8 + lib/lnrpc/client.rb | 35 + lib/lnrpc/rpc.proto | 1967 ++++++++++++++++++++++++++++++++++ lib/lnrpc/rpc_pb.rb | 726 +++++++++++++ lib/lnrpc/rpc_services_pb.rb | 307 ++++++ lib/lnrpc/version.rb | 3 + lnrpc.gemspec | 31 + spec/lnrpc_spec.rb | 5 + spec/spec_helper.rb | 14 + 18 files changed, 3248 insertions(+) create mode 100644 .gitignore create mode 100644 .rspec create mode 100644 Gemfile create mode 100644 Gemfile.lock create mode 100644 LICENSE.txt create mode 100644 README.md create mode 100644 Rakefile create mode 100755 bin/console create mode 100755 bin/setup create mode 100644 lib/lnrpc.rb create mode 100644 lib/lnrpc/client.rb create mode 100644 lib/lnrpc/rpc.proto create mode 100644 lib/lnrpc/rpc_pb.rb create mode 100644 lib/lnrpc/rpc_services_pb.rb create mode 100644 lib/lnrpc/version.rb create mode 100644 lnrpc.gemspec create mode 100644 spec/lnrpc_spec.rb create mode 100644 spec/spec_helper.rb diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..7a6f5df --- /dev/null +++ b/.gitignore @@ -0,0 +1,13 @@ +/.bundle/ +/.yardoc +/_yardoc/ +/coverage/ +/doc/ +/pkg/ +/spec/reports/ +/tmp/ + +# rspec failure tracking +.rspec_status + +.ruby-version diff --git a/.rspec b/.rspec new file mode 100644 index 0000000..34c5164 --- /dev/null +++ b/.rspec @@ -0,0 +1,3 @@ +--format documentation +--color +--require spec_helper diff --git a/Gemfile b/Gemfile new file mode 100644 index 0000000..64ac2c7 --- /dev/null +++ b/Gemfile @@ -0,0 +1,6 @@ +source "https://rubygems.org" + +git_source(:github) {|repo_name| "https://github.com/#{repo_name}" } + +# Specify your gem's dependencies in lnrpc.gemspec +gemspec diff --git a/Gemfile.lock b/Gemfile.lock new file mode 100644 index 0000000..149e725 --- /dev/null +++ b/Gemfile.lock @@ -0,0 +1,42 @@ +PATH + remote: . + specs: + lnrpc (0.1.0) + grpc (>= 1.16.0) + +GEM + remote: https://rubygems.org/ + specs: + diff-lcs (1.3) + google-protobuf (3.6.1) + googleapis-common-protos-types (1.0.3) + google-protobuf (~> 3.0) + grpc (1.18.0) + google-protobuf (~> 3.1) + googleapis-common-protos-types (~> 1.0.0) + rake (10.5.0) + rspec (3.8.0) + rspec-core (~> 3.8.0) + rspec-expectations (~> 3.8.0) + rspec-mocks (~> 3.8.0) + rspec-core (3.8.0) + rspec-support (~> 3.8.0) + rspec-expectations (3.8.2) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.8.0) + rspec-mocks (3.8.0) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.8.0) + rspec-support (3.8.0) + +PLATFORMS + ruby + +DEPENDENCIES + bundler (~> 1.17) + lnrpc! + rake (~> 10.0) + rspec (~> 3.0) + +BUNDLED WITH + 1.17.2 diff --git a/LICENSE.txt b/LICENSE.txt new file mode 100644 index 0000000..6229669 --- /dev/null +++ b/LICENSE.txt @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2019 Michael Bumann + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..88aff88 --- /dev/null +++ b/README.md @@ -0,0 +1,39 @@ +# Lnrpc + +Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/lnrpc`. To experiment with that code, run `bin/console` for an interactive prompt. + +TODO: Delete this and the text above, and describe your gem + +## Installation + +Add this line to your application's Gemfile: + +```ruby +gem 'lnrpc' +``` + +And then execute: + + $ bundle + +Or install it yourself as: + + $ gem install lnrpc + +## Usage + +TODO: Write usage instructions here + +## Development + +After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment. + +To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org). + +## Contributing + +Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/lnrpc. + +## License + +The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT). diff --git a/Rakefile b/Rakefile new file mode 100644 index 0000000..b7e9ed5 --- /dev/null +++ b/Rakefile @@ -0,0 +1,6 @@ +require "bundler/gem_tasks" +require "rspec/core/rake_task" + +RSpec::Core::RakeTask.new(:spec) + +task :default => :spec diff --git a/bin/console b/bin/console new file mode 100755 index 0000000..e1844b9 --- /dev/null +++ b/bin/console @@ -0,0 +1,14 @@ +#!/usr/bin/env ruby + +require "bundler/setup" +require "lnrpc" + +# You can add fixtures and/or initialization code here to make experimenting +# with your gem easier. You can also use a different console, if you like. + +# (If you use this, don't forget to add pry to your Gemfile!) +# require "pry" +# Pry.start + +require "irb" +IRB.start(__FILE__) diff --git a/bin/setup b/bin/setup new file mode 100755 index 0000000..dce67d8 --- /dev/null +++ b/bin/setup @@ -0,0 +1,8 @@ +#!/usr/bin/env bash +set -euo pipefail +IFS=$'\n\t' +set -vx + +bundle install + +# Do any other automated setup that you need to do here diff --git a/lib/lnrpc.rb b/lib/lnrpc.rb new file mode 100644 index 0000000..c9c436a --- /dev/null +++ b/lib/lnrpc.rb @@ -0,0 +1,8 @@ +require "lnrpc/version" + +module Lnrpc + class Error < StandardError; end + autoload :WalletUnlocker, 'lnrpc/rpc_services_pb' + autoload :Lightning, 'lnrpc/rpc_services_pb' + autoload :Client, 'lnrpc/client' +end diff --git a/lib/lnrpc/client.rb b/lib/lnrpc/client.rb new file mode 100644 index 0000000..cf5f77f --- /dev/null +++ b/lib/lnrpc/client.rb @@ -0,0 +1,35 @@ +module Lnrpc + class Client + attr_accessor :address, :credentials, :macaroon, :grpc_client + + DEFAULT_ADDRESS = 'localhost:10009' + DEFAULT_CREDENTIALS_PATH = "~/.lnd/tls.cert" + DEFAULT_MACAROON_PATH = "~/.lnd/data/chain/bitcoin/testnet/admin.macaroon" + + def initialize(options) + self.address = options[:address] || DEFAULT_ADDRESS + + options[:credentials] ||= ::File.read(::File.expand_path(options[:credentials_path] || DEFAULT_CREDENTIALS_PATH)) + self.credentials = options[:credentials] + + options[:macaroon] ||= begin + macaroon_binary = ::File.read(::File.expand_path(options[:macaroon_path] || DEFAULT_MACAROON_PATH)) + macaroon_binary.each_byte.map { |b| b.to_s(16).rjust(2,'0') }.join + end + self.macaroon = options[:macaroon] + + self.grpc_client = Lnrpc::Lightning::Stub.new(self.address, GRPC::Core::ChannelCredentials.new(self.credentials)) + end + + def method_missing(m, *args, &block) + if args.last.is_a?(Hash) + args[-1][:metadata] ||= {} + args[-1][:metadata].merge!(macaroon: self.macaroon) + else + args.push({metadata: { macaroon: self.macaroon }}) + end + self.grpc_client.send(m, *args) + end + end +end + diff --git a/lib/lnrpc/rpc.proto b/lib/lnrpc/rpc.proto new file mode 100644 index 0000000..fbb05ef --- /dev/null +++ b/lib/lnrpc/rpc.proto @@ -0,0 +1,1967 @@ +syntax = "proto3"; + +import "google/api/annotations.proto"; + +package lnrpc; +/** + * Comments in this file will be directly parsed into the API + * Documentation as descriptions of the associated method, message, or field. + * These descriptions should go right above the definition of the object, and + * can be in either block or /// comment format. + * + * One edge case exists where a // comment followed by a /// comment in the + * next line will cause the description not to show up in the documentation. In + * that instance, simply separate the two comments with a blank line. + * + * An RPC method can be matched to an lncli command by placing a line in the + * beginning of the description in exactly the following format: + * lncli: `methodname` + * + * Failure to specify the exact name of the command will cause documentation + * generation to fail. + * + * More information on how exactly the gRPC documentation is generated from + * this proto file can be found here: + * https://github.com/lightninglabs/lightning-api + */ + +// The WalletUnlocker service is used to set up a wallet password for +// lnd at first startup, and unlock a previously set up wallet. +service WalletUnlocker { + /** + GenSeed is the first method that should be used to instantiate a new lnd + instance. This method allows a caller to generate a new aezeed cipher seed + given an optional passphrase. If provided, the passphrase will be necessary + to decrypt the cipherseed to expose the internal wallet seed. + + Once the cipherseed is obtained and verified by the user, the InitWallet + method should be used to commit the newly generated seed, and create the + wallet. + */ + rpc GenSeed(GenSeedRequest) returns (GenSeedResponse) { + option (google.api.http) = { + get: "/v1/genseed" + }; + } + + /** + InitWallet is used when lnd is starting up for the first time to fully + initialize the daemon and its internal wallet. At the very least a wallet + password must be provided. This will be used to encrypt sensitive material + on disk. + + In the case of a recovery scenario, the user can also specify their aezeed + mnemonic and passphrase. If set, then the daemon will use this prior state + to initialize its internal wallet. + + Alternatively, this can be used along with the GenSeed RPC to obtain a + seed, then present it to the user. Once it has been verified by the user, + the seed can be fed into this RPC in order to commit the new wallet. + */ + rpc InitWallet(InitWalletRequest) returns (InitWalletResponse) { + option (google.api.http) = { + post: "/v1/initwallet" + body: "*" + }; + } + + /** lncli: `unlock` + UnlockWallet is used at startup of lnd to provide a password to unlock + the wallet database. + */ + rpc UnlockWallet(UnlockWalletRequest) returns (UnlockWalletResponse) { + option (google.api.http) = { + post: "/v1/unlockwallet" + body: "*" + }; + } + + /** lncli: `changepassword` + ChangePassword changes the password of the encrypted wallet. This will + automatically unlock the wallet database if successful. + */ + rpc ChangePassword (ChangePasswordRequest) returns (ChangePasswordResponse) { + option (google.api.http) = { + post: "/v1/changepassword" + body: "*" + }; + } +} + +message GenSeedRequest { + /** + aezeed_passphrase is an optional user provided passphrase that will be used + to encrypt the generated aezeed cipher seed. + */ + bytes aezeed_passphrase = 1; + + /** + seed_entropy is an optional 16-bytes generated via CSPRNG. If not + specified, then a fresh set of randomness will be used to create the seed. + */ + bytes seed_entropy = 2; +} +message GenSeedResponse { + /** + cipher_seed_mnemonic is a 24-word mnemonic that encodes a prior aezeed + cipher seed obtained by the user. This field is optional, as if not + provided, then the daemon will generate a new cipher seed for the user. + Otherwise, then the daemon will attempt to recover the wallet state linked + to this cipher seed. + */ + repeated string cipher_seed_mnemonic = 1; + + /** + enciphered_seed are the raw aezeed cipher seed bytes. This is the raw + cipher text before run through our mnemonic encoding scheme. + */ + bytes enciphered_seed = 2; +} + +message InitWalletRequest { + /** + wallet_password is the passphrase that should be used to encrypt the + wallet. This MUST be at least 8 chars in length. After creation, this + password is required to unlock the daemon. + */ + bytes wallet_password = 1; + + /** + cipher_seed_mnemonic is a 24-word mnemonic that encodes a prior aezeed + cipher seed obtained by the user. This may have been generated by the + GenSeed method, or be an existing seed. + */ + repeated string cipher_seed_mnemonic = 2; + + /** + aezeed_passphrase is an optional user provided passphrase that will be used + to encrypt the generated aezeed cipher seed. + */ + bytes aezeed_passphrase = 3; + + /** + recovery_window is an optional argument specifying the address lookahead + when restoring a wallet seed. The recovery window applies to each + invdividual branch of the BIP44 derivation paths. Supplying a recovery + window of zero indicates that no addresses should be recovered, such after + the first initialization of the wallet. + */ + int32 recovery_window = 4; +} +message InitWalletResponse { +} + +message UnlockWalletRequest { + /** + wallet_password should be the current valid passphrase for the daemon. This + will be required to decrypt on-disk material that the daemon requires to + function properly. + */ + bytes wallet_password = 1; + + /** + recovery_window is an optional argument specifying the address lookahead + when restoring a wallet seed. The recovery window applies to each + invdividual branch of the BIP44 derivation paths. Supplying a recovery + window of zero indicates that no addresses should be recovered, such after + the first initialization of the wallet. + */ + int32 recovery_window = 2; +} +message UnlockWalletResponse {} + +message ChangePasswordRequest { + /** + current_password should be the current valid passphrase used to unlock the + daemon. + */ + bytes current_password = 1; + + /** + new_password should be the new passphrase that will be needed to unlock the + daemon. + */ + bytes new_password = 2; +} +message ChangePasswordResponse {} + +service Lightning { + /** lncli: `walletbalance` + WalletBalance returns total unspent outputs(confirmed and unconfirmed), all + confirmed unspent outputs and all unconfirmed unspent outputs under control + of the wallet. + */ + rpc WalletBalance (WalletBalanceRequest) returns (WalletBalanceResponse) { + option (google.api.http) = { + get: "/v1/balance/blockchain" + }; + } + + /** lncli: `channelbalance` + ChannelBalance returns the total funds available across all open channels + in satoshis. + */ + rpc ChannelBalance (ChannelBalanceRequest) returns (ChannelBalanceResponse) { + option (google.api.http) = { + get: "/v1/balance/channels" + }; + } + + /** lncli: `listchaintxns` + GetTransactions returns a list describing all the known transactions + relevant to the wallet. + */ + rpc GetTransactions (GetTransactionsRequest) returns (TransactionDetails) { + option (google.api.http) = { + get: "/v1/transactions" + }; + } + + /** lncli: `sendcoins` + SendCoins executes a request to send coins to a particular address. Unlike + SendMany, this RPC call only allows creating a single output at a time. If + neither target_conf, or sat_per_byte are set, then the internal wallet will + consult its fee model to determine a fee for the default confirmation + target. + */ + rpc SendCoins (SendCoinsRequest) returns (SendCoinsResponse) { + option (google.api.http) = { + post: "/v1/transactions" + body: "*" + }; + } + + /** + SubscribeTransactions creates a uni-directional stream from the server to + the client in which any newly discovered transactions relevant to the + wallet are sent over. + */ + rpc SubscribeTransactions (GetTransactionsRequest) returns (stream Transaction); + + /** lncli: `sendmany` + SendMany handles a request for a transaction that creates multiple specified + outputs in parallel. If neither target_conf, or sat_per_byte are set, then + the internal wallet will consult its fee model to determine a fee for the + default confirmation target. + */ + rpc SendMany (SendManyRequest) returns (SendManyResponse); + + /** lncli: `newaddress` + NewAddress creates a new address under control of the local wallet. + */ + rpc NewAddress (NewAddressRequest) returns (NewAddressResponse) { + option (google.api.http) = { + get: "/v1/newaddress" + }; + } + + /** lncli: `signmessage` + SignMessage signs a message with this node's private key. The returned + signature string is `zbase32` encoded and pubkey recoverable, meaning that + only the message digest and signature are needed for verification. + */ + rpc SignMessage (SignMessageRequest) returns (SignMessageResponse); + + /** lncli: `verifymessage` + VerifyMessage verifies a signature over a msg. The signature must be + zbase32 encoded and signed by an active node in the resident node's + channel database. In addition to returning the validity of the signature, + VerifyMessage also returns the recovered pubkey from the signature. + */ + rpc VerifyMessage (VerifyMessageRequest) returns (VerifyMessageResponse); + + /** lncli: `connect` + ConnectPeer attempts to establish a connection to a remote peer. This is at + the networking level, and is used for communication between nodes. This is + distinct from establishing a channel with a peer. + */ + rpc ConnectPeer (ConnectPeerRequest) returns (ConnectPeerResponse) { + option (google.api.http) = { + post: "/v1/peers" + body: "*" + }; + } + + /** lncli: `disconnect` + DisconnectPeer attempts to disconnect one peer from another identified by a + given pubKey. In the case that we currently have a pending or active channel + with the target peer, then this action will be not be allowed. + */ + rpc DisconnectPeer (DisconnectPeerRequest) returns (DisconnectPeerResponse) { + option (google.api.http) = { + delete: "/v1/peers/{pub_key}" + }; + } + + /** lncli: `listpeers` + ListPeers returns a verbose listing of all currently active peers. + */ + rpc ListPeers (ListPeersRequest) returns (ListPeersResponse) { + option (google.api.http) = { + get: "/v1/peers" + }; + } + + /** lncli: `getinfo` + GetInfo returns general information concerning the lightning node including + it's identity pubkey, alias, the chains it is connected to, and information + concerning the number of open+pending channels. + */ + rpc GetInfo (GetInfoRequest) returns (GetInfoResponse) { + option (google.api.http) = { + get: "/v1/getinfo" + }; + } + + // TODO(roasbeef): merge with below with bool? + /** lncli: `pendingchannels` + PendingChannels returns a list of all the channels that are currently + considered "pending". A channel is pending if it has finished the funding + workflow and is waiting for confirmations for the funding txn, or is in the + process of closure, either initiated cooperatively or non-cooperatively. + */ + rpc PendingChannels (PendingChannelsRequest) returns (PendingChannelsResponse) { + option (google.api.http) = { + get: "/v1/channels/pending" + }; + } + + /** lncli: `listchannels` + ListChannels returns a description of all the open channels that this node + is a participant in. + */ + rpc ListChannels (ListChannelsRequest) returns (ListChannelsResponse) { + option (google.api.http) = { + get: "/v1/channels" + }; + } + + /** lncli: `closedchannels` + ClosedChannels returns a description of all the closed channels that + this node was a participant in. + */ + rpc ClosedChannels (ClosedChannelsRequest) returns (ClosedChannelsResponse) { + option (google.api.http) = { + get: "/v1/channels/closed" + }; + } + + + /** + OpenChannelSync is a synchronous version of the OpenChannel RPC call. This + call is meant to be consumed by clients to the REST proxy. As with all + other sync calls, all byte slices are intended to be populated as hex + encoded strings. + */ + rpc OpenChannelSync (OpenChannelRequest) returns (ChannelPoint) { + option (google.api.http) = { + post: "/v1/channels" + body: "*" + }; + } + + /** lncli: `openchannel` + OpenChannel attempts to open a singly funded channel specified in the + request to a remote peer. Users are able to specify a target number of + blocks that the funding transaction should be confirmed in, or a manual fee + rate to us for the funding transaction. If neither are specified, then a + lax block confirmation target is used. + */ + rpc OpenChannel (OpenChannelRequest) returns (stream OpenStatusUpdate); + + /** lncli: `closechannel` + CloseChannel attempts to close an active channel identified by its channel + outpoint (ChannelPoint). The actions of this method can additionally be + augmented to attempt a force close after a timeout period in the case of an + inactive peer. If a non-force close (cooperative closure) is requested, + then the user can specify either a target number of blocks until the + closure transaction is confirmed, or a manual fee rate. If neither are + specified, then a default lax, block confirmation target is used. + */ + rpc CloseChannel (CloseChannelRequest) returns (stream CloseStatusUpdate) { + option (google.api.http) = { + delete: "/v1/channels/{channel_point.funding_txid_str}/{channel_point.output_index}" + }; + } + + /** lncli: `abandonchannel` + AbandonChannel removes all channel state from the database except for a + close summary. This method can be used to get rid of permanently unusable + channels due to bugs fixed in newer versions of lnd. Only available + when in debug builds of lnd. + */ + rpc AbandonChannel (AbandonChannelRequest) returns (AbandonChannelResponse) { + option (google.api.http) = { + delete: "/v1/channels/{channel_point.funding_txid_str}/{channel_point.output_index}" + }; + } + + + /** lncli: `sendpayment` + SendPayment dispatches a bi-directional streaming RPC for sending payments + through the Lightning Network. A single RPC invocation creates a persistent + bi-directional stream allowing clients to rapidly send payments through the + Lightning Network with a single persistent connection. + */ + rpc SendPayment (stream SendRequest) returns (stream SendResponse); + + /** + SendPaymentSync is the synchronous non-streaming version of SendPayment. + This RPC is intended to be consumed by clients of the REST proxy. + Additionally, this RPC expects the destination's public key and the payment + hash (if any) to be encoded as hex strings. + */ + rpc SendPaymentSync (SendRequest) returns (SendResponse) { + option (google.api.http) = { + post: "/v1/channels/transactions" + body: "*" + }; + } + + /** lncli: `sendtoroute` + SendToRoute is a bi-directional streaming RPC for sending payment through + the Lightning Network. This method differs from SendPayment in that it + allows users to specify a full route manually. This can be used for things + like rebalancing, and atomic swaps. + */ + rpc SendToRoute(stream SendToRouteRequest) returns (stream SendResponse); + + /** + SendToRouteSync is a synchronous version of SendToRoute. It Will block + until the payment either fails or succeeds. + */ + rpc SendToRouteSync (SendToRouteRequest) returns (SendResponse) { + option (google.api.http) = { + post: "/v1/channels/transactions/route" + body: "*" + }; + } + + /** lncli: `addinvoice` + AddInvoice attempts to add a new invoice to the invoice database. Any + duplicated invoices are rejected, therefore all invoices *must* have a + unique payment preimage. + */ + rpc AddInvoice (Invoice) returns (AddInvoiceResponse) { + option (google.api.http) = { + post: "/v1/invoices" + body: "*" + }; + } + + /** lncli: `listinvoices` + ListInvoices returns a list of all the invoices currently stored within the + database. Any active debug invoices are ignored. It has full support for + paginated responses, allowing users to query for specific invoices through + their add_index. This can be done by using either the first_index_offset or + last_index_offset fields included in the response as the index_offset of the + next request. The reversed flag is set by default in order to paginate + backwards. If you wish to paginate forwards, you must explicitly set the + flag to false. If none of the parameters are specified, then the last 100 + invoices will be returned. + */ + rpc ListInvoices (ListInvoiceRequest) returns (ListInvoiceResponse) { + option (google.api.http) = { + get: "/v1/invoices" + }; + } + + /** lncli: `lookupinvoice` + LookupInvoice attempts to look up an invoice according to its payment hash. + The passed payment hash *must* be exactly 32 bytes, if not, an error is + returned. + */ + rpc LookupInvoice (PaymentHash) returns (Invoice) { + option (google.api.http) = { + get: "/v1/invoice/{r_hash_str}" + }; + } + + /** + SubscribeInvoices returns a uni-directional stream (server -> client) for + notifying the client of newly added/settled invoices. The caller can + optionally specify the add_index and/or the settle_index. If the add_index + is specified, then we'll first start by sending add invoice events for all + invoices with an add_index greater than the specified value. If the + settle_index is specified, the next, we'll send out all settle events for + invoices with a settle_index greater than the specified value. One or both + of these fields can be set. If no fields are set, then we'll only send out + the latest add/settle events. + */ + rpc SubscribeInvoices (InvoiceSubscription) returns (stream Invoice) { + option (google.api.http) = { + get: "/v1/invoices/subscribe" + }; + } + + /** lncli: `decodepayreq` + DecodePayReq takes an encoded payment request string and attempts to decode + it, returning a full description of the conditions encoded within the + payment request. + */ + rpc DecodePayReq (PayReqString) returns (PayReq) { + option (google.api.http) = { + get: "/v1/payreq/{pay_req}" + }; + } + + /** lncli: `listpayments` + ListPayments returns a list of all outgoing payments. + */ + rpc ListPayments (ListPaymentsRequest) returns (ListPaymentsResponse) { + option (google.api.http) = { + get: "/v1/payments" + }; + }; + + /** + DeleteAllPayments deletes all outgoing payments from DB. + */ + rpc DeleteAllPayments (DeleteAllPaymentsRequest) returns (DeleteAllPaymentsResponse) { + option (google.api.http) = { + delete: "/v1/payments" + }; + }; + + /** lncli: `describegraph` + DescribeGraph returns a description of the latest graph state from the + point of view of the node. The graph information is partitioned into two + components: all the nodes/vertexes, and all the edges that connect the + vertexes themselves. As this is a directed graph, the edges also contain + the node directional specific routing policy which includes: the time lock + delta, fee information, etc. + */ + rpc DescribeGraph (ChannelGraphRequest) returns (ChannelGraph) { + option (google.api.http) = { + get: "/v1/graph" + }; + } + + /** lncli: `getchaninfo` + GetChanInfo returns the latest authenticated network announcement for the + given channel identified by its channel ID: an 8-byte integer which + uniquely identifies the location of transaction's funding output within the + blockchain. + */ + rpc GetChanInfo (ChanInfoRequest) returns (ChannelEdge) { + option (google.api.http) = { + get: "/v1/graph/edge/{chan_id}" + }; + } + + /** lncli: `getnodeinfo` + GetNodeInfo returns the latest advertised, aggregated, and authenticated + channel information for the specified node identified by its public key. + */ + rpc GetNodeInfo (NodeInfoRequest) returns (NodeInfo) { + option (google.api.http) = { + get: "/v1/graph/node/{pub_key}" + }; + } + + /** lncli: `queryroutes` + QueryRoutes attempts to query the daemon's Channel Router for a possible + route to a target destination capable of carrying a specific amount of + satoshis. The retuned route contains the full details required to craft and + send an HTLC, also including the necessary information that should be + present within the Sphinx packet encapsulated within the HTLC. + */ + rpc QueryRoutes(QueryRoutesRequest) returns (QueryRoutesResponse) { + option (google.api.http) = { + get: "/v1/graph/routes/{pub_key}/{amt}" + }; + } + + /** lncli: `getnetworkinfo` + GetNetworkInfo returns some basic stats about the known channel graph from + the point of view of the node. + */ + rpc GetNetworkInfo (NetworkInfoRequest) returns (NetworkInfo) { + option (google.api.http) = { + get: "/v1/graph/info" + }; + } + + /** lncli: `stop` + StopDaemon will send a shutdown request to the interrupt handler, triggering + a graceful shutdown of the daemon. + */ + rpc StopDaemon(StopRequest) returns (StopResponse); + + /** + SubscribeChannelGraph launches a streaming RPC that allows the caller to + receive notifications upon any changes to the channel graph topology from + the point of view of the responding node. Events notified include: new + nodes coming online, nodes updating their authenticated attributes, new + channels being advertised, updates in the routing policy for a directional + channel edge, and when channels are closed on-chain. + */ + rpc SubscribeChannelGraph(GraphTopologySubscription) returns (stream GraphTopologyUpdate); + + /** lncli: `debuglevel` + DebugLevel allows a caller to programmatically set the logging verbosity of + lnd. The logging can be targeted according to a coarse daemon-wide logging + level, or in a granular fashion to specify the logging for a target + sub-system. + */ + rpc DebugLevel (DebugLevelRequest) returns (DebugLevelResponse); + + /** lncli: `feereport` + FeeReport allows the caller to obtain a report detailing the current fee + schedule enforced by the node globally for each channel. + */ + rpc FeeReport(FeeReportRequest) returns (FeeReportResponse) { + option (google.api.http) = { + get: "/v1/fees" + }; + } + + /** lncli: `updatechanpolicy` + UpdateChannelPolicy allows the caller to update the fee schedule and + channel policies for all channels globally, or a particular channel. + */ + rpc UpdateChannelPolicy(PolicyUpdateRequest) returns (PolicyUpdateResponse) { + option (google.api.http) = { + post: "/v1/chanpolicy" + body: "*" + }; + } + + /** lncli: `fwdinghistory` + ForwardingHistory allows the caller to query the htlcswitch for a record of + all HTLC's forwarded within the target time range, and integer offset + within that time range. If no time-range is specified, then the first chunk + of the past 24 hrs of forwarding history are returned. + + A list of forwarding events are returned. The size of each forwarding event + is 40 bytes, and the max message size able to be returned in gRPC is 4 MiB. + As a result each message can only contain 50k entries. Each response has + the index offset of the last entry. The index offset can be provided to the + request to allow the caller to skip a series of records. + */ + rpc ForwardingHistory(ForwardingHistoryRequest) returns (ForwardingHistoryResponse) { + option (google.api.http) = { + post: "/v1/switch" + body: "*" + }; + }; +} + +message Transaction { + /// The transaction hash + string tx_hash = 1 [ json_name = "tx_hash" ]; + + /// The transaction amount, denominated in satoshis + int64 amount = 2 [ json_name = "amount" ]; + + /// The number of confirmations + int32 num_confirmations = 3 [ json_name = "num_confirmations" ]; + + /// The hash of the block this transaction was included in + string block_hash = 4 [ json_name = "block_hash" ]; + + /// The height of the block this transaction was included in + int32 block_height = 5 [ json_name = "block_height" ]; + + /// Timestamp of this transaction + int64 time_stamp = 6 [ json_name = "time_stamp" ]; + + /// Fees paid for this transaction + int64 total_fees = 7 [ json_name = "total_fees" ]; + + /// Addresses that received funds for this transaction + repeated string dest_addresses = 8 [ json_name = "dest_addresses" ]; +} +message GetTransactionsRequest { +} +message TransactionDetails { + /// The list of transactions relevant to the wallet. + repeated Transaction transactions = 1 [json_name = "transactions"]; +} + +message FeeLimit { + oneof limit { + /// The fee limit expressed as a fixed amount of satoshis. + int64 fixed = 1; + + /// The fee limit expressed as a percentage of the payment amount. + int64 percent = 2; + } +} + +message SendRequest { + /// The identity pubkey of the payment recipient + bytes dest = 1; + + /// The hex-encoded identity pubkey of the payment recipient + string dest_string = 2; + + /// Number of satoshis to send. + int64 amt = 3; + + /// The hash to use within the payment's HTLC + bytes payment_hash = 4; + + /// The hex-encoded hash to use within the payment's HTLC + string payment_hash_string = 5; + + /** + A bare-bones invoice for a payment within the Lightning Network. With the + details of the invoice, the sender has all the data necessary to send a + payment to the recipient. + */ + string payment_request = 6; + + /** + The CLTV delta from the current height that should be used to set the + timelock for the final hop. + */ + int32 final_cltv_delta = 7; + + /** + The maximum number of satoshis that will be paid as a fee of the payment. + This value can be represented either as a percentage of the amount being + sent, or as a fixed amount of the maximum fee the user is willing the pay to + send the payment. + */ + FeeLimit fee_limit = 8; +} +message SendResponse { + string payment_error = 1 [json_name = "payment_error"]; + bytes payment_preimage = 2 [json_name = "payment_preimage"]; + Route payment_route = 3 [json_name = "payment_route"]; +} + +message SendToRouteRequest { + /// The payment hash to use for the HTLC. + bytes payment_hash = 1; + + /// An optional hex-encoded payment hash to be used for the HTLC. + string payment_hash_string = 2; + + /// The set of routes that should be used to attempt to complete the payment. + repeated Route routes = 3; +} + +message ChannelPoint { + oneof funding_txid { + /// Txid of the funding transaction + bytes funding_txid_bytes = 1 [json_name = "funding_txid_bytes"]; + + /// Hex-encoded string representing the funding transaction + string funding_txid_str = 2 [json_name = "funding_txid_str"]; + } + + /// The index of the output of the funding transaction + uint32 output_index = 3 [json_name = "output_index"]; +} + +message LightningAddress { + /// The identity pubkey of the Lightning node + string pubkey = 1 [json_name = "pubkey"]; + + /// The network location of the lightning node, e.g. `69.69.69.69:1337` or `localhost:10011` + string host = 2 [json_name = "host"]; +} + +message SendManyRequest { + /// The map from addresses to amounts + map AddrToAmount = 1; + + /// The target number of blocks that this transaction should be confirmed by. + int32 target_conf = 3; + + /// A manual fee rate set in sat/byte that should be used when crafting the transaction. + int64 sat_per_byte = 5; +} +message SendManyResponse { + /// The id of the transaction + string txid = 1 [json_name = "txid"]; +} + +message SendCoinsRequest { + /// The address to send coins to + string addr = 1; + + /// The amount in satoshis to send + int64 amount = 2; + + /// The target number of blocks that this transaction should be confirmed by. + int32 target_conf = 3; + + /// A manual fee rate set in sat/byte that should be used when crafting the transaction. + int64 sat_per_byte = 5; +} +message SendCoinsResponse { + /// The transaction ID of the transaction + string txid = 1 [json_name = "txid"]; +} + +/** +`AddressType` has to be one of: + +- `p2wkh`: Pay to witness key hash (`WITNESS_PUBKEY_HASH` = 0) +- `np2wkh`: Pay to nested witness key hash (`NESTED_PUBKEY_HASH` = 1) +*/ +message NewAddressRequest { + enum AddressType { + WITNESS_PUBKEY_HASH = 0; + NESTED_PUBKEY_HASH = 1; + } + + /// The address type + AddressType type = 1; +} +message NewAddressResponse { + /// The newly generated wallet address + string address = 1 [json_name = "address"]; +} + +message SignMessageRequest { + /// The message to be signed + bytes msg = 1 [ json_name = "msg" ]; +} +message SignMessageResponse { + /// The signature for the given message + string signature = 1 [ json_name = "signature" ]; +} + +message VerifyMessageRequest { + /// The message over which the signature is to be verified + bytes msg = 1 [ json_name = "msg" ]; + + /// The signature to be verified over the given message + string signature = 2 [ json_name = "signature" ]; +} +message VerifyMessageResponse { + /// Whether the signature was valid over the given message + bool valid = 1 [ json_name = "valid" ]; + + /// The pubkey recovered from the signature + string pubkey = 2 [ json_name = "pubkey" ]; +} + +message ConnectPeerRequest { + /// Lightning address of the peer, in the format `@host` + LightningAddress addr = 1; + + /** If set, the daemon will attempt to persistently connect to the target + * peer. Otherwise, the call will be synchronous. */ + bool perm = 2; +} +message ConnectPeerResponse { +} + +message DisconnectPeerRequest { + /// The pubkey of the node to disconnect from + string pub_key = 1 [json_name = "pub_key"]; +} +message DisconnectPeerResponse { +} + +message HTLC { + bool incoming = 1 [json_name = "incoming"]; + int64 amount = 2 [json_name = "amount"]; + bytes hash_lock = 3 [json_name = "hash_lock"]; + uint32 expiration_height = 4 [json_name = "expiration_height"]; +} + +message Channel { + /// Whether this channel is active or not + bool active = 1 [json_name = "active"]; + + /// The identity pubkey of the remote node + string remote_pubkey = 2 [json_name = "remote_pubkey"]; + + /** + The outpoint (txid:index) of the funding transaction. With this value, Bob + will be able to generate a signature for Alice's version of the commitment + transaction. + */ + string channel_point = 3 [json_name = "channel_point"]; + + /** + The unique channel ID for the channel. The first 3 bytes are the block + height, the next 3 the index within the block, and the last 2 bytes are the + output index for the channel. + */ + uint64 chan_id = 4 [json_name = "chan_id"]; + + /// The total amount of funds held in this channel + int64 capacity = 5 [json_name = "capacity"]; + + /// This node's current balance in this channel + int64 local_balance = 6 [json_name = "local_balance"]; + + /// The counterparty's current balance in this channel + int64 remote_balance = 7 [json_name = "remote_balance"]; + + /** + The amount calculated to be paid in fees for the current set of commitment + transactions. The fee amount is persisted with the channel in order to + allow the fee amount to be removed and recalculated with each channel state + update, including updates that happen after a system restart. + */ + int64 commit_fee = 8 [json_name = "commit_fee"]; + + /// The weight of the commitment transaction + int64 commit_weight = 9 [json_name = "commit_weight"]; + + /** + The required number of satoshis per kilo-weight that the requester will pay + at all times, for both the funding transaction and commitment transaction. + This value can later be updated once the channel is open. + */ + int64 fee_per_kw = 10 [json_name = "fee_per_kw"]; + + /// The unsettled balance in this channel + int64 unsettled_balance = 11 [json_name = "unsettled_balance"]; + + /** + The total number of satoshis we've sent within this channel. + */ + int64 total_satoshis_sent = 12 [json_name = "total_satoshis_sent"]; + + /** + The total number of satoshis we've received within this channel. + */ + int64 total_satoshis_received = 13 [json_name = "total_satoshis_received"]; + + /** + The total number of updates conducted within this channel. + */ + uint64 num_updates = 14 [json_name = "num_updates"]; + + /** + The list of active, uncleared HTLCs currently pending within the channel. + */ + repeated HTLC pending_htlcs = 15 [json_name = "pending_htlcs"]; + + /** + The CSV delay expressed in relative blocks. If the channel is force + closed, we'll need to wait for this many blocks before we can regain our + funds. + */ + uint32 csv_delay = 16 [json_name = "csv_delay"]; + + /// Whether this channel is advertised to the network or not + bool private = 17 [json_name = "private"]; +} + + +message ListChannelsRequest { + bool active_only = 1; + bool inactive_only = 2; + bool public_only = 3; + bool private_only = 4; +} +message ListChannelsResponse { + /// The list of active channels + repeated Channel channels = 11 [json_name = "channels"]; +} + +message ChannelCloseSummary { + /// The outpoint (txid:index) of the funding transaction. + string channel_point = 1 [json_name = "channel_point"]; + + /// The unique channel ID for the channel. + uint64 chan_id = 2 [json_name = "chan_id"]; + + /// The hash of the genesis block that this channel resides within. + string chain_hash = 3 [json_name = "chain_hash"]; + + /// The txid of the transaction which ultimately closed this channel. + string closing_tx_hash = 4 [json_name = "closing_tx_hash"]; + + /// Public key of the remote peer that we formerly had a channel with. + string remote_pubkey = 5 [json_name = "remote_pubkey"]; + + /// Total capacity of the channel. + int64 capacity = 6 [json_name = "capacity"]; + + /// Height at which the funding transaction was spent. + uint32 close_height = 7 [json_name = "close_height"]; + + /// Settled balance at the time of channel closure + int64 settled_balance = 8 [json_name = "settled_balance"]; + + /// The sum of all the time-locked outputs at the time of channel closure + int64 time_locked_balance = 9 [json_name = "time_locked_balance"]; + + enum ClosureType { + COOPERATIVE_CLOSE = 0; + LOCAL_FORCE_CLOSE = 1; + REMOTE_FORCE_CLOSE = 2; + BREACH_CLOSE = 3; + FUNDING_CANCELED = 4; + ABANDONED = 5; + } + + /// Details on how the channel was closed. + ClosureType close_type = 10 [json_name = "close_type"]; +} + +message ClosedChannelsRequest { + bool cooperative = 1; + bool local_force = 2; + bool remote_force = 3; + bool breach = 4; + bool funding_canceled = 5; + bool abandoned = 6; +} + +message ClosedChannelsResponse { + repeated ChannelCloseSummary channels = 1 [json_name = "channels"]; +} + +message Peer { + /// The identity pubkey of the peer + string pub_key = 1 [json_name = "pub_key"]; + + /// Network address of the peer; eg `127.0.0.1:10011` + string address = 3 [json_name = "address"]; + + /// Bytes of data transmitted to this peer + uint64 bytes_sent = 4 [json_name = "bytes_sent"]; + + /// Bytes of data transmitted from this peer + uint64 bytes_recv = 5 [json_name = "bytes_recv"]; + + /// Satoshis sent to this peer + int64 sat_sent = 6 [json_name = "sat_sent"]; + + /// Satoshis received from this peer + int64 sat_recv = 7 [json_name = "sat_recv"]; + + /// A channel is inbound if the counterparty initiated the channel + bool inbound = 8 [json_name = "inbound"]; + + /// Ping time to this peer + int64 ping_time = 9 [json_name = "ping_time"]; +} + +message ListPeersRequest { +} +message ListPeersResponse { + /// The list of currently connected peers + repeated Peer peers = 1 [json_name = "peers"]; +} + +message GetInfoRequest { +} +message GetInfoResponse { + + /// The identity pubkey of the current node. + string identity_pubkey = 1 [json_name = "identity_pubkey"]; + + /// If applicable, the alias of the current node, e.g. "bob" + string alias = 2 [json_name = "alias"]; + + /// Number of pending channels + uint32 num_pending_channels = 3 [json_name = "num_pending_channels"]; + + /// Number of active channels + uint32 num_active_channels = 4 [json_name = "num_active_channels"]; + + /// Number of peers + uint32 num_peers = 5 [json_name = "num_peers"]; + + /// The node's current view of the height of the best block + uint32 block_height = 6 [json_name = "block_height"]; + + /// The node's current view of the hash of the best block + string block_hash = 8 [json_name = "block_hash"]; + + /// Whether the wallet's view is synced to the main chain + bool synced_to_chain = 9 [json_name = "synced_to_chain"]; + + /// Whether the current node is connected to testnet + bool testnet = 10 [json_name = "testnet"]; + + /// A list of active chains the node is connected to + repeated string chains = 11 [json_name = "chains"]; + + /// The URIs of the current node. + repeated string uris = 12 [json_name = "uris"]; + + /// Timestamp of the block best known to the wallet + int64 best_header_timestamp = 13 [ json_name = "best_header_timestamp" ]; + + /// The version of the LND software that the node is running. + string version = 14 [ json_name = "version" ]; + +} + +message ConfirmationUpdate { + bytes block_sha = 1; + int32 block_height = 2; + + uint32 num_confs_left = 3; +} + +message ChannelOpenUpdate { + ChannelPoint channel_point = 1 [json_name = "channel_point"]; +} + +message ChannelCloseUpdate { + bytes closing_txid = 1 [json_name = "closing_txid"]; + + bool success = 2 [json_name = "success"]; +} + +message CloseChannelRequest { + /** + The outpoint (txid:index) of the funding transaction. With this value, Bob + will be able to generate a signature for Alice's version of the commitment + transaction. + */ + ChannelPoint channel_point = 1; + + /// If true, then the channel will be closed forcibly. This means the current commitment transaction will be signed and broadcast. + bool force = 2; + + /// The target number of blocks that the closure transaction should be confirmed by. + int32 target_conf = 3; + + /// A manual fee rate set in sat/byte that should be used when crafting the closure transaction. + int64 sat_per_byte = 4; +} + +message CloseStatusUpdate { + oneof update { + PendingUpdate close_pending = 1 [json_name = "close_pending"]; + ConfirmationUpdate confirmation = 2 [json_name = "confirmation"]; + ChannelCloseUpdate chan_close = 3 [json_name = "chan_close"]; + } +} + +message PendingUpdate { + bytes txid = 1 [json_name = "txid"]; + uint32 output_index = 2 [json_name = "output_index"]; +} + +message OpenChannelRequest { + /// The pubkey of the node to open a channel with + bytes node_pubkey = 2 [json_name = "node_pubkey"]; + + /// The hex encoded pubkey of the node to open a channel with + string node_pubkey_string = 3 [json_name = "node_pubkey_string"]; + + /// The number of satoshis the wallet should commit to the channel + int64 local_funding_amount = 4 [json_name = "local_funding_amount"]; + + /// The number of satoshis to push to the remote side as part of the initial commitment state + int64 push_sat = 5 [json_name = "push_sat"]; + + /// The target number of blocks that the funding transaction should be confirmed by. + int32 target_conf = 6; + + /// A manual fee rate set in sat/byte that should be used when crafting the funding transaction. + int64 sat_per_byte = 7; + + /// Whether this channel should be private, not announced to the greater network. + bool private = 8 [json_name = "private"]; + + /// The minimum value in millisatoshi we will require for incoming HTLCs on the channel. + int64 min_htlc_msat = 9 [json_name = "min_htlc_msat"]; + + /// The delay we require on the remote's commitment transaction. If this is not set, it will be scaled automatically with the channel size. + uint32 remote_csv_delay = 10 [json_name = "remote_csv_delay"]; + + /// The minimum number of confirmations each one of your outputs used for the funding transaction must satisfy. + int32 min_confs = 11 [json_name = "min_confs"]; + + /// Whether unconfirmed outputs should be used as inputs for the funding transaction. + bool spend_unconfirmed = 12 [json_name = "spend_unconfirmed"]; +} +message OpenStatusUpdate { + oneof update { + PendingUpdate chan_pending = 1 [json_name = "chan_pending"]; + ConfirmationUpdate confirmation = 2 [json_name = "confirmation"]; + ChannelOpenUpdate chan_open = 3 [json_name = "chan_open"]; + } +} + +message PendingHTLC { + + /// The direction within the channel that the htlc was sent + bool incoming = 1 [ json_name = "incoming" ]; + + /// The total value of the htlc + int64 amount = 2 [ json_name = "amount" ]; + + /// The final output to be swept back to the user's wallet + string outpoint = 3 [ json_name = "outpoint" ]; + + /// The next block height at which we can spend the current stage + uint32 maturity_height = 4 [ json_name = "maturity_height" ]; + + /** + The number of blocks remaining until the current stage can be swept. + Negative values indicate how many blocks have passed since becoming + mature. + */ + int32 blocks_til_maturity = 5 [ json_name = "blocks_til_maturity" ]; + + /// Indicates whether the htlc is in its first or second stage of recovery + uint32 stage = 6 [ json_name = "stage" ]; +} + +message PendingChannelsRequest {} +message PendingChannelsResponse { + message PendingChannel { + string remote_node_pub = 1 [ json_name = "remote_node_pub" ]; + string channel_point = 2 [ json_name = "channel_point" ]; + + int64 capacity = 3 [ json_name = "capacity" ]; + + int64 local_balance = 4 [ json_name = "local_balance" ]; + int64 remote_balance = 5 [ json_name = "remote_balance" ]; + } + + message PendingOpenChannel { + /// The pending channel + PendingChannel channel = 1 [ json_name = "channel" ]; + + /// The height at which this channel will be confirmed + uint32 confirmation_height = 2 [ json_name = "confirmation_height" ]; + + /** + The amount calculated to be paid in fees for the current set of + commitment transactions. The fee amount is persisted with the channel + in order to allow the fee amount to be removed and recalculated with + each channel state update, including updates that happen after a system + restart. + */ + int64 commit_fee = 4 [json_name = "commit_fee" ]; + + /// The weight of the commitment transaction + int64 commit_weight = 5 [ json_name = "commit_weight" ]; + + /** + The required number of satoshis per kilo-weight that the requester will + pay at all times, for both the funding transaction and commitment + transaction. This value can later be updated once the channel is open. + */ + int64 fee_per_kw = 6 [ json_name = "fee_per_kw" ]; + } + + message WaitingCloseChannel { + /// The pending channel waiting for closing tx to confirm + PendingChannel channel = 1; + + /// The balance in satoshis encumbered in this channel + int64 limbo_balance = 2 [ json_name = "limbo_balance" ]; + } + + message ClosedChannel { + /// The pending channel to be closed + PendingChannel channel = 1; + + /// The transaction id of the closing transaction + string closing_txid = 2 [ json_name = "closing_txid" ]; + } + + message ForceClosedChannel { + /// The pending channel to be force closed + PendingChannel channel = 1 [ json_name = "channel" ]; + + /// The transaction id of the closing transaction + string closing_txid = 2 [ json_name = "closing_txid" ]; + + /// The balance in satoshis encumbered in this pending channel + int64 limbo_balance = 3 [ json_name = "limbo_balance" ]; + + /// The height at which funds can be sweeped into the wallet + uint32 maturity_height = 4 [ json_name = "maturity_height" ]; + + /* + Remaining # of blocks until the commitment output can be swept. + Negative values indicate how many blocks have passed since becoming + mature. + */ + int32 blocks_til_maturity = 5 [ json_name = "blocks_til_maturity" ]; + + /// The total value of funds successfully recovered from this channel + int64 recovered_balance = 6 [ json_name = "recovered_balance" ]; + + repeated PendingHTLC pending_htlcs = 8 [ json_name = "pending_htlcs" ]; + } + + /// The balance in satoshis encumbered in pending channels + int64 total_limbo_balance = 1 [ json_name = "total_limbo_balance" ]; + + /// Channels pending opening + repeated PendingOpenChannel pending_open_channels = 2 [ json_name = "pending_open_channels" ]; + + /// Channels pending closing + repeated ClosedChannel pending_closing_channels = 3 [ json_name = "pending_closing_channels" ]; + + /// Channels pending force closing + repeated ForceClosedChannel pending_force_closing_channels = 4 [ json_name = "pending_force_closing_channels" ]; + + /// Channels waiting for closing tx to confirm + repeated WaitingCloseChannel waiting_close_channels = 5 [ json_name = "waiting_close_channels" ]; +} + +message WalletBalanceRequest { +} +message WalletBalanceResponse { + /// The balance of the wallet + int64 total_balance = 1 [json_name = "total_balance"]; + + /// The confirmed balance of a wallet(with >= 1 confirmations) + int64 confirmed_balance = 2 [json_name = "confirmed_balance"]; + + /// The unconfirmed balance of a wallet(with 0 confirmations) + int64 unconfirmed_balance = 3 [json_name = "unconfirmed_balance"]; +} + +message ChannelBalanceRequest { +} +message ChannelBalanceResponse { + /// Sum of channels balances denominated in satoshis + int64 balance = 1 [json_name = "balance"]; + + /// Sum of channels pending balances denominated in satoshis + int64 pending_open_balance = 2 [json_name = "pending_open_balance"]; +} + +message QueryRoutesRequest { + /// The 33-byte hex-encoded public key for the payment destination + string pub_key = 1; + + /// The amount to send expressed in satoshis + int64 amt = 2; + + /// The max number of routes to return. + int32 num_routes = 3; + + /// An optional CLTV delta from the current height that should be used for the timelock of the final hop + int32 final_cltv_delta = 4; + + /** + The maximum number of satoshis that will be paid as a fee of the payment. + This value can be represented either as a percentage of the amount being + sent, or as a fixed amount of the maximum fee the user is willing the pay to + send the payment. + */ + FeeLimit fee_limit = 5; +} +message QueryRoutesResponse { + repeated Route routes = 1 [json_name = "routes"]; +} + +message Hop { + /** + The unique channel ID for the channel. The first 3 bytes are the block + height, the next 3 the index within the block, and the last 2 bytes are the + output index for the channel. + */ + uint64 chan_id = 1 [json_name = "chan_id"]; + int64 chan_capacity = 2 [json_name = "chan_capacity"]; + int64 amt_to_forward = 3 [json_name = "amt_to_forward", deprecated = true]; + int64 fee = 4 [json_name = "fee", deprecated = true]; + uint32 expiry = 5 [json_name = "expiry"]; + int64 amt_to_forward_msat = 6 [json_name = "amt_to_forward_msat"]; + int64 fee_msat = 7 [json_name = "fee_msat"]; +} + +/** +A path through the channel graph which runs over one or more channels in +succession. This struct carries all the information required to craft the +Sphinx onion packet, and send the payment along the first hop in the path. A +route is only selected as valid if all the channels have sufficient capacity to +carry the initial payment amount after fees are accounted for. +*/ +message Route { + + /** + The cumulative (final) time lock across the entire route. This is the CLTV + value that should be extended to the first hop in the route. All other hops + will decrement the time-lock as advertised, leaving enough time for all + hops to wait for or present the payment preimage to complete the payment. + */ + uint32 total_time_lock = 1 [json_name = "total_time_lock"]; + + /** + The sum of the fees paid at each hop within the final route. In the case + of a one-hop payment, this value will be zero as we don't need to pay a fee + it ourself. + */ + int64 total_fees = 2 [json_name = "total_fees", deprecated = true]; + + /** + The total amount of funds required to complete a payment over this route. + This value includes the cumulative fees at each hop. As a result, the HTLC + extended to the first-hop in the route will need to have at least this many + satoshis, otherwise the route will fail at an intermediate node due to an + insufficient amount of fees. + */ + int64 total_amt = 3 [json_name = "total_amt", deprecated = true]; + + /** + Contains details concerning the specific forwarding details at each hop. + */ + repeated Hop hops = 4 [json_name = "hops"]; + + /** + The total fees in millisatoshis. + */ + int64 total_fees_msat = 5 [json_name = "total_fees_msat"]; + + /** + The total amount in millisatoshis. + */ + int64 total_amt_msat = 6 [json_name = "total_amt_msat"]; +} + +message NodeInfoRequest { + /// The 33-byte hex-encoded compressed public of the target node + string pub_key = 1; +} + +message NodeInfo { + + /** + An individual vertex/node within the channel graph. A node is + connected to other nodes by one or more channel edges emanating from it. As + the graph is directed, a node will also have an incoming edge attached to + it for each outgoing edge. + */ + LightningNode node = 1 [json_name = "node"]; + + uint32 num_channels = 2 [json_name = "num_channels"]; + int64 total_capacity = 3 [json_name = "total_capacity"]; +} + +/** +An individual vertex/node within the channel graph. A node is +connected to other nodes by one or more channel edges emanating from it. As the +graph is directed, a node will also have an incoming edge attached to it for +each outgoing edge. +*/ +message LightningNode { + uint32 last_update = 1 [ json_name = "last_update" ]; + string pub_key = 2 [ json_name = "pub_key" ]; + string alias = 3 [ json_name = "alias" ]; + repeated NodeAddress addresses = 4 [ json_name = "addresses" ]; + string color = 5 [ json_name = "color" ]; +} + +message NodeAddress { + string network = 1 [ json_name = "network" ]; + string addr = 2 [ json_name = "addr" ]; +} + +message RoutingPolicy { + uint32 time_lock_delta = 1 [json_name = "time_lock_delta"]; + int64 min_htlc = 2 [json_name = "min_htlc"]; + int64 fee_base_msat = 3 [json_name = "fee_base_msat"]; + int64 fee_rate_milli_msat = 4 [json_name = "fee_rate_milli_msat"]; + bool disabled = 5 [json_name = "disabled"]; +} + +/** +A fully authenticated channel along with all its unique attributes. +Once an authenticated channel announcement has been processed on the network, +then an instance of ChannelEdgeInfo encapsulating the channels attributes is +stored. The other portions relevant to routing policy of a channel are stored +within a ChannelEdgePolicy for each direction of the channel. +*/ +message ChannelEdge { + + /** + The unique channel ID for the channel. The first 3 bytes are the block + height, the next 3 the index within the block, and the last 2 bytes are the + output index for the channel. + */ + uint64 channel_id = 1 [json_name = "channel_id"]; + string chan_point = 2 [json_name = "chan_point"]; + + uint32 last_update = 3 [json_name = "last_update"]; + + string node1_pub = 4 [json_name = "node1_pub"]; + string node2_pub = 5 [json_name = "node2_pub"]; + + int64 capacity = 6 [json_name = "capacity"]; + + RoutingPolicy node1_policy = 7 [json_name = "node1_policy"]; + RoutingPolicy node2_policy = 8 [json_name = "node2_policy"]; +} + +message ChannelGraphRequest { + /** + Whether unannounced channels are included in the response or not. If set, + unannounced channels are included. Unannounced channels are both private + channels, and public channels that are not yet announced to the network. + */ + bool include_unannounced = 1 [json_name = "include_unannounced"]; +} + +/// Returns a new instance of the directed channel graph. +message ChannelGraph { + /// The list of `LightningNode`s in this channel graph + repeated LightningNode nodes = 1 [json_name = "nodes"]; + + /// The list of `ChannelEdge`s in this channel graph + repeated ChannelEdge edges = 2 [json_name = "edges"]; +} + +message ChanInfoRequest { + /** + The unique channel ID for the channel. The first 3 bytes are the block + height, the next 3 the index within the block, and the last 2 bytes are the + output index for the channel. + */ + uint64 chan_id = 1; +} + +message NetworkInfoRequest { +} +message NetworkInfo { + uint32 graph_diameter = 1 [json_name = "graph_diameter"]; + double avg_out_degree = 2 [json_name = "avg_out_degree"]; + uint32 max_out_degree = 3 [json_name = "max_out_degree"]; + + uint32 num_nodes = 4 [json_name = "num_nodes"]; + uint32 num_channels = 5 [json_name = "num_channels"]; + + int64 total_network_capacity = 6 [json_name = "total_network_capacity"]; + + double avg_channel_size = 7 [json_name = "avg_channel_size"]; + int64 min_channel_size = 8 [json_name = "min_channel_size"]; + int64 max_channel_size = 9 [json_name = "max_channel_size"]; + + // TODO(roasbeef): fee rate info, expiry + // * also additional RPC for tracking fee info once in +} + +message StopRequest{} +message StopResponse{} + +message GraphTopologySubscription {} +message GraphTopologyUpdate { + repeated NodeUpdate node_updates = 1; + repeated ChannelEdgeUpdate channel_updates = 2; + repeated ClosedChannelUpdate closed_chans = 3; +} +message NodeUpdate { + repeated string addresses = 1; + string identity_key = 2; + bytes global_features = 3; + string alias = 4; +} +message ChannelEdgeUpdate { + /** + The unique channel ID for the channel. The first 3 bytes are the block + height, the next 3 the index within the block, and the last 2 bytes are the + output index for the channel. + */ + uint64 chan_id = 1; + + ChannelPoint chan_point = 2; + + int64 capacity = 3; + + RoutingPolicy routing_policy = 4; + + string advertising_node = 5; + string connecting_node = 6; +} +message ClosedChannelUpdate { + /** + The unique channel ID for the channel. The first 3 bytes are the block + height, the next 3 the index within the block, and the last 2 bytes are the + output index for the channel. + */ + uint64 chan_id = 1; + int64 capacity = 2; + uint32 closed_height = 3; + ChannelPoint chan_point = 4; +} + +message HopHint { + /// The public key of the node at the start of the channel. + string node_id = 1 [json_name = "node_id"]; + + /// The unique identifier of the channel. + uint64 chan_id = 2 [json_name = "chan_id"]; + + /// The base fee of the channel denominated in millisatoshis. + uint32 fee_base_msat = 3 [json_name = "fee_base_msat"]; + + /** + The fee rate of the channel for sending one satoshi across it denominated in + millionths of a satoshi. + */ + uint32 fee_proportional_millionths = 4 [json_name = "fee_proportional_millionths"]; + + /// The time-lock delta of the channel. + uint32 cltv_expiry_delta = 5 [json_name = "cltv_expiry_delta"]; +} + +message RouteHint { + /** + A list of hop hints that when chained together can assist in reaching a + specific destination. + */ + repeated HopHint hop_hints = 1 [json_name = "hop_hints"]; +} + +message Invoice { + /** + An optional memo to attach along with the invoice. Used for record keeping + purposes for the invoice's creator, and will also be set in the description + field of the encoded payment request if the description_hash field is not + being used. + */ + string memo = 1 [json_name = "memo"]; + + /// An optional cryptographic receipt of payment + bytes receipt = 2 [json_name = "receipt"]; + + /** + The hex-encoded preimage (32 byte) which will allow settling an incoming + HTLC payable to this preimage + */ + bytes r_preimage = 3 [json_name = "r_preimage"]; + + /// The hash of the preimage + bytes r_hash = 4 [json_name = "r_hash"]; + + /// The value of this invoice in satoshis + int64 value = 5 [json_name = "value"]; + + /// Whether this invoice has been fulfilled + bool settled = 6 [json_name = "settled"]; + + /// When this invoice was created + int64 creation_date = 7 [json_name = "creation_date"]; + + /// When this invoice was settled + int64 settle_date = 8 [json_name = "settle_date"]; + + /** + A bare-bones invoice for a payment within the Lightning Network. With the + details of the invoice, the sender has all the data necessary to send a + payment to the recipient. + */ + string payment_request = 9 [json_name = "payment_request"]; + + /** + Hash (SHA-256) of a description of the payment. Used if the description of + payment (memo) is too long to naturally fit within the description field + of an encoded payment request. + */ + bytes description_hash = 10 [json_name = "description_hash"]; + + /// Payment request expiry time in seconds. Default is 3600 (1 hour). + int64 expiry = 11 [json_name = "expiry"]; + + /// Fallback on-chain address. + string fallback_addr = 12 [json_name = "fallback_addr"]; + + /// Delta to use for the time-lock of the CLTV extended to the final hop. + uint64 cltv_expiry = 13 [json_name = "cltv_expiry"]; + + /** + Route hints that can each be individually used to assist in reaching the + invoice's destination. + */ + repeated RouteHint route_hints = 14 [json_name = "route_hints"]; + + /// Whether this invoice should include routing hints for private channels. + bool private = 15 [json_name = "private"]; + + /** + The "add" index of this invoice. Each newly created invoice will increment + this index making it monotonically increasing. Callers to the + SubscribeInvoices call can use this to instantly get notified of all added + invoices with an add_index greater than this one. + */ + uint64 add_index = 16 [json_name = "add_index"]; + + /** + The "settle" index of this invoice. Each newly settled invoice will + increment this index making it monotonically increasing. Callers to the + SubscribeInvoices call can use this to instantly get notified of all + settled invoices with an settle_index greater than this one. + */ + uint64 settle_index = 17 [json_name = "settle_index"]; + + /// Deprecated, use amt_paid_sat or amt_paid_msat. + int64 amt_paid = 18 [json_name = "amt_paid", deprecated = true]; + + /** + The amount that was accepted for this invoice, in satoshis. This will ONLY + be set if this invoice has been settled. We provide this field as if the + invoice was created with a zero value, then we need to record what amount + was ultimately accepted. Additionally, it's possible that the sender paid + MORE that was specified in the original invoice. So we'll record that here + as well. + */ + int64 amt_paid_sat = 19 [json_name = "amt_paid_sat"]; + + /** + The amount that was accepted for this invoice, in millisatoshis. This will + ONLY be set if this invoice has been settled. We provide this field as if + the invoice was created with a zero value, then we need to record what + amount was ultimately accepted. Additionally, it's possible that the sender + paid MORE that was specified in the original invoice. So we'll record that + here as well. + */ + int64 amt_paid_msat = 20 [json_name = "amt_paid_msat"]; +} +message AddInvoiceResponse { + bytes r_hash = 1 [json_name = "r_hash"]; + + /** + A bare-bones invoice for a payment within the Lightning Network. With the + details of the invoice, the sender has all the data necessary to send a + payment to the recipient. + */ + string payment_request = 2 [json_name = "payment_request"]; + + /** + The "add" index of this invoice. Each newly created invoice will increment + this index making it monotonically increasing. Callers to the + SubscribeInvoices call can use this to instantly get notified of all added + invoices with an add_index greater than this one. + */ + uint64 add_index = 16 [json_name = "add_index"]; +} +message PaymentHash { + /** + The hex-encoded payment hash of the invoice to be looked up. The passed + payment hash must be exactly 32 bytes, otherwise an error is returned. + */ + string r_hash_str = 1 [json_name = "r_hash_str"]; + + /// The payment hash of the invoice to be looked up. + bytes r_hash = 2 [json_name = "r_hash"]; +} + +message ListInvoiceRequest { + /// If set, only unsettled invoices will be returned in the response. + bool pending_only = 1 [json_name = "pending_only"]; + + /** + The index of an invoice that will be used as either the start or end of a + query to determine which invoices should be returned in the response. + */ + uint64 index_offset = 4 [json_name = "index_offset"]; + + /// The max number of invoices to return in the response to this query. + uint64 num_max_invoices = 5 [json_name = "num_max_invoices"]; + + /** + If set, the invoices returned will result from seeking backwards from the + specified index offset. This can be used to paginate backwards. + */ + bool reversed = 6 [json_name = "reversed"]; +} +message ListInvoiceResponse { + /** + A list of invoices from the time slice of the time series specified in the + request. + */ + repeated Invoice invoices = 1 [json_name = "invoices"]; + + /** + The index of the last item in the set of returned invoices. This can be used + to seek further, pagination style. + */ + uint64 last_index_offset = 2 [json_name = "last_index_offset"]; + + /** + The index of the last item in the set of returned invoices. This can be used + to seek backwards, pagination style. + */ + uint64 first_index_offset = 3 [json_name = "first_index_offset"]; +} + +message InvoiceSubscription { + /** + If specified (non-zero), then we'll first start by sending out + notifications for all added indexes with an add_index greater than this + value. This allows callers to catch up on any events they missed while they + weren't connected to the streaming RPC. + */ + uint64 add_index = 1 [json_name = "add_index"]; + + /** + If specified (non-zero), then we'll first start by sending out + notifications for all settled indexes with an settle_index greater than + this value. This allows callers to catch up on any events they missed while + they weren't connected to the streaming RPC. + */ + uint64 settle_index = 2 [json_name = "settle_index"]; +} + + +message Payment { + /// The payment hash + string payment_hash = 1 [json_name = "payment_hash"]; + + /// Deprecated, use value_sat or value_msat. + int64 value = 2 [json_name = "value", deprecated = true]; + + /// The date of this payment + int64 creation_date = 3 [json_name = "creation_date"]; + + /// The path this payment took + repeated string path = 4 [ json_name = "path" ]; + + /// The fee paid for this payment in satoshis + int64 fee = 5 [json_name = "fee"]; + + /// The payment preimage + string payment_preimage = 6 [json_name = "payment_preimage"]; + + /// The value of the payment in satoshis + int64 value_sat = 7 [json_name = "value_sat"]; + + /// The value of the payment in milli-satoshis + int64 value_msat = 8 [json_name = "value_msat"]; +} + +message ListPaymentsRequest { +} + +message ListPaymentsResponse { + /// The list of payments + repeated Payment payments = 1 [json_name = "payments"]; +} + +message DeleteAllPaymentsRequest { +} + +message DeleteAllPaymentsResponse { +} + +message AbandonChannelRequest { + ChannelPoint channel_point = 1; +} + +message AbandonChannelResponse { +} + + +message DebugLevelRequest { + bool show = 1; + string level_spec = 2; +} +message DebugLevelResponse { + string sub_systems = 1 [json_name = "sub_systems"]; +} + +message PayReqString { + /// The payment request string to be decoded + string pay_req = 1; +} +message PayReq { + string destination = 1 [json_name = "destination"]; + string payment_hash = 2 [json_name = "payment_hash"]; + int64 num_satoshis = 3 [json_name = "num_satoshis"]; + int64 timestamp = 4 [json_name = "timestamp"]; + int64 expiry = 5 [json_name = "expiry"]; + string description = 6 [json_name = "description"]; + string description_hash = 7 [json_name = "description_hash"]; + string fallback_addr = 8 [json_name = "fallback_addr"]; + int64 cltv_expiry = 9 [json_name = "cltv_expiry"]; + repeated RouteHint route_hints = 10 [json_name = "route_hints"]; +} + +message FeeReportRequest {} +message ChannelFeeReport { + /// The channel that this fee report belongs to. + string chan_point = 1 [json_name = "channel_point"]; + + /// The base fee charged regardless of the number of milli-satoshis sent. + int64 base_fee_msat = 2 [json_name = "base_fee_msat"]; + + /// The amount charged per milli-satoshis transferred expressed in millionths of a satoshi. + int64 fee_per_mil = 3 [json_name = "fee_per_mil"]; + + /// The effective fee rate in milli-satoshis. Computed by dividing the fee_per_mil value by 1 million. + double fee_rate = 4 [json_name = "fee_rate"]; +} +message FeeReportResponse { + /// An array of channel fee reports which describes the current fee schedule for each channel. + repeated ChannelFeeReport channel_fees = 1 [json_name = "channel_fees"]; + + /// The total amount of fee revenue (in satoshis) the switch has collected over the past 24 hrs. + uint64 day_fee_sum = 2 [json_name = "day_fee_sum"]; + + /// The total amount of fee revenue (in satoshis) the switch has collected over the past 1 week. + uint64 week_fee_sum = 3 [json_name = "week_fee_sum"]; + + /// The total amount of fee revenue (in satoshis) the switch has collected over the past 1 month. + uint64 month_fee_sum = 4 [json_name = "month_fee_sum"]; +} + +message PolicyUpdateRequest { + oneof scope { + /// If set, then this update applies to all currently active channels. + bool global = 1 [json_name = "global"] ; + + /// If set, this update will target a specific channel. + ChannelPoint chan_point = 2 [json_name = "chan_point"]; + } + + /// The base fee charged regardless of the number of milli-satoshis sent. + int64 base_fee_msat = 3 [json_name = "base_fee_msat"]; + + /// The effective fee rate in milli-satoshis. The precision of this value goes up to 6 decimal places, so 1e-6. + double fee_rate = 4 [json_name = "fee_rate"]; + + /// The required timelock delta for HTLCs forwarded over the channel. + uint32 time_lock_delta = 5 [json_name = "time_lock_delta"]; +} +message PolicyUpdateResponse { +} + +message ForwardingHistoryRequest { + /// Start time is the starting point of the forwarding history request. All records beyond this point will be included, respecting the end time, and the index offset. + uint64 start_time = 1 [json_name = "start_time"]; + + /// End time is the end point of the forwarding history request. The response will carry at most 50k records between the start time and the end time. The index offset can be used to implement pagination. + uint64 end_time = 2 [json_name = "end_time"]; + + /// Index offset is the offset in the time series to start at. As each response can only contain 50k records, callers can use this to skip around within a packed time series. + uint32 index_offset = 3 [json_name = "index_offset"]; + + /// The max number of events to return in the response to this query. + uint32 num_max_events = 4 [json_name = "num_max_events"]; +} +message ForwardingEvent { + /// Timestamp is the time (unix epoch offset) that this circuit was completed. + uint64 timestamp = 1 [json_name = "timestamp"]; + + /// The incoming channel ID that carried the HTLC that created the circuit. + uint64 chan_id_in = 2 [json_name = "chan_id_in"]; + + /// The outgoing channel ID that carried the preimage that completed the circuit. + uint64 chan_id_out = 4 [json_name = "chan_id_out"]; + + /// The total amount of the incoming HTLC that created half the circuit. + uint64 amt_in = 5 [json_name = "amt_in"]; + + /// The total amount of the outgoign HTLC that created the second half of the circuit. + uint64 amt_out = 6 [json_name = "amt_out"]; + + /// The total fee that this payment circuit carried. + uint64 fee = 7 [json_name = "fee"]; + + // TODO(roasbeef): add settlement latency? + // * use FPE on the chan id? + // * also list failures? +} +message ForwardingHistoryResponse { + /// A list of forwarding events from the time slice of the time series specified in the request. + repeated ForwardingEvent forwarding_events = 1 [json_name = "forwarding_events"]; + + /// The index of the last time in the set of returned forwarding events. Can be used to seek further, pagination style. + uint32 last_offset_index = 2 [json_name = "last_offset_index"]; +} diff --git a/lib/lnrpc/rpc_pb.rb b/lib/lnrpc/rpc_pb.rb new file mode 100644 index 0000000..016cc21 --- /dev/null +++ b/lib/lnrpc/rpc_pb.rb @@ -0,0 +1,726 @@ +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: rpc.proto + +require 'google/protobuf' + +require 'google/api/annotations_pb' +Google::Protobuf::DescriptorPool.generated_pool.build do + add_message "lnrpc.GenSeedRequest" do + optional :aezeed_passphrase, :bytes, 1 + optional :seed_entropy, :bytes, 2 + end + add_message "lnrpc.GenSeedResponse" do + repeated :cipher_seed_mnemonic, :string, 1 + optional :enciphered_seed, :bytes, 2 + end + add_message "lnrpc.InitWalletRequest" do + optional :wallet_password, :bytes, 1 + repeated :cipher_seed_mnemonic, :string, 2 + optional :aezeed_passphrase, :bytes, 3 + optional :recovery_window, :int32, 4 + end + add_message "lnrpc.InitWalletResponse" do + end + add_message "lnrpc.UnlockWalletRequest" do + optional :wallet_password, :bytes, 1 + optional :recovery_window, :int32, 2 + end + add_message "lnrpc.UnlockWalletResponse" do + end + add_message "lnrpc.ChangePasswordRequest" do + optional :current_password, :bytes, 1 + optional :new_password, :bytes, 2 + end + add_message "lnrpc.ChangePasswordResponse" do + end + add_message "lnrpc.Transaction" do + optional :tx_hash, :string, 1 + optional :amount, :int64, 2 + optional :num_confirmations, :int32, 3 + optional :block_hash, :string, 4 + optional :block_height, :int32, 5 + optional :time_stamp, :int64, 6 + optional :total_fees, :int64, 7 + repeated :dest_addresses, :string, 8 + end + add_message "lnrpc.GetTransactionsRequest" do + end + add_message "lnrpc.TransactionDetails" do + repeated :transactions, :message, 1, "lnrpc.Transaction" + end + add_message "lnrpc.FeeLimit" do + oneof :limit do + optional :fixed, :int64, 1 + optional :percent, :int64, 2 + end + end + add_message "lnrpc.SendRequest" do + optional :dest, :bytes, 1 + optional :dest_string, :string, 2 + optional :amt, :int64, 3 + optional :payment_hash, :bytes, 4 + optional :payment_hash_string, :string, 5 + optional :payment_request, :string, 6 + optional :final_cltv_delta, :int32, 7 + optional :fee_limit, :message, 8, "lnrpc.FeeLimit" + end + add_message "lnrpc.SendResponse" do + optional :payment_error, :string, 1 + optional :payment_preimage, :bytes, 2 + optional :payment_route, :message, 3, "lnrpc.Route" + end + add_message "lnrpc.SendToRouteRequest" do + optional :payment_hash, :bytes, 1 + optional :payment_hash_string, :string, 2 + repeated :routes, :message, 3, "lnrpc.Route" + end + add_message "lnrpc.ChannelPoint" do + optional :output_index, :uint32, 3 + oneof :funding_txid do + optional :funding_txid_bytes, :bytes, 1 + optional :funding_txid_str, :string, 2 + end + end + add_message "lnrpc.LightningAddress" do + optional :pubkey, :string, 1 + optional :host, :string, 2 + end + add_message "lnrpc.SendManyRequest" do + map :AddrToAmount, :string, :int64, 1 + optional :target_conf, :int32, 3 + optional :sat_per_byte, :int64, 5 + end + add_message "lnrpc.SendManyResponse" do + optional :txid, :string, 1 + end + add_message "lnrpc.SendCoinsRequest" do + optional :addr, :string, 1 + optional :amount, :int64, 2 + optional :target_conf, :int32, 3 + optional :sat_per_byte, :int64, 5 + end + add_message "lnrpc.SendCoinsResponse" do + optional :txid, :string, 1 + end + add_message "lnrpc.NewAddressRequest" do + optional :type, :enum, 1, "lnrpc.NewAddressRequest.AddressType" + end + add_enum "lnrpc.NewAddressRequest.AddressType" do + value :WITNESS_PUBKEY_HASH, 0 + value :NESTED_PUBKEY_HASH, 1 + end + add_message "lnrpc.NewAddressResponse" do + optional :address, :string, 1 + end + add_message "lnrpc.SignMessageRequest" do + optional :msg, :bytes, 1 + end + add_message "lnrpc.SignMessageResponse" do + optional :signature, :string, 1 + end + add_message "lnrpc.VerifyMessageRequest" do + optional :msg, :bytes, 1 + optional :signature, :string, 2 + end + add_message "lnrpc.VerifyMessageResponse" do + optional :valid, :bool, 1 + optional :pubkey, :string, 2 + end + add_message "lnrpc.ConnectPeerRequest" do + optional :addr, :message, 1, "lnrpc.LightningAddress" + optional :perm, :bool, 2 + end + add_message "lnrpc.ConnectPeerResponse" do + end + add_message "lnrpc.DisconnectPeerRequest" do + optional :pub_key, :string, 1 + end + add_message "lnrpc.DisconnectPeerResponse" do + end + add_message "lnrpc.HTLC" do + optional :incoming, :bool, 1 + optional :amount, :int64, 2 + optional :hash_lock, :bytes, 3 + optional :expiration_height, :uint32, 4 + end + add_message "lnrpc.Channel" do + optional :active, :bool, 1 + optional :remote_pubkey, :string, 2 + optional :channel_point, :string, 3 + optional :chan_id, :uint64, 4 + optional :capacity, :int64, 5 + optional :local_balance, :int64, 6 + optional :remote_balance, :int64, 7 + optional :commit_fee, :int64, 8 + optional :commit_weight, :int64, 9 + optional :fee_per_kw, :int64, 10 + optional :unsettled_balance, :int64, 11 + optional :total_satoshis_sent, :int64, 12 + optional :total_satoshis_received, :int64, 13 + optional :num_updates, :uint64, 14 + repeated :pending_htlcs, :message, 15, "lnrpc.HTLC" + optional :csv_delay, :uint32, 16 + optional :private, :bool, 17 + end + add_message "lnrpc.ListChannelsRequest" do + optional :active_only, :bool, 1 + optional :inactive_only, :bool, 2 + optional :public_only, :bool, 3 + optional :private_only, :bool, 4 + end + add_message "lnrpc.ListChannelsResponse" do + repeated :channels, :message, 11, "lnrpc.Channel" + end + add_message "lnrpc.ChannelCloseSummary" do + optional :channel_point, :string, 1 + optional :chan_id, :uint64, 2 + optional :chain_hash, :string, 3 + optional :closing_tx_hash, :string, 4 + optional :remote_pubkey, :string, 5 + optional :capacity, :int64, 6 + optional :close_height, :uint32, 7 + optional :settled_balance, :int64, 8 + optional :time_locked_balance, :int64, 9 + optional :close_type, :enum, 10, "lnrpc.ChannelCloseSummary.ClosureType" + end + add_enum "lnrpc.ChannelCloseSummary.ClosureType" do + value :COOPERATIVE_CLOSE, 0 + value :LOCAL_FORCE_CLOSE, 1 + value :REMOTE_FORCE_CLOSE, 2 + value :BREACH_CLOSE, 3 + value :FUNDING_CANCELED, 4 + value :ABANDONED, 5 + end + add_message "lnrpc.ClosedChannelsRequest" do + optional :cooperative, :bool, 1 + optional :local_force, :bool, 2 + optional :remote_force, :bool, 3 + optional :breach, :bool, 4 + optional :funding_canceled, :bool, 5 + optional :abandoned, :bool, 6 + end + add_message "lnrpc.ClosedChannelsResponse" do + repeated :channels, :message, 1, "lnrpc.ChannelCloseSummary" + end + add_message "lnrpc.Peer" do + optional :pub_key, :string, 1 + optional :address, :string, 3 + optional :bytes_sent, :uint64, 4 + optional :bytes_recv, :uint64, 5 + optional :sat_sent, :int64, 6 + optional :sat_recv, :int64, 7 + optional :inbound, :bool, 8 + optional :ping_time, :int64, 9 + end + add_message "lnrpc.ListPeersRequest" do + end + add_message "lnrpc.ListPeersResponse" do + repeated :peers, :message, 1, "lnrpc.Peer" + end + add_message "lnrpc.GetInfoRequest" do + end + add_message "lnrpc.GetInfoResponse" do + optional :identity_pubkey, :string, 1 + optional :alias, :string, 2 + optional :num_pending_channels, :uint32, 3 + optional :num_active_channels, :uint32, 4 + optional :num_peers, :uint32, 5 + optional :block_height, :uint32, 6 + optional :block_hash, :string, 8 + optional :synced_to_chain, :bool, 9 + optional :testnet, :bool, 10 + repeated :chains, :string, 11 + repeated :uris, :string, 12 + optional :best_header_timestamp, :int64, 13 + optional :version, :string, 14 + end + add_message "lnrpc.ConfirmationUpdate" do + optional :block_sha, :bytes, 1 + optional :block_height, :int32, 2 + optional :num_confs_left, :uint32, 3 + end + add_message "lnrpc.ChannelOpenUpdate" do + optional :channel_point, :message, 1, "lnrpc.ChannelPoint" + end + add_message "lnrpc.ChannelCloseUpdate" do + optional :closing_txid, :bytes, 1 + optional :success, :bool, 2 + end + add_message "lnrpc.CloseChannelRequest" do + optional :channel_point, :message, 1, "lnrpc.ChannelPoint" + optional :force, :bool, 2 + optional :target_conf, :int32, 3 + optional :sat_per_byte, :int64, 4 + end + add_message "lnrpc.CloseStatusUpdate" do + oneof :update do + optional :close_pending, :message, 1, "lnrpc.PendingUpdate" + optional :confirmation, :message, 2, "lnrpc.ConfirmationUpdate" + optional :chan_close, :message, 3, "lnrpc.ChannelCloseUpdate" + end + end + add_message "lnrpc.PendingUpdate" do + optional :txid, :bytes, 1 + optional :output_index, :uint32, 2 + end + add_message "lnrpc.OpenChannelRequest" do + optional :node_pubkey, :bytes, 2 + optional :node_pubkey_string, :string, 3 + optional :local_funding_amount, :int64, 4 + optional :push_sat, :int64, 5 + optional :target_conf, :int32, 6 + optional :sat_per_byte, :int64, 7 + optional :private, :bool, 8 + optional :min_htlc_msat, :int64, 9 + optional :remote_csv_delay, :uint32, 10 + optional :min_confs, :int32, 11 + optional :spend_unconfirmed, :bool, 12 + end + add_message "lnrpc.OpenStatusUpdate" do + oneof :update do + optional :chan_pending, :message, 1, "lnrpc.PendingUpdate" + optional :confirmation, :message, 2, "lnrpc.ConfirmationUpdate" + optional :chan_open, :message, 3, "lnrpc.ChannelOpenUpdate" + end + end + add_message "lnrpc.PendingHTLC" do + optional :incoming, :bool, 1 + optional :amount, :int64, 2 + optional :outpoint, :string, 3 + optional :maturity_height, :uint32, 4 + optional :blocks_til_maturity, :int32, 5 + optional :stage, :uint32, 6 + end + add_message "lnrpc.PendingChannelsRequest" do + end + add_message "lnrpc.PendingChannelsResponse" do + optional :total_limbo_balance, :int64, 1 + repeated :pending_open_channels, :message, 2, "lnrpc.PendingChannelsResponse.PendingOpenChannel" + repeated :pending_closing_channels, :message, 3, "lnrpc.PendingChannelsResponse.ClosedChannel" + repeated :pending_force_closing_channels, :message, 4, "lnrpc.PendingChannelsResponse.ForceClosedChannel" + repeated :waiting_close_channels, :message, 5, "lnrpc.PendingChannelsResponse.WaitingCloseChannel" + end + add_message "lnrpc.PendingChannelsResponse.PendingChannel" do + optional :remote_node_pub, :string, 1 + optional :channel_point, :string, 2 + optional :capacity, :int64, 3 + optional :local_balance, :int64, 4 + optional :remote_balance, :int64, 5 + end + add_message "lnrpc.PendingChannelsResponse.PendingOpenChannel" do + optional :channel, :message, 1, "lnrpc.PendingChannelsResponse.PendingChannel" + optional :confirmation_height, :uint32, 2 + optional :commit_fee, :int64, 4 + optional :commit_weight, :int64, 5 + optional :fee_per_kw, :int64, 6 + end + add_message "lnrpc.PendingChannelsResponse.WaitingCloseChannel" do + optional :channel, :message, 1, "lnrpc.PendingChannelsResponse.PendingChannel" + optional :limbo_balance, :int64, 2 + end + add_message "lnrpc.PendingChannelsResponse.ClosedChannel" do + optional :channel, :message, 1, "lnrpc.PendingChannelsResponse.PendingChannel" + optional :closing_txid, :string, 2 + end + add_message "lnrpc.PendingChannelsResponse.ForceClosedChannel" do + optional :channel, :message, 1, "lnrpc.PendingChannelsResponse.PendingChannel" + optional :closing_txid, :string, 2 + optional :limbo_balance, :int64, 3 + optional :maturity_height, :uint32, 4 + optional :blocks_til_maturity, :int32, 5 + optional :recovered_balance, :int64, 6 + repeated :pending_htlcs, :message, 8, "lnrpc.PendingHTLC" + end + add_message "lnrpc.WalletBalanceRequest" do + end + add_message "lnrpc.WalletBalanceResponse" do + optional :total_balance, :int64, 1 + optional :confirmed_balance, :int64, 2 + optional :unconfirmed_balance, :int64, 3 + end + add_message "lnrpc.ChannelBalanceRequest" do + end + add_message "lnrpc.ChannelBalanceResponse" do + optional :balance, :int64, 1 + optional :pending_open_balance, :int64, 2 + end + add_message "lnrpc.QueryRoutesRequest" do + optional :pub_key, :string, 1 + optional :amt, :int64, 2 + optional :num_routes, :int32, 3 + optional :final_cltv_delta, :int32, 4 + optional :fee_limit, :message, 5, "lnrpc.FeeLimit" + end + add_message "lnrpc.QueryRoutesResponse" do + repeated :routes, :message, 1, "lnrpc.Route" + end + add_message "lnrpc.Hop" do + optional :chan_id, :uint64, 1 + optional :chan_capacity, :int64, 2 + optional :amt_to_forward, :int64, 3 + optional :fee, :int64, 4 + optional :expiry, :uint32, 5 + optional :amt_to_forward_msat, :int64, 6 + optional :fee_msat, :int64, 7 + end + add_message "lnrpc.Route" do + optional :total_time_lock, :uint32, 1 + optional :total_fees, :int64, 2 + optional :total_amt, :int64, 3 + repeated :hops, :message, 4, "lnrpc.Hop" + optional :total_fees_msat, :int64, 5 + optional :total_amt_msat, :int64, 6 + end + add_message "lnrpc.NodeInfoRequest" do + optional :pub_key, :string, 1 + end + add_message "lnrpc.NodeInfo" do + optional :node, :message, 1, "lnrpc.LightningNode" + optional :num_channels, :uint32, 2 + optional :total_capacity, :int64, 3 + end + add_message "lnrpc.LightningNode" do + optional :last_update, :uint32, 1 + optional :pub_key, :string, 2 + optional :alias, :string, 3 + repeated :addresses, :message, 4, "lnrpc.NodeAddress" + optional :color, :string, 5 + end + add_message "lnrpc.NodeAddress" do + optional :network, :string, 1 + optional :addr, :string, 2 + end + add_message "lnrpc.RoutingPolicy" do + optional :time_lock_delta, :uint32, 1 + optional :min_htlc, :int64, 2 + optional :fee_base_msat, :int64, 3 + optional :fee_rate_milli_msat, :int64, 4 + optional :disabled, :bool, 5 + end + add_message "lnrpc.ChannelEdge" do + optional :channel_id, :uint64, 1 + optional :chan_point, :string, 2 + optional :last_update, :uint32, 3 + optional :node1_pub, :string, 4 + optional :node2_pub, :string, 5 + optional :capacity, :int64, 6 + optional :node1_policy, :message, 7, "lnrpc.RoutingPolicy" + optional :node2_policy, :message, 8, "lnrpc.RoutingPolicy" + end + add_message "lnrpc.ChannelGraphRequest" do + optional :include_unannounced, :bool, 1 + end + add_message "lnrpc.ChannelGraph" do + repeated :nodes, :message, 1, "lnrpc.LightningNode" + repeated :edges, :message, 2, "lnrpc.ChannelEdge" + end + add_message "lnrpc.ChanInfoRequest" do + optional :chan_id, :uint64, 1 + end + add_message "lnrpc.NetworkInfoRequest" do + end + add_message "lnrpc.NetworkInfo" do + optional :graph_diameter, :uint32, 1 + optional :avg_out_degree, :double, 2 + optional :max_out_degree, :uint32, 3 + optional :num_nodes, :uint32, 4 + optional :num_channels, :uint32, 5 + optional :total_network_capacity, :int64, 6 + optional :avg_channel_size, :double, 7 + optional :min_channel_size, :int64, 8 + optional :max_channel_size, :int64, 9 + end + add_message "lnrpc.StopRequest" do + end + add_message "lnrpc.StopResponse" do + end + add_message "lnrpc.GraphTopologySubscription" do + end + add_message "lnrpc.GraphTopologyUpdate" do + repeated :node_updates, :message, 1, "lnrpc.NodeUpdate" + repeated :channel_updates, :message, 2, "lnrpc.ChannelEdgeUpdate" + repeated :closed_chans, :message, 3, "lnrpc.ClosedChannelUpdate" + end + add_message "lnrpc.NodeUpdate" do + repeated :addresses, :string, 1 + optional :identity_key, :string, 2 + optional :global_features, :bytes, 3 + optional :alias, :string, 4 + end + add_message "lnrpc.ChannelEdgeUpdate" do + optional :chan_id, :uint64, 1 + optional :chan_point, :message, 2, "lnrpc.ChannelPoint" + optional :capacity, :int64, 3 + optional :routing_policy, :message, 4, "lnrpc.RoutingPolicy" + optional :advertising_node, :string, 5 + optional :connecting_node, :string, 6 + end + add_message "lnrpc.ClosedChannelUpdate" do + optional :chan_id, :uint64, 1 + optional :capacity, :int64, 2 + optional :closed_height, :uint32, 3 + optional :chan_point, :message, 4, "lnrpc.ChannelPoint" + end + add_message "lnrpc.HopHint" do + optional :node_id, :string, 1 + optional :chan_id, :uint64, 2 + optional :fee_base_msat, :uint32, 3 + optional :fee_proportional_millionths, :uint32, 4 + optional :cltv_expiry_delta, :uint32, 5 + end + add_message "lnrpc.RouteHint" do + repeated :hop_hints, :message, 1, "lnrpc.HopHint" + end + add_message "lnrpc.Invoice" do + optional :memo, :string, 1 + optional :receipt, :bytes, 2 + optional :r_preimage, :bytes, 3 + optional :r_hash, :bytes, 4 + optional :value, :int64, 5 + optional :settled, :bool, 6 + optional :creation_date, :int64, 7 + optional :settle_date, :int64, 8 + optional :payment_request, :string, 9 + optional :description_hash, :bytes, 10 + optional :expiry, :int64, 11 + optional :fallback_addr, :string, 12 + optional :cltv_expiry, :uint64, 13 + repeated :route_hints, :message, 14, "lnrpc.RouteHint" + optional :private, :bool, 15 + optional :add_index, :uint64, 16 + optional :settle_index, :uint64, 17 + optional :amt_paid, :int64, 18 + optional :amt_paid_sat, :int64, 19 + optional :amt_paid_msat, :int64, 20 + end + add_message "lnrpc.AddInvoiceResponse" do + optional :r_hash, :bytes, 1 + optional :payment_request, :string, 2 + optional :add_index, :uint64, 16 + end + add_message "lnrpc.PaymentHash" do + optional :r_hash_str, :string, 1 + optional :r_hash, :bytes, 2 + end + add_message "lnrpc.ListInvoiceRequest" do + optional :pending_only, :bool, 1 + optional :index_offset, :uint64, 4 + optional :num_max_invoices, :uint64, 5 + optional :reversed, :bool, 6 + end + add_message "lnrpc.ListInvoiceResponse" do + repeated :invoices, :message, 1, "lnrpc.Invoice" + optional :last_index_offset, :uint64, 2 + optional :first_index_offset, :uint64, 3 + end + add_message "lnrpc.InvoiceSubscription" do + optional :add_index, :uint64, 1 + optional :settle_index, :uint64, 2 + end + add_message "lnrpc.Payment" do + optional :payment_hash, :string, 1 + optional :value, :int64, 2 + optional :creation_date, :int64, 3 + repeated :path, :string, 4 + optional :fee, :int64, 5 + optional :payment_preimage, :string, 6 + optional :value_sat, :int64, 7 + optional :value_msat, :int64, 8 + end + add_message "lnrpc.ListPaymentsRequest" do + end + add_message "lnrpc.ListPaymentsResponse" do + repeated :payments, :message, 1, "lnrpc.Payment" + end + add_message "lnrpc.DeleteAllPaymentsRequest" do + end + add_message "lnrpc.DeleteAllPaymentsResponse" do + end + add_message "lnrpc.AbandonChannelRequest" do + optional :channel_point, :message, 1, "lnrpc.ChannelPoint" + end + add_message "lnrpc.AbandonChannelResponse" do + end + add_message "lnrpc.DebugLevelRequest" do + optional :show, :bool, 1 + optional :level_spec, :string, 2 + end + add_message "lnrpc.DebugLevelResponse" do + optional :sub_systems, :string, 1 + end + add_message "lnrpc.PayReqString" do + optional :pay_req, :string, 1 + end + add_message "lnrpc.PayReq" do + optional :destination, :string, 1 + optional :payment_hash, :string, 2 + optional :num_satoshis, :int64, 3 + optional :timestamp, :int64, 4 + optional :expiry, :int64, 5 + optional :description, :string, 6 + optional :description_hash, :string, 7 + optional :fallback_addr, :string, 8 + optional :cltv_expiry, :int64, 9 + repeated :route_hints, :message, 10, "lnrpc.RouteHint" + end + add_message "lnrpc.FeeReportRequest" do + end + add_message "lnrpc.ChannelFeeReport" do + optional :chan_point, :string, 1 + optional :base_fee_msat, :int64, 2 + optional :fee_per_mil, :int64, 3 + optional :fee_rate, :double, 4 + end + add_message "lnrpc.FeeReportResponse" do + repeated :channel_fees, :message, 1, "lnrpc.ChannelFeeReport" + optional :day_fee_sum, :uint64, 2 + optional :week_fee_sum, :uint64, 3 + optional :month_fee_sum, :uint64, 4 + end + add_message "lnrpc.PolicyUpdateRequest" do + optional :base_fee_msat, :int64, 3 + optional :fee_rate, :double, 4 + optional :time_lock_delta, :uint32, 5 + oneof :scope do + optional :global, :bool, 1 + optional :chan_point, :message, 2, "lnrpc.ChannelPoint" + end + end + add_message "lnrpc.PolicyUpdateResponse" do + end + add_message "lnrpc.ForwardingHistoryRequest" do + optional :start_time, :uint64, 1 + optional :end_time, :uint64, 2 + optional :index_offset, :uint32, 3 + optional :num_max_events, :uint32, 4 + end + add_message "lnrpc.ForwardingEvent" do + optional :timestamp, :uint64, 1 + optional :chan_id_in, :uint64, 2 + optional :chan_id_out, :uint64, 4 + optional :amt_in, :uint64, 5 + optional :amt_out, :uint64, 6 + optional :fee, :uint64, 7 + end + add_message "lnrpc.ForwardingHistoryResponse" do + repeated :forwarding_events, :message, 1, "lnrpc.ForwardingEvent" + optional :last_offset_index, :uint32, 2 + end +end + +module Lnrpc + GenSeedRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("lnrpc.GenSeedRequest").msgclass + GenSeedResponse = Google::Protobuf::DescriptorPool.generated_pool.lookup("lnrpc.GenSeedResponse").msgclass + InitWalletRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("lnrpc.InitWalletRequest").msgclass + InitWalletResponse = Google::Protobuf::DescriptorPool.generated_pool.lookup("lnrpc.InitWalletResponse").msgclass + UnlockWalletRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("lnrpc.UnlockWalletRequest").msgclass + UnlockWalletResponse = Google::Protobuf::DescriptorPool.generated_pool.lookup("lnrpc.UnlockWalletResponse").msgclass + ChangePasswordRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("lnrpc.ChangePasswordRequest").msgclass + ChangePasswordResponse = Google::Protobuf::DescriptorPool.generated_pool.lookup("lnrpc.ChangePasswordResponse").msgclass + Transaction = Google::Protobuf::DescriptorPool.generated_pool.lookup("lnrpc.Transaction").msgclass + GetTransactionsRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("lnrpc.GetTransactionsRequest").msgclass + TransactionDetails = Google::Protobuf::DescriptorPool.generated_pool.lookup("lnrpc.TransactionDetails").msgclass + FeeLimit = Google::Protobuf::DescriptorPool.generated_pool.lookup("lnrpc.FeeLimit").msgclass + SendRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("lnrpc.SendRequest").msgclass + SendResponse = Google::Protobuf::DescriptorPool.generated_pool.lookup("lnrpc.SendResponse").msgclass + SendToRouteRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("lnrpc.SendToRouteRequest").msgclass + ChannelPoint = Google::Protobuf::DescriptorPool.generated_pool.lookup("lnrpc.ChannelPoint").msgclass + LightningAddress = Google::Protobuf::DescriptorPool.generated_pool.lookup("lnrpc.LightningAddress").msgclass + SendManyRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("lnrpc.SendManyRequest").msgclass + SendManyResponse = Google::Protobuf::DescriptorPool.generated_pool.lookup("lnrpc.SendManyResponse").msgclass + SendCoinsRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("lnrpc.SendCoinsRequest").msgclass + SendCoinsResponse = Google::Protobuf::DescriptorPool.generated_pool.lookup("lnrpc.SendCoinsResponse").msgclass + NewAddressRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("lnrpc.NewAddressRequest").msgclass + NewAddressRequest::AddressType = Google::Protobuf::DescriptorPool.generated_pool.lookup("lnrpc.NewAddressRequest.AddressType").enummodule + NewAddressResponse = Google::Protobuf::DescriptorPool.generated_pool.lookup("lnrpc.NewAddressResponse").msgclass + SignMessageRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("lnrpc.SignMessageRequest").msgclass + SignMessageResponse = Google::Protobuf::DescriptorPool.generated_pool.lookup("lnrpc.SignMessageResponse").msgclass + VerifyMessageRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("lnrpc.VerifyMessageRequest").msgclass + VerifyMessageResponse = Google::Protobuf::DescriptorPool.generated_pool.lookup("lnrpc.VerifyMessageResponse").msgclass + ConnectPeerRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("lnrpc.ConnectPeerRequest").msgclass + ConnectPeerResponse = Google::Protobuf::DescriptorPool.generated_pool.lookup("lnrpc.ConnectPeerResponse").msgclass + DisconnectPeerRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("lnrpc.DisconnectPeerRequest").msgclass + DisconnectPeerResponse = Google::Protobuf::DescriptorPool.generated_pool.lookup("lnrpc.DisconnectPeerResponse").msgclass + HTLC = Google::Protobuf::DescriptorPool.generated_pool.lookup("lnrpc.HTLC").msgclass + Channel = Google::Protobuf::DescriptorPool.generated_pool.lookup("lnrpc.Channel").msgclass + ListChannelsRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("lnrpc.ListChannelsRequest").msgclass + ListChannelsResponse = Google::Protobuf::DescriptorPool.generated_pool.lookup("lnrpc.ListChannelsResponse").msgclass + ChannelCloseSummary = Google::Protobuf::DescriptorPool.generated_pool.lookup("lnrpc.ChannelCloseSummary").msgclass + ChannelCloseSummary::ClosureType = Google::Protobuf::DescriptorPool.generated_pool.lookup("lnrpc.ChannelCloseSummary.ClosureType").enummodule + ClosedChannelsRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("lnrpc.ClosedChannelsRequest").msgclass + ClosedChannelsResponse = Google::Protobuf::DescriptorPool.generated_pool.lookup("lnrpc.ClosedChannelsResponse").msgclass + Peer = Google::Protobuf::DescriptorPool.generated_pool.lookup("lnrpc.Peer").msgclass + ListPeersRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("lnrpc.ListPeersRequest").msgclass + ListPeersResponse = Google::Protobuf::DescriptorPool.generated_pool.lookup("lnrpc.ListPeersResponse").msgclass + GetInfoRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("lnrpc.GetInfoRequest").msgclass + GetInfoResponse = Google::Protobuf::DescriptorPool.generated_pool.lookup("lnrpc.GetInfoResponse").msgclass + ConfirmationUpdate = Google::Protobuf::DescriptorPool.generated_pool.lookup("lnrpc.ConfirmationUpdate").msgclass + ChannelOpenUpdate = Google::Protobuf::DescriptorPool.generated_pool.lookup("lnrpc.ChannelOpenUpdate").msgclass + ChannelCloseUpdate = Google::Protobuf::DescriptorPool.generated_pool.lookup("lnrpc.ChannelCloseUpdate").msgclass + CloseChannelRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("lnrpc.CloseChannelRequest").msgclass + CloseStatusUpdate = Google::Protobuf::DescriptorPool.generated_pool.lookup("lnrpc.CloseStatusUpdate").msgclass + PendingUpdate = Google::Protobuf::DescriptorPool.generated_pool.lookup("lnrpc.PendingUpdate").msgclass + OpenChannelRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("lnrpc.OpenChannelRequest").msgclass + OpenStatusUpdate = Google::Protobuf::DescriptorPool.generated_pool.lookup("lnrpc.OpenStatusUpdate").msgclass + PendingHTLC = Google::Protobuf::DescriptorPool.generated_pool.lookup("lnrpc.PendingHTLC").msgclass + PendingChannelsRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("lnrpc.PendingChannelsRequest").msgclass + PendingChannelsResponse = Google::Protobuf::DescriptorPool.generated_pool.lookup("lnrpc.PendingChannelsResponse").msgclass + PendingChannelsResponse::PendingChannel = Google::Protobuf::DescriptorPool.generated_pool.lookup("lnrpc.PendingChannelsResponse.PendingChannel").msgclass + PendingChannelsResponse::PendingOpenChannel = Google::Protobuf::DescriptorPool.generated_pool.lookup("lnrpc.PendingChannelsResponse.PendingOpenChannel").msgclass + PendingChannelsResponse::WaitingCloseChannel = Google::Protobuf::DescriptorPool.generated_pool.lookup("lnrpc.PendingChannelsResponse.WaitingCloseChannel").msgclass + PendingChannelsResponse::ClosedChannel = Google::Protobuf::DescriptorPool.generated_pool.lookup("lnrpc.PendingChannelsResponse.ClosedChannel").msgclass + PendingChannelsResponse::ForceClosedChannel = Google::Protobuf::DescriptorPool.generated_pool.lookup("lnrpc.PendingChannelsResponse.ForceClosedChannel").msgclass + WalletBalanceRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("lnrpc.WalletBalanceRequest").msgclass + WalletBalanceResponse = Google::Protobuf::DescriptorPool.generated_pool.lookup("lnrpc.WalletBalanceResponse").msgclass + ChannelBalanceRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("lnrpc.ChannelBalanceRequest").msgclass + ChannelBalanceResponse = Google::Protobuf::DescriptorPool.generated_pool.lookup("lnrpc.ChannelBalanceResponse").msgclass + QueryRoutesRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("lnrpc.QueryRoutesRequest").msgclass + QueryRoutesResponse = Google::Protobuf::DescriptorPool.generated_pool.lookup("lnrpc.QueryRoutesResponse").msgclass + Hop = Google::Protobuf::DescriptorPool.generated_pool.lookup("lnrpc.Hop").msgclass + Route = Google::Protobuf::DescriptorPool.generated_pool.lookup("lnrpc.Route").msgclass + NodeInfoRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("lnrpc.NodeInfoRequest").msgclass + NodeInfo = Google::Protobuf::DescriptorPool.generated_pool.lookup("lnrpc.NodeInfo").msgclass + LightningNode = Google::Protobuf::DescriptorPool.generated_pool.lookup("lnrpc.LightningNode").msgclass + NodeAddress = Google::Protobuf::DescriptorPool.generated_pool.lookup("lnrpc.NodeAddress").msgclass + RoutingPolicy = Google::Protobuf::DescriptorPool.generated_pool.lookup("lnrpc.RoutingPolicy").msgclass + ChannelEdge = Google::Protobuf::DescriptorPool.generated_pool.lookup("lnrpc.ChannelEdge").msgclass + ChannelGraphRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("lnrpc.ChannelGraphRequest").msgclass + ChannelGraph = Google::Protobuf::DescriptorPool.generated_pool.lookup("lnrpc.ChannelGraph").msgclass + ChanInfoRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("lnrpc.ChanInfoRequest").msgclass + NetworkInfoRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("lnrpc.NetworkInfoRequest").msgclass + NetworkInfo = Google::Protobuf::DescriptorPool.generated_pool.lookup("lnrpc.NetworkInfo").msgclass + StopRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("lnrpc.StopRequest").msgclass + StopResponse = Google::Protobuf::DescriptorPool.generated_pool.lookup("lnrpc.StopResponse").msgclass + GraphTopologySubscription = Google::Protobuf::DescriptorPool.generated_pool.lookup("lnrpc.GraphTopologySubscription").msgclass + GraphTopologyUpdate = Google::Protobuf::DescriptorPool.generated_pool.lookup("lnrpc.GraphTopologyUpdate").msgclass + NodeUpdate = Google::Protobuf::DescriptorPool.generated_pool.lookup("lnrpc.NodeUpdate").msgclass + ChannelEdgeUpdate = Google::Protobuf::DescriptorPool.generated_pool.lookup("lnrpc.ChannelEdgeUpdate").msgclass + ClosedChannelUpdate = Google::Protobuf::DescriptorPool.generated_pool.lookup("lnrpc.ClosedChannelUpdate").msgclass + HopHint = Google::Protobuf::DescriptorPool.generated_pool.lookup("lnrpc.HopHint").msgclass + RouteHint = Google::Protobuf::DescriptorPool.generated_pool.lookup("lnrpc.RouteHint").msgclass + Invoice = Google::Protobuf::DescriptorPool.generated_pool.lookup("lnrpc.Invoice").msgclass + AddInvoiceResponse = Google::Protobuf::DescriptorPool.generated_pool.lookup("lnrpc.AddInvoiceResponse").msgclass + PaymentHash = Google::Protobuf::DescriptorPool.generated_pool.lookup("lnrpc.PaymentHash").msgclass + ListInvoiceRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("lnrpc.ListInvoiceRequest").msgclass + ListInvoiceResponse = Google::Protobuf::DescriptorPool.generated_pool.lookup("lnrpc.ListInvoiceResponse").msgclass + InvoiceSubscription = Google::Protobuf::DescriptorPool.generated_pool.lookup("lnrpc.InvoiceSubscription").msgclass + Payment = Google::Protobuf::DescriptorPool.generated_pool.lookup("lnrpc.Payment").msgclass + ListPaymentsRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("lnrpc.ListPaymentsRequest").msgclass + ListPaymentsResponse = Google::Protobuf::DescriptorPool.generated_pool.lookup("lnrpc.ListPaymentsResponse").msgclass + DeleteAllPaymentsRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("lnrpc.DeleteAllPaymentsRequest").msgclass + DeleteAllPaymentsResponse = Google::Protobuf::DescriptorPool.generated_pool.lookup("lnrpc.DeleteAllPaymentsResponse").msgclass + AbandonChannelRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("lnrpc.AbandonChannelRequest").msgclass + AbandonChannelResponse = Google::Protobuf::DescriptorPool.generated_pool.lookup("lnrpc.AbandonChannelResponse").msgclass + DebugLevelRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("lnrpc.DebugLevelRequest").msgclass + DebugLevelResponse = Google::Protobuf::DescriptorPool.generated_pool.lookup("lnrpc.DebugLevelResponse").msgclass + PayReqString = Google::Protobuf::DescriptorPool.generated_pool.lookup("lnrpc.PayReqString").msgclass + PayReq = Google::Protobuf::DescriptorPool.generated_pool.lookup("lnrpc.PayReq").msgclass + FeeReportRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("lnrpc.FeeReportRequest").msgclass + ChannelFeeReport = Google::Protobuf::DescriptorPool.generated_pool.lookup("lnrpc.ChannelFeeReport").msgclass + FeeReportResponse = Google::Protobuf::DescriptorPool.generated_pool.lookup("lnrpc.FeeReportResponse").msgclass + PolicyUpdateRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("lnrpc.PolicyUpdateRequest").msgclass + PolicyUpdateResponse = Google::Protobuf::DescriptorPool.generated_pool.lookup("lnrpc.PolicyUpdateResponse").msgclass + ForwardingHistoryRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("lnrpc.ForwardingHistoryRequest").msgclass + ForwardingEvent = Google::Protobuf::DescriptorPool.generated_pool.lookup("lnrpc.ForwardingEvent").msgclass + ForwardingHistoryResponse = Google::Protobuf::DescriptorPool.generated_pool.lookup("lnrpc.ForwardingHistoryResponse").msgclass +end diff --git a/lib/lnrpc/rpc_services_pb.rb b/lib/lnrpc/rpc_services_pb.rb new file mode 100644 index 0000000..0b2df0b --- /dev/null +++ b/lib/lnrpc/rpc_services_pb.rb @@ -0,0 +1,307 @@ +# Generated by the protocol buffer compiler. DO NOT EDIT! +# Source: rpc.proto for package 'lnrpc' + +require 'grpc' +require_relative 'rpc_pb' + +module Lnrpc + module WalletUnlocker + # The WalletUnlocker service is used to set up a wallet password for + # lnd at first startup, and unlock a previously set up wallet. + class Service + + include GRPC::GenericService + + self.marshal_class_method = :encode + self.unmarshal_class_method = :decode + self.service_name = 'lnrpc.WalletUnlocker' + + # * + # GenSeed is the first method that should be used to instantiate a new lnd + # instance. This method allows a caller to generate a new aezeed cipher seed + # given an optional passphrase. If provided, the passphrase will be necessary + # to decrypt the cipherseed to expose the internal wallet seed. + # + # Once the cipherseed is obtained and verified by the user, the InitWallet + # method should be used to commit the newly generated seed, and create the + # wallet. + rpc :GenSeed, GenSeedRequest, GenSeedResponse + # * + # InitWallet is used when lnd is starting up for the first time to fully + # initialize the daemon and its internal wallet. At the very least a wallet + # password must be provided. This will be used to encrypt sensitive material + # on disk. + # + # In the case of a recovery scenario, the user can also specify their aezeed + # mnemonic and passphrase. If set, then the daemon will use this prior state + # to initialize its internal wallet. + # + # Alternatively, this can be used along with the GenSeed RPC to obtain a + # seed, then present it to the user. Once it has been verified by the user, + # the seed can be fed into this RPC in order to commit the new wallet. + rpc :InitWallet, InitWalletRequest, InitWalletResponse + # * lncli: `unlock` + # UnlockWallet is used at startup of lnd to provide a password to unlock + # the wallet database. + rpc :UnlockWallet, UnlockWalletRequest, UnlockWalletResponse + # * lncli: `changepassword` + # ChangePassword changes the password of the encrypted wallet. This will + # automatically unlock the wallet database if successful. + rpc :ChangePassword, ChangePasswordRequest, ChangePasswordResponse + end + + Stub = Service.rpc_stub_class + end + module Lightning + class Service + + include GRPC::GenericService + + self.marshal_class_method = :encode + self.unmarshal_class_method = :decode + self.service_name = 'lnrpc.Lightning' + + # * lncli: `walletbalance` + # WalletBalance returns total unspent outputs(confirmed and unconfirmed), all + # confirmed unspent outputs and all unconfirmed unspent outputs under control + # of the wallet. + rpc :WalletBalance, WalletBalanceRequest, WalletBalanceResponse + # * lncli: `channelbalance` + # ChannelBalance returns the total funds available across all open channels + # in satoshis. + rpc :ChannelBalance, ChannelBalanceRequest, ChannelBalanceResponse + # * lncli: `listchaintxns` + # GetTransactions returns a list describing all the known transactions + # relevant to the wallet. + rpc :GetTransactions, GetTransactionsRequest, TransactionDetails + # * lncli: `sendcoins` + # SendCoins executes a request to send coins to a particular address. Unlike + # SendMany, this RPC call only allows creating a single output at a time. If + # neither target_conf, or sat_per_byte are set, then the internal wallet will + # consult its fee model to determine a fee for the default confirmation + # target. + rpc :SendCoins, SendCoinsRequest, SendCoinsResponse + # * + # SubscribeTransactions creates a uni-directional stream from the server to + # the client in which any newly discovered transactions relevant to the + # wallet are sent over. + rpc :SubscribeTransactions, GetTransactionsRequest, stream(Transaction) + # * lncli: `sendmany` + # SendMany handles a request for a transaction that creates multiple specified + # outputs in parallel. If neither target_conf, or sat_per_byte are set, then + # the internal wallet will consult its fee model to determine a fee for the + # default confirmation target. + rpc :SendMany, SendManyRequest, SendManyResponse + # * lncli: `newaddress` + # NewAddress creates a new address under control of the local wallet. + rpc :NewAddress, NewAddressRequest, NewAddressResponse + # * lncli: `signmessage` + # SignMessage signs a message with this node's private key. The returned + # signature string is `zbase32` encoded and pubkey recoverable, meaning that + # only the message digest and signature are needed for verification. + rpc :SignMessage, SignMessageRequest, SignMessageResponse + # * lncli: `verifymessage` + # VerifyMessage verifies a signature over a msg. The signature must be + # zbase32 encoded and signed by an active node in the resident node's + # channel database. In addition to returning the validity of the signature, + # VerifyMessage also returns the recovered pubkey from the signature. + rpc :VerifyMessage, VerifyMessageRequest, VerifyMessageResponse + # * lncli: `connect` + # ConnectPeer attempts to establish a connection to a remote peer. This is at + # the networking level, and is used for communication between nodes. This is + # distinct from establishing a channel with a peer. + rpc :ConnectPeer, ConnectPeerRequest, ConnectPeerResponse + # * lncli: `disconnect` + # DisconnectPeer attempts to disconnect one peer from another identified by a + # given pubKey. In the case that we currently have a pending or active channel + # with the target peer, then this action will be not be allowed. + rpc :DisconnectPeer, DisconnectPeerRequest, DisconnectPeerResponse + # * lncli: `listpeers` + # ListPeers returns a verbose listing of all currently active peers. + rpc :ListPeers, ListPeersRequest, ListPeersResponse + # * lncli: `getinfo` + # GetInfo returns general information concerning the lightning node including + # it's identity pubkey, alias, the chains it is connected to, and information + # concerning the number of open+pending channels. + rpc :GetInfo, GetInfoRequest, GetInfoResponse + # TODO(roasbeef): merge with below with bool? + # + # * lncli: `pendingchannels` + # PendingChannels returns a list of all the channels that are currently + # considered "pending". A channel is pending if it has finished the funding + # workflow and is waiting for confirmations for the funding txn, or is in the + # process of closure, either initiated cooperatively or non-cooperatively. + rpc :PendingChannels, PendingChannelsRequest, PendingChannelsResponse + # * lncli: `listchannels` + # ListChannels returns a description of all the open channels that this node + # is a participant in. + rpc :ListChannels, ListChannelsRequest, ListChannelsResponse + # * lncli: `closedchannels` + # ClosedChannels returns a description of all the closed channels that + # this node was a participant in. + rpc :ClosedChannels, ClosedChannelsRequest, ClosedChannelsResponse + # * + # OpenChannelSync is a synchronous version of the OpenChannel RPC call. This + # call is meant to be consumed by clients to the REST proxy. As with all + # other sync calls, all byte slices are intended to be populated as hex + # encoded strings. + rpc :OpenChannelSync, OpenChannelRequest, ChannelPoint + # * lncli: `openchannel` + # OpenChannel attempts to open a singly funded channel specified in the + # request to a remote peer. Users are able to specify a target number of + # blocks that the funding transaction should be confirmed in, or a manual fee + # rate to us for the funding transaction. If neither are specified, then a + # lax block confirmation target is used. + rpc :OpenChannel, OpenChannelRequest, stream(OpenStatusUpdate) + # * lncli: `closechannel` + # CloseChannel attempts to close an active channel identified by its channel + # outpoint (ChannelPoint). The actions of this method can additionally be + # augmented to attempt a force close after a timeout period in the case of an + # inactive peer. If a non-force close (cooperative closure) is requested, + # then the user can specify either a target number of blocks until the + # closure transaction is confirmed, or a manual fee rate. If neither are + # specified, then a default lax, block confirmation target is used. + rpc :CloseChannel, CloseChannelRequest, stream(CloseStatusUpdate) + # * lncli: `abandonchannel` + # AbandonChannel removes all channel state from the database except for a + # close summary. This method can be used to get rid of permanently unusable + # channels due to bugs fixed in newer versions of lnd. Only available + # when in debug builds of lnd. + rpc :AbandonChannel, AbandonChannelRequest, AbandonChannelResponse + # * lncli: `sendpayment` + # SendPayment dispatches a bi-directional streaming RPC for sending payments + # through the Lightning Network. A single RPC invocation creates a persistent + # bi-directional stream allowing clients to rapidly send payments through the + # Lightning Network with a single persistent connection. + rpc :SendPayment, stream(SendRequest), stream(SendResponse) + # * + # SendPaymentSync is the synchronous non-streaming version of SendPayment. + # This RPC is intended to be consumed by clients of the REST proxy. + # Additionally, this RPC expects the destination's public key and the payment + # hash (if any) to be encoded as hex strings. + rpc :SendPaymentSync, SendRequest, SendResponse + # * lncli: `sendtoroute` + # SendToRoute is a bi-directional streaming RPC for sending payment through + # the Lightning Network. This method differs from SendPayment in that it + # allows users to specify a full route manually. This can be used for things + # like rebalancing, and atomic swaps. + rpc :SendToRoute, stream(SendToRouteRequest), stream(SendResponse) + # * + # SendToRouteSync is a synchronous version of SendToRoute. It Will block + # until the payment either fails or succeeds. + rpc :SendToRouteSync, SendToRouteRequest, SendResponse + # * lncli: `addinvoice` + # AddInvoice attempts to add a new invoice to the invoice database. Any + # duplicated invoices are rejected, therefore all invoices *must* have a + # unique payment preimage. + rpc :AddInvoice, Invoice, AddInvoiceResponse + # * lncli: `listinvoices` + # ListInvoices returns a list of all the invoices currently stored within the + # database. Any active debug invoices are ignored. It has full support for + # paginated responses, allowing users to query for specific invoices through + # their add_index. This can be done by using either the first_index_offset or + # last_index_offset fields included in the response as the index_offset of the + # next request. The reversed flag is set by default in order to paginate + # backwards. If you wish to paginate forwards, you must explicitly set the + # flag to false. If none of the parameters are specified, then the last 100 + # invoices will be returned. + rpc :ListInvoices, ListInvoiceRequest, ListInvoiceResponse + # * lncli: `lookupinvoice` + # LookupInvoice attempts to look up an invoice according to its payment hash. + # The passed payment hash *must* be exactly 32 bytes, if not, an error is + # returned. + rpc :LookupInvoice, PaymentHash, Invoice + # * + # SubscribeInvoices returns a uni-directional stream (server -> client) for + # notifying the client of newly added/settled invoices. The caller can + # optionally specify the add_index and/or the settle_index. If the add_index + # is specified, then we'll first start by sending add invoice events for all + # invoices with an add_index greater than the specified value. If the + # settle_index is specified, the next, we'll send out all settle events for + # invoices with a settle_index greater than the specified value. One or both + # of these fields can be set. If no fields are set, then we'll only send out + # the latest add/settle events. + rpc :SubscribeInvoices, InvoiceSubscription, stream(Invoice) + # * lncli: `decodepayreq` + # DecodePayReq takes an encoded payment request string and attempts to decode + # it, returning a full description of the conditions encoded within the + # payment request. + rpc :DecodePayReq, PayReqString, PayReq + # * lncli: `listpayments` + # ListPayments returns a list of all outgoing payments. + rpc :ListPayments, ListPaymentsRequest, ListPaymentsResponse + # * + # DeleteAllPayments deletes all outgoing payments from DB. + rpc :DeleteAllPayments, DeleteAllPaymentsRequest, DeleteAllPaymentsResponse + # * lncli: `describegraph` + # DescribeGraph returns a description of the latest graph state from the + # point of view of the node. The graph information is partitioned into two + # components: all the nodes/vertexes, and all the edges that connect the + # vertexes themselves. As this is a directed graph, the edges also contain + # the node directional specific routing policy which includes: the time lock + # delta, fee information, etc. + rpc :DescribeGraph, ChannelGraphRequest, ChannelGraph + # * lncli: `getchaninfo` + # GetChanInfo returns the latest authenticated network announcement for the + # given channel identified by its channel ID: an 8-byte integer which + # uniquely identifies the location of transaction's funding output within the + # blockchain. + rpc :GetChanInfo, ChanInfoRequest, ChannelEdge + # * lncli: `getnodeinfo` + # GetNodeInfo returns the latest advertised, aggregated, and authenticated + # channel information for the specified node identified by its public key. + rpc :GetNodeInfo, NodeInfoRequest, NodeInfo + # * lncli: `queryroutes` + # QueryRoutes attempts to query the daemon's Channel Router for a possible + # route to a target destination capable of carrying a specific amount of + # satoshis. The retuned route contains the full details required to craft and + # send an HTLC, also including the necessary information that should be + # present within the Sphinx packet encapsulated within the HTLC. + rpc :QueryRoutes, QueryRoutesRequest, QueryRoutesResponse + # * lncli: `getnetworkinfo` + # GetNetworkInfo returns some basic stats about the known channel graph from + # the point of view of the node. + rpc :GetNetworkInfo, NetworkInfoRequest, NetworkInfo + # * lncli: `stop` + # StopDaemon will send a shutdown request to the interrupt handler, triggering + # a graceful shutdown of the daemon. + rpc :StopDaemon, StopRequest, StopResponse + # * + # SubscribeChannelGraph launches a streaming RPC that allows the caller to + # receive notifications upon any changes to the channel graph topology from + # the point of view of the responding node. Events notified include: new + # nodes coming online, nodes updating their authenticated attributes, new + # channels being advertised, updates in the routing policy for a directional + # channel edge, and when channels are closed on-chain. + rpc :SubscribeChannelGraph, GraphTopologySubscription, stream(GraphTopologyUpdate) + # * lncli: `debuglevel` + # DebugLevel allows a caller to programmatically set the logging verbosity of + # lnd. The logging can be targeted according to a coarse daemon-wide logging + # level, or in a granular fashion to specify the logging for a target + # sub-system. + rpc :DebugLevel, DebugLevelRequest, DebugLevelResponse + # * lncli: `feereport` + # FeeReport allows the caller to obtain a report detailing the current fee + # schedule enforced by the node globally for each channel. + rpc :FeeReport, FeeReportRequest, FeeReportResponse + # * lncli: `updatechanpolicy` + # UpdateChannelPolicy allows the caller to update the fee schedule and + # channel policies for all channels globally, or a particular channel. + rpc :UpdateChannelPolicy, PolicyUpdateRequest, PolicyUpdateResponse + # * lncli: `fwdinghistory` + # ForwardingHistory allows the caller to query the htlcswitch for a record of + # all HTLC's forwarded within the target time range, and integer offset + # within that time range. If no time-range is specified, then the first chunk + # of the past 24 hrs of forwarding history are returned. + # + # A list of forwarding events are returned. The size of each forwarding event + # is 40 bytes, and the max message size able to be returned in gRPC is 4 MiB. + # As a result each message can only contain 50k entries. Each response has + # the index offset of the last entry. The index offset can be provided to the + # request to allow the caller to skip a series of records. + rpc :ForwardingHistory, ForwardingHistoryRequest, ForwardingHistoryResponse + end + + Stub = Service.rpc_stub_class + end +end diff --git a/lib/lnrpc/version.rb b/lib/lnrpc/version.rb new file mode 100644 index 0000000..f03e155 --- /dev/null +++ b/lib/lnrpc/version.rb @@ -0,0 +1,3 @@ +module Lnrpc + VERSION = "0.1.0" +end diff --git a/lnrpc.gemspec b/lnrpc.gemspec new file mode 100644 index 0000000..dd42878 --- /dev/null +++ b/lnrpc.gemspec @@ -0,0 +1,31 @@ + +lib = File.expand_path("../lib", __FILE__) +$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) +require "lnrpc/version" + +Gem::Specification.new do |spec| + spec.name = "lnrpc" + spec.version = Lnrpc::VERSION + spec.authors = ["Michael Bumann"] + spec.email = ["hello@michaelbumann.com"] + + spec.summary = %q{gRPC interface for lnd packed as ruby gem} + spec.description = %q{gRPC service definitions for the Lightning Network Daemon (lnd) gRPC interace packed as ruby gem} + spec.homepage = "https://github.com/bumi/lnrpc" + spec.license = "MIT" + + # Specify which files should be added to the gem when it is released. + # The `git ls-files -z` loads the files in the RubyGem that have been added into git. + spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do + `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) } + end + spec.bindir = "exe" + spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) } + spec.require_paths = ["lib"] + + spec.add_development_dependency "bundler", "~> 1.17" + spec.add_development_dependency "rake", "~> 10.0" + spec.add_development_dependency "rspec", "~> 3.0" + + spec.add_dependency "grpc", ">= 1.16.0" +end diff --git a/spec/lnrpc_spec.rb b/spec/lnrpc_spec.rb new file mode 100644 index 0000000..71de67a --- /dev/null +++ b/spec/lnrpc_spec.rb @@ -0,0 +1,5 @@ +RSpec.describe Lnrpc do + it "has a version number" do + expect(Lnrpc::VERSION).not_to be nil + end +end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb new file mode 100644 index 0000000..a3a7a34 --- /dev/null +++ b/spec/spec_helper.rb @@ -0,0 +1,14 @@ +require "bundler/setup" +require "lnrpc" + +RSpec.configure do |config| + # Enable flags like --only-failures and --next-failure + config.example_status_persistence_file_path = ".rspec_status" + + # Disable RSpec exposing methods globally on `Module` and `main` + config.disable_monkey_patching! + + config.expect_with :rspec do |c| + c.syntax = :expect + end +end