event

package
v1.1.6 Latest Latest
Warning

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

Go to latest
Published: May 29, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewAbi

func NewAbi(s string) *abi.ABI

If the ABI is invalid, panic.

Args:

s (string): The ABI string of the contract

func NewCli

func NewCli(url string) *jsonrpc.Client

It creates a new client for the given url.

Args:

url (string): The address of the RPC service.

Types

type LoadWrapper

type LoadWrapper func(d interface{}, v map[string]interface{}, l *web3.Log)

type MyContract

type MyContract struct {
	Addr         string
	Contract     *contract.Contract
	Cli          *jsonrpc.Client
	TimeDuration int64 // after some time do it
}

func NewContract

func NewContract(addr, abiStr, rpc string) *MyContract

`NewContract` takes an address, an ABI string, and a data struct, and returns a `MyContract` struct

Args:

addr (string): The address of the contract
abiStr (string): The ABI of the contract.

func (*MyContract) Call

func (d *MyContract) Call(method string, param ...interface{}) (interface{}, error)

A function that is used to call the contract method.

func (*MyContract) GetHistoryLogs

func (d *MyContract) GetHistoryLogs(start, step int64, wrapper LoadWrapper, name ...interface{})

The above code is a function that is used to get the history logs of a contract.

func (*MyContract) GetLogs

func (d *MyContract) GetLogs(wrapper LoadWrapper, name ...interface{})

The above code is a Go function that is used to get the logs of a contract.

func (*MyContract) NewFilter

func (d *MyContract) NewFilter(name ...interface{}) *web3.LogFilter

Creating a filter for the contract events.

func (*MyContract) NowBlock

func (d *MyContract) NowBlock() web3.BlockNumber

It returns the current block number

func (*MyContract) ParseLogWithWrapper

func (d *MyContract) ParseLogWithWrapper(l *web3.Log, wrapper LoadWrapper, name ...interface{})

A function that is used to parse the logs of a contract.

Jump to

Keyboard shortcuts

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