algokit-utils 2.3.0b3__py3-none-any.whl → 2.3.1b2__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/network_clients.py +2 -26
- {algokit_utils-2.3.0b3.dist-info → algokit_utils-2.3.1b2.dist-info}/METADATA +1 -1
- {algokit_utils-2.3.0b3.dist-info → algokit_utils-2.3.1b2.dist-info}/RECORD +6 -6
- {algokit_utils-2.3.0b3.dist-info → algokit_utils-2.3.1b2.dist-info}/LICENSE +0 -0
- {algokit_utils-2.3.0b3.dist-info → algokit_utils-2.3.1b2.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",
|
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,4 +1,4 @@
|
|
|
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
|
|
@@ -16,9 +16,9 @@ algokit_utils/deploy.py,sha256=ydE3QSq1lRkjXQC9zdFclywx8q1UgV9l-l3Mx-shbHg,34668
|
|
|
16
16
|
algokit_utils/dispenser_api.py,sha256=BpwEhKDig6qz54wbO-htG8hmLxFIrvdzXpESUb7Y1zw,5584
|
|
17
17
|
algokit_utils/logic_error.py,sha256=YeE70qHZ6WBeoKCXqnto3uBg8R4ODXiNZkLmfEmASQo,2617
|
|
18
18
|
algokit_utils/models.py,sha256=GWpZQ2bTGfkldM12VZntGlVJTFBTtWf5SM7ZYXC_LHE,8238
|
|
19
|
-
algokit_utils/network_clients.py,sha256=
|
|
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.1b2.dist-info/LICENSE,sha256=J5i7U1Q9Q2c7saUzlvFRmrCCFhQyXb5Juz_LO5omNUw,1076
|
|
22
|
+
algokit_utils-2.3.1b2.dist-info/METADATA,sha256=bYg4HprMBpFc42M-oQ4KI76buhb_K5sXdkTtX02_ot4,2207
|
|
23
|
+
algokit_utils-2.3.1b2.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
|
24
|
+
algokit_utils-2.3.1b2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|