Closed dcts closed 3 weeks ago
To reproduce this error, we used those inputs to adex.createExchangeOrderTx
:
[
'component_tdx_2_1crs8ud8rr680krgtlskauye7qnns5zdawdlspvcqceder6tysu884p',
'MARKET',
'SELL',
'resource_tdx_2_1thrn8vw7lrxpej7enxmhd84mqd9f3cp97rf5qyy8jxa7gpxcnxr5uu',
1238.5599423734525,
-1,
9999,
4,
'account_tdx_2_128t0tnge6cvufl8rc2nj6ushlamuk4fcl4ll889v4fhv57algulas9',
'account_tdx_2_128t0tnge6cvufl8rc2nj6ushlamuk4fcl4ll889v4fhv57algulas9'
]
When we add max on a non-XRD input field with high precision, we get an "insufficient balance" error inside the wallet (with approximately 50% probability). This is most likely caused by
adex.createExchangeOrderTx
.To Reproduce
1238.5599423734525 DEXTR
in your wallet (you can send the difference to another wallet)Available: 1238.55
labelWe are sending the full balance to
adex.createExchangeOrderTx
but for some reason the amount is then rounded in a weird way to...38
instead of...37
.To fix this we can simply truncate the amount we send to
adex.createExchangeOrderTx
to the 8th decimal (truncate, NOT round).