reader

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2020 License: MIT Imports: 16 Imported by: 3

Documentation

Index

Constants

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 NewEthReader

func NewEthReader() *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 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) 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) GetEthereumABI

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

func (*EthReader) GetEthereumABIString

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

func (*EthReader) GetKovanABI added in v0.5.0

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

func (*EthReader) GetKovanABIString added in v0.5.0

func (self *EthReader) GetKovanABIString(address string) (string, 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) GetRinkebyABI added in v0.5.0

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

func (*EthReader) GetRinkebyABIString added in v0.5.0

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

func (*EthReader) GetRopstenABI

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

func (*EthReader) GetRopstenABIString

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

func (*EthReader) GetTomoABI

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

func (*EthReader) GetTomoABIString

func (self *EthReader) GetTomoABIString(address string) (string, 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) RecommendedGasPriceEthereum

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

func (*EthReader) RecommendedGasPriceKovan added in v0.5.0

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

func (*EthReader) RecommendedGasPriceRinkeby added in v0.5.0

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

func (*EthReader) RecommendedGasPriceRopsten

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

func (*EthReader) RecommendedGasPriceTomo

func (self *EthReader) RecommendedGasPriceTomo() (float64, 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, value float64, 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
	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 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, value float64, 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) 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