How to Add Ledger to CosmosKit
Prerequisites
- Connect your Ledger device via an USB cable and unlock it.
- Open the Cosmos app in Ledger, which shows
Cosmos Ready
in the screen.
Browser Support
This package uses the WebUSB (opens in a new tab) API to connect to Ledger devices.
We recommend using the latest version of Chrome and Chrome Android.
- https://developer.mozilla.org/en-US/docs/Web/API/USB/getDevices (opens in a new tab)
- https://developer.mozilla.org/en-US/docs/Web/API/USB/requestDevice (opens in a new tab)
Add @cosmos-kit/ledger
# npm
npm i @cosmos-kit/ledger
# pnpm
pnpm i @cosmos-kit/ledger
# yarn
yarn add @cosmos-kit/ledger
Import the wallets
import { wallets as ledger } from "@cosmos-kit/ledger";
Add to your provider
function MyCosmosApp({ Component, pageProps }: AppProps) {
return (
<ChainProvider
chains={chains}
assetLists={assets}
wallets={[...ledger]}
walletConnectOptions={...} // required if `wallets` contains mobile wallets
>
<Component {...pageProps} />
</ChainProvider>
);
}
export default MyCosmosApp;