web3.js icon indicating copy to clipboard operation
web3.js copied to clipboard

web3.eth.personal.sign typing is wrong

Open TheDutchCoder opened this issue 4 years ago • 4 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

Current Behavior

When using web3.eth.personal.sign with TypeScript, there's a mandatory 3rd parameter (password), but it's not actually required. The typing for sign is:

    sign(
        dataToSign: string,
        address: string,
        password: string,
        callback?: (error: Error, signature: string) => void
    ): Promise<string>;

But should be:

    sign(
        dataToSign: string,
        address: string,
        password?: string,
        callback?: (error: Error, signature: string) => void
    ): Promise<string>;

Expected Behavior

The 3rd param to be optional

Steps to Reproduce

signature.value = await web3.eth.personal.sign('some string', '0xsomeaccount')

Web3.js Version

1.7.1

Environment

  • Operating System: Mac OS
  • Browser: Chrome
  • Node.js Version: 16.14.0
  • NPM Version: 8.3.1

Anything Else?

No response

TheDutchCoder avatar Mar 08 '22 16:03 TheDutchCoder

@TheDutchCoder Thanks for reaching to us with the feedback. We are currently occupied in 4.x rewrite which will not have that issue. For 1.x we will keep it in pipeline and work as we get some bandwidth.

nazarhussain avatar Mar 09 '22 18:03 nazarhussain

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions. If you believe this was a mistake, please comment.

github-actions[bot] avatar May 09 '22 00:05 github-actions[bot]

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions. If you believe this was a mistake, please comment.

github-actions[bot] avatar Jul 10 '22 00:07 github-actions[bot]

May I ask what is the workaround for this issue if I am using TypeScript and it throws me errors? Just ignore the line? I would think this seems like a relatively straightforward fix, if I create a PR would the devs be interested in reviewing and merging it?

SamsonChoo avatar Jul 23 '22 08:07 SamsonChoo

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions. If you believe this was a mistake, please comment.

github-actions[bot] avatar Sep 23 '22 00:09 github-actions[bot]