diff --git a/README.md b/README.md index b0df7407..1eab0b84 100644 --- a/README.md +++ b/README.md @@ -117,8 +117,7 @@ which will show: --order-interpreter
Option to filter the subgraph query results with a specific order's interpreter address, Will override the 'ORDER_INTERPRETER' in env variables --monthly-ratelimit 0x monthly rate limit, if not specified will not respect any 0x monthly ratelimit, Will override the 'MONTHLY_RATELIMIT' in env variables --sleep Seconds to wait between each arb round, default is 10, Will override the 'SLEPP' in env variables - --max-profit Option to maximize profit for 'srouter' mode, comes at the cost of more RPC calls, Will override the 'MAX_PROFIT' - in env variables + --max-profit Option to maximize profit for 'srouter' mode, comes at the cost of more RPC calls, Will override the 'MAX_PROFIT' in env variables --max-ratio Option to maximize maxIORatio for 'srouter' mode, Will override the 'MAX_RATIO' in env variables -V, --version output the version number -h, --help display help for command diff --git a/docs/html/curve.js.html b/docs/html/curve.js.html index 79348a14..b53e9c0f 100644 --- a/docs/html/curve.js.html +++ b/docs/html/curve.js.html @@ -709,13 +709,13 @@

Source: curve.js


- Documentation generated by JSDoc 4.0.2 on Fri Sep 08 2023 16:28:57 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 4.0.2 on Fri Sep 08 2023 16:38:49 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/html/global.html b/docs/html/global.html index 67b3e2c1..50cb5d9e 100644 --- a/docs/html/global.html +++ b/docs/html/global.html @@ -7353,6 +7353,189 @@
Parameters:
+ + + + + + +

visualizeRoute(fromToken, toToken, legs)

+ + + + + + +
+ Method to visualize the routes, returns array of route strings sorted from highest to lowest percentage +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
fromToken + + +string + + + + The from token address
toToken + + +string + + + + The to token address
legs + + +Array.<any> + + + + The legs of the route
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + @@ -7607,13 +7790,13 @@
Returns:

- Documentation generated by JSDoc 4.0.2 on Fri Sep 08 2023 16:28:57 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 4.0.2 on Fri Sep 08 2023 16:38:49 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/html/index.html b/docs/html/index.html index 70e7b549..5afb8c7f 100644 --- a/docs/html/index.html +++ b/docs/html/index.html @@ -50,13 +50,13 @@


- Documentation generated by JSDoc 4.0.2 on Fri Sep 08 2023 16:28:57 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 4.0.2 on Fri Sep 08 2023 16:38:49 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/html/index.js.html b/docs/html/index.js.html index 2d56be0f..ee44d7dc 100644 --- a/docs/html/index.js.html +++ b/docs/html/index.js.html @@ -294,13 +294,13 @@

Source: index.js


- Documentation generated by JSDoc 4.0.2 on Fri Sep 08 2023 16:28:57 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 4.0.2 on Fri Sep 08 2023 16:38:49 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/html/query.js.html b/docs/html/query.js.html index e4e57cfe..cc901ca0 100644 --- a/docs/html/query.js.html +++ b/docs/html/query.js.html @@ -140,13 +140,13 @@

Source: query.js


- Documentation generated by JSDoc 4.0.2 on Fri Sep 08 2023 16:28:57 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 4.0.2 on Fri Sep 08 2023 16:38:49 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/html/router.js.html b/docs/html/router.js.html index 6ea9a564..9609f743 100644 --- a/docs/html/router.js.html +++ b/docs/html/router.js.html @@ -327,11 +327,15 @@

Source: router.js

// ); // if (route.status == "NoWay") throw "could not find any route for this token pair"; console.log(">>> Route portions: ", "\n"); - console.log( - "\x1b[36m%s\x1b[0m", - visualizeRoute(fromToken.address, toToken.address, route.legs), - "\n" + visualizeRoute(fromToken.address, toToken.address, route.legs).forEach( + v => console.log("\x1b[36m%s\x1b[0m", v) ); + console.log("\n"); + // console.log( + // "\x1b[36m%s\x1b[0m", + // visualizeRoute(fromToken.address, toToken.address, route.legs), + // "\n" + // ); const rpParams = Router.routeProcessor2Params( pcMap, @@ -592,13 +596,13 @@

Source: router.js


- Documentation generated by JSDoc 4.0.2 on Fri Sep 08 2023 16:28:57 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 4.0.2 on Fri Sep 08 2023 16:38:49 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/html/srouter.js.html b/docs/html/srouter.js.html index 9461152c..a4c3847c 100644 --- a/docs/html/srouter.js.html +++ b/docs/html/srouter.js.html @@ -269,11 +269,14 @@

Source: srouter.js

const price = rateFixed.mul("1" + "0".repeat(18)).div(maximumInputFixed); console.log(`Current best route price for this token pair: ${ethers.utils.formatEther(price)}`, "\n"); console.log(">>> Route portions: ", "\n"); - console.log( - "\x1b[36m%s\x1b[0m", - visualizeRoute(fromToken.address, toToken.address, route.legs), - "\n" + visualizeRoute(fromToken.address, toToken.address, route.legs).forEach( + v => console.log("\x1b[36m%s\x1b[0m", v) ); + console.log("\n"); + // console.log( + // "\x1b[36m%s\x1b[0m", + // "\n" + // ); const rpParams = Router.routeProcessor2Params( pcMap, @@ -523,13 +526,13 @@

Source: srouter.js


- Documentation generated by JSDoc 4.0.2 on Fri Sep 08 2023 16:28:57 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 4.0.2 on Fri Sep 08 2023 16:38:49 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/html/utils.js.html b/docs/html/utils.js.html index 20d6a6d6..86d48242 100644 --- a/docs/html/utils.js.html +++ b/docs/html/utils.js.html @@ -1239,6 +1239,13 @@

Source: utils.js

} }; +/** + * Method to visualize the routes, returns array of route strings sorted from highest to lowest percentage + * + * @param {string} fromToken - The from token address + * @param {string} toToken - The to token address + * @param {any[]} legs - The legs of the route + */ const visualizeRoute = (fromToken, toToken, legs) => { return [ ...legs.filter( @@ -1271,8 +1278,6 @@

Source: utils.js

).join( " >> " ) - ).join( - "\n" ); }; @@ -1311,13 +1316,13 @@

Source: utils.js


- Documentation generated by JSDoc 4.0.2 on Fri Sep 08 2023 16:28:57 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 4.0.2 on Fri Sep 08 2023 16:38:49 GMT+0000 (Coordinated Universal Time)
diff --git a/docs/html/zeroex.js.html b/docs/html/zeroex.js.html index 25639eef..b88966be 100644 --- a/docs/html/zeroex.js.html +++ b/docs/html/zeroex.js.html @@ -661,13 +661,13 @@

Source: zeroex.js


- Documentation generated by JSDoc 4.0.2 on Fri Sep 08 2023 16:28:57 GMT+0000 (Coordinated Universal Time) + Documentation generated by JSDoc 4.0.2 on Fri Sep 08 2023 16:38:49 GMT+0000 (Coordinated Universal Time)
diff --git a/src/router.js b/src/router.js index ea077d97..1c83e6ed 100644 --- a/src/router.js +++ b/src/router.js @@ -299,11 +299,15 @@ const routerClear = async( // ); // if (route.status == "NoWay") throw "could not find any route for this token pair"; console.log(">>> Route portions: ", "\n"); - console.log( - "\x1b[36m%s\x1b[0m", - visualizeRoute(fromToken.address, toToken.address, route.legs), - "\n" + visualizeRoute(fromToken.address, toToken.address, route.legs).forEach( + v => console.log("\x1b[36m%s\x1b[0m", v) ); + console.log("\n"); + // console.log( + // "\x1b[36m%s\x1b[0m", + // visualizeRoute(fromToken.address, toToken.address, route.legs), + // "\n" + // ); const rpParams = Router.routeProcessor2Params( pcMap, diff --git a/src/srouter.js b/src/srouter.js index 72141182..bbb9903f 100644 --- a/src/srouter.js +++ b/src/srouter.js @@ -241,11 +241,14 @@ const srouterClear = async( const price = rateFixed.mul("1" + "0".repeat(18)).div(maximumInputFixed); console.log(`Current best route price for this token pair: ${ethers.utils.formatEther(price)}`, "\n"); console.log(">>> Route portions: ", "\n"); - console.log( - "\x1b[36m%s\x1b[0m", - visualizeRoute(fromToken.address, toToken.address, route.legs), - "\n" + visualizeRoute(fromToken.address, toToken.address, route.legs).forEach( + v => console.log("\x1b[36m%s\x1b[0m", v) ); + console.log("\n"); + // console.log( + // "\x1b[36m%s\x1b[0m", + // "\n" + // ); const rpParams = Router.routeProcessor2Params( pcMap, diff --git a/src/utils.js b/src/utils.js index cc48dab9..d128617c 100644 --- a/src/utils.js +++ b/src/utils.js @@ -1211,6 +1211,13 @@ const getRouteForTokens = async( } }; +/** + * Method to visualize the routes, returns array of route strings sorted from highest to lowest percentage + * + * @param {string} fromToken - The from token address + * @param {string} toToken - The to token address + * @param {any[]} legs - The legs of the route + */ const visualizeRoute = (fromToken, toToken, legs) => { return [ ...legs.filter( @@ -1243,8 +1250,6 @@ const visualizeRoute = (fromToken, toToken, legs) => { ).join( " >> " ) - ).join( - "\n" ); };