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

@@ -29,17 +29,18 @@ const Order = {
export const orderFuncs = {}
// the key is order.builder.id and the value is a function() that returns an array of tranches
// if null is returned, the builder inputs are not valid and the place order button will be disabled
export const builderFuncs = {}
function newDefaultOrder() {
return { id:uuid(), amount:1, amountIsTokenA: true, buy: true, builders:[] }
return { id:uuid(), valid: false, amount:null, amountIsTokenA: true, buy: true, builders:[] }
}
export const useChartOrderStore = defineStore('chart_orders', () => {
const chartReady = ref(false)
const orders = ref([newDefaultOrder()]) // order models in UI format
const built = ref([{}]) // orders in blockchain format, ready to send
const defaultOrder = newDefaultOrder()
const orders = ref([defaultOrder]) // order models in UI format
const selectedOrder = ref(null)
const selectedSymbol = ref(null)
const selectedPool = ref(null)