Skip to content

Commit 5a1f795

Browse files
committed
loopd: re-add GetLsatTokens method in gRPC
This is needed not to break existing client binaries, e.g. `loop listauth`, Terminal Web, RTL. The API should be removed in a couple of releases. For now, GetLsatTokens just prints a warning message about the API being deprecated and that the client binary should be updated, and calls GetL402Tokens API, as a wrapper. Type LsatToken used by GetLsatTokens in the past was renamed to L402Token, but this does not affect binary encoding, so type L402Token can be used (as part of TokensResponse) without breaking backward compatibility. Updated release_notes.md. See #730 (comment)
1 parent 14dc8e1 commit 5a1f795

File tree

7 files changed

+185
-77
lines changed

7 files changed

+185
-77
lines changed

loopd/perms/perms.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,10 @@ var RequiredPermissions = map[string][]bakery.Op{
7373
Entity: "auth",
7474
Action: "read",
7575
}},
76+
"/looprpc.SwapClient/GetLsatTokens": {{
77+
Entity: "auth",
78+
Action: "read",
79+
}},
7680
"/looprpc.SwapClient/SuggestSwaps": {{
7781
Entity: "suggestions",
7882
Action: "read",

loopd/swapclient_server.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -964,6 +964,21 @@ func (s *swapClientServer) GetL402Tokens(ctx context.Context,
964964
return &clientrpc.TokensResponse{Tokens: rpcTokens}, nil
965965
}
966966

967+
// GetLsatTokens returns all tokens that are contained in the L402 token store.
968+
// Deprecated: use GetL402Tokens.
969+
// This API is provided to maintain backward compatibility with gRPC clients
970+
// (e.g. `loop listauth`, Terminal Web, RTL).
971+
// Type LsatToken used by GetLsatTokens in the past was renamed to L402Token,
972+
// but this does not affect binary encoding, so we can use type L402Token here.
973+
func (s *swapClientServer) GetLsatTokens(ctx context.Context,
974+
req *clientrpc.TokensRequest) (*clientrpc.TokensResponse, error) {
975+
976+
log.Warnf("Received deprecated call GetLsatTokens. Please update the " +
977+
"client software. Calling GetL402Tokens now.")
978+
979+
return s.GetL402Tokens(ctx, req)
980+
}
981+
967982
// GetInfo returns basic information about the loop daemon and details to swaps
968983
// from the swap store.
969984
func (s *swapClientServer) GetInfo(ctx context.Context,

looprpc/client.pb.go

Lines changed: 80 additions & 74 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

looprpc/client.proto

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,15 @@ service SwapClient {
8080
*/
8181
rpc GetL402Tokens (TokensRequest) returns (TokensResponse);
8282

83+
/*
84+
Deprecated: use GetL402Tokens.
85+
This API is provided to maintain backward compatibility with gRPC clients
86+
(e.g. `loop listauth`, Terminal Web, RTL).
87+
Type LsatToken used by GetLsatTokens in the past was renamed to L402Token,
88+
but this does not affect binary encoding, so we can use type L402Token here.
89+
*/
90+
rpc GetLsatTokens (TokensRequest) returns (TokensResponse);
91+
8392
/* loop: `getinfo`
8493
GetInfo gets basic information about the loop daemon.
8594
*/

0 commit comments

Comments
 (0)