on master help sign in
address review comments
93bfa0cLiam Fitzgerald
src/components/CopyButton.js+28
@@ -2,6 +2,8 @@ import React from 'react';
2import cn from 'classnames';
2import cn from 'classnames';
3import { LinkButton } from 'indigo-react';
3import { LinkButton } from 'indigo-react';
4
4
5+import { ForwardButton } from 'components/Buttons';
6+
5import useCopiable from 'lib/useCopiable';
7import useCopiable from 'lib/useCopiable';
6
8
7const renderDefaultCopyText = didCopy => (didCopy ? 'Copied!' : 'Copy');
9const renderDefaultCopyText = didCopy => (didCopy ? 'Copied!' : 'Copy');
@@ -27,3 +29,29 @@ export default function CopyButton({
27 </As>
29 </As>
28 );
30 );
29}
31}
32+
33+export function CopyButtonWide({
34+ as: As = ForwardButton,
35+ text,
36+ children,
37+ accessory = renderDefaultCopyText,
38+ ...rest
39+}) {
40+ const [doCopy, didCopy] = useCopiable(text);
41+ return (
42+ <As
43+ onClick={doCopy}
44+ accessory={
45+ <LinkButton
46+ className={{
47+ black: !didCopy,
48+ green3: didCopy,
49+ }}>
50+ {accessory(didCopy)}
51+ </LinkButton>
52+ }
53+ {...rest}>
54+ {children}
55+ </As>
56+ );
57+}
src/components/InlineEthereumTransaction.js+34−35
@@ -103,7 +103,31 @@ export default function InlineEthereumTransaction({
103 </Grid.Item>
103 </Grid.Item>
104 );
104 );
105 } else if (completed) {
105 } else if (completed) {
106− return undefined;
106+ return (
107+ <>
108+ <Grid.Divider />
109+ <Grid.Item full as={RestartButton} onClick={onReturn}>
110+ Return
111+ </Grid.Item>
112+ <Grid.Divider />
113+ {showReceipt && (
114+ <TransactionReceipt
115+ txHashes={txHashes}
116+ maxCost={maxCost}
117+ onClose={toggleShowReceipt}
118+ />
119+ )}
120+
121+ {!showReceipt && (
122+ <Grid.Item
123+ className="underline mv2 pointer"
124+ full
125+ onClick={toggleShowReceipt}>
126+ View Receipt
127+ </Grid.Item>
128+ )}
129+ </>
130+ );
107 } else if (showBroadcastButton) {
131 } else if (showBroadcastButton) {
108 return (
132 return (
109 <Grid.Item
133 <Grid.Item
@@ -159,7 +183,8 @@ export default function InlineEthereumTransaction({
159 .mul(toBN(gasPrice))
183 .mul(toBN(gasPrice))
160 .mul(toBN(numTxs)),
184 .mul(toBN(numTxs)),
161 'gwei'
185 'gwei'
162− )
186+ ),
187+ 'eth'
163 ),
188 ),
164 [gasLimit, gasPrice, numTxs]
189 [gasLimit, gasPrice, numTxs]
165 );
190 );
@@ -214,7 +239,7 @@ export default function InlineEthereumTransaction({
214 row
239 row
215 justify="between"
240 justify="between"
216 className="mt2">
241 className="mt2">
217− <Flex.Item as={H5}>Gas Price</Flex.Item>
242+ <Flex.Item as={H5}>Transaction Fee</Flex.Item>
218
243
219 <Flex.Item as={H5}>
244 <Flex.Item as={H5}>
220 {gasInfo}{' '}
245 {gasInfo}{' '}
@@ -264,38 +289,12 @@ export default function InlineEthereumTransaction({
264 <Condition when="viewSigned" is={true}>
289 <Condition when="viewSigned" is={true}>
265 <SignedTransactionList
290 <SignedTransactionList
266 serializedTxsHex={serializedTxsHex}
291 serializedTxsHex={serializedTxsHex}
267− gasPrice={gasPrice}
292+ maxCost={maxCost}
268 nonce={nonce}
293 nonce={nonce}
269 />
294 />
270 </Condition>
295 </Condition>
271 </>
296 </>
272 )}
297 )}
273−
274− {completed && (
275− <>
276− <Grid.Divider />
277− <Grid.Item full as={RestartButton} onClick={onReturn}>
278− Return
279− </Grid.Item>
280− <Grid.Divider />
281− {showReceipt && (
282− <TransactionReceipt
283− txHashes={txHashes}
284− maxCost={maxCost}
285− onClose={toggleShowReceipt}
286− />
287− )}
288−
289− {!showReceipt && (
290− <Grid.Item
291− className="underline mv2 pointer"
292− full
293− onClick={toggleShowReceipt}>
294− View Receipt
295− </Grid.Item>
296− )}
297− </>
298− )}
299 </>
298 </>
300 )}
299 )}
301 </BridgeForm>
300 </BridgeForm>
@@ -303,9 +302,9 @@ export default function InlineEthereumTransaction({
303 );
302 );
304}
303}
305
304
306−function SignedTransactionList({ serializedTxsHex, nonce, gasPrice }) {
305+function SignedTransactionList({ serializedTxsHex, nonce, maxCost }) {
307 return serializedTxsHex.map((serializedTxHex, i) => (
306 return serializedTxsHex.map((serializedTxHex, i) => (
308− <React.Fragment key="i">
307+ <React.Fragment key={i}>
309 <Grid.Divider />
308 <Grid.Divider />
310 <Grid.Item full as={Flex} justify="between" className="pv4 black f5">
309 <Grid.Item full as={Flex} justify="between" className="pv4 black f5">
311 <Flex.Item>Nonce</Flex.Item>
310 <Flex.Item>Nonce</Flex.Item>
@@ -313,8 +312,8 @@ function SignedTransactionList({ serializedTxsHex, nonce, gasPrice }) {
313 </Grid.Item>
312 </Grid.Item>
314 <Grid.Divider />
313 <Grid.Divider />
315 <Grid.Item full as={Flex} justify="between" className="pv4 black f5">
314 <Grid.Item full as={Flex} justify="between" className="pv4 black f5">
316− <Flex.Item>Gas Price</Flex.Item>
315+ <Flex.Item>Transaction Cost</Flex.Item>
317− <Flex.Item>{gasPrice.toFixed()} Gwei</Flex.Item>
316+ <Flex.Item>{maxCost} ETH</Flex.Item>
318 </Grid.Item>
317 </Grid.Item>
319 <Grid.Divider />
318 <Grid.Divider />
320 <Grid.Item full as={Flex} justify="between" className="mt3 mb2">
319 <Grid.Item full as={Flex} justify="between" className="mt3 mb2">
@@ -340,7 +339,7 @@ function TransactionReceipt({ txHashes, maxCost, onClose }) {
340 </Flex.Item>
339 </Flex.Item>
341 </Grid.Item>
340 </Grid.Item>
342 <Grid.Item full as={Flex} justify="between" className="pv2 black f5">
341 <Grid.Item full as={Flex} justify="between" className="pv2 black f5">
343− <Flex.Item>Gas Price</Flex.Item>
342+ <Flex.Item>Transaction Cost</Flex.Item>
344 <Flex.Item className="mono">{maxCost} ETH</Flex.Item>
343 <Flex.Item className="mono">{maxCost} ETH</Flex.Item>
345 </Grid.Item>
344 </Grid.Item>
346 <Grid.Divider />
345 <Grid.Divider />
src/store/lib/useResidentsStore.js+24−2
@@ -34,16 +34,28 @@ export default function useResidents() {
34 const syncResidentCount = useCallback(
34 const syncResidentCount = useCallback(
35 async point => {
35 async point => {
36 // Do nothing if we've already fetched in full
36 // Do nothing if we've already fetched in full
37+ // or we aren't a sponsor
38+ const pointSize = azimuth.getPointSize(point);
37 if (Just.hasInstance(getResidents(point).residents)) {
39 if (Just.hasInstance(getResidents(point).residents)) {
38 return;
40 return;
39 }
41 }
42+ if (pointSize === azimuth.PointSize.Planet) {
43+ addToResidentCache(point, {
44+ residentCount: Just(0),
45+ requestsCount: Just(0),
46+ requests: Just([]),
47+ residents: Just([]),
48+ });
49+ return;
50+ }
40
51
41− const isGalaxy = azimuth.getPointSize(point) === azimuth.PointSize.Galaxy;
52+ const isGalaxy = pointSize === azimuth.PointSize.Galaxy;
42 const [residentCount, requestCount] = await Promise.all([
53 const [residentCount, requestCount] = await Promise.all([
43 azimuth.getSponsoringCount(_contracts, point),
54 azimuth.getSponsoringCount(_contracts, point),
44 azimuth.getEscapeRequestsCount(_contracts, point),
55 azimuth.getEscapeRequestsCount(_contracts, point),
45 ]);
56 ]);
46
57
58+ // Galaxies sponsor themselves
47 const _residentCount = isGalaxy
59 const _residentCount = isGalaxy
48 ? residentCount.toNumber() - 1
60 ? residentCount.toNumber() - 1
49 : residentCount.toNumber();
61 : residentCount.toNumber();
@@ -60,12 +72,22 @@ export default function useResidents() {
60
72
61 const syncResidents = useCallback(
73 const syncResidents = useCallback(
62 async point => {
74 async point => {
63− // Galaxies sponsor themselves
75+ if (azimuth.getPointSize(point) === azimuth.PointSize.Planet) {
76+ addToResidentCache(point, {
77+ residentCount: Just(0),
78+ requestsCount: Just(0),
79+ requests: Just([]),
80+ residents: Just([]),
81+ });
82+
83+ return;
84+ }
64 const [residents, requests] = await Promise.all([
85 const [residents, requests] = await Promise.all([
65 azimuth.getSponsoring(_contracts, point),
86 azimuth.getSponsoring(_contracts, point),
66 azimuth.getEscapeRequests(_contracts, point),
87 azimuth.getEscapeRequests(_contracts, point),
67 ]);
88 ]);
68
89
90+ // Galaxies sponsor themselves
69 const _residents = residents.filter(r => r !== point);
91 const _residents = residents.filter(r => r !== point);
70
92
71 addToResidentCache(point, {
93 addToResidentCache(point, {
src/views/UrbitID.js+1−1
@@ -53,7 +53,7 @@ const humanizeName = name => {
53 }
53 }
54};
54};
55
55
56−export default function UrbitOS() {
56+export default function UrbitID() {
57 const history = useHistory();
57 const history = useHistory();
58 const name = useCurrentPointName();
58 const name = useCurrentPointName();
59
59
src/views/UrbitID/Home.js+1−1
@@ -85,7 +85,7 @@ export default function UrbitIDHome() {
85 disabled={!isMasterTicket}
85 disabled={!isMasterTicket}
86 disabledDetail={
86 disabledDetail={
87 <B className="wrap ws-normal">
87 <B className="wrap ws-normal">
88− · Master Ticket Authentication required.
88+ · Master Key Authentication required.
89 </B>
89 </B>
90 }>
90 }>
91 Download Keys
91 Download Keys
src/views/UrbitID/ResetKeys/ResetExecute.js+2−2
@@ -148,7 +148,7 @@ export default function ResetExecute({ newWallet, setNewWallet }) {
148
148
149 return (
149 return (
150 <Grid.Item full as={WarningBox} className="mt4">
150 <Grid.Item full as={WarningBox} className="mt4">
151− Never give your Master Ticket to anyone
151+ Never give your Master Key to anyone
152 </Grid.Item>
152 </Grid.Item>
153 );
153 );
154 };
154 };
@@ -172,7 +172,7 @@ export default function ResetExecute({ newWallet, setNewWallet }) {
172 className="mt4"
172 className="mt4"
173 accessory="↺"
173 accessory="↺"
174 onClick={loginAndGoHome}>
174 onClick={loginAndGoHome}>
175− Login with New Master Ticket
175+ Login with New Master Key
176 </Grid.Item>
176 </Grid.Item>
177 </>
177 </>
178 ) : (
178 ) : (
src/views/UrbitOS/Home.js+2−3
@@ -12,7 +12,7 @@ import useKeyfileGenerator from 'lib/useKeyfileGenerator';
12import * as need from 'lib/need';
12import * as need from 'lib/need';
13
13
14import { OutButton, ForwardButton } from 'components/Buttons';
14import { OutButton, ForwardButton } from 'components/Buttons';
15−import CopyButton from 'components/CopyButton';
15+import { CopyButtonWide } from 'components/CopyButton';
16import NetworkingKeys from 'components/NetworkingKeys';
16import NetworkingKeys from 'components/NetworkingKeys';
17import ProgressButton from 'components/ProgressButton';
17import ProgressButton from 'components/ProgressButton';
18
18
@@ -221,8 +221,7 @@ function Hosting({ manualNetworkSeed }) {
221 <Grid.Item
221 <Grid.Item
222 full
222 full
223 className="mt2"
223 className="mt2"
224− as={ForwardButton}
224+ as={CopyButtonWide}
225− accessory={<CopyButton text={code} />}
226 detail={code}
225 detail={code}
227 detailClassName="mono">
226 detailClassName="mono">
228 Login Code
227 Login Code