Skip to content

Commit

Permalink
Ensure full delegations data is returned
Browse files Browse the repository at this point in the history
  • Loading branch information
tombeynon committed Oct 7, 2022
1 parent 198c796 commit d76eefd
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions validators/validator.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,12 @@ export class Validator {

const asset = this.chain.baseAsset
const price = asset?.prices?.coingecko
if(!price) return delegations

const total_tokens = delegations.total_tokens
if(!total_tokens) return delegations

const total_tokens_display = divide(total_tokens, pow(10, this.chain.decimals))
const total_usd = price.usd && multiply(total_tokens_display, price.usd)
const total_usd = price?.usd && multiply(total_tokens_display, price.usd)
return {
...this.data.delegations,
...delegations,
total_tokens_display,
total_usd
}
Expand Down

0 comments on commit d76eefd

Please sign in to comment.