RootSoft / algorand-dart

Unofficial community SDK to interact with the Algorand network, for Dart & Flutter
MIT License
36 stars 16 forks source link

Asset amount & algos amount should be double #2

Closed joankabello closed 3 years ago

joankabello commented 3 years ago

Hello there,

Nice work with the SDK. I saw that the amount of assets or the amount of algos are intigers, in fact i think it should be a double. In example when you get total amount of X asset, instead of being 1.5, in turns in an intiger on the Algorand Sdk, and looks 15. Of course you can divide it by 10 to get it in double, but for the sake of correctness it would be great to have it a double. :sweat_smile:

Thanks

RootSoft commented 3 years ago

Hi Joan,

The amount of assets or amount of algos should actually be BigIntegers (I still have to do some work to support BigInts). The base unit of Algo is a microAlgo (1 algo = 1.000.000 microAlgos), so you should actually work in microAlgos.

Regarding assets, that is probably based on the total asset amount and decimals specified when creating the asset, so you should do the calculation yourself. If you create an asset with 0 decimals, the asset amount will probably be correct. You can use the format method in the Algo class to specify the number of Algos.

Thanks for trying out the SDK btw!

joankabello commented 3 years ago

Thanks for the explanations, keep up the good work!