wrap fix
This commit is contained in:
@@ -6,7 +6,7 @@
|
|||||||
</v-card-title>
|
</v-card-title>
|
||||||
<v-card-item>
|
<v-card-item>
|
||||||
<v-text-field class="text-end" type="number" variant="outlined" :min="0" :max="balanceFloat"
|
<v-text-field class="text-end" type="number" variant="outlined" :min="0" :max="balanceFloat"
|
||||||
v-model="floatAmount" :step="balanceFloat/10">
|
v-model="floatAmount" :step="step">
|
||||||
<template v-slot:prepend-inner>
|
<template v-slot:prepend-inner>
|
||||||
<v-btn variant="text" text="max" @click="floatAmount=balanceFloat"/>
|
<v-btn variant="text" text="max" @click="floatAmount=balanceFloat"/>
|
||||||
</template>
|
</template>
|
||||||
@@ -34,12 +34,13 @@ const s = useStore()
|
|||||||
const props = defineProps(['modelValue', 'vault', 'maxAmount'])
|
const props = defineProps(['modelValue', 'vault', 'maxAmount'])
|
||||||
const emit = defineEmits(['update:modelValue'])
|
const emit = defineEmits(['update:modelValue'])
|
||||||
const balanceFloat = computed(() => Number(props.maxAmount)/1e18) // todo configurable native decimals
|
const balanceFloat = computed(() => Number(props.maxAmount)/1e18) // todo configurable native decimals
|
||||||
|
const step = computed(()=>balanceFloat.value/20)
|
||||||
const floatAmount = ref(0)
|
const floatAmount = ref(0)
|
||||||
|
|
||||||
function wrapNative() {
|
function wrapNative() {
|
||||||
const vaultAddr = props.vault
|
const vaultAddr = props.vault
|
||||||
const valueStr = floatAmount.value.toString();
|
const valueStr = floatAmount.value.toString();
|
||||||
const amount = floatAmount.value === balanceFloat.value ? s.nativeBalance : // maximum
|
const amount = floatAmount.value === balanceFloat.value ? props.maxAmount : // maximum
|
||||||
FixedNumber.fromString(valueStr,{decimals:18, width:256, signed: false}).value;
|
FixedNumber.fromString(valueStr,{decimals:18, width:256, signed: false}).value;
|
||||||
if( amount === 0n )
|
if( amount === 0n )
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -118,6 +118,8 @@ async function updateNativeBalance() {
|
|||||||
console.log('native balance', vault, balance)
|
console.log('native balance', vault, balance)
|
||||||
if (s.vault===vault) // could have changed during async
|
if (s.vault===vault) // could have changed during async
|
||||||
nativeBalance.value = balance
|
nativeBalance.value = balance
|
||||||
|
else
|
||||||
|
console.warn('vault changed during balance update', vault, s.vault)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user