def create_sub_aggregate(data): """创建子账户-聚合 该接口创建一个子账户和观察者,并设置自动提现地址""" api_key = data["api_key"] secret_key = data["secret_key"] account = data["account"] observer_name = data["obsname"] withdraw_address = data["withdraw_address"] tonce = get_time_stamp() if data.get("tonce"): tonce = data.get("tonce") url = base_url + "openapi/v1/account/sub/aggregate" body = { "tonce": tonce, "account": account, "observer_name": observer_name, "withdraw_address": withdraw_address } sign = hash_encrypt(secret_key, json.dumps(body)) header = { "X-API-KEY": api_key, "X-SIGNATURE": sign, "Content-Type": "application/json" } res = send_post(url, body, header) return res
def set_wallet_payment_address(data): """设置自动提现地址""" api_key = data["api_key"] secret_key = data["secret_key"] coin = data["coin"] address = data["address"] payment_password = data["payment_password"] url = base_url + "openapi/v1/wallet/payment/address" tonce = get_time_stamp() if data.get("tonce"): tonce = data.get("tonce") body = { "tonce": tonce, "coin": coin, "address": address, "payment_password": payment_password } sign = hash_encrypt(secret_key, json.dumps(body)) header = { "X-API-KEY": api_key, "X-SIGNATURE": sign, "Content-Type": "application/json" } res = send_post(url, body, header) return res
def create_wallets_wid(data): """通过key获取wid""" key = data["key"] # BTC的拓展公钥 url = base_url + "wallets/wid" header = {} body = {"key": key} res = send_post(url, body, header) return res
def all_read_msg(data): """消息全部已读""" wid = data["wid"] url = base_url + "wallets/msg/tx" header = {"X-WID": wid} body = {} res = send_post(url, body, header) return res
def pull_wallets_balance(data): """获取所有币的余额""" wid = data["wid"] coinlist = data["coinlist"] url = base_url + "wallets/balance" header = {"X-WID": wid} body = coinlist res = send_post(url, body, header) return res
def send_wallets_transactions(data): """发送交易""" coin = data["coin"] # btc tx_raw = data["tx_raw"] wid = data["wid"] url = base_url + "{0}/transactions".format(coin) body = {"tx_raw": tx_raw} header = {"X-Wid": wid} header.update(app_header) res = send_post(url, body, header) return res
def create_wallets_init(data): """注册钱包""" wid = data["wid"] btc_xpub = data["btc_xpub"] ltc_xpub = data["ltc_xpub"] bch_xpub = data["bch_xpub"] doge_xpub = data["doge_xpub"] url = base_url + "wallets/init" header = {"X-WID": wid} body = { "btc_xpub": btc_xpub, "ltc_xpub": ltc_xpub, "bch_xpub": bch_xpub, "doge_xpub": doge_xpub, } res = send_post(url, body, header) return res
def create_observer(data): """创建观察者""" api_key = data["api_key"] secret_key = data["secret_key"] obsname = data["obsname"] tonce = get_time_stamp() if data.get("tonce"): tonce = data.get("tonce") url = base_url + "openapi/v1/account/observer" body = {"tonce": tonce, "name": obsname} sign = hash_encrypt(secret_key, json.dumps(body)) header = { "X-API-KEY": api_key, "X-SIGNATURE": sign, "Content-Type": "application/json" } res = send_post(url, body, header) return res
def create_account_sub(data): """创建子账户""" api_key = data["api_key"] secret_key = data["secret_key"] account = data["account"] tonce = get_time_stamp() if data.get("tonce"): tonce = data.get("tonce") url = base_url + "openapi/v1/account/sub" body = {"tonce": tonce, "account": account} sign = hash_encrypt(secret_key, json.dumps(body)) header = { "X-API-KEY": api_key, "X-SIGNATURE": sign, "Content-Type": "application/json" } res = send_post(url, body, header) return res
def wallet_sweep(data): """结算钱包余额""" api_key = data["api_key"] secret_key = data["secret_key"] coin = data["coin"] tonce = get_time_stamp() if data.get("tonce"): tonce = data.get("tonce") url = base_url + "openapi/v1/wallet/sweep" body = { "tonce": tonce, "coin": coin, } sign = hash_encrypt(secret_key, json.dumps(body)) header = { "X-API-KEY": api_key, "X-SIGNATURE": sign, "Content-Type": "application/json" } res = send_post(url, body, header) return res
def create_account_group(data): """新建矿工分组""" api_key = data["api_key"] secret_key = data["secret_key"] coin = data["coin"] group_name = data["group_name"] tonce = get_time_stamp() if data.get("tonce"): tonce = data.get("tonce") url = base_url + "openapi/v1/account/group" body = { "tonce": tonce, "coin": coin, "group_name": group_name, } sign = hash_encrypt(secret_key, json.dumps(body)) header = { "X-API-KEY": api_key, "X-SIGNATURE": sign, "Content-Type": "application/json" } res = send_post(url, body, header) return res