1import React from 'react';
2import { azimuth } from 'azimuth-js';
3import * as need from '../../lib/need';
5import { CURVE_ZERO_ADDR, 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';
15const isPlanet = point =>
16 azimuth.getPointSize(point) === azimuth.PointSize.Planet;
19 const history = useHistory();
20 const { wallet } = useWallet();
21 const { pointCursor } = usePointCursor();
22 const point = need.point(pointCursor);
23 const { getDetails } = usePointCache();
24 const pointDetails = getDetails(point);
26 const addr = need.addressFromWallet(wallet);
28 const planet = isPlanet(point);
30 const isOwner = pointDetails.matchWith({
32 Just: details => eqAddr(details.value.owner, addr),
34 const isActive = pointDetails.matchWith({
36 Just: details => details.value.active,
38 const isActiveOwner = isOwner && isActive;
39 const canSetSpawnProxy = isActiveOwner && !planet;
40 const canSetManagementProxy = isActiveOwner;
44 pointDetails.matchWith({
46 Just: details => eqAddr(details.value.managementProxy, addr),
48 const canConfigureKeys = canManage && isActive;
50 const canIssueChild = pointDetails.matchWith({
53 const hasPermission = isOwner || eqAddr(details.value.spawnProxy, addr);
55 const isBooted = details.value.keyRevisionNumber > 0;
57 const isNotPlanet = !isPlanet(point);
59 return hasPermission && isBooted && isNotPlanet;
63 const canTransfer = pointDetails.matchWith({
66 eqAddr(deets.value.transferProxy, addr) ||
67 eqAddr(deets.value.owner, addr),
70 const canAcceptTransfer = pointDetails.matchWith({
72 Just: deets => eqAddr(deets.value.transferProxy, addr),
75 const canCancelTransfer = pointDetails.matchWith({
78 eqAddr(deets.value.owner, addr) &&
79 !isZeroAddress(deets.value.transferProxy),
82 const displayReminder = pointDetails.matchWith({
86 deets.value.encryptionKey === CURVE_ZERO_ADDR &&
87 deets.value.authenticationKey === CURVE_ZERO_ADDR
96 <P>{`Before you can issue child points or generate your Arvo
97 keyfile, you need to set your public keys.`}</P>
102 <Grid.Item third={1}>
106 disabled={planet && !canIssueChild}
108 history.push(ROUTE_NAMES.ISSUE_CHILD);
116 disabled={!canAcceptTransfer}
118 history.push(ROUTE_NAMES.ACCEPT_TRANSFER);
120 {'Accept incoming transfer'}
126 disabled={!canCancelTransfer}
128 history.push(ROUTE_NAMES.CANCEL_TRANSFER);
130 {'Cancel outgoing transfer'}
133 <Grid.Item third={2}>
135 disabled={!canSetSpawnProxy}
139 history.push(ROUTE_NAMES.SET_SPAWN_PROXY);
141 {'Change spawn proxy'}
145 disabled={!canSetManagementProxy}
149 history.push(ROUTE_NAMES.SET_MANAGEMENT_PROXY);
151 {'Change management proxy'}
155 disabled={!canConfigureKeys}
159 history.push(ROUTE_NAMES.SET_KEYS);
165 disabled={!canTransfer}
169 history.push(ROUTE_NAMES.TRANSFER);
177 history.push(ROUTE_NAMES.INVITES_MANAGE);
187export 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