资源加载中... loading...

火币点卡

Author: 一拳男孩, Date: 2019-08-13 21:56:10
Tags: Tool

  • getHBPoints(exchange)

获取火币点卡 返回值,number类型


$.getHBPoints = function(ex) {
    try {
        var accountRet = ex.IO("api", "GET", "/v1/account/accounts")
        if (accountRet && accountRet.data) {
            var account = _.findWhere(accountRet.data, {
                type: 'point'
            })
            if (account && account.id) {
                var balanceRet = ex.IO("api", "GET", "/v1/account/accounts/" + account.id + "/balance")
                if (balanceRet && balanceRet.data && balanceRet.data.list) {
                    var balance = _.reduce(balanceRet.data.list, function(p, n) {
                        return new Decimal(p).plus(n.balance).toNumber()
                    }, 0)
                    return balance
                }
            }
        }
    } catch (e) {}
    return null
}

Related

More