51 lines
2.1 KiB
TypeScript
51 lines
2.1 KiB
TypeScript
import { Controller, Post, Get, Body, Param } from '@nestjs/common';
|
|
import { ApiTags, ApiOperation } from '@nestjs/swagger';
|
|
import { InstitutionalWalletService } from './institutional-wallet.service';
|
|
import { MintRequest, OrderRequest, TradeRequest, TransactionRequest } from '../../common/interfaces/wallet.interfaces';
|
|
|
|
@ApiTags('institutional')
|
|
@Controller('v1/institutional')
|
|
export class InstitutionalWalletController {
|
|
constructor(private readonly wallet: InstitutionalWalletService) {}
|
|
|
|
@Post('mint')
|
|
@ApiOperation({ summary: '铸造券(发行方)' })
|
|
mintCoupons(@Body() batch: MintRequest) { return this.wallet.mintCoupons(batch); }
|
|
|
|
@Post('guarantee/deposit')
|
|
@ApiOperation({ summary: '缴纳保障资金' })
|
|
depositGuarantee(@Body() body: { amount: string }) { return this.wallet.depositGuarantee(BigInt(body.amount)); }
|
|
|
|
@Post('revenue/withdraw')
|
|
@ApiOperation({ summary: '提取销售收入' })
|
|
withdrawRevenue(@Body() body: { amount: string }) { return this.wallet.withdrawRevenue(BigInt(body.amount)); }
|
|
|
|
@Post('order/place')
|
|
@ApiOperation({ summary: '挂单(做市商)' })
|
|
placeOrder(@Body() order: OrderRequest) { return this.wallet.placeOrder(order); }
|
|
|
|
@Post('order/cancel')
|
|
@ApiOperation({ summary: '撤单' })
|
|
cancelOrder(@Body() body: { orderId: string }) { return this.wallet.cancelOrder(body.orderId); }
|
|
|
|
@Post('settle/batch')
|
|
@ApiOperation({ summary: '批量结算' })
|
|
batchSettle(@Body() body: { trades: TradeRequest[] }) { return this.wallet.batchSettle(body.trades); }
|
|
|
|
@Post('multisig/propose')
|
|
@ApiOperation({ summary: '提案(多签)' })
|
|
propose(@Body() tx: TransactionRequest) { return this.wallet.proposeTransaction(tx); }
|
|
|
|
@Post('multisig/approve')
|
|
@ApiOperation({ summary: '审批提案(多签)' })
|
|
approve(@Body() body: { proposalId: string; approver: string }) {
|
|
return this.wallet.approveTransaction(body.proposalId, body.approver);
|
|
}
|
|
|
|
@Get('multisig/status/:proposalId')
|
|
@ApiOperation({ summary: '查询审批状态' })
|
|
getApprovalStatus(@Param('proposalId') proposalId: string) {
|
|
return this.wallet.getApprovalStatus(proposalId);
|
|
}
|
|
}
|