I am currently connecting to a cardano wallet like this.
const [walletApiKey, setWalletApiKey] = useState(null);
const connectCardanoWallets = async (selectedWallet) => {
const walletFound = !!window?.cardano?.[selectedWallet];
if (walletFound) {
try {
let walletApi;
walletApi = await window.cardano[selectedWallet].enable();
setWalletApiKey(walletApi);
} catch (err) {
console.log(err);
}
} else {
toast('Wallet not found');
}
};
If they have previously connected to our website before , when I envoke the method .enable() we get the API key automatically without the user putting in their password to whitelist us again. Right now I am using a useEffect hook like this to connect to their wallet.
useEffect(() => {
connectCardanoWallets('nami');
}, []);
How do I check if our website is whitelisted so i can automatically connect to their wallet and don't automatically envoke the .enable() method if my website is not whitelisted?