-
Notifications
You must be signed in to change notification settings - Fork 428
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
Add v2/contracts/{chainId}
API endpoint
#1857
Conversation
Includes the initial setup of routes and types needed for API v2, as it's the first endpoint
Some shells require mocha's `recursive` option to go through all subdirectories
v2/contracts/{chainId}
API endpoint
We decided to implement id based pagination to circumvent the above issue. We need to add the The API query should look like this then: @marcocastignoli you can wait with reviewing until I implemented this. |
Just to make sure, should it be from |
It should be |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll review again after you implement the new pagination. Great job! 👍
services/server/src/server/services/storageServices/SourcifyDatabaseService.ts
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
* Move `safeHandler` to common.ts * Update API v2 spec * Add `v2/contracts/{chainId}` API endpoint Includes the initial setup of routes and types needed for API v2, as it's the first endpoint * Fix server test commands Some shells require mocha's `recursive` option to go through all subdirectories * Move API v1 routes to apiv1 folder * Update API v2 spec * Change pagination to be id based * Add `getTotalMatchLevel` util function * Rename MatchLevel types
See #1827
Adds the
v2/contracts/{chainId}
endpoint as described in https://sourcify.stoplight.io/docs/sourcify-apiv2/kqms8dret0zja-list-of-verified-contracts-per-chainIncludes the initial setup of routes and types needed for API v2, as it's the first endpoint. Also refactors some API v1 code to the apiv1 folder.
Pagination issue
I discovered an issue about the pagination design of the API. The issue is that we include the
totalResults
in the response. To gather this information, we run a very long db query for counting the matches. It took 60-90 seconds in my trials on production. This issue is already present in API v1.I think we can still review this PR, and resolve this issue in another when we decided how to go about it.