mirror of
https://github.com/luxfi/explore.git
synced 2026-09-24 00:28:18 +00:00
15 lines
620 B
TypeScript
15 lines
620 B
TypeScript
import { useMemo } from 'react';
|
|
|
|
import useAddressMetadataInfoQuery from 'lib/address/useAddressMetadataInfoQuery';
|
|
|
|
export default function useAppActionData(address: string | undefined = '', isEnabled = false) {
|
|
const memoizedArray = useMemo(() => (address && isEnabled) ? [ address ] : [], [ address, isEnabled ]);
|
|
const { data } = useAddressMetadataInfoQuery(memoizedArray);
|
|
const metadata = data?.addresses[address?.toLowerCase()];
|
|
const tag = metadata?.tags?.find(({ tagType }) => tagType === 'protocol');
|
|
if (tag?.meta?.appMarketplaceURL || tag?.meta?.appID) {
|
|
return tag.meta;
|
|
}
|
|
return null;
|
|
}
|