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 c9cb26d
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 16 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
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 c9cb26d

Please sign in to comment.