Connect
connect()
connect()
The connect()
method brings up a modal window that allows you to connect to Face Wallet or external wallets.
import { ConnectedWallet } from '@haechi-labs/face-types';
const connectedWallet: ConnectedWallet = await kit.connect();
If the user is already connected to a wallet and the wallet is authorized, connect()
method returns the ConnectedWallet directly without displaying the modal. Therefore, you can use the isConnected()
method and the connect()
method to implement auto-connect.
const isConnected: boolean = await kit.isConnected();
if(isConnected) {
const connectedWallet = await kit.connect();
}
Returns
connect(): Promise<ConnectedWallet>;
You can access the Wagmi Connector object through its return value.
const wagmiConnector = connectedWallet.connector;
const account = wagmiConnector.getAccount();
For more type information, see the Wallets documentation.
isConnected()
isConnected()
The isConnected()
method checks if the last connected wallet exists and if the wallet is authorized.
const isConnected: boolean = await kit.isConnected();
Returns
isConnected(): Promise<boolean>;
disconnect()
disconnect()
The disconnect()
method disconnects the wallet connected via Kit.
await kit.disconnect();
Returns
disconnect(): Promise<void>;
Updated 12 months ago