@@ -9,17 +9,19 @@ export type IRealmNameComponent = IBaseComponent & {
9
9
}
10
10
11
11
export async function createRealmNameComponent (
12
- components : Pick < BaseComponents , 'fetch' | 'config' | 'provider' >
12
+ components : Pick < BaseComponents , 'fetch' | 'config' | 'provider' | 'logs' >
13
13
) : Promise < IRealmNameComponent > {
14
- const { config, fetch, provider } = components
14
+ const { config, fetch, provider, logs } = components
15
15
16
- async function resolveRealmName ( { address } : CatalystServerInfo ) : Promise < string | undefined > {
17
- const response = await fetch . fetch ( `${ address } /about` )
18
- if ( ! response . ok ) {
19
- return undefined
20
- }
16
+ const logger = logs . getLogger ( 'realm-name' )
21
17
18
+ async function resolveRealmName ( { address } : CatalystServerInfo ) : Promise < string | undefined > {
22
19
try {
20
+ const response = await fetch . fetch ( `${ address } /about` )
21
+ if ( ! response . ok ) {
22
+ return undefined
23
+ }
24
+
23
25
const data : About = await response . json ( )
24
26
return data . configurations . realmName
25
27
} catch ( err ) {
@@ -42,6 +44,7 @@ export async function createRealmNameComponent(
42
44
const servers = await getCatalystServersFromDAO ( network as any , provider )
43
45
const names = new Set ( await Promise . all ( servers . map ( resolveRealmName ) ) )
44
46
47
+ logger . log ( `Realm names found: ${ JSON . stringify ( Array . from ( names ) ) } ` )
45
48
if ( ! names . has ( realmName ) ) {
46
49
validatedRealmName = realmName
47
50
return realmName
0 commit comments