from typing import List, Tuple, Union

from solders.account import Account
from solders.instruction import CompiledInstruction
from solders.pubkey import Pubkey
from solders.signature import Signature
from solders.transaction_status import TransactionErrorType, TransactionReturnData

class InnerInstruction:
    def instruction(self) -> CompiledInstruction: ...
    @staticmethod
    def from_bytes(raw_bytes: bytes) -> "InnerInstruction": ...
    @staticmethod
    def from_json(raw: str) -> "InnerInstruction": ...
    def to_json(self) -> str: ...
    def __bytes__(self) -> bytes: ...
    def __str__(self) -> str: ...
    def __repr__(self) -> str: ...
    def __richcmp__(self, other: "InnerInstruction", op: int) -> bool: ...

class TransactionMetadata:
    def signature(self) -> Signature: ...
    def logs(self) -> List[str]: ...
    def inner_instructions(self) -> List[List[InnerInstruction]]: ...
    def compute_units_consumed(self) -> int: ...
    def transaction_return_data(self) -> TransactionReturnData: ...
    @staticmethod
    def from_bytes(raw_bytes: bytes) -> "TransactionMetadata": ...
    @staticmethod
    def from_json(raw: str) -> "TransactionMetadata": ...
    def to_json(self) -> str: ...
    def __bytes__(self) -> bytes: ...
    def __str__(self) -> str: ...
    def __repr__(self) -> str: ...
    def __richcmp__(self, other: "TransactionMetadata", op: int) -> bool: ...

class FailedTransactionMetadata:
    def err(self) -> TransactionErrorType: ...
    def meta(self) -> TransactionMetadata: ...
    @staticmethod
    def from_bytes(raw_bytes: bytes) -> "FailedTransactionMetadata": ...
    @staticmethod
    def from_json(raw: str) -> "FailedTransactionMetadata": ...
    def to_json(self) -> str: ...
    def __bytes__(self) -> bytes: ...
    def __str__(self) -> str: ...
    def __repr__(self) -> str: ...
    def __richcmp__(self, other: "FailedTransactionMetadata", op: int) -> bool: ...

class SimulatedTransactionInfo:
    def meta(self) -> TransactionMetadata: ...
    def post_accounts(self) -> List[Tuple[Pubkey, Account]]: ...
    @staticmethod
    def from_bytes(raw_bytes: bytes) -> "SimulatedTransactionInfo": ...
    @staticmethod
    def from_json(raw: str) -> "SimulatedTransactionInfo": ...
    def to_json(self) -> str: ...
    def __bytes__(self) -> bytes: ...
    def __str__(self) -> str: ...
    def __repr__(self) -> str: ...
    def __richcmp__(self, other: "SimulatedTransactionInfo", op: int) -> bool: ...

TransactionResult = Union[TransactionMetadata, FailedTransactionMetadata]
SimulateResult = Union[SimulatedTransactionInfo, FailedTransactionMetadata]
