Skip to content
This repository was archived by the owner on Nov 10, 2023. It is now read-only.

(Feature) Remove spam tokens / Deactivate tokens refresh fix#1331

Merged
mmv08 merged 25 commits intodevelopmentfrom
1312-fetch-assets
Sep 15, 2020
Merged

(Feature) Remove spam tokens / Deactivate tokens refresh fix#1331
mmv08 merged 25 commits intodevelopmentfrom
1312-fetch-assets

Conversation

@Agupane
Copy link
Contributor

@Agupane Agupane commented Sep 8, 2020

Closes #1324
Closes #1329

Description

  • Removes spam tokens by setting exclude_spam param in fetchTokenCurrenciesBalances, now the tokens marked as spam in the backend are not fetched and the total balance is not affected by them
  • The "force fetch assets" feature was still there, but it wasn't working because the list of tokens within the safe state wasn't checked on updateSafe reducer, I fixed that replacing merge with mergeDeep
  • Another thing solved here was the currencyBalance/currencyRate that were removed in this PR and was causing two bugs:
    the first one is that the user lost the feature to store his preferred currency and avoid using always USD and the second one was related with the currency balances being deleted every time the user went to the assets tabs on this line:
    const storedCurrencies = await loadCurrencyValues()
    const storedCurrency = storedCurrencies[safeAddress]
    if (!storedCurrency) {
      return batch(() => {
        dispatch(setCurrencyBalances(safeAddress, List([])))
        dispatch(setSelectedCurrency(safeAddress, AVAILABLE_CURRENCIES.USD))
        dispatch(setCurrencyRate(safeAddress, 1))
      })
    }
  • Also while adding some types, I found that SerializedSessionState wasn't working so I fixed it, but seems that we aren't using it, I would suggest removing it.

Update

Now I left just the code needed, there are no fixes related to this (CC @dasanra)

I also left only the spam parameter, but seems that some tokens like Cunning or Scatter are still there, as far as I discussed with Lukas, they should be considered spam, just let you know in case you need to update the db @Uxio0

Update 14/09:

Closes #1324
Closes #1329

This PR fixes the issue with reloading the tokens and also adds the spam parameter for removing spam tokens from the balances list.

  • Also add types and replaces old class component to functional component

@Agupane Agupane self-assigned this Sep 8, 2020
@github-actions
Copy link

github-actions bot commented Sep 8, 2020

CLA Assistant Lite All Contributors have signed the CLA.

@github-actions
Copy link

github-actions bot commented Sep 8, 2020

ESLint Summary View Full Report

Annotations are provided inline on the Files Changed tab. You can also see all annotations that were generated on the annotations page.

Type Occurrences Fixable
Errors 0 0
Warnings 0 0
Ignored 0 N/A
  • Result: ✅ success
  • Annotations: 0 total

Report generated by eslint-plus-action

@Agupane Agupane marked this pull request as ready for review September 8, 2020 14:19
@ghost
Copy link

ghost commented Sep 8, 2020

Travis automatic deployment:
https://pr1331--safereact.review.gnosisdev.com/app

@Agupane Agupane requested a review from francovenica September 8, 2020 14:25
@ghost
Copy link

ghost commented Sep 8, 2020

Travis automatic deployment:
https://pr1331--safereact.review.gnosisdev.com/app

[COOKIES_REDUCER_ID]: Map<string, any>
[ADDRESS_BOOK_REDUCER_ID]: AddressBookReducerMap
[CURRENT_SESSION_REDUCER_ID]: Map<string, any>
[CURRENT_SESSION_REDUCER_ID]: SerializedSessionState
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In your comment you say we are not using it and we should remove it.
But here we are using it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes but it's not consumed anywhere, it's just added there

@Agupane Agupane requested review from Uxio0, dasanra and mmv08 September 10, 2020 12:40
@Uxio0
Copy link
Member

Uxio0 commented Sep 10, 2020

@Uxio0 please check the updated comment on the PR description

@lukasschor is the one now updating the tokens db 😉

@ghost
Copy link

ghost commented Sep 10, 2020

Travis automatic deployment:
https://pr1331--safereact.review.gnosisdev.com/app

@mmv08
Copy link
Contributor

mmv08 commented Sep 14, 2020

Could you please update PR title and desc to what it really does?

I would drop fixes for #1312 in favor of #1333

…to 1312-fetch-assets

# Conflicts:
#	src/routes/safe/components/Balances/Coins/index.tsx
#	src/routes/safe/components/Balances/Coins/styles.ts
@Agupane Agupane changed the title (Feature) Force fetch assets when accessing assets tabs (Feature) Remove spam tokens / Deactivate tokens refresh fix Sep 14, 2020
@Agupane
Copy link
Contributor Author

Agupane commented Sep 14, 2020

It's done @mikheevm

@ghost
Copy link

ghost commented Sep 14, 2020

Travis automatic deployment:
https://pr1331--safereact.review.gnosisdev.com/app

Copy link
Contributor

@mmv08 mmv08 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How does it fix deactivated tokens appear again? Was it an issue with mergeDeep too?

@Agupane
Copy link
Contributor Author

Agupane commented Sep 14, 2020

How does it fix deactivated tokens appear again? Was it an issue with mergeDeep too?

I thought that because the bug seems fixed but I tested with another safeAddress and the problem was still there, anyway, I fixed it now and refactored an old class component to functional component

@ghost
Copy link

ghost commented Sep 14, 2020

Travis automatic deployment:
https://pr1331--safereact.review.gnosisdev.com/app

@@ -1,4 +1,6 @@
import updateSafe from './updateSafe'
import { Set } from 'immutable'
import { Dispatch } from 'redux'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have already spoke about Dispatch and ThunkDispatch differences, haven't we?

Copy link
Contributor

@fernandomg fernandomg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

works great! 💯

@ghost
Copy link

ghost commented Sep 15, 2020

Travis automatic deployment:
https://pr1331--safereact.review.gnosisdev.com/app

@mmv08 mmv08 merged commit 3301817 into development Sep 15, 2020
@mmv08 mmv08 deleted the 1312-fetch-assets branch September 15, 2020 11:12
@mmv08 mmv08 restored the 1312-fetch-assets branch September 15, 2020 11:12
@mmv08 mmv08 deleted the 1312-fetch-assets branch September 15, 2020 11:12
@github-actions github-actions bot locked and limited conversation to collaborators Sep 15, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Deactivate tokens activate again after refresh Remove "spam" tokens

5 participants