Skip to content

Commit

Permalink
Fix tokenfactory metadata not finding the right decimals. (#1497)
Browse files Browse the repository at this point in the history
  • Loading branch information
NoahSaso authored Nov 30, 2023
1 parent d68a351 commit 1b12c1a
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion packages/state/recoil/selectors/token.ts
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,13 @@ export const nativeDenomMetadataInfoSelector = selectorFamily<

const { base, denomUnits, symbol, display } = metadata

// If display is equal to the base, use the symbol denom unit if
// available. This fixes the case where display was not updated even
// though a nonzero exponent was created.
const searchDenom = display === base ? symbol : display

const displayDenom =
denomUnits.find(({ denom }) => denom === searchDenom) ??
denomUnits.find(({ denom }) => denom === display) ??
denomUnits.find(({ exponent }) => exponent > 0) ??
denomUnits[0]
Expand All @@ -412,7 +418,7 @@ export const nativeDenomMetadataInfoSelector = selectorFamily<
}

return {
symbol: symbol || display || base,
symbol: displayDenom.denom,
decimals: displayDenom.exponent,
}
},
Expand Down

2 comments on commit 1b12c1a

@vercel
Copy link

@vercel vercel bot commented on 1b12c1a Nov 30, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vercel
Copy link

@vercel vercel bot commented on 1b12c1a Nov 30, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.