algokit-utils 3.0.0b2__py3-none-any.whl → 3.0.0b3__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.

@@ -222,7 +222,7 @@ class AccountManager:
222
222
 
223
223
  :example:
224
224
  >>> account_manager = AccountManager(client_manager)
225
- >>> account_manager.set_signer_from_account(SigningAccount.new_account())
225
+ >>> account_manager.set_signer_from_account(SigningAccount(private_key=algosdk.account.generate_account()[0]))
226
226
  >>> account_manager.set_signer_from_account(LogicSigAccount(AlgosdkLogicSigAccount(program, args)))
227
227
  >>> account_manager.set_signer_from_account(MultiSigAccount(multisig_params, [account1, account2]))
228
228
  """
@@ -449,8 +449,8 @@ class AccountManager:
449
449
  :example:
450
450
  >>> account = account_manager.random()
451
451
  """
452
- account = SigningAccount.new_account()
453
- return self._register_account(account.private_key)
452
+ private_key, _ = algosdk.account.generate_account()
453
+ return self._register_account(private_key)
454
454
 
455
455
  def localnet_dispenser(self) -> SigningAccount:
456
456
  """
@@ -1,6 +1,6 @@
1
1
  import warnings
2
2
 
3
- from deprecated import deprecated
3
+ from typing_extensions import deprecated
4
4
 
5
5
  warnings.warn(
6
6
  """The legacy v2 application_specification module is deprecated and will be removed in a future version.
@@ -5,7 +5,7 @@ import copy
5
5
  import json
6
6
  import os
7
7
  from collections.abc import Sequence
8
- from dataclasses import dataclass, fields
8
+ from dataclasses import asdict, dataclass, fields
9
9
  from typing import TYPE_CHECKING, Any, Generic, Literal, TypedDict, TypeVar
10
10
 
11
11
  import algosdk
@@ -799,14 +799,12 @@ class _MethodParamsBuilder:
799
799
  :param compilation_params: Parameters for the compilation, defaults to None
800
800
  :return: Parameters for updating the application
801
801
  """
802
- compile_params = (
802
+ compile_params = asdict(
803
803
  self._client.compile(
804
804
  app_spec=self._client.app_spec,
805
805
  app_manager=self._algorand.app,
806
806
  compilation_params=compilation_params,
807
- ).__dict__
808
- if compilation_params
809
- else {}
807
+ )
810
808
  )
811
809
 
812
810
  input_params = {
@@ -5,6 +5,7 @@ import algosdk.atomic_transaction_composer
5
5
  from algosdk.atomic_transaction_composer import AccountTransactionSigner, LogicSigTransactionSigner, TransactionSigner
6
6
  from algosdk.transaction import LogicSigAccount as AlgosdkLogicSigAccount
7
7
  from algosdk.transaction import Multisig, MultisigTransaction
8
+ from typing_extensions import deprecated
8
9
 
9
10
  __all__ = [
10
11
  "DISPENSER_ACCOUNT_NAME",
@@ -66,6 +67,9 @@ class SigningAccount:
66
67
  """
67
68
  return AccountTransactionSigner(self.private_key)
68
69
 
70
+ @deprecated(
71
+ "Use `algorand.account.random()` or `SigningAccount(private_key=algosdk.account.generate_account()[0])` instead"
72
+ )
69
73
  @staticmethod
70
74
  def new_account() -> "SigningAccount":
71
75
  """Create a new random account.
@@ -2,7 +2,6 @@ from __future__ import annotations
2
2
 
3
3
  import base64
4
4
  import json
5
- import math
6
5
  import re
7
6
  from copy import deepcopy
8
7
  from dataclasses import dataclass
@@ -796,6 +795,12 @@ def _find_available_transaction_index(
796
795
  return next((i for i, txn in enumerate(txns) if check_transaction(txn)), -1)
797
796
 
798
797
 
798
+ def _num_extra_program_pages(approval: bytes | None, clear: bytes | None) -> int:
799
+ """Calculate minimum number of extra_pages required for provided approval and clear programs"""
800
+ total = len(approval or b"") + len(clear or b"")
801
+ return max(0, (total - 1) // algosdk.constants.APP_PAGE_MAX_SIZE)
802
+
803
+
799
804
  def populate_app_call_resources(atc: AtomicTransactionComposer, algod: AlgodClient) -> AtomicTransactionComposer:
800
805
  """Populate application call resources based on simulation results.
801
806
 
@@ -1975,12 +1980,7 @@ class TransactionComposer:
1975
1980
  if app_id == 0:
1976
1981
  extra_pages = getattr(params, "extra_program_pages", None)
1977
1982
  if extra_pages is None and approval_program is not None:
1978
- approval_len, clear_len = len(approval_program), len(clear_program or b"")
1979
- extra_pages = (
1980
- int(math.floor((approval_len + clear_len) / algosdk.constants.APP_PAGE_MAX_SIZE))
1981
- if approval_len
1982
- else 0
1983
- )
1983
+ extra_pages = _num_extra_program_pages(approval_program, clear_program)
1984
1984
 
1985
1985
  txn_params = {
1986
1986
  "app_id": app_id,
@@ -2085,9 +2085,6 @@ class TransactionComposer:
2085
2085
  elif isinstance(params.clear_state_program, bytes):
2086
2086
  clear_program = params.clear_state_program
2087
2087
 
2088
- approval_program_len = len(approval_program) if approval_program else 0
2089
- clear_program_len = len(clear_program) if clear_program else 0
2090
-
2091
2088
  sdk_params = {
2092
2089
  "sender": params.sender,
2093
2090
  "sp": suggested_params,
@@ -2120,10 +2117,7 @@ class TransactionComposer:
2120
2117
  num_uints=params.schema.get("local_ints", 0),
2121
2118
  num_byte_slices=params.schema.get("local_byte_slices", 0),
2122
2119
  ),
2123
- "extra_pages": params.extra_program_pages
2124
- or math.floor((approval_program_len + clear_program_len) / algosdk.constants.APP_PAGE_MAX_SIZE)
2125
- if params.extra_program_pages
2126
- else 0,
2120
+ "extra_pages": params.extra_program_pages or _num_extra_program_pages(approval_program, clear_program),
2127
2121
  }
2128
2122
 
2129
2123
  return self._common_txn_build_step(lambda x: algosdk.transaction.ApplicationCallTxn(**x), params, txn_params)
@@ -245,12 +245,12 @@ class AlgorandClientTransactionSender:
245
245
  compiled_approval = (
246
246
  self._app_manager.get_compilation_result(params.approval_program)
247
247
  if isinstance(params.approval_program, str)
248
- else None
248
+ else params.approval_program
249
249
  )
250
250
  compiled_clear = (
251
251
  self._app_manager.get_compilation_result(params.clear_state_program)
252
252
  if isinstance(params.clear_state_program, str)
253
- else None
253
+ else params.clear_state_program
254
254
  )
255
255
 
256
256
  return SendAppUpdateTransactionResult[ABIReturn](
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: algokit-utils
3
- Version: 3.0.0b2
3
+ Version: 3.0.0b3
4
4
  Summary: Utilities for Algorand development for use by AlgoKit
5
5
  License: MIT
6
6
  Author: Algorand Foundation
@@ -28,7 +28,7 @@ Largely these functions wrap the underlying Algorand SDK, but provide a higher l
28
28
  > **Note**
29
29
  > If you prefer TypeScript there's an equivalent [TypeScript utility library](https://github.com/algorandfoundation/algokit-utils-ts).
30
30
 
31
- [Install](https://github.com/algorandfoundation/algokit-utils-py#install) | [Documentation](https://algorandfoundation.github.io/algokit-utils-py/html/index.html)
31
+ [Install](https://github.com/algorandfoundation/algokit-utils-py#install) | [Documentation](https://algorandfoundation.github.io/algokit-utils-py)
32
32
 
33
33
  ## Install
34
34
 
@@ -14,14 +14,14 @@ algokit_utils/_legacy_v2/models.py,sha256=hH7aO50E4po4EgxXI9zdX5HTthn1HLfSLvkuPf
14
14
  algokit_utils/_legacy_v2/network_clients.py,sha256=5nqC-47hreWvMxR-PQWs_QP44wJDAGhtS1MQv8JQ82o,5660
15
15
  algokit_utils/account.py,sha256=gyGrBSoafUh8WV677IzYGkYoxtzzElsgxGMp4SgA4pk,410
16
16
  algokit_utils/accounts/__init__.py,sha256=_LyY0se6TaQOes7vAcmbpt6pmG4VKlzfTt37-IjwimA,138
17
- algokit_utils/accounts/account_manager.py,sha256=flONKOB2CbHUIOwtfcuJ_wNdDLW97-uE83teJHsCAGY,39319
17
+ algokit_utils/accounts/account_manager.py,sha256=KWJWX_4rFWhMcK54x7-k6ooI5BNLQGWjM2kXwMbh1eg,39361
18
18
  algokit_utils/accounts/kmd_account_manager.py,sha256=7HF2eKYULu6TAXSSXrSGZG7i6VuIEMyf6Ppmo5hE3EI,6342
19
19
  algokit_utils/algorand.py,sha256=Gtx3vspZmSxUrNWmh09NFQB24G4v4CEogYuRX_9o5Xw,10554
20
20
  algokit_utils/application_client.py,sha256=5UIxXIBjukjRyjZPCeXmaNlAftbb3TziV7EfBolW79k,337
21
- algokit_utils/application_specification.py,sha256=ACncbJVfXYd67M9rWkIJVXf-7Et-jLUpv2uESRraksM,1409
21
+ algokit_utils/application_specification.py,sha256=-ZM13Qv-AcLmwudJCq8xGPoWLvAvKBICgAdHeFozKbY,1416
22
22
  algokit_utils/applications/__init__.py,sha256=NGjhpBeExsQZOAYCT2QUFag1xuKoFiX-Ux5SR2GNzd8,452
23
23
  algokit_utils/applications/abi.py,sha256=ZwiLuFXx2EwWJ_cOEvNWCzt5onoasm-QmQPv9N7d49g,10087
24
- algokit_utils/applications/app_client.py,sha256=WUdLu-aV4TUTd4R8y4RAi8EcP811rfO4AsSTiUmhm64,86013
24
+ algokit_utils/applications/app_client.py,sha256=O6nuxT5iMasYzncyljieI34UcARnTIRuHKCvxudaSyo,85964
25
25
  algokit_utils/applications/app_deployer.py,sha256=RrSmIsbN84z0lNtGD8JP2FwkDmsAD_HvF8b4kHnCSmo,23099
26
26
  algokit_utils/applications/app_factory.py,sha256=yLe5TAss_r4JjE06rdtU7y2dmR9GrMh7JWG8ggApD-k,33605
27
27
  algokit_utils/applications/app_manager.py,sha256=EA1uRtmvPVAdKi1I5HSCpHjIDgLN7eZcEPT0Cj3C7fU,17661
@@ -48,7 +48,7 @@ algokit_utils/errors/__init__.py,sha256=CmuiLVjzMAOYxPaIIwmYCNArsso_RtS2ssFoNdp5
48
48
  algokit_utils/errors/logic_error.py,sha256=uxqUOU9-D1R5TrKturCbmmWRVlB024Ca4CfVi8x_sgo,4104
49
49
  algokit_utils/logic_error.py,sha256=3duw-l6tBr-DeapO0e0tYHoa9rOxP-QZZ6QWmN8L9tc,305
50
50
  algokit_utils/models/__init__.py,sha256=0aB_c5pnkqKl1Z0hkxM9qbKn2qVdizZE2DvziN9ObqM,465
51
- algokit_utils/models/account.py,sha256=ruzbbGRL5L7LiFHBnlNMzJVDrJUwTMFq7IYhjk5oaQo,5829
51
+ algokit_utils/models/account.py,sha256=TdeKjhYkppD8g0DYRGbnCsi8zfPz3zU74DaZte_CYJw,6014
52
52
  algokit_utils/models/amount.py,sha256=s9_2BCI5BOI_k9dnjNZZ0mNLwOOjlQyuTW4qgHUnTKI,7627
53
53
  algokit_utils/models/application.py,sha256=lM2_g5kZ18k_zyVzcbGvkvqHzksfb2sgRqowJ3pvUgo,1288
54
54
  algokit_utils/models/network.py,sha256=Qe631nHpLgjtGcwqWTc6D4Gk_5Fc_dutxD-bCTsb-xw,723
@@ -61,10 +61,10 @@ algokit_utils/protocols/account.py,sha256=CowaVY7ErBP84TWBHNvBjkZy18whPb8HIlMZtJ
61
61
  algokit_utils/protocols/typed_clients.py,sha256=UrQrHbN2SvS8pEFJ8JQodvouoWeBrQOQGZGyBQx1KLM,3322
62
62
  algokit_utils/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
63
63
  algokit_utils/transactions/__init__.py,sha256=7fYF3m6DyOGzbV36MT5svo0wSkj9AIz496kWgIWSAlk,225
64
- algokit_utils/transactions/transaction_composer.py,sha256=1JRtoDSRZw2lEzsTafnJE7SKAfrY0FffLa_nVWXZ8EU,94989
64
+ algokit_utils/transactions/transaction_composer.py,sha256=yGLFgJk51BKgnwbGYmmuDIE7WPpZZmHqVAVZ7IWcRDQ,94794
65
65
  algokit_utils/transactions/transaction_creator.py,sha256=A1YHeGC2EkR2V0HPYJiXVOAEIrfjBW2KVyYgi3exm4E,6167
66
- algokit_utils/transactions/transaction_sender.py,sha256=83U9AuSkgQBCcyjLsyfYDi41VKVUHuC50_5UFWA5RFg,22728
67
- algokit_utils-3.0.0b2.dist-info/LICENSE,sha256=J5i7U1Q9Q2c7saUzlvFRmrCCFhQyXb5Juz_LO5omNUw,1076
68
- algokit_utils-3.0.0b2.dist-info/METADATA,sha256=2t6xOjJWexi71XknD5JtF8S5Y8BYABzNGKs82R6D22Q,2432
69
- algokit_utils-3.0.0b2.dist-info/WHEEL,sha256=IYZQI976HJqqOpQU6PHkJ8fb3tMNBFjg-Cn-pwAbaFM,88
70
- algokit_utils-3.0.0b2.dist-info/RECORD,,
66
+ algokit_utils/transactions/transaction_sender.py,sha256=uQmHElJgUIxLXfdklMNoabjQQzUku8CFP82wwhfr44E,22769
67
+ algokit_utils-3.0.0b3.dist-info/LICENSE,sha256=J5i7U1Q9Q2c7saUzlvFRmrCCFhQyXb5Juz_LO5omNUw,1076
68
+ algokit_utils-3.0.0b3.dist-info/METADATA,sha256=s6SYm28_fAjF_SD0UtYwyfMdttrg7qvOmwKoTkYpKdw,2416
69
+ algokit_utils-3.0.0b3.dist-info/WHEEL,sha256=IYZQI976HJqqOpQU6PHkJ8fb3tMNBFjg-Cn-pwAbaFM,88
70
+ algokit_utils-3.0.0b3.dist-info/RECORD,,