diff --git a/src/api/assets.js b/src/api/assets.js index 6df529d..7629d67 100644 --- a/src/api/assets.js +++ b/src/api/assets.js @@ -71,6 +71,10 @@ export async function approveAsset(assetLabel, spenderName) { return true; } } catch(e) { + if (e && e.code === 'ACTION_REJECTED' || e && e.code === 4001) { + // User rejected the wallet confirmation — not an error + return false; + } showError(e); } } \ No newline at end of file diff --git a/src/components/modals/EditMargin.svelte b/src/components/modals/EditMargin.svelte index bca6bf5..1d89fbb 100644 --- a/src/components/modals/EditMargin.svelte +++ b/src/components/modals/EditMargin.svelte @@ -52,7 +52,8 @@ }, 50); } - let funding = data.funding || 0; + let funding = data.funding || 0; + let currentLiqPrice = data.position.liqprice; let newLiqPrice = data.position.liqprice; let newMargin = 0; function calculateNewLiquidationPrice(marginDelta, mode) { @@ -151,6 +152,10 @@ +
+ +
+
diff --git a/src/components/modals/StakeCAP.svelte b/src/components/modals/StakeCAP.svelte index 2e4bf18..a823a6e 100644 --- a/src/components/modals/StakeCAP.svelte +++ b/src/components/modals/StakeCAP.svelte @@ -14,6 +14,7 @@ import LabelValue from '../layout/LabelValue.svelte' let amount, isSubmitting, walletBalance = "0.0"; + let isApproving = false; $: formattedWalletBalance = formatCAPForDisplay(walletBalance); @@ -35,7 +36,9 @@ } async function _approveAsset() { + isApproving = true; const result = await approveAsset('CAP', 'FundStore'); + isApproving = false; } async function getBalance() { @@ -75,7 +78,7 @@
{#if $allowances['CAP']?.['FundStore'] * 1 <= amount * 1} -