@@ -3,6 +3,8 @@ import { ApiExcludeEndpoint } from '@nestjs/swagger';
33import { Response } from 'express' ;
44import { readFileSync } from 'fs' ;
55import { join } from 'path' ;
6+ import { UnspentUtxo } from 'src/integration/blockchain/bitcoin/bitcoin-client' ;
7+ import { BitcoinService } from 'src/integration/blockchain/bitcoin/bitcoin.service' ;
68import { EvmTokenBalanceJson } from '../dto/monitoring.dto' ;
79import { MonitoringBalanceRepository } from '../repositories/monitoring-balance.repository' ;
810import { MonitoringEvmBalanceRepository } from '../repositories/monitoring-evm-balance.repository' ;
@@ -14,6 +16,7 @@ export class MonitoringController {
1416 private readonly monitoringRepo : MonitoringRepository ,
1517 private readonly monitoringBalanceRepo : MonitoringBalanceRepository ,
1618 private readonly monitoringEvmBalanceRepo : MonitoringEvmBalanceRepository ,
19+ private readonly bitcoinService : BitcoinService ,
1720 ) { }
1821
1922 @Get ( )
@@ -44,6 +47,14 @@ export class MonitoringController {
4447 ) ;
4548 }
4649
50+ @Get ( 'btc/utxos' )
51+ @ApiExcludeEndpoint ( )
52+ async btcUtxos ( ) : Promise < { utxos : UnspentUtxo [ ] ; count : number ; totalAmount : number } > {
53+ const utxos = await this . bitcoinService . getDefaultClient ( ) . listUnspent ( ) ;
54+ const totalAmount = utxos . reduce ( ( sum , u ) => sum + u . amount , 0 ) ;
55+ return { utxos, count : utxos . length , totalAmount } ;
56+ }
57+
4758 @Get ( 'usd' )
4859 @ApiExcludeEndpoint ( )
4960 async usdPage ( @Res ( ) res : Response ) : Promise < void > {
0 commit comments