Currently, the values in NewSpotOrderParams only accept numbers. Since all numbers in JS are floats, this leads to some numbers having recurring decimals when converting to base 10, tripping the filter "Precision is over the maximum defined for this asset." even after normalizing the number (with Math.floor(qty / precision) * precision).
Allowing passing numberInString or simply string (as numberInString | number) would allow the user to trim the passed value with Number.toFixed.
eg:
const qty = 10/3; // => 3.3333333333333335
const precision = 0.0001;
const normalized = Math.floor(qty / precision) * precision; // => 3.3333000000000004 (rejected)
const trimmed = normalized.toFixed(4) // => "3.3333" (accepted)
Currently, the values in
NewSpotOrderParamsonly accept numbers. Since all numbers in JS are floats, this leads to some numbers having recurring decimals when converting to base 10, tripping the filter "Precision is over the maximum defined for this asset." even after normalizing the number (withMath.floor(qty / precision) * precision).Allowing passing
numberInStringor simplystring(asnumberInString | number) would allow the user to trim the passed value withNumber.toFixed.eg: