algokit-utils 3.0.0b3__py3-none-any.whl → 3.0.0b4__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/accounts/account_manager.py +1 -1
- algokit_utils/applications/app_client.py +84 -147
- algokit_utils/applications/app_factory.py +2 -8
- algokit_utils/clients/dispenser_api_client.py +3 -0
- algokit_utils/models/amount.py +78 -20
- {algokit_utils-3.0.0b3.dist-info → algokit_utils-3.0.0b4.dist-info}/METADATA +1 -1
- {algokit_utils-3.0.0b3.dist-info → algokit_utils-3.0.0b4.dist-info}/RECORD +9 -9
- {algokit_utils-3.0.0b3.dist-info → algokit_utils-3.0.0b4.dist-info}/LICENSE +0 -0
- {algokit_utils-3.0.0b3.dist-info → algokit_utils-3.0.0b4.dist-info}/WHEEL +0 -0
|
@@ -256,7 +256,7 @@ class AccountManager:
|
|
|
256
256
|
:raises ValueError: If no account is found or if the account is not a regular account
|
|
257
257
|
|
|
258
258
|
:example:
|
|
259
|
-
>>> sender = account_manager.random()
|
|
259
|
+
>>> sender = account_manager.random().address
|
|
260
260
|
>>> # ...
|
|
261
261
|
>>> # Returns the `TransactionSignerAccountProtocol` for `sender` that has previously been registered
|
|
262
262
|
>>> account = account_manager.get_account(sender)
|
|
@@ -76,7 +76,6 @@ __all__ = [
|
|
|
76
76
|
"AppClient",
|
|
77
77
|
"AppClientBareCallCreateParams",
|
|
78
78
|
"AppClientBareCallParams",
|
|
79
|
-
"AppClientCallParams",
|
|
80
79
|
"AppClientCompilationParams",
|
|
81
80
|
"AppClientCompilationResult",
|
|
82
81
|
"AppClientCreateSchema",
|
|
@@ -85,6 +84,8 @@ __all__ = [
|
|
|
85
84
|
"AppClientParams",
|
|
86
85
|
"AppSourceMaps",
|
|
87
86
|
"BaseAppClientMethodCallParams",
|
|
87
|
+
"CommonAppCallCreateParams",
|
|
88
|
+
"CommonAppCallParams",
|
|
88
89
|
"CreateOnComplete",
|
|
89
90
|
"FundAppAccountParams",
|
|
90
91
|
"get_constant_block_offset",
|
|
@@ -201,106 +202,35 @@ class AppClientCompilationParams(TypedDict, total=False):
|
|
|
201
202
|
deletable: bool | None
|
|
202
203
|
|
|
203
204
|
|
|
204
|
-
@dataclass(kw_only=True)
|
|
205
|
-
class FundAppAccountParams:
|
|
206
|
-
"""Parameters for funding an application's account.
|
|
207
|
-
|
|
208
|
-
:ivar sender: Optional sender address
|
|
209
|
-
:ivar signer: Optional transaction signer
|
|
210
|
-
:ivar rekey_to: Optional address to rekey to
|
|
211
|
-
:ivar note: Optional transaction note
|
|
212
|
-
:ivar lease: Optional lease
|
|
213
|
-
:ivar static_fee: Optional static fee
|
|
214
|
-
:ivar extra_fee: Optional extra fee
|
|
215
|
-
:ivar max_fee: Optional maximum fee
|
|
216
|
-
:ivar validity_window: Optional validity window in rounds
|
|
217
|
-
:ivar first_valid_round: Optional first valid round
|
|
218
|
-
:ivar last_valid_round: Optional last valid round
|
|
219
|
-
:ivar amount: Amount to fund
|
|
220
|
-
:ivar close_remainder_to: Optional address to close remainder to
|
|
221
|
-
:ivar on_complete: Optional on complete action
|
|
222
|
-
"""
|
|
223
|
-
|
|
224
|
-
sender: str | None = None
|
|
225
|
-
signer: TransactionSigner | None = None
|
|
226
|
-
rekey_to: str | None = None
|
|
227
|
-
note: bytes | None = None
|
|
228
|
-
lease: bytes | None = None
|
|
229
|
-
static_fee: AlgoAmount | None = None
|
|
230
|
-
extra_fee: AlgoAmount | None = None
|
|
231
|
-
max_fee: AlgoAmount | None = None
|
|
232
|
-
validity_window: int | None = None
|
|
233
|
-
first_valid_round: int | None = None
|
|
234
|
-
last_valid_round: int | None = None
|
|
235
|
-
amount: AlgoAmount
|
|
236
|
-
close_remainder_to: str | None = None
|
|
237
|
-
on_complete: algosdk.transaction.OnComplete | None = None
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
@dataclass(kw_only=True)
|
|
241
|
-
class AppClientCallParams:
|
|
242
|
-
"""Parameters for calling an application.
|
|
243
|
-
|
|
244
|
-
:ivar method: Optional ABI method name or signature
|
|
245
|
-
:ivar args: Optional arguments to pass to method
|
|
246
|
-
:ivar boxes: Optional box references to load
|
|
247
|
-
:ivar accounts: Optional account addresses to load
|
|
248
|
-
:ivar apps: Optional app IDs to load
|
|
249
|
-
:ivar assets: Optional asset IDs to load
|
|
250
|
-
:ivar lease: Optional lease
|
|
251
|
-
:ivar sender: Optional sender address
|
|
252
|
-
:ivar note: Optional transaction note
|
|
253
|
-
:ivar send_params: Optional parameters to control transaction sending
|
|
254
|
-
"""
|
|
255
|
-
|
|
256
|
-
method: str | None = None
|
|
257
|
-
args: list | None = None
|
|
258
|
-
boxes: list | None = None
|
|
259
|
-
accounts: list[str] | None = None
|
|
260
|
-
apps: list[int] | None = None
|
|
261
|
-
assets: list[int] | None = None
|
|
262
|
-
lease: (str | bytes) | None = None
|
|
263
|
-
sender: str | None = None
|
|
264
|
-
note: (bytes | dict | str) | None = None
|
|
265
|
-
send_params: dict | None = None
|
|
266
|
-
|
|
267
|
-
|
|
268
205
|
ArgsT = TypeVar("ArgsT")
|
|
269
206
|
MethodT = TypeVar("MethodT")
|
|
270
207
|
|
|
271
208
|
|
|
272
209
|
@dataclass(kw_only=True, frozen=True)
|
|
273
|
-
class
|
|
274
|
-
"""
|
|
210
|
+
class CommonAppCallParams:
|
|
211
|
+
"""Common configuration for app call transaction parameters
|
|
212
|
+
|
|
213
|
+
:ivar account_references: List of account addresses to reference
|
|
214
|
+
:ivar app_references: List of app IDs to reference
|
|
215
|
+
:ivar asset_references: List of asset IDs to reference
|
|
216
|
+
:ivar box_references: List of box references to include
|
|
217
|
+
:ivar extra_fee: Additional fee to add to transaction
|
|
218
|
+
:ivar lease: Transaction lease value
|
|
219
|
+
:ivar max_fee: Maximum fee allowed for transaction
|
|
220
|
+
:ivar note: Arbitrary note for the transaction
|
|
221
|
+
:ivar rekey_to: Address to rekey account to
|
|
222
|
+
:ivar sender: Sender address override
|
|
223
|
+
:ivar signer: Custom transaction signer
|
|
224
|
+
:ivar static_fee: Fixed fee for transaction
|
|
225
|
+
:ivar validity_window: Number of rounds valid
|
|
226
|
+
:ivar first_valid_round: First valid round number
|
|
227
|
+
:ivar last_valid_round: Last valid round number"""
|
|
275
228
|
|
|
276
|
-
:ivar method: Method to call
|
|
277
|
-
:ivar args: Optional arguments to pass to method
|
|
278
|
-
:ivar account_references: Optional account references
|
|
279
|
-
:ivar app_references: Optional application references
|
|
280
|
-
:ivar asset_references: Optional asset references
|
|
281
|
-
:ivar box_references: Optional box references
|
|
282
|
-
:ivar extra_fee: Optional extra fee
|
|
283
|
-
:ivar first_valid_round: Optional first valid round
|
|
284
|
-
:ivar lease: Optional lease
|
|
285
|
-
:ivar max_fee: Optional maximum fee
|
|
286
|
-
:ivar note: Optional note
|
|
287
|
-
:ivar rekey_to: Optional rekey to address
|
|
288
|
-
:ivar sender: Optional sender address
|
|
289
|
-
:ivar signer: Optional transaction signer
|
|
290
|
-
:ivar static_fee: Optional static fee
|
|
291
|
-
:ivar validity_window: Optional validity window
|
|
292
|
-
:ivar last_valid_round: Optional last valid round
|
|
293
|
-
:ivar on_complete: Optional on complete action
|
|
294
|
-
"""
|
|
295
|
-
|
|
296
|
-
method: MethodT
|
|
297
|
-
args: ArgsT | None = None
|
|
298
229
|
account_references: list[str] | None = None
|
|
299
230
|
app_references: list[int] | None = None
|
|
300
231
|
asset_references: list[int] | None = None
|
|
301
|
-
box_references:
|
|
232
|
+
box_references: list[BoxReference | BoxIdentifier] | None = None
|
|
302
233
|
extra_fee: AlgoAmount | None = None
|
|
303
|
-
first_valid_round: int | None = None
|
|
304
234
|
lease: bytes | None = None
|
|
305
235
|
max_fee: AlgoAmount | None = None
|
|
306
236
|
note: bytes | None = None
|
|
@@ -309,82 +239,85 @@ class BaseAppClientMethodCallParams(Generic[ArgsT, MethodT]):
|
|
|
309
239
|
signer: TransactionSigner | None = None
|
|
310
240
|
static_fee: AlgoAmount | None = None
|
|
311
241
|
validity_window: int | None = None
|
|
242
|
+
first_valid_round: int | None = None
|
|
312
243
|
last_valid_round: int | None = None
|
|
313
|
-
on_complete:
|
|
244
|
+
on_complete: OnComplete | None = None
|
|
245
|
+
|
|
246
|
+
|
|
247
|
+
@dataclass(frozen=True)
|
|
248
|
+
class AppClientCreateSchema:
|
|
249
|
+
"""Schema for application creation.
|
|
250
|
+
|
|
251
|
+
:ivar extra_program_pages: Optional number of extra program pages
|
|
252
|
+
:ivar schema: Optional application creation schema
|
|
253
|
+
"""
|
|
254
|
+
|
|
255
|
+
extra_program_pages: int | None = None
|
|
256
|
+
schema: AppCreateSchema | None = None
|
|
314
257
|
|
|
315
258
|
|
|
316
259
|
@dataclass(kw_only=True, frozen=True)
|
|
317
|
-
class
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
]
|
|
322
|
-
):
|
|
323
|
-
"""Parameters for application method calls."""
|
|
260
|
+
class CommonAppCallCreateParams(AppClientCreateSchema, CommonAppCallParams):
|
|
261
|
+
"""Common configuration for app create call transaction parameters."""
|
|
262
|
+
|
|
263
|
+
on_complete: CreateOnComplete | None = None
|
|
324
264
|
|
|
325
265
|
|
|
326
266
|
@dataclass(kw_only=True, frozen=True)
|
|
327
|
-
class
|
|
267
|
+
class FundAppAccountParams(CommonAppCallParams):
|
|
268
|
+
"""Parameters for funding an application's account.
|
|
269
|
+
|
|
270
|
+
:ivar amount: Amount to fund
|
|
271
|
+
:ivar close_remainder_to: Optional address to close remainder to
|
|
272
|
+
"""
|
|
273
|
+
|
|
274
|
+
amount: AlgoAmount
|
|
275
|
+
close_remainder_to: str | None = None
|
|
276
|
+
|
|
277
|
+
|
|
278
|
+
@dataclass(kw_only=True, frozen=True)
|
|
279
|
+
class AppClientBareCallParams(CommonAppCallParams):
|
|
328
280
|
"""Parameters for bare application calls.
|
|
329
281
|
|
|
330
|
-
:ivar signer: Optional transaction signer
|
|
331
|
-
:ivar rekey_to: Optional rekey to address
|
|
332
|
-
:ivar lease: Optional lease
|
|
333
|
-
:ivar static_fee: Optional static fee
|
|
334
|
-
:ivar extra_fee: Optional extra fee
|
|
335
|
-
:ivar max_fee: Optional maximum fee
|
|
336
|
-
:ivar validity_window: Optional validity window
|
|
337
|
-
:ivar first_valid_round: Optional first valid round
|
|
338
|
-
:ivar last_valid_round: Optional last valid round
|
|
339
|
-
:ivar sender: Optional sender address
|
|
340
|
-
:ivar note: Optional note
|
|
341
282
|
:ivar args: Optional arguments
|
|
342
|
-
:ivar account_references: Optional account references
|
|
343
|
-
:ivar app_references: Optional application references
|
|
344
|
-
:ivar asset_references: Optional asset references
|
|
345
|
-
:ivar box_references: Optional box references
|
|
346
283
|
"""
|
|
347
284
|
|
|
348
|
-
signer: TransactionSigner | None = None
|
|
349
|
-
rekey_to: str | None = None
|
|
350
|
-
lease: bytes | None = None
|
|
351
|
-
static_fee: AlgoAmount | None = None
|
|
352
|
-
extra_fee: AlgoAmount | None = None
|
|
353
|
-
max_fee: AlgoAmount | None = None
|
|
354
|
-
validity_window: int | None = None
|
|
355
|
-
first_valid_round: int | None = None
|
|
356
|
-
last_valid_round: int | None = None
|
|
357
|
-
sender: str | None = None
|
|
358
|
-
note: bytes | None = None
|
|
359
285
|
args: list[bytes] | None = None
|
|
360
|
-
account_references: list[str] | None = None
|
|
361
|
-
app_references: list[int] | None = None
|
|
362
|
-
asset_references: list[int] | None = None
|
|
363
|
-
box_references: list[BoxReference | BoxIdentifier] | None = None
|
|
364
286
|
|
|
365
287
|
|
|
366
288
|
@dataclass(frozen=True)
|
|
367
|
-
class
|
|
368
|
-
"""
|
|
289
|
+
class AppClientBareCallCreateParams(CommonAppCallCreateParams):
|
|
290
|
+
"""Parameters for creating application with bare call."""
|
|
369
291
|
|
|
370
|
-
:
|
|
371
|
-
:ivar schema: Optional application creation schema
|
|
372
|
-
"""
|
|
292
|
+
on_complete: CreateOnComplete | None = None
|
|
373
293
|
|
|
374
|
-
extra_program_pages: int | None = None
|
|
375
|
-
schema: AppCreateSchema | None = None
|
|
376
294
|
|
|
295
|
+
@dataclass(kw_only=True, frozen=True)
|
|
296
|
+
class BaseAppClientMethodCallParams(Generic[ArgsT, MethodT], CommonAppCallParams):
|
|
297
|
+
"""Base parameters for application method calls.
|
|
377
298
|
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
299
|
+
:ivar method: Method to call
|
|
300
|
+
:ivar args: Optional arguments to pass to method
|
|
301
|
+
:ivar on_complete: Optional on complete action
|
|
302
|
+
"""
|
|
381
303
|
|
|
382
|
-
|
|
304
|
+
method: MethodT
|
|
305
|
+
args: ArgsT | None = None
|
|
306
|
+
|
|
307
|
+
|
|
308
|
+
@dataclass(kw_only=True, frozen=True)
|
|
309
|
+
class AppClientMethodCallParams(
|
|
310
|
+
BaseAppClientMethodCallParams[
|
|
311
|
+
Sequence[ABIValue | ABIStruct | AppMethodCallTransactionArgument | None],
|
|
312
|
+
str,
|
|
313
|
+
]
|
|
314
|
+
):
|
|
315
|
+
"""Parameters for application method calls."""
|
|
383
316
|
|
|
384
317
|
|
|
385
318
|
@dataclass(frozen=True)
|
|
386
319
|
class AppClientMethodCallCreateParams(AppClientCreateSchema, AppClientMethodCallParams):
|
|
387
|
-
"""Parameters for creating application with method call
|
|
320
|
+
"""Parameters for creating application with method call"""
|
|
388
321
|
|
|
389
322
|
on_complete: CreateOnComplete | None = None
|
|
390
323
|
|
|
@@ -1616,7 +1549,7 @@ class AppClient:
|
|
|
1616
1549
|
program: bytes | None = None,
|
|
1617
1550
|
approval_source_info: ProgramSourceInfo | None = None,
|
|
1618
1551
|
clear_source_info: ProgramSourceInfo | None = None,
|
|
1619
|
-
) -> Exception:
|
|
1552
|
+
) -> LogicError | Exception:
|
|
1620
1553
|
source_map = clear_source_map if is_clear_state_program else approval_source_map
|
|
1621
1554
|
|
|
1622
1555
|
error_details = parse_logic_error(str(e))
|
|
@@ -1682,20 +1615,24 @@ class AppClient:
|
|
|
1682
1615
|
get_line_for_pc=custom_get_line_for_pc,
|
|
1683
1616
|
traces=None,
|
|
1684
1617
|
)
|
|
1685
|
-
|
|
1686
1618
|
if error_message:
|
|
1687
1619
|
import re
|
|
1688
1620
|
|
|
1689
1621
|
message = e.logic_error_str if isinstance(e, LogicError) else str(e)
|
|
1690
1622
|
app_id = re.search(r"(?<=app=)\d+", message)
|
|
1691
1623
|
tx_id = re.search(r"(?<=transaction )\S+(?=:)", message)
|
|
1692
|
-
|
|
1624
|
+
runtime_error_message = (
|
|
1693
1625
|
f"Runtime error when executing {app_spec.name} "
|
|
1694
1626
|
f"(appId: {app_id.group() if app_id else 'N/A'}) in transaction "
|
|
1695
1627
|
f"{tx_id.group() if tx_id else 'N/A'}: {error_message}"
|
|
1696
1628
|
)
|
|
1697
|
-
|
|
1698
|
-
|
|
1629
|
+
if isinstance(e, LogicError):
|
|
1630
|
+
e.message = runtime_error_message
|
|
1631
|
+
return e
|
|
1632
|
+
else:
|
|
1633
|
+
error = Exception(runtime_error_message)
|
|
1634
|
+
error.__cause__ = e
|
|
1635
|
+
return error
|
|
1699
1636
|
|
|
1700
1637
|
return e
|
|
1701
1638
|
|
|
@@ -23,7 +23,6 @@ from algokit_utils.applications.app_client import (
|
|
|
23
23
|
AppClientBareCallParams,
|
|
24
24
|
AppClientCompilationParams,
|
|
25
25
|
AppClientCompilationResult,
|
|
26
|
-
AppClientCreateSchema,
|
|
27
26
|
AppClientMethodCallCreateParams,
|
|
28
27
|
AppClientMethodCallParams,
|
|
29
28
|
AppClientParams,
|
|
@@ -88,17 +87,12 @@ class AppFactoryParams:
|
|
|
88
87
|
|
|
89
88
|
|
|
90
89
|
@dataclass(kw_only=True, frozen=True)
|
|
91
|
-
class
|
|
90
|
+
class AppFactoryCreateParams(AppClientBareCallCreateParams):
|
|
92
91
|
on_complete: CreateOnComplete | None = None
|
|
93
92
|
|
|
94
93
|
|
|
95
94
|
@dataclass(kw_only=True, frozen=True)
|
|
96
|
-
class
|
|
97
|
-
pass
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
@dataclass(kw_only=True, frozen=True)
|
|
101
|
-
class AppFactoryCreateMethodCallParams(_AppFactoryCreateBaseParams, AppClientMethodCallParams):
|
|
95
|
+
class AppFactoryCreateMethodCallParams(AppClientMethodCallCreateParams):
|
|
102
96
|
pass
|
|
103
97
|
|
|
104
98
|
|
|
@@ -71,6 +71,9 @@ class TestNetDispenserApiClient:
|
|
|
71
71
|
Default request timeout is 15 seconds. Modify by passing `request_timeout` to the constructor.
|
|
72
72
|
"""
|
|
73
73
|
|
|
74
|
+
# NOTE: ensures pytest does not think this is a test
|
|
75
|
+
# https://docs.pytest.org/en/stable/example/pythoncollection.html#customizing-test-collection
|
|
76
|
+
__test__ = False
|
|
74
77
|
auth_token: str
|
|
75
78
|
request_timeout = DISPENSER_REQUEST_TIMEOUT
|
|
76
79
|
|
algokit_utils/models/amount.py
CHANGED
|
@@ -1,34 +1,59 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
3
|
from decimal import Decimal
|
|
4
|
+
from typing import overload
|
|
4
5
|
|
|
5
6
|
import algosdk
|
|
6
7
|
from typing_extensions import Self
|
|
7
8
|
|
|
8
|
-
__all__ = ["AlgoAmount"]
|
|
9
|
+
__all__ = ["ALGORAND_MIN_TX_FEE", "AlgoAmount", "algo", "micro_algo", "transaction_fees"]
|
|
9
10
|
|
|
10
11
|
|
|
11
12
|
class AlgoAmount:
|
|
12
13
|
"""Wrapper class to ensure safe, explicit conversion between µAlgo, Algo and numbers.
|
|
13
14
|
|
|
14
|
-
:param amount: A dictionary containing either algos, algo, microAlgos, or microAlgo as key
|
|
15
|
-
and their corresponding value as an integer or Decimal.
|
|
16
|
-
:raises ValueError: If an invalid amount format is provided.
|
|
17
|
-
|
|
18
15
|
:example:
|
|
19
|
-
>>> amount = AlgoAmount(
|
|
20
|
-
>>> amount = AlgoAmount(
|
|
16
|
+
>>> amount = AlgoAmount(algos=1)
|
|
17
|
+
>>> amount = AlgoAmount(algo=1)
|
|
18
|
+
>>> amount = AlgoAmount.from_algos(1)
|
|
19
|
+
>>> amount = AlgoAmount.from_algo(1)
|
|
20
|
+
>>> amount = AlgoAmount(micro_algos=1_000_000)
|
|
21
|
+
>>> amount = AlgoAmount(micro_algo=1_000_000)
|
|
22
|
+
>>> amount = AlgoAmount.from_micro_algos(1_000_000)
|
|
23
|
+
>>> amount = AlgoAmount.from_micro_algo(1_000_000)
|
|
21
24
|
"""
|
|
22
25
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
26
|
+
@overload
|
|
27
|
+
def __init__(self, *, micro_algos: int) -> None: ...
|
|
28
|
+
|
|
29
|
+
@overload
|
|
30
|
+
def __init__(self, *, micro_algo: int) -> None: ...
|
|
31
|
+
|
|
32
|
+
@overload
|
|
33
|
+
def __init__(self, *, algos: int | Decimal) -> None: ...
|
|
34
|
+
|
|
35
|
+
@overload
|
|
36
|
+
def __init__(self, *, algo: int | Decimal) -> None: ...
|
|
37
|
+
|
|
38
|
+
def __init__(
|
|
39
|
+
self,
|
|
40
|
+
*,
|
|
41
|
+
micro_algos: int | None = None,
|
|
42
|
+
micro_algo: int | None = None,
|
|
43
|
+
algos: int | Decimal | None = None,
|
|
44
|
+
algo: int | Decimal | None = None,
|
|
45
|
+
):
|
|
46
|
+
if micro_algos is None and micro_algo is None and algos is None and algo is None:
|
|
47
|
+
raise ValueError("No amount provided")
|
|
48
|
+
|
|
49
|
+
if micro_algos is not None:
|
|
50
|
+
self.amount_in_micro_algo = int(micro_algos)
|
|
51
|
+
elif micro_algo is not None:
|
|
52
|
+
self.amount_in_micro_algo = int(micro_algo)
|
|
53
|
+
elif algos is not None:
|
|
54
|
+
self.amount_in_micro_algo = int(algos * algosdk.constants.MICROALGOS_TO_ALGOS_RATIO)
|
|
55
|
+
elif algo is not None:
|
|
56
|
+
self.amount_in_micro_algo = int(algo * algosdk.constants.MICROALGOS_TO_ALGOS_RATIO)
|
|
32
57
|
else:
|
|
33
58
|
raise ValueError("Invalid amount provided")
|
|
34
59
|
|
|
@@ -74,7 +99,7 @@ class AlgoAmount:
|
|
|
74
99
|
:example:
|
|
75
100
|
>>> amount = AlgoAmount.from_algos(1)
|
|
76
101
|
"""
|
|
77
|
-
return AlgoAmount(
|
|
102
|
+
return AlgoAmount(algos=amount)
|
|
78
103
|
|
|
79
104
|
@staticmethod
|
|
80
105
|
def from_algo(amount: int | Decimal) -> AlgoAmount:
|
|
@@ -86,7 +111,7 @@ class AlgoAmount:
|
|
|
86
111
|
:example:
|
|
87
112
|
>>> amount = AlgoAmount.from_algo(1)
|
|
88
113
|
"""
|
|
89
|
-
return AlgoAmount(
|
|
114
|
+
return AlgoAmount(algo=amount)
|
|
90
115
|
|
|
91
116
|
@staticmethod
|
|
92
117
|
def from_micro_algos(amount: int) -> AlgoAmount:
|
|
@@ -98,7 +123,7 @@ class AlgoAmount:
|
|
|
98
123
|
:example:
|
|
99
124
|
>>> amount = AlgoAmount.from_micro_algos(1_000_000)
|
|
100
125
|
"""
|
|
101
|
-
return AlgoAmount(
|
|
126
|
+
return AlgoAmount(micro_algos=amount)
|
|
102
127
|
|
|
103
128
|
@staticmethod
|
|
104
129
|
def from_micro_algo(amount: int) -> AlgoAmount:
|
|
@@ -110,7 +135,7 @@ class AlgoAmount:
|
|
|
110
135
|
:example:
|
|
111
136
|
>>> amount = AlgoAmount.from_micro_algo(1_000_000)
|
|
112
137
|
"""
|
|
113
|
-
return AlgoAmount(
|
|
138
|
+
return AlgoAmount(micro_algo=amount)
|
|
114
139
|
|
|
115
140
|
def __str__(self) -> str:
|
|
116
141
|
return f"{self.micro_algo:,} µALGO"
|
|
@@ -196,3 +221,36 @@ class AlgoAmount:
|
|
|
196
221
|
else:
|
|
197
222
|
raise TypeError(f"Unsupported operand type(s) for -: 'AlgoAmount' and '{type(other).__name__}'")
|
|
198
223
|
return self
|
|
224
|
+
|
|
225
|
+
|
|
226
|
+
# Helper functions
|
|
227
|
+
def algo(algos: int) -> AlgoAmount:
|
|
228
|
+
"""Create an AlgoAmount object representing the given number of Algo.
|
|
229
|
+
|
|
230
|
+
:param algos: The number of Algo to create an AlgoAmount object for.
|
|
231
|
+
:return: An AlgoAmount object representing the given number of Algo.
|
|
232
|
+
"""
|
|
233
|
+
return AlgoAmount.from_algos(algos)
|
|
234
|
+
|
|
235
|
+
|
|
236
|
+
def micro_algo(microalgos: int) -> AlgoAmount:
|
|
237
|
+
"""Create an AlgoAmount object representing the given number of µAlgo.
|
|
238
|
+
|
|
239
|
+
:param microalgos: The number of µAlgo to create an AlgoAmount object for.
|
|
240
|
+
:return: An AlgoAmount object representing the given number of µAlgo.
|
|
241
|
+
"""
|
|
242
|
+
return AlgoAmount.from_micro_algos(microalgos)
|
|
243
|
+
|
|
244
|
+
|
|
245
|
+
ALGORAND_MIN_TX_FEE = micro_algo(1_000)
|
|
246
|
+
|
|
247
|
+
|
|
248
|
+
def transaction_fees(number_of_transactions: int) -> AlgoAmount:
|
|
249
|
+
"""Calculate the total transaction fees for a given number of transactions.
|
|
250
|
+
|
|
251
|
+
:param number_of_transactions: The number of transactions to calculate the fees for.
|
|
252
|
+
:return: The total transaction fees.
|
|
253
|
+
"""
|
|
254
|
+
|
|
255
|
+
total_micro_algos = number_of_transactions * ALGORAND_MIN_TX_FEE.micro_algos
|
|
256
|
+
return micro_algo(total_micro_algos)
|
|
@@ -14,16 +14,16 @@ 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=
|
|
17
|
+
algokit_utils/accounts/account_manager.py,sha256=pQjfdDeoi5694QYD-EmvlVpuSvIYdFH_e0LKXkcwzRA,39369
|
|
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
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=
|
|
24
|
+
algokit_utils/applications/app_client.py,sha256=xHpcZhp6l1PO6OeY009rJ-T3rOyRAS7xrA3evAKI1Jk,83432
|
|
25
25
|
algokit_utils/applications/app_deployer.py,sha256=RrSmIsbN84z0lNtGD8JP2FwkDmsAD_HvF8b4kHnCSmo,23099
|
|
26
|
-
algokit_utils/applications/app_factory.py,sha256=
|
|
26
|
+
algokit_utils/applications/app_factory.py,sha256=wljyXuXWaMc3KJkDeACJ5XVEfIsVxeSXqdGTJ9p3tJQ,33425
|
|
27
27
|
algokit_utils/applications/app_manager.py,sha256=EA1uRtmvPVAdKi1I5HSCpHjIDgLN7eZcEPT0Cj3C7fU,17661
|
|
28
28
|
algokit_utils/applications/app_spec/__init__.py,sha256=HtjAhAqHNFml9WbRKGmhJnwyJeW8AztPRO_BriQ84vs,140
|
|
29
29
|
algokit_utils/applications/app_spec/arc32.py,sha256=8MMGUopPzkWq48rl5sYbc2Awf-RKnxSX8F0P0UibK5M,7523
|
|
@@ -39,7 +39,7 @@ algokit_utils/beta/client_manager.py,sha256=xDFvsMSha0Ki42BGvKvfScQWT_W9y4GeP_RW
|
|
|
39
39
|
algokit_utils/beta/composer.py,sha256=xDFvsMSha0Ki42BGvKvfScQWT_W9y4GeP_RWXjc3vnE,213
|
|
40
40
|
algokit_utils/clients/__init__.py,sha256=qUuKBvfLnw4z6ZU9x7mc-mLjfnnXC9UcvtoeU33ZLJ8,136
|
|
41
41
|
algokit_utils/clients/client_manager.py,sha256=DzJMf_jdQoZYNcy0sK34Uv-IenqJmfAupkqzo_Asp-A,25683
|
|
42
|
-
algokit_utils/clients/dispenser_api_client.py,sha256=
|
|
42
|
+
algokit_utils/clients/dispenser_api_client.py,sha256=lx6II3beCt7YiKO2TrW6UbsRVirf3NoWMJi8HD_W5nI,6045
|
|
43
43
|
algokit_utils/common.py,sha256=5wl83vWw91RYdEC4hTTufqaptKiFtgjKLIyONDmRSH0,300
|
|
44
44
|
algokit_utils/config.py,sha256=Fd466a33pyqmblKn3YUEoSqMSGbKDmZeaS5Uu7_CNHw,7029
|
|
45
45
|
algokit_utils/deploy.py,sha256=UUtSDI6JcBUuto62FuirhUlDcjZwQyLkiERgDMx8P7A,330
|
|
@@ -49,7 +49,7 @@ algokit_utils/errors/logic_error.py,sha256=uxqUOU9-D1R5TrKturCbmmWRVlB024Ca4CfVi
|
|
|
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
51
|
algokit_utils/models/account.py,sha256=TdeKjhYkppD8g0DYRGbnCsi8zfPz3zU74DaZte_CYJw,6014
|
|
52
|
-
algokit_utils/models/amount.py,sha256=
|
|
52
|
+
algokit_utils/models/amount.py,sha256=2Eb5W9IduM4hqvWz0bpD8-8htKhhmUonaLCuz9c2_1w,9411
|
|
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
|
|
55
55
|
algokit_utils/models/simulate.py,sha256=F9OSEfA9QGFGe5po24h8IGLor5z1ogu5Cwm3l6cHnAs,236
|
|
@@ -64,7 +64,7 @@ algokit_utils/transactions/__init__.py,sha256=7fYF3m6DyOGzbV36MT5svo0wSkj9AIz496
|
|
|
64
64
|
algokit_utils/transactions/transaction_composer.py,sha256=yGLFgJk51BKgnwbGYmmuDIE7WPpZZmHqVAVZ7IWcRDQ,94794
|
|
65
65
|
algokit_utils/transactions/transaction_creator.py,sha256=A1YHeGC2EkR2V0HPYJiXVOAEIrfjBW2KVyYgi3exm4E,6167
|
|
66
66
|
algokit_utils/transactions/transaction_sender.py,sha256=uQmHElJgUIxLXfdklMNoabjQQzUku8CFP82wwhfr44E,22769
|
|
67
|
-
algokit_utils-3.0.
|
|
68
|
-
algokit_utils-3.0.
|
|
69
|
-
algokit_utils-3.0.
|
|
70
|
-
algokit_utils-3.0.
|
|
67
|
+
algokit_utils-3.0.0b4.dist-info/LICENSE,sha256=J5i7U1Q9Q2c7saUzlvFRmrCCFhQyXb5Juz_LO5omNUw,1076
|
|
68
|
+
algokit_utils-3.0.0b4.dist-info/METADATA,sha256=-QVF-0xUq7DMn6ZLnL4uBA5M0pnI5yh2UrjuDOBFCOk,2416
|
|
69
|
+
algokit_utils-3.0.0b4.dist-info/WHEEL,sha256=IYZQI976HJqqOpQU6PHkJ8fb3tMNBFjg-Cn-pwAbaFM,88
|
|
70
|
+
algokit_utils-3.0.0b4.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|