Skip to content

Commit 830220a

Browse files
committed
looprpc: add FetchL402 rpc
This commit adds the FetchL402 rpc to the client proto, which will allow users to force fetching an L402 without doing a loop out or in.
1 parent e9f1a1a commit 830220a

File tree

7 files changed

+785
-571
lines changed

7 files changed

+785
-571
lines changed

loopd/perms/perms.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,10 @@ var RequiredPermissions = map[string][]bakery.Op{
7777
Entity: "auth",
7878
Action: "read",
7979
}},
80+
"/looprpc.SwapClient/FetchL402Token": {{
81+
Entity: "auth",
82+
Action: "write",
83+
}},
8084
"/looprpc.SwapClient/SuggestSwaps": {{
8185
Entity: "suggestions",
8286
Action: "read",

loopd/swapclient_server.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -991,6 +991,21 @@ func (s *swapClientServer) GetLsatTokens(ctx context.Context,
991991
return s.GetL402Tokens(ctx, req)
992992
}
993993

994+
// FetchL402Token fetches a L402 Token from the server. This is required to
995+
// listen for server notifications such as reservations. If a token is already
996+
// in the local L402, nothing will happen.
997+
func (s *swapClientServer) FetchL402Token(ctx context.Context,
998+
_ *looprpc.FetchL402TokenRequest) (*looprpc.FetchL402TokenResponse,
999+
error) {
1000+
1001+
err := s.impl.Server.FetchL402(ctx)
1002+
if err != nil {
1003+
return nil, err
1004+
}
1005+
1006+
return &looprpc.FetchL402TokenResponse{}, nil
1007+
}
1008+
9941009
// GetInfo returns basic information about the loop daemon and details to swaps
9951010
// from the swap store.
9961011
func (s *swapClientServer) GetInfo(ctx context.Context,

0 commit comments

Comments
 (0)