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(suite): solana staking dashboard implementation #16027

Open
wants to merge 8 commits into
base: develop
Choose a base branch
from

Conversation

dev-pvl
Copy link
Contributor

@dev-pvl dev-pvl commented Dec 18, 2024

Description

  • Implemented support for fetching Solana epoch information
  • Enables fetching APY data for Solana
  • Upgraded wallet-sdk to the latest version
  • Enabled unstaking and claiming functionality
  • Added a utility to get staking limits by network
  • Added a utility to get staking balances for the current network
  • Refactored staking components to include Solana support
  • Resolved minor Solana compatibility issues in components

Related Issue

Resolve #15231
Resolve #15266
Resolve #15233
Resolve #15229
Resolve #16036
Resolve #16037
Resolve #16038

Screenshots

Screenshot 2024-12-18 at 16 32 35 Screenshot 2024-12-18 at 14 51 09 Screenshot 2024-12-18 at 14 51 36 Screenshot 2024-12-18 at 14 51 52 Screenshot 2024-12-18 at 16 32 12 Screenshot 2024-12-18 at 16 37 42 Screenshot 2024-12-18 at 16 34 05

@dev-pvl dev-pvl force-pushed the feat/solana-staking-dashboard-implementation branch from 2949fa0 to 7e7e26f Compare December 18, 2024 15:11
@tomasklim tomasklim requested review from martykan and vytick December 18, 2024 16:34
@dev-pvl dev-pvl force-pushed the feat/solana-staking-dashboard-implementation branch from 7e7e26f to 7ce2999 Compare December 18, 2024 17:02
@tomasklim
Copy link
Member

tomasklim commented Dec 18, 2024

When staking on an account for the first time. After stake, can we show staking dashboard faster? It takes user back to the What is staking? page and then after few seconds it shows dashboard

@tomasklim
Copy link
Member

tomasklim commented Dec 18, 2024

Screenshot 2024-12-18 at 19 50 14

Please show the including tokens & staking only in debug mode. For prod, just including tokens

@tomasklim
Copy link
Member

tomasklim commented Dec 18, 2024

@dev-pvl please run yarn dedupe, check is failing

@tomasklim
Copy link
Member

tomasklim commented Dec 18, 2024

@dev-pvl please add staking also to dashboard Assets, card and table

@dev-pvl
Copy link
Contributor Author

dev-pvl commented Dec 20, 2024

We can display the staking dashboard more quickly when transactions are supported. Currently, checking for Solana staking relies on the existence of staking accounts. This serves as a temporary solution, but eventually, we should base the check on the transactions themselves. Once we have transactions, we can probably show the dashboard faster.

misc = {
owner: accountInfo?.owner,
rent: Number(rent),
solStakingAccounts: [],
solStakingAccounts: stakingData?.stakingAccounts,
solEpoch: stakingData?.epoch,
Copy link
Contributor

Choose a reason for hiding this comment

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

it feels odd to have blockchain related info (network epoch) with account related data 🤔

const { result: stakingAccounts } = delegations;

return stakingAccounts;
const epochInfo = await solanaClient.getEpochInfo();
Copy link
Contributor

Choose a reason for hiding this comment

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

this will be called for each account instead of fetching that info only once for the whole network - imo this should not be fetched nor stored with account data

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You're right. Where do you think it should be fetched/stored instead?

Copy link
Contributor

Choose a reason for hiding this comment

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

What do you think @martykan ? Where should we store this info?

@dev-pvl dev-pvl force-pushed the feat/solana-staking-dashboard-implementation branch from 74cd1b0 to bf16abe Compare December 23, 2024 13:35
@dev-pvl
Copy link
Contributor Author

dev-pvl commented Dec 23, 2024

I believe the useStakeEthForm, useUnstakeEthForm, and useClaimEthForm hooks, as well as Ethereum-specific components, should be refactored to support both Ethereum and Solana. However, this would likely require significant work, so it might be better to address it in a separate PR. For now, prioritizing feature support seems more practical, as we discussed previously. Wdyt, @tomasklim?

@tomasklim tomasklim force-pushed the feat/solana-staking-dashboard-implementation branch from 4460aff to b9f7e1c Compare December 28, 2024 08:39
@tomasklim tomasklim force-pushed the feat/solana-staking-dashboard-implementation branch from b9f7e1c to 320ea32 Compare December 28, 2024 09:26
Copy link
Member

@tomasklim tomasklim left a comment

Choose a reason for hiding this comment

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

Wdyt, @tomasklim?

I agree, let's merge this asap.


I've rebased and done some small fixes related to symbols. We are now using getNetworkDisplaySymbol
In UI we use it instead of pure account.symbol to support L2s (Base -> ETH symbol)


btw I dont see staking accounts now. Do you know why? @dev-pvl
Screenshot 2024-12-28 at 10 32 44

@tomasklim tomasklim self-requested a review December 28, 2024 09:33
@tomasklim tomasklim force-pushed the feat/solana-staking-dashboard-implementation branch from 320ea32 to fe44017 Compare December 28, 2024 11:59
solPendingStakeBalance: balances[StakeState.activating],
solPendingUnstakeBalance: balances[StakeState.deactivating],
canClaimSol: new BigNumber(balances[StakeState.deactivated]).gt(0),
canUnstakeSol: new BigNumber(balances[StakeState.active]).gt(0),
Copy link
Contributor

@vytick vytick Jan 3, 2025

Choose a reason for hiding this comment

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

one more thing:

When user stakes SOL -> creates stake account -> delegates and sets stake to activating state, he can still technically get the SOL right away in case he changed his mind. If I see correctly, based on how solClaimableBalance and canUnstakeSol are defined, we wont allow this in Suite.

It just takes to deactivate the stake account and withdraw. No need to wait 2 epochs for activating and deactivating the account again.

Copy link
Contributor

Choose a reason for hiding this comment

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

Do we want to cover this edgecase @tomasklim ?

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