databaseTypes

Data types for SRC20 event watching

Data types for decoded SRC20 events and callbacks.

Overview

The types module provides frozen dataclasses for decoded SRC20 events with decrypted amounts, as well as type aliases for callbacks.

Event Data Types

Type
Description

Transfer event with decrypted amount

Approval event with decrypted amount

Quick Reference

DecryptedTransferLog

@dataclass(frozen=True)
class DecryptedTransferLog:
    from_address: ChecksumAddress
    to_address: ChecksumAddress
    encrypt_key_hash: bytes
    encrypted_amount: bytes
    decrypted_amount: int
    transaction_hash: HexBytes
    block_number: int

DecryptedApprovalLog

Callback Type Aliases

Sync Callbacks

Async Callbacks

Example Usage

Transfer Event

Approval Event

Both Events

Common Fields

Both event types share common fields:

Field
Type
Description

encrypt_key_hash

bytes

32-byte hash of viewing key (used for filtering)

encrypted_amount

bytes

Raw AES-GCM ciphertext with auth tag

decrypted_amount

int

Decrypted token amount (raw value)

transaction_hash

HexBytes

Transaction hash containing the event

block_number

int

Block number containing the event

Properties

Immutability

All event types are frozen dataclasses:

Type Safety

All fields use proper types:

  • Addresses are checksummed (ChecksumAddress)

  • Transaction hashes are HexBytes

  • Amounts are Python integers

  • Block numbers are integers

Notes

  • All event dataclasses are immutable (frozen)

  • Addresses are automatically checksummed

  • Amounts are raw values (consider token decimals)

  • Encrypted amounts include authentication tags

  • Created automatically by event watchers

See Also

Last updated