From 41711b1cd98ede8ffd7b1162460711e7e38256f8 Mon Sep 17 00:00:00 2001 From: wjrjerome Date: Thu, 3 Oct 2024 12:27:10 +1000 Subject: [PATCH 1/3] fix: disable the staking form when reached height cap --- src/app/components/Staking/Staking.tsx | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/app/components/Staking/Staking.tsx b/src/app/components/Staking/Staking.tsx index 4e8ac76c..3a1d3de8 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 From 566347b37b1afac3040b08e432eb6d9462a39619 Mon Sep 17 00:00:00 2001 From: wjrjerome Date: Thu, 3 Oct 2024 23:33:07 +1000 Subject: [PATCH 2/3] the stakingCapHeight is inclusive --- package-lock.json | 4 ++-- package.json | 2 +- src/app/components/Staking/Staking.tsx | 2 +- 3 files changed, 4 insertions(+), 4 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 3a1d3de8..16629d66 100644 --- a/src/app/components/Staking/Staking.tsx +++ b/src/app/components/Staking/Staking.tsx @@ -158,7 +158,7 @@ export const Staking: React.FC = ({ if (stakingCapHeight) { setOverflow({ isHeightCap: true, - overTheCapRange: nextBlockHeight >= stakingCapHeight, + 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 From 3ee23001c0247a054936839bdaa0142f9d29324c Mon Sep 17 00:00:00 2001 From: wjrjerome Date: Thu, 3 Oct 2024 23:54:24 +1000 Subject: [PATCH 3/3] fix: should show correct staking window countdown --- src/app/components/Stats/Stats.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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: