ethbackend

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2024 License: GPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Backend

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

func NewBackend

func NewBackend(chainName string, chainID uint64, blockPeriod time.Duration, ethCl ethclient.Client, privateKeys ...*ecdsa.PrivateKey) (*Backend, error)

func (*Backend) AddAccount

func (b *Backend) AddAccount(privkey *ecdsa.PrivateKey) (common.Address, error)

func (*Backend) BindOpts

func (b *Backend) BindOpts(ctx context.Context, from common.Address) (*bind.TransactOpts, error)

BindOpts returns a new TransactOpts for interacting with bindings based contracts for the provided account. The TransactOpts are partially stubbed, since txmgr handles nonces and signing.

Do not cache or store the TransactOpts, as they are not safe for concurrent use (pointer). Rather create a new TransactOpts for each transaction.

func (*Backend) Chain

func (b *Backend) Chain() (string, uint64)

func (*Backend) Send

func (*Backend) SendTransaction

func (b *Backend) SendTransaction(ctx context.Context, in *ethtypes.Transaction) error

SendTransaction intercepts the tx that bindings generates, extracts the from address (assuming the backendStubSigner was used), the strips fields, and passes it to the txmgr for reliable broadcasting.

func (*Backend) Sign

func (b *Backend) Sign(from common.Address, input [32]byte) ([65]byte, error)

func (*Backend) WaitMined

func (b *Backend) WaitMined(ctx context.Context, tx *ethtypes.Transaction) (*ethtypes.Receipt, error)

WaitMined waits for the transaction to be mined and asserts the receipt is successful.

type Backends

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

Backends is a wrapper around a set of Backends, one for each chain. At this point, it only supports "a single account for all Backends".

See Backends godoc for more information.

func NewBackends

func NewBackends(testnet types.Testnet, deployKeyFile string) (Backends, error)

func (Backends) BindOpts

func (b Backends) BindOpts(ctx context.Context, sourceChainID uint64) (common.Address, *bind.TransactOpts, *Backend, error)

BindOpts is a convenience function that returns the single account and bind.TransactOpts and Backend for a given chain.

func (Backends) NewWaiter

func (b Backends) NewWaiter() *Waiter

NewWaiter returns a new Waiter.

func (Backends) RPCClients

func (b Backends) RPCClients() map[uint64]ethclient.Client

type Waiter

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

Waiter is a convenience struct to easily wait for multiple transactions to be mined.

func (*Waiter) Add

func (w *Waiter) Add(chainID uint64, tx *ethtypes.Transaction)

func (*Waiter) Wait

func (w *Waiter) Wait(ctx context.Context) error

Jump to

Keyboard shortcuts

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