Skip to content
Algorand Developer Portal

algokit_subscriber.types.subscription

TransactionType
SyncBehaviour
BalanceChangeRoleCreate a collection of name/value pairs.
BlockRewards
BlockUpgradeState
BlockStateProofTrackingTracks the status of state proofs.
BlockUpgradeVoteFields relating to voting for a protocol upgrade.
ParticipationUpdatesParticipation account data that needs to be checked/acted on by the network.
BlockMetadataMetadata about a block that was retrieved from algod.
BalanceChangeRepresents a balance change effect for a transaction.
SubscribedTransactionThe common model used to expose a transaction that is returned from a
TransactionSubscriptionResultThe result of a single subscription pull/poll.
BeforePollMetadataMetadata about an impending subscription poll.
BalanceChangeFilter
TransactionFilterSpecify a filter to apply to find transactions of interest.
NamedTransactionFilterSpecify a named filter to apply to find transactions of interest.
CoreTransactionSubscriptionParams
TransactionSubscriptionParams
WatermarkPersistence
SubscriberConfigFilterA single event to subscribe to / emit.
AlgorandSubscriberConfigConfiguration for the subscriber.

Bases: enum.Enum

Create a collection of name/value pairs.

Example enumeration:

class Color(Enum):
RED = 1
BLUE = 2
GREEN = 3

Access them by:

  • attribute access:
    Color.RED
    <Color.RED: 1>
  • value lookup:
    Color(1)
    <Color.RED: 1>
  • name lookup:
    Color['RED']
    <Color.RED: 1>

Enumerations can be iterated over, and know how many members they have:

len(Color)
3
list(Color)
[<Color.RED: 1>, <Color.BLUE: 2>, <Color.GREEN: 3>]

Methods can be added to enumerations, and members can have their own attributes – see the documentation for details.

FeeSink is an address that accepts transaction fees, it can only spend to the incentive pool.

number of leftover MicroAlgos after the distribution of rewards-rate MicroAlgos for every reward unit in the next round.

How many rewards, in MicroAlgos, have been distributed to each RewardUnit of MicroAlgos since genesis.

RewardsPool is an address that accepts periodic injections from the fee-sink and continually redistributes them as rewards.

Number of new MicroAlgos added to the participation stake from rewards at the next round.

Number of leftover MicroAlgos after the distribution of RewardsRate/rewardUnits MicroAlgos for every reward unit in the next round.

Current protocol version

The next proposed protocol version.

next*protocol_approvals *: int | None_ = None

Section titled “next*protocol_approvals *: int | None_ = None”

Number of blocks which approved the protocol upgrade.

next*protocol_vote_before *: int | None_ = None

Section titled “next*protocol_vote_before *: int | None_ = None”

Deadline round for this protocol upgrade (No votes will be consider after this round).

next*protocol_switch_on *: int | None_ = None

Section titled “next*protocol_switch_on *: int | None_ = None”

Round on which the protocol upgrade will take effect.

Tracks the status of state proofs.

Next round for which we will accept a state proof transaction.

The total number of microalgos held by the online accounts during the StateProof round.

State Proof Type. Note the raw object uses map with this as key.

Root of a vector commitment containing online accounts that will help sign the proof.

Fields relating to voting for a protocol upgrade.

Indicates a yes vote for the current proposal.

Indicates the time between acceptance and execution.

Indicates a proposed upgrade.

Participation account data that needs to be checked/acted on by the network.

absent*participation_accounts *: list[str] | None_ = None

Section titled “absent*participation_accounts *: list[str] | None_ = None”

A list of online accounts that need to be suspended.

expired*participation_accounts *: list[str] | None_ = None

Section titled “expired*participation_accounts *: list[str] | None_ = None”

A list of online accounts that needs to be converted to offline since their participation key expired.

Metadata about a block that was retrieved from algod.

The base64 block hash.

The round of the block.

Block creation timestamp in seconds since epoch

The genesis ID of the chain.

The base64 genesis hash of the chain.

The base64 previous block hash.

The base64 seed of the block.

Fields relating to rewards

Count of parent transactions in this block

Full count of transactions and inner transactions (recursively) in this block.

Number of the next transaction that will be committed after this block. It is 0 when no transactions have ever been committed (since TxnCounter started being supported).

Root of transaction merkle tree using SHA512_256 hash function (base64 encoded). This commitment is computed based on the PaysetCommit type specified in the block’s consensus protocol.

TransactionsRootSHA256 is an auxiliary TransactionRoot, built using a vector commitment instead of a merkle tree, and SHA256 hash function instead of the default SHA512_256 (base64 encoded). This commitment can be used on environments where only the SHA256 function exists.

Fields relating to a protocol upgrade.

Tracks the status of state proofs.

Fields relating to voting for a protocol upgrade.

Participation account data that needs to be checked/acted on by the network.

Address of the proposer of this block.

Represents a balance change effect for a transaction.

The address that the balance change is for.

The asset ID of the balance change, or 0 for Algos.

The amount of the balance change in smallest divisible unit or microAlgos.

The roles the account was playing that led to the balance change

Bases: algokit_indexer_client.models.Transaction

The common model used to expose a transaction that is returned from a subscription.

Substantively, based on the Indexer TransactionResult model format with some modifications to:

  • Add the parent_transaction_id field so inner transactions have a reference to their parent
  • Override the type of inner_txns to be SubscribedTransaction[] so inner transactions (recursively) get these extra fields too
  • Add emitted ARC-28 events via arc28_events
  • Balance changes in algo or assets

parent*transaction_id *: str | None_ = None

Section titled “parent*transaction_id *: str | None_ = None”

The transaction ID of the parent of this transaction (if it’s an inner transaction).

parent*intra_round_offset *: int | None_ = None

Section titled “parent*intra_round_offset *: int | None_ = None”

Any ARC-28 events emitted from an app call.

The names of any filters that matched the given transaction to result in it being ‘subscribed’.

The balance changes in the transaction.

The result of a single subscription pull/poll.

The round range that was synced from/to

The current detected tip of the configured Algorand blockchain.

The watermark value that was retrieved at the start of the subscription poll.

The new watermark value to persist for the next call to get_subscribed_transactions to continue the sync. Will be equal to synced_round_range[1]. Only persist this after processing (or in the same atomic transaction as) subscribed transactions to keep it reliable.

Any transactions that matched the given filter within the synced round range. This substantively uses the indexer transaction format to represent the data with some additional fields.

The metadata about any blocks that were retrieved from algod as part of the subscription poll.

Metadata about an impending subscription poll.

The current watermark of the subscriber

The current round of algod

asset*id *: int | list[int] | None_ = None

Section titled “asset*id *: int | list[int] | None_ = None”

Match transactions with balance changes for one of the given asset ID(s), with Algo being 0

Match transactions with balance changes for an account with one of the given role(s)

Match transactions with balance changes affecting one of the given account(s)

min*absolute_amount *: int | float | None_ = None

Section titled “min*absolute_amount *: int | float | None_ = None”

Match transactions with absolute (i.e. using math.abs()) balance changes being greater than or equal to the given minimum (microAlgos or decimal units of an ASA

max*absolute_amount *: int | float | None_ = None

Section titled “max*absolute_amount *: int | float | None_ = None”

Match transactions with absolute (i.e. using math.abs()) balance changes being less than or equal to the given maximum (microAlgos or decimal units of an ASA

Match transactions with balance changes being greater than or equal to the given minimum (microAlgos or decimal units of an ASA)

Match transactions with balance changes being less than or equal to the given maximum (microAlgos or decimal units of an ASA)

Specify a filter to apply to find transactions of interest.

type : TransactionType | list[TransactionType] | None = None

Section titled “type : TransactionType | list[TransactionType] | None = None”

Filter based on the given transaction type(s).

Filter to transactions sent from the specified address(es).

Filter to transactions being received by the specified address(es).

Filter to transactions with a note having the given prefix.

Filter to transactions against the app with the given ID(s).

Filter to transactions that are creating an app.

app*on_complete *: str | list[str] | None_ = None

Section titled “app*on_complete *: str | list[str] | None_ = None”

Filter to transactions that have given on complete(s).

asset*id *: int | list[int] | None_ = None

Section titled “asset*id *: int | list[int] | None_ = None”

Filter to transactions against the asset with the given ID(s).

Filter to transactions that are creating an asset.

Filter to transactions where the amount being transferred is greater than or equal to the given minimum (microAlgos or decimal units of an ASA if type: axfer).

Filter to transactions where the amount being transferred is less than or equal to the given maximum (microAlgos or decimal units of an ASA if type: axfer).

method*signature *: str | list[str] | None_ = None

Section titled “method*signature *: str | list[str] | None_ = None”

Filter to app transactions that have the given ARC-0004 method selector(s) for the given method signature as the first app argument.

app*call_arguments_match *: Callable[[list[bytes] | None], bool] | None_ = None

Section titled “app*call_arguments_match *: Callable[[list[bytes] | None], bool] | None_ = None”

Filter to app transactions that meet the given app arguments predicate.

Filter to app transactions that emit the given ARC-28 events. Note: the definitions for these events must be passed in to the subscription config via arc28_events.

Filter to transactions that result in balance changes that match one or more of the given set of balance changes.

custom*filter *: Callable[[algokit_indexer_client.models.Transaction], bool] | None_ = None

Section titled “custom*filter *: Callable[[algokit_indexer_client.models.Transaction], bool] | None_ = None”

Catch-all custom filter to filter for things that the rest of the filters don’t provide.

Specify a named filter to apply to find transactions of interest.

The name to give the filter.

The filter itself.

The filter(s) to apply to find transactions of interest.

Any ARC-28 event definitions to process from app call logs.

The maximum number of rounds to sync from algod for each subscription pull/poll. Defaults to 500.

max*indexer_rounds_to_sync *: int | None_ = None

Section titled “max*indexer_rounds_to_sync *: int | None_ = None”

The maximum number of rounds to sync from indexer when using sync_behaviour: ‘catchup-with-indexer’.

If the current tip of the configured Algorand blockchain is more than max_rounds_to_sync past watermark then how should that be handled.

fail: Immediately fail skip-sync-newest: Skip catchup and start syncing from the latest block

regardless of the watermark.

sync-oldest: Start syncing from the watermark sync-oldest-start-now: If the watermark is 0, start syncing from round 0.

Otherwise skip to the latest block.

catchup-with-indexer: Use indexer to get missing transactions that match : the filters starting from the watermark. Filters will be used in the indexer request to reduce the total amount of requests needed (relative to getting every block)

Bases: CoreTransactionSubscriptionParams

The current round watermark that transactions have previously been synced to.

The current tip of the configured Algorand blockchain. If not provided, it will be resolved on demand.

Method to retrieve the current watermark

Method to persist the new watermark

Bases: NamedTransactionFilter

A single event to subscribe to / emit.

An optional data mapper if you want the event data to take a certain shape when subscribing to events with this filter name.

Bases: CoreTransactionSubscriptionParams

Configuration for the subscriber.

The set of filters to subscribe to / emit events for, along with optional data mappers.

Methods to retrieve and persist the current watermark so syncing is resilient and maintains its position in the chain

frequency*in_seconds *: float | None_ = None

Section titled “frequency*in_seconds *: float | None_ = None”

The frequency to poll for new blocks in seconds; defaults to 1s

wait*for_block_when_at_tip *: bool | None_ = None

Section titled “wait*for_block_when_at_tip *: bool | None_ = None”

Whether to wait via algod /status/wait-for-block-after endpoint when at the tip of the chain; reduces latency of subscription