diff --git a/dapps/react-dapp-v2/src/App.tsx b/dapps/react-dapp-v2/src/App.tsx index c4b95c1..53bf16b 100644 --- a/dapps/react-dapp-v2/src/App.tsx +++ b/dapps/react-dapp-v2/src/App.tsx @@ -43,6 +43,7 @@ export default function App() { // Initialize the WalletConnect client. const { client, + pairings, session, connect, disconnect, @@ -80,7 +81,7 @@ export default function App() { throw new Error("WalletConnect is not initialized"); } // Suggest existing pairings (if any). - if (client.pairing.values.length) { + if (pairings.length) { openPairingModal(); } else { // If no existing pairings are available, trigger `WalletConnectClient.connect`. @@ -190,7 +191,7 @@ export default function App() { if (typeof client === "undefined") { throw new Error("WalletConnect is not initialized"); } - return ; + return ; case "request": return ; case "ping": diff --git a/dapps/react-dapp-v2/src/contexts/ClientContext.tsx b/dapps/react-dapp-v2/src/contexts/ClientContext.tsx index 634091e..16e8d51 100644 --- a/dapps/react-dapp-v2/src/contexts/ClientContext.tsx +++ b/dapps/react-dapp-v2/src/contexts/ClientContext.tsx @@ -63,7 +63,6 @@ export function ClientContextProvider({ children }: { children: ReactNode | Reac const [chains, setChains] = useState([]); const reset = () => { - setPairings([]); setSession(undefined); setBalances({}); setAccounts([]); @@ -194,8 +193,8 @@ export function ClientContextProvider({ children }: { children: ReactNode | Reac throw new Error("WalletConnect is not initialized"); } // populates existing pairings to state - setPairings(_client.pairing.values); - console.log("RESTORED PAIRINGS: ", _client.pairing.values); + setPairings(_client.pairing.getAll({ active: true })); + console.log("RESTORED PAIRINGS: ", _client.pairing.getAll({ active: true })); if (typeof session !== "undefined") return; // populates (the last) existing session to state