Skip to content

Commit 02a32da

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 02a32da

File tree

7 files changed

+784
-571
lines changed

7 files changed

+784
-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: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -991,6 +991,20 @@ 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, error) {
999+
1000+
err := s.impl.Server.FetchL402(ctx)
1001+
if err != nil {
1002+
return nil, err
1003+
}
1004+
1005+
return &looprpc.FetchL402TokenResponse{}, nil
1006+
}
1007+
9941008
// GetInfo returns basic information about the loop daemon and details to swaps
9951009
// from the swap store.
9961010
func (s *swapClientServer) GetInfo(ctx context.Context,

0 commit comments

Comments
 (0)