Skip to main content

Connected wallets

All of them are observable (MobX). Type guards narrow a wallet: kit.isEvmWallet(w), kit.isNearWallet(w), kit.isSolanaWallet(w), kit.isTonWallet(w), kit.isStellarWallet(w), kit.isCosmosWallet(w). Every wallet extends OmniWallet:

Connect and disconnect

Events, each returns an unsubscribe function:

Balances

Balances come straight from each chain: for every token of the kit’s list on that chain (the whitelist) and the native coin, the wallet asks the chain’s RPC (see Endpoints). Solana, TON, Stellar, XRP and Sui read all their tokens in one or two calls (Solana and TON then keep the listed ones). No balance API is involved, unless you opt into the hex-api indexer (indexer: { baseUrl: "https://hex-api.app/wallet", balances: "proxy" }) or pass your own BalanceIndexer. HEX (NEAR Intents) balances are read from the intents.near contract. Token carries the metadata: symbol, decimals, chain, address, usd, icon, and helpers like token.int(1.5) (to base units) and token.float(raw). Look tokens up with tokens.get(id, chain) and await tokens.getToken(chain, address) from @hot-labs/kit/core.

Deposit and withdraw (UI)

Both open the Bridge popup preset for that operation. For a headless flow use kit.exchange.reviewSwap(request) and kit.exchange.makeSwap(review).

Server-side wallets

NearWallet.fromPrivateKey(privateKey, accountId) from @hot-labs/kit/near creates a NEAR signer from a raw ed25519 key, without a browser. It signs intents and NEAR transactions.