From 0632a17021d86fb53d997524cbc5f18e20137b29 Mon Sep 17 00:00:00 2001 From: Govard Barkhatov Date: Mon, 12 Aug 2024 21:08:51 +0200 Subject: [PATCH 1/3] fix: Refetch UTXOs on unsuccessful staking (#64) * no cancel * proper noCancel pass * partly reset --- .github/workflows/ci.yml | 4 ++-- .github/workflows/publish.yaml | 8 ++++---- src/app/components/Modals/ErrorModal.tsx | 18 +++++++++++------- src/app/components/Staking/Staking.tsx | 11 ++++++++++- src/app/context/Error/ErrorContext.tsx | 18 +++++++++++++----- src/app/page.tsx | 11 +++++++++-- src/app/types/errors.ts | 1 + 7 files changed, 50 insertions(+), 21 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7083d434..b3976930 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,11 +3,11 @@ name: ci on: pull_request: branches: - - '**' + - "**" jobs: lint_test: uses: babylonlabs-io/.github/.github/workflows/reusable_node_lint_test.yml@v0.3.0 with: run-build: true - run-unit-tests: true \ No newline at end of file + run-unit-tests: true diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index 96ed64c2..2c9f4030 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -3,10 +3,10 @@ name: docker_publish on: push: branches: - - 'main' - - 'dev' + - "main" + - "dev" tags: - - '*' + - "*" jobs: lint_test: @@ -14,7 +14,7 @@ jobs: with: run-build: true run-unit-tests: true - + docker_build: needs: [lint_test] runs-on: ubuntu-22.04 diff --git a/src/app/components/Modals/ErrorModal.tsx b/src/app/components/Modals/ErrorModal.tsx index 54660034..20331e28 100644 --- a/src/app/components/Modals/ErrorModal.tsx +++ b/src/app/components/Modals/ErrorModal.tsx @@ -12,6 +12,7 @@ interface ErrorModalProps { errorMessage: string; errorState?: ErrorState; errorTime: Date; + noCancel?: boolean; } export const ErrorModal: React.FC = ({ @@ -20,7 +21,8 @@ export const ErrorModal: React.FC = ({ onRetry, errorMessage, errorState, - errorTime, + noCancel, + // errorTime, // This prop is not used in the component }) => { const { error, retryErrorAction } = useError(); @@ -93,12 +95,14 @@ export const ErrorModal: React.FC = ({

{getErrorMessage()}

- + {!noCancel && ( // Only show the cancel button if noCancel is false or undefined + + )} {onRetry && (
)} -
-

- {maxDecimals(satoshiToBtc(stakingValueSat), 8)} {coinName} +

+
+ +

+ {maxDecimals(satoshiToBtc(stakingValueSat), 8)} {coinName} +

+
+

+ {durationTillNow(startTimestamp, currentTime)}

-

{durationTillNow(startTimestamp, currentTime)}

-
+ + {/* Future data placeholder */} +
{/* we need to center the text without the tooltip add its size 12px and gap 4px, 16/2 = 8px */} -
+

{renderState()}

= ({
- {generateActionButton()} +
{generateActionButton()}
); From 3b571bbc30b0b1385b9e62e04073092ce8c683a2 Mon Sep 17 00:00:00 2001 From: Crypto Minion <154598612+jrwbabylonlab@users.noreply.github.com> Date: Tue, 13 Aug 2024 11:49:43 +1000 Subject: [PATCH 3/3] fix: issue with fee UI react rendering loop (#66) * fix: issue with fee UI infinite react rendering loop --- package-lock.json | 4 ++-- package.json | 2 +- .../components/Staking/Form/StakingFee.tsx | 24 +++++++++---------- src/app/components/Staking/Staking.tsx | 1 + src/utils/isStakingSignReady.ts | 8 +++++++ tests/utils/isStakingSignReady.test.ts | 12 ++++++++-- 6 files changed, 33 insertions(+), 18 deletions(-) diff --git a/package-lock.json b/package-lock.json index e5027773..e3228569 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "simple-staking", - "version": "0.2.31", + "version": "0.2.32", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "simple-staking", - "version": "0.2.31", + "version": "0.2.32", "dependencies": { "@bitcoinerlab/secp256k1": "^1.1.1", "@keystonehq/animated-qr": "^0.8.6", diff --git a/package.json b/package.json index b9087f41..1657ae19 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "simple-staking", - "version": "0.2.31", + "version": "0.2.32", "private": true, "scripts": { "dev": "next dev", diff --git a/src/app/components/Staking/Form/StakingFee.tsx b/src/app/components/Staking/Form/StakingFee.tsx index d2da2131..b43d0720 100644 --- a/src/app/components/Staking/Form/StakingFee.tsx +++ b/src/app/components/Staking/Form/StakingFee.tsx @@ -51,22 +51,20 @@ export const StakingFee: React.FC = ({
{mempoolFeeRates ? ( -

- Recommended fee rate: {defaultFeeRate} sats/vB -

+
+

+ Recommended fee rate: {defaultFeeRate} sats/vB +

+

+ Transaction fee amount:{" "} + + {satoshiToBtc(stakingFeeSat)} {coinName} + +

+
) : ( )} - {stakingFeeSat ? ( -

- Transaction fee amount:{" "} - - {satoshiToBtc(stakingFeeSat)} {coinName} - -

- ) : ( - - )}