@@ -33,7 +33,8 @@ type ContractEvent interface {
3333}
3434
3535// FilterEvents filters a historical block range for instances of emission of a
36- // specific event type from a specified contract. It returns an error if... (TODO: enumerate error scenarios)
36+ // specific event type from a specified contract. It returns an error if the
37+ // provided filter opts are invalid or the backend is closed.
3738func FilterEvents [Ev ContractEvent ](c * BoundContract , opts * FilterOpts , unpack func (* types.Log ) (* Ev , error ), topics ... []any ) (* EventIterator [Ev ], error ) {
3839 var e Ev
3940 logs , sub , err := c .FilterLogs (opts , e .ContractEventName (), topics ... )
@@ -43,11 +44,13 @@ func FilterEvents[Ev ContractEvent](c *BoundContract, opts *FilterOpts, unpack f
4344 return & EventIterator [Ev ]{unpack : unpack , logs : logs , sub : sub }, nil
4445}
4546
46- // WatchEvents creates an event subscription to notify when logs of the specified event type are emitted from the given contract.
47- // Received logs are unpacked and forwarded to sink. If topics are specified, only events are forwarded which match the
48- // topics.
47+ // WatchEvents creates an event subscription to notify when logs of the
48+ // specified event type are emitted from the given contract. Received logs are
49+ // unpacked and forwarded to sink. If topics are specified, only events are
50+ // forwarded which match the topics.
4951//
50- // WatchEvents returns a subscription or an error if ... (TODO: enumerate error scenarios)
52+ // WatchEvents returns a subscription or an error if the provided WatchOpts are
53+ // invalid or the backend is closed.
5154func WatchEvents [Ev ContractEvent ](c * BoundContract , opts * WatchOpts , unpack func (* types.Log ) (* Ev , error ), sink chan <- * Ev , topics ... []any ) (event.Subscription , error ) {
5255 var e Ev
5356 logs , sub , err := c .WatchLogs (opts , e .ContractEventName (), topics ... )
@@ -81,7 +84,8 @@ func WatchEvents[Ev ContractEvent](c *BoundContract, opts *WatchOpts, unpack fun
8184 }), nil
8285}
8386
84- // EventIterator is an object for iterating over the results of a event log filter call.
87+ // EventIterator is an object for iterating over the results of a event log
88+ // filter call.
8589type EventIterator [T any ] struct {
8690 current * T
8791 unpack func (* types.Log ) (* T , error )
@@ -100,8 +104,8 @@ func (it *EventIterator[T]) Value() *T {
100104// returning true if the iterator advanced.
101105//
102106// If the attempt to convert the raw log object to an instance of T using the
103- // unpack function provided via FilterEvents returns an error: that error is returned and subsequent calls to Next will
104- // not advance the iterator.
107+ // unpack function provided via FilterEvents returns an error: that error is
108+ // returned and subsequent calls to Next will not advance the iterator.
105109func (it * EventIterator [T ]) Next () (advanced bool , err error ) {
106110 // If the iterator failed with an error, don't proceed
107111 if it .fail != nil || it .closed {
@@ -151,8 +155,9 @@ func (it *EventIterator[T]) Close() error {
151155
152156// Call performs an eth_call to a contract with optional call data.
153157//
154- // To call a function that doesn't return any output, pass nil as the unpack function.
155- // This can be useful if you just want to check that the function doesn't revert.
158+ // To call a function that doesn't return any output, pass nil as the unpack
159+ // function. This can be useful if you just want to check that the function
160+ // doesn't revert.
156161func Call [T any ](c * BoundContract , opts * CallOpts , calldata []byte , unpack func ([]byte ) (T , error )) (T , error ) {
157162 var defaultResult T
158163 packedOutput , err := c .CallRaw (opts , calldata )
@@ -178,9 +183,10 @@ func Transact(c *BoundContract, opt *TransactOpts, data []byte) (*types.Transact
178183 return c .transact (opt , & addr , data )
179184}
180185
181- // DeployContract creates and submits a deployment transaction based on the deployer bytecode and
182- // optional ABI-encoded constructor input. It returns the address and creation transaction of the
183- // pending contract, or an error if the creation failed.
186+ // DeployContract creates and submits a deployment transaction based on the
187+ // deployer bytecode and optional ABI-encoded constructor input. It returns
188+ // the address and creation transaction of the pending contract, or an error
189+ // if the creation failed.
184190func DeployContract (opts * TransactOpts , bytecode []byte , backend ContractBackend , constructorInput []byte ) (common.Address , * types.Transaction , error ) {
185191 c := NewBoundContract (common.Address {}, abi.ABI {}, backend , backend , backend )
186192
0 commit comments