1 Star 0 Fork 12

小马过河/etherscan-api

forked from 楠木/etherscan-api 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
stat_e2e_test.go 1.20 KB
一键复制 编辑 原始数据 按行查看 历史
楠木 提交于 2018-08-06 14:20 . [dev] token-related method
/*
* Copyright (c) 2018 LI Zhennan
*
* Use of this work is governed by a MIT License.
* You may find a license copy in project root.
*/
package etherscan
import (
"math/big"
"testing"
)
func TestClient_EtherTotalSupply(t *testing.T) {
totalSupply, err := api.EtherTotalSupply()
noError(t, err, "api.EtherTotalSupply")
if totalSupply.Int().Cmp(big.NewInt(100)) != 1 {
t.Errorf("api.EtherTotalSupply not working, totalSupply is %s", totalSupply.Int().String())
}
}
func TestClient_EtherLatestPrice(t *testing.T) {
latest, err := api.EtherLatestPrice()
noError(t, err, "api.EtherLatestPrice")
if latest.ETHBTC == 0 {
t.Errorf("ETHBTC got 0")
}
if latest.ETHBTCTimestamp.Time().IsZero() {
t.Errorf("ETHBTCTimestamp is zero")
}
if latest.ETHUSD == 0 {
t.Errorf("ETHUSD got 0")
}
if latest.ETHUSDTimestamp.Time().IsZero() {
t.Errorf("ETHUSDTimestamp is zero")
}
}
func TestClient_TokenTotalSupply(t *testing.T) {
totalSupply, err := api.TokenTotalSupply("0x57d90b64a1a57749b0f932f1a3395792e12e7055")
noError(t, err, "api.TokenTotalSupply")
if totalSupply.Int().Cmp(big.NewInt(100)) != 1 {
t.Errorf("api.TokenTotalSupply not working, totalSupply is %s", totalSupply.Int().String())
}
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/andygoo/etherscan-api.git
git@gitee.com:andygoo/etherscan-api.git
andygoo
etherscan-api
etherscan-api
master

搜索帮助

23e8dbc6 1850385 7e0993f3 1850385