web3 icon indicating copy to clipboard operation
web3 copied to clipboard

invalid hex address on empty input array

Open ypcat opened this issue 4 months ago • 2 comments

Hi,

I found when calling contract from cli with empty array input would cause this error:

ERROR: Error calling constant function: invalid hex address:

I think the root cause should be that strings.Split on empty string results in a slice with one empty string ([""]) instead of 0-length ([]).

https://github.com/gochain/web3/blob/c84726a6a7ac1fc9579184bc6fe6e3297ef4c9fe/web3.go#L462-L469

I can submit a PR if needed.

Thanks.

ypcat avatar Oct 11 '24 08:10 ypcat