Documentation
¶
Index ¶
- Variables
- type AccountBalanceParams
- type BlockNumberParams
- type BlockRewardParams
- type Client
- func (c *Client) AccountBalance(address string) (types.BigInt, error)
- func (c *Client) BlockNumber(timestamp int64, closest string) (int, error)
- func (c *Client) BlockReward(blockNum int) (response.BlockRewards, error)
- func (c *Client) BlocksMinedByAddress(address string, page int, offset int) ([]response.MinedBlock, error)
- func (c *Client) ContractABI(address string) (string, error)
- func (c *Client) ContractSource(address string) ([]response.ContractSource, error)
- func (c *Client) ERC1155Transfers(contractAddress, address *string, startBlock *int, endBlock *int, page int, ...) ([]response.ERC1155Transfer, error)
- func (c *Client) ERC20Transfers(contractAddress, address *string, startBlock *int, endBlock *int, page int, ...) ([]response.ERC20Transfer, error)
- func (c *Client) ERC721Transfers(contractAddress, address *string, startBlock *int, endBlock *int, page int, ...) ([]response.ERC721Transfer, error)
- func (c *Client) EtherLatestPrice() (price response.LatestPrice, err error)
- func (c *Client) EtherTotalSupply() (totalSupply types.BigInt, err error)
- func (c *Client) ExecutionStatus(txHash string) (response.ExecutionStatus, error)
- func (c *Client) GasEstimate(gasPrice int) (time.Duration, error)
- func (c *Client) GasOracle() (response.GasPrices, error)
- func (c *Client) GetLogs(fromBlock, toBlock int, address, topic string) ([]response.Log, error)
- func (c *Client) InternalTxByAddress(address string, startBlock *int, endBlock *int, page int, offset int, ...) ([]response.InternalTx, error)
- func (c *Client) MultiAccountBalance(addresses ...string) ([]response.AccountBalance, error)
- func (c *Client) NormalTxByAddress(address string, startBlock *int, endBlock *int, page int, offset int, ...) ([]response.NormalTx, error)
- func (c *Client) ReceiptStatus(txHash string) (int, error)
- func (c *Client) TokenBalance(contractAddress, address string) (types.BigInt, error)
- func (c *Client) TokenTotalSupply(contractAddress string) (types.BigInt, error)
- func (c *Client) UnclesMinedByAddress(address string, page int, offset int) ([]response.MinedBlock, error)
- type ContractParams
- type Customization
- type GasEstimateParams
- type LogParams
- type MinedBlockParams
- type MultiAccountBalanceParams
- type TokenBalanceParams
- type TokenTotalSupplyParams
- type TokenTransferParams
- type TransactionParams
- type TxListParams
Constants ¶
This section is empty.
Variables ¶
var ErrPreByzantiumTx = errors.New("pre-byzantium transaction does not support receipt status check")
ErrPreByzantiumTx transaction before 4,370,000 does not support receipt status check
Functions ¶
This section is empty.
Types ¶
type AccountBalanceParams ¶
func (AccountBalanceParams) GetUrlValues ¶
func (p AccountBalanceParams) GetUrlValues() url.Values
type BlockNumberParams ¶
type BlockNumberParams struct { Timestamp int64 `json:"timestamp"` Closest string `json:"closest"` }
func (BlockNumberParams) GetUrlValues ¶
func (p BlockNumberParams) GetUrlValues() url.Values
type BlockRewardParams ¶
type BlockRewardParams struct {
BlockNo int `json:"blockno"`
}
func (BlockRewardParams) GetUrlValues ¶
func (p BlockRewardParams) GetUrlValues() url.Values
type Client ¶
type Client struct { // Verbose when true, talks a lot Verbose bool // BeforeRequest runs before every client request, in the same goroutine. // May be used in rate limit. // Request will be aborted, if BeforeRequest returns non-nil err. BeforeRequest func(module, action string, values url.Values) error // AfterRequest runs after every client request, even when there is an error. AfterRequest func(module, action string, values url.Values, outcome interface{}, requestErr error) error // contains filtered or unexported fields }
Client etherscan API client Clients are safe for concurrent use by multiple goroutines.
func NewClient ¶
NewClient initialize a new etherscan API client please use pre-defined network value
func NewCustomized ¶
func NewCustomized(config Customization) *Client
NewCustomized initialize a customized API client, useful when calling against etherscan-family API like BscScan.
func (*Client) AccountBalance ¶
Refactored methods
func (*Client) BlockNumber ¶
BlockNumber gets the closest block number by UNIX timestamp
valid closest option: before, after
func (*Client) BlockReward ¶
func (c *Client) BlockReward(blockNum int) (response.BlockRewards, error)
BlockReward gets block and uncle rewards by block number
func (*Client) BlocksMinedByAddress ¶
func (*Client) ContractABI ¶
ContractABI gets contract abi for verified contract source codes
func (*Client) ContractSource ¶
func (c *Client) ContractSource(address string) ([]response.ContractSource, error)
ContractSource gets contract source code for verified contract source codes
func (*Client) ERC1155Transfers ¶
func (*Client) ERC20Transfers ¶
func (*Client) ERC721Transfers ¶
func (*Client) EtherLatestPrice ¶
func (c *Client) EtherLatestPrice() (price response.LatestPrice, err error)
EtherLatestPrice gets the latest ether price, in BTC and USD
func (*Client) EtherTotalSupply ¶
EtherTotalSupply gets total supply of ether
func (*Client) ExecutionStatus ¶
func (c *Client) ExecutionStatus(txHash string) (response.ExecutionStatus, error)
ExecutionStatus checks contract execution status
func (*Client) GasEstimate ¶
GasEstimate gets estimated confirmation time (in seconds) at the given gas price
func (*Client) GetLogs ¶
GetLogs gets logs that match "topic" emitted by the specified "address" between the "fromBlock" and "toBlock"
func (*Client) InternalTxByAddress ¶
func (*Client) MultiAccountBalance ¶
func (c *Client) MultiAccountBalance(addresses ...string) ([]response.AccountBalance, error)
func (*Client) NormalTxByAddress ¶
func (*Client) ReceiptStatus ¶
ReceiptStatus checks transaction receipt status
func (*Client) TokenBalance ¶
func (*Client) TokenTotalSupply ¶
TokenTotalSupply gets total supply of token on specified contract address
func (*Client) UnclesMinedByAddress ¶
type ContractParams ¶
type ContractParams struct {
Address string `json:"address"`
}
func (ContractParams) GetUrlValues ¶
func (p ContractParams) GetUrlValues() url.Values
type Customization ¶
type Customization struct { // Timeout for API call Timeout time.Duration // API key applied from Etherscan Key string // Base URL like `https://api.etherscan.io/api?` BaseURL string // When true, talks a lot Verbose bool // ChainID to be used Chain chain.Chain // HTTP Client to be used. Specifying this value will ignore the Timeout value set // Set your own timeout. Client *http.Client // BeforeRequest runs before every client request, in the same goroutine. // May be used in rate limit. // Request will be aborted, if BeforeRequest returns non-nil err. BeforeRequest func(module, action string, values url.Values) error // AfterRequest runs after every client request, even when there is an error. AfterRequest func(module, action string, values url.Values, outcome interface{}, requestErr error) error }
Customization is used in NewCustomized()
type GasEstimateParams ¶
type GasEstimateParams struct {
GasPrice int `json:"gasPrice"`
}
func (GasEstimateParams) GetUrlValues ¶
func (p GasEstimateParams) GetUrlValues() url.Values
type LogParams ¶
type LogParams struct { FromBlock int `json:"fromBlock"` ToBlock int `json:"toBlock"` Topic0 string `json:"topic0"` Address string `json:"address"` }
func (LogParams) GetUrlValues ¶
type MinedBlockParams ¶
type MinedBlockParams struct { Address string `json:"address"` BlockType string `json:"blocktype"` Page int `json:"page"` Offset int `json:"offset"` }
func (MinedBlockParams) GetUrlValues ¶
func (p MinedBlockParams) GetUrlValues() url.Values
type MultiAccountBalanceParams ¶
type MultiAccountBalanceParams struct { Tag string `json:"tag"` Addresses []string `json:"address"` }
func (MultiAccountBalanceParams) GetUrlValues ¶
func (p MultiAccountBalanceParams) GetUrlValues() url.Values
type TokenBalanceParams ¶
type TokenBalanceParams struct { ContractAddress string `json:"contractaddress"` Address string `json:"address"` Tag string `json:"tag"` }
func (TokenBalanceParams) GetUrlValues ¶
func (p TokenBalanceParams) GetUrlValues() url.Values
type TokenTotalSupplyParams ¶
type TokenTotalSupplyParams struct {
ContractAddress string `json:"contractaddress"`
}
func (TokenTotalSupplyParams) GetUrlValues ¶
func (p TokenTotalSupplyParams) GetUrlValues() url.Values
type TokenTransferParams ¶
type TokenTransferParams struct { ContractAddress *string `json:"contractaddress,omitempty"` Address *string `json:"address,omitempty"` StartBlock *int `json:"startblock,omitempty"` EndBlock *int `json:"endblock,omitempty"` Page int `json:"page"` Offset int `json:"offset"` Sort string `json:"sort"` }
func (TokenTransferParams) GetUrlValues ¶
func (p TokenTransferParams) GetUrlValues() url.Values
type TransactionParams ¶
type TransactionParams struct {
TxHash string `json:"txhash"`
}
func (TransactionParams) GetUrlValues ¶
func (p TransactionParams) GetUrlValues() url.Values
type TxListParams ¶
type TxListParams struct { Address string `json:"address"` StartBlock *int `json:"startblock,omitempty"` EndBlock *int `json:"endblock,omitempty"` Page int `json:"page"` Offset int `json:"offset"` Sort string `json:"sort"` }
func (TxListParams) GetUrlValues ¶
func (p TxListParams) GetUrlValues() url.Values