Skip to content

Commit

Permalink
fix: WC check
Browse files Browse the repository at this point in the history
  • Loading branch information
isordo committed Oct 24, 2023
1 parent f26d7ae commit 90030f2
Showing 1 changed file with 18 additions and 8 deletions.
26 changes: 18 additions & 8 deletions packages/beacon-dapp/src/dapp-client/DAppClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1648,10 +1648,15 @@ export class DAppClient extends Client {
let pairingMissing,
sessionMissing = false

if (isLocalStorageAvailable()) {
const storage = new LocalStorage()
pairingMissing = ((await storage.get(StorageKey.WC_2_CORE_PAIRING)) ?? '[]') === '[]'
sessionMissing = ((await storage.get(StorageKey.WC_2_CLIENT_SESSION)) ?? '[]') === '[]'
if (transport instanceof WalletConnectTransport) {
if (isLocalStorageAvailable()) {
const storage = new LocalStorage()
pairingMissing = ((await storage.get(StorageKey.WC_2_CORE_PAIRING)) ?? '[]') === '[]'
sessionMissing = ((await storage.get(StorageKey.WC_2_CLIENT_SESSION)) ?? '[]') === '[]'
} else {
pairingMissing = !transport.pairings?.length
sessionMissing = !transport.sessions?.length
}
}

if (
Expand Down Expand Up @@ -1786,10 +1791,15 @@ export class DAppClient extends Client {
let pairingMissing,
sessionMissing = false

if (isLocalStorageAvailable()) {
const storage = new LocalStorage()
pairingMissing = ((await storage.get(StorageKey.WC_2_CORE_PAIRING)) ?? '[]') === '[]'
sessionMissing = ((await storage.get(StorageKey.WC_2_CLIENT_SESSION)) ?? '[]') === '[]'
if (transport instanceof WalletConnectTransport) {
if (isLocalStorageAvailable()) {
const storage = new LocalStorage()
pairingMissing = ((await storage.get(StorageKey.WC_2_CORE_PAIRING)) ?? '[]') === '[]'
sessionMissing = ((await storage.get(StorageKey.WC_2_CLIENT_SESSION)) ?? '[]') === '[]'
} else {
pairingMissing = !transport.pairings?.length
sessionMissing = !transport.sessions?.length
}
}

if (
Expand Down

0 comments on commit 90030f2

Please sign in to comment.