Rename to init
This commit is contained in:
@@ -153,11 +153,11 @@ namespace Managing.Api.Controllers
|
|||||||
/// Returns a list showing each exchange with its initialization status (true/false).
|
/// Returns a list showing each exchange with its initialization status (true/false).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>A list of exchange approval statuses.</returns>
|
/// <returns>A list of exchange approval statuses.</returns>
|
||||||
[HttpGet("exchange-approval-status")]
|
[HttpGet("exchanges-initialized-status")]
|
||||||
public async Task<ActionResult<List<ExchangeApprovalStatus>>> GetExchangeApprovalStatus()
|
public async Task<ActionResult<List<ExchangeInitializedStatus>>> GetExchangeApprovalStatus()
|
||||||
{
|
{
|
||||||
var user = await GetUser();
|
var user = await GetUser();
|
||||||
var exchangeStatuses = await _AccountService.GetExchangeApprovalStatusAsync(user);
|
var exchangeStatuses = await _AccountService.GetExchangeInitializedStatusAsync(user);
|
||||||
return Ok(exchangeStatuses);
|
return Ok(exchangeStatuses);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,5 +35,5 @@ public interface IAccountService
|
|||||||
Task<SwapInfos> SendTokenAsync(User user, string accountName, string recipientAddress, Ticker ticker,
|
Task<SwapInfos> SendTokenAsync(User user, string accountName, string recipientAddress, Ticker ticker,
|
||||||
decimal amount, int? chainId = null);
|
decimal amount, int? chainId = null);
|
||||||
|
|
||||||
Task<List<ExchangeApprovalStatus>> GetExchangeApprovalStatusAsync(User user);
|
Task<List<ExchangeInitializedStatus>> GetExchangeInitializedStatusAsync(User user);
|
||||||
}
|
}
|
||||||
@@ -333,21 +333,21 @@ public class AccountService : IAccountService
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<List<ExchangeApprovalStatus>> GetExchangeApprovalStatusAsync(User user)
|
public async Task<List<ExchangeInitializedStatus>> GetExchangeInitializedStatusAsync(User user)
|
||||||
{
|
{
|
||||||
var accounts = await GetAccountsByUserAsync(user, hideSecrets: true, getBalance: false);
|
var accounts = await GetAccountsByUserAsync(user, hideSecrets: true, getBalance: false);
|
||||||
|
|
||||||
var exchangeStatuses = new List<ExchangeApprovalStatus>();
|
var exchangeStatuses = new List<ExchangeInitializedStatus>();
|
||||||
|
|
||||||
foreach (var account in accounts)
|
foreach (var account in accounts)
|
||||||
{
|
{
|
||||||
exchangeStatuses.Add(new ExchangeApprovalStatus
|
exchangeStatuses.Add(new ExchangeInitializedStatus
|
||||||
{
|
{
|
||||||
Exchange = TradingExchanges.GmxV2,
|
Exchange = TradingExchanges.GmxV2,
|
||||||
IsInitialized = account.IsGmxInitialized
|
IsInitialized = account.IsGmxInitialized
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Future: Add other exchanges here when supported
|
// Future: Add other exchanges here when supported
|
||||||
// e.g.:
|
// e.g.:
|
||||||
// var hasEvmInitialized = accounts.Any(account =>
|
// var hasEvmInitialized = accounts.Any(account =>
|
||||||
@@ -357,7 +357,7 @@ public class AccountService : IAccountService
|
|||||||
// Exchange = TradingExchanges.Evm,
|
// Exchange = TradingExchanges.Evm,
|
||||||
// IsApproved = hasEvmInitialized
|
// IsApproved = hasEvmInitialized
|
||||||
// });
|
// });
|
||||||
|
|
||||||
return exchangeStatuses;
|
return exchangeStatuses;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,14 +0,0 @@
|
|||||||
using Orleans;
|
|
||||||
using static Managing.Common.Enums;
|
|
||||||
|
|
||||||
namespace Managing.Domain.Accounts;
|
|
||||||
|
|
||||||
[GenerateSerializer]
|
|
||||||
public class ExchangeApprovalStatus
|
|
||||||
{
|
|
||||||
[Id(0)]
|
|
||||||
public TradingExchanges Exchange { get; set; }
|
|
||||||
|
|
||||||
[Id(1)]
|
|
||||||
public bool IsInitialized { get; set; }
|
|
||||||
}
|
|
||||||
12
src/Managing.Domain/Accounts/ExchangeInitializedStatus.cs
Normal file
12
src/Managing.Domain/Accounts/ExchangeInitializedStatus.cs
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
using Orleans;
|
||||||
|
using static Managing.Common.Enums;
|
||||||
|
|
||||||
|
namespace Managing.Domain.Accounts;
|
||||||
|
|
||||||
|
[GenerateSerializer]
|
||||||
|
public class ExchangeInitializedStatus
|
||||||
|
{
|
||||||
|
[Id(0)] public TradingExchanges Exchange { get; set; }
|
||||||
|
|
||||||
|
[Id(1)] public bool IsInitialized { get; set; }
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user