-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Explorer: introduce circulating supply, active stake, and price on cl…
…uster stats page (#16095) * feat: add styles form staking component * feat: introduce circulating supply, active stake, and price on cluster stats page * feat: add an error state for coingecko
- Loading branch information
Showing
5 changed files
with
295 additions
and
3 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { Connection, VoteAccountStatus } from "@solana/web3.js"; | ||
import { Cluster, useCluster } from "providers/cluster"; | ||
import React from "react"; | ||
import { reportError } from "utils/sentry"; | ||
|
||
async function fetchVoteAccounts( | ||
cluster: Cluster, | ||
url: string, | ||
setVoteAccounts: React.Dispatch< | ||
React.SetStateAction<VoteAccountStatus | undefined> | ||
> | ||
) { | ||
try { | ||
const connection = new Connection(url); | ||
const result = await connection.getVoteAccounts(); | ||
setVoteAccounts(result); | ||
} catch (error) { | ||
if (cluster !== Cluster.Custom) { | ||
reportError(error, { url }); | ||
} | ||
} | ||
} | ||
|
||
export function useVoteAccounts() { | ||
const [voteAccounts, setVoteAccounts] = React.useState<VoteAccountStatus>(); | ||
const { cluster, url } = useCluster(); | ||
|
||
return { | ||
fetchVoteAccounts: () => fetchVoteAccounts(cluster, url, setVoteAccounts), | ||
voteAccounts, | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters