1
0
mirror of https://github.com/bumi/lnrpc synced 2026-02-13 15:17:48 +00:00

Add support for v0.11 GRPC services

This also refactors the client GRPC wrapper to dynamically load the
request objects.
All GRPC generated client files now live under lib/grpc_services
This commit is contained in:
2020-08-28 14:09:57 +02:00
parent 579fc423ea
commit 404ed3b99e
31 changed files with 2758 additions and 5878 deletions

View File

@@ -0,0 +1,149 @@
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: walletrpc/walletkit.proto
require 'google/protobuf'
require 'rpc_pb'
require 'signrpc/signer_pb'
Google::Protobuf::DescriptorPool.generated_pool.build do
add_file("walletrpc/walletkit.proto", :syntax => :proto3) do
add_message "walletrpc.ListUnspentRequest" do
optional :min_confs, :int32, 1
optional :max_confs, :int32, 2
end
add_message "walletrpc.ListUnspentResponse" do
repeated :utxos, :message, 1, "lnrpc.Utxo"
end
add_message "walletrpc.LeaseOutputRequest" do
optional :id, :bytes, 1
optional :outpoint, :message, 2, "lnrpc.OutPoint"
end
add_message "walletrpc.LeaseOutputResponse" do
optional :expiration, :uint64, 1
end
add_message "walletrpc.ReleaseOutputRequest" do
optional :id, :bytes, 1
optional :outpoint, :message, 2, "lnrpc.OutPoint"
end
add_message "walletrpc.ReleaseOutputResponse" do
end
add_message "walletrpc.KeyReq" do
optional :key_finger_print, :int32, 1
optional :key_family, :int32, 2
end
add_message "walletrpc.AddrRequest" do
end
add_message "walletrpc.AddrResponse" do
optional :addr, :string, 1
end
add_message "walletrpc.Transaction" do
optional :tx_hex, :bytes, 1
optional :label, :string, 2
end
add_message "walletrpc.PublishResponse" do
optional :publish_error, :string, 1
end
add_message "walletrpc.SendOutputsRequest" do
optional :sat_per_kw, :int64, 1
repeated :outputs, :message, 2, "signrpc.TxOut"
optional :label, :string, 3
end
add_message "walletrpc.SendOutputsResponse" do
optional :raw_tx, :bytes, 1
end
add_message "walletrpc.EstimateFeeRequest" do
optional :conf_target, :int32, 1
end
add_message "walletrpc.EstimateFeeResponse" do
optional :sat_per_kw, :int64, 1
end
add_message "walletrpc.PendingSweep" do
optional :outpoint, :message, 1, "lnrpc.OutPoint"
optional :witness_type, :enum, 2, "walletrpc.WitnessType"
optional :amount_sat, :uint32, 3
optional :sat_per_byte, :uint32, 4
optional :broadcast_attempts, :uint32, 5
optional :next_broadcast_height, :uint32, 6
optional :requested_conf_target, :uint32, 8
optional :requested_sat_per_byte, :uint32, 9
optional :force, :bool, 7
end
add_message "walletrpc.PendingSweepsRequest" do
end
add_message "walletrpc.PendingSweepsResponse" do
repeated :pending_sweeps, :message, 1, "walletrpc.PendingSweep"
end
add_message "walletrpc.BumpFeeRequest" do
optional :outpoint, :message, 1, "lnrpc.OutPoint"
optional :target_conf, :uint32, 2
optional :sat_per_byte, :uint32, 3
optional :force, :bool, 4
end
add_message "walletrpc.BumpFeeResponse" do
end
add_message "walletrpc.ListSweepsRequest" do
optional :verbose, :bool, 1
end
add_message "walletrpc.ListSweepsResponse" do
oneof :sweeps do
optional :transaction_details, :message, 1, "lnrpc.TransactionDetails"
optional :transaction_ids, :message, 2, "walletrpc.ListSweepsResponse.TransactionIDs"
end
end
add_message "walletrpc.ListSweepsResponse.TransactionIDs" do
repeated :transaction_ids, :string, 1
end
add_message "walletrpc.LabelTransactionRequest" do
optional :txid, :bytes, 1
optional :label, :string, 2
optional :overwrite, :bool, 3
end
add_message "walletrpc.LabelTransactionResponse" do
end
add_enum "walletrpc.WitnessType" do
value :UNKNOWN_WITNESS, 0
value :COMMITMENT_TIME_LOCK, 1
value :COMMITMENT_NO_DELAY, 2
value :COMMITMENT_REVOKE, 3
value :HTLC_OFFERED_REVOKE, 4
value :HTLC_ACCEPTED_REVOKE, 5
value :HTLC_OFFERED_TIMEOUT_SECOND_LEVEL, 6
value :HTLC_ACCEPTED_SUCCESS_SECOND_LEVEL, 7
value :HTLC_OFFERED_REMOTE_TIMEOUT, 8
value :HTLC_ACCEPTED_REMOTE_SUCCESS, 9
value :HTLC_SECOND_LEVEL_REVOKE, 10
value :WITNESS_KEY_HASH, 11
value :NESTED_WITNESS_KEY_HASH, 12
value :COMMITMENT_ANCHOR, 13
end
end
end
module Walletrpc
ListUnspentRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("walletrpc.ListUnspentRequest").msgclass
ListUnspentResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("walletrpc.ListUnspentResponse").msgclass
LeaseOutputRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("walletrpc.LeaseOutputRequest").msgclass
LeaseOutputResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("walletrpc.LeaseOutputResponse").msgclass
ReleaseOutputRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("walletrpc.ReleaseOutputRequest").msgclass
ReleaseOutputResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("walletrpc.ReleaseOutputResponse").msgclass
KeyReq = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("walletrpc.KeyReq").msgclass
AddrRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("walletrpc.AddrRequest").msgclass
AddrResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("walletrpc.AddrResponse").msgclass
Transaction = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("walletrpc.Transaction").msgclass
PublishResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("walletrpc.PublishResponse").msgclass
SendOutputsRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("walletrpc.SendOutputsRequest").msgclass
SendOutputsResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("walletrpc.SendOutputsResponse").msgclass
EstimateFeeRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("walletrpc.EstimateFeeRequest").msgclass
EstimateFeeResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("walletrpc.EstimateFeeResponse").msgclass
PendingSweep = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("walletrpc.PendingSweep").msgclass
PendingSweepsRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("walletrpc.PendingSweepsRequest").msgclass
PendingSweepsResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("walletrpc.PendingSweepsResponse").msgclass
BumpFeeRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("walletrpc.BumpFeeRequest").msgclass
BumpFeeResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("walletrpc.BumpFeeResponse").msgclass
ListSweepsRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("walletrpc.ListSweepsRequest").msgclass
ListSweepsResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("walletrpc.ListSweepsResponse").msgclass
ListSweepsResponse::TransactionIDs = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("walletrpc.ListSweepsResponse.TransactionIDs").msgclass
LabelTransactionRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("walletrpc.LabelTransactionRequest").msgclass
LabelTransactionResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("walletrpc.LabelTransactionResponse").msgclass
WitnessType = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("walletrpc.WitnessType").enummodule
end

View File

@@ -0,0 +1,115 @@
# Generated by the protocol buffer compiler. DO NOT EDIT!
# Source: walletrpc/walletkit.proto for package 'walletrpc'
require 'grpc'
require 'walletrpc/walletkit_pb'
module Walletrpc
module WalletKit
# WalletKit is a service that gives access to the core functionalities of the
# daemon's wallet.
class Service
include GRPC::GenericService
self.marshal_class_method = :encode
self.unmarshal_class_method = :decode
self.service_name = 'walletrpc.WalletKit'
#
# 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
#
# LeaseOutput locks an output to the given ID, preventing it from being
# available for any future coin selection attempts. The absolute time of the
# lock's expiration is returned. The expiration of the lock can be extended by
# successive invocations of this RPC. Outputs can be unlocked before their
# expiration through `ReleaseOutput`.
rpc :LeaseOutput, LeaseOutputRequest, LeaseOutputResponse
#
# ReleaseOutput unlocks an output, allowing it to be available for coin
# selection if it remains unspent. The ID should match the one used to
# originally lock the output.
rpc :ReleaseOutput, ReleaseOutputRequest, ReleaseOutputResponse
#
# DeriveNextKey attempts to derive the *next* key within the key family
# (account in BIP43) specified. This method should return the next external
# child within this branch.
rpc :DeriveNextKey, KeyReq, Signrpc::KeyDescriptor
#
# DeriveKey attempts to derive an arbitrary key specified by the passed
# KeyLocator.
rpc :DeriveKey, Signrpc::KeyLocator, Signrpc::KeyDescriptor
#
# NextAddr returns the next unused address within the wallet.
rpc :NextAddr, AddrRequest, AddrResponse
#
# PublishTransaction attempts to publish the passed transaction to the
# network. Once this returns without an error, the wallet will continually
# attempt to re-broadcast the transaction on start up, until it enters the
# chain.
rpc :PublishTransaction, Transaction, PublishResponse
#
# SendOutputs is similar to the existing sendmany call in Bitcoind, and
# allows the caller to create a transaction that sends to several outputs at
# once. This is ideal when wanting to batch create a set of transactions.
rpc :SendOutputs, SendOutputsRequest, SendOutputsResponse
#
# EstimateFee attempts to query the internal fee estimator of the wallet to
# determine the fee (in sat/kw) to attach to a transaction in order to
# achieve the confirmation target.
rpc :EstimateFee, EstimateFeeRequest, EstimateFeeResponse
#
# PendingSweeps returns lists of on-chain outputs that lnd is currently
# attempting to sweep within its central batching engine. Outputs with similar
# fee rates are batched together in order to sweep them within a single
# transaction.
#
# NOTE: Some of the fields within PendingSweepsRequest are not guaranteed to
# remain supported. This is an advanced API that depends on the internals of
# the UtxoSweeper, so things may change.
rpc :PendingSweeps, PendingSweepsRequest, PendingSweepsResponse
#
# BumpFee bumps the fee of an arbitrary input within a transaction. This RPC
# takes a different approach than bitcoind's bumpfee command. lnd has a
# central batching engine in which inputs with similar fee rates are batched
# together to save on transaction fees. Due to this, we cannot rely on
# bumping the fee on a specific transaction, since transactions can change at
# any point with the addition of new inputs. The list of inputs that
# currently exist within lnd's central batching engine can be retrieved
# through the PendingSweeps RPC.
#
# When bumping the fee of an input that currently exists within lnd's central
# batching engine, a higher fee transaction will be created that replaces the
# lower fee transaction through the Replace-By-Fee (RBF) policy. If it
#
# This RPC also serves useful when wanting to perform a Child-Pays-For-Parent
# (CPFP), where the child transaction pays for its parent's fee. This can be
# done by specifying an outpoint within the low fee transaction that is under
# the control of the wallet.
#
# The fee preference can be expressed either as a specific fee rate or a delta
# of blocks in which the output should be swept on-chain within. If a fee
# preference is not explicitly specified, then an error is returned.
#
# Note that this RPC currently doesn't perform any validation checks on the
# fee preference being provided. For now, the responsibility of ensuring that
# the new fee preference is sufficient is delegated to the user.
rpc :BumpFee, BumpFeeRequest, BumpFeeResponse
#
# ListSweeps returns a list of the sweep transactions our node has produced.
# Note that these sweeps may not be confirmed yet, as we record sweeps on
# broadcast, not confirmation.
rpc :ListSweeps, ListSweepsRequest, ListSweepsResponse
#
# LabelTransaction adds a label to a transaction. If the transaction already
# has a label the call will fail unless the overwrite bool is set. This will
# overwrite the exiting transaction label. Labels must not be empty, and
# cannot exceed 500 characters.
rpc :LabelTransaction, LabelTransactionRequest, LabelTransactionResponse
end
Stub = Service.rpc_stub_class
end
end