algokit-utils 2.3.0b2__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 +20 -26
- algokit_utils/deploy.py +6 -20
- algokit_utils/logic_error.py +3 -1
- algokit_utils/models.py +13 -107
- algokit_utils/network_clients.py +2 -26
- {algokit_utils-2.3.0b2.dist-info → algokit_utils-2.3.1.dist-info}/METADATA +1 -1
- {algokit_utils-2.3.0b2.dist-info → algokit_utils-2.3.1.dist-info}/RECORD +10 -10
- {algokit_utils-2.3.0b2.dist-info → algokit_utils-2.3.1.dist-info}/LICENSE +0 -0
- {algokit_utils-2.3.0b2.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",
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import base64
|
|
2
2
|
import copy
|
|
3
|
-
import dataclasses
|
|
4
3
|
import json
|
|
5
4
|
import logging
|
|
6
5
|
import re
|
|
@@ -50,6 +49,7 @@ from algokit_utils.models import (
|
|
|
50
49
|
CreateCallParametersDict,
|
|
51
50
|
OnCompleteCallParameters,
|
|
52
51
|
OnCompleteCallParametersDict,
|
|
52
|
+
SimulationTrace,
|
|
53
53
|
TransactionParameters,
|
|
54
54
|
TransactionParametersDict,
|
|
55
55
|
TransactionResponse,
|
|
@@ -59,6 +59,7 @@ if typing.TYPE_CHECKING:
|
|
|
59
59
|
from algosdk.v2client.algod import AlgodClient
|
|
60
60
|
from algosdk.v2client.indexer import IndexerClient
|
|
61
61
|
|
|
62
|
+
|
|
62
63
|
logger = logging.getLogger(__name__)
|
|
63
64
|
|
|
64
65
|
|
|
@@ -375,7 +376,7 @@ class ApplicationClient:
|
|
|
375
376
|
) -> None:
|
|
376
377
|
"""Adds a signed transaction with application id == 0 and the schema and source of client's app_spec to atc"""
|
|
377
378
|
approval_program, clear_program = self._check_is_compiled()
|
|
378
|
-
transaction_parameters = _convert_transaction_parameters(
|
|
379
|
+
transaction_parameters = _convert_transaction_parameters(transaction_parameters)
|
|
379
380
|
|
|
380
381
|
extra_pages = transaction_parameters.extra_pages or num_extra_program_pages(
|
|
381
382
|
approval_program.raw_binary, clear_program.raw_binary
|
|
@@ -388,7 +389,7 @@ class ApplicationClient:
|
|
|
388
389
|
abi_args=abi_kwargs,
|
|
389
390
|
on_complete=transaction_parameters.on_complete or transaction.OnComplete.NoOpOC,
|
|
390
391
|
call_config=au_spec.CallConfig.CREATE,
|
|
391
|
-
parameters=
|
|
392
|
+
parameters=transaction_parameters,
|
|
392
393
|
approval_program=approval_program.raw_binary,
|
|
393
394
|
clear_program=clear_program.raw_binary,
|
|
394
395
|
global_schema=self.app_spec.global_state_schema,
|
|
@@ -567,12 +568,12 @@ class ApplicationClient:
|
|
|
567
568
|
**abi_kwargs: ABIArgType,
|
|
568
569
|
) -> None:
|
|
569
570
|
"""Adds a signed transaction with specified parameters to atc"""
|
|
570
|
-
_parameters = _convert_transaction_parameters(
|
|
571
|
+
_parameters = _convert_transaction_parameters(transaction_parameters)
|
|
571
572
|
self.add_method_call(
|
|
572
573
|
atc,
|
|
573
574
|
abi_method=call_abi_method,
|
|
574
575
|
abi_args=abi_kwargs,
|
|
575
|
-
parameters=
|
|
576
|
+
parameters=_parameters,
|
|
576
577
|
on_complete=_parameters.on_complete or transaction.OnComplete.NoOpOC,
|
|
577
578
|
)
|
|
578
579
|
|
|
@@ -607,7 +608,7 @@ class ApplicationClient:
|
|
|
607
608
|
) -> TransactionResponse | ABITransactionResponse:
|
|
608
609
|
"""Submits a signed transaction with specified parameters"""
|
|
609
610
|
atc = AtomicTransactionComposer()
|
|
610
|
-
_parameters = _convert_transaction_parameters(
|
|
611
|
+
_parameters = _convert_transaction_parameters(transaction_parameters)
|
|
611
612
|
self.compose_call(
|
|
612
613
|
atc,
|
|
613
614
|
call_abi_method=call_abi_method,
|
|
@@ -1003,7 +1004,7 @@ class ApplicationClient:
|
|
|
1003
1004
|
if app_id is None:
|
|
1004
1005
|
self._load_reference_and_check_app_id()
|
|
1005
1006
|
app_id = self.app_id
|
|
1006
|
-
parameters = _convert_transaction_parameters(
|
|
1007
|
+
parameters = _convert_transaction_parameters(parameters)
|
|
1007
1008
|
method = self._resolve_method(abi_method, abi_args, on_complete, call_config)
|
|
1008
1009
|
sp = parameters.suggested_params or self.suggested_params or self.algod_client.suggested_params()
|
|
1009
1010
|
signer, sender = self.resolve_signer_sender(parameters.signer, parameters.sender)
|
|
@@ -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,28 +1308,21 @@ 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
|
|
|
1319
1320
|
|
|
1320
|
-
_TParams = typing.TypeVar("_TParams", TransactionParameters, OnCompleteCallParameters, CreateCallParameters)
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
1321
|
def _convert_transaction_parameters(
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
)
|
|
1327
|
-
|
|
1328
|
-
return cls()
|
|
1329
|
-
args_dict = args.__dict__ if not isinstance(args, dict) else (args or {})
|
|
1330
|
-
_args = {f.name: args_dict[f.name] for f in dataclasses.fields(cls) if f.name in args_dict}
|
|
1331
|
-
return cls(**_args)
|
|
1322
|
+
args: TransactionParameters | TransactionParametersDict | None,
|
|
1323
|
+
) -> CreateCallParameters:
|
|
1324
|
+
_args = args.__dict__ if isinstance(args, TransactionParameters) else (args or {})
|
|
1325
|
+
return CreateCallParameters(**_args)
|
|
1332
1326
|
|
|
1333
1327
|
|
|
1334
1328
|
def get_sender_from_signer(signer: TransactionSigner | None) -> str | None:
|
algokit_utils/deploy.py
CHANGED
|
@@ -23,7 +23,6 @@ from algokit_utils.models import (
|
|
|
23
23
|
ABIMethod,
|
|
24
24
|
Account,
|
|
25
25
|
CreateCallParameters,
|
|
26
|
-
TransactionParameters,
|
|
27
26
|
TransactionResponse,
|
|
28
27
|
)
|
|
29
28
|
|
|
@@ -725,7 +724,7 @@ class Deployer:
|
|
|
725
724
|
def _create_app(self) -> DeployResponse:
|
|
726
725
|
assert self.app_client.existing_deployments
|
|
727
726
|
|
|
728
|
-
method, abi_args, parameters =
|
|
727
|
+
method, abi_args, parameters = _convert_deploy_args(
|
|
729
728
|
self.create_args, self.new_app_metadata, self.signer, self.sender
|
|
730
729
|
)
|
|
731
730
|
create_response = self.app_client.create(
|
|
@@ -752,7 +751,7 @@ class Deployer:
|
|
|
752
751
|
f"{self.new_app_metadata.name} ({self.new_app_metadata.version}) in {self.creator} account."
|
|
753
752
|
)
|
|
754
753
|
atc = AtomicTransactionComposer()
|
|
755
|
-
create_method, create_abi_args, create_parameters =
|
|
754
|
+
create_method, create_abi_args, create_parameters = _convert_deploy_args(
|
|
756
755
|
self.create_args, self.new_app_metadata, self.signer, self.sender
|
|
757
756
|
)
|
|
758
757
|
self.app_client.compose_create(
|
|
@@ -851,10 +850,11 @@ def _convert_deploy_args(
|
|
|
851
850
|
note: AppDeployMetaData,
|
|
852
851
|
signer: TransactionSigner | None,
|
|
853
852
|
sender: str | None,
|
|
854
|
-
) -> tuple[ABIMethod | bool | None, ABIArgsDict,
|
|
853
|
+
) -> tuple[ABIMethod | bool | None, ABIArgsDict, CreateCallParameters]:
|
|
855
854
|
args = _args.__dict__ if isinstance(_args, DeployCallArgs) else (_args or {})
|
|
856
855
|
|
|
857
|
-
parameters
|
|
856
|
+
# return most derived type, unused parameters are ignored
|
|
857
|
+
parameters = CreateCallParameters(
|
|
858
858
|
note=note.encode(),
|
|
859
859
|
signer=signer,
|
|
860
860
|
sender=sender,
|
|
@@ -865,25 +865,11 @@ def _convert_deploy_args(
|
|
|
865
865
|
foreign_apps=args.get("foreign_apps"),
|
|
866
866
|
boxes=args.get("boxes"),
|
|
867
867
|
rekey_to=args.get("rekey_to"),
|
|
868
|
-
)
|
|
869
|
-
|
|
870
|
-
return args.get("method"), args.get("args") or {}, parameters
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
def _convert_create_deploy_args(
|
|
874
|
-
_args: DeployCallArgs | DeployCallArgsDict | None,
|
|
875
|
-
note: AppDeployMetaData,
|
|
876
|
-
signer: TransactionSigner | None,
|
|
877
|
-
sender: str | None,
|
|
878
|
-
) -> tuple[ABIMethod | bool | None, ABIArgsDict, CreateCallParameters]:
|
|
879
|
-
method, args, parameters = _convert_deploy_args(_args, note, signer, sender)
|
|
880
|
-
create_parameters = CreateCallParameters(
|
|
881
|
-
**parameters.__dict__,
|
|
882
868
|
extra_pages=args.get("extra_pages"),
|
|
883
869
|
on_complete=args.get("on_complete"),
|
|
884
870
|
)
|
|
885
871
|
|
|
886
|
-
return method, args,
|
|
872
|
+
return args.get("method"), args.get("args") or {}, parameters
|
|
887
873
|
|
|
888
874
|
|
|
889
875
|
def get_app_id_from_tx_id(algod_client: "AlgodClient", tx_id: str) -> int:
|
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
|
@@ -155,86 +155,25 @@ class TransactionParameters:
|
|
|
155
155
|
|
|
156
156
|
# CreateTransactionParameters is used by algokit-client-generator clients
|
|
157
157
|
@dataclasses.dataclass(kw_only=True)
|
|
158
|
-
class CreateTransactionParameters:
|
|
158
|
+
class CreateTransactionParameters(TransactionParameters):
|
|
159
159
|
"""Additional parameters that can be included in a transaction when calling a create method"""
|
|
160
160
|
|
|
161
|
-
signer: TransactionSigner | None = None
|
|
162
|
-
"""Signer to use when signing this transaction"""
|
|
163
|
-
sender: str | None = None
|
|
164
|
-
"""Sender of this transaction"""
|
|
165
|
-
suggested_params: transaction.SuggestedParams | None = None
|
|
166
|
-
"""SuggestedParams to use for this transaction"""
|
|
167
|
-
note: bytes | str | None = None
|
|
168
|
-
"""Note for this transaction"""
|
|
169
|
-
lease: bytes | str | None = None
|
|
170
|
-
"""Lease value for this transaction"""
|
|
171
|
-
boxes: Sequence[tuple[int, bytes | bytearray | str | int]] | None = None
|
|
172
|
-
"""Box references to include in transaction. A sequence of (app id, box key) tuples"""
|
|
173
|
-
accounts: list[str] | None = None
|
|
174
|
-
"""Accounts to include in transaction"""
|
|
175
|
-
foreign_apps: list[int] | None = None
|
|
176
|
-
"""List of foreign apps (by app id) to include in transaction"""
|
|
177
|
-
foreign_assets: list[int] | None = None
|
|
178
|
-
"""List of foreign assets (by asset id) to include in transaction"""
|
|
179
|
-
rekey_to: str | None = None
|
|
180
|
-
"""Address to rekey to"""
|
|
181
161
|
extra_pages: int | None = None
|
|
182
162
|
|
|
183
163
|
|
|
184
164
|
@dataclasses.dataclass(kw_only=True)
|
|
185
|
-
class OnCompleteCallParameters:
|
|
165
|
+
class OnCompleteCallParameters(TransactionParameters):
|
|
186
166
|
"""Additional parameters that can be included in a transaction when using the
|
|
187
167
|
ApplicationClient.call/compose_call methods"""
|
|
188
168
|
|
|
189
|
-
signer: TransactionSigner | None = None
|
|
190
|
-
"""Signer to use when signing this transaction"""
|
|
191
|
-
sender: str | None = None
|
|
192
|
-
"""Sender of this transaction"""
|
|
193
|
-
suggested_params: transaction.SuggestedParams | None = None
|
|
194
|
-
"""SuggestedParams to use for this transaction"""
|
|
195
|
-
note: bytes | str | None = None
|
|
196
|
-
"""Note for this transaction"""
|
|
197
|
-
lease: bytes | str | None = None
|
|
198
|
-
"""Lease value for this transaction"""
|
|
199
|
-
boxes: Sequence[tuple[int, bytes | bytearray | str | int]] | None = None
|
|
200
|
-
"""Box references to include in transaction. A sequence of (app id, box key) tuples"""
|
|
201
|
-
accounts: list[str] | None = None
|
|
202
|
-
"""Accounts to include in transaction"""
|
|
203
|
-
foreign_apps: list[int] | None = None
|
|
204
|
-
"""List of foreign apps (by app id) to include in transaction"""
|
|
205
|
-
foreign_assets: list[int] | None = None
|
|
206
|
-
"""List of foreign assets (by asset id) to include in transaction"""
|
|
207
|
-
rekey_to: str | None = None
|
|
208
|
-
"""Address to rekey to"""
|
|
209
169
|
on_complete: transaction.OnComplete | None = None
|
|
210
170
|
|
|
211
171
|
|
|
212
172
|
@dataclasses.dataclass(kw_only=True)
|
|
213
|
-
class CreateCallParameters:
|
|
173
|
+
class CreateCallParameters(OnCompleteCallParameters):
|
|
214
174
|
"""Additional parameters that can be included in a transaction when using the
|
|
215
175
|
ApplicationClient.create/compose_create methods"""
|
|
216
176
|
|
|
217
|
-
signer: TransactionSigner | None = None
|
|
218
|
-
"""Signer to use when signing this transaction"""
|
|
219
|
-
sender: str | None = None
|
|
220
|
-
"""Sender of this transaction"""
|
|
221
|
-
suggested_params: transaction.SuggestedParams | None = None
|
|
222
|
-
"""SuggestedParams to use for this transaction"""
|
|
223
|
-
note: bytes | str | None = None
|
|
224
|
-
"""Note for this transaction"""
|
|
225
|
-
lease: bytes | str | None = None
|
|
226
|
-
"""Lease value for this transaction"""
|
|
227
|
-
boxes: Sequence[tuple[int, bytes | bytearray | str | int]] | None = None
|
|
228
|
-
"""Box references to include in transaction. A sequence of (app id, box key) tuples"""
|
|
229
|
-
accounts: list[str] | None = None
|
|
230
|
-
"""Accounts to include in transaction"""
|
|
231
|
-
foreign_apps: list[int] | None = None
|
|
232
|
-
"""List of foreign apps (by app id) to include in transaction"""
|
|
233
|
-
foreign_assets: list[int] | None = None
|
|
234
|
-
"""List of foreign assets (by asset id) to include in transaction"""
|
|
235
|
-
rekey_to: str | None = None
|
|
236
|
-
"""Address to rekey to"""
|
|
237
|
-
on_complete: transaction.OnComplete | None = None
|
|
238
177
|
extra_pages: int | None = None
|
|
239
178
|
|
|
240
179
|
|
|
@@ -263,58 +202,17 @@ class TransactionParametersDict(TypedDict, total=False):
|
|
|
263
202
|
"""Address to rekey to"""
|
|
264
203
|
|
|
265
204
|
|
|
266
|
-
class OnCompleteCallParametersDict(TypedDict, total=False):
|
|
205
|
+
class OnCompleteCallParametersDict(TypedDict, TransactionParametersDict, total=False):
|
|
267
206
|
"""Additional parameters that can be included in a transaction when using the
|
|
268
207
|
ApplicationClient.call/compose_call methods"""
|
|
269
208
|
|
|
270
|
-
signer: TransactionSigner
|
|
271
|
-
"""Signer to use when signing this transaction"""
|
|
272
|
-
sender: str
|
|
273
|
-
"""Sender of this transaction"""
|
|
274
|
-
suggested_params: transaction.SuggestedParams
|
|
275
|
-
"""SuggestedParams to use for this transaction"""
|
|
276
|
-
note: bytes | str
|
|
277
|
-
"""Note for this transaction"""
|
|
278
|
-
lease: bytes | str
|
|
279
|
-
"""Lease value for this transaction"""
|
|
280
|
-
boxes: Sequence[tuple[int, bytes | bytearray | str | int]]
|
|
281
|
-
"""Box references to include in transaction. A sequence of (app id, box key) tuples"""
|
|
282
|
-
accounts: list[str]
|
|
283
|
-
"""Accounts to include in transaction"""
|
|
284
|
-
foreign_apps: list[int]
|
|
285
|
-
"""List of foreign apps (by app id) to include in transaction"""
|
|
286
|
-
foreign_assets: list[int]
|
|
287
|
-
"""List of foreign assets (by asset id) to include in transaction"""
|
|
288
|
-
rekey_to: str
|
|
289
|
-
"""Address to rekey to"""
|
|
290
209
|
on_complete: transaction.OnComplete
|
|
291
210
|
|
|
292
211
|
|
|
293
|
-
class CreateCallParametersDict(TypedDict, total=False):
|
|
212
|
+
class CreateCallParametersDict(TypedDict, OnCompleteCallParametersDict, total=False):
|
|
294
213
|
"""Additional parameters that can be included in a transaction when using the
|
|
295
214
|
ApplicationClient.create/compose_create methods"""
|
|
296
215
|
|
|
297
|
-
signer: TransactionSigner
|
|
298
|
-
"""Signer to use when signing this transaction"""
|
|
299
|
-
sender: str
|
|
300
|
-
"""Sender of this transaction"""
|
|
301
|
-
suggested_params: transaction.SuggestedParams
|
|
302
|
-
"""SuggestedParams to use for this transaction"""
|
|
303
|
-
note: bytes | str
|
|
304
|
-
"""Note for this transaction"""
|
|
305
|
-
lease: bytes | str
|
|
306
|
-
"""Lease value for this transaction"""
|
|
307
|
-
boxes: Sequence[tuple[int, bytes | bytearray | str | int]]
|
|
308
|
-
"""Box references to include in transaction. A sequence of (app id, box key) tuples"""
|
|
309
|
-
accounts: list[str]
|
|
310
|
-
"""Accounts to include in transaction"""
|
|
311
|
-
foreign_apps: list[int]
|
|
312
|
-
"""List of foreign apps (by app id) to include in transaction"""
|
|
313
|
-
foreign_assets: list[int]
|
|
314
|
-
"""List of foreign assets (by asset id) to include in transaction"""
|
|
315
|
-
rekey_to: str
|
|
316
|
-
"""Address to rekey to"""
|
|
317
|
-
on_complete: transaction.OnComplete
|
|
318
216
|
extra_pages: int
|
|
319
217
|
|
|
320
218
|
|
|
@@ -332,3 +230,11 @@ class CommonCallParameters(TransactionParameters):
|
|
|
332
230
|
@deprecated(reason="Use TransactionParametersDict instead", version="1.3.1")
|
|
333
231
|
class CommonCallParametersDict(TransactionParametersDict):
|
|
334
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
|
|
@@ -12,13 +12,13 @@ algokit_utils/beta/client_manager.py,sha256=rW58VVBdYAV_5QwXNyt3VMP8NGon_IRhq1Dr
|
|
|
12
12
|
algokit_utils/beta/composer.py,sha256=qpIWQ6Xeysk1FzqW8AntHJ_go_W2qIEDB4uvGFOOdgM,28627
|
|
13
13
|
algokit_utils/common.py,sha256=K6-3_9dv2clDn0WMYb8AWE_N46kWWIXglZIPfHIowDs,812
|
|
14
14
|
algokit_utils/config.py,sha256=oY3o1kPzVPRiQH--f4HzrMMNPojT078CSudqS9WQaEc,4279
|
|
15
|
-
algokit_utils/deploy.py,sha256=
|
|
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
|