Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/implement solana staking #15409

Draft
wants to merge 6 commits into
base: develop
Choose a base branch
from

Conversation

dev-pvl
Copy link
Contributor

@dev-pvl dev-pvl commented Nov 15, 2024

Description

  • implemented the initial Solana dashboard
  • renamed stake.ts to ethereumStaking.ts for clarity
  • implemented Solana staking
  • added Solana staking account balance
  • hide the staking buttons if debug mode is disabled

Related Issue

Screenshots:

image
image
image

@dev-pvl dev-pvl force-pushed the feat/implement-solana-staking branch from 5f0e506 to 47ceb8d Compare November 15, 2024 13:57
@dev-pvl dev-pvl force-pushed the feat/implement-solana-staking branch from 47ceb8d to e7afb45 Compare November 15, 2024 14:25
@tomasklim tomasklim self-assigned this Nov 15, 2024
@@ -25,7 +25,9 @@ export const WalletStaking = () => {
case 'cardano':
return <CardanoStakingDashboard selectedAccount={selectedAccount} />;
case 'ethereum':
return <EthStakingDashboard selectedAccount={selectedAccount} />;
return <StakingDashboard selectedAccount={selectedAccount} />;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return <StakingDashboard selectedAccount={selectedAccount} />;

@@ -5,21 +5,25 @@ import { WalletLayout } from 'src/components/wallet';
import { useSelector } from 'src/hooks/suite';

import { EmptyStakingCard } from './components/EmptyStakingCard';
import { StakingDashboard } from './components/StakingDashboard';
import { StakingDashboard as EthStakingDashboard } from '../EthStakingDashboard/components/StakingDashboard';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you please call the file and component EthStakingDashboard?

@@ -8625,7 +8625,7 @@ const messages = defineMessagesWithTypeCheck({
TR_STAKE_STAKING_IS: {
id: 'TR_STAKE_STAKING_IS',
defaultMessage:
"Staking involves temporarily locking your Ethereum assets to support the blockchain's operation. In return, you'll earn additional Ethereum as a reward.",
"Staking involves temporarily locking your {network} assets to support the blockchain's operation. In return, you'll earn additional {network} as a reward.",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to say @jirih-stsh

  • earn additional ETH as a reward. or earn additional Ethereum as a reward.
  • earn additional SOL as a reward. or earn additional Solana as a reward.

@@ -18,6 +19,8 @@ export const ACCOUNT_TABS = [
];

export const AccountNavigation = () => {
const isDebugModeActive = useSelector(selectIsDebugModeActive);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you please add all those is debug things into 1 separate commit or add some specific TODOs somewhere so that we easily find what we should remove before launch?

details: 'basic',
suppressBackupWarning: true,
});
const [basic, stakingAccounts] = await Promise.all([
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note: @tomasklim TODO check if ok

@@ -28,6 +29,10 @@ export const composeTransaction =
return dispatch(stakeFormEthereumActions.composeTransaction(formValues, formState));
}

if (account.networkType === 'solana') {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use switch here




const calculate = (
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

au, this file is really big copy-paste. can we try to avoid that, please

if (output.type === 'send-max' || output.type === 'send-max-noaddress') {
const minEthBalanceForStakingWei =
MIN_SOL_BALANCE_FOR_STAKING.multipliedBy(LAMPORTS_PER_SOL);
const minAmountWithFeeWei = new BigNumber(minEthBalanceForStakingWei).plus(feeInLamports);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, do not use eth referencing name where it does not belong

return new BigNumber(amount).div(LAMPORTS_PER_SOL).toFixed(9);
};

type SolhNetwork = 'devnet' | 'mainnet-beta';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
type SolhNetwork = 'devnet' | 'mainnet-beta';
type SolNetwork = 'devnet' | 'mainnet-beta';

const totalAmount = accounts.reduce((acc, solAccount) => {
const { account } = solAccount;

return acc.plus(account?.data.parsed.info.stake.delegation.stake);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this probably does not include mev kickback and rent. Do we want to count those as well?

Copy link
Contributor

@vytick vytick left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants