Skip to content

Commit

Permalink
fix: tokenFactoryStatic - getMetaByDenomOrAddress returning 2 tokens
Browse files Browse the repository at this point in the history
  • Loading branch information
ThomasRalee committed Dec 9, 2024
1 parent e2a0229 commit f7f22dc
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions packages/sdk-ts/src/service/TokenFactoryStatic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,17 @@ export class TokenFactoryStatic {
getMetaByDenomOrAddress(denomOrAddress: string): TokenStatic | undefined {
const formattedDenom = denomOrAddress.toLowerCase()

return (
this.tokensByDenom[formattedDenom] || this.tokensByAddress[formattedDenom]
)
if (this.tokensByDenom[formattedDenom]) {
return this.tokensByDenom[formattedDenom]
}

if (this.tokensByAddress[formattedDenom]) {
const verifiedToken = this.tokensByAddress[formattedDenom].find(
({ tokenVerification }) =>
tokenVerification === TokenVerification.Verified,
)

return verifiedToken || this.tokensByAddress[formattedDenom][0]
}
}
}

0 comments on commit f7f22dc

Please sign in to comment.