1import React, { useCallback, useMemo } 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';
10import * as need from 'lib/need';
11import { useLocalRouter } from 'lib/LocalRouter';
12import useCurrentPointName from 'lib/useCurrentPointName';
13import useEthereumTransaction from 'lib/useEthereumTransaction';
14import { GAS_LIMITS } from 'lib/constants';
16import ViewHeader from 'components/ViewHeader';
17import InlineEthereumTransaction from 'components/InlineEthereumTransaction';
18import { AddressInput } from 'form/Inputs';
19import { composeValidator, buildAddressValidator } from 'form/validators';
20import BridgeForm from 'form/BridgeForm';
21import FormError from 'form/FormError';
23function useTransfer() {
24 const { contracts } = useNetwork();
25 const { pointCursor } = usePointCursor();
26 const { syncDetails } = usePointCache();
28 const _contracts = need.contracts(contracts);
29 const _point = need.point(pointCursor);
31 return useEthereumTransaction(
33 address => azimuth.ecliptic.setTransferProxy(_contracts, _point, address),
36 useCallback(() => syncDetails(_point), [_point, syncDetails]),
41export default function AdminTransfer() {
42 const { pop } = useLocalRouter();
43 const name = useCurrentPointName();
53 const validate = useMemo(
54 () => composeValidator({ address: buildAddressValidator() }),
58 const onValues = useCallback(
59 ({ valid, values }) => {
61 construct(values.address);
66 [construct, unconstruct]
71 <Grid.Item full as={ViewHeader}>
75 <BridgeForm validate={validate} onValues={onValues}>
76 {({ handleSubmit, values }) => (
81 className={cn('f5 wrap', {
85 ? `${values.address} is now the Transfer Proxy for ${name} and can accept the transfer by logging into Bridge themselves. Until they accept your transfer, you will still have ownership over ${name}.`
86 : `Transfer ${name} to a new owner.`}
95 label="Ethereum Address"
96 disabled={inputsLocked}
100 <Grid.Item full as={FormError} />
104 as={InlineEthereumTransaction}
106 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