Nostr 事件
OneKey provider 发出的 accountChanged 事件不携带参数。收到事件后,应清除缓存的账户状态,并在需要时重新获取当前公钥。通信桥断开时,还会发出 disconnect。这些事件是 OneKey 对 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);最后更新于