Refactor SwapGmxTokens functionality into TradingService

- Moved SwapGmxTokensAsync method from AccountService to TradingService to centralize trading operations.
- Updated AccountController and AgentGrain to utilize the new TradingService method for swapping GMX tokens.
- Removed the old SwapGmxTokensAsync method from IAccountService and its implementation in AccountService.
This commit is contained in:
2025-12-01 22:49:30 +07:00
parent 9d536ea49e
commit 3771bb5dde
7 changed files with 53 additions and 47 deletions

View File

@@ -14,18 +14,22 @@ namespace Managing.Api.Controllers
public class AccountController : BaseController
{
private readonly IAccountService _AccountService;
private readonly ITradingService _TradingService;
/// <summary>
/// Initializes a new instance of the <see cref="AccountController"/> class.
/// </summary>
/// <param name="AccountService">Service for account-related operations.</param>
/// <param name="userService">Service for user-related operations.</param>
/// <param name="TradingService">Service for trading-related operations.</param>
public AccountController(
IAccountService AccountService,
IUserService userService)
IUserService userService,
ITradingService TradingService)
: base(userService)
{
_AccountService = AccountService;
_TradingService = TradingService;
}
/// <summary>
@@ -101,7 +105,7 @@ namespace Managing.Api.Controllers
public async Task<ActionResult<SwapInfos>> SwapGmxTokens(string name, [FromBody] SwapTokensRequest request)
{
var user = await GetUser();
var result = await _AccountService.SwapGmxTokensAsync(
var result = await _TradingService.SwapGmxTokensAsync(
user,
name,
request.FromTicker,