Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | /* eslint-disable @typescript-eslint/no-unsafe-argument */ import { useApi } from '@hooks/use-api'; import { ApiResource } from '@models'; import { selectAddress } from '@store/keys'; import { useCallback } from 'react'; import { useQuery } from 'react-query'; import { useSelector } from 'react-redux'; export function useFetchPossibleNextNonce() { const api = useApi(); const address = useSelector(selectAddress); const nonceFetcher = useCallback( ({ queryKey }) => { const [_, innerAddress] = queryKey; Iif (!innerAddress) return; return api.getNonce(innerAddress); }, [api] ); const { data } = useQuery([ApiResource.Nonce, address], nonceFetcher); Iif (!data) return { nonce: 0 }; return { nonce: data.possible_next_nonce }; } |