From cac920ddf94da6e0178d5a396e594c8ca82f9d36 Mon Sep 17 00:00:00 2001 From: McSam Date: Tue, 4 Feb 2020 18:48:50 +0800 Subject: [PATCH 1/3] Unknown contract proposal --- src/botPage/bot/TradeEngine/Proposal.js | 20 ++++++++++---------- src/botPage/bot/tools.js | 4 ++++ 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/src/botPage/bot/TradeEngine/Proposal.js b/src/botPage/bot/TradeEngine/Proposal.js index 4f2bcbf865..21144eef25 100644 --- a/src/botPage/bot/TradeEngine/Proposal.js +++ b/src/botPage/bot/TradeEngine/Proposal.js @@ -1,5 +1,5 @@ import { translate } from '../../../common/i18n'; -import { tradeOptionToProposal, doUntilDone, getUUID } from '../tools'; +import { tradeOptionToProposal, doUntilDone } from '../tools'; import { proposalsReady, clearProposals } from './state/actions'; export default Engine => @@ -49,13 +49,7 @@ export default Engine => this.proposalTemplates.map(proposal => doUntilDone(() => this.api - .subscribeToPriceForContractProposal({ - ...proposal, - passthrough: { - contractType: proposal.contract_type, - uuid : getUUID(), - }, - }) + .subscribeToPriceForContractProposal(proposal) // eslint-disable-next-line consistent-return .catch(e => { if (e && e.name === 'RateLimit') { @@ -127,8 +121,14 @@ export default Engine => checkProposalReady() { const proposals = this.data.get('proposals'); - if (proposals && proposals.size === this.proposalTemplates.length) { - this.startPromise.then(() => this.store.dispatch(proposalsReady())); + if (proposals && proposals.size) { + const isSameWithTemplate = this.proposalTemplates.every(p => + this.data.getIn(['proposals', p.passthrough.uuid]) + ); + + if (isSameWithTemplate) { + this.startPromise.then(() => this.store.dispatch(proposalsReady())); + } } } isNewTradeOption(tradeOption) { diff --git a/src/botPage/bot/tools.js b/src/botPage/bot/tools.js index 2b509e9c58..49f15f96b4 100644 --- a/src/botPage/bot/tools.js +++ b/src/botPage/bot/tools.js @@ -15,6 +15,10 @@ export const tradeOptionToProposal = tradeOption => duration : tradeOption.duration, amount : roundBalance({ currency: tradeOption.currency, balance: tradeOption.amount }), contract_type: type, + passthrough : { + contractType: type, + uuid : getUUID(), + }, }; if (tradeOption.prediction !== undefined) { proposal.selected_tick = tradeOption.prediction; From a68c34332fa6af5ffb3f4c2701f80a1501ac4e3a Mon Sep 17 00:00:00 2001 From: McSam Date: Wed, 5 Feb 2020 11:31:00 +0800 Subject: [PATCH 2/3] logic update for checkproposalisready --- src/botPage/bot/TradeEngine/Proposal.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/botPage/bot/TradeEngine/Proposal.js b/src/botPage/bot/TradeEngine/Proposal.js index 21144eef25..8fced7acd7 100644 --- a/src/botPage/bot/TradeEngine/Proposal.js +++ b/src/botPage/bot/TradeEngine/Proposal.js @@ -123,7 +123,7 @@ export default Engine => if (proposals && proposals.size) { const isSameWithTemplate = this.proposalTemplates.every(p => - this.data.getIn(['proposals', p.passthrough.uuid]) + this.data.hasIn(['proposals', p.passthrough.uuid]) ); if (isSameWithTemplate) { From 648394b7ec4880681e4586087f83d6fed35d3b22 Mon Sep 17 00:00:00 2001 From: Aaron Imming Date: Mon, 10 Feb 2020 15:03:41 +0800 Subject: [PATCH 3/3] Pass DOM rather than text --- src/botPage/view/blockly/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/botPage/view/blockly/index.js b/src/botPage/view/blockly/index.js index 1041d10364..b044b4985c 100644 --- a/src/botPage/view/blockly/index.js +++ b/src/botPage/view/blockly/index.js @@ -378,7 +378,8 @@ export default class _Blockly { const previousStrat = getPreviousStrat(); if (previousStrat) { - loadDomToWorkspace(previousStrat); + const previousStratDOM = Blockly.Xml.textToDom(previousStrat); + loadDomToWorkspace(previousStratDOM); resolve(); return; }