Documentation
¶
Index ¶
- Variables
- func GetBalance(network string, address string, userApiKey string) (balance int, err error)
- func GetBalances(network string, addresses []string, userApiKey string) (res blockscanGetBalancesReq, err error)
- func GetBlockNumberByTimestamp[T common.Integer | string](network string, timestamp T, userApiKey string) (int, error)
- func GetContractAbi(network string, address string, userApiKey string) (res blockscanResultStringReq, err error)
- func GetContractName(network string, address string, userApiKey string) (name string, err error)
- func GetErc20Transactions[T int | string](network string, address string, startBlock int, endBlock T, userApiKey string) (res blockscanGetErc20TxsReq, err error)
- func GetErc20TransactionsAll(network string, address string, userApiKey string) (txs []blockscanErc20Txs, err error)
- func GetEvents[T int | string](network string, topic0 string, address string, startblock int, endblock T, ...) (res blockscanGetEventsReq, err error)
- func GetGasPrice(network string, userApiKey string) (gasPrice int64, err error)
- func GetGasPriceAll(networks []string, userApiKey string) (err error)
- func GetInternalTransactions[T int | string](network string, address string, startBlock int, endBlock T, userApiKey string) (res blockscanGetInternalTxsReq, err error)
- func GetInternalTransactionsAll(network string, address string, userApiKey string) (txs []blockscanInternalTxs, err error)
- func GetNormalTransactions[T int | string](network string, address string, startBlock int, endBlock T, userApiKey string) (res blockscanGetNormalTxsReq, err error)
- func GetNormalTransactionsAll(network string, address string, userApiKey string) (txs []blockscanNormalTxs, err error)
- func GetSourceCode(network string, address string, userApiKey string) (res blockscanSourceCodeReq, err error)
- func GetUrlAndKey(network string) (urlHead string, apiKey string, err error)
- func IsVerifiedContract(network string, address string, userApiKey string) (isContract bool, err error)
- func ProcessContractAbi(network string, address string, userApiKey string) (abi abiStruct, err error)
- type BlockscanEvents
- type BlockscanInfo
Constants ¶
This section is empty.
Variables ¶
var BlockscanCnf = map[string]BlockscanInfo{ constants.ArbitrumChainName: {URLHead: "https://api.arbiscan.io/api?", APIKey: "BCJX4984KDQ8A3U9WWH8P2EQKN76YV8T5T"}, constants.AvalancheChainName: {URLHead: "https://api.snowtrace.io/api?", APIKey: "K6SR1G96B2SQBRWPI4JP8WXM6BCG62EPQ7"}, constants.BinanaceSmartChainName: {URLHead: "https://api.bscscan.com/api?", APIKey: "34WQ9W88CSRHX4ZK59WNKKZYDAP5CEXINP"}, constants.EthereumChainName: {URLHead: "https://api.etherscan.io/api?", APIKey: "RAFFHS8XP7K1FCBDFZS4TI2C9VHQBG77RP"}, constants.FantomChainName: {URLHead: "https://api.ftmscan.com/api?", APIKey: "Q61VSDQJ7R6WQF5NJJRWDFZJJQDMW4ZR15"}, constants.GoerliChainName: {URLHead: "https://api-goerli.etherscan.io/api?", APIKey: "RAFFHS8XP7K1FCBDFZS4TI2C9VHQBG77RP"}, constants.HecoChainName: {URLHead: "https://api.hecoinfo.com/api?", APIKey: "KC7PPFXMH6V187SGUDWD2XMGPCJXQWSPM5"}, constants.OptimismChainName: {URLHead: "https://api-optimistic.etherscan.io/api?", APIKey: "RAFFHS8XP7K1FCBDFZS4TI2C9VHQBG77RP"}, constants.PolygonChainName: {URLHead: "https://api.polygonscan.com/api?", APIKey: "Q31QP1KF13D6E298AJQ6X5ZHN373VDMF2S"}, }
Functions ¶
func GetBalance ¶
get balance of a single address if "userApiKey" is "", use default api key
func GetBalances ¶
func GetBalances(network string, addresses []string, userApiKey string) (res blockscanGetBalancesReq, err error)
get balances of up to 20 addresses in one call if "userApiKey" is "", use default api key
func GetBlockNumberByTimestamp ¶
func GetBlockNumberByTimestamp[T common.Integer | string](network string, timestamp T, userApiKey string) (int, error)
use timestamp to get block number if "userApiKey" is "", use default api key
func GetContractAbi ¶
func GetContractAbi(network string, address string, userApiKey string) (res blockscanResultStringReq, err error)
get the contract's abi(if it is a verified contract) if "userApiKey" is "", use default api key
func GetContractName ¶
get the contract's name by its source code if "userApiKey" is "", use default api key
func GetErc20Transactions ¶
func GetErc20Transactions[T int | string](network string, address string, startBlock int, endBlock T, userApiKey string) (res blockscanGetErc20TxsReq, err error)
get up to 10000 erc20 txs of an address if "userApiKey" is "", use default api key
func GetErc20TransactionsAll ¶
func GetErc20TransactionsAll(network string, address string, userApiKey string) (txs []blockscanErc20Txs, err error)
get all the erc20 txs of an address if "userApiKey" is "", use default api key
func GetEvents ¶
func GetEvents[T int | string](network string, topic0 string, address string, startblock int, endblock T, userApiKey string) (res blockscanGetEventsReq, err error)
get up to 1000 events of an address if "userApiKey" is "", use default api key
func GetGasPrice ¶
if "userApiKey" is "", use default api key
func GetGasPriceAll ¶
get and print all chains' gas price by Gwei if "userApiKey" is "", use default api key
func GetInternalTransactions ¶
func GetInternalTransactions[T int | string](network string, address string, startBlock int, endBlock T, userApiKey string) (res blockscanGetInternalTxsReq, err error)
get up to 10000 internal txs of an address if "userApiKey" is "", use default api key
func GetInternalTransactionsAll ¶
func GetInternalTransactionsAll(network string, address string, userApiKey string) (txs []blockscanInternalTxs, err error)
get all the internal txs of an address if "userApiKey" is "", use default api key
func GetNormalTransactions ¶
func GetNormalTransactions[T int | string](network string, address string, startBlock int, endBlock T, userApiKey string) (res blockscanGetNormalTxsReq, err error)
get up to 10000 txs of an address if "userApiKey" is "", use default api key
func GetNormalTransactionsAll ¶
func GetNormalTransactionsAll(network string, address string, userApiKey string) (txs []blockscanNormalTxs, err error)
get all the txs of an address if "userApiKey" is "", use default api key
func GetSourceCode ¶
func GetSourceCode(network string, address string, userApiKey string) (res blockscanSourceCodeReq, err error)
get the source code of a contract if "userApiKey" is "", use default api key
func GetUrlAndKey ¶
read the config and get api key
Types ¶
type BlockscanEvents ¶
type BlockscanEvents struct {
Address string `json:"address"`
Topics []string `json:"topics"`
Data string `json:"data"`
BlockNumber string `json:"blockNumber"`
TimeStamp string `json:"timeStamp"`
GasPrice string `json:"gasPrice"`
GasUsed string `json:"gasUsed"`
LogIndex string `json:"logIndex"`
TransactionHash string `json:"transactionHash"`
TransactionIndex string `json:"transactionIndex"`
}
func GetEventsAll ¶
func GetEventsAll(network string, topic0 string, address string, userApiKey string) (events []BlockscanEvents, err error)
get all the events of an address if "userApiKey" is "", use default api key