You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
getBestSell(in, out, amount).toTx(limit) is the worst offender, where the amount is expected to be normalized (123.33), byt limit is absolute (123330000) which leads to errors in integrations which can lead to loss of funds for users
getBestSpotPrice returns the amount of 1 asset in as {amount, decimals}, so you are forced to convert it youself even more confusingly amount can have the fractional part as well
proposed fix
introduce new type Amount that can be created automatically from Number, String, whatever and implements toString, toHex, toNumber, toBigNumber, decimals and toNormalized (name TBD) that will normalize asset amount by decimals, others will return absolute amount, alternatively, we could always deal with the normalized amounts and there would be toAbsolute
it is strongly recommended to to these changes in a back-compatible way to minimize errors this will introduce in integrations
The text was updated successfully, but these errors were encountered:
getBestSell(in, out, amount).toTx(limit)
is the worst offender, where the amount is expected to be normalized (123.33), byt limit is absolute (123330000) which leads to errors in integrations which can lead to loss of funds for usersgetBestSpotPrice
returns the amount of 1 asset in as{amount, decimals}
, so you are forced to convert it youself even more confusingly amount can have the fractional part as wellproposed fix
introduce new type Amount that can be created automatically from
Number
,String
, whatever and implementstoString
,toHex
,toNumber
,toBigNumber
,decimals
andtoNormalized
(name TBD) that will normalize asset amount by decimals, others will return absolute amount, alternatively, we could always deal with the normalized amounts and there would betoAbsolute
it is strongly recommended to to these changes in a back-compatible way to minimize errors this will introduce in integrations
The text was updated successfully, but these errors were encountered: