代码拉取完成,页面将自动刷新
同步操作将从 楠木/etherscan-api 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
/*
* 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
// AccountBalance gets ether balance for a single address
func (c *Client) AccountBalance(address string) (balance *BigInt, err error) {
param := M{
"tag": "latest",
"address": address,
}
balance = new(BigInt)
err = c.call("account", "balance", param, balance)
return
}
// MultiAccountBalance gets ether balance for multiple addresses in a single call
func (c *Client) MultiAccountBalance(addresses ...string) (balances []AccountBalance, err error) {
param := M{
"tag": "latest",
"address": addresses,
}
balances = make([]AccountBalance, 0, len(addresses))
err = c.call("account", "balancemulti", param, &balances)
return
}
// NormalTxByAddress gets a list of "normal" transactions by address
//
// startBlock and endBlock can be nil
//
// if desc is true, result will be sorted in blockNum descendant order.
func (c *Client) NormalTxByAddress(address string, startBlock *int, endBlock *int, page int, offset int, desc bool) (txs []NormalTx, err error) {
param := M{
"address": address,
"page": page,
"offset": offset,
}
compose(param, "startblock", startBlock)
compose(param, "endblock", endBlock)
if desc {
param["sort"] = "desc"
} else {
param["sort"] = "asc"
}
err = c.call("account", "txlist", param, &txs)
return
}
// InternalTxByAddress gets a list of "internal" transactions by address
//
// startBlock and endBlock can be nil
//
// if desc is true, result will be sorted in descendant order.
func (c *Client) InternalTxByAddress(address string, startBlock *int, endBlock *int, page int, offset int, desc bool) (txs []InternalTx, err error) {
param := M{
"address": address,
"page": page,
"offset": offset,
}
compose(param, "startblock", startBlock)
compose(param, "endblock", endBlock)
if desc {
param["sort"] = "desc"
} else {
param["sort"] = "asc"
}
err = c.call("account", "txlistinternal", param, &txs)
return
}
// ERC20Transfers get a list of "erc20 - token transfer events" by
// contract address and/or from/to address.
//
// leave undesired condition to nil.
//
// Note on a Etherscan bug:
// Some ERC20 contract does not have valid decimals information in Etherscan.
// When that happens, TokenName, TokenSymbol are empty strings,
// and TokenDecimal is 0.
//
// More information can be found at:
// https://github.com/nanmu42/etherscan-api/issues/8
func (c *Client) ERC20Transfers(contractAddress, address *string, startBlock *int, endBlock *int, page int, offset int, desc bool) (txs []ERC20Transfer, err error) {
param := M{
"page": page,
"offset": offset,
}
compose(param, "contractaddress", contractAddress)
compose(param, "address", address)
compose(param, "startblock", startBlock)
compose(param, "endblock", endBlock)
if desc {
param["sort"] = "desc"
} else {
param["sort"] = "asc"
}
err = c.call("account", "tokentx", param, &txs)
return
}
// BlocksMinedByAddress gets list of blocks mined by address
func (c *Client) BlocksMinedByAddress(address string, page int, offset int) (mined []MinedBlock, err error) {
param := M{
"address": address,
"blocktype": "blocks",
"page": page,
"offset": offset,
}
err = c.call("account", "getminedblocks", param, &mined)
return
}
// UnclesMinedByAddress gets list of uncles mined by address
func (c *Client) UnclesMinedByAddress(address string, page int, offset int) (mined []MinedBlock, err error) {
param := M{
"address": address,
"blocktype": "uncles",
"page": page,
"offset": offset,
}
err = c.call("account", "getminedblocks", param, &mined)
return
}
// TokenBalance get erc20-token account balance of address for contractAddress
func (c *Client) TokenBalance(contractAddress, address string) (balance *BigInt, err error) {
param := M{
"contractaddress": contractAddress,
"address": address,
"tag": "latest",
}
err = c.call("account", "tokenbalance", param, &balance)
return
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。