RootSoft/algorand-dart

Transfer assets using double type amount instead of int type

joankabello opened this issue · 2 comments

Hello there,

On the method transfer() which is used to transfer assets, i see that the amount is type of int instead of double. Can this be changed ?
Since when you transfer assets, you would need to transfer a double type like 1.5 for example. But this is not doable since the type specified from the SDK is an int.

Thanks

Hi Joan

This issue is actually the same as #2 .
Transactions require the (asset) amount to be uint64. Because your decimals field is > 0, you have to do some basic math or you can use the format functions:

final amount = Algo.format(amount,decimals);

or

(amount * (pow(10, decimals)))

Oh okay, i wasn't aware that the format method was also for the assets transfer, i thought it was only for the Algos transfers.

My misunderstanding on this one.
Thanks for the explanation!