From 816052514fe347c702b6efb7fed6679a356bae84 Mon Sep 17 00:00:00 2001 From: sputn1ck Date: Tue, 13 Aug 2024 12:22:20 +0200 Subject: [PATCH 01/11] hyperloop: create hyperloop package This commit adds the initial logger and interfaces to the hyperloop package. --- hyperloop/interfaces.go | 51 +++++++++++++++++++++++++++++++++++++++++ hyperloop/log.go | 26 +++++++++++++++++++++ loopd/log.go | 5 ++++ 3 files changed, 82 insertions(+) create mode 100644 hyperloop/interfaces.go create mode 100644 hyperloop/log.go diff --git a/hyperloop/interfaces.go b/hyperloop/interfaces.go new file mode 100644 index 000000000..41f493705 --- /dev/null +++ b/hyperloop/interfaces.go @@ -0,0 +1,51 @@ +package hyperloop + +import ( + "context" + + "github.com/lightninglabs/lndclient" + "github.com/lightningnetwork/lnd/input" + "github.com/lightningnetwork/lnd/keychain" +) + +// Store is the interface that stores the hyperloop. +type Store interface { + // CreateHyperloop stores the hyperloop in the database. + CreateHyperloop(ctx context.Context, hyperloop *HyperLoop) error + + // UpdateHyperloop updates the hyperloop in the database. + UpdateHyperloop(ctx context.Context, hyperloop *HyperLoop) error + + // CreateHyperloopParticipant stores the hyperloop participant in the + // database. + CreateHyperloopParticipant(ctx context.Context, + participant *HyperLoopParticipant) error + + // UpdateHyperloopParticipant updates the hyperloop participant in the + // database. + UpdateHyperloopParticipant(ctx context.Context, + participant *HyperLoopParticipant) error + + // GetHyperloop retrieves the hyperloop from the database. + GetHyperloop(ctx context.Context, id ID) (*HyperLoop, error) + + // ListHyperloops lists all existing hyperloops the client has ever + // made. + ListHyperloops(ctx context.Context) ([]*HyperLoop, error) +} + +type Wallet interface { + DeriveNextKey(ctx context.Context, family int32) ( + *keychain.KeyDescriptor, error) +} +type Musig2Signer interface { + MuSig2Sign(ctx context.Context, sessionID [32]byte, + message [32]byte, cleanup bool) ([]byte, error) + + MuSig2CreateSession(ctx context.Context, version input.MuSig2Version, + signerLoc *keychain.KeyLocator, signers [][]byte, + opts ...lndclient.MuSig2SessionOpts) (*input.MuSig2SessionInfo, error) + + MuSig2RegisterNonces(ctx context.Context, sessionID [32]byte, + nonces [][66]byte) (bool, error) +} diff --git a/hyperloop/log.go b/hyperloop/log.go new file mode 100644 index 000000000..8f0999ece --- /dev/null +++ b/hyperloop/log.go @@ -0,0 +1,26 @@ +package hyperloop + +import ( + "github.com/btcsuite/btclog" + "github.com/lightningnetwork/lnd/build" +) + +// Subsystem defines the sub system name of this package. +const Subsystem = "HYPRL" + +// 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 +} diff --git a/loopd/log.go b/loopd/log.go index 970bd806b..08686b6f1 100644 --- a/loopd/log.go +++ b/loopd/log.go @@ -6,6 +6,7 @@ import ( "github.com/lightninglabs/lndclient" "github.com/lightninglabs/loop" "github.com/lightninglabs/loop/fsm" + "github.com/lightninglabs/loop/hyperloop" "github.com/lightninglabs/loop/instantout" "github.com/lightninglabs/loop/instantout/reservation" "github.com/lightninglabs/loop/liquidity" @@ -48,6 +49,10 @@ func SetupLoggers(root *build.RotatingLogWriter, intercept signal.Interceptor) { lnd.AddSubLogger( root, instantout.Subsystem, intercept, instantout.UseLogger, ) + + lnd.AddSubLogger( + root, hyperloop.Subsystem, intercept, hyperloop.UseLogger, + ) } // genSubLogger creates a logger for a subsystem. We provide an instance of From 1ab7e654050ef8b17ae3c209aef5950f97cb39b5 Mon Sep 17 00:00:00 2001 From: sputn1ck Date: Tue, 13 Aug 2024 12:30:58 +0200 Subject: [PATCH 02/11] hyperloop: add hyperloop script --- hyperloop/script.go | 119 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 119 insertions(+) create mode 100644 hyperloop/script.go diff --git a/hyperloop/script.go b/hyperloop/script.go new file mode 100644 index 000000000..c32dba90f --- /dev/null +++ b/hyperloop/script.go @@ -0,0 +1,119 @@ +package hyperloop + +import ( + "fmt" + + "github.com/btcsuite/btcd/btcec/v2" + "github.com/btcsuite/btcd/btcec/v2/schnorr" + "github.com/btcsuite/btcd/txscript" + "github.com/lightningnetwork/lnd/input" +) + +const ( + + // TaprootMultiSigWitnessSize evaluates to 66 bytes: + // - num_witness_elements: 1 byte + // - sig_varint_len: 1 byte + // - : 64 bytes + TaprootMultiSigWitnessSize = 1 + 1 + 64 + + // TaprootExpiryScriptSize evaluates to 39 bytes: + // - OP_DATA: 1 byte (trader_key length) + // - : 32 bytes + // - OP_CHECKSIGVERIFY: 1 byte + // - : 4 bytes + // - OP_CHECKLOCKTIMEVERIFY: 1 byte + TaprootExpiryScriptSize = 1 + 32 + 1 + 4 + 1 + + // TaprootExpiryWitnessSize evaluates to 140 bytes: + // - num_witness_elements: 1 byte + // - trader_sig_varint_len: 1 byte (trader_sig length) + // - : 64 bytes + // - witness_script_varint_len: 1 byte (script length) + // - : 39 bytes + // - control_block_varint_len: 1 byte (control block length) + // - : 33 bytes + TaprootExpiryWitnessSize = 1 + 1 + 64 + 1 + TaprootExpiryScriptSize + 1 + 33 +) + +func HyperLoopScript(expiry uint32, serverKey *btcec.PublicKey, + clientKeys []*btcec.PublicKey) ([]byte, error) { + + taprootKey, _, _, err := TaprootKey(expiry, serverKey, clientKeys) + if err != nil { + return nil, err + } + return PayToWitnessTaprootScript(taprootKey) +} + +// TaprootKey returns the aggregated MuSig2 combined internal key and the +// tweaked Taproot key of an hyperloop output, as well as the expiry script tap +// leaf. +func TaprootKey(expiry uint32, serverKey *btcec.PublicKey, + clientKeys []*btcec.PublicKey) (*btcec.PublicKey, *btcec.PublicKey, + *txscript.TapLeaf, error) { + + expiryLeaf, err := TaprootExpiryScript(expiry, serverKey) + if err != nil { + return nil, nil, nil, err + } + + rootHash := expiryLeaf.TapHash() + + aggregateKey, err := input.MuSig2CombineKeys( + input.MuSig2Version100RC2, + clientKeys, + true, + &input.MuSig2Tweaks{ + TaprootTweak: rootHash[:], + }, + ) + if err != nil { + return nil, nil, nil, fmt.Errorf("error combining keys: %v", err) + } + + return aggregateKey.FinalKey, aggregateKey.PreTweakedKey, expiryLeaf, nil +} + +// PayToWitnessTaprootScript creates a new script to pay to a version 1 +// (taproot) witness program. The passed hash is expected to be valid. +func PayToWitnessTaprootScript(taprootKey *btcec.PublicKey) ([]byte, error) { + builder := txscript.NewScriptBuilder() + + builder.AddOp(txscript.OP_1) + builder.AddData(schnorr.SerializePubKey(taprootKey)) + + return builder.Script() +} + +// TaprootExpiryScript returns the leaf script of the expiry script path. +// +// OP_CHECKSIGVERIFY OP_CHECKSEQUENCEVERIFY. +func TaprootExpiryScript(expiry uint32, + serverKey *btcec.PublicKey) (*txscript.TapLeaf, error) { + + builder := txscript.NewScriptBuilder() + + builder.AddData(schnorr.SerializePubKey(serverKey)) + builder.AddOp(txscript.OP_CHECKSIGVERIFY) + + builder.AddInt64(int64(expiry)) + builder.AddOp(txscript.OP_CHECKSEQUENCEVERIFY) + + script, err := builder.Script() + if err != nil { + return nil, err + } + + leaf := txscript.NewBaseTapLeaf(script) + return &leaf, nil +} + +func ExpirySpendWeight() int64 { + var weightEstimator input.TxWeightEstimator + weightEstimator.AddWitnessInput(TaprootExpiryWitnessSize) + + weightEstimator.AddP2TROutput() + + return int64(weightEstimator.Weight()) +} From b3e3a85679054c6d23248bb7d924858145dcade2 Mon Sep 17 00:00:00 2001 From: sputn1ck Date: Tue, 13 Aug 2024 12:29:36 +0200 Subject: [PATCH 03/11] hyperloop: add hyperloop struct and funcs This commit adds the hyperloop struct and associated funcs. --- hyperloop/hyperloop.go | 654 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 654 insertions(+) create mode 100644 hyperloop/hyperloop.go diff --git a/hyperloop/hyperloop.go b/hyperloop/hyperloop.go new file mode 100644 index 000000000..28307b007 --- /dev/null +++ b/hyperloop/hyperloop.go @@ -0,0 +1,654 @@ +package hyperloop + +import ( + "context" + "crypto/rand" + "fmt" + "time" + + "github.com/btcsuite/btcd/btcec/v2" + "github.com/btcsuite/btcd/btcutil" + "github.com/btcsuite/btcd/btcutil/txsort" + "github.com/btcsuite/btcd/chaincfg" + "github.com/btcsuite/btcd/txscript" + "github.com/btcsuite/btcd/wire" + "github.com/lightninglabs/lndclient" + "github.com/lightninglabs/loop/fsm" + "github.com/lightninglabs/loop/swap" + "github.com/lightningnetwork/lnd/input" + "github.com/lightningnetwork/lnd/keychain" + "github.com/lightningnetwork/lnd/lntypes" + "github.com/lightningnetwork/lnd/lnwallet/chainfee" +) + +type ID [32]byte + +func NewHyperLoopId() (ID, error) { + var id ID + _, err := rand.Read(id[:]) + return id, err +} + +func ParseHyperloopId(id []byte) (ID, error) { + var newID ID + if len(id) != 32 { + return newID, fmt.Errorf("invalid hyperloop id") + } + copy(newID[:], id) + return newID, nil +} + +type HyperLoop struct { + // ID is the hyperloop identifier, this can be the same between multiple + // hyperloops, as swaps can be batched. + ID ID + + // PublishTime is the time where we request the hyperloop output to be + // published. + PublishTime time.Time + + // State is the current state of the hyperloop. + State fsm.StateType + + // SwapHash is the hash of the swap preimage and identifier of the htlc + // that goes onchain. + SwapHash lntypes.Hash + // SwapPreimage is the preimage of the swap hash. + SwapPreimage lntypes.Preimage + + // SwapInvoice is the invoice that the server sends to the client and the + // client pays. + SwapInvoice string + + // Amt is the requested amount of the hyperloop. + Amt btcutil.Amount + + // SweepAddr is the address we sweep the funds to after the hyperloop is + // completed. + SweepAddr btcutil.Address + + // KeyDesc is the key descriptor used to derive the keys for the hyperloop. + KeyDesc *keychain.KeyDescriptor + + // ServerKey is the key of the server used in the hyperloop musig2 output. + ServerKey *btcec.PublicKey + + // Participants are all the participants of the hyperloop including the + // requesting client. + Participants []*HyperLoopParticipant + + // HyperloopExpiry is the csv expiry of the hyperloop output. + HyperLoopExpiry uint32 + + // ConfirmedOutpoint is the outpoint of the confirmed hyperloop output. + ConfirmedOutpoint *wire.OutPoint + + // ConfirmationHeight is the height at which the hyperloop output was + // confirmed. + ConfirmationHeight int32 + + // HtlcFeeRate is the fee rate we'll use for the htlc tx. + HtlcFeeRate chainfee.SatPerKWeight + + // HtlcExpiry is the expiry of each of the htlc swap outputs. + HtlcExpiry int32 + + // HtlcMusig2Session is the musig2 session for the htlc tx. + HtlcMusig2Session *input.MuSig2SessionInfo + + // HtlcFullSig is the completed and valid signature for the htlc tx. + HtlcFullSig []byte + + // SweeplessSweepFeeRate is the fee rate we'll use for the sweepless sweep + // tx. + SweeplessSweepFeeRate chainfee.SatPerKWeight + + // SweeplessSweepMusig2Session is the musig2 session for the sweepless + // sweep tx. + SweeplessSweepMusig2Session *input.MuSig2SessionInfo + + // SweepServerNonce is the nonce of the server for the sweepless sweep tx. + SweepServerNonce [66]byte + + // sweeplessSweepAddrMap is a map of swap hashes to addresses for the + // sweepless sweep tx. + sweeplessSweepAddrMap map[lntypes.Hash]btcutil.Address +} + +// newHyperLoop creates a new hyperloop with the given parameters. +func newHyperLoop(id ID, publishTime time.Time, amt btcutil.Amount, + keyDesc *keychain.KeyDescriptor, preimage lntypes.Preimage, + sweepAddr btcutil.Address) *HyperLoop { + + return &HyperLoop{ + ID: id, + PublishTime: publishTime, + SwapPreimage: preimage, + SwapHash: preimage.Hash(), + KeyDesc: keyDesc, + Amt: amt, + SweepAddr: sweepAddr, + sweeplessSweepAddrMap: make(map[lntypes.Hash]btcutil.Address), + } +} + +// addInitialHyperLoopInfo adds the initial server info to the hyperloop. +func (h *HyperLoop) addInitialHyperLoopInfo(HtlcFeeRate chainfee.SatPerKWeight, + HyperLoopExpiry uint32, HtlcExpiry int32, serverKey *btcec.PublicKey, + swapInvoice string) { + h.HtlcFeeRate = HtlcFeeRate + h.HtlcExpiry = HtlcExpiry + h.HyperLoopExpiry = HyperLoopExpiry + h.ServerKey = serverKey + h.SwapInvoice = swapInvoice +} + +// String returns a human-readable string representation of the hyperloop. +// It encodes the first 3 bytes of the ID as a hex string adds a colon and then +// the first 3 bytes of the swap hash. +func (h *HyperLoop) String() string { + return fmt.Sprintf("%x:%x", h.ID[:3], h.SwapHash[:3]) +} + +type HyperLoopParticipant struct { + SwapHash lntypes.Hash + Amt btcutil.Amount + Pubkey *btcec.PublicKey + SweepAddress btcutil.Address +} + +// addParticipant adds a participant to the hyperloop and adds the sweep address +// to the sweepless sweep address map. +func (h *HyperLoop) registerParticipants(participants []*HyperLoopParticipant) { + h.Participants = participants + for _, p := range participants { + h.sweeplessSweepAddrMap[p.SwapHash] = p.SweepAddress + } +} + +// startHtlcSession starts the musig2 session for the htlc tx. +func (h *HyperLoop) startHtlcSession(ctx context.Context, + signer lndclient.SignerClient) error { + + rootHash, err := h.getHyperLoopRootHash() + if err != nil { + return err + } + + allPubkeys, err := h.getHyperLoopPubkeys() + if err != nil { + return err + } + + var rawKeys [][]byte + for _, key := range allPubkeys { + key := key + rawKeys = append(rawKeys, key.SerializeCompressed()) + } + + htlcSession, err := signer.MuSig2CreateSession( + ctx, input.MuSig2Version100RC2, &h.KeyDesc.KeyLocator, + rawKeys, + lndclient.MuSig2TaprootTweakOpt(rootHash, false), + ) + if err != nil { + return err + } + + h.HtlcMusig2Session = htlcSession + return nil +} + +// startSweeplessSession starts the musig2 session for the sweepless sweep tx. +func (h *HyperLoop) startSweeplessSession(ctx context.Context, + signer lndclient.SignerClient) error { + + rootHash, err := h.getHyperLoopRootHash() + if err != nil { + return err + } + + allPubkeys, err := h.getHyperLoopPubkeys() + if err != nil { + return err + } + + var rawKeys [][]byte + for _, key := range allPubkeys { + key := key + rawKeys = append(rawKeys, key.SerializeCompressed()) + } + + sweeplessSweepSession, err := signer.MuSig2CreateSession( + ctx, input.MuSig2Version100RC2, + &h.KeyDesc.KeyLocator, rawKeys, + lndclient.MuSig2TaprootTweakOpt(rootHash, false), + ) + if err != nil { + return err + } + + h.SweeplessSweepMusig2Session = sweeplessSweepSession + + return nil +} + +// registerHtlcNonces registers the htlc nonces for the hyperloop. +func (h *HyperLoop) registerHtlcNonces(ctx context.Context, + signer lndclient.SignerClient, nonces [][66]byte) error { + + noncesWithoutOwn, err := h.removeOwnNonceFromSet( + h.HtlcMusig2Session, nonces, + ) + if err != nil { + return err + } + haveAllNonces, err := signer.MuSig2RegisterNonces( + ctx, h.HtlcMusig2Session.SessionID, noncesWithoutOwn, + ) + if err != nil { + return err + } + + if !haveAllNonces { + return fmt.Errorf("not all nonces registered") + } + + return nil +} + +// registerSweeplessSweepNonces registers the sweepless sweep nonces for the +// hyperloop. +func (h *HyperLoop) registerSweeplessSweepNonces(ctx context.Context, + signer lndclient.SignerClient, nonces [][66]byte) error { + + nonces = append(nonces, h.SweepServerNonce) + + noncesWithoutOwn, err := h.removeOwnNonceFromSet( + h.SweeplessSweepMusig2Session, nonces, + ) + if err != nil { + return err + } + + haveAllNonces, err := signer.MuSig2RegisterNonces( + ctx, h.SweeplessSweepMusig2Session.SessionID, noncesWithoutOwn, + ) + if err != nil { + return err + } + if !haveAllNonces { + return fmt.Errorf("not all nonces registered") + } + + return nil +} + +// removeOwnNonceFromSet removes the own nonce from the set of nonces. +func (h *HyperLoop) removeOwnNonceFromSet(session *input.MuSig2SessionInfo, + nonces [][66]byte) ([][66]byte, error) { + + var ownNonce [66]byte + copy(ownNonce[:], session.PublicNonce[:]) + + var noncesWithoutOwn [][66]byte + for _, nonce := range nonces { + nonce := nonce + if nonce != ownNonce { + noncesWithoutOwn = append(noncesWithoutOwn, nonce) + } + } + + return noncesWithoutOwn, nil +} + +// getHyperLoopSweeplessSweepTx returns the sweepless sweep tx for the hyperloop. +func (h *HyperLoop) getHyperLoopSweeplessSweepTx() (*wire.MsgTx, error) { + + sweeplessSweepTx := wire.NewMsgTx(2) + + // Add the hyperloop input. + sweeplessSweepTx.AddTxIn(&wire.TxIn{ + PreviousOutPoint: *h.ConfirmedOutpoint, + }) + + // Create a map of addresses to amounts. + sweepPkScriptAmtMap := make(map[btcutil.Address]btcutil.Amount) + for _, participant := range h.Participants { + participant := participant + sweepPkScriptAmtMap[h.sweeplessSweepAddrMap[participant.SwapHash]] += participant.Amt + } + + sweeplessSweepFee, err := h.getSweeplessSweepFee() + if err != nil { + return nil, err + } + feePerOutput := sweeplessSweepFee / btcutil.Amount(len(sweepPkScriptAmtMap)) + + // Add all the sweepless sweep outputs. + for addr, amt := range sweepPkScriptAmtMap { + pkScript, err := txscript.PayToAddrScript(addr) + if err != nil { + return nil, err + } + log.Infof("Adding output %x %v", pkScript, amt) + sweeplessSweepTx.AddTxOut(&wire.TxOut{ + PkScript: []byte(pkScript), + Value: int64(amt - feePerOutput), + }) + sweeplessSweepTx.AddTxOut(&wire.TxOut{ + PkScript: []byte(pkScript), + Value: int64(amt - feePerOutput), + }) + } + + txsort.InPlaceSort(sweeplessSweepTx) + + return sweeplessSweepTx, nil +} + +// getHtlcFee returns the absolute fee for the htlc tx. +func (h *HyperLoop) getHtlcFee() btcutil.Amount { + var weightEstimate input.TxWeightEstimator + + // Add the input. + weightEstimate.AddTaprootKeySpendInput(txscript.SigHashAll) + + // Add the outputs. + for i := 0; i < len(h.Participants); i++ { + weightEstimate.AddP2WSHOutput() + } + + weight := weightEstimate.Weight() + + return h.HtlcFeeRate.FeeForWeight(weight) +} + +// getSweeplessSweepFee returns the absolute fee for the sweepless sweep tx. +func (h *HyperLoop) getSweeplessSweepFee() (btcutil.Amount, error) { + var weightEstimate input.TxWeightEstimator + + // Add the input. + weightEstimate.AddTaprootKeySpendInput(txscript.SigHashAll) + + // Add the outputs. + for _, sweepAddr := range h.sweeplessSweepAddrMap { + switch sweepAddr.(type) { + case *btcutil.AddressWitnessScriptHash: + weightEstimate.AddP2WSHOutput() + + case *btcutil.AddressWitnessPubKeyHash: + weightEstimate.AddP2WKHOutput() + + case *btcutil.AddressScriptHash: + weightEstimate.AddP2SHOutput() + + case *btcutil.AddressPubKeyHash: + weightEstimate.AddP2PKHOutput() + + case *btcutil.AddressTaproot: + weightEstimate.AddP2TROutput() + + default: + return 0, fmt.Errorf("estimate fee: unknown address type %T", + sweepAddr) + } + } + + weight := weightEstimate.Weight() + + return h.SweeplessSweepFeeRate.FeeForWeight(weight), nil +} + +// getHtlcSig returns the signature for the htlc tx. +func (h *HyperLoop) getHtlcSig(ctx context.Context, + signer lndclient.SignerClient, chainParams *chaincfg.Params) ( + []byte, error) { + + // First get the hyperloop htlc tx. + htlcTx, err := h.getHyperLoopHtlcTx(chainParams) + if err != nil { + return nil, err + } + + return h.getSigForTx(ctx, signer, htlcTx, h.HtlcMusig2Session.SessionID) +} + +// getSweeplessSweepSig returns the signature for the sweepless sweep tx. +func (h *HyperLoop) getSweeplessSweepSig(ctx context.Context, + signer lndclient.SignerClient) ([]byte, error) { + + // First get the hyperloop sweepless sweep tx. + sweeplessSweepTx, err := h.getHyperLoopSweeplessSweepTx() + if err != nil { + return nil, err + } + + return h.getSigForTx( + ctx, signer, sweeplessSweepTx, h.SweeplessSweepMusig2Session.SessionID, + ) +} + +// getSigForTx returns the signature for the given hyperloop tx. +func (h *HyperLoop) getSigForTx(ctx context.Context, + signer lndclient.SignerClient, tx *wire.MsgTx, musig2SessionId [32]byte) ( + []byte, error) { + + sigHash, err := h.getTxSighash(tx) + if err != nil { + return nil, err + } + + // Now we can get the sig. + sig, err := signer.MuSig2Sign( + ctx, musig2SessionId, sigHash, false, + ) + if err != nil { + return nil, err + } + + return sig, nil +} + +// getTxSighash returns the sighash for the given hyperloop tx. +func (h *HyperLoop) getTxSighash(tx *wire.MsgTx) ([32]byte, error) { + prevOutFetcher, err := h.getHyperLoopPrevOutputFetcher() + if err != nil { + return [32]byte{}, err + } + + sigHashes := txscript.NewTxSigHashes(tx, prevOutFetcher) + + taprootSigHash, err := txscript.CalcTaprootSignatureHash( + sigHashes, txscript.SigHashDefault, + tx, 0, prevOutFetcher, + ) + if err != nil { + return [32]byte{}, err + } + + var digest [32]byte + copy(digest[:], taprootSigHash) + + return digest, nil +} + +// getHyperLoopPrevOutputFetcher returns a canned prev output fetcher for the +// hyperloop. This is required for the signature generation and verification. +func (h *HyperLoop) getHyperLoopPrevOutputFetcher() (txscript.PrevOutputFetcher, + error) { + hyperloopScript, err := h.getHyperLoopScript() + if err != nil { + return nil, err + } + + return txscript.NewCannedPrevOutputFetcher( + hyperloopScript, int64(h.getHyperLoopTotalAmt()), + ), nil +} + +// getHyperLoopTotalAmt returns the total amount of the hyperloop. +func (h *HyperLoop) getHyperLoopTotalAmt() btcutil.Amount { + hyperLoopAmt := btcutil.Amount(0) + for _, input := range h.Participants { + input := input + hyperLoopAmt += input.Amt + } + return hyperLoopAmt +} + +// getHyperLoopHtlcTx returns the htlc spending tx for the hyperloop. +func (h *HyperLoop) getHyperLoopHtlcTx(chainParams *chaincfg.Params) ( + *wire.MsgTx, error) { + + htlcTx := wire.NewMsgTx(2) + + // Add the hyperloop input. + htlcTx.AddTxIn(&wire.TxIn{ + PreviousOutPoint: *h.ConfirmedOutpoint, + }) + + // Get the fee per output. + htlcFee := h.getHtlcFee() + feePerOutput := htlcFee / btcutil.Amount(len(h.Participants)) + + // Add all the htlc outputs. + for _, participant := range h.Participants { + participant := participant + serverkey, err := get33Bytes(h.ServerKey) + if err != nil { + return nil, err + } + + clientkey, err := get33Bytes(participant.Pubkey) + if err != nil { + return nil, err + } + + htlcv2, err := swap.NewHtlcV2( + h.HtlcExpiry, serverkey, clientkey, + participant.SwapHash, chainParams, + ) + if err != nil { + return nil, err + } + + htlcTx.AddTxOut(&wire.TxOut{ + PkScript: htlcv2.PkScript, + Value: int64(participant.Amt - feePerOutput), + }) + } + + return htlcTx, nil +} + +// getHyperLoopScript returns the pkscript for the hyperloop output. +func (h *HyperLoop) getHyperLoopScript() ([]byte, error) { + pubkeys, err := h.getHyperLoopPubkeys() + if err != nil { + return nil, err + } + + return HyperLoopScript(h.HyperLoopExpiry, h.ServerKey, pubkeys) +} + +// getHyperLoopRootHash returns the root hash of the hyperloop. +func (h *HyperLoop) getHyperLoopRootHash() ([]byte, error) { + + pubkeys, err := h.getHyperLoopPubkeys() + if err != nil { + return nil, err + } + + _, _, leaf, err := TaprootKey( + h.HyperLoopExpiry, h.ServerKey, pubkeys, + ) + if err != nil { + return nil, err + } + + rootHash := leaf.TapHash() + + return rootHash[:], nil +} + +// getHyperLoopPubkeys returns the pubkeys of all participants and the server. +func (h *HyperLoop) getHyperLoopPubkeys() ([]*btcec.PublicKey, error) { + pubkeys := make([]*btcec.PublicKey, 0, len(h.Participants)) + for _, participant := range h.Participants { + participant := participant + if participant.Pubkey == nil { + return nil, fmt.Errorf("missing participant pubkey") + } + pubkeys = append(pubkeys, participant.Pubkey) + } + + pubkeys = append(pubkeys, h.ServerKey) + + return pubkeys, nil +} + +// registerHtlcSig registers the htlc signature for the hyperloop tx and +// checks that it is valid. +func (h *HyperLoop) registerHtlcSig(chainParams *chaincfg.Params, + sig []byte) error { + + h.HtlcFullSig = sig + return h.checkHtlcSig(chainParams) +} + +// checkHtlcSig checks that the htlc signature is valid for the hyperloop tx. +func (h *HyperLoop) checkHtlcSig(chainParams *chaincfg.Params) error { + // First get the hyperloop htlc tx. + htlcTx, err := h.getHyperLoopHtlcTx(chainParams) + if err != nil { + return err + } + + return h.checkSigForTx(htlcTx, h.HtlcFullSig) +} + +// checkSigForTx checks the given signature for the given version of the +// hyperloop tx. +func (h *HyperLoop) checkSigForTx(tx *wire.MsgTx, sig []byte) error { + tx.TxIn[0].Witness = [][]byte{ + sig, + } + + pkscript, err := h.getHyperLoopScript() + if err != nil { + return err + } + + prevOutFetcher, err := h.getHyperLoopPrevOutputFetcher() + if err != nil { + return err + } + hashCache := txscript.NewTxSigHashes( + tx, prevOutFetcher, + ) + + engine, err := txscript.NewEngine( + pkscript, tx, 0, txscript.StandardVerifyFlags, + nil, hashCache, int64(h.getHyperLoopTotalAmt()), prevOutFetcher, + ) + if err != nil { + return err + } + + return engine.Execute() +} + +// get33Bytes returns the 33 byte representation of the given pubkey. +func get33Bytes(pubkey *btcec.PublicKey) ([33]byte, error) { + var key [33]byte + if pubkey == nil { + return key, fmt.Errorf("missing participant pubkey") + } + if len(pubkey.SerializeCompressed()) != 33 { + return key, fmt.Errorf("invalid participant pubkey") + } + copy(key[:], pubkey.SerializeCompressed()) + + return key, nil +} From b3224ca3669751b2097a56a2da8443b666760214 Mon Sep 17 00:00:00 2001 From: sputn1ck Date: Tue, 13 Aug 2024 12:31:21 +0200 Subject: [PATCH 04/11] hyperloop: add fsm and actions --- hyperloop/actions.go | 609 +++++++++++++++++++++++++++++++++++++++++++ hyperloop/fsm.go | 576 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 1185 insertions(+) create mode 100644 hyperloop/actions.go create mode 100644 hyperloop/fsm.go diff --git a/hyperloop/actions.go b/hyperloop/actions.go new file mode 100644 index 000000000..3d13df165 --- /dev/null +++ b/hyperloop/actions.go @@ -0,0 +1,609 @@ +package hyperloop + +import ( + "bytes" + "context" + "crypto/rand" + "errors" + "fmt" + "time" + + "github.com/btcsuite/btcd/btcec/v2" + "github.com/btcsuite/btcd/btcutil" + "github.com/btcsuite/btcd/chaincfg" + "github.com/btcsuite/btcd/wire" + "github.com/lightninglabs/lndclient" + "github.com/lightninglabs/loop/fsm" + "github.com/lightninglabs/loop/loopdb" + "github.com/lightninglabs/loop/swap" + looprpc "github.com/lightninglabs/loop/swapserverrpc" + "github.com/lightningnetwork/lnd/lnrpc" + "github.com/lightningnetwork/lnd/lntypes" + "github.com/lightningnetwork/lnd/lnwallet/chainfee" +) + +var ( + + // Define route independent max routing fees. We have currently no way + // to get a reliable estimate of the routing fees. Best we can do is + // the minimum routing fees, which is not very indicative. + maxRoutingFeeBase = btcutil.Amount(10) + + maxRoutingFeeRate = int64(20000) + + // defaultSendpaymentTimeout is the default timeout for the swap invoice. + defaultSendpaymentTimeout = time.Minute * 5 +) + +// initHyperloopContext contains the request parameters for a hyperloop. +type initHyperloopContext struct { + hyperloopID ID + swapAmt btcutil.Amount + outgoingChanSet *loopdb.ChannelSet + publishTime time.Time + sweepAddr btcutil.Address +} + +// initHyperloopAction is the action that initializes the hyperloop. +func (f *FSM) initHyperloopAction(eventCtx fsm.EventContext) fsm.EventType { + initCtx, ok := eventCtx.(*initHyperloopContext) + if !ok { + return f.HandleError(fsm.ErrInvalidContextType) + } + + // Create a new receiver key descriptor. + receiverKeyDesc, err := f.cfg.Wallet.DeriveNextKey(f.ctx, 42069) + if err != nil { + return f.HandleError(err) + } + + // Create a new swap preimage. + var swapPreimage lntypes.Preimage + if _, err := rand.Read(swapPreimage[:]); err != nil { + return f.HandleError(err) + } + + hyperloop := newHyperLoop( + initCtx.hyperloopID, initCtx.publishTime, initCtx.swapAmt, + receiverKeyDesc, swapPreimage, initCtx.sweepAddr, + ) + + // Request the hyperloop from the server. + registerRes, err := f.cfg.HyperloopClient.RegisterHyperloop( + f.ctx, &looprpc.RegisterHyperloopRequest{ + ReceiverKey: hyperloop. + KeyDesc.PubKey.SerializeCompressed(), + SwapHash: hyperloop.SwapHash[:], + Amt: int64(hyperloop.Amt), + PrivateHyperloopId: hyperloop.ID[:], + PrivateHyperloopPublishTime: hyperloop.PublishTime.Unix(), + }, + ) + if err != nil { + return f.HandleError(err) + } + + senderKey, err := btcec.ParsePubKey(registerRes.ServerKey) + if err != nil { + return f.HandleError(err) + } + + hyperloop.addInitialHyperLoopInfo( + chainfee.SatPerKWeight(registerRes.HyperloopFee), + uint32(registerRes.HyperloopExpiry), + registerRes.HtlcExpiry, + senderKey, + registerRes.Invoice, + ) + + f.hyperloop = hyperloop + + // Now that we have the hyperloop response from the server, we can + // create the hyperloop in the database. + err = f.cfg.Store.CreateHyperloop(f.ctx, hyperloop) + if err != nil { + return f.HandleError(err) + } + + return OnInit +} + +// registerHyperloopAction is the action that registers the hyperloop by +// paying the server. +func (f *FSM) registerHyperloopAction(eventCtx fsm.EventContext) fsm.EventType { + // Create a context which we can cancel if we're registered. + ctx, cancel := context.WithCancel(f.ctx) + defer cancel() + + // Poll the server to check if we're registered. + go func() { + checkFunc := func(res *looprpc.HyperloopNotificationStreamResponse) ( + bool, error) { + for _, participant := range res.Participants { + if bytes.Equal(participant.SwapHash, + f.hyperloop.SwapHash[:]) { + return true, nil + } + } + + if res.HyperloopTxid != "" { + return false, errors.New("registration failed") + } + + return false, nil + } + _, err := f.waitForState(ctx, checkFunc) + if err != nil { + f.handleAsyncError(err) + return + } + + err = f.SendEvent(OnRegistered, nil) + if err != nil { + f.handleAsyncError(err) + return + } + }() + + // Dispatch the swap payment. + paymentChan, errChan, err := f.cfg.Router.SendPayment( + f.ctx, lndclient.SendPaymentRequest{ + Invoice: f.hyperloop.SwapInvoice, + MaxFee: getMaxRoutingFee(f.hyperloop.Amt), + Timeout: defaultSendpaymentTimeout, + }, + ) + if err != nil { + return f.HandleError(err) + } + + go func() { + select { + case <-f.ctx.Done(): + return + case err := <-errChan: + f.handleAsyncError(err) + case res := <-paymentChan: + if res.State == lnrpc.Payment_FAILED { + err = f.SendEvent(OnPaymentFailed, nil) + if err != nil { + f.handleAsyncError(err) + return + } + } + } + }() + + return fsm.NoOp +} + +// waitForPublishAction is the action that waits for the hyperloop to be +// published. +func (f *FSM) waitForPublishAction(_ fsm.EventContext) fsm.EventType { + go func() { + checkFunc := func(res *looprpc.HyperloopNotificationStreamResponse) ( + bool, error) { + if res.HyperloopTxid != "" { + return true, nil + } + + return false, nil + } + res, err := f.waitForState(f.ctx, checkFunc) + if err != nil { + f.handleAsyncError(err) + } + + // If we're published, the list of participants is final. + participants, err := rpcParticipantToHyperloopParticipant( + res.Participants, f.cfg.ChainParams, + ) + if err != nil { + f.handleAsyncError(err) + return + } + f.hyperloop.registerParticipants(participants) + + err = f.SendEvent(OnPublished, nil) + if err != nil { + f.handleAsyncError(err) + return + } + }() + + return fsm.NoOp +} + +// waitForConfirmationAction is the action that waits for the hyperloop to be +// confirmed. +func (f *FSM) waitForConfirmationAction(_ fsm.EventContext) fsm.EventType { + pkScript, err := f.hyperloop.getHyperLoopScript() + if err != nil { + return f.HandleError(err) + } + + subChan, errChan, err := f.cfg.ChainNotifier.RegisterConfirmationsNtfn( + f.ctx, nil, pkScript, 2, 100, //todo height hint + ) + if err != nil { + return f.HandleError(err) + } + + go func() { + for { + select { + case <-f.ctx.Done(): + return + case err := <-errChan: + log.Errorf("Error waiting for confirmation: %v", err) + f.handleAsyncError(err) + return + case conf := <-subChan: + f.hyperloop.ConfirmationHeight = int32(conf.BlockHeight) + f.hyperloop.ConfirmedOutpoint, err = getOutpointFromTx( + conf.Tx, pkScript, + ) + if err != nil { + f.handleAsyncError(err) + } + err := f.SendEvent(OnConfirmed, nil) + if err != nil { + f.handleAsyncError(err) + return + } + } + } + }() + + return fsm.NoOp +} + +// pushHtlcNonceAction is the action that pushes the htlc nonce to the server. +func (f *FSM) pushHtlcNonceAction(_ fsm.EventContext) fsm.EventType { + err := f.hyperloop.startHtlcSession(f.ctx, f.cfg.Signer) + if err != nil { + return f.HandleError(err) + } + + res, err := f.cfg.HyperloopClient.PushHyperloopHtlcNonce( + f.ctx, &looprpc.PushHyperloopHtlcNonceRequest{ + SwapHash: f.hyperloop.SwapHash[:], + HyperloopId: f.hyperloop.ID[:], + HtlcNonce: f.hyperloop.HtlcMusig2Session.PublicNonce[:], + }, + ) + if err != nil { + return f.HandleError(err) + } + + copy(f.hyperloop.SweepServerNonce[:], res.ServerHtlcNonce) + f.hyperloop.HtlcFeeRate = chainfee.SatPerKWeight(res.HtlcFeeRate) + + return OnPushedHtlcNonce +} + +// waitForReadyForHtlcSignAction is the action that waits for the server to be +// ready for the htlc sign. +func (f *FSM) waitForReadyForHtlcSignAction(_ fsm.EventContext) fsm.EventType { + go func() { + checkFunc := func(res *looprpc.HyperloopNotificationStreamResponse) ( + bool, error) { + // If the length of htlc nonces is equal to the + // number of participants, we're ready to sign. + return len(res.Participants) == len(res.HtlcNonces), nil + } + res, err := f.waitForState(f.ctx, checkFunc) + if err != nil { + f.handleAsyncError(err) + return + } + + var nonces [][66]byte + for _, htlcNonce := range res.HtlcNonces { + htlcNonce := htlcNonce + + var nonce [66]byte + copy(nonce[:], htlcNonce) + nonces = append(nonces, nonce) + } + + err = f.hyperloop.registerHtlcNonces(f.ctx, f.cfg.Signer, nonces) + if err != nil { + f.handleAsyncError(err) + return + } + + err = f.SendEvent(OnReadyForHtlcSig, nil) + if err != nil { + f.handleAsyncError(err) + return + } + + }() + + return fsm.NoOp +} + +// pushHtlcSigAction is the action that pushes the htlc signatures to the server. +func (f *FSM) pushHtlcSigAction(_ fsm.EventContext) fsm.EventType { + htlcTx, err := f.hyperloop.getHyperLoopHtlcTx(f.cfg.ChainParams) + if err != nil { + return f.HandleError(err) + } + + sig, err := f.hyperloop.getSigForTx( + f.ctx, f.cfg.Signer, htlcTx, f.hyperloop.HtlcMusig2Session.SessionID, + ) + if err != nil { + return f.HandleError(err) + } + + _, err = f.cfg.HyperloopClient.PushHyperloopHtlcSig( + f.ctx, &looprpc.PushHyperloopHtlcSigRequest{ + SwapHash: f.hyperloop.SwapHash[:], + HyperloopId: f.hyperloop.ID[:], + HtlcSig: sig, + }, + ) + if err != nil { + return f.HandleError(err) + } + + return OnPushedHtlcSig +} + +// waitForHtlcSig is the action where we poll the server for the htlc signature. +func (f *FSM) waitForHtlcSig(_ fsm.EventContext) fsm.EventType { + go func() { + checkFunc := func(res *looprpc.HyperloopNotificationStreamResponse) ( + bool, error) { + return res.FinalHtlcSig != nil, nil + } + res, err := f.waitForState(f.ctx, checkFunc) + if err != nil { + f.handleAsyncError(err) + return + } + + // Try to register the htlc sig, this will verify the sig is valid. + err = f.hyperloop.registerHtlcSig(f.cfg.ChainParams, res.FinalHtlcSig) + if err != nil { + f.handleAsyncError(fmt.Errorf("invalid htlc sig: %v", err)) + } + err = f.SendEvent(OnReceivedHtlcSig, nil) + if err != nil { + f.handleAsyncError(err) + return + } + }() + + return fsm.NoOp +} + +// pushPreimageAction is the action that pushes the preimage to the server. +func (f *FSM) pushPreimageAction(_ fsm.EventContext) fsm.EventType { + // Start the sweep session. + err := f.hyperloop.startSweeplessSession(f.ctx, f.cfg.Signer) + if err != nil { + return f.HandleError(err) + } + + res, err := f.cfg.HyperloopClient.PushHyperloopPreimage( + f.ctx, &looprpc.PushHyperloopPreimageRequest{ + HyperloopId: f.hyperloop.ID[:], + Preimage: f.hyperloop.SwapPreimage[:], + SweepNonce: f.hyperloop.SweeplessSweepMusig2Session.PublicNonce[:], + }, + ) + if err != nil { + return f.HandleError(err) + } + + copy(f.hyperloop.SweepServerNonce[:], res.ServerSweepNonce) + f.hyperloop.SweeplessSweepFeeRate = chainfee.SatPerKWeight(res.SweepFeeRate) + + return OnPushedPreimage +} + +// waitForReadyForSweepAction is the action that waits for the server to be +// ready for the sweep. +func (f *FSM) waitForReadyForSweepAction(_ fsm.EventContext) fsm.EventType { + go func() { + checkFunc := func(res *looprpc.HyperloopNotificationStreamResponse) ( + bool, error) { + return len(res.Participants) == len(res.SweeplessSweepNonces), nil + } + res, err := f.waitForState(f.ctx, checkFunc) + if err != nil { + f.handleAsyncError(err) + return + } + + var nonces [][66]byte + for _, sweepNonce := range res.SweeplessSweepNonces { + sweepNonce := sweepNonce + + var nonce [66]byte + copy(nonce[:], sweepNonce) + nonces = append(nonces, nonce) + } + + err = f.hyperloop.registerSweeplessSweepNonces(f.ctx, f.cfg.Signer, nonces) + if err != nil { + f.handleAsyncError(err) + return + } + + err = f.SendEvent(OnReadyForSweeplessSweepSig, nil) + if err != nil { + f.handleAsyncError(err) + return + } + + }() + + return fsm.NoOp +} + +func (f *FSM) pushSweepSigAction(_ fsm.EventContext) fsm.EventType { + sweepTx, err := f.hyperloop.getHyperLoopSweeplessSweepTx() + if err != nil { + return f.HandleError(err) + } + + sig, err := f.hyperloop.getSigForTx( + f.ctx, f.cfg.Signer, sweepTx, + f.hyperloop.SweeplessSweepMusig2Session.SessionID, + ) + if err != nil { + return f.HandleError(err) + } + + _, err = f.cfg.HyperloopClient.PushHyperloopSweeplessSweepSig( + f.ctx, &looprpc.PushHyperloopSweeplessSweepSigRequest{ + HyperloopId: f.hyperloop.ID[:], + SwapHash: f.hyperloop.SwapHash[:], + SweepSig: sig, + }, + ) + if err != nil { + return f.HandleError(err) + } + + return OnPushedSweeplessSweepSig +} + +// waitForSweeplessSweepConfirmationAction is the action that waits for the +// sweepless sweep to be confirmed. +func (f *FSM) waitForSweeplessSweepConfirmationAction(_ fsm.EventContext, +) fsm.EventType { + + sweeplessSweepTx, err := f.hyperloop.getHyperLoopSweeplessSweepTx() + if err != nil { + return f.HandleError(err) + } + + sweeplessSweepTxHash := sweeplessSweepTx.TxHash() + + confChan, errChan, err := f.cfg.ChainNotifier.RegisterConfirmationsNtfn( + f.ctx, &sweeplessSweepTxHash, nil, 2, f.hyperloop.ConfirmationHeight, + ) + if err != nil { + return f.HandleError(err) + } + + go func() { + for { + select { + case <-f.ctx.Done(): + return + case err := <-errChan: + log.Errorf("Error waiting for confirmation: %v", err) + f.handleAsyncError(err) + return + case <-confChan: + err := f.SendEvent(OnSweeplessSweepConfirmed, nil) + if err != nil { + f.handleAsyncError(err) + return + } + } + } + }() + + return fsm.NoOp +} + +// waitForState polls the server for the hyperloop status until the +// status matches the expected status. Once the status matches, it returns the +// response. +func (f *FSM) waitForState(ctx context.Context, + checkFunc func(*looprpc.HyperloopNotificationStreamResponse) (bool, error), +) (*looprpc.HyperloopNotificationStreamResponse, error) { + + // Create a context which we can cancel if we're published. + ctx, cancel := context.WithCancel(f.ctx) + defer cancel() + + for { + select { + case <-ctx.Done(): + return nil, errors.New("context canceled") + case <-time.After(time.Second * 5): + if f.lastNotification == nil { + continue + } + + status, err := checkFunc(f.lastNotification) + if err != nil { + return nil, err + } + if status { + return f.lastNotification, nil + } + } + } +} + +// handleAsyncError is a helper method that logs an error and sends an error +// event to the FSM +func (f *FSM) handleAsyncError(err error) { + f.LastActionError = err + f.Errorf("Error on async action: %v", err) + err2 := f.SendEvent(fsm.OnError, err) + if err2 != nil { + f.Errorf("Error sending event: %v", err2) + } +} + +// getMaxRoutingFee returns the maximum routing fee for a given amount. +func getMaxRoutingFee(amt btcutil.Amount) btcutil.Amount { + return swap.CalcFee(amt, maxRoutingFeeBase, maxRoutingFeeRate) +} + +// getOutpointFromTx returns the outpoint of the pkScript in the tx. +func getOutpointFromTx(tx *wire.MsgTx, pkScript []byte) (*wire.OutPoint, + error) { + + for i, txOut := range tx.TxOut { + if bytes.Equal(pkScript, txOut.PkScript) { + txHash := tx.TxHash() + return wire.NewOutPoint(&txHash, uint32(i)), nil + } + } + return nil, errors.New("pk script not found in tx") +} + +// rpcParticipantToHyperloopParticipant converts a slice of rpc participants to +// to a slice of hyperloop participants. +func rpcParticipantToHyperloopParticipant(rpcParticipant []*looprpc. + HyperLoopParticipant, params *chaincfg.Params) ([]*HyperLoopParticipant, error) { + + participants := make([]*HyperLoopParticipant, 0, len(rpcParticipant)) + for _, p := range rpcParticipant { + p := p + pubkey, err := btcec.ParsePubKey(p.ParticipantKey) + if err != nil { + return nil, err + } + + swapHash, err := lntypes.MakeHash(p.SwapHash) + if err != nil { + return nil, err + } + + sweepAddr, err := btcutil.DecodeAddress(p.SweepAddr, params) + if err != nil { + return nil, err + } + + participants = append(participants, &HyperLoopParticipant{ + SwapHash: swapHash, + Amt: btcutil.Amount(p.Amt), + Pubkey: pubkey, + SweepAddress: sweepAddr, + }) + } + + return participants, nil +} diff --git a/hyperloop/fsm.go b/hyperloop/fsm.go new file mode 100644 index 000000000..56675fff7 --- /dev/null +++ b/hyperloop/fsm.go @@ -0,0 +1,576 @@ +package hyperloop + +import ( + "bytes" + "context" + "errors" + "sync" + "time" + + "github.com/btcsuite/btcd/chaincfg" + "github.com/lightninglabs/lndclient" + "github.com/lightninglabs/loop/fsm" + "github.com/lightninglabs/loop/swapserverrpc" + "github.com/lightningnetwork/lnd/chainntnfs" +) + +// States represents the possible states of the hyperloop FSM. +var ( + // Init is the initial state of the hyperloop FSM. + Init = fsm.StateType("Init") + + // Registering is the state where we try to pay the hyperloop invoice. + Registering = fsm.StateType("Registering") + + // WaitForPublish is the state where we wait for the hyperloop output to be + // published. + WaitForPublish = fsm.StateType("WaitForPublish") + + // WaitForConfirmation is the state where we wait for the hyperloop output + // to be confirmed. + WaitForConfirmation = fsm.StateType("WaitForConfirmation") + + // PushHtlcNonce is the state where we push the htlc nonce to the server. + PushHtlcNonce = fsm.StateType("PushHtlcNonce") + + // WaitForReadyForHtlcSig is the event that is triggered when the server + // is ready to receive the htlc sig. + WaitForReadyForHtlcSig = fsm.StateType("WaitForReadyForHtlcSig") + + // PushHtlcSig is the state where we push the htlc sig to the server. + PushHtlcSig = fsm.StateType("PushHtlcSig") + + // WaitForHtlcSig is the state where we wait for the final htlc sig. + WaitForHtlcSig = fsm.StateType("WaitForHtlcSig") + + // PushPreimage is the state where we push the preimage and sweepless sweep + // nonce to the server. + PushPreimage = fsm.StateType("PushPreimage") + + // WaitForReadyForSweeplessSweepSig is the event that is triggered when the + // server is ready to receive the sweepless sweep sig. + WaitForReadyForSweeplessSweepSig = fsm.StateType("WaitForReadyForSweeplessSweepSig") + + // PushSweeplessSweepSig is the state where we push the sweepless sweep sig + // to the server. + PushSweeplessSweepSig = fsm.StateType("PushSweeplessSweepSig") + + // WaitForSweepPublish is the state where we wait for the sweep transaction + // to be published. + WaitForSweepPublish = fsm.StateType("PubslishSweep") + + // WaitForSweepConfirmation is the state where we wait for the sweep + // transaction to be confirmed. + WaitForSweepConfirmation = fsm.StateType("WaitForSweepConfirmation") + + // SweepConfirmed is a final state where the sweep transaction has been + // confirmed. + SweepConfirmed = fsm.StateType("SweepConfirmed") + + // PublishHtlc is the state where we publish the htlc transaction. + PublishHtlc = fsm.StateType("PublishHtlc") + + // WaitForHtlcConfirmation is the state where we wait for the htlc + // transaction to be confirmed. + WaitForHtlcConfirmation = fsm.StateType("WaitForHtlcConfirmation") + + // HtlcConfirmed is the state where the htlc transaction has been confirmed. + HtlcConfirmed = fsm.StateType("HtlcConfirmed") + + // PublishHtlcSweep is the state where we publish the htlc sweep + // transaction. + PublishHtlcSweep = fsm.StateType("PublishHtlcSweep") + + // WaitForHtlcSweepConfirmation is the state where we wait for the htlc + // sweep transaction to be confirmed. + WaitForHtlcSweepConfirmation = fsm.StateType("WaitForHtlcSweepConfirmation") + + // HtlcSweepConfirmed is the state where the htlc sweep transaction has been + // confirmed. + HtlcSweepConfirmed = fsm.StateType("HtlcSweepConfirmed") + + // Failed is a final state where the hyperloop has failed. + Failed = fsm.StateType("Failed") +) + +// Events +var ( + // OnStart is the event that is sent when the hyperloop FSM is started. + OnStart = fsm.EventType("OnStart") + + // OnInit is the event is sent when the FSM is initialized. + OnInit = fsm.EventType("OnInit") + + // OnRegistered is the event that is triggered when we have been registered + // with the server. + OnRegistered = fsm.EventType("OnRegistered") + + // OnPublished is the event that is triggered when the hyperloop output has + // been published. + OnPublished = fsm.EventType("OnPublished") + + // OnConfirmed is the event that is triggered when the hyperloop output has + // been confirmed. + OnConfirmed = fsm.EventType("OnConfirmed") + + // OnPushedHtlcNonce is the event that is triggered when the htlc nonce has + // been pushed to the server. + OnPushedHtlcNonce = fsm.EventType("OnPushedHtlcNonce") + + // OnReadyForHtlcSig is the event that is triggered when the server is ready + // to receive the htlc sig. + OnReadyForHtlcSig = fsm.EventType("OnReadyForHtlcSig") + + // OnPushedHtlcSig is the event that is sent when the htlc sig has been + // pushed to the server. + OnPushedHtlcSig = fsm.EventType("OnPushedHtlcSig") + + // OnReceivedHtlcSig is the event that is sent when the htlc sig has been + // received. + OnReceivedHtlcSig = fsm.EventType("OnReceivedHtlcSig") + + // OnPushedPreimage is the event that is sent when the preimage has been + // pushed to the server. + OnPushedPreimage = fsm.EventType("OnPushedPreimage") + + // OnReadyForSweeplessSweepSig is the event that is sent when the server is + // ready to receive the sweepless sweep sig. + OnReadyForSweeplessSweepSig = fsm.EventType("OnReadyForSweeplessSweepSig") + + // OnPushedSweeplessSweepSig is the event that is sent when the sweepless + // sweep sig has been pushed to the server. + OnPushedSweeplessSweepSig = fsm.EventType("OnPushedSweeplessSweepSig") + + // OnSweeplessSweepPublish is the event that is sent when the sweepless + // sweep transaction has been published. + OnSweeplessSweepPublish = fsm.EventType("OnSweeplessSweepPublish") + + // OnSweeplessSweepConfirmed is the event that is sent when the sweepless + // sweep transaction has been confirmed. + OnSweeplessSweepConfirmed = fsm.EventType("OnSweeplessSweepConfirmed") + + // OnPublishHtlc is the event that is sent when we should publish the htlc + // transaction. + OnPublishHtlc = fsm.EventType("OnPublishHtlc") + + // OnHtlcPublished is the event that is sent when the htlc transaction has + // been published. + OnHtlcPublished = fsm.EventType("OnHtlcPublished") + + // OnHtlcConfirmed is the event that is sent when the htlc transaction has + // been confirmed. + OnHtlcConfirmed = fsm.EventType("OnHtlcConfirmed") + + // OnSweepHtlc is the event that is sent when we publish the htlc sweep + // transaction. + OnSweepHtlc = fsm.EventType("OnSweepHtlc") + + // OnSweepPublished is the event that is sent when the sweep transaction has + // been published. + OnSweepPublished = fsm.EventType("OnSweepPublished") + + // OnHtlcSweepConfirmed is the event that is sent when the htlc sweep + // transaction has been confirmed. + OnHtlcSweepConfirmed = fsm.EventType("OnHtlcSweepConfirmed") + + // OnHyperlppSpent is the event that is sent when the hyperloop output has + // been spent. + OnHyperloopSpent = fsm.EventType("OnHyperloopSpent") + + // OnPaymentFailed is the event that is sent when the payment has failed. + OnPaymentFailed = fsm.EventType("OnPaymentFailed") +) + +// FSMConfig contains the services required for the hyperloop FSM. +type FSMConfig struct { + // Store is used to store the hyperloop. + Store Store + + // LndClient is used to interact with the lnd node. + LndClient lndclient.LightningClient + + // Signer is used to sign transactions. + Signer lndclient.SignerClient + + // Wallet is used to derive keys. + Wallet lndclient.WalletKitClient + + // ChainNotifier is used to listen for chain events. + ChainNotifier lndclient.ChainNotifierClient + + // RouterClient is used to dispatch and track payments. + RouterClient lndclient.RouterClient + + // Network is the network that is used for the swap. + Network *chaincfg.Params +} + +// FSM is the state machine that manages the hyperloop process. +type FSM struct { + *fsm.StateMachine + + ctx context.Context + + cfg *Config + + // hyperloop contains all the data required for the hyperloop process. + hyperloop *HyperLoop + + // spendSubOnce is used to ensure that we only subscribe to the spend + // notification once. + spendSubOnce *sync.Once + + // isConnectedToNotificationStream is true if we are connected to the + // notification stream. + isConnectedToNotificationStream bool + + // isConnectedMutex is used to ensure that we safely access the + // isConnectedToNotificationStream variable. + isConnectedMutex sync.Mutex + + // lastNotification is the last notification that we received. + lastNotification *swapserverrpc.HyperloopNotificationStreamResponse +} + +// NewFSM creates a new instant out FSM. +func NewFSM(ctx context.Context, cfg *Config) (*FSM, error) { + + hyperloop := &HyperLoop{ + State: fsm.EmptyState, + } + + return NewFSMFromHyperloop(ctx, cfg, hyperloop) +} + +// NewFSMFromHyperloop creates a new instantout FSM from an existing instantout +// recovered from the database. +func NewFSMFromHyperloop(ctx context.Context, cfg *Config, + hyperloop *HyperLoop) (*FSM, error) { + + instantOutFSM := &FSM{ + ctx: ctx, + cfg: cfg, + hyperloop: hyperloop, + spendSubOnce: new(sync.Once), + } + + instantOutFSM.ActionEntryFunc = instantOutFSM.updateHyperloop + + return instantOutFSM, nil +} + +// GetHyperloopStates returns the statemap that defines the hyperloop FSM. +func (f *FSM) GetStateMap() fsm.States { + return fsm.States{ + fsm.EmptyState: fsm.State{ + Transitions: fsm.Transitions{ + OnStart: Init, + }, + Action: nil, + }, + Init: fsm.State{ + Transitions: fsm.Transitions{ + OnInit: Registering, + fsm.OnError: Failed, + }, + Action: f.initHyperloopAction, + }, + Registering: fsm.State{ + Transitions: fsm.Transitions{ + OnRegistered: WaitForPublish, + fsm.OnError: Failed, + }, + Action: f.registerHyperloopAction, + }, + WaitForPublish: fsm.State{ + Transitions: fsm.Transitions{ + OnPublished: WaitForConfirmation, + fsm.OnError: Failed, + }, + Action: f.waitForPublishAction, + }, + WaitForConfirmation: fsm.State{ + Transitions: fsm.Transitions{ + OnConfirmed: PushHtlcNonce, + fsm.OnError: Failed, + }, + Action: f.waitForConfirmationAction, + }, + PushHtlcNonce: fsm.State{ + Transitions: fsm.Transitions{ + OnPushedHtlcNonce: WaitForReadyForHtlcSig, + fsm.OnError: Failed, + }, + Action: f.pushHtlcNonceAction, + }, + WaitForReadyForHtlcSig: fsm.State{ + Transitions: fsm.Transitions{ + OnReadyForHtlcSig: PushHtlcSig, + fsm.OnError: Failed, + }, + Action: f.waitForReadyForHtlcSignAction, + }, + PushHtlcSig: fsm.State{ + Transitions: fsm.Transitions{ + OnPushedHtlcSig: WaitForHtlcSig, + fsm.OnError: Failed, + }, + Action: f.pushHtlcSigAction, + }, + WaitForHtlcSig: fsm.State{ + Transitions: fsm.Transitions{ + OnReceivedHtlcSig: PushPreimage, + fsm.OnError: Failed, + }, + Action: f.waitForHtlcSig, + }, + PushPreimage: fsm.State{ + Transitions: fsm.Transitions{ + OnPushedPreimage: WaitForReadyForSweeplessSweepSig, + fsm.OnError: Failed, + }, + Action: f.pushPreimageAction, + }, + WaitForReadyForSweeplessSweepSig: fsm.State{ + Transitions: fsm.Transitions{ + OnReadyForSweeplessSweepSig: PushSweeplessSweepSig, + fsm.OnError: Failed, + }, + Action: f.waitForReadyForSweepAction, + }, + PushSweeplessSweepSig: fsm.State{ + Transitions: fsm.Transitions{ + OnPushedSweeplessSweepSig: WaitForSweepPublish, + fsm.OnError: Failed, + }, + Action: f.pushSweepSigAction, + }, + WaitForSweepPublish: fsm.State{ + Transitions: fsm.Transitions{ + OnSweeplessSweepPublish: WaitForSweepConfirmation, + fsm.OnError: Failed, + }, + Action: fsm.NoOpAction, + }, + WaitForSweepConfirmation: fsm.State{ + Transitions: fsm.Transitions{ + OnSweeplessSweepConfirmed: SweepConfirmed, + fsm.OnError: Failed, + }, + Action: f.waitForSweeplessSweepConfirmationAction, + }, + SweepConfirmed: fsm.State{ + Action: fsm.NoOpAction, + }, + // todo htlc states + Failed: fsm.State{ + Action: fsm.NoOpAction, + }, + } +} + +// updateHyperloop updates the hyperloop in the database. This function +// is called after every new state transition. +func (r *FSM) updateHyperloop(notification fsm.Notification) { + if r.hyperloop == nil { + return + } + + r.Debugf( + "NextState: %v, PreviousState: %v, Event: %v", + notification.NextState, notification.PreviousState, + notification.Event, + ) + + r.hyperloop.State = notification.NextState + + // Don't update the reservation if we are in an initial state or if we + // are transitioning from an initial state to a failed state. + if r.hyperloop.State == fsm.EmptyState || + r.hyperloop.State == Init || + (notification.PreviousState == Init && + r.hyperloop.State == Failed) { + + return + } + + // Subscribe to the hyperloop notifications. + r.subscribeHyperloopNotifications() + + // Subscribe to the spend notification of the current outpoint. + err := r.subscribeHyperloopOutpointSpend() + if err != nil { + r.Errorf("unable to subscribe to spend notification: %v", err) + } + + err = r.cfg.Store.UpdateHyperloop(r.ctx, r.hyperloop) + if err != nil { + r.Errorf("unable to update hyperloop: %v", err) + } +} + +func (f *FSM) subscribeHyperloopOutpointSpend() error { + if isFinalState(f.hyperloop.State) { + return nil + } + // If we don't have an outpoint yet, we can't subscribe to it. + if f.hyperloop.ConfirmedOutpoint == nil { + return nil + } + + // We only want to subscribe once, so we use a sync.Once to ensure that. + f.spendSubOnce.Do(func() { + spendChan, errChan, err := f.cfg.ChainNotifier.RegisterSpendNtfn( + f.ctx, f.hyperloop.ConfirmedOutpoint, nil, + f.hyperloop.ConfirmationHeight, + ) + if err != nil { + f.Errorf("unable to subscribe to spend notification: %v", err) + return + } + + go func() { + select { + case spend := <-spendChan: + spendEvent := f.getHyperloopSpendingEvent(spend) + err := f.SendEvent(spendEvent, nil) + if err != nil { + log.Errorf("error sending event: %v", err) + f.handleAsyncError(err) + } + case err := <-errChan: + log.Errorf("error in spend subscription: %v", err) + f.handleAsyncError(err) + } + }() + }) + + return nil +} + +func (f *FSM) subscribeHyperloopNotifications() error { + f.isConnectedMutex.Lock() + defer f.isConnectedMutex.Unlock() + if f.isConnectedToNotificationStream { + return nil + } + + ctx, cancel := context.WithCancel(f.ctx) + + // Subscribe to the notification stream. + client, err := f.cfg.HyperloopClient.HyperloopNotificationStream( + ctx, &swapserverrpc.HyperloopNotificationStreamRequest{ + HyperloopId: f.hyperloop.ID[:], + }, + ) + if err != nil { + f.Errorf("unable to subscribe to hyperloop notifications: %v", err) + return err + } + f.Debugf("subscribed to hyperloop notifications") + + f.isConnectedToNotificationStream = true + go func() { + for { + notification, err := client.Recv() + if err == nil && notification != nil { + f.lastNotification = notification + continue + } + f.Errorf("error receiving hyperloop notification: %v", err) + cancel() + f.isConnectedMutex.Lock() + f.isConnectedToNotificationStream = false + f.isConnectedMutex.Unlock() + + // If we encounter an error, we'll try to reconnect. + for { + select { + case <-f.ctx.Done(): + return + + case <-time.After(time.Second * 10): + f.Debugf("reconnecting to hyperloop notifications") + err = f.subscribeHyperloopNotifications() + if err != nil { + f.Errorf("error reconnecting: %v", err) + continue + } + return + } + } + } + }() + + return nil +} + +// getHyperloopSpendingEvent returns the event that should be triggered when the +// hyperloop output is spent. It returns an error if the spending transaction is +// unexpected. +func (f *FSM) getHyperloopSpendingEvent(spendDetails *chainntnfs.SpendDetail, +) fsm.EventType { + + spendingTxHash := spendDetails.SpendingTx.TxHash() + + htlcTx, err := f.hyperloop.getHyperLoopHtlcTx(f.cfg.ChainParams) + if err != nil { + return f.HandleError(err) + } + htlcTxHash := htlcTx.TxHash() + + if bytes.Equal(spendingTxHash[:], htlcTxHash[:]) { + return OnHtlcPublished + } + + sweeplessSweepTx, err := f.hyperloop.getHyperLoopSweeplessSweepTx() + if err != nil { + return f.HandleError(err) + } + + sweeplessSweepTxHash := sweeplessSweepTx.TxHash() + + if bytes.Equal(spendingTxHash[:], sweeplessSweepTxHash[:]) { + return OnSweeplessSweepPublish + } + + return f.HandleError(errors.New("unexpected tx spent")) +} + +// Infof logs an info message with the reservation hash as prefix. +func (f *FSM) Infof(format string, args ...interface{}) { + log.Infof( + "Hyperloop %v: "+format, + append( + []interface{}{f.hyperloop.ID}, + args..., + )..., + ) +} + +// Debugf logs a debug message with the reservation hash as prefix. +func (f *FSM) Debugf(format string, args ...interface{}) { + log.Debugf( + "Hyperloop %v: "+format, + append( + []interface{}{f.hyperloop.ID}, + args..., + )..., + ) +} + +// Errorf logs an error message with the reservation hash as prefix. +func (f *FSM) Errorf(format string, args ...interface{}) { + log.Errorf( + "Hyperloop %v: "+format, + append( + []interface{}{f.hyperloop.ID}, + args..., + )..., + ) +} + +// isFinalState returns true if the FSM is in a final state. +func isFinalState(state fsm.StateType) bool { + return state == SweepConfirmed || state == Failed +} From cb39b5dd208f49e92310498086b92146d0e8a729 Mon Sep 17 00:00:00 2001 From: sputn1ck Date: Tue, 13 Aug 2024 12:31:35 +0200 Subject: [PATCH 05/11] hyperloop: add hyperloop manager --- hyperloop/manager.go | 161 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 161 insertions(+) create mode 100644 hyperloop/manager.go diff --git a/hyperloop/manager.go b/hyperloop/manager.go new file mode 100644 index 000000000..c11fcf664 --- /dev/null +++ b/hyperloop/manager.go @@ -0,0 +1,161 @@ +package hyperloop + +import ( + "context" + "sync" + "time" + + "github.com/btcsuite/btcd/btcutil" + "github.com/btcsuite/btcd/chaincfg" + "github.com/lightninglabs/lndclient" + "github.com/lightninglabs/loop/fsm" + looprpc "github.com/lightninglabs/loop/swapserverrpc" + "github.com/lightningnetwork/lnd/lnrpc/walletrpc" + "github.com/lightningnetwork/lnd/lntypes" +) + +var ( + // defaultFSMObserverTimeout is the default timeout we'll wait for the fsm + // to reach a certain state. + defaultFSMObserverTimeout = time.Second * 15 +) + +// Config contains all the services that the reservation FSM needs to operate. +type Config struct { + + // Store is the store that is used to store the hyperloop. + Store Store + + // Wallet handles the key derivation for the reservation. + Wallet lndclient.WalletKitClient + + // ChainNotifier is used to subscribe to block notifications. + ChainNotifier lndclient.ChainNotifierClient + + // Signer is used to sign messages. + Signer lndclient.SignerClient + + // Router is used to pay the offchain payments. + Router lndclient.RouterClient + + // HyperloopClient is the client used to communicate with the + // swap server. + HyperloopClient looprpc.HyperloopServerClient + + // ChainParams are the params for the bitcoin network. + ChainParams *chaincfg.Params +} + +type Manager struct { + cfg *Config + runCtx context.Context + + activePendingHyperloop *HyperLoop + pendingHyperloops map[lntypes.Hash]*HyperLoop + + sync.Mutex +} + +// NewManager creates a new hyperloop manager. +func NewManager(cfg *Config) *Manager { + return &Manager{ + cfg: cfg, + pendingHyperloops: make(map[lntypes.Hash]*HyperLoop), + } +} + +// Run starts the hyperloop manager. +func (m *Manager) Run(ctx context.Context) error { + runCtx, cancel := context.WithCancel(ctx) + defer cancel() + + m.runCtx = runCtx + + for { + select { + case <-runCtx.Done(): + return nil + } + } +} + +// NewHyperLoopOut creates a new hyperloop out swap. If we have a pending +// hyperloop, we'll use the same id and sweep address in order to batch +// a possible sweep. +func (m *Manager) NewHyperLoopOut(ctx context.Context, amt btcutil.Amount, + customSweepAddr string) (*HyperLoop, error) { + + var ( + hyperloopID ID + sweepAddr btcutil.Address + publishDeadline time.Time + err error + ) + + // As we're only doing private hyperloops for now, we'll create an id. + if m.activePendingHyperloop == nil { + hyperloopID, err = NewHyperLoopId() + if err != nil { + return nil, err + } + + publishDeadline = time.Now().Add(time.Minute * 30) + + // Create a sweep pk script. + if customSweepAddr == "" { + sweepAddr, err = m.cfg.Wallet.NextAddr( + ctx, "", walletrpc.AddressType_TAPROOT_PUBKEY, false, + ) + if err != nil { + return nil, err + } + } else { + sweepAddr, err = btcutil.DecodeAddress(customSweepAddr, nil) + if err != nil { + return nil, err + } + } + } else { + hyperloopID = m.activePendingHyperloop.ID + publishDeadline = m.activePendingHyperloop.PublishTime + + if customSweepAddr == "" { + sweepAddr = m.activePendingHyperloop.SweepAddr + } else { + addr, err := btcutil.DecodeAddress(customSweepAddr, nil) + if err != nil { + return nil, err + } + + sweepAddr = addr + } + } + + req := &initHyperloopContext{ + hyperloopID: hyperloopID, + swapAmt: amt, + sweepAddr: sweepAddr, + publishTime: publishDeadline, + } + + // Create a new hyperloop fsm. + hl, err := NewFSM(m.runCtx, m.cfg) + if err != nil { + return nil, err + } + + err = hl.SendEvent(OnInit, req) + if err != nil { + return nil, err + } + + err = hl.DefaultObserver.WaitForState( + ctx, defaultFSMObserverTimeout, WaitForPublish, + fsm.WithAbortEarlyOnErrorOption(), + ) + if err != nil { + return nil, err + } + + return hl.hyperloop, nil +} From 9330b4786e9b4284b43e5788cb6fca8a8d07ad6c Mon Sep 17 00:00:00 2001 From: sputn1ck Date: Tue, 13 Aug 2024 12:32:09 +0200 Subject: [PATCH 06/11] swapserverrpc: add hyperloop service --- swapserverrpc/hyperloop.pb.go | 1285 ++++++++++++++++++++++++++++ swapserverrpc/hyperloop.proto | 103 +++ swapserverrpc/hyperloop_grpc.pb.go | 309 +++++++ 3 files changed, 1697 insertions(+) create mode 100644 swapserverrpc/hyperloop.pb.go create mode 100644 swapserverrpc/hyperloop.proto create mode 100644 swapserverrpc/hyperloop_grpc.pb.go diff --git a/swapserverrpc/hyperloop.pb.go b/swapserverrpc/hyperloop.pb.go new file mode 100644 index 000000000..f745bbf3e --- /dev/null +++ b/swapserverrpc/hyperloop.pb.go @@ -0,0 +1,1285 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.30.0 +// protoc v3.21.12 +// source: hyperloop.proto + +// We can't change this to swapserverrpc, it would be a breaking change because +// the package name is also contained in the HTTP URIs and old clients would +// call the wrong endpoints. Luckily with the go_package option we can have +// different golang and RPC package names to fix protobuf namespace conflicts. + +package swapserverrpc + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type HyperloopNotificationStreamRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + HyperloopId []byte `protobuf:"bytes,1,opt,name=hyperloop_id,json=hyperloopId,proto3" json:"hyperloop_id,omitempty"` +} + +func (x *HyperloopNotificationStreamRequest) Reset() { + *x = HyperloopNotificationStreamRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_hyperloop_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *HyperloopNotificationStreamRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*HyperloopNotificationStreamRequest) ProtoMessage() {} + +func (x *HyperloopNotificationStreamRequest) ProtoReflect() protoreflect.Message { + mi := &file_hyperloop_proto_msgTypes[0] + 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 HyperloopNotificationStreamRequest.ProtoReflect.Descriptor instead. +func (*HyperloopNotificationStreamRequest) Descriptor() ([]byte, []int) { + return file_hyperloop_proto_rawDescGZIP(), []int{0} +} + +func (x *HyperloopNotificationStreamRequest) GetHyperloopId() []byte { + if x != nil { + return x.HyperloopId + } + return nil +} + +type HyperloopNotificationStreamResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Participants []*HyperLoopParticipant `protobuf:"bytes,1,rep,name=participants,proto3" json:"participants,omitempty"` + HyperloopTxid string `protobuf:"bytes,2,opt,name=hyperloop_txid,json=hyperloopTxid,proto3" json:"hyperloop_txid,omitempty"` + HtlcNonces [][]byte `protobuf:"bytes,3,rep,name=htlc_nonces,json=htlcNonces,proto3" json:"htlc_nonces,omitempty"` + FinalHtlcSig []byte `protobuf:"bytes,4,opt,name=final_htlc_sig,json=finalHtlcSig,proto3" json:"final_htlc_sig,omitempty"` + SweeplessSweepNonces [][]byte `protobuf:"bytes,5,rep,name=sweepless_sweep_nonces,json=sweeplessSweepNonces,proto3" json:"sweepless_sweep_nonces,omitempty"` +} + +func (x *HyperloopNotificationStreamResponse) Reset() { + *x = HyperloopNotificationStreamResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_hyperloop_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *HyperloopNotificationStreamResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*HyperloopNotificationStreamResponse) ProtoMessage() {} + +func (x *HyperloopNotificationStreamResponse) ProtoReflect() protoreflect.Message { + mi := &file_hyperloop_proto_msgTypes[1] + 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 HyperloopNotificationStreamResponse.ProtoReflect.Descriptor instead. +func (*HyperloopNotificationStreamResponse) Descriptor() ([]byte, []int) { + return file_hyperloop_proto_rawDescGZIP(), []int{1} +} + +func (x *HyperloopNotificationStreamResponse) GetParticipants() []*HyperLoopParticipant { + if x != nil { + return x.Participants + } + return nil +} + +func (x *HyperloopNotificationStreamResponse) GetHyperloopTxid() string { + if x != nil { + return x.HyperloopTxid + } + return "" +} + +func (x *HyperloopNotificationStreamResponse) GetHtlcNonces() [][]byte { + if x != nil { + return x.HtlcNonces + } + return nil +} + +func (x *HyperloopNotificationStreamResponse) GetFinalHtlcSig() []byte { + if x != nil { + return x.FinalHtlcSig + } + return nil +} + +func (x *HyperloopNotificationStreamResponse) GetSweeplessSweepNonces() [][]byte { + if x != nil { + return x.SweeplessSweepNonces + } + return nil +} + +type HyperloopReadyForSig struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *HyperloopReadyForSig) Reset() { + *x = HyperloopReadyForSig{} + if protoimpl.UnsafeEnabled { + mi := &file_hyperloop_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *HyperloopReadyForSig) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*HyperloopReadyForSig) ProtoMessage() {} + +func (x *HyperloopReadyForSig) ProtoReflect() protoreflect.Message { + mi := &file_hyperloop_proto_msgTypes[2] + 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 HyperloopReadyForSig.ProtoReflect.Descriptor instead. +func (*HyperloopReadyForSig) Descriptor() ([]byte, []int) { + return file_hyperloop_proto_rawDescGZIP(), []int{2} +} + +type HyperLoopParticipant struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ParticipantKey []byte `protobuf:"bytes,1,opt,name=participant_key,json=participantKey,proto3" json:"participant_key,omitempty"` + SwapHash []byte `protobuf:"bytes,2,opt,name=swap_hash,json=swapHash,proto3" json:"swap_hash,omitempty"` + Amt int64 `protobuf:"varint,3,opt,name=amt,proto3" json:"amt,omitempty"` + SweepAddr string `protobuf:"bytes,4,opt,name=sweep_addr,json=sweepAddr,proto3" json:"sweep_addr,omitempty"` +} + +func (x *HyperLoopParticipant) Reset() { + *x = HyperLoopParticipant{} + if protoimpl.UnsafeEnabled { + mi := &file_hyperloop_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *HyperLoopParticipant) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*HyperLoopParticipant) ProtoMessage() {} + +func (x *HyperLoopParticipant) ProtoReflect() protoreflect.Message { + mi := &file_hyperloop_proto_msgTypes[3] + 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 HyperLoopParticipant.ProtoReflect.Descriptor instead. +func (*HyperLoopParticipant) Descriptor() ([]byte, []int) { + return file_hyperloop_proto_rawDescGZIP(), []int{3} +} + +func (x *HyperLoopParticipant) GetParticipantKey() []byte { + if x != nil { + return x.ParticipantKey + } + return nil +} + +func (x *HyperLoopParticipant) GetSwapHash() []byte { + if x != nil { + return x.SwapHash + } + return nil +} + +func (x *HyperLoopParticipant) GetAmt() int64 { + if x != nil { + return x.Amt + } + return 0 +} + +func (x *HyperLoopParticipant) GetSweepAddr() string { + if x != nil { + return x.SweepAddr + } + return "" +} + +type RegisterHyperloopRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + 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 int64 `protobuf:"varint,3,opt,name=amt,proto3" json:"amt,omitempty"` + PrivateHyperloopId []byte `protobuf:"bytes,4,opt,name=private_hyperloop_id,json=privateHyperloopId,proto3" json:"private_hyperloop_id,omitempty"` + PrivateHyperloopPublishTime int64 `protobuf:"varint,5,opt,name=private_hyperloop_publish_time,json=privateHyperloopPublishTime,proto3" json:"private_hyperloop_publish_time,omitempty"` + SweepAddr string `protobuf:"bytes,6,opt,name=sweep_addr,json=sweepAddr,proto3" json:"sweep_addr,omitempty"` +} + +func (x *RegisterHyperloopRequest) Reset() { + *x = RegisterHyperloopRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_hyperloop_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *RegisterHyperloopRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RegisterHyperloopRequest) ProtoMessage() {} + +func (x *RegisterHyperloopRequest) ProtoReflect() protoreflect.Message { + mi := &file_hyperloop_proto_msgTypes[4] + 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 RegisterHyperloopRequest.ProtoReflect.Descriptor instead. +func (*RegisterHyperloopRequest) Descriptor() ([]byte, []int) { + return file_hyperloop_proto_rawDescGZIP(), []int{4} +} + +func (x *RegisterHyperloopRequest) GetReceiverKey() []byte { + if x != nil { + return x.ReceiverKey + } + return nil +} + +func (x *RegisterHyperloopRequest) GetSwapHash() []byte { + if x != nil { + return x.SwapHash + } + return nil +} + +func (x *RegisterHyperloopRequest) GetAmt() int64 { + if x != nil { + return x.Amt + } + return 0 +} + +func (x *RegisterHyperloopRequest) GetPrivateHyperloopId() []byte { + if x != nil { + return x.PrivateHyperloopId + } + return nil +} + +func (x *RegisterHyperloopRequest) GetPrivateHyperloopPublishTime() int64 { + if x != nil { + return x.PrivateHyperloopPublishTime + } + return 0 +} + +func (x *RegisterHyperloopRequest) GetSweepAddr() string { + if x != nil { + return x.SweepAddr + } + return "" +} + +type RegisterHyperloopResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + HyperloopId []byte `protobuf:"bytes,1,opt,name=hyperloop_id,json=hyperloopId,proto3" json:"hyperloop_id,omitempty"` + ServerKey []byte `protobuf:"bytes,2,opt,name=server_key,json=serverKey,proto3" json:"server_key,omitempty"` + HtlcExpiry int32 `protobuf:"varint,3,opt,name=htlc_expiry,json=htlcExpiry,proto3" json:"htlc_expiry,omitempty"` + HyperloopExpiry int32 `protobuf:"varint,4,opt,name=hyperloop_expiry,json=hyperloopExpiry,proto3" json:"hyperloop_expiry,omitempty"` + HyperloopFee int64 `protobuf:"varint,5,opt,name=hyperloop_fee,json=hyperloopFee,proto3" json:"hyperloop_fee,omitempty"` + Invoice string `protobuf:"bytes,6,opt,name=invoice,proto3" json:"invoice,omitempty"` +} + +func (x *RegisterHyperloopResponse) Reset() { + *x = RegisterHyperloopResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_hyperloop_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *RegisterHyperloopResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RegisterHyperloopResponse) ProtoMessage() {} + +func (x *RegisterHyperloopResponse) ProtoReflect() protoreflect.Message { + mi := &file_hyperloop_proto_msgTypes[5] + 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 RegisterHyperloopResponse.ProtoReflect.Descriptor instead. +func (*RegisterHyperloopResponse) Descriptor() ([]byte, []int) { + return file_hyperloop_proto_rawDescGZIP(), []int{5} +} + +func (x *RegisterHyperloopResponse) GetHyperloopId() []byte { + if x != nil { + return x.HyperloopId + } + return nil +} + +func (x *RegisterHyperloopResponse) GetServerKey() []byte { + if x != nil { + return x.ServerKey + } + return nil +} + +func (x *RegisterHyperloopResponse) GetHtlcExpiry() int32 { + if x != nil { + return x.HtlcExpiry + } + return 0 +} + +func (x *RegisterHyperloopResponse) GetHyperloopExpiry() int32 { + if x != nil { + return x.HyperloopExpiry + } + return 0 +} + +func (x *RegisterHyperloopResponse) GetHyperloopFee() int64 { + if x != nil { + return x.HyperloopFee + } + return 0 +} + +func (x *RegisterHyperloopResponse) GetInvoice() string { + if x != nil { + return x.Invoice + } + return "" +} + +type PushHyperloopHtlcNonceRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + HyperloopId []byte `protobuf:"bytes,1,opt,name=hyperloop_id,json=hyperloopId,proto3" json:"hyperloop_id,omitempty"` + SwapHash []byte `protobuf:"bytes,2,opt,name=swap_hash,json=swapHash,proto3" json:"swap_hash,omitempty"` + HtlcNonce []byte `protobuf:"bytes,3,opt,name=htlc_nonce,json=htlcNonce,proto3" json:"htlc_nonce,omitempty"` +} + +func (x *PushHyperloopHtlcNonceRequest) Reset() { + *x = PushHyperloopHtlcNonceRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_hyperloop_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PushHyperloopHtlcNonceRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PushHyperloopHtlcNonceRequest) ProtoMessage() {} + +func (x *PushHyperloopHtlcNonceRequest) ProtoReflect() protoreflect.Message { + mi := &file_hyperloop_proto_msgTypes[6] + 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 PushHyperloopHtlcNonceRequest.ProtoReflect.Descriptor instead. +func (*PushHyperloopHtlcNonceRequest) Descriptor() ([]byte, []int) { + return file_hyperloop_proto_rawDescGZIP(), []int{6} +} + +func (x *PushHyperloopHtlcNonceRequest) GetHyperloopId() []byte { + if x != nil { + return x.HyperloopId + } + return nil +} + +func (x *PushHyperloopHtlcNonceRequest) GetSwapHash() []byte { + if x != nil { + return x.SwapHash + } + return nil +} + +func (x *PushHyperloopHtlcNonceRequest) GetHtlcNonce() []byte { + if x != nil { + return x.HtlcNonce + } + return nil +} + +type PushHyperloopHtlcNonceResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ServerHtlcNonce []byte `protobuf:"bytes,1,opt,name=server_htlc_nonce,json=serverHtlcNonce,proto3" json:"server_htlc_nonce,omitempty"` + HtlcFeeRate int64 `protobuf:"varint,2,opt,name=htlc_fee_rate,json=htlcFeeRate,proto3" json:"htlc_fee_rate,omitempty"` +} + +func (x *PushHyperloopHtlcNonceResponse) Reset() { + *x = PushHyperloopHtlcNonceResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_hyperloop_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PushHyperloopHtlcNonceResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PushHyperloopHtlcNonceResponse) ProtoMessage() {} + +func (x *PushHyperloopHtlcNonceResponse) ProtoReflect() protoreflect.Message { + mi := &file_hyperloop_proto_msgTypes[7] + 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 PushHyperloopHtlcNonceResponse.ProtoReflect.Descriptor instead. +func (*PushHyperloopHtlcNonceResponse) Descriptor() ([]byte, []int) { + return file_hyperloop_proto_rawDescGZIP(), []int{7} +} + +func (x *PushHyperloopHtlcNonceResponse) GetServerHtlcNonce() []byte { + if x != nil { + return x.ServerHtlcNonce + } + return nil +} + +func (x *PushHyperloopHtlcNonceResponse) GetHtlcFeeRate() int64 { + if x != nil { + return x.HtlcFeeRate + } + return 0 +} + +type PushHyperloopHtlcSigRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + HyperloopId []byte `protobuf:"bytes,1,opt,name=hyperloop_id,json=hyperloopId,proto3" json:"hyperloop_id,omitempty"` + SwapHash []byte `protobuf:"bytes,2,opt,name=swap_hash,json=swapHash,proto3" json:"swap_hash,omitempty"` + HtlcSig []byte `protobuf:"bytes,3,opt,name=htlc_sig,json=htlcSig,proto3" json:"htlc_sig,omitempty"` +} + +func (x *PushHyperloopHtlcSigRequest) Reset() { + *x = PushHyperloopHtlcSigRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_hyperloop_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PushHyperloopHtlcSigRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PushHyperloopHtlcSigRequest) ProtoMessage() {} + +func (x *PushHyperloopHtlcSigRequest) ProtoReflect() protoreflect.Message { + mi := &file_hyperloop_proto_msgTypes[8] + 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 PushHyperloopHtlcSigRequest.ProtoReflect.Descriptor instead. +func (*PushHyperloopHtlcSigRequest) Descriptor() ([]byte, []int) { + return file_hyperloop_proto_rawDescGZIP(), []int{8} +} + +func (x *PushHyperloopHtlcSigRequest) GetHyperloopId() []byte { + if x != nil { + return x.HyperloopId + } + return nil +} + +func (x *PushHyperloopHtlcSigRequest) GetSwapHash() []byte { + if x != nil { + return x.SwapHash + } + return nil +} + +func (x *PushHyperloopHtlcSigRequest) GetHtlcSig() []byte { + if x != nil { + return x.HtlcSig + } + return nil +} + +type PushHyperloopHtlcSigResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *PushHyperloopHtlcSigResponse) Reset() { + *x = PushHyperloopHtlcSigResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_hyperloop_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PushHyperloopHtlcSigResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PushHyperloopHtlcSigResponse) ProtoMessage() {} + +func (x *PushHyperloopHtlcSigResponse) ProtoReflect() protoreflect.Message { + mi := &file_hyperloop_proto_msgTypes[9] + 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 PushHyperloopHtlcSigResponse.ProtoReflect.Descriptor instead. +func (*PushHyperloopHtlcSigResponse) Descriptor() ([]byte, []int) { + return file_hyperloop_proto_rawDescGZIP(), []int{9} +} + +type PushHyperloopPreimageRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + HyperloopId []byte `protobuf:"bytes,1,opt,name=hyperloop_id,json=hyperloopId,proto3" json:"hyperloop_id,omitempty"` + Preimage []byte `protobuf:"bytes,2,opt,name=preimage,proto3" json:"preimage,omitempty"` + SweepNonce []byte `protobuf:"bytes,3,opt,name=sweep_nonce,json=sweepNonce,proto3" json:"sweep_nonce,omitempty"` +} + +func (x *PushHyperloopPreimageRequest) Reset() { + *x = PushHyperloopPreimageRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_hyperloop_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PushHyperloopPreimageRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PushHyperloopPreimageRequest) ProtoMessage() {} + +func (x *PushHyperloopPreimageRequest) ProtoReflect() protoreflect.Message { + mi := &file_hyperloop_proto_msgTypes[10] + 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 PushHyperloopPreimageRequest.ProtoReflect.Descriptor instead. +func (*PushHyperloopPreimageRequest) Descriptor() ([]byte, []int) { + return file_hyperloop_proto_rawDescGZIP(), []int{10} +} + +func (x *PushHyperloopPreimageRequest) GetHyperloopId() []byte { + if x != nil { + return x.HyperloopId + } + return nil +} + +func (x *PushHyperloopPreimageRequest) GetPreimage() []byte { + if x != nil { + return x.Preimage + } + return nil +} + +func (x *PushHyperloopPreimageRequest) GetSweepNonce() []byte { + if x != nil { + return x.SweepNonce + } + return nil +} + +type PushHyperloopPreimageResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ServerSweepNonce []byte `protobuf:"bytes,1,opt,name=server_sweep_nonce,json=serverSweepNonce,proto3" json:"server_sweep_nonce,omitempty"` + SweepFeeRate int64 `protobuf:"varint,2,opt,name=sweep_fee_rate,json=sweepFeeRate,proto3" json:"sweep_fee_rate,omitempty"` +} + +func (x *PushHyperloopPreimageResponse) Reset() { + *x = PushHyperloopPreimageResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_hyperloop_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PushHyperloopPreimageResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PushHyperloopPreimageResponse) ProtoMessage() {} + +func (x *PushHyperloopPreimageResponse) ProtoReflect() protoreflect.Message { + mi := &file_hyperloop_proto_msgTypes[11] + 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 PushHyperloopPreimageResponse.ProtoReflect.Descriptor instead. +func (*PushHyperloopPreimageResponse) Descriptor() ([]byte, []int) { + return file_hyperloop_proto_rawDescGZIP(), []int{11} +} + +func (x *PushHyperloopPreimageResponse) GetServerSweepNonce() []byte { + if x != nil { + return x.ServerSweepNonce + } + return nil +} + +func (x *PushHyperloopPreimageResponse) GetSweepFeeRate() int64 { + if x != nil { + return x.SweepFeeRate + } + return 0 +} + +type PushHyperloopSweeplessSweepSigRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + HyperloopId []byte `protobuf:"bytes,1,opt,name=hyperloop_id,json=hyperloopId,proto3" json:"hyperloop_id,omitempty"` + SwapHash []byte `protobuf:"bytes,2,opt,name=swap_hash,json=swapHash,proto3" json:"swap_hash,omitempty"` + SweepSig []byte `protobuf:"bytes,3,opt,name=sweep_sig,json=sweepSig,proto3" json:"sweep_sig,omitempty"` +} + +func (x *PushHyperloopSweeplessSweepSigRequest) Reset() { + *x = PushHyperloopSweeplessSweepSigRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_hyperloop_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PushHyperloopSweeplessSweepSigRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PushHyperloopSweeplessSweepSigRequest) ProtoMessage() {} + +func (x *PushHyperloopSweeplessSweepSigRequest) ProtoReflect() protoreflect.Message { + mi := &file_hyperloop_proto_msgTypes[12] + 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 PushHyperloopSweeplessSweepSigRequest.ProtoReflect.Descriptor instead. +func (*PushHyperloopSweeplessSweepSigRequest) Descriptor() ([]byte, []int) { + return file_hyperloop_proto_rawDescGZIP(), []int{12} +} + +func (x *PushHyperloopSweeplessSweepSigRequest) GetHyperloopId() []byte { + if x != nil { + return x.HyperloopId + } + return nil +} + +func (x *PushHyperloopSweeplessSweepSigRequest) GetSwapHash() []byte { + if x != nil { + return x.SwapHash + } + return nil +} + +func (x *PushHyperloopSweeplessSweepSigRequest) GetSweepSig() []byte { + if x != nil { + return x.SweepSig + } + return nil +} + +type PushHyperloopSweeplessSweepSigResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *PushHyperloopSweeplessSweepSigResponse) Reset() { + *x = PushHyperloopSweeplessSweepSigResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_hyperloop_proto_msgTypes[13] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PushHyperloopSweeplessSweepSigResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PushHyperloopSweeplessSweepSigResponse) ProtoMessage() {} + +func (x *PushHyperloopSweeplessSweepSigResponse) ProtoReflect() protoreflect.Message { + mi := &file_hyperloop_proto_msgTypes[13] + 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 PushHyperloopSweeplessSweepSigResponse.ProtoReflect.Descriptor instead. +func (*PushHyperloopSweeplessSweepSigResponse) Descriptor() ([]byte, []int) { + return file_hyperloop_proto_rawDescGZIP(), []int{13} +} + +var File_hyperloop_proto protoreflect.FileDescriptor + +var file_hyperloop_proto_rawDesc = []byte{ + 0x0a, 0x0f, 0x68, 0x79, 0x70, 0x65, 0x72, 0x6c, 0x6f, 0x6f, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x12, 0x07, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x22, 0x47, 0x0a, 0x22, 0x48, 0x79, + 0x70, 0x65, 0x72, 0x6c, 0x6f, 0x6f, 0x70, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x12, 0x21, 0x0a, 0x0c, 0x68, 0x79, 0x70, 0x65, 0x72, 0x6c, 0x6f, 0x6f, 0x70, 0x5f, 0x69, 0x64, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0b, 0x68, 0x79, 0x70, 0x65, 0x72, 0x6c, 0x6f, 0x6f, + 0x70, 0x49, 0x64, 0x22, 0x8c, 0x02, 0x0a, 0x23, 0x48, 0x79, 0x70, 0x65, 0x72, 0x6c, 0x6f, 0x6f, + 0x70, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x72, + 0x65, 0x61, 0x6d, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x41, 0x0a, 0x0c, 0x70, + 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, + 0x0b, 0x32, 0x1d, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x48, 0x79, 0x70, 0x65, + 0x72, 0x4c, 0x6f, 0x6f, 0x70, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, + 0x52, 0x0c, 0x70, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x73, 0x12, 0x25, + 0x0a, 0x0e, 0x68, 0x79, 0x70, 0x65, 0x72, 0x6c, 0x6f, 0x6f, 0x70, 0x5f, 0x74, 0x78, 0x69, 0x64, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x68, 0x79, 0x70, 0x65, 0x72, 0x6c, 0x6f, 0x6f, + 0x70, 0x54, 0x78, 0x69, 0x64, 0x12, 0x1f, 0x0a, 0x0b, 0x68, 0x74, 0x6c, 0x63, 0x5f, 0x6e, 0x6f, + 0x6e, 0x63, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x0a, 0x68, 0x74, 0x6c, 0x63, + 0x4e, 0x6f, 0x6e, 0x63, 0x65, 0x73, 0x12, 0x24, 0x0a, 0x0e, 0x66, 0x69, 0x6e, 0x61, 0x6c, 0x5f, + 0x68, 0x74, 0x6c, 0x63, 0x5f, 0x73, 0x69, 0x67, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0c, + 0x66, 0x69, 0x6e, 0x61, 0x6c, 0x48, 0x74, 0x6c, 0x63, 0x53, 0x69, 0x67, 0x12, 0x34, 0x0a, 0x16, + 0x73, 0x77, 0x65, 0x65, 0x70, 0x6c, 0x65, 0x73, 0x73, 0x5f, 0x73, 0x77, 0x65, 0x65, 0x70, 0x5f, + 0x6e, 0x6f, 0x6e, 0x63, 0x65, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x14, 0x73, 0x77, + 0x65, 0x65, 0x70, 0x6c, 0x65, 0x73, 0x73, 0x53, 0x77, 0x65, 0x65, 0x70, 0x4e, 0x6f, 0x6e, 0x63, + 0x65, 0x73, 0x22, 0x16, 0x0a, 0x14, 0x48, 0x79, 0x70, 0x65, 0x72, 0x6c, 0x6f, 0x6f, 0x70, 0x52, + 0x65, 0x61, 0x64, 0x79, 0x46, 0x6f, 0x72, 0x53, 0x69, 0x67, 0x22, 0x8d, 0x01, 0x0a, 0x14, 0x48, + 0x79, 0x70, 0x65, 0x72, 0x4c, 0x6f, 0x6f, 0x70, 0x50, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, + 0x61, 0x6e, 0x74, 0x12, 0x27, 0x0a, 0x0f, 0x70, 0x61, 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, + 0x6e, 0x74, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0e, 0x70, 0x61, + 0x72, 0x74, 0x69, 0x63, 0x69, 0x70, 0x61, 0x6e, 0x74, 0x4b, 0x65, 0x79, 0x12, 0x1b, 0x0a, 0x09, + 0x73, 0x77, 0x61, 0x70, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, + 0x08, 0x73, 0x77, 0x61, 0x70, 0x48, 0x61, 0x73, 0x68, 0x12, 0x10, 0x0a, 0x03, 0x61, 0x6d, 0x74, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x61, 0x6d, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x73, + 0x77, 0x65, 0x65, 0x70, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x09, 0x73, 0x77, 0x65, 0x65, 0x70, 0x41, 0x64, 0x64, 0x72, 0x22, 0x82, 0x02, 0x0a, 0x18, 0x52, + 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x48, 0x79, 0x70, 0x65, 0x72, 0x6c, 0x6f, 0x6f, 0x70, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x21, 0x0a, 0x0c, 0x72, 0x65, 0x63, 0x65, 0x69, + 0x76, 0x65, 0x72, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0b, 0x72, + 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x72, 0x4b, 0x65, 0x79, 0x12, 0x1b, 0x0a, 0x09, 0x73, 0x77, + 0x61, 0x70, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x08, 0x73, + 0x77, 0x61, 0x70, 0x48, 0x61, 0x73, 0x68, 0x12, 0x10, 0x0a, 0x03, 0x61, 0x6d, 0x74, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x61, 0x6d, 0x74, 0x12, 0x30, 0x0a, 0x14, 0x70, 0x72, 0x69, + 0x76, 0x61, 0x74, 0x65, 0x5f, 0x68, 0x79, 0x70, 0x65, 0x72, 0x6c, 0x6f, 0x6f, 0x70, 0x5f, 0x69, + 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x12, 0x70, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, + 0x48, 0x79, 0x70, 0x65, 0x72, 0x6c, 0x6f, 0x6f, 0x70, 0x49, 0x64, 0x12, 0x43, 0x0a, 0x1e, 0x70, + 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x5f, 0x68, 0x79, 0x70, 0x65, 0x72, 0x6c, 0x6f, 0x6f, 0x70, + 0x5f, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x73, 0x68, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x05, 0x20, + 0x01, 0x28, 0x03, 0x52, 0x1b, 0x70, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x48, 0x79, 0x70, 0x65, + 0x72, 0x6c, 0x6f, 0x6f, 0x70, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x73, 0x68, 0x54, 0x69, 0x6d, 0x65, + 0x12, 0x1d, 0x0a, 0x0a, 0x73, 0x77, 0x65, 0x65, 0x70, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x18, 0x06, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, 0x77, 0x65, 0x65, 0x70, 0x41, 0x64, 0x64, 0x72, 0x22, + 0xe8, 0x01, 0x0a, 0x19, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x48, 0x79, 0x70, 0x65, + 0x72, 0x6c, 0x6f, 0x6f, 0x70, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x21, 0x0a, + 0x0c, 0x68, 0x79, 0x70, 0x65, 0x72, 0x6c, 0x6f, 0x6f, 0x70, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0c, 0x52, 0x0b, 0x68, 0x79, 0x70, 0x65, 0x72, 0x6c, 0x6f, 0x6f, 0x70, 0x49, 0x64, + 0x12, 0x1d, 0x0a, 0x0a, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x4b, 0x65, 0x79, 0x12, + 0x1f, 0x0a, 0x0b, 0x68, 0x74, 0x6c, 0x63, 0x5f, 0x65, 0x78, 0x70, 0x69, 0x72, 0x79, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x68, 0x74, 0x6c, 0x63, 0x45, 0x78, 0x70, 0x69, 0x72, 0x79, + 0x12, 0x29, 0x0a, 0x10, 0x68, 0x79, 0x70, 0x65, 0x72, 0x6c, 0x6f, 0x6f, 0x70, 0x5f, 0x65, 0x78, + 0x70, 0x69, 0x72, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0f, 0x68, 0x79, 0x70, 0x65, + 0x72, 0x6c, 0x6f, 0x6f, 0x70, 0x45, 0x78, 0x70, 0x69, 0x72, 0x79, 0x12, 0x23, 0x0a, 0x0d, 0x68, + 0x79, 0x70, 0x65, 0x72, 0x6c, 0x6f, 0x6f, 0x70, 0x5f, 0x66, 0x65, 0x65, 0x18, 0x05, 0x20, 0x01, + 0x28, 0x03, 0x52, 0x0c, 0x68, 0x79, 0x70, 0x65, 0x72, 0x6c, 0x6f, 0x6f, 0x70, 0x46, 0x65, 0x65, + 0x12, 0x18, 0x0a, 0x07, 0x69, 0x6e, 0x76, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x07, 0x69, 0x6e, 0x76, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x7e, 0x0a, 0x1d, 0x50, 0x75, + 0x73, 0x68, 0x48, 0x79, 0x70, 0x65, 0x72, 0x6c, 0x6f, 0x6f, 0x70, 0x48, 0x74, 0x6c, 0x63, 0x4e, + 0x6f, 0x6e, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x21, 0x0a, 0x0c, 0x68, + 0x79, 0x70, 0x65, 0x72, 0x6c, 0x6f, 0x6f, 0x70, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0c, 0x52, 0x0b, 0x68, 0x79, 0x70, 0x65, 0x72, 0x6c, 0x6f, 0x6f, 0x70, 0x49, 0x64, 0x12, 0x1b, + 0x0a, 0x09, 0x73, 0x77, 0x61, 0x70, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x0c, 0x52, 0x08, 0x73, 0x77, 0x61, 0x70, 0x48, 0x61, 0x73, 0x68, 0x12, 0x1d, 0x0a, 0x0a, 0x68, + 0x74, 0x6c, 0x63, 0x5f, 0x6e, 0x6f, 0x6e, 0x63, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, + 0x09, 0x68, 0x74, 0x6c, 0x63, 0x4e, 0x6f, 0x6e, 0x63, 0x65, 0x22, 0x70, 0x0a, 0x1e, 0x50, 0x75, + 0x73, 0x68, 0x48, 0x79, 0x70, 0x65, 0x72, 0x6c, 0x6f, 0x6f, 0x70, 0x48, 0x74, 0x6c, 0x63, 0x4e, + 0x6f, 0x6e, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2a, 0x0a, 0x11, + 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x5f, 0x68, 0x74, 0x6c, 0x63, 0x5f, 0x6e, 0x6f, 0x6e, 0x63, + 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0f, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x48, + 0x74, 0x6c, 0x63, 0x4e, 0x6f, 0x6e, 0x63, 0x65, 0x12, 0x22, 0x0a, 0x0d, 0x68, 0x74, 0x6c, 0x63, + 0x5f, 0x66, 0x65, 0x65, 0x5f, 0x72, 0x61, 0x74, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, + 0x0b, 0x68, 0x74, 0x6c, 0x63, 0x46, 0x65, 0x65, 0x52, 0x61, 0x74, 0x65, 0x22, 0x78, 0x0a, 0x1b, + 0x50, 0x75, 0x73, 0x68, 0x48, 0x79, 0x70, 0x65, 0x72, 0x6c, 0x6f, 0x6f, 0x70, 0x48, 0x74, 0x6c, + 0x63, 0x53, 0x69, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x21, 0x0a, 0x0c, 0x68, + 0x79, 0x70, 0x65, 0x72, 0x6c, 0x6f, 0x6f, 0x70, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0c, 0x52, 0x0b, 0x68, 0x79, 0x70, 0x65, 0x72, 0x6c, 0x6f, 0x6f, 0x70, 0x49, 0x64, 0x12, 0x1b, + 0x0a, 0x09, 0x73, 0x77, 0x61, 0x70, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x0c, 0x52, 0x08, 0x73, 0x77, 0x61, 0x70, 0x48, 0x61, 0x73, 0x68, 0x12, 0x19, 0x0a, 0x08, 0x68, + 0x74, 0x6c, 0x63, 0x5f, 0x73, 0x69, 0x67, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x68, + 0x74, 0x6c, 0x63, 0x53, 0x69, 0x67, 0x22, 0x1e, 0x0a, 0x1c, 0x50, 0x75, 0x73, 0x68, 0x48, 0x79, + 0x70, 0x65, 0x72, 0x6c, 0x6f, 0x6f, 0x70, 0x48, 0x74, 0x6c, 0x63, 0x53, 0x69, 0x67, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x7e, 0x0a, 0x1c, 0x50, 0x75, 0x73, 0x68, 0x48, 0x79, + 0x70, 0x65, 0x72, 0x6c, 0x6f, 0x6f, 0x70, 0x50, 0x72, 0x65, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x21, 0x0a, 0x0c, 0x68, 0x79, 0x70, 0x65, 0x72, 0x6c, + 0x6f, 0x6f, 0x70, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0b, 0x68, 0x79, + 0x70, 0x65, 0x72, 0x6c, 0x6f, 0x6f, 0x70, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x72, 0x65, + 0x69, 0x6d, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x08, 0x70, 0x72, 0x65, + 0x69, 0x6d, 0x61, 0x67, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x73, 0x77, 0x65, 0x65, 0x70, 0x5f, 0x6e, + 0x6f, 0x6e, 0x63, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0a, 0x73, 0x77, 0x65, 0x65, + 0x70, 0x4e, 0x6f, 0x6e, 0x63, 0x65, 0x22, 0x73, 0x0a, 0x1d, 0x50, 0x75, 0x73, 0x68, 0x48, 0x79, + 0x70, 0x65, 0x72, 0x6c, 0x6f, 0x6f, 0x70, 0x50, 0x72, 0x65, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2c, 0x0a, 0x12, 0x73, 0x65, 0x72, 0x76, 0x65, + 0x72, 0x5f, 0x73, 0x77, 0x65, 0x65, 0x70, 0x5f, 0x6e, 0x6f, 0x6e, 0x63, 0x65, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0c, 0x52, 0x10, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x53, 0x77, 0x65, 0x65, 0x70, + 0x4e, 0x6f, 0x6e, 0x63, 0x65, 0x12, 0x24, 0x0a, 0x0e, 0x73, 0x77, 0x65, 0x65, 0x70, 0x5f, 0x66, + 0x65, 0x65, 0x5f, 0x72, 0x61, 0x74, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0c, 0x73, + 0x77, 0x65, 0x65, 0x70, 0x46, 0x65, 0x65, 0x52, 0x61, 0x74, 0x65, 0x22, 0x84, 0x01, 0x0a, 0x25, + 0x50, 0x75, 0x73, 0x68, 0x48, 0x79, 0x70, 0x65, 0x72, 0x6c, 0x6f, 0x6f, 0x70, 0x53, 0x77, 0x65, + 0x65, 0x70, 0x6c, 0x65, 0x73, 0x73, 0x53, 0x77, 0x65, 0x65, 0x70, 0x53, 0x69, 0x67, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x21, 0x0a, 0x0c, 0x68, 0x79, 0x70, 0x65, 0x72, 0x6c, 0x6f, + 0x6f, 0x70, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0b, 0x68, 0x79, 0x70, + 0x65, 0x72, 0x6c, 0x6f, 0x6f, 0x70, 0x49, 0x64, 0x12, 0x1b, 0x0a, 0x09, 0x73, 0x77, 0x61, 0x70, + 0x5f, 0x68, 0x61, 0x73, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x08, 0x73, 0x77, 0x61, + 0x70, 0x48, 0x61, 0x73, 0x68, 0x12, 0x1b, 0x0a, 0x09, 0x73, 0x77, 0x65, 0x65, 0x70, 0x5f, 0x73, + 0x69, 0x67, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x08, 0x73, 0x77, 0x65, 0x65, 0x70, 0x53, + 0x69, 0x67, 0x22, 0x28, 0x0a, 0x26, 0x50, 0x75, 0x73, 0x68, 0x48, 0x79, 0x70, 0x65, 0x72, 0x6c, + 0x6f, 0x6f, 0x70, 0x53, 0x77, 0x65, 0x65, 0x70, 0x6c, 0x65, 0x73, 0x73, 0x53, 0x77, 0x65, 0x65, + 0x70, 0x53, 0x69, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0xa5, 0x05, 0x0a, + 0x0f, 0x48, 0x79, 0x70, 0x65, 0x72, 0x6c, 0x6f, 0x6f, 0x70, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, + 0x12, 0x7a, 0x0a, 0x1b, 0x48, 0x79, 0x70, 0x65, 0x72, 0x6c, 0x6f, 0x6f, 0x70, 0x4e, 0x6f, 0x74, + 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x12, + 0x2b, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x48, 0x79, 0x70, 0x65, 0x72, 0x6c, + 0x6f, 0x6f, 0x70, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, + 0x74, 0x72, 0x65, 0x61, 0x6d, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2c, 0x2e, 0x6c, + 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x48, 0x79, 0x70, 0x65, 0x72, 0x6c, 0x6f, 0x6f, 0x70, + 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x72, 0x65, + 0x61, 0x6d, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x30, 0x01, 0x12, 0x5a, 0x0a, 0x11, + 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x48, 0x79, 0x70, 0x65, 0x72, 0x6c, 0x6f, 0x6f, + 0x70, 0x12, 0x21, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x52, 0x65, 0x67, 0x69, + 0x73, 0x74, 0x65, 0x72, 0x48, 0x79, 0x70, 0x65, 0x72, 0x6c, 0x6f, 0x6f, 0x70, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x22, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x52, + 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x48, 0x79, 0x70, 0x65, 0x72, 0x6c, 0x6f, 0x6f, 0x70, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x69, 0x0a, 0x16, 0x50, 0x75, 0x73, 0x68, + 0x48, 0x79, 0x70, 0x65, 0x72, 0x6c, 0x6f, 0x6f, 0x70, 0x48, 0x74, 0x6c, 0x63, 0x4e, 0x6f, 0x6e, + 0x63, 0x65, 0x12, 0x26, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x50, 0x75, 0x73, + 0x68, 0x48, 0x79, 0x70, 0x65, 0x72, 0x6c, 0x6f, 0x6f, 0x70, 0x48, 0x74, 0x6c, 0x63, 0x4e, 0x6f, + 0x6e, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x27, 0x2e, 0x6c, 0x6f, 0x6f, + 0x70, 0x72, 0x70, 0x63, 0x2e, 0x50, 0x75, 0x73, 0x68, 0x48, 0x79, 0x70, 0x65, 0x72, 0x6c, 0x6f, + 0x6f, 0x70, 0x48, 0x74, 0x6c, 0x63, 0x4e, 0x6f, 0x6e, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x63, 0x0a, 0x14, 0x50, 0x75, 0x73, 0x68, 0x48, 0x79, 0x70, 0x65, 0x72, + 0x6c, 0x6f, 0x6f, 0x70, 0x48, 0x74, 0x6c, 0x63, 0x53, 0x69, 0x67, 0x12, 0x24, 0x2e, 0x6c, 0x6f, + 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x50, 0x75, 0x73, 0x68, 0x48, 0x79, 0x70, 0x65, 0x72, 0x6c, + 0x6f, 0x6f, 0x70, 0x48, 0x74, 0x6c, 0x63, 0x53, 0x69, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x25, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x50, 0x75, 0x73, 0x68, + 0x48, 0x79, 0x70, 0x65, 0x72, 0x6c, 0x6f, 0x6f, 0x70, 0x48, 0x74, 0x6c, 0x63, 0x53, 0x69, 0x67, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x66, 0x0a, 0x15, 0x50, 0x75, 0x73, 0x68, + 0x48, 0x79, 0x70, 0x65, 0x72, 0x6c, 0x6f, 0x6f, 0x70, 0x50, 0x72, 0x65, 0x69, 0x6d, 0x61, 0x67, + 0x65, 0x12, 0x25, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x50, 0x75, 0x73, 0x68, + 0x48, 0x79, 0x70, 0x65, 0x72, 0x6c, 0x6f, 0x6f, 0x70, 0x50, 0x72, 0x65, 0x69, 0x6d, 0x61, 0x67, + 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x26, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, + 0x70, 0x63, 0x2e, 0x50, 0x75, 0x73, 0x68, 0x48, 0x79, 0x70, 0x65, 0x72, 0x6c, 0x6f, 0x6f, 0x70, + 0x50, 0x72, 0x65, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x81, 0x01, 0x0a, 0x1e, 0x50, 0x75, 0x73, 0x68, 0x48, 0x79, 0x70, 0x65, 0x72, 0x6c, 0x6f, + 0x6f, 0x70, 0x53, 0x77, 0x65, 0x65, 0x70, 0x6c, 0x65, 0x73, 0x73, 0x53, 0x77, 0x65, 0x65, 0x70, + 0x53, 0x69, 0x67, 0x12, 0x2e, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x50, 0x75, + 0x73, 0x68, 0x48, 0x79, 0x70, 0x65, 0x72, 0x6c, 0x6f, 0x6f, 0x70, 0x53, 0x77, 0x65, 0x65, 0x70, + 0x6c, 0x65, 0x73, 0x73, 0x53, 0x77, 0x65, 0x65, 0x70, 0x53, 0x69, 0x67, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x2f, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x50, 0x75, + 0x73, 0x68, 0x48, 0x79, 0x70, 0x65, 0x72, 0x6c, 0x6f, 0x6f, 0x70, 0x53, 0x77, 0x65, 0x65, 0x70, + 0x6c, 0x65, 0x73, 0x73, 0x53, 0x77, 0x65, 0x65, 0x70, 0x53, 0x69, 0x67, 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 ( + file_hyperloop_proto_rawDescOnce sync.Once + file_hyperloop_proto_rawDescData = file_hyperloop_proto_rawDesc +) + +func file_hyperloop_proto_rawDescGZIP() []byte { + file_hyperloop_proto_rawDescOnce.Do(func() { + file_hyperloop_proto_rawDescData = protoimpl.X.CompressGZIP(file_hyperloop_proto_rawDescData) + }) + return file_hyperloop_proto_rawDescData +} + +var file_hyperloop_proto_msgTypes = make([]protoimpl.MessageInfo, 14) +var file_hyperloop_proto_goTypes = []interface{}{ + (*HyperloopNotificationStreamRequest)(nil), // 0: looprpc.HyperloopNotificationStreamRequest + (*HyperloopNotificationStreamResponse)(nil), // 1: looprpc.HyperloopNotificationStreamResponse + (*HyperloopReadyForSig)(nil), // 2: looprpc.HyperloopReadyForSig + (*HyperLoopParticipant)(nil), // 3: looprpc.HyperLoopParticipant + (*RegisterHyperloopRequest)(nil), // 4: looprpc.RegisterHyperloopRequest + (*RegisterHyperloopResponse)(nil), // 5: looprpc.RegisterHyperloopResponse + (*PushHyperloopHtlcNonceRequest)(nil), // 6: looprpc.PushHyperloopHtlcNonceRequest + (*PushHyperloopHtlcNonceResponse)(nil), // 7: looprpc.PushHyperloopHtlcNonceResponse + (*PushHyperloopHtlcSigRequest)(nil), // 8: looprpc.PushHyperloopHtlcSigRequest + (*PushHyperloopHtlcSigResponse)(nil), // 9: looprpc.PushHyperloopHtlcSigResponse + (*PushHyperloopPreimageRequest)(nil), // 10: looprpc.PushHyperloopPreimageRequest + (*PushHyperloopPreimageResponse)(nil), // 11: looprpc.PushHyperloopPreimageResponse + (*PushHyperloopSweeplessSweepSigRequest)(nil), // 12: looprpc.PushHyperloopSweeplessSweepSigRequest + (*PushHyperloopSweeplessSweepSigResponse)(nil), // 13: looprpc.PushHyperloopSweeplessSweepSigResponse +} +var file_hyperloop_proto_depIdxs = []int32{ + 3, // 0: looprpc.HyperloopNotificationStreamResponse.participants:type_name -> looprpc.HyperLoopParticipant + 0, // 1: looprpc.HyperloopServer.HyperloopNotificationStream:input_type -> looprpc.HyperloopNotificationStreamRequest + 4, // 2: looprpc.HyperloopServer.RegisterHyperloop:input_type -> looprpc.RegisterHyperloopRequest + 6, // 3: looprpc.HyperloopServer.PushHyperloopHtlcNonce:input_type -> looprpc.PushHyperloopHtlcNonceRequest + 8, // 4: looprpc.HyperloopServer.PushHyperloopHtlcSig:input_type -> looprpc.PushHyperloopHtlcSigRequest + 10, // 5: looprpc.HyperloopServer.PushHyperloopPreimage:input_type -> looprpc.PushHyperloopPreimageRequest + 12, // 6: looprpc.HyperloopServer.PushHyperloopSweeplessSweepSig:input_type -> looprpc.PushHyperloopSweeplessSweepSigRequest + 1, // 7: looprpc.HyperloopServer.HyperloopNotificationStream:output_type -> looprpc.HyperloopNotificationStreamResponse + 5, // 8: looprpc.HyperloopServer.RegisterHyperloop:output_type -> looprpc.RegisterHyperloopResponse + 7, // 9: looprpc.HyperloopServer.PushHyperloopHtlcNonce:output_type -> looprpc.PushHyperloopHtlcNonceResponse + 9, // 10: looprpc.HyperloopServer.PushHyperloopHtlcSig:output_type -> looprpc.PushHyperloopHtlcSigResponse + 11, // 11: looprpc.HyperloopServer.PushHyperloopPreimage:output_type -> looprpc.PushHyperloopPreimageResponse + 13, // 12: looprpc.HyperloopServer.PushHyperloopSweeplessSweepSig:output_type -> looprpc.PushHyperloopSweeplessSweepSigResponse + 7, // [7:13] is the sub-list for method output_type + 1, // [1:7] is the sub-list for method input_type + 1, // [1:1] is the sub-list for extension type_name + 1, // [1:1] is the sub-list for extension extendee + 0, // [0:1] is the sub-list for field type_name +} + +func init() { file_hyperloop_proto_init() } +func file_hyperloop_proto_init() { + if File_hyperloop_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_hyperloop_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*HyperloopNotificationStreamRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_hyperloop_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*HyperloopNotificationStreamResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_hyperloop_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*HyperloopReadyForSig); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_hyperloop_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*HyperLoopParticipant); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_hyperloop_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RegisterHyperloopRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_hyperloop_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RegisterHyperloopResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_hyperloop_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PushHyperloopHtlcNonceRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_hyperloop_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PushHyperloopHtlcNonceResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_hyperloop_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PushHyperloopHtlcSigRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_hyperloop_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PushHyperloopHtlcSigResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_hyperloop_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PushHyperloopPreimageRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_hyperloop_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PushHyperloopPreimageResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_hyperloop_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PushHyperloopSweeplessSweepSigRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_hyperloop_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PushHyperloopSweeplessSweepSigResponse); 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{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_hyperloop_proto_rawDesc, + NumEnums: 0, + NumMessages: 14, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_hyperloop_proto_goTypes, + DependencyIndexes: file_hyperloop_proto_depIdxs, + MessageInfos: file_hyperloop_proto_msgTypes, + }.Build() + File_hyperloop_proto = out.File + file_hyperloop_proto_rawDesc = nil + file_hyperloop_proto_goTypes = nil + file_hyperloop_proto_depIdxs = nil +} diff --git a/swapserverrpc/hyperloop.proto b/swapserverrpc/hyperloop.proto new file mode 100644 index 000000000..285cb58f5 --- /dev/null +++ b/swapserverrpc/hyperloop.proto @@ -0,0 +1,103 @@ +syntax = "proto3"; + +// We can't change this to swapserverrpc, it would be a breaking change because +// the package name is also contained in the HTTP URIs and old clients would +// call the wrong endpoints. Luckily with the go_package option we can have +// different golang and RPC package names to fix protobuf namespace conflicts. +package looprpc; + +option go_package = "github.com/lightninglabs/loop/swapserverrpc"; + +service HyperloopServer { + rpc HyperloopNotificationStream (HyperloopNotificationStreamRequest) + returns (stream HyperloopNotificationStreamResponse); + rpc RegisterHyperloop (RegisterHyperloopRequest) + returns (RegisterHyperloopResponse); + rpc PushHyperloopHtlcNonce (PushHyperloopHtlcNonceRequest) + returns (PushHyperloopHtlcNonceResponse); + rpc PushHyperloopHtlcSig (PushHyperloopHtlcSigRequest) + returns (PushHyperloopHtlcSigResponse); + rpc PushHyperloopPreimage (PushHyperloopPreimageRequest) + returns (PushHyperloopPreimageResponse); + rpc PushHyperloopSweeplessSweepSig (PushHyperloopSweeplessSweepSigRequest) + returns (PushHyperloopSweeplessSweepSigResponse); +} +message HyperloopNotificationStreamRequest { + bytes hyperloop_id = 1; +} + +message HyperloopNotificationStreamResponse { + repeated HyperLoopParticipant participants = 1; + string hyperloop_txid = 2; + repeated bytes htlc_nonces = 3; + bytes final_htlc_sig = 4; + repeated bytes sweepless_sweep_nonces = 5; +} + +message HyperloopReadyForSig { +} + +message HyperLoopParticipant { + bytes participant_key = 1; + bytes swap_hash = 2; + int64 amt = 3; + string sweep_addr = 4; +} + +message RegisterHyperloopRequest { + bytes receiver_key = 1; + bytes swap_hash = 2; + int64 amt = 3; + bytes private_hyperloop_id = 4; + int64 private_hyperloop_publish_time = 5; + string sweep_addr = 6; +} + +message RegisterHyperloopResponse { + bytes hyperloop_id = 1; + bytes server_key = 2; + int32 htlc_expiry = 3; + int32 hyperloop_expiry = 4; + int64 hyperloop_fee = 5; + string invoice = 6; +} + +message PushHyperloopHtlcNonceRequest { + bytes hyperloop_id = 1; + bytes swap_hash = 2; + bytes htlc_nonce = 3; +} + +message PushHyperloopHtlcNonceResponse { + bytes server_htlc_nonce = 1; + int64 htlc_fee_rate = 2; +} + +message PushHyperloopHtlcSigRequest { + bytes hyperloop_id = 1; + bytes swap_hash = 2; + bytes htlc_sig = 3; +} + +message PushHyperloopHtlcSigResponse { +} + +message PushHyperloopPreimageRequest { + bytes hyperloop_id = 1; + bytes preimage = 2; + bytes sweep_nonce = 3; +} + +message PushHyperloopPreimageResponse { + bytes server_sweep_nonce = 1; + int64 sweep_fee_rate = 2; +} + +message PushHyperloopSweeplessSweepSigRequest { + bytes hyperloop_id = 1; + bytes swap_hash = 2; + bytes sweep_sig = 3; +} + +message PushHyperloopSweeplessSweepSigResponse { +} \ No newline at end of file diff --git a/swapserverrpc/hyperloop_grpc.pb.go b/swapserverrpc/hyperloop_grpc.pb.go new file mode 100644 index 000000000..ff5511ce9 --- /dev/null +++ b/swapserverrpc/hyperloop_grpc.pb.go @@ -0,0 +1,309 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. + +package swapserverrpc + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +// HyperloopServerClient is the client API for HyperloopServer 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 HyperloopServerClient interface { + HyperloopNotificationStream(ctx context.Context, in *HyperloopNotificationStreamRequest, opts ...grpc.CallOption) (HyperloopServer_HyperloopNotificationStreamClient, error) + RegisterHyperloop(ctx context.Context, in *RegisterHyperloopRequest, opts ...grpc.CallOption) (*RegisterHyperloopResponse, error) + PushHyperloopHtlcNonce(ctx context.Context, in *PushHyperloopHtlcNonceRequest, opts ...grpc.CallOption) (*PushHyperloopHtlcNonceResponse, error) + PushHyperloopHtlcSig(ctx context.Context, in *PushHyperloopHtlcSigRequest, opts ...grpc.CallOption) (*PushHyperloopHtlcSigResponse, error) + PushHyperloopPreimage(ctx context.Context, in *PushHyperloopPreimageRequest, opts ...grpc.CallOption) (*PushHyperloopPreimageResponse, error) + PushHyperloopSweeplessSweepSig(ctx context.Context, in *PushHyperloopSweeplessSweepSigRequest, opts ...grpc.CallOption) (*PushHyperloopSweeplessSweepSigResponse, error) +} + +type hyperloopServerClient struct { + cc grpc.ClientConnInterface +} + +func NewHyperloopServerClient(cc grpc.ClientConnInterface) HyperloopServerClient { + return &hyperloopServerClient{cc} +} + +func (c *hyperloopServerClient) HyperloopNotificationStream(ctx context.Context, in *HyperloopNotificationStreamRequest, opts ...grpc.CallOption) (HyperloopServer_HyperloopNotificationStreamClient, error) { + stream, err := c.cc.NewStream(ctx, &HyperloopServer_ServiceDesc.Streams[0], "/looprpc.HyperloopServer/HyperloopNotificationStream", opts...) + if err != nil { + return nil, err + } + x := &hyperloopServerHyperloopNotificationStreamClient{stream} + if err := x.ClientStream.SendMsg(in); err != nil { + return nil, err + } + if err := x.ClientStream.CloseSend(); err != nil { + return nil, err + } + return x, nil +} + +type HyperloopServer_HyperloopNotificationStreamClient interface { + Recv() (*HyperloopNotificationStreamResponse, error) + grpc.ClientStream +} + +type hyperloopServerHyperloopNotificationStreamClient struct { + grpc.ClientStream +} + +func (x *hyperloopServerHyperloopNotificationStreamClient) Recv() (*HyperloopNotificationStreamResponse, error) { + m := new(HyperloopNotificationStreamResponse) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func (c *hyperloopServerClient) RegisterHyperloop(ctx context.Context, in *RegisterHyperloopRequest, opts ...grpc.CallOption) (*RegisterHyperloopResponse, error) { + out := new(RegisterHyperloopResponse) + err := c.cc.Invoke(ctx, "/looprpc.HyperloopServer/RegisterHyperloop", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *hyperloopServerClient) PushHyperloopHtlcNonce(ctx context.Context, in *PushHyperloopHtlcNonceRequest, opts ...grpc.CallOption) (*PushHyperloopHtlcNonceResponse, error) { + out := new(PushHyperloopHtlcNonceResponse) + err := c.cc.Invoke(ctx, "/looprpc.HyperloopServer/PushHyperloopHtlcNonce", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *hyperloopServerClient) PushHyperloopHtlcSig(ctx context.Context, in *PushHyperloopHtlcSigRequest, opts ...grpc.CallOption) (*PushHyperloopHtlcSigResponse, error) { + out := new(PushHyperloopHtlcSigResponse) + err := c.cc.Invoke(ctx, "/looprpc.HyperloopServer/PushHyperloopHtlcSig", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *hyperloopServerClient) PushHyperloopPreimage(ctx context.Context, in *PushHyperloopPreimageRequest, opts ...grpc.CallOption) (*PushHyperloopPreimageResponse, error) { + out := new(PushHyperloopPreimageResponse) + err := c.cc.Invoke(ctx, "/looprpc.HyperloopServer/PushHyperloopPreimage", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *hyperloopServerClient) PushHyperloopSweeplessSweepSig(ctx context.Context, in *PushHyperloopSweeplessSweepSigRequest, opts ...grpc.CallOption) (*PushHyperloopSweeplessSweepSigResponse, error) { + out := new(PushHyperloopSweeplessSweepSigResponse) + err := c.cc.Invoke(ctx, "/looprpc.HyperloopServer/PushHyperloopSweeplessSweepSig", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// HyperloopServerServer is the server API for HyperloopServer service. +// All implementations must embed UnimplementedHyperloopServerServer +// for forward compatibility +type HyperloopServerServer interface { + HyperloopNotificationStream(*HyperloopNotificationStreamRequest, HyperloopServer_HyperloopNotificationStreamServer) error + RegisterHyperloop(context.Context, *RegisterHyperloopRequest) (*RegisterHyperloopResponse, error) + PushHyperloopHtlcNonce(context.Context, *PushHyperloopHtlcNonceRequest) (*PushHyperloopHtlcNonceResponse, error) + PushHyperloopHtlcSig(context.Context, *PushHyperloopHtlcSigRequest) (*PushHyperloopHtlcSigResponse, error) + PushHyperloopPreimage(context.Context, *PushHyperloopPreimageRequest) (*PushHyperloopPreimageResponse, error) + PushHyperloopSweeplessSweepSig(context.Context, *PushHyperloopSweeplessSweepSigRequest) (*PushHyperloopSweeplessSweepSigResponse, error) + mustEmbedUnimplementedHyperloopServerServer() +} + +// UnimplementedHyperloopServerServer must be embedded to have forward compatible implementations. +type UnimplementedHyperloopServerServer struct { +} + +func (UnimplementedHyperloopServerServer) HyperloopNotificationStream(*HyperloopNotificationStreamRequest, HyperloopServer_HyperloopNotificationStreamServer) error { + return status.Errorf(codes.Unimplemented, "method HyperloopNotificationStream not implemented") +} +func (UnimplementedHyperloopServerServer) RegisterHyperloop(context.Context, *RegisterHyperloopRequest) (*RegisterHyperloopResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method RegisterHyperloop not implemented") +} +func (UnimplementedHyperloopServerServer) PushHyperloopHtlcNonce(context.Context, *PushHyperloopHtlcNonceRequest) (*PushHyperloopHtlcNonceResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method PushHyperloopHtlcNonce not implemented") +} +func (UnimplementedHyperloopServerServer) PushHyperloopHtlcSig(context.Context, *PushHyperloopHtlcSigRequest) (*PushHyperloopHtlcSigResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method PushHyperloopHtlcSig not implemented") +} +func (UnimplementedHyperloopServerServer) PushHyperloopPreimage(context.Context, *PushHyperloopPreimageRequest) (*PushHyperloopPreimageResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method PushHyperloopPreimage not implemented") +} +func (UnimplementedHyperloopServerServer) PushHyperloopSweeplessSweepSig(context.Context, *PushHyperloopSweeplessSweepSigRequest) (*PushHyperloopSweeplessSweepSigResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method PushHyperloopSweeplessSweepSig not implemented") +} +func (UnimplementedHyperloopServerServer) mustEmbedUnimplementedHyperloopServerServer() {} + +// UnsafeHyperloopServerServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to HyperloopServerServer will +// result in compilation errors. +type UnsafeHyperloopServerServer interface { + mustEmbedUnimplementedHyperloopServerServer() +} + +func RegisterHyperloopServerServer(s grpc.ServiceRegistrar, srv HyperloopServerServer) { + s.RegisterService(&HyperloopServer_ServiceDesc, srv) +} + +func _HyperloopServer_HyperloopNotificationStream_Handler(srv interface{}, stream grpc.ServerStream) error { + m := new(HyperloopNotificationStreamRequest) + if err := stream.RecvMsg(m); err != nil { + return err + } + return srv.(HyperloopServerServer).HyperloopNotificationStream(m, &hyperloopServerHyperloopNotificationStreamServer{stream}) +} + +type HyperloopServer_HyperloopNotificationStreamServer interface { + Send(*HyperloopNotificationStreamResponse) error + grpc.ServerStream +} + +type hyperloopServerHyperloopNotificationStreamServer struct { + grpc.ServerStream +} + +func (x *hyperloopServerHyperloopNotificationStreamServer) Send(m *HyperloopNotificationStreamResponse) error { + return x.ServerStream.SendMsg(m) +} + +func _HyperloopServer_RegisterHyperloop_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(RegisterHyperloopRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(HyperloopServerServer).RegisterHyperloop(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/looprpc.HyperloopServer/RegisterHyperloop", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(HyperloopServerServer).RegisterHyperloop(ctx, req.(*RegisterHyperloopRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _HyperloopServer_PushHyperloopHtlcNonce_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(PushHyperloopHtlcNonceRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(HyperloopServerServer).PushHyperloopHtlcNonce(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/looprpc.HyperloopServer/PushHyperloopHtlcNonce", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(HyperloopServerServer).PushHyperloopHtlcNonce(ctx, req.(*PushHyperloopHtlcNonceRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _HyperloopServer_PushHyperloopHtlcSig_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(PushHyperloopHtlcSigRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(HyperloopServerServer).PushHyperloopHtlcSig(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/looprpc.HyperloopServer/PushHyperloopHtlcSig", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(HyperloopServerServer).PushHyperloopHtlcSig(ctx, req.(*PushHyperloopHtlcSigRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _HyperloopServer_PushHyperloopPreimage_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(PushHyperloopPreimageRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(HyperloopServerServer).PushHyperloopPreimage(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/looprpc.HyperloopServer/PushHyperloopPreimage", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(HyperloopServerServer).PushHyperloopPreimage(ctx, req.(*PushHyperloopPreimageRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _HyperloopServer_PushHyperloopSweeplessSweepSig_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(PushHyperloopSweeplessSweepSigRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(HyperloopServerServer).PushHyperloopSweeplessSweepSig(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/looprpc.HyperloopServer/PushHyperloopSweeplessSweepSig", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(HyperloopServerServer).PushHyperloopSweeplessSweepSig(ctx, req.(*PushHyperloopSweeplessSweepSigRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// HyperloopServer_ServiceDesc is the grpc.ServiceDesc for HyperloopServer service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var HyperloopServer_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "looprpc.HyperloopServer", + HandlerType: (*HyperloopServerServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "RegisterHyperloop", + Handler: _HyperloopServer_RegisterHyperloop_Handler, + }, + { + MethodName: "PushHyperloopHtlcNonce", + Handler: _HyperloopServer_PushHyperloopHtlcNonce_Handler, + }, + { + MethodName: "PushHyperloopHtlcSig", + Handler: _HyperloopServer_PushHyperloopHtlcSig_Handler, + }, + { + MethodName: "PushHyperloopPreimage", + Handler: _HyperloopServer_PushHyperloopPreimage_Handler, + }, + { + MethodName: "PushHyperloopSweeplessSweepSig", + Handler: _HyperloopServer_PushHyperloopSweeplessSweepSig_Handler, + }, + }, + Streams: []grpc.StreamDesc{ + { + StreamName: "HyperloopNotificationStream", + Handler: _HyperloopServer_HyperloopNotificationStream_Handler, + ServerStreams: true, + }, + }, + Metadata: "hyperloop.proto", +} From 9b737a90329678e737ae2f7cd034705f7b0c94ef Mon Sep 17 00:00:00 2001 From: sputn1ck Date: Tue, 13 Aug 2024 12:32:33 +0200 Subject: [PATCH 07/11] looprpc: add hyperloop calls --- looprpc/client.pb.go | 814 +++++++++++++++++++++++++--------- looprpc/client.proto | 30 ++ looprpc/client.swagger.json | 39 ++ looprpc/client_grpc.pb.go | 72 +++ looprpc/swapclient.pb.json.go | 50 +++ 5 files changed, 789 insertions(+), 216 deletions(-) diff --git a/looprpc/client.pb.go b/looprpc/client.pb.go index d28d5682b..b95f58a2f 100644 --- a/looprpc/client.pb.go +++ b/looprpc/client.pb.go @@ -3873,6 +3873,280 @@ func (x *InstantOut) GetSweepTxId() string { return "" } +type HyperLoopOutRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Amt uint64 `protobuf:"varint,1,opt,name=amt,proto3" json:"amt,omitempty"` + Private bool `protobuf:"varint,2,opt,name=private,proto3" json:"private,omitempty"` + PrivatePublishTime int64 `protobuf:"varint,3,opt,name=private_publish_time,json=privatePublishTime,proto3" json:"private_publish_time,omitempty"` + CustomSweepAddr string `protobuf:"bytes,4,opt,name=custom_sweep_addr,json=customSweepAddr,proto3" json:"custom_sweep_addr,omitempty"` +} + +func (x *HyperLoopOutRequest) Reset() { + *x = HyperLoopOutRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_client_proto_msgTypes[43] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *HyperLoopOutRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*HyperLoopOutRequest) ProtoMessage() {} + +func (x *HyperLoopOutRequest) 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 HyperLoopOutRequest.ProtoReflect.Descriptor instead. +func (*HyperLoopOutRequest) Descriptor() ([]byte, []int) { + return file_client_proto_rawDescGZIP(), []int{43} +} + +func (x *HyperLoopOutRequest) GetAmt() uint64 { + if x != nil { + return x.Amt + } + return 0 +} + +func (x *HyperLoopOutRequest) GetPrivate() bool { + if x != nil { + return x.Private + } + return false +} + +func (x *HyperLoopOutRequest) GetPrivatePublishTime() int64 { + if x != nil { + return x.PrivatePublishTime + } + return 0 +} + +func (x *HyperLoopOutRequest) GetCustomSweepAddr() string { + if x != nil { + return x.CustomSweepAddr + } + return "" +} + +type HyperLoopOutResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + IdBytes []byte `protobuf:"bytes,1,opt,name=id_bytes,json=idBytes,proto3" json:"id_bytes,omitempty"` +} + +func (x *HyperLoopOutResponse) Reset() { + *x = HyperLoopOutResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_client_proto_msgTypes[44] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *HyperLoopOutResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*HyperLoopOutResponse) ProtoMessage() {} + +func (x *HyperLoopOutResponse) 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 HyperLoopOutResponse.ProtoReflect.Descriptor instead. +func (*HyperLoopOutResponse) Descriptor() ([]byte, []int) { + return file_client_proto_rawDescGZIP(), []int{44} +} + +func (x *HyperLoopOutResponse) GetIdBytes() []byte { + if x != nil { + return x.IdBytes + } + return nil +} + +type ListHyperLoopOutsRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *ListHyperLoopOutsRequest) Reset() { + *x = ListHyperLoopOutsRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_client_proto_msgTypes[45] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListHyperLoopOutsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListHyperLoopOutsRequest) ProtoMessage() {} + +func (x *ListHyperLoopOutsRequest) 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 ListHyperLoopOutsRequest.ProtoReflect.Descriptor instead. +func (*ListHyperLoopOutsRequest) Descriptor() ([]byte, []int) { + return file_client_proto_rawDescGZIP(), []int{45} +} + +type ListHyperLoopOutsResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Swaps []*HyperLoopOut `protobuf:"bytes,1,rep,name=swaps,proto3" json:"swaps,omitempty"` +} + +func (x *ListHyperLoopOutsResponse) Reset() { + *x = ListHyperLoopOutsResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_client_proto_msgTypes[46] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListHyperLoopOutsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListHyperLoopOutsResponse) ProtoMessage() {} + +func (x *ListHyperLoopOutsResponse) 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 ListHyperLoopOutsResponse.ProtoReflect.Descriptor instead. +func (*ListHyperLoopOutsResponse) Descriptor() ([]byte, []int) { + return file_client_proto_rawDescGZIP(), []int{46} +} + +func (x *ListHyperLoopOutsResponse) GetSwaps() []*HyperLoopOut { + if x != nil { + return x.Swaps + } + return nil +} + +type HyperLoopOut struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + IdBytes []byte `protobuf:"bytes,1,opt,name=id_bytes,json=idBytes,proto3" json:"id_bytes,omitempty"` + Amt uint64 `protobuf:"varint,2,opt,name=amt,proto3" json:"amt,omitempty"` + State string `protobuf:"bytes,3,opt,name=state,proto3" json:"state,omitempty"` + ServerMessage string `protobuf:"bytes,4,opt,name=server_message,json=serverMessage,proto3" json:"server_message,omitempty"` +} + +func (x *HyperLoopOut) Reset() { + *x = HyperLoopOut{} + if protoimpl.UnsafeEnabled { + mi := &file_client_proto_msgTypes[47] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *HyperLoopOut) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*HyperLoopOut) ProtoMessage() {} + +func (x *HyperLoopOut) 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 HyperLoopOut.ProtoReflect.Descriptor instead. +func (*HyperLoopOut) Descriptor() ([]byte, []int) { + return file_client_proto_rawDescGZIP(), []int{47} +} + +func (x *HyperLoopOut) GetIdBytes() []byte { + if x != nil { + return x.IdBytes + } + return nil +} + +func (x *HyperLoopOut) GetAmt() uint64 { + if x != nil { + return x.Amt + } + return 0 +} + +func (x *HyperLoopOut) GetState() string { + if x != nil { + return x.State + } + return "" +} + +func (x *HyperLoopOut) GetServerMessage() string { + if x != nil { + return x.ServerMessage + } + return "" +} + var File_client_proto protoreflect.FileDescriptor var file_client_proto_rawDesc = []byte{ @@ -4358,169 +4632,207 @@ var file_client_proto_rawDesc = []byte{ 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, 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, + 0x78, 0x49, 0x64, 0x22, 0x9f, 0x01, 0x0a, 0x13, 0x48, 0x79, 0x70, 0x65, 0x72, 0x4c, 0x6f, 0x6f, + 0x70, 0x4f, 0x75, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x61, + 0x6d, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x03, 0x61, 0x6d, 0x74, 0x12, 0x18, 0x0a, + 0x07, 0x70, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, + 0x70, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x12, 0x30, 0x0a, 0x14, 0x70, 0x72, 0x69, 0x76, 0x61, + 0x74, 0x65, 0x5f, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x73, 0x68, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x12, 0x70, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x50, 0x75, + 0x62, 0x6c, 0x69, 0x73, 0x68, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x2a, 0x0a, 0x11, 0x63, 0x75, 0x73, + 0x74, 0x6f, 0x6d, 0x5f, 0x73, 0x77, 0x65, 0x65, 0x70, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x18, 0x04, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x53, 0x77, 0x65, 0x65, + 0x70, 0x41, 0x64, 0x64, 0x72, 0x22, 0x31, 0x0a, 0x14, 0x48, 0x79, 0x70, 0x65, 0x72, 0x4c, 0x6f, + 0x6f, 0x70, 0x4f, 0x75, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x19, 0x0a, + 0x08, 0x69, 0x64, 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, + 0x07, 0x69, 0x64, 0x42, 0x79, 0x74, 0x65, 0x73, 0x22, 0x1a, 0x0a, 0x18, 0x4c, 0x69, 0x73, 0x74, + 0x48, 0x79, 0x70, 0x65, 0x72, 0x4c, 0x6f, 0x6f, 0x70, 0x4f, 0x75, 0x74, 0x73, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x22, 0x48, 0x0a, 0x19, 0x4c, 0x69, 0x73, 0x74, 0x48, 0x79, 0x70, 0x65, + 0x72, 0x4c, 0x6f, 0x6f, 0x70, 0x4f, 0x75, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x2b, 0x0a, 0x05, 0x73, 0x77, 0x61, 0x70, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, + 0x32, 0x15, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x48, 0x79, 0x70, 0x65, 0x72, + 0x4c, 0x6f, 0x6f, 0x70, 0x4f, 0x75, 0x74, 0x52, 0x05, 0x73, 0x77, 0x61, 0x70, 0x73, 0x22, 0x78, + 0x0a, 0x0c, 0x48, 0x79, 0x70, 0x65, 0x72, 0x4c, 0x6f, 0x6f, 0x70, 0x4f, 0x75, 0x74, 0x12, 0x19, + 0x0a, 0x08, 0x69, 0x64, 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, + 0x52, 0x07, 0x69, 0x64, 0x42, 0x79, 0x74, 0x65, 0x73, 0x12, 0x10, 0x0a, 0x03, 0x61, 0x6d, 0x74, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x03, 0x61, 0x6d, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x73, + 0x74, 0x61, 0x74, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x73, 0x74, 0x61, 0x74, + 0x65, 0x12, 0x25, 0x0a, 0x0e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x5f, 0x6d, 0x65, 0x73, 0x73, + 0x61, 0x67, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x73, 0x65, 0x72, 0x76, 0x65, + 0x72, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 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, 0x81, 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, 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, 0x4b, 0x0a, 0x0c, 0x48, 0x79, 0x70, 0x65, 0x72, 0x4c, 0x6f, 0x6f, + 0x70, 0x4f, 0x75, 0x74, 0x12, 0x1c, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x48, + 0x79, 0x70, 0x65, 0x72, 0x4c, 0x6f, 0x6f, 0x70, 0x4f, 0x75, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, 0x2e, 0x48, 0x79, 0x70, + 0x65, 0x72, 0x4c, 0x6f, 0x6f, 0x70, 0x4f, 0x75, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x5a, 0x0a, 0x11, 0x4c, 0x69, 0x73, 0x74, 0x48, 0x79, 0x70, 0x65, 0x72, 0x4c, 0x6f, + 0x6f, 0x70, 0x4f, 0x75, 0x74, 0x73, 0x12, 0x21, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, 0x72, 0x70, 0x63, + 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x48, 0x79, 0x70, 0x65, 0x72, 0x4c, 0x6f, 0x6f, 0x70, 0x4f, 0x75, + 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x22, 0x2e, 0x6c, 0x6f, 0x6f, 0x70, + 0x72, 0x70, 0x63, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x48, 0x79, 0x70, 0x65, 0x72, 0x4c, 0x6f, 0x6f, + 0x70, 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 ( @@ -4536,7 +4848,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, 48) var file_client_proto_goTypes = []any{ (AddressType)(0), // 0: looprpc.AddressType (SwapType)(0), // 1: looprpc.SwapType @@ -4588,19 +4900,24 @@ var file_client_proto_goTypes = []any{ (*ListInstantOutsRequest)(nil), // 47: looprpc.ListInstantOutsRequest (*ListInstantOutsResponse)(nil), // 48: looprpc.ListInstantOutsResponse (*InstantOut)(nil), // 49: looprpc.InstantOut - (*swapserverrpc.RouteHint)(nil), // 50: looprpc.RouteHint + (*HyperLoopOutRequest)(nil), // 50: looprpc.HyperLoopOutRequest + (*HyperLoopOutResponse)(nil), // 51: looprpc.HyperLoopOutResponse + (*ListHyperLoopOutsRequest)(nil), // 52: looprpc.ListHyperLoopOutsRequest + (*ListHyperLoopOutsResponse)(nil), // 53: looprpc.ListHyperLoopOutsResponse + (*HyperLoopOut)(nil), // 54: looprpc.HyperLoopOut + (*swapserverrpc.RouteHint)(nil), // 55: 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 + 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 - 50, // 8: looprpc.QuoteRequest.loop_in_route_hints:type_name -> looprpc.RouteHint - 50, // 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 @@ -4615,53 +4932,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 - 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 + 54, // 24: looprpc.ListHyperLoopOutsResponse.swaps:type_name -> looprpc.HyperLoopOut + 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.SwapClient.HyperLoopOut:input_type -> looprpc.HyperLoopOutRequest + 52, // 47: looprpc.SwapClient.ListHyperLoopOuts:input_type -> looprpc.ListHyperLoopOutsRequest + 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.SwapClient.HyperLoopOut:output_type -> looprpc.HyperLoopOutResponse + 53, // 70: looprpc.SwapClient.ListHyperLoopOuts:output_type -> looprpc.ListHyperLoopOutsResponse + 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() } @@ -5186,6 +5508,66 @@ func file_client_proto_init() { return nil } } + file_client_proto_msgTypes[43].Exporter = func(v any, i int) any { + switch v := v.(*HyperLoopOutRequest); 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 any, i int) any { + switch v := v.(*HyperLoopOutResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_client_proto_msgTypes[45].Exporter = func(v any, i int) any { + switch v := v.(*ListHyperLoopOutsRequest); 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 any, i int) any { + switch v := v.(*ListHyperLoopOutsResponse); 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 any, i int) any { + switch v := v.(*HyperLoopOut); 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{ @@ -5193,7 +5575,7 @@ func file_client_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_client_proto_rawDesc, NumEnums: 7, - NumMessages: 43, + NumMessages: 48, NumExtensions: 0, NumServices: 1, }, diff --git a/looprpc/client.proto b/looprpc/client.proto index 24c5df3ea..1335dc218 100644 --- a/looprpc/client.proto +++ b/looprpc/client.proto @@ -143,6 +143,11 @@ service SwapClient { */ rpc ListInstantOuts (ListInstantOutsRequest) returns (ListInstantOutsResponse); + + rpc HyperLoopOut (HyperLoopOutRequest) returns (HyperLoopOutResponse); + + rpc ListHyperLoopOuts (ListHyperLoopOutsRequest) + returns (ListHyperLoopOutsResponse); } message LoopOutRequest { @@ -1440,3 +1445,28 @@ message InstantOut { */ string sweep_tx_id = 5; } + +message HyperLoopOutRequest { + uint64 amt = 1; + bool private = 2; + int64 private_publish_time = 3; + string custom_sweep_addr = 4; +} + +message HyperLoopOutResponse { + bytes id_bytes = 1; +} + +message ListHyperLoopOutsRequest { +} + +message ListHyperLoopOutsResponse { + repeated HyperLoopOut swaps = 1; +} + +message HyperLoopOut { + bytes id_bytes = 1; + uint64 amt = 2; + string state = 3; + string server_message = 4; +} \ No newline at end of file diff --git a/looprpc/client.swagger.json b/looprpc/client.swagger.json index 2b92b6804..99021899c 100644 --- a/looprpc/client.swagger.json +++ b/looprpc/client.swagger.json @@ -743,6 +743,34 @@ } } }, + "looprpcHyperLoopOut": { + "type": "object", + "properties": { + "id_bytes": { + "type": "string", + "format": "byte" + }, + "amt": { + "type": "string", + "format": "uint64" + }, + "state": { + "type": "string" + }, + "server_message": { + "type": "string" + } + } + }, + "looprpcHyperLoopOutResponse": { + "type": "object", + "properties": { + "id_bytes": { + "type": "string", + "format": "byte" + } + } + }, "looprpcInQuoteResponse": { "type": "object", "properties": { @@ -1057,6 +1085,17 @@ ], "default": "UNKNOWN" }, + "looprpcListHyperLoopOutsResponse": { + "type": "object", + "properties": { + "swaps": { + "type": "array", + "items": { + "$ref": "#/definitions/looprpcHyperLoopOut" + } + } + } + }, "looprpcListInstantOutsResponse": { "type": "object", "properties": { diff --git a/looprpc/client_grpc.pb.go b/looprpc/client_grpc.pb.go index f5bd1489f..6d23eb6be 100644 --- a/looprpc/client_grpc.pb.go +++ b/looprpc/client_grpc.pb.go @@ -102,6 +102,8 @@ 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) + HyperLoopOut(ctx context.Context, in *HyperLoopOutRequest, opts ...grpc.CallOption) (*HyperLoopOutResponse, error) + ListHyperLoopOuts(ctx context.Context, in *ListHyperLoopOutsRequest, opts ...grpc.CallOption) (*ListHyperLoopOutsResponse, error) } type swapClientClient struct { @@ -324,6 +326,24 @@ func (c *swapClientClient) ListInstantOuts(ctx context.Context, in *ListInstantO return out, nil } +func (c *swapClientClient) HyperLoopOut(ctx context.Context, in *HyperLoopOutRequest, opts ...grpc.CallOption) (*HyperLoopOutResponse, error) { + out := new(HyperLoopOutResponse) + err := c.cc.Invoke(ctx, "/looprpc.SwapClient/HyperLoopOut", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *swapClientClient) ListHyperLoopOuts(ctx context.Context, in *ListHyperLoopOutsRequest, opts ...grpc.CallOption) (*ListHyperLoopOutsResponse, error) { + out := new(ListHyperLoopOutsResponse) + err := c.cc.Invoke(ctx, "/looprpc.SwapClient/ListHyperLoopOuts", 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 +432,8 @@ type SwapClientServer interface { // ListInstantOuts returns a list of all currently known instant out swaps and // their current status. ListInstantOuts(context.Context, *ListInstantOutsRequest) (*ListInstantOutsResponse, error) + HyperLoopOut(context.Context, *HyperLoopOutRequest) (*HyperLoopOutResponse, error) + ListHyperLoopOuts(context.Context, *ListHyperLoopOutsRequest) (*ListHyperLoopOutsResponse, error) mustEmbedUnimplementedSwapClientServer() } @@ -482,6 +504,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) HyperLoopOut(context.Context, *HyperLoopOutRequest) (*HyperLoopOutResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method HyperLoopOut not implemented") +} +func (UnimplementedSwapClientServer) ListHyperLoopOuts(context.Context, *ListHyperLoopOutsRequest) (*ListHyperLoopOutsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ListHyperLoopOuts not implemented") +} func (UnimplementedSwapClientServer) mustEmbedUnimplementedSwapClientServer() {} // UnsafeSwapClientServer may be embedded to opt out of forward compatibility for this service. @@ -876,6 +904,42 @@ func _SwapClient_ListInstantOuts_Handler(srv interface{}, ctx context.Context, d return interceptor(ctx, in, info, handler) } +func _SwapClient_HyperLoopOut_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(HyperLoopOutRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SwapClientServer).HyperLoopOut(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/looprpc.SwapClient/HyperLoopOut", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SwapClientServer).HyperLoopOut(ctx, req.(*HyperLoopOutRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _SwapClient_ListHyperLoopOuts_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ListHyperLoopOutsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SwapClientServer).ListHyperLoopOuts(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/looprpc.SwapClient/ListHyperLoopOuts", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SwapClientServer).ListHyperLoopOuts(ctx, req.(*ListHyperLoopOutsRequest)) + } + 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 +1027,14 @@ var SwapClient_ServiceDesc = grpc.ServiceDesc{ MethodName: "ListInstantOuts", Handler: _SwapClient_ListInstantOuts_Handler, }, + { + MethodName: "HyperLoopOut", + Handler: _SwapClient_HyperLoopOut_Handler, + }, + { + MethodName: "ListHyperLoopOuts", + Handler: _SwapClient_ListHyperLoopOuts_Handler, + }, }, Streams: []grpc.StreamDesc{ { diff --git a/looprpc/swapclient.pb.json.go b/looprpc/swapclient.pb.json.go index fd57a4e2b..93cfea565 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.HyperLoopOut"] = func(ctx context.Context, + conn *grpc.ClientConn, reqJSON string, callback func(string, error)) { + + req := &HyperLoopOutRequest{} + err := marshaler.Unmarshal([]byte(reqJSON), req) + if err != nil { + callback("", err) + return + } + + client := NewSwapClientClient(conn) + resp, err := client.HyperLoopOut(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.ListHyperLoopOuts"] = func(ctx context.Context, + conn *grpc.ClientConn, reqJSON string, callback func(string, error)) { + + req := &ListHyperLoopOutsRequest{} + err := marshaler.Unmarshal([]byte(reqJSON), req) + if err != nil { + callback("", err) + return + } + + client := NewSwapClientClient(conn) + resp, err := client.ListHyperLoopOuts(ctx, req) + if err != nil { + callback("", err) + return + } + + respBytes, err := marshaler.Marshal(resp) + if err != nil { + callback("", err) + return + } + callback(string(respBytes), nil) + } } From 82a4e7b289f4a40caed0d2ce135a5fc128b145a9 Mon Sep 17 00:00:00 2001 From: sputn1ck Date: Tue, 13 Aug 2024 12:33:38 +0200 Subject: [PATCH 08/11] loopd: add hyperloop manager --- loopd/daemon.go | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/loopd/daemon.go b/loopd/daemon.go index 12e2c2192..eeaec0519 100644 --- a/loopd/daemon.go +++ b/loopd/daemon.go @@ -16,6 +16,7 @@ import ( proxy "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" "github.com/lightninglabs/lndclient" "github.com/lightninglabs/loop" + "github.com/lightninglabs/loop/hyperloop" "github.com/lightninglabs/loop/instantout" "github.com/lightninglabs/loop/instantout/reservation" "github.com/lightninglabs/loop/loopd/perms" @@ -441,6 +442,11 @@ func (d *Daemon) initialize(withMacaroonService bool) error { swapClient.Conn, ) + // Create a hyperloop server client. + hyperloopClient := loop_swaprpc.NewHyperloopServerClient( + 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()) @@ -501,6 +507,7 @@ func (d *Daemon) initialize(withMacaroonService bool) error { var ( reservationManager *reservation.Manager instantOutManager *instantout.Manager + hyperloopManager *hyperloop.Manager ) // Create the reservation and instantout managers. if d.cfg.EnableExperimental { @@ -540,6 +547,15 @@ func (d *Daemon) initialize(withMacaroonService bool) error { instantOutManager = instantout.NewInstantOutManager( instantOutConfig, ) + + hyperloopConfig := &hyperloop.Config{ + Wallet: d.lnd.WalletKit, + ChainNotifier: d.lnd.ChainNotifier, + Signer: d.lnd.Signer, + Router: d.lnd.Router, + HyperloopClient: hyperloopClient, + } + hyperloopManager = hyperloop.NewManager(hyperloopConfig) } // Now finally fully initialize the swap client RPC server instance. @@ -555,6 +571,7 @@ func (d *Daemon) initialize(withMacaroonService bool) error { mainCtx: d.mainCtx, reservationManager: reservationManager, instantOutManager: instantOutManager, + hyperloopManager: hyperloopManager, } // Retrieve all currently existing swaps from the database. @@ -684,6 +701,23 @@ func (d *Daemon) initialize(withMacaroonService bool) error { } } + // Start the hyperloop manager. + if d.hyperloopManager != nil { + d.wg.Add(1) + go func() { + defer d.wg.Done() + + log.Info("Starting hyperloop manager") + defer log.Info("Hyperloop manager stopped") + + err := d.hyperloopManager.Run(d.mainCtx) + if err != nil && !errors.Is(err, context.Canceled) { + log.Errorf("Error running hyperloop manager: %v", err) + d.internalErrChan <- err + } + }() + } + // Last, start our internal error handler. This will return exactly one // error or nil on the main error channel to inform the caller that // something went wrong or that shutdown is complete. We don't add to From 29980357629ac9f48fe6faae6f592416e43890d0 Mon Sep 17 00:00:00 2001 From: sputn1ck Date: Tue, 13 Aug 2024 12:34:08 +0200 Subject: [PATCH 09/11] loopd: add hyperloop rpc call --- loopd/perms/perms.go | 4 ++++ loopd/swapclient_server.go | 20 ++++++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/loopd/perms/perms.go b/loopd/perms/perms.go index 8958c233e..0636e39ad 100644 --- a/loopd/perms/perms.go +++ b/loopd/perms/perms.go @@ -116,4 +116,8 @@ var RequiredPermissions = map[string][]bakery.Op{ Entity: "swap", Action: "read", }}, + "/looprpc.SwapClient/HyperLoopOut": {{ + Entity: "swap", + Action: "write", + }}, } diff --git a/loopd/swapclient_server.go b/loopd/swapclient_server.go index cdcd9b91e..8bc74d102 100644 --- a/loopd/swapclient_server.go +++ b/loopd/swapclient_server.go @@ -18,6 +18,7 @@ import ( "github.com/lightninglabs/aperture/l402" "github.com/lightninglabs/lndclient" "github.com/lightninglabs/loop" + "github.com/lightninglabs/loop/hyperloop" "github.com/lightninglabs/loop/instantout" "github.com/lightninglabs/loop/instantout/reservation" "github.com/lightninglabs/loop/labels" @@ -83,6 +84,7 @@ type swapClientServer struct { lnd *lndclient.LndServices reservationManager *reservation.Manager instantOutManager *instantout.Manager + hyperloopManager *hyperloop.Manager swaps map[lntypes.Hash]loop.SwapInfo subscribers map[int]chan<- interface{} statusChan chan loop.SwapInfo @@ -91,6 +93,24 @@ type swapClientServer struct { mainCtx context.Context } +func (s *swapClientServer) HyperLoopOut(ctx context.Context, + req *clientrpc.HyperLoopOutRequest) ( + *clientrpc.HyperLoopOutResponse, error) { + + log.Infof("HyperLoop out request received") + + hyperloop, err := s.hyperloopManager.NewHyperLoopOut( + ctx, btcutil.Amount(req.Amt), req.CustomSweepAddr, + ) + if err != nil { + return nil, err + } + + return &clientrpc.HyperLoopOutResponse{ + IdBytes: hyperloop.ID[:], + }, nil +} + // LoopOut initiates a 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 LoopOutStatus stream that is returned from From 41b6062bf1ba4e8df089ba57ebc1039dec31853a Mon Sep 17 00:00:00 2001 From: sputn1ck Date: Tue, 13 Aug 2024 12:34:21 +0200 Subject: [PATCH 10/11] loopcli: add hyperloop cmd --- cmd/loop/hyperloop.go | 77 +++++++++++++++++++++++++++++++++++++++++++ cmd/loop/main.go | 2 +- 2 files changed, 78 insertions(+), 1 deletion(-) create mode 100644 cmd/loop/hyperloop.go diff --git a/cmd/loop/hyperloop.go b/cmd/loop/hyperloop.go new file mode 100644 index 000000000..bb7e4095a --- /dev/null +++ b/cmd/loop/hyperloop.go @@ -0,0 +1,77 @@ +package main + +import ( + "context" + + "github.com/lightninglabs/loop/looprpc" + "github.com/urfave/cli" +) + +var hyperloopCommand = cli.Command{ + Name: "hyperloop", + Usage: "perform a fee optimized off-chain to on-chain swap (hyperloop)", + Description: ` + + `, + ArgsUsage: "amt", + Flags: []cli.Flag{ + cli.Uint64Flag{ + Name: "amt", + Usage: "the amount in satoshis to loop out. To check " + + "for the minimum and maximum amounts to loop " + + "out please consult \"loop terms\"", + }, + cli.StringFlag{ + Name: "addr", + Usage: "the optional address that the looped out funds " + + "should be sent to, if let blank the funds " + + "will go to lnd's wallet", + }, + }, + + Action: hyperloop, +} + +func hyperloop(ctx *cli.Context) error { + args := ctx.Args() + + var amtStr string + switch { + case ctx.IsSet("amt"): + amtStr = ctx.String("amt") + case ctx.NArg() > 0: + amtStr = args[0] + args = args.Tail() + default: + // Show command help if no arguments and flags were provided. + return cli.ShowCommandHelp(ctx, "hyperloop") + } + + amt, err := parseAmt(amtStr) + if err != nil { + return err + } + + // First set up the swap client itself. + client, cleanup, err := getClient(ctx) + if err != nil { + return err + } + defer cleanup() + ctxb := context.Background() + + hyperloopRes, err := client.HyperLoopOut( + ctxb, + &looprpc.HyperLoopOutRequest{ + Amt: uint64(amt), + CustomSweepAddr: ctx.String("addr"), + }, + ) + if err != nil { + return err + } + + printJSON(hyperloopRes) + + return nil +} diff --git a/cmd/loop/main.go b/cmd/loop/main.go index 83a849205..279f79abc 100644 --- a/cmd/loop/main.go +++ b/cmd/loop/main.go @@ -148,7 +148,7 @@ func main() { listSwapsCommand, swapInfoCommand, getLiquidityParamsCommand, setLiquidityRuleCommand, suggestSwapCommand, setParamsCommand, getInfoCommand, abandonSwapCommand, reservationsCommands, - instantOutCommand, listInstantOutsCommand, + instantOutCommand, listInstantOutsCommand, hyperloopCommand, } err := app.Run(os.Args) From 3fcef218852dfe645d8e1e1f9525682660d20c5d Mon Sep 17 00:00:00 2001 From: sputn1ck Date: Tue, 13 Aug 2024 12:36:28 +0200 Subject: [PATCH 11/11] fsm: add hyperloop fsm --- fsm/stateparser/stateparser.go | 8 ++++++ hyperloop/fsm.md | 45 ++++++++++++++++++++++++++++++++++ scripts/fsm-generate.sh | 3 ++- 3 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 hyperloop/fsm.md diff --git a/fsm/stateparser/stateparser.go b/fsm/stateparser/stateparser.go index d70645230..a816768bc 100644 --- a/fsm/stateparser/stateparser.go +++ b/fsm/stateparser/stateparser.go @@ -10,6 +10,7 @@ import ( "sort" "github.com/lightninglabs/loop/fsm" + "github.com/lightninglabs/loop/hyperloop" "github.com/lightninglabs/loop/instantout" "github.com/lightninglabs/loop/instantout/reservation" ) @@ -57,6 +58,13 @@ func run() error { return err } + case "hyperloop": + hyperloop := hyperloop.FSM{} + err = writeMermaidFile(fp, hyperloop.GetStateMap()) + if err != nil { + return err + } + default: fmt.Println("Missing or wrong argument: fsm must be one of:") fmt.Println("\treservations") diff --git a/hyperloop/fsm.md b/hyperloop/fsm.md new file mode 100644 index 000000000..3151632f5 --- /dev/null +++ b/hyperloop/fsm.md @@ -0,0 +1,45 @@ +```mermaid +stateDiagram-v2 +[*] --> Init: OnStart +Failed +Init +Init --> Registering: OnInit +Init --> Failed: OnError +PubslishSweep +PubslishSweep --> WaitForSweepConfirmation: OnSweeplessSweepPublish +PubslishSweep --> Failed: OnError +PushHtlcNonce +PushHtlcNonce --> WaitForReadyForHtlcSig: OnPushedHtlcNonce +PushHtlcNonce --> Failed: OnError +PushHtlcSig +PushHtlcSig --> WaitForHtlcSig: OnPushedHtlcSig +PushHtlcSig --> Failed: OnError +PushPreimage +PushPreimage --> WaitForReadyForSweeplessSweepSig: OnPushedPreimage +PushPreimage --> Failed: OnError +PushSweeplessSweepSig +PushSweeplessSweepSig --> PubslishSweep: OnPushedSweeplessSweepSig +PushSweeplessSweepSig --> Failed: OnError +Registering +Registering --> WaitForPublish: OnRegistered +Registering --> Failed: OnError +SweepConfirmed +WaitForConfirmation +WaitForConfirmation --> PushHtlcNonce: OnConfirmed +WaitForConfirmation --> Failed: OnError +WaitForHtlcSig +WaitForHtlcSig --> PushPreimage: OnReceivedHtlcSig +WaitForHtlcSig --> Failed: OnError +WaitForPublish +WaitForPublish --> WaitForConfirmation: OnPublished +WaitForPublish --> Failed: OnError +WaitForReadyForHtlcSig +WaitForReadyForHtlcSig --> PushHtlcSig: OnReadyForHtlcSig +WaitForReadyForHtlcSig --> Failed: OnError +WaitForReadyForSweeplessSweepSig +WaitForReadyForSweeplessSweepSig --> PushSweeplessSweepSig: OnReadyForSweeplessSweepSig +WaitForReadyForSweeplessSweepSig --> Failed: OnError +WaitForSweepConfirmation +WaitForSweepConfirmation --> SweepConfirmed: OnSweeplessSweepConfirmed +WaitForSweepConfirmation --> Failed: OnError +``` \ No newline at end of file diff --git a/scripts/fsm-generate.sh b/scripts/fsm-generate.sh index 4ab2d74cb..cb797c259 100755 --- a/scripts/fsm-generate.sh +++ b/scripts/fsm-generate.sh @@ -1,4 +1,5 @@ #!/usr/bin/env bash go run ./fsm/stateparser/stateparser.go --out ./fsm/example_fsm.md --fsm example go run ./fsm/stateparser/stateparser.go --out ./reservation/reservation_fsm.md --fsm reservation -go run ./fsm/stateparser/stateparser.go --out ./instantout/fsm.md --fsm instantout \ No newline at end of file +go run ./fsm/stateparser/stateparser.go --out ./instantout/fsm.md --fsm instantout +go run ./fsm/stateparser/stateparser.go --out ./hyperloop/fsm.md --fsm hyperloop \ No newline at end of file