diff --git a/README.md b/README.md index 9edf834..d1374ed 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ This gem makes the gRPC client classes created from the [LND service defintions] ```ruby require "lnrpc" -# the gRPC client is available under the Lnrpc namespace, e.g. +# the gRPC client is available under the Lnrpc namespace, e.g. Lnrpc::Lightning::Stub Lnrpc::GetInfoRequest @@ -45,7 +45,7 @@ The LND API reference can be found here: [https://api.lightning.community/](http ```ruby require "lnrpc" -credentials = File.read("/path/to/tls.cert") +credentials = File.read("/path/to/tls.cert") macaroon = File.read("/path/to/readonly.macaroon").unpack("H*") # initialize a new client @@ -54,12 +54,12 @@ client = Lnrpc::Lightning::Stub.new("localhost:10009", GRPC::Core::ChannelCreden # perform a request request = Lnrpc::GetInfoRequest.new response = client.get_info(request, { metadata: { macaroon: macaroon } }) #=> Lnrpc::GetInfoResponse -puts response.alias +puts response.alias ``` ### Client wrapper -An optional client wrapper ([Lnrpc::Client](https://github.com/bumi/lnrpc/blob/master/lib/lnrpc/client.rb)) makes +An optional client wrapper ([Lnrpc::Client](https://github.com/bumi/lnrpc/blob/master/lib/lnrpc/client.rb)) makes initializing the gRPC client easier and removes the need for some boilerplate code for calling RPC methods. #### Example @@ -72,25 +72,25 @@ Also have a look at [examples.rb](https://github.com/bumi/lnrpc/blob/master/exam #### Initializing a new client -The Lnrpc::Client constructor allows the following options: +The Lnrpc::Client constructor allows the following options: -* credentials: +* credentials: - `credentials` : the credentials data as string (pass nil if a "trusted" cert (e.g. from letsencrypt is used) - `credentials_path` : the path to a credentials file (tls.cert) as string (default: `"#{LND_HOME_DIR}/tls.cert"` ) -* macaroon: +* macaroon: - `macaroon` : the macaroon as hex string - `macaroon_path` : the path to the macaroon file created by lnd as string (default: `"#{LND_HOME_DIR}/data/chain/bitcoin/mainnet/admin.macaroon"`) * address: - `address` : lnd address as string. format: address:port, e.g. localhost:10009 (default) -If no credentials or no macaroon is provided default files are assumed in `ENV['LND_HOME'] || "~/.lnd"`. +If no credentials or no macaroon is provided default files are assumed in `ENV['LND_HOME'] || "~/.lnd"`. A macaroon is required. ```ruby require 'lnrpc' lnd = Lnrpc::Client.new({ - credentials_path: '/path/to.cert.cls', + credentials_path: '/path/to.cert.cls', macaroon_path: '/path/to/admin.macaroon', address: 'host:port' }) @@ -103,22 +103,22 @@ lnd.grpc_client The client wrapper passes any supported RPC method call to the gRPC client applying the following conventions: -If the first parameter is a hash or blank the corresponding gRPC request object will be instantiated. +If the first parameter is a hash or blank the corresponding gRPC request object will be instantiated. Example: ```ruby client.get_info -# is the same as: +# is the same as: client.grpc_client.get_info(Lnrpc::GetInfoRequest.new) client.list_channels(inactive_only: true) -# is the same as: +# is the same as: request = Lnrpc::ListChannelsRequest.new(inactive_only: true) client.grpc_client.list_channels(request) client.wallet_balance.total_balance -# is the same as: +# is the same as: request = Lnrpc::WalletBalanceRequest.new() client.grpc_client.wallet_balance(request).total_balance ``` @@ -133,14 +133,24 @@ If you have a running BTC Pay Server with LND support, integrating with lnrpc is - Initialize your client with the options detailed above. BTC Pay Server utilizes LetsEncrypt for trusted TLC Certificates so set that option to nil. Don't have a BTC Pay Server? [Setting one up is easy.](https://medium.com/@BtcpayServer/launch-btcpay-server-via-web-interface-and-deploy-full-bitcoin-node-lnd-in-less-than-a-minute-dc8bc6f06a3) - + ## Versioning -This gem follows the LND versions and will update the gRPC service definitions accordingly. +This gem follows the LND versions and will update the gRPC service definitions accordingly. e.g. gem version 0.5.2 includes the gRPC service definitions from LND v0.5.2 +### Update service definitions + +1. Generate `prc_pb.rb` and `rpc_services_pb.rb` + + $ grpc_tools_ruby_protoc -I/usr/local/include -I. -I$GOPATH/src/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis --ruby_out=plugins=grpc,paths=source_relative:. --grpc_out=. rpc.proto + +2. Copy `rpc.proto`, `rpc_pb.rb` and `rpc_services_pb.rb` to `lib` + +3. Update `rpc_services_pb.rb` to use `require_relative` to load `rpc_pb` + ## Other resources * [LND gRPC API Reference](https://api.lightning.community) diff --git a/lib/lnrpc/rpc.proto b/lib/lnrpc/rpc.proto index abf0929..dfe5520 100644 --- a/lib/lnrpc/rpc.proto +++ b/lib/lnrpc/rpc.proto @@ -3,6 +3,9 @@ syntax = "proto3"; import "google/api/annotations.proto"; package lnrpc; + +option go_package = "github.com/lightningnetwork/lnd/lnrpc"; + /** * Comments in this file will be directly parsed into the API * Documentation as descriptions of the associated method, message, or field. @@ -142,11 +145,21 @@ message InitWalletRequest { /** 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 + individual 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; + + /** + channel_backups is an optional argument that allows clients to recover the + settled funds within a set of channels. This should be populated if the + user was unable to close out all channels and sweep funds before partial or + total data loss occurred. If specified, then after on-chain recovery of + funds, lnd begin to carry out the data loss recovery protocol in order to + recover the funds in each channel from a remote force closed transaction. + */ + ChanBackupSnapshot channel_backups = 5; } message InitWalletResponse { } @@ -167,6 +180,16 @@ message UnlockWalletRequest { the first initialization of the wallet. */ int32 recovery_window = 2; + + /** + channel_backups is an optional argument that allows clients to recover the + settled funds within a set of channels. This should be populated if the + user was unable to close out all channels and sweep funds before partial or + total data loss occurred. If specified, then after on-chain recovery of + funds, lnd begin to carry out the data loss recovery protocol in order to + recover the funds in each channel from a remote force closed transaction. + */ + ChanBackupSnapshot channel_backups = 3; } message UnlockWalletResponse {} @@ -217,6 +240,16 @@ service Lightning { }; } + /** lncli: `estimatefee` + EstimateFee asks the chain backend to estimate the fee rate and total fees + for a transaction that pays to multiple specified outputs. + */ + rpc EstimateFee (EstimateFeeRequest) returns (EstimateFeeResponse) { + option (google.api.http) = { + get: "/v1/transactions/fee" + }; + } + /** 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 @@ -231,6 +264,16 @@ service Lightning { }; } + /** lncli: `listunspent` + ListUnspent returns a list of all utxos spendable by the wallet with a + number of confirmations between the specified minimum and maximum. + */ + rpc ListUnspent (ListUnspentRequest) returns (ListUnspentResponse) { + option (google.api.http) = { + get: "/v1/utxos" + }; + } + /** SubscribeTransactions creates a uni-directional stream from the server to the client in which any newly discovered transactions relevant to the @@ -260,7 +303,12 @@ service Lightning { 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); + rpc SignMessage (SignMessageRequest) returns (SignMessageResponse) { + option (google.api.http) = { + post: "/v1/signmessage" + body: "*" + }; + } /** lncli: `verifymessage` VerifyMessage verifies a signature over a msg. The signature must be @@ -268,7 +316,12 @@ service Lightning { 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); + rpc VerifyMessage (VerifyMessageRequest) returns (VerifyMessageResponse) { + option (google.api.http) = { + post: "/v1/verifymessage" + body: "*" + }; + } /** lncli: `connect` ConnectPeer attempts to establish a connection to a remote peer. This is at @@ -336,6 +389,14 @@ service Lightning { }; } + /** lncli: `subscribechannelevents` + SubscribeChannelEvents creates a uni-directional stream from the server to + the client in which any updates relevant to the state of the channels are + sent over. Events include new active channels, inactive channels, and closed + channels. + */ + rpc SubscribeChannelEvents (ChannelEventSubscription) returns (stream ChannelEventUpdate); + /** lncli: `closedchannels` ClosedChannels returns a description of all the closed channels that this node was a participant in. @@ -455,10 +516,8 @@ service Lightning { 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. + next request. By default, the first 100 invoices created will be returned. + Backwards pagination is also supported through the Reversed flag. */ rpc ListInvoices (ListInvoiceRequest) returns (ListInvoiceResponse) { option (google.api.http) = { @@ -629,7 +688,7 @@ service Lightning { /** 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 + all HTLCs 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. @@ -645,6 +704,90 @@ service Lightning { body: "*" }; }; + + /** lncli: `exportchanbackup` + ExportChannelBackup attempts to return an encrypted static channel backup + for the target channel identified by it channel point. The backup is + encrypted with a key generated from the aezeed seed of the user. The + returned backup can either be restored using the RestoreChannelBackup + method once lnd is running, or via the InitWallet and UnlockWallet methods + from the WalletUnlocker service. + */ + rpc ExportChannelBackup(ExportChannelBackupRequest) returns (ChannelBackup) { + option (google.api.http) = { + get: "/v1/channels/backup/{chan_point.funding_txid_str}/{chan_point.output_index}" + }; + }; + + /** + ExportAllChannelBackups returns static channel backups for all existing + channels known to lnd. A set of regular singular static channel backups for + each channel are returned. Additionally, a multi-channel backup is returned + as well, which contains a single encrypted blob containing the backups of + each channel. + */ + rpc ExportAllChannelBackups(ChanBackupExportRequest) returns (ChanBackupSnapshot) { + option (google.api.http) = { + get: "/v1/channels/backup" + }; + }; + + /** + VerifyChanBackup allows a caller to verify the integrity of a channel backup + snapshot. This method will accept either a packed Single or a packed Multi. + Specifying both will result in an error. + */ + rpc VerifyChanBackup(ChanBackupSnapshot) returns (VerifyChanBackupResponse) { + option (google.api.http) = { + post: "/v1/channels/backup/verify" + body: "*" + }; + }; + + /** lncli: `restorechanbackup` + RestoreChannelBackups accepts a set of singular channel backups, or a + single encrypted multi-chan backup and attempts to recover any funds + remaining within the channel. If we are able to unpack the backup, then the + new channel will be shown under listchannels, as well as pending channels. + */ + rpc RestoreChannelBackups(RestoreChanBackupRequest) returns (RestoreBackupResponse) { + option (google.api.http) = { + post: "/v1/channels/backup/restore" + body: "*" + }; + }; + + /** + SubscribeChannelBackups allows a client to sub-subscribe to the most up to + date information concerning the state of all channel backups. Each time a + new channel is added, we return the new set of channels, along with a + multi-chan backup containing the backup info for all channels. Each time a + channel is closed, we send a new update, which contains new new chan back + ups, but the updated set of encrypted multi-chan backups with the closed + channel(s) removed. + */ + rpc SubscribeChannelBackups(ChannelBackupSubscription) returns (stream ChanBackupSnapshot) { + }; +} + +message Utxo { + /// The type of address + AddressType type = 1 [json_name = "address_type"]; + + /// The address + string address = 2 [json_name = "address"]; + + /// The value of the unspent coin in satoshis + int64 amount_sat = 3 [json_name = "amount_sat"]; + + /// The pkscript in hex + string pk_script = 4 [json_name = "pk_script"]; + + /// The outpoint in format txid:n + OutPoint outpoint = 5 [json_name = "outpoint"]; + + /// The number of confirmations for the Utxo + int64 confirmations = 6 [json_name = "confirmations"]; } message Transaction { @@ -725,11 +868,25 @@ message SendRequest { send the payment. */ FeeLimit fee_limit = 8; + + /** + The channel id of the channel that must be taken to the first hop. If zero, + any channel may be used. + */ + uint64 outgoing_chan_id = 9; + + /** + An optional maximum total time lock for the route. If zero, there is no + maximum enforced. + */ + uint32 cltv_limit = 10; } + 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"]; + bytes payment_hash = 4 [json_name = "payment_hash"]; } message SendToRouteRequest { @@ -739,8 +896,16 @@ message SendToRouteRequest { /// 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; + /** + Deprecated. The set of routes that should be used to attempt to complete the + payment. The possibility to pass in multiple routes is deprecated and + instead the single route field below should be used in combination with the + streaming variant of SendToRoute. + */ + repeated Route routes = 3 [deprecated = true]; + + /// Route that should be used to attempt to complete the payment. + Route route = 4; } message ChannelPoint { @@ -756,6 +921,17 @@ message ChannelPoint { uint32 output_index = 3 [json_name = "output_index"]; } +message OutPoint { + /// Raw bytes representing the transaction id. + bytes txid_bytes = 1 [json_name = "txid_bytes"]; + + /// Reversed, hex-encoded string representing the transaction id. + string txid_str = 2 [json_name = "txid_str"]; + + /// The index of the output on the transaction. + uint32 output_index = 3 [json_name = "output_index"]; +} + message LightningAddress { /// The identity pubkey of the Lightning node string pubkey = 1 [json_name = "pubkey"]; @@ -764,6 +940,22 @@ message LightningAddress { string host = 2 [json_name = "host"]; } +message EstimateFeeRequest { + /// The map from addresses to amounts for the transaction. + map AddrToAmount = 1; + + /// The target number of blocks that this transaction should be confirmed by. + int32 target_conf = 2; +} + +message EstimateFeeResponse { + /// The total fee in satoshis. + int64 fee_sat = 1 [json_name = "fee_sat"]; + + /// The fee rate in satoshi/byte. + int64 feerate_sat_per_byte = 2 [json_name = "feerate_sat_per_byte"]; +} + message SendManyRequest { /// The map from addresses to amounts map AddrToAmount = 1; @@ -791,24 +983,45 @@ message SendCoinsRequest { /// A manual fee rate set in sat/byte that should be used when crafting the transaction. int64 sat_per_byte = 5; + + /** + If set, then the amount field will be ignored, and lnd will attempt to + send all the coins under control of the internal wallet to the specified + address. + */ + bool send_all = 6; } message SendCoinsResponse { /// The transaction ID of the transaction string txid = 1 [json_name = "txid"]; } +message ListUnspentRequest { + /// The minimum number of confirmations to be included. + int32 min_confs = 1; + + /// The maximum number of confirmations to be included. + int32 max_confs = 2; +} +message ListUnspentResponse { + /// A list of utxos + repeated Utxo utxos = 1 [json_name = "utxos"]; +} + /** `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 { +enum AddressType { WITNESS_PUBKEY_HASH = 0; NESTED_PUBKEY_HASH = 1; - } + UNUSED_WITNESS_PUBKEY_HASH = 2; + UNUSED_NESTED_PUBKEY_HASH = 3; +} +message NewAddressRequest { /// The address type AddressType type = 1; } @@ -938,14 +1151,19 @@ message 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. + The CSV delay expressed in relative blocks. If the channel is force closed, + we will 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 + /// Whether this channel is advertised to the network or not. bool private = 17 [json_name = "private"]; + + /// True if we were the ones that created the channel. + bool initiator = 18 [json_name = "initiator"]; + + /// A set of flags showing the current state of the cahnnel. + string chan_status_flags = 19 [json_name = "chan_status_flags"]; } @@ -1038,6 +1256,26 @@ message Peer { /// Ping time to this peer int64 ping_time = 9 [json_name = "ping_time"]; + + enum SyncType { + /** + Denotes that we cannot determine the peer's current sync type. + */ + UNKNOWN_SYNC = 0; + + /** + Denotes that we are actively receiving new graph updates from the peer. + */ + ACTIVE_SYNC = 1; + + /** + Denotes that we are not receiving new graph updates from the peer. + */ + PASSIVE_SYNC = 2; + } + + // The type of sync we are currently performing with this peer. + SyncType sync_type = 10 [json_name = "sync_type"]; } message ListPeersRequest { @@ -1075,11 +1313,13 @@ message GetInfoResponse { /// 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"]; + /** + Whether the current node is connected to testnet. This field is + deprecated and the network field should be used instead + **/ + bool testnet = 10 [json_name = "testnet", deprecated = true]; - /// A list of active chains the node is connected to - repeated string chains = 11 [json_name = "chains"]; + reserved 11; /// The URIs of the current node. repeated string uris = 12 [json_name = "uris"]; @@ -1092,6 +1332,17 @@ message GetInfoResponse { /// Number of inactive channels uint32 num_inactive_channels = 15 [json_name = "num_inactive_channels"]; + + /// A list of active chains the node is connected to + repeated Chain chains = 16 [json_name = "chains"]; +} + +message Chain { + /// The blockchain the node is on (eg bitcoin, litecoin) + string chain = 1 [json_name = "chain"]; + + /// The network the node is on (eg regtest, testnet, mainnet) + string network = 2 [json_name = "network"]; } message ConfirmationUpdate { @@ -1132,7 +1383,6 @@ message CloseChannelRequest { 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"]; } } @@ -1179,7 +1429,6 @@ message OpenChannelRequest { 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"]; } } @@ -1306,6 +1555,27 @@ message PendingChannelsResponse { repeated WaitingCloseChannel waiting_close_channels = 5 [ json_name = "waiting_close_channels" ]; } +message ChannelEventSubscription { +} + +message ChannelEventUpdate { + oneof channel { + Channel open_channel = 1 [ json_name = "open_channel" ]; + ChannelCloseSummary closed_channel = 2 [ json_name = "closed_channel" ]; + ChannelPoint active_channel = 3 [ json_name = "active_channel" ]; + ChannelPoint inactive_channel = 4 [ json_name = "inactive_channel" ]; + } + + enum UpdateType { + OPEN_CHANNEL = 0; + CLOSED_CHANNEL = 1; + ACTIVE_CHANNEL = 2; + INACTIVE_CHANNEL = 3; + } + + UpdateType type = 5 [ json_name = "type" ]; +} + message WalletBalanceRequest { } message WalletBalanceResponse { @@ -1336,8 +1606,11 @@ message QueryRoutesRequest { /// The amount to send expressed in satoshis int64 amt = 2; - /// The max number of routes to return. - int32 num_routes = 3; + /** + Deprecated. The max number of routes to return. In the future, QueryRoutes + will only return a single route. + */ + int32 num_routes = 3 [deprecated = true]; /// An optional CLTV delta from the current height that should be used for the timelock of the final hop int32 final_cltv_delta = 4; @@ -1349,7 +1622,37 @@ message QueryRoutesRequest { send the payment. */ FeeLimit fee_limit = 5; + + /** + A list of nodes to ignore during path finding. + */ + repeated bytes ignored_nodes = 6; + + /** + A list of edges to ignore during path finding. + */ + repeated EdgeLocator ignored_edges = 7; + + /** + The source node where the request route should originated from. If empty, + self is assumed. + */ + string source_pub_key = 8; } + +message EdgeLocator { + /// The short channel id of this edge. + uint64 channel_id = 1; + + /** + The direction of this edge. If direction_reverse is false, the direction + of this edge is from the channel endpoint with the lexicographically smaller + pub key to the endpoint with the larger pub key. If direction_reverse is + is true, the edge goes the other way. + */ + bool direction_reverse = 2; +} + message QueryRoutesResponse { repeated Route routes = 1 [json_name = "routes"]; } @@ -1468,6 +1771,7 @@ message RoutingPolicy { 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"]; + uint64 max_htlc_msat = 6 [json_name = "max_htlc_msat"]; } /** @@ -1540,6 +1844,7 @@ message NetworkInfo { 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"]; + int64 median_channel_size_sat = 10 [json_name = "median_channel_size_sat"]; // TODO(roasbeef): fee rate info, expiry // * also additional RPC for tracking fee info once in @@ -1626,8 +1931,10 @@ message Invoice { */ string memo = 1 [json_name = "memo"]; - /// An optional cryptographic receipt of payment - bytes receipt = 2 [json_name = "receipt"]; + /** Deprecated. An optional cryptographic receipt of payment which is not + implemented. + */ + bytes receipt = 2 [json_name = "receipt", deprecated = true]; /** The hex-encoded preimage (32 byte) which will allow settling an incoming @@ -1642,7 +1949,7 @@ message Invoice { int64 value = 5 [json_name = "value"]; /// Whether this invoice has been fulfilled - bool settled = 6 [json_name = "settled"]; + bool settled = 6 [json_name = "settled", deprecated = true]; /// When this invoice was created int64 creation_date = 7 [json_name = "creation_date"]; @@ -1720,7 +2027,20 @@ message Invoice { here as well. */ int64 amt_paid_msat = 20 [json_name = "amt_paid_msat"]; + + enum InvoiceState { + OPEN = 0; + SETTLED = 1; + CANCELED = 2; + ACCEPTED = 3; + } + + /** + The state the invoice is in. + */ + InvoiceState state = 21 [json_name = "state"]; } + message AddInvoiceResponse { bytes r_hash = 1 [json_name = "r_hash"]; @@ -1953,15 +2273,18 @@ message ForwardingEvent { /// 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. + /// The total amount (in satoshis) 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. + /// The total amount (in satoshis) of the outgoing 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. + /// The total fee (in satoshis) that this payment circuit carried. uint64 fee = 7 [json_name = "fee"]; + /// The total fee (in milli-satoshis) that this payment circuit carried. + uint64 fee_msat = 8 [json_name = "fee_msat"]; + // TODO(roasbeef): add settlement latency? // * use FPE on the chan id? // * also list failures? @@ -1973,3 +2296,72 @@ message ForwardingHistoryResponse { /// 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"]; } + +message ExportChannelBackupRequest { + /// The target chanenl point to obtain a back up for. + ChannelPoint chan_point = 1; +} + +message ChannelBackup { + /** + Identifies the channel that this backup belongs to. + */ + ChannelPoint chan_point = 1 [ json_name = "chan_point" ]; + + /** + Is an encrypted single-chan backup. this can be passed to + RestoreChannelBackups, or the WalletUnlocker Innit and Unlock methods in + order to trigger the recovery protocol. + */ + bytes chan_backup = 2 [ json_name = "chan_backup" ]; +} + +message MultiChanBackup { + /** + Is the set of all channels that are included in this multi-channel backup. + */ + repeated ChannelPoint chan_points = 1 [ json_name = "chan_points" ]; + + /** + A single encrypted blob containing all the static channel backups of the + channel listed above. This can be stored as a single file or blob, and + safely be replaced with any prior/future versions. + */ + bytes multi_chan_backup = 2 [ json_name = "multi_chan_backup" ]; +} + +message ChanBackupExportRequest {} +message ChanBackupSnapshot { + /** + The set of new channels that have been added since the last channel backup + snapshot was requested. + */ + ChannelBackups single_chan_backups = 1 [ json_name = "single_chan_backups" ]; + + /** + A multi-channel backup that covers all open channels currently known to + lnd. + */ + MultiChanBackup multi_chan_backup = 2 [ json_name = "multi_chan_backup" ]; +} + +message ChannelBackups { + /** + A set of single-chan static channel backups. + */ + repeated ChannelBackup chan_backups = 1 [ json_name = "chan_backups" ]; +} + +message RestoreChanBackupRequest { + oneof backup { + ChannelBackups chan_backups = 1 [ json_name = "chan_backups" ]; + + bytes multi_chan_backup = 2 [ json_name = "multi_chan_backup" ]; + } +} +message RestoreBackupResponse {} + +message ChannelBackupSubscription {} + +message VerifyChanBackupResponse { +} diff --git a/lib/lnrpc/rpc_pb.rb b/lib/lnrpc/rpc_pb.rb index 84a63a7..7b5a4b8 100644 --- a/lib/lnrpc/rpc_pb.rb +++ b/lib/lnrpc/rpc_pb.rb @@ -18,12 +18,14 @@ Google::Protobuf::DescriptorPool.generated_pool.build do repeated :cipher_seed_mnemonic, :string, 2 optional :aezeed_passphrase, :bytes, 3 optional :recovery_window, :int32, 4 + optional :channel_backups, :message, 5, "lnrpc.ChanBackupSnapshot" end add_message "lnrpc.InitWalletResponse" do end add_message "lnrpc.UnlockWalletRequest" do optional :wallet_password, :bytes, 1 optional :recovery_window, :int32, 2 + optional :channel_backups, :message, 3, "lnrpc.ChanBackupSnapshot" end add_message "lnrpc.UnlockWalletResponse" do end @@ -33,6 +35,14 @@ Google::Protobuf::DescriptorPool.generated_pool.build do end add_message "lnrpc.ChangePasswordResponse" do end + add_message "lnrpc.Utxo" do + optional :type, :enum, 1, "lnrpc.AddressType" + optional :address, :string, 2 + optional :amount_sat, :int64, 3 + optional :pk_script, :string, 4 + optional :outpoint, :message, 5, "lnrpc.OutPoint" + optional :confirmations, :int64, 6 + end add_message "lnrpc.Transaction" do optional :tx_hash, :string, 1 optional :amount, :int64, 2 @@ -63,16 +73,20 @@ Google::Protobuf::DescriptorPool.generated_pool.build do optional :payment_request, :string, 6 optional :final_cltv_delta, :int32, 7 optional :fee_limit, :message, 8, "lnrpc.FeeLimit" + optional :outgoing_chan_id, :uint64, 9 + optional :cltv_limit, :uint32, 10 end add_message "lnrpc.SendResponse" do optional :payment_error, :string, 1 optional :payment_preimage, :bytes, 2 optional :payment_route, :message, 3, "lnrpc.Route" + optional :payment_hash, :bytes, 4 end add_message "lnrpc.SendToRouteRequest" do optional :payment_hash, :bytes, 1 optional :payment_hash_string, :string, 2 repeated :routes, :message, 3, "lnrpc.Route" + optional :route, :message, 4, "lnrpc.Route" end add_message "lnrpc.ChannelPoint" do optional :output_index, :uint32, 3 @@ -81,10 +95,23 @@ Google::Protobuf::DescriptorPool.generated_pool.build do optional :funding_txid_str, :string, 2 end end + add_message "lnrpc.OutPoint" do + optional :txid_bytes, :bytes, 1 + optional :txid_str, :string, 2 + optional :output_index, :uint32, 3 + end add_message "lnrpc.LightningAddress" do optional :pubkey, :string, 1 optional :host, :string, 2 end + add_message "lnrpc.EstimateFeeRequest" do + map :AddrToAmount, :string, :int64, 1 + optional :target_conf, :int32, 2 + end + add_message "lnrpc.EstimateFeeResponse" do + optional :fee_sat, :int64, 1 + optional :feerate_sat_per_byte, :int64, 2 + end add_message "lnrpc.SendManyRequest" do map :AddrToAmount, :string, :int64, 1 optional :target_conf, :int32, 3 @@ -98,16 +125,20 @@ Google::Protobuf::DescriptorPool.generated_pool.build do optional :amount, :int64, 2 optional :target_conf, :int32, 3 optional :sat_per_byte, :int64, 5 + optional :send_all, :bool, 6 end add_message "lnrpc.SendCoinsResponse" do optional :txid, :string, 1 end - add_message "lnrpc.NewAddressRequest" do - optional :type, :enum, 1, "lnrpc.NewAddressRequest.AddressType" + add_message "lnrpc.ListUnspentRequest" do + optional :min_confs, :int32, 1 + optional :max_confs, :int32, 2 end - add_enum "lnrpc.NewAddressRequest.AddressType" do - value :WITNESS_PUBKEY_HASH, 0 - value :NESTED_PUBKEY_HASH, 1 + add_message "lnrpc.ListUnspentResponse" do + repeated :utxos, :message, 1, "lnrpc.Utxo" + end + add_message "lnrpc.NewAddressRequest" do + optional :type, :enum, 1, "lnrpc.AddressType" end add_message "lnrpc.NewAddressResponse" do optional :address, :string, 1 @@ -161,6 +192,8 @@ Google::Protobuf::DescriptorPool.generated_pool.build do repeated :pending_htlcs, :message, 15, "lnrpc.HTLC" optional :csv_delay, :uint32, 16 optional :private, :bool, 17 + optional :initiator, :bool, 18 + optional :chan_status_flags, :string, 19 end add_message "lnrpc.ListChannelsRequest" do optional :active_only, :bool, 1 @@ -211,6 +244,12 @@ Google::Protobuf::DescriptorPool.generated_pool.build do optional :sat_recv, :int64, 7 optional :inbound, :bool, 8 optional :ping_time, :int64, 9 + optional :sync_type, :enum, 10, "lnrpc.Peer.SyncType" + end + add_enum "lnrpc.Peer.SyncType" do + value :UNKNOWN_SYNC, 0 + value :ACTIVE_SYNC, 1 + value :PASSIVE_SYNC, 2 end add_message "lnrpc.ListPeersRequest" do end @@ -229,11 +268,15 @@ Google::Protobuf::DescriptorPool.generated_pool.build do 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 optional :num_inactive_channels, :uint32, 15 + repeated :chains, :message, 16, "lnrpc.Chain" + end + add_message "lnrpc.Chain" do + optional :chain, :string, 1 + optional :network, :string, 2 end add_message "lnrpc.ConfirmationUpdate" do optional :block_sha, :bytes, 1 @@ -256,7 +299,6 @@ Google::Protobuf::DescriptorPool.generated_pool.build do 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 @@ -280,7 +322,6 @@ Google::Protobuf::DescriptorPool.generated_pool.build do 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 @@ -332,6 +373,23 @@ Google::Protobuf::DescriptorPool.generated_pool.build do optional :recovered_balance, :int64, 6 repeated :pending_htlcs, :message, 8, "lnrpc.PendingHTLC" end + add_message "lnrpc.ChannelEventSubscription" do + end + add_message "lnrpc.ChannelEventUpdate" do + optional :type, :enum, 5, "lnrpc.ChannelEventUpdate.UpdateType" + oneof :channel do + optional :open_channel, :message, 1, "lnrpc.Channel" + optional :closed_channel, :message, 2, "lnrpc.ChannelCloseSummary" + optional :active_channel, :message, 3, "lnrpc.ChannelPoint" + optional :inactive_channel, :message, 4, "lnrpc.ChannelPoint" + end + end + add_enum "lnrpc.ChannelEventUpdate.UpdateType" do + value :OPEN_CHANNEL, 0 + value :CLOSED_CHANNEL, 1 + value :ACTIVE_CHANNEL, 2 + value :INACTIVE_CHANNEL, 3 + end add_message "lnrpc.WalletBalanceRequest" do end add_message "lnrpc.WalletBalanceResponse" do @@ -351,6 +409,13 @@ Google::Protobuf::DescriptorPool.generated_pool.build do optional :num_routes, :int32, 3 optional :final_cltv_delta, :int32, 4 optional :fee_limit, :message, 5, "lnrpc.FeeLimit" + repeated :ignored_nodes, :bytes, 6 + repeated :ignored_edges, :message, 7, "lnrpc.EdgeLocator" + optional :source_pub_key, :string, 8 + end + add_message "lnrpc.EdgeLocator" do + optional :channel_id, :uint64, 1 + optional :direction_reverse, :bool, 2 end add_message "lnrpc.QueryRoutesResponse" do repeated :routes, :message, 1, "lnrpc.Route" @@ -398,6 +463,7 @@ Google::Protobuf::DescriptorPool.generated_pool.build do optional :fee_base_msat, :int64, 3 optional :fee_rate_milli_msat, :int64, 4 optional :disabled, :bool, 5 + optional :max_htlc_msat, :uint64, 6 end add_message "lnrpc.ChannelEdge" do optional :channel_id, :uint64, 1 @@ -431,6 +497,7 @@ Google::Protobuf::DescriptorPool.generated_pool.build do optional :avg_channel_size, :double, 7 optional :min_channel_size, :int64, 8 optional :max_channel_size, :int64, 9 + optional :median_channel_size_sat, :int64, 10 end add_message "lnrpc.StopRequest" do end @@ -494,6 +561,13 @@ Google::Protobuf::DescriptorPool.generated_pool.build do optional :amt_paid, :int64, 18 optional :amt_paid_sat, :int64, 19 optional :amt_paid_msat, :int64, 20 + optional :state, :enum, 21, "lnrpc.Invoice.InvoiceState" + end + add_enum "lnrpc.Invoice.InvoiceState" do + value :OPEN, 0 + value :SETTLED, 1 + value :CANCELED, 2 + value :ACCEPTED, 3 end add_message "lnrpc.AddInvoiceResponse" do optional :r_hash, :bytes, 1 @@ -603,11 +677,50 @@ Google::Protobuf::DescriptorPool.generated_pool.build do optional :amt_in, :uint64, 5 optional :amt_out, :uint64, 6 optional :fee, :uint64, 7 + optional :fee_msat, :uint64, 8 end add_message "lnrpc.ForwardingHistoryResponse" do repeated :forwarding_events, :message, 1, "lnrpc.ForwardingEvent" optional :last_offset_index, :uint32, 2 end + add_message "lnrpc.ExportChannelBackupRequest" do + optional :chan_point, :message, 1, "lnrpc.ChannelPoint" + end + add_message "lnrpc.ChannelBackup" do + optional :chan_point, :message, 1, "lnrpc.ChannelPoint" + optional :chan_backup, :bytes, 2 + end + add_message "lnrpc.MultiChanBackup" do + repeated :chan_points, :message, 1, "lnrpc.ChannelPoint" + optional :multi_chan_backup, :bytes, 2 + end + add_message "lnrpc.ChanBackupExportRequest" do + end + add_message "lnrpc.ChanBackupSnapshot" do + optional :single_chan_backups, :message, 1, "lnrpc.ChannelBackups" + optional :multi_chan_backup, :message, 2, "lnrpc.MultiChanBackup" + end + add_message "lnrpc.ChannelBackups" do + repeated :chan_backups, :message, 1, "lnrpc.ChannelBackup" + end + add_message "lnrpc.RestoreChanBackupRequest" do + oneof :backup do + optional :chan_backups, :message, 1, "lnrpc.ChannelBackups" + optional :multi_chan_backup, :bytes, 2 + end + end + add_message "lnrpc.RestoreBackupResponse" do + end + add_message "lnrpc.ChannelBackupSubscription" do + end + add_message "lnrpc.VerifyChanBackupResponse" do + end + add_enum "lnrpc.AddressType" do + value :WITNESS_PUBKEY_HASH, 0 + value :NESTED_PUBKEY_HASH, 1 + value :UNUSED_WITNESS_PUBKEY_HASH, 2 + value :UNUSED_NESTED_PUBKEY_HASH, 3 + end end module Lnrpc @@ -619,6 +732,7 @@ module Lnrpc 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 + Utxo = Google::Protobuf::DescriptorPool.generated_pool.lookup("lnrpc.Utxo").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 @@ -627,13 +741,17 @@ module Lnrpc 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 + OutPoint = Google::Protobuf::DescriptorPool.generated_pool.lookup("lnrpc.OutPoint").msgclass LightningAddress = Google::Protobuf::DescriptorPool.generated_pool.lookup("lnrpc.LightningAddress").msgclass + EstimateFeeRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("lnrpc.EstimateFeeRequest").msgclass + EstimateFeeResponse = Google::Protobuf::DescriptorPool.generated_pool.lookup("lnrpc.EstimateFeeResponse").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 + ListUnspentRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("lnrpc.ListUnspentRequest").msgclass + ListUnspentResponse = Google::Protobuf::DescriptorPool.generated_pool.lookup("lnrpc.ListUnspentResponse").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 @@ -652,10 +770,12 @@ module Lnrpc 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 + Peer::SyncType = Google::Protobuf::DescriptorPool.generated_pool.lookup("lnrpc.Peer.SyncType").enummodule 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 + Chain = Google::Protobuf::DescriptorPool.generated_pool.lookup("lnrpc.Chain").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 @@ -672,11 +792,15 @@ module Lnrpc 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 + ChannelEventSubscription = Google::Protobuf::DescriptorPool.generated_pool.lookup("lnrpc.ChannelEventSubscription").msgclass + ChannelEventUpdate = Google::Protobuf::DescriptorPool.generated_pool.lookup("lnrpc.ChannelEventUpdate").msgclass + ChannelEventUpdate::UpdateType = Google::Protobuf::DescriptorPool.generated_pool.lookup("lnrpc.ChannelEventUpdate.UpdateType").enummodule 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 + EdgeLocator = Google::Protobuf::DescriptorPool.generated_pool.lookup("lnrpc.EdgeLocator").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 @@ -701,6 +825,7 @@ module Lnrpc 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 + Invoice::InvoiceState = Google::Protobuf::DescriptorPool.generated_pool.lookup("lnrpc.Invoice.InvoiceState").enummodule 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 @@ -725,4 +850,15 @@ module Lnrpc 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 + ExportChannelBackupRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("lnrpc.ExportChannelBackupRequest").msgclass + ChannelBackup = Google::Protobuf::DescriptorPool.generated_pool.lookup("lnrpc.ChannelBackup").msgclass + MultiChanBackup = Google::Protobuf::DescriptorPool.generated_pool.lookup("lnrpc.MultiChanBackup").msgclass + ChanBackupExportRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("lnrpc.ChanBackupExportRequest").msgclass + ChanBackupSnapshot = Google::Protobuf::DescriptorPool.generated_pool.lookup("lnrpc.ChanBackupSnapshot").msgclass + ChannelBackups = Google::Protobuf::DescriptorPool.generated_pool.lookup("lnrpc.ChannelBackups").msgclass + RestoreChanBackupRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("lnrpc.RestoreChanBackupRequest").msgclass + RestoreBackupResponse = Google::Protobuf::DescriptorPool.generated_pool.lookup("lnrpc.RestoreBackupResponse").msgclass + ChannelBackupSubscription = Google::Protobuf::DescriptorPool.generated_pool.lookup("lnrpc.ChannelBackupSubscription").msgclass + VerifyChanBackupResponse = Google::Protobuf::DescriptorPool.generated_pool.lookup("lnrpc.VerifyChanBackupResponse").msgclass + AddressType = Google::Protobuf::DescriptorPool.generated_pool.lookup("lnrpc.AddressType").enummodule end diff --git a/lib/lnrpc/rpc_services_pb.rb b/lib/lnrpc/rpc_services_pb.rb index 0b2df0b..ef580a4 100644 --- a/lib/lnrpc/rpc_services_pb.rb +++ b/lib/lnrpc/rpc_services_pb.rb @@ -6,6 +6,27 @@ require_relative 'rpc_pb' module Lnrpc module WalletUnlocker + # * + # 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. class Service @@ -74,6 +95,10 @@ module Lnrpc # GetTransactions returns a list describing all the known transactions # relevant to the wallet. rpc :GetTransactions, GetTransactionsRequest, TransactionDetails + # * lncli: `estimatefee` + # EstimateFee asks the chain backend to estimate the fee rate and total fees + # for a transaction that pays to multiple specified outputs. + rpc :EstimateFee, EstimateFeeRequest, EstimateFeeResponse # * 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 @@ -81,6 +106,10 @@ module Lnrpc # consult its fee model to determine a fee for the default confirmation # target. rpc :SendCoins, SendCoinsRequest, SendCoinsResponse + # * lncli: `listunspent` + # ListUnspent returns a list of all utxos spendable by the wallet with a + # number of confirmations between the specified minimum and maximum. + rpc :ListUnspent, ListUnspentRequest, ListUnspentResponse # * # SubscribeTransactions creates a uni-directional stream from the server to # the client in which any newly discovered transactions relevant to the @@ -136,6 +165,12 @@ module Lnrpc # ListChannels returns a description of all the open channels that this node # is a participant in. rpc :ListChannels, ListChannelsRequest, ListChannelsResponse + # * lncli: `subscribechannelevents` + # SubscribeChannelEvents creates a uni-directional stream from the server to + # the client in which any updates relevant to the state of the channels are + # sent over. Events include new active channels, inactive channels, and closed + # channels. + rpc :SubscribeChannelEvents, ChannelEventSubscription, stream(ChannelEventUpdate) # * lncli: `closedchannels` # ClosedChannels returns a description of all the closed channels that # this node was a participant in. @@ -201,10 +236,8 @@ module Lnrpc # 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. + # next request. By default, the first 100 invoices created will be returned. + # Backwards pagination is also supported through the Reversed flag. rpc :ListInvoices, ListInvoiceRequest, ListInvoiceResponse # * lncli: `lookupinvoice` # LookupInvoice attempts to look up an invoice according to its payment hash. @@ -290,7 +323,7 @@ module Lnrpc 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 + # all HTLCs 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. # @@ -300,6 +333,41 @@ module Lnrpc # 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 + # * lncli: `exportchanbackup` + # ExportChannelBackup attempts to return an encrypted static channel backup + # for the target channel identified by it channel point. The backup is + # encrypted with a key generated from the aezeed seed of the user. The + # returned backup can either be restored using the RestoreChannelBackup + # method once lnd is running, or via the InitWallet and UnlockWallet methods + # from the WalletUnlocker service. + rpc :ExportChannelBackup, ExportChannelBackupRequest, ChannelBackup + # * + # ExportAllChannelBackups returns static channel backups for all existing + # channels known to lnd. A set of regular singular static channel backups for + # each channel are returned. Additionally, a multi-channel backup is returned + # as well, which contains a single encrypted blob containing the backups of + # each channel. + rpc :ExportAllChannelBackups, ChanBackupExportRequest, ChanBackupSnapshot + # * + # VerifyChanBackup allows a caller to verify the integrity of a channel backup + # snapshot. This method will accept either a packed Single or a packed Multi. + # Specifying both will result in an error. + rpc :VerifyChanBackup, ChanBackupSnapshot, VerifyChanBackupResponse + # * lncli: `restorechanbackup` + # RestoreChannelBackups accepts a set of singular channel backups, or a + # single encrypted multi-chan backup and attempts to recover any funds + # remaining within the channel. If we are able to unpack the backup, then the + # new channel will be shown under listchannels, as well as pending channels. + rpc :RestoreChannelBackups, RestoreChanBackupRequest, RestoreBackupResponse + # * + # SubscribeChannelBackups allows a client to sub-subscribe to the most up to + # date information concerning the state of all channel backups. Each time a + # new channel is added, we return the new set of channels, along with a + # multi-chan backup containing the backup info for all channels. Each time a + # channel is closed, we send a new update, which contains new new chan back + # ups, but the updated set of encrypted multi-chan backups with the closed + # channel(s) removed. + rpc :SubscribeChannelBackups, ChannelBackupSubscription, stream(ChanBackupSnapshot) end Stub = Service.rpc_stub_class