Documentation ¶
Index ¶
- Constants
- Variables
- type EthReader
- func NewBSCReader() *EthReader
- func NewBSCReaderWithCustomNodes(nodes map[string]string) *EthReader
- func NewBSCTestnetReader() *EthReader
- func NewBSCTestnetReaderWithCustomNodes(nodes map[string]string) *EthReader
- func NewEthReader() *EthReader
- func NewEthReaderGeneric(nodes map[string]string, be BlockExplorer) *EthReader
- func NewEthReaderWithCustomNodes(nodes map[string]string) *EthReader
- func NewKovanReader() *EthReader
- func NewKovanReaderWithCustomNodes(nodes map[string]string) *EthReader
- func NewMaticReader() *EthReader
- func NewMaticReaderWithCustomNodes(nodes map[string]string) *EthReader
- func NewMumbaiReader() *EthReader
- func NewMumbaiReaderWithCustomNodes(nodes map[string]string) *EthReader
- func NewRinkebyReader() *EthReader
- func NewRinkebyReaderWithCustomNodes(nodes map[string]string) *EthReader
- func NewRopstenReader() *EthReader
- func NewRopstenReaderWithCustomNodes(nodes map[string]string) *EthReader
- func NewTomoReader() *EthReader
- func NewTomoReaderWithCustomNodes(nodes map[string]string) *EthReader
- func (self *EthReader) AddressFromContract(contract string, method string) (*common.Address, error)
- func (self *EthReader) AddressFromContractWithABI(contract string, abi *abi.ABI, method string) (*common.Address, error)
- func (self *EthReader) CheckDynamicFeeTxAvailable() (bool, error)
- func (self *EthReader) CurrentBlock() (uint64, error)
- func (self *EthReader) ERC20Allowance(caddr string, owner string, spender string) (*big.Int, error)
- func (self *EthReader) ERC20Balance(caddr string, user string) (*big.Int, error)
- func (self *EthReader) ERC20Decimal(caddr string) (uint64, error)
- func (self *EthReader) ERC20Symbol(caddr string) (string, error)
- func (self *EthReader) EstimateExactGas(from, to string, priceGwei float64, value *big.Int, data []byte) (uint64, error)
- func (self *EthReader) EstimateGas(from, to string, priceGwei, value float64, data []byte) (uint64, error)
- func (self *EthReader) GetABI(address string) (*abi.ABI, error)
- func (self *EthReader) GetABIString(address string) (string, error)
- func (self *EthReader) GetBalance(address string) (balance *big.Int, err error)
- func (self *EthReader) GetCode(address string) (code []byte, err error)
- func (self *EthReader) GetGasPriceWeiSuggestion() (*big.Int, error)
- func (self *EthReader) GetLogs(fromBlock, toBlock int, addresses []string, topic string) ([]types.Log, error)
- func (self *EthReader) GetMinedNonce(address string) (nonce uint64, err error)
- func (self *EthReader) GetPendingNonce(address string) (nonce uint64, err error)
- func (self *EthReader) GetSuggestedGasTipCap() (float64, error)
- func (self *EthReader) HeaderByNumber(number int64) (*types.Header, error)
- func (self *EthReader) HistoryERC20Allowance(atBlock int64, caddr string, owner string, spender string) (*big.Int, error)
- func (self *EthReader) HistoryERC20Balance(atBlock int64, caddr string, user string) (*big.Int, error)
- func (self *EthReader) HistoryERC20Decimal(atBlock int64, caddr string) (int64, error)
- func (self *EthReader) ImplementationOf(atBlock int64, caddr string) (common.Address, error)
- func (self *EthReader) ImplementationOfEIP1967(atBlock int64, caddr string) (common.Address, error)
- func (self *EthReader) ReadContract(result interface{}, caddr string, method string, args ...interface{}) error
- func (self *EthReader) ReadContractToBytes(atBlock int64, from string, caddr string, abi *abi.ABI, method string, ...) ([]byte, error)
- func (self *EthReader) ReadContractWithABI(result interface{}, caddr string, abi *abi.ABI, method string, ...) error
- func (self *EthReader) ReadContractWithABIAndFrom(result interface{}, from string, caddr string, abi *abi.ABI, method string, ...) error
- func (self *EthReader) ReadHistoryContract(atBlock int64, result interface{}, caddr string, method string, ...) error
- func (self *EthReader) ReadHistoryContractWithABI(atBlock int64, result interface{}, caddr string, abi *abi.ABI, method string, ...) error
- func (self *EthReader) RecommendedGasPrice() (float64, error)
- func (self *EthReader) StorageAt(atBlock int64, caddr string, slot string) ([]byte, error)
- func (self *EthReader) SuggestedGasSettings() (maxGasPriceGwei, maxTipGwei float64, err error)
- func (self *EthReader) TransactionByHash(txHash string) (tx *Transaction, isPending bool, err error)
- func (self *EthReader) TransactionReceipt(txHash string) (receipt *types.Receipt, err error)
- func (self *EthReader) TxInfoFromHash(tx string) (TxInfo, error)
- type EthereumNode
- type MCOneResultHandler
- type MultipleCall
- func (mc *MultipleCall) Do(atBlock int64) (block int64, err error)
- func (mc *MultipleCall) Register(result interface{}, caddr string, abi *abi.ABI, method string, ...) *MultipleCall
- func (mc *MultipleCall) RegisterWithHook(result interface{}, hook MCOneResultHandler, caddr string, abi *abi.ABI, ...) *MultipleCall
- type OneNodeReader
- func (self *OneNodeReader) Client() (*rpc.Client, error)
- func (self *OneNodeReader) CurrentBlock() (uint64, error)
- func (self *OneNodeReader) EstimateGas(from, to string, priceGwei float64, value *big.Int, data []byte) (uint64, error)
- func (self *OneNodeReader) EthClient() (*ethclient.Client, error)
- func (self *OneNodeReader) GetBalance(address string) (balance *big.Int, err error)
- func (self *OneNodeReader) GetCode(address string) (code []byte, err error)
- func (self *OneNodeReader) GetGasPriceSuggestion() (*big.Int, error)
- func (self *OneNodeReader) GetLogs(fromBlock, toBlock int, addresses []string, topic string) ([]types.Log, error)
- func (self *OneNodeReader) GetMinedNonce(address string) (nonce uint64, err error)
- func (self *OneNodeReader) GetPendingNonce(address string) (nonce uint64, err error)
- func (self *OneNodeReader) HeaderByNumber(number int64) (*types.Header, error)
- func (self *OneNodeReader) NodeName() string
- func (self *OneNodeReader) NodeURL() string
- func (self *OneNodeReader) ReadContractToBytes(atBlock int64, from string, caddr string, abi *abi.ABI, method string, ...) ([]byte, error)
- func (self *OneNodeReader) StorageAt(atBlock int64, contractAddr string, slot string) ([]byte, error)
- func (self *OneNodeReader) SuggestedGasPrice() (*big.Int, error)
- func (self *OneNodeReader) SuggestedGasTipCap() (*big.Int, error)
- func (self *OneNodeReader) TransactionByHash(txHash string) (tx *Transaction, isPending bool, err error)
- func (self *OneNodeReader) TransactionReceipt(txHash string) (receipt *types.Receipt, err error)
Constants ¶
View Source
const ( DEFAULT_ETHERSCAN_APIKEY string = "UBB257TI824FC7HUSPT66KZUMGBPRN3IWV" DEFAULT_BSCSCAN_APIKEY string = "62TU8Z81F7ESNJT38ZVRBSX7CNN4QZSP5I" DEFAULT_TOMOSCAN_APIKEY string = "" )
View Source
const TIMEOUT time.Duration = 4 * time.Second
Variables ¶
View Source
var DEFAULT_ADDRESS string = "0x0000000000000000000000000000000000000000"
Functions ¶
This section is empty.
Types ¶
type EthReader ¶
type EthReader struct {
// contains filtered or unexported fields
}
func NewBSCReader ¶
func NewBSCReader() *EthReader
func NewBSCTestnetReader ¶
func NewBSCTestnetReader() *EthReader
func NewEthReader ¶
func NewEthReader() *EthReader
func NewEthReaderGeneric ¶
func NewKovanReader ¶
func NewKovanReader() *EthReader
func NewMaticReader ¶
func NewMaticReader() *EthReader
func NewMumbaiReader ¶
func NewMumbaiReader() *EthReader
func NewRinkebyReader ¶
func NewRinkebyReader() *EthReader
func NewRopstenReader ¶
func NewRopstenReader() *EthReader
func NewTomoReader ¶
func NewTomoReader() *EthReader
func (*EthReader) AddressFromContract ¶
func (*EthReader) AddressFromContractWithABI ¶ added in v0.0.30
func (*EthReader) CheckDynamicFeeTxAvailable ¶ added in v0.0.30
CheckDynamicFeeTxAvailable use to detect if current network that connect via node url is support dynamic fee tx, this is done by a trick where we check if block info contain baseFee > 0, that may not always work but should enough for now.
func (*EthReader) CurrentBlock ¶
func (*EthReader) ERC20Allowance ¶
func (*EthReader) ERC20Balance ¶
func (*EthReader) ERC20Symbol ¶ added in v0.0.27
func (*EthReader) EstimateExactGas ¶
func (*EthReader) EstimateGas ¶
func (*EthReader) GetABIString ¶
func (*EthReader) GetBalance ¶
func (*EthReader) GetGasPriceWeiSuggestion ¶
func (*EthReader) GetLogs ¶
func (self *EthReader) GetLogs( fromBlock, toBlock int, addresses []string, topic string, ) ([]types.Log, error)
if toBlock < 0, it will query to the latest block
func (*EthReader) GetMinedNonce ¶
func (*EthReader) GetPendingNonce ¶
func (*EthReader) GetSuggestedGasTipCap ¶ added in v0.0.30
func (*EthReader) HeaderByNumber ¶
func (*EthReader) HistoryERC20Allowance ¶
func (*EthReader) HistoryERC20Balance ¶
func (*EthReader) HistoryERC20Decimal ¶
func (*EthReader) ImplementationOf ¶ added in v0.0.30
func (*EthReader) ImplementationOfEIP1967 ¶ added in v0.0.30
func (*EthReader) ReadContract ¶
func (*EthReader) ReadContractToBytes ¶
func (*EthReader) ReadContractWithABI ¶
func (*EthReader) ReadContractWithABIAndFrom ¶
func (*EthReader) ReadHistoryContract ¶
func (*EthReader) ReadHistoryContractWithABI ¶
func (*EthReader) RecommendedGasPrice ¶
func (*EthReader) SuggestedGasSettings ¶ added in v0.0.30
func (*EthReader) TransactionByHash ¶
func (*EthReader) TransactionReceipt ¶
func (*EthReader) TxInfoFromHash ¶
type EthereumNode ¶
type EthereumNode interface { NodeName() string NodeURL() string EstimateGas( from, to string, priceGwei float64, value *big.Int, data []byte, ) (gas uint64, err error) GetCode(address string) (code []byte, err error) GetBalance(address string) (balance *big.Int, err error) GetMinedNonce(address string) (nonce uint64, err error) GetPendingNonce(address string) (nonce uint64, err error) TransactionReceipt(txHash string) (receipt *types.Receipt, err error) TransactionByHash(txHash string) (tx *common.Transaction, isPending bool, err error) // Call(result interface{}, method string, args ...interface{}) error GetGasPriceSuggestion() (*big.Int, error) SuggestedGasPrice() (*big.Int, error) SuggestedGasTipCap() (*big.Int, error) ReadContractToBytes( atBlock int64, from string, caddr string, abi *abi.ABI, method string, args ...interface{}, ) ([]byte, error) StorageAt(atBlock int64, caddr string, slot string) ([]byte, error) HeaderByNumber(number int64) (*types.Header, error) GetLogs(fromBlock, toBlock int, addresses []string, topic string) ([]types.Log, error) CurrentBlock() (uint64, error) }
type MCOneResultHandler ¶
type MCOneResultHandler func(result interface{}) error
var DO_NOTHING_MC_ONE_RESULT_HANDLER MCOneResultHandler = func(result interface{}) error { return nil }
type MultipleCall ¶
type MultipleCall struct {
// contains filtered or unexported fields
}
func NewMultiCall ¶
func NewMultiCall(r *EthReader, mcContract string) *MultipleCall
func (*MultipleCall) Register ¶
func (mc *MultipleCall) Register( result interface{}, caddr string, abi *abi.ABI, method string, args ...interface{}, ) *MultipleCall
func (*MultipleCall) RegisterWithHook ¶
func (mc *MultipleCall) RegisterWithHook( result interface{}, hook MCOneResultHandler, caddr string, abi *abi.ABI, method string, args ...interface{}, ) *MultipleCall
type OneNodeReader ¶
type OneNodeReader struct {
// contains filtered or unexported fields
}
func NewOneNodeReader ¶
func NewOneNodeReader(name, url string) *OneNodeReader
func (*OneNodeReader) CurrentBlock ¶
func (self *OneNodeReader) CurrentBlock() (uint64, error)
func (*OneNodeReader) EstimateGas ¶
func (*OneNodeReader) GetBalance ¶
func (self *OneNodeReader) GetBalance(address string) (balance *big.Int, err error)
func (*OneNodeReader) GetCode ¶
func (self *OneNodeReader) GetCode(address string) (code []byte, err error)
func (*OneNodeReader) GetGasPriceSuggestion ¶
func (self *OneNodeReader) GetGasPriceSuggestion() (*big.Int, error)
func (*OneNodeReader) GetMinedNonce ¶
func (self *OneNodeReader) GetMinedNonce(address string) (nonce uint64, err error)
func (*OneNodeReader) GetPendingNonce ¶
func (self *OneNodeReader) GetPendingNonce(address string) (nonce uint64, err error)
func (*OneNodeReader) HeaderByNumber ¶
func (self *OneNodeReader) HeaderByNumber(number int64) (*types.Header, error)
func (*OneNodeReader) NodeName ¶
func (self *OneNodeReader) NodeName() string
func (*OneNodeReader) NodeURL ¶
func (self *OneNodeReader) NodeURL() string
func (*OneNodeReader) ReadContractToBytes ¶
func (*OneNodeReader) SuggestedGasPrice ¶ added in v0.0.30
func (self *OneNodeReader) SuggestedGasPrice() (*big.Int, error)
func (*OneNodeReader) SuggestedGasTipCap ¶ added in v0.0.30
func (self *OneNodeReader) SuggestedGasTipCap() (*big.Int, error)
func (*OneNodeReader) TransactionByHash ¶
func (self *OneNodeReader) TransactionByHash(txHash string) (tx *Transaction, isPending bool, err error)
func (*OneNodeReader) TransactionReceipt ¶
func (self *OneNodeReader) TransactionReceipt(txHash string) (receipt *types.Receipt, err error)
Click to show internal directories.
Click to hide internal directories.