Skip to content

Commit

Permalink
chore: code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
dhruvkelawala committed May 18, 2022
1 parent e51f1f3 commit 548d791
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 58 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ export const ActionScreen: FC = () => {
)

case "REQUEST_CUSTOM_NETWORK":
// action.payload
return (
<AddNetworkScreen
requestedNetwork={action.payload}
Expand Down
59 changes: 2 additions & 57 deletions packages/extension/src/ui/features/actions/AddNetworkScreen.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import React, { FC, useState } from "react"
import { useNavigate } from "react-router-dom"
import { number } from "starknet"
import styled from "styled-components"

import { addNetworks } from "../../../background/customNetworks"
Expand All @@ -11,8 +10,6 @@ import { Header } from "../../components/Header"
import { InputText } from "../../components/InputText"
import { FormError, H2 } from "../../components/Typography"
import { routes } from "../../routes"
import { isValidAddress } from "../../services/addresses"
import { TokenDetails } from "../accountTokens/tokens.state"

const AddTokenScreenWrapper = styled.div`
display: flex;
Expand Down Expand Up @@ -48,54 +45,6 @@ export const AddNetworkScreen: FC<AddNetworkScreenProps> = ({

const [error, setError] = useState("")

// const validAddress = useMemo(() => {
// return isValidAddress(networkChainId)
// }, [networkChainId])

// useEffect(() => {
// if (
// requestedNetwork &&
// requestedNetwork.chainId === networkChainId &&
// !tokenDetails
// ) {
// setLoading(true)
// }
// }, [requestedNetwork, networkChainId, tokenDetails])

// useEffect(() => {
// if (account) {
// if (loading && account) {
// fetchTokenDetails(networkChainId, account)
// .then((details) => {
// setTokenDetails(details)
// })
// .catch(() => {
// setTokenDetails(undefined)
// })
// .finally(() => {
// setLoading(false)
// })
// } else if (
// isValidAddress(networkChainId) &&
// networkChainId !== prevValidAddress.current
// ) {
// prevValidAddress.current = networkChainId
// setLoading(true)
// }
// }
// }, [loading, networkChainId, account])

// const compiledData = {
// address: networkChainId,
// ...(tokenDetails ?? {}),
// ...(!tokenDetails?.name && { name: networkName }),
// ...(!tokenDetails?.symbol && { symbol: networkBaseUrl }),
// ...(!tokenDetails?.decimals && {
// decimals: BigNumber.from(networkExplorerUrl || "0"),
// }),
// networkId: switcherNetworkId,
// }

return (
<>
<Header hide={hideBackButton}>
Expand All @@ -110,14 +59,10 @@ export const AddNetworkScreen: FC<AddNetworkScreenProps> = ({
e.preventDefault()
if (requestedNetwork) {
try {
const networks = addNetworks(requestedNetwork)
console.log(
"🚀 ~ file: AddNetworkScreen.tsx ~ line 139 ~ networks",
networks,
)
addNetworks(requestedNetwork)
onSubmit?.()
navigate(routes.settingsNetworks())
} catch (e) {
} catch {
setError("Network already exists")
}
}
Expand Down

0 comments on commit 548d791

Please sign in to comment.