Skip to content

Commit

Permalink
fixing claim rewards pubsub publishing (#480)
Browse files Browse the repository at this point in the history
* fixing claim rewards pubsub publishing

* only get stakingDenom once

Co-authored-by: Fabian Weber <[email protected]>
  • Loading branch information
iambeone and faboweb authored Mar 20, 2020
1 parent 30065a9 commit f9cebc7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
10 changes: 7 additions & 3 deletions lib/block-listeners/cosmos-node-subscription.js
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
Expand Down Expand Up @@ -97,7 +100,7 @@ class CosmosNodeSubscription {
...tx.raw
},
this.cosmosAPI.reducers,
this.cosmosAPI.stakingDenom
this.stakingDenom
)
let addresses = []
try {
Expand All @@ -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)
})
})
Expand Down
2 changes: 1 addition & 1 deletion lib/reducers/cosmosV0-reducers.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit f9cebc7

Please sign in to comment.