Skip to content

Pull Request: TypeScript migration for scripts, improved Hardhat config, and Makefile updates - #1

Merged
blueberrybeach merged 4 commits into
mainfrom
LC-174
Oct 29, 2025
Merged

blueberrybeach merged 4 commits into
mainfrom
LC-174

Conversation

@blueberrybeach

Copy link
Copy Markdown
Contributor

PR: TypeScript migration for scripts, improved Hardhat config, and Makefile updates

Summary

This pull request migrates all deployment and utility scripts from .mjs to .ts, introduces typed network configuration, improves logging and deployment summaries, and updates Hardhat and Makefile to align with the new structure. The goal is safer builds, clearer outputs, and a single source of truth for network and explorer metadata.

Scope

  • Refactor scripts to TypeScript with strict typing
  • Centralize network configuration and explorer URLs
  • Improve console logging and deployment summaries
  • Update Hardhat configuration and type declarations
  • Refresh Makefile targets to call the new TypeScript entry points

What changed

Script migration to TypeScript

Migrated 9 scripts with type annotations, error handling, and constructor fixes:

Before After
scripts/abi/saveAbi.mjs scripts/abi/saveAbi.ts
scripts/abi/cleanAbis.mjs scripts/abi/cleanAbis.ts
scripts/deploy.ts scripts/deployment/deploy.ts (restructured)
scripts/deploy-smart-contracts.mjs scripts/deployment/deploy-smart-contracts.ts
scripts/deploy-chat-utility.mjs scripts/deployment/deploy-chat-utility.ts
scripts/logs/console/console_logger.mjs scripts/logs/console/console_logger.ts
scripts/logs/data/data_logger.mjs scripts/logs/data/data_logger.ts
scripts/roles/assignRoles.mjs scripts/roles/assignRoles.ts

Key improvements

  • Full type safety with interfaces for network config and deployment args
  • Typed error handling and non null assertions where appropriate
  • Constructor calls match contract signatures
  • Pass constructor args directly instead of spread patterns

Console logger

  • Removed printNewLine() helper and wrote newlines directly in output functions
  • Added printDeploymentSummary() to produce a single, consistent summary across scripts
  • Cleaner separation between human readable logs and machine readable data logging

Deployment scripts

  • Removed hardcoded explorer URL mappings
  • Resolved explorer base URLs from typed network config
  • Centralized constants such as TIMELOCK_DELAY
  • Single call to printDeploymentSummary() to standardize output
  • Network type handling fixed with (network as any).name where Hardhat types are loose

Hardhat configuration

  • Added name to all configured networks
  • Ensured every network has a valid url RPC endpoint
  • Added explorer field with name and url for each network
  • Included Ethereum Mainnet configuration
  • Updated hardhat.d.ts to type new network properties

Makefile

  • Updated script invocations from .mjs to .ts
  • Switched to the new scripts/deployment/ structure
  • Kept make targets stable for backwards compatibility

Developer experience

  • TypeScript errors now catch mis wired constructor parameters before runtime
  • Deployment and role assignment flows share a single summary format
  • New network fields allow one touch updates to explorer links and names

Complete TypeScript migration of all deployment and utility scripts:
Migrated Scripts (9 files):
- scripts/abi/saveAbi.mjs → saveAbi.ts
- scripts/abi/cleanAbis.mjs → cleanAbis.ts
- scripts/deployment/deploy.ts (restructured from scripts/deploy.ts)
- scripts/deployment/deploy-smart-contracts.ts (from deploy-smart-contracts.mjs)
- scripts/deployment/deploy-chat-utility.ts (from deploy-chat-utility.mjs)
- scripts/logs/console/console_logger.ts (from console_logger.mjs)
- scripts/logs/data/data_logger.ts (from data_logger.mjs)
- scripts/roles/assignRoles.ts (from assignRoles.mjs)

Script Improvements:
- Full type safety with proper TypeScript annotations
- Network config integration using typed interfaces
- Proper error handling with typed catch blocks
- Non-null assertions where appropriate
- Fixed constructor calls to match actual contract signatures
- Direct constructor args instead of spread operators

Console Logger Enhancements:
- Remove unnecessary printNewLine() function
- Add newlines directly in output functions
- Create printDeploymentSummary() for unified deployment output
- Cleaner, more maintainable logging

Deployment Script Enhancements:
- Remove hardcoded explorer URL mappings
- Read explorer URLs directly from network config
- Use configuration constants (TIMELOCK_DELAY, etc.)
- Single function call for deployment summary
- Proper network type handling with (network as any).name
Hardhat Configuration Improvements:
- Add name property to all network configurations
- Ensure all networks have proper url (RPC endpoint) definitions
- Add explorer property with name and URL to all networks
- Add Ethereum Mainnet configuration
- Update type definitions in hardhat.d.ts for new network properties
…ment/ structure

Makefile Updates:
- Update all script references from .mjs to .ts
- Update deployment commands to use new scripts/deployment/ structure
- Reference new TypeScript entry points
- Maintain backwards compatibility with existing make targets
Documentation & Tooling:
- Add GNOSIS_SAFE_DEPLOYMENT_RUNBOOK.md with deployment procedures
- Add LC-174-IMPLEMENTATION-SUMMARY.md documenting all changes
- Add example-proposal.json with sample proposal format
- Add README.md for Gnosis Safe scripts
@blueberrybeach
blueberrybeach merged commit 7580eb5 into main Oct 29, 2025
1 check failed
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.

1 participant