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