geth

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2022 License: AGPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidSignature = errors.New("invalid Ethereum signature (V is not 27 or 28)")
View Source
var ErrInvalidSignedTxType = errors.New("unable to send transaction, SignedTx field have invalid type")
View Source
var ErrMissingAccount = errors.New("unable to find account for requested address")
View Source
var ErrMulticallNotSupported = errors.New("multicall is not supported on current chain")

Functions

func Recover

func Recover(signature ethereum.Signature, data []byte) (*ethereum.Address, error)

func Signature

func Signature(account *Account, data []byte) (ethereum.Signature, error)

Types

type Account

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

func NewAccount

func NewAccount(keyStorePath, passphrase string, address ethereum.Address) (*Account, error)

NewAccount returns a new Account instance.

func (*Account) Address

func (s *Account) Address() ethereum.Address

Address returns a address of this account.

func (*Account) Passphrase

func (s *Account) Passphrase() string

Passphrase returns a password of this account.

type Client

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

Client implements the ethereum.Client interface.

func NewClient

func NewClient(ethClient EthClient, signer pkgEthereum.Signer) *Client

NewClient returns a new Client instance.

func (*Client) Block added in v0.7.1

func (e *Client) Block(ctx context.Context) (*types.Block, error)

Block implements the ethereum.Client interface.

func (*Client) BlockNumber added in v0.5.0

func (e *Client) BlockNumber(ctx context.Context) (*big.Int, error)

BlockNumber implements the ethereum.Client interface.

func (*Client) Call

func (e *Client) Call(ctx context.Context, call pkgEthereum.Call) ([]byte, error)

Call implements the ethereum.Client interface.

func (*Client) CallBlocks added in v0.5.0

func (e *Client) CallBlocks(ctx context.Context, call pkgEthereum.Call, blocks []int64) ([][]byte, error)

func (*Client) FilterLogs added in v0.7.1

func (e *Client) FilterLogs(ctx context.Context, query ethereum.FilterQuery) ([]types.Log, error)

FilterLogs implements the ethereum.Client interface.

func (*Client) MultiCall

func (e *Client) MultiCall(ctx context.Context, calls []pkgEthereum.Call) ([][]byte, error)

MultiCall implements the ethereum.Client interface.

func (*Client) SendTransaction

func (e *Client) SendTransaction(ctx context.Context, transaction *pkgEthereum.Transaction) (*pkgEthereum.Hash, error)

SendTransaction implements the ethereum.Client interface.

func (*Client) Storage

func (e *Client) Storage(ctx context.Context, address pkgEthereum.Address, key pkgEthereum.Hash) ([]byte, error)

Storage implements the ethereum.Client interface.

type ErrRevert

type ErrRevert struct {
	Message string
	Err     error
}

ErrRevert may be returned by Client.Call method in case of EVM revert.

func (ErrRevert) Error

func (e ErrRevert) Error() string

func (ErrRevert) Unwrap

func (e ErrRevert) Unwrap() error

type EthClient

type EthClient interface {
	SendTransaction(ctx context.Context, tx *types.Transaction) error
	StorageAt(ctx context.Context, account common.Address, key common.Hash, block *big.Int) ([]byte, error)
	CallContract(ctx context.Context, call ethereum.CallMsg, block *big.Int) ([]byte, error)
	NonceAt(ctx context.Context, account common.Address, block *big.Int) (uint64, error)
	PendingNonceAt(ctx context.Context, account common.Address) (uint64, error)
	SuggestGasPrice(ctx context.Context) (*big.Int, error)
	SuggestGasTipCap(ctx context.Context) (*big.Int, error)
	NetworkID(ctx context.Context) (*big.Int, error)
	BlockNumber(ctx context.Context) (uint64, error)
	BlockByNumber(ctx context.Context, number *big.Int) (*types.Block, error)
	FilterLogs(ctx context.Context, q ethereum.FilterQuery) ([]types.Log, error)
}

EthClient represents the Ethereum client, like the ethclient.Client.

type Signer

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

func NewSigner

func NewSigner(account *Account) *Signer

NewSigner returns a new Signer instance. If you don't want to sign any data and you only want to recover public addresses, you may use nil as an argument.

func (*Signer) Address

func (s *Signer) Address() ethereum.Address

Address implements the ethereum.Signer interface.

func (*Signer) Recover

func (s *Signer) Recover(signature ethereum.Signature, data []byte) (*ethereum.Address, error)

Recover implements the ethereum.Signer interface.

func (*Signer) SignTransaction

func (s *Signer) SignTransaction(transaction *ethereum.Transaction) error

SignTransaction implements the ethereum.Signer interface.

func (*Signer) Signature

func (s *Signer) Signature(data []byte) (ethereum.Signature, error)

Signature implements the ethereum.Signer interface.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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