From dead04dce8b26a09cb0b451711517bcb4dea182c Mon Sep 17 00:00:00 2001
From: fragosti <francesco.agosti93@gmail.com>
Date: Thu, 19 Jul 2018 04:11:44 -0700
Subject: WIP for sending ether from portal (works)

---
 packages/website/ts/components/send_button.tsx | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

(limited to 'packages/website/ts/components/send_button.tsx')

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)) {
-- 
cgit v1.2.3

