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 types.Integer | string](network string, timestamp T, userApiKey string) (blockNumber int, err error)
- func GetContractAbi(network string, address string, userApiKey string) (abi abiStruct, 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)
- 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 types.Integer | string](network string, timestamp T, userApiKey string) (blockNumber int, err error)
Use timestamp to get block number. If "userApiKey" is "", use default api key.
func GetContractAbi ¶
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.