reader

package
v0.8.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 13, 2022 License: MIT Imports: 18 Imported by: 2

Documentation

Index

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 added in v0.7.3

func NewBSCReader() *EthReader

func NewBSCReaderWithCustomNodes added in v0.7.3

func NewBSCReaderWithCustomNodes(nodes map[string]string) *EthReader

func NewBSCTestnetReader added in v0.7.3

func NewBSCTestnetReader() *EthReader

func NewBSCTestnetReaderWithCustomNodes added in v0.7.3

func NewBSCTestnetReaderWithCustomNodes(nodes map[string]string) *EthReader

func NewEthReader

func NewEthReader() *EthReader

func NewEthReaderGeneric added in v0.7.5

func NewEthReaderGeneric(nodes map[string]string, be BlockExplorer) *EthReader

func NewEthReaderWithCustomNodes added in v0.2.3

func NewEthReaderWithCustomNodes(nodes map[string]string) *EthReader

func NewKovanReader added in v0.5.0

func NewKovanReader() *EthReader

func NewKovanReaderWithCustomNodes added in v0.5.0

func NewKovanReaderWithCustomNodes(nodes map[string]string) *EthReader

func NewMaticReader added in v0.7.5

func NewMaticReader() *EthReader

func NewMaticReaderWithCustomNodes added in v0.7.5

func NewMaticReaderWithCustomNodes(nodes map[string]string) *EthReader

func NewMumbaiReader added in v0.7.5

func NewMumbaiReader() *EthReader

func NewMumbaiReaderWithCustomNodes added in v0.7.5

func NewMumbaiReaderWithCustomNodes(nodes map[string]string) *EthReader

func NewRinkebyReader added in v0.5.0

func NewRinkebyReader() *EthReader

func NewRinkebyReaderWithCustomNodes added in v0.5.0

func NewRinkebyReaderWithCustomNodes(nodes map[string]string) *EthReader

func NewRopstenReader

func NewRopstenReader() *EthReader

func NewRopstenReaderWithCustomNodes added in v0.2.3

func NewRopstenReaderWithCustomNodes(nodes map[string]string) *EthReader

func NewTomoReader

func NewTomoReader() *EthReader

func NewTomoReaderWithCustomNodes added in v0.2.3

func NewTomoReaderWithCustomNodes(nodes map[string]string) *EthReader

func (*EthReader) AddressFromContract

func (self *EthReader) AddressFromContract(contract string, method string) (*common.Address, error)

func (*EthReader) CurrentBlock added in v0.3.0

func (self *EthReader) CurrentBlock() (uint64, error)

func (*EthReader) ERC20Allowance

func (self *EthReader) ERC20Allowance(caddr string, owner string, spender string) (*big.Int, error)

func (*EthReader) ERC20Balance

func (self *EthReader) ERC20Balance(caddr string, user string) (*big.Int, error)

func (*EthReader) ERC20Decimal

func (self *EthReader) ERC20Decimal(caddr string) (int64, error)

func (*EthReader) EstimateExactGas added in v0.7.0

func (self *EthReader) EstimateExactGas(from, to string, priceGwei float64, value *big.Int, data []byte) (uint64, error)

func (*EthReader) EstimateGas

func (self *EthReader) EstimateGas(from, to string, priceGwei, value float64, data []byte) (uint64, error)

func (*EthReader) GetABI

func (self *EthReader) GetABI(address string) (*abi.ABI, error)

func (*EthReader) GetABIString

func (self *EthReader) GetABIString(address string) (string, error)

func (*EthReader) GetBalance

func (self *EthReader) GetBalance(address string) (balance *big.Int, err error)

func (*EthReader) GetCode

func (self *EthReader) GetCode(address string) (code []byte, err error)

func (*EthReader) GetGasPriceWeiSuggestion added in v0.8.3

func (self *EthReader) GetGasPriceWeiSuggestion() (*big.Int, error)

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 (self *EthReader) GetMinedNonce(address string) (nonce uint64, err error)

func (*EthReader) GetPendingNonce

func (self *EthReader) GetPendingNonce(address string) (nonce uint64, err error)

func (*EthReader) HeaderByNumber

func (self *EthReader) HeaderByNumber(number int64) (*types.Header, error)

func (*EthReader) HistoryERC20Allowance

func (self *EthReader) HistoryERC20Allowance(atBlock int64, caddr string, owner string, spender string) (*big.Int, error)

func (*EthReader) HistoryERC20Balance

func (self *EthReader) HistoryERC20Balance(atBlock int64, caddr string, user string) (*big.Int, error)

func (*EthReader) HistoryERC20Decimal

func (self *EthReader) HistoryERC20Decimal(atBlock int64, caddr string) (int64, error)

func (*EthReader) ReadContract

func (self *EthReader) ReadContract(result interface{}, caddr string, method string, args ...interface{}) error

func (*EthReader) ReadContractToBytes added in v0.2.1

func (self *EthReader) ReadContractToBytes(atBlock int64, from string, caddr string, abi *abi.ABI, method string, args ...interface{}) ([]byte, error)

func (*EthReader) ReadContractWithABI

func (self *EthReader) ReadContractWithABI(result interface{}, caddr string, abi *abi.ABI, method string, args ...interface{}) error

func (*EthReader) ReadContractWithABIAndFrom added in v0.6.0

func (self *EthReader) ReadContractWithABIAndFrom(result interface{}, from string, caddr string, abi *abi.ABI, method string, args ...interface{}) error

func (*EthReader) ReadHistoryContract

func (self *EthReader) ReadHistoryContract(atBlock int64, result interface{}, caddr string, method string, args ...interface{}) error

func (*EthReader) ReadHistoryContractWithABI

func (self *EthReader) ReadHistoryContractWithABI(atBlock int64, result interface{}, caddr string, abi *abi.ABI, method string, args ...interface{}) error

func (*EthReader) RecommendedGasPrice

func (self *EthReader) RecommendedGasPrice() (float64, error)

return gwei

func (*EthReader) RecommendedGasPriceFromKyberSwap added in v0.7.0

func (self *EthReader) RecommendedGasPriceFromKyberSwap() (low, average, fast float64, err error)

func (*EthReader) TransactionByHash

func (self *EthReader) TransactionByHash(txHash string) (tx *eu.Transaction, isPending bool, err error)

func (*EthReader) TransactionReceipt

func (self *EthReader) TransactionReceipt(txHash string) (receipt *types.Receipt, err error)

func (*EthReader) TxInfoFromHash

func (self *EthReader) TxInfoFromHash(tx string) (eu.TxInfo, error)

type EthereumNode added in v0.2.1

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 *eu.Transaction, isPending bool, err error)
	// Call(result interface{}, method string, args ...interface{}) error
	GetGasPriceSuggestion() (*big.Int, error)
	ReadContractToBytes(atBlock int64, from string, caddr string, abi *abi.ABI, method string, args ...interface{}) ([]byte, error)
	HeaderByNumber(number int64) (*types.Header, error)
	GetLogs(fromBlock, toBlock int, addresses []string, topic string) ([]types.Log, error)
	CurrentBlock() (uint64, error)
}

type MCOneResultHandler added in v0.8.0

type MCOneResultHandler func(result interface{}) error
var DO_NOTHING_MC_ONE_RESULT_HANDLER MCOneResultHandler = func(result interface{}) error { return nil }

type MultipleCall added in v0.8.0

type MultipleCall struct {
	// contains filtered or unexported fields
}

func NewMultiCall added in v0.8.0

func NewMultiCall(r *EthReader, mcContract string) *MultipleCall

func (*MultipleCall) Do added in v0.8.0

func (mc *MultipleCall) Do(atBlock int64) (block int64, err error)

func (*MultipleCall) Register added in v0.8.0

func (mc *MultipleCall) Register(
	result interface{},
	caddr string,
	abi *abi.ABI,
	method string,
	args ...interface{},
) *MultipleCall

func (*MultipleCall) RegisterWithHook added in v0.8.0

func (mc *MultipleCall) RegisterWithHook(
	result interface{},
	hook MCOneResultHandler,
	caddr string,
	abi *abi.ABI,
	method string,
	args ...interface{},
) *MultipleCall

type OneNodeReader added in v0.2.1

type OneNodeReader struct {
	// contains filtered or unexported fields
}

func NewOneNodeReader added in v0.2.1

func NewOneNodeReader(name, url string) *OneNodeReader

func (*OneNodeReader) Client added in v0.2.1

func (self *OneNodeReader) Client() (*rpc.Client, error)

func (*OneNodeReader) CurrentBlock added in v0.3.0

func (self *OneNodeReader) CurrentBlock() (uint64, error)

func (*OneNodeReader) EstimateGas added in v0.2.1

func (self *OneNodeReader) EstimateGas(from, to string, priceGwei float64, value *big.Int, data []byte) (uint64, error)

func (*OneNodeReader) EthClient added in v0.2.1

func (self *OneNodeReader) EthClient() (*ethclient.Client, error)

func (*OneNodeReader) GetBalance added in v0.2.1

func (self *OneNodeReader) GetBalance(address string) (balance *big.Int, err error)

func (*OneNodeReader) GetCode added in v0.2.1

func (self *OneNodeReader) GetCode(address string) (code []byte, err error)

func (*OneNodeReader) GetGasPriceSuggestion added in v0.8.3

func (self *OneNodeReader) GetGasPriceSuggestion() (*big.Int, error)

func (*OneNodeReader) GetLogs added in v0.2.1

func (self *OneNodeReader) GetLogs(fromBlock, toBlock int, addresses []string, topic string) ([]types.Log, error)

func (*OneNodeReader) GetMinedNonce added in v0.2.1

func (self *OneNodeReader) GetMinedNonce(address string) (nonce uint64, err error)

func (*OneNodeReader) GetPendingNonce added in v0.2.1

func (self *OneNodeReader) GetPendingNonce(address string) (nonce uint64, err error)

func (*OneNodeReader) HeaderByNumber added in v0.2.1

func (self *OneNodeReader) HeaderByNumber(number int64) (*types.Header, error)

func (*OneNodeReader) NodeName added in v0.2.1

func (self *OneNodeReader) NodeName() string

func (*OneNodeReader) NodeURL added in v0.2.1

func (self *OneNodeReader) NodeURL() string

func (*OneNodeReader) ReadContractToBytes added in v0.2.1

func (self *OneNodeReader) ReadContractToBytes(atBlock int64, from string, caddr string, abi *abi.ABI, method string, args ...interface{}) ([]byte, error)

func (*OneNodeReader) TransactionByHash added in v0.2.1

func (self *OneNodeReader) TransactionByHash(txHash string) (tx *eu.Transaction, isPending bool, err error)

func (*OneNodeReader) TransactionReceipt added in v0.2.1

func (self *OneNodeReader) TransactionReceipt(txHash string) (receipt *types.Receipt, err error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL