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

utils.fromWei & toWei returns string when I pass BigNumber #1042

Closed
szerintedmi opened this issue Sep 14, 2017 · 2 comments
Closed

utils.fromWei & toWei returns string when I pass BigNumber #1042

szerintedmi opened this issue Sep 14, 2017 · 2 comments

Comments

@szerintedmi
Copy link

When I pass MikeMcl BigNumber the return value is string. It used to recognise BigNumbers from that library pre 1.0.0

import BigNumber from "bignumber.js";
let ethStringToWei = web3.utils.toWei("1");
    let ethBNToWei = web3.utils.toWei(new BigNumber("1"));
    console.log(
        web3.version,
        typeof ethStringToWei,
        ethStringToWei,
        typeof ethBNToWei,
        ethBNToWei
    );

// output:
// 1.0.0-beta.18 string 1000000000000000000 string 1000000000000000000
@frozeman
Copy link
Contributor

Yes we don't return Bignumber anymore, you can choose your own BN lib you want to use and convert the number string yourself.
Internally we use BN.js

@linusnorton
Copy link
Contributor

@frozeman is there a migration document somewhere? I only found this out by trial and error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants