add some docs

This commit is contained in:
Jared Wasinger 2024-12-15 20:59:55 +07:00 committed by Felix Lange
parent 2421cc3ed5
commit 780dd76746
1 changed files with 3 additions and 2 deletions

View File

@ -25,13 +25,14 @@ import (
"github.com/ethereum/go-ethereum/event" "github.com/ethereum/go-ethereum/event"
) )
// TODO: this will be generated as part of the bindings, contain the ABI (or metadata object?) and errors // ContractInstance represents a contract deployed on-chain that can be interacted with (filter for past logs, watch
// for new logs, call, transact).
type ContractInstance struct { type ContractInstance struct {
Address common.Address Address common.Address
Backend bind.ContractBackend Backend bind.ContractBackend
} }
// TODO: adding docs soon (jwasinger) // FilterEvents returns an EventIterator instance for filtering historical events based on the event id and a block range.
func FilterEvents[T any](instance *ContractInstance, opts *bind.FilterOpts, eventID common.Hash, unpack func(*types.Log) (*T, error), topics ...[]any) (*EventIterator[T], error) { func FilterEvents[T any](instance *ContractInstance, opts *bind.FilterOpts, eventID common.Hash, unpack func(*types.Log) (*T, error), topics ...[]any) (*EventIterator[T], error) {
backend := instance.Backend backend := instance.Backend
c := bind.NewBoundContract(instance.Address, abi.ABI{}, backend, backend, backend) c := bind.NewBoundContract(instance.Address, abi.ABI{}, backend, backend, backend)