From 979e58f41812134a377fb1c9ff95f0ae016f878d Mon Sep 17 00:00:00 2001 From: LuttyYang Date: Sat, 29 May 2021 17:00:33 +0800 Subject: [PATCH] fix https://github.com/harmony-one/go-sdk/issues/255 (#257) --- pkg/governance/api.go | 14 +++++++++----- pkg/governance/cli.go | 7 ++++--- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/pkg/governance/api.go b/pkg/governance/api.go index 17d5f84..4b778f4 100644 --- a/pkg/governance/api.go +++ b/pkg/governance/api.go @@ -6,10 +6,9 @@ import ( ) type Space struct { - Name string `json:"name"` - Key string `json:"key"` - Network string `json:"network"` - Symbol string `json:"symbol"` + Name string `json:"name"` + Key string `json:"key,omitempty"` + Symbol string `json:"symbol"` } func listSpaces() (spaces map[string]*Space, err error) { @@ -20,6 +19,10 @@ func listSpaces() (spaces map[string]*Space, err error) { return nil, err } + for k, space := range result { + space.Key = k + } + return result, nil } @@ -68,7 +71,7 @@ type ProposalIPFSMsg struct { } type ProposalVoteMsgPayload struct { - Choice int `json:"choice"` + Choice int `json:"choice,string"` Proposal string `json:"proposal"` } @@ -143,6 +146,7 @@ type NewProposalJson struct { } `json:"params"` } `json:"strategies"` } `json:"metadata"` + MaxCanSelect int `json:"maxCanSelect"` } `json:"payload"` } diff --git a/pkg/governance/cli.go b/pkg/governance/cli.go index a87688a..485dacb 100644 --- a/pkg/governance/cli.go +++ b/pkg/governance/cli.go @@ -24,10 +24,10 @@ func PrintListSpace() error { table := tablewriter.NewWriter(os.Stdout) table.SetBorder(false) - table.SetHeader([]string{"Key", "Network", "Name"}) + table.SetHeader([]string{"Key", "Name"}) for key, space := range spaces { - table.Append([]string{key, space.Network, space.Name}) + table.Append([]string{key, space.Name}) } table.Render() @@ -135,7 +135,8 @@ var proposalTemplate = []byte(`{ } } ] - } + }, + "maxCanSelect": 1 } }`)