Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions src/components/modals/StakeCAP.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import { focusInput, hideModal } from '@lib/ui'
import LabelValue from '../layout/LabelValue.svelte'

let amount, isSubmitting, walletBalance = "0.0";
let amount, isSubmitting, isApproving, walletBalance = "0.0";

$: formattedWalletBalance = formatCAPForDisplay(walletBalance);

Expand All @@ -35,7 +35,12 @@
}

async function _approveAsset() {
const result = await approveAsset('CAP', 'FundStore');
isApproving = true;
try {
await approveAsset('CAP', 'FundStore');
} finally {
isApproving = false;
}
}

async function getBalance() {
Expand Down Expand Up @@ -75,7 +80,7 @@

<div>
{#if $allowances['CAP']?.['FundStore'] * 1 <= amount * 1}
<Button noSubmit={true} label={`Approve CAP`} on:click={_approveAsset} />
<Button noSubmit={true} isLoading={isApproving} label={`Approve CAP`} on:click={_approveAsset} />
{:else}
<Button isLoading={isSubmitting} label={`Stake`} />
{/if}
Expand Down