lncli: modify listpayments to use queried payments and update cli docs
This commit is contained in:
parent
97b759796d
commit
4593cfa6c6
@ -2171,10 +2171,42 @@ var listPaymentsCommand = cli.Command{
|
|||||||
Name: "listpayments",
|
Name: "listpayments",
|
||||||
Category: "Payments",
|
Category: "Payments",
|
||||||
Usage: "List all outgoing payments.",
|
Usage: "List all outgoing payments.",
|
||||||
|
Description: "This command enables the retrieval of payments stored " +
|
||||||
|
"in the database. Pagination is supported by the usage of " +
|
||||||
|
"index_offset in combination with the paginate_forwards flag. " +
|
||||||
|
"Reversed pagination is enabled by default to receive " +
|
||||||
|
"current payments first. Pagination can be resumed by using " +
|
||||||
|
"the returned last_index_offset (for forwards order), or " +
|
||||||
|
"first_index_offset (for reversed order) as the offset_index. ",
|
||||||
Flags: []cli.Flag{
|
Flags: []cli.Flag{
|
||||||
cli.BoolFlag{
|
cli.BoolFlag{
|
||||||
Name: "include_incomplete",
|
Name: "include_incomplete",
|
||||||
Usage: "if set to true, payments still in flight (or failed) will be returned as well",
|
Usage: "if set to true, payments still in flight (or " +
|
||||||
|
"failed) will be returned as well, keeping" +
|
||||||
|
"indices for payments the same as without " +
|
||||||
|
"the flag",
|
||||||
|
},
|
||||||
|
cli.UintFlag{
|
||||||
|
Name: "index_offset",
|
||||||
|
Usage: "The index of a payment that will be used as " +
|
||||||
|
"either the start (in forwards mode) or end " +
|
||||||
|
"(in reverse mode) of a query to determine " +
|
||||||
|
"which payments should be returned in the " +
|
||||||
|
"response, where the index_offset is " +
|
||||||
|
"excluded. If index_offset is set to zero in " +
|
||||||
|
"reversed mode, the query will end with the " +
|
||||||
|
"last payment made.",
|
||||||
|
},
|
||||||
|
cli.UintFlag{
|
||||||
|
Name: "max_payments",
|
||||||
|
Usage: "the max number of payments to return, by " +
|
||||||
|
"default, all completed payments are returned",
|
||||||
|
},
|
||||||
|
cli.BoolFlag{
|
||||||
|
Name: "paginate_forwards",
|
||||||
|
Usage: "if set, payments succeeding the " +
|
||||||
|
"index_offset will be returned, allowing " +
|
||||||
|
"forwards pagination",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Action: actionDecorator(listPayments),
|
Action: actionDecorator(listPayments),
|
||||||
@ -2186,6 +2218,9 @@ func listPayments(ctx *cli.Context) error {
|
|||||||
|
|
||||||
req := &lnrpc.ListPaymentsRequest{
|
req := &lnrpc.ListPaymentsRequest{
|
||||||
IncludeIncomplete: ctx.Bool("include_incomplete"),
|
IncludeIncomplete: ctx.Bool("include_incomplete"),
|
||||||
|
IndexOffset: uint64(ctx.Uint("index_offset")),
|
||||||
|
MaxPayments: uint64(ctx.Uint("max_payments")),
|
||||||
|
Reversed: !ctx.Bool("paginate_forwards"),
|
||||||
}
|
}
|
||||||
|
|
||||||
payments, err := client.ListPayments(context.Background(), req)
|
payments, err := client.ListPayments(context.Background(), req)
|
||||||
|
Loading…
Reference in New Issue
Block a user