File tree Expand file tree Collapse file tree 1 file changed +16
-2
lines changed
Expand file tree Collapse file tree 1 file changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -362,10 +362,24 @@ const executeCommand = async (
362362 } ) ;
363363 commandNetworks
364364 . command ( "getNetwork <identifier> [file://]" )
365- . description ( "get network by identifier; optionally save params to file" )
365+ . description (
366+ 'get network by id; "_" for active, optionally save params to file' ,
367+ )
366368 . action ( async ( identifier : string , file ?: string ) => {
367369 if ( ! ipfsNode ) return callback ( responses . IPFS_NOT_STARTED ) ;
368- const networkID = Network . getID ( CircuitString . fromString ( identifier ) ) ;
370+
371+ var networkID : Field ;
372+ if ( identifier === "_" ) {
373+ const nid =
374+ ( await client . query . runtime . Networks . activeNetwork . get ( ) ) as
375+ | Field
376+ | undefined ;
377+ if ( ! nid ) return callback ( responses . RECORD_NOT_FOUND ) ;
378+ networkID = nid ;
379+ } else {
380+ networkID = Network . getID ( CircuitString . fromString ( identifier ) ) ;
381+ }
382+
369383 const network = ( await client . query . runtime . Networks . networks . get (
370384 networkID ,
371385 ) ) as Network | undefined ;
You can’t perform that action at this time.
0 commit comments