From aac3a6ff90e63f041223be4a027d29ef2f0cc698 Mon Sep 17 00:00:00 2001 From: Crypto Minion <154598612+jrwbabylonlab@users.noreply.github.com> Date: Thu, 3 Oct 2024 23:57:08 +1000 Subject: [PATCH] fix: disable the staking form when reached height cap (#195) * fix: disable the staking form when reached height cap --- package-lock.json | 4 ++-- package.json | 2 +- src/app/components/Staking/Staking.tsx | 6 ++---- src/app/components/Stats/Stats.tsx | 4 ++-- 4 files changed, 7 insertions(+), 9 deletions(-) diff --git a/package-lock.json b/package-lock.json index b92b1e8a..afb67f82 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "simple-staking", - "version": "0.3.3", + "version": "0.3.4", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "simple-staking", - "version": "0.3.3", + "version": "0.3.4", "dependencies": { "@babylonlabs-io/btc-staking-ts": "0.3.0", "@bitcoin-js/tiny-secp256k1-asmjs": "2.2.3", diff --git a/package.json b/package.json index 61111947..f744a64e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "simple-staking", - "version": "0.3.3", + "version": "0.3.4", "private": true, "scripts": { "dev": "next dev", diff --git a/src/app/components/Staking/Staking.tsx b/src/app/components/Staking/Staking.tsx index 4e8ac76c..16629d66 100644 --- a/src/app/components/Staking/Staking.tsx +++ b/src/app/components/Staking/Staking.tsx @@ -153,14 +153,12 @@ export const Staking: React.FC = ({ return; } const nextBlockHeight = btcHeight + 1; - const { stakingCapHeight, stakingCapSat, confirmationDepth } = - paramWithCtx.currentVersion; + const { stakingCapHeight, stakingCapSat } = paramWithCtx.currentVersion; // Use height based cap than value based cap if it is set if (stakingCapHeight) { setOverflow({ isHeightCap: true, - overTheCapRange: - nextBlockHeight >= stakingCapHeight + confirmationDepth, + overTheCapRange: nextBlockHeight > stakingCapHeight, /* When btc height is approching the staking cap height, there is higher chance of overflow due to tx not being included in the next few blocks on time diff --git a/src/app/components/Stats/Stats.tsx b/src/app/components/Stats/Stats.tsx index 07183386..c6bb5ee7 100644 --- a/src/app/components/Stats/Stats.tsx +++ b/src/app/components/Stats/Stats.tsx @@ -56,9 +56,9 @@ const buildStakingCapSection = ( if (isApprochingNextVersion && nextVersion) { return buildNextCapText(coinName, btcHeight, nextVersion); } - const { stakingCapHeight, stakingCapSat, confirmationDepth } = currentVersion; + const { stakingCapHeight, stakingCapSat } = currentVersion; if (stakingCapHeight) { - const numOfBlockLeft = stakingCapHeight + confirmationDepth - btcHeight - 1; + const numOfBlockLeft = stakingCapHeight - btcHeight; return { title: "Staking Window", value: