From e30cb5f2a84f53e55c60abad043e5f74b6a8db0a Mon Sep 17 00:00:00 2001 From: Boris Nagaev Date: Wed, 17 Apr 2024 12:54:47 -0300 Subject: [PATCH 01/37] multi: apply make fmt --- instantout/reservation/manager.go | 1 - liquidity/liquidity.go | 3 +-- liquidity/parameters.go | 3 +-- loopd/daemon.go | 6 ++---- loopdb/sqlite.go | 1 - 5 files changed, 4 insertions(+), 10 deletions(-) diff --git a/instantout/reservation/manager.go b/instantout/reservation/manager.go index 120ed1c..6f55249 100644 --- a/instantout/reservation/manager.go +++ b/instantout/reservation/manager.go @@ -9,7 +9,6 @@ import ( "github.com/btcsuite/btcd/btcec/v2" "github.com/btcsuite/btcd/btcutil" - "github.com/lightninglabs/loop/fsm" reservationrpc "github.com/lightninglabs/loop/swapserverrpc" ) diff --git a/liquidity/liquidity.go b/liquidity/liquidity.go index acf01ef..c50f7ea 100644 --- a/liquidity/liquidity.go +++ b/liquidity/liquidity.go @@ -46,6 +46,7 @@ import ( "github.com/lightninglabs/loop" "github.com/lightninglabs/loop/labels" "github.com/lightninglabs/loop/loopdb" + clientrpc "github.com/lightninglabs/loop/looprpc" "github.com/lightninglabs/loop/swap" "github.com/lightningnetwork/lnd/clock" "github.com/lightningnetwork/lnd/funding" @@ -55,8 +56,6 @@ import ( "github.com/lightningnetwork/lnd/routing/route" "github.com/lightningnetwork/lnd/ticker" "google.golang.org/protobuf/proto" - - clientrpc "github.com/lightninglabs/loop/looprpc" ) const ( diff --git a/liquidity/parameters.go b/liquidity/parameters.go index ec4e3d1..f324d47 100644 --- a/liquidity/parameters.go +++ b/liquidity/parameters.go @@ -8,13 +8,12 @@ import ( "github.com/btcsuite/btcd/btcutil" "github.com/lightninglabs/lndclient" + clientrpc "github.com/lightninglabs/loop/looprpc" "github.com/lightninglabs/loop/swap" "github.com/lightningnetwork/lnd/lnrpc/walletrpc" "github.com/lightningnetwork/lnd/lnwallet/chainfee" "github.com/lightningnetwork/lnd/lnwire" "github.com/lightningnetwork/lnd/routing/route" - - clientrpc "github.com/lightninglabs/loop/looprpc" ) var ( diff --git a/loopd/daemon.go b/loopd/daemon.go index fa30b11..dde79b5 100644 --- a/loopd/daemon.go +++ b/loopd/daemon.go @@ -17,14 +17,12 @@ import ( "github.com/lightninglabs/lndclient" "github.com/lightninglabs/loop" "github.com/lightninglabs/loop/instantout" + "github.com/lightninglabs/loop/instantout/reservation" "github.com/lightninglabs/loop/loopd/perms" "github.com/lightninglabs/loop/loopdb" - "github.com/lightninglabs/loop/sweepbatcher" - - "github.com/lightninglabs/loop/instantout/reservation" loop_looprpc "github.com/lightninglabs/loop/looprpc" - loop_swaprpc "github.com/lightninglabs/loop/swapserverrpc" + "github.com/lightninglabs/loop/sweepbatcher" "github.com/lightningnetwork/lnd/clock" "github.com/lightningnetwork/lnd/lntypes" "github.com/lightningnetwork/lnd/macaroons" diff --git a/loopdb/sqlite.go b/loopdb/sqlite.go index 068fb9a..8493ed6 100644 --- a/loopdb/sqlite.go +++ b/loopdb/sqlite.go @@ -15,7 +15,6 @@ import ( sqlite_migrate "github.com/golang-migrate/migrate/v4/database/sqlite" "github.com/lightninglabs/loop/loopdb/sqlc" "github.com/lightningnetwork/lnd/zpay32" - "github.com/stretchr/testify/require" _ "modernc.org/sqlite" // Register relevant drivers. ) From 368432ebb4f272a6cda2ccb5a0947b5fbb8eff0c Mon Sep 17 00:00:00 2001 From: Boris Nagaev Date: Wed, 17 Apr 2024 15:49:04 -0300 Subject: [PATCH 02/37] looprpc,swapserverrpc: update Go image to 1.21.9-bookworm This is needed to update protobuf. Version 1.33 breaks in Go 1.16 with the following error: "//go:build comment without // +build comment". Distribution was updated from buster (10) to bookworm (12). protoc was updated from v3.6.1 to v3.21.12. --- looprpc/Dockerfile | 23 +- looprpc/client.pb.go | 931 +++++++++++++------------------- looprpc/client_grpc.pb.go | 158 +++--- looprpc/debug.pb.go | 2 +- looprpc/debug_grpc.pb.go | 14 +- swapserverrpc/Dockerfile | 16 +- swapserverrpc/common.pb.go | 12 +- swapserverrpc/instantout.pb.go | 2 +- swapserverrpc/reservation.pb.go | 2 +- swapserverrpc/server.pb.go | 160 +++--- 10 files changed, 574 insertions(+), 746 deletions(-) diff --git a/looprpc/Dockerfile b/looprpc/Dockerfile index a79af71..67c46f3 100644 --- a/looprpc/Dockerfile +++ b/looprpc/Dockerfile @@ -1,9 +1,9 @@ -FROM golang:1.16.3-buster +FROM golang:1.21.9-bookworm RUN apt-get update && apt-get install -y \ git \ - protobuf-compiler='3.6*' \ - clang-format='1:7.0*' + protobuf-compiler='3.21.12*' \ + clang-format='1:14.0*' # We don't want any default values for these variables to make sure they're # explicitly provided by parsing the go.mod file. Otherwise we might forget to @@ -13,14 +13,19 @@ ARG GRPC_GATEWAY_VERSION ENV PROTOC_GEN_GO_GRPC_VERSION="v1.1.0" ENV FALAFEL_VERSION="v0.9.1" +ENV GOCACHE=/tmp/build/.cache +ENV GOMODCACHE=/tmp/build/.modcache RUN cd /tmp \ - && export GO111MODULE=on \ - && go get google.golang.org/protobuf/cmd/protoc-gen-go@${PROTOBUF_VERSION} \ - && go get google.golang.org/grpc/cmd/protoc-gen-go-grpc@${PROTOC_GEN_GO_GRPC_VERSION} \ - && go get github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway@${GRPC_GATEWAY_VERSION} \ - && go get github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2@${GRPC_GATEWAY_VERSION} \ - && go get github.com/lightninglabs/falafel@${FALAFEL_VERSION} + && mkdir -p /tmp/build/.cache \ + && mkdir -p /tmp/build/.modcache \ + && go install google.golang.org/protobuf/cmd/protoc-gen-go@${PROTOBUF_VERSION} \ + && go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@${PROTOC_GEN_GO_GRPC_VERSION} \ + && go install github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway@${GRPC_GATEWAY_VERSION} \ + && go install github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2@${GRPC_GATEWAY_VERSION} \ + && go install github.com/lightninglabs/falafel@${FALAFEL_VERSION} \ + && go install golang.org/x/tools/cmd/goimports@v0.1.7 \ + && chmod -R 777 /tmp/build/ WORKDIR /build diff --git a/looprpc/client.pb.go b/looprpc/client.pb.go index 042b1b4..45a1a7a 100644 --- a/looprpc/client.pb.go +++ b/looprpc/client.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.31.0 -// protoc v3.6.1 +// protoc v3.21.12 // source: client.proto package looprpc @@ -21,11 +21,10 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) +// `AddressType` has to be one of: // -//`AddressType` has to be one of: -// -//- `unknown`: Unknown address type -//- `p2tr`: Pay to taproot pubkey (`TAPROOT_PUBKEY` = 1) +// - `unknown`: Unknown address type +// - `p2tr`: Pay to taproot pubkey (`TAPROOT_PUBKEY` = 1) type AddressType int32 const ( @@ -123,33 +122,27 @@ func (SwapType) EnumDescriptor() ([]byte, []int) { type SwapState int32 const ( - // - //INITIATED is the initial state of a swap. At that point, the initiation - //call to the server has been made and the payment process has been started - //for the swap and prepayment invoices. + // INITIATED is the initial state of a swap. At that point, the initiation + // call to the server has been made and the payment process has been started + // for the swap and prepayment invoices. SwapState_INITIATED SwapState = 0 - // - //PREIMAGE_REVEALED is reached when the sweep tx publication is first - //attempted. From that point on, we should consider the preimage to no - //longer be secret and we need to do all we can to get the sweep confirmed. - //This state will mostly coalesce with StateHtlcConfirmed, except in the - //case where we wait for fees to come down before we sweep. + // PREIMAGE_REVEALED is reached when the sweep tx publication is first + // attempted. From that point on, we should consider the preimage to no + // longer be secret and we need to do all we can to get the sweep confirmed. + // This state will mostly coalesce with StateHtlcConfirmed, except in the + // case where we wait for fees to come down before we sweep. SwapState_PREIMAGE_REVEALED SwapState = 1 - // - //HTLC_PUBLISHED is reached when the htlc tx has been published in a loop in - //swap. + // HTLC_PUBLISHED is reached when the htlc tx has been published in a loop in + // swap. SwapState_HTLC_PUBLISHED SwapState = 2 - // - //SUCCESS is the final swap state that is reached when the sweep tx has - //the required confirmation depth. + // SUCCESS is the final swap state that is reached when the sweep tx has + // the required confirmation depth. SwapState_SUCCESS SwapState = 3 - // - //FAILED is the final swap state for a failed swap with or without loss of - //the swap amount. + // FAILED is the final swap state for a failed swap with or without loss of + // the swap amount. SwapState_FAILED SwapState = 4 - // - //INVOICE_SETTLED is reached when the swap invoice in a loop in swap has been - //paid, but we are still waiting for the htlc spend to confirm. + // INVOICE_SETTLED is reached when the swap invoice in a loop in swap has been + // paid, but we are still waiting for the htlc spend to confirm. SwapState_INVOICE_SETTLED SwapState = 5 ) @@ -203,48 +196,38 @@ func (SwapState) EnumDescriptor() ([]byte, []int) { type FailureReason int32 const ( - // - //FAILURE_REASON_NONE is set when the swap did not fail, it is either in - //progress or succeeded. + // FAILURE_REASON_NONE is set when the swap did not fail, it is either in + // progress or succeeded. FailureReason_FAILURE_REASON_NONE FailureReason = 0 - // - //FAILURE_REASON_OFFCHAIN indicates that a loop out failed because it wasn't - //possible to find a route for one or both off chain payments that met the fee - //and timelock limits required. + // FAILURE_REASON_OFFCHAIN indicates that a loop out failed because it wasn't + // possible to find a route for one or both off chain payments that met the fee + // and timelock limits required. FailureReason_FAILURE_REASON_OFFCHAIN FailureReason = 1 - // - //FAILURE_REASON_TIMEOUT indicates that the swap failed because on chain htlc - //did not confirm before its expiry, or it confirmed too late for us to reveal - //our preimage and claim. + // FAILURE_REASON_TIMEOUT indicates that the swap failed because on chain htlc + // did not confirm before its expiry, or it confirmed too late for us to reveal + // our preimage and claim. FailureReason_FAILURE_REASON_TIMEOUT FailureReason = 2 - // - //FAILURE_REASON_SWEEP_TIMEOUT indicates that a loop out permanently failed - //because the on chain htlc wasn't swept before the server revoked the - //htlc. + // FAILURE_REASON_SWEEP_TIMEOUT indicates that a loop out permanently failed + // because the on chain htlc wasn't swept before the server revoked the + // htlc. FailureReason_FAILURE_REASON_SWEEP_TIMEOUT FailureReason = 3 - // - //FAILURE_REASON_INSUFFICIENT_VALUE indicates that a loop out has failed - //because the on chain htlc had a lower value than requested. + // FAILURE_REASON_INSUFFICIENT_VALUE indicates that a loop out has failed + // because the on chain htlc had a lower value than requested. FailureReason_FAILURE_REASON_INSUFFICIENT_VALUE FailureReason = 4 - // - //FAILURE_REASON_TEMPORARY indicates that a swap cannot continue due to an - //internal error. Manual intervention such as a restart is required. + // FAILURE_REASON_TEMPORARY indicates that a swap cannot continue due to an + // internal error. Manual intervention such as a restart is required. FailureReason_FAILURE_REASON_TEMPORARY FailureReason = 5 - // - //FAILURE_REASON_INCORRECT_AMOUNT indicates that a loop in permanently failed - //because the amount extended by an external loop in htlc is insufficient. + // FAILURE_REASON_INCORRECT_AMOUNT indicates that a loop in permanently failed + // because the amount extended by an external loop in htlc is insufficient. FailureReason_FAILURE_REASON_INCORRECT_AMOUNT FailureReason = 6 - // - //FAILURE_REASON_ABANDONED indicates that a swap permanently failed because - //the client manually abandoned the swap. + // FAILURE_REASON_ABANDONED indicates that a swap permanently failed because + // the client manually abandoned the swap. FailureReason_FAILURE_REASON_ABANDONED FailureReason = 7 - // - //FAILURE_REASON_INSUFFICIENT_CONFIRMED_BALANCE indicates that a swap - //wasn't published due to insufficient confirmed balance. + // FAILURE_REASON_INSUFFICIENT_CONFIRMED_BALANCE indicates that a swap + // wasn't published due to insufficient confirmed balance. FailureReason_FAILURE_REASON_INSUFFICIENT_CONFIRMED_BALANCE FailureReason = 8 - // - //FAILURE_REASON_INCORRECT_HTLC_AMT_SWEPT indicates that a swap - //wasn't published due to insufficient confirmed balance. + // FAILURE_REASON_INCORRECT_HTLC_AMT_SWEPT indicates that a swap + // wasn't published due to insufficient confirmed balance. FailureReason_FAILURE_REASON_INCORRECT_HTLC_AMT_SWEPT FailureReason = 9 ) @@ -353,56 +336,43 @@ type AutoReason int32 const ( AutoReason_AUTO_REASON_UNKNOWN AutoReason = 0 - // - //Budget not started indicates that we do not recommend any swaps because - //the start time for our budget has not arrived yet. + // Budget not started indicates that we do not recommend any swaps because + // the start time for our budget has not arrived yet. AutoReason_AUTO_REASON_BUDGET_NOT_STARTED AutoReason = 1 - // - //Sweep fees indicates that the estimated fees to sweep swaps are too high - //right now. + // Sweep fees indicates that the estimated fees to sweep swaps are too high + // right now. AutoReason_AUTO_REASON_SWEEP_FEES AutoReason = 2 - // - //Budget elapsed indicates that the autoloop budget for the period has been - //elapsed. + // Budget elapsed indicates that the autoloop budget for the period has been + // elapsed. AutoReason_AUTO_REASON_BUDGET_ELAPSED AutoReason = 3 - // - //In flight indicates that the limit on in-flight automatically dispatched - //swaps has already been reached. + // In flight indicates that the limit on in-flight automatically dispatched + // swaps has already been reached. AutoReason_AUTO_REASON_IN_FLIGHT AutoReason = 4 - // - //Swap fee indicates that the server fee for a specific swap is too high. + // Swap fee indicates that the server fee for a specific swap is too high. AutoReason_AUTO_REASON_SWAP_FEE AutoReason = 5 - // - //Miner fee indicates that the miner fee for a specific swap is to high. + // Miner fee indicates that the miner fee for a specific swap is to high. AutoReason_AUTO_REASON_MINER_FEE AutoReason = 6 - // - //Prepay indicates that the prepay fee for a specific swap is too high. + // Prepay indicates that the prepay fee for a specific swap is too high. AutoReason_AUTO_REASON_PREPAY AutoReason = 7 - // - //Failure backoff indicates that a swap has recently failed for this target, - //and the backoff period has not yet passed. + // Failure backoff indicates that a swap has recently failed for this target, + // and the backoff period has not yet passed. AutoReason_AUTO_REASON_FAILURE_BACKOFF AutoReason = 8 - // - //Loop out indicates that a loop out swap is currently utilizing the channel, - //so it is not eligible. + // Loop out indicates that a loop out swap is currently utilizing the channel, + // so it is not eligible. AutoReason_AUTO_REASON_LOOP_OUT AutoReason = 9 - // - //Loop In indicates that a loop in swap is currently in flight for the peer, - //so it is not eligible. + // Loop In indicates that a loop in swap is currently in flight for the peer, + // so it is not eligible. AutoReason_AUTO_REASON_LOOP_IN AutoReason = 10 - // - //Liquidity ok indicates that a target meets the liquidity balance expressed - //in its rule, so no swap is needed. + // Liquidity ok indicates that a target meets the liquidity balance expressed + // in its rule, so no swap is needed. AutoReason_AUTO_REASON_LIQUIDITY_OK AutoReason = 11 - // - //Budget insufficient indicates that we cannot perform a swap because we do - //not have enough pending budget available. This differs from budget elapsed, - //because we still have some budget available, but we have allocated it to - //other swaps. + // Budget insufficient indicates that we cannot perform a swap because we do + // not have enough pending budget available. This differs from budget elapsed, + // because we still have some budget available, but we have allocated it to + // other swaps. AutoReason_AUTO_REASON_BUDGET_INSUFFICIENT AutoReason = 12 - // - //Fee insufficient indicates that the fee estimate for a swap is higher than - //the portion of total swap amount that we allow fees to consume. + // Fee insufficient indicates that the fee estimate for a swap is higher than + // the portion of total swap amount that we allow fees to consume. AutoReason_AUTO_REASON_FEE_INSUFFICIENT AutoReason = 13 ) @@ -526,104 +496,86 @@ type LoopOutRequest struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // - //Requested swap amount in sat. This does not include the swap and miner fee. + // Requested swap amount in sat. This does not include the swap and miner fee. Amt int64 `protobuf:"varint,1,opt,name=amt,proto3" json:"amt,omitempty"` - // - //Base58 encoded destination address for the swap. + // Base58 encoded destination address for the swap. Dest string `protobuf:"bytes,2,opt,name=dest,proto3" json:"dest,omitempty"` - // - //Maximum off-chain fee in sat that may be paid for swap payment to the - //server. This limit is applied during path finding. Typically this value is - //taken from the response of the GetQuote call. + // Maximum off-chain fee in sat that may be paid for swap payment to the + // server. This limit is applied during path finding. Typically this value is + // taken from the response of the GetQuote call. MaxSwapRoutingFee int64 `protobuf:"varint,3,opt,name=max_swap_routing_fee,json=maxSwapRoutingFee,proto3" json:"max_swap_routing_fee,omitempty"` - // - //Maximum off-chain fee in sat that may be paid for the prepay to the server. - //This limit is applied during path finding. Typically this value is taken - //from the response of the GetQuote call. + // Maximum off-chain fee in sat that may be paid for the prepay to the server. + // This limit is applied during path finding. Typically this value is taken + // from the response of the GetQuote call. MaxPrepayRoutingFee int64 `protobuf:"varint,4,opt,name=max_prepay_routing_fee,json=maxPrepayRoutingFee,proto3" json:"max_prepay_routing_fee,omitempty"` - // - //Maximum we are willing to pay the server for the swap. This value is not - //disclosed in the swap initiation call, but if the server asks for a - //higher fee, we abort the swap. Typically this value is taken from the - //response of the GetQuote call. It includes the prepay amount. + // Maximum we are willing to pay the server for the swap. This value is not + // disclosed in the swap initiation call, but if the server asks for a + // higher fee, we abort the swap. Typically this value is taken from the + // response of the GetQuote call. It includes the prepay amount. MaxSwapFee int64 `protobuf:"varint,5,opt,name=max_swap_fee,json=maxSwapFee,proto3" json:"max_swap_fee,omitempty"` - // - //Maximum amount of the swap fee that may be charged as a prepayment. + // Maximum amount of the swap fee that may be charged as a prepayment. MaxPrepayAmt int64 `protobuf:"varint,6,opt,name=max_prepay_amt,json=maxPrepayAmt,proto3" json:"max_prepay_amt,omitempty"` - // - //Maximum in on-chain fees that we are willing to spend. If we want to - //sweep the on-chain htlc and the fee estimate turns out higher than this - //value, we cancel the swap. If the fee estimate is lower, we publish the - //sweep tx. - // - //If the sweep tx is not confirmed, we are forced to ratchet up fees until it - //is swept. Possibly even exceeding max_miner_fee if we get close to the htlc - //timeout. Because the initial publication revealed the preimage, we have no - //other choice. The server may already have pulled the off-chain htlc. Only - //when the fee becomes higher than the swap amount, we can only wait for fees - //to come down and hope - if we are past the timeout - that the server is not - //publishing the revocation. - // - //max_miner_fee is typically taken from the response of the GetQuote call. + // Maximum in on-chain fees that we are willing to spend. If we want to + // sweep the on-chain htlc and the fee estimate turns out higher than this + // value, we cancel the swap. If the fee estimate is lower, we publish the + // sweep tx. + // + // If the sweep tx is not confirmed, we are forced to ratchet up fees until it + // is swept. Possibly even exceeding max_miner_fee if we get close to the htlc + // timeout. Because the initial publication revealed the preimage, we have no + // other choice. The server may already have pulled the off-chain htlc. Only + // when the fee becomes higher than the swap amount, we can only wait for fees + // to come down and hope - if we are past the timeout - that the server is not + // publishing the revocation. + // + // max_miner_fee is typically taken from the response of the GetQuote call. MaxMinerFee int64 `protobuf:"varint,7,opt,name=max_miner_fee,json=maxMinerFee,proto3" json:"max_miner_fee,omitempty"` - // - //Deprecated, use outgoing_chan_set. The channel to loop out, the channel - //to loop out is selected based on the lowest routing fee for the swap - //payment to the server. + // Deprecated, use outgoing_chan_set. The channel to loop out, the channel + // to loop out is selected based on the lowest routing fee for the swap + // payment to the server. // // Deprecated: Marked as deprecated in client.proto. LoopOutChannel uint64 `protobuf:"varint,8,opt,name=loop_out_channel,json=loopOutChannel,proto3" json:"loop_out_channel,omitempty"` - // - //A restriction on the channel set that may be used to loop out. The actual - //channel(s) that will be used are selected based on the lowest routing fee - //for the swap payment to the server. + // A restriction on the channel set that may be used to loop out. The actual + // channel(s) that will be used are selected based on the lowest routing fee + // for the swap payment to the server. OutgoingChanSet []uint64 `protobuf:"varint,11,rep,packed,name=outgoing_chan_set,json=outgoingChanSet,proto3" json:"outgoing_chan_set,omitempty"` - // - //The number of blocks from the on-chain HTLC's confirmation height that it - //should be swept within. + // The number of blocks from the on-chain HTLC's confirmation height that it + // should be swept within. SweepConfTarget int32 `protobuf:"varint,9,opt,name=sweep_conf_target,json=sweepConfTarget,proto3" json:"sweep_conf_target,omitempty"` - // - //The number of confirmations that we require for the on chain htlc that will - //be published by the server before we reveal the preimage. + // The number of confirmations that we require for the on chain htlc that will + // be published by the server before we reveal the preimage. HtlcConfirmations int32 `protobuf:"varint,13,opt,name=htlc_confirmations,json=htlcConfirmations,proto3" json:"htlc_confirmations,omitempty"` - // - //The latest time (in unix seconds) we allow the server to wait before - //publishing the HTLC on chain. Setting this to a larger value will give the - //server the opportunity to batch multiple swaps together, and wait for - //low-fee periods before publishing the HTLC, potentially resulting in a - //lower total swap fee. + // The latest time (in unix seconds) we allow the server to wait before + // publishing the HTLC on chain. Setting this to a larger value will give the + // server the opportunity to batch multiple swaps together, and wait for + // low-fee periods before publishing the HTLC, potentially resulting in a + // lower total swap fee. SwapPublicationDeadline uint64 `protobuf:"varint,10,opt,name=swap_publication_deadline,json=swapPublicationDeadline,proto3" json:"swap_publication_deadline,omitempty"` - // - //An optional label for this swap. This field is limited to 500 characters - //and may not start with the prefix [reserved], which is used to tag labels - //produced by the daemon. + // An optional label for this swap. This field is limited to 500 characters + // and may not start with the prefix [reserved], which is used to tag labels + // produced by the daemon. Label string `protobuf:"bytes,12,opt,name=label,proto3" json:"label,omitempty"` - // - //An optional identification string that will be appended to the user agent - //string sent to the server to give information about the usage of loop. This - //initiator part is meant for user interfaces to add their name to give the - //full picture of the binary used (loopd, LiT) and the method used for - //triggering the swap (loop CLI, autolooper, LiT UI, other 3rd party UI). + // An optional identification string that will be appended to the user agent + // string sent to the server to give information about the usage of loop. This + // initiator part is meant for user interfaces to add their name to give the + // full picture of the binary used (loopd, LiT) and the method used for + // triggering the swap (loop CLI, autolooper, LiT UI, other 3rd party UI). Initiator string `protobuf:"bytes,14,opt,name=initiator,proto3" json:"initiator,omitempty"` - // - //An alternative destination address source for the swap. This field - //represents the name of the account in the backing lnd instance. - //Refer to lnd's wallet import functions for reference. + // An alternative destination address source for the swap. This field + // represents the name of the account in the backing lnd instance. + // Refer to lnd's wallet import functions for reference. Account string `protobuf:"bytes,15,opt,name=account,proto3" json:"account,omitempty"` - // - //The address type of the account specified in the account field. + // The address type of the account specified in the account field. AccountAddrType AddressType `protobuf:"varint,16,opt,name=account_addr_type,json=accountAddrType,proto3,enum=looprpc.AddressType" json:"account_addr_type,omitempty"` - // - //A flag indicating whether the defined destination address does not belong to - //the wallet. This is used to flag whether this loop out swap could have its - //associated sweep batched. + // A flag indicating whether the defined destination address does not belong to + // the wallet. This is used to flag whether this loop out swap could have its + // associated sweep batched. IsExternalAddr bool `protobuf:"varint,17,opt,name=is_external_addr,json=isExternalAddr,proto3" json:"is_external_addr,omitempty"` - // - //The reservations to use for the swap. If this field is set, loop will try - //to use the instant out flow using the given reservations. If the - //reservations are not sufficient, the swap will fail. The swap amount must - //be equal to the sum of the amounts of the reservations. + // The reservations to use for the swap. If this field is set, loop will try + // to use the instant out flow using the given reservations. If the + // reservations are not sufficient, the swap will fail. The swap amount must + // be equal to the sum of the amounts of the reservations. ReservationIds [][]byte `protobuf:"bytes,18,rep,name=reservation_ids,json=reservationIds,proto3" json:"reservation_ids,omitempty"` } @@ -791,52 +743,42 @@ type LoopInRequest struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // - //Requested swap amount in sat. This does not include the swap and miner - //fee. + // Requested swap amount in sat. This does not include the swap and miner + // fee. Amt int64 `protobuf:"varint,1,opt,name=amt,proto3" json:"amt,omitempty"` - // - //Maximum we are willing to pay the server for the swap. This value is not - //disclosed in the swap initiation call, but if the server asks for a - //higher fee, we abort the swap. Typically this value is taken from the - //response of the GetQuote call. + // Maximum we are willing to pay the server for the swap. This value is not + // disclosed in the swap initiation call, but if the server asks for a + // higher fee, we abort the swap. Typically this value is taken from the + // response of the GetQuote call. MaxSwapFee int64 `protobuf:"varint,2,opt,name=max_swap_fee,json=maxSwapFee,proto3" json:"max_swap_fee,omitempty"` + // Maximum in on-chain fees that we are willing to spend. If we want to + // publish the on-chain htlc and the fee estimate turns out higher than this + // value, we cancel the swap. // - //Maximum in on-chain fees that we are willing to spend. If we want to - //publish the on-chain htlc and the fee estimate turns out higher than this - //value, we cancel the swap. - // - //max_miner_fee is typically taken from the response of the GetQuote call. + // max_miner_fee is typically taken from the response of the GetQuote call. MaxMinerFee int64 `protobuf:"varint,3,opt,name=max_miner_fee,json=maxMinerFee,proto3" json:"max_miner_fee,omitempty"` - // - //The last hop to use for the loop in swap. If empty, the last hop is selected - //based on the lowest routing fee for the swap payment from the server. + // The last hop to use for the loop in swap. If empty, the last hop is selected + // based on the lowest routing fee for the swap payment from the server. LastHop []byte `protobuf:"bytes,4,opt,name=last_hop,json=lastHop,proto3" json:"last_hop,omitempty"` - // - //If external_htlc is true, we expect the htlc to be published by an external - //actor. + // If external_htlc is true, we expect the htlc to be published by an external + // actor. ExternalHtlc bool `protobuf:"varint,5,opt,name=external_htlc,json=externalHtlc,proto3" json:"external_htlc,omitempty"` - // - //The number of blocks that the on chain htlc should confirm within. + // The number of blocks that the on chain htlc should confirm within. HtlcConfTarget int32 `protobuf:"varint,6,opt,name=htlc_conf_target,json=htlcConfTarget,proto3" json:"htlc_conf_target,omitempty"` - // - //An optional label for this swap. This field is limited to 500 characters - //and may not be one of the reserved values in loop/labels Reserved list. + // An optional label for this swap. This field is limited to 500 characters + // and may not be one of the reserved values in loop/labels Reserved list. Label string `protobuf:"bytes,7,opt,name=label,proto3" json:"label,omitempty"` - // - //An optional identification string that will be appended to the user agent - //string sent to the server to give information about the usage of loop. This - //initiator part is meant for user interfaces to add their name to give the - //full picture of the binary used (loopd, LiT) and the method used for - //triggering the swap (loop CLI, autolooper, LiT UI, other 3rd party UI). + // An optional identification string that will be appended to the user agent + // string sent to the server to give information about the usage of loop. This + // initiator part is meant for user interfaces to add their name to give the + // full picture of the binary used (loopd, LiT) and the method used for + // triggering the swap (loop CLI, autolooper, LiT UI, other 3rd party UI). Initiator string `protobuf:"bytes,8,opt,name=initiator,proto3" json:"initiator,omitempty"` - // - //Optional route hints to reach the destination through private channels. + // Optional route hints to reach the destination through private channels. RouteHints []*swapserverrpc.RouteHint `protobuf:"bytes,9,rep,name=route_hints,json=routeHints,proto3" json:"route_hints,omitempty"` - // - //Private indicates whether the destination node should be considered - //private. In which case, loop will generate hophints to assist with - //probing and payment. + // Private indicates whether the destination node should be considered + // private. In which case, loop will generate hophints to assist with + // probing and payment. Private bool `protobuf:"varint,10,opt,name=private,proto3" json:"private,omitempty"` } @@ -947,31 +889,27 @@ type SwapResponse struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // - //Swap identifier to track status in the update stream that is returned from - //the Start() call. Currently this is the hash that locks the htlcs. - //DEPRECATED: To make the API more consistent, this field is deprecated in - //favor of id_bytes and will be removed in a future release. + // Swap identifier to track status in the update stream that is returned from + // the Start() call. Currently this is the hash that locks the htlcs. + // DEPRECATED: To make the API more consistent, this field is deprecated in + // favor of id_bytes and will be removed in a future release. // // Deprecated: Marked as deprecated in client.proto. Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` - // - //Swap identifier to track status in the update stream that is returned from - //the Start() call. Currently this is the hash that locks the htlcs. + // Swap identifier to track status in the update stream that is returned from + // the Start() call. Currently this is the hash that locks the htlcs. IdBytes []byte `protobuf:"bytes,3,opt,name=id_bytes,json=idBytes,proto3" json:"id_bytes,omitempty"` - // - //DEPRECATED. This field stores the address of the onchain htlc, but - //depending on the request, the semantics are different. - //- For internal loop-in htlc_address contains the address of the - //native segwit (P2WSH) htlc. - /// - For loop-out htlc_address always contains the native segwit (P2WSH) - //htlc address. + // DEPRECATED. This field stores the address of the onchain htlc, but + // depending on the request, the semantics are different. + // - For internal loop-in htlc_address contains the address of the + // native segwit (P2WSH) htlc. + // / - For loop-out htlc_address always contains the native segwit (P2WSH) + // htlc address. // // Deprecated: Marked as deprecated in client.proto. HtlcAddress string `protobuf:"bytes,2,opt,name=htlc_address,json=htlcAddress,proto3" json:"htlc_address,omitempty"` - // - //The native segwit address of the on-chain htlc. - //Used for both loop-in and loop-out. + // The native segwit address of the on-chain htlc. + // Used for both loop-in and loop-out. HtlcAddressP2Wsh string `protobuf:"bytes,5,opt,name=htlc_address_p2wsh,json=htlcAddressP2wsh,proto3" json:"htlc_address_p2wsh,omitempty"` // The address of the v3 (taproot) htlc. Used for both loop-in and loop-out. HtlcAddressP2Tr string `protobuf:"bytes,7,opt,name=htlc_address_p2tr,json=htlcAddressP2tr,proto3" json:"htlc_address_p2tr,omitempty"` @@ -1098,43 +1036,34 @@ type SwapStatus struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // - //Requested swap amount in sat. This does not include the swap and miner - //fee. + // Requested swap amount in sat. This does not include the swap and miner + // fee. Amt int64 `protobuf:"varint,1,opt,name=amt,proto3" json:"amt,omitempty"` - // - //Swap identifier to track status in the update stream that is returned from - //the Start() call. Currently this is the hash that locks the htlcs. - //DEPRECATED: To make the API more consistent, this field is deprecated in - //favor of id_bytes and will be removed in a future release. + // Swap identifier to track status in the update stream that is returned from + // the Start() call. Currently this is the hash that locks the htlcs. + // DEPRECATED: To make the API more consistent, this field is deprecated in + // favor of id_bytes and will be removed in a future release. // // Deprecated: Marked as deprecated in client.proto. Id string `protobuf:"bytes,2,opt,name=id,proto3" json:"id,omitempty"` - // - //Swap identifier to track status in the update stream that is returned from - //the Start() call. Currently this is the hash that locks the htlcs. + // Swap identifier to track status in the update stream that is returned from + // the Start() call. Currently this is the hash that locks the htlcs. IdBytes []byte `protobuf:"bytes,11,opt,name=id_bytes,json=idBytes,proto3" json:"id_bytes,omitempty"` - // - //The type of the swap. + // The type of the swap. Type SwapType `protobuf:"varint,3,opt,name=type,proto3,enum=looprpc.SwapType" json:"type,omitempty"` - // - //State the swap is currently in, see State enum. + // State the swap is currently in, see State enum. State SwapState `protobuf:"varint,4,opt,name=state,proto3,enum=looprpc.SwapState" json:"state,omitempty"` - // - //A failure reason for the swap, only set if the swap has failed. + // A failure reason for the swap, only set if the swap has failed. FailureReason FailureReason `protobuf:"varint,14,opt,name=failure_reason,json=failureReason,proto3,enum=looprpc.FailureReason" json:"failure_reason,omitempty"` - // - //Initiation time of the swap. + // Initiation time of the swap. InitiationTime int64 `protobuf:"varint,5,opt,name=initiation_time,json=initiationTime,proto3" json:"initiation_time,omitempty"` - // - //Initiation time of the swap. + // Initiation time of the swap. LastUpdateTime int64 `protobuf:"varint,6,opt,name=last_update_time,json=lastUpdateTime,proto3" json:"last_update_time,omitempty"` - // - //DEPRECATED: This field stores the address of the onchain htlc. - //- For internal loop-in htlc_address contains the address of the - //native segwit (P2WSH) htlc. - //- For loop-out htlc_address always contains the native segwit (P2WSH) - //htlc address. + // DEPRECATED: This field stores the address of the onchain htlc. + // - For internal loop-in htlc_address contains the address of the + // native segwit (P2WSH) htlc. + // - For loop-out htlc_address always contains the native segwit (P2WSH) + // htlc address. // // Deprecated: Marked as deprecated in client.proto. HtlcAddress string `protobuf:"bytes,7,opt,name=htlc_address,json=htlcAddress,proto3" json:"htlc_address,omitempty"` @@ -1446,8 +1375,7 @@ type ListSwapsResponse struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // - //The list of all currently known swaps and their status. + // The list of all currently known swaps and their status. Swaps []*SwapStatus `protobuf:"bytes,1,rep,name=swaps,proto3" json:"swaps,omitempty"` } @@ -1495,9 +1423,8 @@ type SwapInfoRequest struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // - //The swap identifier which currently is the hash that locks the HTLCs. When - //using REST, this field must be encoded as URL safe base64. + // The swap identifier which currently is the hash that locks the HTLCs. When + // using REST, this field must be encoded as URL safe base64. Id []byte `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` } @@ -1583,11 +1510,9 @@ type InTermsResponse struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // - //Minimum swap amount (sat) + // Minimum swap amount (sat) MinSwapAmount int64 `protobuf:"varint,5,opt,name=min_swap_amount,json=minSwapAmount,proto3" json:"min_swap_amount,omitempty"` - // - //Maximum swap amount (sat) + // Maximum swap amount (sat) MaxSwapAmount int64 `protobuf:"varint,6,opt,name=max_swap_amount,json=maxSwapAmount,proto3" json:"max_swap_amount,omitempty"` } @@ -1642,11 +1567,9 @@ type OutTermsResponse struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // - //Minimum swap amount (sat) + // Minimum swap amount (sat) MinSwapAmount int64 `protobuf:"varint,5,opt,name=min_swap_amount,json=minSwapAmount,proto3" json:"min_swap_amount,omitempty"` - // - //Maximum swap amount (sat) + // Maximum swap amount (sat) MaxSwapAmount int64 `protobuf:"varint,6,opt,name=max_swap_amount,json=maxSwapAmount,proto3" json:"max_swap_amount,omitempty"` // The minimally accepted cltv delta of the on-chain htlc. MinCltvDelta int32 `protobuf:"varint,8,opt,name=min_cltv_delta,json=minCltvDelta,proto3" json:"min_cltv_delta,omitempty"` @@ -1719,38 +1642,31 @@ type QuoteRequest struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // - //The amount to swap in satoshis. + // The amount to swap in satoshis. Amt int64 `protobuf:"varint,1,opt,name=amt,proto3" json:"amt,omitempty"` - // - //The confirmation target that should be used either for the sweep of the - //on-chain HTLC broadcast by the swap server in the case of a Loop Out, or for - //the confirmation of the on-chain HTLC broadcast by the swap client in the - //case of a Loop In. + // The confirmation target that should be used either for the sweep of the + // on-chain HTLC broadcast by the swap server in the case of a Loop Out, or for + // the confirmation of the on-chain HTLC broadcast by the swap client in the + // case of a Loop In. ConfTarget int32 `protobuf:"varint,2,opt,name=conf_target,json=confTarget,proto3" json:"conf_target,omitempty"` - // - //If external_htlc is true, we expect the htlc to be published by an external - //actor. + // If external_htlc is true, we expect the htlc to be published by an external + // actor. ExternalHtlc bool `protobuf:"varint,3,opt,name=external_htlc,json=externalHtlc,proto3" json:"external_htlc,omitempty"` - // - //The latest time (in unix seconds) we allow the server to wait before - //publishing the HTLC on chain. Setting this to a larger value will give the - //server the opportunity to batch multiple swaps together, and wait for - //low-fee periods before publishing the HTLC, potentially resulting in a - //lower total swap fee. This only has an effect on loop out quotes. + // The latest time (in unix seconds) we allow the server to wait before + // publishing the HTLC on chain. Setting this to a larger value will give the + // server the opportunity to batch multiple swaps together, and wait for + // low-fee periods before publishing the HTLC, potentially resulting in a + // lower total swap fee. This only has an effect on loop out quotes. SwapPublicationDeadline uint64 `protobuf:"varint,4,opt,name=swap_publication_deadline,json=swapPublicationDeadline,proto3" json:"swap_publication_deadline,omitempty"` - // - //Optionally the client can specify the last hop pubkey when requesting a - //loop-in quote. This is useful to get better off-chain routing fee from the - //server. + // Optionally the client can specify the last hop pubkey when requesting a + // loop-in quote. This is useful to get better off-chain routing fee from the + // server. LoopInLastHop []byte `protobuf:"bytes,5,opt,name=loop_in_last_hop,json=loopInLastHop,proto3" json:"loop_in_last_hop,omitempty"` - // - //Optional route hints to reach the destination through private channels. + // Optional route hints to reach the destination through private channels. LoopInRouteHints []*swapserverrpc.RouteHint `protobuf:"bytes,6,rep,name=loop_in_route_hints,json=loopInRouteHints,proto3" json:"loop_in_route_hints,omitempty"` - // - //Private indicates whether the destination node should be considered - //private. In which case, loop will generate hophints to assist with - //probing and payment. + // Private indicates whether the destination node should be considered + // private. In which case, loop will generate hophints to assist with + // probing and payment. Private bool `protobuf:"varint,7,opt,name=private,proto3" json:"private,omitempty"` } @@ -1840,22 +1756,18 @@ type InQuoteResponse struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // - //The fee that the swap server is charging for the swap. + // The fee that the swap server is charging for the swap. SwapFeeSat int64 `protobuf:"varint,1,opt,name=swap_fee_sat,json=swapFeeSat,proto3" json:"swap_fee_sat,omitempty"` - // - //An estimate of the on-chain fee that needs to be paid to publish the HTLC - //If a miner fee of 0 is returned, it means the external_htlc flag was set for - //a loop in and the fee estimation was skipped. If a miner fee of -1 is - //returned, it means lnd's wallet tried to estimate the fee but was unable to - //create a sample estimation transaction because not enough funds are - //available. An information message should be shown to the user in this case. + // An estimate of the on-chain fee that needs to be paid to publish the HTLC + // If a miner fee of 0 is returned, it means the external_htlc flag was set for + // a loop in and the fee estimation was skipped. If a miner fee of -1 is + // returned, it means lnd's wallet tried to estimate the fee but was unable to + // create a sample estimation transaction because not enough funds are + // available. An information message should be shown to the user in this case. HtlcPublishFeeSat int64 `protobuf:"varint,3,opt,name=htlc_publish_fee_sat,json=htlcPublishFeeSat,proto3" json:"htlc_publish_fee_sat,omitempty"` - // - //On-chain cltv expiry delta + // On-chain cltv expiry delta CltvDelta int32 `protobuf:"varint,5,opt,name=cltv_delta,json=cltvDelta,proto3" json:"cltv_delta,omitempty"` - // - //The confirmation target to be used to publish the on-chain HTLC. + // The confirmation target to be used to publish the on-chain HTLC. ConfTarget int32 `protobuf:"varint,6,opt,name=conf_target,json=confTarget,proto3" json:"conf_target,omitempty"` } @@ -1924,25 +1836,19 @@ type OutQuoteResponse struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // - //The fee that the swap server is charging for the swap. + // The fee that the swap server is charging for the swap. SwapFeeSat int64 `protobuf:"varint,1,opt,name=swap_fee_sat,json=swapFeeSat,proto3" json:"swap_fee_sat,omitempty"` - // - //The part of the swap fee that is requested as a prepayment. + // The part of the swap fee that is requested as a prepayment. PrepayAmtSat int64 `protobuf:"varint,2,opt,name=prepay_amt_sat,json=prepayAmtSat,proto3" json:"prepay_amt_sat,omitempty"` - // - //An estimate of the on-chain fee that needs to be paid to sweep the HTLC for - //a loop out. + // An estimate of the on-chain fee that needs to be paid to sweep the HTLC for + // a loop out. HtlcSweepFeeSat int64 `protobuf:"varint,3,opt,name=htlc_sweep_fee_sat,json=htlcSweepFeeSat,proto3" json:"htlc_sweep_fee_sat,omitempty"` - // - //The node pubkey where the swap payment needs to be paid - //to. This can be used to test connectivity before initiating the swap. + // The node pubkey where the swap payment needs to be paid + // to. This can be used to test connectivity before initiating the swap. SwapPaymentDest []byte `protobuf:"bytes,4,opt,name=swap_payment_dest,json=swapPaymentDest,proto3" json:"swap_payment_dest,omitempty"` - // - //On-chain cltv expiry delta + // On-chain cltv expiry delta CltvDelta int32 `protobuf:"varint,5,opt,name=cltv_delta,json=cltvDelta,proto3" json:"cltv_delta,omitempty"` - // - //The confirmation target to be used for the sweep of the on-chain HTLC. + // The confirmation target to be used for the sweep of the on-chain HTLC. ConfTarget int32 `protobuf:"varint,6,opt,name=conf_target,json=confTarget,proto3" json:"conf_target,omitempty"` } @@ -2025,14 +1931,11 @@ type ProbeRequest struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // - //The amount to probe. + // The amount to probe. Amt int64 `protobuf:"varint,1,opt,name=amt,proto3" json:"amt,omitempty"` - // - //Optional last hop of the route to probe. + // Optional last hop of the route to probe. LastHop []byte `protobuf:"bytes,2,opt,name=last_hop,json=lastHop,proto3" json:"last_hop,omitempty"` - // - //Optional route hints to reach the destination through private channels. + // Optional route hints to reach the destination through private channels. RouteHints []*swapserverrpc.RouteHint `protobuf:"bytes,3,rep,name=route_hints,json=routeHints,proto3" json:"route_hints,omitempty"` } @@ -2170,8 +2073,7 @@ type TokensResponse struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // - //List of all tokens the daemon knows of, including old/expired tokens. + // List of all tokens the daemon knows of, including old/expired tokens. Tokens []*LsatToken `protobuf:"bytes,1,rep,name=tokens,proto3" json:"tokens,omitempty"` } @@ -2219,35 +2121,26 @@ type LsatToken struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // - //The base macaroon that was baked by the auth server. + // The base macaroon that was baked by the auth server. BaseMacaroon []byte `protobuf:"bytes,1,opt,name=base_macaroon,json=baseMacaroon,proto3" json:"base_macaroon,omitempty"` - // - //The payment hash of the payment that was paid to obtain the token. + // The payment hash of the payment that was paid to obtain the token. PaymentHash []byte `protobuf:"bytes,2,opt,name=payment_hash,json=paymentHash,proto3" json:"payment_hash,omitempty"` - // - //The preimage of the payment hash, knowledge of this is proof that the - //payment has been paid. If the preimage is set to all zeros, this means the - //payment is still pending and the token is not yet fully valid. + // The preimage of the payment hash, knowledge of this is proof that the + // payment has been paid. If the preimage is set to all zeros, this means the + // payment is still pending and the token is not yet fully valid. PaymentPreimage []byte `protobuf:"bytes,3,opt,name=payment_preimage,json=paymentPreimage,proto3" json:"payment_preimage,omitempty"` - // - //The amount of millisatoshis that was paid to get the token. + // The amount of millisatoshis that was paid to get the token. AmountPaidMsat int64 `protobuf:"varint,4,opt,name=amount_paid_msat,json=amountPaidMsat,proto3" json:"amount_paid_msat,omitempty"` - // - //The amount of millisatoshis paid in routing fee to pay for the token. + // The amount of millisatoshis paid in routing fee to pay for the token. RoutingFeePaidMsat int64 `protobuf:"varint,5,opt,name=routing_fee_paid_msat,json=routingFeePaidMsat,proto3" json:"routing_fee_paid_msat,omitempty"` - // - //The creation time of the token as UNIX timestamp in seconds. + // The creation time of the token as UNIX timestamp in seconds. TimeCreated int64 `protobuf:"varint,6,opt,name=time_created,json=timeCreated,proto3" json:"time_created,omitempty"` - // - //Indicates whether the token is expired or still valid. + // Indicates whether the token is expired or still valid. Expired bool `protobuf:"varint,7,opt,name=expired,proto3" json:"expired,omitempty"` - // - //Identifying attribute of this token in the store. Currently represents the - //file name of the token where it's stored on the file system. + // Identifying attribute of this token in the store. Currently represents the + // file name of the token where it's stored on the file system. StorageName string `protobuf:"bytes,8,opt,name=storage_name,json=storageName,proto3" json:"storage_name,omitempty"` - // - //The l402 ID of the token. + // The l402 ID of the token. Id string `protobuf:"bytes,9,opt,name=id,proto3" json:"id,omitempty"` } @@ -2351,20 +2244,15 @@ type LoopStats struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // - //Number of currently pending swaps. + // Number of currently pending swaps. PendingCount uint64 `protobuf:"varint,1,opt,name=pending_count,json=pendingCount,proto3" json:"pending_count,omitempty"` - // - //Number of succeeded swaps. + // Number of succeeded swaps. SuccessCount uint64 `protobuf:"varint,2,opt,name=success_count,json=successCount,proto3" json:"success_count,omitempty"` - // - //Number failed swaps. + // Number failed swaps. FailCount uint64 `protobuf:"varint,3,opt,name=fail_count,json=failCount,proto3" json:"fail_count,omitempty"` - // - //The sum of all pending swap amounts. + // The sum of all pending swap amounts. SumPendingAmt int64 `protobuf:"varint,4,opt,name=sum_pending_amt,json=sumPendingAmt,proto3" json:"sum_pending_amt,omitempty"` - // - //The sum of all succeeded swap amounts. + // The sum of all succeeded swap amounts. SumSucceededAmt int64 `protobuf:"varint,5,opt,name=sum_succeeded_amt,json=sumSucceededAmt,proto3" json:"sum_succeeded_amt,omitempty"` } @@ -2478,29 +2366,21 @@ type GetInfoResponse struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // - //The current daemon version. + // The current daemon version. Version string `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"` - // - //The network the daemon is running on. + // The network the daemon is running on. Network string `protobuf:"bytes,2,opt,name=network,proto3" json:"network,omitempty"` - // - //Host and port of the loopd grpc server. + // Host and port of the loopd grpc server. RpcListen string `protobuf:"bytes,3,opt,name=rpc_listen,json=rpcListen,proto3" json:"rpc_listen,omitempty"` - // - //Host and port of the loopd rest server. + // Host and port of the loopd rest server. RestListen string `protobuf:"bytes,4,opt,name=rest_listen,json=restListen,proto3" json:"rest_listen,omitempty"` - // - //Loop's macaroon path that clients use to talk to the daemon. + // Loop's macaroon path that clients use to talk to the daemon. MacaroonPath string `protobuf:"bytes,5,opt,name=macaroon_path,json=macaroonPath,proto3" json:"macaroon_path,omitempty"` - // - //Loop's tls cert path + // Loop's tls cert path TlsCertPath string `protobuf:"bytes,6,opt,name=tls_cert_path,json=tlsCertPath,proto3" json:"tls_cert_path,omitempty"` - // - //Statistics about loop outs. + // Statistics about loop outs. LoopOutStats *LoopStats `protobuf:"bytes,7,opt,name=loop_out_stats,json=loopOutStats,proto3" json:"loop_out_stats,omitempty"` - // - //Statistics about loop ins. + // Statistics about loop ins. LoopInStats *LoopStats `protobuf:"bytes,8,opt,name=loop_in_stats,json=loopInStats,proto3" json:"loop_in_stats,omitempty"` } @@ -2635,116 +2515,92 @@ type LiquidityParameters struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // - //A set of liquidity rules that describe the desired liquidity balance. + // A set of liquidity rules that describe the desired liquidity balance. Rules []*LiquidityRule `protobuf:"bytes,1,rep,name=rules,proto3" json:"rules,omitempty"` - // - //The parts per million of swap amount that is allowed to be allocated to swap - //fees. This value is applied across swap categories and may not be set in - //conjunction with sweep fee rate, swap fee ppm, routing fee ppm, prepay - //routing, max prepay and max miner fee. + // The parts per million of swap amount that is allowed to be allocated to swap + // fees. This value is applied across swap categories and may not be set in + // conjunction with sweep fee rate, swap fee ppm, routing fee ppm, prepay + // routing, max prepay and max miner fee. FeePpm uint64 `protobuf:"varint,16,opt,name=fee_ppm,json=feePpm,proto3" json:"fee_ppm,omitempty"` - // - //The limit we place on our estimated sweep cost for a swap in sat/vByte. If - //the estimated fee for our sweep transaction within the specified - //confirmation target is above this value, we will not suggest any swaps. + // The limit we place on our estimated sweep cost for a swap in sat/vByte. If + // the estimated fee for our sweep transaction within the specified + // confirmation target is above this value, we will not suggest any swaps. SweepFeeRateSatPerVbyte uint64 `protobuf:"varint,2,opt,name=sweep_fee_rate_sat_per_vbyte,json=sweepFeeRateSatPerVbyte,proto3" json:"sweep_fee_rate_sat_per_vbyte,omitempty"` - // - //The maximum fee paid to the server for facilitating the swap, expressed - //as parts per million of the swap volume. + // The maximum fee paid to the server for facilitating the swap, expressed + // as parts per million of the swap volume. MaxSwapFeePpm uint64 `protobuf:"varint,3,opt,name=max_swap_fee_ppm,json=maxSwapFeePpm,proto3" json:"max_swap_fee_ppm,omitempty"` - // - //The maximum fee paid to route the swap invoice off chain, expressed as - //parts per million of the volume being routed. + // The maximum fee paid to route the swap invoice off chain, expressed as + // parts per million of the volume being routed. MaxRoutingFeePpm uint64 `protobuf:"varint,4,opt,name=max_routing_fee_ppm,json=maxRoutingFeePpm,proto3" json:"max_routing_fee_ppm,omitempty"` - // - //The maximum fee paid to route the prepay invoice off chain, expressed as - //parts per million of the volume being routed. + // The maximum fee paid to route the prepay invoice off chain, expressed as + // parts per million of the volume being routed. MaxPrepayRoutingFeePpm uint64 `protobuf:"varint,5,opt,name=max_prepay_routing_fee_ppm,json=maxPrepayRoutingFeePpm,proto3" json:"max_prepay_routing_fee_ppm,omitempty"` - // - //The maximum no-show penalty in satoshis paid for a swap. + // The maximum no-show penalty in satoshis paid for a swap. MaxPrepaySat uint64 `protobuf:"varint,6,opt,name=max_prepay_sat,json=maxPrepaySat,proto3" json:"max_prepay_sat,omitempty"` - // - //The maximum miner fee we will pay to sweep the swap on chain. Note that we - //will not suggest a swap if the estimate is above the sweep limit set by - //these parameters, and we use the current fee estimate to sweep on chain so - //this value is only a cap placed on the amount we spend on fees in the case - //where the swap needs to be claimed on chain, but fees have suddenly spiked. + // The maximum miner fee we will pay to sweep the swap on chain. Note that we + // will not suggest a swap if the estimate is above the sweep limit set by + // these parameters, and we use the current fee estimate to sweep on chain so + // this value is only a cap placed on the amount we spend on fees in the case + // where the swap needs to be claimed on chain, but fees have suddenly spiked. MaxMinerFeeSat uint64 `protobuf:"varint,7,opt,name=max_miner_fee_sat,json=maxMinerFeeSat,proto3" json:"max_miner_fee_sat,omitempty"` - // - //The number of blocks from the on-chain HTLC's confirmation height that it - //should be swept within. + // The number of blocks from the on-chain HTLC's confirmation height that it + // should be swept within. SweepConfTarget int32 `protobuf:"varint,8,opt,name=sweep_conf_target,json=sweepConfTarget,proto3" json:"sweep_conf_target,omitempty"` - // - //The amount of time we require pass since a channel was part of a failed - //swap due to off chain payment failure until it will be considered for swap - //suggestions again, expressed in seconds. + // The amount of time we require pass since a channel was part of a failed + // swap due to off chain payment failure until it will be considered for swap + // suggestions again, expressed in seconds. FailureBackoffSec uint64 `protobuf:"varint,9,opt,name=failure_backoff_sec,json=failureBackoffSec,proto3" json:"failure_backoff_sec,omitempty"` - // - //Set to true to enable automatic dispatch of swaps. All swaps will be limited - //to the fee categories set by these parameters, and total expenditure will - //be limited to the autoloop budget. + // Set to true to enable automatic dispatch of swaps. All swaps will be limited + // to the fee categories set by these parameters, and total expenditure will + // be limited to the autoloop budget. Autoloop bool `protobuf:"varint,10,opt,name=autoloop,proto3" json:"autoloop,omitempty"` - // - //The total budget for automatically dispatched swaps since the budget start - //time, expressed in satoshis. + // The total budget for automatically dispatched swaps since the budget start + // time, expressed in satoshis. AutoloopBudgetSat uint64 `protobuf:"varint,11,opt,name=autoloop_budget_sat,json=autoloopBudgetSat,proto3" json:"autoloop_budget_sat,omitempty"` - // - //Deprecated, use autoloop_budget_refresh_period_sec. The start time for - //autoloop budget, expressed as a unix timestamp in seconds. If this value is - //0, the budget will be applied for all automatically dispatched swaps. Swaps - //that were completed before this date will not be included in budget - //calculations. + // Deprecated, use autoloop_budget_refresh_period_sec. The start time for + // autoloop budget, expressed as a unix timestamp in seconds. If this value is + // 0, the budget will be applied for all automatically dispatched swaps. Swaps + // that were completed before this date will not be included in budget + // calculations. // // Deprecated: Marked as deprecated in client.proto. AutoloopBudgetStartSec uint64 `protobuf:"varint,12,opt,name=autoloop_budget_start_sec,json=autoloopBudgetStartSec,proto3" json:"autoloop_budget_start_sec,omitempty"` - // - //The maximum number of automatically dispatched swaps that we allow to be in - //flight at any point in time. + // The maximum number of automatically dispatched swaps that we allow to be in + // flight at any point in time. AutoMaxInFlight uint64 `protobuf:"varint,13,opt,name=auto_max_in_flight,json=autoMaxInFlight,proto3" json:"auto_max_in_flight,omitempty"` - // - //The minimum amount, expressed in satoshis, that the autoloop client will - //dispatch a swap for. This value is subject to the server-side limits - //specified by the LoopOutTerms endpoint. + // The minimum amount, expressed in satoshis, that the autoloop client will + // dispatch a swap for. This value is subject to the server-side limits + // specified by the LoopOutTerms endpoint. MinSwapAmount uint64 `protobuf:"varint,14,opt,name=min_swap_amount,json=minSwapAmount,proto3" json:"min_swap_amount,omitempty"` - // - //The maximum amount, expressed in satoshis, that the autoloop client will - //dispatch a swap for. This value is subject to the server-side limits - //specified by the LoopOutTerms endpoint. + // The maximum amount, expressed in satoshis, that the autoloop client will + // dispatch a swap for. This value is subject to the server-side limits + // specified by the LoopOutTerms endpoint. MaxSwapAmount uint64 `protobuf:"varint,15,opt,name=max_swap_amount,json=maxSwapAmount,proto3" json:"max_swap_amount,omitempty"` - // - //The confirmation target for loop in on-chain htlcs. + // The confirmation target for loop in on-chain htlcs. HtlcConfTarget int32 `protobuf:"varint,17,opt,name=htlc_conf_target,json=htlcConfTarget,proto3" json:"htlc_conf_target,omitempty"` - // - //The destination address to use for autoloop loop outs. Set to "default" in - //order to revert to default behavior. + // The destination address to use for autoloop loop outs. Set to "default" in + // order to revert to default behavior. AutoloopDestAddress string `protobuf:"bytes,18,opt,name=autoloop_dest_address,json=autoloopDestAddress,proto3" json:"autoloop_dest_address,omitempty"` - // - //The period over which the autoloop budget is refreshed, expressed in - //seconds. + // The period over which the autoloop budget is refreshed, expressed in + // seconds. AutoloopBudgetRefreshPeriodSec uint64 `protobuf:"varint,19,opt,name=autoloop_budget_refresh_period_sec,json=autoloopBudgetRefreshPeriodSec,proto3" json:"autoloop_budget_refresh_period_sec,omitempty"` - // - //The time at which the autoloop budget was last refreshed, expressed as a - //UNIX timestamp in seconds. + // The time at which the autoloop budget was last refreshed, expressed as a + // UNIX timestamp in seconds. AutoloopBudgetLastRefresh uint64 `protobuf:"varint,20,opt,name=autoloop_budget_last_refresh,json=autoloopBudgetLastRefresh,proto3" json:"autoloop_budget_last_refresh,omitempty"` - // - //Set to true to enable easy autoloop. If set, all channel/peer rules will be - //overridden and the client will automatically dispatch swaps in order to meet - //the configured local balance target size. Currently only loop out is - //supported, meaning that easy autoloop can only reduce the funds that are - //held as balance in channels. + // Set to true to enable easy autoloop. If set, all channel/peer rules will be + // overridden and the client will automatically dispatch swaps in order to meet + // the configured local balance target size. Currently only loop out is + // supported, meaning that easy autoloop can only reduce the funds that are + // held as balance in channels. EasyAutoloop bool `protobuf:"varint,21,opt,name=easy_autoloop,json=easyAutoloop,proto3" json:"easy_autoloop,omitempty"` - // - //The local balance target size, expressed in satoshis. This is used by easy - //autoloop to determine how much liquidity should be maintained in channels. + // The local balance target size, expressed in satoshis. This is used by easy + // autoloop to determine how much liquidity should be maintained in channels. EasyAutoloopLocalTargetSat uint64 `protobuf:"varint,22,opt,name=easy_autoloop_local_target_sat,json=easyAutoloopLocalTargetSat,proto3" json:"easy_autoloop_local_target_sat,omitempty"` - // - //An alternative destination address source for the swap. This field - //represents the name of the account in the backing lnd instance. - //Refer to lnd's wallet import functions for reference. + // An alternative destination address source for the swap. This field + // represents the name of the account in the backing lnd instance. + // Refer to lnd's wallet import functions for reference. Account string `protobuf:"bytes,23,opt,name=account,proto3" json:"account,omitempty"` - // - //The address type of the account specified in the account field. + // The address type of the account specified in the account field. AccountAddrType AddressType `protobuf:"varint,24,opt,name=account_addr_type,json=accountAddrType,proto3,enum=looprpc.AddressType" json:"account_addr_type,omitempty"` } @@ -2954,29 +2810,24 @@ type LiquidityRule struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // - //The short channel ID of the channel that this rule should be applied to. - //This field may not be set when the pubkey field is set. + // The short channel ID of the channel that this rule should be applied to. + // This field may not be set when the pubkey field is set. ChannelId uint64 `protobuf:"varint,1,opt,name=channel_id,json=channelId,proto3" json:"channel_id,omitempty"` // The type of swap that will be dispatched for this rule. SwapType SwapType `protobuf:"varint,6,opt,name=swap_type,json=swapType,proto3,enum=looprpc.SwapType" json:"swap_type,omitempty"` - // - //The public key of the peer that this rule should be applied to. This field - //may not be set when the channel id field is set. + // The public key of the peer that this rule should be applied to. This field + // may not be set when the channel id field is set. Pubkey []byte `protobuf:"bytes,5,opt,name=pubkey,proto3" json:"pubkey,omitempty"` - // - //Type indicates the type of rule that this message rule represents. Setting - //this value will determine which fields are used in the message. The comments - //on each field in this message will be prefixed with the LiquidityRuleType - //they belong to. + // Type indicates the type of rule that this message rule represents. Setting + // this value will determine which fields are used in the message. The comments + // on each field in this message will be prefixed with the LiquidityRuleType + // they belong to. Type LiquidityRuleType `protobuf:"varint,2,opt,name=type,proto3,enum=looprpc.LiquidityRuleType" json:"type,omitempty"` - // - //THRESHOLD: The percentage of total capacity that incoming capacity should - //not drop beneath. + // THRESHOLD: The percentage of total capacity that incoming capacity should + // not drop beneath. IncomingThreshold uint32 `protobuf:"varint,3,opt,name=incoming_threshold,json=incomingThreshold,proto3" json:"incoming_threshold,omitempty"` - // - //THRESHOLD: The percentage of total capacity that outgoing capacity should - //not drop beneath. + // THRESHOLD: The percentage of total capacity that outgoing capacity should + // not drop beneath. OutgoingThreshold uint32 `protobuf:"varint,4,opt,name=outgoing_threshold,json=outgoingThreshold,proto3" json:"outgoing_threshold,omitempty"` } @@ -3059,11 +2910,10 @@ type SetLiquidityParamsRequest struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // - //Parameters is the desired new set of parameters for the liquidity management - //subsystem. Note that the current set of parameters will be completely - //overwritten by the parameters provided (if they are valid), so the full set - //of parameters should be provided for each call. + // Parameters is the desired new set of parameters for the liquidity management + // subsystem. Note that the current set of parameters will be completely + // overwritten by the parameters provided (if they are valid), so the full set + // of parameters should be provided for each call. Parameters *LiquidityParameters `protobuf:"bytes,1,opt,name=parameters,proto3" json:"parameters,omitempty"` } @@ -3187,14 +3037,11 @@ type Disqualified struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // - //The short channel ID of the channel that was excluded from our suggestions. + // The short channel ID of the channel that was excluded from our suggestions. ChannelId uint64 `protobuf:"varint,1,opt,name=channel_id,json=channelId,proto3" json:"channel_id,omitempty"` - // - //The public key of the peer that was excluded from our suggestions. + // The public key of the peer that was excluded from our suggestions. Pubkey []byte `protobuf:"bytes,3,opt,name=pubkey,proto3" json:"pubkey,omitempty"` - // - //The reason that we excluded the channel from the our suggestions. + // The reason that we excluded the channel from the our suggestions. Reason AutoReason `protobuf:"varint,2,opt,name=reason,proto3,enum=looprpc.AutoReason" json:"reason,omitempty"` } @@ -3256,15 +3103,12 @@ type SuggestSwapsResponse struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // - //The set of recommended loop outs. + // The set of recommended loop outs. LoopOut []*LoopOutRequest `protobuf:"bytes,1,rep,name=loop_out,json=loopOut,proto3" json:"loop_out,omitempty"` - // - //The set of recommended loop in swaps + // The set of recommended loop in swaps LoopIn []*LoopInRequest `protobuf:"bytes,3,rep,name=loop_in,json=loopIn,proto3" json:"loop_in,omitempty"` - // - //Disqualified contains the set of channels that swaps are not recommended - //for. + // Disqualified contains the set of channels that swaps are not recommended + // for. Disqualified []*Disqualified `protobuf:"bytes,2,rep,name=disqualified,proto3" json:"disqualified,omitempty"` } @@ -3326,14 +3170,12 @@ type AbandonSwapRequest struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // - //The swap identifier which currently is the hash that locks the HTLCs. When - //using REST, this field must be encoded as URL safe base64. + // The swap identifier which currently is the hash that locks the HTLCs. When + // using REST, this field must be encoded as URL safe base64. Id []byte `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` - // - //A flag that tries to ensure that the client understands that they are - //risking loss of funds by abandoning a swap. This could happen if an - //abandoned swap would wait on a timeout sweep by the client. + // A flag that tries to ensure that the client understands that they are + // risking loss of funds by abandoning a swap. This could happen if an + // abandoned swap would wait on a timeout sweep by the client. IKnowWhatIAmDoing bool `protobuf:"varint,2,opt,name=i_know_what_i_am_doing,json=iKnowWhatIAmDoing,proto3" json:"i_know_what_i_am_doing,omitempty"` } @@ -3464,8 +3306,7 @@ type ListReservationsResponse struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // - //The list of all currently known reservations and their status. + // The list of all currently known reservations and their status. Reservations []*ClientReservation `protobuf:"bytes,1,rep,name=reservations,proto3" json:"reservations,omitempty"` } @@ -3513,23 +3354,17 @@ type ClientReservation struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // - //The reservation id that identifies this reservation. + // The reservation id that identifies this reservation. ReservationId []byte `protobuf:"bytes,1,opt,name=reservation_id,json=reservationId,proto3" json:"reservation_id,omitempty"` - // - //The state the reservation is in. + // The state the reservation is in. State string `protobuf:"bytes,2,opt,name=state,proto3" json:"state,omitempty"` - // - //The amount that the reservation is for. + // The amount that the reservation is for. Amount uint64 `protobuf:"varint,3,opt,name=amount,proto3" json:"amount,omitempty"` - // - //The transaction id of the reservation. + // The transaction id of the reservation. TxId string `protobuf:"bytes,4,opt,name=tx_id,json=txId,proto3" json:"tx_id,omitempty"` - // - //The vout of the reservation. + // The vout of the reservation. Vout uint32 `protobuf:"varint,5,opt,name=vout,proto3" json:"vout,omitempty"` - // - //The expiry of the reservation. + // The expiry of the reservation. Expiry uint32 `protobuf:"varint,6,opt,name=expiry,proto3" json:"expiry,omitempty"` } @@ -3612,17 +3447,14 @@ type InstantOutRequest struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // - //The reservations to use for the swap. + // The reservations to use for the swap. ReservationIds [][]byte `protobuf:"bytes,1,rep,name=reservation_ids,json=reservationIds,proto3" json:"reservation_ids,omitempty"` - // - //A restriction on the channel set that may be used to loop out. The actual - //channel(s) that will be used are selected based on the lowest routing fee - //for the swap payment to the server. + // A restriction on the channel set that may be used to loop out. The actual + // channel(s) that will be used are selected based on the lowest routing fee + // for the swap payment to the server. OutgoingChanSet []uint64 `protobuf:"varint,2,rep,packed,name=outgoing_chan_set,json=outgoingChanSet,proto3" json:"outgoing_chan_set,omitempty"` - // - //An optional address to sweep the onchain funds to. If not set, the funds - //will be swept to the wallet's internal address. + // An optional address to sweep the onchain funds to. If not set, the funds + // will be swept to the wallet's internal address. DestAddr string `protobuf:"bytes,3,opt,name=dest_addr,json=destAddr,proto3" json:"dest_addr,omitempty"` } @@ -3684,14 +3516,11 @@ type InstantOutResponse struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // - //The hash of the swap preimage. + // The hash of the swap preimage. InstantOutHash []byte `protobuf:"bytes,1,opt,name=instant_out_hash,json=instantOutHash,proto3" json:"instant_out_hash,omitempty"` - // - //The transaction id of the sweep transaction. + // The transaction id of the sweep transaction. SweepTxId string `protobuf:"bytes,2,opt,name=sweep_tx_id,json=sweepTxId,proto3" json:"sweep_tx_id,omitempty"` - // - //The state of the swap. + // The state of the swap. State string `protobuf:"bytes,3,opt,name=state,proto3" json:"state,omitempty"` } @@ -3753,11 +3582,9 @@ type InstantOutQuoteRequest struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // - //The amount to swap in satoshis. + // The amount to swap in satoshis. Amt uint64 `protobuf:"varint,1,opt,name=amt,proto3" json:"amt,omitempty"` - // - //The amount of reservations to use for the swap. + // The amount of reservations to use for the swap. NumReservations int32 `protobuf:"varint,2,opt,name=num_reservations,json=numReservations,proto3" json:"num_reservations,omitempty"` } @@ -3812,12 +3639,10 @@ type InstantOutQuoteResponse struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // - //The fee that the swap service is charging for the swap. + // The fee that the swap service is charging for the swap. ServiceFeeSat int64 `protobuf:"varint,1,opt,name=service_fee_sat,json=serviceFeeSat,proto3" json:"service_fee_sat,omitempty"` - // - //The estimated on-chain fee that needs to be paid to publish the Sweepless - //Sweep. + // The estimated on-chain fee that needs to be paid to publish the Sweepless + // Sweep. SweepFeeSat int64 `protobuf:"varint,2,opt,name=sweep_fee_sat,json=sweepFeeSat,proto3" json:"sweep_fee_sat,omitempty"` } @@ -3910,8 +3735,7 @@ type ListInstantOutsResponse struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // - //The list of all currently known instant out swaps and their status. + // The list of all currently known instant out swaps and their status. Swaps []*InstantOut `protobuf:"bytes,1,rep,name=swaps,proto3" json:"swaps,omitempty"` } @@ -3959,20 +3783,15 @@ type InstantOut struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // - //The swap hash that identifies this swap. + // The swap hash that identifies this swap. SwapHash []byte `protobuf:"bytes,1,opt,name=swap_hash,json=swapHash,proto3" json:"swap_hash,omitempty"` - // - //The state the swap is in. + // The state the swap is in. State string `protobuf:"bytes,2,opt,name=state,proto3" json:"state,omitempty"` - // - //The amount of the swap. + // The amount of the swap. Amount uint64 `protobuf:"varint,3,opt,name=amount,proto3" json:"amount,omitempty"` - // - //The used reservations for the swap. + // The used reservations for the swap. ReservationIds [][]byte `protobuf:"bytes,4,rep,name=reservation_ids,json=reservationIds,proto3" json:"reservation_ids,omitempty"` - // - //The sweep transaction id of the swap. + // The sweep transaction id of the swap. SweepTxId string `protobuf:"bytes,5,opt,name=sweep_tx_id,json=sweepTxId,proto3" json:"sweep_tx_id,omitempty"` } diff --git a/looprpc/client_grpc.pb.go b/looprpc/client_grpc.pb.go index 8f4f519..4c35e42 100644 --- a/looprpc/client_grpc.pb.go +++ b/looprpc/client_grpc.pb.go @@ -19,83 +19,82 @@ const _ = grpc.SupportPackageIsVersion7 // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. type SwapClientClient interface { // loop: `out` - //LoopOut initiates an loop out swap with the given parameters. The call - //returns after the swap has been set up with the swap server. From that - //point onwards, progress can be tracked via the SwapStatus stream that is - //returned from Monitor(). + // LoopOut initiates an loop out swap with the given parameters. The call + // returns after the swap has been set up with the swap server. From that + // point onwards, progress can be tracked via the SwapStatus stream that is + // returned from Monitor(). LoopOut(ctx context.Context, in *LoopOutRequest, opts ...grpc.CallOption) (*SwapResponse, error) // loop: `in` - //LoopIn initiates a loop in swap with the given parameters. The call - //returns after the swap has been set up with the swap server. From that - //point onwards, progress can be tracked via the SwapStatus stream - //that is returned from Monitor(). + // LoopIn initiates a loop in swap with the given parameters. The call + // returns after the swap has been set up with the swap server. From that + // point onwards, progress can be tracked via the SwapStatus stream + // that is returned from Monitor(). LoopIn(ctx context.Context, in *LoopInRequest, opts ...grpc.CallOption) (*SwapResponse, error) // loop: `monitor` - //Monitor will return a stream of swap updates for currently active swaps. + // Monitor will return a stream of swap updates for currently active swaps. Monitor(ctx context.Context, in *MonitorRequest, opts ...grpc.CallOption) (SwapClient_MonitorClient, error) // loop: `listswaps` - //ListSwaps returns a list of all currently known swaps and their current - //status. + // ListSwaps returns a list of all currently known swaps and their current + // status. ListSwaps(ctx context.Context, in *ListSwapsRequest, opts ...grpc.CallOption) (*ListSwapsResponse, error) // loop: `swapinfo` - //SwapInfo returns all known details about a single swap. + // SwapInfo returns all known details about a single swap. SwapInfo(ctx context.Context, in *SwapInfoRequest, opts ...grpc.CallOption) (*SwapStatus, error) // loop: `abandonswap` - //AbandonSwap allows the client to abandon a swap. + // AbandonSwap allows the client to abandon a swap. AbandonSwap(ctx context.Context, in *AbandonSwapRequest, opts ...grpc.CallOption) (*AbandonSwapResponse, error) // loop: `terms` - //LoopOutTerms returns the terms that the server enforces for a loop out swap. + // LoopOutTerms returns the terms that the server enforces for a loop out swap. LoopOutTerms(ctx context.Context, in *TermsRequest, opts ...grpc.CallOption) (*OutTermsResponse, error) // loop: `quote` - //LoopOutQuote returns a quote for a loop out swap with the provided - //parameters. + // LoopOutQuote returns a quote for a loop out swap with the provided + // parameters. LoopOutQuote(ctx context.Context, in *QuoteRequest, opts ...grpc.CallOption) (*OutQuoteResponse, error) // loop: `terms` - //GetTerms returns the terms that the server enforces for swaps. + // GetTerms returns the terms that the server enforces for swaps. GetLoopInTerms(ctx context.Context, in *TermsRequest, opts ...grpc.CallOption) (*InTermsResponse, error) // loop: `quote` - //GetQuote returns a quote for a swap with the provided parameters. + // GetQuote returns a quote for a swap with the provided parameters. GetLoopInQuote(ctx context.Context, in *QuoteRequest, opts ...grpc.CallOption) (*InQuoteResponse, error) - // - //Probe asks he sever to probe the route to us to have a better upfront - //estimate about routing fees when loopin-in. + // Probe asks he sever to probe the route to us to have a better upfront + // estimate about routing fees when loopin-in. Probe(ctx context.Context, in *ProbeRequest, opts ...grpc.CallOption) (*ProbeResponse, error) // loop: `listauth` - //GetLsatTokens returns all LSAT tokens the daemon ever paid for. + // GetLsatTokens returns all LSAT tokens the daemon ever paid for. GetLsatTokens(ctx context.Context, in *TokensRequest, opts ...grpc.CallOption) (*TokensResponse, error) // loop: `getinfo` - //GetInfo gets basic information about the loop daemon. + // GetInfo gets basic information about the loop daemon. GetInfo(ctx context.Context, in *GetInfoRequest, opts ...grpc.CallOption) (*GetInfoResponse, error) // loop: `getparams` - //GetLiquidityParams gets the parameters that the daemon's liquidity manager - //is currently configured with. This may be nil if nothing is configured. - //[EXPERIMENTAL]: endpoint is subject to change. + // GetLiquidityParams gets the parameters that the daemon's liquidity manager + // is currently configured with. This may be nil if nothing is configured. + // [EXPERIMENTAL]: endpoint is subject to change. GetLiquidityParams(ctx context.Context, in *GetLiquidityParamsRequest, opts ...grpc.CallOption) (*LiquidityParameters, error) // loop: `setparams` - //SetLiquidityParams sets a new set of parameters for the daemon's liquidity - //manager. Note that the full set of parameters must be provided, because - //this call fully overwrites our existing parameters. - //[EXPERIMENTAL]: endpoint is subject to change. + // SetLiquidityParams sets a new set of parameters for the daemon's liquidity + // manager. Note that the full set of parameters must be provided, because + // this call fully overwrites our existing parameters. + // [EXPERIMENTAL]: endpoint is subject to change. SetLiquidityParams(ctx context.Context, in *SetLiquidityParamsRequest, opts ...grpc.CallOption) (*SetLiquidityParamsResponse, error) // loop: `suggestswaps` - //SuggestSwaps returns a list of recommended swaps based on the current - //state of your node's channels and it's liquidity manager parameters. - //Note that only loop out suggestions are currently supported. - //[EXPERIMENTAL]: endpoint is subject to change. + // SuggestSwaps returns a list of recommended swaps based on the current + // state of your node's channels and it's liquidity manager parameters. + // Note that only loop out suggestions are currently supported. + // [EXPERIMENTAL]: endpoint is subject to change. SuggestSwaps(ctx context.Context, in *SuggestSwapsRequest, opts ...grpc.CallOption) (*SuggestSwapsResponse, error) // loop: `listreservations` - //ListReservations returns a list of all reservations the server opened to us. + // ListReservations returns a list of all reservations the server opened to us. ListReservations(ctx context.Context, in *ListReservationsRequest, opts ...grpc.CallOption) (*ListReservationsResponse, error) // loop: `instantout` - //InstantOut initiates an instant out swap with the given parameters. + // InstantOut initiates an instant out swap with the given parameters. InstantOut(ctx context.Context, in *InstantOutRequest, opts ...grpc.CallOption) (*InstantOutResponse, error) // loop: `instantoutquote` - //InstantOutQuote returns a quote for an instant out swap with the provided - //parameters. + // InstantOutQuote returns a quote for an instant out swap with the provided + // parameters. InstantOutQuote(ctx context.Context, in *InstantOutQuoteRequest, opts ...grpc.CallOption) (*InstantOutQuoteResponse, error) // loop: `listinstantouts` - //ListInstantOuts returns a list of all currently known instant out swaps and - //their current status. + // ListInstantOuts returns a list of all currently known instant out swaps and + // their current status. ListInstantOuts(ctx context.Context, in *ListInstantOutsRequest, opts ...grpc.CallOption) (*ListInstantOutsResponse, error) } @@ -315,83 +314,82 @@ func (c *swapClientClient) ListInstantOuts(ctx context.Context, in *ListInstantO // for forward compatibility type SwapClientServer interface { // loop: `out` - //LoopOut initiates an loop out swap with the given parameters. The call - //returns after the swap has been set up with the swap server. From that - //point onwards, progress can be tracked via the SwapStatus stream that is - //returned from Monitor(). + // LoopOut initiates an loop out swap with the given parameters. The call + // returns after the swap has been set up with the swap server. From that + // point onwards, progress can be tracked via the SwapStatus stream that is + // returned from Monitor(). LoopOut(context.Context, *LoopOutRequest) (*SwapResponse, error) // loop: `in` - //LoopIn initiates a loop in swap with the given parameters. The call - //returns after the swap has been set up with the swap server. From that - //point onwards, progress can be tracked via the SwapStatus stream - //that is returned from Monitor(). + // LoopIn initiates a loop in swap with the given parameters. The call + // returns after the swap has been set up with the swap server. From that + // point onwards, progress can be tracked via the SwapStatus stream + // that is returned from Monitor(). LoopIn(context.Context, *LoopInRequest) (*SwapResponse, error) // loop: `monitor` - //Monitor will return a stream of swap updates for currently active swaps. + // Monitor will return a stream of swap updates for currently active swaps. Monitor(*MonitorRequest, SwapClient_MonitorServer) error // loop: `listswaps` - //ListSwaps returns a list of all currently known swaps and their current - //status. + // ListSwaps returns a list of all currently known swaps and their current + // status. ListSwaps(context.Context, *ListSwapsRequest) (*ListSwapsResponse, error) // loop: `swapinfo` - //SwapInfo returns all known details about a single swap. + // SwapInfo returns all known details about a single swap. SwapInfo(context.Context, *SwapInfoRequest) (*SwapStatus, error) // loop: `abandonswap` - //AbandonSwap allows the client to abandon a swap. + // AbandonSwap allows the client to abandon a swap. AbandonSwap(context.Context, *AbandonSwapRequest) (*AbandonSwapResponse, error) // loop: `terms` - //LoopOutTerms returns the terms that the server enforces for a loop out swap. + // LoopOutTerms returns the terms that the server enforces for a loop out swap. LoopOutTerms(context.Context, *TermsRequest) (*OutTermsResponse, error) // loop: `quote` - //LoopOutQuote returns a quote for a loop out swap with the provided - //parameters. + // LoopOutQuote returns a quote for a loop out swap with the provided + // parameters. LoopOutQuote(context.Context, *QuoteRequest) (*OutQuoteResponse, error) // loop: `terms` - //GetTerms returns the terms that the server enforces for swaps. + // GetTerms returns the terms that the server enforces for swaps. GetLoopInTerms(context.Context, *TermsRequest) (*InTermsResponse, error) // loop: `quote` - //GetQuote returns a quote for a swap with the provided parameters. + // GetQuote returns a quote for a swap with the provided parameters. GetLoopInQuote(context.Context, *QuoteRequest) (*InQuoteResponse, error) - // - //Probe asks he sever to probe the route to us to have a better upfront - //estimate about routing fees when loopin-in. + // Probe asks he sever to probe the route to us to have a better upfront + // estimate about routing fees when loopin-in. Probe(context.Context, *ProbeRequest) (*ProbeResponse, error) // loop: `listauth` - //GetLsatTokens returns all LSAT tokens the daemon ever paid for. + // GetLsatTokens returns all LSAT tokens the daemon ever paid for. GetLsatTokens(context.Context, *TokensRequest) (*TokensResponse, error) // loop: `getinfo` - //GetInfo gets basic information about the loop daemon. + // GetInfo gets basic information about the loop daemon. GetInfo(context.Context, *GetInfoRequest) (*GetInfoResponse, error) // loop: `getparams` - //GetLiquidityParams gets the parameters that the daemon's liquidity manager - //is currently configured with. This may be nil if nothing is configured. - //[EXPERIMENTAL]: endpoint is subject to change. + // GetLiquidityParams gets the parameters that the daemon's liquidity manager + // is currently configured with. This may be nil if nothing is configured. + // [EXPERIMENTAL]: endpoint is subject to change. GetLiquidityParams(context.Context, *GetLiquidityParamsRequest) (*LiquidityParameters, error) // loop: `setparams` - //SetLiquidityParams sets a new set of parameters for the daemon's liquidity - //manager. Note that the full set of parameters must be provided, because - //this call fully overwrites our existing parameters. - //[EXPERIMENTAL]: endpoint is subject to change. + // SetLiquidityParams sets a new set of parameters for the daemon's liquidity + // manager. Note that the full set of parameters must be provided, because + // this call fully overwrites our existing parameters. + // [EXPERIMENTAL]: endpoint is subject to change. SetLiquidityParams(context.Context, *SetLiquidityParamsRequest) (*SetLiquidityParamsResponse, error) // loop: `suggestswaps` - //SuggestSwaps returns a list of recommended swaps based on the current - //state of your node's channels and it's liquidity manager parameters. - //Note that only loop out suggestions are currently supported. - //[EXPERIMENTAL]: endpoint is subject to change. + // SuggestSwaps returns a list of recommended swaps based on the current + // state of your node's channels and it's liquidity manager parameters. + // Note that only loop out suggestions are currently supported. + // [EXPERIMENTAL]: endpoint is subject to change. SuggestSwaps(context.Context, *SuggestSwapsRequest) (*SuggestSwapsResponse, error) // loop: `listreservations` - //ListReservations returns a list of all reservations the server opened to us. + // ListReservations returns a list of all reservations the server opened to us. ListReservations(context.Context, *ListReservationsRequest) (*ListReservationsResponse, error) // loop: `instantout` - //InstantOut initiates an instant out swap with the given parameters. + // InstantOut initiates an instant out swap with the given parameters. InstantOut(context.Context, *InstantOutRequest) (*InstantOutResponse, error) // loop: `instantoutquote` - //InstantOutQuote returns a quote for an instant out swap with the provided - //parameters. + // InstantOutQuote returns a quote for an instant out swap with the provided + // parameters. InstantOutQuote(context.Context, *InstantOutQuoteRequest) (*InstantOutQuoteResponse, error) // loop: `listinstantouts` - //ListInstantOuts returns a list of all currently known instant out swaps and - //their current status. + // ListInstantOuts returns a list of all currently known instant out swaps and + // their current status. ListInstantOuts(context.Context, *ListInstantOutsRequest) (*ListInstantOutsResponse, error) mustEmbedUnimplementedSwapClientServer() } diff --git a/looprpc/debug.pb.go b/looprpc/debug.pb.go index fa69da2..a05f6ce 100644 --- a/looprpc/debug.pb.go +++ b/looprpc/debug.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.31.0 -// protoc v3.6.1 +// protoc v3.21.12 // source: debug.proto package looprpc diff --git a/looprpc/debug_grpc.pb.go b/looprpc/debug_grpc.pb.go index 99d3758..3d7613a 100644 --- a/looprpc/debug_grpc.pb.go +++ b/looprpc/debug_grpc.pb.go @@ -18,10 +18,9 @@ const _ = grpc.SupportPackageIsVersion7 // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. type DebugClient interface { - // - //ForceAutoLoop is intended for *testing purposes only* and will not work on - //mainnet. This endpoint ticks our autoloop timer, triggering automated - //dispatch of a swap if one is suggested. + // ForceAutoLoop is intended for *testing purposes only* and will not work on + // mainnet. This endpoint ticks our autoloop timer, triggering automated + // dispatch of a swap if one is suggested. ForceAutoLoop(ctx context.Context, in *ForceAutoLoopRequest, opts ...grpc.CallOption) (*ForceAutoLoopResponse, error) } @@ -46,10 +45,9 @@ func (c *debugClient) ForceAutoLoop(ctx context.Context, in *ForceAutoLoopReques // All implementations must embed UnimplementedDebugServer // for forward compatibility type DebugServer interface { - // - //ForceAutoLoop is intended for *testing purposes only* and will not work on - //mainnet. This endpoint ticks our autoloop timer, triggering automated - //dispatch of a swap if one is suggested. + // ForceAutoLoop is intended for *testing purposes only* and will not work on + // mainnet. This endpoint ticks our autoloop timer, triggering automated + // dispatch of a swap if one is suggested. ForceAutoLoop(context.Context, *ForceAutoLoopRequest) (*ForceAutoLoopResponse, error) mustEmbedUnimplementedDebugServer() } diff --git a/swapserverrpc/Dockerfile b/swapserverrpc/Dockerfile index 1c96778..3333428 100644 --- a/swapserverrpc/Dockerfile +++ b/swapserverrpc/Dockerfile @@ -1,9 +1,9 @@ -FROM golang:1.16.3-buster +FROM golang:1.21.9-bookworm RUN apt-get update && apt-get install -y \ git \ - protobuf-compiler='3.6*' \ - clang-format='1:7.0*' + protobuf-compiler='3.21.12*' \ + clang-format='1:14.0*' # We don't want any default values for these variables to make sure they're # explicitly provided by parsing the go.mod file. Otherwise we might forget to @@ -11,11 +11,15 @@ RUN apt-get update && apt-get install -y \ ARG PROTOBUF_VERSION ENV PROTOC_GEN_GO_GRPC_VERSION="v1.1.0" +ENV GOCACHE=/tmp/build/.cache +ENV GOMODCACHE=/tmp/build/.modcache RUN cd /tmp \ - && export GO111MODULE=on \ - && go get google.golang.org/protobuf/cmd/protoc-gen-go@${PROTOBUF_VERSION} \ - && go get google.golang.org/grpc/cmd/protoc-gen-go-grpc@${PROTOC_GEN_GO_GRPC_VERSION} + && mkdir -p /tmp/build/.cache \ + && mkdir -p /tmp/build/.modcache \ + && go install google.golang.org/protobuf/cmd/protoc-gen-go@${PROTOBUF_VERSION} \ + && go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@${PROTOC_GEN_GO_GRPC_VERSION} \ + && chmod -R 777 /tmp/build/ WORKDIR /build diff --git a/swapserverrpc/common.pb.go b/swapserverrpc/common.pb.go index a5452d2..ffdcb1c 100644 --- a/swapserverrpc/common.pb.go +++ b/swapserverrpc/common.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.30.0 -// protoc v3.6.1 +// protoc v3.21.12 // source: common.proto // We can't change this to swapserverrpc, it would be a breaking change because @@ -36,9 +36,8 @@ type HopHint struct { ChanId uint64 `protobuf:"varint,2,opt,name=chan_id,json=chanId,proto3" json:"chan_id,omitempty"` // The base fee of the channel denominated in millisatoshis. FeeBaseMsat uint32 `protobuf:"varint,3,opt,name=fee_base_msat,json=feeBaseMsat,proto3" json:"fee_base_msat,omitempty"` - // - //The fee rate of the channel for sending one satoshi across it denominated in - //millionths of a satoshi. + // The fee rate of the channel for sending one satoshi across it denominated in + // millionths of a satoshi. FeeProportionalMillionths uint32 `protobuf:"varint,4,opt,name=fee_proportional_millionths,json=feeProportionalMillionths,proto3" json:"fee_proportional_millionths,omitempty"` // The time-lock delta of the channel. CltvExpiryDelta uint32 `protobuf:"varint,5,opt,name=cltv_expiry_delta,json=cltvExpiryDelta,proto3" json:"cltv_expiry_delta,omitempty"` @@ -116,9 +115,8 @@ type RouteHint struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // - //A list of hop hints that when chained together can assist in reaching a - //specific destination. + // A list of hop hints that when chained together can assist in reaching a + // specific destination. HopHints []*HopHint `protobuf:"bytes,1,rep,name=hop_hints,json=hopHints,proto3" json:"hop_hints,omitempty"` } diff --git a/swapserverrpc/instantout.pb.go b/swapserverrpc/instantout.pb.go index f250d76..13e3e0f 100644 --- a/swapserverrpc/instantout.pb.go +++ b/swapserverrpc/instantout.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.30.0 -// protoc v3.6.1 +// protoc v3.21.12 // source: instantout.proto // We can't change this to swapserverrpc, it would be a breaking change because diff --git a/swapserverrpc/reservation.pb.go b/swapserverrpc/reservation.pb.go index 7097970..9e7bbab 100644 --- a/swapserverrpc/reservation.pb.go +++ b/swapserverrpc/reservation.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.30.0 -// protoc v3.6.1 +// protoc v3.21.12 // source: reservation.proto // We can't change this to swapserverrpc, it would be a breaking change because diff --git a/swapserverrpc/server.pb.go b/swapserverrpc/server.pb.go index 649aee9..82ffb25 100644 --- a/swapserverrpc/server.pb.go +++ b/swapserverrpc/server.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.30.0 -// protoc v3.6.1 +// protoc v3.21.12 // source: server.proto // We can't change this to swapserverrpc, it would be a breaking change because @@ -25,27 +25,26 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) -//* -//This enum defines the protocol versions that clients may adhere to. Note that -//this is not a flagged enum. If a particular protocol version adds a feature, -//then in general all the preceding features are also supported. Exception to this -//is when features get deprecated. +// * +// This enum defines the protocol versions that clients may adhere to. Note that +// this is not a flagged enum. If a particular protocol version adds a feature, +// then in general all the preceding features are also supported. Exception to this +// is when features get deprecated. type ProtocolVersion int32 const ( - /// No protocol version reported at all. + // / No protocol version reported at all. ProtocolVersion_LEGACY ProtocolVersion = 0 - /// Client may attempt to send the loop out payment in multiple parts. + // / Client may attempt to send the loop out payment in multiple parts. ProtocolVersion_MULTI_LOOP_OUT ProtocolVersion = 1 - //* - //Loop will use native segwit (P2WSH) htlcs by default, while externally - //published htlcs may use native (P2WSH) or nested (NP2WSH) segwit as well. + // * + // Loop will use native segwit (P2WSH) htlcs by default, while externally + // published htlcs may use native (P2WSH) or nested (NP2WSH) segwit as well. ProtocolVersion_NATIVE_SEGWIT_LOOP_IN ProtocolVersion = 2 - // - //Once the on chain loop out htlc is confirmed, the client can push the swap - //preimage to the server to speed up claim of their off chain htlc (acquiring - //incoming liquidity more quickly than if the server waited for the on chain - //claim tx). + // Once the on chain loop out htlc is confirmed, the client can push the swap + // preimage to the server to speed up claim of their off chain htlc (acquiring + // incoming liquidity more quickly than if the server waited for the on chain + // claim tx). ProtocolVersion_PREIMAGE_PUSH_LOOP_OUT ProtocolVersion = 3 // The client will propose a cltv expiry height for loop out. ProtocolVersion_USER_EXPIRY_LOOP_OUT ProtocolVersion = 4 @@ -138,23 +137,20 @@ const ( ServerSwapState_SERVER_HTLC_PUBLISHED ServerSwapState = 1 // The swap completed successfully. ServerSwapState_SERVER_SUCCESS ServerSwapState = 2 - // - //The swap failed for a reason that is unknown to the server, this is only - //set for older swaps. + // The swap failed for a reason that is unknown to the server, this is only + // set for older swaps. ServerSwapState_SERVER_FAILED_UNKNOWN ServerSwapState = 3 // No htlc was confirmed in time for the loop in swap to complete. ServerSwapState_SERVER_FAILED_NO_HTLC ServerSwapState = 4 // A loop in htlc confirmed on chain, but it did not have the correct value. ServerSwapState_SERVER_FAILED_INVALID_HTLC_AMOUNT ServerSwapState = 5 - // - //We did not succeed in completing the loop in off chain payment before the - //timeout. + // We did not succeed in completing the loop in off chain payment before the + // timeout. ServerSwapState_SERVER_FAILED_OFF_CHAIN_TIMEOUT ServerSwapState = 6 // The on chain timeout was claimed. ServerSwapState_SERVER_FAILED_TIMEOUT ServerSwapState = 7 - // - //The server could not publish the loop out on chain htlc before the deadline - //provided. + // The server could not publish the loop out on chain htlc before the deadline + // provided. ServerSwapState_SERVER_FAILED_SWAP_DEADLINE ServerSwapState = 8 // The server could not publish the loop out on chain htlc. ServerSwapState_SERVER_FAILED_HTLC_PUBLICATION ServerSwapState = 9 @@ -169,12 +165,10 @@ const ( // The client canceled the swap because they could not route the swap // payment. ServerSwapState_SERVER_CLIENT_INVOICE_CANCEL ServerSwapState = 14 - // - //A loop in swap was rejected because it contained multiple outputs for a - //single swap. + // A loop in swap was rejected because it contained multiple outputs for a + // single swap. ServerSwapState_SERVER_FAILED_MULTIPLE_SWAP_SCRIPTS ServerSwapState = 15 - // - //The swap failed during creation. + // The swap failed during creation. ServerSwapState_SERVER_FAILED_INITIALIZATION ServerSwapState = 16 ) @@ -306,25 +300,19 @@ func (RoutePaymentType) EnumDescriptor() ([]byte, []int) { type PaymentFailureReason int32 const ( - // - //Payment isn't failed (yet). + // Payment isn't failed (yet). PaymentFailureReason_LND_FAILURE_REASON_NONE PaymentFailureReason = 0 - // - //There are more routes to try, but the payment timeout was exceeded. + // There are more routes to try, but the payment timeout was exceeded. PaymentFailureReason_LND_FAILURE_REASON_TIMEOUT PaymentFailureReason = 1 - // - //All possible routes were tried and failed permanently. Or were no - //routes to the destination at all. + // All possible routes were tried and failed permanently. Or were no + // routes to the destination at all. PaymentFailureReason_LND_FAILURE_REASON_NO_ROUTE PaymentFailureReason = 2 - // - //A non-recoverable error has occured. + // A non-recoverable error has occured. PaymentFailureReason_LND_FAILURE_REASON_ERROR PaymentFailureReason = 3 - // - //Payment details incorrect (unknown hash, invalid amt or - //invalid final cltv delta) + // Payment details incorrect (unknown hash, invalid amt or + // invalid final cltv delta) PaymentFailureReason_LND_FAILURE_REASON_INCORRECT_PAYMENT_DETAILS PaymentFailureReason = 4 - // - //Insufficient local balance. + // Insufficient local balance. PaymentFailureReason_LND_FAILURE_REASON_INSUFFICIENT_BALANCE PaymentFailureReason = 5 ) @@ -477,9 +465,9 @@ type ServerLoopOutRequest struct { ReceiverKey []byte `protobuf:"bytes,1,opt,name=receiver_key,json=receiverKey,proto3" json:"receiver_key,omitempty"` SwapHash []byte `protobuf:"bytes,2,opt,name=swap_hash,json=swapHash,proto3" json:"swap_hash,omitempty"` Amt uint64 `protobuf:"varint,3,opt,name=amt,proto3" json:"amt,omitempty"` - /// The unix time in seconds we want the on-chain swap to be published by. + // / The unix time in seconds we want the on-chain swap to be published by. SwapPublicationDeadline int64 `protobuf:"varint,4,opt,name=swap_publication_deadline,json=swapPublicationDeadline,proto3" json:"swap_publication_deadline,omitempty"` - /// The protocol version that the client adheres to. + // / The protocol version that the client adheres to. ProtocolVersion ProtocolVersion `protobuf:"varint,5,opt,name=protocol_version,json=protocolVersion,proto3,enum=looprpc.ProtocolVersion" json:"protocol_version,omitempty"` // The requested absolute block height of the on-chain htlc. This is // subjected to min and max constraints as reported in the LoopOutTerms @@ -488,10 +476,13 @@ type ServerLoopOutRequest struct { // The user agent string that identifies the software running on the user's // side. This can be changed in the user's client software but it _SHOULD_ // conform to the following pattern: - // Agent-Name/semver-version(/additional-info) + // + // Agent-Name/semver-version(/additional-info) + // // Examples: - // loopd/v0.10.0-beta/commit=3b635821 - // litd/v0.2.0-alpha/commit=326d754 + // + // loopd/v0.10.0-beta/commit=3b635821 + // litd/v0.2.0-alpha/commit=326d754 UserAgent string `protobuf:"bytes,7,opt,name=user_agent,json=userAgent,proto3" json:"user_agent,omitempty"` } @@ -666,11 +657,11 @@ type ServerLoopOutQuoteRequest struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - /// The swap amount. If zero, a quote for a maximum amt swap will be given. + // / The swap amount. If zero, a quote for a maximum amt swap will be given. Amt uint64 `protobuf:"varint,1,opt,name=amt,proto3" json:"amt,omitempty"` - /// The unix time in seconds we want the on-chain swap to be published by. + // / The unix time in seconds we want the on-chain swap to be published by. SwapPublicationDeadline int64 `protobuf:"varint,2,opt,name=swap_publication_deadline,json=swapPublicationDeadline,proto3" json:"swap_publication_deadline,omitempty"` - /// The protocol version that the client adheres to. + // / The protocol version that the client adheres to. ProtocolVersion ProtocolVersion `protobuf:"varint,3,opt,name=protocol_version,json=protocolVersion,proto3,enum=looprpc.ProtocolVersion" json:"protocol_version,omitempty"` // The requested absolute block height of the on-chain htlc. This is // subjected to min and max constraints as reported in the LoopOutTerms @@ -679,10 +670,13 @@ type ServerLoopOutQuoteRequest struct { // The user agent string that identifies the software running on the user's // side. This can be changed in the user's client software but it _SHOULD_ // conform to the following pattern: - // Agent-Name/semver-version(/additional-info) + // + // Agent-Name/semver-version(/additional-info) + // // Examples: - // loopd/v0.10.0-beta/commit=3b635821 - // litd/v0.2.0-alpha/commit=326d754 + // + // loopd/v0.10.0-beta/commit=3b635821 + // litd/v0.2.0-alpha/commit=326d754 UserAgent string `protobuf:"bytes,5,opt,name=user_agent,json=userAgent,proto3" json:"user_agent,omitempty"` } @@ -759,9 +753,9 @@ type ServerLoopOutQuote struct { unknownFields protoimpl.UnknownFields SwapPaymentDest string `protobuf:"bytes,1,opt,name=swap_payment_dest,json=swapPaymentDest,proto3" json:"swap_payment_dest,omitempty"` - /// The total estimated swap fee given the quote amt. + // / The total estimated swap fee given the quote amt. SwapFee int64 `protobuf:"varint,2,opt,name=swap_fee,json=swapFee,proto3" json:"swap_fee,omitempty"` - /// Deprecated, total swap fee given quote amt is calculated in swap_fee. + // / Deprecated, total swap fee given quote amt is calculated in swap_fee. // // Deprecated: Marked as deprecated in server.proto. SwapFeeRate int64 `protobuf:"varint,3,opt,name=swap_fee_rate,json=swapFeeRate,proto3" json:"swap_fee_rate,omitempty"` @@ -867,15 +861,18 @@ type ServerLoopOutTermsRequest struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - /// The protocol version that the client adheres to. + // / The protocol version that the client adheres to. ProtocolVersion ProtocolVersion `protobuf:"varint,1,opt,name=protocol_version,json=protocolVersion,proto3,enum=looprpc.ProtocolVersion" json:"protocol_version,omitempty"` // The user agent string that identifies the software running on the user's // side. This can be changed in the user's client software but it _SHOULD_ // conform to the following pattern: - // Agent-Name/semver-version(/additional-info) + // + // Agent-Name/semver-version(/additional-info) + // // Examples: - // loopd/v0.10.0-beta/commit=3b635821 - // litd/v0.2.0-alpha/commit=326d754 + // + // loopd/v0.10.0-beta/commit=3b635821 + // litd/v0.2.0-alpha/commit=326d754 UserAgent string `protobuf:"bytes,2,opt,name=user_agent,json=userAgent,proto3" json:"user_agent,omitempty"` } @@ -1009,17 +1006,20 @@ type ServerLoopInRequest struct { Amt uint64 `protobuf:"varint,3,opt,name=amt,proto3" json:"amt,omitempty"` SwapInvoice string `protobuf:"bytes,4,opt,name=swap_invoice,json=swapInvoice,proto3" json:"swap_invoice,omitempty"` LastHop []byte `protobuf:"bytes,5,opt,name=last_hop,json=lastHop,proto3" json:"last_hop,omitempty"` - /// The protocol version that the client adheres to. + // / The protocol version that the client adheres to. ProtocolVersion ProtocolVersion `protobuf:"varint,6,opt,name=protocol_version,json=protocolVersion,proto3,enum=looprpc.ProtocolVersion" json:"protocol_version,omitempty"` // An invoice that can be used for the purpose of probing. ProbeInvoice string `protobuf:"bytes,7,opt,name=probe_invoice,json=probeInvoice,proto3" json:"probe_invoice,omitempty"` // The user agent string that identifies the software running on the user's // side. This can be changed in the user's client software but it _SHOULD_ // conform to the following pattern: - // Agent-Name/semver-version(/additional-info) + // + // Agent-Name/semver-version(/additional-info) + // // Examples: - // loopd/v0.10.0-beta/commit=3b635821 - // litd/v0.2.0-alpha/commit=326d754 + // + // loopd/v0.10.0-beta/commit=3b635821 + // litd/v0.2.0-alpha/commit=326d754 UserAgent string `protobuf:"bytes,8,opt,name=user_agent,json=userAgent,proto3" json:"user_agent,omitempty"` } @@ -1195,7 +1195,7 @@ type ServerLoopInQuoteRequest struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - /// The swap amount. If zero, a quote for a maximum amt swap will be given. + // / The swap amount. If zero, a quote for a maximum amt swap will be given. Amt uint64 `protobuf:"varint,1,opt,name=amt,proto3" json:"amt,omitempty"` // The destination pubkey. Pubkey []byte `protobuf:"bytes,3,opt,name=pubkey,proto3" json:"pubkey,omitempty"` @@ -1203,15 +1203,18 @@ type ServerLoopInQuoteRequest struct { LastHop []byte `protobuf:"bytes,4,opt,name=last_hop,json=lastHop,proto3" json:"last_hop,omitempty"` // Optional route hints to reach the destination through private channels. RouteHints []*RouteHint `protobuf:"bytes,5,rep,name=route_hints,json=routeHints,proto3" json:"route_hints,omitempty"` - /// The protocol version that the client adheres to. + // / The protocol version that the client adheres to. ProtocolVersion ProtocolVersion `protobuf:"varint,2,opt,name=protocol_version,json=protocolVersion,proto3,enum=looprpc.ProtocolVersion" json:"protocol_version,omitempty"` // The user agent string that identifies the software running on the user's // side. This can be changed in the user's client software but it _SHOULD_ // conform to the following pattern: - // Agent-Name/semver-version(/additional-info) + // + // Agent-Name/semver-version(/additional-info) + // // Examples: - // loopd/v0.10.0-beta/commit=3b635821 - // litd/v0.2.0-alpha/commit=326d754 + // + // loopd/v0.10.0-beta/commit=3b635821 + // litd/v0.2.0-alpha/commit=326d754 UserAgent string `protobuf:"bytes,6,opt,name=user_agent,json=userAgent,proto3" json:"user_agent,omitempty"` } @@ -1379,15 +1382,18 @@ type ServerLoopInTermsRequest struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - /// The protocol version that the client adheres to. + // / The protocol version that the client adheres to. ProtocolVersion ProtocolVersion `protobuf:"varint,1,opt,name=protocol_version,json=protocolVersion,proto3,enum=looprpc.ProtocolVersion" json:"protocol_version,omitempty"` // The user agent string that identifies the software running on the user's // side. This can be changed in the user's client software but it _SHOULD_ // conform to the following pattern: - // Agent-Name/semver-version(/additional-info) + // + // Agent-Name/semver-version(/additional-info) + // // Examples: - // loopd/v0.10.0-beta/commit=3b635821 - // litd/v0.2.0-alpha/commit=326d754 + // + // loopd/v0.10.0-beta/commit=3b635821 + // litd/v0.2.0-alpha/commit=326d754 UserAgent string `protobuf:"bytes,2,opt,name=user_agent,json=userAgent,proto3" json:"user_agent,omitempty"` } @@ -1502,9 +1508,8 @@ type ServerLoopOutPushPreimageRequest struct { // The protocol version that the client adheres to. ProtocolVersion ProtocolVersion `protobuf:"varint,1,opt,name=protocol_version,json=protocolVersion,proto3,enum=looprpc.ProtocolVersion" json:"protocol_version,omitempty"` - // - //Preimage is the preimage of the loop out swap that we wish to push to the - //server to speed up off-chain claim once the on-chain htlc has confirmed. + // Preimage is the preimage of the loop out swap that we wish to push to the + // server to speed up off-chain claim once the on-chain htlc has confirmed. Preimage []byte `protobuf:"bytes,2,opt,name=preimage,proto3" json:"preimage,omitempty"` } @@ -1893,6 +1898,7 @@ type CancelLoopOutSwapRequest struct { // Additional information about the swap cancelation. // // Types that are assignable to CancelInfo: + // // *CancelLoopOutSwapRequest_RouteCancel CancelInfo isCancelLoopOutSwapRequest_CancelInfo `protobuf_oneof:"cancel_info"` } From b99cde172a18055c77034bfc5ccfde3360825f4c Mon Sep 17 00:00:00 2001 From: Boris Nagaev Date: Wed, 17 Apr 2024 14:05:46 -0300 Subject: [PATCH 03/37] go: bump protobuf to v1.33.0-hex-display --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 67d59fd..c7e3cb8 100644 --- a/go.mod +++ b/go.mod @@ -200,7 +200,7 @@ require ( // We want to format raw bytes as hex instead of base64. The forked version // allows us to specify that as an option. -replace google.golang.org/protobuf => github.com/lightninglabs/protobuf-go-hex-display v1.30.0-hex-display +replace google.golang.org/protobuf => github.com/lightninglabs/protobuf-go-hex-display v1.33.0-hex-display replace github.com/lightninglabs/loop/swapserverrpc => ./swapserverrpc diff --git a/go.sum b/go.sum index 3f0d182..87242b0 100644 --- a/go.sum +++ b/go.sum @@ -1104,8 +1104,8 @@ github.com/lightninglabs/neutrino v0.16.0 h1:YNTQG32fPR/Zg0vvJVI65OBH8l3U18LSXXt github.com/lightninglabs/neutrino v0.16.0/go.mod h1:x3OmY2wsA18+Kc3TSV2QpSUewOCiscw2mKpXgZv2kZk= github.com/lightninglabs/neutrino/cache v1.1.1 h1:TllWOSlkABhpgbWJfzsrdUaDH2fBy/54VSIB4vVqV8M= github.com/lightninglabs/neutrino/cache v1.1.1/go.mod h1:XJNcgdOw1LQnanGjw8Vj44CvguYA25IMKjWFZczwZuo= -github.com/lightninglabs/protobuf-go-hex-display v1.30.0-hex-display h1:pRdza2wleRN1L2fJXd6ZoQ9ZegVFTAb2bOQfruJPKcY= -github.com/lightninglabs/protobuf-go-hex-display v1.30.0-hex-display/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +github.com/lightninglabs/protobuf-go-hex-display v1.33.0-hex-display h1:Y2WiPkBS/00EiEg0qp0FhehxnQfk3vv8U6Xt3nN+rTY= +github.com/lightninglabs/protobuf-go-hex-display v1.33.0-hex-display/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= github.com/lightningnetwork/lightning-onion v1.2.1-0.20230823005744-06182b1d7d2f h1:Pua7+5TcFEJXIIZ1I2YAUapmbcttmLj4TTi786bIi3s= github.com/lightningnetwork/lightning-onion v1.2.1-0.20230823005744-06182b1d7d2f/go.mod h1:c0kvRShutpj3l6B9WtTsNTBUtjSmjZXbJd9ZBRQOSKI= github.com/lightningnetwork/lnd v0.17.4-beta h1:BXYbETYZWtcNrYcAosGGXnWsq4Nr5R9PRqlRuEA9AUs= From bfc3f44aa1deea2ef6be8d2497c579048d77434f Mon Sep 17 00:00:00 2001 From: Boris Nagaev Date: Wed, 17 Apr 2024 14:13:01 -0300 Subject: [PATCH 04/37] update aperture to include lsat to l402 renaming Fix the build: go mod tidy sed 's@\@l402@g' -i `git grep -l -w aperture/lsat` make rpc --- client.go | 6 +++--- config.go | 4 ++-- go.mod | 16 ++++++++-------- go.sum | 26 ++++++++++++++------------ loopd/config.go | 6 +++--- loopd/log.go | 4 ++-- loopd/swapclient_server.go | 4 ++-- looprpc/client.pb.go | 2 +- looprpc/debug.pb.go | 2 +- swap_server_client.go | 8 ++++---- 10 files changed, 40 insertions(+), 38 deletions(-) diff --git a/client.go b/client.go index 526c2a6..73c01bd 100644 --- a/client.go +++ b/client.go @@ -12,7 +12,7 @@ import ( "github.com/btcsuite/btcd/btcec/v2" "github.com/btcsuite/btcd/btcec/v2/schnorr" "github.com/btcsuite/btcd/btcutil" - "github.com/lightninglabs/aperture/lsat" + "github.com/lightninglabs/aperture/l402" "github.com/lightninglabs/lndclient" "github.com/lightninglabs/loop/loopdb" "github.com/lightninglabs/loop/swap" @@ -57,7 +57,7 @@ var ( // globalCallTimeout is the maximum time any call of the client to the // server is allowed to take, including the time it may take to get // and pay for an LSAT token. - globalCallTimeout = serverRPCTimeout + lsat.PaymentTimeout + globalCallTimeout = serverRPCTimeout + l402.PaymentTimeout // probeTimeout is the maximum time until a probe is allowed to take. probeTimeout = 3 * time.Minute @@ -138,7 +138,7 @@ func NewClient(dbDir string, loopDB loopdb.SwapStore, sweeperDb sweepbatcher.BatcherStore, cfg *ClientConfig) ( *Client, func(), error) { - lsatStore, err := lsat.NewFileStore(dbDir) + lsatStore, err := l402.NewFileStore(dbDir) if err != nil { return nil, nil, err } diff --git a/config.go b/config.go index 0e2a7b5..7501a56 100644 --- a/config.go +++ b/config.go @@ -3,7 +3,7 @@ package loop import ( "time" - "github.com/lightninglabs/aperture/lsat" + "github.com/lightninglabs/aperture/l402" "github.com/lightninglabs/lndclient" "github.com/lightninglabs/loop/loopdb" "google.golang.org/grpc" @@ -15,7 +15,7 @@ type clientConfig struct { Server swapServerClient Conn *grpc.ClientConn Store loopdb.SwapStore - LsatStore lsat.Store + LsatStore l402.Store CreateExpiryTimer func(expiry time.Duration) <-chan time.Time LoopOutMaxParts uint32 } diff --git a/go.mod b/go.mod index c7e3cb8..db9c1cb 100644 --- a/go.mod +++ b/go.mod @@ -19,7 +19,7 @@ require ( github.com/jackc/pgerrcode v0.0.0-20220416144525-469b46aa5efa github.com/jessevdk/go-flags v1.4.0 github.com/lib/pq v1.10.7 - github.com/lightninglabs/aperture v0.1.21-beta.0.20230705004936-87bb996a4030 + github.com/lightninglabs/aperture v0.3.2-beta github.com/lightninglabs/lndclient v0.17.4-1 github.com/lightninglabs/loop/swapserverrpc v1.0.5 github.com/lightningnetwork/lnd v0.17.4-beta @@ -33,7 +33,7 @@ require ( github.com/urfave/cli v1.22.9 golang.org/x/net v0.23.0 google.golang.org/grpc v1.59.0 - google.golang.org/protobuf v1.31.0 + google.golang.org/protobuf v1.33.0 gopkg.in/macaroon-bakery.v2 v2.1.0 gopkg.in/macaroon.v2 v2.1.0 modernc.org/sqlite v1.29.5 @@ -78,7 +78,7 @@ require ( github.com/go-logr/stdr v1.2.2 // indirect github.com/gogo/protobuf v1.3.2 // indirect github.com/golang-jwt/jwt/v4 v4.4.2 // indirect - github.com/golang/protobuf v1.5.3 // indirect + github.com/golang/protobuf v1.5.4 // indirect github.com/golang/snappy v0.0.4 // indirect github.com/google/btree v1.0.1 // indirect github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect @@ -161,14 +161,14 @@ require ( go.etcd.io/etcd/pkg/v3 v3.5.7 // indirect go.etcd.io/etcd/raft/v3 v3.5.7 // indirect go.etcd.io/etcd/server/v3 v3.5.7 // indirect - go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.46.0 // indirect - go.opentelemetry.io/otel v1.20.0 // indirect + go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.46.1 // indirect + go.opentelemetry.io/otel v1.21.0 // indirect go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.3.0 // indirect go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.3.0 // indirect go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.3.0 // indirect - go.opentelemetry.io/otel/metric v1.20.0 // indirect - go.opentelemetry.io/otel/sdk v1.3.0 // indirect - go.opentelemetry.io/otel/trace v1.20.0 // indirect + go.opentelemetry.io/otel/metric v1.21.0 // indirect + go.opentelemetry.io/otel/sdk v1.21.0 // indirect + go.opentelemetry.io/otel/trace v1.21.0 // indirect go.opentelemetry.io/proto/otlp v0.19.0 // indirect go.uber.org/atomic v1.7.0 // indirect go.uber.org/multierr v1.6.0 // indirect diff --git a/go.sum b/go.sum index 87242b0..b17d474 100644 --- a/go.sum +++ b/go.sum @@ -873,8 +873,9 @@ github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/golang/protobuf v1.5.1/go.mod h1:DopwsBzvsk0Fs44TXzsVbJyPhcCPeIwnvohx4u74HPM= github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= +github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= @@ -1094,8 +1095,8 @@ github.com/lib/pq v1.8.0/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= github.com/lib/pq v1.10.2/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= github.com/lib/pq v1.10.7 h1:p7ZhMD+KsSRozJr34udlUrhboJwWAgCg34+/ZZNvZZw= github.com/lib/pq v1.10.7/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= -github.com/lightninglabs/aperture v0.1.21-beta.0.20230705004936-87bb996a4030 h1:q/BBO2awQdy/dCILXXZbBsstQ+1DpSQ/c8B8EgKqg+g= -github.com/lightninglabs/aperture v0.1.21-beta.0.20230705004936-87bb996a4030/go.mod h1:Jvoen+fgoaGQZIHdchiGigu0Lwuwz8S5u5wad9IhVDU= +github.com/lightninglabs/aperture v0.3.2-beta h1:J2GQwBmSHxpr5VOatXbgrTogF/qN2l6UWLPHfIowq10= +github.com/lightninglabs/aperture v0.3.2-beta/go.mod h1:M/5dPzHjHvuYXQuxzicqaGiCclHUvKW6N0ay1t/HGiM= github.com/lightninglabs/gozmq v0.0.0-20191113021534-d20a764486bf h1:HZKvJUHlcXI/f/O0Avg7t8sqkPo78HFzjmeYFl6DPnc= github.com/lightninglabs/gozmq v0.0.0-20191113021534-d20a764486bf/go.mod h1:vxmQPeIQxPf6Jf9rM8R+B4rKBqLA2AjttNxkFBL2Plk= github.com/lightninglabs/lndclient v0.17.4-1 h1:uCLBYf1f1nOoagHuiPK9anERA86dNSlYK9/QGb410RQ= @@ -1347,24 +1348,25 @@ go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk= go.opencensus.io v0.23.0/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E= go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= -go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.46.0 h1:PzIubN4/sjByhDRHLviCjJuweBXWFZWhghjg7cS28+M= -go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.46.0/go.mod h1:Ct6zzQEuGK3WpJs2n4dn+wfJYzd/+hNnxMRTWjGn30M= +go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.46.1 h1:SpGay3w+nEwMpfVnbqOLH5gY52/foP8RE8UzTZ1pdSE= +go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.46.1/go.mod h1:4UoMYEZOC0yN/sPGH76KPkkU7zgiEWYWL9vwmbnTJPE= go.opentelemetry.io/otel v1.3.0/go.mod h1:PWIKzi6JCp7sM0k9yZ43VX+T345uNbAkDKwHVjb2PTs= -go.opentelemetry.io/otel v1.20.0 h1:vsb/ggIY+hUjD/zCAQHpzTmndPqv/ml2ArbsbfBYTAc= -go.opentelemetry.io/otel v1.20.0/go.mod h1:oUIGj3D77RwJdM6PPZImDpSZGDvkD9fhesHny69JFrs= +go.opentelemetry.io/otel v1.21.0 h1:hzLeKBZEL7Okw2mGzZ0cc4k/A7Fta0uoPgaJCr8fsFc= +go.opentelemetry.io/otel v1.21.0/go.mod h1:QZzNPQPm1zLX4gZK4cMi+71eaorMSGT3A4znnUvNNEo= go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.3.0 h1:R/OBkMoGgfy2fLhs2QhkCI1w4HLEQX92GCcJB6SSdNk= go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.3.0/go.mod h1:VpP4/RMn8bv8gNo9uK7/IMY4mtWLELsS+JIP0inH0h4= go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.3.0 h1:giGm8w67Ja7amYNfYMdme7xSp2pIxThWopw8+QP51Yk= go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.3.0/go.mod h1:hO1KLR7jcKaDDKDkvI9dP/FIhpmna5lkqPUQdEjFAM8= go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.3.0 h1:VQbUHoJqytHHSJ1OZodPH9tvZZSVzUHjPHpkO85sT6k= go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.3.0/go.mod h1:keUU7UfnwWTWpJ+FWnyqmogPa82nuU5VUANFq49hlMY= -go.opentelemetry.io/otel/metric v1.20.0 h1:ZlrO8Hu9+GAhnepmRGhSU7/VkpjrNowxRN9GyKR4wzA= -go.opentelemetry.io/otel/metric v1.20.0/go.mod h1:90DRw3nfK4D7Sm/75yQ00gTJxtkBxX+wu6YaNymbpVM= -go.opentelemetry.io/otel/sdk v1.3.0 h1:3278edCoH89MEJ0Ky8WQXVmDQv3FX4ZJ3Pp+9fJreAI= +go.opentelemetry.io/otel/metric v1.21.0 h1:tlYWfeo+Bocx5kLEloTjbcDwBuELRrIFxwdQ36PlJu4= +go.opentelemetry.io/otel/metric v1.21.0/go.mod h1:o1p3CA8nNHW8j5yuQLdc1eeqEaPfzug24uvsyIEJRWM= go.opentelemetry.io/otel/sdk v1.3.0/go.mod h1:rIo4suHNhQwBIPg9axF8V9CA72Wz2mKF1teNrup8yzs= +go.opentelemetry.io/otel/sdk v1.21.0 h1:FTt8qirL1EysG6sTQRZ5TokkU8d0ugCj8htOgThZXQ8= +go.opentelemetry.io/otel/sdk v1.21.0/go.mod h1:Nna6Yv7PWTdgJHVRD9hIYywQBRx7pbox6nwBnZIxl/E= go.opentelemetry.io/otel/trace v1.3.0/go.mod h1:c/VDhno8888bvQYmbYLqe41/Ldmr/KKunbvWM4/fEjk= -go.opentelemetry.io/otel/trace v1.20.0 h1:+yxVAPZPbQhbC3OfAkeIVTky6iTFpcr4SiY9om7mXSQ= -go.opentelemetry.io/otel/trace v1.20.0/go.mod h1:HJSK7F/hA5RlzpZ0zKDCHCDHm556LCDtKaAo6JmBFUU= +go.opentelemetry.io/otel/trace v1.21.0 h1:WD9i5gzvoUPuXIXH24ZNBudiarZDKuekPqi/E8fpfLc= +go.opentelemetry.io/otel/trace v1.21.0/go.mod h1:LGbsEB0f9LGjN+OZaQQ26sohbOmiMR+BaslueVtS/qQ= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= go.opentelemetry.io/proto/otlp v0.11.0/go.mod h1:QpEjXPrNQzrFDZgoTo49dgHR9RYRSrg3NAKnUGl9YpQ= go.opentelemetry.io/proto/otlp v0.15.0/go.mod h1:H7XAot3MsfNsj7EXtrA2q5xSNQ10UqI405h3+duxN4U= diff --git a/loopd/config.go b/loopd/config.go index 3fd5663..877e472 100644 --- a/loopd/config.go +++ b/loopd/config.go @@ -10,7 +10,7 @@ import ( "time" "github.com/btcsuite/btcd/btcutil" - "github.com/lightninglabs/aperture/lsat" + "github.com/lightninglabs/aperture/l402" "github.com/lightninglabs/loop/loopdb" "github.com/lightningnetwork/lnd/cert" "github.com/lightningnetwork/lnd/lncfg" @@ -206,8 +206,8 @@ func DefaultConfig() Config { TLSKeyPath: DefaultTLSKeyPath, TLSValidity: DefaultAutogenValidity, MacaroonPath: DefaultMacaroonPath, - MaxLSATCost: lsat.DefaultMaxCostSats, - MaxLSATFee: lsat.DefaultMaxRoutingFeeSats, + MaxLSATCost: l402.DefaultMaxCostSats, + MaxLSATFee: l402.DefaultMaxRoutingFeeSats, LoopOutMaxParts: defaultLoopOutMaxParts, TotalPaymentTimeout: defaultTotalPaymentTimeout, MaxPaymentRetries: defaultMaxPaymentRetries, diff --git a/loopd/log.go b/loopd/log.go index 489fa98..970bd80 100644 --- a/loopd/log.go +++ b/loopd/log.go @@ -2,7 +2,7 @@ package loopd import ( "github.com/btcsuite/btclog" - "github.com/lightninglabs/aperture/lsat" + "github.com/lightninglabs/aperture/l402" "github.com/lightninglabs/lndclient" "github.com/lightninglabs/loop" "github.com/lightninglabs/loop/fsm" @@ -37,7 +37,7 @@ func SetupLoggers(root *build.RotatingLogWriter, intercept signal.Interceptor) { lnd.AddSubLogger(root, "SWEEP", intercept, sweepbatcher.UseLogger) lnd.AddSubLogger(root, "LNDC", intercept, lndclient.UseLogger) lnd.AddSubLogger(root, "STORE", intercept, loopdb.UseLogger) - lnd.AddSubLogger(root, lsat.Subsystem, intercept, lsat.UseLogger) + lnd.AddSubLogger(root, l402.Subsystem, intercept, l402.UseLogger) lnd.AddSubLogger( root, liquidity.Subsystem, intercept, liquidity.UseLogger, ) diff --git a/loopd/swapclient_server.go b/loopd/swapclient_server.go index f42e8d5..ef9cf81 100644 --- a/loopd/swapclient_server.go +++ b/loopd/swapclient_server.go @@ -15,7 +15,7 @@ import ( "github.com/btcsuite/btcd/btcec/v2" "github.com/btcsuite/btcd/btcutil" "github.com/btcsuite/btcd/chaincfg" - "github.com/lightninglabs/aperture/lsat" + "github.com/lightninglabs/aperture/l402" "github.com/lightninglabs/lndclient" "github.com/lightninglabs/loop" "github.com/lightninglabs/loop/instantout" @@ -939,7 +939,7 @@ func (s *swapClientServer) GetLsatTokens(ctx context.Context, return nil, err } - id, err := lsat.DecodeIdentifier( + id, err := l402.DecodeIdentifier( bytes.NewReader(token.BaseMacaroon().Id()), ) if err != nil { diff --git a/looprpc/client.pb.go b/looprpc/client.pb.go index 45a1a7a..700198f 100644 --- a/looprpc/client.pb.go +++ b/looprpc/client.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.31.0 +// protoc-gen-go v1.33.0 // protoc v3.21.12 // source: client.proto diff --git a/looprpc/debug.pb.go b/looprpc/debug.pb.go index a05f6ce..17c5fa7 100644 --- a/looprpc/debug.pb.go +++ b/looprpc/debug.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.31.0 +// protoc-gen-go v1.33.0 // protoc v3.21.12 // source: debug.proto diff --git a/swap_server_client.go b/swap_server_client.go index 87760f3..32708ad 100644 --- a/swap_server_client.go +++ b/swap_server_client.go @@ -15,7 +15,7 @@ import ( "github.com/btcsuite/btcd/btcec/v2" "github.com/btcsuite/btcd/btcutil" "github.com/btcsuite/btcd/wire" - "github.com/lightninglabs/aperture/lsat" + "github.com/lightninglabs/aperture/l402" "github.com/lightninglabs/loop/loopdb" looprpc "github.com/lightninglabs/loop/swapserverrpc" "github.com/lightningnetwork/lnd/lnrpc" @@ -161,12 +161,12 @@ func (s *grpcSwapServerClient) stop() { var _ swapServerClient = (*grpcSwapServerClient)(nil) -func newSwapServerClient(cfg *ClientConfig, lsatStore lsat.Store) ( +func newSwapServerClient(cfg *ClientConfig, lsatStore l402.Store) ( *grpcSwapServerClient, error) { // Create the server connection with the interceptor that will handle // the LSAT protocol for us. - clientInterceptor := lsat.NewInterceptor( + clientInterceptor := l402.NewInterceptor( cfg.Lnd, lsatStore, serverRPCTimeout, cfg.MaxLsatCost, cfg.MaxLsatFee, false, ) @@ -895,7 +895,7 @@ func rpcRouteCancel(details *outCancelDetails) ( // proxyAddr indicates that a SOCKS proxy found at the address should be used to // establish the connection. func getSwapServerConn(address, proxyAddress string, insecure bool, - tlsPath string, interceptor *lsat.ClientInterceptor) (*grpc.ClientConn, + tlsPath string, interceptor *l402.ClientInterceptor) (*grpc.ClientConn, error) { // Create a dial options array. From 0e7927ac9641411319b3a45932ba1e5b4a1afe94 Mon Sep 17 00:00:00 2001 From: Boris Nagaev Date: Wed, 17 Apr 2024 15:57:59 -0300 Subject: [PATCH 05/37] multi: replace LSAT with L402 git mv ./cmd/loop/lsat.go ./cmd/loop/l402.go sed 's@lsat@l402@g' -i `git grep -l lsat` sed 's@Lsat@L402@g' -i `git grep -l Lsat` sed 's@LSAT@L402@g' -i `git grep -l LSAT` make rpc Updated release_notes.md. --- client.go | 16 ++-- cmd/loop/{lsat.go => l402.go} | 6 +- config.go | 2 +- instantout/reservation/manager.go | 2 +- loopd/config.go | 8 +- loopd/perms/perms.go | 2 +- loopd/swapclient_server.go | 12 +-- loopd/utils.go | 4 +- looprpc/client.pb.go | 54 ++++++------ looprpc/client.pb.gw.go | 28 +++--- looprpc/client.proto | 8 +- looprpc/client.swagger.json | 142 +++++++++++++++--------------- looprpc/client.yaml | 4 +- looprpc/client_grpc.pb.go | 28 +++--- looprpc/swapclient.pb.json.go | 4 +- release_notes.md | 8 ++ sample-loopd.conf | 4 +- swap_server_client.go | 8 +- 18 files changed, 174 insertions(+), 166 deletions(-) rename cmd/loop/{lsat.go => l402.go} (92%) diff --git a/client.go b/client.go index 73c01bd..ae45e9d 100644 --- a/client.go +++ b/client.go @@ -56,7 +56,7 @@ var ( // globalCallTimeout is the maximum time any call of the client to the // server is allowed to take, including the time it may take to get - // and pay for an LSAT token. + // and pay for an L402 token. globalCallTimeout = serverRPCTimeout + l402.PaymentTimeout // probeTimeout is the maximum time until a probe is allowed to take. @@ -111,13 +111,13 @@ type ClientConfig struct { // Lnd is an instance of the lnd proxy. Lnd *lndclient.LndServices - // MaxLsatCost is the maximum price we are willing to pay to the server + // MaxL402Cost is the maximum price we are willing to pay to the server // for the token. - MaxLsatCost btcutil.Amount + MaxL402Cost btcutil.Amount - // MaxLsatFee is the maximum that we are willing to pay in routing fees + // MaxL402Fee is the maximum that we are willing to pay in routing fees // to obtain the token. - MaxLsatFee btcutil.Amount + MaxL402Fee btcutil.Amount // LoopOutMaxParts defines the maximum number of parts that may be used // for a loop out swap. When greater than one, a multi-part payment may @@ -138,12 +138,12 @@ func NewClient(dbDir string, loopDB loopdb.SwapStore, sweeperDb sweepbatcher.BatcherStore, cfg *ClientConfig) ( *Client, func(), error) { - lsatStore, err := l402.NewFileStore(dbDir) + l402Store, err := l402.NewFileStore(dbDir) if err != nil { return nil, nil, err } - swapServerClient, err := newSwapServerClient(cfg, lsatStore) + swapServerClient, err := newSwapServerClient(cfg, l402Store) if err != nil { return nil, nil, err } @@ -153,7 +153,7 @@ func NewClient(dbDir string, loopDB loopdb.SwapStore, Server: swapServerClient, Store: loopDB, Conn: swapServerClient.conn, - LsatStore: lsatStore, + L402Store: l402Store, CreateExpiryTimer: func(d time.Duration) <-chan time.Time { return time.NewTimer(d).C }, diff --git a/cmd/loop/lsat.go b/cmd/loop/l402.go similarity index 92% rename from cmd/loop/lsat.go rename to cmd/loop/l402.go index 8342b3d..fa7428f 100644 --- a/cmd/loop/lsat.go +++ b/cmd/loop/l402.go @@ -26,8 +26,8 @@ type printableToken struct { var listAuthCommand = cli.Command{ Name: "listauth", - Usage: "list all LSAT tokens", - Description: "Shows a list of all LSAT tokens that loopd has paid for", + Usage: "list all L402 tokens", + Description: "Shows a list of all L402 tokens that loopd has paid for", Action: listAuth, } @@ -38,7 +38,7 @@ func listAuth(ctx *cli.Context) error { } defer cleanup() - resp, err := client.GetLsatTokens( + resp, err := client.GetL402Tokens( context.Background(), &looprpc.TokensRequest{}, ) if err != nil { diff --git a/config.go b/config.go index 7501a56..6cf47c1 100644 --- a/config.go +++ b/config.go @@ -15,7 +15,7 @@ type clientConfig struct { Server swapServerClient Conn *grpc.ClientConn Store loopdb.SwapStore - LsatStore l402.Store + L402Store l402.Store CreateExpiryTimer func(expiry time.Duration) <-chan time.Time LoopOutMaxParts uint32 } diff --git a/instantout/reservation/manager.go b/instantout/reservation/manager.go index 6f55249..35f80ec 100644 --- a/instantout/reservation/manager.go +++ b/instantout/reservation/manager.go @@ -185,7 +185,7 @@ func (m *Manager) fetchL402(ctx context.Context) { func (m *Manager) RegisterReservationNotifications( reservationChan chan *reservationrpc.ServerReservationNotification) error { - // In order to create a valid lsat we first are going to call + // In order to create a valid l402 we first are going to call // the FetchL402 method. As a client might not have outbound capacity // yet, we'll retry until we get a valid response. if !m.hasL402 { diff --git a/loopd/config.go b/loopd/config.go index 877e472..24def35 100644 --- a/loopd/config.go +++ b/loopd/config.go @@ -160,8 +160,8 @@ type Config struct { MaxLogFileSize int `long:"maxlogfilesize" description:"Maximum logfile size in MB."` DebugLevel string `long:"debuglevel" description:"Logging level for all subsystems {trace, debug, info, warn, error, critical} -- You may also specify =,=,... to set the log level for individual subsystems -- Use show to list available subsystems"` - MaxLSATCost uint32 `long:"maxlsatcost" description:"Maximum cost in satoshis that loopd is going to pay for an LSAT token automatically. Does not include routing fees."` - MaxLSATFee uint32 `long:"maxlsatfee" description:"Maximum routing fee in satoshis that we are willing to pay while paying for an LSAT token."` + MaxL402Cost uint32 `long:"maxl402cost" description:"Maximum cost in satoshis that loopd is going to pay for an L402 token automatically. Does not include routing fees."` + MaxL402Fee uint32 `long:"maxl402fee" description:"Maximum routing fee in satoshis that we are willing to pay while paying for an L402 token."` LoopOutMaxParts uint32 `long:"loopoutmaxparts" description:"The maximum number of payment parts that may be used for a loop out swap."` @@ -206,8 +206,8 @@ func DefaultConfig() Config { TLSKeyPath: DefaultTLSKeyPath, TLSValidity: DefaultAutogenValidity, MacaroonPath: DefaultMacaroonPath, - MaxLSATCost: l402.DefaultMaxCostSats, - MaxLSATFee: l402.DefaultMaxRoutingFeeSats, + MaxL402Cost: l402.DefaultMaxCostSats, + MaxL402Fee: l402.DefaultMaxRoutingFeeSats, LoopOutMaxParts: defaultLoopOutMaxParts, TotalPaymentTimeout: defaultTotalPaymentTimeout, MaxPaymentRetries: defaultMaxPaymentRetries, diff --git a/loopd/perms/perms.go b/loopd/perms/perms.go index 138ed79..b33d55f 100644 --- a/loopd/perms/perms.go +++ b/loopd/perms/perms.go @@ -69,7 +69,7 @@ var RequiredPermissions = map[string][]bakery.Op{ Entity: "loop", Action: "in", }}, - "/looprpc.SwapClient/GetLsatTokens": {{ + "/looprpc.SwapClient/GetL402Tokens": {{ Entity: "auth", Action: "read", }}, diff --git a/loopd/swapclient_server.go b/loopd/swapclient_server.go index ef9cf81..924bd37 100644 --- a/loopd/swapclient_server.go +++ b/loopd/swapclient_server.go @@ -920,18 +920,18 @@ func (s *swapClientServer) LoopIn(ctx context.Context, return response, nil } -// GetLsatTokens returns all tokens that are contained in the LSAT token store. -func (s *swapClientServer) GetLsatTokens(ctx context.Context, +// GetL402Tokens returns all tokens that are contained in the L402 token store. +func (s *swapClientServer) GetL402Tokens(ctx context.Context, _ *clientrpc.TokensRequest) (*clientrpc.TokensResponse, error) { - log.Infof("Get LSAT tokens request received") + log.Infof("Get L402 tokens request received") - tokens, err := s.impl.LsatStore.AllTokens() + tokens, err := s.impl.L402Store.AllTokens() if err != nil { return nil, err } - rpcTokens := make([]*clientrpc.LsatToken, len(tokens)) + rpcTokens := make([]*clientrpc.L402Token, len(tokens)) idx := 0 for key, token := range tokens { macBytes, err := token.BaseMacaroon().MarshalBinary() @@ -945,7 +945,7 @@ func (s *swapClientServer) GetLsatTokens(ctx context.Context, if err != nil { return nil, err } - rpcTokens[idx] = &clientrpc.LsatToken{ + rpcTokens[idx] = &clientrpc.L402Token{ BaseMacaroon: macBytes, PaymentHash: token.PaymentHash[:], PaymentPreimage: token.Preimage[:], diff --git a/loopd/utils.go b/loopd/utils.go index 9388a23..b8b9119 100644 --- a/loopd/utils.go +++ b/loopd/utils.go @@ -27,8 +27,8 @@ func getClient(cfg *Config, swapDb loopdb.SwapStore, SwapServerNoTLS: cfg.Server.NoTLS, TLSPathServer: cfg.Server.TLSPath, Lnd: lnd, - MaxLsatCost: btcutil.Amount(cfg.MaxLSATCost), - MaxLsatFee: btcutil.Amount(cfg.MaxLSATFee), + MaxL402Cost: btcutil.Amount(cfg.MaxL402Cost), + MaxL402Fee: btcutil.Amount(cfg.MaxL402Fee), LoopOutMaxParts: cfg.LoopOutMaxParts, TotalPaymentTimeout: cfg.TotalPaymentTimeout, MaxPaymentRetries: cfg.MaxPaymentRetries, diff --git a/looprpc/client.pb.go b/looprpc/client.pb.go index 700198f..bb25658 100644 --- a/looprpc/client.pb.go +++ b/looprpc/client.pb.go @@ -2074,7 +2074,7 @@ type TokensResponse struct { unknownFields protoimpl.UnknownFields // List of all tokens the daemon knows of, including old/expired tokens. - Tokens []*LsatToken `protobuf:"bytes,1,rep,name=tokens,proto3" json:"tokens,omitempty"` + Tokens []*L402Token `protobuf:"bytes,1,rep,name=tokens,proto3" json:"tokens,omitempty"` } func (x *TokensResponse) Reset() { @@ -2109,14 +2109,14 @@ func (*TokensResponse) Descriptor() ([]byte, []int) { return file_client_proto_rawDescGZIP(), []int{18} } -func (x *TokensResponse) GetTokens() []*LsatToken { +func (x *TokensResponse) GetTokens() []*L402Token { if x != nil { return x.Tokens } return nil } -type LsatToken struct { +type L402Token struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields @@ -2144,8 +2144,8 @@ type LsatToken struct { Id string `protobuf:"bytes,9,opt,name=id,proto3" json:"id,omitempty"` } -func (x *LsatToken) Reset() { - *x = LsatToken{} +func (x *L402Token) Reset() { + *x = L402Token{} if protoimpl.UnsafeEnabled { mi := &file_client_proto_msgTypes[19] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -2153,13 +2153,13 @@ func (x *LsatToken) Reset() { } } -func (x *LsatToken) String() string { +func (x *L402Token) String() string { return protoimpl.X.MessageStringOf(x) } -func (*LsatToken) ProtoMessage() {} +func (*L402Token) ProtoMessage() {} -func (x *LsatToken) ProtoReflect() protoreflect.Message { +func (x *L402Token) ProtoReflect() protoreflect.Message { mi := &file_client_proto_msgTypes[19] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -2171,68 +2171,68 @@ func (x *LsatToken) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use LsatToken.ProtoReflect.Descriptor instead. -func (*LsatToken) Descriptor() ([]byte, []int) { +// Deprecated: Use L402Token.ProtoReflect.Descriptor instead. +func (*L402Token) Descriptor() ([]byte, []int) { return file_client_proto_rawDescGZIP(), []int{19} } -func (x *LsatToken) GetBaseMacaroon() []byte { +func (x *L402Token) GetBaseMacaroon() []byte { if x != nil { return x.BaseMacaroon } return nil } -func (x *LsatToken) GetPaymentHash() []byte { +func (x *L402Token) GetPaymentHash() []byte { if x != nil { return x.PaymentHash } return nil } -func (x *LsatToken) GetPaymentPreimage() []byte { +func (x *L402Token) GetPaymentPreimage() []byte { if x != nil { return x.PaymentPreimage } return nil } -func (x *LsatToken) GetAmountPaidMsat() int64 { +func (x *L402Token) GetAmountPaidMsat() int64 { if x != nil { return x.AmountPaidMsat } return 0 } -func (x *LsatToken) GetRoutingFeePaidMsat() int64 { +func (x *L402Token) GetRoutingFeePaidMsat() int64 { if x != nil { return x.RoutingFeePaidMsat } return 0 } -func (x *LsatToken) GetTimeCreated() int64 { +func (x *L402Token) GetTimeCreated() int64 { if x != nil { return x.TimeCreated } return 0 } -func (x *LsatToken) GetExpired() bool { +func (x *L402Token) GetExpired() bool { if x != nil { return x.Expired } return false } -func (x *LsatToken) GetStorageName() string { +func (x *L402Token) GetStorageName() string { if x != nil { return x.StorageName } return "" } -func (x *LsatToken) GetId() string { +func (x *L402Token) GetId() string { if x != nil { return x.Id } @@ -4100,8 +4100,8 @@ var file_client_proto_rawDesc = []byte{ 0x75, 0x65, 0x73, 0x74, 0x22, 0x3c, 0x0a, 0x0e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2a, 0x0a, 0x06, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, - 0x2e, 0x4c, 0x73, 0x61, 0x74, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x52, 0x06, 0x74, 0x6f, 0x6b, 0x65, - 0x6e, 0x73, 0x22, 0xcb, 0x02, 0x0a, 0x09, 0x4c, 0x73, 0x61, 0x74, 0x54, 0x6f, 0x6b, 0x65, 0x6e, + 0x2e, 0x4c, 0x34, 0x30, 0x32, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x52, 0x06, 0x74, 0x6f, 0x6b, 0x65, + 0x6e, 0x73, 0x22, 0xcb, 0x02, 0x0a, 0x09, 0x4c, 0x34, 0x30, 0x32, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x23, 0x0a, 0x0d, 0x62, 0x61, 0x73, 0x65, 0x5f, 0x6d, 0x61, 0x63, 0x61, 0x72, 0x6f, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0c, 0x62, 0x61, 0x73, 0x65, 0x4d, 0x61, 0x63, 0x61, 0x72, 0x6f, 0x6f, 0x6e, 0x12, 0x21, 0x0a, 0x0c, 0x70, 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, @@ -4455,7 +4455,7 @@ var file_client_proto_rawDesc = []byte{ 0x50, 0x72, 0x6f, 0x62, 0x65, 0x12, 0x15, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x50, 0x72, 0x6f, 0x62, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x50, 0x72, 0x6f, 0x62, 0x65, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x40, 0x0a, 0x0d, 0x47, 0x65, 0x74, 0x4c, 0x73, 0x61, 0x74, 0x54, + 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x40, 0x0a, 0x0d, 0x47, 0x65, 0x74, 0x4c, 0x34, 0x30, 0x32, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x12, 0x16, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x52, 0x65, @@ -4547,7 +4547,7 @@ var file_client_proto_goTypes = []interface{}{ (*ProbeResponse)(nil), // 23: looprpc.ProbeResponse (*TokensRequest)(nil), // 24: looprpc.TokensRequest (*TokensResponse)(nil), // 25: looprpc.TokensResponse - (*LsatToken)(nil), // 26: looprpc.LsatToken + (*L402Token)(nil), // 26: looprpc.L402Token (*LoopStats)(nil), // 27: looprpc.LoopStats (*GetInfoRequest)(nil), // 28: looprpc.GetInfoRequest (*GetInfoResponse)(nil), // 29: looprpc.GetInfoResponse @@ -4584,7 +4584,7 @@ var file_client_proto_depIdxs = []int32{ 11, // 7: looprpc.ListSwapsResponse.swaps:type_name -> looprpc.SwapStatus 50, // 8: looprpc.QuoteRequest.loop_in_route_hints:type_name -> looprpc.RouteHint 50, // 9: looprpc.ProbeRequest.route_hints:type_name -> looprpc.RouteHint - 26, // 10: looprpc.TokensResponse.tokens:type_name -> looprpc.LsatToken + 26, // 10: looprpc.TokensResponse.tokens:type_name -> looprpc.L402Token 27, // 11: looprpc.GetInfoResponse.loop_out_stats:type_name -> looprpc.LoopStats 27, // 12: looprpc.GetInfoResponse.loop_in_stats:type_name -> looprpc.LoopStats 32, // 13: looprpc.LiquidityParameters.rules:type_name -> looprpc.LiquidityRule @@ -4609,7 +4609,7 @@ var file_client_proto_depIdxs = []int32{ 16, // 32: looprpc.SwapClient.GetLoopInTerms:input_type -> looprpc.TermsRequest 19, // 33: looprpc.SwapClient.GetLoopInQuote:input_type -> looprpc.QuoteRequest 22, // 34: looprpc.SwapClient.Probe:input_type -> looprpc.ProbeRequest - 24, // 35: looprpc.SwapClient.GetLsatTokens:input_type -> looprpc.TokensRequest + 24, // 35: looprpc.SwapClient.GetL402Tokens:input_type -> looprpc.TokensRequest 28, // 36: looprpc.SwapClient.GetInfo:input_type -> looprpc.GetInfoRequest 30, // 37: looprpc.SwapClient.GetLiquidityParams:input_type -> looprpc.GetLiquidityParamsRequest 33, // 38: looprpc.SwapClient.SetLiquidityParams:input_type -> looprpc.SetLiquidityParamsRequest @@ -4629,7 +4629,7 @@ var file_client_proto_depIdxs = []int32{ 17, // 52: looprpc.SwapClient.GetLoopInTerms:output_type -> looprpc.InTermsResponse 20, // 53: looprpc.SwapClient.GetLoopInQuote:output_type -> looprpc.InQuoteResponse 23, // 54: looprpc.SwapClient.Probe:output_type -> looprpc.ProbeResponse - 25, // 55: looprpc.SwapClient.GetLsatTokens:output_type -> looprpc.TokensResponse + 25, // 55: looprpc.SwapClient.GetL402Tokens:output_type -> looprpc.TokensResponse 29, // 56: looprpc.SwapClient.GetInfo:output_type -> looprpc.GetInfoResponse 31, // 57: looprpc.SwapClient.GetLiquidityParams:output_type -> looprpc.LiquidityParameters 34, // 58: looprpc.SwapClient.SetLiquidityParams:output_type -> looprpc.SetLiquidityParamsResponse @@ -4880,7 +4880,7 @@ func file_client_proto_init() { } } file_client_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*LsatToken); i { + switch v := v.(*L402Token); i { case 0: return &v.state case 1: diff --git a/looprpc/client.pb.gw.go b/looprpc/client.pb.gw.go index 4ec7a66..f6f9e5f 100644 --- a/looprpc/client.pb.gw.go +++ b/looprpc/client.pb.gw.go @@ -433,20 +433,20 @@ func local_request_SwapClient_Probe_0(ctx context.Context, marshaler runtime.Mar } -func request_SwapClient_GetLsatTokens_0(ctx context.Context, marshaler runtime.Marshaler, client SwapClientClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { +func request_SwapClient_GetL402Tokens_0(ctx context.Context, marshaler runtime.Marshaler, client SwapClientClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq TokensRequest var metadata runtime.ServerMetadata - msg, err := client.GetLsatTokens(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + msg, err := client.GetL402Tokens(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } -func local_request_SwapClient_GetLsatTokens_0(ctx context.Context, marshaler runtime.Marshaler, server SwapClientServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { +func local_request_SwapClient_GetL402Tokens_0(ctx context.Context, marshaler runtime.Marshaler, server SwapClientServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq TokensRequest var metadata runtime.ServerMetadata - msg, err := server.GetLsatTokens(ctx, &protoReq) + msg, err := server.GetL402Tokens(ctx, &protoReq) return msg, metadata, err } @@ -770,7 +770,7 @@ func RegisterSwapClientHandlerServer(ctx context.Context, mux *runtime.ServeMux, }) - mux.Handle("GET", pattern_SwapClient_GetLsatTokens_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_SwapClient_GetL402Tokens_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -778,12 +778,12 @@ func RegisterSwapClientHandlerServer(ctx context.Context, mux *runtime.ServeMux, inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/looprpc.SwapClient/GetLsatTokens", runtime.WithHTTPPathPattern("/v1/lsat/tokens")) + annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/looprpc.SwapClient/GetL402Tokens", runtime.WithHTTPPathPattern("/v1/l402/tokens")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_SwapClient_GetLsatTokens_0(annotatedContext, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_SwapClient_GetL402Tokens_0(annotatedContext, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { @@ -791,7 +791,7 @@ func RegisterSwapClientHandlerServer(ctx context.Context, mux *runtime.ServeMux, return } - forward_SwapClient_GetLsatTokens_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_SwapClient_GetL402Tokens_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -1134,25 +1134,25 @@ func RegisterSwapClientHandlerClient(ctx context.Context, mux *runtime.ServeMux, }) - mux.Handle("GET", pattern_SwapClient_GetLsatTokens_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_SwapClient_GetL402Tokens_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/looprpc.SwapClient/GetLsatTokens", runtime.WithHTTPPathPattern("/v1/lsat/tokens")) + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/looprpc.SwapClient/GetL402Tokens", runtime.WithHTTPPathPattern("/v1/l402/tokens")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_SwapClient_GetLsatTokens_0(annotatedContext, inboundMarshaler, client, req, pathParams) + resp, md, err := request_SwapClient_GetL402Tokens_0(annotatedContext, inboundMarshaler, client, req, pathParams) annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) if err != nil { runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) return } - forward_SwapClient_GetLsatTokens_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_SwapClient_GetL402Tokens_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -1266,7 +1266,7 @@ var ( pattern_SwapClient_Probe_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"v1", "loop", "in", "probe", "amt"}, "")) - pattern_SwapClient_GetLsatTokens_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "lsat", "tokens"}, "")) + pattern_SwapClient_GetL402Tokens_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "l402", "tokens"}, "")) pattern_SwapClient_GetInfo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "loop", "info"}, "")) @@ -1296,7 +1296,7 @@ var ( forward_SwapClient_Probe_0 = runtime.ForwardResponseMessage - forward_SwapClient_GetLsatTokens_0 = runtime.ForwardResponseMessage + forward_SwapClient_GetL402Tokens_0 = runtime.ForwardResponseMessage forward_SwapClient_GetInfo_0 = runtime.ForwardResponseMessage diff --git a/looprpc/client.proto b/looprpc/client.proto index 8687b93..d70094c 100644 --- a/looprpc/client.proto +++ b/looprpc/client.proto @@ -76,9 +76,9 @@ service SwapClient { rpc Probe (ProbeRequest) returns (ProbeResponse); /* loop: `listauth` - GetLsatTokens returns all LSAT tokens the daemon ever paid for. + GetL402Tokens returns all L402 tokens the daemon ever paid for. */ - rpc GetLsatTokens (TokensRequest) returns (TokensResponse); + rpc GetL402Tokens (TokensRequest) returns (TokensResponse); /* loop: `getinfo` GetInfo gets basic information about the loop daemon. @@ -811,10 +811,10 @@ message TokensResponse { /* List of all tokens the daemon knows of, including old/expired tokens. */ - repeated LsatToken tokens = 1; + repeated L402Token tokens = 1; } -message LsatToken { +message L402Token { /* The base macaroon that was baked by the auth server. */ diff --git a/looprpc/client.swagger.json b/looprpc/client.swagger.json index d058957..2cc3b85 100644 --- a/looprpc/client.swagger.json +++ b/looprpc/client.swagger.json @@ -39,6 +39,29 @@ ] } }, + "/v1/l402/tokens": { + "get": { + "summary": "loop: `listauth`\nGetL402Tokens returns all L402 tokens the daemon ever paid for.", + "operationId": "SwapClient_GetL402Tokens", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/looprpcTokensResponse" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "tags": [ + "SwapClient" + ] + } + }, "/v1/liquidity/params": { "get": { "summary": "loop: `getparams`\nGetLiquidityParams gets the parameters that the daemon's liquidity manager\nis currently configured with. This may be nil if nothing is configured.\n[EXPERIMENTAL]: endpoint is subject to change.", @@ -515,29 +538,6 @@ "SwapClient" ] } - }, - "/v1/lsat/tokens": { - "get": { - "summary": "loop: `listauth`\nGetLsatTokens returns all LSAT tokens the daemon ever paid for.", - "operationId": "SwapClient_GetLsatTokens", - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/looprpcTokensResponse" - } - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "$ref": "#/definitions/rpcStatus" - } - } - }, - "tags": [ - "SwapClient" - ] - } } }, "definitions": { @@ -824,6 +824,53 @@ } } }, + "looprpcL402Token": { + "type": "object", + "properties": { + "base_macaroon": { + "type": "string", + "format": "byte", + "description": "The base macaroon that was baked by the auth server." + }, + "payment_hash": { + "type": "string", + "format": "byte", + "description": "The payment hash of the payment that was paid to obtain the token." + }, + "payment_preimage": { + "type": "string", + "format": "byte", + "description": "The preimage of the payment hash, knowledge of this is proof that the\npayment has been paid. If the preimage is set to all zeros, this means the\npayment is still pending and the token is not yet fully valid." + }, + "amount_paid_msat": { + "type": "string", + "format": "int64", + "description": "The amount of millisatoshis that was paid to get the token." + }, + "routing_fee_paid_msat": { + "type": "string", + "format": "int64", + "description": "The amount of millisatoshis paid in routing fee to pay for the token." + }, + "time_created": { + "type": "string", + "format": "int64", + "description": "The creation time of the token as UNIX timestamp in seconds." + }, + "expired": { + "type": "boolean", + "description": "Indicates whether the token is expired or still valid." + }, + "storage_name": { + "type": "string", + "description": "Identifying attribute of this token in the store. Currently represents the\nfile name of the token where it's stored on the file system." + }, + "id": { + "type": "string", + "description": "The l402 ID of the token." + } + } + }, "looprpcLiquidityParameters": { "type": "object", "properties": { @@ -1231,53 +1278,6 @@ } } }, - "looprpcLsatToken": { - "type": "object", - "properties": { - "base_macaroon": { - "type": "string", - "format": "byte", - "description": "The base macaroon that was baked by the auth server." - }, - "payment_hash": { - "type": "string", - "format": "byte", - "description": "The payment hash of the payment that was paid to obtain the token." - }, - "payment_preimage": { - "type": "string", - "format": "byte", - "description": "The preimage of the payment hash, knowledge of this is proof that the\npayment has been paid. If the preimage is set to all zeros, this means the\npayment is still pending and the token is not yet fully valid." - }, - "amount_paid_msat": { - "type": "string", - "format": "int64", - "description": "The amount of millisatoshis that was paid to get the token." - }, - "routing_fee_paid_msat": { - "type": "string", - "format": "int64", - "description": "The amount of millisatoshis paid in routing fee to pay for the token." - }, - "time_created": { - "type": "string", - "format": "int64", - "description": "The creation time of the token as UNIX timestamp in seconds." - }, - "expired": { - "type": "boolean", - "description": "Indicates whether the token is expired or still valid." - }, - "storage_name": { - "type": "string", - "description": "Identifying attribute of this token in the store. Currently represents the\nfile name of the token where it's stored on the file system." - }, - "id": { - "type": "string", - "description": "The l402 ID of the token." - } - } - }, "looprpcOutQuoteResponse": { "type": "object", "properties": { @@ -1534,7 +1534,7 @@ "tokens": { "type": "array", "items": { - "$ref": "#/definitions/looprpcLsatToken" + "$ref": "#/definitions/looprpcL402Token" }, "description": "List of all tokens the daemon knows of, including old/expired tokens." } diff --git a/looprpc/client.yaml b/looprpc/client.yaml index 188a6a2..3eb09ec 100644 --- a/looprpc/client.yaml +++ b/looprpc/client.yaml @@ -26,8 +26,8 @@ http: get: "/v1/loop/in/probe/{amt}" - selector: looprpc.SwapClient.GetInfo get: "/v1/loop/info" - - selector: looprpc.SwapClient.GetLsatTokens - get: "/v1/lsat/tokens" + - selector: looprpc.SwapClient.GetL402Tokens + get: "/v1/l402/tokens" - selector: looprpc.SwapClient.GetLiquidityParams get: "/v1/liquidity/params" - selector: looprpc.SwapClient.SetLiquidityParams diff --git a/looprpc/client_grpc.pb.go b/looprpc/client_grpc.pb.go index 4c35e42..34aafe1 100644 --- a/looprpc/client_grpc.pb.go +++ b/looprpc/client_grpc.pb.go @@ -60,8 +60,8 @@ type SwapClientClient interface { // estimate about routing fees when loopin-in. Probe(ctx context.Context, in *ProbeRequest, opts ...grpc.CallOption) (*ProbeResponse, error) // loop: `listauth` - // GetLsatTokens returns all LSAT tokens the daemon ever paid for. - GetLsatTokens(ctx context.Context, in *TokensRequest, opts ...grpc.CallOption) (*TokensResponse, error) + // GetL402Tokens returns all L402 tokens the daemon ever paid for. + GetL402Tokens(ctx context.Context, in *TokensRequest, opts ...grpc.CallOption) (*TokensResponse, error) // loop: `getinfo` // GetInfo gets basic information about the loop daemon. GetInfo(ctx context.Context, in *GetInfoRequest, opts ...grpc.CallOption) (*GetInfoResponse, error) @@ -228,9 +228,9 @@ func (c *swapClientClient) Probe(ctx context.Context, in *ProbeRequest, opts ... return out, nil } -func (c *swapClientClient) GetLsatTokens(ctx context.Context, in *TokensRequest, opts ...grpc.CallOption) (*TokensResponse, error) { +func (c *swapClientClient) GetL402Tokens(ctx context.Context, in *TokensRequest, opts ...grpc.CallOption) (*TokensResponse, error) { out := new(TokensResponse) - err := c.cc.Invoke(ctx, "/looprpc.SwapClient/GetLsatTokens", in, out, opts...) + err := c.cc.Invoke(ctx, "/looprpc.SwapClient/GetL402Tokens", in, out, opts...) if err != nil { return nil, err } @@ -355,8 +355,8 @@ type SwapClientServer interface { // estimate about routing fees when loopin-in. Probe(context.Context, *ProbeRequest) (*ProbeResponse, error) // loop: `listauth` - // GetLsatTokens returns all LSAT tokens the daemon ever paid for. - GetLsatTokens(context.Context, *TokensRequest) (*TokensResponse, error) + // GetL402Tokens returns all L402 tokens the daemon ever paid for. + GetL402Tokens(context.Context, *TokensRequest) (*TokensResponse, error) // loop: `getinfo` // GetInfo gets basic information about the loop daemon. GetInfo(context.Context, *GetInfoRequest) (*GetInfoResponse, error) @@ -431,8 +431,8 @@ func (UnimplementedSwapClientServer) GetLoopInQuote(context.Context, *QuoteReque func (UnimplementedSwapClientServer) Probe(context.Context, *ProbeRequest) (*ProbeResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Probe not implemented") } -func (UnimplementedSwapClientServer) GetLsatTokens(context.Context, *TokensRequest) (*TokensResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetLsatTokens not implemented") +func (UnimplementedSwapClientServer) GetL402Tokens(context.Context, *TokensRequest) (*TokensResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetL402Tokens not implemented") } func (UnimplementedSwapClientServer) GetInfo(context.Context, *GetInfoRequest) (*GetInfoResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method GetInfo not implemented") @@ -672,20 +672,20 @@ func _SwapClient_Probe_Handler(srv interface{}, ctx context.Context, dec func(in return interceptor(ctx, in, info, handler) } -func _SwapClient_GetLsatTokens_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { +func _SwapClient_GetL402Tokens_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(TokensRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(SwapClientServer).GetLsatTokens(ctx, in) + return srv.(SwapClientServer).GetL402Tokens(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/looprpc.SwapClient/GetLsatTokens", + FullMethod: "/looprpc.SwapClient/GetL402Tokens", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(SwapClientServer).GetLsatTokens(ctx, req.(*TokensRequest)) + return srv.(SwapClientServer).GetL402Tokens(ctx, req.(*TokensRequest)) } return interceptor(ctx, in, info, handler) } @@ -882,8 +882,8 @@ var SwapClient_ServiceDesc = grpc.ServiceDesc{ Handler: _SwapClient_Probe_Handler, }, { - MethodName: "GetLsatTokens", - Handler: _SwapClient_GetLsatTokens_Handler, + MethodName: "GetL402Tokens", + Handler: _SwapClient_GetL402Tokens_Handler, }, { MethodName: "GetInfo", diff --git a/looprpc/swapclient.pb.json.go b/looprpc/swapclient.pb.json.go index a715cdd..cece43e 100644 --- a/looprpc/swapclient.pb.json.go +++ b/looprpc/swapclient.pb.json.go @@ -313,7 +313,7 @@ func RegisterSwapClientJSONCallbacks(registry map[string]func(ctx context.Contex callback(string(respBytes), nil) } - registry["looprpc.SwapClient.GetLsatTokens"] = func(ctx context.Context, + registry["looprpc.SwapClient.GetL402Tokens"] = func(ctx context.Context, conn *grpc.ClientConn, reqJSON string, callback func(string, error)) { req := &TokensRequest{} @@ -324,7 +324,7 @@ func RegisterSwapClientJSONCallbacks(registry map[string]func(ctx context.Contex } client := NewSwapClientClient(conn) - resp, err := client.GetLsatTokens(ctx, req) + resp, err := client.GetL402Tokens(ctx, req) if err != nil { callback("", err) return diff --git a/release_notes.md b/release_notes.md index 38afc60..056aa18 100644 --- a/release_notes.md +++ b/release_notes.md @@ -18,6 +18,14 @@ This file tracks release notes for the loop client. #### Breaking Changes +In loopd.conf file `maxlsatcost` and `maxlsatfee` were renamed to `maxl402cost` +and `maxl402fee` accordingly. If they have been changed locally, the file has +to be updated for loopd to recognize the options. + +The path in looprpc "/v1/lsat/tokens" was renamed to "/v1/l402/tokens" and +the corresponding method was renamed from `GetLsatTokens` to `GetL402Tokens`. +Update `loop` and `loopd` simultaneously otherwise this RPC won't work. + #### Bug Fixes #### Maintenance diff --git a/sample-loopd.conf b/sample-loopd.conf index ae1e165..a0ca7b9 100644 --- a/sample-loopd.conf +++ b/sample-loopd.conf @@ -86,11 +86,11 @@ ; Maximum cost in satoshis that loopd is going to pay for an L402 token ; automatically. Does not include routing fees. -; maxlsatcost=1000 +; maxl402cost=1000 ; Maximum routing fee in satoshis that we are willing to pay while paying for an ; L402 token. -; maxlsatfee=10 +; maxl402fee=10 ; The maximum number of payment parts that may be used for a loop out swap. ; loopoutmaxparts=5 diff --git a/swap_server_client.go b/swap_server_client.go index 32708ad..60150ca 100644 --- a/swap_server_client.go +++ b/swap_server_client.go @@ -161,14 +161,14 @@ func (s *grpcSwapServerClient) stop() { var _ swapServerClient = (*grpcSwapServerClient)(nil) -func newSwapServerClient(cfg *ClientConfig, lsatStore l402.Store) ( +func newSwapServerClient(cfg *ClientConfig, l402Store l402.Store) ( *grpcSwapServerClient, error) { // Create the server connection with the interceptor that will handle - // the LSAT protocol for us. + // the L402 protocol for us. clientInterceptor := l402.NewInterceptor( - cfg.Lnd, lsatStore, serverRPCTimeout, cfg.MaxLsatCost, - cfg.MaxLsatFee, false, + cfg.Lnd, l402Store, serverRPCTimeout, cfg.MaxL402Cost, + cfg.MaxL402Fee, false, ) serverConn, err := getSwapServerConn( cfg.ServerAddress, cfg.ProxyAddress, cfg.SwapServerNoTLS, From 7bb04ae6acb4d632421ba7ee3a18f3191bfc077a Mon Sep 17 00:00:00 2001 From: Boris Nagaev Date: Wed, 24 Apr 2024 13:50:24 -0300 Subject: [PATCH 06/37] loopd: recorgnize maxlsatcost and maxlsatfee flags The flags were re-added in hidden mode so that users who specified them could start the daemon after upgrading. If a flag is used, a deprecation warning is printed. Updated release_notes.md. --- loopd/config.go | 2 ++ loopd/utils.go | 29 +++++++++++++++++++++++++++++ release_notes.md | 5 +++-- 3 files changed, 34 insertions(+), 2 deletions(-) diff --git a/loopd/config.go b/loopd/config.go index 24def35..423784a 100644 --- a/loopd/config.go +++ b/loopd/config.go @@ -160,6 +160,8 @@ type Config struct { MaxLogFileSize int `long:"maxlogfilesize" description:"Maximum logfile size in MB."` DebugLevel string `long:"debuglevel" description:"Logging level for all subsystems {trace, debug, info, warn, error, critical} -- You may also specify =,=,... to set the log level for individual subsystems -- Use show to list available subsystems"` + MaxLSATCost uint32 `long:"maxlsatcost" hidden:"true"` + MaxLSATFee uint32 `long:"maxlsatfee" hidden:"true"` MaxL402Cost uint32 `long:"maxl402cost" description:"Maximum cost in satoshis that loopd is going to pay for an L402 token automatically. Does not include routing fees."` MaxL402Fee uint32 `long:"maxl402fee" description:"Maximum routing fee in satoshis that we are willing to pay while paying for an L402 token."` diff --git a/loopd/utils.go b/loopd/utils.go index b8b9119..e6c7547 100644 --- a/loopd/utils.go +++ b/loopd/utils.go @@ -6,6 +6,7 @@ import ( "github.com/btcsuite/btcd/btcutil" "github.com/btcsuite/btcd/chaincfg" + "github.com/lightninglabs/aperture/l402" "github.com/lightninglabs/lndclient" "github.com/lightninglabs/loop" "github.com/lightninglabs/loop/liquidity" @@ -21,6 +22,23 @@ func getClient(cfg *Config, swapDb loopdb.SwapStore, sweeperDb sweepbatcher.BatcherStore, lnd *lndclient.LndServices) ( *loop.Client, func(), error) { + // Default is not set for MaxLSATCost and MaxLSATFee to distinguish + // it from user explicitly setting the option to default value. + // So if MaxL402Cost and MaxLSATFee are not set in the config file + // and command line, they are set to 0. + const ( + defaultCost = l402.DefaultMaxCostSats + defaultFee = l402.DefaultMaxRoutingFeeSats + ) + if cfg.MaxL402Cost != defaultCost && cfg.MaxLSATCost != 0 { + return nil, nil, fmt.Errorf("both maxl402cost and maxlsatcost" + + " were specified; they are not allowed together") + } + if cfg.MaxL402Fee != defaultFee && cfg.MaxLSATFee != 0 { + return nil, nil, fmt.Errorf("both maxl402fee and maxlsatfee" + + " were specified; they are not allowed together") + } + clientConfig := &loop.ClientConfig{ ServerAddress: cfg.Server.Host, ProxyAddress: cfg.Server.Proxy, @@ -34,6 +52,17 @@ func getClient(cfg *Config, swapDb loopdb.SwapStore, MaxPaymentRetries: cfg.MaxPaymentRetries, } + if cfg.MaxL402Cost == defaultCost && cfg.MaxLSATCost != 0 { + log.Warnf("Option maxlsatcost is deprecated and will be " + + "removed. Switch to maxl402cost.") + clientConfig.MaxL402Cost = btcutil.Amount(cfg.MaxLSATCost) + } + if cfg.MaxL402Fee == defaultFee && cfg.MaxLSATFee != 0 { + log.Warnf("Option maxlsatfee is deprecated and will be " + + "removed. Switch to maxl402fee.") + clientConfig.MaxL402Fee = btcutil.Amount(cfg.MaxLSATFee) + } + swapClient, cleanUp, err := loop.NewClient( cfg.DataDir, swapDb, sweeperDb, clientConfig, ) diff --git a/release_notes.md b/release_notes.md index 056aa18..7b752a0 100644 --- a/release_notes.md +++ b/release_notes.md @@ -19,8 +19,9 @@ This file tracks release notes for the loop client. #### Breaking Changes In loopd.conf file `maxlsatcost` and `maxlsatfee` were renamed to `maxl402cost` -and `maxl402fee` accordingly. If they have been changed locally, the file has -to be updated for loopd to recognize the options. +and `maxl402fee` accordingly. Old versions of the options are still recognized +for backward compatibility, but a deprecation warning is printed. Users are +encouraged to change the options to new names if they have been changed locally. The path in looprpc "/v1/lsat/tokens" was renamed to "/v1/l402/tokens" and the corresponding method was renamed from `GetLsatTokens` to `GetL402Tokens`. From 14dc8e165df1aea4e86fb938610259d0732e1918 Mon Sep 17 00:00:00 2001 From: Boris Nagaev Date: Wed, 24 Apr 2024 14:25:48 -0300 Subject: [PATCH 07/37] looprpc: additional_bindings for /v1/lsat/tokens Provide backward compatibility for clients using this API endpoint. --- looprpc/client.pb.gw.go | 69 +++++++++++++++++++++++++++++++++++++ looprpc/client.swagger.json | 23 +++++++++++++ looprpc/client.yaml | 2 ++ release_notes.md | 2 ++ 4 files changed, 96 insertions(+) diff --git a/looprpc/client.pb.gw.go b/looprpc/client.pb.gw.go index f6f9e5f..7fa10f0 100644 --- a/looprpc/client.pb.gw.go +++ b/looprpc/client.pb.gw.go @@ -451,6 +451,24 @@ func local_request_SwapClient_GetL402Tokens_0(ctx context.Context, marshaler run } +func request_SwapClient_GetL402Tokens_1(ctx context.Context, marshaler runtime.Marshaler, client SwapClientClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq TokensRequest + var metadata runtime.ServerMetadata + + msg, err := client.GetL402Tokens(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_SwapClient_GetL402Tokens_1(ctx context.Context, marshaler runtime.Marshaler, server SwapClientServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq TokensRequest + var metadata runtime.ServerMetadata + + msg, err := server.GetL402Tokens(ctx, &protoReq) + return msg, metadata, err + +} + func request_SwapClient_GetInfo_0(ctx context.Context, marshaler runtime.Marshaler, client SwapClientClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq GetInfoRequest var metadata runtime.ServerMetadata @@ -795,6 +813,31 @@ func RegisterSwapClientHandlerServer(ctx context.Context, mux *runtime.ServeMux, }) + mux.Handle("GET", pattern_SwapClient_GetL402Tokens_1, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/looprpc.SwapClient/GetL402Tokens", runtime.WithHTTPPathPattern("/v1/lsat/tokens")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_SwapClient_GetL402Tokens_1(annotatedContext, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_SwapClient_GetL402Tokens_1(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + mux.Handle("GET", pattern_SwapClient_GetInfo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -1156,6 +1199,28 @@ func RegisterSwapClientHandlerClient(ctx context.Context, mux *runtime.ServeMux, }) + mux.Handle("GET", pattern_SwapClient_GetL402Tokens_1, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/looprpc.SwapClient/GetL402Tokens", runtime.WithHTTPPathPattern("/v1/lsat/tokens")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_SwapClient_GetL402Tokens_1(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_SwapClient_GetL402Tokens_1(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + mux.Handle("GET", pattern_SwapClient_GetInfo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -1268,6 +1333,8 @@ var ( pattern_SwapClient_GetL402Tokens_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "l402", "tokens"}, "")) + pattern_SwapClient_GetL402Tokens_1 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "lsat", "tokens"}, "")) + pattern_SwapClient_GetInfo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "loop", "info"}, "")) pattern_SwapClient_GetLiquidityParams_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "liquidity", "params"}, "")) @@ -1298,6 +1365,8 @@ var ( forward_SwapClient_GetL402Tokens_0 = runtime.ForwardResponseMessage + forward_SwapClient_GetL402Tokens_1 = runtime.ForwardResponseMessage + forward_SwapClient_GetInfo_0 = runtime.ForwardResponseMessage forward_SwapClient_GetLiquidityParams_0 = runtime.ForwardResponseMessage diff --git a/looprpc/client.swagger.json b/looprpc/client.swagger.json index 2cc3b85..302ac1a 100644 --- a/looprpc/client.swagger.json +++ b/looprpc/client.swagger.json @@ -538,6 +538,29 @@ "SwapClient" ] } + }, + "/v1/lsat/tokens": { + "get": { + "summary": "loop: `listauth`\nGetL402Tokens returns all L402 tokens the daemon ever paid for.", + "operationId": "SwapClient_GetL402Tokens2", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/looprpcTokensResponse" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "tags": [ + "SwapClient" + ] + } } }, "definitions": { diff --git a/looprpc/client.yaml b/looprpc/client.yaml index 3eb09ec..e30c7fb 100644 --- a/looprpc/client.yaml +++ b/looprpc/client.yaml @@ -28,6 +28,8 @@ http: get: "/v1/loop/info" - selector: looprpc.SwapClient.GetL402Tokens get: "/v1/l402/tokens" + additional_bindings: + - get: "/v1/lsat/tokens" - selector: looprpc.SwapClient.GetLiquidityParams get: "/v1/liquidity/params" - selector: looprpc.SwapClient.SetLiquidityParams diff --git a/release_notes.md b/release_notes.md index 7b752a0..8b081d2 100644 --- a/release_notes.md +++ b/release_notes.md @@ -26,6 +26,8 @@ encouraged to change the options to new names if they have been changed locally. The path in looprpc "/v1/lsat/tokens" was renamed to "/v1/l402/tokens" and the corresponding method was renamed from `GetLsatTokens` to `GetL402Tokens`. Update `loop` and `loopd` simultaneously otherwise this RPC won't work. +HTTP endpoint "/v1/l402/tokens" is now an additional binding for API +"/v1/lsat/tokens", so it still works. #### Bug Fixes From 5a1f79557d207fd9f2f9e99e51ecfcde1e1c9ad1 Mon Sep 17 00:00:00 2001 From: Boris Nagaev Date: Thu, 25 Apr 2024 12:04:03 -0300 Subject: [PATCH 08/37] loopd: re-add GetLsatTokens method in gRPC This is needed not to break existing client binaries, e.g. `loop listauth`, Terminal Web, RTL. The API should be removed in a couple of releases. For now, GetLsatTokens just prints a warning message about the API being deprecated and that the client binary should be updated, and calls GetL402Tokens API, as a wrapper. Type LsatToken used by GetLsatTokens in the past was renamed to L402Token, but this does not affect binary encoding, so type L402Token can be used (as part of TokensResponse) without breaking backward compatibility. Updated release_notes.md. See https://github.com/lightninglabs/loop/pull/730#discussion_r1579251294 --- loopd/perms/perms.go | 4 + loopd/swapclient_server.go | 15 ++++ looprpc/client.pb.go | 154 ++++++++++++++++++---------------- looprpc/client.proto | 9 ++ looprpc/client_grpc.pb.go | 46 ++++++++++ looprpc/swapclient.pb.json.go | 25 ++++++ release_notes.md | 9 +- 7 files changed, 185 insertions(+), 77 deletions(-) diff --git a/loopd/perms/perms.go b/loopd/perms/perms.go index b33d55f..8958c23 100644 --- a/loopd/perms/perms.go +++ b/loopd/perms/perms.go @@ -73,6 +73,10 @@ var RequiredPermissions = map[string][]bakery.Op{ Entity: "auth", Action: "read", }}, + "/looprpc.SwapClient/GetLsatTokens": {{ + Entity: "auth", + Action: "read", + }}, "/looprpc.SwapClient/SuggestSwaps": {{ Entity: "suggestions", Action: "read", diff --git a/loopd/swapclient_server.go b/loopd/swapclient_server.go index 924bd37..1f682f8 100644 --- a/loopd/swapclient_server.go +++ b/loopd/swapclient_server.go @@ -964,6 +964,21 @@ func (s *swapClientServer) GetL402Tokens(ctx context.Context, return &clientrpc.TokensResponse{Tokens: rpcTokens}, nil } +// GetLsatTokens returns all tokens that are contained in the L402 token store. +// Deprecated: use GetL402Tokens. +// This API is provided to maintain backward compatibility with gRPC clients +// (e.g. `loop listauth`, Terminal Web, RTL). +// Type LsatToken used by GetLsatTokens in the past was renamed to L402Token, +// but this does not affect binary encoding, so we can use type L402Token here. +func (s *swapClientServer) GetLsatTokens(ctx context.Context, + req *clientrpc.TokensRequest) (*clientrpc.TokensResponse, error) { + + log.Warnf("Received deprecated call GetLsatTokens. Please update the " + + "client software. Calling GetL402Tokens now.") + + return s.GetL402Tokens(ctx, req) +} + // GetInfo returns basic information about the loop daemon and details to swaps // from the swap store. func (s *swapClientServer) GetInfo(ctx context.Context, diff --git a/looprpc/client.pb.go b/looprpc/client.pb.go index bb25658..abcb254 100644 --- a/looprpc/client.pb.go +++ b/looprpc/client.pb.go @@ -4410,7 +4410,7 @@ var file_client_proto_rawDesc = []byte{ 0x53, 0x4f, 0x4e, 0x5f, 0x42, 0x55, 0x44, 0x47, 0x45, 0x54, 0x5f, 0x49, 0x4e, 0x53, 0x55, 0x46, 0x46, 0x49, 0x43, 0x49, 0x45, 0x4e, 0x54, 0x10, 0x0c, 0x12, 0x20, 0x0a, 0x1c, 0x41, 0x55, 0x54, 0x4f, 0x5f, 0x52, 0x45, 0x41, 0x53, 0x4f, 0x4e, 0x5f, 0x46, 0x45, 0x45, 0x5f, 0x49, 0x4e, 0x53, - 0x55, 0x46, 0x46, 0x49, 0x43, 0x49, 0x45, 0x4e, 0x54, 0x10, 0x0d, 0x32, 0x96, 0x0b, 0x0a, 0x0a, + 0x55, 0x46, 0x46, 0x49, 0x43, 0x49, 0x45, 0x4e, 0x54, 0x10, 0x0d, 0x32, 0xd8, 0x0b, 0x0a, 0x0a, 0x53, 0x77, 0x61, 0x70, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x12, 0x39, 0x0a, 0x07, 0x4c, 0x6f, 0x6f, 0x70, 0x4f, 0x75, 0x74, 0x12, 0x17, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x4c, 0x6f, 0x6f, 0x70, 0x4f, 0x75, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x15, @@ -4459,51 +4459,55 @@ var file_client_proto_rawDesc = []byte{ 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x12, 0x16, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3c, 0x0a, 0x07, 0x47, 0x65, 0x74, 0x49, 0x6e, 0x66, - 0x6f, 0x12, 0x17, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x47, 0x65, 0x74, 0x49, - 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x6c, 0x6f, 0x6f, - 0x70, 0x72, 0x70, 0x63, 0x2e, 0x47, 0x65, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x56, 0x0a, 0x12, 0x47, 0x65, 0x74, 0x4c, 0x69, 0x71, 0x75, 0x69, - 0x64, 0x69, 0x74, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x22, 0x2e, 0x6c, 0x6f, 0x6f, - 0x70, 0x72, 0x70, 0x63, 0x2e, 0x47, 0x65, 0x74, 0x4c, 0x69, 0x71, 0x75, 0x69, 0x64, 0x69, 0x74, - 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, - 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x4c, 0x69, 0x71, 0x75, 0x69, 0x64, 0x69, - 0x74, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x12, 0x5d, 0x0a, 0x12, - 0x53, 0x65, 0x74, 0x4c, 0x69, 0x71, 0x75, 0x69, 0x64, 0x69, 0x74, 0x79, 0x50, 0x61, 0x72, 0x61, - 0x6d, 0x73, 0x12, 0x22, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x53, 0x65, 0x74, - 0x4c, 0x69, 0x71, 0x75, 0x69, 0x64, 0x69, 0x74, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x23, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, - 0x2e, 0x53, 0x65, 0x74, 0x4c, 0x69, 0x71, 0x75, 0x69, 0x64, 0x69, 0x74, 0x79, 0x50, 0x61, 0x72, - 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4b, 0x0a, 0x0c, 0x53, - 0x75, 0x67, 0x67, 0x65, 0x73, 0x74, 0x53, 0x77, 0x61, 0x70, 0x73, 0x12, 0x1c, 0x2e, 0x6c, 0x6f, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x40, 0x0a, 0x0d, 0x47, 0x65, 0x74, 0x4c, 0x73, 0x61, + 0x74, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x12, 0x16, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, + 0x63, 0x2e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x17, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x73, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3c, 0x0a, 0x07, 0x47, 0x65, 0x74, 0x49, + 0x6e, 0x66, 0x6f, 0x12, 0x17, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x47, 0x65, + 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x6c, + 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x47, 0x65, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x56, 0x0a, 0x12, 0x47, 0x65, 0x74, 0x4c, 0x69, 0x71, + 0x75, 0x69, 0x64, 0x69, 0x74, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x22, 0x2e, 0x6c, + 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x47, 0x65, 0x74, 0x4c, 0x69, 0x71, 0x75, 0x69, 0x64, + 0x69, 0x74, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x1c, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x4c, 0x69, 0x71, 0x75, 0x69, + 0x64, 0x69, 0x74, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x12, 0x5d, + 0x0a, 0x12, 0x53, 0x65, 0x74, 0x4c, 0x69, 0x71, 0x75, 0x69, 0x64, 0x69, 0x74, 0x79, 0x50, 0x61, + 0x72, 0x61, 0x6d, 0x73, 0x12, 0x22, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x53, + 0x65, 0x74, 0x4c, 0x69, 0x71, 0x75, 0x69, 0x64, 0x69, 0x74, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, + 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x23, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, + 0x70, 0x63, 0x2e, 0x53, 0x65, 0x74, 0x4c, 0x69, 0x71, 0x75, 0x69, 0x64, 0x69, 0x74, 0x79, 0x50, + 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4b, 0x0a, + 0x0c, 0x53, 0x75, 0x67, 0x67, 0x65, 0x73, 0x74, 0x53, 0x77, 0x61, 0x70, 0x73, 0x12, 0x1c, 0x2e, + 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x53, 0x75, 0x67, 0x67, 0x65, 0x73, 0x74, 0x53, + 0x77, 0x61, 0x70, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x53, 0x75, 0x67, 0x67, 0x65, 0x73, 0x74, 0x53, 0x77, 0x61, - 0x70, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, - 0x72, 0x70, 0x63, 0x2e, 0x53, 0x75, 0x67, 0x67, 0x65, 0x73, 0x74, 0x53, 0x77, 0x61, 0x70, 0x73, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x57, 0x0a, 0x10, 0x4c, 0x69, 0x73, 0x74, - 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x20, 0x2e, 0x6c, - 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x65, 0x72, - 0x76, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x21, + 0x70, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x57, 0x0a, 0x10, 0x4c, 0x69, + 0x73, 0x74, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x20, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, - 0x65, 0x72, 0x76, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x12, 0x45, 0x0a, 0x0a, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x74, 0x4f, 0x75, 0x74, 0x12, - 0x1a, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, - 0x74, 0x4f, 0x75, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1b, 0x2e, 0x6c, 0x6f, - 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x74, 0x4f, 0x75, 0x74, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x54, 0x0a, 0x0f, 0x49, 0x6e, 0x73, 0x74, - 0x61, 0x6e, 0x74, 0x4f, 0x75, 0x74, 0x51, 0x75, 0x6f, 0x74, 0x65, 0x12, 0x1f, 0x2e, 0x6c, 0x6f, - 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x74, 0x4f, 0x75, 0x74, - 0x51, 0x75, 0x6f, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x20, 0x2e, 0x6c, - 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x74, 0x4f, 0x75, - 0x74, 0x51, 0x75, 0x6f, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x54, - 0x0a, 0x0f, 0x4c, 0x69, 0x73, 0x74, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x74, 0x4f, 0x75, 0x74, - 0x73, 0x12, 0x1f, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x4c, 0x69, 0x73, 0x74, - 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x74, 0x4f, 0x75, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x1a, 0x20, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x4c, 0x69, 0x73, - 0x74, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x74, 0x4f, 0x75, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x27, 0x5a, 0x25, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, - 0x6f, 0x6d, 0x2f, 0x6c, 0x69, 0x67, 0x68, 0x74, 0x6e, 0x69, 0x6e, 0x67, 0x6c, 0x61, 0x62, 0x73, - 0x2f, 0x6c, 0x6f, 0x6f, 0x70, 0x2f, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x62, 0x06, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x65, 0x72, 0x76, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x21, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x52, + 0x65, 0x73, 0x65, 0x72, 0x76, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x45, 0x0a, 0x0a, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x74, 0x4f, 0x75, + 0x74, 0x12, 0x1a, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x49, 0x6e, 0x73, 0x74, + 0x61, 0x6e, 0x74, 0x4f, 0x75, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1b, 0x2e, + 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x74, 0x4f, + 0x75, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x54, 0x0a, 0x0f, 0x49, 0x6e, + 0x73, 0x74, 0x61, 0x6e, 0x74, 0x4f, 0x75, 0x74, 0x51, 0x75, 0x6f, 0x74, 0x65, 0x12, 0x1f, 0x2e, + 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x74, 0x4f, + 0x75, 0x74, 0x51, 0x75, 0x6f, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x20, + 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x74, + 0x4f, 0x75, 0x74, 0x51, 0x75, 0x6f, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x54, 0x0a, 0x0f, 0x4c, 0x69, 0x73, 0x74, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x74, 0x4f, + 0x75, 0x74, 0x73, 0x12, 0x1f, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x4c, 0x69, + 0x73, 0x74, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x74, 0x4f, 0x75, 0x74, 0x73, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x20, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x4c, + 0x69, 0x73, 0x74, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x74, 0x4f, 0x75, 0x74, 0x73, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x27, 0x5a, 0x25, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, + 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6c, 0x69, 0x67, 0x68, 0x74, 0x6e, 0x69, 0x6e, 0x67, 0x6c, 0x61, + 0x62, 0x73, 0x2f, 0x6c, 0x6f, 0x6f, 0x70, 0x2f, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x62, + 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -4610,36 +4614,38 @@ var file_client_proto_depIdxs = []int32{ 19, // 33: looprpc.SwapClient.GetLoopInQuote:input_type -> looprpc.QuoteRequest 22, // 34: looprpc.SwapClient.Probe:input_type -> looprpc.ProbeRequest 24, // 35: looprpc.SwapClient.GetL402Tokens:input_type -> looprpc.TokensRequest - 28, // 36: looprpc.SwapClient.GetInfo:input_type -> looprpc.GetInfoRequest - 30, // 37: looprpc.SwapClient.GetLiquidityParams:input_type -> looprpc.GetLiquidityParamsRequest - 33, // 38: looprpc.SwapClient.SetLiquidityParams:input_type -> looprpc.SetLiquidityParamsRequest - 35, // 39: looprpc.SwapClient.SuggestSwaps:input_type -> looprpc.SuggestSwapsRequest - 40, // 40: looprpc.SwapClient.ListReservations:input_type -> looprpc.ListReservationsRequest - 43, // 41: looprpc.SwapClient.InstantOut:input_type -> looprpc.InstantOutRequest - 45, // 42: looprpc.SwapClient.InstantOutQuote:input_type -> looprpc.InstantOutQuoteRequest - 47, // 43: looprpc.SwapClient.ListInstantOuts:input_type -> looprpc.ListInstantOutsRequest - 9, // 44: looprpc.SwapClient.LoopOut:output_type -> looprpc.SwapResponse - 9, // 45: looprpc.SwapClient.LoopIn:output_type -> looprpc.SwapResponse - 11, // 46: looprpc.SwapClient.Monitor:output_type -> looprpc.SwapStatus - 14, // 47: looprpc.SwapClient.ListSwaps:output_type -> looprpc.ListSwapsResponse - 11, // 48: looprpc.SwapClient.SwapInfo:output_type -> looprpc.SwapStatus - 39, // 49: looprpc.SwapClient.AbandonSwap:output_type -> looprpc.AbandonSwapResponse - 18, // 50: looprpc.SwapClient.LoopOutTerms:output_type -> looprpc.OutTermsResponse - 21, // 51: looprpc.SwapClient.LoopOutQuote:output_type -> looprpc.OutQuoteResponse - 17, // 52: looprpc.SwapClient.GetLoopInTerms:output_type -> looprpc.InTermsResponse - 20, // 53: looprpc.SwapClient.GetLoopInQuote:output_type -> looprpc.InQuoteResponse - 23, // 54: looprpc.SwapClient.Probe:output_type -> looprpc.ProbeResponse - 25, // 55: looprpc.SwapClient.GetL402Tokens:output_type -> looprpc.TokensResponse - 29, // 56: looprpc.SwapClient.GetInfo:output_type -> looprpc.GetInfoResponse - 31, // 57: looprpc.SwapClient.GetLiquidityParams:output_type -> looprpc.LiquidityParameters - 34, // 58: looprpc.SwapClient.SetLiquidityParams:output_type -> looprpc.SetLiquidityParamsResponse - 37, // 59: looprpc.SwapClient.SuggestSwaps:output_type -> looprpc.SuggestSwapsResponse - 41, // 60: looprpc.SwapClient.ListReservations:output_type -> looprpc.ListReservationsResponse - 44, // 61: looprpc.SwapClient.InstantOut:output_type -> looprpc.InstantOutResponse - 46, // 62: looprpc.SwapClient.InstantOutQuote:output_type -> looprpc.InstantOutQuoteResponse - 48, // 63: looprpc.SwapClient.ListInstantOuts:output_type -> looprpc.ListInstantOutsResponse - 44, // [44:64] is the sub-list for method output_type - 24, // [24:44] is the sub-list for method input_type + 24, // 36: looprpc.SwapClient.GetLsatTokens:input_type -> looprpc.TokensRequest + 28, // 37: looprpc.SwapClient.GetInfo:input_type -> looprpc.GetInfoRequest + 30, // 38: looprpc.SwapClient.GetLiquidityParams:input_type -> looprpc.GetLiquidityParamsRequest + 33, // 39: looprpc.SwapClient.SetLiquidityParams:input_type -> looprpc.SetLiquidityParamsRequest + 35, // 40: looprpc.SwapClient.SuggestSwaps:input_type -> looprpc.SuggestSwapsRequest + 40, // 41: looprpc.SwapClient.ListReservations:input_type -> looprpc.ListReservationsRequest + 43, // 42: looprpc.SwapClient.InstantOut:input_type -> looprpc.InstantOutRequest + 45, // 43: looprpc.SwapClient.InstantOutQuote:input_type -> looprpc.InstantOutQuoteRequest + 47, // 44: looprpc.SwapClient.ListInstantOuts:input_type -> looprpc.ListInstantOutsRequest + 9, // 45: looprpc.SwapClient.LoopOut:output_type -> looprpc.SwapResponse + 9, // 46: looprpc.SwapClient.LoopIn:output_type -> looprpc.SwapResponse + 11, // 47: looprpc.SwapClient.Monitor:output_type -> looprpc.SwapStatus + 14, // 48: looprpc.SwapClient.ListSwaps:output_type -> looprpc.ListSwapsResponse + 11, // 49: looprpc.SwapClient.SwapInfo:output_type -> looprpc.SwapStatus + 39, // 50: looprpc.SwapClient.AbandonSwap:output_type -> looprpc.AbandonSwapResponse + 18, // 51: looprpc.SwapClient.LoopOutTerms:output_type -> looprpc.OutTermsResponse + 21, // 52: looprpc.SwapClient.LoopOutQuote:output_type -> looprpc.OutQuoteResponse + 17, // 53: looprpc.SwapClient.GetLoopInTerms:output_type -> looprpc.InTermsResponse + 20, // 54: looprpc.SwapClient.GetLoopInQuote:output_type -> looprpc.InQuoteResponse + 23, // 55: looprpc.SwapClient.Probe:output_type -> looprpc.ProbeResponse + 25, // 56: looprpc.SwapClient.GetL402Tokens:output_type -> looprpc.TokensResponse + 25, // 57: looprpc.SwapClient.GetLsatTokens:output_type -> looprpc.TokensResponse + 29, // 58: looprpc.SwapClient.GetInfo:output_type -> looprpc.GetInfoResponse + 31, // 59: looprpc.SwapClient.GetLiquidityParams:output_type -> looprpc.LiquidityParameters + 34, // 60: looprpc.SwapClient.SetLiquidityParams:output_type -> looprpc.SetLiquidityParamsResponse + 37, // 61: looprpc.SwapClient.SuggestSwaps:output_type -> looprpc.SuggestSwapsResponse + 41, // 62: looprpc.SwapClient.ListReservations:output_type -> looprpc.ListReservationsResponse + 44, // 63: looprpc.SwapClient.InstantOut:output_type -> looprpc.InstantOutResponse + 46, // 64: looprpc.SwapClient.InstantOutQuote:output_type -> looprpc.InstantOutQuoteResponse + 48, // 65: looprpc.SwapClient.ListInstantOuts:output_type -> looprpc.ListInstantOutsResponse + 45, // [45:66] is the sub-list for method output_type + 24, // [24:45] is the sub-list for method input_type 24, // [24:24] is the sub-list for extension type_name 24, // [24:24] is the sub-list for extension extendee 0, // [0:24] is the sub-list for field type_name diff --git a/looprpc/client.proto b/looprpc/client.proto index d70094c..e968edb 100644 --- a/looprpc/client.proto +++ b/looprpc/client.proto @@ -80,6 +80,15 @@ service SwapClient { */ rpc GetL402Tokens (TokensRequest) returns (TokensResponse); + /* + Deprecated: use GetL402Tokens. + This API is provided to maintain backward compatibility with gRPC clients + (e.g. `loop listauth`, Terminal Web, RTL). + Type LsatToken used by GetLsatTokens in the past was renamed to L402Token, + but this does not affect binary encoding, so we can use type L402Token here. + */ + rpc GetLsatTokens (TokensRequest) returns (TokensResponse); + /* loop: `getinfo` GetInfo gets basic information about the loop daemon. */ diff --git a/looprpc/client_grpc.pb.go b/looprpc/client_grpc.pb.go index 34aafe1..f5bd148 100644 --- a/looprpc/client_grpc.pb.go +++ b/looprpc/client_grpc.pb.go @@ -62,6 +62,12 @@ type SwapClientClient interface { // loop: `listauth` // GetL402Tokens returns all L402 tokens the daemon ever paid for. GetL402Tokens(ctx context.Context, in *TokensRequest, opts ...grpc.CallOption) (*TokensResponse, error) + // Deprecated: use GetL402Tokens. + // This API is provided to maintain backward compatibility with gRPC clients + // (e.g. `loop listauth`, Terminal Web, RTL). + // Type LsatToken used by GetLsatTokens in the past was renamed to L402Token, + // but this does not affect binary encoding, so we can use type L402Token here. + GetLsatTokens(ctx context.Context, in *TokensRequest, opts ...grpc.CallOption) (*TokensResponse, error) // loop: `getinfo` // GetInfo gets basic information about the loop daemon. GetInfo(ctx context.Context, in *GetInfoRequest, opts ...grpc.CallOption) (*GetInfoResponse, error) @@ -237,6 +243,15 @@ func (c *swapClientClient) GetL402Tokens(ctx context.Context, in *TokensRequest, return out, nil } +func (c *swapClientClient) GetLsatTokens(ctx context.Context, in *TokensRequest, opts ...grpc.CallOption) (*TokensResponse, error) { + out := new(TokensResponse) + err := c.cc.Invoke(ctx, "/looprpc.SwapClient/GetLsatTokens", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + func (c *swapClientClient) GetInfo(ctx context.Context, in *GetInfoRequest, opts ...grpc.CallOption) (*GetInfoResponse, error) { out := new(GetInfoResponse) err := c.cc.Invoke(ctx, "/looprpc.SwapClient/GetInfo", in, out, opts...) @@ -357,6 +372,12 @@ type SwapClientServer interface { // loop: `listauth` // GetL402Tokens returns all L402 tokens the daemon ever paid for. GetL402Tokens(context.Context, *TokensRequest) (*TokensResponse, error) + // Deprecated: use GetL402Tokens. + // This API is provided to maintain backward compatibility with gRPC clients + // (e.g. `loop listauth`, Terminal Web, RTL). + // Type LsatToken used by GetLsatTokens in the past was renamed to L402Token, + // but this does not affect binary encoding, so we can use type L402Token here. + GetLsatTokens(context.Context, *TokensRequest) (*TokensResponse, error) // loop: `getinfo` // GetInfo gets basic information about the loop daemon. GetInfo(context.Context, *GetInfoRequest) (*GetInfoResponse, error) @@ -434,6 +455,9 @@ func (UnimplementedSwapClientServer) Probe(context.Context, *ProbeRequest) (*Pro func (UnimplementedSwapClientServer) GetL402Tokens(context.Context, *TokensRequest) (*TokensResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method GetL402Tokens not implemented") } +func (UnimplementedSwapClientServer) GetLsatTokens(context.Context, *TokensRequest) (*TokensResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetLsatTokens not implemented") +} func (UnimplementedSwapClientServer) GetInfo(context.Context, *GetInfoRequest) (*GetInfoResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method GetInfo not implemented") } @@ -690,6 +714,24 @@ func _SwapClient_GetL402Tokens_Handler(srv interface{}, ctx context.Context, dec return interceptor(ctx, in, info, handler) } +func _SwapClient_GetLsatTokens_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(TokensRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SwapClientServer).GetLsatTokens(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/looprpc.SwapClient/GetLsatTokens", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SwapClientServer).GetLsatTokens(ctx, req.(*TokensRequest)) + } + return interceptor(ctx, in, info, handler) +} + func _SwapClient_GetInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(GetInfoRequest) if err := dec(in); err != nil { @@ -885,6 +927,10 @@ var SwapClient_ServiceDesc = grpc.ServiceDesc{ MethodName: "GetL402Tokens", Handler: _SwapClient_GetL402Tokens_Handler, }, + { + MethodName: "GetLsatTokens", + Handler: _SwapClient_GetLsatTokens_Handler, + }, { MethodName: "GetInfo", Handler: _SwapClient_GetInfo_Handler, diff --git a/looprpc/swapclient.pb.json.go b/looprpc/swapclient.pb.json.go index cece43e..fd57a4e 100644 --- a/looprpc/swapclient.pb.json.go +++ b/looprpc/swapclient.pb.json.go @@ -338,6 +338,31 @@ func RegisterSwapClientJSONCallbacks(registry map[string]func(ctx context.Contex callback(string(respBytes), nil) } + registry["looprpc.SwapClient.GetLsatTokens"] = func(ctx context.Context, + conn *grpc.ClientConn, reqJSON string, callback func(string, error)) { + + req := &TokensRequest{} + err := marshaler.Unmarshal([]byte(reqJSON), req) + if err != nil { + callback("", err) + return + } + + client := NewSwapClientClient(conn) + resp, err := client.GetLsatTokens(ctx, req) + if err != nil { + callback("", err) + return + } + + respBytes, err := marshaler.Marshal(resp) + if err != nil { + callback("", err) + return + } + callback(string(respBytes), nil) + } + registry["looprpc.SwapClient.GetInfo"] = func(ctx context.Context, conn *grpc.ClientConn, reqJSON string, callback func(string, error)) { diff --git a/release_notes.md b/release_notes.md index 8b081d2..d00248f 100644 --- a/release_notes.md +++ b/release_notes.md @@ -25,9 +25,12 @@ encouraged to change the options to new names if they have been changed locally. The path in looprpc "/v1/lsat/tokens" was renamed to "/v1/l402/tokens" and the corresponding method was renamed from `GetLsatTokens` to `GetL402Tokens`. -Update `loop` and `loopd` simultaneously otherwise this RPC won't work. -HTTP endpoint "/v1/l402/tokens" is now an additional binding for API -"/v1/lsat/tokens", so it still works. +New `loop` binary won't work with old `loopd`, because `loop listauth` is now +calling `GetL402Tokens` method, which does not exist in previous `loopd` binary. +Old `loop` binary works with new `loopd`, since `loopd` provides a wrapper for +`GetLsatTokens` which calls `GetL402Tokens`; the wrapper logs a warning and +it will be removed in a couple of releases. HTTP endpoint "/v1/l402/tokens" is +now an additional binding for API "/v1/lsat/tokens", so it still works. #### Bug Fixes From 75d7641d745d36fe896655ed1b13a026e50d935d Mon Sep 17 00:00:00 2001 From: Andras Banki-Horvath Date: Tue, 30 Apr 2024 20:56:06 +0200 Subject: [PATCH 09/37] sweepbatcher: add more debug logging --- sweepbatcher/sweep_batch.go | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/sweepbatcher/sweep_batch.go b/sweepbatcher/sweep_batch.go index 0960f31..33814f3 100644 --- a/sweepbatcher/sweep_batch.go +++ b/sweepbatcher/sweep_batch.go @@ -3,6 +3,7 @@ package sweepbatcher import ( "bytes" "context" + "encoding/hex" "fmt" "math" "sync" @@ -700,9 +701,11 @@ func (b *batch) publishBatch(ctx context.Context) (btcutil.Amount, error) { batchTx.TxIn[i].Witness = witness } - b.log.Debugf("attempting to publish non-coop tx with feerate=%v, "+ - "totalfee=%v, sweeps=%v, destAddr=%s", b.rbfCache.FeeRate, fee, - len(batchTx.TxIn), address.String()) + b.log.Infof("attempting to publish non-coop tx=%v with feerate=%v, "+ + "totalfee=%v, sweeps=%d, destAddr=%s", batchTx.TxHash(), + b.rbfCache.FeeRate, fee, len(batchTx.TxIn), address) + + b.debugLogTx("serialized non-coop sweep", batchTx) err = b.wallet.PublishTransaction( ctx, batchTx, labels.LoopOutBatchSweepSuccess(b.id), @@ -846,9 +849,11 @@ func (b *batch) publishBatchCoop(ctx context.Context) (btcutil.Amount, return fee, err, false } - b.log.Debugf("attempting to publish coop tx with feerate=%v, "+ - "totalfee=%v, sweeps=%v, destAddr=%s", b.rbfCache.FeeRate, fee, - len(batchTx.TxIn), address.String()) + b.log.Infof("attempting to publish coop tx=%v with feerate=%v, "+ + "totalfee=%v, sweeps=%d, destAddr=%s", batchTx.TxHash(), + b.rbfCache.FeeRate, fee, len(batchTx.TxIn), address) + + b.debugLogTx("serialized coop sweep", batchTx) err = b.wallet.PublishTransaction( ctx, batchTx, labels.LoopOutBatchSweepSuccess(b.id), @@ -866,6 +871,17 @@ func (b *batch) publishBatchCoop(ctx context.Context) (btcutil.Amount, return fee, nil, true } +func (b *batch) debugLogTx(msg string, tx *wire.MsgTx) { + // Serialize the transaction and convert to hex string. + buf := bytes.NewBuffer(make([]byte, 0, tx.SerializeSize())) + if err := tx.Serialize(buf); err != nil { + b.log.Errorf("failed to serialize tx for debug log: %v", err) + return + } + + b.log.Debugf("%s: %s", msg, hex.EncodeToString(buf.Bytes())) +} + // coopSignBatchTx collects the necessary signatures from the server in order // to cooperatively sweep the funds. func (b *batch) coopSignBatchTx(ctx context.Context, packet *psbt.Packet, From 636f8b611b4cc3b76dd9c9ad221df7820ac1e4d7 Mon Sep 17 00:00:00 2001 From: Slyghtning Date: Fri, 26 Apr 2024 16:35:45 +0200 Subject: [PATCH 10/37] daemon: fix wrapped errors and typos --- loopd/daemon.go | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/loopd/daemon.go b/loopd/daemon.go index dde79b5..c6496be 100644 --- a/loopd/daemon.go +++ b/loopd/daemon.go @@ -51,7 +51,7 @@ type ListenerCfg struct { // on the passed TLS configuration. restListener func(*tls.Config) (net.Listener, error) - // getLnd returns a grpc connection to an lnd instance. + // getLnd returns a grpc connection to a lnd instance. getLnd func(lndclient.Network, *lndConfig) (*lndclient.GrpcLndServices, error) } @@ -118,9 +118,9 @@ func New(config *Config, lisCfg *ListenerCfg) *Daemon { // Start starts loopd in daemon mode. It will listen for grpc connections, // execute commands and pass back swap status information. func (d *Daemon) Start() error { - // There should be no reason to start the daemon twice. Therefore return - // an error if that's tried. This is mostly to guard against Start and - // StartAsSubserver both being called. + // There should be no reason to start the daemon twice. Therefore, + // return an error if that's tried. This is mostly to guard against + // Start and StartAsSubserver both being called. if atomic.AddInt32(&d.started, 1) != 1 { return errOnlyStartOnce } @@ -135,7 +135,7 @@ func (d *Daemon) Start() error { // With lnd connected, initialize everything else, such as the swap // server client, the swap client RPC server instance and our main swap - // and error handlers. If this fails, then nothing has been started yet + // and error handlers. If this fails, then nothing has been started yet, // and we can just return the error. err = d.initialize(true) if errors.Is(err, bbolt.ErrTimeout) { @@ -322,7 +322,7 @@ func (d *Daemon) startWebServers() error { err := d.restServer.Serve(d.restListener) // ErrServerClosed is always returned when the proxy is // shut down, so don't log it. - if err != nil && err != http.ErrServerClosed { + if err != nil && !errors.Is(err, http.ErrServerClosed) { // Notify the main error handler goroutine that // we exited unexpectedly here. We don't have to // worry about blocking as the internal error @@ -341,7 +341,7 @@ func (d *Daemon) startWebServers() error { log.Infof("RPC server listening on %s", d.grpcListener.Addr()) err = d.grpcServer.Serve(d.grpcListener) - if err != nil && err != grpc.ErrServerStopped { + if err != nil && !errors.Is(err, grpc.ErrServerStopped) { // Notify the main error handler goroutine that // we exited unexpectedly here. We don't have to // worry about blocking as the internal error @@ -680,9 +680,9 @@ func (d *Daemon) initialize(withMacaroonService bool) error { var runtimeErr error // There are only two ways this goroutine can exit. Either there - // is an internal error or the caller requests shutdown. In both - // cases we wait for the stop to complete before we signal the - // caller that we're done. + // is an internal error or the caller requests a shutdown. + // In both cases we wait for the stop to complete before we + // signal the caller that we're done. select { case runtimeErr = <-d.internalErrChan: log.Errorf("Runtime error in daemon, shutting down: "+ @@ -691,7 +691,7 @@ func (d *Daemon) initialize(withMacaroonService bool) error { case <-d.quit: } - // We need to shutdown before sending the error on the channel, + // We need to shut down before sending the error on the channel, // otherwise a caller might exit the process too early. d.stop() cleanupMacaroonStore() @@ -722,7 +722,7 @@ func (d *Daemon) stop() { d.mainCtxCancel() } - // As there is no swap activity anymore, we can forcefully shutdown the + // As there is no swap activity anymore, we can forcefully shut down the // gRPC and HTTP servers now. log.Infof("Stopping gRPC server") if d.grpcServer != nil { From 883d83a85aef71a45494a947c4592af448d544a8 Mon Sep 17 00:00:00 2001 From: Slyghtning Date: Thu, 9 Nov 2023 19:04:59 +0100 Subject: [PATCH 11/37] sqlc: static address migrations, models, queries --- .../migrations/000007_static_address.down.sql | 1 + .../migrations/000007_static_address.up.sql | 38 ++++++ loopdb/sqlc/models.go | 11 ++ loopdb/sqlc/querier.go | 3 + loopdb/sqlc/queries/static_addresses.sql | 25 ++++ loopdb/sqlc/static_addresses.sql.go | 110 ++++++++++++++++++ 6 files changed, 188 insertions(+) create mode 100644 loopdb/sqlc/migrations/000007_static_address.down.sql create mode 100644 loopdb/sqlc/migrations/000007_static_address.up.sql create mode 100644 loopdb/sqlc/queries/static_addresses.sql create mode 100644 loopdb/sqlc/static_addresses.sql.go diff --git a/loopdb/sqlc/migrations/000007_static_address.down.sql b/loopdb/sqlc/migrations/000007_static_address.down.sql new file mode 100644 index 0000000..492ef97 --- /dev/null +++ b/loopdb/sqlc/migrations/000007_static_address.down.sql @@ -0,0 +1 @@ +DROP TABLE IF EXISTS static_addresses; \ No newline at end of file diff --git a/loopdb/sqlc/migrations/000007_static_address.up.sql b/loopdb/sqlc/migrations/000007_static_address.up.sql new file mode 100644 index 0000000..f4b293e --- /dev/null +++ b/loopdb/sqlc/migrations/000007_static_address.up.sql @@ -0,0 +1,38 @@ +-- static_address stores the static loop-in addresses that clients +-- cooperatively created with the server. +CREATE TABLE IF NOT EXISTS static_addresses ( + -- id is the auto-incrementing primary key for a static address. + id INTEGER PRIMARY KEY, + + -- client_pubkey is the client side public taproot key that is used to + -- construct the 2-of-2 MuSig2 taproot output that represents the static + -- address. + client_pubkey BYTEA NOT NULL, + + -- server_pubkey is the server side public taproot key that is used to + -- construct the 2-of-2 MuSig2 taproot output that represents the static + -- address. + server_pubkey BYTEA NOT NULL, + + -- expiry denotes the CSV delay at which funds at a specific static address + -- can be swept back to the client. + expiry INT NOT NULL, + + -- client_key_family is the key family of the client public key from the + -- client's lnd wallet. + client_key_family INT NOT NULL, + + -- client_key_index is the key index of the client public key from the + -- client's lnd wallet. + client_key_index INT NOT NULL, + + -- pkscript is the witness program that represents the static address. It is + -- unique amongst all static addresses. + pkscript BYTEA NOT NULL UNIQUE, + + -- protocol_version is the protocol version that the swap was created with. + -- Note that this version is not upgraded if the client upgrades or + -- downgrades their protocol version for static address outputs already in + -- use. + protocol_version INTEGER NOT NULL +); \ No newline at end of file diff --git a/loopdb/sqlc/models.go b/loopdb/sqlc/models.go index ec9dc56..78d4828 100644 --- a/loopdb/sqlc/models.go +++ b/loopdb/sqlc/models.go @@ -88,6 +88,17 @@ type ReservationUpdate struct { UpdateTimestamp time.Time } +type StaticAddress struct { + ID int32 + ClientPubkey []byte + ServerPubkey []byte + Expiry int32 + ClientKeyFamily int32 + ClientKeyIndex int32 + Pkscript []byte + ProtocolVersion int32 +} + type Swap struct { ID int32 SwapHash []byte diff --git a/loopdb/sqlc/querier.go b/loopdb/sqlc/querier.go index b1f0903..20f502e 100644 --- a/loopdb/sqlc/querier.go +++ b/loopdb/sqlc/querier.go @@ -9,8 +9,10 @@ import ( ) type Querier interface { + AllStaticAddresses(ctx context.Context) ([]StaticAddress, error) ConfirmBatch(ctx context.Context, id int32) error CreateReservation(ctx context.Context, arg CreateReservationParams) error + CreateStaticAddress(ctx context.Context, arg CreateStaticAddressParams) error FetchLiquidityParams(ctx context.Context) ([]byte, error) GetBatchSweeps(ctx context.Context, batchID int32) ([]GetBatchSweepsRow, error) GetBatchSweptAmount(ctx context.Context, batchID int32) (int64, error) @@ -25,6 +27,7 @@ type Querier interface { GetReservation(ctx context.Context, reservationID []byte) (Reservation, error) GetReservationUpdates(ctx context.Context, reservationID []byte) ([]ReservationUpdate, error) GetReservations(ctx context.Context) ([]Reservation, error) + GetStaticAddress(ctx context.Context, pkscript []byte) (StaticAddress, error) GetSwapUpdates(ctx context.Context, swapHash []byte) ([]SwapUpdate, error) GetSweepStatus(ctx context.Context, swapHash []byte) (bool, error) GetUnconfirmedBatches(ctx context.Context) ([]SweepBatch, error) diff --git a/loopdb/sqlc/queries/static_addresses.sql b/loopdb/sqlc/queries/static_addresses.sql new file mode 100644 index 0000000..a0a1fd0 --- /dev/null +++ b/loopdb/sqlc/queries/static_addresses.sql @@ -0,0 +1,25 @@ +-- name: AllStaticAddresses :many +SELECT * FROM static_addresses; + +-- name: GetStaticAddress :one +SELECT * FROM static_addresses +WHERE pkscript=$1; + +-- name: CreateStaticAddress :exec +INSERT INTO static_addresses ( + client_pubkey, + server_pubkey, + expiry, + client_key_family, + client_key_index, + pkscript, + protocol_version +) VALUES ( + $1, + $2, + $3, + $4, + $5, + $6, + $7 + ); \ No newline at end of file diff --git a/loopdb/sqlc/static_addresses.sql.go b/loopdb/sqlc/static_addresses.sql.go new file mode 100644 index 0000000..cfe1a46 --- /dev/null +++ b/loopdb/sqlc/static_addresses.sql.go @@ -0,0 +1,110 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.17.2 +// source: static_addresses.sql + +package sqlc + +import ( + "context" +) + +const allStaticAddresses = `-- name: AllStaticAddresses :many +SELECT id, client_pubkey, server_pubkey, expiry, client_key_family, client_key_index, pkscript, protocol_version FROM static_addresses +` + +func (q *Queries) AllStaticAddresses(ctx context.Context) ([]StaticAddress, error) { + rows, err := q.db.QueryContext(ctx, allStaticAddresses) + if err != nil { + return nil, err + } + defer rows.Close() + var items []StaticAddress + for rows.Next() { + var i StaticAddress + if err := rows.Scan( + &i.ID, + &i.ClientPubkey, + &i.ServerPubkey, + &i.Expiry, + &i.ClientKeyFamily, + &i.ClientKeyIndex, + &i.Pkscript, + &i.ProtocolVersion, + ); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const createStaticAddress = `-- name: CreateStaticAddress :exec +INSERT INTO static_addresses ( + client_pubkey, + server_pubkey, + expiry, + client_key_family, + client_key_index, + pkscript, + protocol_version +) VALUES ( + $1, + $2, + $3, + $4, + $5, + $6, + $7 + ) +` + +type CreateStaticAddressParams struct { + ClientPubkey []byte + ServerPubkey []byte + Expiry int32 + ClientKeyFamily int32 + ClientKeyIndex int32 + Pkscript []byte + ProtocolVersion int32 +} + +func (q *Queries) CreateStaticAddress(ctx context.Context, arg CreateStaticAddressParams) error { + _, err := q.db.ExecContext(ctx, createStaticAddress, + arg.ClientPubkey, + arg.ServerPubkey, + arg.Expiry, + arg.ClientKeyFamily, + arg.ClientKeyIndex, + arg.Pkscript, + arg.ProtocolVersion, + ) + return err +} + +const getStaticAddress = `-- name: GetStaticAddress :one +SELECT id, client_pubkey, server_pubkey, expiry, client_key_family, client_key_index, pkscript, protocol_version FROM static_addresses +WHERE pkscript=$1 +` + +func (q *Queries) GetStaticAddress(ctx context.Context, pkscript []byte) (StaticAddress, error) { + row := q.db.QueryRowContext(ctx, getStaticAddress, pkscript) + var i StaticAddress + err := row.Scan( + &i.ID, + &i.ClientPubkey, + &i.ServerPubkey, + &i.Expiry, + &i.ClientKeyFamily, + &i.ClientKeyIndex, + &i.Pkscript, + &i.ProtocolVersion, + ) + return i, err +} From 7915aab1c069550109396a518eefb4b7d73721b0 Mon Sep 17 00:00:00 2001 From: Slyghtning Date: Wed, 14 Feb 2024 17:00:19 +0100 Subject: [PATCH 12/37] swapserverrpc: static address creation support --- swapserverrpc/server.pb.go | 642 ++++++++++++++++++++++---------- swapserverrpc/server.proto | 27 +- swapserverrpc/server_grpc.pb.go | 90 ++++- 3 files changed, 550 insertions(+), 209 deletions(-) diff --git a/swapserverrpc/server.pb.go b/swapserverrpc/server.pb.go index 82ffb25..3bf20f1 100644 --- a/swapserverrpc/server.pb.go +++ b/swapserverrpc/server.pb.go @@ -2802,6 +2802,167 @@ func (*FetchL402Response) Descriptor() ([]byte, []int) { return file_server_proto_rawDescGZIP(), []int{33} } +type ServerNewAddressRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The protocol version that the client adheres to. + ProtocolVersion StaticAddressProtocolVersion `protobuf:"varint,1,opt,name=protocol_version,json=protocolVersion,proto3,enum=looprpc.StaticAddressProtocolVersion" json:"protocol_version,omitempty"` + // The client key for the MuSig2 static address output. + ClientKey []byte `protobuf:"bytes,2,opt,name=client_key,json=clientKey,proto3" json:"client_key,omitempty"` +} + +func (x *ServerNewAddressRequest) Reset() { + *x = ServerNewAddressRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_server_proto_msgTypes[34] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ServerNewAddressRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ServerNewAddressRequest) ProtoMessage() {} + +func (x *ServerNewAddressRequest) ProtoReflect() protoreflect.Message { + mi := &file_server_proto_msgTypes[34] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ServerNewAddressRequest.ProtoReflect.Descriptor instead. +func (*ServerNewAddressRequest) Descriptor() ([]byte, []int) { + return file_server_proto_rawDescGZIP(), []int{34} +} + +func (x *ServerNewAddressRequest) GetProtocolVersion() StaticAddressProtocolVersion { + if x != nil { + return x.ProtocolVersion + } + return StaticAddressProtocolVersion_V0 +} + +func (x *ServerNewAddressRequest) GetClientKey() []byte { + if x != nil { + return x.ClientKey + } + return nil +} + +type ServerNewAddressResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Params *ServerAddressParameters `protobuf:"bytes,1,opt,name=params,proto3" json:"params,omitempty"` +} + +func (x *ServerNewAddressResponse) Reset() { + *x = ServerNewAddressResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_server_proto_msgTypes[35] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ServerNewAddressResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ServerNewAddressResponse) ProtoMessage() {} + +func (x *ServerNewAddressResponse) ProtoReflect() protoreflect.Message { + mi := &file_server_proto_msgTypes[35] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ServerNewAddressResponse.ProtoReflect.Descriptor instead. +func (*ServerNewAddressResponse) Descriptor() ([]byte, []int) { + return file_server_proto_rawDescGZIP(), []int{35} +} + +func (x *ServerNewAddressResponse) GetParams() *ServerAddressParameters { + if x != nil { + return x.Params + } + return nil +} + +type ServerAddressParameters struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The server key for the MuSig2 static address output. + ServerKey []byte `protobuf:"bytes,1,opt,name=server_key,json=serverKey,proto3" json:"server_key,omitempty"` + // The CSV expiry for the MuSig2 static address output. + Expiry uint32 `protobuf:"varint,2,opt,name=expiry,proto3" json:"expiry,omitempty"` +} + +func (x *ServerAddressParameters) Reset() { + *x = ServerAddressParameters{} + if protoimpl.UnsafeEnabled { + mi := &file_server_proto_msgTypes[36] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ServerAddressParameters) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ServerAddressParameters) ProtoMessage() {} + +func (x *ServerAddressParameters) ProtoReflect() protoreflect.Message { + mi := &file_server_proto_msgTypes[36] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ServerAddressParameters.ProtoReflect.Descriptor instead. +func (*ServerAddressParameters) Descriptor() ([]byte, []int) { + return file_server_proto_rawDescGZIP(), []int{36} +} + +func (x *ServerAddressParameters) GetServerKey() []byte { + if x != nil { + return x.ServerKey + } + return nil +} + +func (x *ServerAddressParameters) GetExpiry() uint32 { + if x != nil { + return x.Expiry + } + return 0 +} + var File_server_proto protoreflect.FileDescriptor var file_server_proto_rawDesc = []byte{ @@ -3127,171 +3288,197 @@ var file_server_proto_rawDesc = []byte{ 0x72, 0x76, 0x65, 0x72, 0x50, 0x75, 0x73, 0x68, 0x4b, 0x65, 0x79, 0x52, 0x65, 0x73, 0x22, 0x12, 0x0a, 0x10, 0x46, 0x65, 0x74, 0x63, 0x68, 0x4c, 0x34, 0x30, 0x32, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x13, 0x0a, 0x11, 0x46, 0x65, 0x74, 0x63, 0x68, 0x4c, 0x34, 0x30, 0x32, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2a, 0xef, 0x01, 0x0a, 0x0f, 0x50, 0x72, 0x6f, 0x74, - 0x6f, 0x63, 0x6f, 0x6c, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x0a, 0x0a, 0x06, 0x4c, - 0x45, 0x47, 0x41, 0x43, 0x59, 0x10, 0x00, 0x12, 0x12, 0x0a, 0x0e, 0x4d, 0x55, 0x4c, 0x54, 0x49, - 0x5f, 0x4c, 0x4f, 0x4f, 0x50, 0x5f, 0x4f, 0x55, 0x54, 0x10, 0x01, 0x12, 0x19, 0x0a, 0x15, 0x4e, - 0x41, 0x54, 0x49, 0x56, 0x45, 0x5f, 0x53, 0x45, 0x47, 0x57, 0x49, 0x54, 0x5f, 0x4c, 0x4f, 0x4f, - 0x50, 0x5f, 0x49, 0x4e, 0x10, 0x02, 0x12, 0x1a, 0x0a, 0x16, 0x50, 0x52, 0x45, 0x49, 0x4d, 0x41, - 0x47, 0x45, 0x5f, 0x50, 0x55, 0x53, 0x48, 0x5f, 0x4c, 0x4f, 0x4f, 0x50, 0x5f, 0x4f, 0x55, 0x54, - 0x10, 0x03, 0x12, 0x18, 0x0a, 0x14, 0x55, 0x53, 0x45, 0x52, 0x5f, 0x45, 0x58, 0x50, 0x49, 0x52, - 0x59, 0x5f, 0x4c, 0x4f, 0x4f, 0x50, 0x5f, 0x4f, 0x55, 0x54, 0x10, 0x04, 0x12, 0x0b, 0x0a, 0x07, - 0x48, 0x54, 0x4c, 0x43, 0x5f, 0x56, 0x32, 0x10, 0x05, 0x12, 0x11, 0x0a, 0x0d, 0x4d, 0x55, 0x4c, - 0x54, 0x49, 0x5f, 0x4c, 0x4f, 0x4f, 0x50, 0x5f, 0x49, 0x4e, 0x10, 0x06, 0x12, 0x13, 0x0a, 0x0f, - 0x4c, 0x4f, 0x4f, 0x50, 0x5f, 0x4f, 0x55, 0x54, 0x5f, 0x43, 0x41, 0x4e, 0x43, 0x45, 0x4c, 0x10, - 0x07, 0x12, 0x09, 0x0a, 0x05, 0x50, 0x52, 0x4f, 0x42, 0x45, 0x10, 0x08, 0x12, 0x12, 0x0a, 0x0e, - 0x52, 0x4f, 0x55, 0x54, 0x49, 0x4e, 0x47, 0x5f, 0x50, 0x4c, 0x55, 0x47, 0x49, 0x4e, 0x10, 0x09, - 0x12, 0x0b, 0x0a, 0x07, 0x48, 0x54, 0x4c, 0x43, 0x5f, 0x56, 0x33, 0x10, 0x0a, 0x12, 0x0a, 0x0a, - 0x06, 0x4d, 0x55, 0x53, 0x49, 0x47, 0x32, 0x10, 0x0b, 0x2a, 0x9e, 0x04, 0x0a, 0x0f, 0x53, 0x65, - 0x72, 0x76, 0x65, 0x72, 0x53, 0x77, 0x61, 0x70, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x14, 0x0a, - 0x10, 0x53, 0x45, 0x52, 0x56, 0x45, 0x52, 0x5f, 0x49, 0x4e, 0x49, 0x54, 0x49, 0x41, 0x54, 0x45, - 0x44, 0x10, 0x00, 0x12, 0x19, 0x0a, 0x15, 0x53, 0x45, 0x52, 0x56, 0x45, 0x52, 0x5f, 0x48, 0x54, - 0x4c, 0x43, 0x5f, 0x50, 0x55, 0x42, 0x4c, 0x49, 0x53, 0x48, 0x45, 0x44, 0x10, 0x01, 0x12, 0x12, - 0x0a, 0x0e, 0x53, 0x45, 0x52, 0x56, 0x45, 0x52, 0x5f, 0x53, 0x55, 0x43, 0x43, 0x45, 0x53, 0x53, - 0x10, 0x02, 0x12, 0x19, 0x0a, 0x15, 0x53, 0x45, 0x52, 0x56, 0x45, 0x52, 0x5f, 0x46, 0x41, 0x49, - 0x4c, 0x45, 0x44, 0x5f, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x03, 0x12, 0x19, 0x0a, - 0x15, 0x53, 0x45, 0x52, 0x56, 0x45, 0x52, 0x5f, 0x46, 0x41, 0x49, 0x4c, 0x45, 0x44, 0x5f, 0x4e, - 0x4f, 0x5f, 0x48, 0x54, 0x4c, 0x43, 0x10, 0x04, 0x12, 0x25, 0x0a, 0x21, 0x53, 0x45, 0x52, 0x56, - 0x45, 0x52, 0x5f, 0x46, 0x41, 0x49, 0x4c, 0x45, 0x44, 0x5f, 0x49, 0x4e, 0x56, 0x41, 0x4c, 0x49, - 0x44, 0x5f, 0x48, 0x54, 0x4c, 0x43, 0x5f, 0x41, 0x4d, 0x4f, 0x55, 0x4e, 0x54, 0x10, 0x05, 0x12, - 0x23, 0x0a, 0x1f, 0x53, 0x45, 0x52, 0x56, 0x45, 0x52, 0x5f, 0x46, 0x41, 0x49, 0x4c, 0x45, 0x44, - 0x5f, 0x4f, 0x46, 0x46, 0x5f, 0x43, 0x48, 0x41, 0x49, 0x4e, 0x5f, 0x54, 0x49, 0x4d, 0x45, 0x4f, - 0x55, 0x54, 0x10, 0x06, 0x12, 0x19, 0x0a, 0x15, 0x53, 0x45, 0x52, 0x56, 0x45, 0x52, 0x5f, 0x46, - 0x41, 0x49, 0x4c, 0x45, 0x44, 0x5f, 0x54, 0x49, 0x4d, 0x45, 0x4f, 0x55, 0x54, 0x10, 0x07, 0x12, - 0x1f, 0x0a, 0x1b, 0x53, 0x45, 0x52, 0x56, 0x45, 0x52, 0x5f, 0x46, 0x41, 0x49, 0x4c, 0x45, 0x44, - 0x5f, 0x53, 0x57, 0x41, 0x50, 0x5f, 0x44, 0x45, 0x41, 0x44, 0x4c, 0x49, 0x4e, 0x45, 0x10, 0x08, - 0x12, 0x22, 0x0a, 0x1e, 0x53, 0x45, 0x52, 0x56, 0x45, 0x52, 0x5f, 0x46, 0x41, 0x49, 0x4c, 0x45, - 0x44, 0x5f, 0x48, 0x54, 0x4c, 0x43, 0x5f, 0x50, 0x55, 0x42, 0x4c, 0x49, 0x43, 0x41, 0x54, 0x49, - 0x4f, 0x4e, 0x10, 0x09, 0x12, 0x1c, 0x0a, 0x18, 0x53, 0x45, 0x52, 0x56, 0x45, 0x52, 0x5f, 0x54, - 0x49, 0x4d, 0x45, 0x4f, 0x55, 0x54, 0x5f, 0x50, 0x55, 0x42, 0x4c, 0x49, 0x53, 0x48, 0x45, 0x44, - 0x10, 0x0a, 0x12, 0x1d, 0x0a, 0x19, 0x53, 0x45, 0x52, 0x56, 0x45, 0x52, 0x5f, 0x55, 0x4e, 0x45, - 0x58, 0x50, 0x45, 0x43, 0x54, 0x45, 0x44, 0x5f, 0x46, 0x41, 0x49, 0x4c, 0x55, 0x52, 0x45, 0x10, - 0x0b, 0x12, 0x19, 0x0a, 0x15, 0x53, 0x45, 0x52, 0x56, 0x45, 0x52, 0x5f, 0x48, 0x54, 0x4c, 0x43, - 0x5f, 0x43, 0x4f, 0x4e, 0x46, 0x49, 0x52, 0x4d, 0x45, 0x44, 0x10, 0x0c, 0x12, 0x1f, 0x0a, 0x1b, - 0x53, 0x45, 0x52, 0x56, 0x45, 0x52, 0x5f, 0x43, 0x4c, 0x49, 0x45, 0x4e, 0x54, 0x5f, 0x50, 0x52, - 0x45, 0x50, 0x41, 0x59, 0x5f, 0x43, 0x41, 0x4e, 0x43, 0x45, 0x4c, 0x10, 0x0d, 0x12, 0x20, 0x0a, - 0x1c, 0x53, 0x45, 0x52, 0x56, 0x45, 0x52, 0x5f, 0x43, 0x4c, 0x49, 0x45, 0x4e, 0x54, 0x5f, 0x49, - 0x4e, 0x56, 0x4f, 0x49, 0x43, 0x45, 0x5f, 0x43, 0x41, 0x4e, 0x43, 0x45, 0x4c, 0x10, 0x0e, 0x12, - 0x27, 0x0a, 0x23, 0x53, 0x45, 0x52, 0x56, 0x45, 0x52, 0x5f, 0x46, 0x41, 0x49, 0x4c, 0x45, 0x44, - 0x5f, 0x4d, 0x55, 0x4c, 0x54, 0x49, 0x50, 0x4c, 0x45, 0x5f, 0x53, 0x57, 0x41, 0x50, 0x5f, 0x53, - 0x43, 0x52, 0x49, 0x50, 0x54, 0x53, 0x10, 0x0f, 0x12, 0x20, 0x0a, 0x1c, 0x53, 0x45, 0x52, 0x56, - 0x45, 0x52, 0x5f, 0x46, 0x41, 0x49, 0x4c, 0x45, 0x44, 0x5f, 0x49, 0x4e, 0x49, 0x54, 0x49, 0x41, - 0x4c, 0x49, 0x5a, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x10, 0x10, 0x2a, 0x4a, 0x0a, 0x10, 0x52, 0x6f, - 0x75, 0x74, 0x65, 0x50, 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x11, - 0x0a, 0x0d, 0x52, 0x4f, 0x55, 0x54, 0x45, 0x5f, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, - 0x00, 0x12, 0x10, 0x0a, 0x0c, 0x50, 0x52, 0x45, 0x50, 0x41, 0x59, 0x5f, 0x52, 0x4f, 0x55, 0x54, - 0x45, 0x10, 0x01, 0x12, 0x11, 0x0a, 0x0d, 0x49, 0x4e, 0x56, 0x4f, 0x49, 0x43, 0x45, 0x5f, 0x52, - 0x4f, 0x55, 0x54, 0x45, 0x10, 0x02, 0x2a, 0xf1, 0x01, 0x0a, 0x14, 0x50, 0x61, 0x79, 0x6d, 0x65, - 0x6e, 0x74, 0x46, 0x61, 0x69, 0x6c, 0x75, 0x72, 0x65, 0x52, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x12, - 0x1b, 0x0a, 0x17, 0x4c, 0x4e, 0x44, 0x5f, 0x46, 0x41, 0x49, 0x4c, 0x55, 0x52, 0x45, 0x5f, 0x52, - 0x45, 0x41, 0x53, 0x4f, 0x4e, 0x5f, 0x4e, 0x4f, 0x4e, 0x45, 0x10, 0x00, 0x12, 0x1e, 0x0a, 0x1a, - 0x4c, 0x4e, 0x44, 0x5f, 0x46, 0x41, 0x49, 0x4c, 0x55, 0x52, 0x45, 0x5f, 0x52, 0x45, 0x41, 0x53, - 0x4f, 0x4e, 0x5f, 0x54, 0x49, 0x4d, 0x45, 0x4f, 0x55, 0x54, 0x10, 0x01, 0x12, 0x1f, 0x0a, 0x1b, - 0x4c, 0x4e, 0x44, 0x5f, 0x46, 0x41, 0x49, 0x4c, 0x55, 0x52, 0x45, 0x5f, 0x52, 0x45, 0x41, 0x53, - 0x4f, 0x4e, 0x5f, 0x4e, 0x4f, 0x5f, 0x52, 0x4f, 0x55, 0x54, 0x45, 0x10, 0x02, 0x12, 0x1c, 0x0a, - 0x18, 0x4c, 0x4e, 0x44, 0x5f, 0x46, 0x41, 0x49, 0x4c, 0x55, 0x52, 0x45, 0x5f, 0x52, 0x45, 0x41, - 0x53, 0x4f, 0x4e, 0x5f, 0x45, 0x52, 0x52, 0x4f, 0x52, 0x10, 0x03, 0x12, 0x30, 0x0a, 0x2c, 0x4c, - 0x4e, 0x44, 0x5f, 0x46, 0x41, 0x49, 0x4c, 0x55, 0x52, 0x45, 0x5f, 0x52, 0x45, 0x41, 0x53, 0x4f, - 0x4e, 0x5f, 0x49, 0x4e, 0x43, 0x4f, 0x52, 0x52, 0x45, 0x43, 0x54, 0x5f, 0x50, 0x41, 0x59, 0x4d, - 0x45, 0x4e, 0x54, 0x5f, 0x44, 0x45, 0x54, 0x41, 0x49, 0x4c, 0x53, 0x10, 0x04, 0x12, 0x2b, 0x0a, - 0x27, 0x4c, 0x4e, 0x44, 0x5f, 0x46, 0x41, 0x49, 0x4c, 0x55, 0x52, 0x45, 0x5f, 0x52, 0x45, 0x41, - 0x53, 0x4f, 0x4e, 0x5f, 0x49, 0x4e, 0x53, 0x55, 0x46, 0x46, 0x49, 0x43, 0x49, 0x45, 0x4e, 0x54, - 0x5f, 0x42, 0x41, 0x4c, 0x41, 0x4e, 0x43, 0x45, 0x10, 0x05, 0x2a, 0x27, 0x0a, 0x0d, 0x52, 0x6f, - 0x75, 0x74, 0x69, 0x6e, 0x67, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x12, 0x08, 0x0a, 0x04, 0x4e, - 0x4f, 0x4e, 0x45, 0x10, 0x00, 0x12, 0x0c, 0x0a, 0x08, 0x4c, 0x4f, 0x57, 0x5f, 0x48, 0x49, 0x47, - 0x48, 0x10, 0x01, 0x2a, 0x26, 0x0a, 0x1c, 0x53, 0x74, 0x61, 0x74, 0x69, 0x63, 0x41, 0x64, 0x64, - 0x72, 0x65, 0x73, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x56, 0x65, 0x72, 0x73, - 0x69, 0x6f, 0x6e, 0x12, 0x06, 0x0a, 0x02, 0x56, 0x30, 0x10, 0x00, 0x32, 0xdc, 0x0a, 0x0a, 0x0a, - 0x53, 0x77, 0x61, 0x70, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x12, 0x4f, 0x0a, 0x0c, 0x4c, 0x6f, - 0x6f, 0x70, 0x4f, 0x75, 0x74, 0x54, 0x65, 0x72, 0x6d, 0x73, 0x12, 0x22, 0x2e, 0x6c, 0x6f, 0x6f, - 0x70, 0x72, 0x70, 0x63, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x4c, 0x6f, 0x6f, 0x70, 0x4f, - 0x75, 0x74, 0x54, 0x65, 0x72, 0x6d, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1b, - 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x4c, - 0x6f, 0x6f, 0x70, 0x4f, 0x75, 0x74, 0x54, 0x65, 0x72, 0x6d, 0x73, 0x12, 0x4f, 0x0a, 0x0e, 0x4e, - 0x65, 0x77, 0x4c, 0x6f, 0x6f, 0x70, 0x4f, 0x75, 0x74, 0x53, 0x77, 0x61, 0x70, 0x12, 0x1d, 0x2e, - 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x4c, 0x6f, - 0x6f, 0x70, 0x4f, 0x75, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1e, 0x2e, 0x6c, - 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x4c, 0x6f, 0x6f, - 0x70, 0x4f, 0x75, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x6c, 0x0a, 0x13, - 0x4c, 0x6f, 0x6f, 0x70, 0x4f, 0x75, 0x74, 0x50, 0x75, 0x73, 0x68, 0x50, 0x72, 0x65, 0x69, 0x6d, - 0x61, 0x67, 0x65, 0x12, 0x29, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x53, 0x65, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x8a, 0x01, 0x0a, 0x17, 0x53, 0x65, 0x72, 0x76, + 0x65, 0x72, 0x4e, 0x65, 0x77, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x12, 0x50, 0x0a, 0x10, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x5f, + 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x25, 0x2e, + 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x69, 0x63, 0x41, 0x64, + 0x64, 0x72, 0x65, 0x73, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x56, 0x65, 0x72, + 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x0f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x56, 0x65, + 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x1d, 0x0a, 0x0a, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x5f, + 0x6b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x63, 0x6c, 0x69, 0x65, 0x6e, + 0x74, 0x4b, 0x65, 0x79, 0x22, 0x54, 0x0a, 0x18, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x4e, 0x65, + 0x77, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x38, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x20, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, + 0x72, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, + 0x72, 0x73, 0x52, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x22, 0x50, 0x0a, 0x17, 0x53, 0x65, + 0x72, 0x76, 0x65, 0x72, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x50, 0x61, 0x72, 0x61, 0x6d, + 0x65, 0x74, 0x65, 0x72, 0x73, 0x12, 0x1d, 0x0a, 0x0a, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x5f, + 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x73, 0x65, 0x72, 0x76, 0x65, + 0x72, 0x4b, 0x65, 0x79, 0x12, 0x16, 0x0a, 0x06, 0x65, 0x78, 0x70, 0x69, 0x72, 0x79, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0d, 0x52, 0x06, 0x65, 0x78, 0x70, 0x69, 0x72, 0x79, 0x2a, 0xef, 0x01, 0x0a, + 0x0f, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, + 0x12, 0x0a, 0x0a, 0x06, 0x4c, 0x45, 0x47, 0x41, 0x43, 0x59, 0x10, 0x00, 0x12, 0x12, 0x0a, 0x0e, + 0x4d, 0x55, 0x4c, 0x54, 0x49, 0x5f, 0x4c, 0x4f, 0x4f, 0x50, 0x5f, 0x4f, 0x55, 0x54, 0x10, 0x01, + 0x12, 0x19, 0x0a, 0x15, 0x4e, 0x41, 0x54, 0x49, 0x56, 0x45, 0x5f, 0x53, 0x45, 0x47, 0x57, 0x49, + 0x54, 0x5f, 0x4c, 0x4f, 0x4f, 0x50, 0x5f, 0x49, 0x4e, 0x10, 0x02, 0x12, 0x1a, 0x0a, 0x16, 0x50, + 0x52, 0x45, 0x49, 0x4d, 0x41, 0x47, 0x45, 0x5f, 0x50, 0x55, 0x53, 0x48, 0x5f, 0x4c, 0x4f, 0x4f, + 0x50, 0x5f, 0x4f, 0x55, 0x54, 0x10, 0x03, 0x12, 0x18, 0x0a, 0x14, 0x55, 0x53, 0x45, 0x52, 0x5f, + 0x45, 0x58, 0x50, 0x49, 0x52, 0x59, 0x5f, 0x4c, 0x4f, 0x4f, 0x50, 0x5f, 0x4f, 0x55, 0x54, 0x10, + 0x04, 0x12, 0x0b, 0x0a, 0x07, 0x48, 0x54, 0x4c, 0x43, 0x5f, 0x56, 0x32, 0x10, 0x05, 0x12, 0x11, + 0x0a, 0x0d, 0x4d, 0x55, 0x4c, 0x54, 0x49, 0x5f, 0x4c, 0x4f, 0x4f, 0x50, 0x5f, 0x49, 0x4e, 0x10, + 0x06, 0x12, 0x13, 0x0a, 0x0f, 0x4c, 0x4f, 0x4f, 0x50, 0x5f, 0x4f, 0x55, 0x54, 0x5f, 0x43, 0x41, + 0x4e, 0x43, 0x45, 0x4c, 0x10, 0x07, 0x12, 0x09, 0x0a, 0x05, 0x50, 0x52, 0x4f, 0x42, 0x45, 0x10, + 0x08, 0x12, 0x12, 0x0a, 0x0e, 0x52, 0x4f, 0x55, 0x54, 0x49, 0x4e, 0x47, 0x5f, 0x50, 0x4c, 0x55, + 0x47, 0x49, 0x4e, 0x10, 0x09, 0x12, 0x0b, 0x0a, 0x07, 0x48, 0x54, 0x4c, 0x43, 0x5f, 0x56, 0x33, + 0x10, 0x0a, 0x12, 0x0a, 0x0a, 0x06, 0x4d, 0x55, 0x53, 0x49, 0x47, 0x32, 0x10, 0x0b, 0x2a, 0x9e, + 0x04, 0x0a, 0x0f, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x53, 0x77, 0x61, 0x70, 0x53, 0x74, 0x61, + 0x74, 0x65, 0x12, 0x14, 0x0a, 0x10, 0x53, 0x45, 0x52, 0x56, 0x45, 0x52, 0x5f, 0x49, 0x4e, 0x49, + 0x54, 0x49, 0x41, 0x54, 0x45, 0x44, 0x10, 0x00, 0x12, 0x19, 0x0a, 0x15, 0x53, 0x45, 0x52, 0x56, + 0x45, 0x52, 0x5f, 0x48, 0x54, 0x4c, 0x43, 0x5f, 0x50, 0x55, 0x42, 0x4c, 0x49, 0x53, 0x48, 0x45, + 0x44, 0x10, 0x01, 0x12, 0x12, 0x0a, 0x0e, 0x53, 0x45, 0x52, 0x56, 0x45, 0x52, 0x5f, 0x53, 0x55, + 0x43, 0x43, 0x45, 0x53, 0x53, 0x10, 0x02, 0x12, 0x19, 0x0a, 0x15, 0x53, 0x45, 0x52, 0x56, 0x45, + 0x52, 0x5f, 0x46, 0x41, 0x49, 0x4c, 0x45, 0x44, 0x5f, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, + 0x10, 0x03, 0x12, 0x19, 0x0a, 0x15, 0x53, 0x45, 0x52, 0x56, 0x45, 0x52, 0x5f, 0x46, 0x41, 0x49, + 0x4c, 0x45, 0x44, 0x5f, 0x4e, 0x4f, 0x5f, 0x48, 0x54, 0x4c, 0x43, 0x10, 0x04, 0x12, 0x25, 0x0a, + 0x21, 0x53, 0x45, 0x52, 0x56, 0x45, 0x52, 0x5f, 0x46, 0x41, 0x49, 0x4c, 0x45, 0x44, 0x5f, 0x49, + 0x4e, 0x56, 0x41, 0x4c, 0x49, 0x44, 0x5f, 0x48, 0x54, 0x4c, 0x43, 0x5f, 0x41, 0x4d, 0x4f, 0x55, + 0x4e, 0x54, 0x10, 0x05, 0x12, 0x23, 0x0a, 0x1f, 0x53, 0x45, 0x52, 0x56, 0x45, 0x52, 0x5f, 0x46, + 0x41, 0x49, 0x4c, 0x45, 0x44, 0x5f, 0x4f, 0x46, 0x46, 0x5f, 0x43, 0x48, 0x41, 0x49, 0x4e, 0x5f, + 0x54, 0x49, 0x4d, 0x45, 0x4f, 0x55, 0x54, 0x10, 0x06, 0x12, 0x19, 0x0a, 0x15, 0x53, 0x45, 0x52, + 0x56, 0x45, 0x52, 0x5f, 0x46, 0x41, 0x49, 0x4c, 0x45, 0x44, 0x5f, 0x54, 0x49, 0x4d, 0x45, 0x4f, + 0x55, 0x54, 0x10, 0x07, 0x12, 0x1f, 0x0a, 0x1b, 0x53, 0x45, 0x52, 0x56, 0x45, 0x52, 0x5f, 0x46, + 0x41, 0x49, 0x4c, 0x45, 0x44, 0x5f, 0x53, 0x57, 0x41, 0x50, 0x5f, 0x44, 0x45, 0x41, 0x44, 0x4c, + 0x49, 0x4e, 0x45, 0x10, 0x08, 0x12, 0x22, 0x0a, 0x1e, 0x53, 0x45, 0x52, 0x56, 0x45, 0x52, 0x5f, + 0x46, 0x41, 0x49, 0x4c, 0x45, 0x44, 0x5f, 0x48, 0x54, 0x4c, 0x43, 0x5f, 0x50, 0x55, 0x42, 0x4c, + 0x49, 0x43, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x10, 0x09, 0x12, 0x1c, 0x0a, 0x18, 0x53, 0x45, 0x52, + 0x56, 0x45, 0x52, 0x5f, 0x54, 0x49, 0x4d, 0x45, 0x4f, 0x55, 0x54, 0x5f, 0x50, 0x55, 0x42, 0x4c, + 0x49, 0x53, 0x48, 0x45, 0x44, 0x10, 0x0a, 0x12, 0x1d, 0x0a, 0x19, 0x53, 0x45, 0x52, 0x56, 0x45, + 0x52, 0x5f, 0x55, 0x4e, 0x45, 0x58, 0x50, 0x45, 0x43, 0x54, 0x45, 0x44, 0x5f, 0x46, 0x41, 0x49, + 0x4c, 0x55, 0x52, 0x45, 0x10, 0x0b, 0x12, 0x19, 0x0a, 0x15, 0x53, 0x45, 0x52, 0x56, 0x45, 0x52, + 0x5f, 0x48, 0x54, 0x4c, 0x43, 0x5f, 0x43, 0x4f, 0x4e, 0x46, 0x49, 0x52, 0x4d, 0x45, 0x44, 0x10, + 0x0c, 0x12, 0x1f, 0x0a, 0x1b, 0x53, 0x45, 0x52, 0x56, 0x45, 0x52, 0x5f, 0x43, 0x4c, 0x49, 0x45, + 0x4e, 0x54, 0x5f, 0x50, 0x52, 0x45, 0x50, 0x41, 0x59, 0x5f, 0x43, 0x41, 0x4e, 0x43, 0x45, 0x4c, + 0x10, 0x0d, 0x12, 0x20, 0x0a, 0x1c, 0x53, 0x45, 0x52, 0x56, 0x45, 0x52, 0x5f, 0x43, 0x4c, 0x49, + 0x45, 0x4e, 0x54, 0x5f, 0x49, 0x4e, 0x56, 0x4f, 0x49, 0x43, 0x45, 0x5f, 0x43, 0x41, 0x4e, 0x43, + 0x45, 0x4c, 0x10, 0x0e, 0x12, 0x27, 0x0a, 0x23, 0x53, 0x45, 0x52, 0x56, 0x45, 0x52, 0x5f, 0x46, + 0x41, 0x49, 0x4c, 0x45, 0x44, 0x5f, 0x4d, 0x55, 0x4c, 0x54, 0x49, 0x50, 0x4c, 0x45, 0x5f, 0x53, + 0x57, 0x41, 0x50, 0x5f, 0x53, 0x43, 0x52, 0x49, 0x50, 0x54, 0x53, 0x10, 0x0f, 0x12, 0x20, 0x0a, + 0x1c, 0x53, 0x45, 0x52, 0x56, 0x45, 0x52, 0x5f, 0x46, 0x41, 0x49, 0x4c, 0x45, 0x44, 0x5f, 0x49, + 0x4e, 0x49, 0x54, 0x49, 0x41, 0x4c, 0x49, 0x5a, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x10, 0x10, 0x2a, + 0x4a, 0x0a, 0x10, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x50, 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x54, + 0x79, 0x70, 0x65, 0x12, 0x11, 0x0a, 0x0d, 0x52, 0x4f, 0x55, 0x54, 0x45, 0x5f, 0x55, 0x4e, 0x4b, + 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x10, 0x0a, 0x0c, 0x50, 0x52, 0x45, 0x50, 0x41, 0x59, + 0x5f, 0x52, 0x4f, 0x55, 0x54, 0x45, 0x10, 0x01, 0x12, 0x11, 0x0a, 0x0d, 0x49, 0x4e, 0x56, 0x4f, + 0x49, 0x43, 0x45, 0x5f, 0x52, 0x4f, 0x55, 0x54, 0x45, 0x10, 0x02, 0x2a, 0xf1, 0x01, 0x0a, 0x14, + 0x50, 0x61, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x46, 0x61, 0x69, 0x6c, 0x75, 0x72, 0x65, 0x52, 0x65, + 0x61, 0x73, 0x6f, 0x6e, 0x12, 0x1b, 0x0a, 0x17, 0x4c, 0x4e, 0x44, 0x5f, 0x46, 0x41, 0x49, 0x4c, + 0x55, 0x52, 0x45, 0x5f, 0x52, 0x45, 0x41, 0x53, 0x4f, 0x4e, 0x5f, 0x4e, 0x4f, 0x4e, 0x45, 0x10, + 0x00, 0x12, 0x1e, 0x0a, 0x1a, 0x4c, 0x4e, 0x44, 0x5f, 0x46, 0x41, 0x49, 0x4c, 0x55, 0x52, 0x45, + 0x5f, 0x52, 0x45, 0x41, 0x53, 0x4f, 0x4e, 0x5f, 0x54, 0x49, 0x4d, 0x45, 0x4f, 0x55, 0x54, 0x10, + 0x01, 0x12, 0x1f, 0x0a, 0x1b, 0x4c, 0x4e, 0x44, 0x5f, 0x46, 0x41, 0x49, 0x4c, 0x55, 0x52, 0x45, + 0x5f, 0x52, 0x45, 0x41, 0x53, 0x4f, 0x4e, 0x5f, 0x4e, 0x4f, 0x5f, 0x52, 0x4f, 0x55, 0x54, 0x45, + 0x10, 0x02, 0x12, 0x1c, 0x0a, 0x18, 0x4c, 0x4e, 0x44, 0x5f, 0x46, 0x41, 0x49, 0x4c, 0x55, 0x52, + 0x45, 0x5f, 0x52, 0x45, 0x41, 0x53, 0x4f, 0x4e, 0x5f, 0x45, 0x52, 0x52, 0x4f, 0x52, 0x10, 0x03, + 0x12, 0x30, 0x0a, 0x2c, 0x4c, 0x4e, 0x44, 0x5f, 0x46, 0x41, 0x49, 0x4c, 0x55, 0x52, 0x45, 0x5f, + 0x52, 0x45, 0x41, 0x53, 0x4f, 0x4e, 0x5f, 0x49, 0x4e, 0x43, 0x4f, 0x52, 0x52, 0x45, 0x43, 0x54, + 0x5f, 0x50, 0x41, 0x59, 0x4d, 0x45, 0x4e, 0x54, 0x5f, 0x44, 0x45, 0x54, 0x41, 0x49, 0x4c, 0x53, + 0x10, 0x04, 0x12, 0x2b, 0x0a, 0x27, 0x4c, 0x4e, 0x44, 0x5f, 0x46, 0x41, 0x49, 0x4c, 0x55, 0x52, + 0x45, 0x5f, 0x52, 0x45, 0x41, 0x53, 0x4f, 0x4e, 0x5f, 0x49, 0x4e, 0x53, 0x55, 0x46, 0x46, 0x49, + 0x43, 0x49, 0x45, 0x4e, 0x54, 0x5f, 0x42, 0x41, 0x4c, 0x41, 0x4e, 0x43, 0x45, 0x10, 0x05, 0x2a, + 0x27, 0x0a, 0x0d, 0x52, 0x6f, 0x75, 0x74, 0x69, 0x6e, 0x67, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, + 0x12, 0x08, 0x0a, 0x04, 0x4e, 0x4f, 0x4e, 0x45, 0x10, 0x00, 0x12, 0x0c, 0x0a, 0x08, 0x4c, 0x4f, + 0x57, 0x5f, 0x48, 0x49, 0x47, 0x48, 0x10, 0x01, 0x2a, 0x26, 0x0a, 0x1c, 0x53, 0x74, 0x61, 0x74, + 0x69, 0x63, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, + 0x6c, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x06, 0x0a, 0x02, 0x56, 0x30, 0x10, 0x00, + 0x32, 0xdc, 0x0a, 0x0a, 0x0a, 0x53, 0x77, 0x61, 0x70, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x12, + 0x4f, 0x0a, 0x0c, 0x4c, 0x6f, 0x6f, 0x70, 0x4f, 0x75, 0x74, 0x54, 0x65, 0x72, 0x6d, 0x73, 0x12, + 0x22, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, + 0x4c, 0x6f, 0x6f, 0x70, 0x4f, 0x75, 0x74, 0x54, 0x65, 0x72, 0x6d, 0x73, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x1b, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x53, 0x65, + 0x72, 0x76, 0x65, 0x72, 0x4c, 0x6f, 0x6f, 0x70, 0x4f, 0x75, 0x74, 0x54, 0x65, 0x72, 0x6d, 0x73, + 0x12, 0x4f, 0x0a, 0x0e, 0x4e, 0x65, 0x77, 0x4c, 0x6f, 0x6f, 0x70, 0x4f, 0x75, 0x74, 0x53, 0x77, + 0x61, 0x70, 0x12, 0x1d, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x53, 0x65, 0x72, + 0x76, 0x65, 0x72, 0x4c, 0x6f, 0x6f, 0x70, 0x4f, 0x75, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x1e, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x53, 0x65, 0x72, 0x76, + 0x65, 0x72, 0x4c, 0x6f, 0x6f, 0x70, 0x4f, 0x75, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x6c, 0x0a, 0x13, 0x4c, 0x6f, 0x6f, 0x70, 0x4f, 0x75, 0x74, 0x50, 0x75, 0x73, 0x68, + 0x50, 0x72, 0x65, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x12, 0x29, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, + 0x70, 0x63, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x4c, 0x6f, 0x6f, 0x70, 0x4f, 0x75, 0x74, + 0x50, 0x75, 0x73, 0x68, 0x50, 0x72, 0x65, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x2a, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x4c, 0x6f, 0x6f, 0x70, 0x4f, 0x75, 0x74, 0x50, 0x75, 0x73, 0x68, 0x50, - 0x72, 0x65, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2a, - 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x4c, - 0x6f, 0x6f, 0x70, 0x4f, 0x75, 0x74, 0x50, 0x75, 0x73, 0x68, 0x50, 0x72, 0x65, 0x69, 0x6d, 0x61, - 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4f, 0x0a, 0x0c, 0x4c, 0x6f, - 0x6f, 0x70, 0x4f, 0x75, 0x74, 0x51, 0x75, 0x6f, 0x74, 0x65, 0x12, 0x22, 0x2e, 0x6c, 0x6f, 0x6f, - 0x70, 0x72, 0x70, 0x63, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x4c, 0x6f, 0x6f, 0x70, 0x4f, - 0x75, 0x74, 0x51, 0x75, 0x6f, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1b, - 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x4c, - 0x6f, 0x6f, 0x70, 0x4f, 0x75, 0x74, 0x51, 0x75, 0x6f, 0x74, 0x65, 0x12, 0x4c, 0x0a, 0x0b, 0x4c, - 0x6f, 0x6f, 0x70, 0x49, 0x6e, 0x54, 0x65, 0x72, 0x6d, 0x73, 0x12, 0x21, 0x2e, 0x6c, 0x6f, 0x6f, - 0x70, 0x72, 0x70, 0x63, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x4c, 0x6f, 0x6f, 0x70, 0x49, - 0x6e, 0x54, 0x65, 0x72, 0x6d, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1a, 0x2e, - 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x4c, 0x6f, - 0x6f, 0x70, 0x49, 0x6e, 0x54, 0x65, 0x72, 0x6d, 0x73, 0x12, 0x4c, 0x0a, 0x0d, 0x4e, 0x65, 0x77, - 0x4c, 0x6f, 0x6f, 0x70, 0x49, 0x6e, 0x53, 0x77, 0x61, 0x70, 0x12, 0x1c, 0x2e, 0x6c, 0x6f, 0x6f, - 0x70, 0x72, 0x70, 0x63, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x4c, 0x6f, 0x6f, 0x70, 0x49, - 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, - 0x70, 0x63, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x4c, 0x6f, 0x6f, 0x70, 0x49, 0x6e, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x54, 0x0a, 0x0b, 0x4c, 0x6f, 0x6f, 0x70, 0x49, - 0x6e, 0x51, 0x75, 0x6f, 0x74, 0x65, 0x12, 0x21, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, - 0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x4c, 0x6f, 0x6f, 0x70, 0x49, 0x6e, 0x51, 0x75, 0x6f, - 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x22, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, - 0x72, 0x70, 0x63, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x4c, 0x6f, 0x6f, 0x70, 0x49, 0x6e, - 0x51, 0x75, 0x6f, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x67, 0x0a, - 0x17, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x4c, 0x6f, 0x6f, 0x70, 0x4f, 0x75, - 0x74, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x73, 0x12, 0x20, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, - 0x70, 0x63, 0x2e, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x55, 0x70, 0x64, 0x61, - 0x74, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x28, 0x2e, 0x6c, 0x6f, 0x6f, - 0x70, 0x72, 0x70, 0x63, 0x2e, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x4c, 0x6f, - 0x6f, 0x70, 0x4f, 0x75, 0x74, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x30, 0x01, 0x12, 0x65, 0x0a, 0x16, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, - 0x69, 0x62, 0x65, 0x4c, 0x6f, 0x6f, 0x70, 0x49, 0x6e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x73, - 0x12, 0x20, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x53, 0x75, 0x62, 0x73, 0x63, - 0x72, 0x69, 0x62, 0x65, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x1a, 0x27, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x53, 0x75, 0x62, - 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x4c, 0x6f, 0x6f, 0x70, 0x49, 0x6e, 0x55, 0x70, 0x64, 0x61, - 0x74, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x30, 0x01, 0x12, 0x5a, 0x0a, - 0x11, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x4c, 0x6f, 0x6f, 0x70, 0x4f, 0x75, 0x74, 0x53, 0x77, - 0x61, 0x70, 0x12, 0x21, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x43, 0x61, 0x6e, - 0x63, 0x65, 0x6c, 0x4c, 0x6f, 0x6f, 0x70, 0x4f, 0x75, 0x74, 0x53, 0x77, 0x61, 0x70, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x22, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, - 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x4c, 0x6f, 0x6f, 0x70, 0x4f, 0x75, 0x74, 0x53, 0x77, 0x61, - 0x70, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x42, 0x0a, 0x05, 0x50, 0x72, 0x6f, - 0x62, 0x65, 0x12, 0x1b, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x53, 0x65, 0x72, - 0x76, 0x65, 0x72, 0x50, 0x72, 0x6f, 0x62, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x72, 0x65, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, + 0x4f, 0x0a, 0x0c, 0x4c, 0x6f, 0x6f, 0x70, 0x4f, 0x75, 0x74, 0x51, 0x75, 0x6f, 0x74, 0x65, 0x12, + 0x22, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, + 0x4c, 0x6f, 0x6f, 0x70, 0x4f, 0x75, 0x74, 0x51, 0x75, 0x6f, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x1b, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x53, 0x65, + 0x72, 0x76, 0x65, 0x72, 0x4c, 0x6f, 0x6f, 0x70, 0x4f, 0x75, 0x74, 0x51, 0x75, 0x6f, 0x74, 0x65, + 0x12, 0x4c, 0x0a, 0x0b, 0x4c, 0x6f, 0x6f, 0x70, 0x49, 0x6e, 0x54, 0x65, 0x72, 0x6d, 0x73, 0x12, + 0x21, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, + 0x4c, 0x6f, 0x6f, 0x70, 0x49, 0x6e, 0x54, 0x65, 0x72, 0x6d, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x1a, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x53, 0x65, 0x72, + 0x76, 0x65, 0x72, 0x4c, 0x6f, 0x6f, 0x70, 0x49, 0x6e, 0x54, 0x65, 0x72, 0x6d, 0x73, 0x12, 0x4c, + 0x0a, 0x0d, 0x4e, 0x65, 0x77, 0x4c, 0x6f, 0x6f, 0x70, 0x49, 0x6e, 0x53, 0x77, 0x61, 0x70, 0x12, 0x1c, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, - 0x50, 0x72, 0x6f, 0x62, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x60, 0x0a, - 0x16, 0x52, 0x65, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x64, 0x52, 0x6f, 0x75, 0x74, 0x69, 0x6e, - 0x67, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x12, 0x22, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, - 0x63, 0x2e, 0x52, 0x65, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x64, 0x52, 0x6f, 0x75, 0x74, 0x69, - 0x6e, 0x67, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x71, 0x1a, 0x22, 0x2e, 0x6c, 0x6f, - 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x52, 0x65, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x64, 0x52, - 0x6f, 0x75, 0x74, 0x69, 0x6e, 0x67, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x73, 0x12, - 0x57, 0x0a, 0x13, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x52, 0x6f, 0x75, 0x74, 0x69, 0x6e, 0x67, - 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x1f, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, - 0x2e, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x52, 0x6f, 0x75, 0x74, 0x69, 0x6e, 0x67, 0x52, 0x65, - 0x73, 0x75, 0x6c, 0x74, 0x52, 0x65, 0x71, 0x1a, 0x1f, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, - 0x63, 0x2e, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x52, 0x6f, 0x75, 0x74, 0x69, 0x6e, 0x67, 0x52, - 0x65, 0x73, 0x75, 0x6c, 0x74, 0x52, 0x65, 0x73, 0x12, 0x4b, 0x0a, 0x0f, 0x4d, 0x75, 0x53, 0x69, - 0x67, 0x32, 0x53, 0x69, 0x67, 0x6e, 0x53, 0x77, 0x65, 0x65, 0x70, 0x12, 0x1b, 0x2e, 0x6c, 0x6f, - 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x4d, 0x75, 0x53, 0x69, 0x67, 0x32, 0x53, 0x69, 0x67, 0x6e, - 0x53, 0x77, 0x65, 0x65, 0x70, 0x52, 0x65, 0x71, 0x1a, 0x1b, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, - 0x70, 0x63, 0x2e, 0x4d, 0x75, 0x53, 0x69, 0x67, 0x32, 0x53, 0x69, 0x67, 0x6e, 0x53, 0x77, 0x65, - 0x65, 0x70, 0x52, 0x65, 0x73, 0x12, 0x3f, 0x0a, 0x07, 0x50, 0x75, 0x73, 0x68, 0x4b, 0x65, 0x79, - 0x12, 0x19, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, - 0x72, 0x50, 0x75, 0x73, 0x68, 0x4b, 0x65, 0x79, 0x52, 0x65, 0x71, 0x1a, 0x19, 0x2e, 0x6c, 0x6f, - 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x50, 0x75, 0x73, 0x68, - 0x4b, 0x65, 0x79, 0x52, 0x65, 0x73, 0x12, 0x42, 0x0a, 0x09, 0x46, 0x65, 0x74, 0x63, 0x68, 0x4c, - 0x34, 0x30, 0x32, 0x12, 0x19, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x46, 0x65, - 0x74, 0x63, 0x68, 0x4c, 0x34, 0x30, 0x32, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1a, - 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x46, 0x65, 0x74, 0x63, 0x68, 0x4c, 0x34, - 0x30, 0x32, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x2d, 0x5a, 0x2b, 0x67, 0x69, - 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6c, 0x69, 0x67, 0x68, 0x74, 0x6e, 0x69, - 0x6e, 0x67, 0x6c, 0x61, 0x62, 0x73, 0x2f, 0x6c, 0x6f, 0x6f, 0x70, 0x2f, 0x73, 0x77, 0x61, 0x70, - 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x72, 0x70, 0x63, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x33, + 0x4c, 0x6f, 0x6f, 0x70, 0x49, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, + 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x4c, 0x6f, + 0x6f, 0x70, 0x49, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x54, 0x0a, 0x0b, + 0x4c, 0x6f, 0x6f, 0x70, 0x49, 0x6e, 0x51, 0x75, 0x6f, 0x74, 0x65, 0x12, 0x21, 0x2e, 0x6c, 0x6f, + 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x4c, 0x6f, 0x6f, 0x70, + 0x49, 0x6e, 0x51, 0x75, 0x6f, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x22, + 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x4c, + 0x6f, 0x6f, 0x70, 0x49, 0x6e, 0x51, 0x75, 0x6f, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x12, 0x67, 0x0a, 0x17, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x4c, + 0x6f, 0x6f, 0x70, 0x4f, 0x75, 0x74, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x73, 0x12, 0x20, 0x2e, + 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, + 0x65, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x28, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, + 0x69, 0x62, 0x65, 0x4c, 0x6f, 0x6f, 0x70, 0x4f, 0x75, 0x74, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, + 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x30, 0x01, 0x12, 0x65, 0x0a, 0x16, 0x53, + 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x4c, 0x6f, 0x6f, 0x70, 0x49, 0x6e, 0x55, 0x70, + 0x64, 0x61, 0x74, 0x65, 0x73, 0x12, 0x20, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, + 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x73, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x27, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, + 0x63, 0x2e, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x4c, 0x6f, 0x6f, 0x70, 0x49, + 0x6e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x30, 0x01, 0x12, 0x5a, 0x0a, 0x11, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x4c, 0x6f, 0x6f, 0x70, + 0x4f, 0x75, 0x74, 0x53, 0x77, 0x61, 0x70, 0x12, 0x21, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, + 0x63, 0x2e, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x4c, 0x6f, 0x6f, 0x70, 0x4f, 0x75, 0x74, 0x53, + 0x77, 0x61, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x22, 0x2e, 0x6c, 0x6f, 0x6f, + 0x70, 0x72, 0x70, 0x63, 0x2e, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x4c, 0x6f, 0x6f, 0x70, 0x4f, + 0x75, 0x74, 0x53, 0x77, 0x61, 0x70, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x42, + 0x0a, 0x05, 0x50, 0x72, 0x6f, 0x62, 0x65, 0x12, 0x1b, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, + 0x63, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x50, 0x72, 0x6f, 0x62, 0x65, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x53, + 0x65, 0x72, 0x76, 0x65, 0x72, 0x50, 0x72, 0x6f, 0x62, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x12, 0x60, 0x0a, 0x16, 0x52, 0x65, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x64, 0x52, + 0x6f, 0x75, 0x74, 0x69, 0x6e, 0x67, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x12, 0x22, 0x2e, 0x6c, + 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x52, 0x65, 0x63, 0x6f, 0x6d, 0x6d, 0x65, 0x6e, 0x64, + 0x52, 0x6f, 0x75, 0x74, 0x69, 0x6e, 0x67, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x71, + 0x1a, 0x22, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x52, 0x65, 0x63, 0x6f, 0x6d, + 0x6d, 0x65, 0x6e, 0x64, 0x52, 0x6f, 0x75, 0x74, 0x69, 0x6e, 0x67, 0x50, 0x6c, 0x75, 0x67, 0x69, + 0x6e, 0x52, 0x65, 0x73, 0x12, 0x57, 0x0a, 0x13, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x52, 0x6f, + 0x75, 0x74, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x1f, 0x2e, 0x6c, 0x6f, + 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x52, 0x6f, 0x75, 0x74, + 0x69, 0x6e, 0x67, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x52, 0x65, 0x71, 0x1a, 0x1f, 0x2e, 0x6c, + 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x52, 0x6f, 0x75, + 0x74, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x52, 0x65, 0x73, 0x12, 0x4b, 0x0a, + 0x0f, 0x4d, 0x75, 0x53, 0x69, 0x67, 0x32, 0x53, 0x69, 0x67, 0x6e, 0x53, 0x77, 0x65, 0x65, 0x70, + 0x12, 0x1b, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x4d, 0x75, 0x53, 0x69, 0x67, + 0x32, 0x53, 0x69, 0x67, 0x6e, 0x53, 0x77, 0x65, 0x65, 0x70, 0x52, 0x65, 0x71, 0x1a, 0x1b, 0x2e, + 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x4d, 0x75, 0x53, 0x69, 0x67, 0x32, 0x53, 0x69, + 0x67, 0x6e, 0x53, 0x77, 0x65, 0x65, 0x70, 0x52, 0x65, 0x73, 0x12, 0x3f, 0x0a, 0x07, 0x50, 0x75, + 0x73, 0x68, 0x4b, 0x65, 0x79, 0x12, 0x19, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, + 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x50, 0x75, 0x73, 0x68, 0x4b, 0x65, 0x79, 0x52, 0x65, 0x71, + 0x1a, 0x19, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, + 0x72, 0x50, 0x75, 0x73, 0x68, 0x4b, 0x65, 0x79, 0x52, 0x65, 0x73, 0x12, 0x42, 0x0a, 0x09, 0x46, + 0x65, 0x74, 0x63, 0x68, 0x4c, 0x34, 0x30, 0x32, 0x12, 0x19, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, + 0x70, 0x63, 0x2e, 0x46, 0x65, 0x74, 0x63, 0x68, 0x4c, 0x34, 0x30, 0x32, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x1a, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x46, 0x65, + 0x74, 0x63, 0x68, 0x4c, 0x34, 0x30, 0x32, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, + 0x6e, 0x0a, 0x13, 0x53, 0x74, 0x61, 0x74, 0x69, 0x63, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, + 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x12, 0x57, 0x0a, 0x10, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, + 0x4e, 0x65, 0x77, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x20, 0x2e, 0x6c, 0x6f, 0x6f, + 0x70, 0x72, 0x70, 0x63, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x4e, 0x65, 0x77, 0x41, 0x64, + 0x64, 0x72, 0x65, 0x73, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x21, 0x2e, 0x6c, + 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x4e, 0x65, 0x77, + 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, + 0x2d, 0x5a, 0x2b, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6c, 0x69, + 0x67, 0x68, 0x74, 0x6e, 0x69, 0x6e, 0x67, 0x6c, 0x61, 0x62, 0x73, 0x2f, 0x6c, 0x6f, 0x6f, 0x70, + 0x2f, 0x73, 0x77, 0x61, 0x70, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x72, 0x70, 0x63, 0x62, 0x06, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -3307,7 +3494,7 @@ func file_server_proto_rawDescGZIP() []byte { } var file_server_proto_enumTypes = make([]protoimpl.EnumInfo, 6) -var file_server_proto_msgTypes = make([]protoimpl.MessageInfo, 34) +var file_server_proto_msgTypes = make([]protoimpl.MessageInfo, 37) var file_server_proto_goTypes = []interface{}{ (ProtocolVersion)(0), // 0: looprpc.ProtocolVersion (ServerSwapState)(0), // 1: looprpc.ServerSwapState @@ -3349,14 +3536,17 @@ var file_server_proto_goTypes = []interface{}{ (*ServerPushKeyRes)(nil), // 37: looprpc.ServerPushKeyRes (*FetchL402Request)(nil), // 38: looprpc.FetchL402Request (*FetchL402Response)(nil), // 39: looprpc.FetchL402Response - (*RouteHint)(nil), // 40: looprpc.RouteHint + (*ServerNewAddressRequest)(nil), // 40: looprpc.ServerNewAddressRequest + (*ServerNewAddressResponse)(nil), // 41: looprpc.ServerNewAddressResponse + (*ServerAddressParameters)(nil), // 42: looprpc.ServerAddressParameters + (*RouteHint)(nil), // 43: looprpc.RouteHint } var file_server_proto_depIdxs = []int32{ 0, // 0: looprpc.ServerLoopOutRequest.protocol_version:type_name -> looprpc.ProtocolVersion 0, // 1: looprpc.ServerLoopOutQuoteRequest.protocol_version:type_name -> looprpc.ProtocolVersion 0, // 2: looprpc.ServerLoopOutTermsRequest.protocol_version:type_name -> looprpc.ProtocolVersion 0, // 3: looprpc.ServerLoopInRequest.protocol_version:type_name -> looprpc.ProtocolVersion - 40, // 4: looprpc.ServerLoopInQuoteRequest.route_hints:type_name -> looprpc.RouteHint + 43, // 4: looprpc.ServerLoopInQuoteRequest.route_hints:type_name -> looprpc.RouteHint 0, // 5: looprpc.ServerLoopInQuoteRequest.protocol_version:type_name -> looprpc.ProtocolVersion 0, // 6: looprpc.ServerLoopInTermsRequest.protocol_version:type_name -> looprpc.ProtocolVersion 0, // 7: looprpc.ServerLoopOutPushPreimageRequest.protocol_version:type_name -> looprpc.ProtocolVersion @@ -3369,7 +3559,7 @@ var file_server_proto_depIdxs = []int32{ 0, // 14: looprpc.CancelLoopOutSwapRequest.protocol_version:type_name -> looprpc.ProtocolVersion 23, // 15: looprpc.CancelLoopOutSwapRequest.route_cancel:type_name -> looprpc.RouteCancel 0, // 16: looprpc.ServerProbeRequest.protocol_version:type_name -> looprpc.ProtocolVersion - 40, // 17: looprpc.ServerProbeRequest.route_hints:type_name -> looprpc.RouteHint + 43, // 17: looprpc.ServerProbeRequest.route_hints:type_name -> looprpc.RouteHint 0, // 18: looprpc.RecommendRoutingPluginReq.protocol_version:type_name -> looprpc.ProtocolVersion 4, // 19: looprpc.RecommendRoutingPluginRes.plugin:type_name -> looprpc.RoutingPlugin 0, // 20: looprpc.ReportRoutingResultReq.protocol_version:type_name -> looprpc.ProtocolVersion @@ -3377,43 +3567,47 @@ var file_server_proto_depIdxs = []int32{ 0, // 22: looprpc.MuSig2SignSweepReq.protocol_version:type_name -> looprpc.ProtocolVersion 34, // 23: looprpc.MuSig2SignSweepReq.prevout_info:type_name -> looprpc.PrevoutInfo 0, // 24: looprpc.ServerPushKeyReq.protocol_version:type_name -> looprpc.ProtocolVersion - 10, // 25: looprpc.SwapServer.LoopOutTerms:input_type -> looprpc.ServerLoopOutTermsRequest - 6, // 26: looprpc.SwapServer.NewLoopOutSwap:input_type -> looprpc.ServerLoopOutRequest - 18, // 27: looprpc.SwapServer.LoopOutPushPreimage:input_type -> looprpc.ServerLoopOutPushPreimageRequest - 8, // 28: looprpc.SwapServer.LoopOutQuote:input_type -> looprpc.ServerLoopOutQuoteRequest - 16, // 29: looprpc.SwapServer.LoopInTerms:input_type -> looprpc.ServerLoopInTermsRequest - 12, // 30: looprpc.SwapServer.NewLoopInSwap:input_type -> looprpc.ServerLoopInRequest - 14, // 31: looprpc.SwapServer.LoopInQuote:input_type -> looprpc.ServerLoopInQuoteRequest - 20, // 32: looprpc.SwapServer.SubscribeLoopOutUpdates:input_type -> looprpc.SubscribeUpdatesRequest - 20, // 33: looprpc.SwapServer.SubscribeLoopInUpdates:input_type -> looprpc.SubscribeUpdatesRequest - 25, // 34: looprpc.SwapServer.CancelLoopOutSwap:input_type -> looprpc.CancelLoopOutSwapRequest - 27, // 35: looprpc.SwapServer.Probe:input_type -> looprpc.ServerProbeRequest - 29, // 36: looprpc.SwapServer.RecommendRoutingPlugin:input_type -> looprpc.RecommendRoutingPluginReq - 31, // 37: looprpc.SwapServer.ReportRoutingResult:input_type -> looprpc.ReportRoutingResultReq - 33, // 38: looprpc.SwapServer.MuSig2SignSweep:input_type -> looprpc.MuSig2SignSweepReq - 36, // 39: looprpc.SwapServer.PushKey:input_type -> looprpc.ServerPushKeyReq - 38, // 40: looprpc.SwapServer.FetchL402:input_type -> looprpc.FetchL402Request - 11, // 41: looprpc.SwapServer.LoopOutTerms:output_type -> looprpc.ServerLoopOutTerms - 7, // 42: looprpc.SwapServer.NewLoopOutSwap:output_type -> looprpc.ServerLoopOutResponse - 19, // 43: looprpc.SwapServer.LoopOutPushPreimage:output_type -> looprpc.ServerLoopOutPushPreimageResponse - 9, // 44: looprpc.SwapServer.LoopOutQuote:output_type -> looprpc.ServerLoopOutQuote - 17, // 45: looprpc.SwapServer.LoopInTerms:output_type -> looprpc.ServerLoopInTerms - 13, // 46: looprpc.SwapServer.NewLoopInSwap:output_type -> looprpc.ServerLoopInResponse - 15, // 47: looprpc.SwapServer.LoopInQuote:output_type -> looprpc.ServerLoopInQuoteResponse - 21, // 48: looprpc.SwapServer.SubscribeLoopOutUpdates:output_type -> looprpc.SubscribeLoopOutUpdatesResponse - 22, // 49: looprpc.SwapServer.SubscribeLoopInUpdates:output_type -> looprpc.SubscribeLoopInUpdatesResponse - 26, // 50: looprpc.SwapServer.CancelLoopOutSwap:output_type -> looprpc.CancelLoopOutSwapResponse - 28, // 51: looprpc.SwapServer.Probe:output_type -> looprpc.ServerProbeResponse - 30, // 52: looprpc.SwapServer.RecommendRoutingPlugin:output_type -> looprpc.RecommendRoutingPluginRes - 32, // 53: looprpc.SwapServer.ReportRoutingResult:output_type -> looprpc.ReportRoutingResultRes - 35, // 54: looprpc.SwapServer.MuSig2SignSweep:output_type -> looprpc.MuSig2SignSweepRes - 37, // 55: looprpc.SwapServer.PushKey:output_type -> looprpc.ServerPushKeyRes - 39, // 56: looprpc.SwapServer.FetchL402:output_type -> looprpc.FetchL402Response - 41, // [41:57] is the sub-list for method output_type - 25, // [25:41] is the sub-list for method input_type - 25, // [25:25] is the sub-list for extension type_name - 25, // [25:25] is the sub-list for extension extendee - 0, // [0:25] is the sub-list for field type_name + 5, // 25: looprpc.ServerNewAddressRequest.protocol_version:type_name -> looprpc.StaticAddressProtocolVersion + 42, // 26: looprpc.ServerNewAddressResponse.params:type_name -> looprpc.ServerAddressParameters + 10, // 27: looprpc.SwapServer.LoopOutTerms:input_type -> looprpc.ServerLoopOutTermsRequest + 6, // 28: looprpc.SwapServer.NewLoopOutSwap:input_type -> looprpc.ServerLoopOutRequest + 18, // 29: looprpc.SwapServer.LoopOutPushPreimage:input_type -> looprpc.ServerLoopOutPushPreimageRequest + 8, // 30: looprpc.SwapServer.LoopOutQuote:input_type -> looprpc.ServerLoopOutQuoteRequest + 16, // 31: looprpc.SwapServer.LoopInTerms:input_type -> looprpc.ServerLoopInTermsRequest + 12, // 32: looprpc.SwapServer.NewLoopInSwap:input_type -> looprpc.ServerLoopInRequest + 14, // 33: looprpc.SwapServer.LoopInQuote:input_type -> looprpc.ServerLoopInQuoteRequest + 20, // 34: looprpc.SwapServer.SubscribeLoopOutUpdates:input_type -> looprpc.SubscribeUpdatesRequest + 20, // 35: looprpc.SwapServer.SubscribeLoopInUpdates:input_type -> looprpc.SubscribeUpdatesRequest + 25, // 36: looprpc.SwapServer.CancelLoopOutSwap:input_type -> looprpc.CancelLoopOutSwapRequest + 27, // 37: looprpc.SwapServer.Probe:input_type -> looprpc.ServerProbeRequest + 29, // 38: looprpc.SwapServer.RecommendRoutingPlugin:input_type -> looprpc.RecommendRoutingPluginReq + 31, // 39: looprpc.SwapServer.ReportRoutingResult:input_type -> looprpc.ReportRoutingResultReq + 33, // 40: looprpc.SwapServer.MuSig2SignSweep:input_type -> looprpc.MuSig2SignSweepReq + 36, // 41: looprpc.SwapServer.PushKey:input_type -> looprpc.ServerPushKeyReq + 38, // 42: looprpc.SwapServer.FetchL402:input_type -> looprpc.FetchL402Request + 40, // 43: looprpc.StaticAddressServer.ServerNewAddress:input_type -> looprpc.ServerNewAddressRequest + 11, // 44: looprpc.SwapServer.LoopOutTerms:output_type -> looprpc.ServerLoopOutTerms + 7, // 45: looprpc.SwapServer.NewLoopOutSwap:output_type -> looprpc.ServerLoopOutResponse + 19, // 46: looprpc.SwapServer.LoopOutPushPreimage:output_type -> looprpc.ServerLoopOutPushPreimageResponse + 9, // 47: looprpc.SwapServer.LoopOutQuote:output_type -> looprpc.ServerLoopOutQuote + 17, // 48: looprpc.SwapServer.LoopInTerms:output_type -> looprpc.ServerLoopInTerms + 13, // 49: looprpc.SwapServer.NewLoopInSwap:output_type -> looprpc.ServerLoopInResponse + 15, // 50: looprpc.SwapServer.LoopInQuote:output_type -> looprpc.ServerLoopInQuoteResponse + 21, // 51: looprpc.SwapServer.SubscribeLoopOutUpdates:output_type -> looprpc.SubscribeLoopOutUpdatesResponse + 22, // 52: looprpc.SwapServer.SubscribeLoopInUpdates:output_type -> looprpc.SubscribeLoopInUpdatesResponse + 26, // 53: looprpc.SwapServer.CancelLoopOutSwap:output_type -> looprpc.CancelLoopOutSwapResponse + 28, // 54: looprpc.SwapServer.Probe:output_type -> looprpc.ServerProbeResponse + 30, // 55: looprpc.SwapServer.RecommendRoutingPlugin:output_type -> looprpc.RecommendRoutingPluginRes + 32, // 56: looprpc.SwapServer.ReportRoutingResult:output_type -> looprpc.ReportRoutingResultRes + 35, // 57: looprpc.SwapServer.MuSig2SignSweep:output_type -> looprpc.MuSig2SignSweepRes + 37, // 58: looprpc.SwapServer.PushKey:output_type -> looprpc.ServerPushKeyRes + 39, // 59: looprpc.SwapServer.FetchL402:output_type -> looprpc.FetchL402Response + 41, // 60: looprpc.StaticAddressServer.ServerNewAddress:output_type -> looprpc.ServerNewAddressResponse + 44, // [44:61] is the sub-list for method output_type + 27, // [27:44] is the sub-list for method input_type + 27, // [27:27] is the sub-list for extension type_name + 27, // [27:27] is the sub-list for extension extendee + 0, // [0:27] is the sub-list for field type_name } func init() { file_server_proto_init() } @@ -3831,6 +4025,42 @@ func file_server_proto_init() { return nil } } + file_server_proto_msgTypes[34].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ServerNewAddressRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_server_proto_msgTypes[35].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ServerNewAddressResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_server_proto_msgTypes[36].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ServerAddressParameters); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } } file_server_proto_msgTypes[19].OneofWrappers = []interface{}{ (*CancelLoopOutSwapRequest_RouteCancel)(nil), @@ -3841,9 +4071,9 @@ func file_server_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_server_proto_rawDesc, NumEnums: 6, - NumMessages: 34, + NumMessages: 37, NumExtensions: 0, - NumServices: 1, + NumServices: 2, }, GoTypes: file_server_proto_goTypes, DependencyIndexes: file_server_proto_depIdxs, diff --git a/swapserverrpc/server.proto b/swapserverrpc/server.proto index 9362b88..e1bbfc1 100644 --- a/swapserverrpc/server.proto +++ b/swapserverrpc/server.proto @@ -47,7 +47,7 @@ service SwapServer { rpc PushKey (ServerPushKeyReq) returns (ServerPushKeyRes); - // FetchL402 is a simple non-l402-allowlisted request that is required + // FetchL402 is a simple non-l402-allow-listed request that is required // in order to force the creation of an l402. rpc FetchL402 (FetchL402Request) returns (FetchL402Response); } @@ -652,4 +652,29 @@ message FetchL402Response { enum StaticAddressProtocolVersion { // V0 is the initially released static address protocol version. V0 = 0; +} + +service StaticAddressServer { + rpc ServerNewAddress (ServerNewAddressRequest) + returns (ServerNewAddressResponse); +} + +message ServerNewAddressRequest { + // The protocol version that the client adheres to. + StaticAddressProtocolVersion protocol_version = 1; + + // The client key for the MuSig2 static address output. + bytes client_key = 2; +} + +message ServerNewAddressResponse { + ServerAddressParameters params = 1; +} + +message ServerAddressParameters { + // The server key for the MuSig2 static address output. + bytes server_key = 1; + + // The CSV expiry for the MuSig2 static address output. + uint32 expiry = 2; } \ No newline at end of file diff --git a/swapserverrpc/server_grpc.pb.go b/swapserverrpc/server_grpc.pb.go index d5c15d8..e30c6ea 100644 --- a/swapserverrpc/server_grpc.pb.go +++ b/swapserverrpc/server_grpc.pb.go @@ -33,7 +33,7 @@ type SwapServerClient interface { ReportRoutingResult(ctx context.Context, in *ReportRoutingResultReq, opts ...grpc.CallOption) (*ReportRoutingResultRes, error) MuSig2SignSweep(ctx context.Context, in *MuSig2SignSweepReq, opts ...grpc.CallOption) (*MuSig2SignSweepRes, error) PushKey(ctx context.Context, in *ServerPushKeyReq, opts ...grpc.CallOption) (*ServerPushKeyRes, error) - // FetchL402 is a simple non-l402-allowlisted request that is required + // FetchL402 is a simple non-l402-allow-listed request that is required // in order to force the creation of an l402. FetchL402(ctx context.Context, in *FetchL402Request, opts ...grpc.CallOption) (*FetchL402Response, error) } @@ -255,7 +255,7 @@ type SwapServerServer interface { ReportRoutingResult(context.Context, *ReportRoutingResultReq) (*ReportRoutingResultRes, error) MuSig2SignSweep(context.Context, *MuSig2SignSweepReq) (*MuSig2SignSweepRes, error) PushKey(context.Context, *ServerPushKeyReq) (*ServerPushKeyRes, error) - // FetchL402 is a simple non-l402-allowlisted request that is required + // FetchL402 is a simple non-l402-allow-listed request that is required // in order to force the creation of an l402. FetchL402(context.Context, *FetchL402Request) (*FetchL402Response, error) mustEmbedUnimplementedSwapServerServer() @@ -698,3 +698,89 @@ var SwapServer_ServiceDesc = grpc.ServiceDesc{ }, Metadata: "server.proto", } + +// StaticAddressServerClient is the client API for StaticAddressServer service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type StaticAddressServerClient interface { + ServerNewAddress(ctx context.Context, in *ServerNewAddressRequest, opts ...grpc.CallOption) (*ServerNewAddressResponse, error) +} + +type staticAddressServerClient struct { + cc grpc.ClientConnInterface +} + +func NewStaticAddressServerClient(cc grpc.ClientConnInterface) StaticAddressServerClient { + return &staticAddressServerClient{cc} +} + +func (c *staticAddressServerClient) ServerNewAddress(ctx context.Context, in *ServerNewAddressRequest, opts ...grpc.CallOption) (*ServerNewAddressResponse, error) { + out := new(ServerNewAddressResponse) + err := c.cc.Invoke(ctx, "/looprpc.StaticAddressServer/ServerNewAddress", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// StaticAddressServerServer is the server API for StaticAddressServer service. +// All implementations must embed UnimplementedStaticAddressServerServer +// for forward compatibility +type StaticAddressServerServer interface { + ServerNewAddress(context.Context, *ServerNewAddressRequest) (*ServerNewAddressResponse, error) + mustEmbedUnimplementedStaticAddressServerServer() +} + +// UnimplementedStaticAddressServerServer must be embedded to have forward compatible implementations. +type UnimplementedStaticAddressServerServer struct { +} + +func (UnimplementedStaticAddressServerServer) ServerNewAddress(context.Context, *ServerNewAddressRequest) (*ServerNewAddressResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ServerNewAddress not implemented") +} +func (UnimplementedStaticAddressServerServer) mustEmbedUnimplementedStaticAddressServerServer() {} + +// UnsafeStaticAddressServerServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to StaticAddressServerServer will +// result in compilation errors. +type UnsafeStaticAddressServerServer interface { + mustEmbedUnimplementedStaticAddressServerServer() +} + +func RegisterStaticAddressServerServer(s grpc.ServiceRegistrar, srv StaticAddressServerServer) { + s.RegisterService(&StaticAddressServer_ServiceDesc, srv) +} + +func _StaticAddressServer_ServerNewAddress_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ServerNewAddressRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(StaticAddressServerServer).ServerNewAddress(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/looprpc.StaticAddressServer/ServerNewAddress", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(StaticAddressServerServer).ServerNewAddress(ctx, req.(*ServerNewAddressRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// StaticAddressServer_ServiceDesc is the grpc.ServiceDesc for StaticAddressServer service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var StaticAddressServer_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "looprpc.StaticAddressServer", + HandlerType: (*StaticAddressServerServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "ServerNewAddress", + Handler: _StaticAddressServer_ServerNewAddress_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "server.proto", +} From 2afdd0929f7753cfacafc8b18eaa45e501e0912b Mon Sep 17 00:00:00 2001 From: Slyghtning Date: Thu, 9 Nov 2023 19:20:01 +0100 Subject: [PATCH 13/37] looprpc: static address creation --- looprpc/client.pb.go | 522 ++++++++++++++++--------- looprpc/client.proto | 35 +- looprpc/client.swagger.json | 12 + looprpc/client_grpc.pb.go | 88 +++++ looprpc/staticaddressclient.pb.json.go | 48 +++ 5 files changed, 508 insertions(+), 197 deletions(-) create mode 100644 looprpc/staticaddressclient.pb.json.go diff --git a/looprpc/client.pb.go b/looprpc/client.pb.go index abcb254..102d243 100644 --- a/looprpc/client.pb.go +++ b/looprpc/client.pb.go @@ -3862,6 +3862,102 @@ func (x *InstantOut) GetSweepTxId() string { return "" } +type NewAddressRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The client's public key for the 2-of-2 MuSig2 taproot static address. + ClientKey []byte `protobuf:"bytes,1,opt,name=client_key,json=clientKey,proto3" json:"client_key,omitempty"` +} + +func (x *NewAddressRequest) Reset() { + *x = NewAddressRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_client_proto_msgTypes[43] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *NewAddressRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*NewAddressRequest) ProtoMessage() {} + +func (x *NewAddressRequest) ProtoReflect() protoreflect.Message { + mi := &file_client_proto_msgTypes[43] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use NewAddressRequest.ProtoReflect.Descriptor instead. +func (*NewAddressRequest) Descriptor() ([]byte, []int) { + return file_client_proto_rawDescGZIP(), []int{43} +} + +func (x *NewAddressRequest) GetClientKey() []byte { + if x != nil { + return x.ClientKey + } + return nil +} + +type NewAddressResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The taproot static address. + Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` +} + +func (x *NewAddressResponse) Reset() { + *x = NewAddressResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_client_proto_msgTypes[44] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *NewAddressResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*NewAddressResponse) ProtoMessage() {} + +func (x *NewAddressResponse) ProtoReflect() protoreflect.Message { + mi := &file_client_proto_msgTypes[44] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use NewAddressResponse.ProtoReflect.Descriptor instead. +func (*NewAddressResponse) Descriptor() ([]byte, []int) { + return file_client_proto_rawDescGZIP(), []int{44} +} + +func (x *NewAddressResponse) GetAddress() string { + if x != nil { + return x.Address + } + return "" +} + var File_client_proto protoreflect.FileDescriptor var file_client_proto_rawDesc = []byte{ @@ -4344,170 +4440,182 @@ var file_client_proto_rawDesc = []byte{ 0x5f, 0x69, 0x64, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x0e, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x73, 0x12, 0x1e, 0x0a, 0x0b, 0x73, 0x77, 0x65, 0x65, 0x70, 0x5f, 0x74, 0x78, 0x5f, 0x69, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x09, 0x73, 0x77, 0x65, 0x65, 0x70, 0x54, 0x78, 0x49, 0x64, 0x2a, 0x3b, 0x0a, 0x0b, 0x41, 0x64, - 0x64, 0x72, 0x65, 0x73, 0x73, 0x54, 0x79, 0x70, 0x65, 0x12, 0x18, 0x0a, 0x14, 0x41, 0x44, 0x44, - 0x52, 0x45, 0x53, 0x53, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, - 0x4e, 0x10, 0x00, 0x12, 0x12, 0x0a, 0x0e, 0x54, 0x41, 0x50, 0x52, 0x4f, 0x4f, 0x54, 0x5f, 0x50, - 0x55, 0x42, 0x4b, 0x45, 0x59, 0x10, 0x01, 0x2a, 0x25, 0x0a, 0x08, 0x53, 0x77, 0x61, 0x70, 0x54, - 0x79, 0x70, 0x65, 0x12, 0x0c, 0x0a, 0x08, 0x4c, 0x4f, 0x4f, 0x50, 0x5f, 0x4f, 0x55, 0x54, 0x10, - 0x00, 0x12, 0x0b, 0x0a, 0x07, 0x4c, 0x4f, 0x4f, 0x50, 0x5f, 0x49, 0x4e, 0x10, 0x01, 0x2a, 0x73, - 0x0a, 0x09, 0x53, 0x77, 0x61, 0x70, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x0d, 0x0a, 0x09, 0x49, - 0x4e, 0x49, 0x54, 0x49, 0x41, 0x54, 0x45, 0x44, 0x10, 0x00, 0x12, 0x15, 0x0a, 0x11, 0x50, 0x52, - 0x45, 0x49, 0x4d, 0x41, 0x47, 0x45, 0x5f, 0x52, 0x45, 0x56, 0x45, 0x41, 0x4c, 0x45, 0x44, 0x10, - 0x01, 0x12, 0x12, 0x0a, 0x0e, 0x48, 0x54, 0x4c, 0x43, 0x5f, 0x50, 0x55, 0x42, 0x4c, 0x49, 0x53, - 0x48, 0x45, 0x44, 0x10, 0x02, 0x12, 0x0b, 0x0a, 0x07, 0x53, 0x55, 0x43, 0x43, 0x45, 0x53, 0x53, - 0x10, 0x03, 0x12, 0x0a, 0x0a, 0x06, 0x46, 0x41, 0x49, 0x4c, 0x45, 0x44, 0x10, 0x04, 0x12, 0x13, - 0x0a, 0x0f, 0x49, 0x4e, 0x56, 0x4f, 0x49, 0x43, 0x45, 0x5f, 0x53, 0x45, 0x54, 0x54, 0x4c, 0x45, - 0x44, 0x10, 0x05, 0x2a, 0xeb, 0x02, 0x0a, 0x0d, 0x46, 0x61, 0x69, 0x6c, 0x75, 0x72, 0x65, 0x52, - 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x12, 0x17, 0x0a, 0x13, 0x46, 0x41, 0x49, 0x4c, 0x55, 0x52, 0x45, - 0x5f, 0x52, 0x45, 0x41, 0x53, 0x4f, 0x4e, 0x5f, 0x4e, 0x4f, 0x4e, 0x45, 0x10, 0x00, 0x12, 0x1b, - 0x0a, 0x17, 0x46, 0x41, 0x49, 0x4c, 0x55, 0x52, 0x45, 0x5f, 0x52, 0x45, 0x41, 0x53, 0x4f, 0x4e, - 0x5f, 0x4f, 0x46, 0x46, 0x43, 0x48, 0x41, 0x49, 0x4e, 0x10, 0x01, 0x12, 0x1a, 0x0a, 0x16, 0x46, - 0x41, 0x49, 0x4c, 0x55, 0x52, 0x45, 0x5f, 0x52, 0x45, 0x41, 0x53, 0x4f, 0x4e, 0x5f, 0x54, 0x49, - 0x4d, 0x45, 0x4f, 0x55, 0x54, 0x10, 0x02, 0x12, 0x20, 0x0a, 0x1c, 0x46, 0x41, 0x49, 0x4c, 0x55, - 0x52, 0x45, 0x5f, 0x52, 0x45, 0x41, 0x53, 0x4f, 0x4e, 0x5f, 0x53, 0x57, 0x45, 0x45, 0x50, 0x5f, - 0x54, 0x49, 0x4d, 0x45, 0x4f, 0x55, 0x54, 0x10, 0x03, 0x12, 0x25, 0x0a, 0x21, 0x46, 0x41, 0x49, - 0x4c, 0x55, 0x52, 0x45, 0x5f, 0x52, 0x45, 0x41, 0x53, 0x4f, 0x4e, 0x5f, 0x49, 0x4e, 0x53, 0x55, - 0x46, 0x46, 0x49, 0x43, 0x49, 0x45, 0x4e, 0x54, 0x5f, 0x56, 0x41, 0x4c, 0x55, 0x45, 0x10, 0x04, - 0x12, 0x1c, 0x0a, 0x18, 0x46, 0x41, 0x49, 0x4c, 0x55, 0x52, 0x45, 0x5f, 0x52, 0x45, 0x41, 0x53, - 0x4f, 0x4e, 0x5f, 0x54, 0x45, 0x4d, 0x50, 0x4f, 0x52, 0x41, 0x52, 0x59, 0x10, 0x05, 0x12, 0x23, - 0x0a, 0x1f, 0x46, 0x41, 0x49, 0x4c, 0x55, 0x52, 0x45, 0x5f, 0x52, 0x45, 0x41, 0x53, 0x4f, 0x4e, - 0x5f, 0x49, 0x4e, 0x43, 0x4f, 0x52, 0x52, 0x45, 0x43, 0x54, 0x5f, 0x41, 0x4d, 0x4f, 0x55, 0x4e, - 0x54, 0x10, 0x06, 0x12, 0x1c, 0x0a, 0x18, 0x46, 0x41, 0x49, 0x4c, 0x55, 0x52, 0x45, 0x5f, 0x52, - 0x45, 0x41, 0x53, 0x4f, 0x4e, 0x5f, 0x41, 0x42, 0x41, 0x4e, 0x44, 0x4f, 0x4e, 0x45, 0x44, 0x10, - 0x07, 0x12, 0x31, 0x0a, 0x2d, 0x46, 0x41, 0x49, 0x4c, 0x55, 0x52, 0x45, 0x5f, 0x52, 0x45, 0x41, - 0x53, 0x4f, 0x4e, 0x5f, 0x49, 0x4e, 0x53, 0x55, 0x46, 0x46, 0x49, 0x43, 0x49, 0x45, 0x4e, 0x54, - 0x5f, 0x43, 0x4f, 0x4e, 0x46, 0x49, 0x52, 0x4d, 0x45, 0x44, 0x5f, 0x42, 0x41, 0x4c, 0x41, 0x4e, - 0x43, 0x45, 0x10, 0x08, 0x12, 0x2b, 0x0a, 0x27, 0x46, 0x41, 0x49, 0x4c, 0x55, 0x52, 0x45, 0x5f, - 0x52, 0x45, 0x41, 0x53, 0x4f, 0x4e, 0x5f, 0x49, 0x4e, 0x43, 0x4f, 0x52, 0x52, 0x45, 0x43, 0x54, - 0x5f, 0x48, 0x54, 0x4c, 0x43, 0x5f, 0x41, 0x4d, 0x54, 0x5f, 0x53, 0x57, 0x45, 0x50, 0x54, 0x10, - 0x09, 0x2a, 0x2f, 0x0a, 0x11, 0x4c, 0x69, 0x71, 0x75, 0x69, 0x64, 0x69, 0x74, 0x79, 0x52, 0x75, - 0x6c, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0b, 0x0a, 0x07, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, - 0x4e, 0x10, 0x00, 0x12, 0x0d, 0x0a, 0x09, 0x54, 0x48, 0x52, 0x45, 0x53, 0x48, 0x4f, 0x4c, 0x44, - 0x10, 0x01, 0x2a, 0xa6, 0x03, 0x0a, 0x0a, 0x41, 0x75, 0x74, 0x6f, 0x52, 0x65, 0x61, 0x73, 0x6f, - 0x6e, 0x12, 0x17, 0x0a, 0x13, 0x41, 0x55, 0x54, 0x4f, 0x5f, 0x52, 0x45, 0x41, 0x53, 0x4f, 0x4e, - 0x5f, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x22, 0x0a, 0x1e, 0x41, 0x55, - 0x54, 0x4f, 0x5f, 0x52, 0x45, 0x41, 0x53, 0x4f, 0x4e, 0x5f, 0x42, 0x55, 0x44, 0x47, 0x45, 0x54, - 0x5f, 0x4e, 0x4f, 0x54, 0x5f, 0x53, 0x54, 0x41, 0x52, 0x54, 0x45, 0x44, 0x10, 0x01, 0x12, 0x1a, - 0x0a, 0x16, 0x41, 0x55, 0x54, 0x4f, 0x5f, 0x52, 0x45, 0x41, 0x53, 0x4f, 0x4e, 0x5f, 0x53, 0x57, - 0x45, 0x45, 0x50, 0x5f, 0x46, 0x45, 0x45, 0x53, 0x10, 0x02, 0x12, 0x1e, 0x0a, 0x1a, 0x41, 0x55, - 0x54, 0x4f, 0x5f, 0x52, 0x45, 0x41, 0x53, 0x4f, 0x4e, 0x5f, 0x42, 0x55, 0x44, 0x47, 0x45, 0x54, - 0x5f, 0x45, 0x4c, 0x41, 0x50, 0x53, 0x45, 0x44, 0x10, 0x03, 0x12, 0x19, 0x0a, 0x15, 0x41, 0x55, - 0x54, 0x4f, 0x5f, 0x52, 0x45, 0x41, 0x53, 0x4f, 0x4e, 0x5f, 0x49, 0x4e, 0x5f, 0x46, 0x4c, 0x49, - 0x47, 0x48, 0x54, 0x10, 0x04, 0x12, 0x18, 0x0a, 0x14, 0x41, 0x55, 0x54, 0x4f, 0x5f, 0x52, 0x45, - 0x41, 0x53, 0x4f, 0x4e, 0x5f, 0x53, 0x57, 0x41, 0x50, 0x5f, 0x46, 0x45, 0x45, 0x10, 0x05, 0x12, - 0x19, 0x0a, 0x15, 0x41, 0x55, 0x54, 0x4f, 0x5f, 0x52, 0x45, 0x41, 0x53, 0x4f, 0x4e, 0x5f, 0x4d, - 0x49, 0x4e, 0x45, 0x52, 0x5f, 0x46, 0x45, 0x45, 0x10, 0x06, 0x12, 0x16, 0x0a, 0x12, 0x41, 0x55, - 0x54, 0x4f, 0x5f, 0x52, 0x45, 0x41, 0x53, 0x4f, 0x4e, 0x5f, 0x50, 0x52, 0x45, 0x50, 0x41, 0x59, - 0x10, 0x07, 0x12, 0x1f, 0x0a, 0x1b, 0x41, 0x55, 0x54, 0x4f, 0x5f, 0x52, 0x45, 0x41, 0x53, 0x4f, - 0x4e, 0x5f, 0x46, 0x41, 0x49, 0x4c, 0x55, 0x52, 0x45, 0x5f, 0x42, 0x41, 0x43, 0x4b, 0x4f, 0x46, - 0x46, 0x10, 0x08, 0x12, 0x18, 0x0a, 0x14, 0x41, 0x55, 0x54, 0x4f, 0x5f, 0x52, 0x45, 0x41, 0x53, - 0x4f, 0x4e, 0x5f, 0x4c, 0x4f, 0x4f, 0x50, 0x5f, 0x4f, 0x55, 0x54, 0x10, 0x09, 0x12, 0x17, 0x0a, - 0x13, 0x41, 0x55, 0x54, 0x4f, 0x5f, 0x52, 0x45, 0x41, 0x53, 0x4f, 0x4e, 0x5f, 0x4c, 0x4f, 0x4f, - 0x50, 0x5f, 0x49, 0x4e, 0x10, 0x0a, 0x12, 0x1c, 0x0a, 0x18, 0x41, 0x55, 0x54, 0x4f, 0x5f, 0x52, - 0x45, 0x41, 0x53, 0x4f, 0x4e, 0x5f, 0x4c, 0x49, 0x51, 0x55, 0x49, 0x44, 0x49, 0x54, 0x59, 0x5f, - 0x4f, 0x4b, 0x10, 0x0b, 0x12, 0x23, 0x0a, 0x1f, 0x41, 0x55, 0x54, 0x4f, 0x5f, 0x52, 0x45, 0x41, - 0x53, 0x4f, 0x4e, 0x5f, 0x42, 0x55, 0x44, 0x47, 0x45, 0x54, 0x5f, 0x49, 0x4e, 0x53, 0x55, 0x46, - 0x46, 0x49, 0x43, 0x49, 0x45, 0x4e, 0x54, 0x10, 0x0c, 0x12, 0x20, 0x0a, 0x1c, 0x41, 0x55, 0x54, - 0x4f, 0x5f, 0x52, 0x45, 0x41, 0x53, 0x4f, 0x4e, 0x5f, 0x46, 0x45, 0x45, 0x5f, 0x49, 0x4e, 0x53, - 0x55, 0x46, 0x46, 0x49, 0x43, 0x49, 0x45, 0x4e, 0x54, 0x10, 0x0d, 0x32, 0xd8, 0x0b, 0x0a, 0x0a, - 0x53, 0x77, 0x61, 0x70, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x12, 0x39, 0x0a, 0x07, 0x4c, 0x6f, - 0x6f, 0x70, 0x4f, 0x75, 0x74, 0x12, 0x17, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, - 0x4c, 0x6f, 0x6f, 0x70, 0x4f, 0x75, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x15, - 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x53, 0x77, 0x61, 0x70, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x37, 0x0a, 0x06, 0x4c, 0x6f, 0x6f, 0x70, 0x49, 0x6e, 0x12, - 0x16, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x4c, 0x6f, 0x6f, 0x70, 0x49, 0x6e, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x15, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, - 0x63, 0x2e, 0x53, 0x77, 0x61, 0x70, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x39, - 0x0a, 0x07, 0x4d, 0x6f, 0x6e, 0x69, 0x74, 0x6f, 0x72, 0x12, 0x17, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, - 0x72, 0x70, 0x63, 0x2e, 0x4d, 0x6f, 0x6e, 0x69, 0x74, 0x6f, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x1a, 0x13, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x53, 0x77, 0x61, - 0x70, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x30, 0x01, 0x12, 0x42, 0x0a, 0x09, 0x4c, 0x69, 0x73, - 0x74, 0x53, 0x77, 0x61, 0x70, 0x73, 0x12, 0x19, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, - 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x77, 0x61, 0x70, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x1a, 0x1a, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x4c, 0x69, 0x73, 0x74, - 0x53, 0x77, 0x61, 0x70, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x39, 0x0a, - 0x08, 0x53, 0x77, 0x61, 0x70, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x18, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, - 0x72, 0x70, 0x63, 0x2e, 0x53, 0x77, 0x61, 0x70, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x1a, 0x13, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x53, 0x77, - 0x61, 0x70, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x48, 0x0a, 0x0b, 0x41, 0x62, 0x61, 0x6e, - 0x64, 0x6f, 0x6e, 0x53, 0x77, 0x61, 0x70, 0x12, 0x1b, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, - 0x63, 0x2e, 0x41, 0x62, 0x61, 0x6e, 0x64, 0x6f, 0x6e, 0x53, 0x77, 0x61, 0x70, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x41, - 0x62, 0x61, 0x6e, 0x64, 0x6f, 0x6e, 0x53, 0x77, 0x61, 0x70, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x12, 0x40, 0x0a, 0x0c, 0x4c, 0x6f, 0x6f, 0x70, 0x4f, 0x75, 0x74, 0x54, 0x65, 0x72, - 0x6d, 0x73, 0x12, 0x15, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x54, 0x65, 0x72, - 0x6d, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, - 0x72, 0x70, 0x63, 0x2e, 0x4f, 0x75, 0x74, 0x54, 0x65, 0x72, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x40, 0x0a, 0x0c, 0x4c, 0x6f, 0x6f, 0x70, 0x4f, 0x75, 0x74, 0x51, - 0x75, 0x6f, 0x74, 0x65, 0x12, 0x15, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x51, - 0x75, 0x6f, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x6c, 0x6f, - 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x4f, 0x75, 0x74, 0x51, 0x75, 0x6f, 0x74, 0x65, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x41, 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x4c, 0x6f, 0x6f, - 0x70, 0x49, 0x6e, 0x54, 0x65, 0x72, 0x6d, 0x73, 0x12, 0x15, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, - 0x70, 0x63, 0x2e, 0x54, 0x65, 0x72, 0x6d, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, - 0x18, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x49, 0x6e, 0x54, 0x65, 0x72, 0x6d, - 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x41, 0x0a, 0x0e, 0x47, 0x65, 0x74, - 0x4c, 0x6f, 0x6f, 0x70, 0x49, 0x6e, 0x51, 0x75, 0x6f, 0x74, 0x65, 0x12, 0x15, 0x2e, 0x6c, 0x6f, - 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x51, 0x75, 0x6f, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x49, 0x6e, 0x51, - 0x75, 0x6f, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x36, 0x0a, 0x05, - 0x50, 0x72, 0x6f, 0x62, 0x65, 0x12, 0x15, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, - 0x50, 0x72, 0x6f, 0x62, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x6c, - 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x50, 0x72, 0x6f, 0x62, 0x65, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x40, 0x0a, 0x0d, 0x47, 0x65, 0x74, 0x4c, 0x34, 0x30, 0x32, 0x54, - 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x12, 0x16, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, - 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e, - 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x40, 0x0a, 0x0d, 0x47, 0x65, 0x74, 0x4c, 0x73, 0x61, - 0x74, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x12, 0x16, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, - 0x63, 0x2e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, - 0x17, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x73, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3c, 0x0a, 0x07, 0x47, 0x65, 0x74, 0x49, - 0x6e, 0x66, 0x6f, 0x12, 0x17, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x47, 0x65, - 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x6c, - 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x47, 0x65, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x56, 0x0a, 0x12, 0x47, 0x65, 0x74, 0x4c, 0x69, 0x71, - 0x75, 0x69, 0x64, 0x69, 0x74, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x22, 0x2e, 0x6c, - 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x47, 0x65, 0x74, 0x4c, 0x69, 0x71, 0x75, 0x69, 0x64, - 0x69, 0x74, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x1a, 0x1c, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x4c, 0x69, 0x71, 0x75, 0x69, - 0x64, 0x69, 0x74, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x12, 0x5d, - 0x0a, 0x12, 0x53, 0x65, 0x74, 0x4c, 0x69, 0x71, 0x75, 0x69, 0x64, 0x69, 0x74, 0x79, 0x50, 0x61, - 0x72, 0x61, 0x6d, 0x73, 0x12, 0x22, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x53, - 0x65, 0x74, 0x4c, 0x69, 0x71, 0x75, 0x69, 0x64, 0x69, 0x74, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, - 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x23, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, + 0x09, 0x73, 0x77, 0x65, 0x65, 0x70, 0x54, 0x78, 0x49, 0x64, 0x22, 0x32, 0x0a, 0x11, 0x4e, 0x65, + 0x77, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, + 0x1d, 0x0a, 0x0a, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0c, 0x52, 0x09, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x4b, 0x65, 0x79, 0x22, 0x2e, + 0x0a, 0x12, 0x4e, 0x65, 0x77, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x2a, 0x3b, + 0x0a, 0x0b, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x54, 0x79, 0x70, 0x65, 0x12, 0x18, 0x0a, + 0x14, 0x41, 0x44, 0x44, 0x52, 0x45, 0x53, 0x53, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, + 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x12, 0x0a, 0x0e, 0x54, 0x41, 0x50, 0x52, 0x4f, + 0x4f, 0x54, 0x5f, 0x50, 0x55, 0x42, 0x4b, 0x45, 0x59, 0x10, 0x01, 0x2a, 0x25, 0x0a, 0x08, 0x53, + 0x77, 0x61, 0x70, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0c, 0x0a, 0x08, 0x4c, 0x4f, 0x4f, 0x50, 0x5f, + 0x4f, 0x55, 0x54, 0x10, 0x00, 0x12, 0x0b, 0x0a, 0x07, 0x4c, 0x4f, 0x4f, 0x50, 0x5f, 0x49, 0x4e, + 0x10, 0x01, 0x2a, 0x73, 0x0a, 0x09, 0x53, 0x77, 0x61, 0x70, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, + 0x0d, 0x0a, 0x09, 0x49, 0x4e, 0x49, 0x54, 0x49, 0x41, 0x54, 0x45, 0x44, 0x10, 0x00, 0x12, 0x15, + 0x0a, 0x11, 0x50, 0x52, 0x45, 0x49, 0x4d, 0x41, 0x47, 0x45, 0x5f, 0x52, 0x45, 0x56, 0x45, 0x41, + 0x4c, 0x45, 0x44, 0x10, 0x01, 0x12, 0x12, 0x0a, 0x0e, 0x48, 0x54, 0x4c, 0x43, 0x5f, 0x50, 0x55, + 0x42, 0x4c, 0x49, 0x53, 0x48, 0x45, 0x44, 0x10, 0x02, 0x12, 0x0b, 0x0a, 0x07, 0x53, 0x55, 0x43, + 0x43, 0x45, 0x53, 0x53, 0x10, 0x03, 0x12, 0x0a, 0x0a, 0x06, 0x46, 0x41, 0x49, 0x4c, 0x45, 0x44, + 0x10, 0x04, 0x12, 0x13, 0x0a, 0x0f, 0x49, 0x4e, 0x56, 0x4f, 0x49, 0x43, 0x45, 0x5f, 0x53, 0x45, + 0x54, 0x54, 0x4c, 0x45, 0x44, 0x10, 0x05, 0x2a, 0xeb, 0x02, 0x0a, 0x0d, 0x46, 0x61, 0x69, 0x6c, + 0x75, 0x72, 0x65, 0x52, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x12, 0x17, 0x0a, 0x13, 0x46, 0x41, 0x49, + 0x4c, 0x55, 0x52, 0x45, 0x5f, 0x52, 0x45, 0x41, 0x53, 0x4f, 0x4e, 0x5f, 0x4e, 0x4f, 0x4e, 0x45, + 0x10, 0x00, 0x12, 0x1b, 0x0a, 0x17, 0x46, 0x41, 0x49, 0x4c, 0x55, 0x52, 0x45, 0x5f, 0x52, 0x45, + 0x41, 0x53, 0x4f, 0x4e, 0x5f, 0x4f, 0x46, 0x46, 0x43, 0x48, 0x41, 0x49, 0x4e, 0x10, 0x01, 0x12, + 0x1a, 0x0a, 0x16, 0x46, 0x41, 0x49, 0x4c, 0x55, 0x52, 0x45, 0x5f, 0x52, 0x45, 0x41, 0x53, 0x4f, + 0x4e, 0x5f, 0x54, 0x49, 0x4d, 0x45, 0x4f, 0x55, 0x54, 0x10, 0x02, 0x12, 0x20, 0x0a, 0x1c, 0x46, + 0x41, 0x49, 0x4c, 0x55, 0x52, 0x45, 0x5f, 0x52, 0x45, 0x41, 0x53, 0x4f, 0x4e, 0x5f, 0x53, 0x57, + 0x45, 0x45, 0x50, 0x5f, 0x54, 0x49, 0x4d, 0x45, 0x4f, 0x55, 0x54, 0x10, 0x03, 0x12, 0x25, 0x0a, + 0x21, 0x46, 0x41, 0x49, 0x4c, 0x55, 0x52, 0x45, 0x5f, 0x52, 0x45, 0x41, 0x53, 0x4f, 0x4e, 0x5f, + 0x49, 0x4e, 0x53, 0x55, 0x46, 0x46, 0x49, 0x43, 0x49, 0x45, 0x4e, 0x54, 0x5f, 0x56, 0x41, 0x4c, + 0x55, 0x45, 0x10, 0x04, 0x12, 0x1c, 0x0a, 0x18, 0x46, 0x41, 0x49, 0x4c, 0x55, 0x52, 0x45, 0x5f, + 0x52, 0x45, 0x41, 0x53, 0x4f, 0x4e, 0x5f, 0x54, 0x45, 0x4d, 0x50, 0x4f, 0x52, 0x41, 0x52, 0x59, + 0x10, 0x05, 0x12, 0x23, 0x0a, 0x1f, 0x46, 0x41, 0x49, 0x4c, 0x55, 0x52, 0x45, 0x5f, 0x52, 0x45, + 0x41, 0x53, 0x4f, 0x4e, 0x5f, 0x49, 0x4e, 0x43, 0x4f, 0x52, 0x52, 0x45, 0x43, 0x54, 0x5f, 0x41, + 0x4d, 0x4f, 0x55, 0x4e, 0x54, 0x10, 0x06, 0x12, 0x1c, 0x0a, 0x18, 0x46, 0x41, 0x49, 0x4c, 0x55, + 0x52, 0x45, 0x5f, 0x52, 0x45, 0x41, 0x53, 0x4f, 0x4e, 0x5f, 0x41, 0x42, 0x41, 0x4e, 0x44, 0x4f, + 0x4e, 0x45, 0x44, 0x10, 0x07, 0x12, 0x31, 0x0a, 0x2d, 0x46, 0x41, 0x49, 0x4c, 0x55, 0x52, 0x45, + 0x5f, 0x52, 0x45, 0x41, 0x53, 0x4f, 0x4e, 0x5f, 0x49, 0x4e, 0x53, 0x55, 0x46, 0x46, 0x49, 0x43, + 0x49, 0x45, 0x4e, 0x54, 0x5f, 0x43, 0x4f, 0x4e, 0x46, 0x49, 0x52, 0x4d, 0x45, 0x44, 0x5f, 0x42, + 0x41, 0x4c, 0x41, 0x4e, 0x43, 0x45, 0x10, 0x08, 0x12, 0x2b, 0x0a, 0x27, 0x46, 0x41, 0x49, 0x4c, + 0x55, 0x52, 0x45, 0x5f, 0x52, 0x45, 0x41, 0x53, 0x4f, 0x4e, 0x5f, 0x49, 0x4e, 0x43, 0x4f, 0x52, + 0x52, 0x45, 0x43, 0x54, 0x5f, 0x48, 0x54, 0x4c, 0x43, 0x5f, 0x41, 0x4d, 0x54, 0x5f, 0x53, 0x57, + 0x45, 0x50, 0x54, 0x10, 0x09, 0x2a, 0x2f, 0x0a, 0x11, 0x4c, 0x69, 0x71, 0x75, 0x69, 0x64, 0x69, + 0x74, 0x79, 0x52, 0x75, 0x6c, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0b, 0x0a, 0x07, 0x55, 0x4e, + 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x0d, 0x0a, 0x09, 0x54, 0x48, 0x52, 0x45, 0x53, + 0x48, 0x4f, 0x4c, 0x44, 0x10, 0x01, 0x2a, 0xa6, 0x03, 0x0a, 0x0a, 0x41, 0x75, 0x74, 0x6f, 0x52, + 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x12, 0x17, 0x0a, 0x13, 0x41, 0x55, 0x54, 0x4f, 0x5f, 0x52, 0x45, + 0x41, 0x53, 0x4f, 0x4e, 0x5f, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x22, + 0x0a, 0x1e, 0x41, 0x55, 0x54, 0x4f, 0x5f, 0x52, 0x45, 0x41, 0x53, 0x4f, 0x4e, 0x5f, 0x42, 0x55, + 0x44, 0x47, 0x45, 0x54, 0x5f, 0x4e, 0x4f, 0x54, 0x5f, 0x53, 0x54, 0x41, 0x52, 0x54, 0x45, 0x44, + 0x10, 0x01, 0x12, 0x1a, 0x0a, 0x16, 0x41, 0x55, 0x54, 0x4f, 0x5f, 0x52, 0x45, 0x41, 0x53, 0x4f, + 0x4e, 0x5f, 0x53, 0x57, 0x45, 0x45, 0x50, 0x5f, 0x46, 0x45, 0x45, 0x53, 0x10, 0x02, 0x12, 0x1e, + 0x0a, 0x1a, 0x41, 0x55, 0x54, 0x4f, 0x5f, 0x52, 0x45, 0x41, 0x53, 0x4f, 0x4e, 0x5f, 0x42, 0x55, + 0x44, 0x47, 0x45, 0x54, 0x5f, 0x45, 0x4c, 0x41, 0x50, 0x53, 0x45, 0x44, 0x10, 0x03, 0x12, 0x19, + 0x0a, 0x15, 0x41, 0x55, 0x54, 0x4f, 0x5f, 0x52, 0x45, 0x41, 0x53, 0x4f, 0x4e, 0x5f, 0x49, 0x4e, + 0x5f, 0x46, 0x4c, 0x49, 0x47, 0x48, 0x54, 0x10, 0x04, 0x12, 0x18, 0x0a, 0x14, 0x41, 0x55, 0x54, + 0x4f, 0x5f, 0x52, 0x45, 0x41, 0x53, 0x4f, 0x4e, 0x5f, 0x53, 0x57, 0x41, 0x50, 0x5f, 0x46, 0x45, + 0x45, 0x10, 0x05, 0x12, 0x19, 0x0a, 0x15, 0x41, 0x55, 0x54, 0x4f, 0x5f, 0x52, 0x45, 0x41, 0x53, + 0x4f, 0x4e, 0x5f, 0x4d, 0x49, 0x4e, 0x45, 0x52, 0x5f, 0x46, 0x45, 0x45, 0x10, 0x06, 0x12, 0x16, + 0x0a, 0x12, 0x41, 0x55, 0x54, 0x4f, 0x5f, 0x52, 0x45, 0x41, 0x53, 0x4f, 0x4e, 0x5f, 0x50, 0x52, + 0x45, 0x50, 0x41, 0x59, 0x10, 0x07, 0x12, 0x1f, 0x0a, 0x1b, 0x41, 0x55, 0x54, 0x4f, 0x5f, 0x52, + 0x45, 0x41, 0x53, 0x4f, 0x4e, 0x5f, 0x46, 0x41, 0x49, 0x4c, 0x55, 0x52, 0x45, 0x5f, 0x42, 0x41, + 0x43, 0x4b, 0x4f, 0x46, 0x46, 0x10, 0x08, 0x12, 0x18, 0x0a, 0x14, 0x41, 0x55, 0x54, 0x4f, 0x5f, + 0x52, 0x45, 0x41, 0x53, 0x4f, 0x4e, 0x5f, 0x4c, 0x4f, 0x4f, 0x50, 0x5f, 0x4f, 0x55, 0x54, 0x10, + 0x09, 0x12, 0x17, 0x0a, 0x13, 0x41, 0x55, 0x54, 0x4f, 0x5f, 0x52, 0x45, 0x41, 0x53, 0x4f, 0x4e, + 0x5f, 0x4c, 0x4f, 0x4f, 0x50, 0x5f, 0x49, 0x4e, 0x10, 0x0a, 0x12, 0x1c, 0x0a, 0x18, 0x41, 0x55, + 0x54, 0x4f, 0x5f, 0x52, 0x45, 0x41, 0x53, 0x4f, 0x4e, 0x5f, 0x4c, 0x49, 0x51, 0x55, 0x49, 0x44, + 0x49, 0x54, 0x59, 0x5f, 0x4f, 0x4b, 0x10, 0x0b, 0x12, 0x23, 0x0a, 0x1f, 0x41, 0x55, 0x54, 0x4f, + 0x5f, 0x52, 0x45, 0x41, 0x53, 0x4f, 0x4e, 0x5f, 0x42, 0x55, 0x44, 0x47, 0x45, 0x54, 0x5f, 0x49, + 0x4e, 0x53, 0x55, 0x46, 0x46, 0x49, 0x43, 0x49, 0x45, 0x4e, 0x54, 0x10, 0x0c, 0x12, 0x20, 0x0a, + 0x1c, 0x41, 0x55, 0x54, 0x4f, 0x5f, 0x52, 0x45, 0x41, 0x53, 0x4f, 0x4e, 0x5f, 0x46, 0x45, 0x45, + 0x5f, 0x49, 0x4e, 0x53, 0x55, 0x46, 0x46, 0x49, 0x43, 0x49, 0x45, 0x4e, 0x54, 0x10, 0x0d, 0x32, + 0xd8, 0x0b, 0x0a, 0x0a, 0x53, 0x77, 0x61, 0x70, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x12, 0x39, + 0x0a, 0x07, 0x4c, 0x6f, 0x6f, 0x70, 0x4f, 0x75, 0x74, 0x12, 0x17, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, + 0x72, 0x70, 0x63, 0x2e, 0x4c, 0x6f, 0x6f, 0x70, 0x4f, 0x75, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x15, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x53, 0x77, 0x61, + 0x70, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x37, 0x0a, 0x06, 0x4c, 0x6f, 0x6f, + 0x70, 0x49, 0x6e, 0x12, 0x16, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x4c, 0x6f, + 0x6f, 0x70, 0x49, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x15, 0x2e, 0x6c, 0x6f, + 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x53, 0x77, 0x61, 0x70, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x12, 0x39, 0x0a, 0x07, 0x4d, 0x6f, 0x6e, 0x69, 0x74, 0x6f, 0x72, 0x12, 0x17, 0x2e, + 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x4d, 0x6f, 0x6e, 0x69, 0x74, 0x6f, 0x72, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x13, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, + 0x2e, 0x53, 0x77, 0x61, 0x70, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x30, 0x01, 0x12, 0x42, 0x0a, + 0x09, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x77, 0x61, 0x70, 0x73, 0x12, 0x19, 0x2e, 0x6c, 0x6f, 0x6f, + 0x70, 0x72, 0x70, 0x63, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x77, 0x61, 0x70, 0x73, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1a, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, + 0x4c, 0x69, 0x73, 0x74, 0x53, 0x77, 0x61, 0x70, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x39, 0x0a, 0x08, 0x53, 0x77, 0x61, 0x70, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x18, 0x2e, + 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x53, 0x77, 0x61, 0x70, 0x49, 0x6e, 0x66, 0x6f, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x13, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, + 0x63, 0x2e, 0x53, 0x77, 0x61, 0x70, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x48, 0x0a, 0x0b, + 0x41, 0x62, 0x61, 0x6e, 0x64, 0x6f, 0x6e, 0x53, 0x77, 0x61, 0x70, 0x12, 0x1b, 0x2e, 0x6c, 0x6f, + 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x41, 0x62, 0x61, 0x6e, 0x64, 0x6f, 0x6e, 0x53, 0x77, 0x61, + 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, + 0x70, 0x63, 0x2e, 0x41, 0x62, 0x61, 0x6e, 0x64, 0x6f, 0x6e, 0x53, 0x77, 0x61, 0x70, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x40, 0x0a, 0x0c, 0x4c, 0x6f, 0x6f, 0x70, 0x4f, 0x75, + 0x74, 0x54, 0x65, 0x72, 0x6d, 0x73, 0x12, 0x15, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, + 0x2e, 0x54, 0x65, 0x72, 0x6d, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, + 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x4f, 0x75, 0x74, 0x54, 0x65, 0x72, 0x6d, 0x73, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x40, 0x0a, 0x0c, 0x4c, 0x6f, 0x6f, 0x70, + 0x4f, 0x75, 0x74, 0x51, 0x75, 0x6f, 0x74, 0x65, 0x12, 0x15, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, + 0x70, 0x63, 0x2e, 0x51, 0x75, 0x6f, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x19, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x4f, 0x75, 0x74, 0x51, 0x75, 0x6f, + 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x41, 0x0a, 0x0e, 0x47, 0x65, + 0x74, 0x4c, 0x6f, 0x6f, 0x70, 0x49, 0x6e, 0x54, 0x65, 0x72, 0x6d, 0x73, 0x12, 0x15, 0x2e, 0x6c, + 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x54, 0x65, 0x72, 0x6d, 0x73, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x49, 0x6e, + 0x54, 0x65, 0x72, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x41, 0x0a, + 0x0e, 0x47, 0x65, 0x74, 0x4c, 0x6f, 0x6f, 0x70, 0x49, 0x6e, 0x51, 0x75, 0x6f, 0x74, 0x65, 0x12, + 0x15, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x51, 0x75, 0x6f, 0x74, 0x65, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, + 0x2e, 0x49, 0x6e, 0x51, 0x75, 0x6f, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x36, 0x0a, 0x05, 0x50, 0x72, 0x6f, 0x62, 0x65, 0x12, 0x15, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, + 0x72, 0x70, 0x63, 0x2e, 0x50, 0x72, 0x6f, 0x62, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x16, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x50, 0x72, 0x6f, 0x62, 0x65, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x40, 0x0a, 0x0d, 0x47, 0x65, 0x74, 0x4c, + 0x34, 0x30, 0x32, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x12, 0x16, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, + 0x72, 0x70, 0x63, 0x2e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x17, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x54, 0x6f, 0x6b, 0x65, + 0x6e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x40, 0x0a, 0x0d, 0x47, 0x65, + 0x74, 0x4c, 0x73, 0x61, 0x74, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x12, 0x16, 0x2e, 0x6c, 0x6f, + 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x54, 0x6f, + 0x6b, 0x65, 0x6e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3c, 0x0a, 0x07, + 0x47, 0x65, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x17, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, + 0x63, 0x2e, 0x47, 0x65, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x18, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x47, 0x65, 0x74, 0x49, 0x6e, + 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x56, 0x0a, 0x12, 0x47, 0x65, + 0x74, 0x4c, 0x69, 0x71, 0x75, 0x69, 0x64, 0x69, 0x74, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, + 0x12, 0x22, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x47, 0x65, 0x74, 0x4c, 0x69, + 0x71, 0x75, 0x69, 0x64, 0x69, 0x74, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x4c, + 0x69, 0x71, 0x75, 0x69, 0x64, 0x69, 0x74, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, + 0x72, 0x73, 0x12, 0x5d, 0x0a, 0x12, 0x53, 0x65, 0x74, 0x4c, 0x69, 0x71, 0x75, 0x69, 0x64, 0x69, + 0x74, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x22, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x53, 0x65, 0x74, 0x4c, 0x69, 0x71, 0x75, 0x69, 0x64, 0x69, 0x74, 0x79, 0x50, - 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4b, 0x0a, - 0x0c, 0x53, 0x75, 0x67, 0x67, 0x65, 0x73, 0x74, 0x53, 0x77, 0x61, 0x70, 0x73, 0x12, 0x1c, 0x2e, - 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x53, 0x75, 0x67, 0x67, 0x65, 0x73, 0x74, 0x53, - 0x77, 0x61, 0x70, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x6c, 0x6f, - 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x53, 0x75, 0x67, 0x67, 0x65, 0x73, 0x74, 0x53, 0x77, 0x61, - 0x70, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x57, 0x0a, 0x10, 0x4c, 0x69, - 0x73, 0x74, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x20, - 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, - 0x65, 0x72, 0x76, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x1a, 0x21, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x52, - 0x65, 0x73, 0x65, 0x72, 0x76, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x12, 0x45, 0x0a, 0x0a, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x74, 0x4f, 0x75, - 0x74, 0x12, 0x1a, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x49, 0x6e, 0x73, 0x74, - 0x61, 0x6e, 0x74, 0x4f, 0x75, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1b, 0x2e, - 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x74, 0x4f, - 0x75, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x54, 0x0a, 0x0f, 0x49, 0x6e, - 0x73, 0x74, 0x61, 0x6e, 0x74, 0x4f, 0x75, 0x74, 0x51, 0x75, 0x6f, 0x74, 0x65, 0x12, 0x1f, 0x2e, - 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x74, 0x4f, - 0x75, 0x74, 0x51, 0x75, 0x6f, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x20, - 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x74, - 0x4f, 0x75, 0x74, 0x51, 0x75, 0x6f, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x12, 0x54, 0x0a, 0x0f, 0x4c, 0x69, 0x73, 0x74, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x74, 0x4f, - 0x75, 0x74, 0x73, 0x12, 0x1f, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x4c, 0x69, - 0x73, 0x74, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x74, 0x4f, 0x75, 0x74, 0x73, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x1a, 0x20, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x4c, - 0x69, 0x73, 0x74, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x74, 0x4f, 0x75, 0x74, 0x73, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x27, 0x5a, 0x25, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, - 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6c, 0x69, 0x67, 0x68, 0x74, 0x6e, 0x69, 0x6e, 0x67, 0x6c, 0x61, - 0x62, 0x73, 0x2f, 0x6c, 0x6f, 0x6f, 0x70, 0x2f, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x62, - 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x23, 0x2e, 0x6c, + 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x53, 0x65, 0x74, 0x4c, 0x69, 0x71, 0x75, 0x69, 0x64, + 0x69, 0x74, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x4b, 0x0a, 0x0c, 0x53, 0x75, 0x67, 0x67, 0x65, 0x73, 0x74, 0x53, 0x77, 0x61, 0x70, + 0x73, 0x12, 0x1c, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x53, 0x75, 0x67, 0x67, + 0x65, 0x73, 0x74, 0x53, 0x77, 0x61, 0x70, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x1d, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x53, 0x75, 0x67, 0x67, 0x65, 0x73, + 0x74, 0x53, 0x77, 0x61, 0x70, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x57, + 0x0a, 0x10, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x73, 0x12, 0x20, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x4c, 0x69, 0x73, + 0x74, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x21, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x4c, + 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x45, 0x0a, 0x0a, 0x49, 0x6e, 0x73, 0x74, 0x61, + 0x6e, 0x74, 0x4f, 0x75, 0x74, 0x12, 0x1a, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, + 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x74, 0x4f, 0x75, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x1b, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x49, 0x6e, 0x73, 0x74, + 0x61, 0x6e, 0x74, 0x4f, 0x75, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x54, + 0x0a, 0x0f, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x74, 0x4f, 0x75, 0x74, 0x51, 0x75, 0x6f, 0x74, + 0x65, 0x12, 0x1f, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x49, 0x6e, 0x73, 0x74, + 0x61, 0x6e, 0x74, 0x4f, 0x75, 0x74, 0x51, 0x75, 0x6f, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x20, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x49, 0x6e, 0x73, + 0x74, 0x61, 0x6e, 0x74, 0x4f, 0x75, 0x74, 0x51, 0x75, 0x6f, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x54, 0x0a, 0x0f, 0x4c, 0x69, 0x73, 0x74, 0x49, 0x6e, 0x73, 0x74, + 0x61, 0x6e, 0x74, 0x4f, 0x75, 0x74, 0x73, 0x12, 0x1f, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, + 0x63, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x74, 0x4f, 0x75, 0x74, + 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x20, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, + 0x70, 0x63, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x74, 0x4f, 0x75, + 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0x5c, 0x0a, 0x13, 0x53, 0x74, + 0x61, 0x74, 0x69, 0x63, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x43, 0x6c, 0x69, 0x65, 0x6e, + 0x74, 0x12, 0x45, 0x0a, 0x0a, 0x4e, 0x65, 0x77, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, + 0x1a, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x4e, 0x65, 0x77, 0x41, 0x64, 0x64, + 0x72, 0x65, 0x73, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1b, 0x2e, 0x6c, 0x6f, + 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x4e, 0x65, 0x77, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x27, 0x5a, 0x25, 0x67, 0x69, 0x74, 0x68, + 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6c, 0x69, 0x67, 0x68, 0x74, 0x6e, 0x69, 0x6e, 0x67, + 0x6c, 0x61, 0x62, 0x73, 0x2f, 0x6c, 0x6f, 0x6f, 0x70, 0x2f, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, + 0x63, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -4523,7 +4631,7 @@ func file_client_proto_rawDescGZIP() []byte { } var file_client_proto_enumTypes = make([]protoimpl.EnumInfo, 7) -var file_client_proto_msgTypes = make([]protoimpl.MessageInfo, 43) +var file_client_proto_msgTypes = make([]protoimpl.MessageInfo, 45) var file_client_proto_goTypes = []interface{}{ (AddressType)(0), // 0: looprpc.AddressType (SwapType)(0), // 1: looprpc.SwapType @@ -4575,19 +4683,21 @@ var file_client_proto_goTypes = []interface{}{ (*ListInstantOutsRequest)(nil), // 47: looprpc.ListInstantOutsRequest (*ListInstantOutsResponse)(nil), // 48: looprpc.ListInstantOutsResponse (*InstantOut)(nil), // 49: looprpc.InstantOut - (*swapserverrpc.RouteHint)(nil), // 50: looprpc.RouteHint + (*NewAddressRequest)(nil), // 50: looprpc.NewAddressRequest + (*NewAddressResponse)(nil), // 51: looprpc.NewAddressResponse + (*swapserverrpc.RouteHint)(nil), // 52: looprpc.RouteHint } var file_client_proto_depIdxs = []int32{ 0, // 0: looprpc.LoopOutRequest.account_addr_type:type_name -> looprpc.AddressType - 50, // 1: looprpc.LoopInRequest.route_hints:type_name -> looprpc.RouteHint + 52, // 1: looprpc.LoopInRequest.route_hints:type_name -> looprpc.RouteHint 1, // 2: looprpc.SwapStatus.type:type_name -> looprpc.SwapType 2, // 3: looprpc.SwapStatus.state:type_name -> looprpc.SwapState 3, // 4: looprpc.SwapStatus.failure_reason:type_name -> looprpc.FailureReason 13, // 5: looprpc.ListSwapsRequest.list_swap_filter:type_name -> looprpc.ListSwapsFilter 6, // 6: looprpc.ListSwapsFilter.swap_type:type_name -> looprpc.ListSwapsFilter.SwapTypeFilter 11, // 7: looprpc.ListSwapsResponse.swaps:type_name -> looprpc.SwapStatus - 50, // 8: looprpc.QuoteRequest.loop_in_route_hints:type_name -> looprpc.RouteHint - 50, // 9: looprpc.ProbeRequest.route_hints:type_name -> looprpc.RouteHint + 52, // 8: looprpc.QuoteRequest.loop_in_route_hints:type_name -> looprpc.RouteHint + 52, // 9: looprpc.ProbeRequest.route_hints:type_name -> looprpc.RouteHint 26, // 10: looprpc.TokensResponse.tokens:type_name -> looprpc.L402Token 27, // 11: looprpc.GetInfoResponse.loop_out_stats:type_name -> looprpc.LoopStats 27, // 12: looprpc.GetInfoResponse.loop_in_stats:type_name -> looprpc.LoopStats @@ -4623,29 +4733,31 @@ var file_client_proto_depIdxs = []int32{ 43, // 42: looprpc.SwapClient.InstantOut:input_type -> looprpc.InstantOutRequest 45, // 43: looprpc.SwapClient.InstantOutQuote:input_type -> looprpc.InstantOutQuoteRequest 47, // 44: looprpc.SwapClient.ListInstantOuts:input_type -> looprpc.ListInstantOutsRequest - 9, // 45: looprpc.SwapClient.LoopOut:output_type -> looprpc.SwapResponse - 9, // 46: looprpc.SwapClient.LoopIn:output_type -> looprpc.SwapResponse - 11, // 47: looprpc.SwapClient.Monitor:output_type -> looprpc.SwapStatus - 14, // 48: looprpc.SwapClient.ListSwaps:output_type -> looprpc.ListSwapsResponse - 11, // 49: looprpc.SwapClient.SwapInfo:output_type -> looprpc.SwapStatus - 39, // 50: looprpc.SwapClient.AbandonSwap:output_type -> looprpc.AbandonSwapResponse - 18, // 51: looprpc.SwapClient.LoopOutTerms:output_type -> looprpc.OutTermsResponse - 21, // 52: looprpc.SwapClient.LoopOutQuote:output_type -> looprpc.OutQuoteResponse - 17, // 53: looprpc.SwapClient.GetLoopInTerms:output_type -> looprpc.InTermsResponse - 20, // 54: looprpc.SwapClient.GetLoopInQuote:output_type -> looprpc.InQuoteResponse - 23, // 55: looprpc.SwapClient.Probe:output_type -> looprpc.ProbeResponse - 25, // 56: looprpc.SwapClient.GetL402Tokens:output_type -> looprpc.TokensResponse - 25, // 57: looprpc.SwapClient.GetLsatTokens:output_type -> looprpc.TokensResponse - 29, // 58: looprpc.SwapClient.GetInfo:output_type -> looprpc.GetInfoResponse - 31, // 59: looprpc.SwapClient.GetLiquidityParams:output_type -> looprpc.LiquidityParameters - 34, // 60: looprpc.SwapClient.SetLiquidityParams:output_type -> looprpc.SetLiquidityParamsResponse - 37, // 61: looprpc.SwapClient.SuggestSwaps:output_type -> looprpc.SuggestSwapsResponse - 41, // 62: looprpc.SwapClient.ListReservations:output_type -> looprpc.ListReservationsResponse - 44, // 63: looprpc.SwapClient.InstantOut:output_type -> looprpc.InstantOutResponse - 46, // 64: looprpc.SwapClient.InstantOutQuote:output_type -> looprpc.InstantOutQuoteResponse - 48, // 65: looprpc.SwapClient.ListInstantOuts:output_type -> looprpc.ListInstantOutsResponse - 45, // [45:66] is the sub-list for method output_type - 24, // [24:45] is the sub-list for method input_type + 50, // 45: looprpc.StaticAddressClient.NewAddress:input_type -> looprpc.NewAddressRequest + 9, // 46: looprpc.SwapClient.LoopOut:output_type -> looprpc.SwapResponse + 9, // 47: looprpc.SwapClient.LoopIn:output_type -> looprpc.SwapResponse + 11, // 48: looprpc.SwapClient.Monitor:output_type -> looprpc.SwapStatus + 14, // 49: looprpc.SwapClient.ListSwaps:output_type -> looprpc.ListSwapsResponse + 11, // 50: looprpc.SwapClient.SwapInfo:output_type -> looprpc.SwapStatus + 39, // 51: looprpc.SwapClient.AbandonSwap:output_type -> looprpc.AbandonSwapResponse + 18, // 52: looprpc.SwapClient.LoopOutTerms:output_type -> looprpc.OutTermsResponse + 21, // 53: looprpc.SwapClient.LoopOutQuote:output_type -> looprpc.OutQuoteResponse + 17, // 54: looprpc.SwapClient.GetLoopInTerms:output_type -> looprpc.InTermsResponse + 20, // 55: looprpc.SwapClient.GetLoopInQuote:output_type -> looprpc.InQuoteResponse + 23, // 56: looprpc.SwapClient.Probe:output_type -> looprpc.ProbeResponse + 25, // 57: looprpc.SwapClient.GetL402Tokens:output_type -> looprpc.TokensResponse + 25, // 58: looprpc.SwapClient.GetLsatTokens:output_type -> looprpc.TokensResponse + 29, // 59: looprpc.SwapClient.GetInfo:output_type -> looprpc.GetInfoResponse + 31, // 60: looprpc.SwapClient.GetLiquidityParams:output_type -> looprpc.LiquidityParameters + 34, // 61: looprpc.SwapClient.SetLiquidityParams:output_type -> looprpc.SetLiquidityParamsResponse + 37, // 62: looprpc.SwapClient.SuggestSwaps:output_type -> looprpc.SuggestSwapsResponse + 41, // 63: looprpc.SwapClient.ListReservations:output_type -> looprpc.ListReservationsResponse + 44, // 64: looprpc.SwapClient.InstantOut:output_type -> looprpc.InstantOutResponse + 46, // 65: looprpc.SwapClient.InstantOutQuote:output_type -> looprpc.InstantOutQuoteResponse + 48, // 66: looprpc.SwapClient.ListInstantOuts:output_type -> looprpc.ListInstantOutsResponse + 51, // 67: looprpc.StaticAddressClient.NewAddress:output_type -> looprpc.NewAddressResponse + 46, // [46:68] is the sub-list for method output_type + 24, // [24:46] is the sub-list for method input_type 24, // [24:24] is the sub-list for extension type_name 24, // [24:24] is the sub-list for extension extendee 0, // [0:24] is the sub-list for field type_name @@ -5173,6 +5285,30 @@ func file_client_proto_init() { return nil } } + file_client_proto_msgTypes[43].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*NewAddressRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_client_proto_msgTypes[44].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*NewAddressResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } } type x struct{} out := protoimpl.TypeBuilder{ @@ -5180,9 +5316,9 @@ func file_client_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_client_proto_rawDesc, NumEnums: 7, - NumMessages: 43, + NumMessages: 45, NumExtensions: 0, - NumServices: 1, + NumServices: 2, }, GoTypes: file_client_proto_goTypes, DependencyIndexes: file_client_proto_depIdxs, diff --git a/looprpc/client.proto b/looprpc/client.proto index e968edb..57d2b06 100644 --- a/looprpc/client.proto +++ b/looprpc/client.proto @@ -1319,20 +1319,24 @@ message ClientReservation { The state the reservation is in. */ string state = 2; + /* - The amount that the reservation is for. + The amount that the reservation is for. */ uint64 amount = 3; + /* - The transaction id of the reservation. + The transaction id of the reservation. */ string tx_id = 4; + /* - The vout of the reservation. + The vout of the reservation. */ uint32 vout = 5; + /* - The expiry of the reservation. + The expiry of the reservation. */ uint32 expiry = 6; } @@ -1362,10 +1366,12 @@ message InstantOutResponse { The hash of the swap preimage. */ bytes instant_out_hash = 1; + /* The transaction id of the sweep transaction. */ string sweep_tx_id = 2; + /* The state of the swap. */ @@ -1433,3 +1439,24 @@ message InstantOut { */ string sweep_tx_id = 5; } + +service StaticAddressClient { + /* + NewAddress requests a new static address for loop-ins from the server. + */ + rpc NewAddress (NewAddressRequest) returns (NewAddressResponse); +} + +message NewAddressRequest { + /* + The client's public key for the 2-of-2 MuSig2 taproot static address. + */ + bytes client_key = 1; +} + +message NewAddressResponse { + /* + The taproot static address. + */ + string address = 1; +} diff --git a/looprpc/client.swagger.json b/looprpc/client.swagger.json index 302ac1a..84b50ff 100644 --- a/looprpc/client.swagger.json +++ b/looprpc/client.swagger.json @@ -7,6 +7,9 @@ "tags": [ { "name": "SwapClient" + }, + { + "name": "StaticAddressClient" } ], "consumes": [ @@ -1301,6 +1304,15 @@ } } }, + "looprpcNewAddressResponse": { + "type": "object", + "properties": { + "address": { + "type": "string", + "description": "The taproot static address." + } + } + }, "looprpcOutQuoteResponse": { "type": "object", "properties": { diff --git a/looprpc/client_grpc.pb.go b/looprpc/client_grpc.pb.go index f5bd148..1e5a1c3 100644 --- a/looprpc/client_grpc.pb.go +++ b/looprpc/client_grpc.pb.go @@ -973,3 +973,91 @@ var SwapClient_ServiceDesc = grpc.ServiceDesc{ }, Metadata: "client.proto", } + +// StaticAddressClientClient is the client API for StaticAddressClient service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type StaticAddressClientClient interface { + // NewAddress requests a new static address for loop-ins from the server. + NewAddress(ctx context.Context, in *NewAddressRequest, opts ...grpc.CallOption) (*NewAddressResponse, error) +} + +type staticAddressClientClient struct { + cc grpc.ClientConnInterface +} + +func NewStaticAddressClientClient(cc grpc.ClientConnInterface) StaticAddressClientClient { + return &staticAddressClientClient{cc} +} + +func (c *staticAddressClientClient) NewAddress(ctx context.Context, in *NewAddressRequest, opts ...grpc.CallOption) (*NewAddressResponse, error) { + out := new(NewAddressResponse) + err := c.cc.Invoke(ctx, "/looprpc.StaticAddressClient/NewAddress", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// StaticAddressClientServer is the server API for StaticAddressClient service. +// All implementations must embed UnimplementedStaticAddressClientServer +// for forward compatibility +type StaticAddressClientServer interface { + // NewAddress requests a new static address for loop-ins from the server. + NewAddress(context.Context, *NewAddressRequest) (*NewAddressResponse, error) + mustEmbedUnimplementedStaticAddressClientServer() +} + +// UnimplementedStaticAddressClientServer must be embedded to have forward compatible implementations. +type UnimplementedStaticAddressClientServer struct { +} + +func (UnimplementedStaticAddressClientServer) NewAddress(context.Context, *NewAddressRequest) (*NewAddressResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method NewAddress not implemented") +} +func (UnimplementedStaticAddressClientServer) mustEmbedUnimplementedStaticAddressClientServer() {} + +// UnsafeStaticAddressClientServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to StaticAddressClientServer will +// result in compilation errors. +type UnsafeStaticAddressClientServer interface { + mustEmbedUnimplementedStaticAddressClientServer() +} + +func RegisterStaticAddressClientServer(s grpc.ServiceRegistrar, srv StaticAddressClientServer) { + s.RegisterService(&StaticAddressClient_ServiceDesc, srv) +} + +func _StaticAddressClient_NewAddress_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(NewAddressRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(StaticAddressClientServer).NewAddress(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/looprpc.StaticAddressClient/NewAddress", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(StaticAddressClientServer).NewAddress(ctx, req.(*NewAddressRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// StaticAddressClient_ServiceDesc is the grpc.ServiceDesc for StaticAddressClient service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var StaticAddressClient_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "looprpc.StaticAddressClient", + HandlerType: (*StaticAddressClientServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "NewAddress", + Handler: _StaticAddressClient_NewAddress_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "client.proto", +} diff --git a/looprpc/staticaddressclient.pb.json.go b/looprpc/staticaddressclient.pb.json.go new file mode 100644 index 0000000..6797157 --- /dev/null +++ b/looprpc/staticaddressclient.pb.json.go @@ -0,0 +1,48 @@ +// Code generated by falafel 0.9.1. DO NOT EDIT. +// source: client.proto + +package looprpc + +import ( + "context" + + gateway "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" + "google.golang.org/grpc" + "google.golang.org/protobuf/encoding/protojson" +) + +func RegisterStaticAddressClientJSONCallbacks(registry map[string]func(ctx context.Context, + conn *grpc.ClientConn, reqJSON string, callback func(string, error))) { + + marshaler := &gateway.JSONPb{ + MarshalOptions: protojson.MarshalOptions{ + UseProtoNames: true, + EmitUnpopulated: true, + }, + } + + registry["looprpc.StaticAddressClient.NewAddress"] = func(ctx context.Context, + conn *grpc.ClientConn, reqJSON string, callback func(string, error)) { + + req := &NewAddressRequest{} + err := marshaler.Unmarshal([]byte(reqJSON), req) + if err != nil { + callback("", err) + return + } + + client := NewStaticAddressClientClient(conn) + resp, err := client.NewAddress(ctx, req) + if err != nil { + callback("", err) + return + } + + respBytes, err := marshaler.Marshal(resp) + if err != nil { + callback("", err) + return + } + callback(string(respBytes), nil) + } +} From d2a28a0b901b617d2762630b49834c6da34a0401 Mon Sep 17 00:00:00 2001 From: Slyghtning Date: Thu, 9 Nov 2023 19:16:31 +0100 Subject: [PATCH 14/37] log: static address sub logger --- staticaddr/log.go | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 staticaddr/log.go diff --git a/staticaddr/log.go b/staticaddr/log.go new file mode 100644 index 0000000..53586b3 --- /dev/null +++ b/staticaddr/log.go @@ -0,0 +1,24 @@ +package staticaddr + +import ( + "github.com/btcsuite/btclog" + "github.com/lightningnetwork/lnd/build" +) + +// Subsystem defines the sub system name of this package. +const Subsystem = "SADDR" + +// log is a logger that is initialized with no output filters. This means the +// package will not perform any logging by default until the caller requests it. +var log btclog.Logger + +// The default amount of logging is none. +func init() { + UseLogger(build.NewSubLogger(Subsystem, nil)) +} + +// UseLogger uses a specified Logger to output package logging info. This should +// be used in preference to SetLogWriter if the caller is also using btclog. +func UseLogger(logger btclog.Logger) { + log = logger +} From 46b6dd28c9c75b28759d28015e8e952e8258f243 Mon Sep 17 00:00:00 2001 From: Slyghtning Date: Thu, 9 Nov 2023 19:07:48 +0100 Subject: [PATCH 15/37] loopdb: static address store --- loopdb/sqlite.go | 6 ++ staticaddr/interface.go | 58 ++++++++++++++++ staticaddr/sql_store.go | 146 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 210 insertions(+) create mode 100644 staticaddr/interface.go create mode 100644 staticaddr/sql_store.go diff --git a/loopdb/sqlite.go b/loopdb/sqlite.go index 8493ed6..7a129bb 100644 --- a/loopdb/sqlite.go +++ b/loopdb/sqlite.go @@ -309,6 +309,12 @@ func (b *BaseDB) FixFaultyTimestamps(ctx context.Context) error { return tx.Commit() } +// GetNetwork returns the network(mainnet, testnet...) that the database is +// running on. +func (db *BaseDB) GetNetwork() *chaincfg.Params { + return db.network +} + // TxOptions represents a set of options one can use to control what type of // database transaction is created. Transaction can whether be read or write. type TxOptions interface { diff --git a/staticaddr/interface.go b/staticaddr/interface.go new file mode 100644 index 0000000..8b424fb --- /dev/null +++ b/staticaddr/interface.go @@ -0,0 +1,58 @@ +package staticaddr + +import ( + "context" + "fmt" + + "github.com/btcsuite/btcd/btcec/v2" + "github.com/lightningnetwork/lnd/keychain" +) + +var ( + ErrAddressAlreadyExists = fmt.Errorf("address already exists") + ErrAddressNotFound = fmt.Errorf("address not found") +) + +// AddressStore is the database interface that is used to store and retrieve +// static addresses. +type AddressStore interface { + // CreateStaticAddress inserts a new static address with its parameters + // into the store. + CreateStaticAddress(ctx context.Context, + addrParams *AddressParameters) error + + // GetStaticAddress fetches static address parameters for a given + // address ID. + GetStaticAddress(ctx context.Context, + pkScript []byte) (*AddressParameters, error) + + // GetAllStaticAddresses retrieves all static addresses from the store. + GetAllStaticAddresses(ctx context.Context) ( + []*AddressParameters, error) +} + +// AddressParameters holds all the necessary information for the 2-of-2 multisig +// address. +type AddressParameters struct { + // ClientPubkey is the client's pubkey for the static address. It is + // used for the 2-of-2 funding output as well as for the client's + // timeout path. + ClientPubkey *btcec.PublicKey + + // ClientPubkey is the client's pubkey for the static address. It is + // used for the 2-of-2 funding output. + ServerPubkey *btcec.PublicKey + + // Expiry is the CSV timout value at which the client can claim the + // static address's timout path. + Expiry uint32 + + // PkScript is the unique static address's output script. + PkScript []byte + + // KeyLocator is the locator of the client's key. + KeyLocator keychain.KeyLocator + + // ProtocolVersion is the protocol version of the static address. + ProtocolVersion AddressProtocolVersion +} diff --git a/staticaddr/sql_store.go b/staticaddr/sql_store.go new file mode 100644 index 0000000..7f14f7c --- /dev/null +++ b/staticaddr/sql_store.go @@ -0,0 +1,146 @@ +package staticaddr + +import ( + "context" + "errors" + + "github.com/btcsuite/btcd/btcec/v2" + "github.com/jackc/pgx/v4" + "github.com/lightninglabs/loop/loopdb" + "github.com/lightninglabs/loop/loopdb/sqlc" + "github.com/lightningnetwork/lnd/keychain" +) + +// SqlStore is the backing store for static addresses. +type SqlStore struct { + baseDB *loopdb.BaseDB +} + +// NewSqlStore constructs a new SQLStore from a BaseDB. The BaseDB is agnostic +// to the underlying driver which can be postgres or sqlite. +func NewSqlStore(db *loopdb.BaseDB) *SqlStore { + return &SqlStore{ + baseDB: db, + } +} + +// ExecTx is a wrapper for txBody to abstract the creation and commit of a db +// transaction. The db transaction is embedded in a `*sqlc.Queries` that txBody +// needs to use when executing each one of the queries that need to be applied +// atomically. +func (s *SqlStore) ExecTx(ctx context.Context, txOptions loopdb.TxOptions, + txBody func(queries *sqlc.Queries) error) error { + + // Create the db transaction. + tx, err := s.baseDB.BeginTx(ctx, txOptions) + if err != nil { + return err + } + + // Rollback is safe to call even if the tx is already closed, so if the + // tx commits successfully, this is a no-op. + defer func() { + err := tx.Rollback() + switch { + // If the tx was already closed (it was successfully executed) + // we do not need to log that error. + case errors.Is(err, pgx.ErrTxClosed): + return + + // If this is an unexpected error, log it. + case err != nil: + log.Errorf("unable to rollback db tx: %v", err) + } + }() + + if err := txBody(s.baseDB.Queries.WithTx(tx)); err != nil { + return err + } + + // Commit transaction. + return tx.Commit() +} + +// CreateStaticAddress creates a static address record in the database. +func (s *SqlStore) CreateStaticAddress(ctx context.Context, + addrParams *AddressParameters) error { + + createArgs := sqlc.CreateStaticAddressParams{ + ClientPubkey: addrParams.ClientPubkey.SerializeCompressed(), + ServerPubkey: addrParams.ServerPubkey.SerializeCompressed(), + Expiry: int32(addrParams.Expiry), + ClientKeyFamily: int32(addrParams.KeyLocator.Family), + ClientKeyIndex: int32(addrParams.KeyLocator.Index), + Pkscript: addrParams.PkScript, + ProtocolVersion: int32(addrParams.ProtocolVersion), + } + + return s.baseDB.Queries.CreateStaticAddress(ctx, createArgs) +} + +// GetStaticAddress retrieves static address parameters for a given pkScript. +func (s *SqlStore) GetStaticAddress(ctx context.Context, + pkScript []byte) (*AddressParameters, error) { + + staticAddress, err := s.baseDB.Queries.GetStaticAddress(ctx, pkScript) + if err != nil { + return nil, err + } + + return s.toAddressParameters(staticAddress) +} + +// GetAllStaticAddresses returns all address known to the server. +func (s *SqlStore) GetAllStaticAddresses(ctx context.Context) ( + []*AddressParameters, error) { + + staticAddresses, err := s.baseDB.Queries.AllStaticAddresses(ctx) + if err != nil { + return nil, err + } + + var result []*AddressParameters + for _, address := range staticAddresses { + res, err := s.toAddressParameters(address) + if err != nil { + return nil, err + } + + result = append(result, res) + } + + return result, nil +} + +// Close closes the database connection. +func (s *SqlStore) Close() { + s.baseDB.DB.Close() +} + +// toAddressParameters transforms a database representation of a static address +// to an AddressParameters struct. +func (s *SqlStore) toAddressParameters(row sqlc.StaticAddress) ( + *AddressParameters, error) { + + clientPubkey, err := btcec.ParsePubKey(row.ClientPubkey) + if err != nil { + return nil, err + } + + serverPubkey, err := btcec.ParsePubKey(row.ServerPubkey) + if err != nil { + return nil, err + } + + return &AddressParameters{ + ClientPubkey: clientPubkey, + ServerPubkey: serverPubkey, + PkScript: row.Pkscript, + Expiry: uint32(row.Expiry), + KeyLocator: keychain.KeyLocator{ + Family: keychain.KeyFamily(row.ClientKeyFamily), + Index: uint32(row.ClientKeyIndex), + }, + ProtocolVersion: AddressProtocolVersion(row.ProtocolVersion), + }, nil +} From 9baaede4de3e0ebaca4167bb32e06e1497e9531b Mon Sep 17 00:00:00 2001 From: Slyghtning Date: Thu, 9 Nov 2023 19:09:44 +0100 Subject: [PATCH 16/37] staticaddr: static address manager --- staticaddr/manager.go | 188 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 188 insertions(+) create mode 100644 staticaddr/manager.go diff --git a/staticaddr/manager.go b/staticaddr/manager.go new file mode 100644 index 0000000..04dd1d5 --- /dev/null +++ b/staticaddr/manager.go @@ -0,0 +1,188 @@ +package staticaddr + +import ( + "context" + "sync" + + "github.com/btcsuite/btcd/btcec/v2" + "github.com/btcsuite/btcd/btcec/v2/schnorr" + "github.com/btcsuite/btcd/btcutil" + "github.com/btcsuite/btcd/chaincfg" + "github.com/lightninglabs/lndclient" + "github.com/lightninglabs/loop" + "github.com/lightninglabs/loop/staticaddr/script" + "github.com/lightninglabs/loop/swap" + staticaddressrpc "github.com/lightninglabs/loop/swapserverrpc" + "github.com/lightningnetwork/lnd/input" + "github.com/lightningnetwork/lnd/keychain" +) + +// ManagerConfig holds the configuration for the address manager. +type ManagerConfig struct { + // AddressClient is the client that communicates with the loop server + // to manage static addresses. + AddressClient staticaddressrpc.StaticAddressServerClient + + // SwapClient provides loop rpc functionality. + SwapClient *loop.Client + + // Store is the database store that is used to store static address + // related records. + Store AddressStore + + // WalletKit is the wallet client that is used to derive new keys from + // lnd's wallet. + WalletKit lndclient.WalletKitClient + + // ChainParams is the chain configuration(mainnet, testnet...) this + // manager uses. + ChainParams *chaincfg.Params +} + +// Manager manages the address state machines. +type Manager struct { + cfg *ManagerConfig + + initChan chan struct{} + + sync.Mutex +} + +// NewAddressManager creates a new address manager. +func NewAddressManager(cfg *ManagerConfig) *Manager { + return &Manager{ + cfg: cfg, + initChan: make(chan struct{}), + } +} + +// Run runs the address manager. +func (m *Manager) Run(ctx context.Context) error { + log.Debugf("Starting address manager.") + defer log.Debugf("Address manager stopped.") + + // Communicate to the caller that the address manager has completed its + // initialization. + close(m.initChan) + + <-ctx.Done() + + return nil +} + +// NewAddress starts a new address creation flow. +func (m *Manager) NewAddress(ctx context.Context) (*btcutil.AddressTaproot, + error) { + + // If there's already a static address in the database, we can return + // it. + m.Lock() + addresses, err := m.cfg.Store.GetAllStaticAddresses(ctx) + if err != nil { + m.Unlock() + + return nil, err + } + if len(addresses) > 0 { + clientPubKey := addresses[0].ClientPubkey + serverPubKey := addresses[0].ServerPubkey + expiry := int64(addresses[0].Expiry) + + m.Unlock() + + return m.getTaprootAddress(clientPubKey, serverPubKey, expiry) + } + m.Unlock() + + // We are fetching a new L402 token from the server. There is one static + // address per L402 token allowed. + err = m.cfg.SwapClient.Server.FetchL402(ctx) + if err != nil { + return nil, err + } + + clientPubKey, err := m.cfg.WalletKit.DeriveNextKey( + ctx, swap.StaticAddressKeyFamily, + ) + if err != nil { + return nil, err + } + + // Send our clientPubKey to the server and wait for the server to + // respond with he serverPubKey and the static address CSV expiry. + protocolVersion := CurrentRPCProtocolVersion() + resp, err := m.cfg.AddressClient.ServerNewAddress( + ctx, &staticaddressrpc.ServerNewAddressRequest{ + ProtocolVersion: protocolVersion, + ClientKey: clientPubKey.PubKey.SerializeCompressed(), //nolint:lll + }, + ) + if err != nil { + return nil, err + } + + serverParams := resp.GetParams() + + serverPubKey, err := btcec.ParsePubKey(serverParams.ServerKey) + if err != nil { + return nil, err + } + + staticAddress, err := script.NewStaticAddress( + input.MuSig2Version100RC2, int64(serverParams.Expiry), + clientPubKey.PubKey, serverPubKey, + ) + if err != nil { + return nil, err + } + + pkScript, err := staticAddress.StaticAddressScript() + if err != nil { + return nil, err + } + + // Create the static address from the parameters the server provided and + // store all parameters in the database. + addrParams := &AddressParameters{ + ClientPubkey: clientPubKey.PubKey, + ServerPubkey: serverPubKey, + PkScript: pkScript, + Expiry: serverParams.Expiry, + KeyLocator: keychain.KeyLocator{ + Family: clientPubKey.Family, + Index: clientPubKey.Index, + }, + ProtocolVersion: AddressProtocolVersion(protocolVersion), + } + err = m.cfg.Store.CreateStaticAddress(ctx, addrParams) + if err != nil { + return nil, err + } + + return m.getTaprootAddress( + clientPubKey.PubKey, serverPubKey, int64(serverParams.Expiry), + ) +} + +func (m *Manager) getTaprootAddress(clientPubkey, + serverPubkey *btcec.PublicKey, expiry int64) (*btcutil.AddressTaproot, + error) { + + staticAddress, err := script.NewStaticAddress( + input.MuSig2Version100RC2, expiry, clientPubkey, serverPubkey, + ) + if err != nil { + return nil, err + } + + return btcutil.NewAddressTaproot( + schnorr.SerializePubKey(staticAddress.TaprootKey), + m.cfg.ChainParams, + ) +} + +// WaitInitComplete waits until the address manager has completed its setup. +func (m *Manager) WaitInitComplete() { + defer log.Debugf("Address manager initiation complete.") + <-m.initChan +} From 0178eeb3ccf6cfa74f20aae9004d0918e3f1c46d Mon Sep 17 00:00:00 2001 From: Slyghtning Date: Wed, 14 Feb 2024 17:02:33 +0100 Subject: [PATCH 17/37] staticaddr: static address server --- staticaddr/server.go | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 staticaddr/server.go diff --git a/staticaddr/server.go b/staticaddr/server.go new file mode 100644 index 0000000..4eeca96 --- /dev/null +++ b/staticaddr/server.go @@ -0,0 +1,42 @@ +package staticaddr + +import ( + "context" + + "github.com/lightninglabs/loop/looprpc" + staticaddressrpc "github.com/lightninglabs/loop/swapserverrpc" +) + +// AddressServer holds all fields for the address rpc server. +type AddressServer struct { + addressClient staticaddressrpc.StaticAddressServerClient + manager *Manager + looprpc.UnimplementedStaticAddressClientServer +} + +// NewAddressServer creates a new static address server. +func NewAddressServer(addressClient staticaddressrpc.StaticAddressServerClient, + manager *Manager) *AddressServer { + + return &AddressServer{ + addressClient: addressClient, + manager: manager, + } +} + +// NewAddress is the rpc endpoint for loop clients to request a new static +// address. +func (r *AddressServer) NewAddress(ctx context.Context, + _ *looprpc.NewAddressRequest) (*looprpc.NewAddressResponse, error) { + + address, err := r.manager.NewAddress(ctx) + if err != nil { + return nil, err + } + + log.Infof("New static loop-in address: %s\n", address.String()) + + return &looprpc.NewAddressResponse{ + Address: address.String(), + }, nil +} From cc97b7b7128605f19bff3af3db3b5ebb36d72413 Mon Sep 17 00:00:00 2001 From: Slyghtning Date: Thu, 9 Nov 2023 19:21:24 +0100 Subject: [PATCH 18/37] perms: static address creation permission --- loopd/perms/perms.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/loopd/perms/perms.go b/loopd/perms/perms.go index 8958c23..1f9c923 100644 --- a/loopd/perms/perms.go +++ b/loopd/perms/perms.go @@ -73,6 +73,13 @@ var RequiredPermissions = map[string][]bakery.Op{ Entity: "auth", Action: "read", }}, + "/looprpc.StaticAddressClient/NewAddress": {{ + Entity: "swap", + Action: "read", + }, { + Entity: "loop", + Action: "in", + }}, "/looprpc.SwapClient/GetLsatTokens": {{ Entity: "auth", Action: "read", From ffec5e143a12c5a50efeca09518fc5a512bb0a4b Mon Sep 17 00:00:00 2001 From: Slyghtning Date: Thu, 9 Nov 2023 19:21:07 +0100 Subject: [PATCH 19/37] loop: static address creation client command --- cmd/loop/loopin.go | 3 ++ cmd/loop/main.go | 1 + cmd/loop/staticaddr.go | 76 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 80 insertions(+) create mode 100644 cmd/loop/staticaddr.go diff --git a/cmd/loop/loopin.go b/cmd/loop/loopin.go index 52e8890..2d84a5e 100644 --- a/cmd/loop/loopin.go +++ b/cmd/loop/loopin.go @@ -52,6 +52,9 @@ var ( Name: "in", Usage: "perform an on-chain to off-chain swap (loop in)", ArgsUsage: "amt", + Subcommands: []cli.Command{ + staticAddressCommands, + }, Description: ` Send the amount in satoshis specified by the amt argument off-chain. diff --git a/cmd/loop/main.go b/cmd/loop/main.go index 65485ff..a89e01f 100644 --- a/cmd/loop/main.go +++ b/cmd/loop/main.go @@ -149,6 +149,7 @@ func main() { setLiquidityRuleCommand, suggestSwapCommand, setParamsCommand, getInfoCommand, abandonSwapCommand, reservationsCommands, instantOutCommand, listInstantOutsCommand, + staticAddressCommands, } err := app.Run(os.Args) diff --git a/cmd/loop/staticaddr.go b/cmd/loop/staticaddr.go new file mode 100644 index 0000000..394e5b1 --- /dev/null +++ b/cmd/loop/staticaddr.go @@ -0,0 +1,76 @@ +package main + +import ( + "context" + "fmt" + + "github.com/lightninglabs/loop/looprpc" + "github.com/urfave/cli" +) + +var staticAddressCommands = cli.Command{ + Name: "static", + ShortName: "s", + Usage: "manage static loop-in addresses", + Category: "StaticAddress", + Subcommands: []cli.Command{ + newStaticAddressCommand, + }, +} + +var newStaticAddressCommand = cli.Command{ + Name: "new", + ShortName: "n", + Usage: "Create a new static loop in address.", + Description: ` + Requests a new static loop in address from the server. Funds that are + sent to this address will be locked by a 2:2 multisig between us and the + loop server, or a timeout path that we can sweep once it opens up. The + funds can either be cooperatively spent with a signature from the server + or looped in. + `, + Action: newStaticAddress, +} + +func newStaticAddress(ctx *cli.Context) error { + ctxb := context.Background() + if ctx.NArg() > 0 { + return cli.ShowCommandHelp(ctx, "new") + } + + client, cleanup, err := getAddressClient(ctx) + if err != nil { + return err + } + defer cleanup() + + resp, err := client.NewAddress( + ctxb, &looprpc.NewAddressRequest{}, + ) + if err != nil { + return err + } + + fmt.Printf("Received a new static loop-in address from the server: "+ + "%s\n", resp.Address) + + return nil +} + +func getAddressClient(ctx *cli.Context) (looprpc.StaticAddressClientClient, + func(), error) { + + rpcServer := ctx.GlobalString("rpcserver") + tlsCertPath, macaroonPath, err := extractPathArgs(ctx) + if err != nil { + return nil, nil, err + } + conn, err := getClientConn(rpcServer, tlsCertPath, macaroonPath) + if err != nil { + return nil, nil, err + } + cleanup := func() { conn.Close() } + + addressClient := looprpc.NewStaticAddressClientClient(conn) + return addressClient, cleanup, nil +} From c2a8b72127e36b672b1397ec4afc82881b4bb55c Mon Sep 17 00:00:00 2001 From: Slyghtning Date: Mon, 12 Feb 2024 12:53:30 +0100 Subject: [PATCH 20/37] gomod: tidy --- go.mod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/go.mod b/go.mod index db9c1cb..783735c 100644 --- a/go.mod +++ b/go.mod @@ -17,6 +17,7 @@ require ( github.com/grpc-ecosystem/grpc-gateway/v2 v2.11.3 github.com/jackc/pgconn v1.14.3 github.com/jackc/pgerrcode v0.0.0-20220416144525-469b46aa5efa + github.com/jackc/pgx/v4 v4.18.2 github.com/jessevdk/go-flags v1.4.0 github.com/lib/pq v1.10.7 github.com/lightninglabs/aperture v0.3.2-beta @@ -97,7 +98,6 @@ require ( github.com/jackc/pgproto3/v2 v2.3.3 // indirect github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a // indirect github.com/jackc/pgtype v1.14.0 // indirect - github.com/jackc/pgx/v4 v4.18.2 // indirect github.com/jackpal/gateway v1.0.5 // indirect github.com/jackpal/go-nat-pmp v0.0.0-20170405195558-28a68d0c24ad // indirect github.com/jonboulle/clockwork v0.2.2 // indirect From 2e397d55bb54530171c4b43208be17f211d00976 Mon Sep 17 00:00:00 2001 From: Slyghtning Date: Thu, 9 Nov 2023 19:20:01 +0100 Subject: [PATCH 21/37] looprpc: list unspent static address --- looprpc/client.pb.go | 698 +++++++++++++++++-------- looprpc/client.proto | 52 ++ looprpc/client.swagger.json | 40 ++ looprpc/client_grpc.pb.go | 38 ++ looprpc/staticaddressclient.pb.json.go | 25 + 5 files changed, 632 insertions(+), 221 deletions(-) diff --git a/looprpc/client.pb.go b/looprpc/client.pb.go index 102d243..d1adbe3 100644 --- a/looprpc/client.pb.go +++ b/looprpc/client.pb.go @@ -3917,6 +3917,8 @@ type NewAddressResponse struct { // The taproot static address. Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` + // The CSV expiry of the static address. + Expiry uint32 `protobuf:"varint,2,opt,name=expiry,proto3" json:"expiry,omitempty"` } func (x *NewAddressResponse) Reset() { @@ -3958,6 +3960,194 @@ func (x *NewAddressResponse) GetAddress() string { return "" } +func (x *NewAddressResponse) GetExpiry() uint32 { + if x != nil { + return x.Expiry + } + return 0 +} + +type ListUnspentRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The number of minimum confirmations a utxo must have to be listed. + MinConfs int32 `protobuf:"varint,1,opt,name=min_confs,json=minConfs,proto3" json:"min_confs,omitempty"` + // The number of maximum confirmations a utxo may have to be listed. A zero + // value indicates that there is no maximum. + MaxConfs int32 `protobuf:"varint,2,opt,name=max_confs,json=maxConfs,proto3" json:"max_confs,omitempty"` +} + +func (x *ListUnspentRequest) Reset() { + *x = ListUnspentRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_client_proto_msgTypes[45] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListUnspentRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListUnspentRequest) ProtoMessage() {} + +func (x *ListUnspentRequest) ProtoReflect() protoreflect.Message { + mi := &file_client_proto_msgTypes[45] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListUnspentRequest.ProtoReflect.Descriptor instead. +func (*ListUnspentRequest) Descriptor() ([]byte, []int) { + return file_client_proto_rawDescGZIP(), []int{45} +} + +func (x *ListUnspentRequest) GetMinConfs() int32 { + if x != nil { + return x.MinConfs + } + return 0 +} + +func (x *ListUnspentRequest) GetMaxConfs() int32 { + if x != nil { + return x.MaxConfs + } + return 0 +} + +type ListUnspentResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // A list of utxos behind the static address. + Utxos []*Utxo `protobuf:"bytes,1,rep,name=utxos,proto3" json:"utxos,omitempty"` +} + +func (x *ListUnspentResponse) Reset() { + *x = ListUnspentResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_client_proto_msgTypes[46] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListUnspentResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListUnspentResponse) ProtoMessage() {} + +func (x *ListUnspentResponse) ProtoReflect() protoreflect.Message { + mi := &file_client_proto_msgTypes[46] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListUnspentResponse.ProtoReflect.Descriptor instead. +func (*ListUnspentResponse) Descriptor() ([]byte, []int) { + return file_client_proto_rawDescGZIP(), []int{46} +} + +func (x *ListUnspentResponse) GetUtxos() []*Utxo { + if x != nil { + return x.Utxos + } + return nil +} + +type Utxo struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The static address of the utxo. + StaticAddress string `protobuf:"bytes,1,opt,name=static_address,json=staticAddress,proto3" json:"static_address,omitempty"` + // The value of the unspent coin in satoshis. + AmountSat int64 `protobuf:"varint,2,opt,name=amount_sat,json=amountSat,proto3" json:"amount_sat,omitempty"` + // The outpoint in the form txid:index. + Outpoint string `protobuf:"bytes,3,opt,name=outpoint,proto3" json:"outpoint,omitempty"` + // The number of confirmations for the Utxo. + Confirmations int64 `protobuf:"varint,4,opt,name=confirmations,proto3" json:"confirmations,omitempty"` +} + +func (x *Utxo) Reset() { + *x = Utxo{} + if protoimpl.UnsafeEnabled { + mi := &file_client_proto_msgTypes[47] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Utxo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Utxo) ProtoMessage() {} + +func (x *Utxo) ProtoReflect() protoreflect.Message { + mi := &file_client_proto_msgTypes[47] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Utxo.ProtoReflect.Descriptor instead. +func (*Utxo) Descriptor() ([]byte, []int) { + return file_client_proto_rawDescGZIP(), []int{47} +} + +func (x *Utxo) GetStaticAddress() string { + if x != nil { + return x.StaticAddress + } + return "" +} + +func (x *Utxo) GetAmountSat() int64 { + if x != nil { + return x.AmountSat + } + return 0 +} + +func (x *Utxo) GetOutpoint() string { + if x != nil { + return x.Outpoint + } + return "" +} + +func (x *Utxo) GetConfirmations() int64 { + if x != nil { + return x.Confirmations + } + return 0 +} + var File_client_proto protoreflect.FileDescriptor var file_client_proto_rawDesc = []byte{ @@ -4443,175 +4633,199 @@ var file_client_proto_rawDesc = []byte{ 0x09, 0x73, 0x77, 0x65, 0x65, 0x70, 0x54, 0x78, 0x49, 0x64, 0x22, 0x32, 0x0a, 0x11, 0x4e, 0x65, 0x77, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x0c, 0x52, 0x09, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x4b, 0x65, 0x79, 0x22, 0x2e, + 0x01, 0x28, 0x0c, 0x52, 0x09, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x4b, 0x65, 0x79, 0x22, 0x46, 0x0a, 0x12, 0x4e, 0x65, 0x77, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x2a, 0x3b, - 0x0a, 0x0b, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x54, 0x79, 0x70, 0x65, 0x12, 0x18, 0x0a, - 0x14, 0x41, 0x44, 0x44, 0x52, 0x45, 0x53, 0x53, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, - 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x12, 0x0a, 0x0e, 0x54, 0x41, 0x50, 0x52, 0x4f, - 0x4f, 0x54, 0x5f, 0x50, 0x55, 0x42, 0x4b, 0x45, 0x59, 0x10, 0x01, 0x2a, 0x25, 0x0a, 0x08, 0x53, - 0x77, 0x61, 0x70, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0c, 0x0a, 0x08, 0x4c, 0x4f, 0x4f, 0x50, 0x5f, - 0x4f, 0x55, 0x54, 0x10, 0x00, 0x12, 0x0b, 0x0a, 0x07, 0x4c, 0x4f, 0x4f, 0x50, 0x5f, 0x49, 0x4e, - 0x10, 0x01, 0x2a, 0x73, 0x0a, 0x09, 0x53, 0x77, 0x61, 0x70, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, - 0x0d, 0x0a, 0x09, 0x49, 0x4e, 0x49, 0x54, 0x49, 0x41, 0x54, 0x45, 0x44, 0x10, 0x00, 0x12, 0x15, - 0x0a, 0x11, 0x50, 0x52, 0x45, 0x49, 0x4d, 0x41, 0x47, 0x45, 0x5f, 0x52, 0x45, 0x56, 0x45, 0x41, - 0x4c, 0x45, 0x44, 0x10, 0x01, 0x12, 0x12, 0x0a, 0x0e, 0x48, 0x54, 0x4c, 0x43, 0x5f, 0x50, 0x55, - 0x42, 0x4c, 0x49, 0x53, 0x48, 0x45, 0x44, 0x10, 0x02, 0x12, 0x0b, 0x0a, 0x07, 0x53, 0x55, 0x43, - 0x43, 0x45, 0x53, 0x53, 0x10, 0x03, 0x12, 0x0a, 0x0a, 0x06, 0x46, 0x41, 0x49, 0x4c, 0x45, 0x44, - 0x10, 0x04, 0x12, 0x13, 0x0a, 0x0f, 0x49, 0x4e, 0x56, 0x4f, 0x49, 0x43, 0x45, 0x5f, 0x53, 0x45, - 0x54, 0x54, 0x4c, 0x45, 0x44, 0x10, 0x05, 0x2a, 0xeb, 0x02, 0x0a, 0x0d, 0x46, 0x61, 0x69, 0x6c, - 0x75, 0x72, 0x65, 0x52, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x12, 0x17, 0x0a, 0x13, 0x46, 0x41, 0x49, - 0x4c, 0x55, 0x52, 0x45, 0x5f, 0x52, 0x45, 0x41, 0x53, 0x4f, 0x4e, 0x5f, 0x4e, 0x4f, 0x4e, 0x45, - 0x10, 0x00, 0x12, 0x1b, 0x0a, 0x17, 0x46, 0x41, 0x49, 0x4c, 0x55, 0x52, 0x45, 0x5f, 0x52, 0x45, - 0x41, 0x53, 0x4f, 0x4e, 0x5f, 0x4f, 0x46, 0x46, 0x43, 0x48, 0x41, 0x49, 0x4e, 0x10, 0x01, 0x12, - 0x1a, 0x0a, 0x16, 0x46, 0x41, 0x49, 0x4c, 0x55, 0x52, 0x45, 0x5f, 0x52, 0x45, 0x41, 0x53, 0x4f, - 0x4e, 0x5f, 0x54, 0x49, 0x4d, 0x45, 0x4f, 0x55, 0x54, 0x10, 0x02, 0x12, 0x20, 0x0a, 0x1c, 0x46, - 0x41, 0x49, 0x4c, 0x55, 0x52, 0x45, 0x5f, 0x52, 0x45, 0x41, 0x53, 0x4f, 0x4e, 0x5f, 0x53, 0x57, - 0x45, 0x45, 0x50, 0x5f, 0x54, 0x49, 0x4d, 0x45, 0x4f, 0x55, 0x54, 0x10, 0x03, 0x12, 0x25, 0x0a, - 0x21, 0x46, 0x41, 0x49, 0x4c, 0x55, 0x52, 0x45, 0x5f, 0x52, 0x45, 0x41, 0x53, 0x4f, 0x4e, 0x5f, - 0x49, 0x4e, 0x53, 0x55, 0x46, 0x46, 0x49, 0x43, 0x49, 0x45, 0x4e, 0x54, 0x5f, 0x56, 0x41, 0x4c, - 0x55, 0x45, 0x10, 0x04, 0x12, 0x1c, 0x0a, 0x18, 0x46, 0x41, 0x49, 0x4c, 0x55, 0x52, 0x45, 0x5f, - 0x52, 0x45, 0x41, 0x53, 0x4f, 0x4e, 0x5f, 0x54, 0x45, 0x4d, 0x50, 0x4f, 0x52, 0x41, 0x52, 0x59, - 0x10, 0x05, 0x12, 0x23, 0x0a, 0x1f, 0x46, 0x41, 0x49, 0x4c, 0x55, 0x52, 0x45, 0x5f, 0x52, 0x45, - 0x41, 0x53, 0x4f, 0x4e, 0x5f, 0x49, 0x4e, 0x43, 0x4f, 0x52, 0x52, 0x45, 0x43, 0x54, 0x5f, 0x41, - 0x4d, 0x4f, 0x55, 0x4e, 0x54, 0x10, 0x06, 0x12, 0x1c, 0x0a, 0x18, 0x46, 0x41, 0x49, 0x4c, 0x55, - 0x52, 0x45, 0x5f, 0x52, 0x45, 0x41, 0x53, 0x4f, 0x4e, 0x5f, 0x41, 0x42, 0x41, 0x4e, 0x44, 0x4f, - 0x4e, 0x45, 0x44, 0x10, 0x07, 0x12, 0x31, 0x0a, 0x2d, 0x46, 0x41, 0x49, 0x4c, 0x55, 0x52, 0x45, - 0x5f, 0x52, 0x45, 0x41, 0x53, 0x4f, 0x4e, 0x5f, 0x49, 0x4e, 0x53, 0x55, 0x46, 0x46, 0x49, 0x43, - 0x49, 0x45, 0x4e, 0x54, 0x5f, 0x43, 0x4f, 0x4e, 0x46, 0x49, 0x52, 0x4d, 0x45, 0x44, 0x5f, 0x42, - 0x41, 0x4c, 0x41, 0x4e, 0x43, 0x45, 0x10, 0x08, 0x12, 0x2b, 0x0a, 0x27, 0x46, 0x41, 0x49, 0x4c, - 0x55, 0x52, 0x45, 0x5f, 0x52, 0x45, 0x41, 0x53, 0x4f, 0x4e, 0x5f, 0x49, 0x4e, 0x43, 0x4f, 0x52, - 0x52, 0x45, 0x43, 0x54, 0x5f, 0x48, 0x54, 0x4c, 0x43, 0x5f, 0x41, 0x4d, 0x54, 0x5f, 0x53, 0x57, - 0x45, 0x50, 0x54, 0x10, 0x09, 0x2a, 0x2f, 0x0a, 0x11, 0x4c, 0x69, 0x71, 0x75, 0x69, 0x64, 0x69, - 0x74, 0x79, 0x52, 0x75, 0x6c, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0b, 0x0a, 0x07, 0x55, 0x4e, - 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x0d, 0x0a, 0x09, 0x54, 0x48, 0x52, 0x45, 0x53, - 0x48, 0x4f, 0x4c, 0x44, 0x10, 0x01, 0x2a, 0xa6, 0x03, 0x0a, 0x0a, 0x41, 0x75, 0x74, 0x6f, 0x52, - 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x12, 0x17, 0x0a, 0x13, 0x41, 0x55, 0x54, 0x4f, 0x5f, 0x52, 0x45, - 0x41, 0x53, 0x4f, 0x4e, 0x5f, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x22, - 0x0a, 0x1e, 0x41, 0x55, 0x54, 0x4f, 0x5f, 0x52, 0x45, 0x41, 0x53, 0x4f, 0x4e, 0x5f, 0x42, 0x55, - 0x44, 0x47, 0x45, 0x54, 0x5f, 0x4e, 0x4f, 0x54, 0x5f, 0x53, 0x54, 0x41, 0x52, 0x54, 0x45, 0x44, - 0x10, 0x01, 0x12, 0x1a, 0x0a, 0x16, 0x41, 0x55, 0x54, 0x4f, 0x5f, 0x52, 0x45, 0x41, 0x53, 0x4f, - 0x4e, 0x5f, 0x53, 0x57, 0x45, 0x45, 0x50, 0x5f, 0x46, 0x45, 0x45, 0x53, 0x10, 0x02, 0x12, 0x1e, - 0x0a, 0x1a, 0x41, 0x55, 0x54, 0x4f, 0x5f, 0x52, 0x45, 0x41, 0x53, 0x4f, 0x4e, 0x5f, 0x42, 0x55, - 0x44, 0x47, 0x45, 0x54, 0x5f, 0x45, 0x4c, 0x41, 0x50, 0x53, 0x45, 0x44, 0x10, 0x03, 0x12, 0x19, - 0x0a, 0x15, 0x41, 0x55, 0x54, 0x4f, 0x5f, 0x52, 0x45, 0x41, 0x53, 0x4f, 0x4e, 0x5f, 0x49, 0x4e, - 0x5f, 0x46, 0x4c, 0x49, 0x47, 0x48, 0x54, 0x10, 0x04, 0x12, 0x18, 0x0a, 0x14, 0x41, 0x55, 0x54, - 0x4f, 0x5f, 0x52, 0x45, 0x41, 0x53, 0x4f, 0x4e, 0x5f, 0x53, 0x57, 0x41, 0x50, 0x5f, 0x46, 0x45, - 0x45, 0x10, 0x05, 0x12, 0x19, 0x0a, 0x15, 0x41, 0x55, 0x54, 0x4f, 0x5f, 0x52, 0x45, 0x41, 0x53, - 0x4f, 0x4e, 0x5f, 0x4d, 0x49, 0x4e, 0x45, 0x52, 0x5f, 0x46, 0x45, 0x45, 0x10, 0x06, 0x12, 0x16, - 0x0a, 0x12, 0x41, 0x55, 0x54, 0x4f, 0x5f, 0x52, 0x45, 0x41, 0x53, 0x4f, 0x4e, 0x5f, 0x50, 0x52, - 0x45, 0x50, 0x41, 0x59, 0x10, 0x07, 0x12, 0x1f, 0x0a, 0x1b, 0x41, 0x55, 0x54, 0x4f, 0x5f, 0x52, - 0x45, 0x41, 0x53, 0x4f, 0x4e, 0x5f, 0x46, 0x41, 0x49, 0x4c, 0x55, 0x52, 0x45, 0x5f, 0x42, 0x41, - 0x43, 0x4b, 0x4f, 0x46, 0x46, 0x10, 0x08, 0x12, 0x18, 0x0a, 0x14, 0x41, 0x55, 0x54, 0x4f, 0x5f, - 0x52, 0x45, 0x41, 0x53, 0x4f, 0x4e, 0x5f, 0x4c, 0x4f, 0x4f, 0x50, 0x5f, 0x4f, 0x55, 0x54, 0x10, - 0x09, 0x12, 0x17, 0x0a, 0x13, 0x41, 0x55, 0x54, 0x4f, 0x5f, 0x52, 0x45, 0x41, 0x53, 0x4f, 0x4e, - 0x5f, 0x4c, 0x4f, 0x4f, 0x50, 0x5f, 0x49, 0x4e, 0x10, 0x0a, 0x12, 0x1c, 0x0a, 0x18, 0x41, 0x55, - 0x54, 0x4f, 0x5f, 0x52, 0x45, 0x41, 0x53, 0x4f, 0x4e, 0x5f, 0x4c, 0x49, 0x51, 0x55, 0x49, 0x44, - 0x49, 0x54, 0x59, 0x5f, 0x4f, 0x4b, 0x10, 0x0b, 0x12, 0x23, 0x0a, 0x1f, 0x41, 0x55, 0x54, 0x4f, - 0x5f, 0x52, 0x45, 0x41, 0x53, 0x4f, 0x4e, 0x5f, 0x42, 0x55, 0x44, 0x47, 0x45, 0x54, 0x5f, 0x49, - 0x4e, 0x53, 0x55, 0x46, 0x46, 0x49, 0x43, 0x49, 0x45, 0x4e, 0x54, 0x10, 0x0c, 0x12, 0x20, 0x0a, - 0x1c, 0x41, 0x55, 0x54, 0x4f, 0x5f, 0x52, 0x45, 0x41, 0x53, 0x4f, 0x4e, 0x5f, 0x46, 0x45, 0x45, - 0x5f, 0x49, 0x4e, 0x53, 0x55, 0x46, 0x46, 0x49, 0x43, 0x49, 0x45, 0x4e, 0x54, 0x10, 0x0d, 0x32, - 0xd8, 0x0b, 0x0a, 0x0a, 0x53, 0x77, 0x61, 0x70, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x12, 0x39, - 0x0a, 0x07, 0x4c, 0x6f, 0x6f, 0x70, 0x4f, 0x75, 0x74, 0x12, 0x17, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, - 0x72, 0x70, 0x63, 0x2e, 0x4c, 0x6f, 0x6f, 0x70, 0x4f, 0x75, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x1a, 0x15, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x53, 0x77, 0x61, - 0x70, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x37, 0x0a, 0x06, 0x4c, 0x6f, 0x6f, - 0x70, 0x49, 0x6e, 0x12, 0x16, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x4c, 0x6f, - 0x6f, 0x70, 0x49, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x15, 0x2e, 0x6c, 0x6f, - 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x53, 0x77, 0x61, 0x70, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x12, 0x39, 0x0a, 0x07, 0x4d, 0x6f, 0x6e, 0x69, 0x74, 0x6f, 0x72, 0x12, 0x17, 0x2e, - 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x4d, 0x6f, 0x6e, 0x69, 0x74, 0x6f, 0x72, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x13, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, - 0x2e, 0x53, 0x77, 0x61, 0x70, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x30, 0x01, 0x12, 0x42, 0x0a, - 0x09, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x77, 0x61, 0x70, 0x73, 0x12, 0x19, 0x2e, 0x6c, 0x6f, 0x6f, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x16, + 0x0a, 0x06, 0x65, 0x78, 0x70, 0x69, 0x72, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x06, + 0x65, 0x78, 0x70, 0x69, 0x72, 0x79, 0x22, 0x4e, 0x0a, 0x12, 0x4c, 0x69, 0x73, 0x74, 0x55, 0x6e, + 0x73, 0x70, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1b, 0x0a, 0x09, + 0x6d, 0x69, 0x6e, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, + 0x08, 0x6d, 0x69, 0x6e, 0x43, 0x6f, 0x6e, 0x66, 0x73, 0x12, 0x1b, 0x0a, 0x09, 0x6d, 0x61, 0x78, + 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x6d, 0x61, + 0x78, 0x43, 0x6f, 0x6e, 0x66, 0x73, 0x22, 0x3a, 0x0a, 0x13, 0x4c, 0x69, 0x73, 0x74, 0x55, 0x6e, + 0x73, 0x70, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x23, 0x0a, + 0x05, 0x75, 0x74, 0x78, 0x6f, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x6c, + 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x55, 0x74, 0x78, 0x6f, 0x52, 0x05, 0x75, 0x74, 0x78, + 0x6f, 0x73, 0x22, 0x8e, 0x01, 0x0a, 0x04, 0x55, 0x74, 0x78, 0x6f, 0x12, 0x25, 0x0a, 0x0e, 0x73, + 0x74, 0x61, 0x74, 0x69, 0x63, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x0d, 0x73, 0x74, 0x61, 0x74, 0x69, 0x63, 0x41, 0x64, 0x64, 0x72, 0x65, + 0x73, 0x73, 0x12, 0x1d, 0x0a, 0x0a, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x5f, 0x73, 0x61, 0x74, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x53, 0x61, + 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x6f, 0x75, 0x74, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x08, 0x6f, 0x75, 0x74, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x12, 0x24, 0x0a, + 0x0d, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x72, 0x6d, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x04, + 0x20, 0x01, 0x28, 0x03, 0x52, 0x0d, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x72, 0x6d, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x73, 0x2a, 0x3b, 0x0a, 0x0b, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x54, 0x79, + 0x70, 0x65, 0x12, 0x18, 0x0a, 0x14, 0x41, 0x44, 0x44, 0x52, 0x45, 0x53, 0x53, 0x5f, 0x54, 0x59, + 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x12, 0x0a, 0x0e, + 0x54, 0x41, 0x50, 0x52, 0x4f, 0x4f, 0x54, 0x5f, 0x50, 0x55, 0x42, 0x4b, 0x45, 0x59, 0x10, 0x01, + 0x2a, 0x25, 0x0a, 0x08, 0x53, 0x77, 0x61, 0x70, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0c, 0x0a, 0x08, + 0x4c, 0x4f, 0x4f, 0x50, 0x5f, 0x4f, 0x55, 0x54, 0x10, 0x00, 0x12, 0x0b, 0x0a, 0x07, 0x4c, 0x4f, + 0x4f, 0x50, 0x5f, 0x49, 0x4e, 0x10, 0x01, 0x2a, 0x73, 0x0a, 0x09, 0x53, 0x77, 0x61, 0x70, 0x53, + 0x74, 0x61, 0x74, 0x65, 0x12, 0x0d, 0x0a, 0x09, 0x49, 0x4e, 0x49, 0x54, 0x49, 0x41, 0x54, 0x45, + 0x44, 0x10, 0x00, 0x12, 0x15, 0x0a, 0x11, 0x50, 0x52, 0x45, 0x49, 0x4d, 0x41, 0x47, 0x45, 0x5f, + 0x52, 0x45, 0x56, 0x45, 0x41, 0x4c, 0x45, 0x44, 0x10, 0x01, 0x12, 0x12, 0x0a, 0x0e, 0x48, 0x54, + 0x4c, 0x43, 0x5f, 0x50, 0x55, 0x42, 0x4c, 0x49, 0x53, 0x48, 0x45, 0x44, 0x10, 0x02, 0x12, 0x0b, + 0x0a, 0x07, 0x53, 0x55, 0x43, 0x43, 0x45, 0x53, 0x53, 0x10, 0x03, 0x12, 0x0a, 0x0a, 0x06, 0x46, + 0x41, 0x49, 0x4c, 0x45, 0x44, 0x10, 0x04, 0x12, 0x13, 0x0a, 0x0f, 0x49, 0x4e, 0x56, 0x4f, 0x49, + 0x43, 0x45, 0x5f, 0x53, 0x45, 0x54, 0x54, 0x4c, 0x45, 0x44, 0x10, 0x05, 0x2a, 0xeb, 0x02, 0x0a, + 0x0d, 0x46, 0x61, 0x69, 0x6c, 0x75, 0x72, 0x65, 0x52, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x12, 0x17, + 0x0a, 0x13, 0x46, 0x41, 0x49, 0x4c, 0x55, 0x52, 0x45, 0x5f, 0x52, 0x45, 0x41, 0x53, 0x4f, 0x4e, + 0x5f, 0x4e, 0x4f, 0x4e, 0x45, 0x10, 0x00, 0x12, 0x1b, 0x0a, 0x17, 0x46, 0x41, 0x49, 0x4c, 0x55, + 0x52, 0x45, 0x5f, 0x52, 0x45, 0x41, 0x53, 0x4f, 0x4e, 0x5f, 0x4f, 0x46, 0x46, 0x43, 0x48, 0x41, + 0x49, 0x4e, 0x10, 0x01, 0x12, 0x1a, 0x0a, 0x16, 0x46, 0x41, 0x49, 0x4c, 0x55, 0x52, 0x45, 0x5f, + 0x52, 0x45, 0x41, 0x53, 0x4f, 0x4e, 0x5f, 0x54, 0x49, 0x4d, 0x45, 0x4f, 0x55, 0x54, 0x10, 0x02, + 0x12, 0x20, 0x0a, 0x1c, 0x46, 0x41, 0x49, 0x4c, 0x55, 0x52, 0x45, 0x5f, 0x52, 0x45, 0x41, 0x53, + 0x4f, 0x4e, 0x5f, 0x53, 0x57, 0x45, 0x45, 0x50, 0x5f, 0x54, 0x49, 0x4d, 0x45, 0x4f, 0x55, 0x54, + 0x10, 0x03, 0x12, 0x25, 0x0a, 0x21, 0x46, 0x41, 0x49, 0x4c, 0x55, 0x52, 0x45, 0x5f, 0x52, 0x45, + 0x41, 0x53, 0x4f, 0x4e, 0x5f, 0x49, 0x4e, 0x53, 0x55, 0x46, 0x46, 0x49, 0x43, 0x49, 0x45, 0x4e, + 0x54, 0x5f, 0x56, 0x41, 0x4c, 0x55, 0x45, 0x10, 0x04, 0x12, 0x1c, 0x0a, 0x18, 0x46, 0x41, 0x49, + 0x4c, 0x55, 0x52, 0x45, 0x5f, 0x52, 0x45, 0x41, 0x53, 0x4f, 0x4e, 0x5f, 0x54, 0x45, 0x4d, 0x50, + 0x4f, 0x52, 0x41, 0x52, 0x59, 0x10, 0x05, 0x12, 0x23, 0x0a, 0x1f, 0x46, 0x41, 0x49, 0x4c, 0x55, + 0x52, 0x45, 0x5f, 0x52, 0x45, 0x41, 0x53, 0x4f, 0x4e, 0x5f, 0x49, 0x4e, 0x43, 0x4f, 0x52, 0x52, + 0x45, 0x43, 0x54, 0x5f, 0x41, 0x4d, 0x4f, 0x55, 0x4e, 0x54, 0x10, 0x06, 0x12, 0x1c, 0x0a, 0x18, + 0x46, 0x41, 0x49, 0x4c, 0x55, 0x52, 0x45, 0x5f, 0x52, 0x45, 0x41, 0x53, 0x4f, 0x4e, 0x5f, 0x41, + 0x42, 0x41, 0x4e, 0x44, 0x4f, 0x4e, 0x45, 0x44, 0x10, 0x07, 0x12, 0x31, 0x0a, 0x2d, 0x46, 0x41, + 0x49, 0x4c, 0x55, 0x52, 0x45, 0x5f, 0x52, 0x45, 0x41, 0x53, 0x4f, 0x4e, 0x5f, 0x49, 0x4e, 0x53, + 0x55, 0x46, 0x46, 0x49, 0x43, 0x49, 0x45, 0x4e, 0x54, 0x5f, 0x43, 0x4f, 0x4e, 0x46, 0x49, 0x52, + 0x4d, 0x45, 0x44, 0x5f, 0x42, 0x41, 0x4c, 0x41, 0x4e, 0x43, 0x45, 0x10, 0x08, 0x12, 0x2b, 0x0a, + 0x27, 0x46, 0x41, 0x49, 0x4c, 0x55, 0x52, 0x45, 0x5f, 0x52, 0x45, 0x41, 0x53, 0x4f, 0x4e, 0x5f, + 0x49, 0x4e, 0x43, 0x4f, 0x52, 0x52, 0x45, 0x43, 0x54, 0x5f, 0x48, 0x54, 0x4c, 0x43, 0x5f, 0x41, + 0x4d, 0x54, 0x5f, 0x53, 0x57, 0x45, 0x50, 0x54, 0x10, 0x09, 0x2a, 0x2f, 0x0a, 0x11, 0x4c, 0x69, + 0x71, 0x75, 0x69, 0x64, 0x69, 0x74, 0x79, 0x52, 0x75, 0x6c, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, + 0x0b, 0x0a, 0x07, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x0d, 0x0a, 0x09, + 0x54, 0x48, 0x52, 0x45, 0x53, 0x48, 0x4f, 0x4c, 0x44, 0x10, 0x01, 0x2a, 0xa6, 0x03, 0x0a, 0x0a, + 0x41, 0x75, 0x74, 0x6f, 0x52, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x12, 0x17, 0x0a, 0x13, 0x41, 0x55, + 0x54, 0x4f, 0x5f, 0x52, 0x45, 0x41, 0x53, 0x4f, 0x4e, 0x5f, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, + 0x4e, 0x10, 0x00, 0x12, 0x22, 0x0a, 0x1e, 0x41, 0x55, 0x54, 0x4f, 0x5f, 0x52, 0x45, 0x41, 0x53, + 0x4f, 0x4e, 0x5f, 0x42, 0x55, 0x44, 0x47, 0x45, 0x54, 0x5f, 0x4e, 0x4f, 0x54, 0x5f, 0x53, 0x54, + 0x41, 0x52, 0x54, 0x45, 0x44, 0x10, 0x01, 0x12, 0x1a, 0x0a, 0x16, 0x41, 0x55, 0x54, 0x4f, 0x5f, + 0x52, 0x45, 0x41, 0x53, 0x4f, 0x4e, 0x5f, 0x53, 0x57, 0x45, 0x45, 0x50, 0x5f, 0x46, 0x45, 0x45, + 0x53, 0x10, 0x02, 0x12, 0x1e, 0x0a, 0x1a, 0x41, 0x55, 0x54, 0x4f, 0x5f, 0x52, 0x45, 0x41, 0x53, + 0x4f, 0x4e, 0x5f, 0x42, 0x55, 0x44, 0x47, 0x45, 0x54, 0x5f, 0x45, 0x4c, 0x41, 0x50, 0x53, 0x45, + 0x44, 0x10, 0x03, 0x12, 0x19, 0x0a, 0x15, 0x41, 0x55, 0x54, 0x4f, 0x5f, 0x52, 0x45, 0x41, 0x53, + 0x4f, 0x4e, 0x5f, 0x49, 0x4e, 0x5f, 0x46, 0x4c, 0x49, 0x47, 0x48, 0x54, 0x10, 0x04, 0x12, 0x18, + 0x0a, 0x14, 0x41, 0x55, 0x54, 0x4f, 0x5f, 0x52, 0x45, 0x41, 0x53, 0x4f, 0x4e, 0x5f, 0x53, 0x57, + 0x41, 0x50, 0x5f, 0x46, 0x45, 0x45, 0x10, 0x05, 0x12, 0x19, 0x0a, 0x15, 0x41, 0x55, 0x54, 0x4f, + 0x5f, 0x52, 0x45, 0x41, 0x53, 0x4f, 0x4e, 0x5f, 0x4d, 0x49, 0x4e, 0x45, 0x52, 0x5f, 0x46, 0x45, + 0x45, 0x10, 0x06, 0x12, 0x16, 0x0a, 0x12, 0x41, 0x55, 0x54, 0x4f, 0x5f, 0x52, 0x45, 0x41, 0x53, + 0x4f, 0x4e, 0x5f, 0x50, 0x52, 0x45, 0x50, 0x41, 0x59, 0x10, 0x07, 0x12, 0x1f, 0x0a, 0x1b, 0x41, + 0x55, 0x54, 0x4f, 0x5f, 0x52, 0x45, 0x41, 0x53, 0x4f, 0x4e, 0x5f, 0x46, 0x41, 0x49, 0x4c, 0x55, + 0x52, 0x45, 0x5f, 0x42, 0x41, 0x43, 0x4b, 0x4f, 0x46, 0x46, 0x10, 0x08, 0x12, 0x18, 0x0a, 0x14, + 0x41, 0x55, 0x54, 0x4f, 0x5f, 0x52, 0x45, 0x41, 0x53, 0x4f, 0x4e, 0x5f, 0x4c, 0x4f, 0x4f, 0x50, + 0x5f, 0x4f, 0x55, 0x54, 0x10, 0x09, 0x12, 0x17, 0x0a, 0x13, 0x41, 0x55, 0x54, 0x4f, 0x5f, 0x52, + 0x45, 0x41, 0x53, 0x4f, 0x4e, 0x5f, 0x4c, 0x4f, 0x4f, 0x50, 0x5f, 0x49, 0x4e, 0x10, 0x0a, 0x12, + 0x1c, 0x0a, 0x18, 0x41, 0x55, 0x54, 0x4f, 0x5f, 0x52, 0x45, 0x41, 0x53, 0x4f, 0x4e, 0x5f, 0x4c, + 0x49, 0x51, 0x55, 0x49, 0x44, 0x49, 0x54, 0x59, 0x5f, 0x4f, 0x4b, 0x10, 0x0b, 0x12, 0x23, 0x0a, + 0x1f, 0x41, 0x55, 0x54, 0x4f, 0x5f, 0x52, 0x45, 0x41, 0x53, 0x4f, 0x4e, 0x5f, 0x42, 0x55, 0x44, + 0x47, 0x45, 0x54, 0x5f, 0x49, 0x4e, 0x53, 0x55, 0x46, 0x46, 0x49, 0x43, 0x49, 0x45, 0x4e, 0x54, + 0x10, 0x0c, 0x12, 0x20, 0x0a, 0x1c, 0x41, 0x55, 0x54, 0x4f, 0x5f, 0x52, 0x45, 0x41, 0x53, 0x4f, + 0x4e, 0x5f, 0x46, 0x45, 0x45, 0x5f, 0x49, 0x4e, 0x53, 0x55, 0x46, 0x46, 0x49, 0x43, 0x49, 0x45, + 0x4e, 0x54, 0x10, 0x0d, 0x32, 0xd8, 0x0b, 0x0a, 0x0a, 0x53, 0x77, 0x61, 0x70, 0x43, 0x6c, 0x69, + 0x65, 0x6e, 0x74, 0x12, 0x39, 0x0a, 0x07, 0x4c, 0x6f, 0x6f, 0x70, 0x4f, 0x75, 0x74, 0x12, 0x17, + 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x4c, 0x6f, 0x6f, 0x70, 0x4f, 0x75, 0x74, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x15, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, + 0x63, 0x2e, 0x53, 0x77, 0x61, 0x70, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x37, + 0x0a, 0x06, 0x4c, 0x6f, 0x6f, 0x70, 0x49, 0x6e, 0x12, 0x16, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, + 0x70, 0x63, 0x2e, 0x4c, 0x6f, 0x6f, 0x70, 0x49, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x15, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x53, 0x77, 0x61, 0x70, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x39, 0x0a, 0x07, 0x4d, 0x6f, 0x6e, 0x69, 0x74, + 0x6f, 0x72, 0x12, 0x17, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x4d, 0x6f, 0x6e, + 0x69, 0x74, 0x6f, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x13, 0x2e, 0x6c, 0x6f, + 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x53, 0x77, 0x61, 0x70, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, + 0x30, 0x01, 0x12, 0x42, 0x0a, 0x09, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x77, 0x61, 0x70, 0x73, 0x12, + 0x19, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x77, + 0x61, 0x70, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1a, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x77, 0x61, 0x70, 0x73, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1a, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, - 0x4c, 0x69, 0x73, 0x74, 0x53, 0x77, 0x61, 0x70, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x12, 0x39, 0x0a, 0x08, 0x53, 0x77, 0x61, 0x70, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x18, 0x2e, - 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x53, 0x77, 0x61, 0x70, 0x49, 0x6e, 0x66, 0x6f, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x13, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, - 0x63, 0x2e, 0x53, 0x77, 0x61, 0x70, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x48, 0x0a, 0x0b, - 0x41, 0x62, 0x61, 0x6e, 0x64, 0x6f, 0x6e, 0x53, 0x77, 0x61, 0x70, 0x12, 0x1b, 0x2e, 0x6c, 0x6f, - 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x41, 0x62, 0x61, 0x6e, 0x64, 0x6f, 0x6e, 0x53, 0x77, 0x61, - 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, - 0x70, 0x63, 0x2e, 0x41, 0x62, 0x61, 0x6e, 0x64, 0x6f, 0x6e, 0x53, 0x77, 0x61, 0x70, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x40, 0x0a, 0x0c, 0x4c, 0x6f, 0x6f, 0x70, 0x4f, 0x75, - 0x74, 0x54, 0x65, 0x72, 0x6d, 0x73, 0x12, 0x15, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, - 0x2e, 0x54, 0x65, 0x72, 0x6d, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, - 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x4f, 0x75, 0x74, 0x54, 0x65, 0x72, 0x6d, 0x73, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x40, 0x0a, 0x0c, 0x4c, 0x6f, 0x6f, 0x70, - 0x4f, 0x75, 0x74, 0x51, 0x75, 0x6f, 0x74, 0x65, 0x12, 0x15, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, - 0x70, 0x63, 0x2e, 0x51, 0x75, 0x6f, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, - 0x19, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x4f, 0x75, 0x74, 0x51, 0x75, 0x6f, - 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x41, 0x0a, 0x0e, 0x47, 0x65, - 0x74, 0x4c, 0x6f, 0x6f, 0x70, 0x49, 0x6e, 0x54, 0x65, 0x72, 0x6d, 0x73, 0x12, 0x15, 0x2e, 0x6c, - 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x54, 0x65, 0x72, 0x6d, 0x73, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x49, 0x6e, - 0x54, 0x65, 0x72, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x41, 0x0a, - 0x0e, 0x47, 0x65, 0x74, 0x4c, 0x6f, 0x6f, 0x70, 0x49, 0x6e, 0x51, 0x75, 0x6f, 0x74, 0x65, 0x12, - 0x15, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x51, 0x75, 0x6f, 0x74, 0x65, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, - 0x2e, 0x49, 0x6e, 0x51, 0x75, 0x6f, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x12, 0x36, 0x0a, 0x05, 0x50, 0x72, 0x6f, 0x62, 0x65, 0x12, 0x15, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, - 0x72, 0x70, 0x63, 0x2e, 0x50, 0x72, 0x6f, 0x62, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x1a, 0x16, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x50, 0x72, 0x6f, 0x62, 0x65, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x40, 0x0a, 0x0d, 0x47, 0x65, 0x74, 0x4c, - 0x34, 0x30, 0x32, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x12, 0x16, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, - 0x72, 0x70, 0x63, 0x2e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x1a, 0x17, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x54, 0x6f, 0x6b, 0x65, - 0x6e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x40, 0x0a, 0x0d, 0x47, 0x65, - 0x74, 0x4c, 0x73, 0x61, 0x74, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x12, 0x16, 0x2e, 0x6c, 0x6f, - 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x54, 0x6f, - 0x6b, 0x65, 0x6e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3c, 0x0a, 0x07, - 0x47, 0x65, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x17, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, - 0x63, 0x2e, 0x47, 0x65, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x1a, 0x18, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x47, 0x65, 0x74, 0x49, 0x6e, - 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x56, 0x0a, 0x12, 0x47, 0x65, - 0x74, 0x4c, 0x69, 0x71, 0x75, 0x69, 0x64, 0x69, 0x74, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, - 0x12, 0x22, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x47, 0x65, 0x74, 0x4c, 0x69, - 0x71, 0x75, 0x69, 0x64, 0x69, 0x74, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x4c, - 0x69, 0x71, 0x75, 0x69, 0x64, 0x69, 0x74, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, - 0x72, 0x73, 0x12, 0x5d, 0x0a, 0x12, 0x53, 0x65, 0x74, 0x4c, 0x69, 0x71, 0x75, 0x69, 0x64, 0x69, - 0x74, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x22, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, - 0x70, 0x63, 0x2e, 0x53, 0x65, 0x74, 0x4c, 0x69, 0x71, 0x75, 0x69, 0x64, 0x69, 0x74, 0x79, 0x50, - 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x23, 0x2e, 0x6c, - 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x53, 0x65, 0x74, 0x4c, 0x69, 0x71, 0x75, 0x69, 0x64, - 0x69, 0x74, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x12, 0x4b, 0x0a, 0x0c, 0x53, 0x75, 0x67, 0x67, 0x65, 0x73, 0x74, 0x53, 0x77, 0x61, 0x70, - 0x73, 0x12, 0x1c, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x53, 0x75, 0x67, 0x67, - 0x65, 0x73, 0x74, 0x53, 0x77, 0x61, 0x70, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, - 0x1d, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x53, 0x75, 0x67, 0x67, 0x65, 0x73, - 0x74, 0x53, 0x77, 0x61, 0x70, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x57, - 0x0a, 0x10, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x73, 0x12, 0x20, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x4c, 0x69, 0x73, - 0x74, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x1a, 0x21, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x4c, - 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x45, 0x0a, 0x0a, 0x49, 0x6e, 0x73, 0x74, 0x61, - 0x6e, 0x74, 0x4f, 0x75, 0x74, 0x12, 0x1a, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, - 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x74, 0x4f, 0x75, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x1a, 0x1b, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x49, 0x6e, 0x73, 0x74, - 0x61, 0x6e, 0x74, 0x4f, 0x75, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x54, - 0x0a, 0x0f, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x74, 0x4f, 0x75, 0x74, 0x51, 0x75, 0x6f, 0x74, - 0x65, 0x12, 0x1f, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x49, 0x6e, 0x73, 0x74, - 0x61, 0x6e, 0x74, 0x4f, 0x75, 0x74, 0x51, 0x75, 0x6f, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x1a, 0x20, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x49, 0x6e, 0x73, - 0x74, 0x61, 0x6e, 0x74, 0x4f, 0x75, 0x74, 0x51, 0x75, 0x6f, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x54, 0x0a, 0x0f, 0x4c, 0x69, 0x73, 0x74, 0x49, 0x6e, 0x73, 0x74, - 0x61, 0x6e, 0x74, 0x4f, 0x75, 0x74, 0x73, 0x12, 0x1f, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, - 0x63, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x74, 0x4f, 0x75, 0x74, - 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x20, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, - 0x70, 0x63, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x74, 0x4f, 0x75, - 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0x5c, 0x0a, 0x13, 0x53, 0x74, - 0x61, 0x74, 0x69, 0x63, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x43, 0x6c, 0x69, 0x65, 0x6e, - 0x74, 0x12, 0x45, 0x0a, 0x0a, 0x4e, 0x65, 0x77, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, - 0x1a, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x4e, 0x65, 0x77, 0x41, 0x64, 0x64, - 0x72, 0x65, 0x73, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1b, 0x2e, 0x6c, 0x6f, - 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x4e, 0x65, 0x77, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x39, 0x0a, 0x08, 0x53, 0x77, 0x61, 0x70, 0x49, 0x6e, + 0x66, 0x6f, 0x12, 0x18, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x53, 0x77, 0x61, + 0x70, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x13, 0x2e, 0x6c, + 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x53, 0x77, 0x61, 0x70, 0x53, 0x74, 0x61, 0x74, 0x75, + 0x73, 0x12, 0x48, 0x0a, 0x0b, 0x41, 0x62, 0x61, 0x6e, 0x64, 0x6f, 0x6e, 0x53, 0x77, 0x61, 0x70, + 0x12, 0x1b, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x41, 0x62, 0x61, 0x6e, 0x64, + 0x6f, 0x6e, 0x53, 0x77, 0x61, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, + 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x41, 0x62, 0x61, 0x6e, 0x64, 0x6f, 0x6e, 0x53, + 0x77, 0x61, 0x70, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x40, 0x0a, 0x0c, 0x4c, + 0x6f, 0x6f, 0x70, 0x4f, 0x75, 0x74, 0x54, 0x65, 0x72, 0x6d, 0x73, 0x12, 0x15, 0x2e, 0x6c, 0x6f, + 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x54, 0x65, 0x72, 0x6d, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x4f, 0x75, 0x74, + 0x54, 0x65, 0x72, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x40, 0x0a, + 0x0c, 0x4c, 0x6f, 0x6f, 0x70, 0x4f, 0x75, 0x74, 0x51, 0x75, 0x6f, 0x74, 0x65, 0x12, 0x15, 0x2e, + 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x51, 0x75, 0x6f, 0x74, 0x65, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x4f, + 0x75, 0x74, 0x51, 0x75, 0x6f, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, + 0x41, 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x4c, 0x6f, 0x6f, 0x70, 0x49, 0x6e, 0x54, 0x65, 0x72, 0x6d, + 0x73, 0x12, 0x15, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x54, 0x65, 0x72, 0x6d, + 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, + 0x70, 0x63, 0x2e, 0x49, 0x6e, 0x54, 0x65, 0x72, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x12, 0x41, 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x4c, 0x6f, 0x6f, 0x70, 0x49, 0x6e, 0x51, + 0x75, 0x6f, 0x74, 0x65, 0x12, 0x15, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x51, + 0x75, 0x6f, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x6c, 0x6f, + 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x49, 0x6e, 0x51, 0x75, 0x6f, 0x74, 0x65, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x36, 0x0a, 0x05, 0x50, 0x72, 0x6f, 0x62, 0x65, 0x12, 0x15, + 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x50, 0x72, 0x6f, 0x62, 0x65, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, + 0x50, 0x72, 0x6f, 0x62, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x40, 0x0a, + 0x0d, 0x47, 0x65, 0x74, 0x4c, 0x34, 0x30, 0x32, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x12, 0x16, + 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, + 0x2e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, + 0x40, 0x0a, 0x0d, 0x47, 0x65, 0x74, 0x4c, 0x73, 0x61, 0x74, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x73, + 0x12, 0x16, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, + 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, + 0x70, 0x63, 0x2e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x3c, 0x0a, 0x07, 0x47, 0x65, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x17, 0x2e, 0x6c, + 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x47, 0x65, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, + 0x47, 0x65, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, + 0x56, 0x0a, 0x12, 0x47, 0x65, 0x74, 0x4c, 0x69, 0x71, 0x75, 0x69, 0x64, 0x69, 0x74, 0x79, 0x50, + 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x22, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, + 0x47, 0x65, 0x74, 0x4c, 0x69, 0x71, 0x75, 0x69, 0x64, 0x69, 0x74, 0x79, 0x50, 0x61, 0x72, 0x61, + 0x6d, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, + 0x72, 0x70, 0x63, 0x2e, 0x4c, 0x69, 0x71, 0x75, 0x69, 0x64, 0x69, 0x74, 0x79, 0x50, 0x61, 0x72, + 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x12, 0x5d, 0x0a, 0x12, 0x53, 0x65, 0x74, 0x4c, 0x69, + 0x71, 0x75, 0x69, 0x64, 0x69, 0x74, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x22, 0x2e, + 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x53, 0x65, 0x74, 0x4c, 0x69, 0x71, 0x75, 0x69, + 0x64, 0x69, 0x74, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x23, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x53, 0x65, 0x74, 0x4c, + 0x69, 0x71, 0x75, 0x69, 0x64, 0x69, 0x74, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4b, 0x0a, 0x0c, 0x53, 0x75, 0x67, 0x67, 0x65, 0x73, + 0x74, 0x53, 0x77, 0x61, 0x70, 0x73, 0x12, 0x1c, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, + 0x2e, 0x53, 0x75, 0x67, 0x67, 0x65, 0x73, 0x74, 0x53, 0x77, 0x61, 0x70, 0x73, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x53, + 0x75, 0x67, 0x67, 0x65, 0x73, 0x74, 0x53, 0x77, 0x61, 0x70, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x57, 0x0a, 0x10, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x65, 0x72, + 0x76, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x20, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, + 0x63, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x21, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, + 0x72, 0x70, 0x63, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x45, 0x0a, 0x0a, + 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x74, 0x4f, 0x75, 0x74, 0x12, 0x1a, 0x2e, 0x6c, 0x6f, 0x6f, + 0x70, 0x72, 0x70, 0x63, 0x2e, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x74, 0x4f, 0x75, 0x74, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1b, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, + 0x2e, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x74, 0x4f, 0x75, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x54, 0x0a, 0x0f, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x74, 0x4f, 0x75, + 0x74, 0x51, 0x75, 0x6f, 0x74, 0x65, 0x12, 0x1f, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, + 0x2e, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x74, 0x4f, 0x75, 0x74, 0x51, 0x75, 0x6f, 0x74, 0x65, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x20, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, + 0x63, 0x2e, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x74, 0x4f, 0x75, 0x74, 0x51, 0x75, 0x6f, 0x74, + 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x54, 0x0a, 0x0f, 0x4c, 0x69, 0x73, + 0x74, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x74, 0x4f, 0x75, 0x74, 0x73, 0x12, 0x1f, 0x2e, 0x6c, + 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x49, 0x6e, 0x73, 0x74, 0x61, + 0x6e, 0x74, 0x4f, 0x75, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x20, 0x2e, + 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x49, 0x6e, 0x73, 0x74, + 0x61, 0x6e, 0x74, 0x4f, 0x75, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, + 0xa6, 0x01, 0x0a, 0x13, 0x53, 0x74, 0x61, 0x74, 0x69, 0x63, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, + 0x73, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x12, 0x45, 0x0a, 0x0a, 0x4e, 0x65, 0x77, 0x41, 0x64, + 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x1a, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, + 0x4e, 0x65, 0x77, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x1b, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x4e, 0x65, 0x77, 0x41, + 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x48, + 0x0a, 0x0b, 0x4c, 0x69, 0x73, 0x74, 0x55, 0x6e, 0x73, 0x70, 0x65, 0x6e, 0x74, 0x12, 0x1b, 0x2e, + 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x55, 0x6e, 0x73, 0x70, + 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x6c, 0x6f, 0x6f, + 0x70, 0x72, 0x70, 0x63, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x55, 0x6e, 0x73, 0x70, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x27, 0x5a, 0x25, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6c, 0x69, 0x67, 0x68, 0x74, 0x6e, 0x69, 0x6e, 0x67, 0x6c, 0x61, 0x62, 0x73, 0x2f, 0x6c, 0x6f, 0x6f, 0x70, 0x2f, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, @@ -4631,7 +4845,7 @@ func file_client_proto_rawDescGZIP() []byte { } var file_client_proto_enumTypes = make([]protoimpl.EnumInfo, 7) -var file_client_proto_msgTypes = make([]protoimpl.MessageInfo, 45) +var file_client_proto_msgTypes = make([]protoimpl.MessageInfo, 48) var file_client_proto_goTypes = []interface{}{ (AddressType)(0), // 0: looprpc.AddressType (SwapType)(0), // 1: looprpc.SwapType @@ -4685,19 +4899,22 @@ var file_client_proto_goTypes = []interface{}{ (*InstantOut)(nil), // 49: looprpc.InstantOut (*NewAddressRequest)(nil), // 50: looprpc.NewAddressRequest (*NewAddressResponse)(nil), // 51: looprpc.NewAddressResponse - (*swapserverrpc.RouteHint)(nil), // 52: looprpc.RouteHint + (*ListUnspentRequest)(nil), // 52: looprpc.ListUnspentRequest + (*ListUnspentResponse)(nil), // 53: looprpc.ListUnspentResponse + (*Utxo)(nil), // 54: looprpc.Utxo + (*swapserverrpc.RouteHint)(nil), // 55: looprpc.RouteHint } var file_client_proto_depIdxs = []int32{ 0, // 0: looprpc.LoopOutRequest.account_addr_type:type_name -> looprpc.AddressType - 52, // 1: looprpc.LoopInRequest.route_hints:type_name -> looprpc.RouteHint + 55, // 1: looprpc.LoopInRequest.route_hints:type_name -> looprpc.RouteHint 1, // 2: looprpc.SwapStatus.type:type_name -> looprpc.SwapType 2, // 3: looprpc.SwapStatus.state:type_name -> looprpc.SwapState 3, // 4: looprpc.SwapStatus.failure_reason:type_name -> looprpc.FailureReason 13, // 5: looprpc.ListSwapsRequest.list_swap_filter:type_name -> looprpc.ListSwapsFilter 6, // 6: looprpc.ListSwapsFilter.swap_type:type_name -> looprpc.ListSwapsFilter.SwapTypeFilter 11, // 7: looprpc.ListSwapsResponse.swaps:type_name -> looprpc.SwapStatus - 52, // 8: looprpc.QuoteRequest.loop_in_route_hints:type_name -> looprpc.RouteHint - 52, // 9: looprpc.ProbeRequest.route_hints:type_name -> looprpc.RouteHint + 55, // 8: looprpc.QuoteRequest.loop_in_route_hints:type_name -> looprpc.RouteHint + 55, // 9: looprpc.ProbeRequest.route_hints:type_name -> looprpc.RouteHint 26, // 10: looprpc.TokensResponse.tokens:type_name -> looprpc.L402Token 27, // 11: looprpc.GetInfoResponse.loop_out_stats:type_name -> looprpc.LoopStats 27, // 12: looprpc.GetInfoResponse.loop_in_stats:type_name -> looprpc.LoopStats @@ -4712,55 +4929,58 @@ var file_client_proto_depIdxs = []int32{ 36, // 21: looprpc.SuggestSwapsResponse.disqualified:type_name -> looprpc.Disqualified 42, // 22: looprpc.ListReservationsResponse.reservations:type_name -> looprpc.ClientReservation 49, // 23: looprpc.ListInstantOutsResponse.swaps:type_name -> looprpc.InstantOut - 7, // 24: looprpc.SwapClient.LoopOut:input_type -> looprpc.LoopOutRequest - 8, // 25: looprpc.SwapClient.LoopIn:input_type -> looprpc.LoopInRequest - 10, // 26: looprpc.SwapClient.Monitor:input_type -> looprpc.MonitorRequest - 12, // 27: looprpc.SwapClient.ListSwaps:input_type -> looprpc.ListSwapsRequest - 15, // 28: looprpc.SwapClient.SwapInfo:input_type -> looprpc.SwapInfoRequest - 38, // 29: looprpc.SwapClient.AbandonSwap:input_type -> looprpc.AbandonSwapRequest - 16, // 30: looprpc.SwapClient.LoopOutTerms:input_type -> looprpc.TermsRequest - 19, // 31: looprpc.SwapClient.LoopOutQuote:input_type -> looprpc.QuoteRequest - 16, // 32: looprpc.SwapClient.GetLoopInTerms:input_type -> looprpc.TermsRequest - 19, // 33: looprpc.SwapClient.GetLoopInQuote:input_type -> looprpc.QuoteRequest - 22, // 34: looprpc.SwapClient.Probe:input_type -> looprpc.ProbeRequest - 24, // 35: looprpc.SwapClient.GetL402Tokens:input_type -> looprpc.TokensRequest - 24, // 36: looprpc.SwapClient.GetLsatTokens:input_type -> looprpc.TokensRequest - 28, // 37: looprpc.SwapClient.GetInfo:input_type -> looprpc.GetInfoRequest - 30, // 38: looprpc.SwapClient.GetLiquidityParams:input_type -> looprpc.GetLiquidityParamsRequest - 33, // 39: looprpc.SwapClient.SetLiquidityParams:input_type -> looprpc.SetLiquidityParamsRequest - 35, // 40: looprpc.SwapClient.SuggestSwaps:input_type -> looprpc.SuggestSwapsRequest - 40, // 41: looprpc.SwapClient.ListReservations:input_type -> looprpc.ListReservationsRequest - 43, // 42: looprpc.SwapClient.InstantOut:input_type -> looprpc.InstantOutRequest - 45, // 43: looprpc.SwapClient.InstantOutQuote:input_type -> looprpc.InstantOutQuoteRequest - 47, // 44: looprpc.SwapClient.ListInstantOuts:input_type -> looprpc.ListInstantOutsRequest - 50, // 45: looprpc.StaticAddressClient.NewAddress:input_type -> looprpc.NewAddressRequest - 9, // 46: looprpc.SwapClient.LoopOut:output_type -> looprpc.SwapResponse - 9, // 47: looprpc.SwapClient.LoopIn:output_type -> looprpc.SwapResponse - 11, // 48: looprpc.SwapClient.Monitor:output_type -> looprpc.SwapStatus - 14, // 49: looprpc.SwapClient.ListSwaps:output_type -> looprpc.ListSwapsResponse - 11, // 50: looprpc.SwapClient.SwapInfo:output_type -> looprpc.SwapStatus - 39, // 51: looprpc.SwapClient.AbandonSwap:output_type -> looprpc.AbandonSwapResponse - 18, // 52: looprpc.SwapClient.LoopOutTerms:output_type -> looprpc.OutTermsResponse - 21, // 53: looprpc.SwapClient.LoopOutQuote:output_type -> looprpc.OutQuoteResponse - 17, // 54: looprpc.SwapClient.GetLoopInTerms:output_type -> looprpc.InTermsResponse - 20, // 55: looprpc.SwapClient.GetLoopInQuote:output_type -> looprpc.InQuoteResponse - 23, // 56: looprpc.SwapClient.Probe:output_type -> looprpc.ProbeResponse - 25, // 57: looprpc.SwapClient.GetL402Tokens:output_type -> looprpc.TokensResponse - 25, // 58: looprpc.SwapClient.GetLsatTokens:output_type -> looprpc.TokensResponse - 29, // 59: looprpc.SwapClient.GetInfo:output_type -> looprpc.GetInfoResponse - 31, // 60: looprpc.SwapClient.GetLiquidityParams:output_type -> looprpc.LiquidityParameters - 34, // 61: looprpc.SwapClient.SetLiquidityParams:output_type -> looprpc.SetLiquidityParamsResponse - 37, // 62: looprpc.SwapClient.SuggestSwaps:output_type -> looprpc.SuggestSwapsResponse - 41, // 63: looprpc.SwapClient.ListReservations:output_type -> looprpc.ListReservationsResponse - 44, // 64: looprpc.SwapClient.InstantOut:output_type -> looprpc.InstantOutResponse - 46, // 65: looprpc.SwapClient.InstantOutQuote:output_type -> looprpc.InstantOutQuoteResponse - 48, // 66: looprpc.SwapClient.ListInstantOuts:output_type -> looprpc.ListInstantOutsResponse - 51, // 67: looprpc.StaticAddressClient.NewAddress:output_type -> looprpc.NewAddressResponse - 46, // [46:68] is the sub-list for method output_type - 24, // [24:46] is the sub-list for method input_type - 24, // [24:24] is the sub-list for extension type_name - 24, // [24:24] is the sub-list for extension extendee - 0, // [0:24] is the sub-list for field type_name + 54, // 24: looprpc.ListUnspentResponse.utxos:type_name -> looprpc.Utxo + 7, // 25: looprpc.SwapClient.LoopOut:input_type -> looprpc.LoopOutRequest + 8, // 26: looprpc.SwapClient.LoopIn:input_type -> looprpc.LoopInRequest + 10, // 27: looprpc.SwapClient.Monitor:input_type -> looprpc.MonitorRequest + 12, // 28: looprpc.SwapClient.ListSwaps:input_type -> looprpc.ListSwapsRequest + 15, // 29: looprpc.SwapClient.SwapInfo:input_type -> looprpc.SwapInfoRequest + 38, // 30: looprpc.SwapClient.AbandonSwap:input_type -> looprpc.AbandonSwapRequest + 16, // 31: looprpc.SwapClient.LoopOutTerms:input_type -> looprpc.TermsRequest + 19, // 32: looprpc.SwapClient.LoopOutQuote:input_type -> looprpc.QuoteRequest + 16, // 33: looprpc.SwapClient.GetLoopInTerms:input_type -> looprpc.TermsRequest + 19, // 34: looprpc.SwapClient.GetLoopInQuote:input_type -> looprpc.QuoteRequest + 22, // 35: looprpc.SwapClient.Probe:input_type -> looprpc.ProbeRequest + 24, // 36: looprpc.SwapClient.GetL402Tokens:input_type -> looprpc.TokensRequest + 24, // 37: looprpc.SwapClient.GetLsatTokens:input_type -> looprpc.TokensRequest + 28, // 38: looprpc.SwapClient.GetInfo:input_type -> looprpc.GetInfoRequest + 30, // 39: looprpc.SwapClient.GetLiquidityParams:input_type -> looprpc.GetLiquidityParamsRequest + 33, // 40: looprpc.SwapClient.SetLiquidityParams:input_type -> looprpc.SetLiquidityParamsRequest + 35, // 41: looprpc.SwapClient.SuggestSwaps:input_type -> looprpc.SuggestSwapsRequest + 40, // 42: looprpc.SwapClient.ListReservations:input_type -> looprpc.ListReservationsRequest + 43, // 43: looprpc.SwapClient.InstantOut:input_type -> looprpc.InstantOutRequest + 45, // 44: looprpc.SwapClient.InstantOutQuote:input_type -> looprpc.InstantOutQuoteRequest + 47, // 45: looprpc.SwapClient.ListInstantOuts:input_type -> looprpc.ListInstantOutsRequest + 50, // 46: looprpc.StaticAddressClient.NewAddress:input_type -> looprpc.NewAddressRequest + 52, // 47: looprpc.StaticAddressClient.ListUnspent:input_type -> looprpc.ListUnspentRequest + 9, // 48: looprpc.SwapClient.LoopOut:output_type -> looprpc.SwapResponse + 9, // 49: looprpc.SwapClient.LoopIn:output_type -> looprpc.SwapResponse + 11, // 50: looprpc.SwapClient.Monitor:output_type -> looprpc.SwapStatus + 14, // 51: looprpc.SwapClient.ListSwaps:output_type -> looprpc.ListSwapsResponse + 11, // 52: looprpc.SwapClient.SwapInfo:output_type -> looprpc.SwapStatus + 39, // 53: looprpc.SwapClient.AbandonSwap:output_type -> looprpc.AbandonSwapResponse + 18, // 54: looprpc.SwapClient.LoopOutTerms:output_type -> looprpc.OutTermsResponse + 21, // 55: looprpc.SwapClient.LoopOutQuote:output_type -> looprpc.OutQuoteResponse + 17, // 56: looprpc.SwapClient.GetLoopInTerms:output_type -> looprpc.InTermsResponse + 20, // 57: looprpc.SwapClient.GetLoopInQuote:output_type -> looprpc.InQuoteResponse + 23, // 58: looprpc.SwapClient.Probe:output_type -> looprpc.ProbeResponse + 25, // 59: looprpc.SwapClient.GetL402Tokens:output_type -> looprpc.TokensResponse + 25, // 60: looprpc.SwapClient.GetLsatTokens:output_type -> looprpc.TokensResponse + 29, // 61: looprpc.SwapClient.GetInfo:output_type -> looprpc.GetInfoResponse + 31, // 62: looprpc.SwapClient.GetLiquidityParams:output_type -> looprpc.LiquidityParameters + 34, // 63: looprpc.SwapClient.SetLiquidityParams:output_type -> looprpc.SetLiquidityParamsResponse + 37, // 64: looprpc.SwapClient.SuggestSwaps:output_type -> looprpc.SuggestSwapsResponse + 41, // 65: looprpc.SwapClient.ListReservations:output_type -> looprpc.ListReservationsResponse + 44, // 66: looprpc.SwapClient.InstantOut:output_type -> looprpc.InstantOutResponse + 46, // 67: looprpc.SwapClient.InstantOutQuote:output_type -> looprpc.InstantOutQuoteResponse + 48, // 68: looprpc.SwapClient.ListInstantOuts:output_type -> looprpc.ListInstantOutsResponse + 51, // 69: looprpc.StaticAddressClient.NewAddress:output_type -> looprpc.NewAddressResponse + 53, // 70: looprpc.StaticAddressClient.ListUnspent:output_type -> looprpc.ListUnspentResponse + 48, // [48:71] is the sub-list for method output_type + 25, // [25:48] is the sub-list for method input_type + 25, // [25:25] is the sub-list for extension type_name + 25, // [25:25] is the sub-list for extension extendee + 0, // [0:25] is the sub-list for field type_name } func init() { file_client_proto_init() } @@ -5309,6 +5529,42 @@ func file_client_proto_init() { return nil } } + file_client_proto_msgTypes[45].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListUnspentRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_client_proto_msgTypes[46].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListUnspentResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_client_proto_msgTypes[47].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Utxo); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } } type x struct{} out := protoimpl.TypeBuilder{ @@ -5316,7 +5572,7 @@ func file_client_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_client_proto_rawDesc, NumEnums: 7, - NumMessages: 45, + NumMessages: 48, NumExtensions: 0, NumServices: 2, }, diff --git a/looprpc/client.proto b/looprpc/client.proto index 57d2b06..b7ccb95 100644 --- a/looprpc/client.proto +++ b/looprpc/client.proto @@ -1445,6 +1445,11 @@ service StaticAddressClient { NewAddress requests a new static address for loop-ins from the server. */ rpc NewAddress (NewAddressRequest) returns (NewAddressResponse); + + /* + ListUnspent returns a list of utxos behind a static address. + */ + rpc ListUnspent (ListUnspentRequest) returns (ListUnspentResponse); } message NewAddressRequest { @@ -1459,4 +1464,51 @@ message NewAddressResponse { The taproot static address. */ string address = 1; + + /* + The CSV expiry of the static address. + */ + uint32 expiry = 2; +} + +message ListUnspentRequest { + /* + The number of minimum confirmations a utxo must have to be listed. + */ + int32 min_confs = 1; + + /* + The number of maximum confirmations a utxo may have to be listed. A zero + value indicates that there is no maximum. + */ + int32 max_confs = 2; +} + +message ListUnspentResponse { + /* + A list of utxos behind the static address. + */ + repeated Utxo utxos = 1; +} + +message Utxo { + /* + The static address of the utxo. + */ + string static_address = 1; + + /* + The value of the unspent coin in satoshis. + */ + int64 amount_sat = 2; + + /* + The outpoint in the form txid:index. + */ + string outpoint = 3; + + /* + The number of confirmations for the Utxo. + */ + int64 confirmations = 4; } diff --git a/looprpc/client.swagger.json b/looprpc/client.swagger.json index 84b50ff..247727b 100644 --- a/looprpc/client.swagger.json +++ b/looprpc/client.swagger.json @@ -1126,6 +1126,18 @@ } } }, + "looprpcListUnspentResponse": { + "type": "object", + "properties": { + "utxos": { + "type": "array", + "items": { + "$ref": "#/definitions/looprpcUtxo" + }, + "description": "A list of utxos behind the static address." + } + } + }, "looprpcLoopInRequest": { "type": "object", "properties": { @@ -1310,6 +1322,11 @@ "address": { "type": "string", "description": "The taproot static address." + }, + "expiry": { + "type": "integer", + "format": "int64", + "description": "The CSV expiry of the static address." } } }, @@ -1575,6 +1592,29 @@ } } }, + "looprpcUtxo": { + "type": "object", + "properties": { + "static_address": { + "type": "string", + "description": "The static address of the utxo." + }, + "amount_sat": { + "type": "string", + "format": "int64", + "description": "The value of the unspent coin in satoshis." + }, + "outpoint": { + "type": "string", + "description": "The outpoint in the form txid:index." + }, + "confirmations": { + "type": "string", + "format": "int64", + "description": "The number of confirmations for the Utxo." + } + } + }, "protobufAny": { "type": "object", "properties": { diff --git a/looprpc/client_grpc.pb.go b/looprpc/client_grpc.pb.go index 1e5a1c3..c9f1929 100644 --- a/looprpc/client_grpc.pb.go +++ b/looprpc/client_grpc.pb.go @@ -980,6 +980,8 @@ var SwapClient_ServiceDesc = grpc.ServiceDesc{ type StaticAddressClientClient interface { // NewAddress requests a new static address for loop-ins from the server. NewAddress(ctx context.Context, in *NewAddressRequest, opts ...grpc.CallOption) (*NewAddressResponse, error) + // ListUnspent returns a list of utxos behind a static address. + ListUnspent(ctx context.Context, in *ListUnspentRequest, opts ...grpc.CallOption) (*ListUnspentResponse, error) } type staticAddressClientClient struct { @@ -999,12 +1001,23 @@ func (c *staticAddressClientClient) NewAddress(ctx context.Context, in *NewAddre return out, nil } +func (c *staticAddressClientClient) ListUnspent(ctx context.Context, in *ListUnspentRequest, opts ...grpc.CallOption) (*ListUnspentResponse, error) { + out := new(ListUnspentResponse) + err := c.cc.Invoke(ctx, "/looprpc.StaticAddressClient/ListUnspent", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // StaticAddressClientServer is the server API for StaticAddressClient service. // All implementations must embed UnimplementedStaticAddressClientServer // for forward compatibility type StaticAddressClientServer interface { // NewAddress requests a new static address for loop-ins from the server. NewAddress(context.Context, *NewAddressRequest) (*NewAddressResponse, error) + // ListUnspent returns a list of utxos behind a static address. + ListUnspent(context.Context, *ListUnspentRequest) (*ListUnspentResponse, error) mustEmbedUnimplementedStaticAddressClientServer() } @@ -1015,6 +1028,9 @@ type UnimplementedStaticAddressClientServer struct { func (UnimplementedStaticAddressClientServer) NewAddress(context.Context, *NewAddressRequest) (*NewAddressResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method NewAddress not implemented") } +func (UnimplementedStaticAddressClientServer) ListUnspent(context.Context, *ListUnspentRequest) (*ListUnspentResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ListUnspent not implemented") +} func (UnimplementedStaticAddressClientServer) mustEmbedUnimplementedStaticAddressClientServer() {} // UnsafeStaticAddressClientServer may be embedded to opt out of forward compatibility for this service. @@ -1046,6 +1062,24 @@ func _StaticAddressClient_NewAddress_Handler(srv interface{}, ctx context.Contex return interceptor(ctx, in, info, handler) } +func _StaticAddressClient_ListUnspent_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ListUnspentRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(StaticAddressClientServer).ListUnspent(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/looprpc.StaticAddressClient/ListUnspent", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(StaticAddressClientServer).ListUnspent(ctx, req.(*ListUnspentRequest)) + } + return interceptor(ctx, in, info, handler) +} + // StaticAddressClient_ServiceDesc is the grpc.ServiceDesc for StaticAddressClient service. // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) @@ -1057,6 +1091,10 @@ var StaticAddressClient_ServiceDesc = grpc.ServiceDesc{ MethodName: "NewAddress", Handler: _StaticAddressClient_NewAddress_Handler, }, + { + MethodName: "ListUnspent", + Handler: _StaticAddressClient_ListUnspent_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "client.proto", diff --git a/looprpc/staticaddressclient.pb.json.go b/looprpc/staticaddressclient.pb.json.go index 6797157..afa5506 100644 --- a/looprpc/staticaddressclient.pb.json.go +++ b/looprpc/staticaddressclient.pb.json.go @@ -45,4 +45,29 @@ func RegisterStaticAddressClientJSONCallbacks(registry map[string]func(ctx conte } callback(string(respBytes), nil) } + + registry["looprpc.StaticAddressClient.ListUnspent"] = func(ctx context.Context, + conn *grpc.ClientConn, reqJSON string, callback func(string, error)) { + + req := &ListUnspentRequest{} + err := marshaler.Unmarshal([]byte(reqJSON), req) + if err != nil { + callback("", err) + return + } + + client := NewStaticAddressClientClient(conn) + resp, err := client.ListUnspent(ctx, req) + if err != nil { + callback("", err) + return + } + + respBytes, err := marshaler.Marshal(resp) + if err != nil { + callback("", err) + return + } + callback(string(respBytes), nil) + } } From 7192cdfa6dd76e2389103fa57958c14d4b3c81e2 Mon Sep 17 00:00:00 2001 From: Slyghtning Date: Wed, 25 Oct 2023 15:43:24 +0200 Subject: [PATCH 22/37] staticaddr: track and list spends in manager --- staticaddr/manager.go | 63 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) diff --git a/staticaddr/manager.go b/staticaddr/manager.go index 04dd1d5..a963c86 100644 --- a/staticaddr/manager.go +++ b/staticaddr/manager.go @@ -1,7 +1,9 @@ package staticaddr import ( + "bytes" "context" + "fmt" "sync" "github.com/btcsuite/btcd/btcec/v2" @@ -15,6 +17,7 @@ import ( staticaddressrpc "github.com/lightninglabs/loop/swapserverrpc" "github.com/lightningnetwork/lnd/input" "github.com/lightningnetwork/lnd/keychain" + "github.com/lightningnetwork/lnd/lnwallet" ) // ManagerConfig holds the configuration for the address manager. @@ -159,6 +162,19 @@ func (m *Manager) NewAddress(ctx context.Context) (*btcutil.AddressTaproot, return nil, err } + // Import the static address tapscript into our lnd wallet, so we can + // track unspent outputs of it. + tapScript := input.TapscriptFullTree( + staticAddress.InternalPubKey, *staticAddress.TimeoutLeaf, + ) + addr, err := m.cfg.WalletKit.ImportTaprootScript(ctx, tapScript) + if err != nil { + return nil, err + } + + log.Infof("imported static address taproot script to lnd wallet: %v", + addr) + return m.getTaprootAddress( clientPubKey.PubKey, serverPubKey, int64(serverParams.Expiry), ) @@ -186,3 +202,50 @@ func (m *Manager) WaitInitComplete() { defer log.Debugf("Address manager initiation complete.") <-m.initChan } + +// ListUnspentRaw returns a list of utxos at the static address. +func (m *Manager) ListUnspentRaw(ctx context.Context, minConfs, + maxConfs int32) (*btcutil.AddressTaproot, []*lnwallet.Utxo, error) { + + addresses, err := m.cfg.Store.GetAllStaticAddresses(ctx) + switch { + case err != nil: + return nil, nil, err + + case len(addresses) == 0: + return nil, nil, fmt.Errorf("no address found") + + case len(addresses) > 1: + return nil, nil, fmt.Errorf("more than one address found") + } + + staticAddress := addresses[0] + + // List all unspent utxos the wallet sees, regardless of the number of + // confirmations. + utxos, err := m.cfg.WalletKit.ListUnspent( + ctx, minConfs, maxConfs, + ) + if err != nil { + return nil, nil, err + } + + // Filter the list of lnd's unspent utxos for the pkScript of our static + // address. + var filteredUtxos []*lnwallet.Utxo + for _, utxo := range utxos { + if bytes.Equal(utxo.PkScript, staticAddress.PkScript) { + filteredUtxos = append(filteredUtxos, utxo) + } + } + + taprootAddress, err := m.getTaprootAddress( + staticAddress.ClientPubkey, staticAddress.ServerPubkey, + int64(staticAddress.Expiry), + ) + if err != nil { + return nil, nil, err + } + + return taprootAddress, filteredUtxos, nil +} From 9352f1728545e70eee587cb28527f78806dfef6a Mon Sep 17 00:00:00 2001 From: Slyghtning Date: Wed, 25 Oct 2023 15:45:47 +0200 Subject: [PATCH 23/37] staticaddr: list unspent outputs in server --- staticaddr/server.go | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/staticaddr/server.go b/staticaddr/server.go index 4eeca96..a6273dd 100644 --- a/staticaddr/server.go +++ b/staticaddr/server.go @@ -26,10 +26,10 @@ func NewAddressServer(addressClient staticaddressrpc.StaticAddressServerClient, // NewAddress is the rpc endpoint for loop clients to request a new static // address. -func (r *AddressServer) NewAddress(ctx context.Context, +func (s *AddressServer) NewAddress(ctx context.Context, _ *looprpc.NewAddressRequest) (*looprpc.NewAddressResponse, error) { - address, err := r.manager.NewAddress(ctx) + address, err := s.manager.NewAddress(ctx) if err != nil { return nil, err } @@ -40,3 +40,31 @@ func (r *AddressServer) NewAddress(ctx context.Context, Address: address.String(), }, nil } + +// ListUnspent returns a list of utxos behind the static address. +func (s *AddressServer) ListUnspent(ctx context.Context, + req *looprpc.ListUnspentRequest) (*looprpc.ListUnspentResponse, error) { + + // List all unspent utxos the wallet sees, regardless of the number of + // confirmations. + staticAddress, utxos, err := s.manager.ListUnspentRaw( + ctx, req.MinConfs, req.MaxConfs, + ) + if err != nil { + return nil, err + } + + // Prepare the list response. + var respUtxos []*looprpc.Utxo + for _, u := range utxos { + utxo := &looprpc.Utxo{ + StaticAddress: staticAddress.String(), + AmountSat: int64(u.Value), + Confirmations: u.Confirmations, + Outpoint: u.OutPoint.String(), + } + respUtxos = append(respUtxos, utxo) + } + + return &looprpc.ListUnspentResponse{Utxos: respUtxos}, nil +} From 0eb787ed29a5a4aa85b3b1cd693c9e13fad97855 Mon Sep 17 00:00:00 2001 From: Slyghtning Date: Wed, 25 Oct 2023 15:46:06 +0200 Subject: [PATCH 24/37] perms: list unspent outputs --- loopd/perms/perms.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/loopd/perms/perms.go b/loopd/perms/perms.go index 1f9c923..d2b6380 100644 --- a/loopd/perms/perms.go +++ b/loopd/perms/perms.go @@ -80,6 +80,13 @@ var RequiredPermissions = map[string][]bakery.Op{ Entity: "loop", Action: "in", }}, + "/looprpc.StaticAddressClient/ListUnspent": {{ + Entity: "swap", + Action: "read", + }, { + Entity: "loop", + Action: "in", + }}, "/looprpc.SwapClient/GetLsatTokens": {{ Entity: "auth", Action: "read", From 995fb6534e06593d19a9ea1d58f71aedd5bda247 Mon Sep 17 00:00:00 2001 From: Slyghtning Date: Wed, 25 Oct 2023 15:46:48 +0200 Subject: [PATCH 25/37] loop: list unspent static address outputs --- cmd/loop/staticaddr.go | 48 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/cmd/loop/staticaddr.go b/cmd/loop/staticaddr.go index 394e5b1..c9626ba 100644 --- a/cmd/loop/staticaddr.go +++ b/cmd/loop/staticaddr.go @@ -15,6 +15,7 @@ var staticAddressCommands = cli.Command{ Category: "StaticAddress", Subcommands: []cli.Command{ newStaticAddressCommand, + listUnspentCommand, }, } @@ -57,6 +58,53 @@ func newStaticAddress(ctx *cli.Context) error { return nil } +var listUnspentCommand = cli.Command{ + Name: "listunspent", + ShortName: "l", + Usage: "List unspent static address outputs.", + Description: ` + List all unspent static address outputs. + `, + Flags: []cli.Flag{ + cli.IntFlag{ + Name: "min_confs", + Usage: "The minimum amount of confirmations an " + + "output should have to be listed.", + }, + cli.IntFlag{ + Name: "max_confs", + Usage: "The maximum number of confirmations an " + + "output could have to be listed.", + }, + }, + Action: listUnspent, +} + +func listUnspent(ctx *cli.Context) error { + ctxb := context.Background() + if ctx.NArg() > 0 { + return cli.ShowCommandHelp(ctx, "listunspent") + } + + client, cleanup, err := getAddressClient(ctx) + if err != nil { + return err + } + defer cleanup() + + resp, err := client.ListUnspent(ctxb, &looprpc.ListUnspentRequest{ + MinConfs: int32(ctx.Int("min_confs")), + MaxConfs: int32(ctx.Int("max_confs")), + }) + if err != nil { + return err + } + + printRespJSON(resp) + + return nil +} + func getAddressClient(ctx *cli.Context) (looprpc.StaticAddressClientClient, func(), error) { From 5630f39ac920fa38e7b4a5a4544b3287b6fd5d47 Mon Sep 17 00:00:00 2001 From: Slyghtning Date: Thu, 9 Nov 2023 19:21:07 +0100 Subject: [PATCH 26/37] loop: static address creation client command --- client.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client.go b/client.go index ae45e9d..3f2e887 100644 --- a/client.go +++ b/client.go @@ -151,9 +151,9 @@ func NewClient(dbDir string, loopDB loopdb.SwapStore, config := &clientConfig{ LndServices: cfg.Lnd, Server: swapServerClient, - Store: loopDB, Conn: swapServerClient.conn, L402Store: l402Store, + Store: loopDB, CreateExpiryTimer: func(d time.Duration) <-chan time.Time { return time.NewTimer(d).C }, From 34f05ccda532b7172a3d856cbcc1a9b73014a18c Mon Sep 17 00:00:00 2001 From: Slyghtning Date: Thu, 9 Nov 2023 19:19:00 +0100 Subject: [PATCH 27/37] daemon: integrate static address manager and sql store --- loopd/daemon.go | 73 +++++++++++++++++++++++++++---------------------- 1 file changed, 40 insertions(+), 33 deletions(-) diff --git a/loopd/daemon.go b/loopd/daemon.go index c6496be..d4c67fa 100644 --- a/loopd/daemon.go +++ b/loopd/daemon.go @@ -21,6 +21,7 @@ import ( "github.com/lightninglabs/loop/loopd/perms" "github.com/lightninglabs/loop/loopdb" loop_looprpc "github.com/lightninglabs/loop/looprpc" + "github.com/lightninglabs/loop/staticaddr" loop_swaprpc "github.com/lightninglabs/loop/swapserverrpc" "github.com/lightninglabs/loop/sweepbatcher" "github.com/lightningnetwork/lnd/clock" @@ -67,6 +68,12 @@ type Daemon struct { // same process. swapClientServer + // AddressServer is the embedded RPC server that satisfies the + // static address client RPC interface. We embed this struct so the + // Daemon itself can be registered to an existing grpc.Server to run as + // a subserver in the same process. + *staticaddr.AddressServer + // ErrChan is an error channel that users of the Daemon struct must use // to detect runtime errors and also whether a shutdown is fully // completed. @@ -232,6 +239,7 @@ func (d *Daemon) startWebServers() error { grpc.StreamInterceptor(streamInterceptor), ) loop_looprpc.RegisterSwapClientServer(d.grpcServer, d) + loop_looprpc.RegisterStaticAddressClientServer(d.grpcServer, d) // Register our debug server if it is compiled in. d.registerDebugServer() @@ -543,6 +551,26 @@ func (d *Daemon) initialize(withMacaroonService bool) error { instantOutManager: instantOutManager, } + // Create a static address server client. + staticAddressClient := loop_swaprpc.NewStaticAddressServerClient( + swapClient.Conn, + ) + + store := staticaddr.NewSqlStore(baseDb) + + cfg := &staticaddr.ManagerConfig{ + AddressClient: staticAddressClient, + SwapClient: swapClient, + Store: store, + WalletKit: d.lnd.WalletKit, + ChainParams: d.lnd.ChainParams, + } + staticAddressManager := staticaddr.NewAddressManager(cfg) + + d.AddressServer = staticaddr.NewAddressServer( + staticAddressClient, staticAddressManager, + ) + // Retrieve all currently existing swaps from the database. swapsList, err := d.impl.FetchSwaps(d.mainCtx) if err != nil { @@ -633,42 +661,21 @@ func (d *Daemon) initialize(withMacaroonService bool) error { }() } - // Start the instant out manager. - if d.instantOutManager != nil { - d.wg.Add(1) - initChan := make(chan struct{}) - go func() { - defer d.wg.Done() - - getInfo, err := d.lnd.Client.GetInfo(d.mainCtx) - if err != nil { - d.internalErrChan <- err - return - } + // Start the static address manager. + d.wg.Add(1) + go func() { + defer d.wg.Done() - log.Info("Starting instantout manager") - defer log.Info("Instantout manager stopped") + log.Info("Starting static address manager...") + err = staticAddressManager.Run(d.mainCtx) + if err != nil && !errors.Is(context.Canceled, err) { + d.internalErrChan <- err + } - err = d.instantOutManager.Run( - d.mainCtx, initChan, int32(getInfo.BlockHeight), - ) - if err != nil && !errors.Is(err, context.Canceled) { - d.internalErrChan <- err - } - }() + log.Info("Static address manager stopped") + }() - // Wait for the instantout server to be ready before starting the - // grpc server. - timeOutCtx, cancel := context.WithTimeout(d.mainCtx, 10*time.Second) - select { - case <-timeOutCtx.Done(): - cancel() - return fmt.Errorf("reservation server not ready: %v", - timeOutCtx.Err()) - case <-initChan: - cancel() - } - } + staticAddressManager.WaitInitComplete() // Last, start our internal error handler. This will return exactly one // error or nil on the main error channel to inform the caller that From 95e704aa5ac540662ea8d3d00f60484777965c34 Mon Sep 17 00:00:00 2001 From: Slyghtning Date: Mon, 22 Apr 2024 16:22:06 +0200 Subject: [PATCH 28/37] gomod: tidy --- go.mod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/go.mod b/go.mod index 783735c..db9c1cb 100644 --- a/go.mod +++ b/go.mod @@ -17,7 +17,6 @@ require ( github.com/grpc-ecosystem/grpc-gateway/v2 v2.11.3 github.com/jackc/pgconn v1.14.3 github.com/jackc/pgerrcode v0.0.0-20220416144525-469b46aa5efa - github.com/jackc/pgx/v4 v4.18.2 github.com/jessevdk/go-flags v1.4.0 github.com/lib/pq v1.10.7 github.com/lightninglabs/aperture v0.3.2-beta @@ -98,6 +97,7 @@ require ( github.com/jackc/pgproto3/v2 v2.3.3 // indirect github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a // indirect github.com/jackc/pgtype v1.14.0 // indirect + github.com/jackc/pgx/v4 v4.18.2 // indirect github.com/jackpal/gateway v1.0.5 // indirect github.com/jackpal/go-nat-pmp v0.0.0-20170405195558-28a68d0c24ad // indirect github.com/jonboulle/clockwork v0.2.2 // indirect From 8a38b1309d6e4db38d49ec58629d6e74837219e2 Mon Sep 17 00:00:00 2001 From: Slyghtning Date: Mon, 26 Feb 2024 09:06:06 +0100 Subject: [PATCH 29/37] looprpc: include static address in swap client We remove the static address client and add its rpcs into the SwapClient --- looprpc/client.pb.go | 505 +++++++++++++------------ looprpc/client.proto | 32 +- looprpc/client.swagger.json | 7 +- looprpc/client_grpc.pb.go | 206 ++++------ looprpc/staticaddressclient.pb.json.go | 73 ---- looprpc/swapclient.pb.json.go | 50 +++ 6 files changed, 402 insertions(+), 471 deletions(-) delete mode 100644 looprpc/staticaddressclient.pb.json.go diff --git a/looprpc/client.pb.go b/looprpc/client.pb.go index d1adbe3..818240d 100644 --- a/looprpc/client.pb.go +++ b/looprpc/client.pb.go @@ -3862,7 +3862,7 @@ func (x *InstantOut) GetSweepTxId() string { return "" } -type NewAddressRequest struct { +type NewStaticAddressRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields @@ -3871,8 +3871,8 @@ type NewAddressRequest struct { ClientKey []byte `protobuf:"bytes,1,opt,name=client_key,json=clientKey,proto3" json:"client_key,omitempty"` } -func (x *NewAddressRequest) Reset() { - *x = NewAddressRequest{} +func (x *NewStaticAddressRequest) Reset() { + *x = NewStaticAddressRequest{} if protoimpl.UnsafeEnabled { mi := &file_client_proto_msgTypes[43] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -3880,13 +3880,13 @@ func (x *NewAddressRequest) Reset() { } } -func (x *NewAddressRequest) String() string { +func (x *NewStaticAddressRequest) String() string { return protoimpl.X.MessageStringOf(x) } -func (*NewAddressRequest) ProtoMessage() {} +func (*NewStaticAddressRequest) ProtoMessage() {} -func (x *NewAddressRequest) ProtoReflect() protoreflect.Message { +func (x *NewStaticAddressRequest) ProtoReflect() protoreflect.Message { mi := &file_client_proto_msgTypes[43] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -3898,19 +3898,19 @@ func (x *NewAddressRequest) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use NewAddressRequest.ProtoReflect.Descriptor instead. -func (*NewAddressRequest) Descriptor() ([]byte, []int) { +// Deprecated: Use NewStaticAddressRequest.ProtoReflect.Descriptor instead. +func (*NewStaticAddressRequest) Descriptor() ([]byte, []int) { return file_client_proto_rawDescGZIP(), []int{43} } -func (x *NewAddressRequest) GetClientKey() []byte { +func (x *NewStaticAddressRequest) GetClientKey() []byte { if x != nil { return x.ClientKey } return nil } -type NewAddressResponse struct { +type NewStaticAddressResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields @@ -3921,8 +3921,8 @@ type NewAddressResponse struct { Expiry uint32 `protobuf:"varint,2,opt,name=expiry,proto3" json:"expiry,omitempty"` } -func (x *NewAddressResponse) Reset() { - *x = NewAddressResponse{} +func (x *NewStaticAddressResponse) Reset() { + *x = NewStaticAddressResponse{} if protoimpl.UnsafeEnabled { mi := &file_client_proto_msgTypes[44] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -3930,13 +3930,13 @@ func (x *NewAddressResponse) Reset() { } } -func (x *NewAddressResponse) String() string { +func (x *NewStaticAddressResponse) String() string { return protoimpl.X.MessageStringOf(x) } -func (*NewAddressResponse) ProtoMessage() {} +func (*NewStaticAddressResponse) ProtoMessage() {} -func (x *NewAddressResponse) ProtoReflect() protoreflect.Message { +func (x *NewStaticAddressResponse) ProtoReflect() protoreflect.Message { mi := &file_client_proto_msgTypes[44] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -3948,26 +3948,26 @@ func (x *NewAddressResponse) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use NewAddressResponse.ProtoReflect.Descriptor instead. -func (*NewAddressResponse) Descriptor() ([]byte, []int) { +// Deprecated: Use NewStaticAddressResponse.ProtoReflect.Descriptor instead. +func (*NewStaticAddressResponse) Descriptor() ([]byte, []int) { return file_client_proto_rawDescGZIP(), []int{44} } -func (x *NewAddressResponse) GetAddress() string { +func (x *NewStaticAddressResponse) GetAddress() string { if x != nil { return x.Address } return "" } -func (x *NewAddressResponse) GetExpiry() uint32 { +func (x *NewStaticAddressResponse) GetExpiry() uint32 { if x != nil { return x.Expiry } return 0 } -type ListUnspentRequest struct { +type ListUnspentDepositsRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields @@ -3979,8 +3979,8 @@ type ListUnspentRequest struct { MaxConfs int32 `protobuf:"varint,2,opt,name=max_confs,json=maxConfs,proto3" json:"max_confs,omitempty"` } -func (x *ListUnspentRequest) Reset() { - *x = ListUnspentRequest{} +func (x *ListUnspentDepositsRequest) Reset() { + *x = ListUnspentDepositsRequest{} if protoimpl.UnsafeEnabled { mi := &file_client_proto_msgTypes[45] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -3988,13 +3988,13 @@ func (x *ListUnspentRequest) Reset() { } } -func (x *ListUnspentRequest) String() string { +func (x *ListUnspentDepositsRequest) String() string { return protoimpl.X.MessageStringOf(x) } -func (*ListUnspentRequest) ProtoMessage() {} +func (*ListUnspentDepositsRequest) ProtoMessage() {} -func (x *ListUnspentRequest) ProtoReflect() protoreflect.Message { +func (x *ListUnspentDepositsRequest) ProtoReflect() protoreflect.Message { mi := &file_client_proto_msgTypes[45] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -4006,26 +4006,26 @@ func (x *ListUnspentRequest) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use ListUnspentRequest.ProtoReflect.Descriptor instead. -func (*ListUnspentRequest) Descriptor() ([]byte, []int) { +// Deprecated: Use ListUnspentDepositsRequest.ProtoReflect.Descriptor instead. +func (*ListUnspentDepositsRequest) Descriptor() ([]byte, []int) { return file_client_proto_rawDescGZIP(), []int{45} } -func (x *ListUnspentRequest) GetMinConfs() int32 { +func (x *ListUnspentDepositsRequest) GetMinConfs() int32 { if x != nil { return x.MinConfs } return 0 } -func (x *ListUnspentRequest) GetMaxConfs() int32 { +func (x *ListUnspentDepositsRequest) GetMaxConfs() int32 { if x != nil { return x.MaxConfs } return 0 } -type ListUnspentResponse struct { +type ListUnspentDepositsResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields @@ -4034,8 +4034,8 @@ type ListUnspentResponse struct { Utxos []*Utxo `protobuf:"bytes,1,rep,name=utxos,proto3" json:"utxos,omitempty"` } -func (x *ListUnspentResponse) Reset() { - *x = ListUnspentResponse{} +func (x *ListUnspentDepositsResponse) Reset() { + *x = ListUnspentDepositsResponse{} if protoimpl.UnsafeEnabled { mi := &file_client_proto_msgTypes[46] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -4043,13 +4043,13 @@ func (x *ListUnspentResponse) Reset() { } } -func (x *ListUnspentResponse) String() string { +func (x *ListUnspentDepositsResponse) String() string { return protoimpl.X.MessageStringOf(x) } -func (*ListUnspentResponse) ProtoMessage() {} +func (*ListUnspentDepositsResponse) ProtoMessage() {} -func (x *ListUnspentResponse) ProtoReflect() protoreflect.Message { +func (x *ListUnspentDepositsResponse) ProtoReflect() protoreflect.Message { mi := &file_client_proto_msgTypes[46] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -4061,12 +4061,12 @@ func (x *ListUnspentResponse) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use ListUnspentResponse.ProtoReflect.Descriptor instead. -func (*ListUnspentResponse) Descriptor() ([]byte, []int) { +// Deprecated: Use ListUnspentDepositsResponse.ProtoReflect.Descriptor instead. +func (*ListUnspentDepositsResponse) Descriptor() ([]byte, []int) { return file_client_proto_rawDescGZIP(), []int{46} } -func (x *ListUnspentResponse) GetUtxos() []*Utxo { +func (x *ListUnspentDepositsResponse) GetUtxos() []*Utxo { if x != nil { return x.Utxos } @@ -4630,206 +4630,209 @@ var file_client_proto_rawDesc = []byte{ 0x5f, 0x69, 0x64, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x0e, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x73, 0x12, 0x1e, 0x0a, 0x0b, 0x73, 0x77, 0x65, 0x65, 0x70, 0x5f, 0x74, 0x78, 0x5f, 0x69, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x09, 0x73, 0x77, 0x65, 0x65, 0x70, 0x54, 0x78, 0x49, 0x64, 0x22, 0x32, 0x0a, 0x11, 0x4e, 0x65, - 0x77, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, - 0x1d, 0x0a, 0x0a, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x0c, 0x52, 0x09, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x4b, 0x65, 0x79, 0x22, 0x46, - 0x0a, 0x12, 0x4e, 0x65, 0x77, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x16, - 0x0a, 0x06, 0x65, 0x78, 0x70, 0x69, 0x72, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x06, - 0x65, 0x78, 0x70, 0x69, 0x72, 0x79, 0x22, 0x4e, 0x0a, 0x12, 0x4c, 0x69, 0x73, 0x74, 0x55, 0x6e, - 0x73, 0x70, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1b, 0x0a, 0x09, - 0x6d, 0x69, 0x6e, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, - 0x08, 0x6d, 0x69, 0x6e, 0x43, 0x6f, 0x6e, 0x66, 0x73, 0x12, 0x1b, 0x0a, 0x09, 0x6d, 0x61, 0x78, - 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x6d, 0x61, - 0x78, 0x43, 0x6f, 0x6e, 0x66, 0x73, 0x22, 0x3a, 0x0a, 0x13, 0x4c, 0x69, 0x73, 0x74, 0x55, 0x6e, - 0x73, 0x70, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x23, 0x0a, - 0x05, 0x75, 0x74, 0x78, 0x6f, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x6c, - 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x55, 0x74, 0x78, 0x6f, 0x52, 0x05, 0x75, 0x74, 0x78, - 0x6f, 0x73, 0x22, 0x8e, 0x01, 0x0a, 0x04, 0x55, 0x74, 0x78, 0x6f, 0x12, 0x25, 0x0a, 0x0e, 0x73, - 0x74, 0x61, 0x74, 0x69, 0x63, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x0d, 0x73, 0x74, 0x61, 0x74, 0x69, 0x63, 0x41, 0x64, 0x64, 0x72, 0x65, - 0x73, 0x73, 0x12, 0x1d, 0x0a, 0x0a, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x5f, 0x73, 0x61, 0x74, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x53, 0x61, - 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x6f, 0x75, 0x74, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x08, 0x6f, 0x75, 0x74, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x12, 0x24, 0x0a, - 0x0d, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x72, 0x6d, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x04, - 0x20, 0x01, 0x28, 0x03, 0x52, 0x0d, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x72, 0x6d, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x73, 0x2a, 0x3b, 0x0a, 0x0b, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x54, 0x79, - 0x70, 0x65, 0x12, 0x18, 0x0a, 0x14, 0x41, 0x44, 0x44, 0x52, 0x45, 0x53, 0x53, 0x5f, 0x54, 0x59, - 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x12, 0x0a, 0x0e, - 0x54, 0x41, 0x50, 0x52, 0x4f, 0x4f, 0x54, 0x5f, 0x50, 0x55, 0x42, 0x4b, 0x45, 0x59, 0x10, 0x01, - 0x2a, 0x25, 0x0a, 0x08, 0x53, 0x77, 0x61, 0x70, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0c, 0x0a, 0x08, - 0x4c, 0x4f, 0x4f, 0x50, 0x5f, 0x4f, 0x55, 0x54, 0x10, 0x00, 0x12, 0x0b, 0x0a, 0x07, 0x4c, 0x4f, - 0x4f, 0x50, 0x5f, 0x49, 0x4e, 0x10, 0x01, 0x2a, 0x73, 0x0a, 0x09, 0x53, 0x77, 0x61, 0x70, 0x53, - 0x74, 0x61, 0x74, 0x65, 0x12, 0x0d, 0x0a, 0x09, 0x49, 0x4e, 0x49, 0x54, 0x49, 0x41, 0x54, 0x45, - 0x44, 0x10, 0x00, 0x12, 0x15, 0x0a, 0x11, 0x50, 0x52, 0x45, 0x49, 0x4d, 0x41, 0x47, 0x45, 0x5f, - 0x52, 0x45, 0x56, 0x45, 0x41, 0x4c, 0x45, 0x44, 0x10, 0x01, 0x12, 0x12, 0x0a, 0x0e, 0x48, 0x54, - 0x4c, 0x43, 0x5f, 0x50, 0x55, 0x42, 0x4c, 0x49, 0x53, 0x48, 0x45, 0x44, 0x10, 0x02, 0x12, 0x0b, - 0x0a, 0x07, 0x53, 0x55, 0x43, 0x43, 0x45, 0x53, 0x53, 0x10, 0x03, 0x12, 0x0a, 0x0a, 0x06, 0x46, - 0x41, 0x49, 0x4c, 0x45, 0x44, 0x10, 0x04, 0x12, 0x13, 0x0a, 0x0f, 0x49, 0x4e, 0x56, 0x4f, 0x49, - 0x43, 0x45, 0x5f, 0x53, 0x45, 0x54, 0x54, 0x4c, 0x45, 0x44, 0x10, 0x05, 0x2a, 0xeb, 0x02, 0x0a, - 0x0d, 0x46, 0x61, 0x69, 0x6c, 0x75, 0x72, 0x65, 0x52, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x12, 0x17, - 0x0a, 0x13, 0x46, 0x41, 0x49, 0x4c, 0x55, 0x52, 0x45, 0x5f, 0x52, 0x45, 0x41, 0x53, 0x4f, 0x4e, - 0x5f, 0x4e, 0x4f, 0x4e, 0x45, 0x10, 0x00, 0x12, 0x1b, 0x0a, 0x17, 0x46, 0x41, 0x49, 0x4c, 0x55, - 0x52, 0x45, 0x5f, 0x52, 0x45, 0x41, 0x53, 0x4f, 0x4e, 0x5f, 0x4f, 0x46, 0x46, 0x43, 0x48, 0x41, - 0x49, 0x4e, 0x10, 0x01, 0x12, 0x1a, 0x0a, 0x16, 0x46, 0x41, 0x49, 0x4c, 0x55, 0x52, 0x45, 0x5f, - 0x52, 0x45, 0x41, 0x53, 0x4f, 0x4e, 0x5f, 0x54, 0x49, 0x4d, 0x45, 0x4f, 0x55, 0x54, 0x10, 0x02, - 0x12, 0x20, 0x0a, 0x1c, 0x46, 0x41, 0x49, 0x4c, 0x55, 0x52, 0x45, 0x5f, 0x52, 0x45, 0x41, 0x53, - 0x4f, 0x4e, 0x5f, 0x53, 0x57, 0x45, 0x45, 0x50, 0x5f, 0x54, 0x49, 0x4d, 0x45, 0x4f, 0x55, 0x54, - 0x10, 0x03, 0x12, 0x25, 0x0a, 0x21, 0x46, 0x41, 0x49, 0x4c, 0x55, 0x52, 0x45, 0x5f, 0x52, 0x45, - 0x41, 0x53, 0x4f, 0x4e, 0x5f, 0x49, 0x4e, 0x53, 0x55, 0x46, 0x46, 0x49, 0x43, 0x49, 0x45, 0x4e, - 0x54, 0x5f, 0x56, 0x41, 0x4c, 0x55, 0x45, 0x10, 0x04, 0x12, 0x1c, 0x0a, 0x18, 0x46, 0x41, 0x49, - 0x4c, 0x55, 0x52, 0x45, 0x5f, 0x52, 0x45, 0x41, 0x53, 0x4f, 0x4e, 0x5f, 0x54, 0x45, 0x4d, 0x50, - 0x4f, 0x52, 0x41, 0x52, 0x59, 0x10, 0x05, 0x12, 0x23, 0x0a, 0x1f, 0x46, 0x41, 0x49, 0x4c, 0x55, - 0x52, 0x45, 0x5f, 0x52, 0x45, 0x41, 0x53, 0x4f, 0x4e, 0x5f, 0x49, 0x4e, 0x43, 0x4f, 0x52, 0x52, - 0x45, 0x43, 0x54, 0x5f, 0x41, 0x4d, 0x4f, 0x55, 0x4e, 0x54, 0x10, 0x06, 0x12, 0x1c, 0x0a, 0x18, - 0x46, 0x41, 0x49, 0x4c, 0x55, 0x52, 0x45, 0x5f, 0x52, 0x45, 0x41, 0x53, 0x4f, 0x4e, 0x5f, 0x41, - 0x42, 0x41, 0x4e, 0x44, 0x4f, 0x4e, 0x45, 0x44, 0x10, 0x07, 0x12, 0x31, 0x0a, 0x2d, 0x46, 0x41, - 0x49, 0x4c, 0x55, 0x52, 0x45, 0x5f, 0x52, 0x45, 0x41, 0x53, 0x4f, 0x4e, 0x5f, 0x49, 0x4e, 0x53, - 0x55, 0x46, 0x46, 0x49, 0x43, 0x49, 0x45, 0x4e, 0x54, 0x5f, 0x43, 0x4f, 0x4e, 0x46, 0x49, 0x52, - 0x4d, 0x45, 0x44, 0x5f, 0x42, 0x41, 0x4c, 0x41, 0x4e, 0x43, 0x45, 0x10, 0x08, 0x12, 0x2b, 0x0a, - 0x27, 0x46, 0x41, 0x49, 0x4c, 0x55, 0x52, 0x45, 0x5f, 0x52, 0x45, 0x41, 0x53, 0x4f, 0x4e, 0x5f, - 0x49, 0x4e, 0x43, 0x4f, 0x52, 0x52, 0x45, 0x43, 0x54, 0x5f, 0x48, 0x54, 0x4c, 0x43, 0x5f, 0x41, - 0x4d, 0x54, 0x5f, 0x53, 0x57, 0x45, 0x50, 0x54, 0x10, 0x09, 0x2a, 0x2f, 0x0a, 0x11, 0x4c, 0x69, - 0x71, 0x75, 0x69, 0x64, 0x69, 0x74, 0x79, 0x52, 0x75, 0x6c, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, - 0x0b, 0x0a, 0x07, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x0d, 0x0a, 0x09, - 0x54, 0x48, 0x52, 0x45, 0x53, 0x48, 0x4f, 0x4c, 0x44, 0x10, 0x01, 0x2a, 0xa6, 0x03, 0x0a, 0x0a, - 0x41, 0x75, 0x74, 0x6f, 0x52, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x12, 0x17, 0x0a, 0x13, 0x41, 0x55, - 0x54, 0x4f, 0x5f, 0x52, 0x45, 0x41, 0x53, 0x4f, 0x4e, 0x5f, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, - 0x4e, 0x10, 0x00, 0x12, 0x22, 0x0a, 0x1e, 0x41, 0x55, 0x54, 0x4f, 0x5f, 0x52, 0x45, 0x41, 0x53, - 0x4f, 0x4e, 0x5f, 0x42, 0x55, 0x44, 0x47, 0x45, 0x54, 0x5f, 0x4e, 0x4f, 0x54, 0x5f, 0x53, 0x54, - 0x41, 0x52, 0x54, 0x45, 0x44, 0x10, 0x01, 0x12, 0x1a, 0x0a, 0x16, 0x41, 0x55, 0x54, 0x4f, 0x5f, - 0x52, 0x45, 0x41, 0x53, 0x4f, 0x4e, 0x5f, 0x53, 0x57, 0x45, 0x45, 0x50, 0x5f, 0x46, 0x45, 0x45, - 0x53, 0x10, 0x02, 0x12, 0x1e, 0x0a, 0x1a, 0x41, 0x55, 0x54, 0x4f, 0x5f, 0x52, 0x45, 0x41, 0x53, - 0x4f, 0x4e, 0x5f, 0x42, 0x55, 0x44, 0x47, 0x45, 0x54, 0x5f, 0x45, 0x4c, 0x41, 0x50, 0x53, 0x45, - 0x44, 0x10, 0x03, 0x12, 0x19, 0x0a, 0x15, 0x41, 0x55, 0x54, 0x4f, 0x5f, 0x52, 0x45, 0x41, 0x53, - 0x4f, 0x4e, 0x5f, 0x49, 0x4e, 0x5f, 0x46, 0x4c, 0x49, 0x47, 0x48, 0x54, 0x10, 0x04, 0x12, 0x18, - 0x0a, 0x14, 0x41, 0x55, 0x54, 0x4f, 0x5f, 0x52, 0x45, 0x41, 0x53, 0x4f, 0x4e, 0x5f, 0x53, 0x57, - 0x41, 0x50, 0x5f, 0x46, 0x45, 0x45, 0x10, 0x05, 0x12, 0x19, 0x0a, 0x15, 0x41, 0x55, 0x54, 0x4f, - 0x5f, 0x52, 0x45, 0x41, 0x53, 0x4f, 0x4e, 0x5f, 0x4d, 0x49, 0x4e, 0x45, 0x52, 0x5f, 0x46, 0x45, - 0x45, 0x10, 0x06, 0x12, 0x16, 0x0a, 0x12, 0x41, 0x55, 0x54, 0x4f, 0x5f, 0x52, 0x45, 0x41, 0x53, - 0x4f, 0x4e, 0x5f, 0x50, 0x52, 0x45, 0x50, 0x41, 0x59, 0x10, 0x07, 0x12, 0x1f, 0x0a, 0x1b, 0x41, - 0x55, 0x54, 0x4f, 0x5f, 0x52, 0x45, 0x41, 0x53, 0x4f, 0x4e, 0x5f, 0x46, 0x41, 0x49, 0x4c, 0x55, - 0x52, 0x45, 0x5f, 0x42, 0x41, 0x43, 0x4b, 0x4f, 0x46, 0x46, 0x10, 0x08, 0x12, 0x18, 0x0a, 0x14, - 0x41, 0x55, 0x54, 0x4f, 0x5f, 0x52, 0x45, 0x41, 0x53, 0x4f, 0x4e, 0x5f, 0x4c, 0x4f, 0x4f, 0x50, - 0x5f, 0x4f, 0x55, 0x54, 0x10, 0x09, 0x12, 0x17, 0x0a, 0x13, 0x41, 0x55, 0x54, 0x4f, 0x5f, 0x52, - 0x45, 0x41, 0x53, 0x4f, 0x4e, 0x5f, 0x4c, 0x4f, 0x4f, 0x50, 0x5f, 0x49, 0x4e, 0x10, 0x0a, 0x12, - 0x1c, 0x0a, 0x18, 0x41, 0x55, 0x54, 0x4f, 0x5f, 0x52, 0x45, 0x41, 0x53, 0x4f, 0x4e, 0x5f, 0x4c, - 0x49, 0x51, 0x55, 0x49, 0x44, 0x49, 0x54, 0x59, 0x5f, 0x4f, 0x4b, 0x10, 0x0b, 0x12, 0x23, 0x0a, - 0x1f, 0x41, 0x55, 0x54, 0x4f, 0x5f, 0x52, 0x45, 0x41, 0x53, 0x4f, 0x4e, 0x5f, 0x42, 0x55, 0x44, - 0x47, 0x45, 0x54, 0x5f, 0x49, 0x4e, 0x53, 0x55, 0x46, 0x46, 0x49, 0x43, 0x49, 0x45, 0x4e, 0x54, - 0x10, 0x0c, 0x12, 0x20, 0x0a, 0x1c, 0x41, 0x55, 0x54, 0x4f, 0x5f, 0x52, 0x45, 0x41, 0x53, 0x4f, - 0x4e, 0x5f, 0x46, 0x45, 0x45, 0x5f, 0x49, 0x4e, 0x53, 0x55, 0x46, 0x46, 0x49, 0x43, 0x49, 0x45, - 0x4e, 0x54, 0x10, 0x0d, 0x32, 0xd8, 0x0b, 0x0a, 0x0a, 0x53, 0x77, 0x61, 0x70, 0x43, 0x6c, 0x69, - 0x65, 0x6e, 0x74, 0x12, 0x39, 0x0a, 0x07, 0x4c, 0x6f, 0x6f, 0x70, 0x4f, 0x75, 0x74, 0x12, 0x17, - 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x4c, 0x6f, 0x6f, 0x70, 0x4f, 0x75, 0x74, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x15, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, - 0x63, 0x2e, 0x53, 0x77, 0x61, 0x70, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x37, - 0x0a, 0x06, 0x4c, 0x6f, 0x6f, 0x70, 0x49, 0x6e, 0x12, 0x16, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, - 0x70, 0x63, 0x2e, 0x4c, 0x6f, 0x6f, 0x70, 0x49, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x1a, 0x15, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x53, 0x77, 0x61, 0x70, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x39, 0x0a, 0x07, 0x4d, 0x6f, 0x6e, 0x69, 0x74, - 0x6f, 0x72, 0x12, 0x17, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x4d, 0x6f, 0x6e, - 0x69, 0x74, 0x6f, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x13, 0x2e, 0x6c, 0x6f, - 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x53, 0x77, 0x61, 0x70, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, - 0x30, 0x01, 0x12, 0x42, 0x0a, 0x09, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x77, 0x61, 0x70, 0x73, 0x12, - 0x19, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x77, - 0x61, 0x70, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1a, 0x2e, 0x6c, 0x6f, 0x6f, - 0x70, 0x72, 0x70, 0x63, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x77, 0x61, 0x70, 0x73, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x39, 0x0a, 0x08, 0x53, 0x77, 0x61, 0x70, 0x49, 0x6e, - 0x66, 0x6f, 0x12, 0x18, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x53, 0x77, 0x61, - 0x70, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x13, 0x2e, 0x6c, - 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x53, 0x77, 0x61, 0x70, 0x53, 0x74, 0x61, 0x74, 0x75, - 0x73, 0x12, 0x48, 0x0a, 0x0b, 0x41, 0x62, 0x61, 0x6e, 0x64, 0x6f, 0x6e, 0x53, 0x77, 0x61, 0x70, - 0x12, 0x1b, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x41, 0x62, 0x61, 0x6e, 0x64, - 0x6f, 0x6e, 0x53, 0x77, 0x61, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, - 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x41, 0x62, 0x61, 0x6e, 0x64, 0x6f, 0x6e, 0x53, - 0x77, 0x61, 0x70, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x40, 0x0a, 0x0c, 0x4c, - 0x6f, 0x6f, 0x70, 0x4f, 0x75, 0x74, 0x54, 0x65, 0x72, 0x6d, 0x73, 0x12, 0x15, 0x2e, 0x6c, 0x6f, - 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x54, 0x65, 0x72, 0x6d, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x4f, 0x75, 0x74, - 0x54, 0x65, 0x72, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x40, 0x0a, - 0x0c, 0x4c, 0x6f, 0x6f, 0x70, 0x4f, 0x75, 0x74, 0x51, 0x75, 0x6f, 0x74, 0x65, 0x12, 0x15, 0x2e, - 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x51, 0x75, 0x6f, 0x74, 0x65, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x4f, - 0x75, 0x74, 0x51, 0x75, 0x6f, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, - 0x41, 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x4c, 0x6f, 0x6f, 0x70, 0x49, 0x6e, 0x54, 0x65, 0x72, 0x6d, - 0x73, 0x12, 0x15, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x54, 0x65, 0x72, 0x6d, - 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, - 0x70, 0x63, 0x2e, 0x49, 0x6e, 0x54, 0x65, 0x72, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x12, 0x41, 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x4c, 0x6f, 0x6f, 0x70, 0x49, 0x6e, 0x51, - 0x75, 0x6f, 0x74, 0x65, 0x12, 0x15, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x51, - 0x75, 0x6f, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x6c, 0x6f, - 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x49, 0x6e, 0x51, 0x75, 0x6f, 0x74, 0x65, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x36, 0x0a, 0x05, 0x50, 0x72, 0x6f, 0x62, 0x65, 0x12, 0x15, - 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x50, 0x72, 0x6f, 0x62, 0x65, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, - 0x50, 0x72, 0x6f, 0x62, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x40, 0x0a, - 0x0d, 0x47, 0x65, 0x74, 0x4c, 0x34, 0x30, 0x32, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x12, 0x16, - 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, - 0x2e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, - 0x40, 0x0a, 0x0d, 0x47, 0x65, 0x74, 0x4c, 0x73, 0x61, 0x74, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x73, - 0x12, 0x16, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, - 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, - 0x70, 0x63, 0x2e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x12, 0x3c, 0x0a, 0x07, 0x47, 0x65, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x17, 0x2e, 0x6c, - 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x47, 0x65, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, - 0x47, 0x65, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, - 0x56, 0x0a, 0x12, 0x47, 0x65, 0x74, 0x4c, 0x69, 0x71, 0x75, 0x69, 0x64, 0x69, 0x74, 0x79, 0x50, - 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x22, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, - 0x47, 0x65, 0x74, 0x4c, 0x69, 0x71, 0x75, 0x69, 0x64, 0x69, 0x74, 0x79, 0x50, 0x61, 0x72, 0x61, - 0x6d, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, - 0x72, 0x70, 0x63, 0x2e, 0x4c, 0x69, 0x71, 0x75, 0x69, 0x64, 0x69, 0x74, 0x79, 0x50, 0x61, 0x72, - 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x12, 0x5d, 0x0a, 0x12, 0x53, 0x65, 0x74, 0x4c, 0x69, - 0x71, 0x75, 0x69, 0x64, 0x69, 0x74, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x22, 0x2e, - 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x53, 0x65, 0x74, 0x4c, 0x69, 0x71, 0x75, 0x69, - 0x64, 0x69, 0x74, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x1a, 0x23, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x53, 0x65, 0x74, 0x4c, + 0x09, 0x73, 0x77, 0x65, 0x65, 0x70, 0x54, 0x78, 0x49, 0x64, 0x22, 0x38, 0x0a, 0x17, 0x4e, 0x65, + 0x77, 0x53, 0x74, 0x61, 0x74, 0x69, 0x63, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x5f, + 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x63, 0x6c, 0x69, 0x65, 0x6e, + 0x74, 0x4b, 0x65, 0x79, 0x22, 0x4c, 0x0a, 0x18, 0x4e, 0x65, 0x77, 0x53, 0x74, 0x61, 0x74, 0x69, + 0x63, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x65, 0x78, + 0x70, 0x69, 0x72, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x06, 0x65, 0x78, 0x70, 0x69, + 0x72, 0x79, 0x22, 0x56, 0x0a, 0x1a, 0x4c, 0x69, 0x73, 0x74, 0x55, 0x6e, 0x73, 0x70, 0x65, 0x6e, + 0x74, 0x44, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x12, 0x1b, 0x0a, 0x09, 0x6d, 0x69, 0x6e, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x73, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x05, 0x52, 0x08, 0x6d, 0x69, 0x6e, 0x43, 0x6f, 0x6e, 0x66, 0x73, 0x12, 0x1b, 0x0a, + 0x09, 0x6d, 0x61, 0x78, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, + 0x52, 0x08, 0x6d, 0x61, 0x78, 0x43, 0x6f, 0x6e, 0x66, 0x73, 0x22, 0x42, 0x0a, 0x1b, 0x4c, 0x69, + 0x73, 0x74, 0x55, 0x6e, 0x73, 0x70, 0x65, 0x6e, 0x74, 0x44, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, + 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x23, 0x0a, 0x05, 0x75, 0x74, 0x78, + 0x6f, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, + 0x70, 0x63, 0x2e, 0x55, 0x74, 0x78, 0x6f, 0x52, 0x05, 0x75, 0x74, 0x78, 0x6f, 0x73, 0x22, 0x8e, + 0x01, 0x0a, 0x04, 0x55, 0x74, 0x78, 0x6f, 0x12, 0x25, 0x0a, 0x0e, 0x73, 0x74, 0x61, 0x74, 0x69, + 0x63, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x0d, 0x73, 0x74, 0x61, 0x74, 0x69, 0x63, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x1d, + 0x0a, 0x0a, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x5f, 0x73, 0x61, 0x74, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x03, 0x52, 0x09, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x53, 0x61, 0x74, 0x12, 0x1a, 0x0a, + 0x08, 0x6f, 0x75, 0x74, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x08, 0x6f, 0x75, 0x74, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x12, 0x24, 0x0a, 0x0d, 0x63, 0x6f, 0x6e, + 0x66, 0x69, 0x72, 0x6d, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, + 0x52, 0x0d, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x72, 0x6d, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2a, + 0x3b, 0x0a, 0x0b, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x54, 0x79, 0x70, 0x65, 0x12, 0x18, + 0x0a, 0x14, 0x41, 0x44, 0x44, 0x52, 0x45, 0x53, 0x53, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, + 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x12, 0x0a, 0x0e, 0x54, 0x41, 0x50, 0x52, + 0x4f, 0x4f, 0x54, 0x5f, 0x50, 0x55, 0x42, 0x4b, 0x45, 0x59, 0x10, 0x01, 0x2a, 0x25, 0x0a, 0x08, + 0x53, 0x77, 0x61, 0x70, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0c, 0x0a, 0x08, 0x4c, 0x4f, 0x4f, 0x50, + 0x5f, 0x4f, 0x55, 0x54, 0x10, 0x00, 0x12, 0x0b, 0x0a, 0x07, 0x4c, 0x4f, 0x4f, 0x50, 0x5f, 0x49, + 0x4e, 0x10, 0x01, 0x2a, 0x73, 0x0a, 0x09, 0x53, 0x77, 0x61, 0x70, 0x53, 0x74, 0x61, 0x74, 0x65, + 0x12, 0x0d, 0x0a, 0x09, 0x49, 0x4e, 0x49, 0x54, 0x49, 0x41, 0x54, 0x45, 0x44, 0x10, 0x00, 0x12, + 0x15, 0x0a, 0x11, 0x50, 0x52, 0x45, 0x49, 0x4d, 0x41, 0x47, 0x45, 0x5f, 0x52, 0x45, 0x56, 0x45, + 0x41, 0x4c, 0x45, 0x44, 0x10, 0x01, 0x12, 0x12, 0x0a, 0x0e, 0x48, 0x54, 0x4c, 0x43, 0x5f, 0x50, + 0x55, 0x42, 0x4c, 0x49, 0x53, 0x48, 0x45, 0x44, 0x10, 0x02, 0x12, 0x0b, 0x0a, 0x07, 0x53, 0x55, + 0x43, 0x43, 0x45, 0x53, 0x53, 0x10, 0x03, 0x12, 0x0a, 0x0a, 0x06, 0x46, 0x41, 0x49, 0x4c, 0x45, + 0x44, 0x10, 0x04, 0x12, 0x13, 0x0a, 0x0f, 0x49, 0x4e, 0x56, 0x4f, 0x49, 0x43, 0x45, 0x5f, 0x53, + 0x45, 0x54, 0x54, 0x4c, 0x45, 0x44, 0x10, 0x05, 0x2a, 0xeb, 0x02, 0x0a, 0x0d, 0x46, 0x61, 0x69, + 0x6c, 0x75, 0x72, 0x65, 0x52, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x12, 0x17, 0x0a, 0x13, 0x46, 0x41, + 0x49, 0x4c, 0x55, 0x52, 0x45, 0x5f, 0x52, 0x45, 0x41, 0x53, 0x4f, 0x4e, 0x5f, 0x4e, 0x4f, 0x4e, + 0x45, 0x10, 0x00, 0x12, 0x1b, 0x0a, 0x17, 0x46, 0x41, 0x49, 0x4c, 0x55, 0x52, 0x45, 0x5f, 0x52, + 0x45, 0x41, 0x53, 0x4f, 0x4e, 0x5f, 0x4f, 0x46, 0x46, 0x43, 0x48, 0x41, 0x49, 0x4e, 0x10, 0x01, + 0x12, 0x1a, 0x0a, 0x16, 0x46, 0x41, 0x49, 0x4c, 0x55, 0x52, 0x45, 0x5f, 0x52, 0x45, 0x41, 0x53, + 0x4f, 0x4e, 0x5f, 0x54, 0x49, 0x4d, 0x45, 0x4f, 0x55, 0x54, 0x10, 0x02, 0x12, 0x20, 0x0a, 0x1c, + 0x46, 0x41, 0x49, 0x4c, 0x55, 0x52, 0x45, 0x5f, 0x52, 0x45, 0x41, 0x53, 0x4f, 0x4e, 0x5f, 0x53, + 0x57, 0x45, 0x45, 0x50, 0x5f, 0x54, 0x49, 0x4d, 0x45, 0x4f, 0x55, 0x54, 0x10, 0x03, 0x12, 0x25, + 0x0a, 0x21, 0x46, 0x41, 0x49, 0x4c, 0x55, 0x52, 0x45, 0x5f, 0x52, 0x45, 0x41, 0x53, 0x4f, 0x4e, + 0x5f, 0x49, 0x4e, 0x53, 0x55, 0x46, 0x46, 0x49, 0x43, 0x49, 0x45, 0x4e, 0x54, 0x5f, 0x56, 0x41, + 0x4c, 0x55, 0x45, 0x10, 0x04, 0x12, 0x1c, 0x0a, 0x18, 0x46, 0x41, 0x49, 0x4c, 0x55, 0x52, 0x45, + 0x5f, 0x52, 0x45, 0x41, 0x53, 0x4f, 0x4e, 0x5f, 0x54, 0x45, 0x4d, 0x50, 0x4f, 0x52, 0x41, 0x52, + 0x59, 0x10, 0x05, 0x12, 0x23, 0x0a, 0x1f, 0x46, 0x41, 0x49, 0x4c, 0x55, 0x52, 0x45, 0x5f, 0x52, + 0x45, 0x41, 0x53, 0x4f, 0x4e, 0x5f, 0x49, 0x4e, 0x43, 0x4f, 0x52, 0x52, 0x45, 0x43, 0x54, 0x5f, + 0x41, 0x4d, 0x4f, 0x55, 0x4e, 0x54, 0x10, 0x06, 0x12, 0x1c, 0x0a, 0x18, 0x46, 0x41, 0x49, 0x4c, + 0x55, 0x52, 0x45, 0x5f, 0x52, 0x45, 0x41, 0x53, 0x4f, 0x4e, 0x5f, 0x41, 0x42, 0x41, 0x4e, 0x44, + 0x4f, 0x4e, 0x45, 0x44, 0x10, 0x07, 0x12, 0x31, 0x0a, 0x2d, 0x46, 0x41, 0x49, 0x4c, 0x55, 0x52, + 0x45, 0x5f, 0x52, 0x45, 0x41, 0x53, 0x4f, 0x4e, 0x5f, 0x49, 0x4e, 0x53, 0x55, 0x46, 0x46, 0x49, + 0x43, 0x49, 0x45, 0x4e, 0x54, 0x5f, 0x43, 0x4f, 0x4e, 0x46, 0x49, 0x52, 0x4d, 0x45, 0x44, 0x5f, + 0x42, 0x41, 0x4c, 0x41, 0x4e, 0x43, 0x45, 0x10, 0x08, 0x12, 0x2b, 0x0a, 0x27, 0x46, 0x41, 0x49, + 0x4c, 0x55, 0x52, 0x45, 0x5f, 0x52, 0x45, 0x41, 0x53, 0x4f, 0x4e, 0x5f, 0x49, 0x4e, 0x43, 0x4f, + 0x52, 0x52, 0x45, 0x43, 0x54, 0x5f, 0x48, 0x54, 0x4c, 0x43, 0x5f, 0x41, 0x4d, 0x54, 0x5f, 0x53, + 0x57, 0x45, 0x50, 0x54, 0x10, 0x09, 0x2a, 0x2f, 0x0a, 0x11, 0x4c, 0x69, 0x71, 0x75, 0x69, 0x64, + 0x69, 0x74, 0x79, 0x52, 0x75, 0x6c, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0b, 0x0a, 0x07, 0x55, + 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x0d, 0x0a, 0x09, 0x54, 0x48, 0x52, 0x45, + 0x53, 0x48, 0x4f, 0x4c, 0x44, 0x10, 0x01, 0x2a, 0xa6, 0x03, 0x0a, 0x0a, 0x41, 0x75, 0x74, 0x6f, + 0x52, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x12, 0x17, 0x0a, 0x13, 0x41, 0x55, 0x54, 0x4f, 0x5f, 0x52, + 0x45, 0x41, 0x53, 0x4f, 0x4e, 0x5f, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, + 0x22, 0x0a, 0x1e, 0x41, 0x55, 0x54, 0x4f, 0x5f, 0x52, 0x45, 0x41, 0x53, 0x4f, 0x4e, 0x5f, 0x42, + 0x55, 0x44, 0x47, 0x45, 0x54, 0x5f, 0x4e, 0x4f, 0x54, 0x5f, 0x53, 0x54, 0x41, 0x52, 0x54, 0x45, + 0x44, 0x10, 0x01, 0x12, 0x1a, 0x0a, 0x16, 0x41, 0x55, 0x54, 0x4f, 0x5f, 0x52, 0x45, 0x41, 0x53, + 0x4f, 0x4e, 0x5f, 0x53, 0x57, 0x45, 0x45, 0x50, 0x5f, 0x46, 0x45, 0x45, 0x53, 0x10, 0x02, 0x12, + 0x1e, 0x0a, 0x1a, 0x41, 0x55, 0x54, 0x4f, 0x5f, 0x52, 0x45, 0x41, 0x53, 0x4f, 0x4e, 0x5f, 0x42, + 0x55, 0x44, 0x47, 0x45, 0x54, 0x5f, 0x45, 0x4c, 0x41, 0x50, 0x53, 0x45, 0x44, 0x10, 0x03, 0x12, + 0x19, 0x0a, 0x15, 0x41, 0x55, 0x54, 0x4f, 0x5f, 0x52, 0x45, 0x41, 0x53, 0x4f, 0x4e, 0x5f, 0x49, + 0x4e, 0x5f, 0x46, 0x4c, 0x49, 0x47, 0x48, 0x54, 0x10, 0x04, 0x12, 0x18, 0x0a, 0x14, 0x41, 0x55, + 0x54, 0x4f, 0x5f, 0x52, 0x45, 0x41, 0x53, 0x4f, 0x4e, 0x5f, 0x53, 0x57, 0x41, 0x50, 0x5f, 0x46, + 0x45, 0x45, 0x10, 0x05, 0x12, 0x19, 0x0a, 0x15, 0x41, 0x55, 0x54, 0x4f, 0x5f, 0x52, 0x45, 0x41, + 0x53, 0x4f, 0x4e, 0x5f, 0x4d, 0x49, 0x4e, 0x45, 0x52, 0x5f, 0x46, 0x45, 0x45, 0x10, 0x06, 0x12, + 0x16, 0x0a, 0x12, 0x41, 0x55, 0x54, 0x4f, 0x5f, 0x52, 0x45, 0x41, 0x53, 0x4f, 0x4e, 0x5f, 0x50, + 0x52, 0x45, 0x50, 0x41, 0x59, 0x10, 0x07, 0x12, 0x1f, 0x0a, 0x1b, 0x41, 0x55, 0x54, 0x4f, 0x5f, + 0x52, 0x45, 0x41, 0x53, 0x4f, 0x4e, 0x5f, 0x46, 0x41, 0x49, 0x4c, 0x55, 0x52, 0x45, 0x5f, 0x42, + 0x41, 0x43, 0x4b, 0x4f, 0x46, 0x46, 0x10, 0x08, 0x12, 0x18, 0x0a, 0x14, 0x41, 0x55, 0x54, 0x4f, + 0x5f, 0x52, 0x45, 0x41, 0x53, 0x4f, 0x4e, 0x5f, 0x4c, 0x4f, 0x4f, 0x50, 0x5f, 0x4f, 0x55, 0x54, + 0x10, 0x09, 0x12, 0x17, 0x0a, 0x13, 0x41, 0x55, 0x54, 0x4f, 0x5f, 0x52, 0x45, 0x41, 0x53, 0x4f, + 0x4e, 0x5f, 0x4c, 0x4f, 0x4f, 0x50, 0x5f, 0x49, 0x4e, 0x10, 0x0a, 0x12, 0x1c, 0x0a, 0x18, 0x41, + 0x55, 0x54, 0x4f, 0x5f, 0x52, 0x45, 0x41, 0x53, 0x4f, 0x4e, 0x5f, 0x4c, 0x49, 0x51, 0x55, 0x49, + 0x44, 0x49, 0x54, 0x59, 0x5f, 0x4f, 0x4b, 0x10, 0x0b, 0x12, 0x23, 0x0a, 0x1f, 0x41, 0x55, 0x54, + 0x4f, 0x5f, 0x52, 0x45, 0x41, 0x53, 0x4f, 0x4e, 0x5f, 0x42, 0x55, 0x44, 0x47, 0x45, 0x54, 0x5f, + 0x49, 0x4e, 0x53, 0x55, 0x46, 0x46, 0x49, 0x43, 0x49, 0x45, 0x4e, 0x54, 0x10, 0x0c, 0x12, 0x20, + 0x0a, 0x1c, 0x41, 0x55, 0x54, 0x4f, 0x5f, 0x52, 0x45, 0x41, 0x53, 0x4f, 0x4e, 0x5f, 0x46, 0x45, + 0x45, 0x5f, 0x49, 0x4e, 0x53, 0x55, 0x46, 0x46, 0x49, 0x43, 0x49, 0x45, 0x4e, 0x54, 0x10, 0x0d, + 0x32, 0x93, 0x0d, 0x0a, 0x0a, 0x53, 0x77, 0x61, 0x70, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x12, + 0x39, 0x0a, 0x07, 0x4c, 0x6f, 0x6f, 0x70, 0x4f, 0x75, 0x74, 0x12, 0x17, 0x2e, 0x6c, 0x6f, 0x6f, + 0x70, 0x72, 0x70, 0x63, 0x2e, 0x4c, 0x6f, 0x6f, 0x70, 0x4f, 0x75, 0x74, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x15, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x53, 0x77, + 0x61, 0x70, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x37, 0x0a, 0x06, 0x4c, 0x6f, + 0x6f, 0x70, 0x49, 0x6e, 0x12, 0x16, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x4c, + 0x6f, 0x6f, 0x70, 0x49, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x15, 0x2e, 0x6c, + 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x53, 0x77, 0x61, 0x70, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x39, 0x0a, 0x07, 0x4d, 0x6f, 0x6e, 0x69, 0x74, 0x6f, 0x72, 0x12, 0x17, + 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x4d, 0x6f, 0x6e, 0x69, 0x74, 0x6f, 0x72, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x13, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, + 0x63, 0x2e, 0x53, 0x77, 0x61, 0x70, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x30, 0x01, 0x12, 0x42, + 0x0a, 0x09, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x77, 0x61, 0x70, 0x73, 0x12, 0x19, 0x2e, 0x6c, 0x6f, + 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x77, 0x61, 0x70, 0x73, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1a, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, + 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x77, 0x61, 0x70, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x12, 0x39, 0x0a, 0x08, 0x53, 0x77, 0x61, 0x70, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x18, + 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x53, 0x77, 0x61, 0x70, 0x49, 0x6e, 0x66, + 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x13, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, + 0x70, 0x63, 0x2e, 0x53, 0x77, 0x61, 0x70, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x48, 0x0a, + 0x0b, 0x41, 0x62, 0x61, 0x6e, 0x64, 0x6f, 0x6e, 0x53, 0x77, 0x61, 0x70, 0x12, 0x1b, 0x2e, 0x6c, + 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x41, 0x62, 0x61, 0x6e, 0x64, 0x6f, 0x6e, 0x53, 0x77, + 0x61, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, + 0x72, 0x70, 0x63, 0x2e, 0x41, 0x62, 0x61, 0x6e, 0x64, 0x6f, 0x6e, 0x53, 0x77, 0x61, 0x70, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x40, 0x0a, 0x0c, 0x4c, 0x6f, 0x6f, 0x70, 0x4f, + 0x75, 0x74, 0x54, 0x65, 0x72, 0x6d, 0x73, 0x12, 0x15, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, + 0x63, 0x2e, 0x54, 0x65, 0x72, 0x6d, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, + 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x4f, 0x75, 0x74, 0x54, 0x65, 0x72, 0x6d, + 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x40, 0x0a, 0x0c, 0x4c, 0x6f, 0x6f, + 0x70, 0x4f, 0x75, 0x74, 0x51, 0x75, 0x6f, 0x74, 0x65, 0x12, 0x15, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, + 0x72, 0x70, 0x63, 0x2e, 0x51, 0x75, 0x6f, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x19, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x4f, 0x75, 0x74, 0x51, 0x75, + 0x6f, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x41, 0x0a, 0x0e, 0x47, + 0x65, 0x74, 0x4c, 0x6f, 0x6f, 0x70, 0x49, 0x6e, 0x54, 0x65, 0x72, 0x6d, 0x73, 0x12, 0x15, 0x2e, + 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x54, 0x65, 0x72, 0x6d, 0x73, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x49, + 0x6e, 0x54, 0x65, 0x72, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x41, + 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x4c, 0x6f, 0x6f, 0x70, 0x49, 0x6e, 0x51, 0x75, 0x6f, 0x74, 0x65, + 0x12, 0x15, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x51, 0x75, 0x6f, 0x74, 0x65, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, + 0x63, 0x2e, 0x49, 0x6e, 0x51, 0x75, 0x6f, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x36, 0x0a, 0x05, 0x50, 0x72, 0x6f, 0x62, 0x65, 0x12, 0x15, 0x2e, 0x6c, 0x6f, 0x6f, + 0x70, 0x72, 0x70, 0x63, 0x2e, 0x50, 0x72, 0x6f, 0x62, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x16, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x50, 0x72, 0x6f, 0x62, + 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x40, 0x0a, 0x0d, 0x47, 0x65, 0x74, + 0x4c, 0x34, 0x30, 0x32, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x12, 0x16, 0x2e, 0x6c, 0x6f, 0x6f, + 0x70, 0x72, 0x70, 0x63, 0x2e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x17, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x54, 0x6f, 0x6b, + 0x65, 0x6e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x40, 0x0a, 0x0d, 0x47, + 0x65, 0x74, 0x4c, 0x73, 0x61, 0x74, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x12, 0x16, 0x2e, 0x6c, + 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x54, + 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3c, 0x0a, + 0x07, 0x47, 0x65, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x17, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, + 0x70, 0x63, 0x2e, 0x47, 0x65, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x18, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x47, 0x65, 0x74, 0x49, + 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x56, 0x0a, 0x12, 0x47, + 0x65, 0x74, 0x4c, 0x69, 0x71, 0x75, 0x69, 0x64, 0x69, 0x74, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, + 0x73, 0x12, 0x22, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x47, 0x65, 0x74, 0x4c, 0x69, 0x71, 0x75, 0x69, 0x64, 0x69, 0x74, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4b, 0x0a, 0x0c, 0x53, 0x75, 0x67, 0x67, 0x65, 0x73, - 0x74, 0x53, 0x77, 0x61, 0x70, 0x73, 0x12, 0x1c, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, - 0x2e, 0x53, 0x75, 0x67, 0x67, 0x65, 0x73, 0x74, 0x53, 0x77, 0x61, 0x70, 0x73, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x53, - 0x75, 0x67, 0x67, 0x65, 0x73, 0x74, 0x53, 0x77, 0x61, 0x70, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x12, 0x57, 0x0a, 0x10, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x65, 0x72, - 0x76, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x20, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, - 0x63, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x21, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, - 0x72, 0x70, 0x63, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x45, 0x0a, 0x0a, - 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x74, 0x4f, 0x75, 0x74, 0x12, 0x1a, 0x2e, 0x6c, 0x6f, 0x6f, - 0x70, 0x72, 0x70, 0x63, 0x2e, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x74, 0x4f, 0x75, 0x74, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1b, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, - 0x2e, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x74, 0x4f, 0x75, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x12, 0x54, 0x0a, 0x0f, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x74, 0x4f, 0x75, - 0x74, 0x51, 0x75, 0x6f, 0x74, 0x65, 0x12, 0x1f, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, - 0x2e, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x74, 0x4f, 0x75, 0x74, 0x51, 0x75, 0x6f, 0x74, 0x65, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x20, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, - 0x63, 0x2e, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x74, 0x4f, 0x75, 0x74, 0x51, 0x75, 0x6f, 0x74, - 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x54, 0x0a, 0x0f, 0x4c, 0x69, 0x73, - 0x74, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x74, 0x4f, 0x75, 0x74, 0x73, 0x12, 0x1f, 0x2e, 0x6c, - 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x49, 0x6e, 0x73, 0x74, 0x61, - 0x6e, 0x74, 0x4f, 0x75, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x20, 0x2e, - 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x49, 0x6e, 0x73, 0x74, - 0x61, 0x6e, 0x74, 0x4f, 0x75, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, - 0xa6, 0x01, 0x0a, 0x13, 0x53, 0x74, 0x61, 0x74, 0x69, 0x63, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, - 0x73, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x12, 0x45, 0x0a, 0x0a, 0x4e, 0x65, 0x77, 0x41, 0x64, - 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x1a, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, - 0x4e, 0x65, 0x77, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x1a, 0x1b, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x4e, 0x65, 0x77, 0x41, - 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x48, - 0x0a, 0x0b, 0x4c, 0x69, 0x73, 0x74, 0x55, 0x6e, 0x73, 0x70, 0x65, 0x6e, 0x74, 0x12, 0x1b, 0x2e, - 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x55, 0x6e, 0x73, 0x70, - 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x6c, 0x6f, 0x6f, - 0x70, 0x72, 0x70, 0x63, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x55, 0x6e, 0x73, 0x70, 0x65, 0x6e, 0x74, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x27, 0x5a, 0x25, 0x67, 0x69, 0x74, 0x68, - 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6c, 0x69, 0x67, 0x68, 0x74, 0x6e, 0x69, 0x6e, 0x67, - 0x6c, 0x61, 0x62, 0x73, 0x2f, 0x6c, 0x6f, 0x6f, 0x70, 0x2f, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, - 0x63, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, + 0x4c, 0x69, 0x71, 0x75, 0x69, 0x64, 0x69, 0x74, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, + 0x65, 0x72, 0x73, 0x12, 0x5d, 0x0a, 0x12, 0x53, 0x65, 0x74, 0x4c, 0x69, 0x71, 0x75, 0x69, 0x64, + 0x69, 0x74, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x22, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, + 0x72, 0x70, 0x63, 0x2e, 0x53, 0x65, 0x74, 0x4c, 0x69, 0x71, 0x75, 0x69, 0x64, 0x69, 0x74, 0x79, + 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x23, 0x2e, + 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x53, 0x65, 0x74, 0x4c, 0x69, 0x71, 0x75, 0x69, + 0x64, 0x69, 0x74, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x12, 0x4b, 0x0a, 0x0c, 0x53, 0x75, 0x67, 0x67, 0x65, 0x73, 0x74, 0x53, 0x77, 0x61, + 0x70, 0x73, 0x12, 0x1c, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x53, 0x75, 0x67, + 0x67, 0x65, 0x73, 0x74, 0x53, 0x77, 0x61, 0x70, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x1d, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x53, 0x75, 0x67, 0x67, 0x65, + 0x73, 0x74, 0x53, 0x77, 0x61, 0x70, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, + 0x57, 0x0a, 0x10, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x73, 0x12, 0x20, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x4c, 0x69, + 0x73, 0x74, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x21, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, + 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x45, 0x0a, 0x0a, 0x49, 0x6e, 0x73, 0x74, + 0x61, 0x6e, 0x74, 0x4f, 0x75, 0x74, 0x12, 0x1a, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, + 0x2e, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x74, 0x4f, 0x75, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x1b, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x49, 0x6e, 0x73, + 0x74, 0x61, 0x6e, 0x74, 0x4f, 0x75, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, + 0x54, 0x0a, 0x0f, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x74, 0x4f, 0x75, 0x74, 0x51, 0x75, 0x6f, + 0x74, 0x65, 0x12, 0x1f, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x49, 0x6e, 0x73, + 0x74, 0x61, 0x6e, 0x74, 0x4f, 0x75, 0x74, 0x51, 0x75, 0x6f, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x20, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x49, 0x6e, + 0x73, 0x74, 0x61, 0x6e, 0x74, 0x4f, 0x75, 0x74, 0x51, 0x75, 0x6f, 0x74, 0x65, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x54, 0x0a, 0x0f, 0x4c, 0x69, 0x73, 0x74, 0x49, 0x6e, 0x73, + 0x74, 0x61, 0x6e, 0x74, 0x4f, 0x75, 0x74, 0x73, 0x12, 0x1f, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, + 0x70, 0x63, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x74, 0x4f, 0x75, + 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x20, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, + 0x72, 0x70, 0x63, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x74, 0x4f, + 0x75, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x57, 0x0a, 0x10, 0x4e, + 0x65, 0x77, 0x53, 0x74, 0x61, 0x74, 0x69, 0x63, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, + 0x20, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x4e, 0x65, 0x77, 0x53, 0x74, 0x61, + 0x74, 0x69, 0x63, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x21, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x4e, 0x65, 0x77, 0x53, + 0x74, 0x61, 0x74, 0x69, 0x63, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x60, 0x0a, 0x13, 0x4c, 0x69, 0x73, 0x74, 0x55, 0x6e, 0x73, 0x70, + 0x65, 0x6e, 0x74, 0x44, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x73, 0x12, 0x23, 0x2e, 0x6c, 0x6f, + 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x55, 0x6e, 0x73, 0x70, 0x65, 0x6e, + 0x74, 0x44, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x24, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x55, + 0x6e, 0x73, 0x70, 0x65, 0x6e, 0x74, 0x44, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x73, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x27, 0x5a, 0x25, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, + 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6c, 0x69, 0x67, 0x68, 0x74, 0x6e, 0x69, 0x6e, 0x67, 0x6c, 0x61, + 0x62, 0x73, 0x2f, 0x6c, 0x6f, 0x6f, 0x70, 0x2f, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x62, + 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -4897,10 +4900,10 @@ var file_client_proto_goTypes = []interface{}{ (*ListInstantOutsRequest)(nil), // 47: looprpc.ListInstantOutsRequest (*ListInstantOutsResponse)(nil), // 48: looprpc.ListInstantOutsResponse (*InstantOut)(nil), // 49: looprpc.InstantOut - (*NewAddressRequest)(nil), // 50: looprpc.NewAddressRequest - (*NewAddressResponse)(nil), // 51: looprpc.NewAddressResponse - (*ListUnspentRequest)(nil), // 52: looprpc.ListUnspentRequest - (*ListUnspentResponse)(nil), // 53: looprpc.ListUnspentResponse + (*NewStaticAddressRequest)(nil), // 50: looprpc.NewStaticAddressRequest + (*NewStaticAddressResponse)(nil), // 51: looprpc.NewStaticAddressResponse + (*ListUnspentDepositsRequest)(nil), // 52: looprpc.ListUnspentDepositsRequest + (*ListUnspentDepositsResponse)(nil), // 53: looprpc.ListUnspentDepositsResponse (*Utxo)(nil), // 54: looprpc.Utxo (*swapserverrpc.RouteHint)(nil), // 55: looprpc.RouteHint } @@ -4929,7 +4932,7 @@ var file_client_proto_depIdxs = []int32{ 36, // 21: looprpc.SuggestSwapsResponse.disqualified:type_name -> looprpc.Disqualified 42, // 22: looprpc.ListReservationsResponse.reservations:type_name -> looprpc.ClientReservation 49, // 23: looprpc.ListInstantOutsResponse.swaps:type_name -> looprpc.InstantOut - 54, // 24: looprpc.ListUnspentResponse.utxos:type_name -> looprpc.Utxo + 54, // 24: looprpc.ListUnspentDepositsResponse.utxos:type_name -> looprpc.Utxo 7, // 25: looprpc.SwapClient.LoopOut:input_type -> looprpc.LoopOutRequest 8, // 26: looprpc.SwapClient.LoopIn:input_type -> looprpc.LoopInRequest 10, // 27: looprpc.SwapClient.Monitor:input_type -> looprpc.MonitorRequest @@ -4951,8 +4954,8 @@ var file_client_proto_depIdxs = []int32{ 43, // 43: looprpc.SwapClient.InstantOut:input_type -> looprpc.InstantOutRequest 45, // 44: looprpc.SwapClient.InstantOutQuote:input_type -> looprpc.InstantOutQuoteRequest 47, // 45: looprpc.SwapClient.ListInstantOuts:input_type -> looprpc.ListInstantOutsRequest - 50, // 46: looprpc.StaticAddressClient.NewAddress:input_type -> looprpc.NewAddressRequest - 52, // 47: looprpc.StaticAddressClient.ListUnspent:input_type -> looprpc.ListUnspentRequest + 50, // 46: looprpc.SwapClient.NewStaticAddress:input_type -> looprpc.NewStaticAddressRequest + 52, // 47: looprpc.SwapClient.ListUnspentDeposits:input_type -> looprpc.ListUnspentDepositsRequest 9, // 48: looprpc.SwapClient.LoopOut:output_type -> looprpc.SwapResponse 9, // 49: looprpc.SwapClient.LoopIn:output_type -> looprpc.SwapResponse 11, // 50: looprpc.SwapClient.Monitor:output_type -> looprpc.SwapStatus @@ -4974,8 +4977,8 @@ var file_client_proto_depIdxs = []int32{ 44, // 66: looprpc.SwapClient.InstantOut:output_type -> looprpc.InstantOutResponse 46, // 67: looprpc.SwapClient.InstantOutQuote:output_type -> looprpc.InstantOutQuoteResponse 48, // 68: looprpc.SwapClient.ListInstantOuts:output_type -> looprpc.ListInstantOutsResponse - 51, // 69: looprpc.StaticAddressClient.NewAddress:output_type -> looprpc.NewAddressResponse - 53, // 70: looprpc.StaticAddressClient.ListUnspent:output_type -> looprpc.ListUnspentResponse + 51, // 69: looprpc.SwapClient.NewStaticAddress:output_type -> looprpc.NewStaticAddressResponse + 53, // 70: looprpc.SwapClient.ListUnspentDeposits:output_type -> looprpc.ListUnspentDepositsResponse 48, // [48:71] is the sub-list for method output_type 25, // [25:48] is the sub-list for method input_type 25, // [25:25] is the sub-list for extension type_name @@ -5506,7 +5509,7 @@ func file_client_proto_init() { } } file_client_proto_msgTypes[43].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*NewAddressRequest); i { + switch v := v.(*NewStaticAddressRequest); i { case 0: return &v.state case 1: @@ -5518,7 +5521,7 @@ func file_client_proto_init() { } } file_client_proto_msgTypes[44].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*NewAddressResponse); i { + switch v := v.(*NewStaticAddressResponse); i { case 0: return &v.state case 1: @@ -5530,7 +5533,7 @@ func file_client_proto_init() { } } file_client_proto_msgTypes[45].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ListUnspentRequest); i { + switch v := v.(*ListUnspentDepositsRequest); i { case 0: return &v.state case 1: @@ -5542,7 +5545,7 @@ func file_client_proto_init() { } } file_client_proto_msgTypes[46].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ListUnspentResponse); i { + switch v := v.(*ListUnspentDepositsResponse); i { case 0: return &v.state case 1: @@ -5574,7 +5577,7 @@ func file_client_proto_init() { NumEnums: 7, NumMessages: 48, NumExtensions: 0, - NumServices: 2, + NumServices: 1, }, GoTypes: file_client_proto_goTypes, DependencyIndexes: file_client_proto_depIdxs, diff --git a/looprpc/client.proto b/looprpc/client.proto index b7ccb95..9f7f228 100644 --- a/looprpc/client.proto +++ b/looprpc/client.proto @@ -143,6 +143,18 @@ service SwapClient { */ rpc ListInstantOuts (ListInstantOutsRequest) returns (ListInstantOutsResponse); + + /* loop: `static newstaticaddress` + NewStaticAddress requests a new static address for loop-ins from the server. + */ + rpc NewStaticAddress (NewStaticAddressRequest) + returns (NewStaticAddressResponse); + + /* loop: `static listunspentdeposits` + ListUnspentDeposits returns a list of utxos deposited at a static address. + */ + rpc ListUnspentDeposits (ListUnspentDepositsRequest) + returns (ListUnspentDepositsResponse); } message LoopOutRequest { @@ -1440,26 +1452,14 @@ message InstantOut { string sweep_tx_id = 5; } -service StaticAddressClient { - /* - NewAddress requests a new static address for loop-ins from the server. - */ - rpc NewAddress (NewAddressRequest) returns (NewAddressResponse); - - /* - ListUnspent returns a list of utxos behind a static address. - */ - rpc ListUnspent (ListUnspentRequest) returns (ListUnspentResponse); -} - -message NewAddressRequest { +message NewStaticAddressRequest { /* The client's public key for the 2-of-2 MuSig2 taproot static address. */ bytes client_key = 1; } -message NewAddressResponse { +message NewStaticAddressResponse { /* The taproot static address. */ @@ -1471,7 +1471,7 @@ message NewAddressResponse { uint32 expiry = 2; } -message ListUnspentRequest { +message ListUnspentDepositsRequest { /* The number of minimum confirmations a utxo must have to be listed. */ @@ -1484,7 +1484,7 @@ message ListUnspentRequest { int32 max_confs = 2; } -message ListUnspentResponse { +message ListUnspentDepositsResponse { /* A list of utxos behind the static address. */ diff --git a/looprpc/client.swagger.json b/looprpc/client.swagger.json index 247727b..ce60851 100644 --- a/looprpc/client.swagger.json +++ b/looprpc/client.swagger.json @@ -7,9 +7,6 @@ "tags": [ { "name": "SwapClient" - }, - { - "name": "StaticAddressClient" } ], "consumes": [ @@ -1126,7 +1123,7 @@ } } }, - "looprpcListUnspentResponse": { + "looprpcListUnspentDepositsResponse": { "type": "object", "properties": { "utxos": { @@ -1316,7 +1313,7 @@ } } }, - "looprpcNewAddressResponse": { + "looprpcNewStaticAddressResponse": { "type": "object", "properties": { "address": { diff --git a/looprpc/client_grpc.pb.go b/looprpc/client_grpc.pb.go index c9f1929..1c233ac 100644 --- a/looprpc/client_grpc.pb.go +++ b/looprpc/client_grpc.pb.go @@ -102,6 +102,12 @@ type SwapClientClient interface { // ListInstantOuts returns a list of all currently known instant out swaps and // their current status. ListInstantOuts(ctx context.Context, in *ListInstantOutsRequest, opts ...grpc.CallOption) (*ListInstantOutsResponse, error) + // loop: `static newstaticaddress` + // NewStaticAddress requests a new static address for loop-ins from the server. + NewStaticAddress(ctx context.Context, in *NewStaticAddressRequest, opts ...grpc.CallOption) (*NewStaticAddressResponse, error) + // loop: `static listunspentdeposits` + // ListUnspentDeposits returns a list of utxos deposited at a static address. + ListUnspentDeposits(ctx context.Context, in *ListUnspentDepositsRequest, opts ...grpc.CallOption) (*ListUnspentDepositsResponse, error) } type swapClientClient struct { @@ -324,6 +330,24 @@ func (c *swapClientClient) ListInstantOuts(ctx context.Context, in *ListInstantO return out, nil } +func (c *swapClientClient) NewStaticAddress(ctx context.Context, in *NewStaticAddressRequest, opts ...grpc.CallOption) (*NewStaticAddressResponse, error) { + out := new(NewStaticAddressResponse) + err := c.cc.Invoke(ctx, "/looprpc.SwapClient/NewStaticAddress", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *swapClientClient) ListUnspentDeposits(ctx context.Context, in *ListUnspentDepositsRequest, opts ...grpc.CallOption) (*ListUnspentDepositsResponse, error) { + out := new(ListUnspentDepositsResponse) + err := c.cc.Invoke(ctx, "/looprpc.SwapClient/ListUnspentDeposits", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // SwapClientServer is the server API for SwapClient service. // All implementations must embed UnimplementedSwapClientServer // for forward compatibility @@ -412,6 +436,12 @@ type SwapClientServer interface { // ListInstantOuts returns a list of all currently known instant out swaps and // their current status. ListInstantOuts(context.Context, *ListInstantOutsRequest) (*ListInstantOutsResponse, error) + // loop: `static newstaticaddress` + // NewStaticAddress requests a new static address for loop-ins from the server. + NewStaticAddress(context.Context, *NewStaticAddressRequest) (*NewStaticAddressResponse, error) + // loop: `static listunspentdeposits` + // ListUnspentDeposits returns a list of utxos deposited at a static address. + ListUnspentDeposits(context.Context, *ListUnspentDepositsRequest) (*ListUnspentDepositsResponse, error) mustEmbedUnimplementedSwapClientServer() } @@ -482,6 +512,12 @@ func (UnimplementedSwapClientServer) InstantOutQuote(context.Context, *InstantOu func (UnimplementedSwapClientServer) ListInstantOuts(context.Context, *ListInstantOutsRequest) (*ListInstantOutsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method ListInstantOuts not implemented") } +func (UnimplementedSwapClientServer) NewStaticAddress(context.Context, *NewStaticAddressRequest) (*NewStaticAddressResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method NewStaticAddress not implemented") +} +func (UnimplementedSwapClientServer) ListUnspentDeposits(context.Context, *ListUnspentDepositsRequest) (*ListUnspentDepositsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ListUnspentDeposits not implemented") +} func (UnimplementedSwapClientServer) mustEmbedUnimplementedSwapClientServer() {} // UnsafeSwapClientServer may be embedded to opt out of forward compatibility for this service. @@ -876,6 +912,42 @@ func _SwapClient_ListInstantOuts_Handler(srv interface{}, ctx context.Context, d return interceptor(ctx, in, info, handler) } +func _SwapClient_NewStaticAddress_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(NewStaticAddressRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SwapClientServer).NewStaticAddress(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/looprpc.SwapClient/NewStaticAddress", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SwapClientServer).NewStaticAddress(ctx, req.(*NewStaticAddressRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _SwapClient_ListUnspentDeposits_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ListUnspentDepositsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SwapClientServer).ListUnspentDeposits(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/looprpc.SwapClient/ListUnspentDeposits", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SwapClientServer).ListUnspentDeposits(ctx, req.(*ListUnspentDepositsRequest)) + } + return interceptor(ctx, in, info, handler) +} + // SwapClient_ServiceDesc is the grpc.ServiceDesc for SwapClient service. // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) @@ -963,6 +1035,14 @@ var SwapClient_ServiceDesc = grpc.ServiceDesc{ MethodName: "ListInstantOuts", Handler: _SwapClient_ListInstantOuts_Handler, }, + { + MethodName: "NewStaticAddress", + Handler: _SwapClient_NewStaticAddress_Handler, + }, + { + MethodName: "ListUnspentDeposits", + Handler: _SwapClient_ListUnspentDeposits_Handler, + }, }, Streams: []grpc.StreamDesc{ { @@ -973,129 +1053,3 @@ var SwapClient_ServiceDesc = grpc.ServiceDesc{ }, Metadata: "client.proto", } - -// StaticAddressClientClient is the client API for StaticAddressClient service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. -type StaticAddressClientClient interface { - // NewAddress requests a new static address for loop-ins from the server. - NewAddress(ctx context.Context, in *NewAddressRequest, opts ...grpc.CallOption) (*NewAddressResponse, error) - // ListUnspent returns a list of utxos behind a static address. - ListUnspent(ctx context.Context, in *ListUnspentRequest, opts ...grpc.CallOption) (*ListUnspentResponse, error) -} - -type staticAddressClientClient struct { - cc grpc.ClientConnInterface -} - -func NewStaticAddressClientClient(cc grpc.ClientConnInterface) StaticAddressClientClient { - return &staticAddressClientClient{cc} -} - -func (c *staticAddressClientClient) NewAddress(ctx context.Context, in *NewAddressRequest, opts ...grpc.CallOption) (*NewAddressResponse, error) { - out := new(NewAddressResponse) - err := c.cc.Invoke(ctx, "/looprpc.StaticAddressClient/NewAddress", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *staticAddressClientClient) ListUnspent(ctx context.Context, in *ListUnspentRequest, opts ...grpc.CallOption) (*ListUnspentResponse, error) { - out := new(ListUnspentResponse) - err := c.cc.Invoke(ctx, "/looprpc.StaticAddressClient/ListUnspent", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// StaticAddressClientServer is the server API for StaticAddressClient service. -// All implementations must embed UnimplementedStaticAddressClientServer -// for forward compatibility -type StaticAddressClientServer interface { - // NewAddress requests a new static address for loop-ins from the server. - NewAddress(context.Context, *NewAddressRequest) (*NewAddressResponse, error) - // ListUnspent returns a list of utxos behind a static address. - ListUnspent(context.Context, *ListUnspentRequest) (*ListUnspentResponse, error) - mustEmbedUnimplementedStaticAddressClientServer() -} - -// UnimplementedStaticAddressClientServer must be embedded to have forward compatible implementations. -type UnimplementedStaticAddressClientServer struct { -} - -func (UnimplementedStaticAddressClientServer) NewAddress(context.Context, *NewAddressRequest) (*NewAddressResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method NewAddress not implemented") -} -func (UnimplementedStaticAddressClientServer) ListUnspent(context.Context, *ListUnspentRequest) (*ListUnspentResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method ListUnspent not implemented") -} -func (UnimplementedStaticAddressClientServer) mustEmbedUnimplementedStaticAddressClientServer() {} - -// UnsafeStaticAddressClientServer may be embedded to opt out of forward compatibility for this service. -// Use of this interface is not recommended, as added methods to StaticAddressClientServer will -// result in compilation errors. -type UnsafeStaticAddressClientServer interface { - mustEmbedUnimplementedStaticAddressClientServer() -} - -func RegisterStaticAddressClientServer(s grpc.ServiceRegistrar, srv StaticAddressClientServer) { - s.RegisterService(&StaticAddressClient_ServiceDesc, srv) -} - -func _StaticAddressClient_NewAddress_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(NewAddressRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(StaticAddressClientServer).NewAddress(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/looprpc.StaticAddressClient/NewAddress", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(StaticAddressClientServer).NewAddress(ctx, req.(*NewAddressRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _StaticAddressClient_ListUnspent_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ListUnspentRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(StaticAddressClientServer).ListUnspent(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/looprpc.StaticAddressClient/ListUnspent", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(StaticAddressClientServer).ListUnspent(ctx, req.(*ListUnspentRequest)) - } - return interceptor(ctx, in, info, handler) -} - -// StaticAddressClient_ServiceDesc is the grpc.ServiceDesc for StaticAddressClient service. -// It's only intended for direct use with grpc.RegisterService, -// and not to be introspected or modified (even as a copy) -var StaticAddressClient_ServiceDesc = grpc.ServiceDesc{ - ServiceName: "looprpc.StaticAddressClient", - HandlerType: (*StaticAddressClientServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "NewAddress", - Handler: _StaticAddressClient_NewAddress_Handler, - }, - { - MethodName: "ListUnspent", - Handler: _StaticAddressClient_ListUnspent_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "client.proto", -} diff --git a/looprpc/staticaddressclient.pb.json.go b/looprpc/staticaddressclient.pb.json.go deleted file mode 100644 index afa5506..0000000 --- a/looprpc/staticaddressclient.pb.json.go +++ /dev/null @@ -1,73 +0,0 @@ -// Code generated by falafel 0.9.1. DO NOT EDIT. -// source: client.proto - -package looprpc - -import ( - "context" - - gateway "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" - "google.golang.org/grpc" - "google.golang.org/protobuf/encoding/protojson" -) - -func RegisterStaticAddressClientJSONCallbacks(registry map[string]func(ctx context.Context, - conn *grpc.ClientConn, reqJSON string, callback func(string, error))) { - - marshaler := &gateway.JSONPb{ - MarshalOptions: protojson.MarshalOptions{ - UseProtoNames: true, - EmitUnpopulated: true, - }, - } - - registry["looprpc.StaticAddressClient.NewAddress"] = func(ctx context.Context, - conn *grpc.ClientConn, reqJSON string, callback func(string, error)) { - - req := &NewAddressRequest{} - err := marshaler.Unmarshal([]byte(reqJSON), req) - if err != nil { - callback("", err) - return - } - - client := NewStaticAddressClientClient(conn) - resp, err := client.NewAddress(ctx, req) - if err != nil { - callback("", err) - return - } - - respBytes, err := marshaler.Marshal(resp) - if err != nil { - callback("", err) - return - } - callback(string(respBytes), nil) - } - - registry["looprpc.StaticAddressClient.ListUnspent"] = func(ctx context.Context, - conn *grpc.ClientConn, reqJSON string, callback func(string, error)) { - - req := &ListUnspentRequest{} - err := marshaler.Unmarshal([]byte(reqJSON), req) - if err != nil { - callback("", err) - return - } - - client := NewStaticAddressClientClient(conn) - resp, err := client.ListUnspent(ctx, req) - if err != nil { - callback("", err) - return - } - - respBytes, err := marshaler.Marshal(resp) - if err != nil { - callback("", err) - return - } - callback(string(respBytes), nil) - } -} diff --git a/looprpc/swapclient.pb.json.go b/looprpc/swapclient.pb.json.go index fd57a4e..d5ea9e6 100644 --- a/looprpc/swapclient.pb.json.go +++ b/looprpc/swapclient.pb.json.go @@ -562,4 +562,54 @@ func RegisterSwapClientJSONCallbacks(registry map[string]func(ctx context.Contex } callback(string(respBytes), nil) } + + registry["looprpc.SwapClient.NewStaticAddress"] = func(ctx context.Context, + conn *grpc.ClientConn, reqJSON string, callback func(string, error)) { + + req := &NewStaticAddressRequest{} + err := marshaler.Unmarshal([]byte(reqJSON), req) + if err != nil { + callback("", err) + return + } + + client := NewSwapClientClient(conn) + resp, err := client.NewStaticAddress(ctx, req) + if err != nil { + callback("", err) + return + } + + respBytes, err := marshaler.Marshal(resp) + if err != nil { + callback("", err) + return + } + callback(string(respBytes), nil) + } + + registry["looprpc.SwapClient.ListUnspentDeposits"] = func(ctx context.Context, + conn *grpc.ClientConn, reqJSON string, callback func(string, error)) { + + req := &ListUnspentDepositsRequest{} + err := marshaler.Unmarshal([]byte(reqJSON), req) + if err != nil { + callback("", err) + return + } + + client := NewSwapClientClient(conn) + resp, err := client.ListUnspentDeposits(ctx, req) + if err != nil { + callback("", err) + return + } + + respBytes, err := marshaler.Marshal(resp) + if err != nil { + callback("", err) + return + } + callback(string(respBytes), nil) + } } From edfb154b4325bbae9ae39c355e91bd626332bbfc Mon Sep 17 00:00:00 2001 From: Slyghtning Date: Thu, 7 Mar 2024 17:25:07 +0100 Subject: [PATCH 30/37] sqlc: deposit queries, models and migrations --- .../000008_static_address_deposits.down.sql | 1 + .../000008_static_address_deposits.up.sql | 43 ++++ loopdb/sqlc/models.go | 18 ++ loopdb/sqlc/querier.go | 6 + .../sqlc/queries/static_address_deposits.sql | 66 ++++++ loopdb/sqlc/static_address_deposits.sql.go | 197 ++++++++++++++++++ loopdb/sqlc/static_addresses.sql.go | 2 +- 7 files changed, 332 insertions(+), 1 deletion(-) create mode 100644 loopdb/sqlc/migrations/000008_static_address_deposits.down.sql create mode 100644 loopdb/sqlc/migrations/000008_static_address_deposits.up.sql create mode 100644 loopdb/sqlc/queries/static_address_deposits.sql create mode 100644 loopdb/sqlc/static_address_deposits.sql.go diff --git a/loopdb/sqlc/migrations/000008_static_address_deposits.down.sql b/loopdb/sqlc/migrations/000008_static_address_deposits.down.sql new file mode 100644 index 0000000..1170fda --- /dev/null +++ b/loopdb/sqlc/migrations/000008_static_address_deposits.down.sql @@ -0,0 +1 @@ +DROP TABLE IF EXISTS deposits; diff --git a/loopdb/sqlc/migrations/000008_static_address_deposits.up.sql b/loopdb/sqlc/migrations/000008_static_address_deposits.up.sql new file mode 100644 index 0000000..7898e60 --- /dev/null +++ b/loopdb/sqlc/migrations/000008_static_address_deposits.up.sql @@ -0,0 +1,43 @@ +-- deposits stores historic and unspent static address outputs. +CREATE TABLE IF NOT EXISTS deposits ( + -- id is the auto-incrementing primary key for a static address. + id INTEGER PRIMARY KEY, + + -- deposit_id is the unique identifier for the deposit. + deposit_id BLOB NOT NULL UNIQUE, + + -- tx_hash is the transaction hash of the deposit. + tx_hash BYTEA NOT NULL, + + -- output_index is the index of the output in the transaction. + out_index INT NOT NULL, + + -- amount is the amount of the deposit. + amount BIGINT NOT NULL, + + -- confirmation_height is the absolute height at which the deposit was + -- confirmed. + confirmation_height BIGINT NOT NULL, + + -- timeout_sweep_pk_script is the public key script that will be used to + -- sweep the deposit after has expired. + timeout_sweep_pk_script BYTEA NOT NULL, + + -- expiry_sweep_txid is the transaction id of the expiry sweep. + expiry_sweep_txid BLOB +); + +-- deposit_updates contains all the updates to a deposit. +CREATE TABLE IF NOT EXISTS deposit_updates ( + -- id is the auto incrementing primary key. + id INTEGER PRIMARY KEY, + + -- deposit_id is the unique identifier for the deposit. + deposit_id BLOB NOT NULL REFERENCES deposits(deposit_id), + + -- update_state is the state of the deposit at the time of the update. + update_state TEXT NOT NULL, + + -- update_timestamp is the timestamp of the update. + update_timestamp TIMESTAMP NOT NULL +); diff --git a/loopdb/sqlc/models.go b/loopdb/sqlc/models.go index 78d4828..3a9abe7 100644 --- a/loopdb/sqlc/models.go +++ b/loopdb/sqlc/models.go @@ -9,6 +9,24 @@ import ( "time" ) +type Deposit struct { + ID int32 + DepositID []byte + TxHash []byte + OutIndex int32 + Amount int64 + ConfirmationHeight int64 + TimeoutSweepPkScript []byte + ExpirySweepTxid []byte +} + +type DepositUpdate struct { + ID int32 + DepositID []byte + UpdateState string + UpdateTimestamp time.Time +} + type HtlcKey struct { SwapHash []byte SenderScriptPubkey []byte diff --git a/loopdb/sqlc/querier.go b/loopdb/sqlc/querier.go index 20f502e..a5f9393 100644 --- a/loopdb/sqlc/querier.go +++ b/loopdb/sqlc/querier.go @@ -9,16 +9,20 @@ import ( ) type Querier interface { + AllDeposits(ctx context.Context) ([]Deposit, error) AllStaticAddresses(ctx context.Context) ([]StaticAddress, error) ConfirmBatch(ctx context.Context, id int32) error + CreateDeposit(ctx context.Context, arg CreateDepositParams) error CreateReservation(ctx context.Context, arg CreateReservationParams) error CreateStaticAddress(ctx context.Context, arg CreateStaticAddressParams) error FetchLiquidityParams(ctx context.Context) ([]byte, error) GetBatchSweeps(ctx context.Context, batchID int32) ([]GetBatchSweepsRow, error) GetBatchSweptAmount(ctx context.Context, batchID int32) (int64, error) + GetDeposit(ctx context.Context, depositID []byte) (Deposit, error) GetInstantOutSwap(ctx context.Context, swapHash []byte) (GetInstantOutSwapRow, error) GetInstantOutSwapUpdates(ctx context.Context, swapHash []byte) ([]InstantoutUpdate, error) GetInstantOutSwaps(ctx context.Context) ([]GetInstantOutSwapsRow, error) + GetLatestDepositUpdate(ctx context.Context, depositID []byte) (DepositUpdate, error) GetLoopInSwap(ctx context.Context, swapHash []byte) (GetLoopInSwapRow, error) GetLoopInSwaps(ctx context.Context) ([]GetLoopInSwapsRow, error) GetLoopOutSwap(ctx context.Context, swapHash []byte) (GetLoopOutSwapRow, error) @@ -32,6 +36,7 @@ type Querier interface { GetSweepStatus(ctx context.Context, swapHash []byte) (bool, error) GetUnconfirmedBatches(ctx context.Context) ([]SweepBatch, error) InsertBatch(ctx context.Context, arg InsertBatchParams) (int32, error) + InsertDepositUpdate(ctx context.Context, arg InsertDepositUpdateParams) error InsertHtlcKeys(ctx context.Context, arg InsertHtlcKeysParams) error InsertInstantOut(ctx context.Context, arg InsertInstantOutParams) error InsertInstantOutUpdate(ctx context.Context, arg InsertInstantOutUpdateParams) error @@ -41,6 +46,7 @@ type Querier interface { InsertSwap(ctx context.Context, arg InsertSwapParams) error InsertSwapUpdate(ctx context.Context, arg InsertSwapUpdateParams) error UpdateBatch(ctx context.Context, arg UpdateBatchParams) error + UpdateDeposit(ctx context.Context, arg UpdateDepositParams) error UpdateInstantOut(ctx context.Context, arg UpdateInstantOutParams) error UpdateReservation(ctx context.Context, arg UpdateReservationParams) error UpsertLiquidityParams(ctx context.Context, params []byte) error diff --git a/loopdb/sqlc/queries/static_address_deposits.sql b/loopdb/sqlc/queries/static_address_deposits.sql new file mode 100644 index 0000000..d09ca3f --- /dev/null +++ b/loopdb/sqlc/queries/static_address_deposits.sql @@ -0,0 +1,66 @@ +-- name: CreateDeposit :exec +INSERT INTO deposits ( + deposit_id, + tx_hash, + out_index, + amount, + confirmation_height, + timeout_sweep_pk_script, + expiry_sweep_txid +) VALUES ( + $1, + $2, + $3, + $4, + $5, + $6, + $7 + ); + +-- name: UpdateDeposit :exec +UPDATE deposits +SET + tx_hash = $2, + out_index = $3, + confirmation_height = $4, + expiry_sweep_txid = $5 +WHERE + deposits.deposit_id = $1; + +-- name: InsertDepositUpdate :exec +INSERT INTO deposit_updates ( + deposit_id, + update_state, + update_timestamp +) VALUES ( + $1, + $2, + $3 + ); + +-- name: GetDeposit :one +SELECT + * +FROM + deposits +WHERE + deposit_id = $1; + +-- name: AllDeposits :many +SELECT + * +FROM + deposits +ORDER BY + id ASC; + +-- name: GetLatestDepositUpdate :one +SELECT + * +FROM + deposit_updates +WHERE + deposit_id = $1 +ORDER BY + update_timestamp DESC +LIMIT 1; \ No newline at end of file diff --git a/loopdb/sqlc/static_address_deposits.sql.go b/loopdb/sqlc/static_address_deposits.sql.go new file mode 100644 index 0000000..8b4612d --- /dev/null +++ b/loopdb/sqlc/static_address_deposits.sql.go @@ -0,0 +1,197 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.25.0 +// source: static_address_deposits.sql + +package sqlc + +import ( + "context" + "time" +) + +const allDeposits = `-- name: AllDeposits :many +SELECT + id, deposit_id, tx_hash, out_index, amount, confirmation_height, timeout_sweep_pk_script, expiry_sweep_txid +FROM + deposits +ORDER BY + id ASC +` + +func (q *Queries) AllDeposits(ctx context.Context) ([]Deposit, error) { + rows, err := q.db.QueryContext(ctx, allDeposits) + if err != nil { + return nil, err + } + defer rows.Close() + var items []Deposit + for rows.Next() { + var i Deposit + if err := rows.Scan( + &i.ID, + &i.DepositID, + &i.TxHash, + &i.OutIndex, + &i.Amount, + &i.ConfirmationHeight, + &i.TimeoutSweepPkScript, + &i.ExpirySweepTxid, + ); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const createDeposit = `-- name: CreateDeposit :exec +INSERT INTO deposits ( + deposit_id, + tx_hash, + out_index, + amount, + confirmation_height, + timeout_sweep_pk_script, + expiry_sweep_txid +) VALUES ( + $1, + $2, + $3, + $4, + $5, + $6, + $7 + ) +` + +type CreateDepositParams struct { + DepositID []byte + TxHash []byte + OutIndex int32 + Amount int64 + ConfirmationHeight int64 + TimeoutSweepPkScript []byte + ExpirySweepTxid []byte +} + +func (q *Queries) CreateDeposit(ctx context.Context, arg CreateDepositParams) error { + _, err := q.db.ExecContext(ctx, createDeposit, + arg.DepositID, + arg.TxHash, + arg.OutIndex, + arg.Amount, + arg.ConfirmationHeight, + arg.TimeoutSweepPkScript, + arg.ExpirySweepTxid, + ) + return err +} + +const getDeposit = `-- name: GetDeposit :one +SELECT + id, deposit_id, tx_hash, out_index, amount, confirmation_height, timeout_sweep_pk_script, expiry_sweep_txid +FROM + deposits +WHERE + deposit_id = $1 +` + +func (q *Queries) GetDeposit(ctx context.Context, depositID []byte) (Deposit, error) { + row := q.db.QueryRowContext(ctx, getDeposit, depositID) + var i Deposit + err := row.Scan( + &i.ID, + &i.DepositID, + &i.TxHash, + &i.OutIndex, + &i.Amount, + &i.ConfirmationHeight, + &i.TimeoutSweepPkScript, + &i.ExpirySweepTxid, + ) + return i, err +} + +const getLatestDepositUpdate = `-- name: GetLatestDepositUpdate :one +SELECT + id, deposit_id, update_state, update_timestamp +FROM + deposit_updates +WHERE + deposit_id = $1 +ORDER BY + update_timestamp DESC +LIMIT 1 +` + +func (q *Queries) GetLatestDepositUpdate(ctx context.Context, depositID []byte) (DepositUpdate, error) { + row := q.db.QueryRowContext(ctx, getLatestDepositUpdate, depositID) + var i DepositUpdate + err := row.Scan( + &i.ID, + &i.DepositID, + &i.UpdateState, + &i.UpdateTimestamp, + ) + return i, err +} + +const insertDepositUpdate = `-- name: InsertDepositUpdate :exec +INSERT INTO deposit_updates ( + deposit_id, + update_state, + update_timestamp +) VALUES ( + $1, + $2, + $3 + ) +` + +type InsertDepositUpdateParams struct { + DepositID []byte + UpdateState string + UpdateTimestamp time.Time +} + +func (q *Queries) InsertDepositUpdate(ctx context.Context, arg InsertDepositUpdateParams) error { + _, err := q.db.ExecContext(ctx, insertDepositUpdate, arg.DepositID, arg.UpdateState, arg.UpdateTimestamp) + return err +} + +const updateDeposit = `-- name: UpdateDeposit :exec +UPDATE deposits +SET + tx_hash = $2, + out_index = $3, + confirmation_height = $4, + expiry_sweep_txid = $5 +WHERE + deposits.deposit_id = $1 +` + +type UpdateDepositParams struct { + DepositID []byte + TxHash []byte + OutIndex int32 + ConfirmationHeight int64 + ExpirySweepTxid []byte +} + +func (q *Queries) UpdateDeposit(ctx context.Context, arg UpdateDepositParams) error { + _, err := q.db.ExecContext(ctx, updateDeposit, + arg.DepositID, + arg.TxHash, + arg.OutIndex, + arg.ConfirmationHeight, + arg.ExpirySweepTxid, + ) + return err +} diff --git a/loopdb/sqlc/static_addresses.sql.go b/loopdb/sqlc/static_addresses.sql.go index cfe1a46..23902a2 100644 --- a/loopdb/sqlc/static_addresses.sql.go +++ b/loopdb/sqlc/static_addresses.sql.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.17.2 +// sqlc v1.25.0 // source: static_addresses.sql package sqlc From 246d4ddedab091305f3bb380b658cf2606631411 Mon Sep 17 00:00:00 2001 From: Slyghtning Date: Thu, 7 Mar 2024 17:27:13 +0100 Subject: [PATCH 31/37] istaticaddr: interfaces --- staticaddr/{ => address}/interface.go | 25 ++- staticaddr/{ => address}/sql_store.go | 58 ++----- staticaddr/deposit/interface.go | 44 ++++++ staticaddr/deposit/sql_store.go | 213 ++++++++++++++++++++++++++ 4 files changed, 279 insertions(+), 61 deletions(-) rename staticaddr/{ => address}/interface.go (66%) rename staticaddr/{ => address}/sql_store.go (63%) create mode 100644 staticaddr/deposit/interface.go create mode 100644 staticaddr/deposit/sql_store.go diff --git a/staticaddr/interface.go b/staticaddr/address/interface.go similarity index 66% rename from staticaddr/interface.go rename to staticaddr/address/interface.go index 8b424fb..99021e8 100644 --- a/staticaddr/interface.go +++ b/staticaddr/address/interface.go @@ -1,39 +1,38 @@ -package staticaddr +package address import ( "context" "fmt" "github.com/btcsuite/btcd/btcec/v2" + "github.com/lightninglabs/loop/staticaddr" "github.com/lightningnetwork/lnd/keychain" ) var ( ErrAddressAlreadyExists = fmt.Errorf("address already exists") - ErrAddressNotFound = fmt.Errorf("address not found") ) -// AddressStore is the database interface that is used to store and retrieve +// Store is the database interface that is used to store and retrieve // static addresses. -type AddressStore interface { +type Store interface { // CreateStaticAddress inserts a new static address with its parameters // into the store. - CreateStaticAddress(ctx context.Context, - addrParams *AddressParameters) error + CreateStaticAddress(ctx context.Context, addrParams *Parameters) error // GetStaticAddress fetches static address parameters for a given // address ID. - GetStaticAddress(ctx context.Context, - pkScript []byte) (*AddressParameters, error) + GetStaticAddress(ctx context.Context, pkScript []byte) (*Parameters, + error) // GetAllStaticAddresses retrieves all static addresses from the store. - GetAllStaticAddresses(ctx context.Context) ( - []*AddressParameters, error) + GetAllStaticAddresses(ctx context.Context) ([]*Parameters, + error) } -// AddressParameters holds all the necessary information for the 2-of-2 multisig +// Parameters holds all the necessary information for the 2-of-2 multisig // address. -type AddressParameters struct { +type Parameters struct { // ClientPubkey is the client's pubkey for the static address. It is // used for the 2-of-2 funding output as well as for the client's // timeout path. @@ -54,5 +53,5 @@ type AddressParameters struct { KeyLocator keychain.KeyLocator // ProtocolVersion is the protocol version of the static address. - ProtocolVersion AddressProtocolVersion + ProtocolVersion staticaddr.AddressProtocolVersion } diff --git a/staticaddr/sql_store.go b/staticaddr/address/sql_store.go similarity index 63% rename from staticaddr/sql_store.go rename to staticaddr/address/sql_store.go index 7f14f7c..9d15fc9 100644 --- a/staticaddr/sql_store.go +++ b/staticaddr/address/sql_store.go @@ -1,13 +1,12 @@ -package staticaddr +package address import ( "context" - "errors" "github.com/btcsuite/btcd/btcec/v2" - "github.com/jackc/pgx/v4" "github.com/lightninglabs/loop/loopdb" "github.com/lightninglabs/loop/loopdb/sqlc" + "github.com/lightninglabs/loop/staticaddr" "github.com/lightningnetwork/lnd/keychain" ) @@ -24,46 +23,9 @@ func NewSqlStore(db *loopdb.BaseDB) *SqlStore { } } -// ExecTx is a wrapper for txBody to abstract the creation and commit of a db -// transaction. The db transaction is embedded in a `*sqlc.Queries` that txBody -// needs to use when executing each one of the queries that need to be applied -// atomically. -func (s *SqlStore) ExecTx(ctx context.Context, txOptions loopdb.TxOptions, - txBody func(queries *sqlc.Queries) error) error { - - // Create the db transaction. - tx, err := s.baseDB.BeginTx(ctx, txOptions) - if err != nil { - return err - } - - // Rollback is safe to call even if the tx is already closed, so if the - // tx commits successfully, this is a no-op. - defer func() { - err := tx.Rollback() - switch { - // If the tx was already closed (it was successfully executed) - // we do not need to log that error. - case errors.Is(err, pgx.ErrTxClosed): - return - - // If this is an unexpected error, log it. - case err != nil: - log.Errorf("unable to rollback db tx: %v", err) - } - }() - - if err := txBody(s.baseDB.Queries.WithTx(tx)); err != nil { - return err - } - - // Commit transaction. - return tx.Commit() -} - // CreateStaticAddress creates a static address record in the database. func (s *SqlStore) CreateStaticAddress(ctx context.Context, - addrParams *AddressParameters) error { + addrParams *Parameters) error { createArgs := sqlc.CreateStaticAddressParams{ ClientPubkey: addrParams.ClientPubkey.SerializeCompressed(), @@ -80,7 +42,7 @@ func (s *SqlStore) CreateStaticAddress(ctx context.Context, // GetStaticAddress retrieves static address parameters for a given pkScript. func (s *SqlStore) GetStaticAddress(ctx context.Context, - pkScript []byte) (*AddressParameters, error) { + pkScript []byte) (*Parameters, error) { staticAddress, err := s.baseDB.Queries.GetStaticAddress(ctx, pkScript) if err != nil { @@ -91,15 +53,15 @@ func (s *SqlStore) GetStaticAddress(ctx context.Context, } // GetAllStaticAddresses returns all address known to the server. -func (s *SqlStore) GetAllStaticAddresses(ctx context.Context) ( - []*AddressParameters, error) { +func (s *SqlStore) GetAllStaticAddresses(ctx context.Context) ([]*Parameters, + error) { staticAddresses, err := s.baseDB.Queries.AllStaticAddresses(ctx) if err != nil { return nil, err } - var result []*AddressParameters + var result []*Parameters for _, address := range staticAddresses { res, err := s.toAddressParameters(address) if err != nil { @@ -120,7 +82,7 @@ func (s *SqlStore) Close() { // toAddressParameters transforms a database representation of a static address // to an AddressParameters struct. func (s *SqlStore) toAddressParameters(row sqlc.StaticAddress) ( - *AddressParameters, error) { + *Parameters, error) { clientPubkey, err := btcec.ParsePubKey(row.ClientPubkey) if err != nil { @@ -132,7 +94,7 @@ func (s *SqlStore) toAddressParameters(row sqlc.StaticAddress) ( return nil, err } - return &AddressParameters{ + return &Parameters{ ClientPubkey: clientPubkey, ServerPubkey: serverPubkey, PkScript: row.Pkscript, @@ -141,6 +103,6 @@ func (s *SqlStore) toAddressParameters(row sqlc.StaticAddress) ( Family: keychain.KeyFamily(row.ClientKeyFamily), Index: uint32(row.ClientKeyIndex), }, - ProtocolVersion: AddressProtocolVersion(row.ProtocolVersion), + ProtocolVersion: staticaddr.AddressProtocolVersion(row.ProtocolVersion), }, nil } diff --git a/staticaddr/deposit/interface.go b/staticaddr/deposit/interface.go new file mode 100644 index 0000000..dc98f16 --- /dev/null +++ b/staticaddr/deposit/interface.go @@ -0,0 +1,44 @@ +package deposit + +import ( + "context" + + "github.com/lightninglabs/loop/staticaddr/address" + "github.com/lightninglabs/loop/staticaddr/script" + "github.com/lightningnetwork/lnd/lnwallet" +) + +const ( + IdLength = 32 +) + +// Store is the database interface that is used to store and retrieve +// static address deposits. +type Store interface { + // CreateDeposit inserts a new deposit into the store. + CreateDeposit(ctx context.Context, deposit *Deposit) error + + // UpdateDeposit updates the deposit in the database. + UpdateDeposit(ctx context.Context, deposit *Deposit) error + + // GetDeposit retrieves a deposit with depositID from the database. + GetDeposit(ctx context.Context, depositID ID) (*Deposit, error) + + // AllDeposits retrieves all deposits from the store. + AllDeposits(ctx context.Context) ([]*Deposit, error) +} + +// AddressManager handles fetching of address parameters. +type AddressManager interface { + // GetStaticAddressParameters returns the static address parameters. + GetStaticAddressParameters(ctx context.Context) (*address.Parameters, + error) + + // GetStaticAddress returns the deposit address for the given + // client and server public keys. + GetStaticAddress(ctx context.Context) (*script.StaticAddress, error) + + // ListUnspent returns a list of utxos at the static address. + ListUnspent(ctx context.Context, minConfs, + maxConfs int32) ([]*lnwallet.Utxo, error) +} diff --git a/staticaddr/deposit/sql_store.go b/staticaddr/deposit/sql_store.go new file mode 100644 index 0000000..e50f478 --- /dev/null +++ b/staticaddr/deposit/sql_store.go @@ -0,0 +1,213 @@ +package deposit + +import ( + "context" + "database/sql" + + "github.com/btcsuite/btcd/btcutil" + "github.com/btcsuite/btcd/chaincfg/chainhash" + "github.com/btcsuite/btcd/wire" + "github.com/lightninglabs/loop/fsm" + "github.com/lightninglabs/loop/loopdb" + "github.com/lightninglabs/loop/loopdb/sqlc" + "github.com/lightningnetwork/lnd/clock" +) + +// SqlStore is the backing store for static address deposits. +type SqlStore struct { + baseDB *loopdb.BaseDB + + clock clock.Clock +} + +// NewSqlStore constructs a new SQLStore from a BaseDB. The BaseDB is agnostic +// to the underlying driver which can be postgres or sqlite. +func NewSqlStore(db *loopdb.BaseDB) *SqlStore { + return &SqlStore{ + baseDB: db, + + clock: clock.NewDefaultClock(), + } +} + +// CreateDeposit creates a static address deposit record in the database. +func (s *SqlStore) CreateDeposit(ctx context.Context, deposit *Deposit) error { + createArgs := sqlc.CreateDepositParams{ + DepositID: deposit.ID[:], + TxHash: deposit.Hash[:], + OutIndex: int32(deposit.Index), + Amount: int64(deposit.Value), + ConfirmationHeight: deposit.ConfirmationHeight, + TimeoutSweepPkScript: deposit.TimeOutSweepPkScript, + } + + updateArgs := sqlc.InsertDepositUpdateParams{ + DepositID: deposit.ID[:], + UpdateTimestamp: s.clock.Now().UTC(), + UpdateState: string(deposit.State), + } + + return s.baseDB.ExecTx(ctx, &loopdb.SqliteTxOptions{}, + func(q *sqlc.Queries) error { + err := q.CreateDeposit(ctx, createArgs) + if err != nil { + return err + } + + return q.InsertDepositUpdate(ctx, updateArgs) + }) +} + +// UpdateDeposit updates the deposit in the database. +func (s *SqlStore) UpdateDeposit(ctx context.Context, deposit *Deposit) error { + insertUpdateArgs := sqlc.InsertDepositUpdateParams{ + DepositID: deposit.ID[:], + UpdateTimestamp: s.clock.Now().UTC(), + UpdateState: string(deposit.State), + } + + var ( + txHash = deposit.Hash[:] + outIndex = sql.NullInt32{ + Int32: int32(deposit.Index), + Valid: true, + } + confirmationHeight = sql.NullInt64{ + Int64: deposit.ConfirmationHeight, + Valid: deposit.ConfirmationHeight != 0, + } + ) + + updateArgs := sqlc.UpdateDepositParams{ + DepositID: deposit.ID[:], + TxHash: txHash, + OutIndex: outIndex.Int32, + ConfirmationHeight: confirmationHeight.Int64, + ExpirySweepTxid: deposit.ExpirySweepTxid[:], + } + + return s.baseDB.ExecTx(ctx, &loopdb.SqliteTxOptions{}, + func(q *sqlc.Queries) error { + err := q.UpdateDeposit(ctx, updateArgs) + if err != nil { + return err + } + + return q.InsertDepositUpdate(ctx, insertUpdateArgs) + }) +} + +// GetDeposit retrieves the deposit from the database. +func (s *SqlStore) GetDeposit(ctx context.Context, id ID) (*Deposit, error) { + var deposit *Deposit + err := s.baseDB.ExecTx(ctx, loopdb.NewSqlReadOpts(), + func(q *sqlc.Queries) error { + row, err := q.GetDeposit(ctx, id[:]) + if err != nil { + return err + } + + latestUpdate, err := q.GetLatestDepositUpdate( + ctx, id[:], + ) + if err != nil { + return err + } + + deposit, err = s.toDeposit(row, latestUpdate) + if err != nil { + return err + } + + return nil + }) + if err != nil { + return nil, err + } + + return deposit, nil +} + +// AllDeposits retrieves all known deposits to our static address. +func (s *SqlStore) AllDeposits(ctx context.Context) ([]*Deposit, error) { + var allDeposits []*Deposit + + err := s.baseDB.ExecTx(ctx, loopdb.NewSqlReadOpts(), + func(q *sqlc.Queries) error { + var err error + + deposits, err := q.AllDeposits(ctx) + if err != nil { + return err + } + + for _, deposit := range deposits { + latestUpdate, err := q.GetLatestDepositUpdate( + ctx, deposit.DepositID, + ) + if err != nil { + return err + } + + d, err := s.toDeposit(deposit, latestUpdate) + if err != nil { + return err + } + + allDeposits = append(allDeposits, d) + } + + return nil + }) + if err != nil { + return nil, err + } + + return allDeposits, nil +} + +// toDeposit converts an sql deposit to a deposit. +func (s *SqlStore) toDeposit(row sqlc.Deposit, + lastUpdate sqlc.DepositUpdate) (*Deposit, error) { + + id := ID{} + err := id.FromByteSlice(row.DepositID) + if err != nil { + return nil, err + } + + var txHash *chainhash.Hash + if row.TxHash != nil { + txHash, err = chainhash.NewHash(row.TxHash) + if err != nil { + return nil, err + } + } + + var expirySweepTxid chainhash.Hash + if row.ExpirySweepTxid != nil { + hash, err := chainhash.NewHash(row.ExpirySweepTxid) + if err != nil { + return nil, err + } + expirySweepTxid = *hash + } + + return &Deposit{ + ID: id, + state: fsm.StateType(lastUpdate.UpdateState), + OutPoint: wire.OutPoint{ + Hash: *txHash, + Index: uint32(row.OutIndex), + }, + Value: btcutil.Amount(row.Amount), + ConfirmationHeight: row.ConfirmationHeight, + TimeOutSweepPkScript: row.TimeoutSweepPkScript, + ExpirySweepTxid: expirySweepTxid, + }, nil +} + +// Close closes the database connection. +func (s *SqlStore) Close() { + s.baseDB.DB.Close() +} From 2b3b3a89611bac4901648d2a6b581d9c527f495a Mon Sep 17 00:00:00 2001 From: Slyghtning Date: Thu, 7 Mar 2024 17:27:33 +0100 Subject: [PATCH 32/37] staticaddr: deposit logger --- staticaddr/log.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/staticaddr/log.go b/staticaddr/log.go index 53586b3..faa520a 100644 --- a/staticaddr/log.go +++ b/staticaddr/log.go @@ -22,3 +22,8 @@ func init() { func UseLogger(logger btclog.Logger) { log = logger } + +// GetLogger returns the logger for this package. +func GetLogger() btclog.Logger { + return log +} From 0e1b4dc44cd485453206174487cce4b0fc1ad2d4 Mon Sep 17 00:00:00 2001 From: Slyghtning Date: Thu, 7 Mar 2024 17:28:38 +0100 Subject: [PATCH 33/37] staticaddr: deposit manager and fsm --- staticaddr/{ => address}/manager.go | 105 +++++-- staticaddr/deposit/actions.go | 148 ++++++++++ staticaddr/deposit/deposit.go | 107 +++++++ staticaddr/deposit/fsm.go | 305 ++++++++++++++++++++ staticaddr/deposit/manager.go | 432 ++++++++++++++++++++++++++++ staticaddr/deposit/sql_store.go | 4 +- 6 files changed, 1068 insertions(+), 33 deletions(-) rename staticaddr/{ => address}/manager.go (75%) create mode 100644 staticaddr/deposit/actions.go create mode 100644 staticaddr/deposit/deposit.go create mode 100644 staticaddr/deposit/fsm.go create mode 100644 staticaddr/deposit/manager.go diff --git a/staticaddr/manager.go b/staticaddr/address/manager.go similarity index 75% rename from staticaddr/manager.go rename to staticaddr/address/manager.go index a963c86..c8b4e3f 100644 --- a/staticaddr/manager.go +++ b/staticaddr/address/manager.go @@ -1,4 +1,4 @@ -package staticaddr +package address import ( "bytes" @@ -10,8 +10,9 @@ import ( "github.com/btcsuite/btcd/btcec/v2/schnorr" "github.com/btcsuite/btcd/btcutil" "github.com/btcsuite/btcd/chaincfg" + "github.com/btcsuite/btclog" "github.com/lightninglabs/lndclient" - "github.com/lightninglabs/loop" + "github.com/lightninglabs/loop/staticaddr" "github.com/lightninglabs/loop/staticaddr/script" "github.com/lightninglabs/loop/swap" staticaddressrpc "github.com/lightninglabs/loop/swapserverrpc" @@ -20,18 +21,26 @@ import ( "github.com/lightningnetwork/lnd/lnwallet" ) +var ( + log btclog.Logger +) + +func init() { + log = staticaddr.GetLogger() +} + // ManagerConfig holds the configuration for the address manager. type ManagerConfig struct { // AddressClient is the client that communicates with the loop server // to manage static addresses. AddressClient staticaddressrpc.StaticAddressServerClient - // SwapClient provides loop rpc functionality. - SwapClient *loop.Client + // FetchL402 is the function used to fetch the l402 token. + FetchL402 func(context.Context) error // Store is the database store that is used to store static address // related records. - Store AddressStore + Store Store // WalletKit is the wallet client that is used to derive new keys from // lnd's wallet. @@ -46,30 +55,19 @@ type ManagerConfig struct { type Manager struct { cfg *ManagerConfig - initChan chan struct{} - sync.Mutex } -// NewAddressManager creates a new address manager. -func NewAddressManager(cfg *ManagerConfig) *Manager { +// NewManager creates a new address manager. +func NewManager(cfg *ManagerConfig) *Manager { return &Manager{ - cfg: cfg, - initChan: make(chan struct{}), + cfg: cfg, } } // Run runs the address manager. func (m *Manager) Run(ctx context.Context) error { - log.Debugf("Starting address manager.") - defer log.Debugf("Address manager stopped.") - - // Communicate to the caller that the address manager has completed its - // initialization. - close(m.initChan) - <-ctx.Done() - return nil } @@ -99,7 +97,7 @@ func (m *Manager) NewAddress(ctx context.Context) (*btcutil.AddressTaproot, // We are fetching a new L402 token from the server. There is one static // address per L402 token allowed. - err = m.cfg.SwapClient.Server.FetchL402(ctx) + err = m.cfg.FetchL402(ctx) if err != nil { return nil, err } @@ -113,7 +111,7 @@ func (m *Manager) NewAddress(ctx context.Context) (*btcutil.AddressTaproot, // Send our clientPubKey to the server and wait for the server to // respond with he serverPubKey and the static address CSV expiry. - protocolVersion := CurrentRPCProtocolVersion() + protocolVersion := staticaddr.CurrentRPCProtocolVersion() resp, err := m.cfg.AddressClient.ServerNewAddress( ctx, &staticaddressrpc.ServerNewAddressRequest{ ProtocolVersion: protocolVersion, @@ -146,7 +144,7 @@ func (m *Manager) NewAddress(ctx context.Context) (*btcutil.AddressTaproot, // Create the static address from the parameters the server provided and // store all parameters in the database. - addrParams := &AddressParameters{ + addrParams := &Parameters{ ClientPubkey: clientPubKey.PubKey, ServerPubkey: serverPubKey, PkScript: pkScript, @@ -155,7 +153,9 @@ func (m *Manager) NewAddress(ctx context.Context) (*btcutil.AddressTaproot, Family: clientPubKey.Family, Index: clientPubKey.Index, }, - ProtocolVersion: AddressProtocolVersion(protocolVersion), + ProtocolVersion: staticaddr.AddressProtocolVersion( + protocolVersion, + ), } err = m.cfg.Store.CreateStaticAddress(ctx, addrParams) if err != nil { @@ -172,7 +172,7 @@ func (m *Manager) NewAddress(ctx context.Context) (*btcutil.AddressTaproot, return nil, err } - log.Infof("imported static address taproot script to lnd wallet: %v", + log.Infof("Imported static address taproot script to lnd wallet: %v", addr) return m.getTaprootAddress( @@ -197,12 +197,6 @@ func (m *Manager) getTaprootAddress(clientPubkey, ) } -// WaitInitComplete waits until the address manager has completed its setup. -func (m *Manager) WaitInitComplete() { - defer log.Debugf("Address manager initiation complete.") - <-m.initChan -} - // ListUnspentRaw returns a list of utxos at the static address. func (m *Manager) ListUnspentRaw(ctx context.Context, minConfs, maxConfs int32) (*btcutil.AddressTaproot, []*lnwallet.Utxo, error) { @@ -213,7 +207,7 @@ func (m *Manager) ListUnspentRaw(ctx context.Context, minConfs, return nil, nil, err case len(addresses) == 0: - return nil, nil, fmt.Errorf("no address found") + return nil, nil, nil case len(addresses) > 1: return nil, nil, fmt.Errorf("more than one address found") @@ -249,3 +243,52 @@ func (m *Manager) ListUnspentRaw(ctx context.Context, minConfs, return taprootAddress, filteredUtxos, nil } + +// GetStaticAddressParameters returns the parameters of the static address. +func (m *Manager) GetStaticAddressParameters(ctx context.Context) (*Parameters, + error) { + + params, err := m.cfg.Store.GetAllStaticAddresses(ctx) + if err != nil { + return nil, err + } + + if len(params) == 0 { + return nil, fmt.Errorf("no static address parameters found") + } + + return params[0], nil +} + +// GetStaticAddress returns a taproot address for the given client and server +// public keys and expiry. +func (m *Manager) GetStaticAddress(ctx context.Context) (*script.StaticAddress, + error) { + + params, err := m.GetStaticAddressParameters(ctx) + if err != nil { + return nil, err + } + + address, err := script.NewStaticAddress( + input.MuSig2Version100RC2, int64(params.Expiry), + params.ClientPubkey, params.ServerPubkey, + ) + if err != nil { + return nil, err + } + + return address, nil +} + +// ListUnspent returns a list of utxos at the static address. +func (m *Manager) ListUnspent(ctx context.Context, minConfs, + maxConfs int32) ([]*lnwallet.Utxo, error) { + + _, utxos, err := m.ListUnspentRaw(ctx, minConfs, maxConfs) + if err != nil { + return nil, err + } + + return utxos, nil +} diff --git a/staticaddr/deposit/actions.go b/staticaddr/deposit/actions.go new file mode 100644 index 0000000..d40eefa --- /dev/null +++ b/staticaddr/deposit/actions.go @@ -0,0 +1,148 @@ +package deposit + +import ( + "errors" + "fmt" + "strings" + + "github.com/btcsuite/btcd/wire" + "github.com/lightninglabs/lndclient" + "github.com/lightninglabs/loop/fsm" + "github.com/lightninglabs/loop/staticaddr/script" +) + +const ( + defaultConfTarget = 3 +) + +// PublishDepositExpirySweepAction creates and publishes the timeout transaction +// that spends the deposit from the static address timeout leaf to the +// predefined timeout sweep pkscript. +func (f *FSM) PublishDepositExpirySweepAction(_ fsm.EventContext) fsm.EventType { + msgTx := wire.NewMsgTx(2) + + params, err := f.cfg.AddressManager.GetStaticAddressParameters(f.ctx) + if err != nil { + return fsm.OnError + } + + // Add the deposit outpoint as input to the transaction. + msgTx.AddTxIn(&wire.TxIn{ + PreviousOutPoint: f.deposit.OutPoint, + Sequence: params.Expiry, + SignatureScript: nil, + }) + + // Estimate the fee rate of an expiry spend transaction. + feeRateEstimator, err := f.cfg.WalletKit.EstimateFeeRate( + f.ctx, defaultConfTarget, + ) + if err != nil { + return f.HandleError(fmt.Errorf("timeout sweep fee "+ + "estimation failed: %v", err)) + } + + weight := script.ExpirySpendWeight() + + fee := feeRateEstimator.FeeForWeight(weight) + + // We cap the fee at 20% of the deposit value. + if fee > f.deposit.Value/5 { + return f.HandleError(errors.New("fee is greater than 20% of " + + "the deposit value")) + } + + output := &wire.TxOut{ + Value: int64(f.deposit.Value - fee), + PkScript: f.deposit.TimeOutSweepPkScript, + } + msgTx.AddTxOut(output) + + txOut := &wire.TxOut{ + Value: int64(f.deposit.Value), + PkScript: params.PkScript, + } + + prevOut := []*wire.TxOut{txOut} + + signDesc, err := f.SignDescriptor() + if err != nil { + return f.HandleError(err) + } + + rawSigs, err := f.cfg.Signer.SignOutputRaw( + f.ctx, msgTx, []*lndclient.SignDescriptor{signDesc}, prevOut, + ) + if err != nil { + return f.HandleError(err) + } + + address, err := f.cfg.AddressManager.GetStaticAddress(f.ctx) + if err != nil { + return f.HandleError(err) + } + + sig := rawSigs[0] + msgTx.TxIn[0].Witness, err = address.GenTimeoutWitness(sig) + if err != nil { + return f.HandleError(err) + } + + txLabel := fmt.Sprintf("timeout sweep for deposit %v", + f.deposit.OutPoint) + + err = f.cfg.WalletKit.PublishTransaction(f.ctx, msgTx, txLabel) + if err != nil { + if !strings.Contains(err.Error(), "output already spent") { + log.Errorf("%v: %v", txLabel, err) + f.LastActionError = err + return fsm.OnError + } + } else { + f.Debugf("published timeout sweep with txid: %v", + msgTx.TxHash()) + } + + return OnExpiryPublished +} + +// WaitForExpirySweepAction waits for a sufficient number of confirmations +// before a timeout sweep is considered successful. +func (f *FSM) WaitForExpirySweepAction(_ fsm.EventContext) fsm.EventType { + spendChan, errSpendChan, err := f.cfg.ChainNotifier.RegisterConfirmationsNtfn( //nolint:lll + f.ctx, nil, f.deposit.TimeOutSweepPkScript, defaultConfTarget, + int32(f.deposit.ConfirmationHeight), + ) + if err != nil { + return f.HandleError(err) + } + + select { + case err := <-errSpendChan: + log.Debugf("error while sweeping expired deposit: %v", err) + return fsm.OnError + + case confirmedTx := <-spendChan: + f.deposit.ExpirySweepTxid = confirmedTx.Tx.TxHash() + return OnExpirySwept + + case <-f.ctx.Done(): + return fsm.OnError + } +} + +// SweptExpiredDepositAction is the final action of the FSM. It signals to the +// manager that the deposit has been swept and the FSM can be removed. It also +// ends the state machine main loop by cancelling its context. +func (f *FSM) SweptExpiredDepositAction(_ fsm.EventContext) fsm.EventType { + select { + case <-f.ctx.Done(): + return fsm.OnError + + default: + f.finalizedDepositChan <- f.deposit.OutPoint + f.ctx.Done() + } + + return fsm.NoOp +} diff --git a/staticaddr/deposit/deposit.go b/staticaddr/deposit/deposit.go new file mode 100644 index 0000000..d2bda01 --- /dev/null +++ b/staticaddr/deposit/deposit.go @@ -0,0 +1,107 @@ +package deposit + +import ( + "crypto/rand" + "fmt" + "sync" + + "github.com/btcsuite/btcd/btcutil" + "github.com/btcsuite/btcd/chaincfg/chainhash" + "github.com/btcsuite/btcd/wire" + "github.com/lightninglabs/loop/fsm" +) + +// ID is a unique identifier for a deposit. +type ID [IdLength]byte + +// FromByteSlice creates a deposit id from a byte slice. +func (r *ID) FromByteSlice(b []byte) error { + if len(b) != IdLength { + return fmt.Errorf("deposit id must be 32 bytes, got %d, %x", + len(b), b) + } + + copy(r[:], b) + + return nil +} + +// Deposit bundles an utxo at a static address together with manager-relevant +// data. +type Deposit struct { + // ID is the unique identifier of the deposit. + ID ID + + // state is the current state of the deposit. + state fsm.StateType + + // The outpoint of the deposit. + wire.OutPoint + + // Value is the amount of the deposit. + Value btcutil.Amount + + // ConfirmationHeight is the absolute height at which the deposit was + // first confirmed. + ConfirmationHeight int64 + + // TimeOutSweepPkScript is the pk script that is used to sweep the + // deposit to after it is expired. + TimeOutSweepPkScript []byte + + // ExpirySweepTxid is the transaction id of the expiry sweep. + ExpirySweepTxid chainhash.Hash + + sync.Mutex +} + +// IsInPendingState returns true if the deposit is pending. +func (d *Deposit) IsInPendingState() bool { + d.Lock() + defer d.Unlock() + + return !d.IsInFinalState() +} + +// IsInFinalState returns true if the deposit is final. +func (d *Deposit) IsInFinalState() bool { + d.Lock() + defer d.Unlock() + + return d.state == Expired || d.state == Failed +} + +func (d *Deposit) isExpired(currentHeight, expiry uint32) bool { + d.Lock() + defer d.Unlock() + + return currentHeight >= uint32(d.ConfirmationHeight)+expiry +} + +func (d *Deposit) getState() fsm.StateType { + d.Lock() + defer d.Unlock() + + return d.state +} + +func (d *Deposit) setState(state fsm.StateType) { + d.Lock() + defer d.Unlock() + + d.state = state +} + +func (d *Deposit) isInState(state fsm.StateType) bool { + d.Lock() + defer d.Unlock() + + return d.state == state +} + +// GetRandomDepositID generates a random deposit ID. +func GetRandomDepositID() (ID, error) { + var id ID + _, err := rand.Read(id[:]) + return id, err +} diff --git a/staticaddr/deposit/fsm.go b/staticaddr/deposit/fsm.go new file mode 100644 index 0000000..b73b73f --- /dev/null +++ b/staticaddr/deposit/fsm.go @@ -0,0 +1,305 @@ +package deposit + +import ( + "context" + "errors" + "fmt" + + "github.com/btcsuite/btcd/txscript" + "github.com/btcsuite/btcd/wire" + "github.com/lightninglabs/lndclient" + "github.com/lightninglabs/loop/fsm" + "github.com/lightninglabs/loop/staticaddr" + "github.com/lightninglabs/loop/staticaddr/address" + "github.com/lightninglabs/loop/staticaddr/script" + "github.com/lightningnetwork/lnd/input" + "github.com/lightningnetwork/lnd/keychain" +) + +const ( + DefaultObserverSize = 20 +) + +var ( + ErrProtocolVersionNotSupported = errors.New("protocol version not " + + "supported") +) + +// States. +var ( + Deposited = fsm.StateType("Deposited") + + PublishExpiredDeposit = fsm.StateType("PublishExpiredDeposit") + + WaitForExpirySweep = fsm.StateType("WaitForExpirySweep") + + Expired = fsm.StateType("Expired") + + Failed = fsm.StateType("Failed") +) + +// Events. +var ( + OnStart = fsm.EventType("OnStart") + OnExpiry = fsm.EventType("OnExpiry") + OnExpiryPublished = fsm.EventType("OnExpiryPublished") + OnExpirySwept = fsm.EventType("OnExpirySwept") + OnRecover = fsm.EventType("OnRecover") +) + +// FSM is the state machine that handles the instant out. +type FSM struct { + *fsm.StateMachine + + cfg *ManagerConfig + + deposit *Deposit + + params *address.Parameters + + address *script.StaticAddress + + ctx context.Context + + blockNtfnChan chan uint32 + + finalizedDepositChan chan wire.OutPoint +} + +// NewFSM creates a new state machine that can action on all static address +// feature requests. +func NewFSM(ctx context.Context, deposit *Deposit, cfg *ManagerConfig, + finalizedDepositChan chan wire.OutPoint, + recoverStateMachine bool) (*FSM, error) { + + params, err := cfg.AddressManager.GetStaticAddressParameters(ctx) + if err != nil { + return nil, fmt.Errorf("unable to get static address "+ + "parameters: %v", err) + } + + address, err := cfg.AddressManager.GetStaticAddress(ctx) + if err != nil { + return nil, fmt.Errorf("unable to get static address: %v", err) + } + + depoFsm := &FSM{ + cfg: cfg, + deposit: deposit, + params: params, + address: address, + ctx: ctx, + blockNtfnChan: make(chan uint32), + finalizedDepositChan: finalizedDepositChan, + } + + depositStates := depoFsm.DepositStatesV0() + switch params.ProtocolVersion { + case staticaddr.ProtocolVersion_V0: + + default: + return nil, ErrProtocolVersionNotSupported + } + + if recoverStateMachine { + depoFsm.StateMachine = fsm.NewStateMachineWithState( + depositStates, deposit.getState(), + DefaultObserverSize, + ) + } else { + depoFsm.StateMachine = fsm.NewStateMachine( + depositStates, DefaultObserverSize, + ) + } + + depoFsm.ActionEntryFunc = depoFsm.updateDeposit + + go func() { + for { + select { + case currentHeight := <-depoFsm.blockNtfnChan: + err := depoFsm.handleBlockNotification( + currentHeight, + ) + if err != nil { + log.Errorf("error handling block "+ + "notification: %v", err) + } + + case <-ctx.Done(): + return + } + } + }() + + return depoFsm, nil +} + +// handleBlockNotification inspects the current block height and sends the +// OnExpiry event to publish the expiry sweep transaction if the deposit timed +// out, or it republishes the expiry sweep transaction if it was not yet swept. +func (f *FSM) handleBlockNotification(currentHeight uint32) error { + params, err := f.cfg.AddressManager.GetStaticAddressParameters(f.ctx) + if err != nil { + return err + } + + // If the deposit is expired but not yet sufficiently confirmed, we + // republish the expiry sweep transaction. + if f.deposit.isExpired(currentHeight, params.Expiry) { + if f.deposit.isInState(WaitForExpirySweep) { + f.PublishDepositExpirySweepAction(nil) + } else { + go func() { + err := f.SendEvent(OnExpiry, nil) + if err != nil { + log.Debugf("error sending OnExpiry "+ + "event: %v", err) + } + }() + } + } + + return nil +} + +// DepositStatesV0 returns the states a deposit can be in. +func (f *FSM) DepositStatesV0() fsm.States { + return fsm.States{ + fsm.EmptyState: fsm.State{ + Transitions: fsm.Transitions{ + OnStart: Deposited, + }, + Action: fsm.NoOpAction, + }, + Deposited: fsm.State{ + Transitions: fsm.Transitions{ + OnExpiry: PublishExpiredDeposit, + OnRecover: Deposited, + }, + Action: fsm.NoOpAction, + }, + PublishExpiredDeposit: fsm.State{ + Transitions: fsm.Transitions{ + OnRecover: PublishExpiredDeposit, + OnExpiryPublished: WaitForExpirySweep, + // If the timeout sweep failed we go back to + // Deposited, hoping that another timeout sweep + // attempt will be successful. Alternatively, + // the client can try to coop-spend the deposit. + fsm.OnError: Deposited, + }, + Action: f.PublishDepositExpirySweepAction, + }, + WaitForExpirySweep: fsm.State{ + Transitions: fsm.Transitions{ + OnExpirySwept: Expired, + // Upon recovery, we republish the sweep tx. + OnRecover: PublishExpiredDeposit, + // If the timeout sweep failed we go back to + // Deposited, hoping that another timeout sweep + // attempt will be successful. Alternatively, + // the client can try to coop-spend the deposit. + fsm.OnError: Deposited, + }, + Action: f.WaitForExpirySweepAction, + }, + Expired: fsm.State{ + Transitions: fsm.Transitions{ + OnExpiry: Expired, + }, + Action: f.SweptExpiredDepositAction, + }, + Failed: fsm.State{ + Transitions: fsm.Transitions{ + OnExpiry: Failed, + }, + Action: fsm.NoOpAction, + }, + } +} + +// DepositEntryFunction is called after every action and updates the deposit in +// the db. +func (f *FSM) updateDeposit(notification fsm.Notification) { + if f.deposit == nil { + return + } + + f.Debugf("NextState: %v, PreviousState: %v, Event: %v", + notification.NextState, notification.PreviousState, + notification.Event, + ) + + f.deposit.setState(notification.NextState) + + // Don't update the deposit if we are in an initial state or if we + // are transitioning from an initial state to a failed state. + d := f.deposit + if d.isInState(fsm.EmptyState) || d.isInState(Deposited) || + (notification.PreviousState == Deposited && d.isInState( + Failed, + )) { + + return + } + + err := f.cfg.Store.UpdateDeposit(f.ctx, f.deposit) + if err != nil { + f.Errorf("unable to update deposit: %v", err) + } +} + +// Infof logs an info message with the deposit outpoint. +func (f *FSM) Infof(format string, args ...interface{}) { + log.Infof( + "Deposit %v: "+format, + append( + []interface{}{f.deposit.OutPoint}, + args..., + )..., + ) +} + +// Debugf logs a debug message with the deposit outpoint. +func (f *FSM) Debugf(format string, args ...interface{}) { + log.Debugf( + "Deposit %v: "+format, + append( + []interface{}{f.deposit.OutPoint}, + args..., + )..., + ) +} + +// Errorf logs an error message with the deposit outpoint. +func (f *FSM) Errorf(format string, args ...interface{}) { + log.Errorf( + "Deposit %v: "+format, + append( + []interface{}{f.deposit.OutPoint}, + args..., + )..., + ) +} + +// SignDescriptor returns the sign descriptor for the static address output. +func (f *FSM) SignDescriptor() (*lndclient.SignDescriptor, error) { + address, err := f.cfg.AddressManager.GetStaticAddress(f.ctx) + if err != nil { + return nil, err + } + + return &lndclient.SignDescriptor{ + WitnessScript: address.TimeoutLeaf.Script, + KeyDesc: keychain.KeyDescriptor{ + PubKey: f.params.ClientPubkey, + }, + Output: wire.NewTxOut( + int64(f.deposit.Value), f.params.PkScript, + ), + HashType: txscript.SigHashDefault, + InputIndex: 0, + SignMethod: input.TaprootScriptSpendSignMethod, + }, nil +} diff --git a/staticaddr/deposit/manager.go b/staticaddr/deposit/manager.go new file mode 100644 index 0000000..68a2bee --- /dev/null +++ b/staticaddr/deposit/manager.go @@ -0,0 +1,432 @@ +package deposit + +import ( + "context" + "fmt" + "sync" + "time" + + "github.com/btcsuite/btcd/chaincfg" + "github.com/btcsuite/btcd/txscript" + "github.com/btcsuite/btcd/wire" + "github.com/btcsuite/btclog" + "github.com/lightninglabs/lndclient" + "github.com/lightninglabs/loop" + "github.com/lightninglabs/loop/staticaddr" + staticaddressrpc "github.com/lightninglabs/loop/swapserverrpc" + "github.com/lightningnetwork/lnd/lnrpc/walletrpc" + "github.com/lightningnetwork/lnd/lnwallet" +) + +const ( + // PollInterval is the interval in which we poll for new deposits to our + // static address. + PollInterval = 10 * time.Second + + // MinConfs is the minimum number of confirmations we require for a + // deposit to be considered available for loop-ins, coop-spends and + // timeouts. + MinConfs = 3 + + // MaxConfs is unset since we don't require a max number of + // confirmations for deposits. + MaxConfs = 0 +) + +var ( + log btclog.Logger +) + +func init() { + log = staticaddr.GetLogger() +} + +// ManagerConfig holds the configuration for the address manager. +type ManagerConfig struct { + // AddressClient is the client that communicates with the loop server + // to manage static addresses. + AddressClient staticaddressrpc.StaticAddressServerClient + + // AddressManager is the address manager that is used to fetch static + // address parameters. + AddressManager AddressManager + + // SwapClient provides loop rpc functionality. + SwapClient *loop.Client + + // Store is the database store that is used to store static address + // related records. + Store Store + + // WalletKit is the wallet client that is used to derive new keys from + // lnd's wallet. + WalletKit lndclient.WalletKitClient + + // ChainParams is the chain configuration(mainnet, testnet...) this + // manager uses. + ChainParams *chaincfg.Params + + // ChainNotifier is the chain notifier that is used to listen for new + // blocks. + ChainNotifier lndclient.ChainNotifierClient + + // Signer is the signer client that is used to sign transactions. + Signer lndclient.SignerClient +} + +// Manager manages the address state machines. +type Manager struct { + cfg *ManagerConfig + + runCtx context.Context + + sync.Mutex + + // initChan signals the daemon that the address manager has completed + // its initialization. + initChan chan struct{} + + // activeDeposits contains all the active static address outputs. + activeDeposits map[wire.OutPoint]*FSM + + // initiationHeight stores the currently best known block height. + initiationHeight uint32 + + // currentHeight stores the currently best known block height. + currentHeight uint32 + + // deposits contains all the deposits that have ever been made to the + // static address. This field is used to store and recover deposits. It + // also serves as basis for reconciliation of newly detected deposits by + // matching them against deposits in this map that were already seen. + deposits map[wire.OutPoint]*Deposit + + // finalizedDepositChan is a channel that receives deposits that have + // been finalized. The manager will adjust its internal state and flush + // finalized deposits from its memory. + finalizedDepositChan chan wire.OutPoint +} + +// NewManager creates a new deposit manager. +func NewManager(cfg *ManagerConfig) *Manager { + return &Manager{ + cfg: cfg, + initChan: make(chan struct{}), + activeDeposits: make(map[wire.OutPoint]*FSM), + deposits: make(map[wire.OutPoint]*Deposit), + finalizedDepositChan: make(chan wire.OutPoint), + } +} + +// Run runs the address manager. +func (m *Manager) Run(ctx context.Context, currentHeight uint32) error { + m.runCtx = ctx + + m.Lock() + m.currentHeight, m.initiationHeight = currentHeight, currentHeight + m.Unlock() + + newBlockChan, newBlockErrChan, err := m.cfg.ChainNotifier.RegisterBlockEpochNtfn(m.runCtx) //nolint:lll + if err != nil { + return err + } + + // Recover previous deposits and static address parameters from the DB. + err = m.recover(m.runCtx) + if err != nil { + return err + } + + // Start the deposit notifier. + m.pollDeposits(ctx) + + // Communicate to the caller that the address manager has completed its + // initialization. + close(m.initChan) + + for { + select { + case height := <-newBlockChan: + m.Lock() + m.currentHeight = uint32(height) + m.Unlock() + + // Inform all active deposits about a new block arrival. + for _, fsm := range m.activeDeposits { + select { + case fsm.blockNtfnChan <- uint32(height): + + case <-m.runCtx.Done(): + return m.runCtx.Err() + } + } + case outpoint := <-m.finalizedDepositChan: + // If deposits notify us about their finalization, we + // update the manager's internal state and flush the + // finalized deposit from memory. + m.finalizeDeposit(outpoint) + + case err := <-newBlockErrChan: + return err + + case <-m.runCtx.Done(): + return m.runCtx.Err() + } + } +} + +// recover recovers static address parameters, previous deposits and state +// machines from the database and starts the deposit notifier. +func (m *Manager) recover(ctx context.Context) error { + log.Infof("Recovering static address parameters and deposits...") + + // Recover deposits. + deposits, err := m.cfg.Store.AllDeposits(ctx) + if err != nil { + return err + } + + for i, d := range deposits { + m.deposits[d.OutPoint] = deposits[i] + + // If the current deposit is final it wasn't active when we + // shut down the client last. So we don't need to start a fsm + // for it. + if d.IsInFinalState() { + continue + } + + log.Debugf("Recovering deposit %x", d.ID) + + // Create a state machine for a given deposit. + fsm, err := NewFSM( + m.runCtx, d, m.cfg, + m.finalizedDepositChan, true, + ) + if err != nil { + return err + } + + // Send the OnRecover event to the state machine. + go func() { + err = fsm.SendEvent(OnRecover, nil) + if err != nil { + log.Errorf("Error sending OnStart event: %v", + err) + } + }() + + m.activeDeposits[d.OutPoint] = fsm + } + + return nil +} + +// WaitInitComplete waits until the address manager has completed its setup. +func (m *Manager) WaitInitComplete() { + defer log.Debugf("Static address deposit manager initiation complete.") + <-m.initChan +} + +// pollDeposits polls new deposits to our static address and notifies the +// manager's event loop about them. +func (m *Manager) pollDeposits(ctx context.Context) { + log.Debugf("Waiting for new static address deposits...") + + go func() { + ticker := time.NewTicker(PollInterval) + defer ticker.Stop() + for { + select { + case <-ticker.C: + err := m.reconcileDeposits(ctx) + if err != nil { + log.Errorf("unable to reconcile "+ + "deposits: %v", err) + } + + case <-ctx.Done(): + return + } + } + }() +} + +// reconcileDeposits fetches all spends to our static address from our lnd +// wallet and matches it against the deposits in our memory that we've seen so +// far. It picks the newly identified deposits and starts a state machine per +// deposit to track its progress. +func (m *Manager) reconcileDeposits(ctx context.Context) error { + log.Tracef("Reconciling new deposits...") + + utxos, err := m.cfg.AddressManager.ListUnspent( + ctx, MinConfs, MaxConfs, + ) + if err != nil { + return fmt.Errorf("unable to list new deposits: %v", err) + } + + newDeposits := m.filterNewDeposits(utxos) + if err != nil { + return fmt.Errorf("unable to filter new deposits: %v", err) + } + + if len(newDeposits) == 0 { + log.Tracef("No new deposits...") + return nil + } + + for _, utxo := range newDeposits { + deposit, err := m.createNewDeposit(ctx, utxo) + if err != nil { + return fmt.Errorf("unable to retain new deposit: %v", + err) + } + + log.Debugf("Received deposit: %v", deposit) + err = m.startDepositFsm(deposit) + if err != nil { + return fmt.Errorf("unable to start new deposit FSM: %v", + err) + } + } + + return nil +} + +// createNewDeposit transforms the wallet utxo into a deposit struct and stores +// it in our database and manager memory. +func (m *Manager) createNewDeposit(ctx context.Context, + utxo *lnwallet.Utxo) (*Deposit, error) { + + blockHeight, err := m.getBlockHeight(ctx, utxo) + if err != nil { + return nil, err + } + + // Get the sweep pk script. + addr, err := m.cfg.WalletKit.NextAddr( + ctx, lnwallet.DefaultAccountName, + walletrpc.AddressType_TAPROOT_PUBKEY, false, + ) + if err != nil { + return nil, err + } + + timeoutSweepPkScript, err := txscript.PayToAddrScript(addr) + if err != nil { + return nil, err + } + + id, err := GetRandomDepositID() + if err != nil { + return nil, err + } + deposit := &Deposit{ + ID: id, + state: Deposited, + OutPoint: utxo.OutPoint, + Value: utxo.Value, + ConfirmationHeight: int64(blockHeight), + TimeOutSweepPkScript: timeoutSweepPkScript, + } + + err = m.cfg.Store.CreateDeposit(ctx, deposit) + if err != nil { + return nil, err + } + + m.Lock() + m.deposits[deposit.OutPoint] = deposit + m.Unlock() + + return deposit, nil +} + +// getBlockHeight retrieves the block height of a given utxo. +func (m *Manager) getBlockHeight(ctx context.Context, + utxo *lnwallet.Utxo) (uint32, error) { + + addressParams, err := m.cfg.AddressManager.GetStaticAddressParameters( + ctx, + ) + if err != nil { + return 0, fmt.Errorf("couldn't get confirmation height for "+ + "deposit, %v", err) + } + + notifChan, errChan, err := m.cfg.ChainNotifier.RegisterConfirmationsNtfn( //nolint:lll + ctx, &utxo.OutPoint.Hash, addressParams.PkScript, MinConfs, + int32(m.initiationHeight), + ) + if err != nil { + return 0, err + } + + select { + case tx := <-notifChan: + return tx.BlockHeight, nil + + case err := <-errChan: + return 0, err + + case <-ctx.Done(): + return 0, ctx.Err() + } +} + +// filterNewDeposits filters the given utxos for new deposits that we haven't +// seen before. +func (m *Manager) filterNewDeposits(utxos []*lnwallet.Utxo) []*lnwallet.Utxo { + m.Lock() + defer m.Unlock() + + var newDeposits []*lnwallet.Utxo + for _, utxo := range utxos { + _, ok := m.deposits[utxo.OutPoint] + if !ok { + newDeposits = append(newDeposits, utxo) + } + } + + return newDeposits +} + +// startDepositFsm creates a new state machine flow from the latest deposit to +// our static address. +func (m *Manager) startDepositFsm(deposit *Deposit) error { + // Create a state machine for a given deposit. + fsm, err := NewFSM( + m.runCtx, deposit, m.cfg, m.finalizedDepositChan, false, + ) + if err != nil { + return err + } + + // Send the start event to the state machine. + go func() { + err = fsm.SendEvent(OnStart, nil) + if err != nil { + log.Errorf("Error sending OnStart event: %v", err) + } + }() + + err = fsm.DefaultObserver.WaitForState(m.runCtx, time.Minute, Deposited) + if err != nil { + return err + } + + // Add the FSM to the active FSMs map. + m.Lock() + m.activeDeposits[deposit.OutPoint] = fsm + m.Unlock() + + return nil +} + +func (m *Manager) finalizeDeposit(outpoint wire.OutPoint) { + m.Lock() + delete(m.activeDeposits, outpoint) + delete(m.deposits, outpoint) + m.Unlock() +} diff --git a/staticaddr/deposit/sql_store.go b/staticaddr/deposit/sql_store.go index e50f478..f746ee7 100644 --- a/staticaddr/deposit/sql_store.go +++ b/staticaddr/deposit/sql_store.go @@ -44,7 +44,7 @@ func (s *SqlStore) CreateDeposit(ctx context.Context, deposit *Deposit) error { updateArgs := sqlc.InsertDepositUpdateParams{ DepositID: deposit.ID[:], UpdateTimestamp: s.clock.Now().UTC(), - UpdateState: string(deposit.State), + UpdateState: string(deposit.getState()), } return s.baseDB.ExecTx(ctx, &loopdb.SqliteTxOptions{}, @@ -63,7 +63,7 @@ func (s *SqlStore) UpdateDeposit(ctx context.Context, deposit *Deposit) error { insertUpdateArgs := sqlc.InsertDepositUpdateParams{ DepositID: deposit.ID[:], UpdateTimestamp: s.clock.Now().UTC(), - UpdateState: string(deposit.State), + UpdateState: string(deposit.getState()), } var ( From aaa86f7f627e734196021116dd43751ba38ef7a1 Mon Sep 17 00:00:00 2001 From: Slyghtning Date: Thu, 7 Mar 2024 18:25:31 +0100 Subject: [PATCH 34/37] staticaddr: deposits for server and daemon --- loopd/daemon.go | 132 +++++++++++++++++++++++-------------- loopd/perms/perms.go | 4 +- loopd/swapclient_server.go | 75 +++++++++++++++++---- staticaddr/server.go | 70 -------------------- 4 files changed, 146 insertions(+), 135 deletions(-) delete mode 100644 staticaddr/server.go diff --git a/loopd/daemon.go b/loopd/daemon.go index d4c67fa..e335e20 100644 --- a/loopd/daemon.go +++ b/loopd/daemon.go @@ -21,7 +21,8 @@ import ( "github.com/lightninglabs/loop/loopd/perms" "github.com/lightninglabs/loop/loopdb" loop_looprpc "github.com/lightninglabs/loop/looprpc" - "github.com/lightninglabs/loop/staticaddr" + "github.com/lightninglabs/loop/staticaddr/address" + "github.com/lightninglabs/loop/staticaddr/deposit" loop_swaprpc "github.com/lightninglabs/loop/swapserverrpc" "github.com/lightninglabs/loop/sweepbatcher" "github.com/lightningnetwork/lnd/clock" @@ -68,12 +69,6 @@ type Daemon struct { // same process. swapClientServer - // AddressServer is the embedded RPC server that satisfies the - // static address client RPC interface. We embed this struct so the - // Daemon itself can be registered to an existing grpc.Server to run as - // a subserver in the same process. - *staticaddr.AddressServer - // ErrChan is an error channel that users of the Daemon struct must use // to detect runtime errors and also whether a shutdown is fully // completed. @@ -239,7 +234,6 @@ func (d *Daemon) startWebServers() error { grpc.StreamInterceptor(streamInterceptor), ) loop_looprpc.RegisterSwapClientServer(d.grpcServer, d) - loop_looprpc.RegisterStaticAddressClientServer(d.grpcServer, d) // Register our debug server if it is compiled in. d.registerDebugServer() @@ -438,6 +432,11 @@ func (d *Daemon) initialize(withMacaroonService bool) error { swapClient.Conn, ) + // Create a static address server client. + staticAddressClient := loop_swaprpc.NewStaticAddressServerClient( + swapClient.Conn, + ) + // Both the client RPC server and the swap server client should stop // on main context cancel. So we create it early and pass it down. d.mainCtx, d.mainCtxCancel = context.WithCancel(context.Background()) @@ -498,6 +497,9 @@ func (d *Daemon) initialize(withMacaroonService bool) error { var ( reservationManager *reservation.Manager instantOutManager *instantout.Manager + + staticAddressManager *address.Manager + depositManager *deposit.Manager ) // Create the reservation and instantout managers. if d.cfg.EnableExperimental { @@ -534,43 +536,50 @@ func (d *Daemon) initialize(withMacaroonService bool) error { instantOutManager = instantout.NewInstantOutManager( instantOutConfig, ) + + // Static address manager setup. + staticAddressStore := address.NewSqlStore(baseDb) + addrCfg := &address.ManagerConfig{ + AddressClient: staticAddressClient, + FetchL402: swapClient.Server.FetchL402, + Store: staticAddressStore, + WalletKit: d.lnd.WalletKit, + ChainParams: d.lnd.ChainParams, + } + staticAddressManager = address.NewManager(addrCfg) + + // Static address deposit manager setup. + depositStore := deposit.NewSqlStore(baseDb) + depoCfg := &deposit.ManagerConfig{ + AddressClient: staticAddressClient, + AddressManager: staticAddressManager, + SwapClient: swapClient, + Store: depositStore, + WalletKit: d.lnd.WalletKit, + ChainParams: d.lnd.ChainParams, + ChainNotifier: d.lnd.ChainNotifier, + Signer: d.lnd.Signer, + } + depositManager = deposit.NewManager(depoCfg) } // Now finally fully initialize the swap client RPC server instance. d.swapClientServer = swapClientServer{ - config: d.cfg, - network: lndclient.Network(d.cfg.Network), - impl: swapClient, - liquidityMgr: getLiquidityManager(swapClient), - lnd: &d.lnd.LndServices, - swaps: make(map[lntypes.Hash]loop.SwapInfo), - subscribers: make(map[int]chan<- interface{}), - statusChan: make(chan loop.SwapInfo), - mainCtx: d.mainCtx, - reservationManager: reservationManager, - instantOutManager: instantOutManager, + config: d.cfg, + network: lndclient.Network(d.cfg.Network), + impl: swapClient, + liquidityMgr: getLiquidityManager(swapClient), + lnd: &d.lnd.LndServices, + swaps: make(map[lntypes.Hash]loop.SwapInfo), + subscribers: make(map[int]chan<- interface{}), + statusChan: make(chan loop.SwapInfo), + mainCtx: d.mainCtx, + reservationManager: reservationManager, + instantOutManager: instantOutManager, + staticAddressManager: staticAddressManager, + depositManager: depositManager, } - // Create a static address server client. - staticAddressClient := loop_swaprpc.NewStaticAddressServerClient( - swapClient.Conn, - ) - - store := staticaddr.NewSqlStore(baseDb) - - cfg := &staticaddr.ManagerConfig{ - AddressClient: staticAddressClient, - SwapClient: swapClient, - Store: store, - WalletKit: d.lnd.WalletKit, - ChainParams: d.lnd.ChainParams, - } - staticAddressManager := staticaddr.NewAddressManager(cfg) - - d.AddressServer = staticaddr.NewAddressServer( - staticAddressClient, staticAddressManager, - ) - // Retrieve all currently existing swaps from the database. swapsList, err := d.impl.FetchSwaps(d.mainCtx) if err != nil { @@ -662,20 +671,43 @@ func (d *Daemon) initialize(withMacaroonService bool) error { } // Start the static address manager. - d.wg.Add(1) - go func() { - defer d.wg.Done() + if staticAddressManager != nil { + d.wg.Add(1) + go func() { + defer d.wg.Done() - log.Info("Starting static address manager...") - err = staticAddressManager.Run(d.mainCtx) - if err != nil && !errors.Is(context.Canceled, err) { - d.internalErrChan <- err - } + log.Info("Starting static address manager...") + err = staticAddressManager.Run(d.mainCtx) + if err != nil && !errors.Is(context.Canceled, err) { + d.internalErrChan <- err + } + log.Info("Static address manager stopped") + }() + } - log.Info("Static address manager stopped") - }() + // Start the static address deposit manager. + if depositManager != nil { + d.wg.Add(1) + go func() { + defer d.wg.Done() - staticAddressManager.WaitInitComplete() + // Lnd's GetInfo call supplies us with the current block + // height. + info, err := d.lnd.Client.GetInfo(d.mainCtx) + if err != nil { + d.internalErrChan <- err + return + } + + log.Info("Starting static address deposit manager...") + err = depositManager.Run(d.mainCtx, info.BlockHeight) + if err != nil && !errors.Is(context.Canceled, err) { + d.internalErrChan <- err + } + log.Info("Static address deposit manager stopped") + }() + depositManager.WaitInitComplete() + } // Last, start our internal error handler. This will return exactly one // error or nil on the main error channel to inform the caller that diff --git a/loopd/perms/perms.go b/loopd/perms/perms.go index d2b6380..7da667b 100644 --- a/loopd/perms/perms.go +++ b/loopd/perms/perms.go @@ -73,14 +73,14 @@ var RequiredPermissions = map[string][]bakery.Op{ Entity: "auth", Action: "read", }}, - "/looprpc.StaticAddressClient/NewAddress": {{ + "/looprpc.SwapClient/NewStaticAddress": {{ Entity: "swap", Action: "read", }, { Entity: "loop", Action: "in", }}, - "/looprpc.StaticAddressClient/ListUnspent": {{ + "/looprpc.SwapClient/ListUnspentDeposits": {{ Entity: "swap", Action: "read", }, { diff --git a/loopd/swapclient_server.go b/loopd/swapclient_server.go index 1f682f8..bbfd4c5 100644 --- a/loopd/swapclient_server.go +++ b/loopd/swapclient_server.go @@ -24,6 +24,8 @@ import ( "github.com/lightninglabs/loop/liquidity" "github.com/lightninglabs/loop/loopdb" clientrpc "github.com/lightninglabs/loop/looprpc" + "github.com/lightninglabs/loop/staticaddr/address" + "github.com/lightninglabs/loop/staticaddr/deposit" "github.com/lightninglabs/loop/swap" looprpc "github.com/lightninglabs/loop/swapserverrpc" "github.com/lightningnetwork/lnd/lnrpc/walletrpc" @@ -76,19 +78,21 @@ type swapClientServer struct { clientrpc.UnimplementedSwapClientServer clientrpc.UnimplementedDebugServer - config *Config - network lndclient.Network - impl *loop.Client - liquidityMgr *liquidity.Manager - lnd *lndclient.LndServices - reservationManager *reservation.Manager - instantOutManager *instantout.Manager - swaps map[lntypes.Hash]loop.SwapInfo - subscribers map[int]chan<- interface{} - statusChan chan loop.SwapInfo - nextSubscriberID int - swapsLock sync.Mutex - mainCtx context.Context + config *Config + network lndclient.Network + impl *loop.Client + liquidityMgr *liquidity.Manager + lnd *lndclient.LndServices + reservationManager *reservation.Manager + instantOutManager *instantout.Manager + staticAddressManager *address.Manager + depositManager *deposit.Manager + swaps map[lntypes.Hash]loop.SwapInfo + subscribers map[int]chan<- interface{} + statusChan chan loop.SwapInfo + nextSubscriberID int + swapsLock sync.Mutex + mainCtx context.Context } // LoopOut initiates a loop out swap with the given parameters. The call returns @@ -1287,6 +1291,51 @@ func rpcInstantOut(instantOut *instantout.InstantOut) *clientrpc.InstantOut { } } +// NewStaticAddress is the rpc endpoint for loop clients to request a new static +// address. +func (s *swapClientServer) NewStaticAddress(ctx context.Context, + _ *clientrpc.NewStaticAddressRequest) ( + *clientrpc.NewStaticAddressResponse, error) { + + staticAddress, err := s.staticAddressManager.NewAddress(ctx) + if err != nil { + return nil, err + } + + return &clientrpc.NewStaticAddressResponse{ + Address: staticAddress.String(), + }, nil +} + +// ListUnspentDeposits returns a list of utxos behind the static address. +func (s *swapClientServer) ListUnspentDeposits(ctx context.Context, + req *clientrpc.ListUnspentDepositsRequest) ( + *clientrpc.ListUnspentDepositsResponse, error) { + + // List all unspent utxos the wallet sees, regardless of the number of + // confirmations. + staticAddress, utxos, err := s.staticAddressManager.ListUnspentRaw( + ctx, req.MinConfs, req.MaxConfs, + ) + if err != nil { + return nil, err + } + + // Prepare the list response. + var respUtxos []*clientrpc.Utxo + for _, u := range utxos { + utxo := &clientrpc.Utxo{ + StaticAddress: staticAddress.String(), + AmountSat: int64(u.Value), + Confirmations: u.Confirmations, + Outpoint: u.OutPoint.String(), + } + respUtxos = append(respUtxos, utxo) + } + + return &clientrpc.ListUnspentDepositsResponse{Utxos: respUtxos}, nil +} + func rpcAutoloopReason(reason liquidity.Reason) (clientrpc.AutoReason, error) { switch reason { case liquidity.ReasonNone: diff --git a/staticaddr/server.go b/staticaddr/server.go deleted file mode 100644 index a6273dd..0000000 --- a/staticaddr/server.go +++ /dev/null @@ -1,70 +0,0 @@ -package staticaddr - -import ( - "context" - - "github.com/lightninglabs/loop/looprpc" - staticaddressrpc "github.com/lightninglabs/loop/swapserverrpc" -) - -// AddressServer holds all fields for the address rpc server. -type AddressServer struct { - addressClient staticaddressrpc.StaticAddressServerClient - manager *Manager - looprpc.UnimplementedStaticAddressClientServer -} - -// NewAddressServer creates a new static address server. -func NewAddressServer(addressClient staticaddressrpc.StaticAddressServerClient, - manager *Manager) *AddressServer { - - return &AddressServer{ - addressClient: addressClient, - manager: manager, - } -} - -// NewAddress is the rpc endpoint for loop clients to request a new static -// address. -func (s *AddressServer) NewAddress(ctx context.Context, - _ *looprpc.NewAddressRequest) (*looprpc.NewAddressResponse, error) { - - address, err := s.manager.NewAddress(ctx) - if err != nil { - return nil, err - } - - log.Infof("New static loop-in address: %s\n", address.String()) - - return &looprpc.NewAddressResponse{ - Address: address.String(), - }, nil -} - -// ListUnspent returns a list of utxos behind the static address. -func (s *AddressServer) ListUnspent(ctx context.Context, - req *looprpc.ListUnspentRequest) (*looprpc.ListUnspentResponse, error) { - - // List all unspent utxos the wallet sees, regardless of the number of - // confirmations. - staticAddress, utxos, err := s.manager.ListUnspentRaw( - ctx, req.MinConfs, req.MaxConfs, - ) - if err != nil { - return nil, err - } - - // Prepare the list response. - var respUtxos []*looprpc.Utxo - for _, u := range utxos { - utxo := &looprpc.Utxo{ - StaticAddress: staticAddress.String(), - AmountSat: int64(u.Value), - Confirmations: u.Confirmations, - Outpoint: u.OutPoint.String(), - } - respUtxos = append(respUtxos, utxo) - } - - return &looprpc.ListUnspentResponse{Utxos: respUtxos}, nil -} From 45f9b6a53b6138a24619a367685df47290856f44 Mon Sep 17 00:00:00 2001 From: Slyghtning Date: Thu, 7 Mar 2024 18:26:26 +0100 Subject: [PATCH 35/37] staticaddr: add swap client to cmd --- cmd/loop/staticaddr.go | 35 +++++++++-------------------------- 1 file changed, 9 insertions(+), 26 deletions(-) diff --git a/cmd/loop/staticaddr.go b/cmd/loop/staticaddr.go index c9626ba..bf1f7fc 100644 --- a/cmd/loop/staticaddr.go +++ b/cmd/loop/staticaddr.go @@ -39,14 +39,14 @@ func newStaticAddress(ctx *cli.Context) error { return cli.ShowCommandHelp(ctx, "new") } - client, cleanup, err := getAddressClient(ctx) + client, cleanup, err := getClient(ctx) if err != nil { return err } defer cleanup() - resp, err := client.NewAddress( - ctxb, &looprpc.NewAddressRequest{}, + resp, err := client.NewStaticAddress( + ctxb, &looprpc.NewStaticAddressRequest{}, ) if err != nil { return err @@ -86,16 +86,17 @@ func listUnspent(ctx *cli.Context) error { return cli.ShowCommandHelp(ctx, "listunspent") } - client, cleanup, err := getAddressClient(ctx) + client, cleanup, err := getClient(ctx) if err != nil { return err } defer cleanup() - resp, err := client.ListUnspent(ctxb, &looprpc.ListUnspentRequest{ - MinConfs: int32(ctx.Int("min_confs")), - MaxConfs: int32(ctx.Int("max_confs")), - }) + resp, err := client.ListUnspentDeposits( + ctxb, &looprpc.ListUnspentDepositsRequest{ + MinConfs: int32(ctx.Int("min_confs")), + MaxConfs: int32(ctx.Int("max_confs")), + }) if err != nil { return err } @@ -104,21 +105,3 @@ func listUnspent(ctx *cli.Context) error { return nil } - -func getAddressClient(ctx *cli.Context) (looprpc.StaticAddressClientClient, - func(), error) { - - rpcServer := ctx.GlobalString("rpcserver") - tlsCertPath, macaroonPath, err := extractPathArgs(ctx) - if err != nil { - return nil, nil, err - } - conn, err := getClientConn(rpcServer, tlsCertPath, macaroonPath) - if err != nil { - return nil, nil, err - } - cleanup := func() { conn.Close() } - - addressClient := looprpc.NewStaticAddressClientClient(conn) - return addressClient, cleanup, nil -} From 239f6b467604fb18995e68feb83a2b7bb6d7829e Mon Sep 17 00:00:00 2001 From: Slyghtning Date: Tue, 23 Apr 2024 10:49:49 +0200 Subject: [PATCH 36/37] unit: manager tests --- staticaddr/address/manager_test.go | 149 ++++++++++++++ staticaddr/deposit/manager_test.go | 314 +++++++++++++++++++++++++++++ test/walletkit_mock.go | 2 +- 3 files changed, 464 insertions(+), 1 deletion(-) create mode 100644 staticaddr/address/manager_test.go create mode 100644 staticaddr/deposit/manager_test.go diff --git a/staticaddr/address/manager_test.go b/staticaddr/address/manager_test.go new file mode 100644 index 0000000..8e15732 --- /dev/null +++ b/staticaddr/address/manager_test.go @@ -0,0 +1,149 @@ +package address + +import ( + "context" + "encoding/hex" + "testing" + + "github.com/btcsuite/btcd/btcec/v2" + "github.com/btcsuite/btcd/btcec/v2/schnorr" + "github.com/btcsuite/btcd/btcutil" + "github.com/lightninglabs/loop/loopdb" + "github.com/lightninglabs/loop/staticaddr/script" + "github.com/lightninglabs/loop/swap" + "github.com/lightninglabs/loop/swapserverrpc" + "github.com/lightninglabs/loop/test" + "github.com/lightningnetwork/lnd/input" + "github.com/lightningnetwork/lnd/keychain" + "github.com/stretchr/testify/mock" + "github.com/stretchr/testify/require" + "google.golang.org/grpc" +) + +var ( + defaultServerPubkeyBytes, _ = hex.DecodeString("021c97a90a411ff2b10dc2a8e32de2f29d2fa49d41bfbb52bd416e460db0747d0d") + + defaultServerPubkey, _ = btcec.ParsePubKey(defaultServerPubkeyBytes) + + defaultExpiry = uint32(100) +) + +type mockStaticAddressClient struct { + mock.Mock +} + +func (m *mockStaticAddressClient) ServerNewAddress(ctx context.Context, + in *swapserverrpc.ServerNewAddressRequest, opts ...grpc.CallOption) ( + *swapserverrpc.ServerNewAddressResponse, error) { + + args := m.Called(ctx, in, opts) + + return args.Get(0).(*swapserverrpc.ServerNewAddressResponse), + args.Error(1) +} + +// TestManager tests the static address manager generates the corerct static +// taproot address from the given test parameters. +func TestManager(t *testing.T) { + ctxb, cancel := context.WithCancel(context.Background()) + defer cancel() + + testContext := NewAddressManagerTestContext(t) + + // Start the manager. + go func() { + err := testContext.manager.Run(ctxb) + require.NoError(t, err) + }() + + // Create the expected static address. + expectedAddress, err := GenerateExpectedTaprootAddress(testContext) + require.NoError(t, err) + + // Create a new static address. + taprootAddress, err := testContext.manager.NewAddress(ctxb) + require.NoError(t, err) + + // The addresses have to match. + require.Equal(t, expectedAddress.String(), taprootAddress.String()) +} + +// GenerateExpectedTaprootAddress generates the expected taproot address that +// the predefined parameters are supposed to generate. +func GenerateExpectedTaprootAddress(t *ManagerTestContext) ( + *btcutil.AddressTaproot, error) { + + keyIndex := int32(0) + _, pubKey := test.CreateKey(keyIndex) + + keyDescriptor := &keychain.KeyDescriptor{ + KeyLocator: keychain.KeyLocator{ + Family: keychain.KeyFamily(swap.StaticAddressKeyFamily), + Index: uint32(keyIndex), + }, + PubKey: pubKey, + } + + staticAddress, err := script.NewStaticAddress( + input.MuSig2Version100RC2, int64(defaultExpiry), + keyDescriptor.PubKey, defaultServerPubkey, + ) + if err != nil { + return nil, err + } + + return btcutil.NewAddressTaproot( + schnorr.SerializePubKey(staticAddress.TaprootKey), + t.manager.cfg.ChainParams, + ) +} + +// ManagerTestContext is a helper struct that contains all the necessary +// components to test the static address manager. +type ManagerTestContext struct { + manager *Manager + context test.Context + mockLnd *test.LndMockServices + mockStaticAddressClient *mockStaticAddressClient +} + +// NewAddressManagerTestContext creates a new test context for the static +// address manager. +func NewAddressManagerTestContext(t *testing.T) *ManagerTestContext { + mockLnd := test.NewMockLnd() + lndContext := test.NewContext(t, mockLnd) + + dbFixture := loopdb.NewTestDB(t) + + store := NewSqlStore(dbFixture.BaseDB) + + mockStaticAddressClient := new(mockStaticAddressClient) + + mockStaticAddressClient.On( + "ServerNewAddress", mock.Anything, mock.Anything, mock.Anything, + ).Return( + &swapserverrpc.ServerNewAddressResponse{ + Params: &swapserverrpc.ServerAddressParameters{ + ServerKey: defaultServerPubkeyBytes, + Expiry: defaultExpiry, + }, + }, nil, + ) + + cfg := &ManagerConfig{ + Store: store, + WalletKit: mockLnd.WalletKit, + ChainParams: mockLnd.ChainParams, + AddressClient: mockStaticAddressClient, + FetchL402: func(context.Context) error { return nil }, + } + + manager := NewManager(cfg) + + return &ManagerTestContext{ + manager: manager, + context: lndContext, + mockLnd: mockLnd, + mockStaticAddressClient: mockStaticAddressClient, + } +} diff --git a/staticaddr/deposit/manager_test.go b/staticaddr/deposit/manager_test.go new file mode 100644 index 0000000..1cce2dc --- /dev/null +++ b/staticaddr/deposit/manager_test.go @@ -0,0 +1,314 @@ +package deposit + +import ( + "context" + "encoding/hex" + "testing" + + "github.com/btcsuite/btcd/btcec/v2" + "github.com/btcsuite/btcd/btcutil" + "github.com/btcsuite/btcd/chaincfg/chainhash" + "github.com/btcsuite/btcd/wire" + "github.com/lightninglabs/lndclient" + "github.com/lightninglabs/loop/staticaddr/address" + "github.com/lightninglabs/loop/staticaddr/script" + "github.com/lightninglabs/loop/swap" + "github.com/lightninglabs/loop/swapserverrpc" + "github.com/lightninglabs/loop/test" + "github.com/lightningnetwork/lnd/chainntnfs" + "github.com/lightningnetwork/lnd/input" + "github.com/lightningnetwork/lnd/lnwallet" + "github.com/stretchr/testify/mock" + "github.com/stretchr/testify/require" + "google.golang.org/grpc" +) + +var ( + defaultServerPubkeyBytes, _ = hex.DecodeString("021c97a90a411ff2b10dc2a8e32de2f29d2fa49d41bfbb52bd416e460db0747d0d") + + defaultServerPubkey, _ = btcec.ParsePubKey(defaultServerPubkeyBytes) + + defaultExpiry = uint32(100) + + defaultDepositConfirmations = uint32(3) + + confChan = make(chan *chainntnfs.TxConfirmation) + + confErrChan = make(chan error) + + blockChan = make(chan int32) + + blockErrChan = make(chan error) + + initChan = make(chan struct{}) + + finalizedDepositChan = make(chan wire.OutPoint) +) + +type mockStaticAddressClient struct { + mock.Mock +} + +func (m *mockStaticAddressClient) ServerNewAddress(ctx context.Context, + in *swapserverrpc.ServerNewAddressRequest, opts ...grpc.CallOption) ( + *swapserverrpc.ServerNewAddressResponse, error) { + + args := m.Called(ctx, in, opts) + + return args.Get(0).(*swapserverrpc.ServerNewAddressResponse), + args.Error(1) +} + +type mockAddressManager struct { + mock.Mock +} + +func (m *mockAddressManager) GetStaticAddressParameters(ctx context.Context) ( + *address.Parameters, error) { + + args := m.Called(ctx) + + return args.Get(0).(*address.Parameters), + args.Error(1) +} + +func (m *mockAddressManager) GetStaticAddress(ctx context.Context) ( + *script.StaticAddress, error) { + + args := m.Called(ctx) + + return args.Get(0).(*script.StaticAddress), + args.Error(1) +} + +func (m *mockAddressManager) ListUnspent(ctx context.Context, + minConfs, maxConfs int32) ([]*lnwallet.Utxo, error) { + + args := m.Called(ctx, minConfs, maxConfs) + + return args.Get(0).([]*lnwallet.Utxo), + args.Error(1) +} + +type mockStore struct { + mock.Mock +} + +func (s *mockStore) CreateDeposit(ctx context.Context, deposit *Deposit) error { + args := s.Called(ctx, deposit) + return args.Error(0) +} + +func (s *mockStore) UpdateDeposit(ctx context.Context, deposit *Deposit) error { + args := s.Called(ctx, deposit) + return args.Error(0) +} + +func (s *mockStore) GetDeposit(ctx context.Context, depositID ID) (*Deposit, + error) { + + args := s.Called(ctx, depositID) + return args.Get(0).(*Deposit), args.Error(1) +} + +func (s *mockStore) AllDeposits(ctx context.Context) ([]*Deposit, error) { + args := s.Called(ctx) + return args.Get(0).([]*Deposit), args.Error(1) +} + +type MockChainNotifier struct { + mock.Mock +} + +func (m *MockChainNotifier) RegisterConfirmationsNtfn(ctx context.Context, + txid *chainhash.Hash, pkScript []byte, numConfs, heightHint int32, + _ ...lndclient.NotifierOption) (chan *chainntnfs.TxConfirmation, + chan error, error) { + + args := m.Called(ctx, txid, pkScript, numConfs, heightHint) + return args.Get(0).(chan *chainntnfs.TxConfirmation), + args.Get(1).(chan error), args.Error(2) +} + +func (m *MockChainNotifier) RegisterBlockEpochNtfn(ctx context.Context) ( + chan int32, chan error, error) { + + args := m.Called(ctx) + return args.Get(0).(chan int32), args.Get(1).(chan error), args.Error(2) +} + +func (m *MockChainNotifier) RegisterSpendNtfn(ctx context.Context, + outpoint *wire.OutPoint, pkScript []byte, heightHint int32) ( + chan *chainntnfs.SpendDetail, chan error, error) { + + args := m.Called(ctx, pkScript, heightHint) + return args.Get(0).(chan *chainntnfs.SpendDetail), + args.Get(1).(chan error), args.Error(2) +} + +// TestManager checks that the manager processes the right channel notifications +// while a deposit is expiring. +func TestManager(t *testing.T) { + ctxb, cancel := context.WithCancel(context.Background()) + defer cancel() + + // Create the test context with required mocks. + testContext := newManagerTestContext(t) + + // Start the deposit manager. + go func() { + err := testContext.manager.Run( + ctxb, uint32(testContext.mockLnd.Height), + ) + require.NoError(t, err) + }() + + // Ensure that the manager has been initialized. + <-initChan + + // Notify about the last block before the expiry. + blockChan <- int32(defaultDepositConfirmations + defaultExpiry) + + // Ensure that the deposit state machine didn't sign for the expiry tx. + select { + case <-testContext.mockLnd.SignOutputRawChannel: + t.Fatal("received unexpected sign request") + + default: + } + + // Mine the expiry tx height. + blockChan <- int32(defaultDepositConfirmations + defaultExpiry) + + // Ensure that the deposit state machine didn't sign for the expiry tx. + <-testContext.mockLnd.SignOutputRawChannel + + // Ensure that the signed expiry transaction is published. + expiryTx := <-testContext.mockLnd.TxPublishChannel + + // Ensure that the deposit is waiting for a confirmation notification. + confChan <- &chainntnfs.TxConfirmation{ + BlockHeight: defaultDepositConfirmations + defaultExpiry + 3, + Tx: expiryTx, + } +} + +// ManagerTestContext is a helper struct that contains all the necessary +// components to test the reservation manager. +type ManagerTestContext struct { + manager *Manager + context test.Context + mockLnd *test.LndMockServices + mockStaticAddressClient *mockStaticAddressClient + mockAddressManager *mockAddressManager +} + +// newManagerTestContext creates a new test context for the reservation manager. +func newManagerTestContext(t *testing.T) *ManagerTestContext { + mockLnd := test.NewMockLnd() + lndContext := test.NewContext(t, mockLnd) + + mockStaticAddressClient := new(mockStaticAddressClient) + mockAddressManager := new(mockAddressManager) + mockStore := new(mockStore) + mockChainNotifier := new(MockChainNotifier) + + ID, err := GetRandomDepositID() + utxo := &lnwallet.Utxo{ + AddressType: lnwallet.TaprootPubkey, + Value: btcutil.Amount(100000), + Confirmations: int64(defaultDepositConfirmations), + PkScript: []byte("pkscript"), + OutPoint: wire.OutPoint{ + Hash: chainhash.Hash{}, + Index: 0xffffffff, + }, + } + require.NoError(t, err) + storedDeposits := []*Deposit{ + { + ID: ID, + state: Deposited, + OutPoint: utxo.OutPoint, + Value: utxo.Value, + ConfirmationHeight: 3, + TimeOutSweepPkScript: []byte{0x42, 0x21, 0x69}, + }, + } + + mockStore.On( + "AllDeposits", mock.Anything, + ).Return(storedDeposits, nil) + + mockStore.On( + "UpdateDeposit", mock.Anything, mock.Anything, + ).Return(nil) + + mockAddressManager.On( + "GetStaticAddressParameters", mock.Anything, + ).Return(&address.Parameters{ + Expiry: defaultExpiry, + }, nil) + + mockAddressManager.On( + "ListUnspent", mock.Anything, mock.Anything, mock.Anything, + ).Return([]*lnwallet.Utxo{utxo}, nil) + + // Define the expected return values for the mocks. + mockChainNotifier.On( + "RegisterConfirmationsNtfn", mock.Anything, mock.Anything, + mock.Anything, mock.Anything, mock.Anything, + ).Return(confChan, confErrChan, nil) + + mockChainNotifier.On("RegisterBlockEpochNtfn", mock.Anything).Return( + blockChan, blockErrChan, nil, + ) + + cfg := &ManagerConfig{ + AddressClient: mockStaticAddressClient, + AddressManager: mockAddressManager, + Store: mockStore, + WalletKit: mockLnd.WalletKit, + ChainParams: mockLnd.ChainParams, + ChainNotifier: mockChainNotifier, + Signer: mockLnd.Signer, + } + + manager := NewManager(cfg) + manager.initChan = initChan + manager.finalizedDepositChan = finalizedDepositChan + + testContext := &ManagerTestContext{ + manager: manager, + context: lndContext, + mockLnd: mockLnd, + mockStaticAddressClient: mockStaticAddressClient, + mockAddressManager: mockAddressManager, + } + + staticAddress := generateStaticAddress( + context.Background(), testContext, + ) + mockAddressManager.On( + "GetStaticAddress", mock.Anything, + ).Return(staticAddress, nil) + + return testContext +} + +func generateStaticAddress(ctx context.Context, + t *ManagerTestContext) *script.StaticAddress { + + keyDescriptor, err := t.mockLnd.WalletKit.DeriveNextKey( + ctx, swap.StaticAddressKeyFamily, + ) + require.NoError(t.context.T, err) + + staticAddress, err := script.NewStaticAddress( + input.MuSig2Version100RC2, int64(defaultExpiry), + keyDescriptor.PubKey, defaultServerPubkey, + ) + require.NoError(t.context.T, err) + + return staticAddress +} diff --git a/test/walletkit_mock.go b/test/walletkit_mock.go index c26f7b4..c8f9c11 100644 --- a/test/walletkit_mock.go +++ b/test/walletkit_mock.go @@ -266,5 +266,5 @@ func (m *mockWalletKit) ImportPublicKey(ctx context.Context, func (m *mockWalletKit) ImportTaprootScript(ctx context.Context, tapscript *waddrmgr.Tapscript) (btcutil.Address, error) { - return nil, fmt.Errorf("unimplemented") + return nil, nil } From 7c17c27b7662a38276e4e9fb06b6d8ac55f53a03 Mon Sep 17 00:00:00 2001 From: Slyghtning Date: Thu, 25 Apr 2024 15:17:59 +0200 Subject: [PATCH 37/37] staticaddr: public deposit method scope --- staticaddr/deposit/deposit.go | 8 ++++---- staticaddr/deposit/fsm.go | 12 ++++++------ staticaddr/deposit/sql_store.go | 4 ++-- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/staticaddr/deposit/deposit.go b/staticaddr/deposit/deposit.go index d2bda01..8c11999 100644 --- a/staticaddr/deposit/deposit.go +++ b/staticaddr/deposit/deposit.go @@ -71,28 +71,28 @@ func (d *Deposit) IsInFinalState() bool { return d.state == Expired || d.state == Failed } -func (d *Deposit) isExpired(currentHeight, expiry uint32) bool { +func (d *Deposit) IsExpired(currentHeight, expiry uint32) bool { d.Lock() defer d.Unlock() return currentHeight >= uint32(d.ConfirmationHeight)+expiry } -func (d *Deposit) getState() fsm.StateType { +func (d *Deposit) GetState() fsm.StateType { d.Lock() defer d.Unlock() return d.state } -func (d *Deposit) setState(state fsm.StateType) { +func (d *Deposit) SetState(state fsm.StateType) { d.Lock() defer d.Unlock() d.state = state } -func (d *Deposit) isInState(state fsm.StateType) bool { +func (d *Deposit) IsInState(state fsm.StateType) bool { d.Lock() defer d.Unlock() diff --git a/staticaddr/deposit/fsm.go b/staticaddr/deposit/fsm.go index b73b73f..3d5f505 100644 --- a/staticaddr/deposit/fsm.go +++ b/staticaddr/deposit/fsm.go @@ -103,7 +103,7 @@ func NewFSM(ctx context.Context, deposit *Deposit, cfg *ManagerConfig, if recoverStateMachine { depoFsm.StateMachine = fsm.NewStateMachineWithState( - depositStates, deposit.getState(), + depositStates, deposit.GetState(), DefaultObserverSize, ) } else { @@ -146,8 +146,8 @@ func (f *FSM) handleBlockNotification(currentHeight uint32) error { // If the deposit is expired but not yet sufficiently confirmed, we // republish the expiry sweep transaction. - if f.deposit.isExpired(currentHeight, params.Expiry) { - if f.deposit.isInState(WaitForExpirySweep) { + if f.deposit.IsExpired(currentHeight, params.Expiry) { + if f.deposit.IsInState(WaitForExpirySweep) { f.PublishDepositExpirySweepAction(nil) } else { go func() { @@ -231,13 +231,13 @@ func (f *FSM) updateDeposit(notification fsm.Notification) { notification.Event, ) - f.deposit.setState(notification.NextState) + f.deposit.SetState(notification.NextState) // Don't update the deposit if we are in an initial state or if we // are transitioning from an initial state to a failed state. d := f.deposit - if d.isInState(fsm.EmptyState) || d.isInState(Deposited) || - (notification.PreviousState == Deposited && d.isInState( + if d.IsInState(fsm.EmptyState) || d.IsInState(Deposited) || + (notification.PreviousState == Deposited && d.IsInState( Failed, )) { diff --git a/staticaddr/deposit/sql_store.go b/staticaddr/deposit/sql_store.go index f746ee7..7290077 100644 --- a/staticaddr/deposit/sql_store.go +++ b/staticaddr/deposit/sql_store.go @@ -44,7 +44,7 @@ func (s *SqlStore) CreateDeposit(ctx context.Context, deposit *Deposit) error { updateArgs := sqlc.InsertDepositUpdateParams{ DepositID: deposit.ID[:], UpdateTimestamp: s.clock.Now().UTC(), - UpdateState: string(deposit.getState()), + UpdateState: string(deposit.GetState()), } return s.baseDB.ExecTx(ctx, &loopdb.SqliteTxOptions{}, @@ -63,7 +63,7 @@ func (s *SqlStore) UpdateDeposit(ctx context.Context, deposit *Deposit) error { insertUpdateArgs := sqlc.InsertDepositUpdateParams{ DepositID: deposit.ID[:], UpdateTimestamp: s.clock.Now().UTC(), - UpdateState: string(deposit.getState()), + UpdateState: string(deposit.GetState()), } var (