StricaHQ / typhonjs

Pure javascript Cardano wallet library
Apache License 2.0
61 stars 12 forks source link

Accept Number in protocol params and UTXOs #28

Closed mahnunchik closed 7 months ago

mahnunchik commented 1 year ago

The idea behind is make library consumer to not depend on Bignumber.js itself. This may be done by accepting plain JS Numbers (or even strings) in protocol params values and UTXOs.

BigNumber(BigNumber()) = BigNumber
BigNumber(Number) = BigNumber
BigNumber(String) = BigNumber

This can be implemented by wrapping any value in a BigNumber constructor inside a library.

Related:

ashisherc commented 7 months ago

I'm releasing a new major version of the library with Babbage features, I have considered this suggestion and I feel that it is safer to use BigNumber to work with any Cardano token amount or ADA amount as they can be quite big. I have had got into situations where the number type does not work as expected. Specifically when someone is working with private/public testnets.

We will give it a thought again with Voltaire major release.