wrap fix
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
</v-card-title>
|
||||
<v-card-item>
|
||||
<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>
|
||||
<v-btn variant="text" text="max" @click="floatAmount=balanceFloat"/>
|
||||
</template>
|
||||
@@ -34,12 +34,13 @@ const s = useStore()
|
||||
const props = defineProps(['modelValue', 'vault', 'maxAmount'])
|
||||
const emit = defineEmits(['update:modelValue'])
|
||||
const balanceFloat = computed(() => Number(props.maxAmount)/1e18) // todo configurable native decimals
|
||||
const step = computed(()=>balanceFloat.value/20)
|
||||
const floatAmount = ref(0)
|
||||
|
||||
function wrapNative() {
|
||||
const vaultAddr = props.vault
|
||||
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;
|
||||
if( amount === 0n )
|
||||
return
|
||||
|
||||
@@ -118,6 +118,8 @@ async function updateNativeBalance() {
|
||||
console.log('native balance', vault, balance)
|
||||
if (s.vault===vault) // could have changed during async
|
||||
nativeBalance.value = balance
|
||||
else
|
||||
console.warn('vault changed during balance update', vault, s.vault)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user