WIP for sending ether from portal (works)
This commit is contained in:
@@ -12,7 +12,7 @@ import { utils } from 'ts/utils/utils';
|
||||
interface SendButtonProps {
|
||||
userAddress: string;
|
||||
networkId: number;
|
||||
token: Token;
|
||||
asset: Token | 'ETH';
|
||||
dispatcher: Dispatcher;
|
||||
blockchain: Blockchain;
|
||||
onError: () => void;
|
||||
@@ -51,7 +51,7 @@ export class SendButton extends React.Component<SendButtonProps, SendButtonState
|
||||
isOpen={this.state.isSendDialogVisible}
|
||||
onComplete={this._onSendAmountSelectedAsync.bind(this)}
|
||||
onCancelled={this._toggleSendDialog.bind(this)}
|
||||
token={this.props.token}
|
||||
asset={this.props.asset}
|
||||
lastForceTokenStateRefetch={this.props.lastForceTokenStateRefetch}
|
||||
/>
|
||||
</div>
|
||||
@@ -67,10 +67,14 @@ export class SendButton extends React.Component<SendButtonProps, SendButtonState
|
||||
isSending: true,
|
||||
});
|
||||
this._toggleSendDialog();
|
||||
const token = this.props.token;
|
||||
try {
|
||||
await this.props.blockchain.transferAsync(token, recipient, value);
|
||||
await this.props.refetchTokenStateAsync(token.address);
|
||||
if (this.props.asset === 'ETH') {
|
||||
await this.props.blockchain.sendAsync(recipient, value);
|
||||
} else {
|
||||
const token = this.props.asset;
|
||||
await this.props.blockchain.transferAsync(token, recipient, value);
|
||||
await this.props.refetchTokenStateAsync(token.address);
|
||||
}
|
||||
} catch (err) {
|
||||
const errMsg = `${err}`;
|
||||
if (_.includes(errMsg, BlockchainCallErrs.UserHasNoAssociatedAddresses)) {
|
||||
|
Reference in New Issue
Block a user