Example #1
0
// GetWorkSubmitAsync 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 GetWorkSubmit for the blocking version and more details.
func (c *Client) GetWorkSubmitAsync(data string) FutureGetWorkSubmit {
	id := c.NextID()
	cmd, err := btcjson.NewGetWorkCmd(id, data)
	if err != nil {
		return newFutureError(err)
	}

	return c.sendCmd(cmd)
}
Example #2
0
// GetWorkAsync 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 GetWork for the blocking version and more details.
func (c *Client) GetWorkAsync() FutureGetWork {
	id := c.NextID()
	cmd, err := btcjson.NewGetWorkCmd(id)
	if err != nil {
		return newFutureError(err)
	}

	return c.sendCmd(cmd)
}
Example #3
0
func makeGetWork(args []interface{}) (btcjson.Cmd, error) {
	cmd, err := btcjson.NewGetWorkCmd("btcctl")
	if err != nil {
		return nil, err
	}
	if len(args) == 1 {
		cmd.Data = args[0].(string)
	}
	return cmd, nil
}
Example #4
0
File: btcctl.go Project: hsk81/btcd
func makeGetWork(args []interface{}) (btcjson.Cmd, error) {
	cmd, err := btcjson.NewGetWorkCmd("btcctl")
	if err != nil {
		return nil, err
	}
	if len(args) == 1 {
		err = cmd.UnmarshalJSON([]byte(args[0].(string)))
		if err != nil {
			return nil, err
		}
	}
	return cmd, nil
}