> For the complete documentation index, see [llms.txt](https://docs.eldorito.club/dkit-by-eldorito/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.eldorito.club/dkit-by-eldorito/set-up-the-sdk.md).

# Set up the SDK

To begin, initialize and configure the **dKit** SDK:

```typescript
import { createDoritoKit } from '@doritokit/sdk'

const doritoKitClient = createDoritoKit({
  config: {
    stagenet?: boolean;
    /**
     * @required for AVAX & BSC
     */
    covalentApiKey?: string;
    /**
     * @required for ETH
     */
    ethplorerApiKey?: string;
    /**
     * @required for BTC, LTC, DOGE & BCH
     */
    utxoApiKey?: string;
  };
})
```

## Connecting a wallet <a href="#connecting-a-wallet" id="connecting-a-wallet"></a>

**doritoKit** offers multiple wallet connection options, including **Keystore, Phantom, Keplr, Metamask and hardware wallets**. These options are defined in the `WalletOption` enum.

Here’s an example of `connectWallet`, which allows your dApp’s frontend to connect to any supported wallet:

```typescript
import { AssetAmount, Chain, createDoritoKit, WalletOption } from '@swapkit/sdk'

const client = createDoritoKit();
const connectChains = [Chain.Ethereum, Chain.Bitcoin, Chain.THORChain]

const connectWallet = (walletOption: WalletOption) => {
  // Note that specific wallets support a subset of all chains.
  switch (walletOption) {
    // supports most chains e.g.
    // import { CosmosChains, EVMChains, MAYASupportedChains, SubstrateChains, TCSupportedChains, UtXOChains } from '@doritokit/helpers'
    case WalletOption.KEYSTORE: {
      return client.connectKeystore(connectChains, phrase);
    }
    // import { CTRL_SUPPORTED_CHAINS } from '@doritokit/wallet-ctrl'
    case WalletOption.CTRL:
      return client.connectCtrl(connectChains);
    // 
    case WalletOption.PHANTOM:
      return client.connectPhantom(connectChains);
    // import { EVMChains } from '@doritokit/helpers'
    case WalletOption.METAMASK:
      return client.connectEVMWallet(connectChains, WalletOption.METAMASK);
    // import { CosmosChains } from '@doritokit/helpers'
    case WalletOption.KEPLR:
      return client.connectKeplr(connectChains, 'keplr');
    // import { CosmosChains } from '@doritokit/helpers'
    case WalletOption.LEAP:
      return client.connectKeplr(connectChains, 'leap');
    // import { SubstrateChains } from '@doritokit/helpers'
    case WalletOption.TALISMAN:
      return client.connectTalisman(connectChains);
      
    default:
      break;
  }
}, []);
  
const fetchWalletBalances = () => {
  const wallets = await Promise.all(connectChains.map(client.getWalletByChain));

  console.log(wallets)
  // [{ balance: AssetAmount[]; address: string; walletType: WalletOption }]
}
```
