on master help sign in
transfer: point out lockups during galaxy transfer

To make galaxy owners aware that locked up stars will not transfer with the galaxy, but need to be transferred separately if so desired.

commitebac710d6662f593b3358d38b8b92fbf29f53d9c authorfang <git@fang.io> dateTue 30 Mar 2021, 17:05 (6 years ago) parent5ccd972
1 file changed+19
src/views/UrbitID/Transfer.js+19
src/views/UrbitID/Transfer.js+19
@@ -6,6 +6,7 @@ import * as azimuth from 'azimuth-js';
66import { useNetwork } from 'store/network';
77import { usePointCursor } from 'store/pointCursor';
88import { usePointCache } from 'store/pointCache';
9+import { useStarReleaseCache } from 'store/starRelease';
910
1011import * as need from 'lib/need';
1112import { useLocalRouter } from 'lib/LocalRouter';
@@ -14,6 +15,7 @@ import useEthereumTransaction from 'lib/useEthereumTransaction';
1415import { GAS_LIMITS } from 'lib/constants';
1516
1617import ViewHeader from 'components/ViewHeader';
18+import NoticeBox from 'components/NoticeBox';
1719import InlineEthereumTransaction from 'components/InlineEthereumTransaction';
1820import { AddressInput } from 'form/Inputs';
1921import { composeValidator, buildAddressValidator } from 'form/validators';
@@ -41,6 +43,8 @@ function useTransfer() {
4143export default function AdminTransfer() {
4244 const { pop } = useLocalRouter();
4345 const name = useCurrentPointName();
46+ const { pointCursor } = usePointCursor();
47+ const { starReleaseDetails } = useStarReleaseCache();
4448
4549 const {
4650 construct,
@@ -50,6 +54,15 @@ export default function AdminTransfer() {
5054 bind,
5155 } = useTransfer();
5256
57+ const needLockupWarning = useMemo(() => {
58+ const point = need.point(pointCursor);
59+ const az = azimuth.azimuth;
60+ return (
61+ az.getPointSize(point) === az.PointSize.Galaxy &&
62+ starReleaseDetails.map(a => a.kind).getOrElse('none') !== 'none'
63+ );
64+ }, [pointCursor, starReleaseDetails]);
65+
5366 const validate = useMemo(
5467 () => composeValidator({ address: buildAddressValidator() }),
5568 []
@@ -80,6 +93,12 @@ export default function AdminTransfer() {
8093 Transfer {name} to a new owner.
8194 </Grid.Item>
8295 )}
96+ {!completed && needLockupWarning && (
97+ <Grid.Item full as={NoticeBox}>
98+ You have stars in lockup. These will not transfer with the{' '}
99+ galaxy. If you wish, you must transfer the lockup separately.
100+ </Grid.Item>
101+ )}
83102 {completed && (
84103 <>
85104 <Grid.Item full as={Text} className="wrap">