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)
}
版权属于:区块链中文技术社区 / 转载原创者
本文链接:https://bcskill.com/index.php/archives/1058.html
相关技术文章仅限于相关区块链底层技术研究,禁止用于非法用途,后果自负!本站严格遵守一切相关法律政策!