1import React from 'react';
2import { azimuth } from 'azimuth-js';
3import * as need from '../../lib/need';
5import { isZeroAddress, eqAddr } from '../../lib/wallet';
6import { H2, P } from '../../components/old/Base';
7import { Button } from '../../components/old/Base';
8import { ROUTE_NAMES } from '../../lib/routeNames';
9import { useHistory } from '../../store/history';
10import { useWallet } from '../../store/wallet';
11import { Grid } from 'indigo-react';
12import { usePointCursor } from 'store/pointCursor';
13import { usePointCache } from 'store/pointCache';
14import { CURVE_ZERO_ADDR } from 'lib/keys';
16const 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({
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({
67 eqAddr(deets.value.transferProxy, addr) ||
68 eqAddr(deets.value.owner, addr),
71 const canAcceptTransfer = pointDetails.matchWith({
73 Just: deets => eqAddr(deets.value.transferProxy, addr),
76 const canCancelTransfer = pointDetails.matchWith({
79 eqAddr(deets.value.owner, addr) &&
80 !isZeroAddress(deets.value.transferProxy),
83 const displayReminder = pointDetails.matchWith({
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);
166 disabled={!canTransfer}
170 history.push(ROUTE_NAMES.TRANSFER);
178 history.push(ROUTE_NAMES.INVITES_MANAGE);
188export default Actions;
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list