Skip to content

Commit

Permalink
Fix top callouts
Browse files Browse the repository at this point in the history
  • Loading branch information
ChewingGlass committed Jan 30, 2025
1 parent b8934c5 commit 048cbc2
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions src/components/VeTokensCallout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@ import {
calcPositionVotingPower,
usePositionKeysAndProxies,
usePositions,
useRegistrar
useRegistrar,
useRegistrarForMint,
} from "@helium/voter-stake-registry-hooks";
import { getRegistrarKey } from "@helium/voter-stake-registry-sdk";
import { getRegistrarKey, VoteService } from "@helium/voter-stake-registry-sdk";
import { PublicKey } from "@solana/web3.js";
import BN from "bn.js";
import Image from "next/image";
Expand All @@ -26,22 +27,25 @@ const VeTokenItem: FC<{ mint: PublicKey }> = ({ mint }) => {
const { wallet, connection } = provider || {};
const unixNow = useSolanaUnixNow() || Date.now() / 1000;
const decimals = useMint(mint)?.info?.decimals;
const registrarKey = useMemo(
() => mint && getRegistrarKey(mint),
// eslint-disable-next-line react-hooks/exhaustive-deps
[mint?.toBase58()]
);
const { registrarKey } = useRegistrarForMint(mint);
const urlVoteService = useMemo(() => {
return registrarKey
? new VoteService({
baseURL: process.env.NEXT_PUBLIC_HELIUM_VOTE_URI,
registrar: registrarKey,
})
: undefined;
}, [registrarKey]);
const { info: registrar } = useRegistrar(registrarKey);

const { voteService } = useGovernance();
const {
positionKeys,
proxiedPositionKeys,
isLoading: loadingPositionKeys,
} = usePositionKeysAndProxies({
wallet: wallet?.publicKey,
provider,
voteService,
voteService: urlVoteService,
});

// Assume that my positions are a small amount, so we don't need to say they're static
Expand All @@ -50,7 +54,7 @@ const VeTokenItem: FC<{ mint: PublicKey }> = ({ mint }) => {
// Proxied positions may be a lot, set to static
const { accounts: proxiedPositions, loading: loadingProxyPositions } =
usePositions(proxiedPositionKeys, true);
const loadingFetchedPositions = loadingMyPositions || loadingProxyPositions
const loadingFetchedPositions = loadingMyPositions || loadingProxyPositions;
const fetchedPositions = useMemo(() => {
const uniquePositions = new Map();
[...(myPositions || []), ...(proxiedPositions || [])].forEach(
Expand Down

0 comments on commit 048cbc2

Please sign in to comment.