mirror of
https://github.com/lightninglabs/loop.git
synced 2026-08-13 12:33:03 +02:00
cmd: add fetchl402 cli command
This commit adds a new command to the loop cli tool that fetches the a l402 token from the swap server.
This commit is contained in:
parent
830220af66
commit
7ca5dc81bc
2 changed files with 29 additions and 1 deletions
|
|
@ -73,3 +73,31 @@ func listAuth(ctx *cli.Context) error {
|
|||
printJSON(tokens)
|
||||
return nil
|
||||
}
|
||||
|
||||
var fetchL402Command = cli.Command{
|
||||
Name: "fetchl402",
|
||||
Usage: "fetches a new L402 authentication token from the server",
|
||||
Description: "Fetches a new L402 authentication token from the server. " +
|
||||
"This token is required to listen to notifications from the server, " +
|
||||
"such as reservation notifications. If a L402 is already present in " +
|
||||
"the store, this command is a no-op.",
|
||||
Action: fetchL402,
|
||||
}
|
||||
|
||||
func fetchL402(ctx *cli.Context) error {
|
||||
client, cleanup, err := getClient(ctx)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer cleanup()
|
||||
|
||||
res, err := client.FetchL402Token(
|
||||
context.Background(), &looprpc.FetchL402TokenRequest{},
|
||||
)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
printRespJSON(res)
|
||||
return nil
|
||||
}
|
||||
|
|
|
|||
|
|
@ -144,7 +144,7 @@ func main() {
|
|||
}
|
||||
app.Commands = []cli.Command{
|
||||
loopOutCommand, loopInCommand, termsCommand,
|
||||
monitorCommand, quoteCommand, listAuthCommand,
|
||||
monitorCommand, quoteCommand, listAuthCommand, fetchL402Command,
|
||||
listSwapsCommand, swapInfoCommand, getLiquidityParamsCommand,
|
||||
setLiquidityRuleCommand, suggestSwapCommand, setParamsCommand,
|
||||
getInfoCommand, abandonSwapCommand, reservationsCommands,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue