Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
I
interface
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
LuckySwap
interface
Commits
167cc695
Unverified
Commit
167cc695
authored
Jan 03, 2023
by
eddie
Committed by
GitHub
Jan 03, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: stop showing the token logos from different chains as a fallback (#5761)
parent
e175bff7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
6 deletions
+7
-6
TokenLogoLookupTable.ts
src/constants/TokenLogoLookupTable.ts
+5
-4
useAssetLogoSource.ts
src/hooks/useAssetLogoSource.ts
+2
-2
No files found.
src/constants/TokenLogoLookupTable.ts
View file @
167cc695
...
@@ -13,11 +13,11 @@ class TokenLogoLookupTable {
...
@@ -13,11 +13,11 @@ class TokenLogoLookupTable {
store
.
getState
().
lists
.
byUrl
[
list
].
current
?.
tokens
.
forEach
((
token
)
=>
{
store
.
getState
().
lists
.
byUrl
[
list
].
current
?.
tokens
.
forEach
((
token
)
=>
{
if
(
token
.
logoURI
)
{
if
(
token
.
logoURI
)
{
const
lowercaseAddress
=
token
.
address
.
toLowerCase
()
const
lowercaseAddress
=
token
.
address
.
toLowerCase
()
const
currentEntry
=
dict
[
lowercaseAddress
]
const
currentEntry
=
dict
[
lowercaseAddress
+
'
:
'
+
token
.
chainId
]
if
(
currentEntry
)
{
if
(
currentEntry
)
{
currentEntry
.
push
(
token
.
logoURI
)
currentEntry
.
push
(
token
.
logoURI
)
}
else
{
}
else
{
dict
[
lowercaseAddress
]
=
[
token
.
logoURI
]
dict
[
lowercaseAddress
+
'
:
'
+
token
.
chainId
]
=
[
token
.
logoURI
]
}
}
}
}
})
})
...
@@ -25,13 +25,14 @@ class TokenLogoLookupTable {
...
@@ -25,13 +25,14 @@ class TokenLogoLookupTable {
this
.
dict
=
dict
this
.
dict
=
dict
this
.
initialized
=
true
this
.
initialized
=
true
}
}
getIcons
(
address
?:
string
|
null
)
{
getIcons
(
address
?:
string
|
null
,
chainId
:
number
|
null
=
1
)
{
if
(
!
address
)
return
undefined
if
(
!
address
)
return
undefined
if
(
!
this
.
initialized
)
{
if
(
!
this
.
initialized
)
{
this
.
initialize
()
this
.
initialize
()
}
}
return
this
.
dict
[
address
.
toLowerCase
()]
return
this
.
dict
[
address
.
toLowerCase
()
+
'
:
'
+
chainId
]
}
}
}
}
...
...
src/hooks/useAssetLogoSource.ts
View file @
167cc695
...
@@ -66,7 +66,7 @@ export default function useAssetLogoSource(
...
@@ -66,7 +66,7 @@ export default function useAssetLogoSource(
}
}
// Parses and stores logo sources from tokenlists if assets repo url fails
// Parses and stores logo sources from tokenlists if assets repo url fails
if
(
!
fallbackSrcs
)
{
if
(
!
fallbackSrcs
)
{
const
uris
=
TokenLogoLookupTable
.
getIcons
(
address
)
??
[]
const
uris
=
TokenLogoLookupTable
.
getIcons
(
address
,
chainId
)
??
[]
if
(
backupImg
)
uris
.
push
(
backupImg
)
if
(
backupImg
)
uris
.
push
(
backupImg
)
const
tokenListIcons
=
prioritizeLogoSources
(
parseLogoSources
(
uris
))
const
tokenListIcons
=
prioritizeLogoSources
(
parseLogoSources
(
uris
))
...
@@ -75,7 +75,7 @@ export default function useAssetLogoSource(
...
@@ -75,7 +75,7 @@ export default function useAssetLogoSource(
}
else
{
}
else
{
setCurrent
(
fallbackSrcs
.
find
((
src
)
=>
!
BAD_SRCS
[
src
]))
setCurrent
(
fallbackSrcs
.
find
((
src
)
=>
!
BAD_SRCS
[
src
]))
}
}
},
[
current
,
fallbackSrcs
,
address
,
backupImg
])
},
[
current
,
fallbackSrcs
,
address
,
chainId
,
backupImg
])
return
[
current
,
nextSrc
]
return
[
current
,
nextSrc
]
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment