How to get the results "_pathsArr (including the mid id), bestPath and amounts_out" in console.log?
Basically i need the arrPaths including their id and the amount_out of each.
Also i need to know where to input manually the amount_in for temporary tests.
Thanks.
This is my code:
import { toFixed, accDiv } from './public';
// import Worker from './worker'
// import VueWorker from 'vue-worker'
class swapRouter {
constructor() {
this.markets = [];
this.pair_market_map = {};
this.mid_market_map = {};
this.tokens = [];
this.paths = [];
this.isInit = false;
this._pathsArr = [];
this.bestPath = '';
}
init(data, vThis) {
this.markets = data || [];
this._pathsArr = [];
this.bestPath = '';
if (this.paths.length) {
return
}
if (window.Worker) {
this.workerToInitPath(vThis)
} else {
this.initPath()
}
}
workerToInitPath(vThis) {
HERE GOES THE CODE THAT FINDS THE PATHS AND AMOUNTS_OUT
}
const d = [{ here are the data correctly organized }
const swapRouter1 = new swapRouter()
swapRouter1.init(d)
console.log(swapRouter1);
Is this correctly declared?
this.bestPath = '';
Or must be:
this.bestPath = [];
Because get only markets, tokens and paths in the result (console.log), but don't get_pathsArr and bestPath.
I also need that the path results includes the "mid" (the id number).