40 lines
1.0 KiB
TypeScript
40 lines
1.0 KiB
TypeScript
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);
|
|
}
|
|
} |