From 623c44e4c2f401eeb00e51016d2280741cb636f5 Mon Sep 17 00:00:00 2001 From: Ben Kremer Date: Mon, 14 Feb 2022 13:49:27 +0100 Subject: [PATCH] chore: cleanup --- dapps/react-dapp-v2-with-ethers/src/App.tsx | 8 +-- .../src/components/Header.tsx | 1 - .../src/contexts/ClientContext.tsx | 55 +------------------ 3 files changed, 2 insertions(+), 62 deletions(-) diff --git a/dapps/react-dapp-v2-with-ethers/src/App.tsx b/dapps/react-dapp-v2-with-ethers/src/App.tsx index 24383e8..187b00e 100644 --- a/dapps/react-dapp-v2-with-ethers/src/App.tsx +++ b/dapps/react-dapp-v2-with-ethers/src/App.tsx @@ -193,13 +193,7 @@ export default function App() { {chainOptions.map(chainId => ( - + ))} {/* {"Connect"} diff --git a/dapps/react-dapp-v2-with-ethers/src/components/Header.tsx b/dapps/react-dapp-v2-with-ethers/src/components/Header.tsx index e65cd44..5942c2f 100644 --- a/dapps/react-dapp-v2-with-ethers/src/components/Header.tsx +++ b/dapps/react-dapp-v2-with-ethers/src/components/Header.tsx @@ -1,6 +1,5 @@ import * as React from "react"; import styled from "styled-components"; -import { SessionTypes } from "@walletconnect/types"; import { fonts, responsive } from "../styles"; import Button from "./Button"; diff --git a/dapps/react-dapp-v2-with-ethers/src/contexts/ClientContext.tsx b/dapps/react-dapp-v2-with-ethers/src/contexts/ClientContext.tsx index 046f9b5..aa45946 100644 --- a/dapps/react-dapp-v2-with-ethers/src/contexts/ClientContext.tsx +++ b/dapps/react-dapp-v2-with-ethers/src/contexts/ClientContext.tsx @@ -10,13 +10,7 @@ import { useMemo, useState, } from "react"; -import { - DEFAULT_APP_METADATA, - DEFAULT_EIP155_METHODS, - DEFAULT_LOGGER, - DEFAULT_PROJECT_ID, - DEFAULT_RELAY_URL, -} from "../constants"; +import { DEFAULT_LOGGER, DEFAULT_PROJECT_ID, DEFAULT_RELAY_URL } from "../constants"; import { ERROR } from "@walletconnect/utils"; import EthereumProvider from "@walletconnect/ethereum-provider"; import { providers, utils } from "ethers"; @@ -52,7 +46,6 @@ export function ClientContextProvider({ children }: { children: ReactNode | Reac const [pairings, setPairings] = useState([]); const [session, setSession] = useState(); - const [ethereumProvider, setEthereumProvider] = useState(); const [web3Provider, setWeb3Provider] = useState(); const [isFetchingBalances, setIsFetchingBalances] = useState(false); @@ -157,51 +150,6 @@ export function ClientContextProvider({ children }: { children: ReactNode | Reac } }, [client, createClient]); - // useEffect(() => { - // const init = async () => { - // if (!client) return; - - // // Create WalletConnect Provider - // const ethereumProvider = new EthereumProvider({ - // chainId: 42, - // rpc: { - // infuraId: "5dc0df7abe4645dfb06a9a8c39ede422", - // }, - // // FIXME: `signer-connection` sub-dep is already specifying beta.23 -> typings mismatch. - // // @ts-ignore - // client, - // }); - // const web3Provider = new providers.Web3Provider(ethereumProvider); - - // setEthereumProvider(ethereumProvider); - // setWeb3Provider(web3Provider); - - // // Enable session (triggers QR Code modal if we bound the listener on `client` for it). - // // const accounts = await ethereumProvider.enable(); - // // console.log("accounts:", accounts); - - // // const provider = new providers.Web3Provider(ethereumProvider); - - // // console.log(provider); - // // console.log(await provider.listAccounts()); - // // console.log(await provider.getNetwork()); - // // console.log(provider.getSigner()); - // // console.log(await provider.getBalance(accounts[0])); - - // // const TEST_ETH_TRANSFER = { - // // from: accounts[0], - // // to: accounts[0], - // // value: utils.parseEther("1").toHexString(), - // // data: "0x", - // // }; - - // // const signer = provider.getSigner(); - // // const transferTx = await signer.sendTransaction(TEST_ETH_TRANSFER); - // }; - - // init(); - // }, [client]); - const onEnable = useCallback( async (caipChainId: string) => { if (!client) { @@ -226,7 +174,6 @@ export function ClientContextProvider({ children }: { children: ReactNode | Reac console.log(ethereumProvider); - setEthereumProvider(ethereumProvider); setWeb3Provider(web3Provider); const accounts = await ethereumProvider.enable();