order validity checks

This commit is contained in:
Tim
2024-04-12 13:30:49 -04:00
parent a5accb7049
commit fe1b633c4a
6 changed files with 59 additions and 17 deletions

View File

@@ -43,7 +43,7 @@
import BuilderFactory from "@/components/chart/BuilderFactory.vue";
import {builderFuncs, newBuilder, orderFuncs, useChartOrderStore} from "@/orderbuild.js";
import {useOrderStore} from "@/store/store.js";
import {computed, onMounted, onUnmounted, onUpdated, watch} from "vue";
import {computed, onMounted, onUnmounted, onUpdated, watch, watchEffect} from "vue";
import {lightenColor, lightenColor2} from "@/misc.js";
import {useTheme} from "vuetify";
import RowBar from "@/components/chart/RowBar.vue";
@@ -66,9 +66,27 @@ function build(order, component, options={}) {
}
// check order validity
watchEffect(()=>{
let valid = props.order.amount
if (valid) {
for (const builder of builders.value) {
if (!builder.valid) {
valid = false
break
}
}
}
props.order.valid = valid
})
function buildOrder() {
const order = props.order
console.log('buildOrder', order)
if (!order.amount) return null
// struct SwapOrder {
// address tokenIn;
// address tokenOut;