简单的以太坊API以获取您的ERC20代币余额以及有用的信息
https://github.com/hunterlong/tokenbalance
import (
"github.com/hunterlong/tokenbalance"
)
func main() {
// connect to your Geth Server
configs = &tokenbalance.Config{
GethLocation: "https://eth.coinapp.io",
Logs: true,
}
configs.Connect()
// insert a Token Contract address and Wallet address
contract := "0x86fa049857e0209aa7d9e616f7eb3b3b78ecfdb0"
wallet := "0xbfaa1a1ea534d35199e84859975648b59880f639"
// query the blockchain and wallet details
token, err := tokenbalance.New(contract, wallet)
// Token Balance will respond back useful things
token.BalanceString() // "600000.0"
token.ETHString() // "1.020095885777777767"
token.Name // "OmiseGO"
token.Symbol // "OMG"
token.Decimals // 18
token.Balance // big.Int() (token balance)
token.ETH // big.Int() (ether balance)
}
当前页面是本站的「Google AMP」版。查看和发表评论请点击:完整版 »