@@ -132,34 +132,11 @@ func (tm *Manager) getDiscoveredTokens(onlyCommunityCustoms bool) ([]*tokentypes
132132}
133133
134134func (tm * Manager ) GetCustoms (onlyCommunityCustoms bool ) ([]* tokentypes.Token , error ) {
135- communityTokens , err := tm .communityTokensDB .GetTokens ()
136- if err != nil {
137- return nil , err
138- }
139-
140135 var (
141136 result []* tokentypes.Token
142137 processedToken = make (map [string ]struct {})
143138 )
144139
145- for _ , communityToken := range communityTokens {
146- token := & tokentypes.Token {
147- Token : & types.Token {
148- Address : common .HexToAddress (communityToken .Address ),
149- Name : communityToken .Name ,
150- Symbol : communityToken .Symbol ,
151- Decimals : uint (communityToken .Decimals ),
152- ChainID : uint64 (communityToken .ChainID ),
153- },
154- CommunityData : & tokentypes.CommunityData {
155- ID : communityToken .CommunityID ,
156- },
157- }
158-
159- processedToken [token .Key ()] = struct {}{}
160- result = append (result , token )
161- }
162-
163140 discoveredTokens , err := tm .getDiscoveredTokens (onlyCommunityCustoms )
164141 if err != nil {
165142 return nil , err
@@ -173,6 +150,32 @@ func (tm *Manager) GetCustoms(onlyCommunityCustoms bool) ([]*tokentypes.Token, e
173150 result = append (result , discoveredToken )
174151 }
175152
153+ if onlyCommunityCustoms {
154+ communityTokens , err := tm .communityTokensDB .GetTokens ()
155+ if err != nil {
156+ return nil , err
157+ }
158+
159+ for _ , communityToken := range communityTokens {
160+ token := & tokentypes.Token {
161+ Token : & types.Token {
162+ Address : common .HexToAddress (communityToken .Address ),
163+ Name : communityToken .Name ,
164+ Symbol : communityToken .Symbol ,
165+ Decimals : uint (communityToken .Decimals ),
166+ ChainID : uint64 (communityToken .ChainID ),
167+ LogoURI : communityToken .Base64Image ,
168+ },
169+ CommunityData : & tokentypes.CommunityData {
170+ ID : communityToken .CommunityID ,
171+ },
172+ }
173+
174+ processedToken [token .Key ()] = struct {}{}
175+ result = append (result , token )
176+ }
177+ }
178+
176179 return result , nil
177180}
178181
0 commit comments