Installation

Install starknet-tokenkit and configure it in your project

npm version npm downloads

Install the package

Pick your package manager. styled-components is a peer dependency — install both.

Peer dependencies

react, react-dom, and styled-components are peer dependencies. The SDK is tested with React 19 and Next.js; React 18 also works.

Code
bash
1npm install react react-dom styled-components
Info
You do not need `starknet.js` for the SDK to work. The SDK pulls token data from TokenKit's API, not from a Starknet RPC. When you want to send transactions, pair the SDK with `starknet-react` or `get-starknet`.

Configure via TokenKitWrapper

The SDK has no configure(...) call — configuration lives on the TokenKitWrapper component. Mount it once near your app root.

Code
tsx
1import { TokenKitWrapper, themes } from 'starknet-tokenkit';
2 
3export default function App({ children }) {
4 return (
5 <TokenKitWrapper
6 network="SN_MAIN"
7 apiKey={process.env.NEXT_PUBLIC_TOKENKIT_API_KEY!}
8 mainnetEndpoint="https://api.tokenkithq.io"
9 sepoliaEndpoint="https://api.sepolia.tokenkithq.io"
10 themeObject={themes.dark}
11 options={{ tokensToLoad: 'public', enableRecent: true }}
12 >
13 {children}
14 </TokenKitWrapper>
15 );
16}
PropTypeNotes
network'SN_MAIN' | 'SN_SEPOLIA'Which Starknet chain to query against.
apiKeystringYour TokenKit API key. See API Keys.
mainnetEndpointstringBase URL for the mainnet API (typically https://api.tokenkithq.io).
sepoliaEndpointstringBase URL for the sepolia API.
themeObjectThemeA theme preset (themes.dark, themes.lavender, ...) or your own. See Themes.
optionsTokenKitOptionsOptional. { tokensToLoad?: 'all' | 'public', enableRecent?: boolean }. Defaults: 'public', false.
originstringOptional. Sent as X-Origin on API requests — useful for browser-extension wallets (e.g. 'chrome-extension://<id>').
Tip
If you manage your own `ThemeProvider` already, use `TokenKitProvider` instead of `TokenKitWrapper` — it has identical props minus `themeObject`, and skips re-wrapping in styled-components.

TypeScript

Types are bundled. No @types/... to install.

Code
tsx
1import type { IToken, Theme, TokenKitOptions } from 'starknet-tokenkit';

Verify it works

Drop a SelectTokenModal inside the wrapper, run dev, and click the trigger. You should see USDC, USDT, ETH, STRK, and friends.

Code
tsx
1import { useState } from 'react';
2import { SelectTokenModal, type IToken } from 'starknet-tokenkit';
3 
4export default function VerifyToken() {
5 const [selected, setSelected] = useState<IToken | null>(null);
6 return (
7 <SelectTokenModal selectedToken={selected} callBackFunc={setSelected}>
8 <button>{selected?.symbol ?? 'Open picker'}</button>
9 </SelectTokenModal>
10 );
11}

If the list is empty:

  • Confirm the wrapper's apiKey is valid (no Authorization: Bearer is used — the SDK sends api-key and optional X-Origin)
  • Check the browser console for CORS errors — your origin must be allow-listed for that API key

See also