add project
This commit is contained in:
20
apps/api/src/controllers/wallet.controller.ts
Normal file
20
apps/api/src/controllers/wallet.controller.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
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 });
|
||||
}
|
||||
},
|
||||
};
|
||||
Reference in New Issue
Block a user