From 921c500c8bf01322f7aa5f6a97f547e4edc3cd0c Mon Sep 17 00:00:00 2001 From: motrebski Date: Tue, 9 Oct 2018 14:05:58 +0200 Subject: [PATCH 01/66] New BitShares EOS option in Deposit & Withdraw --- app/assets/locales/locale-en.json | 7 ++++-- .../Account/AccountDepositWithdraw.jsx | 12 +++++++++- .../DepositWithdraw/BitsharesEos.jsx | 23 +++++++++++++++++++ 3 files changed, 39 insertions(+), 3 deletions(-) create mode 100644 app/components/DepositWithdraw/BitsharesEos.jsx diff --git a/app/assets/locales/locale-en.json b/app/assets/locales/locale-en.json index 64b8c66b6b..287cbbc546 100644 --- a/app/assets/locales/locale-en.json +++ b/app/assets/locales/locale-en.json @@ -891,9 +891,12 @@ "status": "Status", "support_block": "For DEPOSIT AND WITHDRAWAL issues using \"OpenLedger TRANSFER SERVICE\", please contact Openledger at:", "support_gdex": "For support, please contact GDEX", + "bitshares_beos": { + "create_account": "Create BEOS account", + "transfer": "Convert BTS to BEOS" + }, "bitspark": { - "support_block": - "For DEPOSIT AND WITHDRAWAL issues using \"BitSpark TRANSFER SERVICE\", please contact BitSpark at:" + "support_block": "For DEPOSIT AND WITHDRAWAL issues using \"BitSpark TRANSFER SERVICE\", please contact BitSpark at:" }, "symbol": "Symbol", "time": "Time", diff --git a/app/components/Account/AccountDepositWithdraw.jsx b/app/components/Account/AccountDepositWithdraw.jsx index 5be1c923a5..ea6240a533 100644 --- a/app/components/Account/AccountDepositWithdraw.jsx +++ b/app/components/Account/AccountDepositWithdraw.jsx @@ -17,6 +17,7 @@ import AccountStore from "stores/AccountStore"; import SettingsStore from "stores/SettingsStore"; import SettingsActions from "actions/SettingsActions"; import {openledgerAPIs} from "api/apiConfig"; +import BitsharesEos from "../DepositWithdraw/BitsharesEos"; import BitKapital from "../DepositWithdraw/BitKapital"; import RuDexGateway from "../DepositWithdraw/rudex/RuDexGateway"; import GatewayStore from "stores/GatewayStore"; @@ -45,7 +46,10 @@ class AccountDepositWithdraw extends React.Component { this.state = { olService: props.viewSettings.get("olService", "gateway"), rudexService: props.viewSettings.get("rudexService", "gateway"), - bitsparkService: props.viewSettings.get("bitsparkService", "gateway"), + bitsparkService: props.viewSettings.get( + "bitsparkService", + "gateway" + ), xbtsxService: props.viewSettings.get("xbtsxService", "gateway"), btService: props.viewSettings.get("btService", "bridge"), citadelService: props.viewSettings.get("citadelService", "bridge"), @@ -500,6 +504,11 @@ class AccountDepositWithdraw extends React.Component { ) }); + serList.push({ + name: "BitShares EOS", + template: + }); + serList.push({ name: "BitKapital", template: ( @@ -597,6 +606,7 @@ class AccountDepositWithdraw extends React.Component { "RUDEX", "SPARKDEX", "TRADE", + "BEOS", "BITKAPITAL", "XBTSX", "CITADEL" diff --git a/app/components/DepositWithdraw/BitsharesEos.jsx b/app/components/DepositWithdraw/BitsharesEos.jsx new file mode 100644 index 0000000000..44a5c21667 --- /dev/null +++ b/app/components/DepositWithdraw/BitsharesEos.jsx @@ -0,0 +1,23 @@ +import React from "react"; +import Translate from "react-translate-component"; + +class BitsharesEos extends React.Component { + render() { + return ( +
+ + +
+ ); + } +} + +export default BitsharesEos; From 98daf6619ada270ea0b03b8f44a7551a3024bbf1 Mon Sep 17 00:00:00 2001 From: motrebski Date: Wed, 10 Oct 2018 15:39:46 +0200 Subject: [PATCH 02/66] Modal of eos bitshares --- app/assets/locales/locale-en.json | 7 +- .../DepositWithdraw/BitsharesEos.jsx | 71 ++++++++- .../DepositWithdraw/BitsharesEosModal.jsx | 143 ++++++++++++++++++ 3 files changed, 219 insertions(+), 2 deletions(-) create mode 100644 app/components/DepositWithdraw/BitsharesEosModal.jsx diff --git a/app/assets/locales/locale-en.json b/app/assets/locales/locale-en.json index 287cbbc546..17c2ce1627 100644 --- a/app/assets/locales/locale-en.json +++ b/app/assets/locales/locale-en.json @@ -892,8 +892,13 @@ "support_block": "For DEPOSIT AND WITHDRAWAL issues using \"OpenLedger TRANSFER SERVICE\", please contact Openledger at:", "support_gdex": "For support, please contact GDEX", "bitshares_beos": { + "action": "%(action)s", + "account": "Account", + "active_key": "Active key", + "amount_to_send": "Amount to send", "create_account": "Create BEOS account", - "transfer": "Convert BTS to BEOS" + "transfer": "Send BTS", + "title": "%(name)s" }, "bitspark": { "support_block": "For DEPOSIT AND WITHDRAWAL issues using \"BitSpark TRANSFER SERVICE\", please contact BitSpark at:" diff --git a/app/components/DepositWithdraw/BitsharesEos.jsx b/app/components/DepositWithdraw/BitsharesEos.jsx index 44a5c21667..672383eeb4 100644 --- a/app/components/DepositWithdraw/BitsharesEos.jsx +++ b/app/components/DepositWithdraw/BitsharesEos.jsx @@ -1,20 +1,89 @@ import React from "react"; +import BaseModal from "../Modal/BaseModal"; +import BitsharesEosModal from "./BitsharesEosModal"; import Translate from "react-translate-component"; +import ZfApi from "react-foundation-apps/src/utils/foundation-api"; class BitsharesEos extends React.Component { + getCreateAccountId() { + return "create_acoount"; + } + + getSendBtsId() { + return "send_bts"; + } + + onCreateAccount() { + ZfApi.publish(this.getCreateAccountId(), "open"); + } + + sendBts() { + ZfApi.publish(this.getSendBtsId(), "open"); + } + render() { + let createAccountId = this.getCreateAccountId(); + let sendBtsId = this.getSendBtsId(); + return (
- + +
+
+ +
+
+ +
+
+ +
+
); } diff --git a/app/components/DepositWithdraw/BitsharesEosModal.jsx b/app/components/DepositWithdraw/BitsharesEosModal.jsx new file mode 100644 index 0000000000..2e08657b84 --- /dev/null +++ b/app/components/DepositWithdraw/BitsharesEosModal.jsx @@ -0,0 +1,143 @@ +import React from "react"; +import AmountSelector from "components/Utility/AmountSelector"; +import Translate from "react-translate-component"; +import Trigger from "react-foundation-apps/src/trigger"; +import ChainTypes from "components/Utility/ChainTypes"; +import BindToChainState from "components/Utility/BindToChainState"; +import PropTypes from "prop-types"; + +class BitsharesEosModal extends React.Component { + static propTypes = { + asset: ChainTypes.ChainAsset.isRequired, + creator: PropTypes.string.isRequired, + name: PropTypes.string.isRequired, + owner_key: PropTypes.string.isRequired, + ram: PropTypes.string.isRequired, + account_contract: PropTypes.string.isRequired, + action: PropTypes.string.isRequired, + from: PropTypes.string.isRequired, + create_account: PropTypes.number.isRequired + }; + + constructor(props) { + super(props); + + this.state = { + amount_to_send: "", + creator: this.props.creator, + owner_key: this.props.owner_key, + ram: this.props.ram, + account_contract: this.props.account_contract, + action: this.props.action, + from: this.props.from, + create_account: this.props.create_account, + empty_amount_to_send_value: false, + balance_error: false + }; + } + + onAmountToSendChange({amount}) { + this.setState({ + amount_to_send: amount, + empty_amount_to_send_value: + amount !== undefined && !parseFloat(amount) + }); + } + + onSubmit() { + console.log("Send"); + } + + render() { + const disableSubmit = !this.state.amount_to_send; + + return ( +
+
+
+

+ +

+
+ {/* Account */} +
+ +
+ +
+
+ {/* Active key */} +
+ +
+ +
+
+ {/* Amount to send */} +
+ + {this.state.empty_amount_to_send_value ? ( +

+ +

+ ) : null} + {this.state.balance_error ? ( +

+ +

+ ) : null} +
+ {/* Buttons */} +
+
+ +
+ + +
+ +
+
+
+
+
+ ); + } +} + +export default BindToChainState(BitsharesEosModal); From 490d7512209a1939cea492364a5f895827e3ea18 Mon Sep 17 00:00:00 2001 From: motrebski Date: Thu, 11 Oct 2018 14:50:41 +0200 Subject: [PATCH 03/66] Add amount selector and remove one modal --- app/assets/locales/locale-en.json | 12 +- .../Account/AccountDepositWithdraw.jsx | 4 +- .../DepositWithdraw/BitsharesBeos.jsx | 64 +++++++ ...resEosModal.jsx => BitsharesBeosModal.jsx} | 172 +++++++++++++----- .../DepositWithdraw/BitsharesEos.jsx | 92 ---------- 5 files changed, 197 insertions(+), 147 deletions(-) create mode 100644 app/components/DepositWithdraw/BitsharesBeos.jsx rename app/components/DepositWithdraw/{BitsharesEosModal.jsx => BitsharesBeosModal.jsx} (50%) delete mode 100644 app/components/DepositWithdraw/BitsharesEos.jsx diff --git a/app/assets/locales/locale-en.json b/app/assets/locales/locale-en.json index 17c2ce1627..ab4b48b39c 100644 --- a/app/assets/locales/locale-en.json +++ b/app/assets/locales/locale-en.json @@ -892,13 +892,11 @@ "support_block": "For DEPOSIT AND WITHDRAWAL issues using \"OpenLedger TRANSFER SERVICE\", please contact Openledger at:", "support_gdex": "For support, please contact GDEX", "bitshares_beos": { - "action": "%(action)s", - "account": "Account", - "active_key": "Active key", - "amount_to_send": "Amount to send", - "create_account": "Create BEOS account", - "transfer": "Send BTS", - "title": "%(name)s" + "account_label": "Bitshares EOS account", + "amount_to_send_label": "Amount to send to BEOS account", + "send_button_label": "Send", + "transfer_button": "Transfer BTS to BitShares EOS account", + "modal_title": "Transfer BTS to BitShares EOS account" }, "bitspark": { "support_block": "For DEPOSIT AND WITHDRAWAL issues using \"BitSpark TRANSFER SERVICE\", please contact BitSpark at:" diff --git a/app/components/Account/AccountDepositWithdraw.jsx b/app/components/Account/AccountDepositWithdraw.jsx index ea6240a533..df7685519f 100644 --- a/app/components/Account/AccountDepositWithdraw.jsx +++ b/app/components/Account/AccountDepositWithdraw.jsx @@ -17,7 +17,7 @@ import AccountStore from "stores/AccountStore"; import SettingsStore from "stores/SettingsStore"; import SettingsActions from "actions/SettingsActions"; import {openledgerAPIs} from "api/apiConfig"; -import BitsharesEos from "../DepositWithdraw/BitsharesEos"; +import BitsharesBeos from "../DepositWithdraw/BitsharesBeos"; import BitKapital from "../DepositWithdraw/BitKapital"; import RuDexGateway from "../DepositWithdraw/rudex/RuDexGateway"; import GatewayStore from "stores/GatewayStore"; @@ -506,7 +506,7 @@ class AccountDepositWithdraw extends React.Component { serList.push({ name: "BitShares EOS", - template: + template: }); serList.push({ diff --git a/app/components/DepositWithdraw/BitsharesBeos.jsx b/app/components/DepositWithdraw/BitsharesBeos.jsx new file mode 100644 index 0000000000..612f5335ad --- /dev/null +++ b/app/components/DepositWithdraw/BitsharesBeos.jsx @@ -0,0 +1,64 @@ +import React from "react"; +import BaseModal from "../Modal/BaseModal"; +import BitsharesBeosModal from "./BitsharesBeosModal"; +import ChainTypes from "components/Utility/ChainTypes"; +import Translate from "react-translate-component"; +import ZfApi from "react-foundation-apps/src/utils/foundation-api"; +import BindToChainState from "components/Utility/BindToChainState"; + +class BitsharesBeos extends React.Component { + static propTypes = { + asset: ChainTypes.ChainAsset.isRequired + }; + + getTransferBtsId() { + return "transfer_bts"; + } + + onTransferBts() { + ZfApi.publish(this.getTransferBtsId(), "open"); + } + + render() { + let transferBtsId = this.getTransferBtsId(); + + return ( +
+ + +
+
+ +
+
+
+ ); + } +} + +export default BindToChainState(BitsharesBeos); diff --git a/app/components/DepositWithdraw/BitsharesEosModal.jsx b/app/components/DepositWithdraw/BitsharesBeosModal.jsx similarity index 50% rename from app/components/DepositWithdraw/BitsharesEosModal.jsx rename to app/components/DepositWithdraw/BitsharesBeosModal.jsx index 2e08657b84..d256bdde07 100644 --- a/app/components/DepositWithdraw/BitsharesEosModal.jsx +++ b/app/components/DepositWithdraw/BitsharesBeosModal.jsx @@ -3,20 +3,23 @@ import AmountSelector from "components/Utility/AmountSelector"; import Translate from "react-translate-component"; import Trigger from "react-foundation-apps/src/trigger"; import ChainTypes from "components/Utility/ChainTypes"; +import BalanceComponent from "components/Utility/BalanceComponent"; import BindToChainState from "components/Utility/BindToChainState"; import PropTypes from "prop-types"; +import {checkBalance} from "common/trxHelper"; +import {Asset} from "common/MarketClasses"; -class BitsharesEosModal extends React.Component { +class BitsharesBeosModal extends React.Component { static propTypes = { + account: ChainTypes.ChainAccount.isRequired, asset: ChainTypes.ChainAsset.isRequired, creator: PropTypes.string.isRequired, - name: PropTypes.string.isRequired, owner_key: PropTypes.string.isRequired, ram: PropTypes.string.isRequired, account_contract: PropTypes.string.isRequired, action: PropTypes.string.isRequired, from: PropTypes.string.isRequired, - create_account: PropTypes.number.isRequired + balance: ChainTypes.ChainObject }; constructor(props) { @@ -24,24 +27,78 @@ class BitsharesEosModal extends React.Component { this.state = { amount_to_send: "", + create_account: 0, creator: this.props.creator, owner_key: this.props.owner_key, ram: this.props.ram, account_contract: this.props.account_contract, action: this.props.action, + fee_amount: 10000, from: this.props.from, - create_account: this.props.create_account, empty_amount_to_send_value: false, balance_error: false }; } - onAmountToSendChange({amount}) { - this.setState({ - amount_to_send: amount, - empty_amount_to_send_value: - amount !== undefined && !parseFloat(amount) + _checkBalance() { + const {amount_to_send} = this.state; + const {asset, balance} = this.props; + let feeAmount = new Asset({ + amount: this.state.fee_amount, + asset_id: this.props.asset.get("id"), + precision: this.props.asset.get("precision") }); + if (!balance || !feeAmount) return; + const hasBalance = checkBalance( + amount_to_send, + asset, + feeAmount, + balance + ); + if (hasBalance === null) return; + this.setState({balance_error: !hasBalance}); + return hasBalance; + } + + onAccountBalance() { + if ( + Object.keys(this.props.account.get("balances").toJS()).includes( + this.props.asset.get("id") + ) + ) { + let total = new Asset({ + amount: this.props.balance.get("balance"), + asset_id: this.props.asset.get("id"), + precision: this.props.asset.get("precision") + }); + + let totalFeeAmount = new Asset({ + amount: this.state.fee_amount, + asset_id: this.props.asset.get("id"), + precision: this.props.asset.get("precision") + }); + + total.minus(totalFeeAmount); + + this.setState( + { + amount_to_send: total.getAmount({real: true}), + empty_amount_to_send_value: false + }, + this._checkBalance + ); + } + } + + onAmountToSendChange({amount}) { + this.setState( + { + amount_to_send: amount, + empty_amount_to_send_value: + amount !== undefined && !parseFloat(amount) + }, + this._checkBalance + ); } onSubmit() { @@ -49,6 +106,45 @@ class BitsharesEosModal extends React.Component { } render() { + let balance = null; + let account_balances = this.props.account.get("balances").toJS(); + let asset_types = Object.keys(account_balances); + + if (asset_types.length > 0) { + let current_asset_id = this.props.asset.get("id"); + if (current_asset_id) { + let current = account_balances[current_asset_id]; + balance = ( + + +  :  + + {current ? ( + + ) : ( + 0 + )} + + + ); + } else balance = "No funds"; + } else { + balance = "No funds"; + } + const disableSubmit = !this.state.amount_to_send; return ( @@ -56,46 +152,19 @@ class BitsharesEosModal extends React.Component {

- +

- {/* Account */} -
- -
- -
-
- {/* Active key */} -
- -
- -
-
- {/* Amount to send */} + {/* Amount to send to BEOS account */}
{this.state.empty_amount_to_send_value ? (

) : null}

- {/* Buttons */} + {/* Bitshares EOS account */} +
+ +
+ +
+
+ {/* Active key */} + + {/* Send/Cancel buttons */}
- +
@@ -140,4 +220,4 @@ class BitsharesEosModal extends React.Component { } } -export default BindToChainState(BitsharesEosModal); +export default BindToChainState(BitsharesBeosModal); diff --git a/app/components/DepositWithdraw/BitsharesEos.jsx b/app/components/DepositWithdraw/BitsharesEos.jsx deleted file mode 100644 index 672383eeb4..0000000000 --- a/app/components/DepositWithdraw/BitsharesEos.jsx +++ /dev/null @@ -1,92 +0,0 @@ -import React from "react"; -import BaseModal from "../Modal/BaseModal"; -import BitsharesEosModal from "./BitsharesEosModal"; -import Translate from "react-translate-component"; -import ZfApi from "react-foundation-apps/src/utils/foundation-api"; - -class BitsharesEos extends React.Component { - getCreateAccountId() { - return "create_acoount"; - } - - getSendBtsId() { - return "send_bts"; - } - - onCreateAccount() { - ZfApi.publish(this.getCreateAccountId(), "open"); - } - - sendBts() { - ZfApi.publish(this.getSendBtsId(), "open"); - } - - render() { - let createAccountId = this.getCreateAccountId(); - let sendBtsId = this.getSendBtsId(); - - return ( -
- - - -
-
- -
-
- -
-
- -
-
-
- ); - } -} - -export default BitsharesEos; From bb8cb778d5bc0ba8b2a7a117f4f547b61bcaa3f2 Mon Sep 17 00:00:00 2001 From: motrebski Date: Thu, 11 Oct 2018 16:40:39 +0200 Subject: [PATCH 04/66] Add checkbox for creating account --- app/assets/locales/locale-en.json | 1 + .../DepositWithdraw/BitsharesBeosModal.jsx | 41 ++++++++++++++++++- 2 files changed, 40 insertions(+), 2 deletions(-) diff --git a/app/assets/locales/locale-en.json b/app/assets/locales/locale-en.json index ab4b48b39c..51d1b8daa1 100644 --- a/app/assets/locales/locale-en.json +++ b/app/assets/locales/locale-en.json @@ -894,6 +894,7 @@ "bitshares_beos": { "account_label": "Bitshares EOS account", "amount_to_send_label": "Amount to send to BEOS account", + "create_account_checkbox": "Create account", "send_button_label": "Send", "transfer_button": "Transfer BTS to BitShares EOS account", "modal_title": "Transfer BTS to BitShares EOS account" diff --git a/app/components/DepositWithdraw/BitsharesBeosModal.jsx b/app/components/DepositWithdraw/BitsharesBeosModal.jsx index d256bdde07..ee709adf4b 100644 --- a/app/components/DepositWithdraw/BitsharesBeosModal.jsx +++ b/app/components/DepositWithdraw/BitsharesBeosModal.jsx @@ -31,6 +31,7 @@ class BitsharesBeosModal extends React.Component { creator: this.props.creator, owner_key: this.props.owner_key, ram: this.props.ram, + isAccountCreation: false, account_contract: this.props.account_contract, action: this.props.action, fee_amount: 10000, @@ -101,6 +102,10 @@ class BitsharesBeosModal extends React.Component { ); } + onCreateAccountCheckbox() { + this.setState({isAccountCreation: !this.state.isAccountCreation}); + } + onSubmit() { console.log("Send"); } @@ -195,8 +200,40 @@ class BitsharesBeosModal extends React.Component {
- {/* Active key */} - + {/* Create account enabled/disabled */} + + + + + + + +
+ + : + +
+ +
+
{/* Send/Cancel buttons */}
Date: Fri, 12 Oct 2018 13:46:06 +0200 Subject: [PATCH 05/66] Add maintenance modal --- app/assets/locales/locale-en.json | 4 +- .../DepositWithdraw/BitsharesBeosModal.jsx | 225 ++++++++++-------- 2 files changed, 134 insertions(+), 95 deletions(-) diff --git a/app/assets/locales/locale-en.json b/app/assets/locales/locale-en.json index 51d1b8daa1..691cbbe827 100644 --- a/app/assets/locales/locale-en.json +++ b/app/assets/locales/locale-en.json @@ -897,7 +897,9 @@ "create_account_checkbox": "Create account", "send_button_label": "Send", "transfer_button": "Transfer BTS to BitShares EOS account", - "modal_title": "Transfer BTS to BitShares EOS account" + "modal_title": "Transfer BTS to BitShares EOS account", + "maintenance_modal_label": "Gateway to BitShares EOS is down for maintenance", + "maintenance_button_label": "Ok" }, "bitspark": { "support_block": "For DEPOSIT AND WITHDRAWAL issues using \"BitSpark TRANSFER SERVICE\", please contact BitSpark at:" diff --git a/app/components/DepositWithdraw/BitsharesBeosModal.jsx b/app/components/DepositWithdraw/BitsharesBeosModal.jsx index ee709adf4b..92722f4154 100644 --- a/app/components/DepositWithdraw/BitsharesBeosModal.jsx +++ b/app/components/DepositWithdraw/BitsharesBeosModal.jsx @@ -1,11 +1,13 @@ import React from "react"; import AmountSelector from "components/Utility/AmountSelector"; +import Modal from "react-foundation-apps/src/modal"; import Translate from "react-translate-component"; import Trigger from "react-foundation-apps/src/trigger"; import ChainTypes from "components/Utility/ChainTypes"; import BalanceComponent from "components/Utility/BalanceComponent"; import BindToChainState from "components/Utility/BindToChainState"; import PropTypes from "prop-types"; +import ZfApi from "react-foundation-apps/src/utils/foundation-api"; import {checkBalance} from "common/trxHelper"; import {Asset} from "common/MarketClasses"; @@ -61,6 +63,14 @@ class BitsharesBeosModal extends React.Component { return hasBalance; } + getMaintenanceId() { + return "maintenance"; + } + + onMaintenance() { + ZfApi.publish(this.getMaintenanceId(), "open"); + } + onAccountBalance() { if ( Object.keys(this.props.account.get("balances").toJS()).includes( @@ -107,13 +117,14 @@ class BitsharesBeosModal extends React.Component { } onSubmit() { - console.log("Send"); + this.onMaintenance(); } render() { let balance = null; let account_balances = this.props.account.get("balances").toJS(); let asset_types = Object.keys(account_balances); + let maintenanceId = this.getMaintenanceId(); if (asset_types.length > 0) { let current_asset_id = this.props.asset.get("id"); @@ -153,106 +164,132 @@ class BitsharesBeosModal extends React.Component { const disableSubmit = !this.state.amount_to_send; return ( -
-
-
-

- -

-
- {/* Amount to send to BEOS account */} -
- - {this.state.empty_amount_to_send_value ? ( -

- -

- ) : null} - {this.state.balance_error ? ( -

- -

- ) : null} -
- {/* Bitshares EOS account */} -
-
- + +
); } } From 8fcc37c84199544cf233ea1cdb6dd80181df3db7 Mon Sep 17 00:00:00 2001 From: motrebski Date: Mon, 15 Oct 2018 13:52:29 +0200 Subject: [PATCH 06/66] Memo customization --- app/assets/locales/locale-en.json | 3 +- .../DepositWithdraw/BitsharesBeos.jsx | 1 + .../DepositWithdraw/BitsharesBeosModal.jsx | 79 ++++++++++++++++++- 3 files changed, 78 insertions(+), 5 deletions(-) diff --git a/app/assets/locales/locale-en.json b/app/assets/locales/locale-en.json index 691cbbe827..c3ec7878ce 100644 --- a/app/assets/locales/locale-en.json +++ b/app/assets/locales/locale-en.json @@ -899,7 +899,8 @@ "transfer_button": "Transfer BTS to BitShares EOS account", "modal_title": "Transfer BTS to BitShares EOS account", "maintenance_modal_label": "Gateway to BitShares EOS is down for maintenance", - "maintenance_button_label": "Ok" + "maintenance_button_label": "Ok", + "memo_label": "Memo" }, "bitspark": { "support_block": "For DEPOSIT AND WITHDRAWAL issues using \"BitSpark TRANSFER SERVICE\", please contact BitSpark at:" diff --git a/app/components/DepositWithdraw/BitsharesBeos.jsx b/app/components/DepositWithdraw/BitsharesBeos.jsx index 612f5335ad..26c8ca1837 100644 --- a/app/components/DepositWithdraw/BitsharesBeos.jsx +++ b/app/components/DepositWithdraw/BitsharesBeos.jsx @@ -45,6 +45,7 @@ class BitsharesBeos extends React.Component { ] } creator={"eosio"} + issuer="blocktrades" owner_key={ "EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5So8BhtHuGYqET5GDW5CV" } diff --git a/app/components/DepositWithdraw/BitsharesBeosModal.jsx b/app/components/DepositWithdraw/BitsharesBeosModal.jsx index 92722f4154..513a67b410 100644 --- a/app/components/DepositWithdraw/BitsharesBeosModal.jsx +++ b/app/components/DepositWithdraw/BitsharesBeosModal.jsx @@ -10,12 +10,15 @@ import PropTypes from "prop-types"; import ZfApi from "react-foundation-apps/src/utils/foundation-api"; import {checkBalance} from "common/trxHelper"; import {Asset} from "common/MarketClasses"; +import AccountActions from "actions/AccountActions"; +import utils from "common/utils"; class BitsharesBeosModal extends React.Component { static propTypes = { account: ChainTypes.ChainAccount.isRequired, asset: ChainTypes.ChainAsset.isRequired, creator: PropTypes.string.isRequired, + issuer: ChainTypes.ChainAccount.isRequired, owner_key: PropTypes.string.isRequired, ram: PropTypes.string.isRequired, account_contract: PropTypes.string.isRequired, @@ -39,7 +42,8 @@ class BitsharesBeosModal extends React.Component { fee_amount: 10000, from: this.props.from, empty_amount_to_send_value: false, - balance_error: false + balance_error: false, + memo: "" }; } @@ -113,11 +117,63 @@ class BitsharesBeosModal extends React.Component { } onCreateAccountCheckbox() { - this.setState({isAccountCreation: !this.state.isAccountCreation}); + if (this.state.isAccountCreation) { + this.setState( + { + fee_amount: 0, + isAccountCreation: !this.state.isAccountCreation + }, + this._checkBalance + ); + } else { + this.setState( + { + fee_amount: 10000, + isAccountCreation: !this.state.isAccountCreation + }, + this._checkBalance + ); + } + } + + onMemoChanged(e) { + this.setState({memo: e.target.value}); } onSubmit() { - this.onMaintenance(); + let newMemo = ""; + let newAmountToSend = parseInt( + this.state.amount_to_send * + utils.get_asset_precision(this.props.asset.get("precision")), + 10 + ); + + if (this.state.isAccountCreation) { + newMemo = + "beos:receiving_beos_account_name:" + + this.state.memo + + ":create"; + } else if (this.state.memo === "" && !this.state.isAccountCreation) { + newMemo = "beos:receiving_beos_account_name"; + } else if (this.state.memo !== "" && !this.state.isAccountCreation) { + newMemo = "beos:receiving_beos_account_name:" + this.state.memo; + } + + if (this.state.isAccountCreation) { + newAmountToSend = newAmountToSend + this.state.fee_amount; + } + + console.log(newAmountToSend); + + /*AccountActions.transfer( + this.props.account.get("id"), + this.props.issuer.get("id"), + newAmountToSend, + this.props.asset.get("id"), + newMemo + ).catch(() => { + this.onMaintenance(); + });*/ } render() { @@ -161,7 +217,8 @@ class BitsharesBeosModal extends React.Component { balance = "No funds"; } - const disableSubmit = !this.state.amount_to_send; + const disableSubmit = + !this.state.amount_to_send || this.state.balance_error; return (
@@ -216,6 +273,20 @@ class BitsharesBeosModal extends React.Component { />
+ {/* Memo */} +
+ +