File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed
Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ export default function rates(pylon: Pylon, store: Store) {
1818 const storeApi = {
1919 getKnownTokens : ( address ?: Address ) =>
2020 ( ( address && store ( 'main.tokens.known' , address ) ) || [ ] ) as Token [ ] ,
21+ getCustomTokens : ( ) => ( store ( 'main.tokens.custom' ) || [ ] ) as Token [ ] ,
2122 setNativeCurrencyData : ( chainId : number , currencyData : NativeCurrency ) =>
2223 store . setNativeCurrencyData ( 'ethereum' , chainId , currencyData ) ,
2324 setNativeCurrencyRate : ( chainId : number , rate : Rate ) =>
@@ -67,7 +68,13 @@ export default function rates(pylon: Pylon, store: Store) {
6768 function updateSubscription ( chains : number [ ] , address ?: Address ) {
6869 const subscribedCurrencies = chains . map ( ( chainId ) => ( { type : AssetType . NativeCurrency , chainId } ) )
6970 const knownTokens = storeApi . getKnownTokens ( address ) . filter ( ( token ) => chains . includes ( token . chainId ) )
70- const subscribedTokens = knownTokens . map ( ( token ) => ( {
71+ const customTokens = storeApi
72+ . getCustomTokens ( )
73+ . filter (
74+ ( token ) => ! knownTokens . some ( ( kt ) => kt . address === token . address && kt . chainId === token . chainId )
75+ )
76+
77+ const subscribedTokens = [ ...knownTokens , ...customTokens ] . map ( ( token ) => ( {
7178 type : AssetType . Token ,
7279 chainId : token . chainId ,
7380 address : token . address
You can’t perform that action at this time.
0 commit comments