import { CRYPTO_API, DEPOSIT_API } from '#lib/configs/api' import type { BaseResponse } from '#lib/types/api' import type { EWalletResponseItem, CryptoItem } from '#lib/types/deposit' import { useAPI } from '#lib/composables' import { useApiFetch } from './use-api-fetch' export const useDepositService = () => { const { request } = useApiFetch() /** * Fetches the code needed for e-wallet deposits. * * @returns {Promise>>} - A promise resolving to the API response with the e-wallet code. */ const fetchEWalletCodeService = async () => { return useAPI>(DEPOSIT_API.DEPOSIT_E_WALLET_CODE) } /** * Fetches the list of e-wallets available for deposits. * * @returns {Promise>>} - A promise resolving to the API response with a list of e-wallets. */ const fetchEWalletsService = () => { return useAPI>( DEPOSIT_API.DEPOSIT_E_WALLET_LIST, ) } /** * Fetches the cryptocurrency data. * * @returns {Promise} - A promise resolving to the API response with cryptocurrency data. */ const fetchCrypto = async () => { const { data } = await request(CRYPTO_API.CRYPTO) return data } return { fetchEWalletsService, fetchEWalletCodeService, fetchCrypto, } }