Exemple #1
0
        public Task <StdTx> PostWithdrawAddressAsync(string delegatorAddress, SetWithdrawalAddrRequest request, CancellationToken cancellationToken = default)
        {
            var baseReq = new BaseReqWithSimulate(request.BaseReq, false);

            request = new SetWithdrawalAddrRequest(baseReq, request.WithdrawAddress);

            return(_clientGetter()
                   .Request("distribution", "delegators", delegatorAddress, "withdraw_address")
                   .PostJsonAsync(request, cancellationToken)
                   .ReceiveJson <StdTx>()
                   .WrapExceptions());
        }
        public async Task PostWithdrawAddressSimulationNotEmpty()
        {
            using var client = CreateClient(Configuration.LocalBaseUrl);

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

            var request       = new SetWithdrawalAddrRequest(baseRequest, Configuration.LocalAccount1Address);
            var gasEstimation = await client
                                .Distribution
                                .PostWithdrawAddressSimulationAsync(Configuration.LocalDelegator1Address, request);

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

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

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

            var request = new SetWithdrawalAddrRequest(baseRequest, Configuration.LocalAccount1Address);
            var stdTx   = await client
                          .Distribution
                          .PostWithdrawAddressAsync(Configuration.LocalDelegator1Address, request);

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

            CheckStdTx(baseRequest, stdTx);
            var msg = stdTx
                      .Msg
                      .OfType <MsgSetWithdrawAddress>()
                      .First();

            Assert.Equal(Configuration.LocalDelegator1Address, msg.DelegatorAddress);
            Assert.Equal(Configuration.LocalAccount1Address, msg.WithdrawAddress);
        }
Exemple #4
0
 public StdTx PostWithdrawAddress(string delegatorAddress, SetWithdrawalAddrRequest request)
 {
     return(PostWithdrawAddressAsync(delegatorAddress, request)
            .Sync());
 }
Exemple #5
0
 public GasEstimateResponse PostWithdrawAddressSimulation(string delegatorAddress, SetWithdrawalAddrRequest request)
 {
     return(PostWithdrawAddressSimulationAsync(delegatorAddress, request)
            .Sync());
 }