vspd/webapi/types.go
jholdstock 4f2766352b Improve handling of fee status.
- Fee tx status is now tracked using a dedicated field, with values none/received/broadcast/confirmed/error.
- Fee tx hex and hash are now both set in /payfee. The absense of txhash is no longer used to determine if a fee tx has been broadcast or not.
- setvotechoices can no longer be called before a fee is received.
- Remove `binding:required` from response types. It has no effect on responses, it is only needed on request types which are validated by gin.
2020-06-09 14:17:43 +00:00

61 lines
2.1 KiB
Go

package webapi
type vspInfoResponse struct {
Timestamp int64 `json:"timestamp"`
PubKey []byte `json:"pubkey"`
FeePercentage float64 `json:"feepercentage"`
VspClosed bool `json:"vspclosed"`
Network string `json:"network"`
}
type FeeAddressRequest struct {
Timestamp int64 `json:"timestamp" binding:"required"`
TicketHash string `json:"tickethash" binding:"required"`
}
type feeAddressResponse struct {
Timestamp int64 `json:"timestamp"`
FeeAddress string `json:"feeaddress"`
FeeAmount int64 `json:"feeamount"`
Expiration int64 `json:"expiration"`
Request FeeAddressRequest `json:"request"`
}
type PayFeeRequest struct {
Timestamp int64 `json:"timestamp" binding:"required"`
TicketHash string `json:"tickethash" binding:"required"`
FeeTx string `json:"feetx" binding:"required"`
VotingKey string `json:"votingkey" binding:"required"`
VoteChoices map[string]string `json:"votechoices" binding:"required"`
}
type payFeeResponse struct {
Timestamp int64 `json:"timestamp"`
Request PayFeeRequest `json:"request"`
}
type SetVoteChoicesRequest struct {
Timestamp int64 `json:"timestamp" binding:"required"`
TicketHash string `json:"tickethash" binding:"required"`
VoteChoices map[string]string `json:"votechoices" binding:"required"`
}
type setVoteChoicesResponse struct {
Timestamp int64 `json:"timestamp"`
Request SetVoteChoicesRequest `json:"request"`
}
type TicketStatusRequest struct {
Timestamp int64 `json:"timestamp" binding:"required"`
TicketHash string `json:"tickethash" binding:"required"`
}
type ticketStatusResponse struct {
Timestamp int64 `json:"timestamp"`
TicketConfirmed bool `json:"ticketconfirmed"`
FeeTxStatus string `json:"feetxstatus"`
FeeTxHash string `json:"feetxhash"`
VoteChoices map[string]string `json:"votechoices"`
Request TicketStatusRequest `json:"request"`
}