Skip to content

Commit 636c897

Browse files
authored
docs: refining docstrings, adding more examples (#137)
* docs: fix typo in from_kmd documentation * docs: minor refinements in deprecation strings * chore: extra ignores in autoapi docs * chore: wip syncing with latest ts docstring examples * fix: wip on remaining docstrings sync + removing asset_id from fund method * docs: docstring examples * docs: remaining docstrings
1 parent a38843a commit 636c897

File tree

53 files changed

+5826
-1140
lines changed

Some content is hidden

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

53 files changed

+5826
-1140
lines changed

docs/markdown/autoapi/account_manager/index.md

Lines changed: 0 additions & 1 deletion
This file was deleted.

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

Lines changed: 100 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -28,98 +28,126 @@ Information about an Algorand account’s current status, balance and other prop
2828

2929
See https://developer.algorand.org/docs/rest-apis/algod/#account for detailed field descriptions.
3030

31-
* **Variables:**
32-
* **address** (*str*) – The account’s address
33-
* **amount** ([*AlgoAmount*](../../models/amount/index.md#algokit_utils.models.amount.AlgoAmount)) – The account’s current balance
34-
* **amount_without_pending_rewards** ([*AlgoAmount*](../../models/amount/index.md#algokit_utils.models.amount.AlgoAmount)) – The account’s balance without the pending rewards
35-
* **min_balance** ([*AlgoAmount*](../../models/amount/index.md#algokit_utils.models.amount.AlgoAmount)) – The account’s minimum required balance
36-
* **pending_rewards** ([*AlgoAmount*](../../models/amount/index.md#algokit_utils.models.amount.AlgoAmount)) – The amount of pending rewards
37-
* **rewards** ([*AlgoAmount*](../../models/amount/index.md#algokit_utils.models.amount.AlgoAmount)) – The amount of rewards earned
38-
* **round** (*int*) – The round for which this information is relevant
39-
* **status** (*str*) – The account’s status (e.g., ‘Offline’, ‘Online’)
40-
* **total_apps_opted_in** (*int* *|**None*) – Number of applications this account has opted into
41-
* **total_assets_opted_in** (*int* *|**None*) – Number of assets this account has opted into
42-
* **total_box_bytes** (*int* *|**None*) – Total number of box bytes used by this account
43-
* **total_boxes** (*int* *|**None*) – Total number of boxes used by this account
44-
* **total_created_apps** (*int* *|**None*) – Number of applications created by this account
45-
* **total_created_assets** (*int* *|**None*) – Number of assets created by this account
46-
* **apps_local_state** (*list* *[**dict* *]* *|**None*) – Local state of applications this account has opted into
47-
* **apps_total_extra_pages** (*int* *|**None*) – Number of extra pages allocated to applications
48-
* **apps_total_schema** (*dict* *|**None*) – Total schema for all applications
49-
* **assets** (*list* *[**dict* *]* *|**None*) – Assets held by this account
50-
* **auth_addr** (*str* *|**None*) – If rekeyed, the authorized address
51-
* **closed_at_round** (*int* *|**None*) – Round when this account was closed
52-
* **created_apps** (*list* *[**dict* *]* *|**None*) – Applications created by this account
53-
* **created_assets** (*list* *[**dict* *]* *|**None*) – Assets created by this account
54-
* **created_at_round** (*int* *|**None*) – Round when this account was created
55-
* **deleted** (*bool* *|**None*) – Whether this account is deleted
56-
* **incentive_eligible** (*bool* *|**None*) – Whether this account is eligible for incentives
57-
* **last_heartbeat** (*int* *|**None*) – Last heartbeat round for this account
58-
* **last_proposed** (*int* *|**None*) – Last round this account proposed a block
59-
* **participation** (*dict* *|**None*) – Participation information for this account
60-
* **reward_base** (*int* *|**None*) – Base reward for this account
61-
* **sig_type** (*str* *|**None*) – Signature type for this account
62-
6331
#### address *: str*
6432

33+
The account’s address
34+
6535
#### amount *: [algokit_utils.models.amount.AlgoAmount](../../models/amount/index.md#algokit_utils.models.amount.AlgoAmount)*
6636

37+
The account’s current balance
38+
6739
#### amount_without_pending_rewards *: [algokit_utils.models.amount.AlgoAmount](../../models/amount/index.md#algokit_utils.models.amount.AlgoAmount)*
6840

41+
The account’s balance without the pending rewards
42+
6943
#### min_balance *: [algokit_utils.models.amount.AlgoAmount](../../models/amount/index.md#algokit_utils.models.amount.AlgoAmount)*
7044

45+
The account’s minimum required balance
46+
7147
#### pending_rewards *: [algokit_utils.models.amount.AlgoAmount](../../models/amount/index.md#algokit_utils.models.amount.AlgoAmount)*
7248

49+
The amount of pending rewards
50+
7351
#### rewards *: [algokit_utils.models.amount.AlgoAmount](../../models/amount/index.md#algokit_utils.models.amount.AlgoAmount)*
7452

53+
The amount of rewards earned
54+
7555
#### round *: int*
7656

57+
The round for which this information is relevant
58+
7759
#### status *: str*
7860

61+
The account’s status (e.g., ‘Offline’, ‘Online’)
62+
7963
#### total_apps_opted_in *: int | None* *= None*
8064

65+
Number of applications this account has opted into
66+
8167
#### total_assets_opted_in *: int | None* *= None*
8268

69+
Number of assets this account has opted into
70+
8371
#### total_box_bytes *: int | None* *= None*
8472

73+
Total number of box bytes used by this account
74+
8575
#### total_boxes *: int | None* *= None*
8676

77+
Total number of boxes used by this account
78+
8779
#### total_created_apps *: int | None* *= None*
8880

81+
Number of applications created by this account
82+
8983
#### total_created_assets *: int | None* *= None*
9084

85+
Number of assets created by this account
86+
9187
#### apps_local_state *: list[dict] | None* *= None*
9288

89+
Local state of applications this account has opted into
90+
9391
#### apps_total_extra_pages *: int | None* *= None*
9492

93+
Number of extra pages allocated to applications
94+
9595
#### apps_total_schema *: dict | None* *= None*
9696

97+
Total schema for all applications
98+
9799
#### assets *: list[dict] | None* *= None*
98100

101+
Assets held by this account
102+
99103
#### auth_addr *: str | None* *= None*
100104

105+
If rekeyed, the authorized address
106+
101107
#### closed_at_round *: int | None* *= None*
102108

109+
Round when this account was closed
110+
103111
#### created_apps *: list[dict] | None* *= None*
104112

113+
Applications created by this account
114+
105115
#### created_assets *: list[dict] | None* *= None*
106116

117+
Assets created by this account
118+
107119
#### created_at_round *: int | None* *= None*
108120

121+
Round when this account was created
122+
109123
#### deleted *: bool | None* *= None*
110124

125+
Whether this account is deleted
126+
111127
#### incentive_eligible *: bool | None* *= None*
112128

129+
Whether this account is eligible for incentives
130+
113131
#### last_heartbeat *: int | None* *= None*
114132

133+
Last heartbeat round for this account
134+
115135
#### last_proposed *: int | None* *= None*
116136

137+
Last round this account proposed a block
138+
117139
#### participation *: dict | None* *= None*
118140

141+
Participation information for this account
142+
119143
#### reward_base *: int | None* *= None*
120144

145+
Base reward for this account
146+
121147
#### sig_type *: str | None* *= None*
122148

149+
Signature type for this account
150+
123151
### *class* algokit_utils.accounts.account_manager.AccountManager(client_manager: [algokit_utils.clients.client_manager.ClientManager](../../clients/client_manager/index.md#algokit_utils.clients.client_manager.ClientManager))
124152

125153
Creates and keeps track of signing accounts that can sign transactions for a sending address.
@@ -136,6 +164,15 @@ mnemonic-based, rekeyed, multisig, and logic signature accounts.
136164

137165
#### *property* kmd *: [algokit_utils.accounts.kmd_account_manager.KmdAccountManager](../kmd_account_manager/index.md#algokit_utils.accounts.kmd_account_manager.KmdAccountManager)*
138166

167+
KMD account manager that allows you to easily get and create accounts using KMD.
168+
169+
* **Return KmdAccountManager:**
170+
The ‘KmdAccountManager’ instance
171+
* **Example:**
172+
```pycon
173+
>>> kmd_manager = account_manager.kmd
174+
```
175+
139176
#### set_default_signer(signer: algosdk.atomic_transaction_composer.TransactionSigner | [algokit_utils.protocols.account.TransactionSignerAccountProtocol](../../protocols/account/index.md#algokit_utils.protocols.account.TransactionSignerAccountProtocol)) → typing_extensions.Self
140177

141178
Sets the default signer to use if no other signer is specified.
@@ -150,10 +187,7 @@ then an error will be thrown from get_signer / get_account.
150187
* **Example:**
151188
```pycon
152189
>>> signer_account = account_manager.random()
153-
>>> account_manager.set_default_signer(signer_account.signer)
154-
>>> # When signing a transaction, if there is no signer registered for the sender
155-
>>> # then the default signer will be used
156-
>>> signer = account_manager.get_signer("{SENDERADDRESS}")
190+
>>> account_manager.set_default_signer(signer_account)
157191
```
158192

159193
#### set_signer(sender: str, signer: algosdk.atomic_transaction_composer.TransactionSigner) → typing_extensions.Self
@@ -179,6 +213,10 @@ Merges the given AccountManager into this one.
179213
* **overwrite_existing** – Whether to overwrite existing signers in this manager
180214
* **Returns:**
181215
The AccountManager instance for method chaining
216+
* **Example:**
217+
```pycon
218+
>>> accountManager2.set_signers(accountManager1)
219+
```
182220

183221
#### set_signer_from_account(account: [algokit_utils.protocols.account.TransactionSignerAccountProtocol](../../protocols/account/index.md#algokit_utils.protocols.account.TransactionSignerAccountProtocol)) → typing_extensions.Self
184222

@@ -333,7 +371,7 @@ Tracks and returns an account that represents a logic signature.
333371
A logic signature account wrapper
334372
* **Example:**
335373
```pycon
336-
>>> account = account.logic_sig(program, [new Uint8Array(3, ...)])
374+
>>> account = account.logicsig(program, [new Uint8Array(3, ...)])
337375
```
338376

339377
#### multisig(metadata: [algokit_utils.models.account.MultisigMetadata](../../models/account/index.md#algokit_utils.models.account.MultisigMetadata), signing_accounts: list[[algokit_utils.models.account.SigningAccount](../../models/account/index.md#algokit_utils.models.account.SigningAccount)]) → [algokit_utils.models.account.MultiSigAccount](../../models/account/index.md#algokit_utils.models.account.MultiSigAccount)
@@ -434,22 +472,22 @@ Please be careful with this function and be sure to read the
434472
* **Example:**
435473
```pycon
436474
>>> # Basic example (with string addresses):
437-
>>> algorand.account.rekey_account({account: "ACCOUNTADDRESS", rekey_to: "NEWADDRESS"})
475+
>>> algorand.account.rekey_account("ACCOUNTADDRESS", "NEWADDRESS")
438476
>>> # Basic example (with signer accounts):
439-
>>> algorand.account.rekey_account({account: account1, rekey_to: newSignerAccount})
477+
>>> algorand.account.rekey_account(account1, newSignerAccount)
440478
>>> # Advanced example:
441-
>>> algorand.account.rekey_account({
442-
... account: "ACCOUNTADDRESS",
443-
... rekey_to: "NEWADDRESS",
444-
... lease: 'lease',
445-
... note: 'note',
446-
... first_valid_round: 1000,
447-
... validity_window: 10,
448-
... extra_fee: AlgoAmount.from_micro_algo(1000),
449-
... static_fee: AlgoAmount.from_micro_algo(1000),
450-
... max_fee: AlgoAmount.from_micro_algo(3000),
451-
... suppress_log: True,
452-
... })
479+
>>> algorand.account.rekey_account(
480+
... account="ACCOUNTADDRESS",
481+
... rekey_to="NEWADDRESS",
482+
... lease='lease',
483+
... note='note',
484+
... first_valid_round=1000,
485+
... validity_window=10,
486+
... extra_fee=AlgoAmount.from_micro_algo(1000),
487+
... static_fee=AlgoAmount.from_micro_algo(1000),
488+
... max_fee=AlgoAmount.from_micro_algo(3000),
489+
... suppress_log=True,
490+
... )
453491
```
454492

455493
#### ensure_funded(account_to_fund: str | [algokit_utils.models.account.SigningAccount](../../models/account/index.md#algokit_utils.models.account.SigningAccount), dispenser_account: str | [algokit_utils.models.account.SigningAccount](../../models/account/index.md#algokit_utils.models.account.SigningAccount), min_spending_balance: [algokit_utils.models.amount.AlgoAmount](../../models/amount/index.md#algokit_utils.models.amount.AlgoAmount), min_funding_increment: [algokit_utils.models.amount.AlgoAmount](../../models/amount/index.md#algokit_utils.models.amount.AlgoAmount) | None = None, send_params: [algokit_utils.models.transaction.SendParams](../../models/transaction/index.md#algokit_utils.models.transaction.SendParams) | None = None, signer: algosdk.atomic_transaction_composer.TransactionSigner | None = None, rekey_to: str | None = None, note: bytes | None = None, lease: bytes | None = None, static_fee: [algokit_utils.models.amount.AlgoAmount](../../models/amount/index.md#algokit_utils.models.amount.AlgoAmount) | None = None, extra_fee: [algokit_utils.models.amount.AlgoAmount](../../models/amount/index.md#algokit_utils.models.amount.AlgoAmount) | None = None, max_fee: [algokit_utils.models.amount.AlgoAmount](../../models/amount/index.md#algokit_utils.models.amount.AlgoAmount) | None = None, validity_window: int | None = None, first_valid_round: int | None = None, last_valid_round: int | None = None) → [EnsureFundedResult](#algokit_utils.accounts.account_manager.EnsureFundedResult) | None
@@ -484,13 +522,13 @@ See [https://developer.algorand.org/docs/get-details/accounts/#minimum-balance](
484522
* **Example:**
485523
```pycon
486524
>>> # Basic example:
487-
>>> algorand.account.ensure_funded("ACCOUNTADDRESS", "DISPENSERADDRESS", algokit.algo(1))
525+
>>> algorand.account.ensure_funded("ACCOUNTADDRESS", "DISPENSERADDRESS", AlgoAmount.from_algo(1))
488526
>>> # With configuration:
489527
>>> algorand.account.ensure_funded(
490528
... "ACCOUNTADDRESS",
491529
... "DISPENSERADDRESS",
492-
... algokit.algo(1),
493-
... min_funding_increment=algokit.algo(2),
530+
... AlgoAmount.from_algo(1),
531+
... min_funding_increment=AlgoAmount.from_algo(2),
494532
... fee=AlgoAmount.from_micro_algo(1000),
495533
... suppress_log=True
496534
... )
@@ -534,12 +572,12 @@ if it’s a rekeyed account, or against default LocalNet if no environment varia
534572
* **Example:**
535573
```pycon
536574
>>> # Basic example:
537-
>>> algorand.account.ensure_funded_from_environment("ACCOUNTADDRESS", algokit.algo(1))
575+
>>> algorand.account.ensure_funded_from_environment("ACCOUNTADDRESS", AlgoAmount.from_algo(1))
538576
>>> # With configuration:
539577
>>> algorand.account.ensure_funded_from_environment(
540578
... "ACCOUNTADDRESS",
541-
... algokit.algo(1),
542-
... min_funding_increment=algokit.algo(2),
579+
... AlgoAmount.from_algo(1),
580+
... min_funding_increment=AlgoAmount.from_algo(2),
543581
... fee=AlgoAmount.from_micro_algo(1000),
544582
... suppress_log=True
545583
... )
@@ -568,16 +606,16 @@ See [https://developer.algorand.org/docs/get-details/accounts/#minimum-balance](
568606
* **Example:**
569607
```pycon
570608
>>> # Basic example:
571-
>>> algorand.account.ensure_funded_from_testnet_dispenser_api(
609+
>>> account_manager.ensure_funded_from_testnet_dispenser_api(
572610
... "ACCOUNTADDRESS",
573611
... algorand.client.get_testnet_dispenser_from_environment(),
574-
... algokit.algo(1)
612+
... AlgoAmount.from_algo(1)
575613
... )
576614
>>> # With configuration:
577-
>>> algorand.account.ensure_funded_from_testnet_dispenser_api(
615+
>>> account_manager.ensure_funded_from_testnet_dispenser_api(
578616
... "ACCOUNTADDRESS",
579617
... algorand.client.get_testnet_dispenser_from_environment(),
580-
... algokit.algo(1),
581-
... min_funding_increment=algokit.algo(2)
618+
... AlgoAmount.from_algo(1),
619+
... min_funding_increment=AlgoAmount.from_algo(2)
582620
... )
583621
```

0 commit comments

Comments
 (0)