-
-
Notifications
You must be signed in to change notification settings - Fork 279
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
Changes from all commits
fb284b0
8226009
a40fcb9
1cb198e
f059e14
873a8e2
f80ce45
fe44017
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? 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. What do you think @martykan ? Where should we store this info? 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. I guess the most logical place to store it would be Blockchain, alongside blockHash/blockHeight. trezor-suite/suite-common/wallet-types/src/backend.ts Lines 32 to 36 in fe44017
And load it in getInfo.
|
||||||||||||||
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 🤔