strideutils 0.4.2__tar.gz → 0.4.4__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.4.2 → strideutils-0.4.4}/PKG-INFO +1 -1
- {strideutils-0.4.2 → strideutils-0.4.4}/pyproject.toml +1 -1
- {strideutils-0.4.2 → strideutils-0.4.4}/strideutils/stride_config.py +1 -0
- {strideutils-0.4.2 → strideutils-0.4.4}/strideutils/stride_requests.py +53 -36
- {strideutils-0.4.2 → strideutils-0.4.4}/README.md +0 -0
- {strideutils-0.4.2 → strideutils-0.4.4}/strideutils/Makefile +0 -0
- {strideutils-0.4.2 → strideutils-0.4.4}/strideutils/__init__.py +0 -0
- {strideutils-0.4.2 → strideutils-0.4.4}/strideutils/coingecko.py +0 -0
- {strideutils-0.4.2 → strideutils-0.4.4}/strideutils/config_examples/strideutils_config.yaml.example +0 -0
- {strideutils-0.4.2 → strideutils-0.4.4}/strideutils/config_examples/strideutils_secrets.yaml.example +0 -0
- {strideutils-0.4.2 → strideutils-0.4.4}/strideutils/cryptography.py +0 -0
- {strideutils-0.4.2 → strideutils-0.4.4}/strideutils/exec_tx.py +0 -0
- {strideutils-0.4.2 → strideutils-0.4.4}/strideutils/invariant_helpers.py +0 -0
- {strideutils-0.4.2 → strideutils-0.4.4}/strideutils/run_safely.py +0 -0
- {strideutils-0.4.2 → strideutils-0.4.4}/strideutils/sheets_connector.py +0 -0
- {strideutils-0.4.2 → strideutils-0.4.4}/strideutils/slack_connector.py +0 -0
- {strideutils-0.4.2 → strideutils-0.4.4}/strideutils/stride_alerts.py +0 -0
- {strideutils-0.4.2 → strideutils-0.4.4}/strideutils/stride_upstash.py +0 -0
- {strideutils-0.4.2 → strideutils-0.4.4}/strideutils/twilio_connector.py +0 -0
- {strideutils-0.4.2 → strideutils-0.4.4}/strideutils/types.py +0 -0
- {strideutils-0.4.2 → strideutils-0.4.4}/strideutils-stubs/__init__.pyi +0 -0
- {strideutils-0.4.2 → strideutils-0.4.4}/strideutils-stubs/coingecko.pyi +0 -0
- {strideutils-0.4.2 → strideutils-0.4.4}/strideutils-stubs/cryptography.pyi +0 -0
- {strideutils-0.4.2 → strideutils-0.4.4}/strideutils-stubs/exec_tx.pyi +0 -0
- {strideutils-0.4.2 → strideutils-0.4.4}/strideutils-stubs/invariant_helpers.pyi +0 -0
- {strideutils-0.4.2 → strideutils-0.4.4}/strideutils-stubs/run_safely.pyi +0 -0
- {strideutils-0.4.2 → strideutils-0.4.4}/strideutils-stubs/sheets_connector.pyi +0 -0
- {strideutils-0.4.2 → strideutils-0.4.4}/strideutils-stubs/slack_connector.pyi +0 -0
- {strideutils-0.4.2 → strideutils-0.4.4}/strideutils-stubs/stride_alerts.pyi +0 -0
- {strideutils-0.4.2 → strideutils-0.4.4}/strideutils-stubs/stride_config.pyi +0 -0
- {strideutils-0.4.2 → strideutils-0.4.4}/strideutils-stubs/stride_requests.pyi +0 -0
- {strideutils-0.4.2 → strideutils-0.4.4}/strideutils-stubs/stride_upstash.pyi +0 -0
- {strideutils-0.4.2 → strideutils-0.4.4}/strideutils-stubs/twilio_connector.pyi +0 -0
|
@@ -129,6 +129,7 @@ class HostChainsConfig(ConfigObj):
|
|
|
129
129
|
saga: HostChainConfig = field(default_factory=HostChainConfig)
|
|
130
130
|
celestia: HostChainConfig = field(default_factory=HostChainConfig)
|
|
131
131
|
dymension: HostChainConfig = field(default_factory=HostChainConfig)
|
|
132
|
+
haqq: HostChainConfig = field(default_factory=HostChainConfig)
|
|
132
133
|
|
|
133
134
|
|
|
134
135
|
@dataclass(repr=False)
|
|
@@ -23,6 +23,7 @@ MODULE_ACCOUNTS_QUERY = "cosmos/auth/v1beta1/module_accounts"
|
|
|
23
23
|
SUPPLY_QUERY = "cosmos/bank/v1beta1/supply/by_denom"
|
|
24
24
|
VALIDATORS_QUERY = "cosmos/staking/v1beta1/validators"
|
|
25
25
|
VALIDATOR_SLASHES_QUERY = "cosmos/distribution/v1beta1/validators/{validator_address}/slashes"
|
|
26
|
+
DELEGATIONS_QUERY = "cosmos/staking/v1beta1/delegations/{delegator_address}"
|
|
26
27
|
|
|
27
28
|
CONNECTION_QUERY = "ibc/core/connection/v1/connections/{connection_id}"
|
|
28
29
|
CHANNELS_QUERY = "ibc/core/channel/v1/connections/{connection_id}/channels"
|
|
@@ -317,7 +318,6 @@ def get_unbonding_records(
|
|
|
317
318
|
for epoch_unbonding in epoch_unbondings:
|
|
318
319
|
epoch_number = epoch_unbonding["epoch_number"]
|
|
319
320
|
for host_zone_unbonding in epoch_unbonding["host_zone_unbondings"]:
|
|
320
|
-
|
|
321
321
|
chain_id_match = host_zone_unbonding["host_zone_id"] == chain_id
|
|
322
322
|
status_match = not status or host_zone_unbonding["status"] == status
|
|
323
323
|
|
|
@@ -588,7 +588,6 @@ def get_callback_data(
|
|
|
588
588
|
|
|
589
589
|
filtered_callback_data = []
|
|
590
590
|
for data in callback_data:
|
|
591
|
-
|
|
592
591
|
chain_id_match = not chain_id or chain_id in data["port_id"]
|
|
593
592
|
channel_id_match = not channel_id or data["channel_id"] == channel_id
|
|
594
593
|
port_id_match = not port_id or data["port_id"] == port_id
|
|
@@ -623,7 +622,10 @@ def get_redemption_rate(token: str) -> float:
|
|
|
623
622
|
"""
|
|
624
623
|
Queries the redemption rate for a particular token
|
|
625
624
|
"""
|
|
626
|
-
|
|
625
|
+
chain_config_id = config.get_chain(ticker=token).id
|
|
626
|
+
if token == 'TIA':
|
|
627
|
+
chain_config_id = config.get_chain(name='celestia').id
|
|
628
|
+
host_zone = get_host_zone(chain_config_id)
|
|
627
629
|
return float(host_zone["redemption_rate"])
|
|
628
630
|
|
|
629
631
|
|
|
@@ -984,15 +986,30 @@ def get_unbonding_tokens_on_address(
|
|
|
984
986
|
return unbonding_amounts
|
|
985
987
|
|
|
986
988
|
|
|
987
|
-
def
|
|
989
|
+
def get_delegations(delegator_address: str, api_endpoint: str = config.stride.api_endpoint) -> dict[str, int]:
|
|
990
|
+
"""
|
|
991
|
+
Queries all the delegations for a given delegator
|
|
992
|
+
Returned as a mapping of validator addresss to delegation amount
|
|
993
|
+
"""
|
|
994
|
+
url = f"{api_endpoint}/{DELEGATIONS_QUERY.format(delegator_address=delegator_address)}"
|
|
995
|
+
delegations = query_list_with_pagination(url, rel_key="delegation_responses")
|
|
996
|
+
|
|
997
|
+
delegations_by_validator = {}
|
|
998
|
+
for delegation in delegations:
|
|
999
|
+
validator_address = delegation["delegation"]["validator_address"]
|
|
1000
|
+
amount = int(delegation["balance"]["amount"])
|
|
1001
|
+
delegations_by_validator[validator_address] = amount
|
|
1002
|
+
|
|
1003
|
+
return delegations_by_validator
|
|
1004
|
+
|
|
1005
|
+
|
|
1006
|
+
def get_host_zone_delegations(host_zone_id: str, include_ground_truth: bool = True) -> pd.DataFrame:
|
|
988
1007
|
"""
|
|
989
1008
|
Given a host zone id, returns a Dataframe of validator delegations.
|
|
990
1009
|
|
|
991
|
-
If `
|
|
1010
|
+
If `include_ground_truth=True`, then will also return the "true" delegations
|
|
992
1011
|
on the host zone delegaiton account.
|
|
993
1012
|
"""
|
|
994
|
-
host_zone = get_host_zone(host_zone_id)
|
|
995
|
-
vdf = pd.DataFrame(host_zone["validators"])
|
|
996
1013
|
int_cols = [
|
|
997
1014
|
"weight",
|
|
998
1015
|
"delegation",
|
|
@@ -1000,36 +1017,36 @@ def get_host_zone_delegations(host_zone_id: str, ground_truth_included: bool = T
|
|
|
1000
1017
|
"slash_query_checkpoint",
|
|
1001
1018
|
"shares_to_tokens_rate",
|
|
1002
1019
|
]
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
"slash_query_in_progress",
|
|
1012
|
-
"slash_query_progress_tracker",
|
|
1013
|
-
"shares_to_tokens_rate",
|
|
1014
|
-
]
|
|
1020
|
+
output_cols = [
|
|
1021
|
+
"name",
|
|
1022
|
+
"address",
|
|
1023
|
+
"weight",
|
|
1024
|
+
"delegation",
|
|
1025
|
+
"slash_query_in_progress",
|
|
1026
|
+
"slash_query_progress_tracker",
|
|
1027
|
+
"shares_to_tokens_rate",
|
|
1015
1028
|
]
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1029
|
+
|
|
1030
|
+
# Query the validator delegations on the host zone
|
|
1031
|
+
host_zone = get_host_zone(host_zone_id)
|
|
1032
|
+
validator_df = pd.DataFrame(host_zone["validators"])
|
|
1033
|
+
validator_df[int_cols] = validator_df[int_cols].map(lambda i: int(float(i))) # type: ignore
|
|
1034
|
+
validator_df = validator_df[output_cols]
|
|
1035
|
+
|
|
1036
|
+
# If the ground truth isn't requested, return as is
|
|
1037
|
+
if not include_ground_truth:
|
|
1038
|
+
return validator_df
|
|
1039
|
+
|
|
1040
|
+
# Otherwise, query the ground truth delegations from the actual host chain
|
|
1041
|
+
delegation_ica_account = host_zone["delegation_ica_address"]
|
|
1042
|
+
api_endpoint = config.get_chain(id=host_zone_id).api_endpoint
|
|
1043
|
+
delegations_by_validator = get_delegations(delegation_ica_account, api_endpoint=api_endpoint)
|
|
1044
|
+
|
|
1045
|
+
validator_df["ground_delegation"] = (validator_df["address"].map(delegations_by_validator)).fillna(0)
|
|
1046
|
+
validator_df["ground_delegation"] = validator_df["ground_delegation"].apply(int)
|
|
1047
|
+
validator_df["delegation_difference"] = validator_df["ground_delegation"] - validator_df["delegation"]
|
|
1048
|
+
|
|
1049
|
+
return validator_df
|
|
1033
1050
|
|
|
1034
1051
|
|
|
1035
1052
|
def get_epochs() -> List[Dict]:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{strideutils-0.4.2 → strideutils-0.4.4}/strideutils/config_examples/strideutils_config.yaml.example
RENAMED
|
File without changes
|
{strideutils-0.4.2 → strideutils-0.4.4}/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
|