Beispiel #1
0
// makeGetNewAddress generates the cmd structure for getnewaddress commands.
func makeGetNewAddress(args []interface{}) (btcjson.Cmd, error) {
	var account string
	if len(args) > 0 {
		account = args[0].(string)
	}
	return btcjson.NewGetNewAddressCmd("btcctl", account)
}
Beispiel #2
0
func (p *Peer) fetchNewBtcAddr(btcConf *util.BitcoindConf) (string, error) {
	cmd, err := btcjson.NewGetNewAddressCmd("")
	if err != nil {
		return "", fmt.Errorf("error while making cmd: %v", err.Error())
	}
	resp, err := util.SendBtcRpc(cmd, btcConf)
	addr, ok := resp.Result.(string)
	if !ok {
		return "", fmt.Errorf("error during bitcoind JSON-RPC: %v", resp)
	}
	return addr, nil
}