github.com/decred/politeia@v1.4.0/politeiawww/cmd/cmswww/activevotes.go (about) 1 // Copyright (c) 2017-2019 The Decred developers 2 // Use of this source code is governed by an ISC 3 // license that can be found in the LICENSE file. 4 5 package main 6 7 import "github.com/decred/politeia/politeiawww/cmd/shared" 8 9 // ActiveVotesCmd retreives all dccs that are currently being voted on. 10 type ActiveVotesCmd struct{} 11 12 // Execute executes the active votes command. 13 func (cmd *ActiveVotesCmd) Execute(args []string) error { 14 // Send request 15 avr, err := client.ActiveVotesDCC() 16 if err != nil { 17 return err 18 } 19 20 // Print response details 21 return shared.PrintJSON(avr) 22 } 23 24 // activeVotesHelpMsg is the output for the help command when 'activevotes' 25 // is specified. 26 const activeVotesHelpMsg = `activevotes "token" 27 28 Retrieve all dccs that are currently being voted on. 29 30 Arguments: None 31 32 Result: 33 { 34 "votes": [ 35 "dcc": { 36 "name": (string) Suggested short dcc name 37 "state": (PropStateT) Current state of dcc 38 "status": (PropStatusT) Current status of dcc 39 "timestamp": (int64) Timestamp of last update of dcc 40 "userid": (string) ID of user who submitted dcc 41 "username": (string) Username of user who submitted dcc 42 "publickey": (string) Public key used to sign dcc 43 "signature": (string) Signature of merkle root 44 "files": [ 45 { 46 "name": (string) Filename 47 "mime": (string) Mime type 48 "digest": (string) File digest 49 "payload": (string) File payload 50 } 51 ], 52 "numcomments": (uint) Number of comments on the dcc 53 "version": (string) Version of dcc 54 "censorshiprecord": { 55 "token": (string) Censorship token 56 "merkle": (string) Merkle root of dcc 57 "signature": (string) Server side signature of []byte(Merkle+Token) 58 } 59 }, 60 "startvote": { 61 "publickey" (string) Public key of user that submitted dcc 62 "vote": { 63 "token": (string) Censorship token 64 "mask" (uint64) Valid votebits 65 "duration": (uint32) Duration of vote in blocks 66 "quorumpercentage" (uint32) Percent of votes required for quorum 67 "passpercentage": (uint32) Percent of votes required to pass 68 "options": [ 69 { 70 "id" (string) Unique word identifying vote (e.g. yes) 71 "description" (string) Longer description of the vote 72 "bits": (uint64) Bits used for this option 73 }, 74 ] 75 }, 76 "signature" (string) Signature of Votehash 77 }, 78 "startvotereply": { 79 "startblockheight": (string) Block height at start of vote 80 "startblockhash": (string) Hash of first block of vote interval 81 "endheight": (string) Block height at end of vote 82 "eligibletickets": [ 83 "removed by cmswww for readability" 84 ] 85 } 86 ] 87 } 88 `