1// SPDX-License-Identifier: ISC
2// Copyright (c) 2014-2020 Bitmark Inc.
3// Use of this source code is governed by an ISC
4// license that can be found in the LICENSE file.
5
6package main
7
8import (
9	"github.com/urfave/cli"
10
11	"github.com/bitmark-inc/bitmarkd/command/bitmark-cli/rpccalls"
12)
13
14func runBitmarkdInfo(c *cli.Context) error {
15
16	m := c.App.Metadata["config"].(*metadata)
17
18	client, err := rpccalls.NewClient(m.testnet, m.config.Connections[m.connectionOffset], m.verbose, m.e)
19	if nil != err {
20		return err
21	}
22	defer client.Close()
23
24	response, err := client.GetBitmarkInfoCompat()
25	if nil != err {
26		return err
27	}
28	response["_connection"] = m.config.Connections[m.connectionOffset]
29
30	printJson(m.w, response)
31
32	return nil
33}
34