> ## 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.

# Wallets

> Connect, disconnect, and manage 19 wallet adapters across EVM, UTXO, Cosmos, Solana, NEAR, Tron, and more

## Connect & Disconnect

```typescript theme={null}
const conn = await sdk.connectWallet("metamask"); // returns WalletConnection

await sdk.disconnectWallet("metamask");
await sdk.disconnectAll();
```

| Method                          | Returns                            | Description                                   |
| ------------------------------- | ---------------------------------- | --------------------------------------------- |
| `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()`                 | `boolean`                          | At least one wallet connected?                |
| `getAddress(chain)`             | `string \| undefined`              | Resolved 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

| `WalletType`              | Capabilities                    | Notes                                     |
| ------------------------- | ------------------------------- | ----------------------------------------- |
| `metamask`                | EVM                             | EIP-6963 with multi-account support       |
| `coinbase`                | EVM                             | Coinbase Wallet                           |
| `phantom`                 | EVM, UTXO, Solana               |                                           |
| `ledger`                  | EVM, UTXO, Cosmos               | Hardware (WebUSB)                         |
| `keystore`                | EVM, UTXO, Cosmos, Solana, Tron | Encrypted keystore file                   |
| `ctrl`                    | EVM, UTXO, Cosmos, Solana       | CTRL/XDEFI                                |
| `keplr`                   | Cosmos                          |                                           |
| `trust`                   | EVM, UTXO, Cosmos, Solana       | Trust Wallet                              |
| `talisman`                | Substrate / EVM                 |                                           |
| `tronlink`                | Tron                            |                                           |
| `walletconnect`           | EVM (and others via WC v2)      | Requires `projectId` in `ConnectOptions`  |
| `vultisig`                | Multi-chain                     |                                           |
| `solflare`                | Solana, EVM                     |                                           |
| `shielded-zcash-keystore` | ZCash transparent + shielded    | See [Shielded ZCash](/sdk/zcash-shielded) |
| `hot-wallet`              | Multi-chain                     |                                           |
| `meteor`                  | NEAR                            |                                           |
| `okx`                     | EVM, UTXO, Solana               |                                           |
| `near`                    | NEAR                            | NEAR Wallet                               |
| `rabby`                   | EVM                             |                                           |

For type-safe lazy imports, use `leokit-sdk/wallets`:

```typescript theme={null}
import { MetaMaskAdapter, LedgerAdapter, KeplrAdapter } from "leokit-sdk/wallets";
```

## Ledger Deep-Dive

```typescript theme={null}
// 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:

```typescript theme={null}
// 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:

```typescript theme={null}
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>`:

```typescript theme={null}
sdk.on("walletChange", (e) => console.log(e.from, "→", e.to));
sdk.on("error", (err) => console.error(err));
```
