Source code for houndapi.schema.subscription
from pydantic import BaseModel
from typing import Union, Optional, List
# Base
[docs]
class SubscriptionBase(BaseModel):
label: Optional[str]
@property
def type(self) -> str:
raise NotImplementedError
# Logs
[docs]
class LogsSubscription(SubscriptionBase):
address: Union[str, List[str]]
topics: Optional[List[str]]
@property
def type(self) -> str: return "logs"
# PendingTransactions
[docs]
class PendingTransactionsSubscription(SubscriptionBase):
full_transactions: bool = False
@property
def type(self) -> str: return "pending"
SupportedSubscription = Union[
LogsSubscription, PendingTransactionsSubscription
]