Skip to content

Commit

Permalink
merge beta to production (Uniswap#317)
Browse files Browse the repository at this point in the history
* update SNX exchange and token address (Uniswap#301)

* update SNX exchange and token address

* checksum exchange address

* Account improvements (Uniswap#302)

* begin account migration

* prep for styling

* improve multi-network support

allow deprecated window.web3 providers

* kill old modal

* remove tests

* clean up css

* Style account modal

* kill scss

* bug fixes

* use suspense for code-splitting and i18n

move abis

add ENS support to Web3Status

* Account modal mobile styles

* style tweaks

* finalize migration

* fix account styling

* fix ethereum svg

* fixes

* Split wallet modal into components

* refactor wallet modal and add connect button styles

* removing tap highlights

fix spacing on some mobile browsers

* Styling fixes for account and warning

* clean up injected connector logic

* remove console

* add wrong network copy

* restore border radius

change wallet logo

* various improvements (Uniswap#313)

* add unchecked signer

* remove focus underline from tabs

* update tokens

* remove console log

* remove snx for now

* make slippage warnings more robust

* memo-ize contexts

* improve slippage styling

* fix warnings + bugs

* clear stale network error

* Feather icons (Uniswap#314)

* Remove fontawesome

* Update new SNX exchange and new token address (Uniswap#316)

* Update new SNX exchange and new token address

* remove whitespace

* checksum exchange address
  • Loading branch information
NoahZinsmeister authored May 30, 2019
1 parent 45a66d3 commit b7f4967
Show file tree
Hide file tree
Showing 81 changed files with 3,020 additions and 5,091 deletions.
1 change: 0 additions & 1 deletion .env.example → .env.local.example
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
REACT_APP_NETWORK_ID="1"
REACT_APP_NETWORK_URL=""
REACT_APP_NETWORK_NAME="Main Ethereum Network"
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,3 @@ install: yarn
script:
- yarn check:all
- yarn build
- yarn test
6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,15 @@ yarn

### Configure Environment

Rename `.env.example` to `.env` and fill in the appropriate variables.
Rename `.env.local.example` to `.env.local` and fill in the appropriate variables.

### Run

```bash
yarn start
# or
yarn start:rinkeby
```

More robust support for other testnets is in the works!
To run on a testnet, simply update the `.env.local` file appropriately.

## Contributions

Expand Down
15 changes: 7 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,32 +5,31 @@
"homepage": ".",
"private": true,
"dependencies": {
"@reach/dialog": "^0.2.8",
"@reach/tooltip": "^0.2.0",
"classnames": "^2.2.6",
"copy-to-clipboard": "^3.2.0",
"escape-string-regexp": "^2.0.0",
"ethers": "^4.0.27",
"ethers": "^4.0.28",
"i18next": "^15.0.9",
"i18next-browser-languagedetector": "^3.0.1",
"i18next-xhr-backend": "^2.0.1",
"jazzicon": "^1.5.0",
"node-sass": "^4.11.0",
"polished": "^3.3.2",
"react": "^16.8.6",
"react-aria-modal": "^4.0.0",
"react-device-detect": "^1.6.2",
"react-dom": "^16.8.6",
"react-feather": "^1.1.6",
"react-ga": "^2.5.7",
"react-i18next": "^10.7.0",
"react-router-dom": "^5.0.0",
"react-scripts": "^3.0.1",
"react-transition-group": "1.x",
"react-spring": "^8.0.20",
"styled-components": "^4.2.0",
"ua-parser-js": "^0.7.18",
"web3-react": "^5.0.4"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"start:rinkeby": "REACT_APP_NETWORK_ID=4 REACT_APP_NETWORK_NAME='Rinkeby Test Network' yarn start",
"build:rinkeby": "REACT_APP_NETWORK_ID=4 REACT_APP_NETWORK_NAME='Rinkeby Test Network' yarn build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject",
"lint:base": "yarn eslint './src/**/*.{js,jsx}'",
Expand Down
Binary file modified public/favicon.ico
Binary file not shown.
7 changes: 3 additions & 4 deletions public/index.html
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<!DOCTYPE html>
<!DOCTYPE html />
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<!--
manifest.json provides metadata used when your web app is installed on a
Expand All @@ -23,8 +23,7 @@
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<div id="modal-root"></div>
<div id="root" />
<!--
This HTML file is a template.
If you open it directly in the browser, you will see an empty page.
Expand Down
67 changes: 0 additions & 67 deletions public/libraries/qr-scanner/qr-scanner-worker.min.js

This file was deleted.

4 changes: 4 additions & 0 deletions public/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
"installMetamask": "Please visit us after installing Metamask on Chrome or Brave.",
"disconnected": "Disconnected",
"swap": "Swap",
"swapAnyway": "Swap Anyway",
"send": "Send",
"sendAnyway": "Send Anyway",
"pool": "Pool",
"betaWarning": "This project is in beta. Use at your own risk.",
"input": "Input",
Expand All @@ -19,6 +21,7 @@
"searchOrPaste": "Search Token or Paste Address",
"noExchange": "No Exchange Found",
"exchangeRate": "Exchange Rate",
"unknownError": "Oops! An unknown error occurred. Please refresh the page, or visit from another browser or device.",
"enterValueCont": "Enter a {{ missingCurrencyValue }} value to continue.",
"selectTokenCont": "Select a token to continue.",
"noLiquidity": "No liquidity.",
Expand All @@ -27,6 +30,7 @@
"transactionDetails": "Transaction Details",
"hideDetails": "Hide Details",
"slippageWarning": "Slippage Warning",
"highSlippageWarning": "High Slippage Warning",
"youAreSelling": "You are selling",
"orTransFail": "or the transaction will fail.",
"youWillReceive": "You will receive at least",
Expand Down
100 changes: 100 additions & 0 deletions src/InjectedConnector.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
import { Connectors } from 'web3-react'
const { Connector, ErrorCodeMixin } = Connectors

const InjectedConnectorErrorCodes = ['ETHEREUM_ACCESS_DENIED', 'NO_WEB3', 'UNLOCK_REQUIRED']
export default class InjectedConnector extends ErrorCodeMixin(Connector, InjectedConnectorErrorCodes) {
constructor(args = {}) {
super(args)
this.runOnDeactivation = []

this.networkChangedHandler = this.networkChangedHandler.bind(this)
this.accountsChangedHandler = this.accountsChangedHandler.bind(this)

const { ethereum } = window
if (ethereum && ethereum.isMetaMask) {
ethereum.autoRefreshOnNetworkChange = false
}
}

async onActivation() {
const { ethereum, web3 } = window

if (ethereum) {
await ethereum.enable().catch(error => {
const deniedAccessError = Error(error)
deniedAccessError.code = InjectedConnector.errorCodes.ETHEREUM_ACCESS_DENIED
throw deniedAccessError
})

// initialize event listeners
if (ethereum.on) {
ethereum.on('networkChanged', this.networkChangedHandler)
ethereum.on('accountsChanged', this.accountsChangedHandler)

this.runOnDeactivation.push(() => {
if (ethereum.removeListener) {
ethereum.removeListener('networkChanged', this.networkChangedHandler)
ethereum.removeListener('accountsChanged', this.accountsChangedHandler)
}
})
}
} else if (web3) {
console.warn('Your web3 provider is outdated, please upgrade to a modern provider.')
} else {
const noWeb3Error = Error('Your browser is not equipped with web3 capabilities.')
noWeb3Error.code = InjectedConnector.errorCodes.NO_WEB3
throw noWeb3Error
}
}

async getProvider() {
const { ethereum, web3 } = window
return ethereum || web3.currentProvider
}

async getAccount(provider) {
const account = await super.getAccount(provider)

if (account === null) {
const unlockRequiredError = Error('Ethereum account locked.')
unlockRequiredError.code = InjectedConnector.errorCodes.UNLOCK_REQUIRED
throw unlockRequiredError
}

return account
}

onDeactivation() {
this.runOnDeactivation.forEach(runner => runner())
this.runOnDeactivation = []
}

// event handlers
networkChangedHandler(networkId) {
const networkIdNumber = Number(networkId)

try {
super._validateNetworkId(networkIdNumber)

super._web3ReactUpdateHandler({
updateNetworkId: true,
networkId: networkIdNumber
})
} catch (error) {
super._web3ReactErrorHandler(error)
}
}

accountsChangedHandler(accounts) {
if (!accounts[0]) {
const unlockRequiredError = Error('Ethereum account locked.')
unlockRequiredError.code = InjectedConnector.errorCodes.UNLOCK_REQUIRED
super._web3ReactErrorHandler(unlockRequiredError)
} else {
super._web3ReactUpdateHandler({
updateAccount: true,
account: accounts[0]
})
}
}
}
24 changes: 0 additions & 24 deletions src/assets/images/brave-logo.svg

This file was deleted.

3 changes: 3 additions & 0 deletions src/assets/images/circle.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed src/assets/images/coinbase-wallet-logo.png
Binary file not shown.
19 changes: 11 additions & 8 deletions src/assets/images/ethereum-logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed src/assets/images/generic-token-logo.png
Binary file not shown.
Binary file removed src/assets/images/logo.png
Binary file not shown.
60 changes: 0 additions & 60 deletions src/assets/images/metamask-logo.svg

This file was deleted.

3 changes: 0 additions & 3 deletions src/assets/images/pending.svg

This file was deleted.

3 changes: 0 additions & 3 deletions src/assets/images/qr-code.svg

This file was deleted.

17 changes: 17 additions & 0 deletions src/assets/images/spinner.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit b7f4967

Please sign in to comment.