text: from typing import Optional, Union
  
  from .operation import Operation
  from .. import xdr as stellar_xdr
  from ..muxed_account import MuxedAccount
  
  __all__ = ["AccountMerge"]
  
  
  class AccountMerge(Operation):
      """The :class:`AccountMerge` object, which represents a
      AccountMerge operation on Stellar's network.
  
      Transfers the native balance (the amount of XLM an account holds) to
      another account and removes the source account from the ledger.
  
      Threshold: High
  
      :param destination: Destination to merge the source account into.
      :param source: The source account (defaults to transaction source).
  
      """
  
      _XDR_OPERATION_TYPE: stellar_xdr.OperationType = (
          stellar_xdr.OperationType.ACCOUNT_MERGE
      )
  
      def __init__(
          self,
          destination: Union[MuxedAccount, str],
          source: Optional[Union[MuxedAccount, str]] = None,
      ) -> None:
          super().__init__(source)
          if isinstance(destination, str):
              destination = MuxedAccount.from_account(destination)
          self.destination: MuxedAccount = destination
  
      def _to_operation_body(self) -> stellar_xdr.OperationBody:
          destination = self.destination.to_xdr_object()
          body = stellar_xdr.OperationBody(
              type=self._XDR_OPERATION_TYPE, destination=destination
          )
          return body
  
      @classmethod
      def from_xdr_object(cls, xdr_object: stellar_xdr.Operation) -> "AccountMerge":
          """Creates a :class:`AccountMerge` object from an XDR Operation
          object.
  
          """
          source = Operation.get_source_from_xdr_obj(xdr_object)
          assert xdr_object.body.destination is not None
          destination = MuxedAccount.from_xdr_object(xdr_object.body.destination)
          op = cls(source=source, destination=destination)
          return op
  
      def __str__(self):
          return f"<AccountMerge [destination={self.destination}, source={self.source}]>"
  