From f9cebc7b75183ee45cb4554e4b4dbc28b3468a2d Mon Sep 17 00:00:00 2001 From: Aleksey Rudometov Date: Fri, 20 Mar 2020 19:36:35 +0500 Subject: [PATCH] fixing claim rewards pubsub publishing (#480) * fixing claim rewards pubsub publishing * only get stakingDenom once Co-authored-by: Fabian Weber --- lib/block-listeners/cosmos-node-subscription.js | 10 +++++++--- lib/reducers/cosmosV0-reducers.js | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/lib/block-listeners/cosmos-node-subscription.js b/lib/block-listeners/cosmos-node-subscription.js index c3f2375bf0..4ad7fe8883 100644 --- a/lib/block-listeners/cosmos-node-subscription.js +++ b/lib/block-listeners/cosmos-node-subscription.js @@ -27,6 +27,9 @@ class CosmosNodeSubscription { this.db = new database(config)(networkSchemaName) this.chainHangup = undefined this.height = undefined + this.cosmosAPI + .getStakingDenom() + .then(stakingDenom => (this.stakingDenom = stakingDenom)) this.pollForNewBlock() } @@ -97,7 +100,7 @@ class CosmosNodeSubscription { ...tx.raw }, this.cosmosAPI.reducers, - this.cosmosAPI.stakingDenom + this.stakingDenom ) let addresses = [] try { @@ -114,8 +117,9 @@ class CosmosNodeSubscription { addresses.forEach(address => { publishUserTransactionAdded(this.network.id, address, tx) // txv2 returns array, so its zero element could not be set for some reasons - txV2[0] && - publishUserTransactionAddedV2(this.network.id, address, txV2[0]) + txV2.map(txMsg => + publishUserTransactionAddedV2(this.network.id, address, txMsg) + ) publishEvent(this.network.id, 'transaction', address, tx) }) }) diff --git a/lib/reducers/cosmosV0-reducers.js b/lib/reducers/cosmosV0-reducers.js index 34a6a9a0c6..db44b9868f 100644 --- a/lib/reducers/cosmosV0-reducers.js +++ b/lib/reducers/cosmosV0-reducers.js @@ -550,7 +550,7 @@ function transactionReducerV2(transaction, reducers, stakingDenom) { timestamp: transaction.timestamp, memo: transaction.tx.value.memo, fees, - success: transaction.logs ? transaction.logs[index].success : false + success: transaction.logs ? transaction.logs[index].success || false : false })) return returnedMessages }