1import React, { useCallback, useEffect } from 'react';
2import cn from 'classnames';
3import { Grid, Text, Input } from 'indigo-react';
4import * as azimuth from 'azimuth-js';
6import { useNetwork } from 'store/network';
7import { usePointCursor } from 'store/pointCursor';
8import { usePointCache } from 'store/pointCache';
10import * as need from 'lib/need';
11import { useLocalRouter } from 'lib/LocalRouter';
12import { useAddressInput } from 'lib/useInputs';
13import useCurrentPointName from 'lib/useCurrentPointName';
14import useEthereumTransaction from 'lib/useEthereumTransaction';
15import { GAS_LIMITS } from 'lib/constants';
17import ViewHeader from 'components/ViewHeader';
18import MiniBackButton from 'components/MiniBackButton';
19import InlineEthereumTransaction from 'components/InlineEthereumTransaction';
21function useTransfer() {
22 const { contracts } = useNetwork();
23 const { pointCursor } = usePointCursor();
24 const { syncOwnedPoint } = usePointCache();
26 const _contracts = need.contracts(contracts);
27 const _point = need.point(pointCursor);
30 construct: _construct,
35 } = useEthereumTransaction(GAS_LIMITS.SET_PROXY);
37 const construct = useCallback(
40 azimuth.ecliptic.setTransferProxy(_contracts, _point, address)
42 [_construct, _contracts, _point]
45 // sync point details after success
48 syncOwnedPoint(_point);
50 }, [_point, confirmed, syncOwnedPoint]);
61export default function AdminTransfer() {
62 const { pop } = useLocalRouter();
63 const name = useCurrentPointName();
73 const [addressInput, { pass, data: address }] = useAddressInput({
75 label: `Ethereum Address`,
76 disabled: inputsLocked,
85 }, [pass, address, construct, unconstruct]);
89 <Grid.Item full as={MiniBackButton} onClick={() => pop()} />
90 <Grid.Item full as={ViewHeader}>
100 ? `${address} is now the Transfer Proxy for ${name} and can accept the transfer by logging into Multipass themselves. Until they accept your transfer, you will still have ownership over ${name}.`
101 : `Transfer ${name} to a new owner.`}
104 <Grid.Item full as={Input} {...addressInput} className="mv4" />
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