Files
cryptowallet/apps/api/src/controllers/wallet.controller.ts
ZOMBIIIIIII 89cb6174b7 new version
2026-04-14 20:22:51 +03:00

21 lines
573 B
TypeScript

import { Request, Response } from 'express';
import { WalletModel } from '../models/wallet.model';
export const WalletController = {
async getWallets(req: Request, res: Response) {
try {
const wallets = await WalletModel.findByUserId(req.auth!.userId);
res.json({
success: true,
data: wallets.map((w) => ({
chain: w.chain,
address: w.address,
derivationPath: w.derivation_path,
})),
});
} catch (err: any) {
res.status(500).json({ success: false, error: err.message });
}
},
};