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

Add GET /v2/contract/{chainId}/{address} endpoint #1874

Merged
merged 10 commits into from
Jan 29, 2025

Conversation

manuelwedler
Copy link
Contributor

Closes #1827

Adds the /v2/contract/{chainId}/{address} endpoint as described in https://sourcify.stoplight.io/docs/sourcify-apiv2/branches/main/cqx62aqefyrje-get-verified-contract

Copy link
Member

@marcocastignoli marcocastignoli left a comment

Choose a reason for hiding this comment

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

🚀 Great job! Only some minor things:

@@ -626,32 +626,22 @@
"name": "#utility.yul"
}
],
"sourceMap": "141:356:8:-:0;;;;;;;;;;;;;;;;;;;",
"deployedSourceMap": "141:356:8:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;416:79;;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;271:64;;;;;;;;;;;;;:::i;:::-;;:::i;:::-;;416:79;457:7;482:6;;475:13;;416:79;:::o;271:64::-;325:3;316:6;:12;;;;271:64;:::o;7:139:9:-;53:5;91:6;78:20;69:29;;107:33;134:5;107:33;:::i;:::-;59:87;;;;:::o;152:262::-;211:6;260:2;248:9;239:7;235:23;231:32;228:2;;;276:1;273;266:12;228:2;319:1;344:53;389:7;380:6;369:9;365:22;344:53;:::i;:::-;334:63;;290:117;218:196;;;;:::o;420:118::-;507:24;525:5;507:24;:::i;:::-;502:3;495:37;485:53;;:::o;544:222::-;637:4;675:2;664:9;660:18;652:26;;688:71;756:1;745:9;741:17;732:6;688:71;:::i;:::-;642:124;;;;:::o;772:77::-;809:7;838:5;827:16;;817:32;;;:::o;855:122::-;928:24;946:5;928:24;:::i;:::-;921:5;918:35;908:2;;967:1;964;957:12;908:2;898:79;:::o",
"sourceMap": "141:356:0:-:0;;;;;;;;;;;;;;;;;;;",
Copy link
Member

Choose a reason for hiding this comment

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

Why did this become 0?

Copy link
Member

Choose a reason for hiding this comment

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

141:356:8 -> 141:356:0

Copy link
Contributor Author

@manuelwedler manuelwedler Jan 29, 2025

Choose a reason for hiding this comment

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

Good question. Tbh, I just recompiled myself and added the source map there because I had a failing test. I don't know why the server and my compilation produce a different source map than the original compilation. Everything else just matches. Any idea how I can get the server to produce the same source map as before?

Copy link
Member

Choose a reason for hiding this comment

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

Mmh I don't have an answer right now, maybe @kuzdogan knows it?

Copy link
Member

Choose a reason for hiding this comment

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

No idea, I tried to compile the same file with different compilers but I didn't get an inconsistent result. The new value is the correct one.

Copy link
Member

@marcocastignoli marcocastignoli left a comment

Choose a reason for hiding this comment

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

LGTM!

@manuelwedler manuelwedler merged commit 9c10fa8 into apiv2 Jan 29, 2025
6 checks passed
@manuelwedler manuelwedler deleted the apiv2-get-contract-endpoint branch January 29, 2025 15:34
manuelwedler added a commit that referenced this pull request Jan 30, 2025
* Update API v2 spec

* Add VerifiedContract type

* Add tests for GET /v2/contracts/:chainId/:address endpoint

* Add GET `/v2/contract/{chainId}/{address}` endpoint

* Update API v2 spec

* Add proxy detection to GET /v2/contract/{chainId}/{address} endpoint

* Don't deploy a contract in every test

* Fix naming of enpoint to `/v2/contract/{chainId}/{address}`

* Fix proxy-contract-util tests

* Address PR feedback
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: COMPLETED
Development

Successfully merging this pull request may close these issues.

3 participants