WIP for sending ether from portal (works)

This commit is contained in:
fragosti
2018-07-19 04:11:44 -07:00
parent 3a18c249f5
commit dead04dce8
7 changed files with 82 additions and 38 deletions

View File

@@ -6,6 +6,7 @@ import * as React from 'react';
import { Blockchain } from 'ts/blockchain';
import { AddressInput } from 'ts/components/inputs/address_input';
import { TokenAmountInput } from 'ts/components/inputs/token_amount_input';
import { EthAmountInput } from 'ts/containers/inputs/eth_amount_input';
import { Token } from 'ts/types';
interface SendDialogProps {
@@ -15,7 +16,7 @@ interface SendDialogProps {
onComplete: (recipient: string, value: BigNumber) => void;
onCancelled: () => void;
isOpen: boolean;
token: Token;
asset: Token | 'ETH';
lastForceTokenStateRefetch: number;
}
@@ -58,23 +59,23 @@ export class SendDialog extends React.Component<SendDialogProps, SendDialogState
);
}
private _renderSendDialogBody(): React.ReactNode {
return (
<div className="mx-auto" style={{ maxWidth: 300 }}>
<div style={{ height: 80 }}>
<AddressInput
initialAddress={this.state.recipient}
updateAddress={this._onRecipientChange.bind(this)}
isRequired={true}
label={'Recipient address'}
hintText={'Address'}
/>
</div>
const input =
this.props.asset === 'ETH' ? (
<EthAmountInput
label="Amount to send"
shouldShowIncompleteErrs={this.state.shouldShowIncompleteErrs}
shouldCheckBalance={true}
shouldShowErrs={true}
onChange={this._onValueChange.bind(this)}
amount={this.state.value}
/>
) : (
<TokenAmountInput
blockchain={this.props.blockchain}
userAddress={this.props.userAddress}
networkId={this.props.networkId}
label="Amount to send"
token={this.props.token}
token={this.props.asset}
shouldShowIncompleteErrs={this.state.shouldShowIncompleteErrs}
shouldCheckBalance={true}
shouldCheckAllowance={false}
@@ -82,6 +83,19 @@ export class SendDialog extends React.Component<SendDialogProps, SendDialogState
amount={this.state.value}
lastForceTokenStateRefetch={this.props.lastForceTokenStateRefetch}
/>
);
return (
<div className="mx-auto" style={{ maxWidth: 300 }}>
<div style={{ height: 80 }}>
<AddressInput
initialAddress={this.state.recipient}
updateAddress={this._onRecipientChange.bind(this)}
isRequired={true}
label="Recipient address'"
hintText="Address"
/>
</div>
{input}
</div>
);
}