Add agent balance fetch from proxy

This commit is contained in:
2025-08-15 20:52:37 +07:00
parent b178f15beb
commit 289fd25dc3
9 changed files with 1622 additions and 43 deletions

View File

@@ -106,7 +106,7 @@ public class AccountService : IAccountService
throw new ArgumentException($"Account '{name}' not found");
}
ManageProperties(hideSecrets, getBalance, account);
await ManagePropertiesAsync(hideSecrets, getBalance, account);
if (account.User == null && account.User != null)
{
@@ -119,7 +119,7 @@ public class AccountService : IAccountService
public async Task<Account> GetAccountByKey(string key, bool hideSecrets, bool getBalance)
{
var account = await _accountRepository.GetAccountByKeyAsync(key);
ManageProperties(hideSecrets, getBalance, account);
await ManagePropertiesAsync(hideSecrets, getBalance, account);
return account;
}
@@ -127,7 +127,7 @@ public class AccountService : IAccountService
public async Task<Account> GetAccountByUser(User user, string name, bool hideSecrets, bool getBalance)
{
var account = await _accountRepository.GetAccountByNameAsync(name);
ManageProperties(hideSecrets, getBalance, account);
await ManagePropertiesAsync(hideSecrets, getBalance, account);
return account;
}
@@ -139,7 +139,7 @@ public class AccountService : IAccountService
if (account != null)
{
ManageProperties(hideSecrets, getBalance, account);
await ManagePropertiesAsync(hideSecrets, getBalance, account);
if (account.User != null)
{
account.User = await _userRepository.GetUserByNameAsync(account.User.Name);
@@ -161,7 +161,7 @@ public class AccountService : IAccountService
foreach (var account in result)
{
ManageProperties(hideSecrets, getBalance, account);
await ManagePropertiesAsync(hideSecrets, getBalance, account);
accounts.Add(account);
}
@@ -190,7 +190,7 @@ public class AccountService : IAccountService
foreach (var account in result.Where(a => a.User.Name == user.Name))
{
ManageProperties(hideSecrets, getBalance, account);
await ManagePropertiesAsync(hideSecrets, getBalance, account);
accounts.Add(account);
}
@@ -333,7 +333,7 @@ public class AccountService : IAccountService
}
}
private void ManageProperties(bool hideSecrets, bool getBalance, Account account)
private async Task ManagePropertiesAsync(bool hideSecrets, bool getBalance, Account account)
{
if (account != null)
{
@@ -341,7 +341,7 @@ public class AccountService : IAccountService
{
try
{
account.Balances = _exchangeService.GetBalances(account).Result;
account.Balances = await _exchangeService.GetBalances(account);
}
catch (Exception ex)
{