| Client Instantiation | This example demonstrates the different ways to create an AlgorandClient instance: - AlgorandClient.default_localnet() for local development
- AlgorandClient.testnet() for TestNet connection
- AlgorandClient.mainnet() for MainNet connection
- AlgorandClient.from_environment() reading from environment variables
- AlgorandClient.from_config() with explicit AlgoConfig object
- AlgorandClient.from_clients() with pre-configured algod/indexer/kmd clients
- Verifying connection by calling algod.status()
|
| AlgoAmount Utility | This example demonstrates how to use the AlgoAmount utility class to work with ALGO and microALGO amounts safely, avoiding floating point precision issues. Topics covered: - Creating AlgoAmount using static factory methods
- Accessing values in ALGO and microALGO
- String formatting
- Arithmetic operations (addition, subtraction)
- Comparison operations
- Using AlgoAmount with payment transactions
- Avoiding floating point precision issues
|
| Signer Configuration | This example demonstrates how to configure transaction signers on AlgorandClient: - set_default_signer() to set a fallback signer for all transactions
- set_signer_from_account() to register a signer from an Account object
- set_signer() to register a signer for a specific address
- How signers are automatically used when sending transactions
- Registering multiple signers for different accounts
- How the default signer is used when no specific signer is registered
|
| Suggested Params Configuration | This example demonstrates how to configure suggested transaction parameters: - set_default_validity_window() to set the number of rounds a transaction is valid
- set_suggested_params_cache_timeout() to set cache duration in milliseconds
- get_suggested_params() to manually fetch suggested params
- Performance benefits of caching when sending multiple transactions
|
| Account Manager | This example demonstrates how to use the account manager to create, import, and manage accounts including: - algorand.account.random() to generate a new random account
- algorand.account.from_mnemonic() to import from 25-word mnemonic
- algorand.account.from_environment() to load from env var
- algorand.account.from_kmd() to get account from KMD wallet
- algorand.account.multisig() to create a multisig account
- algorand.account.logicsig() to create a logic signature account
- algorand.account.rekeyed() to create a rekeyed account reference
- algorand.account.get_information() to fetch account details from network
- algorand.account.ensure_funded() to ensure account has minimum balance
- algorand.account.ensure_funded_from_environment() for dispenser funding
|
| Send Payment | This example demonstrates how to send ALGO payment transactions: - algorand.send.payment() with basic parameters (sender, receiver, amount)
- Using AlgoAmount for the amount parameter
- Payment with note field
- Payment with close_remainder_to to close account and send remaining balance
- Understanding the SendSingleTransactionResult return value
- Displaying transaction ID and confirmed round
- Verifying balances before and after payment
|
| Send Asset Operations | This example demonstrates how to perform ASA (Algorand Standard Asset) operations: - algorand.send.asset_create() to create a new ASA with all parameters
- algorand.send.asset_config() to reconfigure an asset
- algorand.send.asset_opt_in() for receiver to opt into the asset
- algorand.send.asset_transfer() to transfer assets between accounts
- algorand.send.asset_freeze() to freeze/unfreeze an account’s asset holding
- algorand.send.asset_transfer() with clawback_target for clawback operations
- algorand.send.asset_opt_out() to opt out and close asset holding
- algorand.send.asset_destroy() to destroy an asset
|
| Send Application Operations | This example demonstrates how to perform smart contract (application) operations: - algorand.send.app_create() to deploy a new application with global/local schema
- algorand.send.app_update() to update application code
- algorand.send.app_call() for NoOp application calls with args
- algorand.send.app_call() with OnComplete.OptIn for account opt-in
- algorand.send.app_call() with OnComplete.CloseOut for account close-out
- algorand.send.app_call() with OnComplete.ClearState to clear local state
- algorand.send.app_delete() to delete the application
- Passing application arguments, accounts, assets, apps references
|
| Create Transaction (Unsigned Transactions) | This example demonstrates how to create unsigned transactions without immediately sending them, which is useful for: - Transaction inspection and debugging
- Multi-party signing workflows
- Custom signing flows (hardware wallets, HSMs, etc.)
- Modifying transaction fields before signing
- Building transaction groups for atomic transactions
Key concepts: - algorand.create_transaction.payment() creates unsigned payment transactions
- algorand.create_transaction.asset_create() creates unsigned asset creation
- algorand.create_transaction.asset_transfer() creates unsigned asset transfers
- algorand.create_transaction.app_call() creates unsigned app calls
- Transaction objects have properties like tx_id(), fee, first_valid, last_valid
- Manual signing with account.signer() function
- Sending signed transactions via algorand.client.algod.send_raw_transaction()
|
| Transaction Composer (Atomic Transaction Groups) | This example demonstrates how to build atomic transaction groups using the transaction composer: - algorand.new_group() creates a new transaction composer
- Adding multiple transactions using .add_payment(), .add_asset_opt_in(), etc.
- Method chaining: algorand.new_group().add_payment(…).add_payment(…)
- .simulate() to simulate the transaction group before sending
- .send() to execute the atomic transaction group
- Atomicity: all transactions succeed or fail together
- Adding transactions with different signers
- Group ID assigned to all transactions in the group
|
| Asset Manager | This example demonstrates the AssetManager functionality for querying asset information and performing bulk opt-in/opt-out operations: - algorand.asset.get_by_id() to fetch asset information by asset ID
- algorand.asset.get_account_information() to get an account’s asset holding
- algorand.asset.bulk_opt_in() to opt into multiple assets at once
- algorand.asset.bulk_opt_out() to opt out of multiple assets at once
- Efficiency comparison: bulk operations vs individual opt-ins
- Error handling for non-existent assets and non-opted-in accounts
|
| App Manager | This example demonstrates the AppManager functionality for querying application information, state, box storage, and TEAL compilation: - algorand.app.get_by_id() to fetch application information
- algorand.app.get_global_state() to read global state
- algorand.app.get_local_state() to read account’s local state
- algorand.app.get_box_names() to list all box names for an app
- algorand.app.get_box_value() to read a specific box value
- algorand.app.get_box_values() to read multiple box values
- algorand.app.get_box_values_from_abi_type() to decode typed box values
- algorand.app.compile_teal() to compile TEAL source code
- algorand.app.compile_teal_template() to compile TEAL with template variables
|
| App Deployer | This example demonstrates the AppDeployer functionality for idempotent application deployment with create, update, and replace strategies: - algorand.app_deployer.deploy() for initial deployment
- Deploy parameters: name, version, approval_program, clear_program, schema, on_update, on_schema_break
- Idempotency: calling deploy() again with same version does nothing
- on_update: ‘update’ to update existing app when version changes
- on_update: ‘replace’ to delete and recreate app when version changes
- on_update: ‘fail’ to fail if app already exists with different code
- on_schema_break: ‘replace’ when schema changes require new app
- Deployment metadata stored in app global state
- App name used for idempotent lookups
|
| Client Manager | This example demonstrates how to access the underlying raw clients through the ClientManager (algorand.client), and how to get typed app clients: - algorand.client.algod - Access the raw Algod client
- algorand.client.indexer - Access the raw Indexer client
- algorand.client.kmd - Access the raw KMD client
- algorand.client.indexer_if_present - Safely access Indexer (returns None if not configured)
- algorand.client.get_app_client_by_id() - Get typed app client by ID
- algorand.client.get_app_client_by_creator_and_name() - Get typed app client by creator/name
- algorand.client.get_app_factory() - Get app factory for creating/deploying apps
- When to use raw clients vs AlgorandClient methods
|
| Error Transformers | This example demonstrates how to register custom error transformers to enhance error messages and debugging information for failed transactions: - What error transformers are and why they’re useful
- algorand.register_error_transformer() to add custom error transformers
- Creating transformers that add source code context to logic errors
- Creating transformers that provide user-friendly error messages
- How transformers receive errors and can return enhanced errors
- algorand.unregister_error_transformer() to remove transformers
- Triggering intentional errors and showing enhanced output
- How multiple transformers can be chained
- The transformer function signature: (error: Exception) -> Exception
|