algokit-utils 2.2.2b5__py3-none-any.whl → 2.3.0__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/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 = _convert_create_deploy_args(
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 = _convert_create_deploy_args(
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, TransactionParameters]:
853
+ ) -> tuple[ABIMethod | bool | None, ABIArgsDict, CreateCallParameters]:
855
854
  args = _args.__dict__ if isinstance(_args, DeployCallArgs) else (_args or {})
856
855
 
857
- parameters = TransactionParameters(
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, create_parameters
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/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
 
@@ -18,6 +18,8 @@ __all__ = [
18
18
  "is_localnet",
19
19
  "is_mainnet",
20
20
  "is_testnet",
21
+ "AlgoClientConfigs",
22
+ "get_kmd_client",
21
23
  ]
22
24
 
23
25
  _PURE_STAKE_HOST = "purestake.io"
@@ -34,6 +36,13 @@ class AlgoClientConfig:
34
36
  """API Token to authenticate with the service"""
35
37
 
36
38
 
39
+ @dataclasses.dataclass
40
+ class AlgoClientConfigs:
41
+ algod_config: AlgoClientConfig
42
+ indexer_config: AlgoClientConfig
43
+ kmd_config: AlgoClientConfig | None
44
+
45
+
37
46
  def get_default_localnet_config(config: Literal["algod", "indexer", "kmd"]) -> AlgoClientConfig:
38
47
  """Returns the client configuration to point to the default LocalNet"""
39
48
  port = {"algod": 4001, "indexer": 8980, "kmd": 4002}[config]
@@ -69,6 +78,14 @@ def get_algod_client(config: AlgoClientConfig | None = None) -> AlgodClient:
69
78
  return AlgodClient(config.token, config.server, headers)
70
79
 
71
80
 
81
+ def get_kmd_client(config: AlgoClientConfig | None = None) -> KMDClient:
82
+ """Returns an {py:class}`algosdk.kmd.KMDClient` from `config` or environment
83
+
84
+ If no configuration provided will use environment variables `KMD_SERVER`, `KMD_PORT` and `KMD_TOKEN`"""
85
+ config = config or _get_config_from_environment("KMD")
86
+ return KMDClient(config.token, config.server) # type: ignore[no-untyped-call]
87
+
88
+
72
89
  def get_indexer_client(config: AlgoClientConfig | None = None) -> IndexerClient:
73
90
  """Returns an {py:class}`algosdk.v2client.indexer.IndexerClient` from `config` or environment.
74
91
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: algokit-utils
3
- Version: 2.2.2b5
3
+ Version: 2.3.0
4
4
  Summary: Utilities for Algorand development for use by AlgoKit
5
5
  License: MIT
6
6
  Author: Algorand Foundation
@@ -0,0 +1,24 @@
1
+ algokit_utils/__init__.py,sha256=yeufbE_5wjRILZs_10UD5B3_sjdwAfPXskdFKskzXhg,4963
2
+ algokit_utils/_debugging.py,sha256=4UC5NZGqxF32y742TUB34rX9kWaObXCCPOs-lbkQjGQ,10732
3
+ algokit_utils/_ensure_funded.py,sha256=ZdEdUB43QGIQrg7cSSgNrDmWaLSUhli9x9I6juwKfgo,6786
4
+ algokit_utils/_transfer.py,sha256=R9q8RoMHiwtqcwQjuGHEluMxIzmYqAsI5WrTsQd24Ds,6021
5
+ algokit_utils/account.py,sha256=UIuOQZe28pQxjEP9TzhtYlOU20tUdzzS-nIIZM9Bp6Y,7364
6
+ algokit_utils/application_client.py,sha256=xOZJ8i3y8wDJL0Uvaw1o-UmJKvSmbv8ib5RwGl4ar0w,58661
7
+ algokit_utils/application_specification.py,sha256=XusOe7VrGPun2UoNspC9Ei202NzPkxRNx5USXiABuXc,7466
8
+ algokit_utils/asset.py,sha256=jsc7T1dH9HZA3Yve2gRLObwUlK6xLDoQz0NxLLnqaGs,7216
9
+ algokit_utils/beta/account_manager.py,sha256=dSb-jpBAWRfmKFYzG6T8t5vkh6ysX2NkZXl5UcZY5WA,8015
10
+ algokit_utils/beta/algorand_client.py,sha256=y1CYYn_ADwgOLTVID9BFMvdubDgKqUfx9R6XH3PrzsA,12649
11
+ algokit_utils/beta/client_manager.py,sha256=rW58VVBdYAV_5QwXNyt3VMP8NGon_IRhq1Dr35Mp31g,3117
12
+ algokit_utils/beta/composer.py,sha256=qpIWQ6Xeysk1FzqW8AntHJ_go_W2qIEDB4uvGFOOdgM,28627
13
+ algokit_utils/common.py,sha256=K6-3_9dv2clDn0WMYb8AWE_N46kWWIXglZIPfHIowDs,812
14
+ algokit_utils/config.py,sha256=oY3o1kPzVPRiQH--f4HzrMMNPojT078CSudqS9WQaEc,4279
15
+ algokit_utils/deploy.py,sha256=ydE3QSq1lRkjXQC9zdFclywx8q1UgV9l-l3Mx-shbHg,34668
16
+ algokit_utils/dispenser_api.py,sha256=BpwEhKDig6qz54wbO-htG8hmLxFIrvdzXpESUb7Y1zw,5584
17
+ algokit_utils/logic_error.py,sha256=YeE70qHZ6WBeoKCXqnto3uBg8R4ODXiNZkLmfEmASQo,2617
18
+ algokit_utils/models.py,sha256=GWpZQ2bTGfkldM12VZntGlVJTFBTtWf5SM7ZYXC_LHE,8238
19
+ algokit_utils/network_clients.py,sha256=O4nJ3ECms4hFbuB1X64nzTMNOfK1Uj2oyjKxeieri-g,5929
20
+ algokit_utils/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
21
+ algokit_utils-2.3.0.dist-info/LICENSE,sha256=J5i7U1Q9Q2c7saUzlvFRmrCCFhQyXb5Juz_LO5omNUw,1076
22
+ algokit_utils-2.3.0.dist-info/METADATA,sha256=jAqL6L3gHaVkXH9jzsWn7o9JePrVCTstcLhP3c8heqk,2205
23
+ algokit_utils-2.3.0.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
24
+ algokit_utils-2.3.0.dist-info/RECORD,,
@@ -1,20 +0,0 @@
1
- algokit_utils/__init__.py,sha256=yeufbE_5wjRILZs_10UD5B3_sjdwAfPXskdFKskzXhg,4963
2
- algokit_utils/_debugging.py,sha256=4UC5NZGqxF32y742TUB34rX9kWaObXCCPOs-lbkQjGQ,10732
3
- algokit_utils/_ensure_funded.py,sha256=ZdEdUB43QGIQrg7cSSgNrDmWaLSUhli9x9I6juwKfgo,6786
4
- algokit_utils/_transfer.py,sha256=CyXGOR_Zy-2crQhk-78uUbB8Sj_ZeTzxPwOAHU7wwno,5947
5
- algokit_utils/account.py,sha256=UIuOQZe28pQxjEP9TzhtYlOU20tUdzzS-nIIZM9Bp6Y,7364
6
- algokit_utils/application_client.py,sha256=qylA2aI4Ecs532bIs6fyc6FgLnWey9PBzZBZW_jnYtk,59092
7
- algokit_utils/application_specification.py,sha256=XusOe7VrGPun2UoNspC9Ei202NzPkxRNx5USXiABuXc,7466
8
- algokit_utils/asset.py,sha256=jsc7T1dH9HZA3Yve2gRLObwUlK6xLDoQz0NxLLnqaGs,7216
9
- algokit_utils/common.py,sha256=K6-3_9dv2clDn0WMYb8AWE_N46kWWIXglZIPfHIowDs,812
10
- algokit_utils/config.py,sha256=oY3o1kPzVPRiQH--f4HzrMMNPojT078CSudqS9WQaEc,4279
11
- algokit_utils/deploy.py,sha256=BxIFPtZd1lO8o_JmQQDIKk0O93E_bE-ZzglEWXwbefw,35110
12
- algokit_utils/dispenser_api.py,sha256=BpwEhKDig6qz54wbO-htG8hmLxFIrvdzXpESUb7Y1zw,5584
13
- algokit_utils/logic_error.py,sha256=YeE70qHZ6WBeoKCXqnto3uBg8R4ODXiNZkLmfEmASQo,2617
14
- algokit_utils/models.py,sha256=iJUiV6eLq5N_FKki4X5ll5rYQslU_wSPiSTtl61Z1CI,12803
15
- algokit_utils/network_clients.py,sha256=sj5y_g5uclddWCEyUCptA-KjWuAtLV06hZH4QIGM1yE,5313
16
- algokit_utils/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
17
- algokit_utils-2.2.2b5.dist-info/LICENSE,sha256=J5i7U1Q9Q2c7saUzlvFRmrCCFhQyXb5Juz_LO5omNUw,1076
18
- algokit_utils-2.2.2b5.dist-info/METADATA,sha256=8mkuN9VkBEa_Z2oH1GmzccM-SH63NFZmlBsXxc5CHQ4,2207
19
- algokit_utils-2.2.2b5.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
20
- algokit_utils-2.2.2b5.dist-info/RECORD,,