multicall

package
v0.0.0-...-7d5141f Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DoMultiCall

func DoMultiCall[A any, B any](mc MulticallClient, a *MultiCallMetaData[A], b *MultiCallMetaData[B]) (*A, *B, error)

func DoMultiCallMany

func DoMultiCallMany[A any](mc MulticallClient, requests ...*MultiCallMetaData[A]) (*[]A, error)

func DoMultiCallManyReportingFailures

func DoMultiCallManyReportingFailures[A any](mc MulticallClient, requests ...*MultiCallMetaData[A]) (*[]TypedMulticall3Result[A], error)

Types

type DeserializedMulticall3Result

type DeserializedMulticall3Result struct {
	Success bool
	Value   any
}

type MultiCallMetaData

type MultiCallMetaData[T interface{}] struct {
	Address      common.Address
	Data         []byte
	FunctionName string
	Deserialize  func([]byte) (T, error)
}

func MultiCall

func MultiCall[T any](contractAddress common.Address, abi abi.ABI, deserialize func([]byte) (T, error), method string, params ...interface{}) (*MultiCallMetaData[T], error)

Call invokes the (constant) contract method with params as input values and sets the output to result. The result type might be a single field for simple returns, a slice of interfaces for anonymous returns and a struct for named returns.

func (*MultiCallMetaData[T]) Raw

func (md *MultiCallMetaData[T]) Raw() RawMulticall

type Multicall3Result

type Multicall3Result struct {
	Success    bool
	ReturnData []byte
}

type MulticallClient

type MulticallClient struct {
	Contract            *bind.BoundContract
	ABI                 *abi.ABI
	Context             context.Context
	MaxBatchSize        uint64
	OverrideCallOptions *bind.CallOpts
}

func NewMulticallClient

func NewMulticallClient(ctx context.Context, eth *ethclient.Client, options *TMulticallClientOptions) (*MulticallClient, error)

maxBatchSizeBytes - 0: no batching.

type ParamMulticall3Call3

type ParamMulticall3Call3 struct {
	Target       common.Address
	AllowFailure bool
	CallData     []byte
}

type RawMulticall

type RawMulticall struct {
	Address      common.Address
	Data         []byte
	FunctionName string
	Deserialize  func([]byte) (any, error)
}

type TMulticallClientOptions

type TMulticallClientOptions struct {
	OverrideContractAddress *common.Address
	MaxBatchSizeBytes       uint64
	OverrideCallOptions     *bind.CallOpts
}

type TypedMulticall3Result

type TypedMulticall3Result[A any] struct {
	Success bool
	Value   A
	Error   error
}

Jump to

Keyboard shortcuts

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