algokit-utils 2.4.0__py3-none-any.whl → 3.0.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/__init__.py +23 -181
- algokit_utils/_debugging.py +89 -45
- algokit_utils/_legacy_v2/__init__.py +177 -0
- algokit_utils/{_ensure_funded.py → _legacy_v2/_ensure_funded.py} +21 -24
- algokit_utils/{_transfer.py → _legacy_v2/_transfer.py} +26 -23
- algokit_utils/_legacy_v2/account.py +203 -0
- algokit_utils/_legacy_v2/application_client.py +1472 -0
- algokit_utils/_legacy_v2/application_specification.py +21 -0
- algokit_utils/_legacy_v2/asset.py +168 -0
- algokit_utils/_legacy_v2/common.py +28 -0
- algokit_utils/_legacy_v2/deploy.py +822 -0
- algokit_utils/_legacy_v2/logic_error.py +14 -0
- algokit_utils/{models.py → _legacy_v2/models.py} +16 -45
- algokit_utils/_legacy_v2/network_clients.py +144 -0
- algokit_utils/account.py +12 -183
- algokit_utils/accounts/__init__.py +2 -0
- algokit_utils/accounts/account_manager.py +912 -0
- algokit_utils/accounts/kmd_account_manager.py +161 -0
- algokit_utils/algorand.py +359 -0
- algokit_utils/application_client.py +9 -1447
- algokit_utils/application_specification.py +39 -197
- algokit_utils/applications/__init__.py +7 -0
- algokit_utils/applications/abi.py +275 -0
- algokit_utils/applications/app_client.py +2108 -0
- algokit_utils/applications/app_deployer.py +725 -0
- algokit_utils/applications/app_factory.py +1134 -0
- algokit_utils/applications/app_manager.py +578 -0
- algokit_utils/applications/app_spec/__init__.py +2 -0
- algokit_utils/applications/app_spec/arc32.py +207 -0
- algokit_utils/applications/app_spec/arc56.py +989 -0
- algokit_utils/applications/enums.py +40 -0
- algokit_utils/asset.py +32 -168
- algokit_utils/assets/__init__.py +1 -0
- algokit_utils/assets/asset_manager.py +336 -0
- algokit_utils/beta/_utils.py +36 -0
- algokit_utils/beta/account_manager.py +4 -195
- algokit_utils/beta/algorand_client.py +4 -314
- algokit_utils/beta/client_manager.py +5 -74
- algokit_utils/beta/composer.py +5 -712
- algokit_utils/clients/__init__.py +2 -0
- algokit_utils/clients/client_manager.py +738 -0
- algokit_utils/clients/dispenser_api_client.py +224 -0
- algokit_utils/common.py +8 -26
- algokit_utils/config.py +76 -29
- algokit_utils/deploy.py +7 -894
- algokit_utils/dispenser_api.py +8 -176
- algokit_utils/errors/__init__.py +1 -0
- algokit_utils/errors/logic_error.py +121 -0
- algokit_utils/logic_error.py +7 -82
- algokit_utils/models/__init__.py +8 -0
- algokit_utils/models/account.py +217 -0
- algokit_utils/models/amount.py +200 -0
- algokit_utils/models/application.py +91 -0
- algokit_utils/models/network.py +29 -0
- algokit_utils/models/simulate.py +11 -0
- algokit_utils/models/state.py +68 -0
- algokit_utils/models/transaction.py +100 -0
- algokit_utils/network_clients.py +7 -128
- algokit_utils/protocols/__init__.py +2 -0
- algokit_utils/protocols/account.py +22 -0
- algokit_utils/protocols/typed_clients.py +108 -0
- algokit_utils/transactions/__init__.py +3 -0
- algokit_utils/transactions/transaction_composer.py +2499 -0
- algokit_utils/transactions/transaction_creator.py +688 -0
- algokit_utils/transactions/transaction_sender.py +1219 -0
- {algokit_utils-2.4.0.dist-info → algokit_utils-3.0.0.dist-info}/METADATA +11 -7
- algokit_utils-3.0.0.dist-info/RECORD +70 -0
- {algokit_utils-2.4.0.dist-info → algokit_utils-3.0.0.dist-info}/WHEEL +1 -1
- algokit_utils-2.4.0.dist-info/RECORD +0 -24
- {algokit_utils-2.4.0.dist-info → algokit_utils-3.0.0.dist-info}/LICENSE +0 -0
|
@@ -0,0 +1,688 @@
|
|
|
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
|
+
:example:
|
|
46
|
+
>>> creator = AlgorandClientTransactionCreator(lambda: TransactionComposer())
|
|
47
|
+
>>> creator.payment(PaymentParams(sender="sender", receiver="receiver", amount=AlgoAmount.from_algo(1)))
|
|
48
|
+
"""
|
|
49
|
+
|
|
50
|
+
def __init__(self, new_group: Callable[[], TransactionComposer]) -> None:
|
|
51
|
+
self._new_group = new_group
|
|
52
|
+
|
|
53
|
+
def _transaction(
|
|
54
|
+
self, c: Callable[[TransactionComposer], Callable[[TxnParam], TransactionComposer]]
|
|
55
|
+
) -> Callable[[TxnParam], Transaction]:
|
|
56
|
+
def create_transaction(params: TxnParam) -> Transaction:
|
|
57
|
+
composer = self._new_group()
|
|
58
|
+
result = c(composer)(params).build_transactions()
|
|
59
|
+
return result.transactions[-1]
|
|
60
|
+
|
|
61
|
+
return create_transaction
|
|
62
|
+
|
|
63
|
+
def _transactions(
|
|
64
|
+
self, c: Callable[[TransactionComposer], Callable[[TxnParam], TransactionComposer]]
|
|
65
|
+
) -> Callable[[TxnParam], BuiltTransactions]:
|
|
66
|
+
def create_transactions(params: TxnParam) -> BuiltTransactions:
|
|
67
|
+
composer = self._new_group()
|
|
68
|
+
return c(composer)(params).build_transactions()
|
|
69
|
+
|
|
70
|
+
return create_transactions
|
|
71
|
+
|
|
72
|
+
@property
|
|
73
|
+
def payment(self) -> Callable[[PaymentParams], Transaction]:
|
|
74
|
+
"""Create a payment transaction to transfer Algo between accounts.
|
|
75
|
+
|
|
76
|
+
:example:
|
|
77
|
+
>>> #Basic example
|
|
78
|
+
>>> creator = AlgorandClientTransactionCreator(lambda: TransactionComposer())
|
|
79
|
+
>>> creator.payment(PaymentParams(sender="sender", receiver="receiver", amount=AlgoAmount.from_algo(4)))
|
|
80
|
+
:example:
|
|
81
|
+
>>> #Advanced example
|
|
82
|
+
>>> creator.payment(PaymentParams(
|
|
83
|
+
sender="SENDERADDRESS",
|
|
84
|
+
receiver="RECEIVERADDRESS",
|
|
85
|
+
amount=AlgoAmount.from_algo(4),
|
|
86
|
+
close_remainder_to="CLOSEREMAINDERTOADDRESS",
|
|
87
|
+
lease="lease",
|
|
88
|
+
note=b"note",
|
|
89
|
+
rekey_to="REKEYTOADDRESS",
|
|
90
|
+
first_valid_round=1000,
|
|
91
|
+
validity_window=10,
|
|
92
|
+
extra_fee=AlgoAmount.from_micro_algo(1000),
|
|
93
|
+
static_fee=AlgoAmount.from_micro_algo(1000),
|
|
94
|
+
max_fee=AlgoAmount.from_micro_algo(3000)
|
|
95
|
+
))
|
|
96
|
+
"""
|
|
97
|
+
return self._transaction(lambda c: c.add_payment)
|
|
98
|
+
|
|
99
|
+
@property
|
|
100
|
+
def asset_create(self) -> Callable[[AssetCreateParams], Transaction]:
|
|
101
|
+
"""Create a create Algorand Standard Asset transaction.
|
|
102
|
+
|
|
103
|
+
:example:
|
|
104
|
+
>>> #Basic example
|
|
105
|
+
>>> creator = AlgorandClientTransactionCreator(lambda: TransactionComposer())
|
|
106
|
+
>>> params = AssetCreateParams(sender="SENDER_ADDRESS", total=1000)
|
|
107
|
+
>>> txn = creator.asset_create(params)
|
|
108
|
+
:example:
|
|
109
|
+
>>> #Advanced example
|
|
110
|
+
>>> creator.asset_create(AssetCreateParams(
|
|
111
|
+
sender="SENDER_ADDRESS",
|
|
112
|
+
total=1000,
|
|
113
|
+
asset_name="MyAsset",
|
|
114
|
+
unit_name="MA",
|
|
115
|
+
url="https://example.com/asset",
|
|
116
|
+
decimals=0,
|
|
117
|
+
default_frozen=False,
|
|
118
|
+
manager="MANAGER_ADDRESS",
|
|
119
|
+
reserve="RESERVE_ADDRESS",
|
|
120
|
+
freeze="FREEZE_ADDRESS",
|
|
121
|
+
clawback="CLAWBACK_ADDRESS",
|
|
122
|
+
lease="lease",
|
|
123
|
+
note=b"note",
|
|
124
|
+
rekey_to="REKEYTOADDRESS",
|
|
125
|
+
first_valid_round=1000,
|
|
126
|
+
validity_window=10,
|
|
127
|
+
extra_fee=AlgoAmount.from_micro_algo(1000),
|
|
128
|
+
static_fee=AlgoAmount.from_micro_algo(1000),
|
|
129
|
+
max_fee=AlgoAmount.from_micro_algo(3000)
|
|
130
|
+
))
|
|
131
|
+
"""
|
|
132
|
+
return self._transaction(lambda c: c.add_asset_create)
|
|
133
|
+
|
|
134
|
+
@property
|
|
135
|
+
def asset_config(self) -> Callable[[AssetConfigParams], Transaction]:
|
|
136
|
+
"""Create an asset config transaction to reconfigure an existing Algorand Standard Asset.
|
|
137
|
+
|
|
138
|
+
:example:
|
|
139
|
+
>>> #Basic example
|
|
140
|
+
>>> creator = AlgorandClientTransactionCreator(lambda: TransactionComposer())
|
|
141
|
+
>>> params = AssetConfigParams(sender="SENDER_ADDRESS", asset_id=123456, manager="NEW_MANAGER_ADDRESS")
|
|
142
|
+
>>> txn = creator.asset_config(params)
|
|
143
|
+
:example:
|
|
144
|
+
>>> #Advanced example
|
|
145
|
+
>>> creator.asset_config(AssetConfigParams(
|
|
146
|
+
sender="SENDER_ADDRESS",
|
|
147
|
+
asset_id=123456,
|
|
148
|
+
manager="NEW_MANAGER_ADDRESS",
|
|
149
|
+
reserve="NEW_RESERVE_ADDRESS",
|
|
150
|
+
freeze="NEW_FREEZE_ADDRESS",
|
|
151
|
+
clawback="NEW_CLAWBACK_ADDRESS",
|
|
152
|
+
lease="lease",
|
|
153
|
+
note=b"note",
|
|
154
|
+
rekey_to="REKEYTOADDRESS",
|
|
155
|
+
first_valid_round=1000,
|
|
156
|
+
validity_window=10,
|
|
157
|
+
extra_fee=AlgoAmount.from_micro_algo(1000),
|
|
158
|
+
static_fee=AlgoAmount.from_micro_algo(1000),
|
|
159
|
+
max_fee=AlgoAmount.from_micro_algo(3000)
|
|
160
|
+
))
|
|
161
|
+
"""
|
|
162
|
+
return self._transaction(lambda c: c.add_asset_config)
|
|
163
|
+
|
|
164
|
+
@property
|
|
165
|
+
def asset_freeze(self) -> Callable[[AssetFreezeParams], Transaction]:
|
|
166
|
+
"""Create an Algorand Standard Asset freeze transaction.
|
|
167
|
+
|
|
168
|
+
:example:
|
|
169
|
+
>>> #Basic example
|
|
170
|
+
>>> creator = AlgorandClientTransactionCreator(lambda: TransactionComposer())
|
|
171
|
+
>>> params = AssetFreezeParams(sender="SENDER_ADDRESS",
|
|
172
|
+
asset_id=123456,
|
|
173
|
+
account="ACCOUNT_TO_FREEZE",
|
|
174
|
+
frozen=True)
|
|
175
|
+
>>> txn = creator.asset_freeze(params)
|
|
176
|
+
|
|
177
|
+
:example:
|
|
178
|
+
>>> #Advanced example
|
|
179
|
+
>>> creator.asset_freeze(AssetFreezeParams(
|
|
180
|
+
sender="SENDER_ADDRESS",
|
|
181
|
+
asset_id=123456,
|
|
182
|
+
account="ACCOUNT_TO_FREEZE",
|
|
183
|
+
frozen=True,
|
|
184
|
+
lease="lease",
|
|
185
|
+
note=b"note",
|
|
186
|
+
rekey_to="REKEYTOADDRESS",
|
|
187
|
+
first_valid_round=1000,
|
|
188
|
+
validity_window=10,
|
|
189
|
+
extra_fee=AlgoAmount.from_micro_algo(1000),
|
|
190
|
+
static_fee=AlgoAmount.from_micro_algo(1000),
|
|
191
|
+
max_fee=AlgoAmount.from_micro_algo(3000)
|
|
192
|
+
))
|
|
193
|
+
"""
|
|
194
|
+
return self._transaction(lambda c: c.add_asset_freeze)
|
|
195
|
+
|
|
196
|
+
@property
|
|
197
|
+
def asset_destroy(self) -> Callable[[AssetDestroyParams], Transaction]:
|
|
198
|
+
"""Create an Algorand Standard Asset destroy transaction.
|
|
199
|
+
|
|
200
|
+
:example:
|
|
201
|
+
>>> #Basic example
|
|
202
|
+
>>> creator = AlgorandClientTransactionCreator(lambda: TransactionComposer())
|
|
203
|
+
>>> params = AssetDestroyParams(sender="SENDER_ADDRESS", asset_id=123456)
|
|
204
|
+
>>> txn = creator.asset_destroy(params)
|
|
205
|
+
|
|
206
|
+
:example:
|
|
207
|
+
>>> #Advanced example
|
|
208
|
+
>>> creator.asset_destroy(AssetDestroyParams(
|
|
209
|
+
sender="SENDER_ADDRESS",
|
|
210
|
+
asset_id=123456,
|
|
211
|
+
lease="lease",
|
|
212
|
+
note=b"note",
|
|
213
|
+
rekey_to="REKEYTOADDRESS",
|
|
214
|
+
first_valid_round=1000,
|
|
215
|
+
validity_window=10,
|
|
216
|
+
extra_fee=AlgoAmount.from_micro_algo(1000),
|
|
217
|
+
static_fee=AlgoAmount.from_micro_algo(1000),
|
|
218
|
+
max_fee=AlgoAmount.from_micro_algo(3000)
|
|
219
|
+
))
|
|
220
|
+
"""
|
|
221
|
+
return self._transaction(lambda c: c.add_asset_destroy)
|
|
222
|
+
|
|
223
|
+
@property
|
|
224
|
+
def asset_transfer(self) -> Callable[[AssetTransferParams], Transaction]:
|
|
225
|
+
"""Create an Algorand Standard Asset transfer transaction.
|
|
226
|
+
|
|
227
|
+
:example:
|
|
228
|
+
>>> #Basic example
|
|
229
|
+
>>> creator = AlgorandClientTransactionCreator(lambda: TransactionComposer())
|
|
230
|
+
>>> params = AssetTransferParams(sender="SENDER_ADDRESS",
|
|
231
|
+
asset_id=123456,
|
|
232
|
+
amount=10,
|
|
233
|
+
receiver="RECEIVER_ADDRESS")
|
|
234
|
+
>>> txn = creator.asset_transfer(params)
|
|
235
|
+
|
|
236
|
+
:example:
|
|
237
|
+
>>> #Advanced example
|
|
238
|
+
>>> creator.asset_transfer(AssetTransferParams(
|
|
239
|
+
sender="SENDER_ADDRESS",
|
|
240
|
+
asset_id=123456,
|
|
241
|
+
amount=10,
|
|
242
|
+
receiver="RECEIVER_ADDRESS",
|
|
243
|
+
clawback_target="CLAWBACK_TARGET_ADDRESS",
|
|
244
|
+
close_asset_to="CLOSE_ASSET_TO_ADDRESS",
|
|
245
|
+
lease="lease",
|
|
246
|
+
note=b"note",
|
|
247
|
+
rekey_to="REKEYTOADDRESS",
|
|
248
|
+
first_valid_round=1000,
|
|
249
|
+
validity_window=10,
|
|
250
|
+
extra_fee=AlgoAmount.from_micro_algo(1000),
|
|
251
|
+
static_fee=AlgoAmount.from_micro_algo(1000),
|
|
252
|
+
max_fee=AlgoAmount.from_micro_algo(3000)
|
|
253
|
+
))
|
|
254
|
+
"""
|
|
255
|
+
return self._transaction(lambda c: c.add_asset_transfer)
|
|
256
|
+
|
|
257
|
+
@property
|
|
258
|
+
def asset_opt_in(self) -> Callable[[AssetOptInParams], Transaction]:
|
|
259
|
+
"""Create an Algorand Standard Asset opt-in transaction.
|
|
260
|
+
|
|
261
|
+
:example:
|
|
262
|
+
>>> # Basic example
|
|
263
|
+
>>> creator = AlgorandClientTransactionCreator(lambda: TransactionComposer())
|
|
264
|
+
>>> params = AssetOptInParams(sender="SENDER_ADDRESS", asset_id=123456)
|
|
265
|
+
>>> txn = creator.asset_opt_in(params)
|
|
266
|
+
|
|
267
|
+
:example:
|
|
268
|
+
>>> # Advanced example
|
|
269
|
+
>>> creator.asset_opt_in(AssetOptInParams(
|
|
270
|
+
sender="SENDER_ADDRESS",
|
|
271
|
+
asset_id=123456,
|
|
272
|
+
lease="lease",
|
|
273
|
+
note=b"note",
|
|
274
|
+
rekey_to="REKEYTOADDRESS",
|
|
275
|
+
first_valid_round=1000,
|
|
276
|
+
validity_window=10,
|
|
277
|
+
extra_fee=AlgoAmount.from_micro_algo(1000),
|
|
278
|
+
static_fee=AlgoAmount.from_micro_algo(1000),
|
|
279
|
+
max_fee=AlgoAmount.from_micro_algo(3000)
|
|
280
|
+
))
|
|
281
|
+
"""
|
|
282
|
+
return self._transaction(lambda c: c.add_asset_opt_in)
|
|
283
|
+
|
|
284
|
+
@property
|
|
285
|
+
def asset_opt_out(self) -> Callable[[AssetOptOutParams], Transaction]:
|
|
286
|
+
"""Create an asset opt-out transaction.
|
|
287
|
+
|
|
288
|
+
:example:
|
|
289
|
+
>>> #Basic example
|
|
290
|
+
>>> creator = AlgorandClientTransactionCreator(lambda: TransactionComposer())
|
|
291
|
+
>>> params = AssetOptOutParams(sender="SENDER_ADDRESS", asset_id=123456, creator="CREATOR_ADDRESS")
|
|
292
|
+
>>> txn = creator.asset_opt_out(params)
|
|
293
|
+
|
|
294
|
+
:example:
|
|
295
|
+
>>> #Advanced example
|
|
296
|
+
>>> creator.asset_opt_out(AssetOptOutParams(
|
|
297
|
+
sender="SENDER_ADDRESS",
|
|
298
|
+
asset_id=123456,
|
|
299
|
+
creator="CREATOR_ADDRESS",
|
|
300
|
+
lease="lease",
|
|
301
|
+
note=b"note",
|
|
302
|
+
rekey_to="REKEYTOADDRESS",
|
|
303
|
+
first_valid_round=1000,
|
|
304
|
+
validity_window=10,
|
|
305
|
+
extra_fee=AlgoAmount.from_micro_algo(1000),
|
|
306
|
+
static_fee=AlgoAmount.from_micro_algo(1000),
|
|
307
|
+
max_fee=AlgoAmount.from_micro_algo(3000)
|
|
308
|
+
))
|
|
309
|
+
"""
|
|
310
|
+
return self._transaction(lambda c: c.add_asset_opt_out)
|
|
311
|
+
|
|
312
|
+
@property
|
|
313
|
+
def app_create(self) -> Callable[[AppCreateParams], Transaction]:
|
|
314
|
+
"""Create an application create transaction.
|
|
315
|
+
|
|
316
|
+
:example:
|
|
317
|
+
>>> #Basic example
|
|
318
|
+
>>> creator = AlgorandClientTransactionCreator(lambda: TransactionComposer())
|
|
319
|
+
>>> params = AppCreateParams(
|
|
320
|
+
... sender="SENDER_ADDRESS",
|
|
321
|
+
... approval_program="TEAL_APPROVAL_CODE",
|
|
322
|
+
... clear_state_program="TEAL_CLEAR_CODE",
|
|
323
|
+
... schema={
|
|
324
|
+
... 'global_ints': 1,
|
|
325
|
+
... 'global_byte_slices': 1,
|
|
326
|
+
... 'local_ints': 1,
|
|
327
|
+
... 'local_byte_slices': 1
|
|
328
|
+
... }
|
|
329
|
+
... )
|
|
330
|
+
>>> txn = creator.app_create(params)
|
|
331
|
+
|
|
332
|
+
:example:
|
|
333
|
+
>>> #Advanced example
|
|
334
|
+
>>> creator.app_create(AppCreateParams(
|
|
335
|
+
sender="SENDER_ADDRESS",
|
|
336
|
+
approval_program="TEAL_APPROVAL_CODE",
|
|
337
|
+
clear_state_program="TEAL_CLEAR_CODE",
|
|
338
|
+
schema={'global_ints': 1, 'global_byte_slices': 1, 'local_ints': 1, 'local_byte_slices': 1},
|
|
339
|
+
on_complete=OnComplete.NoOpOC,
|
|
340
|
+
args=[b'arg1', b'arg2'],
|
|
341
|
+
account_references=["ACCOUNT1"],
|
|
342
|
+
app_references=[789],
|
|
343
|
+
asset_references=[123],
|
|
344
|
+
box_references=[],
|
|
345
|
+
extra_program_pages=0,
|
|
346
|
+
lease="lease",
|
|
347
|
+
note=b"note",
|
|
348
|
+
rekey_to="REKEYTOADDRESS",
|
|
349
|
+
first_valid_round=1000,
|
|
350
|
+
validity_window=10,
|
|
351
|
+
extra_fee=AlgoAmount.from_micro_algo(1000),
|
|
352
|
+
static_fee=AlgoAmount.from_micro_algo(1000),
|
|
353
|
+
max_fee=AlgoAmount.from_micro_algo(3000)
|
|
354
|
+
))
|
|
355
|
+
"""
|
|
356
|
+
return self._transaction(lambda c: c.add_app_create)
|
|
357
|
+
|
|
358
|
+
@property
|
|
359
|
+
def app_update(self) -> Callable[[AppUpdateParams], Transaction]:
|
|
360
|
+
"""Create an application update transaction.
|
|
361
|
+
|
|
362
|
+
:example:
|
|
363
|
+
>>> #Basic example
|
|
364
|
+
>>> creator = AlgorandClientTransactionCreator(lambda: TransactionComposer())
|
|
365
|
+
>>> txn = creator.app_update(AppUpdateParams(sender="SENDER_ADDRESS",
|
|
366
|
+
app_id=789,
|
|
367
|
+
approval_program="TEAL_NEW_APPROVAL_CODE",
|
|
368
|
+
clear_state_program="TEAL_NEW_CLEAR_CODE",
|
|
369
|
+
args=[b'new_arg1', b'new_arg2']))
|
|
370
|
+
|
|
371
|
+
:example:
|
|
372
|
+
>>> #Advanced example
|
|
373
|
+
>>> creator.app_update(AppUpdateParams(
|
|
374
|
+
sender="SENDER_ADDRESS",
|
|
375
|
+
app_id=789,
|
|
376
|
+
approval_program="TEAL_NEW_APPROVAL_CODE",
|
|
377
|
+
clear_state_program="TEAL_NEW_CLEAR_CODE",
|
|
378
|
+
args=[b'new_arg1', b'new_arg2'],
|
|
379
|
+
account_references=["ACCOUNT1"],
|
|
380
|
+
app_references=[789],
|
|
381
|
+
asset_references=[123],
|
|
382
|
+
box_references=[],
|
|
383
|
+
on_complete=OnComplete.UpdateApplicationOC,
|
|
384
|
+
lease="lease",
|
|
385
|
+
note=b"note",
|
|
386
|
+
rekey_to="REKEYTOADDRESS",
|
|
387
|
+
first_valid_round=1000,
|
|
388
|
+
validity_window=10,
|
|
389
|
+
extra_fee=AlgoAmount.from_micro_algo(1000),
|
|
390
|
+
static_fee=AlgoAmount.from_micro_algo(1000),
|
|
391
|
+
max_fee=AlgoAmount.from_micro_algo(3000)
|
|
392
|
+
))
|
|
393
|
+
"""
|
|
394
|
+
return self._transaction(lambda c: c.add_app_update)
|
|
395
|
+
|
|
396
|
+
@property
|
|
397
|
+
def app_delete(self) -> Callable[[AppDeleteParams], Transaction]:
|
|
398
|
+
"""Create an application delete transaction.
|
|
399
|
+
|
|
400
|
+
:example:
|
|
401
|
+
>>> #Basic example
|
|
402
|
+
>>> creator = AlgorandClientTransactionCreator(lambda: TransactionComposer())
|
|
403
|
+
>>> params = AppDeleteParams(sender="SENDER_ADDRESS", app_id=789, args=[b'delete_arg'])
|
|
404
|
+
>>> txn = creator.app_delete(params)
|
|
405
|
+
|
|
406
|
+
:example:
|
|
407
|
+
>>> #Advanced example
|
|
408
|
+
>>> creator.app_delete(AppDeleteParams(
|
|
409
|
+
sender="SENDER_ADDRESS",
|
|
410
|
+
app_id=789,
|
|
411
|
+
args=[b'delete_arg'],
|
|
412
|
+
account_references=["ACCOUNT1"],
|
|
413
|
+
app_references=[789],
|
|
414
|
+
asset_references=[123],
|
|
415
|
+
box_references=[],
|
|
416
|
+
on_complete=OnComplete.DeleteApplicationOC,
|
|
417
|
+
lease="lease",
|
|
418
|
+
note=b"note",
|
|
419
|
+
rekey_to="REKEYTOADDRESS",
|
|
420
|
+
first_valid_round=1000,
|
|
421
|
+
validity_window=10,
|
|
422
|
+
extra_fee=AlgoAmount.from_micro_algo(1000),
|
|
423
|
+
static_fee=AlgoAmount.from_micro_algo(1000),
|
|
424
|
+
max_fee=AlgoAmount.from_micro_algo(3000)
|
|
425
|
+
))
|
|
426
|
+
"""
|
|
427
|
+
return self._transaction(lambda c: c.add_app_delete)
|
|
428
|
+
|
|
429
|
+
@property
|
|
430
|
+
def app_call(self) -> Callable[[AppCallParams], Transaction]:
|
|
431
|
+
"""Create an application call transaction.
|
|
432
|
+
|
|
433
|
+
:example:
|
|
434
|
+
>>> #Basic example
|
|
435
|
+
>>> creator = AlgorandClientTransactionCreator(lambda: TransactionComposer())
|
|
436
|
+
>>> params = AppCallParams(
|
|
437
|
+
... sender="SENDER_ADDRESS",
|
|
438
|
+
... on_complete=OnComplete.NoOpOC,
|
|
439
|
+
... app_id=789,
|
|
440
|
+
... approval_program="TEAL_APPROVAL_CODE",
|
|
441
|
+
... clear_state_program="TEAL_CLEAR_CODE",
|
|
442
|
+
... schema={
|
|
443
|
+
... 'global_ints': 1,
|
|
444
|
+
... 'global_byte_slices': 1,
|
|
445
|
+
... 'local_ints': 1,
|
|
446
|
+
... 'local_byte_slices': 1
|
|
447
|
+
... },
|
|
448
|
+
... args=[b'arg1', b'arg2'],
|
|
449
|
+
... account_references=["ACCOUNT1"],
|
|
450
|
+
... app_references=[789],
|
|
451
|
+
... asset_references=[123],
|
|
452
|
+
... extra_pages=0,
|
|
453
|
+
... box_references=[]
|
|
454
|
+
... )
|
|
455
|
+
>>> txn = creator.app_call(params)
|
|
456
|
+
|
|
457
|
+
:example:
|
|
458
|
+
>>> #Advanced example
|
|
459
|
+
>>> creator.app_call(AppCallParams(
|
|
460
|
+
sender="SENDER_ADDRESS",
|
|
461
|
+
on_complete=OnComplete.NoOpOC,
|
|
462
|
+
app_id=789,
|
|
463
|
+
approval_program="TEAL_APPROVAL_CODE",
|
|
464
|
+
clear_state_program="TEAL_CLEAR_CODE",
|
|
465
|
+
schema={'global_ints': 1, 'global_byte_slices': 1, 'local_ints': 1, 'local_byte_slices': 1},
|
|
466
|
+
args=[b'arg1', b'arg2'],
|
|
467
|
+
account_references=["ACCOUNT1"],
|
|
468
|
+
app_references=[789],
|
|
469
|
+
asset_references=[123],
|
|
470
|
+
extra_pages=0,
|
|
471
|
+
box_references=[],
|
|
472
|
+
lease="lease",
|
|
473
|
+
note=b"note",
|
|
474
|
+
rekey_to="REKEYTOADDRESS",
|
|
475
|
+
first_valid_round=1000,
|
|
476
|
+
validity_window=10,
|
|
477
|
+
extra_fee=AlgoAmount.from_micro_algo(1000),
|
|
478
|
+
static_fee=AlgoAmount.from_micro_algo(1000),
|
|
479
|
+
max_fee=AlgoAmount.from_micro_algo(3000)
|
|
480
|
+
))
|
|
481
|
+
"""
|
|
482
|
+
return self._transaction(lambda c: c.add_app_call)
|
|
483
|
+
|
|
484
|
+
@property
|
|
485
|
+
def app_create_method_call(self) -> Callable[[AppCreateMethodCallParams], BuiltTransactions]:
|
|
486
|
+
"""Create an application create call with ABI method call transaction.
|
|
487
|
+
|
|
488
|
+
:example:
|
|
489
|
+
>>> #Basic example
|
|
490
|
+
>>> creator = AlgorandClientTransactionCreator(lambda: TransactionComposer())
|
|
491
|
+
>>> params = AppCreateMethodCallParams(sender="SENDER_ADDRESS", app_id=0, method=some_abi_method_object)
|
|
492
|
+
>>> built_txns = creator.app_create_method_call(params)
|
|
493
|
+
|
|
494
|
+
:example:
|
|
495
|
+
>>> #Advanced example
|
|
496
|
+
>>> creator.app_create_method_call(AppCreateMethodCallParams(
|
|
497
|
+
sender="SENDER_ADDRESS",
|
|
498
|
+
app_id=0,
|
|
499
|
+
method=some_abi_method_object,
|
|
500
|
+
args=[b'method_arg'],
|
|
501
|
+
account_references=["ACCOUNT1"],
|
|
502
|
+
app_references=[789],
|
|
503
|
+
asset_references=[123],
|
|
504
|
+
box_references=[],
|
|
505
|
+
schema={'global_ints': 1, 'global_byte_slices': 1, 'local_ints': 1, 'local_byte_slices': 1},
|
|
506
|
+
approval_program="TEAL_APPROVAL_CODE",
|
|
507
|
+
clear_state_program="TEAL_CLEAR_CODE",
|
|
508
|
+
on_complete=OnComplete.NoOpOC,
|
|
509
|
+
extra_program_pages=0,
|
|
510
|
+
lease="lease",
|
|
511
|
+
note=b"note",
|
|
512
|
+
rekey_to="REKEYTOADDRESS",
|
|
513
|
+
first_valid_round=1000,
|
|
514
|
+
validity_window=10,
|
|
515
|
+
extra_fee=AlgoAmount.from_micro_algo(1000),
|
|
516
|
+
static_fee=AlgoAmount.from_micro_algo(1000),
|
|
517
|
+
max_fee=AlgoAmount.from_micro_algo(3000)
|
|
518
|
+
))
|
|
519
|
+
"""
|
|
520
|
+
return self._transactions(lambda c: c.add_app_create_method_call)
|
|
521
|
+
|
|
522
|
+
@property
|
|
523
|
+
def app_update_method_call(self) -> Callable[[AppUpdateMethodCallParams], BuiltTransactions]:
|
|
524
|
+
"""Create an application update call with ABI method call transaction.
|
|
525
|
+
|
|
526
|
+
:example:
|
|
527
|
+
>>> #Basic example
|
|
528
|
+
>>> creator = AlgorandClientTransactionCreator(lambda: TransactionComposer())
|
|
529
|
+
>>> params = AppUpdateMethodCallParams(sender="SENDER_ADDRESS", app_id=789, method=some_abi_method_object)
|
|
530
|
+
>>> built_txns = creator.app_update_method_call(params)
|
|
531
|
+
|
|
532
|
+
:example:
|
|
533
|
+
>>> #Advanced example
|
|
534
|
+
>>> creator.app_update_method_call(AppUpdateMethodCallParams(
|
|
535
|
+
sender="SENDER_ADDRESS",
|
|
536
|
+
app_id=789,
|
|
537
|
+
method=some_abi_method_object,
|
|
538
|
+
args=[b'method_arg'],
|
|
539
|
+
account_references=["ACCOUNT1"],
|
|
540
|
+
app_references=[789],
|
|
541
|
+
asset_references=[123],
|
|
542
|
+
box_references=[],
|
|
543
|
+
schema={'global_ints': 1, 'global_byte_slices': 1, 'local_ints': 1, 'local_byte_slices': 1},
|
|
544
|
+
approval_program="TEAL_NEW_APPROVAL_CODE",
|
|
545
|
+
clear_state_program="TEAL_NEW_CLEAR_CODE",
|
|
546
|
+
on_complete=OnComplete.UpdateApplicationOC,
|
|
547
|
+
lease="lease",
|
|
548
|
+
note=b"note",
|
|
549
|
+
rekey_to="REKEYTOADDRESS",
|
|
550
|
+
first_valid_round=1000,
|
|
551
|
+
validity_window=10,
|
|
552
|
+
extra_fee=AlgoAmount.from_micro_algo(1000),
|
|
553
|
+
static_fee=AlgoAmount.from_micro_algo(1000),
|
|
554
|
+
max_fee=AlgoAmount.from_micro_algo(3000)
|
|
555
|
+
))
|
|
556
|
+
"""
|
|
557
|
+
return self._transactions(lambda c: c.add_app_update_method_call)
|
|
558
|
+
|
|
559
|
+
@property
|
|
560
|
+
def app_delete_method_call(self) -> Callable[[AppDeleteMethodCallParams], BuiltTransactions]:
|
|
561
|
+
"""Create an application delete call with ABI method call transaction.
|
|
562
|
+
|
|
563
|
+
:example:
|
|
564
|
+
>>> #Basic example
|
|
565
|
+
>>> creator = AlgorandClientTransactionCreator(lambda: TransactionComposer())
|
|
566
|
+
>>> params = AppDeleteMethodCallParams(sender="SENDER_ADDRESS", app_id=789, method=some_abi_method_object)
|
|
567
|
+
>>> built_txns = creator.app_delete_method_call(params)
|
|
568
|
+
|
|
569
|
+
:example:
|
|
570
|
+
>>> #Advanced example
|
|
571
|
+
>>> creator.app_delete_method_call(AppDeleteMethodCallParams(
|
|
572
|
+
sender="SENDER_ADDRESS",
|
|
573
|
+
app_id=789,
|
|
574
|
+
method=some_abi_method_object,
|
|
575
|
+
args=[b'method_arg'],
|
|
576
|
+
account_references=["ACCOUNT1"],
|
|
577
|
+
app_references=[789],
|
|
578
|
+
asset_references=[123],
|
|
579
|
+
box_references=[],
|
|
580
|
+
lease="lease",
|
|
581
|
+
note=b"note",
|
|
582
|
+
rekey_to="REKEYTOADDRESS",
|
|
583
|
+
first_valid_round=1000,
|
|
584
|
+
validity_window=10,
|
|
585
|
+
extra_fee=AlgoAmount.from_micro_algo(1000),
|
|
586
|
+
static_fee=AlgoAmount.from_micro_algo(1000),
|
|
587
|
+
max_fee=AlgoAmount.from_micro_algo(3000)
|
|
588
|
+
))
|
|
589
|
+
"""
|
|
590
|
+
return self._transactions(lambda c: c.add_app_delete_method_call)
|
|
591
|
+
|
|
592
|
+
@property
|
|
593
|
+
def app_call_method_call(self) -> Callable[[AppCallMethodCallParams], BuiltTransactions]:
|
|
594
|
+
"""Create an application call with ABI method call transaction.
|
|
595
|
+
|
|
596
|
+
:example:
|
|
597
|
+
>>> #Basic example
|
|
598
|
+
>>> creator = AlgorandClientTransactionCreator(lambda: TransactionComposer())
|
|
599
|
+
>>> params = AppCallMethodCallParams(sender="SENDER_ADDRESS", app_id=789, method=some_abi_method_object)
|
|
600
|
+
>>> built_txns = creator.app_call_method_call(params)
|
|
601
|
+
:example: Advanced example
|
|
602
|
+
>>> creator.app_call_method_call(AppCallMethodCallParams(
|
|
603
|
+
sender="SENDER_ADDRESS",
|
|
604
|
+
app_id=789,
|
|
605
|
+
method=some_abi_method_object,
|
|
606
|
+
args=[b'method_arg'],
|
|
607
|
+
account_references=["ACCOUNT1"],
|
|
608
|
+
app_references=[789],
|
|
609
|
+
asset_references=[123],
|
|
610
|
+
box_references=[],
|
|
611
|
+
lease="lease",
|
|
612
|
+
note=b"note",
|
|
613
|
+
rekey_to="REKEYTOADDRESS",
|
|
614
|
+
first_valid_round=1000,
|
|
615
|
+
validity_window=10,
|
|
616
|
+
extra_fee=AlgoAmount.from_micro_algo(1000),
|
|
617
|
+
static_fee=AlgoAmount.from_micro_algo(1000),
|
|
618
|
+
max_fee=AlgoAmount.from_micro_algo(3000)
|
|
619
|
+
))
|
|
620
|
+
"""
|
|
621
|
+
return self._transactions(lambda c: c.add_app_call_method_call)
|
|
622
|
+
|
|
623
|
+
@property
|
|
624
|
+
def online_key_registration(self) -> Callable[[OnlineKeyRegistrationParams], Transaction]:
|
|
625
|
+
"""Create an online key registration transaction.
|
|
626
|
+
|
|
627
|
+
:example:
|
|
628
|
+
>>> #Basic example
|
|
629
|
+
>>> creator = AlgorandClientTransactionCreator(lambda: TransactionComposer())
|
|
630
|
+
>>> params = OnlineKeyRegistrationParams(
|
|
631
|
+
sender="SENDER_ADDRESS",
|
|
632
|
+
vote_key="VOTE_KEY",
|
|
633
|
+
selection_key="SELECTION_KEY",
|
|
634
|
+
vote_first=1000,
|
|
635
|
+
vote_last=2000,
|
|
636
|
+
vote_key_dilution=10,
|
|
637
|
+
state_proof_key=b"state_proof_key_bytes"
|
|
638
|
+
)
|
|
639
|
+
>>> txn = creator.online_key_registration(params)
|
|
640
|
+
|
|
641
|
+
:example:
|
|
642
|
+
>>> #Advanced example
|
|
643
|
+
>>> creator.online_key_registration(OnlineKeyRegistrationParams(
|
|
644
|
+
sender="SENDER_ADDRESS",
|
|
645
|
+
vote_key="VOTE_KEY",
|
|
646
|
+
selection_key="SELECTION_KEY",
|
|
647
|
+
vote_first=1000,
|
|
648
|
+
vote_last=2000,
|
|
649
|
+
vote_key_dilution=10,
|
|
650
|
+
state_proof_key=b"state_proof_key_bytes",
|
|
651
|
+
lease="lease",
|
|
652
|
+
note=b"note",
|
|
653
|
+
rekey_to="REKEYTOADDRESS",
|
|
654
|
+
first_valid_round=1000,
|
|
655
|
+
validity_window=10,
|
|
656
|
+
extra_fee=AlgoAmount.from_micro_algo(1000),
|
|
657
|
+
static_fee=AlgoAmount.from_micro_algo(1000),
|
|
658
|
+
max_fee=AlgoAmount.from_micro_algo(3000)
|
|
659
|
+
))
|
|
660
|
+
"""
|
|
661
|
+
return self._transaction(lambda c: c.add_online_key_registration)
|
|
662
|
+
|
|
663
|
+
@property
|
|
664
|
+
def offline_key_registration(self) -> Callable[[OfflineKeyRegistrationParams], Transaction]:
|
|
665
|
+
"""Create an offline key registration transaction.
|
|
666
|
+
|
|
667
|
+
:example:
|
|
668
|
+
>>> #Basic example
|
|
669
|
+
>>> creator = AlgorandClientTransactionCreator(lambda: TransactionComposer())
|
|
670
|
+
>>> txn = creator.offline_key_registration(OfflineKeyRegistrationParams(sender="SENDER_ADDRESS",
|
|
671
|
+
prevent_account_from_ever_participating_again=True))
|
|
672
|
+
|
|
673
|
+
:example:
|
|
674
|
+
>>> #Advanced example
|
|
675
|
+
>>> creator.offline_key_registration(OfflineKeyRegistrationParams(
|
|
676
|
+
sender="SENDER_ADDRESS",
|
|
677
|
+
prevent_account_from_ever_participating_again=True,
|
|
678
|
+
lease="lease",
|
|
679
|
+
note=b"note",
|
|
680
|
+
rekey_to="REKEYTOADDRESS",
|
|
681
|
+
first_valid_round=1000,
|
|
682
|
+
validity_window=10,
|
|
683
|
+
extra_fee=AlgoAmount.from_micro_algo(1000),
|
|
684
|
+
static_fee=AlgoAmount.from_micro_algo(1000),
|
|
685
|
+
max_fee=AlgoAmount.from_micro_algo(3000)
|
|
686
|
+
))
|
|
687
|
+
"""
|
|
688
|
+
return self._transaction(lambda c: c.add_offline_key_registration)
|