on master help sign in
checkpoint again - need to refactor web3 and contracts references
commitaf32282cbe0ba1c98521e738d8b92ab5f3e28689 authorMatt Condon (shrugs) <mattgcondon@gmail.com> dateTue 11 Jun 2019, 14:02 (7 years ago) parente27d1c6
3 files changed+65−55
src/bridge/Bridge.js+57−53 src/bridge/lib/nest.js+6 src/bridge/views/Network.js+2−2
src/bridge/Bridge.js+57−53
@@ -21,6 +21,7 @@ import { BRIDGE_ERROR } from './lib/error';
2121import { isDevelopment } from './lib/flags';
2222import { OnlineProvider } from './store/online';
2323import { NetworkProvider } from './store/network';
24+import nest from './lib/nest';
2425
2526// NB(shrugs): toggle this variable to use the default local state.
2627// don't commit changes to this line, but there shouldn't be a problem
@@ -63,6 +64,13 @@ const VariableWidthColumn = withHistory(({ history, children }) => (
6364 </Col>
6465));
6566
67+const AllProviders = nest([
68+ HistoryProvider,
69+ TxnConfirmationsProvider,
70+ OnlineProvider,
71+ NetworkProvider,
72+]);
73+
6674class Bridge extends React.Component {
6775 constructor(props) {
6876 super(props);
@@ -221,62 +229,58 @@ class Bridge extends React.Component {
221229 : NETWORK_NAMES.MAINNET;
222230
223231 return (
224− <HistoryProvider initialRoutes={kInitialRoutes}>
225− <TxnConfirmationsProvider>
226− <OnlineProvider>
227− <NetworkProvider initialNetworkType={initialNetworkType}>
228− <Container>
229− <Row>
230− <VariableWidthColumn>
231− <Header
232− skipRoute={this.skipRoute}
233− wallet={wallet}
234− pointCursor={pointCursor}
235− />
232+ <AllProviders
233+ initialRoutes={kInitialRoutes}
234+ initialNetworkType={initialNetworkType}>
235+ <Container>
236+ <Row>
237+ <VariableWidthColumn>
238+ <Header
239+ skipRoute={this.skipRoute}
240+ wallet={wallet}
241+ pointCursor={pointCursor}
242+ />
236243
237− <Row className={'row wrapper'}>
238− <Router
239− setWalletType={
240− this.setWalletType // wallet
241− }
242− setWalletHdPath={this.setWalletHdPath}
243− setWallet={this.setWallet}
244− walletType={walletType}
245− walletHdPath={walletHdPath}
246− wallet={wallet}
247− urbitWallet={
248− urbitWallet // urbit wallet
249− }
250− setUrbitWallet={this.setUrbitWallet}
251− authMnemonic={authMnemonic}
252− setAuthMnemonic={this.setAuthMnemonic}
253− setPointCursor={
254− this.setPointCursor // point
255− }
256− addToPointCache={this.addToPointCache}
257− pointCursor={pointCursor}
258− pointCache={pointCache}
259− networkSeedCache={networkSeedCache}
260− networkRevisionCache={networkRevisionCache}
261− setNetworkSeedCache={this.setNetworkSeedCache}
262− onSent={
263− this.setTxnHashCursor // txn
264− }
265− setTxnHashCursor={this.setTxnHashCursor}
266− txnHashCursor={txnHashCursor}
267− />
244+ <Row className={'row wrapper'}>
245+ <Router
246+ setWalletType={
247+ this.setWalletType // wallet
248+ }
249+ setWalletHdPath={this.setWalletHdPath}
250+ setWallet={this.setWallet}
251+ walletType={walletType}
252+ walletHdPath={walletHdPath}
253+ wallet={wallet}
254+ urbitWallet={
255+ urbitWallet // urbit wallet
256+ }
257+ setUrbitWallet={this.setUrbitWallet}
258+ authMnemonic={authMnemonic}
259+ setAuthMnemonic={this.setAuthMnemonic}
260+ setPointCursor={
261+ this.setPointCursor // point
262+ }
263+ addToPointCache={this.addToPointCache}
264+ pointCursor={pointCursor}
265+ pointCache={pointCache}
266+ networkSeedCache={networkSeedCache}
267+ networkRevisionCache={networkRevisionCache}
268+ setNetworkSeedCache={this.setNetworkSeedCache}
269+ onSent={
270+ this.setTxnHashCursor // txn
271+ }
272+ setTxnHashCursor={this.setTxnHashCursor}
273+ txnHashCursor={txnHashCursor}
274+ />
268275
269− <div className={'push'} />
270− </Row>
276+ <div className={'push'} />
277+ </Row>
271278
272− <Footer />
273− </VariableWidthColumn>
274− </Row>
275− </Container>
276− </NetworkProvider>
277− </OnlineProvider>
278− </TxnConfirmationsProvider>
279− </HistoryProvider>
279+ <Footer />
280+ </VariableWidthColumn>
281+ </Row>
282+ </Container>
283+ </AllProviders>
280284 );
281285 }
282286}
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 = [
3131];
3232
3333function Network() {
34− const { networkType } = useNetwork();
34+ const { networkType, setNetworkType } = useNetwork();
3535 const history = useHistory();
3636
3737 return (
@@ -48,7 +48,7 @@ function Network() {
4848 <InnerLabelDropdown
4949 className={'mt-6'}
5050 title={'Node:'}
51− handleUpdate={this.network.setNetworkType}
51+ handleUpdate={setNetworkType}
5252 options={kNetworkOptions}
5353 currentSelectionTitle={renderNetworkType(networkType)}
5454 />