strideutils 0.3.5__tar.gz → 0.3.6__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.
- {strideutils-0.3.5 → strideutils-0.3.6}/PKG-INFO +2 -4
- {strideutils-0.3.5 → strideutils-0.3.6}/pyproject.toml +2 -2
- {strideutils-0.3.5 → strideutils-0.3.6}/strideutils/stride_requests.py +58 -4
- {strideutils-0.3.5 → strideutils-0.3.6}/README.md +0 -0
- {strideutils-0.3.5 → strideutils-0.3.6}/strideutils/Makefile +0 -0
- {strideutils-0.3.5 → strideutils-0.3.6}/strideutils/__init__.py +0 -0
- {strideutils-0.3.5 → strideutils-0.3.6}/strideutils/coingecko.py +0 -0
- {strideutils-0.3.5 → strideutils-0.3.6}/strideutils/config_examples/strideutils_config.yaml.example +0 -0
- {strideutils-0.3.5 → strideutils-0.3.6}/strideutils/config_examples/strideutils_secrets.yaml.example +0 -0
- {strideutils-0.3.5 → strideutils-0.3.6}/strideutils/cryptography.py +0 -0
- {strideutils-0.3.5 → strideutils-0.3.6}/strideutils/exec_tx.py +0 -0
- {strideutils-0.3.5 → strideutils-0.3.6}/strideutils/invariant_helpers.py +0 -0
- {strideutils-0.3.5 → strideutils-0.3.6}/strideutils/run_safely.py +0 -0
- {strideutils-0.3.5 → strideutils-0.3.6}/strideutils/sheets_connector.py +0 -0
- {strideutils-0.3.5 → strideutils-0.3.6}/strideutils/slack_connector.py +0 -0
- {strideutils-0.3.5 → strideutils-0.3.6}/strideutils/stride_alerts.py +0 -0
- {strideutils-0.3.5 → strideutils-0.3.6}/strideutils/stride_config.py +0 -0
- {strideutils-0.3.5 → strideutils-0.3.6}/strideutils/stride_upstash.py +0 -0
- {strideutils-0.3.5 → strideutils-0.3.6}/strideutils/twilio_connector.py +0 -0
- {strideutils-0.3.5 → strideutils-0.3.6}/strideutils/types.py +0 -0
- {strideutils-0.3.5 → strideutils-0.3.6}/strideutils-stubs/__init__.pyi +0 -0
- {strideutils-0.3.5 → strideutils-0.3.6}/strideutils-stubs/coingecko.pyi +0 -0
- {strideutils-0.3.5 → strideutils-0.3.6}/strideutils-stubs/cryptography.pyi +0 -0
- {strideutils-0.3.5 → strideutils-0.3.6}/strideutils-stubs/exec_tx.pyi +0 -0
- {strideutils-0.3.5 → strideutils-0.3.6}/strideutils-stubs/invariant_helpers.pyi +0 -0
- {strideutils-0.3.5 → strideutils-0.3.6}/strideutils-stubs/run_safely.pyi +0 -0
- {strideutils-0.3.5 → strideutils-0.3.6}/strideutils-stubs/sheets_connector.pyi +0 -0
- {strideutils-0.3.5 → strideutils-0.3.6}/strideutils-stubs/slack_connector.pyi +0 -0
- {strideutils-0.3.5 → strideutils-0.3.6}/strideutils-stubs/stride_alerts.pyi +0 -0
- {strideutils-0.3.5 → strideutils-0.3.6}/strideutils-stubs/stride_config.pyi +0 -0
- {strideutils-0.3.5 → strideutils-0.3.6}/strideutils-stubs/stride_requests.pyi +0 -0
- {strideutils-0.3.5 → strideutils-0.3.6}/strideutils-stubs/stride_upstash.pyi +0 -0
- {strideutils-0.3.5 → strideutils-0.3.6}/strideutils-stubs/twilio_connector.pyi +0 -0
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: strideutils
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.6
|
|
4
4
|
Summary:
|
|
5
5
|
Author: Your Name
|
|
6
6
|
Author-email: you@example.com
|
|
7
|
-
Requires-Python: >=3.
|
|
7
|
+
Requires-Python: >=3.11
|
|
8
8
|
Classifier: Programming Language :: Python :: 3
|
|
9
|
-
Classifier: Programming Language :: Python :: 3.9
|
|
10
|
-
Classifier: Programming Language :: Python :: 3.10
|
|
11
9
|
Classifier: Programming Language :: Python :: 3.11
|
|
12
10
|
Classifier: Programming Language :: Python :: 3.12
|
|
13
11
|
Requires-Dist: bech32 (>=1.2.0)
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = "strideutils"
|
|
3
|
-
version = "0.3.
|
|
3
|
+
version = "0.3.6"
|
|
4
4
|
description = ""
|
|
5
5
|
authors = ["Your Name <you@example.com>"]
|
|
6
6
|
readme = "README.md"
|
|
7
7
|
include = ["strideutils", "strideutils-stubs"]
|
|
8
8
|
|
|
9
9
|
[tool.poetry.dependencies]
|
|
10
|
-
python = ">=3.
|
|
10
|
+
python = ">=3.11"
|
|
11
11
|
google-api-python-client = ">=2.100.0"
|
|
12
12
|
google-auth-httplib2 = ">=0.1.1"
|
|
13
13
|
google-auth-oauthlib = ">=1.1.0"
|
|
@@ -7,7 +7,6 @@ from functools import lru_cache
|
|
|
7
7
|
from typing import Any, Dict, List, Optional, Tuple, Union, cast
|
|
8
8
|
|
|
9
9
|
import bech32
|
|
10
|
-
import dateutil.parser
|
|
11
10
|
import pandas as pd
|
|
12
11
|
import pytz
|
|
13
12
|
import requests
|
|
@@ -327,6 +326,61 @@ def get_unbonding_records(
|
|
|
327
326
|
return host_zone_unbondings
|
|
328
327
|
|
|
329
328
|
|
|
329
|
+
def get_unbonding_queue_records(chain_id: str, block_height: int = 0) -> List[Dict[str, Any]]:
|
|
330
|
+
"""
|
|
331
|
+
Queries all the unbonding records that are ready to initiate an unbonding
|
|
332
|
+
This is identified by records in status UNBONDING_QUEUE with a non-zero unbonding amount
|
|
333
|
+
"""
|
|
334
|
+
unbonding_records = get_unbonding_records(
|
|
335
|
+
chain_id=chain_id,
|
|
336
|
+
block_height=block_height,
|
|
337
|
+
status=types.UnbondingRecordStatus.UNBONDING_QUEUE,
|
|
338
|
+
)
|
|
339
|
+
return [ur for ur in unbonding_records if int(ur["native_token_amount"]) > 0]
|
|
340
|
+
|
|
341
|
+
|
|
342
|
+
def get_unbonded_records(
|
|
343
|
+
chain_id: str,
|
|
344
|
+
block_height: int = 0,
|
|
345
|
+
filter_unbonded_last_epoch: bool = False,
|
|
346
|
+
) -> List[Dict[str, Any]]:
|
|
347
|
+
"""
|
|
348
|
+
Queries the list of all unbonding records records that have finished unbonding
|
|
349
|
+
This is identified by records in status EXIT_TRANSFER_QUEUE with an unbonding time
|
|
350
|
+
in the past
|
|
351
|
+
Optionally filter to records that just unbonded last epoch
|
|
352
|
+
"""
|
|
353
|
+
unbonding_records = get_unbonding_records(
|
|
354
|
+
chain_id=chain_id,
|
|
355
|
+
block_height=block_height,
|
|
356
|
+
status=types.UnbondingRecordStatus.EXIT_TRANSFER_QUEUE,
|
|
357
|
+
)
|
|
358
|
+
|
|
359
|
+
# If we're fetching an older block, use that block's time as the "current time"
|
|
360
|
+
current_time = int(datetime.datetime.now().timestamp() * 1e9)
|
|
361
|
+
if block_height != 0:
|
|
362
|
+
current_time = int(get_block_time(block_height).timestamp() * 1e9)
|
|
363
|
+
|
|
364
|
+
# Filter to the records that have finished unbonding, and optionally also
|
|
365
|
+
# filter to records that just finished during the last epoch
|
|
366
|
+
day = 24 * 60 * 60 * 1e9
|
|
367
|
+
filtered_unbonding_records = []
|
|
368
|
+
for unbonding_record in unbonding_records:
|
|
369
|
+
unbonding_time = int(unbonding_record["unbonding_time"])
|
|
370
|
+
|
|
371
|
+
# Ignore records that haven't finished unbonding yet
|
|
372
|
+
if unbonding_time > current_time:
|
|
373
|
+
continue
|
|
374
|
+
|
|
375
|
+
# If filtering from last epoch, ignore records that unbonded over a day ago
|
|
376
|
+
if filter_unbonded_last_epoch and (current_time - unbonding_time) > day:
|
|
377
|
+
continue
|
|
378
|
+
|
|
379
|
+
filtered_unbonding_records.append(unbonding_record)
|
|
380
|
+
|
|
381
|
+
return filtered_unbonding_records
|
|
382
|
+
|
|
383
|
+
|
|
330
384
|
def get_lsm_deposit_records(chain_id: str) -> List[Dict[str, Any]]:
|
|
331
385
|
"""
|
|
332
386
|
Queries all the LSM deposit records
|
|
@@ -630,7 +684,7 @@ def get_block_time(height: int, rpc_endpoint: str = config.stride.rpc_endpoint)
|
|
|
630
684
|
url = f"{rpc_endpoint}/block?height={height}"
|
|
631
685
|
resp = request(url)
|
|
632
686
|
block_time = resp["result"]["block"]["header"]["time"]
|
|
633
|
-
block_datetime =
|
|
687
|
+
block_datetime = datetime.datetime.fromisoformat(block_time)
|
|
634
688
|
return block_datetime
|
|
635
689
|
|
|
636
690
|
|
|
@@ -1030,7 +1084,7 @@ def get_stride_epoch_start_time() -> datetime.datetime:
|
|
|
1030
1084
|
Returns the epoch start time for the current "stride" epoch
|
|
1031
1085
|
"""
|
|
1032
1086
|
stride_epoch = get_stride_epoch()
|
|
1033
|
-
return
|
|
1087
|
+
return datetime.datetime.fromisoformat(stride_epoch["current_epoch_start_time"])
|
|
1034
1088
|
|
|
1035
1089
|
|
|
1036
1090
|
def get_day_epoch_start_time() -> datetime.datetime:
|
|
@@ -1038,7 +1092,7 @@ def get_day_epoch_start_time() -> datetime.datetime:
|
|
|
1038
1092
|
Returns the epoch start time for the current "day" epoch
|
|
1039
1093
|
"""
|
|
1040
1094
|
day_epoch = get_day_epoch()
|
|
1041
|
-
return
|
|
1095
|
+
return datetime.datetime.fromisoformat(day_epoch["current_epoch_start_time"])
|
|
1042
1096
|
|
|
1043
1097
|
|
|
1044
1098
|
def get_stride_epoch_start_height() -> int:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{strideutils-0.3.5 → strideutils-0.3.6}/strideutils/config_examples/strideutils_config.yaml.example
RENAMED
|
File without changes
|
{strideutils-0.3.5 → strideutils-0.3.6}/strideutils/config_examples/strideutils_secrets.yaml.example
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|