Documentation ¶
Overview ¶
Package geth handles creating mock geth clients and simulated backends
Index ¶
- Constants
- type Backend
- func (f *Backend) BackendName() string
- func (f *Backend) ChainConfig() *params.ChainConfig
- func (f *Backend) FaucetSignTx(tx *types.Transaction) *types.Transaction
- func (f *Backend) FundAccount(ctx context.Context, address common.Address, amount big.Int)
- func (f *Backend) GetFundedAccount(ctx context.Context, requestBalance *big.Int) *keystore.Key
- func (f *Backend) GetTxContext(ctx context.Context, address *common.Address) (res backends.AuthType)
- func (f *Backend) ReachGasLimit()
- func (f *Backend) Signer() types.Signer
Constants ¶
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 ¶
NewEmbeddedBackend gets the default embedded backend.
func NewEmbeddedBackendForChainID ¶
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 ¶
BackendName gets the backend name.
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 ¶
FundAccount fundsa new account.
func (*Backend) GetFundedAccount ¶
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) ReachGasLimit ¶
func (f *Backend) ReachGasLimit()
ReachGasLimit spins an insta-mining client with no-op transactions until target gas limit is achieved see https://github.com/cgewecke/geth-dev-assistant/blob/b7f840baa21f7589a0b18297b60c385a01d72ad1/lib/app.js for details.