Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Mar 5, 2025. It is now read-only.
This repository was archived by the owner on Mar 5, 2025. It is now read-only.

web3.utils.toWei(amount, ether) fix required when decimals in input are overflown. #7044

@hammersharkfish

Description

@hammersharkfish

MRE :

x = "1.123456789123456789123"
const amountInWei = web3.utils.toWei(x, 'ether')

console.log(amountInWei, typeof(amountInWei))

Output: 1123456789123456789123 string .
This output is equivalent to 1123.456789123456789123 ether while we provided 1.123456789123456789123 as input .

Metadata

Metadata

Assignees

No one assigned

    Labels

    4.x4.0 relatedBugAddressing a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions