Code Examples
Browse 15 runnable Python examples demonstrating AlgoKit Subscriber features. Each example is self-contained and demonstrates specific functionality.
Quick Start
Section titled “Quick Start”# Clone the repositorygit clone https://github.com/algorandfoundation/algokit-subscriber-py.gitcd algokit-subscriber-py
# Install dependenciesuv sync
# Run an examplecd examples/subscriberuv run python 01_basic_poll_once.pyPrerequisites
Section titled “Prerequisites”- Python >= 3.10
- uv installed
- AlgoKit CLI installed
- LocalNet running for network examples (
algokit localnet start)
Examples (15)
Section titled “Examples (15)”| Example | Description |
|---|---|
| Basic Poll Once | Demonstrates a single poll_once() call with a sender filter. Creates a funded sender account, sends 2 self-payment transactions, then uses AlgorandSubscriber to find and verify the matched transactions. |
| Continuous Subscriber | Demonstrates continuous polling with start/stop and event handlers.
|
| Payment Filters | Demonstrates payment transaction filters:
|
| Asset Transfer | Demonstrates ASA lifecycle subscription:
|
| App Call Subscription | Demonstrates application call subscription with ABI method filtering:
|
| Multiple Named Filters | Demonstrates multiple named filters with deduplication:
|
| Balance Change Tracking | Demonstrates balance change filtering for ALGO and ASA transfers:
|
| ARC-28 Event Subscription | Demonstrates ARC-28 event parsing, filtering, and inspection:
|
| Inner Transaction Subscription | Demonstrates inner transaction subscription and parent-child relationships:
|
| Batch Handling & Data Mappers | Demonstrates mapper transforms with on_batch and on handler patterns:
|
| Watermark Persistence | Demonstrates file-backed watermark persistence across multiple polls:
|
| Sync Behaviours | Demonstrates all 4 sync behaviours and maxRoundsToSync comparison:
|
| Custom Filters | Demonstrates custom filter predicates with multi-condition logic:
|
| Stateless Subscriptions | Demonstrates getSubscribedTransactions for serverless patterns.
|
| Lifecycle Hooks & Error Handling | Demonstrates lifecycle hooks and retry patterns.
|