order validity checks
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user