ethutil

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

This package contains functions to help using the Go-ethereum library. It is not the objective of this package to replace or hide Go-ethereum.

Index

Constants

View Source
const FoundryMnemonic = "test test test test test test test test test test test junk"

Dev mnemonic used by Foundry/Anvil.

View Source
const GasLimit = 30_000_000

Gas limit when sending transactions.

View Source
const PollInterval = 100 * time.Millisecond

Variables

This section is empty.

Functions

func AddInput

func AddInput(
	ctx context.Context,
	client *ethclient.Client,
	book *addresses.Book,
	signer Signer,
	input []byte,
) (int, error)

Add input to the input box for the given DApp address. This function waits until the transaction is added to a block and return the input index.

func ExecuteVoucher

func ExecuteVoucher(
	ctx context.Context,
	client *ethclient.Client,
	book *addresses.Book,
	signer Signer,
	voucher []byte,
	destination *common.Address,
	proof *contracts.Proof,
) (*common.Hash, error)

Executes a voucher given its payload, destination and proof. This function waits until the transaction is added to a block and returns the transaction hash.

func GetInputFromInputBox

func GetInputFromInputBox(
	client *ethclient.Client,
	book *addresses.Book,
	inputIndex int,
) (*contracts.InputBoxInputAdded, error)

Get the given input of the given DApp from the input box. Return the event with the input sender and payload.

func ValidateNotice

func ValidateNotice(
	ctx context.Context,
	client *ethclient.Client,
	book *addresses.Book,
	notice []byte,
	proof *contracts.Proof,
) error

ValidateNotice validates the given notice for the specified Dapp. It returns nil if the notice is valid and an execution-reverted error otherwise.

Types

type MnemonicSigner

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

Sign transactions using a mnemonic.

func NewMnemonicSigner

func NewMnemonicSigner(
	ctx context.Context,
	client *ethclient.Client,
	mnemonic string,
	accountIndex uint32,
) (*MnemonicSigner, error)

Create a new mnemonic signer. Uses the client to get the chain ID.

func (*MnemonicSigner) Account

func (s *MnemonicSigner) Account() common.Address

func (*MnemonicSigner) MakeTransactor

func (s *MnemonicSigner) MakeTransactor() (*bind.TransactOpts, error)

type Signer

type Signer interface {

	// Create the base transaction used in the contract bindings.
	MakeTransactor() (*bind.TransactOpts, error)

	// Get the account address of the signer.
	Account() common.Address
}

Interface that sign blockchain transactions.

Jump to

Keyboard shortcuts

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