const axios = require('axios'); var { account_config } = require('../config/config.js'); const logger = require('./logger.js'); var url = account_config.CZZ_BASEURL const withdraw = async (params) => { params.privateKey = '' params.toAddress = params.receiver logger.info('withdraw_czz', process.env.NODE_ENV, url, ' params ', params) var data = { ...params } return new Promise(resolve => { axios.post(url + '/withdraw', data, { timeout: 2 * 60 * 1000 }) .then(res => { console.log('res=>', res.status, res.data); resolve(res.data) }).catch(err => { logger.error('http_request_post withdraw_czz error ', JSON.stringify(err)); resolve(JSON.stringify(err)) }); }) } module.exports = { withdraw }