@@ -23,7 +23,7 @@ import * as constants from '../constants.js';
23
23
24
24
import type { KeyManager } from '../key_manager.js' ;
25
25
import type { ToJSON } from '../../types/index.js' ;
26
- import type { NodeAlias , NodeAliases } from '../../types/aliases.js' ;
26
+ import type { JsonString , NodeAlias , NodeAliases } from '../../types/aliases.js' ;
27
27
28
28
/**
29
29
* Used to construct the nodes data and convert them to JSON
@@ -36,13 +36,13 @@ export class GenesisNetworkDataConstructor implements ToJSON {
36
36
private readonly keyManager : KeyManager ,
37
37
private readonly keysDir : string ,
38
38
) {
39
- this . nodeAliases . forEach ( nodeAlias => {
39
+ for ( const nodeAlias of nodeAliases ) {
40
40
const nodeId = Templates . nodeIdFromNodeAlias ( nodeAlias ) ;
41
+ const adminPrivateKey = PrivateKey . fromStringED25519 ( constants . GENESIS_KEY ) ;
42
+ const adminPubKey = adminPrivateKey . publicKey . toStringRaw ( ) ;
41
43
42
- const adminKey = PrivateKey . fromStringED25519 ( constants . GENESIS_KEY ) ;
43
-
44
- this . nodes [ nodeAlias ] = new GenesisNetworkNodeDataWrapper ( nodeId , adminKey . publicKey . toStringRaw ( ) , nodeAlias ) ;
45
- } ) ;
44
+ this . nodes [ nodeAlias ] = new GenesisNetworkNodeDataWrapper ( nodeId , adminPubKey , nodeAlias ) ;
45
+ }
46
46
}
47
47
48
48
public static async initialize (
@@ -80,7 +80,7 @@ export class GenesisNetworkDataConstructor implements ToJSON {
80
80
) ;
81
81
}
82
82
83
- public toJSON ( ) {
83
+ public toJSON ( ) : JsonString {
84
84
return JSON . stringify ( {
85
85
nodeMetadata : Object . values ( this . nodes ) . map ( node => node . toObject ( ) ) ,
86
86
} ) ;
0 commit comments