Files
Sankofa/blockchain/scripts/generate-types.ts
defiQUG 9daf1fd378 Apply Composer changes: comprehensive API updates, migrations, middleware, and infrastructure improvements
- Add comprehensive database migrations (001-024) for schema evolution
- Enhance API schema with expanded type definitions and resolvers
- Add new middleware: audit logging, rate limiting, MFA enforcement, security, tenant auth
- Implement new services: AI optimization, billing, blockchain, compliance, marketplace
- Add adapter layer for cloud integrations (Cloudflare, Kubernetes, Proxmox, storage)
- Update Crossplane provider with enhanced VM management capabilities
- Add comprehensive test suite for API endpoints and services
- Update frontend components with improved GraphQL subscriptions and real-time updates
- Enhance security configurations and headers (CSP, CORS, etc.)
- Update documentation and configuration files
- Add new CI/CD workflows and validation scripts
- Implement design system improvements and UI enhancements
2025-12-12 18:01:35 -08:00

45 lines
1.3 KiB
TypeScript

/**
* Generate TypeScript types from compiled smart contracts
* Run: pnpm exec ts-node scripts/generate-types.ts
*/
import { execSync } from 'child_process'
import * as fs from 'fs'
import * as path from 'path'
async function generateTypes() {
console.log('Generating TypeScript types from smart contracts...')
try {
// Run typechain to generate types
execSync('npx typechain --target ethers-v6 --out-dir ../api/src/types/contracts artifacts/contracts/**/*.json', {
cwd: path.join(__dirname, '..'),
stdio: 'inherit',
})
console.log('✓ TypeScript types generated successfully')
console.log('Types are available in: api/src/types/contracts/')
// Create index file for easy imports
const typesDir = path.join(__dirname, '../../api/src/types/contracts')
if (fs.existsSync(typesDir)) {
const indexContent = `// Auto-generated contract type exports
// This file is generated by scripts/generate-types.ts
export * from './ResourceProvisioning'
export * from './IdentityManagement'
export * from './Billing'
export * from './Compliance'
`
fs.writeFileSync(path.join(typesDir, 'index.ts'), indexContent)
console.log('✓ Created index.ts for contract types')
}
} catch (error) {
console.error('Failed to generate types:', error)
process.exit(1)
}
}
generateTypes()