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 { 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';
22function useAcceptTransfer() {
23 const { contracts } = useNetwork();
24 const { pointCursor } = usePointCursor();
25 const { syncOwnedPoint, syncControlledPoints } = usePointCache();
26 const { wallet } = useWallet();
28 const _contracts = need.contracts(contracts);
29 const _point = need.point(pointCursor);
30 const _address = need.addressFromWallet(wallet);
32 const { construct, ...rest } = useEthereumTransaction(
35 azimuth.ecliptic.transferPoint(
41 [_contracts, _point, _address]
44 () => Promise.all([syncOwnedPoint(_point), syncControlledPoints()]),
45 [_point, syncControlledPoints, syncOwnedPoint]
59export default function AcceptTransfer() {
60 const { pop } = useLocalRouter();
62 const name = useCurrentPointName();
64 const { completed, bind } = useAcceptTransfer();
67 <View pop={pop} inset>
69 <Grid.Item full as={ViewHeader}>
76 className={cn('f5 wrap', {
80 ? `${name} has been accepted.`
81 : `Accept the incoming transfer of ${name}.`}
86 as={InlineEthereumTransaction}
88 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