w3types

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package w3types implements common types.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

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 deprecated

type Caller = RPCCaller

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

Deprecated: Use the RPCCaller interface instead.

type CallerFactory deprecated

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.

Deprecated: Use the RPCCallerFactory interface instead.

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
	BlobGasFeeCap *big.Int
	BlobHashes    []common.Hash

	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) MustSetTx

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

MustSetTx is like [SetTx] but panics if the sender retrieval fails.

func (*Message) Set

func (msg *Message) Set(msg2 *Message) *Message

Set sets msg to the given Message and returns it.

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, error)

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

func (*Message) UnmarshalJSON

func (msg *Message) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler.

type RPCCaller

type RPCCaller interface {
	// Create a new rpc.BatchElem for doing the RPC call.
	CreateRequest() (elem rpc.BatchElem, err error)

	// Handle the response from the rpc.BatchElem to handle its result.
	HandleResponse(elem rpc.BatchElem) (err error)
}

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

type RPCCallerFactory

type RPCCallerFactory[T any] interface {

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

RPCCallerFactory is the interface that wraps the basic Returns 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