Asset view touchup; withdrawal of zero disallowed
This commit is contained in:
@@ -39,7 +39,7 @@
|
|||||||
:on-withdraw="onWithdrawNative" :on-wrap="()=>wrapShow=true"/>
|
:on-withdraw="onWithdrawNative" :on-wrap="()=>wrapShow=true"/>
|
||||||
</suspense>
|
</suspense>
|
||||||
<suspense v-for="(amount,addr) of balances">
|
<suspense v-for="(amount,addr) of balances">
|
||||||
<token-row :chain-id="s.chainId" :addr="addr" :amount="amount" :onWithdraw="onWithdraw"/>
|
<token-row v-if="BigInt(amount)!==0n" :chain-id="s.chainId" :addr="addr" :amount="amount" :onWithdraw="onWithdraw"/>
|
||||||
</suspense>
|
</suspense>
|
||||||
</tbody>
|
</tbody>
|
||||||
</v-table>
|
</v-table>
|
||||||
@@ -83,7 +83,7 @@ const balances = computed(()=>{
|
|||||||
const empty = computed(()=>{
|
const empty = computed(()=>{
|
||||||
if(nativeBalance.value!==0n) return false
|
if(nativeBalance.value!==0n) return false
|
||||||
for( const v of Object.values(balances.value) )
|
for( const v of Object.values(balances.value) )
|
||||||
if(v!==0n)
|
if(BigInt(v)!==0n)
|
||||||
return false
|
return false
|
||||||
return true
|
return true
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ const props = defineProps(['modelValue', 'vault', 'token'])
|
|||||||
const emit = defineEmits(['update:modelValue'])
|
const emit = defineEmits(['update:modelValue'])
|
||||||
const balance = computed(() => {
|
const balance = computed(() => {
|
||||||
console.log('balance', props.vault, props.token, s.vaultBalances)
|
console.log('balance', props.vault, props.token, s.vaultBalances)
|
||||||
return s.vaultBalances[props.vault][props.token.address] || 0
|
return BigInt(s.vaultBalances[props.vault][props.token.address]) || 0n
|
||||||
})
|
})
|
||||||
const balanceFloat = computed(() => tokenFloat(props.token, balance.value))
|
const balanceFloat = computed(() => tokenFloat(props.token, balance.value))
|
||||||
const floatAmount = ref(0)
|
const floatAmount = ref(0)
|
||||||
@@ -46,9 +46,9 @@ function withdraw() {
|
|||||||
const valueStr = floatAmount.value.toString();
|
const valueStr = floatAmount.value.toString();
|
||||||
const amount = floatAmount.value === balanceFloat.value ? balance.value :
|
const amount = floatAmount.value === balanceFloat.value ? balance.value :
|
||||||
FixedNumber.fromString(valueStr,{decimals:props.token.d, width:256, signed: false}).value;
|
FixedNumber.fromString(valueStr,{decimals:props.token.d, width:256, signed: false}).value;
|
||||||
console.log('pending withdrawal', valueStr, amount, props.token.s)
|
|
||||||
if( amount === 0n )
|
if( amount === 0n )
|
||||||
return
|
return
|
||||||
|
console.log('pending withdrawal', valueStr, amount, props.token.s)
|
||||||
pendTransaction(async (signer)=>{
|
pendTransaction(async (signer)=>{
|
||||||
const vault = await vaultContract(vaultAddr, signer)
|
const vault = await vaultContract(vaultAddr, signer)
|
||||||
return await vault['withdraw(address,uint256)'](props.token.a, amount)
|
return await vault['withdraw(address,uint256)'](props.token.a, amount)
|
||||||
|
|||||||
Reference in New Issue
Block a user