Files
Sankofa/api/src/services/blockchain-contracts.ts
T
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

67 lines
1.7 KiB
TypeScript

/**
* Blockchain Contract Types
*
* This file provides type-safe interfaces for smart contracts.
* In production, these should be generated from compiled contracts using typechain.
*
* To generate types:
* 1. Compile contracts: cd blockchain && pnpm compile
* 2. Generate types: cd blockchain && pnpm generate:types
* 3. Import from: import { ResourceProvisioning } from '../types/contracts'
*/
// Resource Type enum matching smart contract
export enum ResourceType {
VM = 0,
CONTAINER = 1,
STORAGE = 2,
NETWORK = 3,
SERVICE = 4,
}
// Resource struct matching smart contract
export interface BlockchainResource {
resourceId: string
region: string
datacenter: string
resourceType: ResourceType
provisionedAt: bigint
provisionedBy: string
active: boolean
metadata: string
}
// Event types
export interface ResourceProvisionedEvent {
resourceId: string
region: string
resourceType: ResourceType
provisionedBy: string
timestamp: bigint
}
export interface ResourceDeprovisionedEvent {
resourceId: string
deprovisionedBy: string
timestamp: bigint
}
/**
* Try to import generated types, fallback to manual definitions
*/
let ResourceProvisioningContract: any = null
let IdentityManagementContract: any = null
try {
// Try to import generated types
const generatedTypes = require('../types/contracts')
ResourceProvisioningContract = generatedTypes.ResourceProvisioning
IdentityManagementContract = generatedTypes.IdentityManagement
} catch (error) {
// Types not generated yet - using manual definitions
// This is expected until contracts are compiled and types are generated
}
export { ResourceProvisioningContract, IdentityManagementContract }