mirror of
https://github.com/lightninglabs/loop.git
synced 2026-08-13 12:33:03 +02:00
Merge pull request #186 from joostjager/report-version
multi: report protocol version
This commit is contained in:
commit
b054e84eb2
3 changed files with 225 additions and 89 deletions
|
|
@ -23,15 +23,49 @@ var _ = math.Inf
|
|||
// proto package needs to be updated.
|
||||
const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
|
||||
|
||||
//*
|
||||
//This enum defines the protocol versions that clients may adhere to. Note that
|
||||
//this is not a flagged enum. If a particular protocol version adds a feature,
|
||||
//then in general all the preceding features are also supported. Exception to this
|
||||
//is when features get deprecated.
|
||||
type ProtocolVersion int32
|
||||
|
||||
const (
|
||||
/// No protocol version reported at all.
|
||||
ProtocolVersion_LEGACY ProtocolVersion = 0
|
||||
/// Client may attempt to send the loop out payment in multiple parts.
|
||||
ProtocolVersion_MULTI_LOOP_OUT ProtocolVersion = 1
|
||||
)
|
||||
|
||||
var ProtocolVersion_name = map[int32]string{
|
||||
0: "LEGACY",
|
||||
1: "MULTI_LOOP_OUT",
|
||||
}
|
||||
|
||||
var ProtocolVersion_value = map[string]int32{
|
||||
"LEGACY": 0,
|
||||
"MULTI_LOOP_OUT": 1,
|
||||
}
|
||||
|
||||
func (x ProtocolVersion) String() string {
|
||||
return proto.EnumName(ProtocolVersion_name, int32(x))
|
||||
}
|
||||
|
||||
func (ProtocolVersion) EnumDescriptor() ([]byte, []int) {
|
||||
return fileDescriptor_ad098daeda4239f7, []int{0}
|
||||
}
|
||||
|
||||
type ServerLoopOutRequest struct {
|
||||
ReceiverKey []byte `protobuf:"bytes,1,opt,name=receiver_key,json=receiverKey,proto3" json:"receiver_key,omitempty"`
|
||||
SwapHash []byte `protobuf:"bytes,2,opt,name=swap_hash,json=swapHash,proto3" json:"swap_hash,omitempty"`
|
||||
Amt uint64 `protobuf:"varint,3,opt,name=amt,proto3" json:"amt,omitempty"`
|
||||
/// The unix time in seconds we want the on-chain swap to be published by.
|
||||
SwapPublicationDeadline int64 `protobuf:"varint,4,opt,name=swap_publication_deadline,json=swapPublicationDeadline,proto3" json:"swap_publication_deadline,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
SwapPublicationDeadline int64 `protobuf:"varint,4,opt,name=swap_publication_deadline,json=swapPublicationDeadline,proto3" json:"swap_publication_deadline,omitempty"`
|
||||
/// The protocol version that the client adheres to.
|
||||
ProtocolVersion ProtocolVersion `protobuf:"varint,5,opt,name=protocol_version,json=protocolVersion,proto3,enum=looprpc.ProtocolVersion" json:"protocol_version,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *ServerLoopOutRequest) Reset() { *m = ServerLoopOutRequest{} }
|
||||
|
|
@ -87,6 +121,13 @@ func (m *ServerLoopOutRequest) GetSwapPublicationDeadline() int64 {
|
|||
return 0
|
||||
}
|
||||
|
||||
func (m *ServerLoopOutRequest) GetProtocolVersion() ProtocolVersion {
|
||||
if m != nil {
|
||||
return m.ProtocolVersion
|
||||
}
|
||||
return ProtocolVersion_LEGACY
|
||||
}
|
||||
|
||||
type ServerLoopOutResponse struct {
|
||||
SwapInvoice string `protobuf:"bytes,1,opt,name=swap_invoice,json=swapInvoice,proto3" json:"swap_invoice,omitempty"`
|
||||
PrepayInvoice string `protobuf:"bytes,2,opt,name=prepay_invoice,json=prepayInvoice,proto3" json:"prepay_invoice,omitempty"`
|
||||
|
|
@ -154,10 +195,12 @@ type ServerLoopOutQuoteRequest struct {
|
|||
/// The swap amount. If zero, a quote for a maximum amt swap will be given.
|
||||
Amt uint64 `protobuf:"varint,1,opt,name=amt,proto3" json:"amt,omitempty"`
|
||||
/// The unix time in seconds we want the on-chain swap to be published by.
|
||||
SwapPublicationDeadline int64 `protobuf:"varint,2,opt,name=swap_publication_deadline,json=swapPublicationDeadline,proto3" json:"swap_publication_deadline,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
SwapPublicationDeadline int64 `protobuf:"varint,2,opt,name=swap_publication_deadline,json=swapPublicationDeadline,proto3" json:"swap_publication_deadline,omitempty"`
|
||||
/// The protocol version that the client adheres to.
|
||||
ProtocolVersion ProtocolVersion `protobuf:"varint,3,opt,name=protocol_version,json=protocolVersion,proto3,enum=looprpc.ProtocolVersion" json:"protocol_version,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *ServerLoopOutQuoteRequest) Reset() { *m = ServerLoopOutQuoteRequest{} }
|
||||
|
|
@ -199,6 +242,13 @@ func (m *ServerLoopOutQuoteRequest) GetSwapPublicationDeadline() int64 {
|
|||
return 0
|
||||
}
|
||||
|
||||
func (m *ServerLoopOutQuoteRequest) GetProtocolVersion() ProtocolVersion {
|
||||
if m != nil {
|
||||
return m.ProtocolVersion
|
||||
}
|
||||
return ProtocolVersion_LEGACY
|
||||
}
|
||||
|
||||
type ServerLoopOutQuote struct {
|
||||
SwapPaymentDest string `protobuf:"bytes,1,opt,name=swap_payment_dest,json=swapPaymentDest,proto3" json:"swap_payment_dest,omitempty"`
|
||||
/// The total estimated swap fee given the quote amt.
|
||||
|
|
@ -292,9 +342,11 @@ func (m *ServerLoopOutQuote) GetCltvDelta() int32 {
|
|||
}
|
||||
|
||||
type ServerLoopOutTermsRequest struct {
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
/// The protocol version that the client adheres to.
|
||||
ProtocolVersion ProtocolVersion `protobuf:"varint,1,opt,name=protocol_version,json=protocolVersion,proto3,enum=looprpc.ProtocolVersion" json:"protocol_version,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *ServerLoopOutTermsRequest) Reset() { *m = ServerLoopOutTermsRequest{} }
|
||||
|
|
@ -322,6 +374,13 @@ func (m *ServerLoopOutTermsRequest) XXX_DiscardUnknown() {
|
|||
|
||||
var xxx_messageInfo_ServerLoopOutTermsRequest proto.InternalMessageInfo
|
||||
|
||||
func (m *ServerLoopOutTermsRequest) GetProtocolVersion() ProtocolVersion {
|
||||
if m != nil {
|
||||
return m.ProtocolVersion
|
||||
}
|
||||
return ProtocolVersion_LEGACY
|
||||
}
|
||||
|
||||
type ServerLoopOutTerms struct {
|
||||
MinSwapAmount uint64 `protobuf:"varint,1,opt,name=min_swap_amount,json=minSwapAmount,proto3" json:"min_swap_amount,omitempty"`
|
||||
MaxSwapAmount uint64 `protobuf:"varint,2,opt,name=max_swap_amount,json=maxSwapAmount,proto3" json:"max_swap_amount,omitempty"`
|
||||
|
|
@ -370,14 +429,16 @@ func (m *ServerLoopOutTerms) GetMaxSwapAmount() uint64 {
|
|||
}
|
||||
|
||||
type ServerLoopInRequest struct {
|
||||
SenderKey []byte `protobuf:"bytes,1,opt,name=sender_key,json=senderKey,proto3" json:"sender_key,omitempty"`
|
||||
SwapHash []byte `protobuf:"bytes,2,opt,name=swap_hash,json=swapHash,proto3" json:"swap_hash,omitempty"`
|
||||
Amt uint64 `protobuf:"varint,3,opt,name=amt,proto3" json:"amt,omitempty"`
|
||||
SwapInvoice string `protobuf:"bytes,4,opt,name=swap_invoice,json=swapInvoice,proto3" json:"swap_invoice,omitempty"`
|
||||
LastHop []byte `protobuf:"bytes,5,opt,name=last_hop,json=lastHop,proto3" json:"last_hop,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
SenderKey []byte `protobuf:"bytes,1,opt,name=sender_key,json=senderKey,proto3" json:"sender_key,omitempty"`
|
||||
SwapHash []byte `protobuf:"bytes,2,opt,name=swap_hash,json=swapHash,proto3" json:"swap_hash,omitempty"`
|
||||
Amt uint64 `protobuf:"varint,3,opt,name=amt,proto3" json:"amt,omitempty"`
|
||||
SwapInvoice string `protobuf:"bytes,4,opt,name=swap_invoice,json=swapInvoice,proto3" json:"swap_invoice,omitempty"`
|
||||
LastHop []byte `protobuf:"bytes,5,opt,name=last_hop,json=lastHop,proto3" json:"last_hop,omitempty"`
|
||||
/// The protocol version that the client adheres to.
|
||||
ProtocolVersion ProtocolVersion `protobuf:"varint,6,opt,name=protocol_version,json=protocolVersion,proto3,enum=looprpc.ProtocolVersion" json:"protocol_version,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *ServerLoopInRequest) Reset() { *m = ServerLoopInRequest{} }
|
||||
|
|
@ -440,6 +501,13 @@ func (m *ServerLoopInRequest) GetLastHop() []byte {
|
|||
return nil
|
||||
}
|
||||
|
||||
func (m *ServerLoopInRequest) GetProtocolVersion() ProtocolVersion {
|
||||
if m != nil {
|
||||
return m.ProtocolVersion
|
||||
}
|
||||
return ProtocolVersion_LEGACY
|
||||
}
|
||||
|
||||
type ServerLoopInResponse struct {
|
||||
ReceiverKey []byte `protobuf:"bytes,1,opt,name=receiver_key,json=receiverKey,proto3" json:"receiver_key,omitempty"`
|
||||
Expiry int32 `protobuf:"varint,2,opt,name=expiry,proto3" json:"expiry,omitempty"`
|
||||
|
|
@ -489,10 +557,12 @@ func (m *ServerLoopInResponse) GetExpiry() int32 {
|
|||
|
||||
type ServerLoopInQuoteRequest struct {
|
||||
/// The swap amount. If zero, a quote for a maximum amt swap will be given.
|
||||
Amt uint64 `protobuf:"varint,1,opt,name=amt,proto3" json:"amt,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
Amt uint64 `protobuf:"varint,1,opt,name=amt,proto3" json:"amt,omitempty"`
|
||||
/// The protocol version that the client adheres to.
|
||||
ProtocolVersion ProtocolVersion `protobuf:"varint,2,opt,name=protocol_version,json=protocolVersion,proto3,enum=looprpc.ProtocolVersion" json:"protocol_version,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *ServerLoopInQuoteRequest) Reset() { *m = ServerLoopInQuoteRequest{} }
|
||||
|
|
@ -527,6 +597,13 @@ func (m *ServerLoopInQuoteRequest) GetAmt() uint64 {
|
|||
return 0
|
||||
}
|
||||
|
||||
func (m *ServerLoopInQuoteRequest) GetProtocolVersion() ProtocolVersion {
|
||||
if m != nil {
|
||||
return m.ProtocolVersion
|
||||
}
|
||||
return ProtocolVersion_LEGACY
|
||||
}
|
||||
|
||||
type ServerLoopInQuoteResponse struct {
|
||||
SwapFee int64 `protobuf:"varint,1,opt,name=swap_fee,json=swapFee,proto3" json:"swap_fee,omitempty"`
|
||||
SwapFeeRate int64 `protobuf:"varint,2,opt,name=swap_fee_rate,json=swapFeeRate,proto3" json:"swap_fee_rate,omitempty"` // Deprecated: Do not use.
|
||||
|
|
@ -602,9 +679,11 @@ func (m *ServerLoopInQuoteResponse) GetCltvDelta() int32 {
|
|||
}
|
||||
|
||||
type ServerLoopInTermsRequest struct {
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
/// The protocol version that the client adheres to.
|
||||
ProtocolVersion ProtocolVersion `protobuf:"varint,1,opt,name=protocol_version,json=protocolVersion,proto3,enum=looprpc.ProtocolVersion" json:"protocol_version,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *ServerLoopInTermsRequest) Reset() { *m = ServerLoopInTermsRequest{} }
|
||||
|
|
@ -632,6 +711,13 @@ func (m *ServerLoopInTermsRequest) XXX_DiscardUnknown() {
|
|||
|
||||
var xxx_messageInfo_ServerLoopInTermsRequest proto.InternalMessageInfo
|
||||
|
||||
func (m *ServerLoopInTermsRequest) GetProtocolVersion() ProtocolVersion {
|
||||
if m != nil {
|
||||
return m.ProtocolVersion
|
||||
}
|
||||
return ProtocolVersion_LEGACY
|
||||
}
|
||||
|
||||
type ServerLoopInTerms struct {
|
||||
MinSwapAmount uint64 `protobuf:"varint,1,opt,name=min_swap_amount,json=minSwapAmount,proto3" json:"min_swap_amount,omitempty"`
|
||||
MaxSwapAmount uint64 `protobuf:"varint,2,opt,name=max_swap_amount,json=maxSwapAmount,proto3" json:"max_swap_amount,omitempty"`
|
||||
|
|
@ -680,6 +766,7 @@ func (m *ServerLoopInTerms) GetMaxSwapAmount() uint64 {
|
|||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterEnum("looprpc.ProtocolVersion", ProtocolVersion_name, ProtocolVersion_value)
|
||||
proto.RegisterType((*ServerLoopOutRequest)(nil), "looprpc.ServerLoopOutRequest")
|
||||
proto.RegisterType((*ServerLoopOutResponse)(nil), "looprpc.ServerLoopOutResponse")
|
||||
proto.RegisterType((*ServerLoopOutQuoteRequest)(nil), "looprpc.ServerLoopOutQuoteRequest")
|
||||
|
|
@ -697,51 +784,57 @@ func init() {
|
|||
func init() { proto.RegisterFile("server.proto", fileDescriptor_ad098daeda4239f7) }
|
||||
|
||||
var fileDescriptor_ad098daeda4239f7 = []byte{
|
||||
// 693 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x55, 0xdd, 0x4e, 0xdb, 0x4c,
|
||||
0x10, 0x95, 0x9d, 0x90, 0x90, 0x21, 0x81, 0x8f, 0xfd, 0xfa, 0xe3, 0x04, 0x52, 0x81, 0xa5, 0x22,
|
||||
0x84, 0x2a, 0x90, 0xda, 0xbb, 0xde, 0x51, 0x21, 0x04, 0x2a, 0x2a, 0xc5, 0x70, 0x6f, 0x2d, 0xc9,
|
||||
0x94, 0x58, 0xb5, 0xbd, 0x5b, 0x7b, 0x13, 0xc8, 0x9b, 0xb4, 0x97, 0x95, 0xfa, 0x4a, 0x7d, 0x90,
|
||||
0xbe, 0x41, 0xb5, 0x3f, 0x26, 0xb6, 0xf3, 0x03, 0x48, 0xbd, 0x63, 0x67, 0x0e, 0x33, 0x67, 0xce,
|
||||
0x9c, 0x89, 0xa1, 0x99, 0x62, 0x32, 0xc2, 0x64, 0x9f, 0x27, 0x4c, 0x30, 0x52, 0x0f, 0x19, 0xe3,
|
||||
0x09, 0xef, 0x75, 0x36, 0x6f, 0x18, 0xbb, 0x09, 0xf1, 0x80, 0xf2, 0xe0, 0x80, 0xc6, 0x31, 0x13,
|
||||
0x54, 0x04, 0x2c, 0x4e, 0x35, 0xcc, 0xfd, 0x65, 0xc1, 0xb3, 0x4b, 0xf5, 0x7f, 0x67, 0x8c, 0xf1,
|
||||
0xf3, 0xa1, 0xf0, 0xf0, 0xdb, 0x10, 0x53, 0x41, 0xb6, 0xa1, 0x99, 0x60, 0x0f, 0x83, 0x11, 0x26,
|
||||
0xfe, 0x57, 0x1c, 0x3b, 0xd6, 0x96, 0xb5, 0xdb, 0xf4, 0x56, 0xb2, 0xd8, 0x47, 0x1c, 0x93, 0x0d,
|
||||
0x68, 0xa4, 0xb7, 0x94, 0xfb, 0x03, 0x9a, 0x0e, 0x1c, 0x5b, 0xe5, 0x97, 0x65, 0xe0, 0x84, 0xa6,
|
||||
0x03, 0xf2, 0x1f, 0x54, 0x68, 0x24, 0x9c, 0xca, 0x96, 0xb5, 0x5b, 0xf5, 0xe4, 0x9f, 0xe4, 0x3d,
|
||||
0xb4, 0x15, 0x9c, 0x0f, 0xaf, 0xc3, 0xa0, 0xa7, 0x58, 0xf8, 0x7d, 0xa4, 0xfd, 0x30, 0x88, 0xd1,
|
||||
0xa9, 0x6e, 0x59, 0xbb, 0x15, 0xef, 0xa5, 0x04, 0x7c, 0x9e, 0xe4, 0x8f, 0x4c, 0xda, 0xfd, 0x6e,
|
||||
0xc1, 0xf3, 0x12, 0xcd, 0x94, 0xb3, 0x38, 0x45, 0xc9, 0x53, 0x55, 0x0d, 0xe2, 0x11, 0x0b, 0x7a,
|
||||
0xa8, 0x78, 0x36, 0xbc, 0x15, 0x19, 0x3b, 0xd5, 0x21, 0xf2, 0x1a, 0x56, 0x79, 0x82, 0x9c, 0x8e,
|
||||
0xef, 0x41, 0xb6, 0x02, 0xb5, 0x74, 0x34, 0x83, 0x75, 0x01, 0x52, 0x8c, 0xfb, 0x66, 0xde, 0x8a,
|
||||
0x9a, 0xa7, 0xa1, 0x23, 0x72, 0xda, 0x17, 0x50, 0xc3, 0x3b, 0x1e, 0x24, 0x63, 0xc5, 0x75, 0xc9,
|
||||
0x33, 0x2f, 0x37, 0x80, 0x76, 0x81, 0xd9, 0xc5, 0x90, 0x09, 0xcc, 0x54, 0x34, 0x2a, 0x58, 0x8f,
|
||||
0x54, 0xc1, 0x5e, 0xac, 0xc2, 0x0f, 0x1b, 0xc8, 0x74, 0x2f, 0xb2, 0x07, 0xeb, 0xba, 0x24, 0x1d,
|
||||
0x47, 0x18, 0x0b, 0xbf, 0x8f, 0xa9, 0x30, 0x3a, 0xac, 0xa9, 0x52, 0x3a, 0x7e, 0x24, 0x09, 0xb5,
|
||||
0x41, 0xad, 0xc8, 0xff, 0x82, 0x59, 0xb7, 0xba, 0x7c, 0x1f, 0x23, 0x92, 0x1d, 0x68, 0x65, 0x29,
|
||||
0x3f, 0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||||
0xbb, 0xbf, 0xad, 0xfc, 0xa2, 0xee, 0xe1, 0x86, 0x46, 0xde, 0x9e, 0xd6, 0x03, 0xf6, 0xb4, 0x67,
|
||||
0xdb, 0x73, 0x86, 0xff, 0xaa, 0x4f, 0xf0, 0xdf, 0xd2, 0xe3, 0xfc, 0x57, 0x2b, 0xfb, 0xaf, 0x53,
|
||||
0x54, 0xa1, 0x60, 0xbf, 0x1e, 0xac, 0x4f, 0xe5, 0xfe, 0xb5, 0xfb, 0xde, 0xfe, 0xa9, 0x00, 0xc8,
|
||||
0xa7, 0xee, 0x44, 0xce, 0xa1, 0x59, 0x30, 0xbb, 0xbb, 0x6f, 0x3e, 0x08, 0xfb, 0x73, 0xcf, 0xa4,
|
||||
0xb3, 0xb1, 0x00, 0x43, 0xce, 0x61, 0xf5, 0x13, 0xde, 0x9a, 0x90, 0x6c, 0x44, 0xba, 0xb3, 0xe1,
|
||||
0x59, 0xb5, 0x57, 0xf3, 0xd2, 0x66, 0xd7, 0x13, 0x86, 0xfa, 0x67, 0x6c, 0x0e, 0xc3, 0xbc, 0x9f,
|
||||
0xe6, 0x31, 0xd4, 0x05, 0xce, 0x60, 0x25, 0x2f, 0xf0, 0xf6, 0x0c, 0x6c, 0x71, 0x31, 0x9d, 0xce,
|
||||
0x7c, 0x08, 0x39, 0x83, 0x96, 0x99, 0xf7, 0x54, 0xad, 0x83, 0x6c, 0xce, 0x04, 0x67, 0xa5, 0xba,
|
||||
0x73, 0xb2, 0x66, 0xd8, 0xab, 0x8c, 0x9b, 0xa6, 0x3a, 0x9b, 0x5b, 0x61, 0x54, 0x77, 0x11, 0x44,
|
||||
0x57, 0xbd, 0xae, 0xa9, 0x8f, 0xf8, 0xbb, 0xbf, 0x01, 0x00, 0x00, 0xff, 0xff, 0x6c, 0x99, 0x4f,
|
||||
0x5f, 0xfb, 0x07, 0x00, 0x00,
|
||||
// 786 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x55, 0xdd, 0x52, 0xda, 0x40,
|
||||
0x14, 0x6e, 0x02, 0x82, 0x1c, 0xf9, 0x73, 0xfb, 0x17, 0x50, 0x3a, 0xc8, 0x4c, 0x1d, 0xc6, 0x0b,
|
||||
0x9d, 0xda, 0xbb, 0xde, 0x59, 0xad, 0x95, 0x29, 0x2d, 0x1a, 0xb1, 0x33, 0xbd, 0x4a, 0x57, 0x38,
|
||||
0x95, 0x4c, 0x43, 0x36, 0x26, 0x0b, 0xca, 0x9b, 0xb4, 0x2f, 0xd1, 0xb7, 0xe9, 0x2b, 0x74, 0xa6,
|
||||
0x97, 0x7d, 0x83, 0x4e, 0x36, 0x89, 0x24, 0x21, 0xa8, 0xcc, 0x78, 0x67, 0xce, 0x7e, 0x9e, 0xfd,
|
||||
0xbe, 0xef, 0x9c, 0x6f, 0x81, 0xbc, 0x83, 0xf6, 0x18, 0xed, 0x6d, 0xcb, 0x66, 0x9c, 0x91, 0xac,
|
||||
0xc1, 0x98, 0x65, 0x5b, 0xbd, 0xea, 0xfa, 0x05, 0x63, 0x17, 0x06, 0xee, 0x50, 0x4b, 0xdf, 0xa1,
|
||||
0xa6, 0xc9, 0x38, 0xe5, 0x3a, 0x33, 0x1d, 0x0f, 0xd6, 0xf8, 0x2b, 0xc1, 0x93, 0x53, 0xf1, 0x7f,
|
||||
0x6d, 0xc6, 0xac, 0xce, 0x88, 0xab, 0x78, 0x39, 0x42, 0x87, 0x93, 0x0d, 0xc8, 0xdb, 0xd8, 0x43,
|
||||
0x7d, 0x8c, 0xb6, 0xf6, 0x1d, 0x27, 0x8a, 0x54, 0x97, 0x9a, 0x79, 0x75, 0x25, 0xa8, 0x7d, 0xc0,
|
||||
0x09, 0x59, 0x83, 0x9c, 0x73, 0x45, 0x2d, 0x6d, 0x40, 0x9d, 0x81, 0x22, 0x8b, 0xf3, 0x65, 0xb7,
|
||||
0x70, 0x44, 0x9d, 0x01, 0x29, 0x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0x5e,
|
||||
0xcc, 0x3b, 0xf6, 0x77, 0x6c, 0xca, 0xd0, 0xfb, 0x35, 0x98, 0xc3, 0x30, 0x1c, 0x86, 0x79, 0x0c,
|
||||
0xbd, 0x06, 0x6d, 0x58, 0x09, 0xcf, 0x64, 0x23, 0x01, 0x1b, 0x5d, 0x88, 0x6a, 0x75, 0x3e, 0x84,
|
||||
0xb4, 0xa1, 0xe0, 0xeb, 0x6d, 0x89, 0x09, 0x92, 0xf5, 0x44, 0x70, 0xd0, 0xaa, 0x36, 0xe7, 0xd4,
|
||||
0x17, 0xdb, 0x0d, 0xb8, 0x79, 0x54, 0x93, 0xb9, 0x45, 0xa4, 0x36, 0x6e, 0x83, 0x78, 0x5d, 0xcf,
|
||||
0x33, 0x62, 0x39, 0x5f, 0xff, 0x0f, 0x00, 0x00, 0xff, 0xff, 0xd4, 0x54, 0xd0, 0xf3, 0xcd, 0x09,
|
||||
0x00, 0x00,
|
||||
}
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
|
|
|
|||
|
|
@ -5,17 +5,32 @@ import "google/api/annotations.proto";
|
|||
package looprpc;
|
||||
|
||||
service SwapServer {
|
||||
rpc LoopOutTerms(ServerLoopOutTermsRequest) returns (ServerLoopOutTerms);
|
||||
rpc LoopOutTerms (ServerLoopOutTermsRequest) returns (ServerLoopOutTerms);
|
||||
|
||||
rpc NewLoopOutSwap(ServerLoopOutRequest) returns (ServerLoopOutResponse);
|
||||
rpc NewLoopOutSwap (ServerLoopOutRequest) returns (ServerLoopOutResponse);
|
||||
|
||||
rpc LoopOutQuote(ServerLoopOutQuoteRequest) returns (ServerLoopOutQuote);
|
||||
rpc LoopOutQuote (ServerLoopOutQuoteRequest) returns (ServerLoopOutQuote);
|
||||
|
||||
rpc LoopInTerms(ServerLoopInTermsRequest) returns (ServerLoopInTerms);
|
||||
rpc LoopInTerms (ServerLoopInTermsRequest) returns (ServerLoopInTerms);
|
||||
|
||||
rpc NewLoopInSwap(ServerLoopInRequest) returns (ServerLoopInResponse);
|
||||
rpc NewLoopInSwap (ServerLoopInRequest) returns (ServerLoopInResponse);
|
||||
|
||||
rpc LoopInQuote(ServerLoopInQuoteRequest) returns (ServerLoopInQuoteResponse);
|
||||
rpc LoopInQuote (ServerLoopInQuoteRequest)
|
||||
returns (ServerLoopInQuoteResponse);
|
||||
}
|
||||
|
||||
/**
|
||||
This enum defines the protocol versions that clients may adhere to. Note that
|
||||
this is not a flagged enum. If a particular protocol version adds a feature,
|
||||
then in general all the preceding features are also supported. Exception to this
|
||||
is when features get deprecated.
|
||||
*/
|
||||
enum ProtocolVersion {
|
||||
/// No protocol version reported at all.
|
||||
LEGACY = 0;
|
||||
|
||||
/// Client may attempt to send the loop out payment in multiple parts.
|
||||
MULTI_LOOP_OUT = 1;
|
||||
}
|
||||
|
||||
message ServerLoopOutRequest {
|
||||
|
|
@ -27,10 +42,13 @@ message ServerLoopOutRequest {
|
|||
|
||||
/// The unix time in seconds we want the on-chain swap to be published by.
|
||||
int64 swap_publication_deadline = 4;
|
||||
|
||||
/// The protocol version that the client adheres to.
|
||||
ProtocolVersion protocol_version = 5;
|
||||
}
|
||||
|
||||
message ServerLoopOutResponse {
|
||||
string swap_invoice= 1;
|
||||
string swap_invoice = 1;
|
||||
|
||||
string prepay_invoice = 2;
|
||||
|
||||
|
|
@ -45,6 +63,9 @@ message ServerLoopOutQuoteRequest {
|
|||
|
||||
/// The unix time in seconds we want the on-chain swap to be published by.
|
||||
int64 swap_publication_deadline = 2;
|
||||
|
||||
/// The protocol version that the client adheres to.
|
||||
ProtocolVersion protocol_version = 3;
|
||||
}
|
||||
|
||||
message ServerLoopOutQuote {
|
||||
|
|
@ -66,6 +87,8 @@ message ServerLoopOutQuote {
|
|||
}
|
||||
|
||||
message ServerLoopOutTermsRequest {
|
||||
/// The protocol version that the client adheres to.
|
||||
ProtocolVersion protocol_version = 1;
|
||||
}
|
||||
|
||||
message ServerLoopOutTerms {
|
||||
|
|
@ -79,6 +102,9 @@ message ServerLoopInRequest {
|
|||
uint64 amt = 3;
|
||||
string swap_invoice = 4;
|
||||
bytes last_hop = 5;
|
||||
|
||||
/// The protocol version that the client adheres to.
|
||||
ProtocolVersion protocol_version = 6;
|
||||
}
|
||||
|
||||
message ServerLoopInResponse {
|
||||
|
|
@ -89,17 +115,22 @@ message ServerLoopInResponse {
|
|||
message ServerLoopInQuoteRequest {
|
||||
/// The swap amount. If zero, a quote for a maximum amt swap will be given.
|
||||
uint64 amt = 1;
|
||||
|
||||
/// The protocol version that the client adheres to.
|
||||
ProtocolVersion protocol_version = 2;
|
||||
}
|
||||
|
||||
|
||||
message ServerLoopInQuoteResponse {
|
||||
int64 swap_fee = 1;
|
||||
int64 swap_fee_rate = 2 [deprecated=true];
|
||||
uint64 min_swap_amount = 4 [deprecated=true];
|
||||
uint64 max_swap_amount = 5 [deprecated=true];
|
||||
int64 swap_fee_rate = 2 [deprecated = true];
|
||||
uint64 min_swap_amount = 4 [deprecated = true];
|
||||
uint64 max_swap_amount = 5 [deprecated = true];
|
||||
int32 cltv_delta = 6;
|
||||
}
|
||||
|
||||
message ServerLoopInTermsRequest {
|
||||
/// The protocol version that the client adheres to.
|
||||
ProtocolVersion protocol_version = 1;
|
||||
}
|
||||
|
||||
message ServerLoopInTerms {
|
||||
|
|
|
|||
|
|
@ -20,6 +20,10 @@ import (
|
|||
"google.golang.org/grpc/credentials"
|
||||
)
|
||||
|
||||
// protocolVersion defines the version of the protocol that is currently
|
||||
// supported by the loop client.
|
||||
const protocolVersion = looprpc.ProtocolVersion_MULTI_LOOP_OUT
|
||||
|
||||
type swapServerClient interface {
|
||||
GetLoopOutTerms(ctx context.Context) (
|
||||
*LoopOutTerms, error)
|
||||
|
|
@ -84,7 +88,9 @@ func (s *grpcSwapServerClient) GetLoopOutTerms(ctx context.Context) (
|
|||
rpcCtx, rpcCancel := context.WithTimeout(ctx, globalCallTimeout)
|
||||
defer rpcCancel()
|
||||
terms, err := s.server.LoopOutTerms(rpcCtx,
|
||||
&looprpc.ServerLoopOutTermsRequest{},
|
||||
&looprpc.ServerLoopOutTermsRequest{
|
||||
ProtocolVersion: protocolVersion,
|
||||
},
|
||||
)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
|
@ -106,6 +112,7 @@ func (s *grpcSwapServerClient) GetLoopOutQuote(ctx context.Context,
|
|||
&looprpc.ServerLoopOutQuoteRequest{
|
||||
Amt: uint64(amt),
|
||||
SwapPublicationDeadline: swapPublicationDeadline.Unix(),
|
||||
ProtocolVersion: protocolVersion,
|
||||
},
|
||||
)
|
||||
if err != nil {
|
||||
|
|
@ -136,7 +143,9 @@ func (s *grpcSwapServerClient) GetLoopInTerms(ctx context.Context) (
|
|||
rpcCtx, rpcCancel := context.WithTimeout(ctx, globalCallTimeout)
|
||||
defer rpcCancel()
|
||||
terms, err := s.server.LoopInTerms(rpcCtx,
|
||||
&looprpc.ServerLoopInTermsRequest{},
|
||||
&looprpc.ServerLoopInTermsRequest{
|
||||
ProtocolVersion: protocolVersion,
|
||||
},
|
||||
)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
|
@ -155,7 +164,8 @@ func (s *grpcSwapServerClient) GetLoopInQuote(ctx context.Context,
|
|||
defer rpcCancel()
|
||||
quoteResp, err := s.server.LoopInQuote(rpcCtx,
|
||||
&looprpc.ServerLoopInQuoteRequest{
|
||||
Amt: uint64(amt),
|
||||
Amt: uint64(amt),
|
||||
ProtocolVersion: protocolVersion,
|
||||
},
|
||||
)
|
||||
if err != nil {
|
||||
|
|
@ -181,6 +191,7 @@ func (s *grpcSwapServerClient) NewLoopOutSwap(ctx context.Context,
|
|||
Amt: uint64(amount),
|
||||
ReceiverKey: receiverKey[:],
|
||||
SwapPublicationDeadline: swapPublicationDeadline.Unix(),
|
||||
ProtocolVersion: protocolVersion,
|
||||
},
|
||||
)
|
||||
if err != nil {
|
||||
|
|
@ -212,10 +223,11 @@ func (s *grpcSwapServerClient) NewLoopInSwap(ctx context.Context,
|
|||
defer rpcCancel()
|
||||
|
||||
req := &looprpc.ServerLoopInRequest{
|
||||
SwapHash: swapHash[:],
|
||||
Amt: uint64(amount),
|
||||
SenderKey: senderKey[:],
|
||||
SwapInvoice: swapInvoice,
|
||||
SwapHash: swapHash[:],
|
||||
Amt: uint64(amount),
|
||||
SenderKey: senderKey[:],
|
||||
SwapInvoice: swapInvoice,
|
||||
ProtocolVersion: protocolVersion,
|
||||
}
|
||||
if lastHop != nil {
|
||||
req.LastHop = lastHop[:]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue