From 9665bb7e54c8c204fd9f07a5da483f48d1d7b589 Mon Sep 17 00:00:00 2001 From: Thomas Preindl Date: Sat, 4 Mar 2017 09:23:04 +0100 Subject: [PATCH] lncli: add listchaintxns command --- cmd/lncli/commands.go | 22 ++++++++++++++++++++++ cmd/lncli/main.go | 1 + 2 files changed, 23 insertions(+) diff --git a/cmd/lncli/commands.go b/cmd/lncli/commands.go index daf69ac8..ca4383a5 100644 --- a/cmd/lncli/commands.go +++ b/cmd/lncli/commands.go @@ -1491,3 +1491,25 @@ func decodePayReq(ctx *cli.Context) error { printRespJson(resp) return nil } + +var ListChainTxns = cli.Command{ + Name: "listchaintxns", + Usage: "List transactions from the wallet.", + Description: "List all transactions an address of the wallet was involved in.", + Action: listChainTxns, +} + +func listChainTxns(ctx *cli.Context) error { + ctxb := context.Background() + client, cleanUp := getClient(ctx) + defer cleanUp() + + resp, err := client.GetTransactions(ctxb, &lnrpc.GetTransactionsRequest{}) + + if err != nil { + return err + } + + printRespJson(resp) + return nil +} diff --git a/cmd/lncli/main.go b/cmd/lncli/main.go index fe5f68e4..de2c7b19 100644 --- a/cmd/lncli/main.go +++ b/cmd/lncli/main.go @@ -77,6 +77,7 @@ func main() { GetNetworkInfoCommand, DebugLevel, DecodePayReq, + ListChainTxns, } if err := app.Run(os.Args); err != nil {