
/**
 * Web唐明明
 * 匆匆数载恍如梦，岁月迢迢华发增。
 * 碌碌无为枉半生，一朝惊醒万事空。
 * moduleName: 钱包
 */

import {request} from '../index.js'

// 导出助记词
const seed = () => {
	return request({
		url: 'chain/safe/seed'
	})
}

const hash = (data) => {
	return request({
		url: 'chain/wallet/hash',
		method: 'POST',
		data: data
	})
}

// 收款码
const code = () => {
	return request({
		url: 'chain/account/code'
	})
}

// 原石余额
const sum = () => {
	return request({
		url: 'chain/account/balance'
	})
}

// 原石价格
const price = () => {
	return request({
		url: 'nodes/price'
	})
}

// 账户记录
const logs = (data) => {
	return request({
		url: 'chain/account/logs',
		data: data
	})
}

// 设置安全密码
const security = (data) => {
	return request({
		url: 'chain/safe/security',
		method: 'POST',
		data
	})
}

// 转账
const transfer = (data) => {
	return request({
		url: 'chain/account/transfer',
		method: 'POST',
		data
	})
}

// 钱包私钥
const privatekey = (code) => {
	return request({
		url : "chain/safe/private_key",
		data: {
			code
		} 
	})
}

// 获取可提现信息
const withdraw = () => {
	return request({
		url : "withdraw"
	})
}

// 提现记录
const withdrawLogs = (data) => {
	return request({
		url : "withdraw/logs",
    data:data
	})
}

//  提现
const withdrawDo = (data) => {
	return request({
		url : "withdraw",
		method: 'POST',
		data:data
	})
}

//  验证支付密码是否正确
const securityCheck = (password) => {
	return request({
		url : "chain/safe/security/check",
		method: 'POST',
		data:{
			code : password,
		}
	})
}

//  修改密码
const securityReset = (data) => {
	return request({
		url : "chain/safe/security",
		method: 'PUT',
		data:data
	})
}

// 提现服务条款
const cmsWithdraw = () => {
	return request({
		url : "cms/withdraw"
	})
}

// 私钥规则
const keyrules = () => {
	return request({
		url: 'cms/keyrules'
	})
}

export {
	seed,
	hash,
	code,
	sum,
	price,
	logs,
	security,
	transfer,
	privatekey,
	withdraw,
	withdrawLogs,
	withdrawDo,
	securityCheck,
	securityReset,
	cmsWithdraw,
	keyrules
}

