- Add Foundry project configuration (foundry.toml, foundry.lock) - Add Solidity contracts (TokenFactory138, BridgeVault138, ComplianceRegistry, etc.) - Add API definitions (OpenAPI, GraphQL, gRPC, AsyncAPI) - Add comprehensive test suite (unit, integration, fuzz, invariants) - Add API services (REST, GraphQL, orchestrator, packet service) - Add documentation (ISO20022 mapping, runbooks, adapter guides) - Add development tools (RBC tool, Swagger UI, mock server) - Update OpenZeppelin submodules to v5.0.0
118 lines
3.4 KiB
TypeScript
118 lines
3.4 KiB
TypeScript
/**
|
|
* Compliance controllers
|
|
*/
|
|
|
|
import { Request, Response, NextFunction } from 'express';
|
|
import { complianceService } from '../services/compliance-service';
|
|
|
|
export async function getComplianceProfile(req: Request, res: Response, next: NextFunction) {
|
|
try {
|
|
const { accountRefId } = req.params;
|
|
const profile = await complianceService.getProfile(accountRefId);
|
|
res.json(profile);
|
|
} catch (error) {
|
|
next(error);
|
|
}
|
|
}
|
|
|
|
export async function setCompliance(req: Request, res: Response, next: NextFunction) {
|
|
try {
|
|
const { accountRefId } = req.params;
|
|
const profile = await complianceService.setCompliance(accountRefId, req.body);
|
|
res.json(profile);
|
|
} catch (error) {
|
|
next(error);
|
|
}
|
|
}
|
|
|
|
export async function setFrozen(req: Request, res: Response, next: NextFunction) {
|
|
try {
|
|
const { accountRefId } = req.params;
|
|
const profile = await complianceService.setFrozen(accountRefId, req.body);
|
|
res.json(profile);
|
|
} catch (error) {
|
|
next(error);
|
|
}
|
|
}
|
|
|
|
export async function setTier(req: Request, res: Response, next: NextFunction) {
|
|
try {
|
|
const { accountRefId } = req.params;
|
|
const { tier } = req.body;
|
|
const profile = await complianceService.setTier(accountRefId, tier);
|
|
res.json(profile);
|
|
} catch (error) {
|
|
next(error);
|
|
}
|
|
}
|
|
|
|
export async function setJurisdictionHash(req: Request, res: Response, next: NextFunction) {
|
|
try {
|
|
const { accountRefId } = req.params;
|
|
const { jurisdictionHash } = req.body;
|
|
const profile = await complianceService.setJurisdictionHash(accountRefId, jurisdictionHash);
|
|
res.json(profile);
|
|
} catch (error) {
|
|
next(error);
|
|
}
|
|
}
|
|
|
|
// Wallet-specific endpoints
|
|
export async function getWalletComplianceProfile(req: Request, res: Response, next: NextFunction) {
|
|
try {
|
|
const { walletRefId } = req.params;
|
|
// In production, map wallet to account first
|
|
const profile = await complianceService.getProfile(walletRefId);
|
|
res.json(profile);
|
|
} catch (error) {
|
|
next(error);
|
|
}
|
|
}
|
|
|
|
export async function setWalletCompliance(req: Request, res: Response, next: NextFunction) {
|
|
try {
|
|
const { walletRefId } = req.params;
|
|
// In production, map wallet to account first
|
|
const profile = await complianceService.setCompliance(walletRefId, req.body);
|
|
res.json(profile);
|
|
} catch (error) {
|
|
next(error);
|
|
}
|
|
}
|
|
|
|
export async function setWalletFrozen(req: Request, res: Response, next: NextFunction) {
|
|
try {
|
|
const { walletRefId } = req.params;
|
|
// In production, map wallet to account first
|
|
const profile = await complianceService.setFrozen(walletRefId, req.body);
|
|
res.json(profile);
|
|
} catch (error) {
|
|
next(error);
|
|
}
|
|
}
|
|
|
|
export async function setWalletTier(req: Request, res: Response, next: NextFunction) {
|
|
try {
|
|
const { walletRefId } = req.params;
|
|
const { tier } = req.body;
|
|
// In production, map wallet to account first
|
|
const profile = await complianceService.setTier(walletRefId, tier);
|
|
res.json(profile);
|
|
} catch (error) {
|
|
next(error);
|
|
}
|
|
}
|
|
|
|
export async function setWalletJurisdictionHash(req: Request, res: Response, next: NextFunction) {
|
|
try {
|
|
const { walletRefId } = req.params;
|
|
const { jurisdictionHash } = req.body;
|
|
// In production, map wallet to account first
|
|
const profile = await complianceService.setJurisdictionHash(walletRefId, jurisdictionHash);
|
|
res.json(profile);
|
|
} catch (error) {
|
|
next(error);
|
|
}
|
|
}
|
|
|