示例#1
0
文件: cmds.go 项目: Kalipsol/factomd
// MarshalJSON returns the JSON encoding of cmd.  Part of the Cmd interface.
func (cmd *NotifyBlocksCmd) MarshalJSON() ([]byte, error) {
	raw, err := btcjson.NewRawCmd(cmd.id, cmd.Method(), []interface{}{})
	if err != nil {
		return nil, err
	}
	return json.Marshal(raw)
}
示例#2
0
文件: cmds.go 项目: Kalipsol/factomd
// MarshalJSON returns the JSON encoding of cmd.  Part of the Cmd interface.
func (cmd *NotifyReceivedCmd) MarshalJSON() ([]byte, error) {
	params := []interface{}{
		cmd.Addresses,
	}

	raw, err := btcjson.NewRawCmd(cmd.id, cmd.Method(), params)
	if err != nil {
		return nil, err
	}
	return json.Marshal(raw)
}
示例#3
0
文件: cmds.go 项目: Kalipsol/factomd
// MarshalJSON returns the JSON encoding of cmd.  Part of the Cmd interface.
func (cmd *CreateNewAccountCmd) MarshalJSON() ([]byte, error) {
	params := []interface{}{
		cmd.Account,
	}

	raw, err := btcjson.NewRawCmd(cmd.id, cmd.Method(), params)
	if err != nil {
		return nil, err
	}
	return json.Marshal(raw)
}
示例#4
0
文件: cmds.go 项目: Kalipsol/factomd
// MarshalJSON returns the JSON encoding of cmd.  Part of the Cmd interface.
func (cmd *CreateEncryptedWalletCmd) MarshalJSON() ([]byte, error) {
	params := []interface{}{
		cmd.Passphrase,
	}

	raw, err := btcjson.NewRawCmd(cmd.id, cmd.Method(), params)
	if err != nil {
		return nil, err
	}
	return json.Marshal(raw)
}
示例#5
0
文件: cmds.go 项目: Kalipsol/factomd
// MarshalJSON returns the JSON encoding of cmd.  Part of the Cmd interface.
func (cmd *NotifySpentCmd) MarshalJSON() ([]byte, error) {
	params := []interface{}{
		cmd.OutPoints,
	}

	raw, err := btcjson.NewRawCmd(cmd.id, cmd.Method(), params)
	if err != nil {
		return nil, err
	}
	return json.Marshal(raw)
}
示例#6
0
文件: cmds.go 项目: Kalipsol/factomd
// MarshalJSON returns the JSON encoding of cmd.  Part of the Cmd interface.
func (cmd *NotifyNewTransactionsCmd) MarshalJSON() ([]byte, error) {
	params := []interface{}{
		cmd.Verbose,
	}

	raw, err := btcjson.NewRawCmd(cmd.id, cmd.Method(), params)
	if err != nil {
		return nil, err
	}
	return json.Marshal(raw)
}
示例#7
0
// MarshalJSON returns the JSON encoding of n.  Part of the btcjson.Cmd
// interface.
func (n *BtcdConnectedNtfn) MarshalJSON() ([]byte, error) {
	params := []interface{}{
		n.Connected,
	}

	// No ID for notifications.
	raw, err := btcjson.NewRawCmd(nil, n.Method(), params)
	if err != nil {
		return nil, err
	}
	return json.Marshal(raw)
}
示例#8
0
// MarshalJSON returns the JSON encoding of n.  Part of the btcjson.Cmd
// interface.
func (n *TxAcceptedVerboseNtfn) MarshalJSON() ([]byte, error) {
	params := []interface{}{
		n.RawTx,
	}

	// No ID for notifications.
	raw, err := btcjson.NewRawCmd(nil, n.Method(), params)
	if err != nil {
		return nil, err
	}
	return json.Marshal(raw)
}
示例#9
0
文件: cmds.go 项目: Kalipsol/factomd
// MarshalJSON returns the JSON encoding of cmd.  Part of the Cmd interface.
func (cmd *GetUnconfirmedBalanceCmd) MarshalJSON() ([]byte, error) {
	params := make([]interface{}, 0, 1)
	if cmd.Account != "" {
		params = append(params, cmd.Account)
	}

	raw, err := btcjson.NewRawCmd(cmd.id, cmd.Method(), params)
	if err != nil {
		return nil, err
	}
	return json.Marshal(raw)
}
示例#10
0
文件: cmds.go 项目: Kalipsol/factomd
// MarshalJSON returns the JSON encoding of cmd.  Part of the Cmd interface.
func (cmd *ListAllTransactionsCmd) MarshalJSON() ([]byte, error) {
	params := make([]interface{}, 0, 1)
	if cmd.Account != nil {
		params = append(params, cmd.Account)
	}

	raw, err := btcjson.NewRawCmd(cmd.id, cmd.Method(), params)
	if err != nil {
		return nil, err
	}
	return json.Marshal(raw)
}
示例#11
0
文件: cmds.go 项目: Kalipsol/factomd
// MarshalJSON returns the JSON encoding of cmd.  Part of the Cmd interface.
func (cmd *AuthenticateCmd) MarshalJSON() ([]byte, error) {
	params := []interface{}{
		cmd.Username,
		cmd.Passphrase,
	}

	raw, err := btcjson.NewRawCmd(cmd.id, cmd.Method(), params)
	if err != nil {
		return nil, err
	}
	return json.Marshal(raw)
}
示例#12
0
// MarshalJSON returns the JSON encoding of n.  Part of the btcjson.Cmd
// interface.
func (n *TxNtfn) MarshalJSON() ([]byte, error) {
	params := []interface{}{
		n.Account,
		n.Details,
	}

	// No ID for notifications.
	raw, err := btcjson.NewRawCmd(nil, n.Method(), params)
	if err != nil {
		return nil, err
	}
	return json.Marshal(raw)
}
示例#13
0
// MarshalJSON returns the JSON encoding of n.  Part of the btcjson.Cmd
// interface.
func (n *RescanProgressNtfn) MarshalJSON() ([]byte, error) {
	params := []interface{}{
		n.Hash,
		n.Height,
		n.Time,
	}

	// No ID for notifications.
	raw, err := btcjson.NewRawCmd(nil, n.Method(), params)
	if err != nil {
		return nil, err
	}
	return json.Marshal(raw)
}
示例#14
0
// MarshalJSON returns the JSON encoding of n.  Part of the btcjson.Cmd
// interface.
func (n *RedeemingTxNtfn) MarshalJSON() ([]byte, error) {
	params := make([]interface{}, 1, 2)
	params[0] = n.HexTx
	if n.Block != nil {
		params = append(params, n.Block)
	}

	// No ID for notifications.
	raw, err := btcjson.NewRawCmd(nil, n.Method(), params)
	if err != nil {
		return nil, err
	}
	return json.Marshal(raw)
}
示例#15
0
文件: cmds.go 项目: Kalipsol/factomd
// MarshalJSON returns the JSON encoding of cmd.  Part of the Cmd interface.
func (cmd *RescanCmd) MarshalJSON() ([]byte, error) {
	params := make([]interface{}, 3, 4)
	params[0] = cmd.BeginBlock
	params[1] = cmd.Addresses
	params[2] = cmd.OutPoints
	if cmd.EndBlock != "" {
		params = append(params, cmd.EndBlock)
	}

	raw, err := btcjson.NewRawCmd(cmd.id, cmd.Method(), params)
	if err != nil {
		return nil, err
	}
	return json.Marshal(raw)
}
示例#16
0
文件: cmds.go 项目: Kalipsol/factomd
// MarshalJSON returns the JSON encoding of cmd.  Part of the Cmd interface.
func (cmd *ExportWatchingWalletCmd) MarshalJSON() ([]byte, error) {
	params := make([]interface{}, 0, 2)
	if cmd.Account != "" || cmd.Download {
		params = append(params, cmd.Account)
	}
	if cmd.Download {
		params = append(params, cmd.Download)
	}

	raw, err := btcjson.NewRawCmd(cmd.id, cmd.Method(), params)
	if err != nil {
		return nil, err
	}
	return json.Marshal(raw)
}