algokit-utils 1.2.0b8__py3-none-any.whl → 1.3.0b1__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 CHANGED
@@ -83,6 +83,8 @@ from algokit_utils.network_clients import (
83
83
  get_kmd_client_from_algod_client,
84
84
  get_purestake_config,
85
85
  is_localnet,
86
+ is_mainnet,
87
+ is_testnet,
86
88
  )
87
89
 
88
90
  __all__ = [
@@ -155,6 +157,8 @@ __all__ = [
155
157
  "get_kmd_client_from_algod_client",
156
158
  "get_purestake_config",
157
159
  "is_localnet",
160
+ "is_mainnet",
161
+ "is_testnet",
158
162
  "EnsureBalanceParameters",
159
163
  "TransferParameters",
160
164
  "ensure_funded",
algokit_utils/deploy.py CHANGED
@@ -489,7 +489,8 @@ class OnUpdate(Enum):
489
489
  """Update the Application with the new approval and clear programs"""
490
490
  ReplaceApp = 2
491
491
  """Create a new Application and delete the old Application in a single transaction"""
492
- # TODO: AppendApp
492
+ AppendApp = 3
493
+ """Create a new application"""
493
494
 
494
495
 
495
496
  class OnSchemaBreak(Enum):
@@ -499,6 +500,8 @@ class OnSchemaBreak(Enum):
499
500
  """Fail the deployment"""
500
501
  ReplaceApp = 2
501
502
  """Create a new Application and delete the old Application in a single transaction"""
503
+ AppendApp = 3
504
+ """Create a new Application"""
502
505
 
503
506
 
504
507
  class OperationPerformed(Enum):
@@ -657,6 +660,10 @@ class Deployer:
657
660
  "If you want to try deleting and recreating the app then "
658
661
  "re-run with on_schema_break=OnSchemaBreak.ReplaceApp"
659
662
  )
663
+ if self.on_schema_break == OnSchemaBreak.AppendApp:
664
+ logger.info("Schema break detected and on_schema_break=AppendApp, will attempt to create new app")
665
+ return self._create_app()
666
+
660
667
  if self.existing_app_metadata_or_reference.deletable:
661
668
  logger.info(
662
669
  "App is deletable and on_schema_break=ReplaceApp, will attempt to create new app and delete old app"
@@ -679,7 +686,10 @@ class Deployer:
679
686
  "Update detected and on_update=Fail, stopping deployment. "
680
687
  "If you want to try updating the app then re-run with on_update=UpdateApp"
681
688
  )
682
- if self.existing_app_metadata_or_reference.updatable and self.on_update == OnUpdate.UpdateApp:
689
+ if self.on_update == OnUpdate.AppendApp:
690
+ logger.info("Update detected and on_update=AppendApp, will attempt to create new app")
691
+ return self._create_app()
692
+ elif self.existing_app_metadata_or_reference.updatable and self.on_update == OnUpdate.UpdateApp:
683
693
  logger.info("App is updatable and on_update=UpdateApp, will update app")
684
694
  return self._update_app()
685
695
  elif self.existing_app_metadata_or_reference.updatable and self.on_update == OnUpdate.ReplaceApp:
algokit_utils/models.py CHANGED
@@ -2,6 +2,7 @@ import dataclasses
2
2
  from collections.abc import Sequence
3
3
  from typing import Any, Generic, Protocol, TypeAlias, TypedDict, TypeVar
4
4
 
5
+ import algosdk.account
5
6
  from algosdk import transaction
6
7
  from algosdk.abi import Method
7
8
  from algosdk.atomic_transaction_composer import (
@@ -21,9 +22,13 @@ class Account:
21
22
 
22
23
  private_key: str
23
24
  """Base64 encoded private key"""
24
- address: str
25
+ address: str = dataclasses.field(default="")
25
26
  """Address for this account"""
26
27
 
28
+ def __post_init__(self) -> None:
29
+ if not self.address:
30
+ self.address = algosdk.account.address_from_private_key(self.private_key) # type: ignore[no-untyped-call]
31
+
27
32
  @property
28
33
  def public_key(self) -> bytes:
29
34
  """The public key for this account"""
@@ -36,6 +41,11 @@ class Account:
36
41
  """An AccountTransactionSigner for this account"""
37
42
  return AccountTransactionSigner(self.private_key)
38
43
 
44
+ @staticmethod
45
+ def new_account() -> "Account":
46
+ private_key, address = algosdk.account.generate_account() # type: ignore[no-untyped-call]
47
+ return Account(private_key=private_key)
48
+
39
49
 
40
50
  @dataclasses.dataclass(kw_only=True)
41
51
  class TransactionResponse:
@@ -16,6 +16,8 @@ __all__ = [
16
16
  "get_kmd_client_from_algod_client",
17
17
  "get_purestake_config",
18
18
  "is_localnet",
19
+ "is_mainnet",
20
+ "is_testnet",
19
21
  ]
20
22
 
21
23
  _PURE_STAKE_HOST = "purestake.io"
@@ -82,6 +84,18 @@ def is_localnet(client: AlgodClient) -> bool:
82
84
  return params.gen in ["devnet-v1", "sandnet-v1", "dockernet-v1"]
83
85
 
84
86
 
87
+ def is_mainnet(client: AlgodClient) -> bool:
88
+ """Returns True if client genesis is `mainnet-v1`"""
89
+ params = client.suggested_params()
90
+ return bool(params.gen == "mainnet-v1")
91
+
92
+
93
+ def is_testnet(client: AlgodClient) -> bool:
94
+ """Returns True if client genesis is `testnet-v1`"""
95
+ params = client.suggested_params()
96
+ return bool(params.gen == "testnet-v1")
97
+
98
+
85
99
  def get_kmd_client_from_algod_client(client: AlgodClient) -> KMDClient:
86
100
  """Returns an {py:class}`algosdk.kmd.KMDClient` from supplied `client`
87
101
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: algokit-utils
3
- Version: 1.2.0b8
3
+ Version: 1.3.0b1
4
4
  Summary: Utilities for Algorand development for use by AlgoKit
5
5
  License: MIT
6
6
  Author: Algorand Foundation
@@ -1,16 +1,16 @@
1
- algokit_utils/__init__.py,sha256=wuh-p9PubCj9Bj2tpxP3tQ5qZPs_nUHzB16BHi9Aq2c,4091
1
+ algokit_utils/__init__.py,sha256=Ko-gEPeER-Ho8lRU_a6k5SsV3mTfZa6CP1I9dmZjQvk,4159
2
2
  algokit_utils/_ensure_funded.py,sha256=DjwGnCC_6USLQV5wIMJZRVQFlQ1uLrGDMxRF471atsQ,4410
3
3
  algokit_utils/_simulate_315_compat.py,sha256=9qCsNnKa1FXYfCccMFiE0mGEcZJiBuPmUy7ZRvvUSqU,2841
4
4
  algokit_utils/_transfer.py,sha256=K8TMoaFcZE74xZ1rhp1De0Ri4mg8vs8pu-iJLOa5WoE,3569
5
5
  algokit_utils/account.py,sha256=UIuOQZe28pQxjEP9TzhtYlOU20tUdzzS-nIIZM9Bp6Y,7364
6
6
  algokit_utils/application_client.py,sha256=k3eTyhY3zyfpajHffo1uJ2u1C0vlYPmdALl5jmgH1WM,56488
7
7
  algokit_utils/application_specification.py,sha256=XusOe7VrGPun2UoNspC9Ei202NzPkxRNx5USXiABuXc,7466
8
- algokit_utils/deploy.py,sha256=UmVlJ-0vo91EjPXRC1EjkFBh5frJ0R4nCnlyZABhcRg,34168
8
+ algokit_utils/deploy.py,sha256=sY6u0T39DuF6oLpal0eJAc76EmjPWdoCPk2OSKGccnM,34650
9
9
  algokit_utils/logic_error.py,sha256=8O_4rJ1t57JEG81ucRNih2ojc1-EOm2fVxW6m-1ZXI8,2550
10
- algokit_utils/models.py,sha256=1IXNhibqtZ7cmuH31mLvNLcpJzaMl9lOD0EqsTPyglU,5876
11
- algokit_utils/network_clients.py,sha256=dq8yyTLKtyb9yG3tsXV-eZLF3iqMaFWs9kNWm1V4CdU,4857
10
+ algokit_utils/models.py,sha256=75tWWa3W-37Om3YgkcuKiuHAGzMkFIJ9U-eHO29RPi4,6319
11
+ algokit_utils/network_clients.py,sha256=KmuSHG2kSdJfo9W4pIB_4RjnBL2yMQNGlF54lxXTnsQ,5267
12
12
  algokit_utils/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
13
- algokit_utils-1.2.0b8.dist-info/LICENSE,sha256=J5i7U1Q9Q2c7saUzlvFRmrCCFhQyXb5Juz_LO5omNUw,1076
14
- algokit_utils-1.2.0b8.dist-info/METADATA,sha256=VjqC24FemTAouDXAwiChHgbjLRMXO89jHtN0uJLSHls,2072
15
- algokit_utils-1.2.0b8.dist-info/WHEEL,sha256=WGfLGfLX43Ei_YORXSnT54hxFygu34kMpcQdmgmEwCQ,88
16
- algokit_utils-1.2.0b8.dist-info/RECORD,,
13
+ algokit_utils-1.3.0b1.dist-info/LICENSE,sha256=J5i7U1Q9Q2c7saUzlvFRmrCCFhQyXb5Juz_LO5omNUw,1076
14
+ algokit_utils-1.3.0b1.dist-info/METADATA,sha256=75vQhThgjoQUr2xDl-t--FnVEl9bHz7kAs7LS4jVwns,2072
15
+ algokit_utils-1.3.0b1.dist-info/WHEEL,sha256=Zb28QaM1gQi8f4VCBhsUklF61CTlNYfs9YAZn-TOGFk,88
16
+ algokit_utils-1.3.0b1.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: poetry-core 1.6.0
2
+ Generator: poetry-core 1.6.1
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any