diff --git a/src/components/modals/StakeCAP.svelte b/src/components/modals/StakeCAP.svelte index 2e4bf18..120ab02 100644 --- a/src/components/modals/StakeCAP.svelte +++ b/src/components/modals/StakeCAP.svelte @@ -13,7 +13,9 @@ import { focusInput, hideModal } from '@lib/ui' import LabelValue from '../layout/LabelValue.svelte' - let amount, isSubmitting, walletBalance = "0.0"; + const CAP_STAKING_SPENDER = 'Staking'; + + let amount, isSubmitting, isApproving, isCheckingAllowance = true, walletBalance = "0.0"; $: formattedWalletBalance = formatCAPForDisplay(walletBalance); @@ -31,11 +33,21 @@ } async function checkAllowance() { - await getAllowance('CAP', 'FundStore'); + isCheckingAllowance = true; + try { + await getAllowance('CAP', CAP_STAKING_SPENDER); + } finally { + isCheckingAllowance = false; + } } async function _approveAsset() { - const result = await approveAsset('CAP', 'FundStore'); + isApproving = true; + try { + await approveAsset('CAP', CAP_STAKING_SPENDER); + } finally { + isApproving = false; + } } async function getBalance() { @@ -74,8 +86,10 @@
- {#if $allowances['CAP']?.['FundStore'] * 1 <= amount * 1} -