-
Notifications
You must be signed in to change notification settings - Fork 778
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
BN support in Common #914
Comments
Bumping this to important. We convert BNs to numbers at some places, where this is illegal if we use very high values (such as chain id, very big block numbers, etc.) |
Also the question here if we want to use an (eventually expanded with |
I have taken a look at all existing Common type signatures with input type containing a
|
@ryanio thanks for bringing these together. 😄 Yes, I also had a short look couple of days ago. The only solution I can think of for these return-number messages is doing temporary e.g. We might also want to give a short note on the code docs of the methods themselves. |
@holgerd77 no problem. another idea I had today is what if we added an extra optional param e.g. chainId(returnAsBN?: true): BN
chainId(returnAsBN? = false): number so current usage would still work as expected without any breaking change. I think I prefer just adding a new method On another note, can we do a small release on |
Yeah, if it wouldn't be for your explanation I guess I would have also agreed to the parameter version, but these extra methods seems to be the less invasive variant. Some other aspects: I was thinking a bit about a (not so far in the) future BigInt transition. My current idea/suggestion on how to do this (at least regarding the methods we are touching here and with the other
With this in consideration I guess it does make sense here (for the input parameters) to rather broaden and go for For the output methods it might rather make more sense to go for |
Lots of methods in Common have to do with numbers. We sometimes convert BNs to numbers (for instance block numbers) and feed those to Common. Common should support inputs where this input is of type BN and should also handle arithmetic as BN. We can keep supporting numbers by internally converting it to BN and then feeding it to the same method which handles the input as BN.
The text was updated successfully, but these errors were encountered: