Documentation
¶
Index ¶
- func GetBalance(network string, address string, userApiKey string) (balance int, err error)
- func GetBlockNumberByTimestamp[T types.Integer | string](network string, timestamp T, userApiKey string) (blockNumber int, err error)
- func GetContractName(network string, address string, userApiKey string) (name string, err error)
- func GetGasPrice(network string, userApiKey string) (gasPrice int64, err error)
- func GetGasPriceAll(networks []string, userApiKey string) (gasPriceMap map[string]int64, 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 AbiStruct
- type BlockscanErc20Txs
- type BlockscanEvents
- type BlockscanGasPriceReq
- type BlockscanGetBalanceReq
- type BlockscanGetBalancesReq
- type BlockscanGetErc20TxsReq
- type BlockscanGetEventsReq
- type BlockscanGetInternalTxsReq
- type BlockscanGetNormalTxsReq
- type BlockscanInternalTxs
- type BlockscanNormalTxs
- type BlockscanResultStringReq
- type BlockscanSourceCodeReq
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetBalance ¶
Get balance of a single address. 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 GetContractName ¶
Get the contract's name by its source code. 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 GetUrlAndKey ¶
Read the config and get api key.
Types ¶
type AbiStruct ¶
type AbiStruct []struct {
Inputs []struct {
InternalType string `json:"internalType"`
Name string `json:"name"`
Type string `json:"type"`
} `json:"inputs"`
StateMutability string `json:"stateMutability"`
Type string `json:"type"`
Anonymous bool `json:"anonymous"`
Name string `json:"name"`
Outputs []struct {
InternalType string `json:"internalType"`
Name string `json:"name"`
Type string `json:"type"`
} `json:"outputs"`
}
type BlockscanErc20Txs ¶
type BlockscanErc20Txs struct {
BlockNumber string `json:"blockNumber"`
TimeStamp string `json:"timeStamp"`
Hash string `json:"hash"`
Nonce string `json:"nonce"`
BlockHash string `json:"blockHash"`
From string `json:"from"`
ContractAddress string `json:"contractAddress"`
To string `json:"to"`
Value string `json:"value"`
TokenName string `json:"tokenName"`
TokenSymbol string `json:"tokenSymbol"`
TokenDecimal string `json:"tokenDecimal"`
TransactionIndex string `json:"transactionIndex"`
Gas string `json:"gas"`
GasPrice string `json:"gasPrice"`
GasUsed string `json:"gasUsed"`
CumulativeGasUsed string `json:"cumulativeGasUsed"`
Input string `json:"input"`
Confirmations string `json:"confirmations"`
}
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.
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.
type BlockscanGasPriceReq ¶
type BlockscanGetBalanceReq ¶
type BlockscanGetBalancesReq ¶
type BlockscanGetBalancesReq struct {
Status string `json:"status"`
Message string `json:"message"`
Result []struct {
Account string `json:"account"`
Balance string `json:"balance"`
} `json:"result"`
}
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.
type BlockscanGetErc20TxsReq ¶
type BlockscanGetErc20TxsReq struct {
Status string `json:"status"`
Message string `json:"message"`
Result []BlockscanErc20Txs `json:"result"`
}
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.
type BlockscanGetEventsReq ¶
type BlockscanGetEventsReq struct {
Status string `json:"status"`
Message string `json:"message"`
Result []BlockscanEvents `json:"result"`
}
type BlockscanGetInternalTxsReq ¶
type BlockscanGetInternalTxsReq struct {
Status string `json:"status"`
Message string `json:"message"`
Result []BlockscanInternalTxs `json:"result"`
}
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.
type BlockscanGetNormalTxsReq ¶
type BlockscanGetNormalTxsReq struct {
Status string `json:"status"`
Message string `json:"message"`
Result []BlockscanNormalTxs `json:"result"`
}
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.
type BlockscanInternalTxs ¶
type BlockscanInternalTxs struct {
BlockNumber string `json:"blockNumber"`
TimeStamp string `json:"timeStamp"`
Hash string `json:"hash"`
From string `json:"from"`
To string `json:"to"`
Value string `json:"value"`
ContractAddress string `json:"contractAddress"`
Input string `json:"input"`
Type string `json:"type"`
Gas string `json:"gas"`
GasUsed string `json:"gasUsed"`
TraceID string `json:"traceId"`
IsError string `json:"isError"`
ErrCode string `json:"errCode"`
}
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.
type BlockscanNormalTxs ¶
type BlockscanNormalTxs struct {
BlockNumber string `json:"blockNumber"`
TimeStamp string `json:"timeStamp"`
Hash string `json:"hash"`
Nonce string `json:"nonce"`
BlockHash string `json:"blockHash"`
TransactionIndex string `json:"transactionIndex"`
From string `json:"from"`
To string `json:"to"`
Value string `json:"value"`
Gas string `json:"gas"`
GasPrice string `json:"gasPrice"`
IsError string `json:"isError"`
TxreceiptStatus string `json:"txreceipt_status"`
Input string `json:"input"`
ContractAddress string `json:"contractAddress"`
CumulativeGasUsed string `json:"cumulativeGasUsed"`
GasUsed string `json:"gasUsed"`
Confirmations string `json:"confirmations"`
}
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.
type BlockscanSourceCodeReq ¶
type BlockscanSourceCodeReq struct {
Status string `json:"status"`
Message string `json:"message"`
Result []struct {
SourceCode string `json:"SourceCode"`
Abi string `json:"ABI"`
ContractName string `json:"ContractName"`
CompilerVersion string `json:"CompilerVersion"`
OptimizationUsed string `json:"OptimizationUsed"`
Runs string `json:"Runs"`
ConstructorArguments string `json:"ConstructorArguments"`
EVMVersion string `json:"EVMVersion"`
Library string `json:"Library"`
LicenseType string `json:"LicenseType"`
Proxy string `json:"Proxy"`
Implementation string `json:"Implementation"`
SwarmSource string `json:"SwarmSource"`
} `json:"result"`
}
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.