Documentation ¶
Index ¶
- func NewCallDecoder(method *goethABI.Method) func(data []byte, res any) error
- func NewCallEncoder(method *goethABI.Method, args ...any) func() ([]byte, error)
- func NewContractErrorDecoder(contract *goethABI.Contract) func(err error) error
- type Call
- func (c *Call) Address() types.Address
- func (c *Call) Call(ctx context.Context, number types.BlockNumber, res any) error
- func (c *Call) CallData() ([]byte, error)
- func (c *Call) Client() rpc.RPC
- func (c *Call) DecodeTo(data []byte, res any) error
- func (c *Call) Gas(ctx context.Context, number types.BlockNumber) (uint64, error)
- type CallOpts
- type Callable
- type Caller
- type Decoder
- type SelfCaller
- type SelfTransactableCaller
- type TransactableCall
- type Transactor
- type TypedCall
- type TypedCaller
- type TypedDecoder
- type TypedSelfCaller
- type TypedSelfTransactableCaller
- type TypedTransactableCall
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewCallDecoder ¶ added in v0.22.7
NewCallDecoder creates a new decoder for the given method and result.
It can be used to create a CallOpts.Decoder.
func NewCallEncoder ¶ added in v0.22.7
NewCallEncoder creates a new encoder for the given method and arguments.
It can be used to create a CallOpts.Encoder.
Types ¶
type Call ¶ added in v0.22.7
type Call struct {
// contains filtered or unexported fields
}
Call is a contract call.
Using this type instead of performing the call directly allows to choose if the call should be executed immediately or passed as an argument to another function.
func (*Call) Address ¶ added in v0.22.7
Address implements the Callable, Caller, TypedCaller, and Transactor interface.
func (*Call) Client ¶ added in v0.22.7
Client implements the Caller, TypedCaller, and Transactor interface.
type CallOpts ¶ added in v0.22.7
type CallOpts struct { // Client is the RPC client to use when performing the call or sending // the transaction. Client rpc.RPC // Address is the address of the contract to call or send a transaction to. Address types.Address // Encoder is an optional encoder that will be used to encode the // arguments of the contract call. Encoder func() ([]byte, error) // Decoder is an optional decoder that will be used to decode the result // returned by the contract call. Decoder func([]byte, any) error // ErrorDecoder is an optional decoder that will be used to decode the // error returned by the contract call. ErrorDecoder func(err error) error }
CallOpts are the options for New*Call functions.
type Callable ¶ added in v0.22.7
type Callable interface { // Address returns the address of the contract to call. Address() types.Address // CallData returns the encoded call data. CallData() ([]byte, error) }
Callable provides the data required to call a contract.
type Caller ¶ added in v0.22.7
type Caller interface { // Address returns the address of the contract to call. Address() types.Address // Client returns the RPC client to use when performing the call. Client() rpc.RPC // Call executes the call and decodes the result into res. Call(ctx context.Context, number types.BlockNumber, res any) error // Gas returns the estimated gas usage of the call. Gas(ctx context.Context, number types.BlockNumber) (uint64, error) }
Caller can perform a call to a contract and decode the result.
type SelfCaller ¶ added in v0.22.7
SelfCaller is a Callable that can perform a call by itself.
type SelfTransactableCaller ¶ added in v0.22.7
type SelfTransactableCaller interface { Callable Caller Transactor Decoder }
SelfTransactableCaller is a Callable that can perform a call or send a transaction by itself.
type TransactableCall ¶ added in v0.22.7
type TransactableCall struct {
// contains filtered or unexported fields
}
TransactableCall works like Call but can be also used to send a transaction.
func NewTransactableCall ¶ added in v0.22.7
func NewTransactableCall(opts CallOpts) *TransactableCall
NewTransactableCall creates a new TransactableCall instance.
func (*TransactableCall) SendTransaction ¶ added in v0.22.7
func (t *TransactableCall) SendTransaction(ctx context.Context) (*types.Hash, *types.Transaction, error)
SendTransaction sends a call as a transaction.
type Transactor ¶ added in v0.22.7
type Transactor interface { // Address returns the address of the contract to send a transaction to. Address() types.Address // Client returns the RPC client to use when sending the transaction. Client() rpc.RPC // SendTransaction sends a call as a transaction. SendTransaction(ctx context.Context) (*types.Hash, *types.Transaction, error) // Gas returns the estimated gas usage of the transaction. Gas(ctx context.Context, number types.BlockNumber) (uint64, error) }
Transactor can send a transaction to a contract.
type TypedCall ¶ added in v0.22.7
type TypedCall[T any] struct { // contains filtered or unexported fields }
TypedCall is a Call with a typed result.
func NewTypedCall ¶ added in v0.22.7
NewTypedCall creates a new TypedCall instance.
type TypedCaller ¶ added in v0.22.7
type TypedCaller[T any] interface { // Address returns the address of the contract to call. Address() types.Address // Client returns the RPC client to use when performing the call. Client() rpc.RPC // Call executes the call and decodes the result into res. Call(ctx context.Context, number types.BlockNumber) (T, error) // Gas returns the estimated gas usage of the call. Gas(ctx context.Context, number types.BlockNumber) (uint64, error) }
TypedCaller can perform a call to a contract and decode the result.
type TypedDecoder ¶ added in v0.22.7
TypedDecoder decodes the data returned by the contract call.
type TypedSelfCaller ¶ added in v0.22.7
type TypedSelfCaller[T any] interface { Callable TypedCaller[T] TypedDecoder[T] Decoder }
TypedSelfCaller is a Callable that can perform a call by itself.
type TypedSelfTransactableCaller ¶ added in v0.22.7
type TypedSelfTransactableCaller[T any] interface { Callable TypedCaller[T] Transactor Decoder }
TypedSelfTransactableCaller is a Callable that can perform a call or send a transaction by itself.
type TypedTransactableCall ¶ added in v0.22.7
type TypedTransactableCall[T any] struct { // contains filtered or unexported fields }
TypedTransactableCall is a TransactableCall with a typed result.
func NewTypedTransactableCall ¶ added in v0.22.7
func NewTypedTransactableCall[T any](opts CallOpts) *TypedTransactableCall[T]
NewTypedTransactableCall creates a new TypedTransactableCall instance.
func (*TypedTransactableCall[T]) Call ¶ added in v0.22.7
func (t *TypedTransactableCall[T]) Call(ctx context.Context, number types.BlockNumber) (T, error)
Call executes the call and returns the decoded result.
func (*TypedTransactableCall[T]) Decode ¶ added in v0.22.7
func (t *TypedTransactableCall[T]) Decode(data []byte) (T, error)
Decode decodes the result of the call.