@@ -42,20 +42,30 @@ export class AppController {
4242
4343 @Get ( "transaction/raw/:txId" )
4444 async getRawTransaction ( @Param ( "txId" ) txId : string ) : Promise < any > {
45- console . log ( 'getRawTransaction' )
45+ // console.log('getRawTransaction')
4646 return await this . appService . getRawTransaction ( txId , 0 ) ;
4747 }
4848
49- @Get ( "transaction/decode/:transaction " )
50- async getaRawTransaction (
51- @Param ( "transaction" ) transaction : string
49+ @Post ( "transaction/raw/decode" )
50+ async decodeRawTransaction (
51+ //@Res () response,
52+ @Body ( )
53+ message : {
54+ rawtransaction : string ;
55+ }
5256 ) : Promise < any > {
53- return await this . appService . decodeRawTransaction ( transaction ) ;
57+ //console.log(message.rawtransaction);
58+ let transaction = await this . appService . decodeRawTransaction (
59+ message . rawtransaction
60+ ) ;
61+
62+ //console.log(transaction);
63+ return transaction ;
5464 }
5565
5666 @Post ( "transaction/raw/coinstake" )
5767 async createMessage (
58- @Res ( ) response ,
68+ // @Res () response,
5969 @Body ( )
6070 message : {
6171 txid : string ;
@@ -67,21 +77,17 @@ export class AppController {
6777 minterPubkey : string ;
6878 }
6979 ) {
70- try {
71- console . log ( message ) ;
72- return await this . appService . createRawCoinstakeTransaction (
73- message . txid ,
74- Number ( message . vout ) ,
75- message . redeemScript ,
76- message . address ,
77- Number ( message . futureOutput ) ,
78- Number ( message . futureTimestamp ) ,
79- message . minterPubkey
80- ) ;
81-
82- } catch ( error ) {
83- console . warn ( error ) ;
84- return response . status ( 400 ) ;
85- }
80+ console . log ( message ) ;
81+ const response = await this . appService . createRawCoinstakeTransaction (
82+ message . txid ,
83+ Number ( message . vout ) ,
84+ message . redeemScript ,
85+ message . address ,
86+ Number ( message . futureOutput ) ,
87+ Number ( message . futureTimestamp ) ,
88+ message . minterPubkey
89+ ) ;
90+ console . log ( response ) ;
91+ return response ;
8692 }
8793}
0 commit comments