strideutils 0.2.4__tar.gz → 0.2.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.2.4 → strideutils-0.2.6}/PKG-INFO +1 -1
- {strideutils-0.2.4 → strideutils-0.2.6}/pyproject.toml +1 -1
- strideutils-0.2.6/strideutils/exec_tx.py +60 -0
- {strideutils-0.2.4 → strideutils-0.2.6}/strideutils/stride_config.py +1 -0
- {strideutils-0.2.4 → strideutils-0.2.6}/README.md +0 -0
- {strideutils-0.2.4 → strideutils-0.2.6}/strideutils/Makefile +0 -0
- {strideutils-0.2.4 → strideutils-0.2.6}/strideutils/__init__.py +0 -0
- {strideutils-0.2.4 → strideutils-0.2.6}/strideutils/coingecko.py +0 -0
- {strideutils-0.2.4 → strideutils-0.2.6}/strideutils/config_examples/strideutils_config.yaml.example +0 -0
- {strideutils-0.2.4 → strideutils-0.2.6}/strideutils/config_examples/strideutils_secrets.yaml.example +0 -0
- {strideutils-0.2.4 → strideutils-0.2.6}/strideutils/cryptography.py +0 -0
- {strideutils-0.2.4 → strideutils-0.2.6}/strideutils/invariant_helpers.py +0 -0
- {strideutils-0.2.4 → strideutils-0.2.6}/strideutils/run_safely.py +0 -0
- {strideutils-0.2.4 → strideutils-0.2.6}/strideutils/sheets_connector.py +0 -0
- {strideutils-0.2.4 → strideutils-0.2.6}/strideutils/slack_connector.py +0 -0
- {strideutils-0.2.4 → strideutils-0.2.6}/strideutils/stride_alerts.py +0 -0
- {strideutils-0.2.4 → strideutils-0.2.6}/strideutils/stride_requests.py +0 -0
- {strideutils-0.2.4 → strideutils-0.2.6}/strideutils/stride_upstash.py +0 -0
- {strideutils-0.2.4 → strideutils-0.2.6}/strideutils/twilio_connector.py +0 -0
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import re
|
|
2
|
+
import subprocess
|
|
3
|
+
import time
|
|
4
|
+
from dataclasses import dataclass
|
|
5
|
+
from typing import Optional
|
|
6
|
+
|
|
7
|
+
from strideutils import stride_requests
|
|
8
|
+
from strideutils.stride_config import config
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
@dataclass
|
|
12
|
+
class TxResponse:
|
|
13
|
+
stdout: str
|
|
14
|
+
stderr: str
|
|
15
|
+
tx_response: Optional[dict] = None
|
|
16
|
+
tx_hash: Optional[str] = None
|
|
17
|
+
success: bool = False
|
|
18
|
+
raw_log: Optional[str] = None
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def execute_tx(command: str, api_endpoint: str = config.stride.api_endpoint) -> TxResponse:
|
|
22
|
+
"""
|
|
23
|
+
Execute a tx and query the tx hash
|
|
24
|
+
"""
|
|
25
|
+
output = subprocess.run(command, shell=True, capture_output=True)
|
|
26
|
+
standard_out = re.sub(r'\x1b\[[0-9;]*[mGKH]', '', output.stdout.decode('utf-8'))
|
|
27
|
+
error_out = re.sub(r'\x1b\[[0-9;]*[mGKH]', '', output.stderr.decode('utf-8'))
|
|
28
|
+
|
|
29
|
+
tx_hash = ""
|
|
30
|
+
for output_line in standard_out.split('\n'):
|
|
31
|
+
if 'txhash' in output_line:
|
|
32
|
+
tx_hash = output_line.split(': ')[-1]
|
|
33
|
+
|
|
34
|
+
tx_response = None
|
|
35
|
+
response_success = False
|
|
36
|
+
raw_log = ""
|
|
37
|
+
if not error_out:
|
|
38
|
+
event_filters = [(f"tx.hash='{tx_hash}'")]
|
|
39
|
+
for _ in range(15):
|
|
40
|
+
time.sleep(2)
|
|
41
|
+
tx_response = stride_requests.get_txs(event_filters, api_endpoint)
|
|
42
|
+
if tx_response['total'] != '0':
|
|
43
|
+
try:
|
|
44
|
+
response_code = tx_response['tx_responses'][0]['code']
|
|
45
|
+
raw_log = tx_response['tx_responses'][0]['raw_log']
|
|
46
|
+
response_success = response_code == 0
|
|
47
|
+
except KeyError:
|
|
48
|
+
response_success = False
|
|
49
|
+
break
|
|
50
|
+
|
|
51
|
+
success = response_success and not error_out
|
|
52
|
+
response = TxResponse(
|
|
53
|
+
stdout=standard_out,
|
|
54
|
+
stderr=error_out,
|
|
55
|
+
tx_response=tx_response,
|
|
56
|
+
success=success,
|
|
57
|
+
tx_hash=tx_hash,
|
|
58
|
+
raw_log=raw_log,
|
|
59
|
+
)
|
|
60
|
+
return response
|
|
@@ -94,6 +94,7 @@ class HostZoneChainConfig(ConfigObj):
|
|
|
94
94
|
comdex: ChainConfig = field(default_factory=ChainConfig)
|
|
95
95
|
sommelier: ChainConfig = field(default_factory=ChainConfig)
|
|
96
96
|
dydx: ChainConfig = field(default_factory=ChainConfig)
|
|
97
|
+
saga: ChainConfig = field(default_factory=ChainConfig)
|
|
97
98
|
|
|
98
99
|
|
|
99
100
|
@dataclass(repr=False)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{strideutils-0.2.4 → strideutils-0.2.6}/strideutils/config_examples/strideutils_config.yaml.example
RENAMED
|
File without changes
|
{strideutils-0.2.4 → strideutils-0.2.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
|