ethutils

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2021 License: Apache-2.0 Imports: 13 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CallCheck

func CallCheck(ctx context.Context, client EthClient, from common.Address, contractAddress common.Address, contractABI abi.ABI, method string, params ...interface{}) error

Types

type BlockInfo

type BlockInfo struct {
	Hash       common.Hash    `json:"hash"`
	ParentHash common.Hash    `json:"parentHash"`
	Time       hexutil.Uint64 `json:"timestamp"`
	Number     *hexutil.Big   `json:"number"`
}

type EthClient

type EthClient interface {
	bind.ContractBackend
	ReceiptFetcher

	HeaderByHash(ctx context.Context, hash common.Hash) (*types.Header, error)
	BlockInfoByNumber(ctx context.Context, number *big.Int) (*BlockInfo, error)
	HeaderByNumber(ctx context.Context, number *big.Int) (*types.Header, error)
	TransactionByHash(ctx context.Context, hash common.Hash) (tx *types.Transaction, isPending bool, err error)
	TransactionInBlock(ctx context.Context, blockHash common.Hash, index uint) (*types.Transaction, error)
	PendingCallContract(ctx context.Context, msg ethereum.CallMsg) ([]byte, error)
	BalanceAt(ctx context.Context, account common.Address, blockNumber *big.Int) (*big.Int, error)
}

type RPCEthClient

type RPCEthClient struct {
	*ethclient.Client
	// contains filtered or unexported fields
}

func NewRPCEthClient

func NewRPCEthClient(url string) (*RPCEthClient, error)

func (*RPCEthClient) BlockInfoByNumber

func (r *RPCEthClient) BlockInfoByNumber(ctx context.Context, number *big.Int) (*BlockInfo, error)

type ReceiptFetcher

type ReceiptFetcher interface {
	TransactionReceipt(ctx context.Context, txHash common.Hash) (*types.Receipt, error)
}

type SimulatedEthClient

type SimulatedEthClient struct {
	*backends.SimulatedBackend
}

func (*SimulatedEthClient) BlockInfoByNumber

func (r *SimulatedEthClient) BlockInfoByNumber(ctx context.Context, number *big.Int) (*BlockInfo, error)

Jump to

Keyboard shortcuts

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