1import * as ob from 'urbit-ob';
2import { isGalaxy, isPlanet, isStar } from 'lib/utils/point';
3import { eqAddr, isZeroAddress } from 'lib/utils/address';
4import { L1Point } from './L1Point';
6export interface Points {
10export enum Relationship {
18export default class Point {
23 authenticationKey: string;
24 continuityNumber: string;
25 cryptoSuiteVersion: string;
26 encryptionKey: string;
27 escapeRequested: boolean;
28 escapeRequestedTo: string;
30 keyRevisionNumber: string;
31 managementProxy: string;
35 transferProxy: string;
37 relationship: Relationship;
47 networkKeysSet: boolean;
48 // usePermissionsForPoint details
50 isActiveOwner: boolean;
51 isManagementProxy: boolean;
52 isSpawnProxy: boolean;
53 isVotingProxy: boolean;
54 isTransferProxy: boolean;
55 isManagementProxySet: boolean;
56 isSpawnProxySet: boolean;
57 isVotingProxySet: boolean;
58 isTransferProxySet: boolean;
67 relationship: Relationship,
72 this.patp = value < 0 ? 'null' : ob.patp(value);
73 this.relationship = relationship;
75 this.layer = details.layer;
76 this.isL2Spawn = Boolean(details.isL2Spawn);
77 this.active = details.active;
78 this.authenticationKey = details.authenticationKey;
79 this.continuityNumber = details.continuityNumber;
80 this.cryptoSuiteVersion = details.cryptoSuiteVersion;
81 this.encryptionKey = details.encryptionKey;
82 this.escapeRequested = details.escapeRequested;
83 this.escapeRequestedTo = details.escapeRequestedTo;
84 this.hasSponsor = details.hasSponsor;
85 this.keyRevisionNumber = details.keyRevisionNumber;
86 this.managementProxy = details.managementProxy;
87 this.owner = details.owner;
88 this.spawnProxy = details.spawnProxy;
89 this.sponsor = details.sponsor;
90 this.transferProxy = details.transferProxy;
91 this.votingProxy = details.votingProxy;
92 // Derived details here
93 this.isL2 = this.layer === 2;
94 this.isL1 = this.layer === 1;
95 this.isGalaxy = isGalaxy(value);
96 this.isStar = isStar(value);
97 this.isPlanet = isPlanet(value);
98 this.isParent = !this.isPlanet;
99 this.networkKeysSet = Number(this.keyRevisionNumber) > 0;
100 // usePermissionsForPoint
101 this.isOwner = eqAddr(address, this.owner);
102 this.isActiveOwner = this.isOwner && this.active;
103 this.isManagementProxy = eqAddr(address, this.managementProxy);
104 this.isSpawnProxy = eqAddr(address, this.spawnProxy);
105 this.isVotingProxy = eqAddr(address, this.votingProxy);
106 this.isTransferProxy = eqAddr(address, this.transferProxy);
107 this.isManagementProxySet = !isZeroAddress(this.managementProxy);
108 this.isSpawnProxySet = !isZeroAddress(this.spawnProxy);
109 this.isVotingProxySet = !isZeroAddress(this.votingProxy);
110 this.isTransferProxySet = !isZeroAddress(this.transferProxy);
111 this.canManage = this.isOwner || this.isManagementProxy;
112 this.canTransfer = this.isOwner || this.isTransferProxy;
115 (this.isOwner || this.isSpawnProxy) &&
118 this.isGalaxy && this.active && (this.isOwner || this.isVotingProxy);
122 ((this.isGalaxy && !this.isL2Spawn) || this.isStar || this.isPlanet);
123 this.showInvites = this.canManage || this.canSpawn;
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