Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

keccak256/sha3 in web3-utils module must be accepting Buffer #5351

Closed
1 task done
coldcode001 opened this issue Aug 16, 2022 · 1 comment
Closed
1 task done

keccak256/sha3 in web3-utils module must be accepting Buffer #5351

coldcode001 opened this issue Aug 16, 2022 · 1 comment
Assignees
Labels
1.x 1.0 related issues Feature Request

Comments

@coldcode001
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

Seems it's missing in https://github.com/ChainSafe/web3.js/blob/1.x/packages/web3-utils/types/index.d.ts, could we revise the types definition? otherwise we need to suppress the warnings/erros in typescript.
export function sha3(value: string | BN): string | null;

Expected Behavior

export function sha3(value: string | BN | Buffer): string | null;
export function sha3Raw(value: string | BN | Buffer): string;

Steps to Reproduce

https://github.com/ChainSafe/web3.js/blob/1.x/packages/web3-utils/types/index.d.ts

Web3.js Version

1.7.3

Environment

No response

Anything Else?

Not sure if other methods in v1.x have same issue. But I checked v4.x and it's already fixed.

@coldcode001 coldcode001 added the Bug Addressing a bug label Aug 16, 2022
@Muhammad-Altabba
Copy link
Contributor

Muhammad-Altabba commented Aug 17, 2022

Thanks @coldcode001 for opening the issue.
Yes, we worked on accepting more types for sha3 in version 4.x
However, it seems to me like a feature-request rather than a bug. The function just works exactly as expected according to the documentation (https://web3js.readthedocs.io/en/v1.2.11/web3-utils.html#sha3)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1.x 1.0 related issues Feature Request
Projects
None yet
Development

No branches or pull requests

2 participants