chore: cleanup

This commit is contained in:
Ben Kremer 2022-02-14 13:49:27 +01:00
parent 6a23ad8a0a
commit 623c44e4c2
3 changed files with 2 additions and 62 deletions

View File

@ -193,13 +193,7 @@ export default function App() {
<Toggle active={isTestnet} onClick={toggleTestnets} />
</SToggleContainer>
{chainOptions.map(chainId => (
<Blockchain
key={chainId}
chainId={chainId}
chainData={chainData}
onClick={onEnable}
// active={chains.includes(chainId)}
/>
<Blockchain key={chainId} chainId={chainId} chainData={chainData} onClick={onEnable} />
))}
{/* <SConnectButton left onClick={onEnable} disabled={!chains.length}>
{"Connect"}

View File

@ -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";

View File

@ -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<string[]>([]);
const [session, setSession] = useState<SessionTypes.Created>();
const [ethereumProvider, setEthereumProvider] = useState<EthereumProvider>();
const [web3Provider, setWeb3Provider] = useState<providers.Web3Provider>();
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();