on master help sign in
checkpoint again - need to refactor web3 and contracts references
af32282Matt Condon (shrugs)
src/bridge/Bridge.js+57−53
@@ -21,6 +21,7 @@ import { BRIDGE_ERROR } from './lib/error';
21import { isDevelopment } from './lib/flags';
21import { isDevelopment } from './lib/flags';
22import { OnlineProvider } from './store/online';
22import { OnlineProvider } from './store/online';
23import { NetworkProvider } from './store/network';
23import { NetworkProvider } from './store/network';
24+import nest from './lib/nest';
24
25
25// NB(shrugs): toggle this variable to use the default local state.
26// NB(shrugs): toggle this variable to use the default local state.
26// don't commit changes to this line, but there shouldn't be a problem
27// don't commit changes to this line, but there shouldn't be a problem
@@ -63,6 +64,13 @@ const VariableWidthColumn = withHistory(({ history, children }) => (
63 </Col>
64 </Col>
64));
65));
65
66
67+const AllProviders = nest([
68+ HistoryProvider,
69+ TxnConfirmationsProvider,
70+ OnlineProvider,
71+ NetworkProvider,
72+]);
73+
66class Bridge extends React.Component {
74class Bridge extends React.Component {
67 constructor(props) {
75 constructor(props) {
68 super(props);
76 super(props);
@@ -221,62 +229,58 @@ class Bridge extends React.Component {
221 : NETWORK_NAMES.MAINNET;
229 : NETWORK_NAMES.MAINNET;
222
230
223 return (
231 return (
232+ <AllProviders
224− <HistoryProvider initialRoutes={kInitialRoutes}>
233+ initialRoutes={kInitialRoutes}
225− <TxnConfirmationsProvider>
226− <OnlineProvider>
227− <NetworkProvider initialNetworkType={initialNetworkType}>
234+ initialNetworkType={initialNetworkType}>
228− <Container>
235+ <Container>
229− <Row>
236+ <Row>
230− <VariableWidthColumn>
237+ <VariableWidthColumn>
231− <Header
238+ <Header
232− skipRoute={this.skipRoute}
239+ skipRoute={this.skipRoute}
233− wallet={wallet}
240+ wallet={wallet}
234− pointCursor={pointCursor}
241+ pointCursor={pointCursor}
235− />
242+ />
236
243
237− <Row className={'row wrapper'}>
244+ <Row className={'row wrapper'}>
238− <Router
245+ <Router
239− setWalletType={
246+ setWalletType={
240− this.setWalletType // wallet
247+ this.setWalletType // wallet
241− }
248+ }
242− setWalletHdPath={this.setWalletHdPath}
249+ setWalletHdPath={this.setWalletHdPath}
243− setWallet={this.setWallet}
250+ setWallet={this.setWallet}
244− walletType={walletType}
251+ walletType={walletType}
245− walletHdPath={walletHdPath}
252+ walletHdPath={walletHdPath}
246− wallet={wallet}
253+ wallet={wallet}
247− urbitWallet={
254+ urbitWallet={
248− urbitWallet // urbit wallet
255+ urbitWallet // urbit wallet
249− }
256+ }
250− setUrbitWallet={this.setUrbitWallet}
257+ setUrbitWallet={this.setUrbitWallet}
251− authMnemonic={authMnemonic}
258+ authMnemonic={authMnemonic}
252− setAuthMnemonic={this.setAuthMnemonic}
259+ setAuthMnemonic={this.setAuthMnemonic}
253− setPointCursor={
260+ setPointCursor={
254− this.setPointCursor // point
261+ this.setPointCursor // point
255− }
262+ }
256− addToPointCache={this.addToPointCache}
263+ addToPointCache={this.addToPointCache}
257− pointCursor={pointCursor}
264+ pointCursor={pointCursor}
258− pointCache={pointCache}
265+ pointCache={pointCache}
259− networkSeedCache={networkSeedCache}
266+ networkSeedCache={networkSeedCache}
260− networkRevisionCache={networkRevisionCache}
267+ networkRevisionCache={networkRevisionCache}
261− setNetworkSeedCache={this.setNetworkSeedCache}
268+ setNetworkSeedCache={this.setNetworkSeedCache}
262− onSent={
269+ onSent={
263− this.setTxnHashCursor // txn
270+ this.setTxnHashCursor // txn
264− }
271+ }
265− setTxnHashCursor={this.setTxnHashCursor}
272+ setTxnHashCursor={this.setTxnHashCursor}
266− txnHashCursor={txnHashCursor}
273+ txnHashCursor={txnHashCursor}
267− />
274+ />
268
275
269− <div className={'push'} />
276+ <div className={'push'} />
270− </Row>
277+ </Row>
271
278
272− <Footer />
279+ <Footer />
273− </VariableWidthColumn>
280+ </VariableWidthColumn>
274− </Row>
281+ </Row>
275− </Container>
282+ </Container>
276− </NetworkProvider>
283+ </AllProviders>
277− </OnlineProvider>
278− </TxnConfirmationsProvider>
279− </HistoryProvider>
280 );
284 );
281 }
285 }
282}
286}
src/bridge/lib/nest.jsnew file+6
@@ -0,0 +1,6 @@
1+import { createFactory } from 'react';
2+
3+export default (components = []) => ({ children, ...props }) =>
4+ components
5+ .map(createFactory)
6+ .reduceRight((child, factory) => factory(props, child), children);
src/bridge/views/Network.js+2−2
@@ -31,7 +31,7 @@ const kNetworkOptions = [
31];
31];
32
32
33function Network() {
33function Network() {
34− const { networkType } = useNetwork();
34+ const { networkType, setNetworkType } = useNetwork();
35 const history = useHistory();
35 const history = useHistory();
36
36
37 return (
37 return (
@@ -48,7 +48,7 @@ function Network() {
48 <InnerLabelDropdown
48 <InnerLabelDropdown
49 className={'mt-6'}
49 className={'mt-6'}
50 title={'Node:'}
50 title={'Node:'}
51− handleUpdate={this.network.setNetworkType}
51+ handleUpdate={setNetworkType}
52 options={kNetworkOptions}
52 options={kNetworkOptions}
53 currentSelectionTitle={renderNetworkType(networkType)}
53 currentSelectionTitle={renderNetworkType(networkType)}
54 />
54 />