@@ -48,6 +48,11 @@ function rpc(PORT, client, transactionHandler, stateDB, blockDB) {
4848
4949 break ;
5050
51+ case "mining" :
52+ respond ( { mining : client . mining } ) ;
53+
54+ break ;
55+
5156 default :
5257 throwError ( "Invalid option." , 404 ) ;
5358 }
@@ -158,7 +163,7 @@ function rpc(PORT, client, transactionHandler, stateDB, blockDB) {
158163 throwError ( "Invalid request." , 400 ) ;
159164 } else {
160165 const dataFromTarget = await stateDB . get ( req . body . params . address ) ; // Fetch target's state object
161- const targetBalance = dataFromTarget . balance ; // Get target's balance
166+ const targetBalance = dataFromTarget . balance ; // Get target's balance
162167
163168 respond ( { balance : targetBalance } ) ;
164169 }
@@ -169,18 +174,34 @@ function rpc(PORT, client, transactionHandler, stateDB, blockDB) {
169174 if (
170175 typeof req . body . params !== "object" ||
171176 typeof req . body . params . address !== "string" ||
172- ! ( await stateDB . keys ( ) . all ( ) ) . includes ( tx . sender )
177+ ! ( await stateDB . keys ( ) . all ( ) ) . includes ( req . body . params . address )
173178 ) {
174179 throwError ( "Invalid request." , 400 ) ;
175180 } else {
176- const dataFromTarget = await stateDB . get ( tx . sender ) ; // Fetch target's state object
177- const targetBody = dataFromTarget . body ; // Get target's code body
181+ const dataFromTarget = await stateDB . get ( req . body . params . address ) ; // Fetch target's state object
182+ const targetBody = dataFromTarget . body ; // Get target's code body
178183
179184 respond ( { code : targetBody } ) ;
180185 }
181186
182187 break ;
183188
189+ case "get_storage" :
190+ if (
191+ typeof req . body . params !== "object" ||
192+ typeof req . body . params . address !== "string" ||
193+ ! ( await stateDB . keys ( ) . all ( ) ) . includes ( req . body . params . address )
194+ ) {
195+ throwError ( "Invalid request." , 400 ) ;
196+ } else {
197+ const dataFromTarget = await stateDB . get ( req . body . params . address ) ; // Fetch target's state object
198+ const targetStorage = dataFromTarget . body ; // Get target's storage object
199+
200+ respond ( { storage : targetStorage } ) ;
201+ }
202+
203+ break ;
204+
184205 case "get_transactionByBlockNumberAndIndex" :
185206 if (
186207 typeof req . body . params !== "object" ||
0 commit comments