Skip to content
This repository was archived by the owner on Sep 8, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions src/ui/common/state/MultistakingState.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export function MultistakingState({ children }: PropsWithChildren) {
? networkInfo.params.bbnStakingParams.latestParam.maxFinalityProviders
: DEFAULT_MAX_FINALITY_PROVIDERS;

const { stakableBtcBalance } = useBalanceState();
const { stakableBtcBalance, bbnBalance } = useBalanceState();
const { stakingInfo } = useStakingState();

const formFields: FieldOptions[] = useMemo(
Expand Down Expand Up @@ -135,10 +135,13 @@ export function MultistakingState({ children }: PropsWithChildren) {
"Staking amount must have no more than 8 decimal points.",
(_, context) => validateDecimalPoints(context.originalValue),
)
// ???
.test("insufficientFunds", "Insufficient BTC", () => true),
Comment thread
jrwbabylonlab marked this conversation as resolved.
.test(
"insufficientBabyBalance",
"Insufficient BABY Balance",
() => bbnBalance > 0,
),
errors: {
invalidFormat: { level: "error" },
invalidFormat: { level: "error" },
},
},
{
Expand Down Expand Up @@ -166,7 +169,7 @@ export function MultistakingState({ children }: PropsWithChildren) {
.moreThan(0, "Staking fee amount must be greater than 0."),
},
] as const,
[stakingInfo, stakableBtcBalance, maxFinalityProviders],
[stakingInfo, stakableBtcBalance, bbnBalance, maxFinalityProviders],
);

const validationSchema = useMemo(() => {
Expand Down
13 changes: 8 additions & 5 deletions src/ui/legacy/state/MultistakingState.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export function MultistakingState({ children }: PropsWithChildren) {
const [stakingModalPage, setStakingModalPage] = useState<StakingModalPage>(
StakingModalPage.DEFAULT,
);
const { stakableBtcBalance } = useBalanceState();
const { stakableBtcBalance, bbnBalance } = useBalanceState();
const { stakingInfo } = useStakingState();

const formFields: FieldOptions[] = useMemo(
Expand Down Expand Up @@ -118,10 +118,13 @@ export function MultistakingState({ children }: PropsWithChildren) {
"Staking amount must have no more than 8 decimal points.",
(_, context) => validateDecimalPoints(context.originalValue),
)
// ???
.test("insufficientFunds", "Insufficient BTC", () => true),
.test(
"insufficientBabyBalance",
"Insufficient BABY Balance",
() => bbnBalance > 0,
),
errors: {
invalidFormat: { level: "error" },
invalidFormat: { level: "error" },
},
},
{
Expand Down Expand Up @@ -149,7 +152,7 @@ export function MultistakingState({ children }: PropsWithChildren) {
.moreThan(0, "Staking fee amount must be greater than 0."),
},
] as const,
[stakingInfo, stakableBtcBalance],
[stakingInfo, stakableBtcBalance, bbnBalance],
);

const validationSchema = useMemo(() => {
Expand Down