Skip to content

Commit af8485f

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 6082693 commit af8485f

File tree

7 files changed

+783
-571
lines changed

7 files changed

+783
-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: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -991,6 +991,19 @@ 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.
996+
func (s *swapClientServer) FetchL402Token(ctx context.Context,
997+
_ *looprpc.FetchL402TokenRequest) (*looprpc.FetchL402TokenResponse, error) {
998+
999+
err := s.impl.Server.FetchL402(ctx)
1000+
if err != nil {
1001+
return nil, err
1002+
}
1003+
1004+
return &looprpc.FetchL402TokenResponse{}, nil
1005+
}
1006+
9941007
// GetInfo returns basic information about the loop daemon and details to swaps
9951008
// from the swap store.
9961009
func (s *swapClientServer) GetInfo(ctx context.Context,

0 commit comments

Comments
 (0)