Get fees to claims
This commit is contained in:
@@ -1,9 +1,11 @@
|
||||
using System.Net.Http.Json;
|
||||
using Managing.Infrastructure.Evm.Abstractions;
|
||||
using Microsoft.Extensions.Options;
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
using System.Web;
|
||||
using Managing.Application.Abstractions.Services;
|
||||
using Managing.Domain.Accounts;
|
||||
using Managing.Infrastructure.Evm.Models.Proxy;
|
||||
using Microsoft.Extensions.Options;
|
||||
|
||||
namespace Managing.Infrastructure.Evm.Services
|
||||
{
|
||||
@@ -146,6 +148,38 @@ namespace Managing.Infrastructure.Evm.Services
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<GmxClaimableSummary> GetGmxClaimableSummaryAsync(string account)
|
||||
{
|
||||
var payload = new { account };
|
||||
var response = await GetGmxServiceAsync<ClaimingFeesResponse>("/claimable-summary", payload);
|
||||
|
||||
|
||||
if (response.Data == null)
|
||||
{
|
||||
throw new Web3ProxyException("GMX claimable summary data is null");
|
||||
}
|
||||
|
||||
// Map from Web3Proxy response model to domain model
|
||||
return new GmxClaimableSummary
|
||||
{
|
||||
ClaimableFundingFees = new FundingFeesData
|
||||
{
|
||||
TotalUsdc = response.Data.ClaimableFundingFees.TotalUsdc
|
||||
},
|
||||
ClaimableUiFees = new UiFeesData
|
||||
{
|
||||
TotalUsdc = response.Data.ClaimableUiFees.TotalUsdc
|
||||
},
|
||||
RebateStats = new RebateStatsData
|
||||
{
|
||||
TotalRebateUsdc = response.Data.RebateStats.TotalRebateUsdc,
|
||||
DiscountUsdc = response.Data.RebateStats.DiscountUsdc,
|
||||
RebateFactor = response.Data.RebateStats.RebateFactor,
|
||||
DiscountFactor = response.Data.RebateStats.DiscountFactor
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
private async Task HandleErrorResponse(HttpResponseMessage response)
|
||||
{
|
||||
var statusCode = (int)response.StatusCode;
|
||||
@@ -198,7 +232,7 @@ namespace Managing.Infrastructure.Evm.Services
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
var queryString = new System.Text.StringBuilder("?");
|
||||
var queryString = new StringBuilder("?");
|
||||
bool isFirst = true;
|
||||
|
||||
foreach (var prop in properties)
|
||||
|
||||
Reference in New Issue
Block a user