v0.10.0 Latest Latest

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

Go to latest
Published: Sep 30, 2022 License: MIT Imports: 9 Imported by: 18



Package w3types implements common types.



This section is empty.


This section is empty.


This section is empty.


type Account

type Account struct {
	Nonce   uint64
	Balance *big.Int
	Code    []byte
	Storage map[common.Hash]common.Hash
	// contains filtered or unexported fields

func (*Account) CodeHash

func (acc *Account) CodeHash() common.Hash

CodeHash returns the hash of the account's code.

func (*Account) MarshalJSON

func (acc *Account) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler.

type Caller

type Caller interface {

Caller is the interface that groups the basic CreateRequest and HandleResponse methods.

type CallerFactory

type CallerFactory[T any] interface {

	// Returns given argument points to the variable in which to store the
	// calls result.
	Returns(*T) Caller

CallerFactory is the interface that wraps the basic Returns method.

type Func

type Func interface {

	// EncodeArgs ABI-encodes the given args and prepends the Func's 4-byte
	// selector.
	EncodeArgs(args ...any) (input []byte, err error)

	// DecodeArgs ABI-decodes the given input to the given args.
	DecodeArgs(input []byte, args ...any) (err error)

	// DecodeReturns ABI-decodes the given output to the given returns.
	DecodeReturns(output []byte, returns ...any) (err error)

Func is the interface that wraps the methods for ABI encoding and decoding.

type Message

type Message struct {
	From       common.Address  // Sender
	To         *common.Address // Recipient
	Nonce      uint64
	GasPrice   *big.Int
	GasFeeCap  *big.Int
	GasTipCap  *big.Int
	Gas        uint64
	Value      *big.Int
	Input      []byte // Input data
	AccessList types.AccessList

	Func Func  // Func to encode
	Args []any // Arguments for Func

Message represents a transaction without the signature.

If no input data is given, but Func is not null, the input data is automatically encoded from the given Func and Args arguments by many functions that accept a Message struct as an argument.

func (*Message) MarshalJSON

func (msg *Message) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler.

func (*Message) SetCallMsg

func (msg *Message) SetCallMsg(callMsg ethereum.CallMsg) *Message

SetCallMsg sets msg to the ethereum.CallMsg callMsg and returns msg.

func (*Message) SetTx

func (msg *Message) SetTx(tx *types.Transaction, signer types.Signer) *Message

SetTx sets msg to the types.Transaction tx and returns msg.

type RequestCreator

type RequestCreator interface {
	CreateRequest() (elem rpc.BatchElem, err error)

RequestCreator is the interface that wraps the basic CreateRequest method.

type ResponseHandler

type ResponseHandler interface {
	HandleResponse(elem rpc.BatchElem) (err error)

ResponseHandler is the interface that wraps the basic HandleResponse method.

type State

type State map[common.Address]*Account

func (State) SetGenesisAlloc

func (s State) SetGenesisAlloc(alloc core.GenesisAlloc) State

SetGenesisAlloc copies the given core.GenesisAlloc to the state and returns it.

Jump to

Keyboard shortcuts

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