import { ActiveAccountProps, CheckEmailProps, LoginWithDappProps, ResendEmailActiveProps, ResetPasswordProps, SendEmailForgotPasswordProps, SignUpWithDappProps, UpdateProfileProps, } from '../state/user/types' import axiosService from './axiosService' import { APIResponseProps } from './types' export async function checkExistPublicAddress(params): Promise { return axiosService.get('/v1/user/public-address', { params }) } export async function register(data): Promise { return axiosService.post('/v1/user/public-address', data) } export async function loginWithMetaMask(data): Promise { return axiosService.post('/v1/user/public-address/auth', data) } export async function loginWithDapp(payload: LoginWithDappProps): Promise { return axiosService.post('/v1/user/login', payload) } export async function signUpWithDapp(data: SignUpWithDappProps): Promise { return axiosService.post('/v1/user/register', data) } export const activeAccount = async ( data: any, ): Promise<{ isSuccess: boolean data: ActiveAccountProps }> => { return axiosService.get(`/v1/user/active?code=${data.code}&email=${data.email}`) } export async function sendEmailForgotPassword(data: SendEmailForgotPasswordProps): Promise { return axiosService.get(`/v1/user/password/forgot?email=${data.email}`) } export async function resetPassword(data: ResetPasswordProps): Promise { return axiosService.post(`/v1/user/password/reset`, data) } export async function refreshQRCode(): Promise { return axiosService.get(`/v1/user/qr-code/refresh`) } export async function getAdjustedBalances(): Promise { return axiosService.get(`/v1/user/token`) } export async function updateProfile(payload: UpdateProfileProps): Promise { const { userId, userData } = payload return axiosService.put(`/v1/user/${userId}`, userData) } export async function checkEmail(data: CheckEmailProps): Promise { return axiosService.post('/v1/user/check/email', data) } export async function connectWallet(data): Promise { const { publicAddress, signature, config } = data return axiosService.post('/v1/user/public-address/signature', { publicAddress, signature }, config) } export async function resendEmailActive(data: ResendEmailActiveProps): Promise { const { email } = data return axiosService.get(`/v1/user/resend-code?email=${email}`) } export async function getUserInfo(): Promise { return axiosService.get('/v1/user/info') }