1import React, { useCallback, useMemo } from 'react';
2import cn from 'classnames';
3import { Grid, Text, CheckboxInput } from 'indigo-react';
4import * as azimuth from 'azimuth-js';
6import { useNetwork } from 'store/network';
7import { usePointCursor } from 'store/pointCursor';
8import { usePointCache } from 'store/pointCache';
9import { useWallet } from 'store/wallet';
11import * as need from 'lib/need';
12import useCurrentPointName from 'lib/useCurrentPointName';
13import useEthereumTransaction from 'lib/useEthereumTransaction';
14import { GAS_LIMITS } from 'lib/constants';
15import useLifecycle from 'lib/useLifecycle';
16import { useLocalRouter } from 'lib/LocalRouter';
18import ViewHeader from 'components/ViewHeader';
19import InlineEthereumTransaction from 'components/InlineEthereumTransaction';
20import View from 'components/View';
22import BridgeForm from 'form/BridgeForm';
23import { composeValidator, buildCheckboxValidator } from 'form/validators';
25function useAcceptTransfer() {
26 const { contracts } = useNetwork();
27 const { pointCursor } = usePointCursor();
28 const { syncOwnedPoint, syncControlledPoints } = usePointCache();
29 const { wallet } = useWallet();
31 const _contracts = need.contracts(contracts);
32 const _point = need.point(pointCursor);
33 const _address = need.addressFromWallet(wallet);
35 const transaction = useEthereumTransaction(
38 azimuth.ecliptic.transferPoint(_contracts, _point, _address, reset),
39 [_contracts, _point, _address]
42 () => Promise.all([syncOwnedPoint(_point), syncControlledPoints()]),
43 [_point, syncControlledPoints, syncOwnedPoint]
53export default function AcceptTransfer() {
54 const { pop } = useLocalRouter();
56 const name = useCurrentPointName();
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);
75 <View pop={pop} inset>
77 <Grid.Item full as={ViewHeader}>
84 className={cn('f5 wrap', {
88 ? `${name} has been accepted.`
89 : `Accept the incoming transfer of ${name}.`}
94 initialValues={initialValues}
101 label="Retain proxies and key configuration, in case of transferring to self"
102 disabled={inputsLocked}
109 as={InlineEthereumTransaction}
111 onReturn={() => pop()}
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