@@ -1,8 +1,6 @@
1−import React, { useCallback, useMemo, useState } from 'react';
1+import React, { useCallback, useEffect, useMemo, useState } from 'react';
2−import cn from 'classnames';
3import { Grid, Text, Button } from 'indigo-react';
2import { Grid, Text, Button } from 'indigo-react';
4import * as azimuth from 'azimuth-js';
3import * as azimuth from 'azimuth-js';
5−import { Row } from '@tlon/indigo-react';
7import { useNetwork } from 'store/network';
5import { useNetwork } from 'store/network';
8import { usePointCursor } from 'store/pointCursor';
6import { usePointCursor } from 'store/pointCursor';
@@ -26,18 +24,20 @@ import FormError from 'form/FormError';
26import Window from 'components/L2/Window/Window';
24import Window from 'components/L2/Window/Window';
27import HeaderPane from 'components/L2/Window/HeaderPane';
25import HeaderPane from 'components/L2/Window/HeaderPane';
28import BodyPane from 'components/L2/Window/BodyPane';
26import BodyPane from 'components/L2/Window/BodyPane';
27+import { L1TxnType } from 'lib/types/PendingL1Transaction';
30function useTransfer() {
29function useTransfer() {
31− const { contracts } = useNetwork();
30+ const { contracts }: any = useNetwork();
32− const { pointCursor } = usePointCursor();
31+ const { pointCursor }: any = usePointCursor();
33− const { syncDetails } = usePointCache();
32+ const { syncDetails }: any = usePointCache();
35 const _contracts = need.contracts(contracts);
34 const _contracts = need.contracts(contracts);
36 const _point = need.point(pointCursor);
35 const _point = need.point(pointCursor);
38 return useEthereumTransaction(
37 return useEthereumTransaction(
39 useCallback(
38 useCallback(
40− address => azimuth.ecliptic.setTransferProxy(_contracts, _point, address),
40+ azimuth.ecliptic.setTransferProxy(_contracts, _point, address),
41 [_contracts, _point]
41 [_contracts, _point]
43 useCallback(() => syncDetails(_point), [_point, syncDetails]),
43 useCallback(() => syncDetails(_point), [_point, syncDetails]),
@@ -46,14 +46,15 @@ function useTransfer() {
48export default function AdminTransfer() {
48export default function AdminTransfer() {
49− const { pop } = useLocalRouter();
49+ const { pop }: any = useLocalRouter();
50 const name = useCurrentPointName();
50 const name = useCurrentPointName();
51− const { pointCursor } = usePointCursor();
52− const { starReleaseDetails } = useStarReleaseCache();
51+ const { starReleaseDetails }: any = useStarReleaseCache();
52+ const { point } = useRollerStore();
54− point: { isL2 },
54+ setProxyAddress,
55− } = useRollerStore();
56− const { setProxyAddress, getPendingTransactions } = useRoller();
55+ getPendingTransactions,
57 const [owner, setNewOwner] = useState('');
58 const [owner, setNewOwner] = useState('');
@@ -62,18 +63,34 @@ export default function AdminTransfer() {
62 completed,
63 completed,
63 inputsLocked,
64 inputsLocked,
65 } = useTransfer();
67 } = useTransfer();
67− const point = need.point(pointCursor);
69 const needLockupWarning = useMemo(() => {
69 const needLockupWarning = useMemo(() => {
70 const az = azimuth.azimuth;
70 const az = azimuth.azimuth;
72− az.getPointSize(point) === az.PointSize.Galaxy &&
72+ az.getPointSize(point.value) === az.PointSize.Galaxy &&
73− starReleaseDetails.map(a => a.kind).getOrElse('none') !== 'none'
73+ starReleaseDetails.map((a: any) => a.kind).getOrElse('none') !== 'none'
75 }, [starReleaseDetails, point]);
75 }, [starReleaseDetails, point]);
82+ message: `${point.patp}'s transfer proxy has been set!`,
84+ id: `set-transfer-proxy-${point.value}`,
86+ type: L1TxnType.transferProxy,
88+ time: new Date().getTime(),
92+ }, [completed]); // eslint-disable-line react-hooks/exhaustive-deps
77 const validate = useMemo(
94 const validate = useMemo(
78 () => composeValidator({ address: buildAddressValidator() }),
95 () => composeValidator({ address: buildAddressValidator() }),
@@ -84,14 +101,25 @@ export default function AdminTransfer() {
84 if (owner === '') return;
101 if (owner === '') return;
86 await setProxyAddress('transfer', owner);
103 await setProxyAddress('transfer', owner);
87− getPendingTransactions(point);
104+ getPendingTransactions();
107+ message: `${point.patp}'s transfer proxy has been set!`,
89 } catch (error) {
110 } catch (error) {
90 // setError(error);
111 // setError(error);
91 } finally {
112 } finally {
92 // setLoading(false);
113 // setLoading(false);
94− }, [owner, getPendingTransactions, point, pop, setProxyAddress]);
118+ getPendingTransactions,
96 const onValues = useCallback(
124 const onValues = useCallback(
97 ({ valid, values }) => {
125 ({ valid, values }) => {
@@ -109,9 +137,7 @@ export default function AdminTransfer() {
111 <HeaderPane>
139 <HeaderPane>
112− <Row className="header-row">
113− <h5>Transfer Point</h5>
140+ <h5>Transfer Point</h5>
115 </HeaderPane>
141 </HeaderPane>
116 <BodyPane>
142 <BodyPane>
117 <Grid className="w-full" full gap={1}>
143 <Grid className="w-full" full gap={1}>
@@ -119,7 +145,7 @@ export default function AdminTransfer() {
119 {({ handleSubmit, values }) => (
145 {({ handleSubmit, values }) => (
121 {!completed && (
147 {!completed && (
122− <Grid.Item full as={Text} className={cn('f5 wrap')}>
148+ <Grid.Item full as={Text} style={{ fontSize: 14 }}>
123 Transfer <span className="mono">{name}</span> to a new
149 Transfer <span className="mono">{name}</span> to a new
125 </Grid.Item>
151 </Grid.Item>
@@ -160,7 +186,7 @@ export default function AdminTransfer() {
161 <Grid.Item full as={FormError} />
187 <Grid.Item full as={FormError} />
163− {isL2 ? (
189+ {point.isL2 ? (
164 <Grid.Item
190 <Grid.Item
165 as={Button}
191 as={Button}