Fix get Gas fees + position direction list
This commit is contained in:
@@ -7,6 +7,7 @@ using System.Web;
|
||||
using Managing.Application.Abstractions.Services;
|
||||
using Managing.Core.Exceptions;
|
||||
using Managing.Domain.Accounts;
|
||||
using Managing.Domain.Evm;
|
||||
using Managing.Infrastructure.Evm.Models.Proxy;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.Extensions.Options;
|
||||
@@ -408,7 +409,34 @@ namespace Managing.Infrastructure.Evm.Services
|
||||
throw new Web3ProxyException($"Gas fee request failed: {response.Error}");
|
||||
}
|
||||
|
||||
return (decimal)(response.EstimatedGasFeeUsd ?? 0);
|
||||
if (response.Data is null)
|
||||
{
|
||||
throw new Web3ProxyException("Gas fee data is null");
|
||||
}
|
||||
|
||||
return (decimal)(response.Data.EstimatedGasFeeUsd ?? 0);
|
||||
}
|
||||
|
||||
public async Task<GasFeeData> GetGasFeeDataAsync()
|
||||
{
|
||||
var response = await GetGmxServiceAsync<GasFeeResponse>("/gas-fee", null);
|
||||
|
||||
if (response == null)
|
||||
{
|
||||
throw new Web3ProxyException("Gas fee response is null");
|
||||
}
|
||||
|
||||
if (!response.Success)
|
||||
{
|
||||
throw new Web3ProxyException($"Gas fee request failed: {response.Error}");
|
||||
}
|
||||
|
||||
if (response.Data is null)
|
||||
{
|
||||
throw new Web3ProxyException("Gas fee data is null");
|
||||
}
|
||||
|
||||
return response.Data;
|
||||
}
|
||||
|
||||
private async Task HandleErrorResponse(HttpResponseMessage response)
|
||||
|
||||
Reference in New Issue
Block a user