@@ -14,7 +14,7 @@ import { transactionManagement } from '../../packages/routing-interface/routes/i
14
14
import { verifierFactory } from '../../packages/routing-interface/routes/index' ;
15
15
import { BusinessLogicBase } from '../../packages/business-logic-plugin/BusinessLogicBase' ;
16
16
//import { makeRawTransaction } from './TransactionEthereum'
17
- // import { LedgerEvent } from '../../packages/ledger-plugin/LedgerPlugin';
17
+ import { LedgerEvent } from '../../packages/ledger-plugin/LedgerPlugin' ;
18
18
import { json2str } from '../../packages/ledger-plugin/DriverCommon'
19
19
20
20
const fs = require ( 'fs' ) ;
@@ -65,12 +65,16 @@ export class BusinessLogicRunTransaction extends BusinessLogicBase {
65
65
logger . debug ( "called execTransaction()" ) ;
66
66
67
67
const useValidator = JSON . parse ( transactionManagement . getValidatorToUse ( tradeInfo . businessLogicID ) ) ;
68
+
68
69
// TODO: Temporarily specify no monitoring required (# 3rd parameter = false)
69
70
const verifier = verifierFactory . getVerifier ( useValidator [ 'validatorID' ] [ 0 ] , { } , false ) ;
70
71
logger . debug ( "getVerifier" ) ;
71
72
73
+ // TODO: for Temporarily specify no monitoring required (# 3rd parameter = false)
74
+ verifier . setEventListener ( transactionManagement ) ;
75
+
72
76
const contract = { } ;
73
- const method = { command : "run-transaction" } ;
77
+ const method = { command : "test- run-transaction" } ;
74
78
const args = { "args" : {
75
79
"keychainId" : requestInfo . keychainId ,
76
80
"keychainRef" : requestInfo . keychainRef ,
@@ -80,8 +84,43 @@ export class BusinessLogicRunTransaction extends BusinessLogicBase {
80
84
"functionArgs" : requestInfo . functionArgs
81
85
} } ;
82
86
87
+ logger . debug ( `##before call verifier.requestLedgerOperationHttp()` ) ;
83
88
verifier . requestLedgerOperationHttp ( contract , method , args ) ;
89
+ logger . debug ( `##after call verifier.requestLedgerOperationHttp()` ) ;
90
+
91
+ }
92
+
93
+
94
+ onEvent ( ledgerEvent : LedgerEvent , targetIndex : number ) : void {
95
+ logger . debug ( `##in BLP:onEvent()` ) ;
96
+ logger . debug ( `##onEvent(): ${ json2str ( ledgerEvent ) } ` ) ;
97
+ }
98
+
99
+
100
+ getEventDataNum ( ledgerEvent : LedgerEvent ) : number {
101
+ // NOTE: This method implements the BisinessLogcPlugin operation(* Override by subclass)
102
+ // TODO:
103
+ logger . debug ( `##in getEventDataNum(), ledgerEvent: ${ JSON . stringify ( ledgerEvent ) } ` ) ;
104
+ const retEventNum = ledgerEvent . data [ 'blockData' ] . length ;
105
+ logger . debug ( `##retEventNum: ${ retEventNum } ` ) ;
106
+ return retEventNum ;
107
+ }
108
+
109
+
110
+ getTxIDFromEvent ( ledgerEvent : LedgerEvent , targetIndex : number ) : string | null {
111
+ // NOTE: This method implements the BisinessLogcPlugin operation(* Override by subclass)
112
+ // TODO:
113
+ logger . debug ( `##in getTxIDFromEvent(), ledgerEvent: ${ JSON . stringify ( ledgerEvent ) } ` ) ;
114
+
115
+ const txId = ledgerEvent . data [ 'txId' ] ;
116
+
117
+ if ( typeof txId !== 'string' ) {
118
+ logger . warn ( `#getTxIDFromEvent(): skip(invalid block, not found txId.), event: ${ json2str ( ledgerEvent ) } ` ) ;
119
+ return null ;
120
+ }
84
121
122
+ logger . debug ( `###getTxIDFromEvent(): txId: ${ txId } ` ) ;
123
+ return txId ;
85
124
}
86
125
87
126
0 commit comments