import { Body, Controller, Get, Post, UseGuards } from '@nestjs/common'; import { Throttle } from '@nestjs/throttler'; import { JwtGuard } from '../../../guards/JwtGuard'; import { throttleProfiles } from '../../../config/throttleProfiles'; import { BitcoinWalletRevealSeedDto } from '../dto/BitcoinWalletRevealSeedDto'; import { BitcoinWalletWithdrawDto } from '../dto/BitcoinWalletWithdrawDto'; import { BitcoinWalletAdminService } from '../services/BitcoinWalletAdminService'; @Controller('bitcoin-wallet') @UseGuards(JwtGuard) export class BitcoinWalletController { constructor(private readonly walletAdminService: BitcoinWalletAdminService) {} @Get('/') getStatus() { return this.walletAdminService.getStatus(); } @Post('/withdraw') @Throttle(throttleProfiles.walletWithdraw) withdraw(@Body() { destinationAddress, feeRateSatVbyte, password }: BitcoinWalletWithdrawDto) { return this.walletAdminService.withdrawAll(destinationAddress, feeRateSatVbyte, password); } @Post('/reveal-seed') @Throttle(throttleProfiles.walletRevealSeed) revealSeed(@Body() { password }: BitcoinWalletRevealSeedDto) { return this.walletAdminService.revealSeed(password); } }