mirror of
https://github.com/luxfi/explore.git
synced 2026-09-24 00:28:18 +00:00
* basic Rollbar setup * remove sentry code * add rollback env to values for demo * [skip ci] adjust instance name * fix validator * don't log errors from API by default and change error levels * [skip ci] change default value for environment property * [skip ci] do not log api errors of address endpoint
26 lines
631 B
TypeScript
26 lines
631 B
TypeScript
import { useQuery } from '@tanstack/react-query';
|
|
|
|
import config from 'configs/app';
|
|
import useFetch from 'lib/hooks/useFetch';
|
|
|
|
const feature = config.features.safe;
|
|
|
|
export default function useIsSafeAddress(hash: string | undefined): boolean {
|
|
const fetch = useFetch();
|
|
|
|
const { data } = useQuery({
|
|
queryKey: [ 'safe_transaction_api', hash ],
|
|
queryFn: async() => {
|
|
if (!feature.isEnabled || !hash) {
|
|
return Promise.reject();
|
|
}
|
|
|
|
return fetch(`${ feature.apiUrl }/${ hash }`);
|
|
},
|
|
enabled: feature.isEnabled && Boolean(hash),
|
|
refetchOnMount: false,
|
|
});
|
|
|
|
return Boolean(data);
|
|
}
|