@kea-wallet/browser-sdk
Browser SDK for KEA Wallet — wraps the embedded provider with ThruClient RPC and automatic dApp metadata resolution.
Installation
npm install @kea-wallet/browser-sdk
Quick Start
import { BrowserSDK } from '@kea-wallet/browser-sdk';
const sdk = new BrowserSDK();
const { accounts } = await sdk.connect();
console.log('Connected:', accounts[0].address);
Key Concepts
- Automatic initialization — BrowserSDK.connect creates the wallet iframe on demand; call BrowserSDK.initialize explicitly only to pre-load.
- Event-driven — subscribe to
'connect','disconnect','accountChanged','lock', and'error'events via BrowserSDK.on. - gRPC-web RPC — access the Thru blockchain directly via BrowserSDK.getThru without requiring a connected wallet.
- Metadata auto-resolution —
appNameandappUrlare derived fromwindow.locationunless explicitly set in ConnectOptions.metadata.
See
- BrowserSDK — main entry-point class
- BrowserSDKConfig — configuration options
- SDKEventPayloads — per-event payload types
Lifecycle
| Class | Description |
|---|---|
| BrowserSDK | High-level browser SDK for KEA Wallet integration. |
Other
ErrorCode
Renames and re-exports ConnectResult
IThruChain
Renames and re-exports ConnectResult
WalletAccount
Renames and re-exports ConnectResult