Skip to main content

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

ParameterTypeDescription
propsReadonly<KeaProviderProps>Provider props including SDK config and children

Returns

Element

Remarks

  • Creates a BrowserSDK instance and calls initialize() on mount.
  • The config prop 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