Skip to content

Commit

Permalink
docs: minor refinements in deprecation strings
Browse files Browse the repository at this point in the history
  • Loading branch information
aorumbayev committed Feb 11, 2025
1 parent bcf77fd commit 9ddd321
Show file tree
Hide file tree
Showing 10 changed files with 38 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ Tracks and returns an account that represents a logic signature.
A logic signature account wrapper
* **Example:**
```pycon
>>> account = account.logic_sig(program, [new Uint8Array(3, ...)])
>>> account = account.logicsig(program, [new Uint8Array(3, ...)])
```

#### 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)
Expand Down
10 changes: 5 additions & 5 deletions docs/markdown/capabilities/app-deploy.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,9 @@ It will automatically [add metadata to the transaction note of the create or upd
The first parameter `deployment` is an `AppDeployParams`, which is an object with:

- `metadata: AppDeployMetadata` - determines the [deployment metadata]() of the deployment
- `create_params: AppCreateParams | CreateCallABI` - the parameters for an [app creation call](app.md#creation) (raw parameters or ABI method call)
- `update_params: AppUpdateParams | UpdateCallABI` - the parameters for an [app update call](app.md#updating) (raw parameters or ABI method call) without the `app_id`, `approval_program`, or `clear_state_program` as these are handled by the deploy logic
- `delete_params: AppDeleteParams | DeleteCallABI` - the parameters for an [app delete call](app.md#deleting) (raw parameters or ABI method call) without the `app_id` parameter
- `create_params: AppCreateParams | CreateCallABI` - the parameters for an [app creation call](app.md) (raw parameters or ABI method call)
- `update_params: AppUpdateParams | UpdateCallABI` - the parameters for an [app update call](app.md) (raw parameters or ABI method call) without the `app_id`, `approval_program`, or `clear_state_program` as these are handled by the deploy logic
- `delete_params: AppDeleteParams | DeleteCallABI` - the parameters for an [app delete call](app.md) (raw parameters or ABI method call) without the `app_id` parameter
- `deploy_time_params: TealTemplateParams | None` - optional parameters for [TEAL template substitution]()
- `TealTemplateParams` is a dict that replaces `TMPL_{key}` with `value` (strings/Uint8Arrays are properly encoded)
- `on_schema_break: OnSchemaBreak | str | None` - determines `OnSchemaBreak` if schema requirements increase (values: ‘replace’, ‘fail’, ‘append’)
Expand Down Expand Up @@ -204,11 +204,11 @@ The `deploy` call itself may do one of the following (which you can determine by
- `OperationPerformed.REPLACE` - The smart contract app was deleted and created again (in an atomic transaction)
- `OperationPerformed.NOTHING` - Nothing was done since it was detected the existing smart contract app deployment was up to date

As well as the `operation_performed` parameter and the [optional compilation result](), the return value will have the [`ApplicationMetaData`]() [fields]() present.
As well as the `operation_performed` parameter and the [optional compilation result](), the return value will have the [`ApplicationMetaData`](../autoapi/algokit_utils/applications/app_deployer/index.md#algokit_utils.applications.app_deployer.ApplicationMetaData) [fields]() present.

Based on the value of `operation_performed`, there will be other data available in the return value:

- If `CREATE`, `UPDATE` or `REPLACE` then it will have the relevant [`SendAppTransactionResult`](app.md#calling-an-app) values:
- If `CREATE`, `UPDATE` or `REPLACE` then it will have the relevant [`SendAppTransactionResult`](../autoapi/algokit_utils/transactions/transaction_sender/index.md#algokit_utils.transactions.transaction_sender.SendAppTransactionResult) values:
- `create_result` for create operations
- `update_result` for update operations
- If `REPLACE` then it will also have `delete_result` to capture the result of deleting the existing app
12 changes: 6 additions & 6 deletions docs/source/capabilities/app-deploy.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,9 @@ It will automatically [add metadata to the transaction note of the create or upd
The first parameter `deployment` is an {py:obj}`AppDeployParams <algokit_utils.models.app_deployer.AppDeployParams>`, which is an object with:

- `metadata: AppDeployMetadata` - determines the [deployment metadata](#deployment-metadata) of the deployment
- `create_params: AppCreateParams | CreateCallABI` - the parameters for an [app creation call](./app.md#creation) (raw parameters or ABI method call)
- `update_params: AppUpdateParams | UpdateCallABI` - the parameters for an [app update call](./app.md#updating) (raw parameters or ABI method call) without the `app_id`, `approval_program`, or `clear_state_program` as these are handled by the deploy logic
- `delete_params: AppDeleteParams | DeleteCallABI` - the parameters for an [app delete call](./app.md#deleting) (raw parameters or ABI method call) without the `app_id` parameter
- `create_params: AppCreateParams | CreateCallABI` - the parameters for an [app creation call](./app.md) (raw parameters or ABI method call)
- `update_params: AppUpdateParams | UpdateCallABI` - the parameters for an [app update call](./app.md) (raw parameters or ABI method call) without the `app_id`, `approval_program`, or `clear_state_program` as these are handled by the deploy logic
- `delete_params: AppDeleteParams | DeleteCallABI` - the parameters for an [app delete call](./app.md) (raw parameters or ABI method call) without the `app_id` parameter
- `deploy_time_params: TealTemplateParams | None` - optional parameters for [TEAL template substitution](#compilation-and-template-substitution)
- {py:obj}`TealTemplateParams <algokit_utils.models.app_deployer.TealTemplateParams>` is a dict that replaces `TMPL_{key}` with `value` (strings/Uint8Arrays are properly encoded)
- `on_schema_break: OnSchemaBreak | str | None` - determines {py:obj}`OnSchemaBreak <algokit_utils.models.app_deployer.OnSchemaBreak>` if schema requirements increase (values: 'replace', 'fail', 'append')
Expand All @@ -171,7 +171,7 @@ The first parameter `deployment` is an {py:obj}`AppDeployParams <algokit_utils.m

### Compilation and template substitution

When compiling TEAL template code, the capabilities described in the [above design](#design) are present, namely the ability to supply deploy-time parameters and the ability to control immutability and permanence of the smart contract at deploy-time.
When compiling TEAL template code, the capabilities described in the [above design](#smart-contract-development-lifecycle) are present, namely the ability to supply deploy-time parameters and the ability to control immutability and permanence of the smart contract at deploy-time.

In order for a smart contract to opt-in to use this functionality, it must have a TEAL Template that contains the following:

Expand Down Expand Up @@ -204,11 +204,11 @@ The `deploy` call itself may do one of the following (which you can determine by
- `OperationPerformed.REPLACE` - The smart contract app was deleted and created again (in an atomic transaction)
- `OperationPerformed.NOTHING` - Nothing was done since it was detected the existing smart contract app deployment was up to date

As well as the `operation_performed` parameter and the [optional compilation result](#compilation-and-template-substitution), the return value will have the [`ApplicationMetaData`](../code/classes/algokit_utils.applications.app_deployer.ApplicationMetaData.md) [fields](#deployment-metadata) present.
As well as the `operation_performed` parameter and the [optional compilation result](#compilation-and-template-substitution), the return value will have the {py:obj}`ApplicationMetaData <algokit_utils.applications.app_deployer.ApplicationMetaData>` [fields](#deployment-metadata) present.

Based on the value of `operation_performed`, there will be other data available in the return value:

- If `CREATE`, `UPDATE` or `REPLACE` then it will have the relevant [`SendAppTransactionResult`](./app.md#calling-an-app) values:
- If `CREATE`, `UPDATE` or `REPLACE` then it will have the relevant {py:obj}`SendAppTransactionResult <algokit_utils.transactions.transaction_sender.SendAppTransactionResult>` values:
- `create_result` for create operations
- `update_result` for update operations
- If `REPLACE` then it will also have `delete_result` to capture the result of deleting the existing app
4 changes: 3 additions & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@
autoapi_options = ['members',
'undoc-members',
'show-inheritance',
'show-module-summary']
'show-module-summary',
"prune"]

autoapi_ignore = ['*algokit_utils/beta/__init__.py',
'*algokit_utils/asset.py',
'*algokit_utils/deploy.py',
Expand Down
1 change: 1 addition & 0 deletions src/algokit_utils/_legacy_v2/_ensure_funded.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
)


@deprecated("Use `algorand.account.ensure_funded()` instead")
@dataclass(kw_only=True)
class EnsureBalanceParameters:
"""Parameters for ensuring an account has a minimum number of µALGOs"""
Expand Down
7 changes: 5 additions & 2 deletions src/algokit_utils/_legacy_v2/_transfer.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
logger = logging.getLogger(__name__)


@deprecated("Send transactions via `algorand.{send|create_transaction}.{txn_type}()` instead")
@dataclasses.dataclass(kw_only=True)
class TransferParametersBase:
"""Parameters for transferring µALGOs between accounts.
Expand All @@ -39,13 +40,15 @@ class TransferParametersBase:
max_fee_micro_algos: int | None = None


@deprecated("Use `algorand.send.payment(...)` / `algorand.create_transaction.payment(...)` instead")
@dataclasses.dataclass(kw_only=True)
class TransferParameters(TransferParametersBase):
"""Parameters for transferring µALGOs between accounts"""

micro_algos: int


@deprecated("Use `algorand.send.asset_transfer(...)` / `algorand.create_transaction.asset_transfer(...)` instead")
@dataclasses.dataclass(kw_only=True)
class TransferAssetParameters(TransferParametersBase):
"""Parameters for transferring assets between accounts.
Expand Down Expand Up @@ -79,7 +82,7 @@ def _check_fee(transaction: PaymentTxn | AssetTransferTxn, max_fee: int | None)
)


@deprecated("Use the `TransactionComposer` abstraction instead to construct appropriate transfer transactions")
@deprecated("Use `algorand.send.payment(...)` / `algorand.create_transaction.payment(...)` instead")
def transfer(client: "AlgodClient", parameters: TransferParameters) -> PaymentTxn:
"""Transfer µALGOs between accounts"""

Expand All @@ -100,7 +103,7 @@ def transfer(client: "AlgodClient", parameters: TransferParameters) -> PaymentTx
return result


@deprecated("Use the `TransactionComposer` abstraction instead to construct appropriate transfer transactions")
@deprecated("Use `algorand.send.asset_transfer(...)` / `algorand.create_transaction.asset_transfer(...)` instead")
def transfer_asset(client: "AlgodClient", parameters: TransferAssetParameters) -> AssetTransferTxn:
"""Transfer assets between accounts"""

Expand Down
10 changes: 5 additions & 5 deletions src/algokit_utils/_legacy_v2/account.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ def get_account_from_mnemonic(mnemonic: str) -> Account:
return Account(private_key=private_key, address=address)


@deprecated("Use `algorand.account.from_kmd()` instead. Example: " "`account = algorand.account.from_kmd(name)`")
@deprecated(
"Use `algorand.account.kmd.get_or_create_wallet_account(name, fund_with)` or `KMDAccountManager(clientManager).get_or_create_wallet_account(name, fund_with)` instead"
)
def create_kmd_wallet_account(kmd_client: "KMDClient", name: str) -> Account:
"""Creates a wallet with specified name"""
wallet_id = kmd_client.create_wallet(name, "")["id"]
Expand All @@ -56,8 +58,7 @@ def create_kmd_wallet_account(kmd_client: "KMDClient", name: str) -> Account:


@deprecated(
"Use `algorand.account.from_kmd()` instead. Example: "
"`account = algorand.account.from_kmd(name, fund_with=AlgoAmount.from_algo(1000))`"
"Use `algorand.account.kmd.get_or_create_wallet_account(name, fund_with)` or `KMDAccountManager(clientManager).get_or_create_wallet_account(name, fund_with)` instead"
)
def get_or_create_kmd_wallet_account(
client: "AlgodClient", name: str, fund_with_algos: float = 1000, kmd_client: "KMDClient | None" = None
Expand Down Expand Up @@ -100,8 +101,7 @@ def _is_default_account(account: dict[str, Any]) -> bool:


@deprecated(
"Use `algorand.account.from_kmd()` instead. Example: "
"`account = algorand.account.from_kmd('unencrypted-default-wallet', lambda a: a['status'] != 'Offline' and a['amount'] > 1_000_000_000)`"
"Use `algorand.account.localnet_dispenser()` or `algorand.account.from_kmd('unencrypted-default-wallet', lambda a: a['status'] != 'Offline' and a['amount'] > 1_000_000_000)`"
)
def get_localnet_default_account(client: "AlgodClient") -> Account:
"""Returns the default Account in a LocalNet instance"""
Expand Down
2 changes: 1 addition & 1 deletion src/algokit_utils/_legacy_v2/deploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ def _parse_note(metadata_b64: str | None) -> AppDeployMetaData | None:
return None


@deprecated("Use algorand.appDeployer.get_creator_apps_by_name() instead. ")
@deprecated("Use algorand.app_deployer.get_creator_apps_by_name() instead. ")
def get_creator_apps(indexer: "IndexerClient", creator_account: Account | str) -> AppLookup:
"""Returns a mapping of Application names to {py:class}`AppMetaData` for all Applications created by specified
creator that have a transaction note containing {py:class}`AppDeployMetaData`
Expand Down
16 changes: 10 additions & 6 deletions src/algokit_utils/_legacy_v2/network_clients.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,14 @@ class AlgoClientConfigs:
kmd_config: AlgoClientConfig | None


@deprecated("Use AlgorandClient.client.algod")
@deprecated("Use `ClientManager.get_default_localnet_config(config)` instead")
def get_default_localnet_config(config: Literal["algod", "indexer", "kmd"]) -> AlgoClientConfig:
"""Returns the client configuration to point to the default LocalNet"""
port = {"algod": 4001, "indexer": 8980, "kmd": 4002}[config]
return AlgoClientConfig(server=f"http://localhost:{port}", token="a" * 64)


@deprecated("Use AlgorandClient.testnet() or AlgorandClient.mainnet() instead")
@deprecated("Use `ClientManager.get_algonode_config(network, config)` instead")
def get_algonode_config(
network: Literal["testnet", "mainnet"], config: Literal["algod", "indexer"], token: str
) -> AlgoClientConfig:
Expand All @@ -59,7 +59,9 @@ def get_algonode_config(
)


@deprecated("Use AlgorandClient.from_environment() instead.")
@deprecated(
"Use `ClientManager.get_algod_client(config)` or `ClientManager.get_algod_client_from_environment()` instead."
)
def get_algod_client(config: AlgoClientConfig | None = None) -> AlgodClient:
"""Returns an {py:class}`algosdk.v2client.algod.AlgodClient` from `config` or environment
Expand All @@ -69,7 +71,7 @@ def get_algod_client(config: AlgoClientConfig | None = None) -> AlgodClient:
return AlgodClient(config.token, config.server, headers)


@deprecated("Use AlgorandClient.default_localnet().kmd instead")
@deprecated("Use `ClientManager.get_kmd_client(config)` or `ClientManager.get_kmd_client_from_environment()` instead.")
def get_kmd_client(config: AlgoClientConfig | None = None) -> KMDClient:
"""Returns an {py:class}`algosdk.kmd.KMDClient` from `config` or environment
Expand All @@ -78,7 +80,9 @@ def get_kmd_client(config: AlgoClientConfig | None = None) -> KMDClient:
return KMDClient(config.token, config.server)


@deprecated("Use AlgorandClient.client.from_environment().indexer instead")
@deprecated(
"Use `ClientManager.get_indexer_client(config)` or `ClientManager.get_indexer_client_from_environment()` instead."
)
def get_indexer_client(config: AlgoClientConfig | None = None) -> IndexerClient:
"""Returns an {py:class}`algosdk.v2client.indexer.IndexerClient` from `config` or environment.
Expand Down Expand Up @@ -109,7 +113,7 @@ def is_testnet(client: AlgodClient) -> bool:
return params.gen in ["testnet-v1.0", "testnet-v1", "testnet"]


@deprecated("Use AlgorandClient.default_localnet().kmd instead")
@deprecated("Use `ClientManager.get_kmd_client(config)` or `ClientManager.get_kmd_client_from_environment()` instead.")
def get_kmd_client_from_algod_client(client: AlgodClient) -> KMDClient:
"""Returns an {py:class}`algosdk.kmd.KMDClient` from supplied `client`
Expand Down
2 changes: 1 addition & 1 deletion src/algokit_utils/accounts/account_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ def logicsig(self, program: bytes, args: list[bytes] | None = None) -> LogicSigA
:returns: A logic signature account wrapper
:example:
>>> account = account.logic_sig(program, [new Uint8Array(3, ...)])
>>> account = account.logicsig(program, [new Uint8Array(3, ...)])
"""
return self._register_logicsig(program, args)

Expand Down

0 comments on commit 9ddd321

Please sign in to comment.