From 14dc8e165df1aea4e86fb938610259d0732e1918 Mon Sep 17 00:00:00 2001 From: Boris Nagaev Date: Wed, 24 Apr 2024 14:25:48 -0300 Subject: [PATCH] looprpc: additional_bindings for /v1/lsat/tokens Provide backward compatibility for clients using this API endpoint. --- looprpc/client.pb.gw.go | 69 +++++++++++++++++++++++++++++++++++++ looprpc/client.swagger.json | 23 +++++++++++++ looprpc/client.yaml | 2 ++ release_notes.md | 2 ++ 4 files changed, 96 insertions(+) diff --git a/looprpc/client.pb.gw.go b/looprpc/client.pb.gw.go index f6f9e5f..7fa10f0 100644 --- a/looprpc/client.pb.gw.go +++ b/looprpc/client.pb.gw.go @@ -451,6 +451,24 @@ func local_request_SwapClient_GetL402Tokens_0(ctx context.Context, marshaler run } +func request_SwapClient_GetL402Tokens_1(ctx context.Context, marshaler runtime.Marshaler, client SwapClientClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq TokensRequest + var metadata runtime.ServerMetadata + + msg, err := client.GetL402Tokens(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_SwapClient_GetL402Tokens_1(ctx context.Context, marshaler runtime.Marshaler, server SwapClientServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq TokensRequest + var metadata runtime.ServerMetadata + + msg, err := server.GetL402Tokens(ctx, &protoReq) + return msg, metadata, err + +} + func request_SwapClient_GetInfo_0(ctx context.Context, marshaler runtime.Marshaler, client SwapClientClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq GetInfoRequest var metadata runtime.ServerMetadata @@ -795,6 +813,31 @@ func RegisterSwapClientHandlerServer(ctx context.Context, mux *runtime.ServeMux, }) + mux.Handle("GET", pattern_SwapClient_GetL402Tokens_1, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/looprpc.SwapClient/GetL402Tokens", runtime.WithHTTPPathPattern("/v1/lsat/tokens")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_SwapClient_GetL402Tokens_1(annotatedContext, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_SwapClient_GetL402Tokens_1(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + mux.Handle("GET", pattern_SwapClient_GetInfo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -1156,6 +1199,28 @@ func RegisterSwapClientHandlerClient(ctx context.Context, mux *runtime.ServeMux, }) + mux.Handle("GET", pattern_SwapClient_GetL402Tokens_1, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/looprpc.SwapClient/GetL402Tokens", runtime.WithHTTPPathPattern("/v1/lsat/tokens")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_SwapClient_GetL402Tokens_1(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_SwapClient_GetL402Tokens_1(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + mux.Handle("GET", pattern_SwapClient_GetInfo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -1268,6 +1333,8 @@ var ( pattern_SwapClient_GetL402Tokens_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "l402", "tokens"}, "")) + pattern_SwapClient_GetL402Tokens_1 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "lsat", "tokens"}, "")) + pattern_SwapClient_GetInfo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "loop", "info"}, "")) pattern_SwapClient_GetLiquidityParams_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "liquidity", "params"}, "")) @@ -1298,6 +1365,8 @@ var ( forward_SwapClient_GetL402Tokens_0 = runtime.ForwardResponseMessage + forward_SwapClient_GetL402Tokens_1 = runtime.ForwardResponseMessage + forward_SwapClient_GetInfo_0 = runtime.ForwardResponseMessage forward_SwapClient_GetLiquidityParams_0 = runtime.ForwardResponseMessage diff --git a/looprpc/client.swagger.json b/looprpc/client.swagger.json index 2cc3b85..302ac1a 100644 --- a/looprpc/client.swagger.json +++ b/looprpc/client.swagger.json @@ -538,6 +538,29 @@ "SwapClient" ] } + }, + "/v1/lsat/tokens": { + "get": { + "summary": "loop: `listauth`\nGetL402Tokens returns all L402 tokens the daemon ever paid for.", + "operationId": "SwapClient_GetL402Tokens2", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/looprpcTokensResponse" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "tags": [ + "SwapClient" + ] + } } }, "definitions": { diff --git a/looprpc/client.yaml b/looprpc/client.yaml index 3eb09ec..e30c7fb 100644 --- a/looprpc/client.yaml +++ b/looprpc/client.yaml @@ -28,6 +28,8 @@ http: get: "/v1/loop/info" - selector: looprpc.SwapClient.GetL402Tokens get: "/v1/l402/tokens" + additional_bindings: + - get: "/v1/lsat/tokens" - selector: looprpc.SwapClient.GetLiquidityParams get: "/v1/liquidity/params" - selector: looprpc.SwapClient.SetLiquidityParams diff --git a/release_notes.md b/release_notes.md index 7b752a0..8b081d2 100644 --- a/release_notes.md +++ b/release_notes.md @@ -26,6 +26,8 @@ encouraged to change the options to new names if they have been changed locally. The path in looprpc "/v1/lsat/tokens" was renamed to "/v1/l402/tokens" and the corresponding method was renamed from `GetLsatTokens` to `GetL402Tokens`. Update `loop` and `loopd` simultaneously otherwise this RPC won't work. +HTTP endpoint "/v1/l402/tokens" is now an additional binding for API +"/v1/lsat/tokens", so it still works. #### Bug Fixes