From 4021075e057ac46e09791a3b09dc55c8f4f2fb8a Mon Sep 17 00:00:00 2001 From: Bassem Date: Mon, 14 Jun 2021 12:15:24 +0200 Subject: [PATCH 01/30] fix harvesting problem when activated on different device (#1436) * fix #1431 #1332 * fix harvesting showing wrong status on fresh accounts --- .../NetworkNodeSelector/NetworkNodeSelectorTs.ts | 2 +- src/store/Harvesting.ts | 15 +++++++++++++-- .../FormMosaicSupplyChangeTransactionTs.ts | 4 +++- .../verify-mnemonic/VerifyMnemonic.vue | 7 +++++++ 4 files changed, 24 insertions(+), 4 deletions(-) diff --git a/src/components/NetworkNodeSelector/NetworkNodeSelectorTs.ts b/src/components/NetworkNodeSelector/NetworkNodeSelectorTs.ts index a109beccd..a7cedec65 100644 --- a/src/components/NetworkNodeSelector/NetworkNodeSelectorTs.ts +++ b/src/components/NetworkNodeSelector/NetworkNodeSelectorTs.ts @@ -117,7 +117,7 @@ export class NetworkNodeSelectorTs extends Vue { Vue.set(this, 'showInputPublicKey', false); this.$emit('input', nodeModel); if (this.isAccountKeyLinked && this.isVrfKeyLinked && this.missingKeys) { - this.$store.dispatch('harvesting/FETCH_STATUS', value); + this.$store.dispatch('harvesting/FETCH_STATUS', [value, nodeModel]); } } else { Vue.set(this, 'showInputPublicKey', true); diff --git a/src/store/Harvesting.ts b/src/store/Harvesting.ts index 83912dc73..da18266fc 100644 --- a/src/store/Harvesting.ts +++ b/src/store/Harvesting.ts @@ -147,11 +147,12 @@ export default { SET_POLLING_TRIALS({ commit }, pollingTrials) { commit('setPollingTrials', pollingTrials); }, - async FETCH_STATUS({ commit, rootGetters }, nodeUrl?: string) { + async FETCH_STATUS({ commit, rootGetters, dispatch }, node?: []) { const currentSignerAccountInfo: AccountInfo = rootGetters['account/currentSignerAccountInfo']; // reset let status: HarvestingStatus; if (!currentSignerAccountInfo) { + commit('status', HarvestingStatus.INACTIVE); return; } const currentSignerHarvestingModel: HarvestingModel = rootGetters['harvesting/currentSignerHarvestingModel']; @@ -160,7 +161,8 @@ export default { if (currentSignerHarvestingModel) { //find the node url from currentSignerHarvestingModel (localStorage) const selectedNode = currentSignerHarvestingModel.selectedHarvestingNode; - const harvestingNodeUrl = selectedNode?.url || nodeUrl; + // @ts-ignore + const harvestingNodeUrl = selectedNode?.url || (node && !!node.length ? node[0] : ''); let unlockedAccounts: string[] = []; if (harvestingNodeUrl) { @@ -188,6 +190,15 @@ export default { ? HarvestingStatus.FAILED : HarvestingStatus.INPROGRESS_ACTIVATION : HarvestingStatus.KEYS_LINKED; + // @ts-ignore + if (status === HarvestingStatus.ACTIVE && node && node[1]) { + // @ts-ignore + dispatch('UPDATE_ACCOUNT_SELECTED_HARVESTING_NODE', { + accountAddress: currentSignerHarvestingModel.accountAddress, + // @ts-ignore + selectedHarvestingNode: node[1], + }); + } } else { status = accountUnlocked ? HarvestingStatus.INPROGRESS_DEACTIVATION : HarvestingStatus.INACTIVE; } diff --git a/src/views/forms/FormMosaicSupplyChangeTransaction/FormMosaicSupplyChangeTransactionTs.ts b/src/views/forms/FormMosaicSupplyChangeTransaction/FormMosaicSupplyChangeTransactionTs.ts index 349a18635..a83a158b2 100644 --- a/src/views/forms/FormMosaicSupplyChangeTransaction/FormMosaicSupplyChangeTransactionTs.ts +++ b/src/views/forms/FormMosaicSupplyChangeTransaction/FormMosaicSupplyChangeTransactionTs.ts @@ -245,7 +245,9 @@ export class FormMosaicSupplyChangeTransactionTs extends FormTransactionBase { } get ownedTargetHexIds(): string[] { - return this.holdMosaics.filter((m) => m.ownerRawPlain === this.currentAccount.address).map(({ mosaicIdHex }) => mosaicIdHex); + return this.holdMosaics + .filter((m) => m.ownerRawPlain === this.currentAccount.address && m.supplyMutable) + .map(({ mosaicIdHex }) => mosaicIdHex); } public emitToAggregate() { diff --git a/src/views/pages/profiles/create-profile/verify-mnemonic/VerifyMnemonic.vue b/src/views/pages/profiles/create-profile/verify-mnemonic/VerifyMnemonic.vue index e0f6a1783..e71f946d7 100644 --- a/src/views/pages/profiles/create-profile/verify-mnemonic/VerifyMnemonic.vue +++ b/src/views/pages/profiles/create-profile/verify-mnemonic/VerifyMnemonic.vue @@ -1,5 +1,12 @@