@@ -9,10 +9,10 @@ import nest from './lib/nest';
9import { router } from './lib/router';
9import { router } from './lib/router';
10import { ROUTE_NAMES } from './lib/routeNames';
10import { ROUTE_NAMES } from './lib/routeNames';
11import { NETWORK_TYPES } from './lib/network';
11import { NETWORK_TYPES } from './lib/network';
12−import { DEFAULT_HD_PATH, walletFromMnemonic } from './lib/wallet';
12+import { walletFromMnemonic } from './lib/wallet';
13import { isDevelopment } from './lib/flags';
13import { isDevelopment } from './lib/flags';
15−import { HistoryProvider, withHistory, useHistory } from './store/history';
15+import { HistoryProvider, useHistory } from './store/history';
16import { TxnConfirmationsProvider } from './store/txnConfirmations';
16import { TxnConfirmationsProvider } from './store/txnConfirmations';
17import { OnlineProvider } from './store/online';
17import { OnlineProvider } from './store/online';
18import { NetworkProvider } from './store/network';
18import { NetworkProvider } from './store/network';
@@ -42,6 +42,9 @@ const kInitialWallet = kIsStubbed
42 process.env.REACT_APP_HD_PATH
42 process.env.REACT_APP_HD_PATH
44 : undefined;
44 : undefined;
45+const kInitialMnemonic = kIsStubbed
46+ ? process.env.REACT_APP_DEV_MNEMONIC
46// the router itself is just a component that renders a specific view
49// the router itself is just a component that renders a specific view
47// depending on the history
50// depending on the history
@@ -52,23 +55,26 @@ const Router = function(props) {
52 return <Route {...props} />;
55 return <Route {...props} />;
55−// NB(shrugs): separate component because it needs withHistory
58+// NB(shrugs): separate component because it needs useHistory
56// this will be must better structured as part of the UI overhaul
59// this will be must better structured as part of the UI overhaul
57−const VariableWidthColumn = withHistory(({ history, children }) => (
60+const VariableWidthColumn = function({ children }) {
61+ const history = useHistory();
58 // For the invite acceptance flow, widen the screen to use the full
62 // For the invite acceptance flow, widen the screen to use the full
59 // container, and hide the breadcrumbs
63 // container, and hide the breadcrumbs
61− className={
66+ className={
62− history.includes(ROUTE_NAMES.INVITE_TICKET)
67+ history.includes(ROUTE_NAMES.INVITE_TICKET)
63− ? 'col-md-12'
68+ ? 'col-md-12'
64− : 'col-md-offset-1 col-md-10'
69+ : 'col-md-offset-1 col-md-10'
67− history.includes(ROUTE_NAMES.INVITE_TICKET) ? {} : { maxWidth: '620px' }
72+ history.includes(ROUTE_NAMES.INVITE_TICKET) ? {} : { maxWidth: '620px' }
69− {children}
74+ {children}
73// nest all of the providers within each other to avoid hella depth
79// nest all of the providers within each other to avoid hella depth
74const AllProviders = nest([
80const AllProviders = nest([
@@ -84,9 +90,6 @@ class Bridge extends React.Component {
84 super(props);
90 super(props);
86 this.state = {
92 this.state = {
87− // urbit wallet-related
88− urbitWallet: Nothing(),
89− authMnemonic: Nothing(),
90 networkSeedCache: null,
93 networkSeedCache: null,
92 pointCursor: Nothing(),
95 pointCursor: Nothing(),
@@ -96,8 +99,6 @@ class Bridge extends React.Component {
96 txnConfirmations: {},
99 txnConfirmations: {},
99− this.setUrbitWallet = this.setUrbitWallet.bind(this);
100− this.setAuthMnemonic = this.setAuthMnemonic.bind(this);
101 this.setPointCursor = this.setPointCursor.bind(this);
102 this.setPointCursor = this.setPointCursor.bind(this);
102 this.setTxnHashCursor = this.setTxnHashCursor.bind(this);
103 this.setTxnHashCursor = this.setTxnHashCursor.bind(this);
103 this.setNetworkSeedCache = this.setNetworkSeedCache.bind(this);
104 this.setNetworkSeedCache = this.setNetworkSeedCache.bind(this);
@@ -110,12 +111,8 @@ class Bridge extends React.Component {
110 // If running in development, the following can be tweaked to get you set
111 // If running in development, the following can be tweaked to get you set
111 // up with a desirable initial state.
112 // up with a desirable initial state.
112 if (kIsStubbed) {
113 if (kIsStubbed) {
113− const mnemonic = process.env.REACT_APP_DEV_MNEMONIC;
115 this.setState({
114 this.setState({
116 pointCursor: Just(0),
115 pointCursor: Just(0),
117− urbitWallet: Nothing(),
118− authMnemonic: Just(mnemonic),
@@ -127,28 +124,6 @@ class Bridge extends React.Component {
130− // also sets wallet to ownership address
131− setUrbitWallet(urbitWallet) {
132− let wallet = this.state.wallet;
133− if (Just.hasInstance(urbitWallet)) {
134− const mnemonic = urbitWallet.value.ownership.seed;
135− wallet = walletFromMnemonic(
138− urbitWallet.value.meta.passphrase
141− wal.address = urbitWallet.value.ownership.keys.address;
145− this.setState({ urbitWallet, wallet });
148− setAuthMnemonic(authMnemonic) {
149− this.setState({ authMnemonic });
152 setPointCursor(pointCursor) {
127 setPointCursor(pointCursor) {
153 this.setState({ pointCursor });
128 this.setState({ pointCursor });
@@ -165,8 +140,6 @@ class Bridge extends React.Component {
166 render() {
141 render() {
170 networkSeedCache,
143 networkSeedCache,
171 networkRevisionCache,
144 networkRevisionCache,
172 pointCursor,
145 pointCursor,
@@ -178,7 +151,8 @@ class Bridge extends React.Component {
178 <AllProviders
151 <AllProviders
179 initialRoutes={kInitialRoutes}
152 initialRoutes={kInitialRoutes}
180 initialNetworkType={kInitialNetworkType}
153 initialNetworkType={kInitialNetworkType}
181− initialWallet={kInitialWallet}>
154+ initialWallet={kInitialWallet}
155+ initialMnemonic={kInitialMnemonic}>
182 <Container>
156 <Container>
184 <VariableWidthColumn>
158 <VariableWidthColumn>
@@ -186,10 +160,6 @@ class Bridge extends React.Component {
187 <Row className={'row wrapper'}>
161 <Row className={'row wrapper'}>
189− urbitWallet={urbitWallet}
190− setUrbitWallet={this.setUrbitWallet}
191− authMnemonic={authMnemonic}
192− setAuthMnemonic={this.setAuthMnemonic}
193 setPointCursor={this.setPointCursor}
163 setPointCursor={this.setPointCursor}
194 addToPointCache={this.addToPointCache}
164 addToPointCache={this.addToPointCache}
195 pointCursor={pointCursor}
165 pointCursor={pointCursor}