reader

package
v0.0.29 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2023 License: MIT Imports: 18 Imported by: 0

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

func NewBSCReader() *EthReader

func NewBSCReaderWithCustomNodes

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

func NewBSCTestnetReader

func NewBSCTestnetReader() *EthReader

func NewBSCTestnetReaderWithCustomNodes

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

func NewEthReader

func NewEthReader() *EthReader

func NewEthReaderGeneric

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

func NewEthReaderWithCustomNodes

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

func NewKovanReader

func NewKovanReader() *EthReader

func NewKovanReaderWithCustomNodes

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

func NewMaticReader

func NewMaticReader() *EthReader

func NewMaticReaderWithCustomNodes

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

func NewMumbaiReader

func NewMumbaiReader() *EthReader

func NewMumbaiReaderWithCustomNodes

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

func NewRinkebyReader

func NewRinkebyReader() *EthReader

func NewRinkebyReaderWithCustomNodes

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

func NewRopstenReader

func NewRopstenReader() *EthReader

func NewRopstenReaderWithCustomNodes

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

func NewTomoReader

func NewTomoReader() *EthReader

func NewTomoReaderWithCustomNodes

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

func (*EthReader) AddressFromContract

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

func (*EthReader) CurrentBlock

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) ERC20Symbol added in v0.0.27

func (self *EthReader) ERC20Symbol(caddr string) (string, error)

func (*EthReader) EstimateExactGas

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

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

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

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

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

func (*EthReader) TransactionByHash

func (self *EthReader) TransactionByHash(txHash string) (tx *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) (TxInfo, error)

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)
	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

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) Do

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

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) Client

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

func (*OneNodeReader) CurrentBlock

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

func (*OneNodeReader) EstimateGas

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

func (*OneNodeReader) EthClient

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

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) GetLogs

func (self *OneNodeReader) GetLogs(fromBlock, toBlock int, addresses []string, topic string) ([]types.Log, 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 (self *OneNodeReader) ReadContractToBytes(atBlock int64, from string, caddr string, abi *abi.ABI, method string, args ...interface{}) ([]byte, 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)

Jump to

Keyboard shortcuts

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