client

package
v0.0.0-...-290478e Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2025 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Block

type Block struct {
	Number           int
	Hash             string
	ParentHash       string
	Nonce            string
	Sha3Uncles       string
	LogsBloom        string
	TransactionsRoot string
	StateRoot        string
	Miner            string
	Difficulty       *big.Int
	TotalDifficulty  *big.Int
	ExtraData        string
	Size             int
	GasLimit         int
	GasUsed          int
	Timestamp        int
	Uncles           []string
	Transactions     []Transaction
}

Block EVM block.

type Client

type Client struct {
	*ethclient.Client
	ethtypes.Signer
}

func New

func New(client *ethclient.Client, signer ethtypes.Signer) *Client

New Client constructor.

func NewFromEndpoint

func NewFromEndpoint(ctx context.Context, endpoint string) (*Client, error)

NewFromEndpoint new Client constructor based on endpoint URL.

func (*Client) BlockByNumberCustom

func (c *Client) BlockByNumberCustom(ctx context.Context, blockNumber *big.Int) (*Block, error)

BlockByNumberCustom is alternative to geth BlockByNumber that supports NON-ETH chains. For example, OP stack has different tx types that result in err="transaction type not supported"

See https://github.com/zeta-chain/node/issues/3386 See https://github.com/ethereum/go-ethereum/issues/29407

func (*Client) HealthCheck

func (c *Client) HealthCheck(ctx context.Context) (time.Time, error)

HealthCheck asserts RPC health. Returns the latest block time in UTC.

func (*Client) IsTxConfirmed

func (c *Client) IsTxConfirmed(ctx context.Context, txHash string, confirmations uint64) (bool, error)

IsTxConfirmed checks whether txHash settled on-chain && has at least X blocks of confirmations.

func (*Client) TransactionByHashCustom

func (c *Client) TransactionByHashCustom(ctx context.Context, hash string) (*Transaction, error)

TransactionByHashCustom is alternative to geth TransactionByHash that supports NON-ETH chains. See BlockByNumberCustom.

type Transaction

type Transaction struct {
	Hash             string
	Nonce            int
	BlockHash        string
	BlockNumber      *int
	TransactionIndex *int
	From             string
	To               string
	Value            *big.Int
	Gas              int
	GasPrice         *big.Int
	Input            string
}

Transaction EVM transaction.

Jump to

Keyboard shortcuts

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