@ -34,6 +34,11 @@ import (
const basefeeWiggleMultiplier = 2
var (
errNoEventSignature = errors . New ( "no event signature" )
errEventSignatureMismatch = errors . New ( "event signature mismatch" )
)
// SignerFn is a signer function callback when a contract requires a method to
// sign the transaction before submission.
type SignerFn func ( common . Address , * types . Transaction ) ( * types . Transaction , error )
@ -488,8 +493,12 @@ func (c *BoundContract) WatchLogs(opts *WatchOpts, name string, query ...[]inter
// UnpackLog unpacks a retrieved log into the provided output structure.
func ( c * BoundContract ) UnpackLog ( out interface { } , event string , log types . Log ) error {
// Anonymous events are not supported.
if len ( log . Topics ) == 0 {
return errNoEventSignature
}
if log . Topics [ 0 ] != c . abi . Events [ event ] . ID {
return fmt . Errorf ( "event signature mismatch" )
return errEventSignatureMismatch
}
if len ( log . Data ) > 0 {
if err := c . abi . UnpackIntoInterface ( out , event , log . Data ) ; err != nil {
@ -507,8 +516,12 @@ func (c *BoundContract) UnpackLog(out interface{}, event string, log types.Log)
// UnpackLogIntoMap unpacks a retrieved log into the provided map.
func ( c * BoundContract ) UnpackLogIntoMap ( out map [ string ] interface { } , event string , log types . Log ) error {
// Anonymous events are not supported.
if len ( log . Topics ) == 0 {
return errNoEventSignature
}
if log . Topics [ 0 ] != c . abi . Events [ event ] . ID {
return fmt . Errorf ( "event signature mismatch" )
return errEventSignatureMismatch
}
if len ( log . Data ) > 0 {
if err := c . abi . UnpackIntoMap ( out , event , log . Data ) ; err != nil {