Closed shazow closed 3 months ago
Hey just saw this by chance. You can use the /files/any
endpoint to get the source code and the metadata at the same time https://sourcify.dev/server/files/any/1/0x07880D44b0f7b75464ad18fc2b980049c40A8bc3/
@kuzdogan Ha thanks, just added that earlier today!! https://github.com/shazow/whatsabi/pull/112/files#diff-e06cc0643d5d32542b35abf16a4c938570ddd0a6d2fb52cc1703b45635e2cb8bR265
Actually I have a question, any reason why the partial /any/
version of the response is a different layout than the full match version? Latter is a list of files, former is contained within an object with {status, files: [...]}
.
@kuzdogan Also one more question while I have you here (thanks for dropping by!), should I be replacing my usage of https://repo.sourcify.dev/contracts/partial_match/1/$ADDRESS/metadata.json
api with the https://sourcify.dev/server/repository
api instead?
Actually I have a question, any reason why the partial
/any/
version of the response is a different layout than the full match version? Latter is a list of files, former is contained within an object with{status, files: [...]}
.
I don't know... I guess this was how the API has always been before I joined, and we keep it as is. The legacy API is really not clean I know.
@kuzdogan Also one more question while I have you here (thanks for dropping by!), should I be replacing my usage of
https://repo.sourcify.dev/contracts/partial_match/1/$ADDRESS/metadata.json
api with thehttps://sourcify.dev/server/repository
api instead?
We are redirecting the requests to repo.souricify.dev
's static file access to sourcify.dev/server/repository
anyways so yes it makes sense.
We are redirecting the requests to
repo.souricify.dev
's static file access tosourcify.dev/server/repository
anyways so yes it makes sense.
Looks like the new endpoint is even worse than the old endpoint wrt handling missing contracts, so I'm going to have to stick with the old one for now: https://x.com/shazow/status/1821931353954201621 Oops I missed the /server
prefix.
Right now we just load the metadata, but we're not too far from loading the code too.
I believe the Etherscan loader already returns the code in the response, we just need to plumb it through to the response.
The Sourcify loader would likely need another request to fetch the source, so might need to make it a flag?