getAvailableWallets
Function to return wallets object based on wallet availability.
Usage
import { getAvailableWallets, useConnect } from "graz";
export const AvailableWallets = () => {
const wallets = getAvailableWallets();
const { connect } = useConnect();
return (
<>
{wallets.keplr && <button onClick={() => connect({ walletType: WalletType.KEPLR })}>Keplr</button>}
{wallets.leap && <button onClick={() => connect({ walletType: WalletType.LEAP })}>Leap</button>}
{wallets.cosmostation && (
<button onClick={() => connect({ walletType: WalletType.COSMOSTATION })}>Cosmostation</button>
)}
{wallets.walletconnect && (
<button onClick={() => connect({ walletType: WalletType.WALLETCONNECT })}>WalletConnect</button>
)}
{wallets.wc_keplr_mobile && (
<button onClick={() => connect({ walletType: WalletType.WC_KEPLR_MOBILE })}>Keplr Mobile</button>
)}
{wallets.wc_leap_mobile && (
<button onClick={() => connect({ walletType: WalletType.WC_LEAP_MOBILE })}>Leap Mobile</button>
)}
{wallets.wc_cosmostation_mobile && (
<button onClick={() => connect({ walletType: WalletType.WC_COSMOSTATION_MOBILE })}>Cosmostation Mobile</button>
)}
</>
);
};
Note:
- if
walletConnect.options.projectIdnot providedWalletType.WALLETCONNECT|WalletType.WC_KEPLR_MOBILE|WalletType.WC_LEAP_MOBILE|WalletType.WC_COSMOSTATION_MOBILEwill return false wallet.WalletType.WALLETCONNECTis using@walletconnect/modalfor the modal, it will only shows the qr code. To connect and have deep linking to wallet mobile apps, useWalletType.WC_KEPLR_MOBILE|WalletType.WC_LEAP_MOBILE|WalletType.WC_COSMOSTATION_MOBILEWalletType.WC_KEPLR_MOBILE|WalletType.WC_LEAP_MOBILE|WalletType.WC_COSMOSTATION_MOBILEonly returns true on mobile