Beispiel #1
0
 private VoteMessage CreateVoteMessage(Vote vote)
 {
     return(new VoteMessage
     {
         ProposalId = vote.ProposalId.ToString(),
         Option = VoteMessage.ToOption(vote.Option),
         Voter = Wallet.Address
     });
 }
Beispiel #2
0
 private byte[] EncodeVoteMessage(VoteMessage voteMessage)
 {
     proto.Vote vote = new proto.Vote
     {
         Voter      = ByteString.CopyFrom(Wallet.AddressBytes),
         ProposalId = long.Parse(voteMessage.ProposalId),
         Option     = VoteMessage.ToOption(voteMessage.Option)
     };
     return(EncodeUtils.AminoWrap(vote.ToByteArray(), MessageType.GetTransactionType(EMessageType.Vote), false));
 }
Beispiel #3
0
        public string BuildVote(Vote vote)
        {
            Wallet.EnsureWalletIsReady();
            VoteMessage msgBean = CreateVoteMessage(vote);

            byte[] msg       = EncodeVoteMessage(msgBean);
            byte[] signature = EncodeSignature(Sign(msgBean));
            byte[] stdTx     = EncodeStdTx(msg, signature);
            return(EncodeUtils.ByteArrayToHex(stdTx));
        }