fix: simplifies session deleted handling
This commit is contained in:
parent
bf553a2c2d
commit
3e53d08874
@ -82,12 +82,6 @@ export function ClientContextProvider({ children }: { children: ReactNode | Reac
|
|||||||
throw new Error("WalletConnect is not initialized");
|
throw new Error("WalletConnect is not initialized");
|
||||||
}
|
}
|
||||||
|
|
||||||
let _session = {} as SessionTypes.Settled;
|
|
||||||
|
|
||||||
if (_client.session.topics.length) {
|
|
||||||
_session = await _client.session.get(_client.session.topics[0]);
|
|
||||||
}
|
|
||||||
|
|
||||||
_client.on(CLIENT_EVENTS.pairing.proposal, async (proposal: PairingTypes.Proposal) => {
|
_client.on(CLIENT_EVENTS.pairing.proposal, async (proposal: PairingTypes.Proposal) => {
|
||||||
const { uri } = proposal.signal.params;
|
const { uri } = proposal.signal.params;
|
||||||
console.log("EVENT", "QR Code Modal open");
|
console.log("EVENT", "QR Code Modal open");
|
||||||
@ -100,8 +94,7 @@ export function ClientContextProvider({ children }: { children: ReactNode | Reac
|
|||||||
setPairings(_client.pairing.topics);
|
setPairings(_client.pairing.topics);
|
||||||
});
|
});
|
||||||
|
|
||||||
_client.on(CLIENT_EVENTS.session.deleted, (deletedSession: SessionTypes.Settled) => {
|
_client.on(CLIENT_EVENTS.session.deleted, () => {
|
||||||
if (deletedSession.topic !== _session?.topic) return;
|
|
||||||
console.log("EVENT", "session_deleted");
|
console.log("EVENT", "session_deleted");
|
||||||
resetApp();
|
resetApp();
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user