geth

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2024 License: MIT Imports: 41 Imported by: 2

Documentation

Overview

Package geth handles creating mock geth clients and simulated backends

Index

Constants

View Source
const GethBackendName = "GethBackend"

GethBackendName is the name of the geth backend.

Variables

This section is empty.

Functions

This section is empty.

Types

type Backend

type Backend struct {
	// Chain is the creates chain object
	*base.Backend
	// Node is the eth node
	*node.Node
	// contains filtered or unexported fields
}

Backend is a full geth backend equivalent to running geth --dev.

func NewEmbeddedBackend

func NewEmbeddedBackend(ctx context.Context, t *testing.T) *Backend

NewEmbeddedBackend gets the default embedded backend.

func NewEmbeddedBackendForChainID

func NewEmbeddedBackendForChainID(ctx context.Context, t *testing.T, chainID *big.Int) *Backend

NewEmbeddedBackendForChainID gets the embedded backend for a specific chain id.

func NewEmbeddedBackendWithConfig

func NewEmbeddedBackendWithConfig(ctx context.Context, t *testing.T, config *params.ChainConfig) *Backend

NewEmbeddedBackendWithConfig gets a full node backend to test against and returns the rpc url can be canceled with the past in context object.

func (*Backend) BackendName

func (f *Backend) BackendName() string

BackendName gets the backend name.

func (*Backend) BatchWithContext added in v0.1.7

func (f *Backend) BatchWithContext(ctx context.Context, calls ...w3types.Caller) error

func (*Backend) ChainConfig

func (f *Backend) ChainConfig() *params.ChainConfig

ChainConfig gets the chain config for the backend.

func (*Backend) FaucetSignTx

func (f *Backend) FaucetSignTx(tx *types.Transaction) *types.Transaction

FaucetSignTx will sign a tx with the faucet addr.

func (*Backend) FundAccount

func (f *Backend) FundAccount(ctx context.Context, address common.Address, amount big.Int)

FundAccount fundsa new account.

func (*Backend) GetFundedAccount

func (f *Backend) GetFundedAccount(ctx context.Context, requestBalance *big.Int) *keystore.Key

GetFundedAccount returns an account with the requested balance. (Note: if genesis acount has an insufficient balance, blocks may be mined here).

func (*Backend) GetTxContext

func (f *Backend) GetTxContext(ctx context.Context, address *common.Address) (res backends.AuthType)

GetTxContext gets a signed transaction from full backend.

func (*Backend) Signer

func (f *Backend) Signer() types.Signer

Signer gets the signer for the chain.

Jump to

Keyboard shortcuts

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