Source code for stellar_sdk.call_builder.effects_call_builder

from typing import Union

from ..call_builder.base_call_builder import BaseCallBuilder
from ..client.base_async_client import BaseAsyncClient
from ..client.base_sync_client import BaseSyncClient

__all__ = ["EffectsCallBuilder"]

[docs]class EffectsCallBuilder(BaseCallBuilder): """Creates a new :class:`EffectsCallBuilder` pointed to server defined by horizon_url. Do not create this object directly, use :func:`stellar_sdk.server.Server.effects`. See `All Effects <>`_ :param horizon_url: Horizon server URL. :param client: The client instance used to send request. """ def __init__( self, horizon_url: str, client: Union[BaseAsyncClient, BaseSyncClient] ) -> None: super().__init__(horizon_url, client) self.endpoint: str = "effects"
[docs] def for_account(self, account_id: str) -> "EffectsCallBuilder": """This endpoint represents all effects that changed a given account. It will return relevant effects from the creation of the account to the current ledger. See `Effects for Account <>`_ :param account_id: account id, for example: `GDGQVOKHW4VEJRU2TETD6DBRKEO5ERCNF353LW5WBFW3JJWQ2BRQ6KDD` :return: this EffectCallBuilder instance """ self.endpoint = f"accounts/{account_id}/effects" return self
[docs] def for_ledger(self, sequence: Union[int, str]) -> "EffectsCallBuilder": """Effects are the specific ways that the ledger was changed by any operation. This endpoint represents all effects that occurred in the given ledger. See `Effects for Ledger <>`_ :param sequence: ledger sequence :return: this EffectCallBuilder instance """ self.endpoint = f"ledgers/{sequence}/effects" return self
[docs] def for_transaction(self, transaction_hash: str) -> "EffectsCallBuilder": """This endpoint represents all effects that occurred as a result of a given transaction. See `Effects for Transaction <>`_ :param transaction_hash: transaction hash :return: this EffectCallBuilder instance """ self.endpoint = f"transactions/{transaction_hash}/effects" return self
[docs] def for_operation(self, operation_id: Union[int, str]) -> "EffectsCallBuilder": """This endpoint represents all effects that occurred as a result of a given operation. See `Effects for Operation <>`_ :param operation_id: operation ID :return: this EffectCallBuilder instance """ self.endpoint = f"operations/{operation_id}/effects" return self