order placement doesnt crash

This commit is contained in:
Tim Olson
2023-10-14 22:06:43 -04:00
parent b699d76073
commit dc23ecdd20
7 changed files with 52 additions and 20 deletions

View File

@@ -159,7 +159,7 @@ async function findRoute() {
}
catch (e) {
routes.value = []
// console.log('routes exception', e)
console.log('routes exception', e)
return
}
// todo expose all available pools
@@ -178,6 +178,7 @@ async function findRoute() {
}
}
routes.value = [result]
console.log('found route', result)
}
const routeFinder = new SingletonCoroutine(findRoute,10)
@@ -245,7 +246,7 @@ async function placeOrder() {
const route = routes.value[0];
const amountToken = amountIsTokenA ? ta : tb
const amt = FixedNumber.fromString(amount.value.toString(), {decimals: amountToken.decimals}).value
const amountIsInput = !buy.value ^ amountIsTokenA.value
const amountIsInput = amountIsTokenA.value === buy.value
// build tranches
const n = tranches.value // num tranches