After installing the SDK, you first need to set it up.
To get started, you have to instantiate and configure the SwapKit SDK:
import { createSwapKit } from '@swapkit/sdk'
const swapKitClient = createSwapKit({
config: {
stagenet?: boolean;
/**
* @required for AVAX & BSC
*/
covalentApiKey?: string;
/**
* @required for ETH
*/
ethplorerApiKey?: string;
/**
* @required for BTC, LTC, DOGE & BCH
*/
utxoApiKey?: string;
/**
* @required for Walletconnect
*/
walletConnectProjectId?: string;
/**
* @optional for Trezor config
*/
trezorManifest?: {
email: string;
appUrl: string;
};
};
})
Connecting a wallet
SwapKit supports several wallet options, including: Keystore, Trezor, Ledger, WalletConnect, and Browser wallets. These options are described in the enum WalletOption
Below is a example connectWallet that can be used to connect any wallet in the frontend of your dApp: