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

Files changed (70) hide show
  1. algokit_utils/__init__.py +23 -183
  2. algokit_utils/_debugging.py +123 -97
  3. algokit_utils/_legacy_v2/__init__.py +177 -0
  4. algokit_utils/{_ensure_funded.py → _legacy_v2/_ensure_funded.py} +19 -18
  5. algokit_utils/{_transfer.py → _legacy_v2/_transfer.py} +24 -23
  6. algokit_utils/_legacy_v2/account.py +203 -0
  7. algokit_utils/_legacy_v2/application_client.py +1471 -0
  8. algokit_utils/_legacy_v2/application_specification.py +21 -0
  9. algokit_utils/_legacy_v2/asset.py +168 -0
  10. algokit_utils/_legacy_v2/common.py +28 -0
  11. algokit_utils/_legacy_v2/deploy.py +822 -0
  12. algokit_utils/_legacy_v2/logic_error.py +14 -0
  13. algokit_utils/{models.py → _legacy_v2/models.py} +19 -142
  14. algokit_utils/_legacy_v2/network_clients.py +140 -0
  15. algokit_utils/account.py +12 -183
  16. algokit_utils/accounts/__init__.py +2 -0
  17. algokit_utils/accounts/account_manager.py +909 -0
  18. algokit_utils/accounts/kmd_account_manager.py +159 -0
  19. algokit_utils/algorand.py +265 -0
  20. algokit_utils/application_client.py +9 -1453
  21. algokit_utils/application_specification.py +39 -197
  22. algokit_utils/applications/__init__.py +7 -0
  23. algokit_utils/applications/abi.py +276 -0
  24. algokit_utils/applications/app_client.py +2056 -0
  25. algokit_utils/applications/app_deployer.py +600 -0
  26. algokit_utils/applications/app_factory.py +826 -0
  27. algokit_utils/applications/app_manager.py +470 -0
  28. algokit_utils/applications/app_spec/__init__.py +2 -0
  29. algokit_utils/applications/app_spec/arc32.py +207 -0
  30. algokit_utils/applications/app_spec/arc56.py +1023 -0
  31. algokit_utils/applications/enums.py +40 -0
  32. algokit_utils/asset.py +32 -168
  33. algokit_utils/assets/__init__.py +1 -0
  34. algokit_utils/assets/asset_manager.py +320 -0
  35. algokit_utils/beta/_utils.py +36 -0
  36. algokit_utils/beta/account_manager.py +4 -195
  37. algokit_utils/beta/algorand_client.py +4 -314
  38. algokit_utils/beta/client_manager.py +5 -74
  39. algokit_utils/beta/composer.py +5 -712
  40. algokit_utils/clients/__init__.py +2 -0
  41. algokit_utils/clients/client_manager.py +656 -0
  42. algokit_utils/clients/dispenser_api_client.py +192 -0
  43. algokit_utils/common.py +8 -26
  44. algokit_utils/config.py +71 -18
  45. algokit_utils/deploy.py +7 -892
  46. algokit_utils/dispenser_api.py +8 -176
  47. algokit_utils/errors/__init__.py +1 -0
  48. algokit_utils/errors/logic_error.py +121 -0
  49. algokit_utils/logic_error.py +7 -80
  50. algokit_utils/models/__init__.py +8 -0
  51. algokit_utils/models/account.py +193 -0
  52. algokit_utils/models/amount.py +198 -0
  53. algokit_utils/models/application.py +61 -0
  54. algokit_utils/models/network.py +25 -0
  55. algokit_utils/models/simulate.py +11 -0
  56. algokit_utils/models/state.py +59 -0
  57. algokit_utils/models/transaction.py +100 -0
  58. algokit_utils/network_clients.py +7 -152
  59. algokit_utils/protocols/__init__.py +2 -0
  60. algokit_utils/protocols/account.py +22 -0
  61. algokit_utils/protocols/typed_clients.py +108 -0
  62. algokit_utils/transactions/__init__.py +3 -0
  63. algokit_utils/transactions/transaction_composer.py +2293 -0
  64. algokit_utils/transactions/transaction_creator.py +156 -0
  65. algokit_utils/transactions/transaction_sender.py +574 -0
  66. {algokit_utils-3.0.0b1.dist-info → algokit_utils-3.0.0b2.dist-info}/METADATA +12 -7
  67. algokit_utils-3.0.0b2.dist-info/RECORD +70 -0
  68. {algokit_utils-3.0.0b1.dist-info → algokit_utils-3.0.0b2.dist-info}/WHEEL +1 -1
  69. algokit_utils-3.0.0b1.dist-info/RECORD +0 -24
  70. {algokit_utils-3.0.0b1.dist-info → algokit_utils-3.0.0b2.dist-info}/LICENSE +0 -0
@@ -0,0 +1,156 @@
1
+ from collections.abc import Callable
2
+ from typing import TypeVar
3
+
4
+ from algosdk.transaction import Transaction
5
+
6
+ from algokit_utils.transactions.transaction_composer import (
7
+ AppCallMethodCallParams,
8
+ AppCallParams,
9
+ AppCreateMethodCallParams,
10
+ AppCreateParams,
11
+ AppDeleteMethodCallParams,
12
+ AppDeleteParams,
13
+ AppUpdateMethodCallParams,
14
+ AppUpdateParams,
15
+ AssetConfigParams,
16
+ AssetCreateParams,
17
+ AssetDestroyParams,
18
+ AssetFreezeParams,
19
+ AssetOptInParams,
20
+ AssetOptOutParams,
21
+ AssetTransferParams,
22
+ BuiltTransactions,
23
+ OfflineKeyRegistrationParams,
24
+ OnlineKeyRegistrationParams,
25
+ PaymentParams,
26
+ TransactionComposer,
27
+ )
28
+
29
+ __all__ = [
30
+ "AlgorandClientTransactionCreator",
31
+ ]
32
+
33
+ TxnParam = TypeVar("TxnParam")
34
+ TxnResult = TypeVar("TxnResult")
35
+
36
+
37
+ class AlgorandClientTransactionCreator:
38
+ """A creator for Algorand transactions.
39
+
40
+ Provides methods to create various types of Algorand transactions including payments,
41
+ asset operations, application calls and key registrations.
42
+
43
+ :param new_group: A lambda that starts a new TransactionComposer transaction group
44
+ """
45
+
46
+ def __init__(self, new_group: Callable[[], TransactionComposer]) -> None:
47
+ self._new_group = new_group
48
+
49
+ def _transaction(
50
+ self, c: Callable[[TransactionComposer], Callable[[TxnParam], TransactionComposer]]
51
+ ) -> Callable[[TxnParam], Transaction]:
52
+ def create_transaction(params: TxnParam) -> Transaction:
53
+ composer = self._new_group()
54
+ result = c(composer)(params).build_transactions()
55
+ return result.transactions[-1]
56
+
57
+ return create_transaction
58
+
59
+ def _transactions(
60
+ self, c: Callable[[TransactionComposer], Callable[[TxnParam], TransactionComposer]]
61
+ ) -> Callable[[TxnParam], BuiltTransactions]:
62
+ def create_transactions(params: TxnParam) -> BuiltTransactions:
63
+ composer = self._new_group()
64
+ return c(composer)(params).build_transactions()
65
+
66
+ return create_transactions
67
+
68
+ @property
69
+ def payment(self) -> Callable[[PaymentParams], Transaction]:
70
+ """Create a payment transaction to transfer Algo between accounts."""
71
+ return self._transaction(lambda c: c.add_payment)
72
+
73
+ @property
74
+ def asset_create(self) -> Callable[[AssetCreateParams], Transaction]:
75
+ """Create a create Algorand Standard Asset transaction."""
76
+ return self._transaction(lambda c: c.add_asset_create)
77
+
78
+ @property
79
+ def asset_config(self) -> Callable[[AssetConfigParams], Transaction]:
80
+ """Create an asset config transaction to reconfigure an existing Algorand Standard Asset."""
81
+ return self._transaction(lambda c: c.add_asset_config)
82
+
83
+ @property
84
+ def asset_freeze(self) -> Callable[[AssetFreezeParams], Transaction]:
85
+ """Create an Algorand Standard Asset freeze transaction."""
86
+ return self._transaction(lambda c: c.add_asset_freeze)
87
+
88
+ @property
89
+ def asset_destroy(self) -> Callable[[AssetDestroyParams], Transaction]:
90
+ """Create an Algorand Standard Asset destroy transaction."""
91
+ return self._transaction(lambda c: c.add_asset_destroy)
92
+
93
+ @property
94
+ def asset_transfer(self) -> Callable[[AssetTransferParams], Transaction]:
95
+ """Create an Algorand Standard Asset transfer transaction."""
96
+ return self._transaction(lambda c: c.add_asset_transfer)
97
+
98
+ @property
99
+ def asset_opt_in(self) -> Callable[[AssetOptInParams], Transaction]:
100
+ """Create an Algorand Standard Asset opt-in transaction."""
101
+ return self._transaction(lambda c: c.add_asset_opt_in)
102
+
103
+ @property
104
+ def asset_opt_out(self) -> Callable[[AssetOptOutParams], Transaction]:
105
+ """Create an asset opt-out transaction."""
106
+ return self._transaction(lambda c: c.add_asset_opt_out)
107
+
108
+ @property
109
+ def app_create(self) -> Callable[[AppCreateParams], Transaction]:
110
+ """Create an application create transaction."""
111
+ return self._transaction(lambda c: c.add_app_create)
112
+
113
+ @property
114
+ def app_update(self) -> Callable[[AppUpdateParams], Transaction]:
115
+ """Create an application update transaction."""
116
+ return self._transaction(lambda c: c.add_app_update)
117
+
118
+ @property
119
+ def app_delete(self) -> Callable[[AppDeleteParams], Transaction]:
120
+ """Create an application delete transaction."""
121
+ return self._transaction(lambda c: c.add_app_delete)
122
+
123
+ @property
124
+ def app_call(self) -> Callable[[AppCallParams], Transaction]:
125
+ """Create an application call transaction."""
126
+ return self._transaction(lambda c: c.add_app_call)
127
+
128
+ @property
129
+ def app_create_method_call(self) -> Callable[[AppCreateMethodCallParams], BuiltTransactions]:
130
+ """Create an application create call with ABI method call transaction."""
131
+ return self._transactions(lambda c: c.add_app_create_method_call)
132
+
133
+ @property
134
+ def app_update_method_call(self) -> Callable[[AppUpdateMethodCallParams], BuiltTransactions]:
135
+ """Create an application update call with ABI method call transaction."""
136
+ return self._transactions(lambda c: c.add_app_update_method_call)
137
+
138
+ @property
139
+ def app_delete_method_call(self) -> Callable[[AppDeleteMethodCallParams], BuiltTransactions]:
140
+ """Create an application delete call with ABI method call transaction."""
141
+ return self._transactions(lambda c: c.add_app_delete_method_call)
142
+
143
+ @property
144
+ def app_call_method_call(self) -> Callable[[AppCallMethodCallParams], BuiltTransactions]:
145
+ """Create an application call with ABI method call transaction."""
146
+ return self._transactions(lambda c: c.add_app_call_method_call)
147
+
148
+ @property
149
+ def online_key_registration(self) -> Callable[[OnlineKeyRegistrationParams], Transaction]:
150
+ """Create an online key registration transaction."""
151
+ return self._transaction(lambda c: c.add_online_key_registration)
152
+
153
+ @property
154
+ def offline_key_registration(self) -> Callable[[OfflineKeyRegistrationParams], Transaction]:
155
+ """Create an offline key registration transaction."""
156
+ return self._transaction(lambda c: c.add_offline_key_registration)