website refactor
This commit is contained in:
40
apps/website/lib/services/leagues/LeagueWalletService.ts
Normal file
40
apps/website/lib/services/leagues/LeagueWalletService.ts
Normal file
@@ -0,0 +1,40 @@
|
||||
import { WalletsApiClient } from '@/lib/api/wallets/WalletsApiClient';
|
||||
import type { LeagueWalletDTO, WithdrawRequestDTO, WithdrawResponseDTO } from '@/lib/api/wallets/WalletsApiClient';
|
||||
|
||||
/**
|
||||
* LeagueWalletService - DTO Only
|
||||
*
|
||||
* Returns raw API DTOs. No ViewModels or UX logic.
|
||||
* All client-side presentation logic must be handled by hooks/components.
|
||||
*/
|
||||
export class LeagueWalletService {
|
||||
constructor(
|
||||
private readonly apiClient: WalletsApiClient
|
||||
) {}
|
||||
|
||||
/**
|
||||
* Get wallet for a league
|
||||
*/
|
||||
async getWalletForLeague(leagueId: string): Promise<LeagueWalletDTO> {
|
||||
return this.apiClient.getLeagueWallet(leagueId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Withdraw from league wallet
|
||||
*/
|
||||
async withdraw(
|
||||
leagueId: string,
|
||||
amount: number,
|
||||
currency: string,
|
||||
seasonId: string,
|
||||
destinationAccount: string
|
||||
): Promise<WithdrawResponseDTO> {
|
||||
const payload: WithdrawRequestDTO = {
|
||||
amount,
|
||||
currency,
|
||||
seasonId,
|
||||
destinationAccount,
|
||||
};
|
||||
return this.apiClient.withdrawFromLeagueWallet(leagueId, payload);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user