Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: ✨ Add spamFilteringTx in LLD #7911

Merged
merged 3 commits into from
Oct 31, 2024

Conversation

mcayuelas-ledger
Copy link
Contributor

@mcayuelas-ledger mcayuelas-ledger commented Sep 25, 2024

✅ Checklist

  • npx changeset was attached.
  • Covered by automatic tests.
  • Impact of the changes:
  1. Transaction Filtering:
    Implementation of a new feature to filter transactions involving spam NFTs. This ensures that only valid and relevant transactions are considered within the system.

  2. Whitelist and Enhancement of HiddenCollection:
    Addition of a whitelist to control the addresses and accounts authorized to interact with the system, enhancing the security and reliability of processed transactions.
    Improvements made to the HiddenCollection object to optimize the management and storage of hidden NFT collections.

  3. Automatic Synchronization:
    Implementation of automatic synchronization every 6 hours to refresh and filter NFTs via the Simplehash API. This ensures that the data remains up-to-date and relevant.

  4. Refresh on Account Addition:
    When new accounts or addresses are added, the filtering request is automatically re-triggered. This guarantees that new entries are immediately taken into account in the filtering process.

  5. Add loading "Show more collections" to avoid load everything fully

📝 Description

0 - News
1 - Tests
2 - Feature

0 - What's new

  • Rework some components using useNftGalleryFilter
  • New generic hook useNftCollections used instead in each file that was using useNftGalleryFilter
  • HiddenCollection and Whitelist NFTs

1 - TESTS Feature with SimpleHashTool + TanStackQuery

Test if we have more than 20 address if check is done on other groups

Screen.Recording.2024-09-25.at.14.41.07.mov

Adding a new account

Screen.Recording.2024-09-25.at.15.21.38.mov

Test FF

Screen.Recording.2024-09-25.at.16.22.37.mov

2 - Spam Filtering

  • ADD in HiddenCollection
  • add new account
  • Filter Spam TX
  • Show more
Screen.Recording.2024-10-28.at.16.21.13.mov
Screen.Recording.2024-10-28.at.16.22.19.mov

Screenshot 2024-10-29 at 17 10 24

❓ Context


🧐 Checklist for the PR Reviewers

  • The code aligns with the requirements described in the linked JIRA or GitHub issue.
  • The PR description clearly documents the changes made and explains any technical trade-offs or design decisions.
  • There are no undocumented trade-offs, technical debt, or maintainability issues.
  • The PR has been tested thoroughly, and any potential edge cases have been considered and handled.
  • Any new dependencies have been justified and documented.
  • Performance considerations have been taken into account. (changes have been profiled or benchmarked if necessary)

@mcayuelas-ledger mcayuelas-ledger requested a review from a team as a code owner September 25, 2024 15:46
Copy link

vercel bot commented Sep 25, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
web-tools ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 30, 2024 8:41am
4 Skipped Deployments
Name Status Preview Comments Updated (UTC)
ledger-live-docs ⬜️ Ignored (Inspect) Visit Preview Oct 30, 2024 8:41am
ledger-live-github-bot ⬜️ Ignored (Inspect) Visit Preview Oct 30, 2024 8:41am
native-ui-storybook ⬜️ Ignored (Inspect) Visit Preview Oct 30, 2024 8:41am
react-ui-storybook ⬜️ Ignored (Inspect) Visit Preview Oct 30, 2024 8:41am

@live-github-bot live-github-bot bot added desktop Has changes in LLD common Has changes in live-common labels Sep 25, 2024
@mcayuelas-ledger mcayuelas-ledger force-pushed the feat/spam-filtering-tx-useNFTfilter-LLD branch from ce9ee33 to 3bb906f Compare September 25, 2024 15:49
themooneer
themooneer previously approved these changes Sep 25, 2024
Copy link
Contributor

@themooneer themooneer left a comment

Choose a reason for hiding this comment

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

i've added an optional suggestion. but it's a nice and clean work 👏

Comment on lines +28 to +29
export const ONE_DAY = 24 * 60 * 60 * 1000;
export const HALF_DAY = ONE_DAY / 2;
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this be defined here or imported from libs/ledger-live-common/src/market/utils/timers.ts ? Because I don't see HALF_DAY imported anywhere.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

perhaps we could consider a file with all the timers, as this one is specific to the market, for example ? wdyt?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes it's good too but what I suggested here here was either:

  • To import ONE_DAY and HALF_DAY from ledger-live-common/src/market/utils/timers

  • Or to remove HALF_DAY from ledger-live-common/src/market/utils/timers and remove the export from the declaration:

    Suggested change
    export const ONE_DAY = 24 * 60 * 60 * 1000;
    export const HALF_DAY = ONE_DAY / 2;
    const ONE_DAY = 24 * 60 * 60 * 1000;
    const HALF_DAY = ONE_DAY / 2;

It's a detail but since HALF_DAY is not imported anywhere it looks like extra unused code right now. Unless of course if you're planning to use it later.

@mcayuelas-ledger mcayuelas-ledger force-pushed the feat/spam-filtering-tx-useNFTfilter-LLD branch from bf44241 to d510372 Compare September 25, 2024 16:12
@mcayuelas-ledger mcayuelas-ledger force-pushed the feat/spam-filtering-tx-useNFTfilter branch 2 times, most recently from 6a8e4d2 to dfa5ee1 Compare September 26, 2024 08:36
@mcayuelas-ledger mcayuelas-ledger force-pushed the feat/spam-filtering-tx-useNFTfilter-LLD branch from d510372 to aa9ccfe Compare September 26, 2024 08:37
@mcayuelas-ledger mcayuelas-ledger force-pushed the feat/spam-filtering-tx-useNFTfilter branch 2 times, most recently from 972e404 to 93eadf1 Compare September 26, 2024 08:45
@mcayuelas-ledger mcayuelas-ledger force-pushed the feat/spam-filtering-tx-useNFTfilter-LLD branch from aa9ccfe to 38ffc44 Compare September 26, 2024 08:46
@mcayuelas-ledger mcayuelas-ledger force-pushed the feat/spam-filtering-tx-useNFTfilter branch from 93eadf1 to ca467ec Compare September 26, 2024 09:04
@mcayuelas-ledger mcayuelas-ledger force-pushed the feat/spam-filtering-tx-useNFTfilter-LLD branch from 38ffc44 to d5fe6ae Compare September 26, 2024 09:56
@LucasWerey LucasWerey force-pushed the feat/spam-filtering-tx-useNFTfilter branch 2 times, most recently from f32c6e9 to 7af1be4 Compare October 2, 2024 13:17
@mcayuelas-ledger mcayuelas-ledger marked this pull request as ready for review October 28, 2024 15:27
expect(mapChain(BlockchainEVM.Avalanche)).toEqual("avalanche");
});

it("mapChains", () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggestion it("should map a multiple chains")

themooneer
themooneer previously approved these changes Oct 29, 2024
mcayuelas-ledger and others added 3 commits October 30, 2024 09:35
feat: ✨ Add spamFilteringTx hook in global

review: Enums
Fix some UI broken + improve SimpleHash tool
test: ✅ Add tests for new Hooks

Check when adding new address

✅ Add tests for new Hooks
Copy link
Member

@KVNLS KVNLS left a comment

Choose a reason for hiding this comment

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

It works well! Well done!

@mcayuelas-ledger mcayuelas-ledger merged commit 87218b1 into develop Oct 31, 2024
55 of 56 checks passed
@mcayuelas-ledger mcayuelas-ledger deleted the feat/spam-filtering-tx-useNFTfilter-LLD branch October 31, 2024 12:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
common Has changes in live-common desktop Has changes in LLD mobile Has changes in LLM
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants