strideutils 0.8.0__tar.gz → 0.8.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. {strideutils-0.8.0 → strideutils-0.8.2}/.bumpversion.cfg +1 -1
  2. {strideutils-0.8.0 → strideutils-0.8.2}/PKG-INFO +1 -1
  3. {strideutils-0.8.0 → strideutils-0.8.2}/pyproject.toml +1 -1
  4. {strideutils-0.8.0 → strideutils-0.8.2}/strideutils/stride_config.py +27 -13
  5. {strideutils-0.8.0 → strideutils-0.8.2}/strideutils/stride_config.pyi +8 -3
  6. {strideutils-0.8.0 → strideutils-0.8.2}/strideutils/stride_requests.py +1 -1
  7. {strideutils-0.8.0 → strideutils-0.8.2}/strideutils-stubs/stride_config.pyi +8 -3
  8. {strideutils-0.8.0 → strideutils-0.8.2}/strideutils.egg-info/PKG-INFO +1 -1
  9. {strideutils-0.8.0 → strideutils-0.8.2}/tests/test_config.py +6 -6
  10. {strideutils-0.8.0 → strideutils-0.8.2}/.github/workflows/lint.yml +0 -0
  11. {strideutils-0.8.0 → strideutils-0.8.2}/.github/workflows/publish.yml +0 -0
  12. {strideutils-0.8.0 → strideutils-0.8.2}/.github/workflows/test.yml +0 -0
  13. {strideutils-0.8.0 → strideutils-0.8.2}/.github/workflows/version.yaml +0 -0
  14. {strideutils-0.8.0 → strideutils-0.8.2}/.gitignore +0 -0
  15. {strideutils-0.8.0 → strideutils-0.8.2}/LICENSE +0 -0
  16. {strideutils-0.8.0 → strideutils-0.8.2}/MANIFEST.in +0 -0
  17. {strideutils-0.8.0 → strideutils-0.8.2}/Makefile +0 -0
  18. {strideutils-0.8.0 → strideutils-0.8.2}/README.md +0 -0
  19. {strideutils-0.8.0 → strideutils-0.8.2}/example-config.yaml +0 -0
  20. {strideutils-0.8.0 → strideutils-0.8.2}/setup.cfg +0 -0
  21. {strideutils-0.8.0 → strideutils-0.8.2}/strideutils/Makefile +0 -0
  22. {strideutils-0.8.0 → strideutils-0.8.2}/strideutils/__init__.py +0 -0
  23. {strideutils-0.8.0 → strideutils-0.8.2}/strideutils/__init__.pyi +0 -0
  24. {strideutils-0.8.0 → strideutils-0.8.2}/strideutils/coingecko.py +0 -0
  25. {strideutils-0.8.0 → strideutils-0.8.2}/strideutils/coingecko.pyi +0 -0
  26. {strideutils-0.8.0 → strideutils-0.8.2}/strideutils/config_examples/env.local.example +0 -0
  27. {strideutils-0.8.0 → strideutils-0.8.2}/strideutils/config_examples/strideutils_config.yaml.example +0 -0
  28. {strideutils-0.8.0 → strideutils-0.8.2}/strideutils/cryptography.py +0 -0
  29. {strideutils-0.8.0 → strideutils-0.8.2}/strideutils/cryptography.pyi +0 -0
  30. {strideutils-0.8.0 → strideutils-0.8.2}/strideutils/exec_tx.py +0 -0
  31. {strideutils-0.8.0 → strideutils-0.8.2}/strideutils/exec_tx.pyi +0 -0
  32. {strideutils-0.8.0 → strideutils-0.8.2}/strideutils/py.typed +0 -0
  33. {strideutils-0.8.0 → strideutils-0.8.2}/strideutils/redis_connector.py +0 -0
  34. {strideutils-0.8.0 → strideutils-0.8.2}/strideutils/redis_connector.pyi +0 -0
  35. {strideutils-0.8.0 → strideutils-0.8.2}/strideutils/run_safely.py +0 -0
  36. {strideutils-0.8.0 → strideutils-0.8.2}/strideutils/run_safely.pyi +0 -0
  37. {strideutils-0.8.0 → strideutils-0.8.2}/strideutils/sheets_connector.py +0 -0
  38. {strideutils-0.8.0 → strideutils-0.8.2}/strideutils/sheets_connector.pyi +0 -0
  39. {strideutils-0.8.0 → strideutils-0.8.2}/strideutils/slack_connector.py +0 -0
  40. {strideutils-0.8.0 → strideutils-0.8.2}/strideutils/slack_connector.pyi +0 -0
  41. {strideutils-0.8.0 → strideutils-0.8.2}/strideutils/stride_alerts.py +0 -0
  42. {strideutils-0.8.0 → strideutils-0.8.2}/strideutils/stride_alerts.pyi +0 -0
  43. {strideutils-0.8.0 → strideutils-0.8.2}/strideutils/stride_requests.pyi +0 -0
  44. {strideutils-0.8.0 → strideutils-0.8.2}/strideutils/twilio_connector.py +0 -0
  45. {strideutils-0.8.0 → strideutils-0.8.2}/strideutils/twilio_connector.pyi +0 -0
  46. {strideutils-0.8.0 → strideutils-0.8.2}/strideutils/types.py +0 -0
  47. {strideutils-0.8.0 → strideutils-0.8.2}/strideutils/types.pyi +0 -0
  48. {strideutils-0.8.0 → strideutils-0.8.2}/strideutils-stubs/__init__.pyi +0 -0
  49. {strideutils-0.8.0 → strideutils-0.8.2}/strideutils-stubs/coingecko.pyi +0 -0
  50. {strideutils-0.8.0 → strideutils-0.8.2}/strideutils-stubs/cryptography.pyi +0 -0
  51. {strideutils-0.8.0 → strideutils-0.8.2}/strideutils-stubs/exec_tx.pyi +0 -0
  52. {strideutils-0.8.0 → strideutils-0.8.2}/strideutils-stubs/redis_connector.pyi +0 -0
  53. {strideutils-0.8.0 → strideutils-0.8.2}/strideutils-stubs/run_safely.pyi +0 -0
  54. {strideutils-0.8.0 → strideutils-0.8.2}/strideutils-stubs/sheets_connector.pyi +0 -0
  55. {strideutils-0.8.0 → strideutils-0.8.2}/strideutils-stubs/slack_connector.pyi +0 -0
  56. {strideutils-0.8.0 → strideutils-0.8.2}/strideutils-stubs/stride_alerts.pyi +0 -0
  57. {strideutils-0.8.0 → strideutils-0.8.2}/strideutils-stubs/stride_requests.pyi +0 -0
  58. {strideutils-0.8.0 → strideutils-0.8.2}/strideutils-stubs/twilio_connector.pyi +0 -0
  59. {strideutils-0.8.0 → strideutils-0.8.2}/strideutils-stubs/types.pyi +0 -0
  60. {strideutils-0.8.0 → strideutils-0.8.2}/strideutils.egg-info/SOURCES.txt +0 -0
  61. {strideutils-0.8.0 → strideutils-0.8.2}/strideutils.egg-info/dependency_links.txt +0 -0
  62. {strideutils-0.8.0 → strideutils-0.8.2}/strideutils.egg-info/requires.txt +0 -0
  63. {strideutils-0.8.0 → strideutils-0.8.2}/strideutils.egg-info/top_level.txt +0 -0
  64. {strideutils-0.8.0 → strideutils-0.8.2}/tests/test_coingecko.py +0 -0
  65. {strideutils-0.8.0 → strideutils-0.8.2}/tests/test_encryption.py +0 -0
  66. {strideutils-0.8.0 → strideutils-0.8.2}/tests/test_redis_connector.py +0 -0
  67. {strideutils-0.8.0 → strideutils-0.8.2}/tests/test_sheets_connector.py +0 -0
  68. {strideutils-0.8.0 → strideutils-0.8.2}/tests/test_slack_connector.py +0 -0
  69. {strideutils-0.8.0 → strideutils-0.8.2}/tests/test_stride_requests.py +0 -0
  70. {strideutils-0.8.0 → strideutils-0.8.2}/tests/test_twilio_connector.py +0 -0
@@ -1,5 +1,5 @@
1
1
  [bumpversion]
2
- current_version = 0.8.0
2
+ current_version = 0.8.2
3
3
  commit = False
4
4
  tag = False
5
5
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: strideutils
3
- Version: 0.8.0
3
+ Version: 0.8.2
4
4
  Summary: Utility functions for monitoring the Stride blockchain
5
5
  Author-email: Stride Labs <hello@stridelabs.co>
6
6
  License: MIT License
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "strideutils"
7
- version = "0.8.0"
7
+ version = "0.8.2"
8
8
  authors = [
9
9
  {name = "Stride Labs", email = "hello@stridelabs.co"},
10
10
  ]
@@ -19,7 +19,7 @@ if ENV not in ["DEV", "PROD"]:
19
19
 
20
20
  def get_redis_password_env_var(db_name: str) -> str:
21
21
  """Generate the environment variable name for a Redis database password"""
22
- return f"REDIS_STRIDE_{db_name.upper()}_PASSWORD"
22
+ return f"REDIS_{db_name.upper()}_PASSWORD"
23
23
 
24
24
 
25
25
  @dataclass(frozen=True)
@@ -176,12 +176,28 @@ class Config(ConfigObj):
176
176
 
177
177
  # Chain configs
178
178
  stride: StrideChainConfig = field(default_factory=StrideChainConfig)
179
- host_zones: Dict[str, HostChainConfig] = field(default_factory=dict)
180
- app_chains: Dict[str, ChainConfig] = field(default_factory=dict)
179
+ _host_zones: Dict[str, HostChainConfig] = field(default_factory=dict)
180
+ _app_chains: Dict[str, ChainConfig] = field(default_factory=dict)
181
+
182
+ @property
183
+ def host_zones(self) -> List[HostChainConfig]:
184
+ return [host_zone for host_zone in self._host_zones.values()]
181
185
 
182
186
  @property
183
187
  def stakeibc_host_zones(self) -> List[HostChainConfig]:
184
- return [host_zone for host_zone in self.host_zones.values() if host_zone.ica_enabled]
188
+ return [host_zone for host_zone in self._host_zones.values() if host_zone.ica_enabled]
189
+
190
+ @property
191
+ def app_chains(self) -> List[ChainConfig]:
192
+ return [app_chain for app_chain in self._app_chains.values()]
193
+
194
+ @property
195
+ def host_zone_names(self) -> List[str]:
196
+ return [host_zone for host_zone in self._host_zones.keys()]
197
+
198
+ @property
199
+ def app_chain_names(self) -> List[str]:
200
+ return [app_chain for app_chain in self._app_chains.keys()]
185
201
 
186
202
  def _create_mappings(self) -> None:
187
203
  """
@@ -194,7 +210,7 @@ class Config(ConfigObj):
194
210
  denom_on_stride_to_zone = ConfigDict()
195
211
 
196
212
  # Map host zones and app chains.
197
- for chain_info in itertools.chain(self.host_zones.values(), self.app_chains.values()):
213
+ for chain_info in itertools.chain(self._host_zones.values(), self._app_chains.values()):
198
214
  try:
199
215
  name_to_zone[chain_info.name] = chain_info
200
216
  except AttributeError:
@@ -301,10 +317,6 @@ class Config(ConfigObj):
301
317
  raise TypeError(f"Chain {chain_config.name} is not a host zone")
302
318
  return chain_config
303
319
 
304
- def __iter__(self):
305
- """Allow iterating over host zones"""
306
- return iter(self.host_zones.values())
307
-
308
320
 
309
321
  def _load_raw_config() -> dict[str, Any]:
310
322
  """
@@ -347,17 +359,19 @@ def _parse_raw_configs(raw_config: dict[str, Any], raw_secrets: dict[str, Option
347
359
  app_chain_fields = [field.name for field in fields(cast(Any, ChainConfig))]
348
360
  redis_config_fields = [field.name for field in fields(cast(Any, RedisConfig))]
349
361
 
350
- # Parse Host Chain configs
362
+ # Parse Host Chain configs into new dict (instead of dict from raw_config)
351
363
  host_chain_config = {}
352
364
  for name, info in raw_config["host_zones"].items():
353
365
  filtered_info = {key: value for key, value in info.items() if key in host_chain_fields}
354
366
  host_chain_config[name] = HostChainConfig(**filtered_info)
367
+ del raw_config["host_zones"]
355
368
 
356
- # Parse App Chain configs
369
+ # Parse App Chain configs into new dict (instead of dict from raw_config)
357
370
  app_chain_config = {}
358
371
  for name, info in raw_config["app_chains"].items():
359
372
  filtered_info = {key: value for key, value in info.items() if key in app_chain_fields}
360
373
  app_chain_config[name] = ChainConfig(**filtered_info)
374
+ del raw_config["app_chains"]
361
375
 
362
376
  # Parse Stride chain config
363
377
  stride_chain_config = StrideChainConfig(**raw_config["stride"])
@@ -370,8 +384,8 @@ def _parse_raw_configs(raw_config: dict[str, Any], raw_secrets: dict[str, Option
370
384
 
371
385
  chain_configs = {
372
386
  "stride": stride_chain_config,
373
- "host_zones": host_chain_config,
374
- "app_chains": app_chain_config,
387
+ "_host_zones": host_chain_config,
388
+ "_app_chains": app_chain_config,
375
389
  "redis": redis_configs,
376
390
  }
377
391
 
@@ -73,13 +73,18 @@ class Config(ConfigObj):
73
73
  alerts_playbook: str = ...
74
74
  slack_channels: ConfigDict = ...
75
75
  stride: StrideChainConfig = ...
76
- host_zones: dict[str, HostChainConfig] = ...
77
- app_chains: dict[str, ChainConfig] = ...
76
+ @property
77
+ def host_zones(self) -> list[HostChainConfig]: ...
78
78
  @property
79
79
  def stakeibc_host_zones(self) -> list[HostChainConfig]: ...
80
+ @property
81
+ def app_chains(self) -> list[ChainConfig]: ...
82
+ @property
83
+ def host_zone_names(self) -> list[str]: ...
84
+ @property
85
+ def app_chain_names(self) -> list[str]: ...
80
86
  def __post_init__(self) -> None: ...
81
87
  def get_chain(self, name: str | None = None, id: str | None = None, ticker: str | None = None, denom: str | None = None, denom_on_stride: str | None = None) -> ChainConfig | StrideChainConfig | HostChainConfig: ...
82
88
  def get_host_chain(self, name: str | None = None, id: str | None = None, ticker: str | None = None, denom: str | None = None, denom_on_stride: str | None = None) -> HostChainConfig: ...
83
- def __iter__(self): ...
84
89
 
85
90
  config: Config
@@ -815,7 +815,7 @@ def get_icns_name(address: str) -> str:
815
815
  if "osmosis" not in config.host_zones:
816
816
  raise KeyError("Osmosis host zone configuration not found")
817
817
 
818
- osmosis_config = config.host_zones["osmosis"]
818
+ osmosis_config = config.get_host_chain("osmosis")
819
819
  contract_address = "osmo1xk0s8xgktn9x5vwcgtjdxqzadg88fgn33p8u9cnpdxwemvxscvast52cdd"
820
820
  query_msg = {"primary_name": {"address": address}}
821
821
 
@@ -72,10 +72,16 @@ class Config(ConfigObj):
72
72
  alerts_playbook: str = ...
73
73
  slack_channels: ConfigDict = ...
74
74
  stride: StrideChainConfig = ...
75
- host_zones: dict[str, HostChainConfig] = ...
76
- app_chains: dict[str, ChainConfig] = ...
75
+ @property
76
+ def host_zones(self) -> list[HostChainConfig]: ...
77
77
  @property
78
78
  def stakeibc_host_zones(self) -> list[HostChainConfig]: ...
79
+ @property
80
+ def app_chains(self) -> list[ChainConfig]: ...
81
+ @property
82
+ def host_zone_names(self) -> list[str]: ...
83
+ @property
84
+ def app_chain_names(self) -> list[str]: ...
79
85
  def __post_init__(self) -> None: ...
80
86
  def get_chain(
81
87
  self,
@@ -93,6 +99,5 @@ class Config(ConfigObj):
93
99
  denom: str | None = None,
94
100
  denom_on_stride: str | None = None,
95
101
  ) -> HostChainConfig: ...
96
- def __iter__(self): ...
97
102
 
98
103
  config: Config
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: strideutils
3
- Version: 0.8.0
3
+ Version: 0.8.2
4
4
  Summary: Utility functions for monitoring the Stride blockchain
5
5
  Author-email: Stride Labs <hello@stridelabs.co>
6
6
  License: MIT License
@@ -127,8 +127,8 @@ class TestParseConfig:
127
127
 
128
128
  # Validate all chains are set
129
129
  assert config.stride.name == "stride"
130
- assert set(config.host_zones.keys()) == set(self.host_chain_names)
131
- assert set(config.app_chains.keys()) == set(self.app_chain_names)
130
+ assert set(config.host_zone_names) == set(self.host_chain_names)
131
+ assert set(config.app_chain_names) == set(self.app_chain_names)
132
132
 
133
133
  # Validate Redis configuration
134
134
  assert isinstance(config.redis, dict)
@@ -139,8 +139,8 @@ class TestParseConfig:
139
139
  assert config.redis["public"].ssl is False # Verify SSL setting
140
140
 
141
141
  # Test iteration over host_zones
142
- assert len(list(config.host_zones.values())) == len(self.host_chain_names)
143
- assert all(isinstance(zone, HostChainConfig) for zone in config.host_zones.values())
142
+ assert len(list(config.host_zones)) == len(self.host_chain_names)
143
+ assert all(isinstance(zone, HostChainConfig) for zone in config.host_zones)
144
144
 
145
145
  def test_parse_config_missing_stride(self) -> None:
146
146
  """Test that parsing fails when stride config is missing"""
@@ -159,7 +159,7 @@ class TestParseConfig:
159
159
  raw_config["host_zones"]["cosmoshub"] = {"name": "cosmoshub", "id": "cosmoshub-1", "new_field": "value1"}
160
160
 
161
161
  config = _parse_raw_configs(raw_config, self.raw_secrets)
162
- host_chain = config.host_zones["cosmoshub"]
162
+ host_chain = config.get_host_chain(name="cosmoshub")
163
163
 
164
164
  assert isinstance(host_chain, HostChainConfig)
165
165
  assert host_chain.name == "cosmoshub"
@@ -178,7 +178,7 @@ class TestParseConfig:
178
178
  raw_config["app_chains"]["neutron"] = {"name": "neutron", "id": "neutron-1", "new_field": "value1"}
179
179
 
180
180
  config = _parse_raw_configs(raw_config, self.raw_secrets)
181
- app_chain = config.app_chains["neutron"]
181
+ app_chain = config.get_chain(name="neutron")
182
182
 
183
183
  assert isinstance(app_chain, ChainConfig)
184
184
  assert app_chain.name == "neutron"
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes