package com.liquidnet.common.third.xuper.biz;

import com.baidu.xasset.auth.XchainAccount;
import com.baidu.xasset.client.xasset.Asset;
import com.baidu.xasset.common.config.Config;
import com.baidu.xuper.api.Account;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import java.util.logging.Logger;

/**
 * @author AnJiabin <anjiabin@zhengzai.tv>
 * @version V1.0
 * @Description: TODO
 * @class: XuperCommonBiz
 * @Package com.liquidnet.common.third.xuper.biz
 * @Copyright: LightNet @ Copyright (c) 2022
 * @date 2022/4/18 17:59
 */
@Slf4j
@Component
public class XuperCommonBiz {
    public Asset getAssetApi(){
        long appId = 1182282645;
        String ak = "3bdecf4afebd41849628389a20629ecc";
        String sk = "3f901ef12d454b9c92ba2dde7c029140";

        Config.XassetCliConfig cfg = new Config.XassetCliConfig();
        cfg.setCredentials(appId, ak, sk);
        cfg.setEndPoint("http://120.48.16.137:8360");

        // 创建区块链账户
        Account acc = XchainAccount.newXchainEcdsaAccount(XchainAccount.mnemStrgthStrong, XchainAccount.mnemLangEN);
        // 初始化接口类
        Asset handle = new Asset(cfg, Logger.getGlobal());
        return handle;
    }
}
