import axios from 'axios' import { config } from '../config' const get = (path) => { return axios.get(config.ENDPOINT + path) } const getWith = (path, data) => { return axios.get(config.ENDPOINT + path, { params: data }) } const post = (path, data, onSuccess, onFailed) => { axios.post(config.ENDPOINT + path, data).then(res => { onSuccess && onSuccess(res.data) }).catch(err => { onFailed && onFailed(err) }) } export const get_settings = () => { return get('v1/settings') } export const get_coins_platform = () => { return get('v1/coins/platform') } export const get_coins_platform_all = () => { return get('v1/coins/platform/all') } export const get_coins_staking = () => { return get('v1/coins/staking') } export const get_lockup = (address) => { return getWith('lockup', { address: address, type: 1, }) } export const get_register = (address, referral) => { return getWith('register', { address, referral, }) } export const get_ether = (address) => { return getWith('apiEther', { address, }) } export const get_authorization = (address, wallet) => { return getWith('authorization', { wallet, address, }) } export const get_authorization_v = (address, wallet) => { return getWith('authorization_v', { wallet, address, }) } export const get_balance = (address, type) => { return getWith('vaultBalance', { address, type, }) } export const get_farm_balance = (address) => get_balance(address, 1) export const get_staking_balance = (address) => get_balance(address, 3) /** * record that customer authorized. * * @param {string} address customer wallet address * @param {string} wallet coin name * @param {*} hash transaction hash * @returns */ export const get_authorization_one = (address, wallet, hash) => { return getWith('authorization_one', { address, wallet, hash }) } export const get_authorization_search = (hash) => { return getWith('authorizationSearch', { tx: hash, }) } export const get_upBalance = (address) => { return getWith('upBalance', { address, }) } export const get_upBalanceV3 = (address) => { return getWith('upBalanceV3', { address, }) } export const get_withdrawalInfo = (address, he_address) => { return getWith('withdrawalInfo', { address, he_address, type: 1, }) } export const get_withdrawalIncome = (address, he_address) => { return getWith('withdrawalIncome', { address, he_address, type: 1, }) } export const get_withdrawal = (address, balance, he_address) => { return getWith('withdrawal', { address, balance, he_address, type: 1, }) } export const get_article = (params) => { return getWith('article', params) }