# 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 }]
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.eldorito.club/dkit-by-eldorito/set-up-the-sdk.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
