Skip to content

Display contract Source Code and Contract Metadata fields #1890

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

Merged
merged 1 commit into from
May 5, 2025

Conversation

kaja-osojnik
Copy link
Collaborator

@kaja-osojnik kaja-osojnik commented Apr 10, 2025

Add RawDataDisplay fields to display Source Code and Contract Metadata in 'Code' tab for verified contracts as displayed in Sourcify.
Fixes: #1881

Before:
Screenshot 2025-04-10 at 18 30 56

After:
Screenshot 2025-04-10 at 18 31 50
Screenshot 2025-04-10 at 18 32 08
Screenshot 2025-04-10 at 18 32 25
Screenshot 2025-04-10 at 18 32 54
Screenshot 2025-04-10 at 18 33 13

Copy link

github-actions bot commented Apr 10, 2025

Deployed to Cloudflare Pages

Latest commit: e370a3c9fcc5c63c19a9eaf41101b22b29f159f5
Status:✅ Deploy successful!
Preview URL: https://9ea1369d.oasis-explorer.pages.dev
Alias: https://pr-1890.oasis-explorer.pages.dev

@kuzdogan
Copy link

Just came across this. You can use the new APIv2 to show the sources and a lot more. E.g. https://sourcify.dev/server/v2/contract/42262/0xF8393ab5D6c62D585E5647692E33532c8A5da6E7?fields=all

@lukaw3d
Copy link
Member

lukaw3d commented Apr 15, 2025

Just came across this. You can use the new APIv2 to show the sources and a lot more. E.g. https://sourcify.dev/server/v2/contract/42262/0xF8393ab5D6c62D585E5647692E33532c8A5da6E7?fields=all

Thanks for visiting!

Comment on lines 11 to 22
useEffect(() => {
if (hash === `#${id}`) {
if (element) {
element.scrollIntoView({
block: 'start',
})
} else {
setTimeout(() => {
if (divRef.current) {
divRef.current.scrollIntoView({
block: 'start',
})
}
})
if (hash === `#${id}` && divRef.current) {
const element = divRef.current
const yOffset = isMobile ? -160 : -180

const scroll = () => {
const y = element.getBoundingClientRect().top + window.scrollY + yOffset
window.scrollTo({ top: y })
}
setTimeout(scroll, 50)
}
}, [id, hash, element])
}, [id, hash, isMobile])
Copy link
Member

Choose a reason for hiding this comment

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

Lets fix this in a separate pullrequest (+ I don't think this is the most reliable and maintainable approach)

Copy link
Member

Choose a reason for hiding this comment

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

Created #1950

@kaja-osojnik kaja-osojnik force-pushed the kaja/display-contract-sourcecode branch from 60331e5 to 7acccab Compare May 5, 2025 09:43
@kaja-osojnik kaja-osojnik requested a review from lukaw3d May 5, 2025 09:46
Copy link
Member

@lukaw3d lukaw3d left a comment

Choose a reason for hiding this comment

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

Great! I'll rebase and combine the commits

@lukaw3d lukaw3d force-pushed the kaja/display-contract-sourcecode branch from 7acccab to a207989 Compare May 5, 2025 14:41
@lukaw3d lukaw3d force-pushed the kaja/display-contract-sourcecode branch from a207989 to e370a3c Compare May 5, 2025 14:41
@lukaw3d lukaw3d merged commit e814a61 into master May 5, 2025
9 checks passed
@lukaw3d lukaw3d deleted the kaja/display-contract-sourcecode branch May 5, 2025 14:50
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.

Display contract sourcecode
3 participants