When initializing the Kit object, you must pass a Wallet object as an option so that you can connect an external wallet through the Face Wallet Kit modal. The Face Wallet Kit provides various external wallet objects.


getMetaMask()

import { Face } from '@haechi-labs/face-sdk';
import { Kit, getMetaMask } from '@haechi-labs/face-kit';

// Put the initialized face instance to Kit
const face = new Face(/* ... */);

const kit = new Kit(face, {
  externalWalletOptions: {
    wallets: [ getMetaMask() ],
  },
});

Returns a MetaMask wallet object so that you can show the MetaMask in the Face Wallet Kit.


getWalletConnect()

import { Face } from '@haechi-labs/face-sdk';
import { Kit, getWalletConnect } from '@haechi-labs/face-kit';

// Put the initialized face instance to Kit
const face = new Face(/* ... */);

const kit = new Kit(face, {
  externalWalletOptions: {
    wallets: [ getWalletConnect({ options: { projectId: wcProjectId } }) ],
  },
});

Returns a WalletConnect wallet object so that Face Wallet Kit can show WalletConnect v2. WalletConnect v2 requires an optional projectId to be passed, which can be obtained here.


getWalletConnectLegacy()

import { Face } from '@haechi-labs/face-sdk';
import { Kit, getWalletConnectLegacy } from '@haechi-labs/face-kit';

// Put the initialized face instance to Kit
const face = new Face(/* ... */);

const kit = new Kit(face, {
  externalWalletOptions: {
    wallets: [ getWalletConnectLegacy() ],
  },
});

Returns a WalletConnectLegacy wallet object so that Face Wallet Kit can show WalletConnect v1.


Types

Wallet

The Wallet option object you pass to Face Wallet Kit has the following types:

import { Connector } from '@wagmi/connectors';

type Wallet = {
  id: string;
  name: string;
  iconUrl: string;
  downloadUrls?: {
    ios?: string;
    android?: string;
    chrome?: string;
    firefox?: string;
    edge?: string;
    opera?: string;
    default?: string;
  };

	createConnector: () => Promise<Connector>;
};

ConnectedWallet

The object returned by kit.connect() has type ConnectedWallet. ConnectedWallet is the Wallet type without the createConnector field and with the connector field instead.

import { Connector } from '@wagmi/connectors';

type ConnectedWallet = {
  id: string;
  name: string;
  iconUrl: string;
  downloadUrls?: {
    ios?: string;
    android?: string;
    chrome?: string;
    firefox?: string;
    edge?: string;
    opera?: string;
    default?: string;
  };

	connector: Connector;
};