Install DoritoKit SDK

Table of Content

Table of Content

Table of Content

Set up the SDK

After installing the SDK, you first need to set it up.

To begin, initialize and configure the DoritoKit SDK:

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

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:

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

Join our Community

Any other questions? Book a Call

DoritoKit

·

©

2025

All rights reserved

DoritoKit

·

©

2025

All rights reserved

DoritoKit

·

©

2025

All rights reserved