From 2acdc98135614bcc372f89ffa8be024dd6de7c9f Mon Sep 17 00:00:00 2001 From: jolan Date: Fri, 7 Apr 2017 12:56:55 -0500 Subject: [PATCH] dcrjson: add generatevote and remove some unused pieces (#652) --- dcrjson/dcrwalletextcmds.go | 38 ++++++++++++++++++------------------- dcrjson/walletsvrresults.go | 5 +++++ 2 files changed, 23 insertions(+), 20 deletions(-) diff --git a/dcrjson/dcrwalletextcmds.go b/dcrjson/dcrwalletextcmds.go index 5d781da7..e82a71b2 100644 --- a/dcrjson/dcrwalletextcmds.go +++ b/dcrjson/dcrwalletextcmds.go @@ -156,15 +156,25 @@ func NewCreateRawSSRtxCmd(inputs []TransactionInput, fee *float64) *CreateRawSSR } } -// GetBalanceToMaintainCmd is a type handling custom marshaling and -// unmarshaling of getbalancetomaintain JSON wallet extension -// commands. -type GetBalanceToMaintainCmd struct { +// GenerateVoteCmd is a type handling custom marshaling and +// unmarshaling of generatevote JSON wallet extension commands. +type GenerateVoteCmd struct { + BlockHash string + Height int64 + TicketHash string + VoteBits uint16 + VoteBitsExt string } -// NewGetBalanceToMaintainCmd creates a new GetBalanceToMaintainCmd. -func NewGetBalanceToMaintainCmd() *GetBalanceToMaintainCmd { - return &GetBalanceToMaintainCmd{} +// NewGenerateVoteCmd creates a new GenerateVoteCmd. +func NewGenerateVoteCmd(blockhash string, height int64, tickethash string, votebits uint16, voteBitsExt string) *GenerateVoteCmd { + return &GenerateVoteCmd{ + BlockHash: blockhash, + Height: height, + TicketHash: tickethash, + VoteBits: votebits, + VoteBitsExt: voteBitsExt, + } } // GetMultisigOutInfoCmd is a type handling custom marshaling and @@ -223,17 +233,6 @@ func NewGetTicketFeeCmd() *GetTicketFeeCmd { return &GetTicketFeeCmd{} } -// GetTicketMaxPriceCmd is a type handling custom marshaling and -// unmarshaling of getticketmaxprice JSON wallet extension -// commands. -type GetTicketMaxPriceCmd struct { -} - -// NewGetTicketMaxPriceCmd creates a new GetTicketMaxPriceCmd. -func NewGetTicketMaxPriceCmd() *GetTicketMaxPriceCmd { - return &GetTicketMaxPriceCmd{} -} - // GetTicketsCmd is a type handling custom marshaling and // unmarshaling of gettickets JSON wallet extension // commands. @@ -642,13 +641,12 @@ func init() { MustRegisterCmd("createrawsstx", (*CreateRawSStxCmd)(nil), flags) MustRegisterCmd("createrawssgentx", (*CreateRawSSGenTxCmd)(nil), flags) MustRegisterCmd("createrawssrtx", (*CreateRawSSRtxCmd)(nil), flags) - MustRegisterCmd("getbalancetomaintain", (*GetBalanceToMaintainCmd)(nil), flags) + MustRegisterCmd("generatevote", (*GenerateVoteCmd)(nil), flags) MustRegisterCmd("getmultisigoutinfo", (*GetMultisigOutInfoCmd)(nil), flags) MustRegisterCmd("getmasterpubkey", (*GetMasterPubkeyCmd)(nil), flags) MustRegisterCmd("getseed", (*GetSeedCmd)(nil), flags) MustRegisterCmd("getstakeinfo", (*GetStakeInfoCmd)(nil), flags) MustRegisterCmd("getticketfee", (*GetTicketFeeCmd)(nil), flags) - MustRegisterCmd("getticketmaxprice", (*GetTicketMaxPriceCmd)(nil), flags) MustRegisterCmd("gettickets", (*GetTicketsCmd)(nil), flags) MustRegisterCmd("getticketvotebits", (*GetTicketVoteBitsCmd)(nil), flags) MustRegisterCmd("getticketsvotebits", (*GetTicketsVoteBitsCmd)(nil), flags) diff --git a/dcrjson/walletsvrresults.go b/dcrjson/walletsvrresults.go index 7c0e8c36..0fb21740 100644 --- a/dcrjson/walletsvrresults.go +++ b/dcrjson/walletsvrresults.go @@ -5,6 +5,11 @@ package dcrjson +// GenerateVoteResult models the data from the generatevote command. +type GenerateVoteResult struct { + Hex string `json:"hex"` +} + // GetAccountBalanceResult models the account data from the getbalance command. type GetAccountBalanceResult struct { AccountName string `json:"accountname"`