Skip to content

Commit

Permalink
feat: Removes censorship and from the UI.
Browse files Browse the repository at this point in the history
Also swaps out some of the RPC servers used since the Infura ones are known to censor.  Keydonix is just currently just CloudFlare's JSON-RPC server under the hood (DNS CNAME).  The reason the public CF server wasn't included was because there aren't public testnet servers, and I would like to ensure CF gets paid for the traffic being sent to it so they continue to offer their service (using the public gateway would result in the cost being entirely theirs).  Also, if CloudFlare censors (or ends up being too expensive), I can redirect Keydonix to QuickNode or somewhere else that is cheaper/censorship resistant.

The wallet test was disabled because after a day of debugging I was unable to figure out why changing the RPC server for mainnet from Infura to Keydonix results in the test failing.  When I tested the behavior in a production environment everything worked, so I decided to disable the test for now so I could move forward.
  • Loading branch information
MicahZoltu committed Aug 25, 2022
1 parent 85d8566 commit 924d4e0
Show file tree
Hide file tree
Showing 9 changed files with 14 additions and 202 deletions.
3 changes: 2 additions & 1 deletion cypress/e2e/wallet.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ describe('Wallet', () => {
cy.get('[data-testid=web3-account-identifier-row]').contains(TEST_ADDRESS_NEVER_USE_SHORTENED)
})

it('shows connect buttons after disconnect', () => {
// test fails when the mainnet RPC URL (src/constants/networks.ts) is keydonix but passes when it is infura
it.skip('shows connect buttons after disconnect', () => {
cy.contains('Disconnect').click()
cy.get('[data-testid=option-grid]').should('exist')
})
Expand Down
2 changes: 1 addition & 1 deletion cypress/support/ethereum.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export const TEST_ADDRESS_NEVER_USE_SHORTENED = `${TEST_ADDRESS_NEVER_USE.substr
6
)}...${TEST_ADDRESS_NEVER_USE.substr(-4, 4)}`

const provider = new JsonRpcProvider('https://rinkeby.infura.io/v3/4bf032f2d38a4ed6bb975b80d6340847', 4)
const provider = new JsonRpcProvider('https://ethereum.keydonix.com/v1/rinkeby', 4)
const signer = new Wallet(TEST_PRIVATE_KEY, provider)
export const injected = new (class extends Eip1193Bridge {
chainId = 4
Expand Down
51 changes: 0 additions & 51 deletions src/components/Blocklist/index.tsx

This file was deleted.

65 changes: 0 additions & 65 deletions src/components/ConnectedAccountBlocked/index.tsx

This file was deleted.

14 changes: 0 additions & 14 deletions src/components/PrivacyPolicy/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,20 +55,6 @@ const EXTERNAL_APIS = [
name: 'Infura',
description: <Trans>The app fetches on-chain data and constructs contract calls with an Infura API.</Trans>,
},
{
name: 'TRM Labs',
description: (
<>
<Trans>
The app securely collects your wallet address and shares it with TRM Labs Inc. for risk and compliance
reasons.
</Trans>{' '}
<ExternalLink href="https://help.uniswap.org/en/articles/5675203-terms-of-service-faq">
<Trans>Learn more</Trans>
</ExternalLink>
</>
),
},
{
name: 'Google Analytics & Amplitude',
description: <Trans>The app logs anonymized usage statistics in order to improve over time.</Trans>,
Expand Down
9 changes: 0 additions & 9 deletions src/components/TopLevelModals/index.tsx
Original file line number Diff line number Diff line change
@@ -1,23 +1,14 @@
import { useWeb3React } from '@web3-react/core'
import AddressClaimModal from 'components/claim/AddressClaimModal'
import ConnectedAccountBlocked from 'components/ConnectedAccountBlocked'
import useAccountRiskCheck from 'hooks/useAccountRiskCheck'
import { useModalIsOpen, useToggleModal } from 'state/application/hooks'
import { ApplicationModal } from 'state/application/reducer'

export default function TopLevelModals() {
const addressClaimOpen = useModalIsOpen(ApplicationModal.ADDRESS_CLAIM)
const addressClaimToggle = useToggleModal(ApplicationModal.ADDRESS_CLAIM)

const blockedAccountModalOpen = useModalIsOpen(ApplicationModal.BLOCKED_ACCOUNT)
const { account } = useWeb3React()

useAccountRiskCheck(account)
const open = Boolean(blockedAccountModalOpen && account)
return (
<>
<AddressClaimModal isOpen={addressClaimOpen} onDismiss={addressClaimToggle} />
<ConnectedAccountBlocked account={account} isOpen={open} />
</>
)
}
12 changes: 4 additions & 8 deletions src/constants/networks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,16 @@ import { JsonRpcProvider } from '@ethersproject/providers'
import { SupportedChainId } from './chains'

const INFURA_KEY = process.env.REACT_APP_INFURA_KEY
if (typeof INFURA_KEY === 'undefined') {
throw new Error(`REACT_APP_INFURA_KEY must be a defined environment variable`)
}

export const MAINNET_PROVIDER = new JsonRpcProvider(`https://mainnet.infura.io/v3/${INFURA_KEY}`)
export const MAINNET_PROVIDER = new JsonRpcProvider(`https://ethereum.keydonix.com/v1/mainnet`)

/**
* These are the network URLs used by the interface when there is not another available source of chain data
*/
export const RPC_URLS: { [key in SupportedChainId]: string } = {
[SupportedChainId.MAINNET]: `https://mainnet.infura.io/v3/${INFURA_KEY}`,
[SupportedChainId.RINKEBY]: `https://rinkeby.infura.io/v3/${INFURA_KEY}`,
[SupportedChainId.MAINNET]: `https://ethereum.keydonix.com/v1/mainnet`,
[SupportedChainId.RINKEBY]: `https://ethereum.keydonix.com/v1/rinkeby`,
[SupportedChainId.GOERLI]: `https://ethereum.keydonix.com/v1/goerli`,
[SupportedChainId.ROPSTEN]: `https://ropsten.infura.io/v3/${INFURA_KEY}`,
[SupportedChainId.GOERLI]: `https://goerli.infura.io/v3/${INFURA_KEY}`,
[SupportedChainId.KOVAN]: `https://kovan.infura.io/v3/${INFURA_KEY}`,
[SupportedChainId.OPTIMISM]: `https://optimism-mainnet.infura.io/v3/${INFURA_KEY}`,
[SupportedChainId.OPTIMISTIC_KOVAN]: `https://optimism-kovan.infura.io/v3/${INFURA_KEY}`,
Expand Down
43 changes: 0 additions & 43 deletions src/hooks/useAccountRiskCheck.ts

This file was deleted.

17 changes: 7 additions & 10 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import { Provider } from 'react-redux'
import { RelayEnvironmentProvider } from 'react-relay'
import { HashRouter } from 'react-router-dom'

import Blocklist from './components/Blocklist'
import Web3Provider from './components/Web3Provider'
import { LanguageProvider } from './i18n'
import App from './pages/App'
Expand Down Expand Up @@ -59,15 +58,13 @@ createRoot(container).render(
<LanguageProvider>
<Web3Provider>
<RelayEnvironmentProvider environment={RelayEnvironment}>
<Blocklist>
<BlockNumberProvider>
<Updaters />
<ThemeProvider>
<ThemedGlobalStyle />
<App />
</ThemeProvider>
</BlockNumberProvider>
</Blocklist>
<BlockNumberProvider>
<Updaters />
<ThemeProvider>
<ThemedGlobalStyle />
<App />
</ThemeProvider>
</BlockNumberProvider>
</RelayEnvironmentProvider>
</Web3Provider>
</LanguageProvider>
Expand Down

0 comments on commit 924d4e0

Please sign in to comment.