Files
ark/noah/balance.go
Louis Singer a17aba8356 Noah CLI implementation (#42)
* Import stubs

* send and balance cmd implementations

* ListVtxos & faucet

* main.go: add faucetCommand

* fix after review

* send: continue if no forfeits included in current round

* remove cov in noah/Makefile

* fancy printJSON

* remove rpc_url

---------

Co-authored-by: altafan <18440657+altafan@users.noreply.github.com>
2023-12-06 12:57:35 +01:00

31 lines
491 B
Go

package main
import (
"github.com/urfave/cli/v2"
)
var balanceCommand = cli.Command{
Name: "balance",
Usage: "Print balance of the Noah wallet",
Action: balanceAction,
}
func balanceAction(ctx *cli.Context) error {
client, close, err := getArkClient(ctx)
if err != nil {
return err
}
defer close()
vtxos, err := getVtxos(ctx, client)
if err != nil {
return err
}
balance := computeBalance(vtxos)
return printJSON(map[string]interface{}{
"balance": balance,
})
}