From 9750b28eb583e3798b79f23f2a564ecffa2e9823 Mon Sep 17 00:00:00 2001
From: rebel117 <>
Date: Fri, 15 May 2026 22:04:33 +0800
Subject: [PATCH 1/2] Show current and new liquidation price in edit margin
modal
Display the current liquidation price alongside the new calculated
price when adding or removing margin, so users can see the impact
of their margin adjustment at a glance.
---
src/components/modals/EditMargin.svelte | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
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 @@
+
+
+
+
From d730d5ede3aa296a99907c3a60ef1a76b81476c8 Mon Sep 17 00:00:00 2001
From: rebel117 <>
Date: Fri, 15 May 2026 22:11:55 +0800
Subject: [PATCH 2/2] Fix premature error display when approving CAP for
staking
- Add loading state to Approve button in StakeCAP modal
- Prevent showing error when user hasn't yet confirmed in wallet
- Handle wallet rejection (code 4001/ACTION_REJECTED) gracefully
- Return false on rejection instead of showing error modal
---
src/api/assets.js | 4 ++++
src/components/modals/StakeCAP.svelte | 5 ++++-
2 files changed, 8 insertions(+), 1 deletion(-)
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/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 @@