* Remove HybridCodec * WIP on fixing proto JSON issues * WIP on fixing proto JSON issues * WIP on fixing proto JSON issues * WIP on fixing proto JSON issues * WIP on fixing proto JSON issues * Test fixes * Delete hybrid_codec.go * Fixes * Fixes * Fixes * Test fixes * Test fixes * Test fixes * Lint * Sim fixes * Sim fixes * Revert * Remove vesting account JSON tests * Update CHANGELOG.md * Lint * Sim fixes * Sim fixes * Docs * Migrate more amino usages * Remove custom VoteOption String() and json marshaling * Fix tests * Add comments, update CHANGELOG.md Co-authored-by: Jonathan Gimeno <jgimeno@gmail.com> Co-authored-by: Alexander Bezobchuk <alexanderbez@users.noreply.github.com>
51 lines
1.1 KiB
Go
51 lines
1.1 KiB
Go
package utils
|
|
|
|
import "github.com/cosmos/cosmos-sdk/x/gov/types"
|
|
|
|
// NormalizeVoteOption - normalize user specified vote option
|
|
func NormalizeVoteOption(option string) string {
|
|
switch option {
|
|
case "Yes", "yes":
|
|
return types.OptionYes.String()
|
|
|
|
case "Abstain", "abstain":
|
|
return types.OptionAbstain.String()
|
|
|
|
case "No", "no":
|
|
return types.OptionNo.String()
|
|
|
|
case "NoWithVeto", "no_with_veto":
|
|
return types.OptionNoWithVeto.String()
|
|
|
|
default:
|
|
return option
|
|
}
|
|
}
|
|
|
|
//NormalizeProposalType - normalize user specified proposal type
|
|
func NormalizeProposalType(proposalType string) string {
|
|
switch proposalType {
|
|
case "Text", "text":
|
|
return types.ProposalTypeText
|
|
|
|
default:
|
|
return ""
|
|
}
|
|
}
|
|
|
|
//NormalizeProposalStatus - normalize user specified proposal status
|
|
func NormalizeProposalStatus(status string) string {
|
|
switch status {
|
|
case "DepositPeriod", "deposit_period":
|
|
return "DepositPeriod"
|
|
case "VotingPeriod", "voting_period":
|
|
return "VotingPeriod"
|
|
case "Passed", "passed":
|
|
return "Passed"
|
|
case "Rejected", "rejected":
|
|
return "Rejected"
|
|
default:
|
|
return status
|
|
}
|
|
}
|