Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.leokit.dev/llms.txt

Use this file to discover all available pages before exploring further.

Connect & Disconnect

const conn = await sdk.connectWallet("metamask"); // returns WalletConnection

await sdk.disconnectWallet("metamask");
await sdk.disconnectAll();
MethodReturnsDescription
connectWallet(type, options?)Promise<WalletConnection>Connects an adapter. Adapters are lazy-loaded
disconnectWallet(type)Promise<void>Cleanly disconnects a single adapter
disconnectAll()Promise<void>Disconnects every connected adapter
getConnectedWallets()WalletConnection[]Currently-connected sessions
isConnected()booleanAt least one wallet connected?
getAddress(chain)string | undefinedResolved address for a chain
getAddresses()Partial<Record<ChainId, string>>All resolved addresses
getAvailableWallets()WalletType[]Adapters detected in the current environment
getSupportedWallets()WalletType[]All adapters compiled into the SDK
onProvidersChanged(callback) returns an unsubscribe function. It fires when EIP-6963 providers come and go (browser only).

Adapters

WalletTypeCapabilitiesNotes
metamaskEVMEIP-6963 with multi-account support
coinbaseEVMCoinbase Wallet
phantomEVM, UTXO, Solana
ledgerEVM, UTXO, CosmosHardware (WebUSB)
keystoreEVM, UTXO, Cosmos, Solana, TronEncrypted keystore file
ctrlEVM, UTXO, Cosmos, SolanaCTRL/XDEFI
keplrCosmos
trustEVM, UTXO, Cosmos, SolanaTrust Wallet
talismanSubstrate / EVM
tronlinkTron
walletconnectEVM (and others via WC v2)Requires projectId in ConnectOptions
vultisigMulti-chain
solflareSolana, EVM
shielded-zcash-keystoreZCash transparent + shieldedSee Shielded ZCash
hot-walletMulti-chain
meteorNEAR
okxEVM, UTXO, Solana
nearNEARNEAR Wallet
rabbyEVM
For type-safe lazy imports, use leokit-sdk/wallets:
import { MetaMaskAdapter, LedgerAdapter, KeplrAdapter } from "leokit-sdk/wallets";

Ledger Deep-Dive

// Subscribe to detection progress (USB devices arriving / leaving)
const unsubscribe = await sdk.onLedgerProgress((event) => {
  console.log(event.stage, event.message);
});

// Pick an account from the device
const accounts = await sdk.getLedgerDerivedAccounts("ETH");
// [{ address, publicKey, derivationPath, index }, ...]
await sdk.selectLedgerAccount("ETH", 1); // use the second derivation

// Re-detect after physical reconnect
await sdk.redetectLedger();
@ledgerhq/hw-app-btc@^10.18.0 is required and pinned via the SDK’s optional dependencies.

MetaMask Multi-Account

MetaMask exposes multiple accounts as a single provider. The SDK adds first-class methods for switching and revoking permissions:
// Prompt MetaMask to expose more accounts
const newAccounts = await sdk.requestAdditionalMetaMaskAccounts();

// Find the currently-selected one
const active = await sdk.getMetaMaskSelectedAddress();

// React to user-driven account switches
const off = await sdk.onMetaMaskAccountsChanged((accounts) => {
  console.log("active changed to", accounts[0]);
});

// Revoke wallet permissions entirely
await sdk.revokeMetaMaskPermissions();
These methods are MetaMask-specific — they no-op on other EVM adapters.

EIP-6963 Discovery

The SDK ships an EIP6963Store that auto-tracks provider announcements:
import { getEIP6963Store } from "leokit-sdk/wallets";

const store = getEIP6963Store();
const providers = store.getProviders(); // [{ rdns, name, icon, provider }]
Use this to render a wallet picker that includes every browser-installed provider, not just the ones your app pre-defines.

Connection Events

LeoKitClient extends EventEmitter<LeoKitEvents>:
sdk.on("walletChange", (e) => console.log(e.from, "→", e.to));
sdk.on("error", (err) => console.error(err));