core

package
v2.0.0-b1 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2024 License: GPL-3.0 Imports: 15 Imported by: 8

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddCall

func AddCall[OutType CallReturnType](mc *batch.MultiCaller, contract *Contract, output *OutType, method string, args ...any)

This is a helper for adding calls to multicall that has strongly-typed output and can take in RP contracts

func AddCallRaw

func AddCallRaw(mc *batch.MultiCaller, contract *Contract, output any, method string, args ...any)

This is a helper for adding calls to multicall that has untyped output and can take in RP contracts Only use this in situations where the output type is unique (such as a struct for a specific contract view)

func Call

func Call[retType CallReturnType](contract *Contract, opts *bind.CallOpts, method string, params ...interface{}) (retType, error)

Calls a contract method

func DecodeAbi

func DecodeAbi(abiEncoded string) (*abi.ABI, error)

Decode, decompress and parse a zlib-compressed, base64-encoded ABI

func EncodeAbiStr

func EncodeAbiStr(abiStr string) (string, error)

zlib-compress and base64-encode an ABI JSON string

func GetValueForUint256

func GetValueForUint256[ValueType FormattedUint256Type](value ValueType) *big.Int

Converts the value to a *big.Int; useful for transactions that require formattable types

Types

type CallReturnType

type CallReturnType interface {
	*big.Int | uint8 | bool | string | common.Address | common.Hash | beacon.ValidatorPubkey | []byte
}

type Contract

type Contract struct {
	*eth.Contract
	Version uint8
}

Contract type wraps go-ethereum bound contract

func (*Contract) Call

func (c *Contract) Call(opts *bind.CallOpts, result interface{}, method string, params ...interface{}) error

Call a contract method

type FormattedUint256Field

type FormattedUint256Field[ValueType FormattedUint256Type] struct {
	// contains filtered or unexported fields
}

A field that is stored as a uint256 in the contracts, but represents a more well-defined type

func NewFormattedUint256Field

func NewFormattedUint256Field[ValueType FormattedUint256Type](contract *Contract, getterName string, args ...any) *FormattedUint256Field[ValueType]

Creates a new FormattedUint256Type instance

func (*FormattedUint256Field[ValueType]) AddToQuery

func (f *FormattedUint256Field[ValueType]) AddToQuery(mc *batch.MultiCaller)

Adds a query to the field's value to the multicall

func (*FormattedUint256Field[ValueType]) Formatted

func (f *FormattedUint256Field[ValueType]) Formatted() ValueType

Gets the value after it's been queried, converted to the more well-defined type

func (*FormattedUint256Field[ValueType]) Raw

func (f *FormattedUint256Field[ValueType]) Raw() *big.Int

Gets the raw value after it's been queried

type FormattedUint256Type

type FormattedUint256Type interface {
	time.Time | uint32 | uint64 | int64 | float64 | time.Duration
}

A collection of legal types for FormattedUint256Field

type FormattedUint8Field

type FormattedUint8Field[ValueType FormattedUint8Type] struct {
	// contains filtered or unexported fields
}

A field that is stored as a uint8 in the contracts, but represents a more well-defined type

func NewFormattedUint8Field

func NewFormattedUint8Field[ValueType FormattedUint8Type](contract *Contract, getterName string, args ...any) *FormattedUint8Field[ValueType]

Creates a new FormattedUint8Type instance

func (*FormattedUint8Field[ValueType]) AddToQuery

func (f *FormattedUint8Field[ValueType]) AddToQuery(mc *batch.MultiCaller)

Adds a query to the field's value to the multicall

func (*FormattedUint8Field[ValueType]) Formatted

func (f *FormattedUint8Field[ValueType]) Formatted() ValueType

Gets the value after it's been queried, converted to the more well-defined type

func (*FormattedUint8Field[ValueType]) Raw

func (f *FormattedUint8Field[ValueType]) Raw() uint8

Gets the raw value after it's been queried

type FormattedUint8Type

A collection of legal types for FormattedUint8Field

type SimpleField

type SimpleField[ValueType CallReturnType] struct {
	// contains filtered or unexported fields
}

A field where the underlying value type is the same as the type stored in the contracts

func NewSimpleField

func NewSimpleField[ValueType CallReturnType](contract *Contract, getterName string, args ...any) *SimpleField[ValueType]

Creates a new SimpleField instance

func (*SimpleField[ValueType]) AddToQuery

func (f *SimpleField[ValueType]) AddToQuery(mc *batch.MultiCaller)

Adds a query to the field's value to the multicall

func (*SimpleField[ValueType]) Get

func (f *SimpleField[ValueType]) Get() ValueType

Gets the field's value after it's been queried

Jump to

Keyboard shortcuts

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