diff options
Diffstat (limited to 'packages/website/ts/components/send_button.tsx')
-rw-r--r-- | packages/website/ts/components/send_button.tsx | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/packages/website/ts/components/send_button.tsx b/packages/website/ts/components/send_button.tsx index ac55d430b..107983dee 100644 --- a/packages/website/ts/components/send_button.tsx +++ b/packages/website/ts/components/send_button.tsx @@ -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)) { |