@@ -1,6 +1,6 @@
1−import React, { useCallback } from 'react';
1+import React, { useCallback, useMemo } from 'react';
2import cn from 'classnames';
2import cn from 'classnames';
3−import { Grid, Text } from 'indigo-react';
3+import { Grid, Text, CheckboxInput } from 'indigo-react';
4import * as azimuth from 'azimuth-js';
4import * as azimuth from 'azimuth-js';
6import { useNetwork } from 'store/network';
6import { useNetwork } from 'store/network';
@@ -19,6 +19,9 @@ import ViewHeader from 'components/ViewHeader';
19import InlineEthereumTransaction from 'components/InlineEthereumTransaction';
19import InlineEthereumTransaction from 'components/InlineEthereumTransaction';
20import View from 'components/View';
20import View from 'components/View';
22+import BridgeForm from 'form/BridgeForm';
23+import { composeValidator, buildCheckboxValidator } from 'form/validators';
22function useAcceptTransfer() {
25function useAcceptTransfer() {
23 const { contracts } = useNetwork();
26 const { contracts } = useNetwork();
24 const { pointCursor } = usePointCursor();
27 const { pointCursor } = usePointCursor();
@@ -29,15 +32,10 @@ function useAcceptTransfer() {
29 const _point = need.point(pointCursor);
32 const _point = need.point(pointCursor);
30 const _address = need.addressFromWallet(wallet);
33 const _address = need.addressFromWallet(wallet);
32− const { construct, ...rest } = useEthereumTransaction(
35+ const transaction = useEthereumTransaction(
33 useCallback(
36 useCallback(
35− azimuth.ecliptic.transferPoint(
38+ azimuth.ecliptic.transferPoint(_contracts, _point, _address, reset),
41 [_contracts, _point, _address]
39 [_contracts, _point, _address]
43 useCallback(
41 useCallback(
@@ -47,12 +45,8 @@ function useAcceptTransfer() {
47 GAS_LIMITS.TRANSFER
45 GAS_LIMITS.TRANSFER
55− ...rest,
49+ ...transaction,
@@ -61,7 +55,21 @@ export default function AcceptTransfer() {
62 const name = useCurrentPointName();
56 const name = useCurrentPointName();
64− const { completed, bind } = useAcceptTransfer();
58+ const { completed, bind, inputsLocked, construct } = useAcceptTransfer();
60+ const initialValues = useMemo(() => ({ noReset: false }), []);
62+ const validate = useMemo(
63+ () => composeValidator({ noReset: buildCheckboxValidator() }),
67+ const onValues = useCallback(
68+ ({ valid, values, form }) => {
69+ construct(!values.noReset);
67 <View pop={pop} inset>
75 <View pop={pop} inset>
@@ -81,6 +89,21 @@ export default function AcceptTransfer() {
81 : `Accept the incoming transfer of ${name}.`}
89 : `Accept the incoming transfer of ${name}.`}
82 </Grid.Item>
90 </Grid.Item>
94+ initialValues={initialValues}
101+ label="Retain proxies and key configuration, in case of transferring to self"
102+ disabled={inputsLocked}
84 <Grid.Item
107 <Grid.Item
86 as={InlineEthereumTransaction}
109 as={InlineEthereumTransaction}