@@ -250,7 +250,7 @@ router.post('/trade', async (req: Request, res: Response) => {
250250 ) ;
251251
252252 if ( side === 'BUY' ) {
253- const price = trade . executionPrice . invert ( ) . toSignificant ( 8 ) ;
253+ const price = trade . executionPrice . invert ( ) . toFixed ( ) ;
254254 logger . info ( `uniswap.route - Price: ${ price . toString ( ) } ` ) ;
255255 if ( ! limitPrice || price <= limitPrice ) {
256256 // pass swaps to exchange-proxy to complete trade
@@ -268,7 +268,7 @@ router.post('/trade', async (req: Request, res: Response) => {
268268 base : baseTokenAddress ,
269269 quote : quoteTokenAddress ,
270270 amount : amount ,
271- expectedIn : expectedAmount . toSignificant ( 8 ) ,
271+ expectedIn : expectedAmount . toFixed ( ) ,
272272 price : price ,
273273 gasPrice : gasPrice ,
274274 gasLimit,
@@ -286,7 +286,7 @@ router.post('/trade', async (req: Request, res: Response) => {
286286 }
287287 } else {
288288 // sell
289- const price = trade . executionPrice . toSignificant ( 8 ) ;
289+ const price = trade . executionPrice . toFixed ( ) ;
290290 logger . info ( `Price: ${ price . toString ( ) } ` ) ;
291291 if ( ! limitPrice || price >= limitPrice ) {
292292 // pass swaps to exchange-proxy to complete trade
@@ -304,7 +304,7 @@ router.post('/trade', async (req: Request, res: Response) => {
304304 base : baseTokenAddress ,
305305 quote : quoteTokenAddress ,
306306 amount : parseFloat ( req . body . amount ) ,
307- expectedOut : expectedAmount . toSignificant ( 8 ) ,
307+ expectedOut : expectedAmount . toFixed ( ) ,
308308 price : parseFloat ( price ) ,
309309 gasPrice : gasPrice ,
310310 gasLimit,
@@ -389,13 +389,13 @@ router.post('/price', async (req: Request, res: Response) => {
389389 if ( trade !== null && expectedAmount !== null ) {
390390 price =
391391 side === 'BUY'
392- ? trade . executionPrice . invert ( ) . toSignificant ( 8 )
393- : trade . executionPrice . toSignificant ( 8 ) ;
392+ ? trade . executionPrice . invert ( ) . toFixed ( )
393+ : trade . executionPrice . toFixed ( ) ;
394394
395395 priceResult = {
396396 price : parseFloat ( price ) ,
397397 amount : parseFloat ( amount ) ,
398- expectedAmount : parseFloat ( expectedAmount . toSignificant ( 8 ) ) ,
398+ expectedAmount : parseFloat ( expectedAmount . toFixed ( ) ) ,
399399 } ;
400400 }
401401 } else {
0 commit comments