on master help sign in
Another MM fix
commit5e84d23525d0e91c8dc30dfafe3ffab21e9dc324 authorWill Galebach <willbach@gmail.com> dateTue 7 Dec 2021, 15:51 (5 years ago) parent2c54548
5 files changed+48−33
src/components/Passport.js+2−2 src/store/network.js+1−1 src/views/Login/Metamask.js+8−4 src/views/Point/IssueChild.tsx+36−25 src/views/Point/MigrateL2.tsx+1−1
src/components/Passport.js+2−2
@@ -218,7 +218,7 @@ function MiniPassport({
218218 processing = false,
219219 ...rest
220220}) {
221− useSyncDetails([point]);
221+ // useSyncDetails([point]);
222222 // const { wallet } = useWallet();
223223 // const address = need.addressFromWallet(wallet);
224224 // const permissions = usePermissionsForPoint(address, point);
@@ -239,7 +239,7 @@ function MiniPassport({
239239 return (
240240 <div {...rest} className="sigil-mini">
241241 <div className={className}>{sigil}</div>
242− <span className="patp">{patp}</span>
242+ <span className="patp mono">{patp}</span>
243243 {locked && <Icon color="white" icon="Locked" className="lock" />}
244244 </div>
245245 );
src/store/network.js+1−1
@@ -126,7 +126,7 @@ function _useNetwork(initialNetworkType = null) {
126126 })();
127127 }, [networkType, metamask]);
128128
129− return { networkType, setNetworkType, web3, contracts };
129+ return { networkType, setNetworkType, setMetamask, web3, contracts };
130130}
131131
132132const NetworkContext = createContext(null);
src/views/Login/Metamask.js+8−4
@@ -1,4 +1,4 @@
1−import React, { useCallback } from 'react';
1+import React, { useCallback, useEffect } from 'react';
22import { Grid, Text, LinkButton, H5 } from 'indigo-react';
33import { Just } from 'folktale/maybe';
44import { FORM_ERROR } from 'final-form';
@@ -24,11 +24,15 @@ export default function Metamask({ className, goHome }) {
2424 useLoginView(WALLET_TYPES.METAMASK);
2525 const { setWallet, setWalletType, setAuthToken } = useWallet();
2626
27− const { web3 } = useNetwork();
28− const _web3 = need.web3(web3);
27+ const { web3, setMetamask } = useNetwork();
28+
29+ useEffect(() => {
30+ setMetamask(true);
31+ }, []); // eslint-disable-line react-hooks/exhaustive-deps
2932
3033 const onSubmit = useCallback(async () => {
3134 try {
35+ const _web3 = need.web3(web3);
3236 const accounts = await window.ethereum.send('eth_requestAccounts');
3337 const wallet = new MetamaskWallet(accounts.result[0]);
3438
@@ -45,7 +49,7 @@ export default function Metamask({ className, goHome }) {
4549 console.error(e);
4650 return { [FORM_ERROR]: e.message };
4751 }
48− }, [_web3, setAuthToken, setWallet, setWalletType]);
52+ }, [web3, setAuthToken, setWallet, setWalletType]);
4953
5054 return (
5155 <Grid className={className}>
src/views/Point/IssueChild.tsx+36−25
@@ -120,6 +120,7 @@ export default function IssueChild() {
120120 await spawnPoint(pointToSpawn, destinationAddress);
121121 checkForUpdates(pointToSpawn);
122122 setPointToSpawn(null);
123+ setDestinationAddress(null);
123124 setL2SpawnSent(true);
124125 setLoading(false);
125126 }
@@ -199,9 +200,11 @@ export default function IssueChild() {
199200 const validAddress =
200201 destinationAddress && !buildAddressValidator()(destinationAddress);
201202
203+ const pointType = point.isStar ? 'planet' : 'star';
204+
202205 const getButtonText = () => {
203206 if (!validPoint) {
204− return `Please enter a valid ${point.isStar ? 'planet' : 'star'}`;
207+ return `Please enter a valid ${pointType}`;
205208 } else if (!validAddress) {
206209 return `Please enter a valid destination address`;
207210 }
@@ -234,16 +237,25 @@ export default function IssueChild() {
234237 full
235238 as={'div'}
236239 style={{ fontSize: 14 }}
237− className={cn('f5 wrap mb5', {
240+ className={cn('f5 wrap', {
238241 green3: completed,
239242 })}>
240243 <span className="mono">{values.point}</span> has been
241244 spawned and can be claimed by{' '}
242245 <CopiableAddress>{values.owner}</CopiableAddress>.
246+ <Grid.Item
247+ as={Button}
248+ full
249+ className="mt6"
250+ center
251+ solid
252+ onClick={() => pop()}>
253+ Go back
254+ </Grid.Item>
243255 </Grid.Item>
244256 )}
245257
246− {!completed && (
258+ {!(completed || l2SpawnSent) && (
247259 <>
248260 <Grid.Item
249261 full
@@ -289,30 +301,29 @@ export default function IssueChild() {
289301 <AddressButton>Use my address</AddressButton>
290302 </Box>
291303 )}
304+ <Grid.Item full as={FormError} />
305+
306+ {point.isL2Spawn ? (
307+ <Grid.Item
308+ as={Button}
309+ full
310+ className="mt4"
311+ center
312+ solid
313+ disabled={!validPoint || !validAddress}
314+ onClick={spawnNewPoint}>
315+ {getButtonText()}
316+ </Grid.Item>
317+ ) : (
318+ <Grid.Item
319+ full
320+ as={InlineEthereumTransaction}
321+ {...bind}
322+ onReturn={() => pop()}
323+ />
324+ )}
292325 </>
293326 )}
294−
295− <Grid.Item full as={FormError} />
296−
297− {point.isL2Spawn ? (
298− <Grid.Item
299− as={Button}
300− full
301− className="mt4"
302− center
303− solid
304− disabled={!validPoint || !validAddress}
305− onClick={spawnNewPoint}>
306− {getButtonText()}
307− </Grid.Item>
308− ) : (
309− <Grid.Item
310− full
311− as={InlineEthereumTransaction}
312− {...bind}
313− onReturn={() => pop()}
314− />
315− )}
316327 </>
317328 )}
318329 </BridgeForm>
src/views/Point/MigrateL2.tsx+1−1
@@ -61,7 +61,7 @@ const PointEntry = ({
6161 <Box className="sigil">
6262 <Sigil patp={patp} size={1} colors={['#000000', '#FFFFFF']} />
6363 </Box>
64− <Box>{patp}</Box>
64+ <Box className="mono">{patp}</Box>
6565 </Row>
6666 );
6767};