forked from Uniswap/interface
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
merge beta to production (Uniswap#317)
* 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
1 parent
45a66d3
commit b7f4967
Showing
81 changed files
with
3,020 additions
and
5,091 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,4 +11,3 @@ install: yarn | |
script: | ||
- yarn check:all | ||
- yarn build | ||
- yarn test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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] | ||
}) | ||
} | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.