From 64e1ec616caa2d63df23cbfd7f2095d4963001db Mon Sep 17 00:00:00 2001 From: qingfeng312 <86755530+qingfeng312@users.noreply.github.com> Date: Sun, 7 Jun 2026 12:15:23 +0800 Subject: [PATCH 1/2] Fix Stake CAP approval spender and loading state --- src/components/modals/StakeCAP.svelte | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/src/components/modals/StakeCAP.svelte b/src/components/modals/StakeCAP.svelte index 2e4bf18..2859c64 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 @@