1import React, { useCallback } from 'react';
2import cn from 'classnames';
3import { Grid, Text } 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 { useHistory } from 'store/history';
10import { useWallet } from 'store/wallet';
12import * as need from 'lib/need';
13import useCurrentPointName from 'lib/useCurrentPointName';
14import useEthereumTransaction from 'lib/useEthereumTransaction';
15import { GAS_LIMITS } from 'lib/constants';
16import useLifecycle from 'lib/useLifecycle';
18import ViewHeader from 'components/ViewHeader';
19import MiniBackButton from 'components/MiniBackButton';
20import InlineEthereumTransaction from 'components/InlineEthereumTransaction';
21import View from 'components/View';
23function useAcceptTransfer() {
24 const { contracts } = useNetwork();
25 const { pointCursor } = usePointCursor();
26 const { syncOwnedPoint, syncControlledPoints } = usePointCache();
27 const { wallet } = useWallet();
29 const _contracts = need.contracts(contracts);
30 const _point = need.point(pointCursor);
31 const _address = need.addressFromWallet(wallet);
33 const { construct, ...rest } = useEthereumTransaction(
36 azimuth.ecliptic.transferPoint(
42 [_contracts, _point, _address]
45 () => Promise.all([syncOwnedPoint(_point), syncControlledPoints()]),
46 [_point, syncControlledPoints, syncOwnedPoint]
60export default function AcceptTransfer() {
61 const { pop } = useHistory();
63 const name = useCurrentPointName();
65 const { completed, bind } = useAcceptTransfer();
70 <Grid.Item full as={MiniBackButton} onClick={() => pop()} />
72 <Grid.Item full as={ViewHeader}>
83 ? `${name} has been accepted.`
84 : `Accept the incoming transfer of ${name}.`}
89 as={InlineEthereumTransaction}
91 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