Skip to content

Conversation

@AugustoL
Copy link
Collaborator

@AugustoL AugustoL commented Jan 21, 2026

Description

Add Vite plugin that automatically injects Hardhat/Ignition deployment artifacts into localStorage when running npm run dev, eliminating the need for manual ZIP file import during local development.

Related Issue

Closes #146

Type of Change

  • Bug fix
  • New feature
  • Documentation update
  • Refactoring
  • Performance improvement
  • Other (please describe):

Changes Made

  • Create vite-plugin-artifacts.ts - Vite plugin that scans for Ignition deployment artifacts at build time
  • Create src/utils/devArtifacts.ts - Runtime handler that injects artifacts into localStorage on app startup
  • Update vite.config.ts - Add the dev artifacts plugin
  • Update src/index.tsx - Call the injection handler before React renders
  • Fix scripts/run-test-env.sh - Add sleep before ignition deploy to ensure node is ready

Features:

  • Auto-detects artifacts from multiple paths (hardhat-node-test/ignition/deployments/chain-31337/ or ./artifacts/)
  • Includes ABI, contract name, source code, and build info
  • Only injects when localStorage is empty (won't override user imports)
  • Only runs in dev mode (npm run dev)

Screenshots (if applicable)

N/A

Checklist

  • I have run npm run format:fix and npm run lint:fix
  • I have run npm run typecheck with no errors
  • I have run tests with npm run test:run
  • I have tested my changes locally
  • I have updated documentation if needed
  • My code follows the project's architecture patterns

Additional Notes

The artifact schema matches the existing useZipJsonReader output format, so all existing components work unchanged.

Add Vite plugin that automatically injects Hardhat/Ignition deployment
artifacts into localStorage when running `npm run dev`. This eliminates
the need for manual ZIP file import during local development.

- Create vite-plugin-artifacts.ts to scan and load deployment artifacts
- Add devArtifacts.ts runtime handler to inject into localStorage
- Auto-detect artifacts from multiple paths (ignition or ./artifacts)
- Only inject when localStorage is empty to not override user imports

Closes openscan-explorer#146
@AugustoL AugustoL requested a review from MatiasOS January 21, 2026 13:41
@github-actions
Copy link

🚀 Preview: https://pr-171--openscan.netlify.app
📝 Commit: 7a5347408606f1a7734fd887478f3ef50a4e3658

Copy link
Member

@MatiasOS MatiasOS left a comment

Choose a reason for hiding this comment

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

Thanks for taking this one !

@AugustoL AugustoL merged commit e3196e9 into openscan-explorer:dev Jan 21, 2026
2 of 3 checks passed
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.

2 participants