Big numbers support
Opened this issue · 2 comments
Hey guys,
Your library is really nice with good test coverage and we will probably use it. I just have one question. If we add support for big numbers (e.g. https://github.com/MikeMcl/bignumber.js) will you accept it? Do you even care about supporting new coins? I just wanted to ask first, so we don't waste the time.
Thank you!
We are working on a policy and refactoring in order to allow contributors to add new coins, but it's not ready yet.
I'm curious about the "Big Numbers" change you suggest, what is the motivation behind? Javascript numbers should be enough when dealing with UTXO related values.
Hi @argjv
The motivation here is support for dogecoin which works with quite large amounts.
For example without this change we are not able to parse Transaction.fromHex
for existing transaction:
https://doge1.trezor.io/tx/0a4cb7d5c27455333701f0e53812e4be56a0272ad7f168279acfed7b065ee118
It fails in bufferutils.verifuint
with RangeError.
I've already made this change and now we successfully get Transaction.outs.value
as strings (when network is set to "doge")
It's a simple change, you can see it in this commit:
trezor@e97f7f7
Now there are 2 questions:
- Are you interested to have this change in you repo?
- If you are interested, i figured out second approach to do allow working with strings where instead of relying on network we can decide to use strings everywhere by setting global
Transaction.USE_STRING_VALUES
to true
trezor@810f989
I'm not sure which approach is better, i like the second one
We've already decided to fork your lib since we want to add there some more logic that we need like Transaction.getExtraData
method see here, but we want to keep it as close to upstream as possible