algokit-utils 2.3.0b3__py3-none-any.whl → 2.3.1__py3-none-any.whl
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.
Potentially problematic release.
This version of algokit-utils might be problematic. Click here for more details.
- algokit_utils/__init__.py +0 -2
- algokit_utils/application_client.py +9 -8
- algokit_utils/logic_error.py +3 -1
- algokit_utils/models.py +8 -0
- algokit_utils/network_clients.py +2 -26
- {algokit_utils-2.3.0b3.dist-info → algokit_utils-2.3.1.dist-info}/METADATA +1 -1
- {algokit_utils-2.3.0b3.dist-info → algokit_utils-2.3.1.dist-info}/RECORD +9 -9
- {algokit_utils-2.3.0b3.dist-info → algokit_utils-2.3.1.dist-info}/LICENSE +0 -0
- {algokit_utils-2.3.0b3.dist-info → algokit_utils-2.3.1.dist-info}/WHEEL +0 -0
algokit_utils/__init__.py
CHANGED
|
@@ -88,7 +88,6 @@ from algokit_utils.network_clients import (
|
|
|
88
88
|
get_default_localnet_config,
|
|
89
89
|
get_indexer_client,
|
|
90
90
|
get_kmd_client_from_algod_client,
|
|
91
|
-
get_purestake_config,
|
|
92
91
|
is_localnet,
|
|
93
92
|
is_mainnet,
|
|
94
93
|
is_testnet,
|
|
@@ -160,7 +159,6 @@ __all__ = [
|
|
|
160
159
|
"get_default_localnet_config",
|
|
161
160
|
"get_indexer_client",
|
|
162
161
|
"get_kmd_client_from_algod_client",
|
|
163
|
-
"get_purestake_config",
|
|
164
162
|
"is_localnet",
|
|
165
163
|
"is_mainnet",
|
|
166
164
|
"is_testnet",
|
|
@@ -49,6 +49,7 @@ from algokit_utils.models import (
|
|
|
49
49
|
CreateCallParametersDict,
|
|
50
50
|
OnCompleteCallParameters,
|
|
51
51
|
OnCompleteCallParametersDict,
|
|
52
|
+
SimulationTrace,
|
|
52
53
|
TransactionParameters,
|
|
53
54
|
TransactionParametersDict,
|
|
54
55
|
TransactionResponse,
|
|
@@ -1236,7 +1237,7 @@ def _try_convert_to_logic_error(
|
|
|
1236
1237
|
source_ex: Exception | str,
|
|
1237
1238
|
approval_program: str,
|
|
1238
1239
|
approval_source_map: SourceMap | typing.Callable[[], SourceMap | None] | None = None,
|
|
1239
|
-
simulate_traces: list | None = None,
|
|
1240
|
+
simulate_traces: list[SimulationTrace] | None = None,
|
|
1240
1241
|
) -> Exception | None:
|
|
1241
1242
|
source_ex_str = str(source_ex)
|
|
1242
1243
|
logic_error_data = parse_logic_error(source_ex_str)
|
|
@@ -1297,7 +1298,7 @@ def execute_atc_with_logic_error(
|
|
|
1297
1298
|
raise ex
|
|
1298
1299
|
|
|
1299
1300
|
|
|
1300
|
-
def _create_simulate_traces(simulate: SimulateAtomicTransactionResponse) -> list[
|
|
1301
|
+
def _create_simulate_traces(simulate: SimulateAtomicTransactionResponse) -> list[SimulationTrace]:
|
|
1301
1302
|
traces = []
|
|
1302
1303
|
if hasattr(simulate, "simulate_response") and hasattr(simulate, "failed_at") and simulate.failed_at:
|
|
1303
1304
|
for txn_group in simulate.simulate_response["txn-groups"]:
|
|
@@ -1307,12 +1308,12 @@ def _create_simulate_traces(simulate: SimulateAtomicTransactionResponse) -> list
|
|
|
1307
1308
|
txn_result = txn_group.get("txn-results", [{}])[0]
|
|
1308
1309
|
exec_trace = txn_result.get("exec-trace", {})
|
|
1309
1310
|
traces.append(
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1311
|
+
SimulationTrace(
|
|
1312
|
+
app_budget_added=app_budget_added,
|
|
1313
|
+
app_budget_consumed=app_budget_consumed,
|
|
1314
|
+
failure_message=failure_message,
|
|
1315
|
+
exec_trace=exec_trace,
|
|
1316
|
+
)
|
|
1316
1317
|
)
|
|
1317
1318
|
return traces
|
|
1318
1319
|
|
algokit_utils/logic_error.py
CHANGED
|
@@ -2,6 +2,8 @@ import re
|
|
|
2
2
|
from copy import copy
|
|
3
3
|
from typing import TYPE_CHECKING, TypedDict
|
|
4
4
|
|
|
5
|
+
from algokit_utils.models import SimulationTrace
|
|
6
|
+
|
|
5
7
|
if TYPE_CHECKING:
|
|
6
8
|
from algosdk.source_map import SourceMap as AlgoSourceMap
|
|
7
9
|
|
|
@@ -46,7 +48,7 @@ class LogicError(Exception):
|
|
|
46
48
|
message: str,
|
|
47
49
|
pc: int,
|
|
48
50
|
logic_error: Exception | None = None,
|
|
49
|
-
traces: list | None = None,
|
|
51
|
+
traces: list[SimulationTrace] | None = None,
|
|
50
52
|
):
|
|
51
53
|
self.logic_error = logic_error
|
|
52
54
|
self.logic_error_str = logic_error_str
|
algokit_utils/models.py
CHANGED
|
@@ -230,3 +230,11 @@ class CommonCallParameters(TransactionParameters):
|
|
|
230
230
|
@deprecated(reason="Use TransactionParametersDict instead", version="1.3.1")
|
|
231
231
|
class CommonCallParametersDict(TransactionParametersDict):
|
|
232
232
|
"""Deprecated, use TransactionParametersDict instead"""
|
|
233
|
+
|
|
234
|
+
|
|
235
|
+
@dataclasses.dataclass
|
|
236
|
+
class SimulationTrace:
|
|
237
|
+
app_budget_added: int | None
|
|
238
|
+
app_budget_consumed: int | None
|
|
239
|
+
failure_message: str | None
|
|
240
|
+
exec_trace: dict[str, object]
|
algokit_utils/network_clients.py
CHANGED
|
@@ -14,7 +14,6 @@ __all__ = [
|
|
|
14
14
|
"get_default_localnet_config",
|
|
15
15
|
"get_indexer_client",
|
|
16
16
|
"get_kmd_client_from_algod_client",
|
|
17
|
-
"get_purestake_config",
|
|
18
17
|
"is_localnet",
|
|
19
18
|
"is_mainnet",
|
|
20
19
|
"is_testnet",
|
|
@@ -22,8 +21,6 @@ __all__ = [
|
|
|
22
21
|
"get_kmd_client",
|
|
23
22
|
]
|
|
24
23
|
|
|
25
|
-
_PURE_STAKE_HOST = "purestake.io"
|
|
26
|
-
|
|
27
24
|
|
|
28
25
|
@dataclasses.dataclass
|
|
29
26
|
class AlgoClientConfig:
|
|
@@ -59,22 +56,12 @@ def get_algonode_config(
|
|
|
59
56
|
)
|
|
60
57
|
|
|
61
58
|
|
|
62
|
-
def get_purestake_config(
|
|
63
|
-
network: Literal["testnet", "mainnet"], config: Literal["algod", "indexer"], token: str
|
|
64
|
-
) -> AlgoClientConfig:
|
|
65
|
-
client = "ps2" if config == "algod" else "idx2"
|
|
66
|
-
return AlgoClientConfig(
|
|
67
|
-
server=f"https://{network}-algorand.api.purestake.io/{client}",
|
|
68
|
-
token=token,
|
|
69
|
-
)
|
|
70
|
-
|
|
71
|
-
|
|
72
59
|
def get_algod_client(config: AlgoClientConfig | None = None) -> AlgodClient:
|
|
73
60
|
"""Returns an {py:class}`algosdk.v2client.algod.AlgodClient` from `config` or environment
|
|
74
61
|
|
|
75
62
|
If no configuration provided will use environment variables `ALGOD_SERVER`, `ALGOD_PORT` and `ALGOD_TOKEN`"""
|
|
76
63
|
config = config or _get_config_from_environment("ALGOD")
|
|
77
|
-
headers =
|
|
64
|
+
headers = {"X-Algo-API-Token": config.token}
|
|
78
65
|
return AlgodClient(config.token, config.server, headers)
|
|
79
66
|
|
|
80
67
|
|
|
@@ -91,7 +78,7 @@ def get_indexer_client(config: AlgoClientConfig | None = None) -> IndexerClient:
|
|
|
91
78
|
|
|
92
79
|
If no configuration provided will use environment variables `INDEXER_SERVER`, `INDEXER_PORT` and `INDEXER_TOKEN`"""
|
|
93
80
|
config = config or _get_config_from_environment("INDEXER")
|
|
94
|
-
headers =
|
|
81
|
+
headers = {"X-Indexer-API-Token": config.token}
|
|
95
82
|
return IndexerClient(config.token, config.server, headers) # type: ignore[no-untyped-call]
|
|
96
83
|
|
|
97
84
|
|
|
@@ -141,14 +128,3 @@ def _get_config_from_environment(environment_prefix: str) -> AlgoClientConfig:
|
|
|
141
128
|
parsed = parse.urlparse(server)
|
|
142
129
|
server = parsed._replace(netloc=f"{parsed.hostname}:{port}").geturl()
|
|
143
130
|
return AlgoClientConfig(server, os.getenv(f"{environment_prefix}_TOKEN", ""))
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
def _is_pure_stake_url(url: str) -> bool:
|
|
147
|
-
parsed = parse.urlparse(url)
|
|
148
|
-
host = parsed.netloc.split(":")[0].lower()
|
|
149
|
-
return host.endswith(_PURE_STAKE_HOST)
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
def _get_headers(config: AlgoClientConfig, default_auth_header: str) -> dict[str, str] | None:
|
|
153
|
-
auth_header = "X-API-Key" if _is_pure_stake_url(config.server) else default_auth_header
|
|
154
|
-
return {auth_header: config.token}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
algokit_utils/__init__.py,sha256=
|
|
1
|
+
algokit_utils/__init__.py,sha256=Xc9NVy3cETI2qzbkkAea2YrZ9-CLtZLHnuS1UHQ13wQ,4909
|
|
2
2
|
algokit_utils/_debugging.py,sha256=4UC5NZGqxF32y742TUB34rX9kWaObXCCPOs-lbkQjGQ,10732
|
|
3
3
|
algokit_utils/_ensure_funded.py,sha256=ZdEdUB43QGIQrg7cSSgNrDmWaLSUhli9x9I6juwKfgo,6786
|
|
4
4
|
algokit_utils/_transfer.py,sha256=R9q8RoMHiwtqcwQjuGHEluMxIzmYqAsI5WrTsQd24Ds,6021
|
|
5
5
|
algokit_utils/account.py,sha256=UIuOQZe28pQxjEP9TzhtYlOU20tUdzzS-nIIZM9Bp6Y,7364
|
|
6
|
-
algokit_utils/application_client.py,sha256=
|
|
6
|
+
algokit_utils/application_client.py,sha256=rBV5QnMJ8wBwfV6KCz5QS9dtI97aF61a0TGPy2ZnEu0,58703
|
|
7
7
|
algokit_utils/application_specification.py,sha256=XusOe7VrGPun2UoNspC9Ei202NzPkxRNx5USXiABuXc,7466
|
|
8
8
|
algokit_utils/asset.py,sha256=jsc7T1dH9HZA3Yve2gRLObwUlK6xLDoQz0NxLLnqaGs,7216
|
|
9
9
|
algokit_utils/beta/account_manager.py,sha256=dSb-jpBAWRfmKFYzG6T8t5vkh6ysX2NkZXl5UcZY5WA,8015
|
|
@@ -14,11 +14,11 @@ algokit_utils/common.py,sha256=K6-3_9dv2clDn0WMYb8AWE_N46kWWIXglZIPfHIowDs,812
|
|
|
14
14
|
algokit_utils/config.py,sha256=oY3o1kPzVPRiQH--f4HzrMMNPojT078CSudqS9WQaEc,4279
|
|
15
15
|
algokit_utils/deploy.py,sha256=ydE3QSq1lRkjXQC9zdFclywx8q1UgV9l-l3Mx-shbHg,34668
|
|
16
16
|
algokit_utils/dispenser_api.py,sha256=BpwEhKDig6qz54wbO-htG8hmLxFIrvdzXpESUb7Y1zw,5584
|
|
17
|
-
algokit_utils/logic_error.py,sha256=
|
|
18
|
-
algokit_utils/models.py,sha256=
|
|
19
|
-
algokit_utils/network_clients.py,sha256=
|
|
17
|
+
algokit_utils/logic_error.py,sha256=I9fJJ09zfpPlKgcJJ7fqC77BBPTz37QsSlGfZwXDdPQ,2684
|
|
18
|
+
algokit_utils/models.py,sha256=KMpSUv7XGjZ9_50U6qUjcPjGh9_7lsRj3ZlO9Fb2zyE,8421
|
|
19
|
+
algokit_utils/network_clients.py,sha256=TlGRZ4l62_vi__AKg9zyVGiAawTrA0ca6AfPDzRL44E,5136
|
|
20
20
|
algokit_utils/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
21
|
-
algokit_utils-2.3.
|
|
22
|
-
algokit_utils-2.3.
|
|
23
|
-
algokit_utils-2.3.
|
|
24
|
-
algokit_utils-2.3.
|
|
21
|
+
algokit_utils-2.3.1.dist-info/LICENSE,sha256=J5i7U1Q9Q2c7saUzlvFRmrCCFhQyXb5Juz_LO5omNUw,1076
|
|
22
|
+
algokit_utils-2.3.1.dist-info/METADATA,sha256=ntCMbzLSfDWUPdUKPVku6Ast-kVeUfJZKWI360_EIl8,2205
|
|
23
|
+
algokit_utils-2.3.1.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
|
24
|
+
algokit_utils-2.3.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|