useNodeDetails.ts raw

   1  import useSWR, { SWRConfiguration } from "swr";
   2  
   3  import { MempoolNode } from "src/types";
   4  import { swrFetcher } from "src/utils/swr";
   5  
   6  export function useNodeDetails(nodePubkey: string | undefined) {
   7    const config: SWRConfiguration = {
   8      dedupingInterval: 600000, // 10 minutes
   9    };
  10  
  11    return useSWR<MempoolNode>(
  12      nodePubkey && `/api/mempool?endpoint=/v1/lightning/nodes/${nodePubkey}`,
  13      swrFetcher,
  14      config
  15    );
  16  }
  17