Initial project setup: Add contracts, API definitions, tests, and documentation

- 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
This commit is contained in:
defiQUG
2025-12-12 10:59:41 -08:00
parent 26b5aaf932
commit 651ff4f7eb
281 changed files with 24813 additions and 2 deletions

View File

@@ -0,0 +1,22 @@
{
"name": "@emoney/mapping-service",
"version": "1.0.0",
"description": "Account-Wallet mapping service",
"main": "dist/index.js",
"scripts": {
"build": "tsc",
"start": "node dist/index.js",
"dev": "ts-node-dev --respawn --transpile-only src/index.ts"
},
"dependencies": {
"express": "^4.18.2",
"@emoney/blockchain": "workspace:*"
},
"devDependencies": {
"@types/express": "^4.17.21",
"@types/node": "^20.10.0",
"typescript": "^5.3.0",
"ts-node-dev": "^2.0.0"
}
}

View File

@@ -0,0 +1,22 @@
/**
* Mapping Service
* Manages account-wallet mappings and provider integrations
*/
import express from 'express';
import { mappingRouter } from './routes/mappings';
const app = express();
const PORT = process.env.PORT || 3004;
app.use(express.json());
// Mapping API routes
app.use('/v1/mappings', mappingRouter);
app.listen(PORT, () => {
console.log(`Mapping service listening on port ${PORT}`);
});
export default app;

View File

@@ -0,0 +1,47 @@
/**
* Mapping routes
*/
import { Router, Request, Response } from 'express';
import { mappingService } from '../services/mapping-service';
export const mappingRouter = Router();
mappingRouter.post('/account-wallet/link', async (req: Request, res: Response) => {
try {
const { accountRefId, walletRefId } = req.body;
const mapping = await mappingService.linkAccountWallet(accountRefId, walletRefId);
res.status(201).json(mapping);
} catch (error: any) {
res.status(400).json({ error: error.message });
}
});
mappingRouter.post('/account-wallet/unlink', async (req: Request, res: Response) => {
try {
const { accountRefId, walletRefId } = req.body;
await mappingService.unlinkAccountWallet(accountRefId, walletRefId);
res.json({ unlinked: true });
} catch (error: any) {
res.status(400).json({ error: error.message });
}
});
mappingRouter.get('/accounts/:accountRefId/wallets', async (req: Request, res: Response) => {
try {
const wallets = await mappingService.getAccountWallets(req.params.accountRefId);
res.json({ accountRefId: req.params.accountRefId, wallets });
} catch (error: any) {
res.status(404).json({ error: error.message });
}
});
mappingRouter.get('/wallets/:walletRefId/accounts', async (req: Request, res: Response) => {
try {
const accounts = await mappingService.getWalletAccounts(req.params.walletRefId);
res.json({ walletRefId: req.params.walletRefId, accounts });
} catch (error: any) {
res.status(404).json({ error: error.message });
}
});

View File

@@ -0,0 +1,55 @@
/**
* Mapping service - manages account-wallet links
*/
export interface AccountWalletMapping {
accountRefId: string;
walletRefId: string;
provider: string;
linked: boolean;
createdAt: string;
}
export const mappingService = {
/**
* Link account to wallet
*/
async linkAccountWallet(accountRefId: string, walletRefId: string): Promise<AccountWalletMapping> {
// TODO: Create mapping in database
// TODO: Validate account and wallet exist
throw new Error('Not implemented');
},
/**
* Unlink account from wallet
*/
async unlinkAccountWallet(accountRefId: string, walletRefId: string): Promise<void> {
// TODO: Remove mapping from database
throw new Error('Not implemented');
},
/**
* Get wallets for account
*/
async getAccountWallets(accountRefId: string): Promise<string[]> {
// TODO: Query database for linked wallets
throw new Error('Not implemented');
},
/**
* Get accounts for wallet
*/
async getWalletAccounts(walletRefId: string): Promise<string[]> {
// TODO: Query database for linked accounts
throw new Error('Not implemented');
},
/**
* Connect wallet provider (WalletConnect, Fireblocks, etc.)
*/
async connectProvider(provider: string, config: any): Promise<void> {
// TODO: Initialize provider SDK
throw new Error('Not implemented');
},
};

View File

@@ -0,0 +1,18 @@
{
"compilerOptions": {
"target": "ES2020",
"module": "commonjs",
"lib": ["ES2020"],
"outDir": "./dist",
"rootDir": "./src",
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"resolveJsonModule": true,
"declaration": true
},
"include": ["src/**/*"],
"exclude": ["node_modules", "dist"]
}