From f819161934d6c8b57033af3b5306e6219261c167 Mon Sep 17 00:00:00 2001 From: Ben Kremer Date: Fri, 4 Feb 2022 15:28:34 +0100 Subject: [PATCH] chore: removes unused `uri` state --- dapps/react-dapp-v2/src/HooksApp.tsx | 70 ++++++++++++++-------------- 1 file changed, 34 insertions(+), 36 deletions(-) diff --git a/dapps/react-dapp-v2/src/HooksApp.tsx b/dapps/react-dapp-v2/src/HooksApp.tsx index 7e6e97a..2e08626 100644 --- a/dapps/react-dapp-v2/src/HooksApp.tsx +++ b/dapps/react-dapp-v2/src/HooksApp.tsx @@ -68,7 +68,6 @@ export default function App() { const [modal, setModal] = useState(""); const [client, setClient] = useState(); - const [uri, setUri] = useState(""); const [session, setSession] = useState(); const [accounts, setAccounts] = useState([]); const [pairings, setPairings] = useState([]); @@ -122,7 +121,6 @@ export default function App() { _client.on(CLIENT_EVENTS.pairing.proposal, async (proposal: PairingTypes.Proposal) => { const { uri } = proposal.signal.params; - setUri(uri); console.log("EVENT", "QR Code Modal open"); QRCodeModal.open(uri, () => { console.log("EVENT", "QR Code Modal closed"); @@ -247,40 +245,6 @@ export default function App() { await getAccountBalances(accounts); }; - const ping = async () => { - if (typeof client === "undefined") { - throw new Error("WalletConnect is not initialized"); - } - if (typeof session === "undefined") { - throw new Error("Session is not connected"); - } - - try { - setPending(true); - openPingModal(); - - let valid = false; - - try { - await client.session.ping(session.topic); - valid = true; - } catch (e) { - valid = false; - } - - // display result - setResult({ - method: "ping", - valid, - }); - } catch (e) { - console.error(e); - setResult(null); - } finally { - setPending(false); - } - }; - const getAccountBalances = async (_accounts: string[]) => { setFetching(true); try { @@ -348,6 +312,40 @@ export default function App() { } }; + const ping = async () => { + if (typeof client === "undefined") { + throw new Error("WalletConnect is not initialized"); + } + if (typeof session === "undefined") { + throw new Error("Session is not connected"); + } + + try { + setPending(true); + openPingModal(); + + let valid = false; + + try { + await client.session.ping(session.topic); + valid = true; + } catch (e) { + valid = false; + } + + // display result + setResult({ + method: "ping", + valid, + }); + } catch (e) { + console.error(e); + setResult(null); + } finally { + setPending(false); + } + }; + const testSendTransaction = createJsonRpcRequestHandler(async (chainId: string) => { // get ethereum address const account = accounts.find(account => account.startsWith(chainId));