From e80d0a68a9a34b68b817417138131520efe85ab2 Mon Sep 17 00:00:00 2001 From: William O'Beirne Date: Tue, 19 Sep 2017 20:47:08 -0400 Subject: [PATCH] All v3 Nodes & Networks (#202) * Add all v3s nodes, create node libs for etherscan and infura. * Add all network configs for alternatives. * Color and animate nav border on network selection. * Address PR comments. * Persist network selection to local storage. * Modifiy TransactionSucceeded to link to network-specific explorer. * - Reload on Node Change to reset state. Should be refactored in the future so that we are not forcing clients to reload. --- .../TransactionSucceeded.js | 13 +- .../Header/components/Navigation.jsx | 14 +- .../Header/components/Navigation.scss | 1 + common/components/Header/index.jsx | 7 +- common/config/contracts/exp.json | 1 + common/config/contracts/rsk.json | 1 + common/config/contracts/ubq.json | 1 + common/config/data.js | 164 ++++++- common/config/tokens/etc.json | 8 + common/config/tokens/eth.js | 439 ------------------ common/config/tokens/eth.json | 437 +++++++++++++++++ common/config/tokens/exp.json | 1 + common/config/tokens/kovan.json | 14 + common/config/tokens/rinkeby.json | 1 + common/config/tokens/ropsten.json | 1 + common/config/tokens/rsk.json | 1 + common/config/tokens/ubq.json | 14 + common/libs/nodes/etherscan/client.js | 29 ++ common/libs/nodes/etherscan/index.js | 14 + common/libs/nodes/etherscan/requests.js | 67 +++ common/libs/nodes/etherscan/types.js | 42 ++ common/libs/nodes/index.js | 2 + common/libs/nodes/infura/client.js | 9 + common/libs/nodes/infura/index.js | 11 + common/libs/nodes/rpc/client.js | 100 +--- common/libs/nodes/rpc/index.js | 97 ++-- common/libs/nodes/rpc/requests.js | 62 +++ common/libs/nodes/rpc/types.js | 2 - common/sagas/config.js | 5 +- common/sagas/wallet.js | 12 +- common/store.js | 1 + package-lock.json | 18 +- 32 files changed, 993 insertions(+), 596 deletions(-) create mode 100644 common/config/contracts/exp.json create mode 100644 common/config/contracts/rsk.json create mode 100644 common/config/contracts/ubq.json create mode 100644 common/config/tokens/etc.json delete mode 100644 common/config/tokens/eth.js create mode 100644 common/config/tokens/eth.json create mode 100644 common/config/tokens/exp.json create mode 100644 common/config/tokens/kovan.json create mode 100644 common/config/tokens/rinkeby.json create mode 100644 common/config/tokens/ropsten.json create mode 100644 common/config/tokens/rsk.json create mode 100644 common/config/tokens/ubq.json create mode 100644 common/libs/nodes/etherscan/client.js create mode 100644 common/libs/nodes/etherscan/index.js create mode 100644 common/libs/nodes/etherscan/requests.js create mode 100644 common/libs/nodes/etherscan/types.js create mode 100644 common/libs/nodes/infura/client.js create mode 100644 common/libs/nodes/infura/index.js create mode 100644 common/libs/nodes/rpc/requests.js diff --git a/common/components/ExtendedNotifications/TransactionSucceeded.js b/common/components/ExtendedNotifications/TransactionSucceeded.js index 5801e8d0..41cb83fb 100644 --- a/common/components/ExtendedNotifications/TransactionSucceeded.js +++ b/common/components/ExtendedNotifications/TransactionSucceeded.js @@ -1,13 +1,18 @@ import React from 'react'; -import { ETHTxExplorer } from 'config/data'; +import type { BlockExplorerConfig } from 'config.data'; import translate from 'translations'; + export type TransactionSucceededProps = { - txHash: string + txHash: string, + blockExplorer: BlockExplorerConfig }; -const TransactionSucceeded = ({ txHash }: TransactionSucceededProps) => { +const TransactionSucceeded = ({ + txHash, + blockExplorer +}: TransactionSucceededProps) => { // const checkTxLink = `https://www.myetherwallet.com?txHash=${txHash}/#check-tx-status`; - const txHashLink = ETHTxExplorer(txHash); + const txHashLink = blockExplorer.tx(txHash); return (
diff --git a/common/components/Header/components/Navigation.jsx b/common/components/Header/components/Navigation.jsx index f3bcadf8..bcf9eb88 100644 --- a/common/components/Header/components/Navigation.jsx +++ b/common/components/Header/components/Navigation.jsx @@ -39,7 +39,7 @@ const tabs = [ } ]; -export default class TabsOptions extends Component { +export default class Navigation extends Component { constructor(props) { super(props); this.state = { @@ -49,7 +49,8 @@ export default class TabsOptions extends Component { } static propTypes = { - location: PropTypes.object + location: PropTypes.object, + color: PropTypes.string }; scrollLeft() {} @@ -57,12 +58,19 @@ export default class TabsOptions extends Component { scrollRight() {} render() { - const { location } = this.props; + const { location, color } = this.props; + const borderStyle = {}; + + if (color) { + borderStyle.borderTopColor = color; + } + return (