@@ -12,15 +12,15 @@ import { useNetwork } from 'store/network';
12import { useRollerStore } from 'store/rollerStore';
12import { useRollerStore } from 'store/rollerStore';
14import * as need from 'lib/need';
14import * as need from 'lib/need';
15−import { isZeroAddress, abbreviateAddress } from 'lib/utils/address';
15+import { abbreviateAddress } from 'lib/utils/address';
16import useIsEclipticOwner from 'lib/useIsEclipticOwner';
16import useIsEclipticOwner from 'lib/useIsEclipticOwner';
17import { useSyncDetails } from 'lib/useSyncPoints';
17import { useSyncDetails } from 'lib/useSyncPoints';
18import useRejectedIncomingPointTransfers from 'lib/useRejectedIncomingPointTransfers';
18import useRejectedIncomingPointTransfers from 'lib/useRejectedIncomingPointTransfers';
19import { pluralize } from 'lib/pluralize';
19import { pluralize } from 'lib/pluralize';
20+import Point from 'lib/types/Point';
20import newGithubIssueUrl from 'new-github-issue-url';
21import newGithubIssueUrl from 'new-github-issue-url';
22import View from 'components/View';
23import View from 'components/View';
23−import Passport from 'components/Passport';
24import Footer from 'components/Footer';
24import Footer from 'components/Footer';
25import { ForwardButton } from 'components/Buttons';
25import { ForwardButton } from 'components/Buttons';
26import CopiableAddress from 'components/copiable/CopiableAddress';
26import CopiableAddress from 'components/copiable/CopiableAddress';
@@ -28,6 +28,7 @@ import NavHeader from 'components/NavHeader';
28import L2PointHeader from 'components/L2/Headers/L2PointHeader';
28import L2PointHeader from 'components/L2/Headers/L2PointHeader';
29import IncomingPoint from 'components/L2/Points/IncomingPoint';
29import IncomingPoint from 'components/L2/Points/IncomingPoint';
30import LoadingOverlay from 'components/L2/LoadingOverlay';
30import LoadingOverlay from 'components/L2/LoadingOverlay';
31+import PointList from 'components/L2/PointList';
31import { Box, Text } from '@tlon/indigo-react';
32import { Box, Text } from '@tlon/indigo-react';
33import './Points.scss';
34import './Points.scss';
@@ -42,56 +43,18 @@ export const maybeGetResult = (obj, key, defaultValue) =>
45−export const hasTransferProxy = details =>
46− !isZeroAddress(details.transferProxy);
48−export const isLocked = (details, contracts) =>
46+export const isLocked = (details: any, contracts: any) =>
49 details.owner === contracts.linearSR ||
47 details.owner === contracts.linearSR ||
50 details.owner === contracts.conditionalSR;
48 details.owner === contracts.conditionalSR;
52−const PointList = function({
50+interface ActionButtonProps {
55− actions,
51+ actions?: {
56− locked = false,
52+ text?: string;
60− const { setPointCursor } = usePointCursor();
61− const { push, names } = useHistory();
64− <Grid gap={4} className={className}>
65− {points.map((point, i) => (
68− className={`full fourth-${(i % 4) + 1}-md fourth-${(i % 4) + 1}-lg`}>
72− processing={processing}
74− onClick={
53+ onClick?: () => void;
75− locked || processing
54+ }[];
78− setPointCursor(Just(point));
85− <Flex.Item className="mt2">{actions(point, i)}</Flex.Item>
94−function ActionButtons({ actions = [] }) {
57+function ActionButtons({ actions = [] }: ActionButtonProps) {
96 <Flex row>
59 <Flex row>
97 {actions.map(action => (
60 {actions.map(action => (
@@ -164,9 +127,7 @@ export default function Points() {
164 [getDetails, controlledPoints, _contracts]
127 [getDetails, controlledPoints, _contracts]
167− const allPoints = pointList
168− .filter(({ shouldDisplay }) => shouldDisplay)
130+ const allPoints = pointList.filter(({ shouldDisplay }) => shouldDisplay);
169− .map(({ value }) => value);
171 // if we can only interact with a single point, jump to the point page.
132 // if we can only interact with a single point, jump to the point page.
172 // if there are any pending transfers, incoming or outgoing, stay on this
133 // if there are any pending transfers, incoming or outgoing, stay on this
@@ -182,7 +143,7 @@ export default function Points() {
182 (starReleaseDetails.value === null ||
143 (starReleaseDetails.value === null ||
183 starReleaseDetails.value.total === 0)
144 starReleaseDetails.value.total === 0)
185− setPointCursor(Just(allPoints[0]));
146+ setPointCursor(Just(allPoints[0].value));
186 push(names.POINT);
147 push(names.POINT);
@@ -201,11 +162,13 @@ export default function Points() {
201 const loading = Nothing.hasInstance(controlledPoints);
162 const loading = Nothing.hasInstance(controlledPoints);
203 const ownedPoints = maybeGetResult(controlledPoints, 'ownedPoints', []);
164 const ownedPoints = maybeGetResult(controlledPoints, 'ownedPoints', []);
204− const lockedPoints = maybeLockedPoints.getOrElse([]);
165+ const lockedPoints = maybeLockedPoints
167+ .map((value: number) => ({ value }));
206− const processingPoints = pointList
169+ const processingPoints = pointList.filter(
207− .filter(({ shouldDisplay }) => !shouldDisplay)
170+ ({ shouldDisplay }) => !shouldDisplay
208− .map(({ value }) => value);
171+ );
210 const displayEmptyState =
173 const displayEmptyState =
211 !loading && incomingPoints.length === 0 && allPoints.length === 0;
174 !loading && incomingPoints.length === 0 && allPoints.length === 0;
@@ -331,14 +294,14 @@ export default function Points() {
331 <Grid.Item
294 <Grid.Item
333 as={PointList}
296 as={PointList}
334− points={outgoingPoints.map(({ value }) => value)}
297+ points={outgoingPoints}
335− actions={(point, i) => (
298+ actions={(point: Point, i: number) => (
336 <ActionButtons
299 <ActionButtons
337 actions={[
300 actions={[
339 text: 'Cancel',
302 text: 'Cancel',
340 onClick: () => {
303 onClick: () => {
341− setPointCursor(Just(point));
304+ setPointCursor(Just(point.value));
342 // TODO: deep linking to fix this duplicate route
305 // TODO: deep linking to fix this duplicate route
343 push(names.CANCEL_TRANSFER);
306 push(names.CANCEL_TRANSFER);
@@ -358,11 +321,11 @@ export default function Points() {
359 {lockedPoints.length > 0 && (
322 {lockedPoints.length > 0 && (
360 <Grid.Item full as={Grid} gap={1}>
323 <Grid.Item full as={Grid} gap={1}>
361− <Grid.Item full as={PointList} locked points={allPoints} />
324+ <Grid.Item full as={PointList} locked points={lockedPoints} />
362 </Grid.Item>
325 </Grid.Item>
365− {processingPoints.length > 0 && (
328+ {/* {processingPoints.length > 0 && (
366 <Grid.Item full as={Grid} gap={1} className="mv6">
329 <Grid.Item full as={Grid} gap={1} className="mv6">
367 <Grid.Item full as={H5}>
330 <Grid.Item full as={H5}>
368 Awaiting L2 Rollup
331 Awaiting L2 Rollup
@@ -374,7 +337,7 @@ export default function Points() {
374 processing
337 processing
376 </Grid.Item>
339 </Grid.Item>