Beispiel #1
0
        public Task <StdTx> PostVoteAsync(ulong proposalId, VoteReq request, CancellationToken cancellationToken = default)
        {
            var baseReq = new BaseReqWithSimulate(request.BaseReq, false);

            request = new VoteReq(baseReq, request.Voter, request.Option);

            return(_clientGetter()
                   .Request("gov", "proposals", proposalId, "votes")
                   .PostJsonAsync(request, cancellationToken)
                   .ReceiveJson <StdTx>()
                   .WrapExceptions());
        }
Beispiel #2
0
        public async Task PostVoteSimulationNotEmpty()
        {
            using var client = CreateClient(Configuration.LocalBaseUrl);

            var baseReq = await client.CreateBaseReq(Configuration.LocalAccount1Address, "", null, null, null, null);

            var voteReq = new VoteReq(baseReq, Configuration.LocalAccount1Address, VoteOption.Yes);

            var gasEstimation = await client
                                .Governance
                                .PostVoteSimulationAsync(ProposalId, voteReq);

            OutputHelper.WriteLine("Deserialized Gas Estimation:");
            Dump(gasEstimation);

            Assert.True(gasEstimation.GasEstimate > 0);
        }
Beispiel #3
0
        public async Task PostVoteNotEmpty()
        {
            using var client = CreateClient(Configuration.LocalBaseUrl);

            var baseReq = await client.CreateBaseReq(Configuration.LocalAccount1Address, "memo", null, null, null, null);

            var voteReq = new VoteReq(baseReq, Configuration.LocalAccount1Address, VoteOption.Yes);

            var tx = await client
                     .Governance
                     .PostVoteAsync(ProposalId, voteReq);

            OutputHelper.WriteLine("Deserialized StdTx:");
            Dump(tx);

            Assert.Equal("memo", tx.Memo);
            var msg = tx.Msg.OfType <MsgVote>().First();

            Assert.Equal(VoteOption.Yes, msg.Option);
            Assert.Equal(Configuration.LocalAccount1Address, msg.Voter);
            Assert.Equal(ProposalId, msg.ProposalId);
        }
Beispiel #4
0
 public StdTx PostVote(ulong proposalId, VoteReq request)
 {
     return(PostVoteAsync(proposalId, request)
            .Sync());
 }
Beispiel #5
0
 public GasEstimateResponse PostVoteSimulation(ulong proposalId, VoteReq request)
 {
     return(PostVoteSimulationAsync(proposalId, request)
            .Sync());
 }