# algorand

## Classes

| [`AlgorandClient`](https://dev.algorand.co/reference/algokit-utils-py/api/algorand/#algokit_utils.algorand.AlgorandClient) | A client that brokers easy access to Algorand functionality. |
| --- | --- |

## Module Contents

### _class_ algokit_utils.algorand.AlgorandClient(config: [algokit_utils.models.network.AlgoClientConfigs](https://dev.algorand.co/reference/algokit-utils-py/api/models/network/#algokit_utils.models.network.AlgoClientConfigs) | [algokit_utils.clients.client_manager.AlgoSdkClients](https://dev.algorand.co/reference/algokit-utils-py/api/clients/client_manager/#algokit_utils.clients.client_manager.AlgoSdkClients))

A client that brokers easy access to Algorand functionality.

#### set_default_validity_window(validity_window: int) → typing_extensions.Self

Sets the default validity window for transactions.
- **Parameters:** **validity_window** – The number of rounds between the first and last valid rounds
- **Returns:** The AlgorandClient so method calls can be chained
- **Example:**
```python
algorand = AlgorandClient.mainnet().set_default_validity_window(1000);
```

#### set_default_signer(signer: algosdk.atomic_transaction_composer.TransactionSigner | [algokit_utils.protocols.account.TransactionSignerAccountProtocol](https://dev.algorand.co/reference/algokit-utils-py/api/protocols/account/#algokit_utils.protocols.account.TransactionSignerAccountProtocol)) → typing_extensions.Self

Sets the default signer to use if no other signer is specified.
- **Parameters:** **signer** – The signer to use, either a TransactionSigner or a TransactionSignerAccountProtocol
- **Returns:** The AlgorandClient so method calls can be chained
- **Example:**
```python
signer = SigningAccount(private_key=..., address=...)

algorand = AlgorandClient.mainnet().set_default_signer(signer)
```

#### set_signer(sender: str, signer: algosdk.atomic_transaction_composer.TransactionSigner) → typing_extensions.Self

Tracks the given account for later signing.
- **Parameters:**
  - **sender** – The sender address to use this signer for
  - **signer** – The signer to sign transactions with for the given sender
- **Returns:** The AlgorandClient so method calls can be chained
- **Example:**
```python
signer = SigningAccount(private_key=..., address=...)

algorand = AlgorandClient.mainnet().set_signer(signer.addr, signer.signer)
```

#### set_signer_from_account(signer: [algokit_utils.protocols.account.TransactionSignerAccountProtocol](https://dev.algorand.co/reference/algokit-utils-py/api/protocols/account/#algokit_utils.protocols.account.TransactionSignerAccountProtocol)) → typing_extensions.Self

Sets the default signer to use if no other signer is specified.
- **Parameters:** **signer** – The signer to use, either a TransactionSigner or a TransactionSignerAccountProtocol
- **Returns:** The AlgorandClient so method calls can be chained
- **Example:**
```python
accountManager = AlgorandClient.mainnet()

accountManager.set_signer_from_account(TransactionSignerAccount(address=..., signer=...))

accountManager.set_signer_from_account(algosdk.LogicSigAccount(program, args))

accountManager.set_signer_from_account(SigningAccount(private_key=..., address=...))

accountManager.set_signer_from_account(MultisigAccount(metadata, signing_accounts))

accountManager.set_signer_from_account(account)
```

#### set_suggested_params_cache(suggested_params: algosdk.transaction.SuggestedParams, until: float | None = None) → typing_extensions.Self

Sets a cache value to use for suggested params.
- **Parameters:**
  - **suggested_params** – The suggested params to use
  - **until** – A timestamp until which to cache, or if not specified then the timeout is used
- **Returns:** The AlgorandClient so method calls can be chained
- **Example:**
```python
algorand = AlgorandClient.mainnet().set_suggested_params_cache(suggested_params, time.time() + 3.6e6)
```

#### set_suggested_params_cache_timeout(timeout: int) → typing_extensions.Self

Sets the timeout for caching suggested params.
- **Parameters:** **timeout** – The timeout in milliseconds
- **Returns:** The AlgorandClient so method calls can be chained
- **Example:**
```python
algorand = AlgorandClient.mainnet().set_suggested_params_cache_timeout(10_000)
```

#### get_suggested_params() → algosdk.transaction.SuggestedParams

Get suggested params for a transaction (either cached or from algod if the cache is stale or empty)
- **Example:**
```python
algorand = AlgorandClient.mainnet().get_suggested_params()
```

#### register_error_transformer(transformer: algokit_utils.transactions.transaction_composer.ErrorTransformer) → typing_extensions.Self

Register a function that will be used to transform an error caught when simulating or executing composed transaction groups made from new_group
- **Parameters:** **transformer** – The error transformer function
- **Returns:** The AlgorandClient so you can chain method calls

#### unregister_error_transformer(transformer: algokit_utils.transactions.transaction_composer.ErrorTransformer) → typing_extensions.Self

Unregister an error transformer function
- **Parameters:** **transformer** – The error transformer function to remove
- **Returns:** The AlgorandClient so you can chain method calls

#### new_group() → [algokit_utils.transactions.transaction_composer.TransactionComposer](https://dev.algorand.co/reference/algokit-utils-py/api/transactions/transaction_composer/#algokit_utils.transactions.transaction_composer.TransactionComposer)

Start a new TransactionComposer transaction group
- **Example:**
```python
composer = AlgorandClient.mainnet().new_group()

result = await composer.add_transaction(payment).send()
```

#### _property_ client _: [algokit_utils.clients.client_manager.ClientManager](https://dev.algorand.co/reference/algokit-utils-py/api/clients/client_manager/#algokit_utils.clients.client_manager.ClientManager)_

Get clients, including algosdk clients and app clients.
- **Example:**
```python
clientManager = AlgorandClient.mainnet().client
```

#### _property_ account _: [algokit_utils.accounts.account_manager.AccountManager](https://dev.algorand.co/reference/algokit-utils-py/api/accounts/account_manager/#algokit_utils.accounts.account_manager.AccountManager)

Get or create accounts that can sign transactions.
- **Example:**
```python
accountManager = AlgorandClient.mainnet().account
```

#### _property_ asset _: [algokit_utils.assets.asset_manager.AssetManager](https://dev.algorand.co/reference/algokit-utils-py/api/assets/asset_manager/#algokit_utils.assets.asset_manager.AssetManager)

Get or create assets.
- **Example:**
```python
assetManager = AlgorandClient.mainnet().asset
```

#### _property_ app _: [algokit_utils.applications.app_manager.AppManager](https://dev.algorand.co/reference/algokit-utils-py/api/applications/app_manager/#algokit_utils.applications.app_manager.AppManager)

Get or create applications.
- **Example:**
```python
appManager = AlgorandClient.mainnet().app
```

#### _property_ app*deployer *: [algokit_utils.applications.app_deployer.AppDeployer](https://dev.algorand.co/reference/algokit-utils-py/api/applications/app_deployer/#algokit_utils.applications.app_deployer.AppDeployer)_

Get or create applications.
- **Example:**
```python
appDeployer = AlgorandClient.mainnet().app_deployer
```

#### _property_ send _: [algokit_utils.transactions.transaction_sender.AlgorandClientTransactionSender](https://dev.algorand.co/reference/algokit-utils-py/api/transactions/transaction_sender/#algokit_utils.transactions.transaction_sender.AlgorandClientTransactionSender)

Methods for sending a transaction and waiting for confirmation
- **Example:**
```python
result = await AlgorandClient.mainnet().send.payment(

PaymentParams(

sender="SENDERADDRESS",

receiver="RECEIVERADDRESS",

amount=AlgoAmount(algo-1)

))
```

#### _property_ create*transaction *: [algokit_utils.transactions.transaction_creator.AlgorandClientTransactionCreator](https://dev.algorand.co/reference/algokit-utils-py/api/transactions/transaction_creator/#algokit_utils.transactions.transaction_creator.AlgorandClientTransactionCreator)

Methods for building transactions
- **Example:**
```python
transaction = AlgorandClient.mainnet().create_transaction.payment(

PaymentParams(

sender="SENDERADDRESS",

receiver="RECEIVERADDRESS",

amount=AlgoAmount(algo=1)

))
```

#### _static_ default_localnet() → [AlgorandClient](https://dev.algorand.co/reference/algokit-utils-py/api/algorand/#algokit_utils.algorand.AlgorandClient)

Returns an AlgorandClient pointing at default LocalNet ports and API token.
- **Returns:** The AlgorandClient
- **Example:**
```python
algorand = AlgorandClient.default_localnet()
```

#### _static_ testnet() → [AlgorandClient](https://dev.algorand.co/reference/algokit-utils-py/api/algorand/#algokit_utils.algorand.AlgorandClient)

Returns an AlgorandClient pointing at TestNet using AlgoNode.
- **Returns:** The AlgorandClient
- **Example:**
```python
algorand = AlgorandClient.testnet()
```

#### _static_ mainnet() → [AlgorandClient](https://dev.algorand.co/reference/algokit-utils-py/api/algorand/#algokit_utils.algorand.AlgorandClient)

Returns an AlgorandClient pointing at MainNet using AlgoNode.
- **Returns:** The AlgorandClient
- **Example:**
```python
algorand = AlgorandClient.mainnet()
```

#### _static_ from_clients(algod: algosdk.v2client.algod.AlgodClient, indexer: algosdk.v2client.indexer.IndexerClient | None = None, kmd: algosdk.kmd.KMDClient | None = None) → [AlgorandClient](https://dev.algorand.co/reference/algokit-utils-py/api/algorand/#algokit_utils.algorand.AlgorandClient)

Returns an AlgorandClient pointing to the given client(s).
- **Parameters:**
  - **algod** – The algod client to use
  - **indexer** – The indexer client to use
  - **kmd** – The kmd client to use
- **Returns:** The AlgorandClient
- **Example:**
```python
algorand = AlgorandClient.from_clients(algod, indexer, kmd)
```

#### _static_ from_environment() → [AlgorandClient](https://dev.algorand.co/reference/algokit-utils-py/api/algorand/#algokit_utils.algorand.AlgorandClient)

Returns an AlgorandClient loading the configuration from environment variables.
Retrieve configurations from environment variables when defined or get defaults.
Expects to be called from a Python environment.
- **Returns:** The AlgorandClient
- **Example:**
```python
algorand = AlgorandClient.from_environment()
```

#### _static_ from_config(algod_config: [algokit_utils.models.network.AlgoClientNetworkConfig](https://dev.algorand.co/reference/algokit-utils-py/api/models/network/#algokit_utils.models.network.AlgoClientNetworkConfig), indexer_config: [algokit_utils.models.network.AlgoClientNetworkConfig](https://dev.algorand.co/reference/algokit-utils-py/api/models/network/#algokit_utils.models.network.AlgoClientNetworkConfig) | None = None, kmd_config: [algokit_utils.models.network.AlgoClientNetworkConfig](https://dev.algorand.co/reference/algokit-utils-py/api/models/network/#algokit_utils.models.network.AlgoClientNetworkConfig) | None = None) → [AlgorandClient](https://dev.algorand.co/reference/algokit-utils-py/api/algorand/#algokit_utils.algorand.AlgorandClient)

Returns an AlgorandClient from the given config.
- **Parameters:**
  - **algod_config** – The config to use for the algod client
  - **indexer_config** – The config to use for the indexer client
  - **kmd_config** – The config to use for the kmd client
- **Returns:** The AlgorandClient
- **Example:**
```python
algorand = AlgorandClient.from_config(algod_config, indexer_config, kmd_config)
```
