Example #1
0
// GetNetworkHashPS3Async returns an instance of a type that can be used to get
// the result of the RPC at some future time by invoking the Receive function on
// the returned instance.
//
// See GetNetworkHashPS3 for the blocking version and more details.
func (c *Client) GetNetworkHashPS3Async(blocks, height int) FutureGetNetworkHashPS {
	id := c.NextID()
	cmd, err := btcjson.NewGetNetworkHashPSCmd(id, blocks, height)
	if err != nil {
		return newFutureError(err)
	}

	return c.sendCmd(cmd)
}
Example #2
0
// GetNetworkHashPSAsync returns an instance of a type that can be used to get
// the result of the RPC at some future time by invoking the Receive function on
// the returned instance.
//
// See GetNetworkHashPS for the blocking version and more details.
func (c *Client) GetNetworkHashPSAsync() FutureGetNetworkHashPS {
	id := c.NextID()
	cmd, err := btcjson.NewGetNetworkHashPSCmd(id)
	if err != nil {
		return newFutureError(err)
	}

	return c.sendCmd(cmd)
}
Example #3
0
// makeGetNetworkHashPS generates the cmd structure for getnetworkhashps
// commands.
func makeGetNetworkHashPS(args []interface{}) (btcjson.Cmd, error) {
	// Create the getnetworkhashps command with defaults for the optional
	// parameters.
	cmd, err := btcjson.NewGetNetworkHashPSCmd("btcctl")
	if err != nil {
		return nil, err
	}

	// Override the optional blocks if specified.
	if len(args) > 0 {
		cmd.Blocks = args[0].(int)
	}

	// Override the optional height if specified.
	if len(args) > 1 {
		cmd.Height = args[1].(int)
	}

	return cmd, nil
}