Skip to content

Commit b8071a8

Browse files
fix: addressing internal feedback (3) (#134)
* fix: ensure server+port is assembled when instantiating algosdk abstractions * fix: algosdk configs respecting port field; Edge case for auto fee handling for readonly calls * refactor: remove plural forms from AlgoAmount * chore: addressing pr comments * fix: adjust handling of readonly method fee coverage * refactor: further align static get_{}_client methods in ClientManager with ts implementation * docs: fixing autogenerated urls; fixing docstring warnings --------- Co-authored-by: Neil Campbell <neil.campbell@makerx.com.au>
1 parent 0693abc commit b8071a8

File tree

43 files changed

+1677
-1393
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+1677
-1393
lines changed

.github/workflows/check-python.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@ jobs:
4545
- name: Check types with mypy
4646
run: poetry run mypy
4747

48+
- name: Check docstrings are up to date
49+
run: poetry run poe docstrings-check
50+
4851
# TODO: Restore before prod release of v3
4952
# - name: Check docs are up to date
5053
# run: |

docs/markdown/autoapi/algokit_utils/accounts/account_manager/index.md

Lines changed: 174 additions & 194 deletions
Large diffs are not rendered by default.

docs/markdown/autoapi/algokit_utils/assets/asset_manager/index.md

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -39,22 +39,21 @@ Information about an Algorand Standard Asset (ASA).
3939
* **decimals** – The amount of decimal places the asset was created with
4040
* **default_frozen** – Whether the asset was frozen by default for all accounts, defaults to None
4141
* **manager** – The address of the optional account that can manage the configuration of the asset and destroy it,
42-
43-
defaults to None
44-
:ivar reserve: The address of the optional account that holds the reserve (uncirculated supply) units of the asset,
45-
defaults to None
46-
:ivar freeze: The address of the optional account that can be used to freeze or unfreeze holdings of this asset,
47-
defaults to None
48-
:ivar clawback: The address of the optional account that can clawback holdings of this asset from any account,
49-
defaults to None
50-
:ivar unit_name: The optional name of the unit of this asset (e.g. ticker name), defaults to None
51-
:ivar unit_name_b64: The optional name of the unit of this asset as bytes, defaults to None
52-
:ivar asset_name: The optional name of the asset, defaults to None
53-
:ivar asset_name_b64: The optional name of the asset as bytes, defaults to None
54-
:ivar url: Optional URL where more information about the asset can be retrieved, defaults to None
55-
:ivar url_b64: Optional URL where more information about the asset can be retrieved as bytes, defaults to None
56-
:ivar metadata_hash: 32-byte hash of some metadata that is relevant to the asset and/or asset holders,
57-
defaults to None
42+
defaults to None
43+
* **reserve** – The address of the optional account that holds the reserve (uncirculated supply) units of the asset,
44+
defaults to None
45+
* **freeze** – The address of the optional account that can be used to freeze or unfreeze holdings of this asset,
46+
defaults to None
47+
* **clawback** – The address of the optional account that can clawback holdings of this asset from any account,
48+
defaults to None
49+
* **unit_name** – The optional name of the unit of this asset (e.g. ticker name), defaults to None
50+
* **unit_name_b64** – The optional name of the unit of this asset as bytes, defaults to None
51+
* **asset_name** – The optional name of the asset, defaults to None
52+
* **asset_name_b64** – The optional name of the asset as bytes, defaults to None
53+
* **url** – Optional URL where more information about the asset can be retrieved, defaults to None
54+
* **url_b64** – Optional URL where more information about the asset can be retrieved as bytes, defaults to None
55+
* **metadata_hash** – 32-byte hash of some metadata that is relevant to the asset and/or asset holders,
56+
defaults to None
5857

5958
#### asset_id *: int*
6059

docs/markdown/autoapi/algokit_utils/clients/client_manager/index.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ Get an application client by creator address and name.
188188
* **Returns:**
189189
Application client instance
190190

191-
#### *static* get_algod_client(config: [algokit_utils.models.network.AlgoClientNetworkConfig](../../models/network/index.md#algokit_utils.models.network.AlgoClientNetworkConfig) | None = None) → algosdk.v2client.algod.AlgodClient
191+
#### *static* get_algod_client(config: [algokit_utils.models.network.AlgoClientNetworkConfig](../../models/network/index.md#algokit_utils.models.network.AlgoClientNetworkConfig)) → algosdk.v2client.algod.AlgodClient
192192

193193
Get an Algod client from config or environment.
194194

@@ -204,7 +204,7 @@ Get an Algod client from environment variables.
204204
* **Returns:**
205205
Algod client instance
206206

207-
#### *static* get_kmd_client(config: [algokit_utils.models.network.AlgoClientNetworkConfig](../../models/network/index.md#algokit_utils.models.network.AlgoClientNetworkConfig) | None = None) → algosdk.kmd.KMDClient
207+
#### *static* get_kmd_client(config: [algokit_utils.models.network.AlgoClientNetworkConfig](../../models/network/index.md#algokit_utils.models.network.AlgoClientNetworkConfig)) → algosdk.kmd.KMDClient
208208

209209
Get a KMD client from config or environment.
210210

@@ -220,7 +220,7 @@ Get a KMD client from environment variables.
220220
* **Returns:**
221221
KMD client instance
222222

223-
#### *static* get_indexer_client(config: [algokit_utils.models.network.AlgoClientNetworkConfig](../../models/network/index.md#algokit_utils.models.network.AlgoClientNetworkConfig) | None = None) → algosdk.v2client.indexer.IndexerClient
223+
#### *static* get_indexer_client(config: [algokit_utils.models.network.AlgoClientNetworkConfig](../../models/network/index.md#algokit_utils.models.network.AlgoClientNetworkConfig)) → algosdk.v2client.indexer.IndexerClient
224224

225225
Get an Indexer client from config or environment.
226226

docs/markdown/autoapi/algokit_utils/models/amount/index.md

Lines changed: 16 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -19,35 +19,19 @@
1919

2020
## Module Contents
2121

22-
### *class* algokit_utils.models.amount.AlgoAmount(\*, micro_algos: int)
23-
2422
### *class* algokit_utils.models.amount.AlgoAmount(\*, micro_algo: int)
2523

26-
### *class* algokit_utils.models.amount.AlgoAmount(\*, algos: int | decimal.Decimal)
27-
2824
### *class* algokit_utils.models.amount.AlgoAmount(\*, algo: int | decimal.Decimal)
2925

3026
Wrapper class to ensure safe, explicit conversion between µAlgo, Algo and numbers.
3127

3228
* **Example:**
33-
34-
```pycon
35-
>>> amount = AlgoAmount(algos=1)
36-
>>> amount = AlgoAmount(algo=1)
37-
>>> amount = AlgoAmount.from_algos(1)
38-
>>> amount = AlgoAmount.from_algo(1)
39-
>>> amount = AlgoAmount(micro_algos=1_000_000)
40-
>>> amount = AlgoAmount(micro_algo=1_000_000)
41-
>>> amount = AlgoAmount.from_micro_algos(1_000_000)
42-
>>> amount = AlgoAmount.from_micro_algo(1_000_000)
43-
```
44-
45-
#### *property* micro_algos *: int*
46-
47-
Return the amount as a number in µAlgo.
48-
49-
* **Returns:**
50-
The amount in µAlgo.
29+
```pycon
30+
>>> amount = AlgoAmount(algo=1)
31+
>>> amount = AlgoAmount.from_algo(1)
32+
>>> amount = AlgoAmount(micro_algo=1_000_000)
33+
>>> amount = AlgoAmount.from_micro_algo(1_000_000)
34+
```
5135

5236
#### *property* micro_algo *: int*
5337

@@ -56,34 +40,13 @@ Return the amount as a number in µAlgo.
5640
* **Returns:**
5741
The amount in µAlgo.
5842

59-
#### *property* algos *: decimal.Decimal*
60-
61-
Return the amount as a number in Algo.
62-
63-
* **Returns:**
64-
The amount in Algo.
65-
6643
#### *property* algo *: decimal.Decimal*
6744

6845
Return the amount as a number in Algo.
6946

7047
* **Returns:**
7148
The amount in Algo.
7249

73-
#### *static* from_algos(amount: int | decimal.Decimal) → [AlgoAmount](#algokit_utils.models.amount.AlgoAmount)
74-
75-
Create an AlgoAmount object representing the given number of Algo.
76-
77-
* **Parameters:**
78-
**amount** – The amount in Algo.
79-
* **Returns:**
80-
An AlgoAmount instance.
81-
* **Example:**
82-
83-
```pycon
84-
>>> amount = AlgoAmount.from_algos(1)
85-
```
86-
8750
#### *static* from_algo(amount: int | decimal.Decimal) → [AlgoAmount](#algokit_utils.models.amount.AlgoAmount)
8851

8952
Create an AlgoAmount object representing the given number of Algo.
@@ -93,24 +56,9 @@ Create an AlgoAmount object representing the given number of Algo.
9356
* **Returns:**
9457
An AlgoAmount instance.
9558
* **Example:**
96-
97-
```pycon
98-
>>> amount = AlgoAmount.from_algo(1)
99-
```
100-
101-
#### *static* from_micro_algos(amount: int) → [AlgoAmount](#algokit_utils.models.amount.AlgoAmount)
102-
103-
Create an AlgoAmount object representing the given number of µAlgo.
104-
105-
* **Parameters:**
106-
**amount** – The amount in µAlgo.
107-
* **Returns:**
108-
An AlgoAmount instance.
109-
* **Example:**
110-
111-
```pycon
112-
>>> amount = AlgoAmount.from_micro_algos(1_000_000)
113-
```
59+
```pycon
60+
>>> amount = AlgoAmount.from_algo(1)
61+
```
11462

11563
#### *static* from_micro_algo(amount: int) → [AlgoAmount](#algokit_utils.models.amount.AlgoAmount)
11664

@@ -121,26 +69,25 @@ Create an AlgoAmount object representing the given number of µAlgo.
12169
* **Returns:**
12270
An AlgoAmount instance.
12371
* **Example:**
72+
```pycon
73+
>>> amount = AlgoAmount.from_micro_algo(1_000_000)
74+
```
12475

125-
```pycon
126-
>>> amount = AlgoAmount.from_micro_algo(1_000_000)
127-
```
128-
129-
### algokit_utils.models.amount.algo(algos: int) → [AlgoAmount](#algokit_utils.models.amount.AlgoAmount)
76+
### algokit_utils.models.amount.algo(algo: int) → [AlgoAmount](#algokit_utils.models.amount.AlgoAmount)
13077

13178
Create an AlgoAmount object representing the given number of Algo.
13279

13380
* **Parameters:**
134-
**algos** – The number of Algo to create an AlgoAmount object for.
81+
**algo** – The number of Algo to create an AlgoAmount object for.
13582
* **Returns:**
13683
An AlgoAmount object representing the given number of Algo.
13784

138-
### algokit_utils.models.amount.micro_algo(microalgos: int) → [AlgoAmount](#algokit_utils.models.amount.AlgoAmount)
85+
### algokit_utils.models.amount.micro_algo(micro_algo: int) → [AlgoAmount](#algokit_utils.models.amount.AlgoAmount)
13986

14087
Create an AlgoAmount object representing the given number of µAlgo.
14188

14289
* **Parameters:**
143-
**microalgos** – The number of µAlgo to create an AlgoAmount object for.
90+
**micro_algo** – The number of µAlgo to create an AlgoAmount object for.
14491
* **Returns:**
14592
An AlgoAmount object representing the given number of µAlgo.
14693

docs/markdown/autoapi/algokit_utils/models/network/index.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,18 @@ Connection details for connecting to an {py:class}\`algosdk.v2client.algod.Algod
1515

1616
#### server *: str*
1717

18-
URL for the service e.g. http://localhost:4001 or https://testnet-api.algonode.cloud
18+
URL for the service e.g. http://localhost or https://testnet-api.algonode.cloud
1919

2020
#### token *: str | None* *= None*
2121

22-
API Token to authenticate with the service
22+
API Token to authenticate with the service e.g ‘4001’ or ‘8980’
2323

2424
#### port *: str | int | None* *= None*
2525

26+
#### full_url() → str
27+
28+
Returns the full URL for the service
29+
2630
### *class* algokit_utils.models.network.AlgoClientConfigs
2731

2832
#### algod_config *: [AlgoClientNetworkConfig](#algokit_utils.models.network.AlgoClientNetworkConfig)*

docs/markdown/autoapi/algokit_utils/transactions/transaction_composer/index.md

Lines changed: 55 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,10 @@
3636

3737
## Functions
3838

39-
| [`send_atomic_transaction_composer`](#algokit_utils.transactions.transaction_composer.send_atomic_transaction_composer)(...) | Send an AtomicTransactionComposer transaction group. |
40-
|--------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------|
39+
| [`populate_app_call_resources`](#algokit_utils.transactions.transaction_composer.populate_app_call_resources)(...) | Populate application call resources based on simulation results. |
40+
|------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------|
41+
| [`prepare_group_for_sending`](#algokit_utils.transactions.transaction_composer.prepare_group_for_sending)(...) | Prepare a transaction group for sending by handling execution info and resources. |
42+
| [`send_atomic_transaction_composer`](#algokit_utils.transactions.transaction_composer.send_atomic_transaction_composer)(...) | Send an AtomicTransactionComposer transaction group. |
4143

4244
## Module Contents
4345

@@ -51,8 +53,7 @@ Parameters for a payment transaction.
5153
* **receiver** – The account that will receive the ALGO
5254
* **amount** – Amount to send
5355
* **close_remainder_to** – If given, close the sender account and send the remaining balance to this address,
54-
55-
defaults to None
56+
defaults to None
5657

5758
#### receiver *: str*
5859

@@ -317,19 +318,18 @@ Bases: `_CommonTxnParams`
317318
Parameters for creating an application.
318319

319320
* **Variables:**
320-
**approval_program** – The program to execute for all OnCompletes other than ClearState as raw teal (string)
321-
322-
or compiled teal (bytes)
323-
:ivar clear_state_program: The program to execute for ClearState OnComplete as raw teal (string)
324-
or compiled teal (bytes)
325-
:ivar schema: The state schema for the app. This is immutable, defaults to None
326-
:ivar on_complete: The OnComplete action (cannot be ClearState), defaults to None
327-
:ivar args: Application arguments, defaults to None
328-
:ivar account_references: Account references, defaults to None
329-
:ivar app_references: App references, defaults to None
330-
:ivar asset_references: Asset references, defaults to None
331-
:ivar box_references: Box references, defaults to None
332-
:ivar extra_program_pages: Number of extra pages required for the programs, defaults to None
321+
* **approval_program** – The program to execute for all OnCompletes other than ClearState as raw teal (string)
322+
or compiled teal (bytes)
323+
* **clear_state_program** – The program to execute for ClearState OnComplete as raw teal (string)
324+
or compiled teal (bytes)
325+
* **schema** – The state schema for the app. This is immutable, defaults to None
326+
* **on_complete** – The OnComplete action (cannot be ClearState), defaults to None
327+
* **args** – Application arguments, defaults to None
328+
* **account_references** – Account references, defaults to None
329+
* **app_references** – App references, defaults to None
330+
* **asset_references** – Asset references, defaults to None
331+
* **box_references** – Box references, defaults to None
332+
* **extra_program_pages** – Number of extra pages required for the programs, defaults to None
333333

334334
#### approval_program *: str | bytes*
335335

@@ -360,16 +360,15 @@ Parameters for updating an application.
360360
* **Variables:**
361361
* **app_id** – ID of the application
362362
* **approval_program** – The program to execute for all OnCompletes other than ClearState as raw teal (string)
363-
364-
or compiled teal (bytes)
365-
:ivar clear_state_program: The program to execute for ClearState OnComplete as raw teal (string)
366-
or compiled teal (bytes)
367-
:ivar args: Application arguments, defaults to None
368-
:ivar account_references: Account references, defaults to None
369-
:ivar app_references: App references, defaults to None
370-
:ivar asset_references: Asset references, defaults to None
371-
:ivar box_references: Box references, defaults to None
372-
:ivar on_complete: The OnComplete action, defaults to None
363+
or compiled teal (bytes)
364+
* **clear_state_program** – The program to execute for ClearState OnComplete as raw teal (string)
365+
or compiled teal (bytes)
366+
* **args** – Application arguments, defaults to None
367+
* **account_references** – Account references, defaults to None
368+
* **app_references** – App references, defaults to None
369+
* **asset_references** – Asset references, defaults to None
370+
* **box_references** – Box references, defaults to None
371+
* **on_complete** – The OnComplete action, defaults to None
373372

374373
#### app_id *: int*
375374

@@ -428,9 +427,8 @@ Parameters for a regular ABI method call.
428427
* **app_id** – ID of the application
429428
* **method** – The ABI method to call
430429
* **args** – Arguments to the ABI method, either an ABI value, transaction with explicit signer,
431-
432-
transaction, another method call, or None
433-
:ivar on_complete: The OnComplete action (cannot be UpdateApplication or ClearState), defaults to None
430+
transaction, another method call, or None
431+
* **on_complete** – The OnComplete action (cannot be UpdateApplication or ClearState), defaults to None
434432

435433
#### app_id *: int*
436434

@@ -553,6 +551,29 @@ Results from sending an AtomicTransactionComposer transaction group.
553551

554552
#### simulate_response *: dict[str, Any] | None* *= None*
555553

554+
### algokit_utils.transactions.transaction_composer.populate_app_call_resources(atc: algosdk.atomic_transaction_composer.AtomicTransactionComposer, algod: algosdk.v2client.algod.AlgodClient) → algosdk.atomic_transaction_composer.AtomicTransactionComposer
555+
556+
Populate application call resources based on simulation results.
557+
558+
* **Parameters:**
559+
* **atc** – The AtomicTransactionComposer containing transactions
560+
* **algod** – Algod client for simulation
561+
* **Returns:**
562+
Modified AtomicTransactionComposer with populated resources
563+
564+
### algokit_utils.transactions.transaction_composer.prepare_group_for_sending(atc: algosdk.atomic_transaction_composer.AtomicTransactionComposer, algod: algosdk.v2client.algod.AlgodClient, populate_app_call_resources: bool | None = None, cover_app_call_inner_transaction_fees: bool | None = None, additional_atc_context: AdditionalAtcContext | None = None) → algosdk.atomic_transaction_composer.AtomicTransactionComposer
565+
566+
Prepare a transaction group for sending by handling execution info and resources.
567+
568+
* **Parameters:**
569+
* **atc** – The AtomicTransactionComposer containing transactions
570+
* **algod** – Algod client for simulation
571+
* **populate_app_call_resources** – Whether to populate app call resources
572+
* **cover_app_call_inner_transaction_fees** – Whether to cover inner txn fees
573+
* **additional_atc_context** – Additional context for the AtomicTransactionComposer
574+
* **Returns:**
575+
Modified AtomicTransactionComposer ready for sending
576+
556577
### algokit_utils.transactions.transaction_composer.send_atomic_transaction_composer(atc: algosdk.atomic_transaction_composer.AtomicTransactionComposer, algod: algosdk.v2client.algod.AlgodClient, \*, max_rounds_to_wait: int | None = 5, skip_waiting: bool = False, suppress_log: bool | None = None, populate_app_call_resources: bool | None = None, cover_app_call_inner_transaction_fees: bool | None = None, additional_atc_context: AdditionalAtcContext | None = None) → [SendAtomicTransactionComposerResults](#algokit_utils.transactions.transaction_composer.SendAtomicTransactionComposerResults)
557578

558579
Send an AtomicTransactionComposer transaction group.
@@ -585,10 +606,9 @@ Supports various transaction types including payments, asset operations, applica
585606
* **algod** – An instance of AlgodClient used to get suggested params and send transactions
586607
* **get_signer** – A function that takes an address and returns a TransactionSigner for that address
587608
* **get_suggested_params** – Optional function to get suggested transaction parameters,
588-
589-
defaults to using algod.suggested_params()
590-
:param default_validity_window: Optional default validity window for transactions in rounds, defaults to 10
591-
:param app_manager: Optional AppManager instance for compiling TEAL programs, defaults to None
609+
defaults to using algod.suggested_params()
610+
* **default_validity_window** – Optional default validity window for transactions in rounds, defaults to 10
611+
* **app_manager** – Optional AppManager instance for compiling TEAL programs, defaults to None
592612

593613
#### add_transaction(transaction: algosdk.transaction.Transaction, signer: algosdk.atomic_transaction_composer.TransactionSigner | None = None) → [TransactionComposer](#algokit_utils.transactions.transaction_composer.TransactionComposer)
594614

@@ -819,7 +839,7 @@ Simulate transaction group execution with configurable validation rules.
819839
* **Parameters:**
820840
* **allow_more_logs** – Whether to allow more logs than the standard limit
821841
* **allow_empty_signatures** – Whether to allow transactions with empty signatures
822-
* **allow_unnamed_resources** – Whether to allow unnamed resources
842+
* **allow_unnamed_resources** – Whether to allow unnamed resources.
823843
* **extra_opcode_budget** – Additional opcode budget to allocate
824844
* **exec_trace_config** – Configuration for execution tracing
825845
* **simulation_round** – Round number to simulate at

0 commit comments

Comments
 (0)