Skip to content

Commit 078be72

Browse files
committed
chore: adding draft deprecation warnings; wip
1 parent ae54304 commit 078be72

20 files changed

+1036
-587
lines changed

docs/markdown/index.md

Lines changed: 35 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -7,46 +7,47 @@ The goal of this library is to provide intuitive, productive utility functions t
77
Largely these functions wrap the underlying Algorand SDK, but provide a higher level interface with sensible defaults and capabilities for common tasks.
88

99
#### NOTE
10+
1011
If you prefer TypeScript there’s an equivalent [TypeScript utility library](https://github.com/algorandfoundation/algokit-utils-ts).
1112

1213
[Core principles]() | [Installation]() | [Usage]() | [Capabilities]() | [Reference docs]()
1314

1415
# Contents
1516

16-
* [Account management](capabilities/account.md)
17-
* [`Account`](capabilities/account.md#account)
18-
* [Client management](capabilities/client.md)
19-
* [Network configuration](capabilities/client.md#network-configuration)
20-
* [Clients](capabilities/client.md#clients)
21-
* [App client](capabilities/app-client.md)
22-
* [Design](capabilities/app-client.md#design)
23-
* [Creating an application client](capabilities/app-client.md#creating-an-application-client)
24-
* [Calling methods on the app](capabilities/app-client.md#calling-methods-on-the-app)
25-
* [Composing calls](capabilities/app-client.md#composing-calls)
26-
* [Reading state](capabilities/app-client.md#reading-state)
27-
* [Handling logic errors and diagnosing errors](capabilities/app-client.md#handling-logic-errors-and-diagnosing-errors)
28-
* [App deployment](capabilities/app-deploy.md)
29-
* [Design](capabilities/app-deploy.md#design)
30-
* [Finding apps by creator](capabilities/app-deploy.md#finding-apps-by-creator)
31-
* [Deploying an application](capabilities/app-deploy.md#deploying-an-application)
32-
* [Algo transfers](capabilities/transfer.md)
33-
* [Transferring Algos](capabilities/transfer.md#transferring-algos)
34-
* [Ensuring minimum Algos](capabilities/transfer.md#ensuring-minimum-algos)
35-
* [Transfering Assets](capabilities/transfer.md#transfering-assets)
36-
* [Dispenser](capabilities/transfer.md#dispenser)
37-
* [TestNet Dispenser Client](capabilities/dispenser-client.md)
38-
* [Creating a Dispenser Client](capabilities/dispenser-client.md#creating-a-dispenser-client)
39-
* [Funding an Account](capabilities/dispenser-client.md#funding-an-account)
40-
* [Registering a Refund](capabilities/dispenser-client.md#registering-a-refund)
41-
* [Getting Current Limit](capabilities/dispenser-client.md#getting-current-limit)
42-
* [Error Handling](capabilities/dispenser-client.md#error-handling)
43-
* [Debugger](capabilities/debugger.md)
44-
* [Configuration](capabilities/debugger.md#configuration)
45-
* [Debugging Utilities](capabilities/debugger.md#debugging-utilities)
46-
* [`algokit_utils`](apidocs/algokit_utils/algokit_utils.md)
47-
* [Data](apidocs/algokit_utils/algokit_utils.md#data)
48-
* [Classes](apidocs/algokit_utils/algokit_utils.md#classes)
49-
* [Functions](apidocs/algokit_utils/algokit_utils.md#functions)
17+
- [Account management](capabilities/account.md)
18+
- [`Account`](capabilities/account.md#account)
19+
- [Client management](capabilities/client.md)
20+
- [Network configuration](capabilities/client.md#network-configuration)
21+
- [Clients](capabilities/client.md#clients)
22+
- [App client](capabilities/app-client.md)
23+
- [Design](capabilities/app-client.md#design)
24+
- [Creating an application client](capabilities/app-client.md#creating-an-application-client)
25+
- [Calling methods on the app](capabilities/app-client.md#calling-methods-on-the-app)
26+
- [Composing calls](capabilities/app-client.md#composing-calls)
27+
- [Reading state](capabilities/app-client.md#reading-state)
28+
- [Handling logic errors and diagnosing errors](capabilities/app-client.md#handling-logic-errors-and-diagnosing-errors)
29+
- [App deployment](capabilities/app-deploy.md)
30+
- [Design](capabilities/app-deploy.md#design)
31+
- [Finding apps by creator](capabilities/app-deploy.md#finding-apps-by-creator)
32+
- [Deploying an application](capabilities/app-deploy.md#deploying-an-application)
33+
- [Algo transfers](capabilities/transfer.md)
34+
- [Transferring Algos](capabilities/transfer.md#transferring-algos)
35+
- [Ensuring minimum Algos](capabilities/transfer.md#ensuring-minimum-algos)
36+
- [Transfering Assets](capabilities/transfer.md#transfering-assets)
37+
- [Dispenser](capabilities/transfer.md#dispenser)
38+
- [TestNet Dispenser Client](capabilities/dispenser-client.md)
39+
- [Creating a Dispenser Client](capabilities/dispenser-client.md#creating-a-dispenser-client)
40+
- [Funding an Account](capabilities/dispenser-client.md#funding-an-account)
41+
- [Registering a Refund](capabilities/dispenser-client.md#registering-a-refund)
42+
- [Getting Current Limit](capabilities/dispenser-client.md#getting-current-limit)
43+
- [Error Handling](capabilities/dispenser-client.md#error-handling)
44+
- [Debugger](capabilities/debugger.md)
45+
- [Configuration](capabilities/debugger.md#configuration)
46+
- [Debugging Utilities](capabilities/debugger.md#debugging-utilities)
47+
- [`algokit_utils`](apidocs/algokit_utils/algokit_utils.md)
48+
- [Data](apidocs/algokit_utils/algokit_utils.md#data)
49+
- [Classes](apidocs/algokit_utils/algokit_utils.md#classes)
50+
- [Functions](apidocs/algokit_utils/algokit_utils.md#functions)
5051

5152
<a id="core-principles"></a>
5253

src/algokit_utils/_legacy_v2/_ensure_funded.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
from algosdk.atomic_transaction_composer import AccountTransactionSigner
55
from algosdk.transaction import SuggestedParams
66
from algosdk.v2client.algod import AlgodClient
7+
from deprecated import deprecated
78

89
from algokit_utils._legacy_v2._transfer import TransferParameters, transfer
910
from algokit_utils._legacy_v2.account import get_dispenser_account
@@ -115,6 +116,7 @@ def _fund_using_transfer(
115116
return EnsureFundedResponse(transaction_id=transaction_id, amount=response.amt)
116117

117118

119+
@deprecated(reason="Deprecated", version="3.0.0")
118120
def ensure_funded(
119121
client: AlgodClient,
120122
parameters: EnsureBalanceParameters,

src/algokit_utils/_legacy_v2/account.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
from algosdk.account import address_from_private_key
66
from algosdk.mnemonic import from_private_key, to_private_key
77
from algosdk.util import algos_to_microalgos
8+
from deprecated import deprecated
89

910
from algokit_utils._legacy_v2._transfer import TransferParameters, transfer
1011
from algokit_utils._legacy_v2.network_clients import get_kmd_client_from_algod_client, is_localnet
@@ -30,13 +31,15 @@
3031
_DEFAULT_ACCOUNT_MINIMUM_BALANCE = 1_000_000_000
3132

3233

34+
@deprecated(reason="Deprecated", version="3.0.0")
3335
def get_account_from_mnemonic(mnemonic: str) -> Account:
3436
"""Convert a mnemonic (25 word passphrase) into an Account"""
3537
private_key = to_private_key(mnemonic)
3638
address = address_from_private_key(private_key)
3739
return Account(private_key=private_key, address=address)
3840

3941

42+
@deprecated(reason="Deprecated", version="3.0.0")
4043
def create_kmd_wallet_account(kmd_client: "KMDClient", name: str) -> Account:
4144
"""Creates a wallet with specified name"""
4245
wallet_id = kmd_client.create_wallet(name, "")["id"]
@@ -50,6 +53,7 @@ def create_kmd_wallet_account(kmd_client: "KMDClient", name: str) -> Account:
5053
return get_account_from_mnemonic(from_private_key(private_account_key))
5154

5255

56+
@deprecated(reason="Deprecated", version="3.0.0")
5357
def get_or_create_kmd_wallet_account(
5458
client: "AlgodClient", name: str, fund_with_algos: float = 1000, kmd_client: "KMDClient | None" = None
5559
) -> Account:
@@ -90,6 +94,7 @@ def _is_default_account(account: dict[str, Any]) -> bool:
9094
return bool(account["status"] != "Offline" and account["amount"] > _DEFAULT_ACCOUNT_MINIMUM_BALANCE)
9195

9296

97+
@deprecated(reason="Deprecated", version="3.0.0")
9398
def get_localnet_default_account(client: "AlgodClient") -> Account:
9499
"""Returns the default Account in a LocalNet instance"""
95100
if not is_localnet(client):
@@ -102,13 +107,15 @@ def get_localnet_default_account(client: "AlgodClient") -> Account:
102107
return account
103108

104109

110+
@deprecated(reason="Deprecated", version="3.0.0")
105111
def get_dispenser_account(client: "AlgodClient") -> Account:
106112
"""Returns an Account based on DISPENSER_MNENOMIC environment variable or the default account on LocalNet"""
107113
if is_localnet(client):
108114
return get_localnet_default_account(client)
109115
return get_account(client, "DISPENSER")
110116

111117

118+
@deprecated(reason="Deprecated", version="3.0.0")
112119
def get_kmd_wallet_account(
113120
client: "AlgodClient",
114121
kmd_client: "KMDClient",
@@ -142,6 +149,7 @@ def get_kmd_wallet_account(
142149
return get_account_from_mnemonic(from_private_key(private_account_key))
143150

144151

152+
@deprecated(reason="Deprecated", version="3.0.0")
145153
def get_account(
146154
client: "AlgodClient", name: str, fund_with_algos: float = 1000, kmd_client: "KMDClient | None" = None
147155
) -> Account:

src/algokit_utils/_legacy_v2/application_client.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
from algosdk.constants import APP_PAGE_MAX_SIZE
2828
from algosdk.logic import get_application_address
2929
from algosdk.source_map import SourceMap
30+
from deprecated import deprecated
3031

3132
import algokit_utils._legacy_v2.application_specification as au_spec
3233
import algokit_utils._legacy_v2.deploy as au_deploy
@@ -83,6 +84,7 @@ def num_extra_program_pages(approval: bytes, clear: bytes) -> int:
8384
return ceil(((len(approval) + len(clear)) - APP_PAGE_MAX_SIZE) / APP_PAGE_MAX_SIZE)
8485

8586

87+
@deprecated(reason="Use AppClient from algokit_utils.applications instead", version="3.0.0")
8688
class ApplicationClient:
8789
"""A class that wraps an ARC-0032 app spec and provides high productivity methods to deploy and call the app"""
8890

@@ -1254,6 +1256,7 @@ def _try_convert_to_logic_error(
12541256
return None
12551257

12561258

1259+
@deprecated(reason="Deprecated", version="3.0.0")
12571260
def execute_atc_with_logic_error(
12581261
atc: AtomicTransactionComposer,
12591262
algod_client: "AlgodClient",

src/algokit_utils/_legacy_v2/application_specification.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
from algosdk.abi import Contract
99
from algosdk.abi.method import MethodDict
1010
from algosdk.transaction import StateSchema
11+
from deprecated import deprecated
1112

1213
__all__ = [
1314
"CallConfig",
@@ -136,6 +137,7 @@ def _decode_state_schema(data: dict[str, int]) -> StateSchema:
136137
)
137138

138139

140+
@deprecated(reason="Deprecated", version="3.0.0")
139141
@dataclasses.dataclass(kw_only=True)
140142
class ApplicationSpecification:
141143
"""ARC-0032 application specification

src/algokit_utils/_legacy_v2/asset.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
from algosdk.atomic_transaction_composer import AtomicTransactionComposer, TransactionWithSigner
55
from algosdk.constants import TX_GROUP_LIMIT
66
from algosdk.transaction import AssetTransferTxn
7+
from deprecated import deprecated
78

89
if TYPE_CHECKING:
910
from algosdk.v2client.algod import AlgodClient
@@ -68,6 +69,7 @@ def _ensure_asset_balance_conditions(
6869
raise ValueError(error_message)
6970

7071

72+
@deprecated(reason="Deprecated", version="3.0.0")
7173
def opt_in(algod_client: "AlgodClient", account: Account, asset_ids: list[int]) -> dict[int, str]:
7274
"""
7375
Opt-in to a list of assets on the Algorand blockchain. Before an account can receive a specific asset,
@@ -116,6 +118,7 @@ def opt_in(algod_client: "AlgodClient", account: Account, asset_ids: list[int])
116118
return result
117119

118120

121+
@deprecated(reason="Deprecated", version="3.0.0")
119122
def opt_out(algod_client: "AlgodClient", account: Account, asset_ids: list[int]) -> dict[int, str]:
120123
"""
121124
Opt out from a list of Algorand Standard Assets (ASAs) by transferring them back to their creators.

src/algokit_utils/_legacy_v2/deploy.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,7 @@ def _parse_note(metadata_b64: str | None) -> AppDeployMetaData | None:
175175
return None
176176

177177

178+
@deprecated(reason="Deprecated", version="3.0.0")
178179
def get_creator_apps(indexer: "IndexerClient", creator_account: Account | str) -> AppLookup:
179180
"""Returns a mapping of Application names to {py:class}`AppMetaData` for all Applications created by specified
180181
creator that have a transaction note containing {py:class}`AppDeployMetaData`
@@ -255,6 +256,7 @@ class AppChanges:
255256
schema_change_description: str | None
256257

257258

259+
@deprecated(reason="Deprecated", version="3.0.0")
258260
def check_for_app_changes(
259261
algod_client: "AlgodClient",
260262
*,

src/algokit_utils/_legacy_v2/network_clients.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
from algosdk.kmd import KMDClient
77
from algosdk.v2client.algod import AlgodClient
88
from algosdk.v2client.indexer import IndexerClient
9+
from deprecated import deprecated
910

1011
__all__ = [
1112
"AlgoClientConfig",
@@ -40,12 +41,14 @@ class AlgoClientConfigs:
4041
kmd_config: AlgoClientConfig | None
4142

4243

44+
@deprecated(reason="Deprecated", version="3.0.0")
4345
def get_default_localnet_config(config: Literal["algod", "indexer", "kmd"]) -> AlgoClientConfig:
4446
"""Returns the client configuration to point to the default LocalNet"""
4547
port = {"algod": 4001, "indexer": 8980, "kmd": 4002}[config]
4648
return AlgoClientConfig(server=f"http://localhost:{port}", token="a" * 64)
4749

4850

51+
@deprecated(reason="Deprecated", version="3.0.0")
4952
def get_algonode_config(
5053
network: Literal["testnet", "mainnet"], config: Literal["algod", "indexer"], token: str
5154
) -> AlgoClientConfig:
@@ -56,6 +59,7 @@ def get_algonode_config(
5659
)
5760

5861

62+
@deprecated(reason="Deprecated", version="3.0.0")
5963
def get_algod_client(config: AlgoClientConfig | None = None) -> AlgodClient:
6064
"""Returns an {py:class}`algosdk.v2client.algod.AlgodClient` from `config` or environment
6165
@@ -65,6 +69,7 @@ def get_algod_client(config: AlgoClientConfig | None = None) -> AlgodClient:
6569
return AlgodClient(config.token, config.server, headers)
6670

6771

72+
@deprecated(reason="Deprecated", version="3.0.0")
6873
def get_kmd_client(config: AlgoClientConfig | None = None) -> KMDClient:
6974
"""Returns an {py:class}`algosdk.kmd.KMDClient` from `config` or environment
7075
@@ -73,6 +78,7 @@ def get_kmd_client(config: AlgoClientConfig | None = None) -> KMDClient:
7378
return KMDClient(config.token, config.server)
7479

7580

81+
@deprecated(reason="Deprecated", version="3.0.0")
7682
def get_indexer_client(config: AlgoClientConfig | None = None) -> IndexerClient:
7783
"""Returns an {py:class}`algosdk.v2client.indexer.IndexerClient` from `config` or environment.
7884
@@ -82,24 +88,28 @@ def get_indexer_client(config: AlgoClientConfig | None = None) -> IndexerClient:
8288
return IndexerClient(config.token, config.server, headers)
8389

8490

91+
@deprecated(reason="Deprecated", version="3.0.0")
8592
def is_localnet(client: AlgodClient) -> bool:
8693
"""Returns True if client genesis is `devnet-v1` or `sandnet-v1`"""
8794
params = client.suggested_params()
8895
return params.gen in ["devnet-v1", "sandnet-v1", "dockernet-v1"]
8996

9097

98+
@deprecated(reason="Deprecated", version="3.0.0")
9199
def is_mainnet(client: AlgodClient) -> bool:
92100
"""Returns True if client genesis is `mainnet-v1`"""
93101
params = client.suggested_params()
94102
return params.gen in ["mainnet-v1.0", "mainnet-v1", "mainnet"]
95103

96104

105+
@deprecated(reason="Deprecated", version="3.0.0")
97106
def is_testnet(client: AlgodClient) -> bool:
98107
"""Returns True if client genesis is `testnet-v1`"""
99108
params = client.suggested_params()
100109
return params.gen in ["testnet-v1.0", "testnet-v1", "testnet"]
101110

102111

112+
@deprecated(reason="Deprecated", version="3.0.0")
103113
def get_kmd_client_from_algod_client(client: AlgodClient) -> KMDClient:
104114
"""Returns an {py:class}`algosdk.kmd.KMDClient` from supplied `client`
105115

0 commit comments

Comments
 (0)