on master help sign in
update-invites: adding alert and updated copy
6ef450fHunter Miller
src/components/L2/CreatingInvitesModal.tsx+5−5
@@ -4,7 +4,7 @@ import { ReactComponent as InviteIcon } from 'assets/invite.svg';
4import { InviteGeneratingStatus } from '../../views/Invite/useInvites';
4import { InviteGeneratingStatus } from '../../views/Invite/useInvites';
5import BodyPane from './Window/BodyPane';
5import BodyPane from './Window/BodyPane';
6
6
7−interface GeneratingModalProps {
7+interface CreatingInvitesModalProps {
8 status: InviteGeneratingStatus;
8 status: InviteGeneratingStatus;
9 current: number;
9 current: number;
10 total: number;
10 total: number;
@@ -18,7 +18,7 @@ export const CreatingInvitesModal = ({
18 total,
18 total,
19 hide,
19 hide,
20 error,
20 error,
21−}: GeneratingModalProps) => {
21+}: CreatingInvitesModalProps) => {
22 const successfulInvites = current > 1 ? current - 1 : 0;
22 const successfulInvites = current > 1 ? current - 1 : 0;
23 return (
23 return (
24 <Modal
24 <Modal
@@ -32,7 +32,7 @@ export const CreatingInvitesModal = ({
32 <Row alignItems="center">
32 <Row alignItems="center">
33 <LoadingSpinner dark />
33 <LoadingSpinner dark />
34 <Text bold marginLeft={2}>
34 <Text bold marginLeft={2}>
35− Creating Invite {current}/{total}...
35+ Updating Invite {current}/{total}...
36 </Text>
36 </Text>
37 </Row>
37 </Row>
38 )}
38 )}
@@ -41,7 +41,7 @@ export const CreatingInvitesModal = ({
41 <Row mb={3}>
41 <Row mb={3}>
42 <InviteIcon />
42 <InviteIcon />
43 <Text bold ml={2}>
43 <Text bold ml={2}>
44− All Invites Created
44+ All Invites Updated
45 </Text>
45 </Text>
46 </Row>
46 </Row>
47 <Text mb={3}>
47 <Text mb={3}>
@@ -58,7 +58,7 @@ export const CreatingInvitesModal = ({
58 {status === 'errored' && (
58 {status === 'errored' && (
59 <>
59 <>
60 <H3 marginBottom={2}>
60 <H3 marginBottom={2}>
61− There was an error while creating your invites:
61+ There was an error while updating your invites:
62 </H3>
62 </H3>
63 {error && (
63 {error && (
64 <Text color="red" mono marginBottom={3}>
64 <Text color="red" mono marginBottom={3}>
src/components/L2/Headers/L2PointHeader.scss+1−1
@@ -52,7 +52,7 @@
52 }
52 }
53
53
54 .create-invites {
54 .create-invites {
55− margin-left: 4px;
55+ margin-left: 8px;
56 }
56 }
57
57
58 .invites {
58 .invites {
src/components/L2/InviteConverter.tsx+12−6
@@ -20,6 +20,8 @@ import {
20} from 'views/Invite/useInvites';
20} from 'views/Invite/useInvites';
21import { usePointCache } from 'store/pointCache';
21import { usePointCache } from 'store/pointCache';
22import { CreatingInvitesModal } from './CreatingInvitesModal';
22import { CreatingInvitesModal } from './CreatingInvitesModal';
23+import { useWallet } from 'store/wallet';
24+import { WALLET_TYPES } from 'lib/constants';
23
25
24interface StarMap {
26interface StarMap {
25 [key: string]: {
27 [key: string]: {
@@ -52,6 +54,9 @@ function allChildrenSelected(selected: string[], childrenPatps: string[]) {
52
54
53export const InviteConverter = ({ points }: InviteConverterProps) => {
55export const InviteConverter = ({ points }: InviteConverterProps) => {
54 const { syncControlledPoints }: any = usePointCache();
56 const { syncControlledPoints }: any = usePointCache();
57+ const { walletType }: any = useWallet();
58+ const signatureFree =
59+ walletType === WALLET_TYPES.TICKET || walletType === WALLET_TYPES.SHARDS;
55 const { api, getPendingTransactions, getAndUpdatePoint } = useRoller();
60 const { api, getPendingTransactions, getAndUpdatePoint } = useRoller();
56 const { inviteJobs } = useInviteStore();
61 const { inviteJobs } = useInviteStore();
57 const { generateInviteCodes } = useInvites();
62 const { generateInviteCodes } = useInvites();
@@ -134,7 +139,6 @@ export const InviteConverter = ({ points }: InviteConverterProps) => {
134
139
135 try {
140 try {
136 for (const { point, children } of Object.values(starMap)) {
141 for (const { point, children } of Object.values(starMap)) {
137− debugger;
138 const filtered = children
142 const filtered = children
139 .filter(p => selected.includes(p.patp))
143 .filter(p => selected.includes(p.patp))
140 .map(p => p.value);
144 .map(p => p.value);
@@ -201,7 +205,7 @@ export const InviteConverter = ({ points }: InviteConverterProps) => {
201 {/*
205 {/*
202 @ts-ignore */}
206 @ts-ignore */}
203 <Button className="create-invites" center onClick={() => setShow(true)}>
207 <Button className="create-invites" center onClick={() => setShow(true)}>
204− Create Invites from Planets
208+ Update Invites
205 </Button>
209 </Button>
206 <Modal small show={show} hide={() => setShow(false)}>
210 <Modal small show={show} hide={() => setShow(false)}>
207 <BodyPane p={0}>
211 <BodyPane p={0}>
@@ -209,7 +213,7 @@ export const InviteConverter = ({ points }: InviteConverterProps) => {
209 <Row alignItems="center" mb={3}>
213 <Row alignItems="center" mb={3}>
210 <InviteIcon />
214 <InviteIcon />
211 <Text bold ml={2}>
215 <Text bold ml={2}>
212− Create Invites for Existing Planets
216+ Updates invites for planets
213 </Text>
217 </Text>
214 </Row>
218 </Row>
215 <Text mb={5}>
219 <Text mb={5}>
@@ -220,9 +224,11 @@ export const InviteConverter = ({ points }: InviteConverterProps) => {
220 keys invalid.
224 keys invalid.
221 </Text>
225 </Text>
222 </Text>
226 </Text>
227+ {!signatureFree && (
223− <Text bold className={!!signatureCount ? '' : 'hidden'}>
228+ <Text bold className={!!signatureCount ? '' : 'hidden'}>
224− {signatureCount} manual signatures will be required.
229+ {signatureCount} manual signatures will be required.
225− </Text>
230+ </Text>
231+ )}
226 <Col
232 <Col
227 bg="washedGray"
233 bg="washedGray"
228 height="300px"
234 height="300px"
src/components/alerts/L2VulnAlert.tsxnew file+49
@@ -0,0 +1,49 @@
1+import { Anchor, BaseButton, Box, Col, Text } from '@tlon/indigo-react';
2+import useLocalStorageState from 'lib/useLocalStorageState';
3+
4+const L2_VULN_KEY = 'l2vuln-2022-03-07';
5+
6+export const L2VulnAlert = () => {
7+ const [showAlert, setShowAlert] = useLocalStorageState(L2_VULN_KEY, true);
8+
9+ if (!showAlert) {
10+ return null;
11+ }
12+
13+ return (
14+ <Box
15+ position="relative"
16+ p={3}
17+ mb={3}
18+ bg="washedBlue"
19+ borderWidth="1px"
20+ borderColor="lightBlue"
21+ borderStyle="solid"
22+ borderRadius={3}>
23+ <Col>
24+ <BaseButton
25+ position="absolute"
26+ top="3px"
27+ right="8px"
28+ fontSize="18px"
29+ fontWeight="200"
30+ cursor="pointer"
31+ bg="transparent"
32+ onClick={() => setShowAlert(false)}>
33+ &#215;
34+ </BaseButton>
35+ <Text bold mb={2}>
36+ ~2022.03.07 - L2 Planet invite fix
37+ </Text>
38+ <Text mb={2}>
39+ Due to an L2 security vulnerability, we strongly recommend you use the
40+ "Update Invites" button to rekey any L2 planet invites that were
41+ previously yet to be claimed.
42+ </Text>
43+ <Anchor href="https://urbit.org" target="_blank">
44+ Learn More About This Issue
45+ </Anchor>
46+ </Col>
47+ </Box>
48+ );
49+};
src/views/Invite/useInvites.ts+1−1
@@ -255,7 +255,7 @@ export function useInvites() {
255 );
255 );
256
256
257 if (!spawn) {
257 if (!spawn) {
258− performL2Reticket({
258+ await performL2Reticket({
259 point: planet,
259 point: planet,
260 to: inviteWallet.ownership.keys.address,
260 to: inviteWallet.ownership.keys.address,
261 manager: inviteWallet.management.keys.address,
261 manager: inviteWallet.management.keys.address,
src/views/Points.tsx+2
@@ -34,6 +34,7 @@ import './Points.scss';
34import { StarReleaseButton } from './Points/StarReleaseButton';
34import { StarReleaseButton } from './Points/StarReleaseButton';
35import { maybeGetResult } from 'lib/maybeGetResult';
35import { maybeGetResult } from 'lib/maybeGetResult';
36import { isGalaxy, isStar } from 'lib/utils/point';
36import { isGalaxy, isStar } from 'lib/utils/point';
37+import { L2VulnAlert } from 'components/alerts/L2VulnAlert';
37
38
38export const isLocked = (details: any, contracts: any) =>
39export const isLocked = (details: any, contracts: any) =>
39 details.owner === contracts.linearSR ||
40 details.owner === contracts.linearSR ||
@@ -270,6 +271,7 @@ export default function Points() {
270 {abbreviateAddress(address)}
271 {abbreviateAddress(address)}
271 </CopiableAddress>
272 </CopiableAddress>
272 </NavHeader>
273 </NavHeader>
274+ <L2VulnAlert />
273 {incomingPoints.map(({ value }) => (
275 {incomingPoints.map(({ value }) => (
274 <IncomingPoint
276 <IncomingPoint
275 key={value}
277 key={value}