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

@@ -1,15 +1,19 @@
<template>
<!-- <v-card v-if="!s.account" prepend-icon="mdi-connection" title="Connect Wallet"-->
<!-- text="Please connect your wallet to an Arbitrum account.">-->
<!-- <v-card-actions><v-btn text="Connect Wallet" color="green" variant="elevated" @click="connectWallet" prepend-icon="mdi-power"/></v-card-actions>-->
<!-- </v-card>-->
<slot v-if="s.helper"/>
<v-card v-if="!s.helper" prepend-icon='mdi-reload-alert' title="Change Blockchain" text="Dexorder works only with Arbitrum. Please choose the Arbitrum blockchain in your wallet."/>
<v-card v-if="!s.helper" prepend-icon='mdi-reload-alert' title="Change Blockchain"
text="Dexorder works only with Arbitrum. Please choose the Arbitrum blockchain in your wallet."/>
</template>
<script setup>
import {useStore} from "@/store/store";
import {connectWallet} from "@/blockchain/wallet.js";
const s = useStore()
async function connect() {
}
</script>
<style scoped lang="scss">

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