Source code for digital_world_sdk.operation.extend_footprint_ttl

from typing import ClassVar

from .. import xdr as dw_xdr
from ..muxed_account import MuxedAccount
from .operation import Operation

__all__ = ["ExtendFootprintTTL"]


[docs] class ExtendFootprintTTL(Operation): """The :class:`ExtendFootprintTTL` object, which represents a ExtendFootprintTTL operation on the Digital World network. Threshold: Low See `Extend Footprint TTL <https://docs.digitalworld.global/docs/learn/fundamentals/transactions/list-of-operations#extend-footprint-ttl>`_. :param extend_to: The number of ledgers past the LCL (last closed ledger) by which to extend the validity of the ledger keys in this transaction. :param source: The source account for the operation. Defaults to the transaction's source account. """ _XDR_OPERATION_TYPE: ClassVar[dw_xdr.OperationType] = ( dw_xdr.OperationType.EXTEND_FOOTPRINT_TTL ) def __init__( self, extend_to: int, source: MuxedAccount | str | None = None ) -> None: super().__init__(source) if extend_to < 0 or extend_to > 2**32 - 1: raise ValueError( f"`extend_to` value must be between 0 and 2**32-1, got {extend_to}" ) self.extend_to: int = extend_to def _to_operation_body(self) -> dw_xdr.OperationBody: op = dw_xdr.ExtendFootprintTTLOp( ext=dw_xdr.ExtensionPoint(0), extend_to=dw_xdr.Uint32(self.extend_to), ) body = dw_xdr.OperationBody( type=self._XDR_OPERATION_TYPE, extend_footprint_ttl_op=op ) return body
[docs] @classmethod def from_xdr_object(cls, xdr_object: dw_xdr.Operation) -> "ExtendFootprintTTL": """Creates a :class:`ExtendFootprintTTL` object from an XDR Operation object.""" source = Operation.get_source_from_xdr_obj(xdr_object) assert xdr_object.body.extend_footprint_ttl_op is not None extend_to = xdr_object.body.extend_footprint_ttl_op.extend_to.uint32 op = cls(source=source, extend_to=extend_to) return op
def __repr__(self): return ( f"<ExtendFootprintTTL [extend_to={self.extend_to}, source={self.source}]>" )