static version.json file
This commit is contained in:
@@ -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>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user