diff --git a/src/components/LocksCard.tsx b/src/components/LocksCard.tsx index 56f8c5e..c4c9793 100644 --- a/src/components/LocksCard.tsx +++ b/src/components/LocksCard.tsx @@ -1,10 +1,13 @@ import { useLocks } from '@/contexts/LocksContext' import { useNetwork } from '@/contexts/NetworkContext' +import { getExpectedBlockTime } from '@/lib/currentVotesAndDelegations' +import { Card } from '@polkadot-ui/react' import { useEffect, useState } from 'react' export const LocksCard = () => { const { currentLocks } = useLocks() const [currentBlock, setCurrentBlock] = useState(0) + const [expectedBlockTime, setExpectedBlockTime] = useState(0) const { api } = useNetwork() useEffect(() => { @@ -19,23 +22,37 @@ export const LocksCard = () => { return () => sub.unsubscribe() }, [api]) + useEffect(() => { + if (!api) return + + getExpectedBlockTime(api) + .then((value) => setExpectedBlockTime(Number(value))) + .catch(console.error) + }, [api]) + if (!currentLocks) return null return ( -