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

Add a .toBigInt() method to BigNumber type #1415

Closed
mds1 opened this issue Mar 30, 2021 · 5 comments
Closed

Add a .toBigInt() method to BigNumber type #1415

mds1 opened this issue Mar 30, 2021 · 5 comments
Labels
enhancement New feature or improvement. fixed/complete This Bug is fixed or Enhancement is complete and published.

Comments

@mds1
Copy link

mds1 commented Mar 30, 2021

Ethers accepts BigInt's as inputs for BigNumberish types, but getting a BigInt from a returned BigNumber is a bit clunky with BigInt(myBigNumber.toString())

I saw in #594 (comment) you mentioned that "There will likely be an instance method that will return a BigInt (similar to the instance.toNumber())", though that method still doesn't exist.

I'm happy to submit a PR for it, as long as you still support adding an instance.toBigInt() method, and my only question would be whether to throw or return null on platforms that don't support BigInt

@ricmoo ricmoo added enhancement New feature or improvement. on-deck This Enhancement or Bug is currently being worked on. labels Mar 30, 2021
@ricmoo
Copy link
Member

ricmoo commented Mar 30, 2021

I have a bunch of other changes I’m pushing out today with v5.1, and this is something that makes sense for that minor bump. I’ll add it today. :)

@ricmoo
Copy link
Member

ricmoo commented Mar 30, 2021

(thanks for the reminder!)

@mds1
Copy link
Author

mds1 commented Mar 30, 2021

Awesome, thank you!

@ricmoo
Copy link
Member

ricmoo commented Mar 30, 2021

This should now be available in 5.1.0.

Try it out and let me know if there are any issues. :)

@ricmoo ricmoo added fixed/complete This Bug is fixed or Enhancement is complete and published. and removed on-deck This Enhancement or Bug is currently being worked on. labels Mar 30, 2021
@mds1
Copy link
Author

mds1 commented Mar 31, 2021

Looks like it's working great so far, appreciate the quick turnaround too!

@mds1 mds1 closed this as completed Mar 31, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or improvement. fixed/complete This Bug is fixed or Enhancement is complete and published.
Projects
None yet
Development

No branches or pull requests

2 participants