21 lines
573 B
TypeScript
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 });
|
|
}
|
|
},
|
|
};
|