@@ -7,7 +7,6 @@ import Header from './components/Header';
7import { Container, Row, Col } from './components/Base';
7import { Container, Row, Col } from './components/Base';
9import { router } from './lib/router';
9import { router } from './lib/router';
10−import { initWeb3 } from './lib/web3';
11import { ROUTE_NAMES } from './lib/routeNames';
10import { ROUTE_NAMES } from './lib/routeNames';
12import { HistoryProvider, withHistory, useHistory } from './store/history';
11import { HistoryProvider, withHistory, useHistory } from './store/history';
13import { TxnConfirmationsProvider } from './store/txnConfirmations';
12import { TxnConfirmationsProvider } from './store/txnConfirmations';
@@ -19,13 +18,15 @@ import {
19 addressFromSecp256k1Public,
18 addressFromSecp256k1Public,
20} from './lib/wallet';
19} from './lib/wallet';
21import { BRIDGE_ERROR } from './lib/error';
20import { BRIDGE_ERROR } from './lib/error';
22−import { isLocal } from './lib/flags';
21+import { isDevelopment } from './lib/flags';
22+import { OnlineProvider } from './store/online';
23+import { NetworkProvider } from './store/network';
24// NB(shrugs): toggle this variable to use the default local state.
25// NB(shrugs): toggle this variable to use the default local state.
25// don't commit changes to this line, but there shouldn't be a problem
26// don't commit changes to this line, but there shouldn't be a problem
26// if you do because we'll never stub on a production build.
27// if you do because we'll never stub on a production build.
27const shouldStubLocal = false;
28const shouldStubLocal = false;
28−const isStubbed = isLocal && shouldStubLocal;
29+const isStubbed = isDevelopment && shouldStubLocal;
29const kInitialRoutes = isStubbed
30const kInitialRoutes = isStubbed
31 { name: ROUTE_NAMES.SHIPS },
32 { name: ROUTE_NAMES.SHIPS },
@@ -66,12 +67,6 @@ class Bridge extends React.Component {
66 constructor(props) {
67 constructor(props) {
67 super(props);
68 super(props);
69− const networkType = isLocal ? NETWORK_NAMES.LOCAL : NETWORK_NAMES.MAINNET;
71− // Sidestepping full network selection to allow for point viewing,
72− // but still respecting the networkType
73− const { web3, contracts } = initWeb3(networkType);
75 // NB (jtobin):
70 // NB (jtobin):
77 // Note that the 'wallet' prop has type depending on the 'walletType' prop.
72 // Note that the 'wallet' prop has type depending on the 'walletType' prop.
@@ -86,10 +81,6 @@ class Bridge extends React.Component {
86 // 'EthereumWallet'.
81 // 'EthereumWallet'.
88 this.state = {
83 this.state = {
90− networkType: networkType,
92− contracts: Just(contracts),
94 walletType: WALLET_NAMES.MNEMONIC,
85 walletType: WALLET_NAMES.MNEMONIC,
95 wallet: Nothing(),
86 wallet: Nothing(),
@@ -106,8 +97,6 @@ class Bridge extends React.Component {
106 txnConfirmations: {},
97 txnConfirmations: {},
109− this.setNetworkType = this.setNetworkType.bind(this);
110− this.setNetwork = this.setNetwork.bind(this);
111 this.setWalletType = this.setWalletType.bind(this);
100 this.setWalletType = this.setWalletType.bind(this);
112 this.setWallet = this.setWallet.bind(this);
101 this.setWallet = this.setWallet.bind(this);
113 this.setWalletHdPath = this.setWalletHdPath.bind(this);
102 this.setWalletHdPath = this.setWalletHdPath.bind(this);
@@ -155,13 +144,6 @@ class Bridge extends React.Component {
158− setNetwork(web3, contracts) {
161− contracts: contracts,
165 setWalletType(symbol) {
147 setWalletType(symbol) {
166 if (includes(WALLET_NAMES, symbol)) {
148 if (includes(WALLET_NAMES, symbol)) {
167 this.setState({
149 this.setState({
@@ -222,7 +204,6 @@ class Bridge extends React.Component {
223 render() {
205 render() {
226 walletType,
207 walletType,
227 walletHdPath,
208 walletHdPath,
@@ -233,64 +214,67 @@ class Bridge extends React.Component {
233 pointCursor,
214 pointCursor,
234 pointCache,
215 pointCache,
235 txnHashCursor,
216 txnHashCursor,
238 } = this.state;
217 } = this.state;
219+ const initialNetworkType = isDevelopment
220+ ? NETWORK_NAMES.LOCAL
221+ : NETWORK_NAMES.MAINNET;
241 <HistoryProvider initialRoutes={kInitialRoutes}>
224 <HistoryProvider initialRoutes={kInitialRoutes}>
242 <TxnConfirmationsProvider>
225 <TxnConfirmationsProvider>
243− <Container>
226+ <OnlineProvider>
244− <Row>
227+ <NetworkProvider initialNetworkType={initialNetworkType}>
245− <VariableWidthColumn>
230+ <VariableWidthColumn>
247− skipRoute={this.skipRoute}
232+ skipRoute={this.skipRoute}
248− networkType={networkType}
249− wallet={wallet}
233+ wallet={wallet}
250− pointCursor={pointCursor}
234+ pointCursor={pointCursor}
253− <Row className={'row wrapper'}>
237+ <Row className={'row wrapper'}>
255− // network
239+ setWalletType={
256− setNetworkType={this.setNetworkType}
257− setNetwork={this.setNetwork}
258− networkType={networkType}
260− contracts={contracts}
261− // wallet
240+ this.setWalletType // wallet
262− setWalletType={this.setWalletType}
241+ }
263− setWalletHdPath={this.setWalletHdPath}
242+ setWalletHdPath={this.setWalletHdPath}
264− setWallet={this.setWallet}
243+ setWallet={this.setWallet}
265− walletType={walletType}
244+ walletType={walletType}
266− walletHdPath={walletHdPath}
245+ walletHdPath={walletHdPath}
267− wallet={wallet}
246+ wallet={wallet}
268− // urbit wallet
248+ urbitWallet // urbit wallet
269− urbitWallet={urbitWallet}
249+ }
270− setUrbitWallet={this.setUrbitWallet}
250+ setUrbitWallet={this.setUrbitWallet}
271− authMnemonic={authMnemonic}
251+ authMnemonic={authMnemonic}
272− setAuthMnemonic={this.setAuthMnemonic}
252+ setAuthMnemonic={this.setAuthMnemonic}
273− // point
253+ setPointCursor={
274− setPointCursor={this.setPointCursor}
254+ this.setPointCursor // point
275− addToPointCache={this.addToPointCache}
256+ addToPointCache={this.addToPointCache}
276− pointCursor={pointCursor}
257+ pointCursor={pointCursor}
277− pointCache={pointCache}
258+ pointCache={pointCache}
278− networkSeedCache={networkSeedCache}
259+ networkSeedCache={networkSeedCache}
279− networkRevisionCache={networkRevisionCache}
260+ networkRevisionCache={networkRevisionCache}
280− setNetworkSeedCache={this.setNetworkSeedCache}
261+ setNetworkSeedCache={this.setNetworkSeedCache}
282− onSent={this.setTxnHashCursor}
263+ this.setTxnHashCursor // txn
283− setTxnHashCursor={this.setTxnHashCursor}
265+ setTxnHashCursor={this.setTxnHashCursor}
284− txnHashCursor={txnHashCursor}
266+ txnHashCursor={txnHashCursor}
287− <div className={'push'} />
269+ <div className={'push'} />
290− <Footer />
272+ <Footer />
291− </VariableWidthColumn>
273+ </VariableWidthColumn>
293− </Container>
275+ </Container>
294 </TxnConfirmationsProvider>
278 </TxnConfirmationsProvider>
295 </HistoryProvider>
279 </HistoryProvider>