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 { useLocalRouter } from 'lib/LocalRouter';
17import ViewHeader from 'components/ViewHeader';
18import InlineEthereumTransaction from 'components/InlineEthereumTransaction';
19import View from 'components/View';
21import BridgeForm from 'form/BridgeForm';
22import { composeValidator, buildCheckboxValidator } from 'form/validators';
24function useAcceptTransfer() {
25 const { contracts } = useNetwork();
26 const { pointCursor } = usePointCursor();
27 const { syncExtras, syncControlledPoints } = usePointCache();
28 const { wallet } = useWallet();
30 const _contracts = need.contracts(contracts);
31 const _point = need.point(pointCursor);
32 const _address = need.addressFromWallet(wallet);
34 const transaction = useEthereumTransaction(
37 azimuth.ecliptic.transferPoint(_contracts, _point, _address, reset),
38 [_contracts, _point, _address]
41 () => Promise.all([syncExtras(_point), syncControlledPoints()]),
42 [_point, syncControlledPoints, syncExtras]
52export default function AcceptTransfer() {
53 const { pop } = useLocalRouter();
55 const name = useCurrentPointName();
57 const { completed, bind, inputsLocked, construct } = useAcceptTransfer();
59 const initialValues = useMemo(() => ({ noReset: false }), []);
61 const validate = useMemo(
62 () => composeValidator({ noReset: buildCheckboxValidator() }),
66 const onValues = useCallback(
67 ({ valid, values, form }) => {
68 construct(!values.noReset);
74 <View pop={pop} inset>
76 <Grid.Item full as={ViewHeader}>
83 className={cn('f5 wrap', {
87 ? `${name} has been accepted.`
88 : `Accept the incoming transfer of ${name}.`}
93 initialValues={initialValues}
100 label="Retain proxies and key configuration, in case of transferring to self"
101 disabled={inputsLocked}
108 as={InlineEthereumTransaction}
110 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