Skip to content

Commit

Permalink
Include rewards tokens in tokenlist (#253)
Browse files Browse the repository at this point in the history
* Include rewards tokens in token list

* Protect against undefined assets in the pool

* Update variable name

* Add rewards tokens after all the pool assets are in
  • Loading branch information
sashimi36 authored Aug 27, 2022
1 parent 373c433 commit 734e562
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion hooks/useTokenList.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,17 @@ export const useTokenList = () => {
'@token-list',
() => {
const tokenMapBySymbol = new Map()
/* serialize pool assets first */
poolsListResponse.pools.forEach(({ pool_assets }) => {
pool_assets.forEach((token) => {
pool_assets?.forEach((token) => {
if (!tokenMapBySymbol.has(token.symbol)) {
tokenMapBySymbol.set(token.symbol, token)
}
})
})
/* add unique rewards tokens if any */
poolsListResponse.pools.forEach(({ rewards_tokens }) => {
rewards_tokens?.forEach((token) => {
if (!tokenMapBySymbol.has(token.symbol)) {
tokenMapBySymbol.set(token.symbol, token)
}
Expand Down

0 comments on commit 734e562

Please sign in to comment.