import React from 'react'; import { Just, Nothing } from 'folktale/maybe'; import { H1, H2, P, Grid } from 'indigo-react'; import { ROUTE_NAMES } from 'lib/routeNames'; import { isZeroAddress } from 'lib/wallet'; import useIsEclipticOwner from 'lib/useIsEclipticOwner'; import { useSyncKnownPoints } from 'lib/useSyncPoints'; import { useHistory } from 'store/history'; import { useWallet } from 'store/wallet'; import { usePointCache } from 'store/pointCache'; import View from 'components/View'; import { ForwardButton } from 'components/Buttons'; import useLifecycle from 'lib/useLifecycle'; //TODO new component import { usePointCursor } from 'store/pointCursor'; import * as ob from 'urbit-ob'; const PointList = function(props) { const { setPointCursor } = usePointCursor(); const history = useHistory(); const { points, loading } = props; return points.length === 0 ? (
{loading ? 'Loading...' : 'No points to display'}
) : ( <> {points.map(point => ({ setPointCursor(Just(point)); history.push(ROUTE_NAMES.POINT); }}> {ob.patp(point)}
))} > ); }; const matchArray = obj => obj.matchWith({ Nothing: () => [], Just: p => p.value }); const hasTransferProxy = (details, point) => !isZeroAddress(details.transferProxy); export default function Points() { const { wallet } = useWallet(); const history = useHistory(); const { getControlledPoints, syncControlledPoints, getDetails, } = usePointCache(); const { ownedPoints, incomingPoints, managingPoints, votingPoints, spawningPoints, } = getControlledPoints(wallet); const isEclipticOwner = useIsEclipticOwner(); const owned = matchArray(ownedPoints); const incoming = matchArray(incomingPoints); const managing = matchArray(managingPoints); const voting = matchArray(votingPoints); const spawning = matchArray(spawningPoints); // sync controlled points on mount useLifecycle(() => { syncControlledPoints(); }); // sync display details for known points useSyncKnownPoints([ ...owned, ...incoming, ...managing, ...voting, ...spawning, ]); const loading = Nothing.hasInstance(ownedPoints); const outgoing = ownedPoints.filter(point => getDetails(point).matchWith({ Nothing: () => false, Just: p => hasTransferProxy(p.value), }) ); return (A point is an identity on the Ethereum blockchain. Points declare keys for ships on the Arvo network.
You do not own these points until you accept the incoming transfer. You may reject any incoming transfers.
You own these points until the recipient accepts the incoming transfer. You may cancel the transfer until accepted.
You can configure or set network keys and conduct sponsorship related operations for these points.
Since you are part of the Galactic Senate, you can cast votes on new Azimuth proposals on behalf of these points.
You can create new child points under these points.