import { Module, Global } from '@nestjs/common'; import { HttpModule } from '@nestjs/axios'; import { PrismaService } from './persistence/prisma/prisma.service'; import { UserAccountRepositoryImpl } from './persistence/repositories/user-account.repository.impl'; import { MpcKeyShareRepositoryImpl } from './persistence/repositories/mpc-key-share.repository.impl'; import { UserAccountMapper } from './persistence/mappers/user-account.mapper'; import { RedisService } from './redis/redis.service'; import { EventPublisherService } from './kafka/event-publisher.service'; import { SmsService } from './external/sms/sms.service'; import { WalletGeneratorServiceImpl } from './external/blockchain/wallet-generator.service.impl'; import { BlockchainQueryService } from './external/blockchain/blockchain-query.service'; import { MpcClientService, MpcWalletService } from './external/mpc'; import { BackupClientService, MpcShareStorageService } from './external/backup'; import { MPC_KEY_SHARE_REPOSITORY } from '@/domain/repositories/mpc-key-share.repository.interface'; import { WalletGeneratorService } from '@/domain/services/wallet-generator.service'; @Global() @Module({ imports: [ HttpModule.register({ timeout: 300000, maxRedirects: 5, }), ], providers: [ PrismaService, UserAccountRepositoryImpl, { provide: MPC_KEY_SHARE_REPOSITORY, useClass: MpcKeyShareRepositoryImpl, }, UserAccountMapper, RedisService, EventPublisherService, SmsService, // WalletGeneratorService 抽象类由 WalletGeneratorServiceImpl 实现 WalletGeneratorServiceImpl, { provide: WalletGeneratorService, useExisting: WalletGeneratorServiceImpl, }, BlockchainQueryService, MpcClientService, MpcWalletService, BackupClientService, MpcShareStorageService, ], exports: [ PrismaService, UserAccountRepositoryImpl, { provide: MPC_KEY_SHARE_REPOSITORY, useClass: MpcKeyShareRepositoryImpl, }, UserAccountMapper, RedisService, EventPublisherService, SmsService, WalletGeneratorServiceImpl, WalletGeneratorService, BlockchainQueryService, MpcClientService, MpcWalletService, BackupClientService, MpcShareStorageService, ], }) export class InfrastructureModule {}