From 86d9540318ef4986500053a29884522ca258c333 Mon Sep 17 00:00:00 2001 From: Peter Broadhurst Date: Mon, 27 Jun 2022 12:32:47 -0400 Subject: [PATCH] Improve function docs Signed-off-by: Peter Broadhurst --- pkg/abi/abi.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkg/abi/abi.go b/pkg/abi/abi.go index 840f3121..a3fde27a 100644 --- a/pkg/abi/abi.go +++ b/pkg/abi/abi.go @@ -377,7 +377,7 @@ func (e *Entry) GenerateFunctionSelectorCtx(ctx context.Context) ([]byte, error) } // FunctionSelectorBytes is a convenience function to get the ID as bytes. -// Will return a nil 4 bytes on error +// Will return all zeros on error (ensures non-nil) func (e *Entry) FunctionSelectorBytes() ethtypes.HexBytes0xPrefix { id, err := e.GenerateFunctionSelector() if err != nil { @@ -447,6 +447,8 @@ func (e *Entry) SignatureHashCtx(context.Context) (ethtypes.HexBytes0xPrefix, er return hash.Sum(nil), nil } +// SignatureHashBytes is a convenience function to get the signature hash as bytes. +// Will return all zeros on error (ensures non-nil) func (e *Entry) SignatureHashBytes() ethtypes.HexBytes0xPrefix { sh, err := e.SignatureHashCtx(context.Background()) if err != nil {