-
-
Notifications
You must be signed in to change notification settings - Fork 263
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
base: develop
Are you sure you want to change the base?
Changes from all commits
77917ab
66ea09c
394f3a6
6a42466
6249141
e58f97b
bf16abe
0c3a403
4460aff
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,7 +25,7 @@ export const prioritizeEndpoints = (urls: string[]) => | |
.sort(([, a], [, b]) => b - a) | ||
.map(([url]) => url); | ||
|
||
export const getSolanaStakingAccounts = async (descriptor: string, isTestnet: boolean) => { | ||
export const getSolanaStakingData = async (descriptor: string, isTestnet: boolean) => { | ||
const blockchainEnvironment = isTestnet ? 'devnet' : 'mainnet'; | ||
|
||
// Find the blockchain configuration for the specified chain and environment | ||
|
@@ -38,7 +38,16 @@ export const getSolanaStakingAccounts = async (descriptor: string, isTestnet: bo | |
const solanaClient = new Solana(network, serverUrl); | ||
|
||
const delegations = await solanaClient.getDelegations(descriptor); | ||
if (!delegations || !delegations.result) { | ||
throw new Error('Failed to fetch delegations'); | ||
} | ||
const { result: stakingAccounts } = delegations; | ||
|
||
return stakingAccounts; | ||
const epochInfo = await solanaClient.getEpochInfo(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 There was a problem hiding this comment. Choose a reason for hiding this commentThe 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? |
||
if (!epochInfo || !epochInfo.result) { | ||
throw new Error('Failed to fetch epoch info'); | ||
} | ||
const { epoch } = epochInfo.result; | ||
|
||
return { stakingAccounts, epoch }; | ||
}; |
There was a problem hiding this comment.
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 🤔