๐Ÿ“ฆ Install dKiT SDK

๐Ÿ’ก Set up the SDK

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

To begin, initialize and configure the dKiT 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

dKiT supports multiple wallet connection methods to ensure broad compatibility across different blockchain ecosystems. Supported wallets include Keystore, Phantom, Keplr, MetaMask, and various hardware wallets. All available options are defined within the WalletOption enum.

The connectWallet function provides a unified interface for your dApp's frontend to establish connections with any of these supported wallet types:

import { AssetAmount, Chain, createSwapKit as createDoritoKit, WalletOption } from '@doritokit/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 โ†’

dKiT

ยท

ยฉ

2025

All rights reserved

dKiT

ยท

ยฉ

2025

All rights reserved

dKiT

ยท

ยฉ

2025

All rights reserved