Fix get Gas fees + position direction list

This commit is contained in:
2025-09-26 12:02:07 +07:00
parent bcfeb693ce
commit 1e19e29cec
7 changed files with 213 additions and 50 deletions

View File

@@ -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)