Nostr Events
The OneKey provider emits accountChanged without a payload. Clear cached account state when this event fires, then retrieve the current public key when needed. It also emits disconnect when the bridge disconnects. These are OneKey extensions to NIP-07.
const provider = window.$onekey?.nostr;
if (!provider) throw new Error('OneKey Nostr provider is unavailable.');
const onAccountChanged = () => {
// Clear the cached public key and any account-specific UI.
};
provider.on('accountChanged', onAccountChanged);
// Run during cleanup.
provider.off('accountChanged', onAccountChanged);Last updated on