static version.json file

This commit is contained in:
Tim Olson
2024-01-03 16:07:10 -04:00
parent 29517807f5
commit 80cd86dcec
8 changed files with 39 additions and 29 deletions

View File

@@ -1,9 +1,12 @@
<template>
<v-text-field label='Amount' type="number" step="1" variant="outlined" aria-valuemin="0" min="0"
v-model="os.amount" :rules="[validateRequired,validateAmount]" v-auto-select>
<template v-slot:prepend-inner>
<v-btn @click="os.amount = maxAmount">max {{maxAmount.toPrecision(5)}}</v-btn>
</template>
<template v-slot:append-inner>
<v-btn @click="os.amountIsTokenA=!os.amountIsTokenA" variant="outlined" class="mr-2">
{{ os.amountIsTokenA ? os.tokenA.symbol : os.tokenB.symbol }}
{{ amountToken.symbol }}
</v-btn>
<v-btn :text="os.amountIsTotal ? 'total' : 'per tranche'" variant="outlined"
@click="os.amountIsTotal=!os.amountIsTotal" class="total"/>
@@ -12,13 +15,24 @@
</template>
<script setup>
import {useOrderStore} from "@/store/store";
import {useOrderStore, useStore} from "@/store/store";
// noinspection ES6UnusedImports
import {vAutoSelect} from "@/misc.js";
import {validateAmount, validateRequired} from "@/validate.js";
import {computed} from "vue";
const s = useStore()
const os = useOrderStore()
const amountToken = computed( ()=>os.amountIsTokenA ? os.tokenA.symbol : os.tokenB.symbol )
const inToken = computed( ()=>os.buy ? os.tokenB : os.tokenA )
const maxAmount = computed(()=>{
const balance = s.balances[inToken]
if( !balance )
return 0
const divisor = os.amountIsTotal ? 1 : os.tranches
return balance / 10**inToken.value.decimals / divisor
})
</script>