diff --git a/packages/next-common/components/staking/overview/accountNomination/index.jsx b/packages/next-common/components/staking/overview/accountNomination/index.jsx
index c742279487..722cdf6251 100644
--- a/packages/next-common/components/staking/overview/accountNomination/index.jsx
+++ b/packages/next-common/components/staking/overview/accountNomination/index.jsx
@@ -78,6 +78,7 @@ function Header() {
const realAddress = useRealAddress();
const { nominators } = useMyStakingLedger();
const width = useWindowWidthContext();
+ const hasNominations = !!nominators?.targets?.length;
return (
@@ -109,7 +112,7 @@ function StakingBalance() {
className="w-[300px] [&>*:not(:last-child)]:mb-1"
labelItem={
diff --git a/packages/next-common/components/staking/overview/accountNomination/modifyNomineesButton.jsx b/packages/next-common/components/staking/overview/accountNomination/modifyNomineesButton.jsx
index 3837c46bd4..6701b1041c 100644
--- a/packages/next-common/components/staking/overview/accountNomination/modifyNomineesButton.jsx
+++ b/packages/next-common/components/staking/overview/accountNomination/modifyNomineesButton.jsx
@@ -3,6 +3,10 @@ import dynamicPopup from "next-common/lib/dynamic/popup";
import { IconButton } from "next-common/components/styled/iconButton";
import { MenuTreasuryProposal } from "@osn/icons/subsquare";
import Tooltip from "next-common/components/tooltip";
+import { useMyStakingLedger } from "next-common/context/staking/myStakingLedger";
+import useSubStorage from "next-common/hooks/common/useSubStorage";
+import { useChainSettings } from "next-common/context/chain";
+import { cn, toPrecision } from "next-common/utils";
const ModifyNomineesPopup = dynamicPopup(() =>
import(
@@ -10,21 +14,50 @@ const ModifyNomineesPopup = dynamicPopup(() =>
),
);
-export default function ModifyNomineesButton() {
+export default function ModifyNomineesButton({ startNominating = false }) {
const [modifyNomineePopup, setModifyNomineePopup] = useState(false);
+ const { ledger } = useMyStakingLedger();
+ const { decimals, symbol } = useChainSettings();
+ const { result: minNominatorBond, loading } = useSubStorage(
+ "staking",
+ "minNominatorBond",
+ [],
+ );
+
+ const minBond = BigInt(minNominatorBond?.toString() || 0);
+ const activeBond = BigInt(ledger?.active || 0);
+ const belowMinBond = !loading && !!ledger && activeBond < minBond;
return (
<>
-
+
setModifyNomineePopup(true)}
>
{modifyNomineePopup && (
- setModifyNomineePopup(false)} />
+ setModifyNomineePopup(false)}
+ />
)}
>
);
diff --git a/packages/next-common/components/staking/overview/accountNomination/modifyNomineesPopup/index.js b/packages/next-common/components/staking/overview/accountNomination/modifyNomineesPopup/index.js
index ad1dd54a15..d7cb710932 100644
--- a/packages/next-common/components/staking/overview/accountNomination/modifyNomineesPopup/index.js
+++ b/packages/next-common/components/staking/overview/accountNomination/modifyNomineesPopup/index.js
@@ -124,10 +124,13 @@ function ModifyNomineesPopupContent() {
);
}
-export default function ModifyNomineesPopup({ onClose }) {
+export default function ModifyNomineesPopup({ onClose, startNominating }) {
return (
-
+
diff --git a/packages/next-common/components/staking/overview/accountNomination/quickActions/index.jsx b/packages/next-common/components/staking/overview/accountNomination/quickActions/index.jsx
index c76c4d610c..2d39d5405e 100644
--- a/packages/next-common/components/staking/overview/accountNomination/quickActions/index.jsx
+++ b/packages/next-common/components/staking/overview/accountNomination/quickActions/index.jsx
@@ -4,15 +4,15 @@ import PayeeButton from "./payeeButton";
import StopNominationButton from "./stopNominationButton";
import ModifyNomineesButton from "../modifyNomineesButton";
-export default function NominatorQuickActions() {
+export default function NominatorQuickActions({ hasNominations }) {
return (
-
-
+ {hasNominations &&
}
+
);
diff --git a/packages/next/pages/staking/index.jsx b/packages/next/pages/staking/index.jsx
index 487e4d3623..018bdf4869 100644
--- a/packages/next/pages/staking/index.jsx
+++ b/packages/next/pages/staking/index.jsx
@@ -23,12 +23,19 @@ const isStakingSupported = !!getChainSettings(CHAIN).modules?.staking;
function MyStaking() {
const { poolMember, loading: isMyPoolLoading } = useMyPool();
- const { nominators, loading: isMyStakingLedgerLoading } =
- useMyStakingLedger();
+ const {
+ ledger,
+ nominators,
+ loading: isMyStakingLedgerLoading,
+ } = useMyStakingLedger();
const width = useWindowWidthContext();
const loading = isMyPoolLoading || isMyStakingLedgerLoading || !width;
+ // A chilled or fully unbonded nominator no longer has a `nominators` entry,
+ // but its staking ledger may still hold balances to withdraw or unbond.
+ const hasNominatorStake = !!nominators || !!ledger;
+
if (loading) {
return (
@@ -37,7 +44,7 @@ function MyStaking() {
);
}
- if (poolMember && !nominators) {
+ if (poolMember && !hasNominatorStake) {
return (
@@ -46,7 +53,7 @@ function MyStaking() {
);
}
- if (nominators && !poolMember) {
+ if (hasNominatorStake && !poolMember) {
return (
@@ -55,7 +62,7 @@ function MyStaking() {
);
}
- if (poolMember && nominators) {
+ if (poolMember && hasNominatorStake) {
return (