Skip to content
Snippets Groups Projects
Commit 6a858073 authored by Krzysztof Mochocki's avatar Krzysztof Mochocki Committed by Mateusz Żebrak
Browse files

Dynamic global properties are stored in app state

parent 48493602
No related branches found
No related tags found
3 merge requests!186V1.27.5.0 release,!174RELEASE: 1,!102Redesign header
...@@ -3,6 +3,8 @@ from __future__ import annotations ...@@ -3,6 +3,8 @@ from __future__ import annotations
from dataclasses import dataclass from dataclasses import dataclass
from typing import TYPE_CHECKING from typing import TYPE_CHECKING
from clive.__private.core.commands.update_node_data import DynamicGlobalPropertiesT # noqa: TCH001
if TYPE_CHECKING: if TYPE_CHECKING:
from clive.__private.core.world import World from clive.__private.core.world import World
...@@ -12,6 +14,13 @@ class AppState: ...@@ -12,6 +14,13 @@ class AppState:
"""A class that holds information about the current state of an application.""" """A class that holds information about the current state of an application."""
world: World world: World
_dynamic_global_properties: DynamicGlobalPropertiesT | None = None
def get_dynamic_global_properties(self) -> DynamicGlobalPropertiesT:
if self._dynamic_global_properties is None:
self.world.commands.update_node_data(accounts=[])
assert self._dynamic_global_properties is not None
return self._dynamic_global_properties
def is_active(self) -> bool: def is_active(self) -> bool:
wallets = self.world.beekeeper.api.list_wallets().wallets wallets = self.world.beekeeper.api.list_wallets().wallets
......
...@@ -95,4 +95,6 @@ class Commands: ...@@ -95,4 +95,6 @@ class Commands:
).execute() ).execute()
def update_node_data(self, *, accounts: list[Account]) -> None: def update_node_data(self, *, accounts: list[Account]) -> None:
UpdateNodeData(accounts=accounts, node=self.__world.node).execute() self.__world.app_state._dynamic_global_properties = UpdateNodeData(
accounts=accounts, node=self.__world.node
).execute_with_result()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment