@@ -1,188 +0,0 @@
1−import React from 'react';
2−import { azimuth } from 'azimuth-js';
3−import * as need from '../../lib/need';
5−import { isZeroAddress, eqAddr } from '../../lib/wallet';
6−import { H2, P } from '../../components/old/Base';
7−import { Button } from '../../components/old/Base';
8−import { ROUTE_NAMES } from '../../lib/routeNames';
9−import { useHistory } from '../../store/history';
10−import { useWallet } from '../../store/wallet';
11−import { Grid } from 'indigo-react';
12−import { usePointCursor } from 'store/pointCursor';
13−import { usePointCache } from 'store/pointCache';
14−import { CURVE_ZERO_ADDR } from 'lib/keys';
16−const isPlanet = point =>
17− azimuth.getPointSize(point) === azimuth.PointSize.Planet;
20− const history = useHistory();
21− const { wallet } = useWallet();
22− const { pointCursor } = usePointCursor();
23− const point = need.point(pointCursor);
24− const { getDetails } = usePointCache();
25− const pointDetails = getDetails(point);
27− const addr = need.addressFromWallet(wallet);
29− const planet = isPlanet(point);
31− const isOwner = pointDetails.matchWith({
33− Just: details => eqAddr(details.value.owner, addr),
35− const isActive = pointDetails.matchWith({
37− Just: details => details.value.active,
39− const isActiveOwner = isOwner && isActive;
40− const canSetSpawnProxy = isActiveOwner && !planet;
41− const canSetManagementProxy = isActiveOwner;
45− pointDetails.matchWith({
47− Just: details => eqAddr(details.value.managementProxy, addr),
49− const canConfigureKeys = canManage && isActive;
51− const canIssueChild = pointDetails.matchWith({
52− Nothing: () => false,
54− const hasPermission = isOwner || eqAddr(details.value.spawnProxy, addr);
56− const isBooted = details.value.keyRevisionNumber > 0;
58− const isNotPlanet = !isPlanet(point);
60− return hasPermission && isBooted && isNotPlanet;
64− const canTransfer = pointDetails.matchWith({
65− Nothing: () => false,
67− eqAddr(deets.value.transferProxy, addr) ||
68− eqAddr(deets.value.owner, addr),
71− const canAcceptTransfer = pointDetails.matchWith({
72− Nothing: () => false,
73− Just: deets => eqAddr(deets.value.transferProxy, addr),
76− const canCancelTransfer = pointDetails.matchWith({
77− Nothing: () => false,
79− eqAddr(deets.value.owner, addr) &&
80− !isZeroAddress(deets.value.transferProxy),
83− const displayReminder = pointDetails.matchWith({
84− Nothing: () => false,
87− deets.value.encryptionKey === CURVE_ZERO_ADDR &&
88− deets.value.authenticationKey === CURVE_ZERO_ADDR
97− <P>{`Before you can issue child points or generate your Arvo
98− keyfile, you need to set your public keys.`}</P>
103− <Grid.Item third={1}>
107− disabled={planet && !canIssueChild}
109− history.push(ROUTE_NAMES.ISSUE_CHILD);
117− disabled={!canAcceptTransfer}
119− history.push(ROUTE_NAMES.ACCEPT_TRANSFER);
121− {'Accept incoming transfer'}
127− disabled={!canCancelTransfer}
129− history.push(ROUTE_NAMES.CANCEL_TRANSFER);
131− {'Cancel outgoing transfer'}
134− <Grid.Item third={2}>
136− disabled={!canSetSpawnProxy}
140− history.push(ROUTE_NAMES.SET_SPAWN_PROXY);
142− {'Change spawn proxy'}
146− disabled={!canSetManagementProxy}
150− history.push(ROUTE_NAMES.SET_MANAGEMENT_PROXY);
152− {'Change management proxy'}
156− disabled={!canConfigureKeys}
160− history.push(ROUTE_NAMES.SET_KEYS);
162− {'Set network keys'}
166− disabled={!canTransfer}
170− history.push(ROUTE_NAMES.TRANSFER);
178− history.push(ROUTE_NAMES.INVITES_MANAGE);
188−export default Actions;