@@ -304,16 +304,9 @@ const executeCommand = async (
304304 . command ( "getActive" )
305305 . description ( "get the identifier of the active network(s)" )
306306 . action ( async ( ) => {
307- const nid = ( await client . query . runtime . Networks . activeNetwork . get ( ) ) as
308- | Field
309- | undefined ;
310- if ( ! nid ) return callback ( responses . RECORD_NOT_FOUND ) ;
311-
312- // retrieve the string form of the network identifier
313- const n = await client . query . runtime . Networks . networks . get ( nid ) ;
307+ const n = await qry . processor . getActiveNetwork ( ) ;
314308 if ( ! n ) return callback ( responses . RECORD_NOT_FOUND ) ;
315-
316- callback ( { id, status : SUCCESS , data : n . identifier . toString ( ) } ) ;
309+ callback ( { id, status : SUCCESS , data : n . identifier } ) ;
317310 } ) ;
318311 commandNetworks
319312 . command ( "getNetwork <identifier> [file://]" )
@@ -323,28 +316,23 @@ const executeCommand = async (
323316 . action ( async ( identifier : string , file ?: string ) => {
324317 if ( ! ipfsNode ) return callback ( responses . IPFS_NOT_STARTED ) ;
325318
326- var networkID : Field ;
319+ var networkID : string ;
327320 if ( identifier === "_" ) {
328- const nid =
329- ( await client . query . runtime . Networks . activeNetwork . get ( ) ) as
330- | Field
331- | undefined ;
332- if ( ! nid ) return callback ( responses . RECORD_NOT_FOUND ) ;
333- networkID = nid ;
321+ const n = await qry . processor . getActiveNetwork ( ) ;
322+ if ( ! n ) return callback ( responses . RECORD_NOT_FOUND ) ;
323+ networkID = n . identifier ;
334324 } else {
335- networkID = Network . getID ( CircuitString . fromString ( identifier ) ) ;
325+ networkID = identifier ;
336326 }
337327
338- const network = ( await client . query . runtime . Networks . networks . get (
339- networkID ,
340- ) ) as Network | undefined ;
328+ const network = await qry . processor . getNetwork ( networkID ) ;
341329 if ( ! network ) return callback ( responses . RECORD_NOT_FOUND ) ;
342330
343- const cid = network . parametersCID . toString ( ) ;
331+ const cid = network . parametersCID ;
344332 const parameters = await ipfsNode . getBytes ( cid ) ;
345333 if ( file ) await putBytesToFile ( file , parameters ) ;
346334
347- const { parametersCID, ...rest } = Network . toObject ( network ) ;
335+ const { parametersCID, ...rest } = network ;
348336 const data = {
349337 parameters,
350338 ...rest ,
0 commit comments