@@ -28,10 +28,11 @@ import {
2828 TokenMint ,
2929 TokenPool ,
3030 TokenPoolActivate ,
31+ TokenPoolDeactivate ,
3132 TokenTransfer ,
3233} from './tokens.interfaces' ;
3334import { TokensService } from './tokens.service' ;
34- import { RequestContext } from '../request-context/request-context.decorator' ;
35+ import { Context , RequestContext } from '../request-context/request-context.decorator' ;
3536
3637@Controller ( )
3738export class TokensController {
@@ -40,7 +41,7 @@ export class TokensController {
4041 @Post ( 'init' )
4142 @HttpCode ( 204 )
4243 @ApiOperation ( { summary : 'Perform one-time initialization (if not auto-initialized)' } )
43- async init ( @RequestContext ( ) ctx ) {
44+ async init ( @RequestContext ( ) ctx : Context ) {
4445 await this . service . init ( ctx ) ;
4546 }
4647
@@ -53,21 +54,31 @@ export class TokensController {
5354 } )
5455 @ApiBody ( { type : TokenPool } )
5556 @ApiResponse ( { status : 202 , type : AsyncResponse } )
56- createPool ( @RequestContext ( ) ctx , @Body ( ) dto : TokenPool ) {
57+ createPool ( @RequestContext ( ) ctx : Context , @Body ( ) dto : TokenPool ) {
5758 return this . service . createPool ( ctx , dto ) ;
5859 }
5960
6061 @Post ( 'activatepool' )
6162 @HttpCode ( 204 )
6263 @ApiOperation ( {
63- summary : 'Activate a token pool to begin receiving transfer events' ,
64+ summary : 'Activate a token pool to begin receiving transfer and approval events' ,
6465 description : 'Will retrigger the token-pool event for this pool as a side-effect' ,
6566 } )
6667 @ApiBody ( { type : TokenPoolActivate } )
67- async activatePool ( @RequestContext ( ) ctx , @Body ( ) dto : TokenPoolActivate ) {
68+ async activatePool ( @RequestContext ( ) ctx : Context , @Body ( ) dto : TokenPoolActivate ) {
6869 await this . service . activatePool ( ctx , dto ) ;
6970 }
7071
72+ @Post ( 'deactivatepool' )
73+ @HttpCode ( 204 )
74+ @ApiOperation ( {
75+ summary : 'Deactivate a token pool to delete all listeners and stop receiving events' ,
76+ } )
77+ @ApiBody ( { type : TokenPoolDeactivate } )
78+ async deactivatePool ( @RequestContext ( ) ctx : Context , @Body ( ) dto : TokenPoolDeactivate ) {
79+ await this . service . deactivatePool ( ctx , dto ) ;
80+ }
81+
7182 @Post ( 'mint' )
7283 @HttpCode ( 202 )
7384 @ApiOperation ( {
@@ -77,7 +88,7 @@ export class TokensController {
7788 } )
7889 @ApiBody ( { type : TokenMint } )
7990 @ApiResponse ( { status : 202 , type : AsyncResponse } )
80- mint ( @RequestContext ( ) ctx , @Body ( ) dto : TokenMint ) {
91+ mint ( @RequestContext ( ) ctx : Context , @Body ( ) dto : TokenMint ) {
8192 return this . service . mint ( ctx , dto ) ;
8293 }
8394
@@ -99,7 +110,7 @@ export class TokensController {
99110 } )
100111 @ApiBody ( { type : TokenApproval } )
101112 @ApiResponse ( { status : 202 , type : AsyncResponse } )
102- approve ( @RequestContext ( ) ctx , @Body ( ) dto : TokenApproval ) {
113+ approve ( @RequestContext ( ) ctx : Context , @Body ( ) dto : TokenApproval ) {
103114 return this . service . approval ( ctx , dto ) ;
104115 }
105116
@@ -112,7 +123,7 @@ export class TokensController {
112123 } )
113124 @ApiBody ( { type : TokenBurn } )
114125 @ApiResponse ( { status : 202 , type : AsyncResponse } )
115- burn ( @RequestContext ( ) ctx , @Body ( ) dto : TokenBurn ) {
126+ burn ( @RequestContext ( ) ctx : Context , @Body ( ) dto : TokenBurn ) {
116127 return this . service . burn ( ctx , dto ) ;
117128 }
118129
@@ -125,21 +136,21 @@ export class TokensController {
125136 } )
126137 @ApiBody ( { type : TokenTransfer } )
127138 @ApiResponse ( { status : 202 , type : AsyncResponse } )
128- transfer ( @RequestContext ( ) ctx , @Body ( ) dto : TokenTransfer ) {
139+ transfer ( @RequestContext ( ) ctx : Context , @Body ( ) dto : TokenTransfer ) {
129140 return this . service . transfer ( ctx , dto ) ;
130141 }
131142
132143 @Get ( 'balance' )
133144 @ApiOperation ( { summary : 'Retrieve a token balance' } )
134145 @ApiResponse ( { status : 200 , type : TokenBalance } )
135- balance ( @RequestContext ( ) ctx , @Query ( ) query : TokenBalanceQuery ) {
146+ balance ( @RequestContext ( ) ctx : Context , @Query ( ) query : TokenBalanceQuery ) {
136147 return this . service . balance ( ctx , query ) ;
137148 }
138149
139150 @Get ( 'receipt/:id' )
140151 @ApiOperation ( { summary : 'Retrieve the result of an async operation' } )
141152 @ApiResponse ( { status : 200 , type : EventStreamReply } )
142- getReceipt ( @RequestContext ( ) ctx , @Param ( 'id' ) id : string ) {
153+ getReceipt ( @RequestContext ( ) ctx : Context , @Param ( 'id' ) id : string ) {
143154 return this . blockchain . getReceipt ( ctx , id ) ;
144155 }
145156}
0 commit comments