Exemplo n.º 1
0
        public async Task GetTxSettings()
        {
            Transaction             tran = new Transaction();
            TransactionFeeSettingOM om   = await tran.GetTxSettings();

            Assert.IsNotNull(om);
        }
Exemplo n.º 2
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public static async Task <ApiResponse> GetTxSettings()
        {
            ApiResponse response = new ApiResponse();

            try
            {
                TransactionFeeSetting setting = new TransactionFeeSetting();
                Transaction           trans   = new Transaction();

                TransactionFeeSettingOM result = await trans.GetTxSettings();

                if (result != null)
                {
                    setting.Confirmations = result.Confirmations;
                    setting.FeePerKB      = result.FeePerKB;
                    setting.Encrypt       = result.Encrypt;
                    response.Result       = Newtonsoft.Json.Linq.JToken.FromObject(setting);
                }
                else
                {
                    response.Result = null;
                }
            }
            catch (ApiCustomException ex)
            {
                Logger.Singleton.Error(ex.ToString());
                response.Error = new ApiError(ex.ErrorCode, ex.ToString());
            }
            catch (Exception ex)
            {
                Logger.Singleton.Error(ex.ToString());
                response.Error = new ApiError(ex.HResult, ex.ToString());
            }
            return(response);
        }
Exemplo n.º 3
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public async Task <TransactionFeeSettingOM> GetTxSettings()
        {
            AuthenticationHeaderValue authHeaderValue = null;
            RpcClient   client   = new RpcClient(new Uri(WalletNetwork.NetWork), authHeaderValue, null, null, "application/json");
            RpcRequest  request  = RpcRequest.WithNoParameters("GetTxSettings", 1);
            RpcResponse response = await client.SendRequestAsync(request);

            if (response.HasError)
            {
                throw new ApiCustomException(response.Error.Code, response.Error.Message);
            }
            TransactionFeeSettingOM responseValue = response.GetResult <TransactionFeeSettingOM>();

            return(responseValue);
        }