Function: KeaProvider()
function KeaProvider(props: Readonly<KeaProviderProps>): Element;
Defined in: KeaProvider.tsx:64
React context provider that initializes the KEA Wallet SDK and manages wallet state (connection, accounts, errors). Wrap your app (or the relevant subtree) with this component to enable the wallet hooks.
Parameters
| Parameter | Type | Description |
|---|---|---|
props | Readonly<KeaProviderProps> | Provider props including SDK config and children |
Returns
Element
Remarks
- Creates a BrowserSDK instance and calls
initialize()on mount. - The
configprop is read once on mount — changing it after the initial render has no effect. Unmount and remount the provider to reconfigure. - Subscribes to all SDK events (
connect,disconnect,error,lock,accountChanged) and updates React state accordingly. - Automatically cleans up on unmount: removes event listeners and calls
sdk.destroy().
Example
import { KeaProvider } from '@kea-wallet/react-sdk';
function App() {
return (
<KeaProvider config={{ rpcUrl: 'https://grpc-web.alphanet.thruput.org' }}>
<MyDApp />
</KeaProvider>
);
}
See
- useWallet — primary hook for wallet operations
- useAccounts — account-focused hook
- useKea — low-level context access
- BrowserSDKConfig — configuration options