algokit_utils.assets.asset_manager ================================== .. py:module:: algokit_utils.assets.asset_manager Classes ------- .. autoapisummary:: algokit_utils.assets.asset_manager.AccountAssetInformation algokit_utils.assets.asset_manager.AssetInformation algokit_utils.assets.asset_manager.BulkAssetOptInOutResult algokit_utils.assets.asset_manager.AssetManager Module Contents --------------- .. py:class:: AccountAssetInformation Information about an account's holding of a particular asset. .. py:attribute:: asset_id :type: int The ID of the asset .. py:attribute:: balance :type: int The amount of the asset held by the account .. py:attribute:: frozen :type: bool Whether the asset is frozen for this account .. py:attribute:: round :type: int The round this information was retrieved at .. py:class:: AssetInformation Information about an Algorand Standard Asset (ASA). .. py:attribute:: asset_id :type: int The ID of the asset .. py:attribute:: creator :type: str The address of the account that created the asset .. py:attribute:: total :type: int The total amount of the smallest divisible units that were created of the asset .. py:attribute:: decimals :type: int The amount of decimal places the asset was created with .. py:attribute:: default_frozen :type: bool | None :value: None Whether the asset was frozen by default for all accounts, defaults to None .. py:attribute:: manager :type: str | None :value: None The address of the optional account that can manage the configuration of the asset and destroy it, defaults to None .. py:attribute:: reserve :type: str | None :value: None The address of the optional account that holds the reserve (uncirculated supply) units of the asset, defaults to None .. py:attribute:: freeze :type: str | None :value: None The address of the optional account that can be used to freeze or unfreeze holdings of this asset, defaults to None .. py:attribute:: clawback :type: str | None :value: None The address of the optional account that can clawback holdings of this asset from any account, defaults to None .. py:attribute:: unit_name :type: str | None :value: None The optional name of the unit of this asset (e.g. ticker name), defaults to None .. py:attribute:: unit_name_b64 :type: bytes | None :value: None The optional name of the unit of this asset as bytes, defaults to None .. py:attribute:: asset_name :type: str | None :value: None The optional name of the asset, defaults to None .. py:attribute:: asset_name_b64 :type: bytes | None :value: None The optional name of the asset as bytes, defaults to None .. py:attribute:: url :type: str | None :value: None The optional URL where more information about the asset can be retrieved, defaults to None .. py:attribute:: url_b64 :type: bytes | None :value: None The optional URL where more information about the asset can be retrieved as bytes, defaults to None .. py:attribute:: metadata_hash :type: bytes | None :value: None The 32-byte hash of some metadata that is relevant to the asset and/or asset holders, defaults to None .. py:class:: BulkAssetOptInOutResult Result from performing a bulk opt-in or bulk opt-out for an account against a series of assets. :ivar asset_id: The ID of the asset opted into / out of :ivar transaction_id: The transaction ID of the resulting opt in / out .. py:attribute:: asset_id :type: int The ID of the asset opted into / out of .. py:attribute:: transaction_id :type: str The transaction ID of the resulting opt in / out .. py:class:: AssetManager(algod_client: algosdk.v2client.algod.AlgodClient, new_group: collections.abc.Callable[[], algokit_utils.transactions.transaction_composer.TransactionComposer]) A manager for Algorand Standard Assets (ASAs). :param algod_client: An algod client :param new_group: A function that creates a new TransactionComposer transaction group :example: >>> asset_manager = AssetManager(algod_client) .. py:method:: get_by_id(asset_id: int) -> AssetInformation Returns the current asset information for the asset with the given ID. :param asset_id: The ID of the asset :return: The asset information :example: >>> asset_manager = AssetManager(algod_client) >>> asset_info = asset_manager.get_by_id(1234567890) .. py:method:: get_account_information(sender: str | algokit_utils.models.account.SigningAccount | algosdk.atomic_transaction_composer.TransactionSigner, asset_id: int) -> AccountAssetInformation Returns the given sender account's asset holding for a given asset. :param sender: The address of the sender/account to look up :param asset_id: The ID of the asset to return a holding for :return: The account asset holding information :example: >>> asset_manager = AssetManager(algod_client) >>> account_asset_info = asset_manager.get_account_information(sender, asset_id) .. py:method:: bulk_opt_in(account: str, asset_ids: list[int], 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 | None = None, extra_fee: algokit_utils.models.amount.AlgoAmount | None = None, max_fee: algokit_utils.models.amount.AlgoAmount | None = None, validity_window: int | None = None, first_valid_round: int | None = None, last_valid_round: int | None = None, send_params: algokit_utils.models.transaction.SendParams | None = None) -> list[BulkAssetOptInOutResult] Opt an account in to a list of Algorand Standard Assets. :param account: The account to opt-in :param asset_ids: The list of asset IDs to opt-in to :param signer: The signer to use for the transaction, defaults to None :param rekey_to: The address to rekey the account to, defaults to None :param note: The note to include in the transaction, defaults to None :param lease: The lease to include in the transaction, defaults to None :param static_fee: The static fee to include in the transaction, defaults to None :param extra_fee: The extra fee to include in the transaction, defaults to None :param max_fee: The maximum fee to include in the transaction, defaults to None :param validity_window: The validity window to include in the transaction, defaults to None :param first_valid_round: The first valid round to include in the transaction, defaults to None :param last_valid_round: The last valid round to include in the transaction, defaults to None :param send_params: The send parameters to use for the transaction, defaults to None :return: An array of records matching asset ID to transaction ID of the opt in :example: >>> asset_manager = AssetManager(algod_client) >>> results = asset_manager.bulk_opt_in(account, asset_ids) .. py:method:: bulk_opt_out(*, account: str, asset_ids: list[int], ensure_zero_balance: bool = True, 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 | None = None, extra_fee: algokit_utils.models.amount.AlgoAmount | None = None, max_fee: algokit_utils.models.amount.AlgoAmount | None = None, validity_window: int | None = None, first_valid_round: int | None = None, last_valid_round: int | None = None, send_params: algokit_utils.models.transaction.SendParams | None = None) -> list[BulkAssetOptInOutResult] Opt an account out of a list of Algorand Standard Assets. :param account: The account to opt-out :param asset_ids: The list of asset IDs to opt-out of :param ensure_zero_balance: Whether to check if the account has a zero balance first, defaults to True :param signer: The signer to use for the transaction, defaults to None :param rekey_to: The address to rekey the account to, defaults to None :param note: The note to include in the transaction, defaults to None :param lease: The lease to include in the transaction, defaults to None :param static_fee: The static fee to include in the transaction, defaults to None :param extra_fee: The extra fee to include in the transaction, defaults to None :param max_fee: The maximum fee to include in the transaction, defaults to None :param validity_window: The validity window to include in the transaction, defaults to None :param first_valid_round: The first valid round to include in the transaction, defaults to None :param last_valid_round: The last valid round to include in the transaction, defaults to None :param send_params: The send parameters to use for the transaction, defaults to None :raises ValueError: If ensure_zero_balance is True and account has non-zero balance or is not opted in :return: An array of records matching asset ID to transaction ID of the opt out :example: >>> asset_manager = AssetManager(algod_client) >>> results = asset_manager.bulk_opt_out(account, asset_ids)