// MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. func (cmd *GetUnconfirmedBalanceCmd) MarshalJSON() ([]byte, error) { // Fill a RawCmd and marshal. raw := btcjson.RawCmd{ Jsonrpc: "1.0", Method: "getunconfirmedbalance", Id: cmd.id, } if cmd.Account != "" { raw.Params = append(raw.Params, cmd.Account) } return json.Marshal(raw) }
// MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. func (cmd *ListAllTransactionsCmd) MarshalJSON() ([]byte, error) { // Fill a RawCmd and marshal. raw := btcjson.RawCmd{ Jsonrpc: "1.0", Method: "listalltransactions", Id: cmd.id, Params: []interface{}{}, } if cmd.Account != "" { raw.Params = append(raw.Params, cmd.Account) } return json.Marshal(raw) }
// MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. func (cmd *WalletIsLockedCmd) MarshalJSON() ([]byte, error) { // Fill a RawCmd and marshal. raw := btcjson.RawCmd{ Jsonrpc: "1.0", Method: "walletislocked", Id: cmd.id, Params: []interface{}{}, } if cmd.Account != "" { raw.Params = append(raw.Params, cmd.Account) } return json.Marshal(raw) }
// MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. func (cmd *ExportWatchingWalletCmd) MarshalJSON() ([]byte, error) { // Fill a RawCmd and marshal. raw := btcjson.RawCmd{ Jsonrpc: "1.0", Method: "exportwatchingwallet", Id: cmd.id, } if cmd.Account != "" || cmd.Download { raw.Params = append(raw.Params, cmd.Account) } if cmd.Download { raw.Params = append(raw.Params, cmd.Download) } return json.Marshal(raw) }
// MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. func (cmd *GetAddressBalanceCmd) MarshalJSON() ([]byte, error) { // Fill a RawCmd and marshal. raw := btcjson.RawCmd{ Jsonrpc: "1.0", Method: "getaddressbalance", Id: cmd.id, Params: []interface{}{ cmd.Address, }, } if cmd.Minconf != 1 { raw.Params = append(raw.Params, cmd.Minconf) } return json.Marshal(raw) }
// MarshalJSON returns the JSON encoding of cmd. Part of the Cmd interface. func (cmd *RescanCmd) MarshalJSON() ([]byte, error) { // Fill a RawCmd and marshal. raw := btcjson.RawCmd{ Jsonrpc: "1.0", Method: "rescan", Id: cmd.id, Params: []interface{}{ cmd.BeginBlock, cmd.Addresses, }, } if cmd.EndBlock != btcdb.AllShas { raw.Params = append(raw.Params, cmd.EndBlock) } return json.Marshal(raw) }