From 756f128b1b94fbf2b48fbce847da9204129ac5c2 Mon Sep 17 00:00:00 2001 From: Jeremy <168515712+jeremy-babylonlabs@users.noreply.github.com> Date: Wed, 16 Oct 2024 18:50:10 +1100 Subject: [PATCH] Sync from main to dev (#227) * use correct height for unbonding model (#196) * fix: improvement on using the correct height for unbonding model --------- Co-authored-by: wjrjerome * feat: enable another wallet on mainnet (#200) * fix na inconsistent display (#205) * fix small points amount display (#206) * fix: skip ordinals for cactus (#208) * fix: skip ordinals for cactus --------- Co-authored-by: Filippos Malandrakis * fix: mempool endpoints errors should provide better UX (#165) * fix: mempool endpoints errors should provide better UX * fix: remove delegation from local storage only when error status is 404 * fix: delegations tests (#170) * feat: move wallet provider logic in react context (#178) * feat: refactor global params (#182) * feat: refactor global params * fix: version info data for loading state * fix: small review issues * fix: review issues * feat: added new api hooks and global states (#197) * feat: added new api hooks and global states * fix: review issues * fix: add new eslint rule for booleans * fix: FAQ test * fix: review feedback * use correct height for unbonding model (#196) (#202) * use correct height for unbonding model (#196) * fix: improvement on using the correct height for unbonding model --------- Co-authored-by: wjrjerome * fix format --------- Co-authored-by: wjrjerome * linting error * resolve comments --------- Co-authored-by: wjrjerome Co-authored-by: Crypto Minion <154598612+jrwbabylonlab@users.noreply.github.com> Co-authored-by: Filippos Malandrakis Co-authored-by: David Totrashvili --- package-lock.json | 4 +- package.json | 2 +- .../components/Points/DelegationPoints.tsx | 14 ++----- src/app/components/Points/Points.tsx | 37 +++++++++++++++++++ src/app/components/Points/StakerPoints.tsx | 14 ++----- src/utils/wallet/list.ts | 2 +- .../wallet/providers/cactuslink_wallet.ts | 3 +- 7 files changed, 49 insertions(+), 27 deletions(-) create mode 100644 src/app/components/Points/Points.tsx diff --git a/package-lock.json b/package-lock.json index 07380f44..689ccf89 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "simple-staking", - "version": "0.3.5", + "version": "0.3.9", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "simple-staking", - "version": "0.3.5", + "version": "0.3.9", "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 e3daf24b..062d1ad3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "simple-staking", - "version": "0.3.5", + "version": "0.3.9", "private": true, "scripts": { "dev": "next dev", diff --git a/src/app/components/Points/DelegationPoints.tsx b/src/app/components/Points/DelegationPoints.tsx index 43c7b78c..dfe9b3d6 100644 --- a/src/app/components/Points/DelegationPoints.tsx +++ b/src/app/components/Points/DelegationPoints.tsx @@ -1,10 +1,11 @@ import React from "react"; -import { NumericFormat } from "react-number-format"; import { useDelegationsPoints } from "@/app/context/api/DelegationsPointsProvider"; import { useHealthCheck } from "@/app/hooks/useHealthCheck"; import { shouldDisplayPoints } from "@/config"; +import { Points } from "./Points"; + interface DelegationPointsProps { stakingTxHash: string; className?: string; @@ -37,16 +38,7 @@ export const DelegationPoints: React.FC = ({

Points: - {points !== undefined ? ( - - ) : ( - "n.a." - )} +

diff --git a/src/app/components/Points/Points.tsx b/src/app/components/Points/Points.tsx new file mode 100644 index 00000000..815cb2a8 --- /dev/null +++ b/src/app/components/Points/Points.tsx @@ -0,0 +1,37 @@ +import React from "react"; +import { NumericFormat } from "react-number-format"; +import { Tooltip } from "react-tooltip"; + +interface PointsProps { + points: number | undefined; +} + +export const Points: React.FC = ({ points }) => { + if (points === undefined || points === 0) { + return <>n.a.; + } + + if (points < 0.001 && points > 0) { + return ( + <> + + <0.001 + + + + ); + } + + return ( + + ); +}; diff --git a/src/app/components/Points/StakerPoints.tsx b/src/app/components/Points/StakerPoints.tsx index 6af6007e..b3ab859a 100644 --- a/src/app/components/Points/StakerPoints.tsx +++ b/src/app/components/Points/StakerPoints.tsx @@ -1,9 +1,10 @@ import { useQuery } from "@tanstack/react-query"; import React from "react"; -import { NumericFormat } from "react-number-format"; import { getStakersPoints } from "@/app/api/getPoints"; +import { Points } from "./Points"; + interface StakerPointsProps { publicKeyNoCoord: string; } @@ -33,16 +34,7 @@ export const StakerPoints: React.FC = ({ return (

- {points !== undefined ? ( - - ) : ( - "n.a." - )} +

); diff --git a/src/utils/wallet/list.ts b/src/utils/wallet/list.ts index a1ee7e1d..7db9eb66 100644 --- a/src/utils/wallet/list.ts +++ b/src/utils/wallet/list.ts @@ -68,7 +68,7 @@ export const walletList: IntegratedWallet[] = [ provider: cactusLinkProvider, linkToDocs: "https://chromewebstore.google.com/detail/cactus-link/chiilpgkfmcopocdffapngjcbggdehmj?pli=1", - supportedNetworks: [Network.SIGNET], + supportedNetworks: [Network.MAINNET, Network.SIGNET], }, { name: "Keystone", diff --git a/src/utils/wallet/providers/cactuslink_wallet.ts b/src/utils/wallet/providers/cactuslink_wallet.ts index c2d3f835..5842ddb8 100644 --- a/src/utils/wallet/providers/cactuslink_wallet.ts +++ b/src/utils/wallet/providers/cactuslink_wallet.ts @@ -169,6 +169,7 @@ export class CactusLinkWallet extends WalletProvider { }; getInscriptions(): Promise { - throw new Error("Method not implemented."); + // Temporary solution to ignore inscriptions filtering for Cactus Link Wallet + return Promise.resolve([]); } }