2
0
mirror of https://github.com/lightninglabs/loop synced 2024-11-11 13:11:12 +00:00
loop/looprpc/server.proto

146 lines
3.7 KiB
Protocol Buffer
Raw Permalink Normal View History

2019-03-06 20:13:50 +00:00
syntax = "proto3";
import "google/api/annotations.proto";
package looprpc;
2019-03-06 20:13:50 +00:00
service SwapServer {
2020-04-27 13:30:52 +00:00
rpc LoopOutTerms (ServerLoopOutTermsRequest) returns (ServerLoopOutTerms);
2020-04-27 13:30:52 +00:00
rpc NewLoopOutSwap (ServerLoopOutRequest) returns (ServerLoopOutResponse);
2020-04-27 13:30:52 +00:00
rpc LoopOutQuote (ServerLoopOutQuoteRequest) returns (ServerLoopOutQuote);
2019-03-12 15:10:37 +00:00
2020-04-27 13:30:52 +00:00
rpc LoopInTerms (ServerLoopInTermsRequest) returns (ServerLoopInTerms);
2020-04-27 13:30:52 +00:00
rpc NewLoopInSwap (ServerLoopInRequest) returns (ServerLoopInResponse);
2019-03-12 15:10:37 +00:00
2020-04-27 13:30:52 +00:00
rpc LoopInQuote (ServerLoopInQuoteRequest)
returns (ServerLoopInQuoteResponse);
2019-03-06 20:13:50 +00:00
}
2020-04-27 13:43:30 +00:00
/**
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;
2020-05-05 07:14:26 +00:00
/**
Loop will use native segwit (P2WSH) htlcs by default, while externally
published htlcs may use native (P2WSH) or nested (NP2WSH) segwit as well.
*/
NATIVE_SEGWIT_LOOP_IN = 2;
2020-04-27 13:43:30 +00:00
}
message ServerLoopOutRequest {
2019-03-06 20:13:50 +00:00
bytes receiver_key = 1;
2019-03-06 20:13:50 +00:00
bytes swap_hash = 2;
2019-03-06 20:13:50 +00:00
uint64 amt = 3;
/// The unix time in seconds we want the on-chain swap to be published by.
int64 swap_publication_deadline = 4;
2020-04-27 13:43:30 +00:00
/// The protocol version that the client adheres to.
ProtocolVersion protocol_version = 5;
2019-03-06 20:13:50 +00:00
}
message ServerLoopOutResponse {
2020-04-27 13:30:52 +00:00
string swap_invoice = 1;
2019-03-06 20:13:50 +00:00
string prepay_invoice = 2;
2019-03-06 20:13:50 +00:00
bytes sender_key = 3;
2019-03-06 20:13:50 +00:00
int32 expiry = 4;
}
message ServerLoopOutQuoteRequest {
/// The swap amount. If zero, a quote for a maximum amt swap will be given.
uint64 amt = 1;
2020-01-07 12:28:22 +00:00
/// The unix time in seconds we want the on-chain swap to be published by.
int64 swap_publication_deadline = 2;
2020-04-27 13:43:30 +00:00
/// The protocol version that the client adheres to.
ProtocolVersion protocol_version = 3;
2019-03-06 20:13:50 +00:00
}
message ServerLoopOutQuote {
2019-03-06 20:13:50 +00:00
string swap_payment_dest = 1;
/// The total estimated swap fee given the quote amt.
int64 swap_fee = 2;
/// Deprecated, total swap fee given quote amt is calculated in swap_fee.
int64 swap_fee_rate = 3 [deprecated = true];
2019-03-06 20:13:50 +00:00
uint64 prepay_amt = 4;
uint64 min_swap_amount = 5 [deprecated = true];
uint64 max_swap_amount = 6 [deprecated = true];
2019-03-06 20:13:50 +00:00
int32 cltv_delta = 7;
}
2019-03-12 15:10:37 +00:00
message ServerLoopOutTermsRequest {
2020-04-27 13:43:30 +00:00
/// The protocol version that the client adheres to.
ProtocolVersion protocol_version = 1;
}
message ServerLoopOutTerms {
uint64 min_swap_amount = 1;
uint64 max_swap_amount = 2;
}
2019-03-12 15:10:37 +00:00
message ServerLoopInRequest {
bytes sender_key = 1;
bytes swap_hash = 2;
uint64 amt = 3;
string swap_invoice = 4;
bytes last_hop = 5;
2020-04-27 13:43:30 +00:00
/// The protocol version that the client adheres to.
ProtocolVersion protocol_version = 6;
2019-03-12 15:10:37 +00:00
}
message ServerLoopInResponse {
bytes receiver_key = 1;
int32 expiry = 2;
}
message ServerLoopInQuoteRequest {
/// The swap amount. If zero, a quote for a maximum amt swap will be given.
uint64 amt = 1;
2020-04-27 13:43:30 +00:00
/// The protocol version that the client adheres to.
ProtocolVersion protocol_version = 2;
2019-03-12 15:10:37 +00:00
}
2020-04-27 13:30:52 +00:00
2019-03-12 15:10:37 +00:00
message ServerLoopInQuoteResponse {
int64 swap_fee = 1;
2020-04-27 13:30:52 +00:00
int64 swap_fee_rate = 2 [deprecated = true];
uint64 min_swap_amount = 4 [deprecated = true];
uint64 max_swap_amount = 5 [deprecated = true];
2019-03-12 15:10:37 +00:00
int32 cltv_delta = 6;
}
message ServerLoopInTermsRequest {
2020-04-27 13:43:30 +00:00
/// The protocol version that the client adheres to.
ProtocolVersion protocol_version = 1;
}
message ServerLoopInTerms {
uint64 min_swap_amount = 1;
uint64 max_swap_amount = 2;
}