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 toggle in Recent Contracts to display only verified contracts #915

Merged
merged 6 commits into from
Mar 5, 2024

Conversation

svienot
Copy link
Collaborator

@svienot svienot commented Mar 4, 2024

Description:

Provide functionality similar to what is already available in AccountDetails for recent created contract: add a toggle allowing to choose between All contracts and Verified contracts.

Since the Sourcify server does not provide a sorted/paginated enumeration of verified contracts, we have to get from mirror-node a fixed size buffer of the most recent contracts created, among which we filter verified contracts, if any.

Some refactoring was done to share VerifiedContractsTable and VerifiedContractsController between the Contracts and AccountDetails views. Only the cache differs (respectively VerifiedContractsCache and VerifiedContractsByAccountIdCache)
To allow for this, the corresponding Lookup classes, resp. SingletonLookup and EntityLookup (renamed from Lookup) are now implementing a common Lookup interface.

Related issue(s):

Fixes #884

Notes for reviewer:

Being deployed on staging server.

Screenshot 2024-03-04 at 23 30 12 Screenshot 2024-03-04 at 23 39 07

Checklist

  • Documented (Code comments, README, etc.)
  • Tested (unit, integration, etc.)

Signed-off-by: Simon Viénot <simon.vienot@icloud.com>
… VerifiedContractsTable and VerifiedContractsController renamed respectively AccountVerifiedContractsTable and AccountVerifiedContractsController.

Signed-off-by: Simon Viénot <simon.vienot@icloud.com>
Signed-off-by: Simon Viénot <simon.vienot@icloud.com>
Signed-off-by: Simon Viénot <simon.vienot@icloud.com>
…Lookup and SingletonLookup classes as Lookup interface.

Signed-off-by: Simon Viénot <simon.vienot@icloud.com>
…for VerifiedContractsCache.

Signed-off-by: Simon Viénot <simon.vienot@icloud.com>

Make VerifiedContractsBuffer capacity configurable. Use capacity 500 for VerifiedContractsCache.

Signed-off-by: Simon Viénot <simon.vienot@icloud.com>
Copy link

github-actions bot commented Mar 4, 2024

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 83.13% 35257 / 42407
🔵 Statements 83.13% 35257 / 42407
🔵 Functions 63.97% 831 / 1299
🔵 Branches 84.25% 3890 / 4617
File Coverage
File Stmts % Branch % Funcs % Lines Uncovered Lines
Changed Files
src/components/contract/VerifiedContractsController.ts 64% 100% 20% 64% 46-48, 53-55, 58-60, 69-74, 77-81, 94-105, 108-109, 112-116, 119-124
src/pages/AccountDetails.vue 46.01% 83.52% 33.33% 46.01% 1-257, 402-403, 408-409, 425-427
src/pages/Contracts.vue 95.27% 57.14% 50% 95.27% 36, 45-49
src/utils/cache/CacheUtils.ts 100% 100% 100% 100%
src/utils/cache/NftBySerialCache.ts 55.22% 100% 33.33% 55.22% 35-50, 53-66
src/utils/cache/TokenAssociationCache.ts 93.9% 75% 83.33% 93.9% 57-58, 75-77
src/utils/cache/VerifiedContractsBuffer.ts 23.63% 100% 50% 23.63% 27-110
src/utils/cache/VerifiedContractsByAccountIdCache.ts 76.19% 100% 50% 76.19% 30-33, 36-41
src/utils/cache/VerifiedContractsCache.ts 76.19% 100% 50% 76.19% 30-33, 36-41
src/utils/cache/base/EntityCache.ts 96.71% 93.54% 94.44% 96.71% 73-74, 145-147
src/utils/cache/base/Lookup.ts 0% 0% 0% 0% 1-29
src/utils/cache/base/SingletonCache.ts 97.36% 100% 88.88% 97.36% 53-54
Generated in workflow #747

Copy link

sonarcloud bot commented Mar 4, 2024

Quality Gate Failed Quality Gate failed

Failed conditions
0.0% Coverage on New Code (required ≥ 80%)

See analysis details on SonarCloud

Copy link
Collaborator

@ericleponner ericleponner left a comment

Choose a reason for hiding this comment

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

Looks good.

@svienot svienot merged commit d86d7ec into main Mar 5, 2024
6 of 7 checks passed
@svienot svienot deleted the 00884-V2-recent-verified-contracts branch March 5, 2024 13:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add toggle in Recent Contracts view to display all contracts or only verified contracts
2 participants