-
Notifications
You must be signed in to change notification settings - Fork 1
Feat/wna server #35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feat/wna server #35
Changes from all commits
902b1f6
94ee983
37786f7
cd79ed8
08b852c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,7 @@ | ||
| import { getAllInstalledSolutionsNames, runtimeStarted } from '../node-red/red'; | ||
| import { createKeyringPair } from '../polkadot/account'; | ||
| import { MAIN_CONFIG } from '../config'; | ||
| import { getOperatorInfo, type OperatorInfo } from '../util/operator-info'; | ||
|
|
||
| enum HealthStatus { | ||
| OK = 'OK', | ||
|
|
@@ -23,6 +26,13 @@ interface NodeRedHealthStatus extends ComponentHealthStatus { | |
| }; | ||
| } | ||
|
|
||
| interface SolutionGroupsDetailsStatus { | ||
| timestamp: string; | ||
| rpcUrl?: string; | ||
| workerAddress?: string; | ||
| operator?: OperatorInfo | null; | ||
| } | ||
|
|
||
| export const isLive = (): ComponentHealthStatus => { | ||
| return { | ||
| status: HealthStatus.OK, | ||
|
|
@@ -59,3 +69,26 @@ export const getNodeRedHealth = async (): Promise<NodeRedHealthStatus> => { | |
| }, | ||
| }; | ||
| }; | ||
|
|
||
| export const getSolutionGroupsDetailsStatus = async (): Promise<SolutionGroupsDetailsStatus> => { | ||
| const timestamp = new Date().toISOString(); | ||
| const rpcUrl = MAIN_CONFIG.PALLET_RPC_URL; | ||
|
|
||
| let account: ReturnType<typeof createKeyringPair>; | ||
| try { | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. app should not initialize without worker address but it's ok. I don't see a point to assign rpcUrl in both places, why not just
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| account = createKeyringPair(); | ||
| } catch { | ||
| // No worker identity (e.g. config not ready); return config only | ||
| return { timestamp, rpcUrl }; | ||
| } | ||
|
|
||
| const workerAddress = account.address; | ||
| const operatorInfo = await getOperatorInfo(); | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This logic does not make sense to me, first there is a try-catch that I assume checks if worker address is present and then you fetch operator info based on worker address without any additional checks? Please clean up this logic as it's confusing
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. updated check top logic |
||
|
|
||
| return { | ||
| timestamp, | ||
| rpcUrl, | ||
| workerAddress, | ||
| operator: operatorInfo, | ||
| }; | ||
| }; | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
check here