looprpc: add swap filter

pull/679/head
sputn1ck 4 months ago
parent 9f2bf5ca07
commit 90f5a8851e
No known key found for this signature in database
GPG Key ID: 671103D881A5F0E4

File diff suppressed because it is too large Load Diff

@ -99,10 +99,21 @@ func local_request_SwapClient_LoopIn_0(ctx context.Context, marshaler runtime.Ma
}
var (
filter_SwapClient_ListSwaps_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}
)
func request_SwapClient_ListSwaps_0(ctx context.Context, marshaler runtime.Marshaler, client SwapClientClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq ListSwapsRequest
var metadata runtime.ServerMetadata
if err := req.ParseForm(); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_SwapClient_ListSwaps_0); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := client.ListSwaps(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
@ -112,6 +123,13 @@ func local_request_SwapClient_ListSwaps_0(ctx context.Context, marshaler runtime
var protoReq ListSwapsRequest
var metadata runtime.ServerMetadata
if err := req.ParseForm(); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_SwapClient_ListSwaps_0); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := server.ListSwaps(ctx, &protoReq)
return msg, metadata, err

@ -544,6 +544,34 @@ enum FailureReason {
}
message ListSwapsRequest {
// Optional filter to only return swaps that match the filter.
ListSwapsFilter list_swap_filter = 1;
}
message ListSwapsFilter {
enum SwapTypeFilter {
// ANY indicates that no filter is applied.
ANY = 0;
// LOOP_OUT indicates an loop out swap (off-chain to on-chain).
LOOP_OUT = 1;
// LOOP_IN indicates a loop in swap (on-chain to off-chain).
LOOP_IN = 2;
}
// The type of the swap.
SwapTypeFilter swap_type = 1;
// If set, only pending swaps are returned.
bool pending_only = 2;
// If specified on creation, the outgoing channel set of the swap.
repeated uint64 outgoing_chan_set = 3;
// Label of swap to filter for.
string label = 4;
// If specified on creation, the last hop of the swap.
bytes loop_in_last_hop = 5;
}
message ListSwapsResponse {

@ -462,6 +462,55 @@
}
}
},
"parameters": [
{
"name": "list_swap_filter.swap_type",
"description": "The type of the swap.\n\n - ANY: ANY indicates that no filter is applied.\n - LOOP_OUT: LOOP_OUT indicates an loop out swap (off-chain to on-chain)\n - LOOP_IN: LOOP_IN indicates a loop in swap (on-chain to off-chain)",
"in": "query",
"required": false,
"type": "string",
"enum": [
"ANY",
"LOOP_OUT",
"LOOP_IN"
],
"default": "ANY"
},
{
"name": "list_swap_filter.pending_only",
"description": "If set, only pending swaps are returned.",
"in": "query",
"required": false,
"type": "boolean"
},
{
"name": "list_swap_filter.outgoing_chan_set",
"description": "If specified on creation, the outgoing channel set of the swap.",
"in": "query",
"required": false,
"type": "array",
"items": {
"type": "string",
"format": "uint64"
},
"collectionFormat": "multi"
},
{
"name": "list_swap_filter.label",
"description": "Label of swap to filter for.",
"in": "query",
"required": false,
"type": "string"
},
{
"name": "list_swap_filter.loop_in_last_hop",
"description": "If specified on creation, the last hop of the swap.",
"in": "query",
"required": false,
"type": "string",
"format": "byte"
}
],
"tags": [
"SwapClient"
]
@ -492,6 +541,16 @@
}
},
"definitions": {
"ListSwapsFilterSwapTypeFilter": {
"type": "string",
"enum": [
"ANY",
"LOOP_OUT",
"LOOP_IN"
],
"default": "ANY",
"title": "- ANY: ANY indicates that no filter is applied.\n - LOOP_OUT: LOOP_OUT indicates an loop out swap (off-chain to on-chain)\n - LOOP_IN: LOOP_IN indicates a loop in swap (on-chain to off-chain)"
},
"looprpcAbandonSwapResponse": {
"type": "object"
},
@ -830,6 +889,36 @@
],
"default": "UNKNOWN"
},
"looprpcListSwapsFilter": {
"type": "object",
"properties": {
"swap_type": {
"$ref": "#/definitions/ListSwapsFilterSwapTypeFilter",
"description": "The type of the swap."
},
"pending_only": {
"type": "boolean",
"description": "If set, only pending swaps are returned."
},
"outgoing_chan_set": {
"type": "array",
"items": {
"type": "string",
"format": "uint64"
},
"description": "If specified on creation, the outgoing channel set of the swap."
},
"label": {
"type": "string",
"description": "Label of swap to filter for."
},
"loop_in_last_hop": {
"type": "string",
"format": "byte",
"description": "If specified on creation, the last hop of the swap."
}
}
},
"looprpcListSwapsResponse": {
"type": "object",
"properties": {

Loading…
Cancel
Save