Documentation ¶
Index ¶
- Variables
- func AccrueEvents(contractABI abi.ABI, eventKeys ...string) []abi.Event
- func CollectEventHashes(events []abi.Event) []common.Hash
- func ExtractFieldFromUnpacked[T any](unpacked map[string]interface{}, field string) (T, error)
- func UnpackLogDataIntoMap(contractABI abi.ABI, eventKey string, logData []byte) (map[string]interface{}, error)
- type Contract
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrUnpackFailed = errors.New("failed to unpack log data") ErrTypeAssertion = errors.New("failed to assert type") ErrFieldNotFound = errors.New("field not found") ErrNoSuchABIEvent = errors.Wrap(ErrFieldNotFound, "no such ABI event") )
Functions ¶
func AccrueEvents ¶
AccrueEvents uses |eventKeys| to find corresponding `abi.Event` in |contractABI|. If eventKeys has length of 0, AccrueEvents returns all |contractABI.Events| events.
func CollectEventHashes ¶
CollectEventHashes returns a slice containing all event hashes (ID) from |events|.
Types ¶
type Contract ¶
type Contract struct { Name string `json:"name"` // Arbitrary contract name Address common.Address `json:"address"` // Deployment address ContractABI abi.ABI `json:"-"` // Contract's parsed abi.ABI ContractEvents []abi.Event `json:"events"` // Contract's arbitrary interesting events }
Contract is a utility struct that provides just-enough contract-specific information for small Go backend services.
Click to show internal directories.
Click to hide internal directories.