Skip to content

Commit

Permalink
Merge pull request #9103 from LedgerHQ/fix/CN-1076-earn-rewards-dot-t…
Browse files Browse the repository at this point in the history
…o-stakekit

CN-1076: change the button action earn rewards to open stakekit
  • Loading branch information
adammino-ledger authored Feb 7, 2025
2 parents 11975c0 + 821750e commit 6524dcf
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 16 deletions.
6 changes: 6 additions & 0 deletions .changeset/calm-planes-train.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"ledger-live-desktop": minor
"live-mobile": minor
---

DOT stake earn more reward button redirecting to stakekit
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ import {
} from "@ledgerhq/live-common/families/polkadot/types";
import { SubAccount } from "@ledgerhq/types-live";
import { useAccountUnit } from "~/renderer/hooks/useAccountUnit";
import { useHistory } from "react-router";

type Props = {
account: PolkadotAccount | SubAccount;
Expand All @@ -64,6 +65,8 @@ export type NominationValidator =
| PolkadotUnlocking;

const Nomination = ({ account }: { account: PolkadotAccount }) => {
const history = useHistory();

const discreet = useDiscreetMode();
const locale = useSelector(localeSelector);
const unit = useAccountUnit(account);
Expand Down Expand Up @@ -115,12 +118,15 @@ const Nomination = ({ account }: { account: PolkadotAccount }) => {
};
}, [unlockings, unlockedBalance]);
const onEarnRewards = useCallback(() => {
dispatch(
openModal("MODAL_POLKADOT_REWARDS_INFO", {
account,
}),
);
}, [account, dispatch]);
history.push({
pathname: "/platform/stakekit",
state: {
yieldId: "polkadot-dot-validator-staking",
accountId: account.id,
returnTo: `/account/${account.id}`,
},
});
}, [account, history]);
const onNominate = useCallback(() => {
dispatch(
openModal("MODAL_POLKADOT_NOMINATE", {
Expand Down
20 changes: 10 additions & 10 deletions apps/ledger-live-mobile/src/families/polkadot/Nominations/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import { getMainAccount } from "@ledgerhq/live-common/account/index";
import { getDefaultExplorerView, getAddressExplorer } from "@ledgerhq/live-common/explorers";
import {
canNominate,
isStash,
hasExternalController,
hasExternalStash,
hasPendingOperationType,
Expand Down Expand Up @@ -144,15 +143,16 @@ export default function Nominations(props: Props) {
);

const onEarnRewards = useCallback(() => {
isStash(account)
? onNavigate({
route: NavigatorName.PolkadotNominateFlow,
screen: ScreenName.PolkadotNominateSelectValidators,
})
: onNavigate({
route: NavigatorName.PolkadotBondFlow,
screen: ScreenName.PolkadotBondStarted,
});
onNavigate({
route: NavigatorName.Base,
screen: ScreenName.PlatformApp,
params: {
platform: "stakekit",
name: "StakeKit",
accountId: account.id,
yieldId: "polkadot-dot-validator-staking",
},
});
}, [account, onNavigate]);

const onNominate = useCallback(() => {
Expand Down

0 comments on commit 6524dcf

Please sign in to comment.