Module diem.diem_types

Expand source code
# pyre-strict
from dataclasses import dataclass
import typing
from diem import serde_types as st
from diem import bcs


@dataclass(frozen=True)
class AccessPath:
    address: "AccountAddress"
    path: bytes

    def bcs_serialize(self) -> bytes:
        return bcs.serialize(self, AccessPath)

    @staticmethod
    def bcs_deserialize(input: bytes) -> "AccessPath":
        v, buffer = bcs.deserialize(input, AccessPath)
        if buffer:
            raise st.DeserializationError("Some input bytes were not read")
        return v


@dataclass(frozen=True)
class AccountAddress:
    value: typing.Tuple[
        st.uint8,
        st.uint8,
        st.uint8,
        st.uint8,
        st.uint8,
        st.uint8,
        st.uint8,
        st.uint8,
        st.uint8,
        st.uint8,
        st.uint8,
        st.uint8,
        st.uint8,
        st.uint8,
        st.uint8,
        st.uint8,
    ]

    def bcs_serialize(self) -> bytes:
        return bcs.serialize(self, AccountAddress)

    @staticmethod
    def bcs_deserialize(input: bytes) -> "AccountAddress":
        v, buffer = bcs.deserialize(input, AccountAddress)
        if buffer:
            raise st.DeserializationError("Some input bytes were not read")
        return v

    LENGTH = 16  # type: int

    def to_bytes(self) -> bytes:
        """Convert account address to bytes."""
        return bytes(typing.cast(typing.Iterable[int], self.value))

    @staticmethod
    def from_bytes(addr: bytes) -> "AccountAddress":
        """Create an account address from bytes."""
        if len(addr) != AccountAddress.LENGTH:
            raise ValueError("Incorrect length for an account address")
        return AccountAddress(value=tuple(st.uint8(x) for x in addr))  # pyre-ignore

    def to_hex(self) -> str:
        """Convert account address to an hexadecimal string."""
        return self.to_bytes().hex()

    @staticmethod
    def from_hex(addr: str) -> "AccountAddress":
        """Create an account address from an hexadecimal string."""
        return AccountAddress.from_bytes(bytes.fromhex(addr))


@dataclass(frozen=True)
class BlockMetadata:
    id: "HashValue"
    round: st.uint64
    timestamp_usecs: st.uint64
    previous_block_votes: typing.Sequence["AccountAddress"]
    proposer: "AccountAddress"

    def bcs_serialize(self) -> bytes:
        return bcs.serialize(self, BlockMetadata)

    @staticmethod
    def bcs_deserialize(input: bytes) -> "BlockMetadata":
        v, buffer = bcs.deserialize(input, BlockMetadata)
        if buffer:
            raise st.DeserializationError("Some input bytes were not read")
        return v


@dataclass(frozen=True)
class ChainId:
    value: st.uint8

    def bcs_serialize(self) -> bytes:
        return bcs.serialize(self, ChainId)

    @staticmethod
    def bcs_deserialize(input: bytes) -> "ChainId":
        v, buffer = bcs.deserialize(input, ChainId)
        if buffer:
            raise st.DeserializationError("Some input bytes were not read")
        return v

    @staticmethod
    def from_int(id: int) -> "ChainId":
        return ChainId(value=st.uint8(id))

    def to_int(self) -> int:
        return int(self.value)


@dataclass(frozen=True)
class ChangeSet:
    write_set: "WriteSet"
    events: typing.Sequence["ContractEvent"]

    def bcs_serialize(self) -> bytes:
        return bcs.serialize(self, ChangeSet)

    @staticmethod
    def bcs_deserialize(input: bytes) -> "ChangeSet":
        v, buffer = bcs.deserialize(input, ChangeSet)
        if buffer:
            raise st.DeserializationError("Some input bytes were not read")
        return v


class CoinTradeMetadata:
    VARIANTS = []  # type: typing.Sequence[typing.Type[CoinTradeMetadata]]

    def bcs_serialize(self) -> bytes:
        return bcs.serialize(self, CoinTradeMetadata)

    @staticmethod
    def bcs_deserialize(input: bytes) -> "CoinTradeMetadata":
        v, buffer = bcs.deserialize(input, CoinTradeMetadata)
        if buffer:
            raise st.DeserializationError("Some input bytes were not read")
        return v


@dataclass(frozen=True)
class CoinTradeMetadata__CoinTradeMetadataV0(CoinTradeMetadata):
    INDEX = 0  # type: int
    value: "CoinTradeMetadataV0"


CoinTradeMetadata.VARIANTS = [
    CoinTradeMetadata__CoinTradeMetadataV0,
]


@dataclass(frozen=True)
class CoinTradeMetadataV0:
    trade_ids: typing.Sequence[str]

    def bcs_serialize(self) -> bytes:
        return bcs.serialize(self, CoinTradeMetadataV0)

    @staticmethod
    def bcs_deserialize(input: bytes) -> "CoinTradeMetadataV0":
        v, buffer = bcs.deserialize(input, CoinTradeMetadataV0)
        if buffer:
            raise st.DeserializationError("Some input bytes were not read")
        return v


class ContractEvent:
    VARIANTS = []  # type: typing.Sequence[typing.Type[ContractEvent]]

    def bcs_serialize(self) -> bytes:
        return bcs.serialize(self, ContractEvent)

    @staticmethod
    def bcs_deserialize(input: bytes) -> "ContractEvent":
        v, buffer = bcs.deserialize(input, ContractEvent)
        if buffer:
            raise st.DeserializationError("Some input bytes were not read")
        return v


@dataclass(frozen=True)
class ContractEvent__V0(ContractEvent):
    INDEX = 0  # type: int
    value: "ContractEventV0"


ContractEvent.VARIANTS = [
    ContractEvent__V0,
]


@dataclass(frozen=True)
class ContractEventV0:
    key: "EventKey"
    sequence_number: st.uint64
    type_tag: "TypeTag"
    event_data: bytes

    def bcs_serialize(self) -> bytes:
        return bcs.serialize(self, ContractEventV0)

    @staticmethod
    def bcs_deserialize(input: bytes) -> "ContractEventV0":
        v, buffer = bcs.deserialize(input, ContractEventV0)
        if buffer:
            raise st.DeserializationError("Some input bytes were not read")
        return v


@dataclass(frozen=True)
class Ed25519PublicKey:
    value: bytes

    def bcs_serialize(self) -> bytes:
        return bcs.serialize(self, Ed25519PublicKey)

    @staticmethod
    def bcs_deserialize(input: bytes) -> "Ed25519PublicKey":
        v, buffer = bcs.deserialize(input, Ed25519PublicKey)
        if buffer:
            raise st.DeserializationError("Some input bytes were not read")
        return v


@dataclass(frozen=True)
class Ed25519Signature:
    value: bytes

    def bcs_serialize(self) -> bytes:
        return bcs.serialize(self, Ed25519Signature)

    @staticmethod
    def bcs_deserialize(input: bytes) -> "Ed25519Signature":
        v, buffer = bcs.deserialize(input, Ed25519Signature)
        if buffer:
            raise st.DeserializationError("Some input bytes were not read")
        return v


@dataclass(frozen=True)
class EventKey:
    value: bytes

    def bcs_serialize(self) -> bytes:
        return bcs.serialize(self, EventKey)

    @staticmethod
    def bcs_deserialize(input: bytes) -> "EventKey":
        v, buffer = bcs.deserialize(input, EventKey)
        if buffer:
            raise st.DeserializationError("Some input bytes were not read")
        return v


class GeneralMetadata:
    VARIANTS = []  # type: typing.Sequence[typing.Type[GeneralMetadata]]

    def bcs_serialize(self) -> bytes:
        return bcs.serialize(self, GeneralMetadata)

    @staticmethod
    def bcs_deserialize(input: bytes) -> "GeneralMetadata":
        v, buffer = bcs.deserialize(input, GeneralMetadata)
        if buffer:
            raise st.DeserializationError("Some input bytes were not read")
        return v


@dataclass(frozen=True)
class GeneralMetadata__GeneralMetadataVersion0(GeneralMetadata):
    INDEX = 0  # type: int
    value: "GeneralMetadataV0"


GeneralMetadata.VARIANTS = [
    GeneralMetadata__GeneralMetadataVersion0,
]


@dataclass(frozen=True)
class GeneralMetadataV0:
    to_subaddress: typing.Optional[bytes]
    from_subaddress: typing.Optional[bytes]
    referenced_event: typing.Optional[st.uint64]

    def bcs_serialize(self) -> bytes:
        return bcs.serialize(self, GeneralMetadataV0)

    @staticmethod
    def bcs_deserialize(input: bytes) -> "GeneralMetadataV0":
        v, buffer = bcs.deserialize(input, GeneralMetadataV0)
        if buffer:
            raise st.DeserializationError("Some input bytes were not read")
        return v


@dataclass(frozen=True)
class HashValue:
    value: bytes

    def bcs_serialize(self) -> bytes:
        return bcs.serialize(self, HashValue)

    @staticmethod
    def bcs_deserialize(input: bytes) -> "HashValue":
        v, buffer = bcs.deserialize(input, HashValue)
        if buffer:
            raise st.DeserializationError("Some input bytes were not read")
        return v


@dataclass(frozen=True)
class Identifier:
    value: str

    def bcs_serialize(self) -> bytes:
        return bcs.serialize(self, Identifier)

    @staticmethod
    def bcs_deserialize(input: bytes) -> "Identifier":
        v, buffer = bcs.deserialize(input, Identifier)
        if buffer:
            raise st.DeserializationError("Some input bytes were not read")
        return v


class Metadata:
    VARIANTS = []  # type: typing.Sequence[typing.Type[Metadata]]

    def bcs_serialize(self) -> bytes:
        return bcs.serialize(self, Metadata)

    @staticmethod
    def bcs_deserialize(input: bytes) -> "Metadata":
        v, buffer = bcs.deserialize(input, Metadata)
        if buffer:
            raise st.DeserializationError("Some input bytes were not read")
        return v

    def decode_structure(self) -> typing.Union[None, "GeneralMetadataV0", "TravelRuleMetadataV0", "RefundMetadataV0"]:
        """decode metadata structure

        Returns None for a non-structure type or undefined
        """

        type_index = type(self).INDEX
        if type_index == 1:
            return typing.cast(GeneralMetadataV0, self.value.value)
        elif type_index == 2:
            return typing.cast(TravelRuleMetadataV0, self.value.value)
        elif type_index == 4:
            return typing.cast(RefundMetadataV0, self.value.value)
        elif type_index == 5:
            return typing.cast(CoinTradeMetadataV0, self.value.value)
        return None


@dataclass(frozen=True)
class Metadata__Undefined(Metadata):
    INDEX = 0  # type: int
    pass


@dataclass(frozen=True)
class Metadata__GeneralMetadata(Metadata):
    INDEX = 1  # type: int
    value: "GeneralMetadata"


@dataclass(frozen=True)
class Metadata__TravelRuleMetadata(Metadata):
    INDEX = 2  # type: int
    value: "TravelRuleMetadata"


@dataclass(frozen=True)
class Metadata__UnstructuredBytesMetadata(Metadata):
    INDEX = 3  # type: int
    value: "UnstructuredBytesMetadata"


@dataclass(frozen=True)
class Metadata__RefundMetadata(Metadata):
    INDEX = 4  # type: int
    value: "RefundMetadata"


@dataclass(frozen=True)
class Metadata__CoinTradeMetadata(Metadata):
    INDEX = 5  # type: int
    value: "CoinTradeMetadata"


Metadata.VARIANTS = [
    Metadata__Undefined,
    Metadata__GeneralMetadata,
    Metadata__TravelRuleMetadata,
    Metadata__UnstructuredBytesMetadata,
    Metadata__RefundMetadata,
    Metadata__CoinTradeMetadata,
]


@dataclass(frozen=True)
class Module:
    code: bytes

    def bcs_serialize(self) -> bytes:
        return bcs.serialize(self, Module)

    @staticmethod
    def bcs_deserialize(input: bytes) -> "Module":
        v, buffer = bcs.deserialize(input, Module)
        if buffer:
            raise st.DeserializationError("Some input bytes were not read")
        return v


@dataclass(frozen=True)
class ModuleId:
    address: "AccountAddress"
    name: "Identifier"

    def bcs_serialize(self) -> bytes:
        return bcs.serialize(self, ModuleId)

    @staticmethod
    def bcs_deserialize(input: bytes) -> "ModuleId":
        v, buffer = bcs.deserialize(input, ModuleId)
        if buffer:
            raise st.DeserializationError("Some input bytes were not read")
        return v


@dataclass(frozen=True)
class MultiEd25519PublicKey:
    value: bytes

    def bcs_serialize(self) -> bytes:
        return bcs.serialize(self, MultiEd25519PublicKey)

    @staticmethod
    def bcs_deserialize(input: bytes) -> "MultiEd25519PublicKey":
        v, buffer = bcs.deserialize(input, MultiEd25519PublicKey)
        if buffer:
            raise st.DeserializationError("Some input bytes were not read")
        return v


@dataclass(frozen=True)
class MultiEd25519Signature:
    value: bytes

    def bcs_serialize(self) -> bytes:
        return bcs.serialize(self, MultiEd25519Signature)

    @staticmethod
    def bcs_deserialize(input: bytes) -> "MultiEd25519Signature":
        v, buffer = bcs.deserialize(input, MultiEd25519Signature)
        if buffer:
            raise st.DeserializationError("Some input bytes were not read")
        return v


@dataclass(frozen=True)
class RawTransaction:
    sender: "AccountAddress"
    sequence_number: st.uint64
    payload: "TransactionPayload"
    max_gas_amount: st.uint64
    gas_unit_price: st.uint64
    gas_currency_code: str
    expiration_timestamp_secs: st.uint64
    chain_id: "ChainId"

    def bcs_serialize(self) -> bytes:
        return bcs.serialize(self, RawTransaction)

    @staticmethod
    def bcs_deserialize(input: bytes) -> "RawTransaction":
        v, buffer = bcs.deserialize(input, RawTransaction)
        if buffer:
            raise st.DeserializationError("Some input bytes were not read")
        return v


class RefundMetadata:
    VARIANTS = []  # type: typing.Sequence[typing.Type[RefundMetadata]]

    def bcs_serialize(self) -> bytes:
        return bcs.serialize(self, RefundMetadata)

    @staticmethod
    def bcs_deserialize(input: bytes) -> "RefundMetadata":
        v, buffer = bcs.deserialize(input, RefundMetadata)
        if buffer:
            raise st.DeserializationError("Some input bytes were not read")
        return v


@dataclass(frozen=True)
class RefundMetadata__RefundMetadataV0(RefundMetadata):
    INDEX = 0  # type: int
    value: "RefundMetadataV0"


RefundMetadata.VARIANTS = [
    RefundMetadata__RefundMetadataV0,
]


@dataclass(frozen=True)
class RefundMetadataV0:
    transaction_version: st.uint64
    reason: "RefundReason"

    def bcs_serialize(self) -> bytes:
        return bcs.serialize(self, RefundMetadataV0)

    @staticmethod
    def bcs_deserialize(input: bytes) -> "RefundMetadataV0":
        v, buffer = bcs.deserialize(input, RefundMetadataV0)
        if buffer:
            raise st.DeserializationError("Some input bytes were not read")
        return v


class RefundReason:
    VARIANTS = []  # type: typing.Sequence[typing.Type[RefundReason]]

    def bcs_serialize(self) -> bytes:
        return bcs.serialize(self, RefundReason)

    @staticmethod
    def bcs_deserialize(input: bytes) -> "RefundReason":
        v, buffer = bcs.deserialize(input, RefundReason)
        if buffer:
            raise st.DeserializationError("Some input bytes were not read")
        return v


@dataclass(frozen=True)
class RefundReason__OtherReason(RefundReason):
    INDEX = 0  # type: int
    pass


@dataclass(frozen=True)
class RefundReason__InvalidSubaddress(RefundReason):
    INDEX = 1  # type: int
    pass


@dataclass(frozen=True)
class RefundReason__UserInitiatedPartialRefund(RefundReason):
    INDEX = 2  # type: int
    pass


@dataclass(frozen=True)
class RefundReason__UserInitiatedFullRefund(RefundReason):
    INDEX = 3  # type: int
    pass


RefundReason.VARIANTS = [
    RefundReason__OtherReason,
    RefundReason__InvalidSubaddress,
    RefundReason__UserInitiatedPartialRefund,
    RefundReason__UserInitiatedFullRefund,
]


@dataclass(frozen=True)
class Script:
    code: bytes
    ty_args: typing.Sequence["TypeTag"]
    args: typing.Sequence["TransactionArgument"]

    def bcs_serialize(self) -> bytes:
        return bcs.serialize(self, Script)

    @staticmethod
    def bcs_deserialize(input: bytes) -> "Script":
        v, buffer = bcs.deserialize(input, Script)
        if buffer:
            raise st.DeserializationError("Some input bytes were not read")
        return v


@dataclass(frozen=True)
class ScriptFunction:
    module: "ModuleId"
    function: "Identifier"
    ty_args: typing.Sequence["TypeTag"]
    args: typing.Sequence[bytes]

    def bcs_serialize(self) -> bytes:
        return bcs.serialize(self, ScriptFunction)

    @staticmethod
    def bcs_deserialize(input: bytes) -> "ScriptFunction":
        v, buffer = bcs.deserialize(input, ScriptFunction)
        if buffer:
            raise st.DeserializationError("Some input bytes were not read")
        return v


@dataclass(frozen=True)
class SignedTransaction:
    raw_txn: "RawTransaction"
    authenticator: "TransactionAuthenticator"

    def bcs_serialize(self) -> bytes:
        return bcs.serialize(self, SignedTransaction)

    @staticmethod
    def bcs_deserialize(input: bytes) -> "SignedTransaction":
        v, buffer = bcs.deserialize(input, SignedTransaction)
        if buffer:
            raise st.DeserializationError("Some input bytes were not read")
        return v

    @staticmethod
    def from_raw_txn_and_ed25519_key(txn: RawTransaction, public_key: bytes, signature: bytes) -> "SignedTransaction":
        return SignedTransaction(
            raw_txn=txn,
            authenticator=TransactionAuthenticator__Ed25519(
                public_key=Ed25519PublicKey(value=public_key),
                signature=Ed25519Signature(value=signature),
            ),
        )


@dataclass(frozen=True)
class StructTag:
    address: "AccountAddress"
    module: "Identifier"
    name: "Identifier"
    type_params: typing.Sequence["TypeTag"]

    def bcs_serialize(self) -> bytes:
        return bcs.serialize(self, StructTag)

    @staticmethod
    def bcs_deserialize(input: bytes) -> "StructTag":
        v, buffer = bcs.deserialize(input, StructTag)
        if buffer:
            raise st.DeserializationError("Some input bytes were not read")
        return v


class Transaction:
    VARIANTS = []  # type: typing.Sequence[typing.Type[Transaction]]

    def bcs_serialize(self) -> bytes:
        return bcs.serialize(self, Transaction)

    @staticmethod
    def bcs_deserialize(input: bytes) -> "Transaction":
        v, buffer = bcs.deserialize(input, Transaction)
        if buffer:
            raise st.DeserializationError("Some input bytes were not read")
        return v


@dataclass(frozen=True)
class Transaction__UserTransaction(Transaction):
    INDEX = 0  # type: int
    value: "SignedTransaction"


@dataclass(frozen=True)
class Transaction__GenesisTransaction(Transaction):
    INDEX = 1  # type: int
    value: "WriteSetPayload"


@dataclass(frozen=True)
class Transaction__BlockMetadata(Transaction):
    INDEX = 2  # type: int
    value: "BlockMetadata"


Transaction.VARIANTS = [
    Transaction__UserTransaction,
    Transaction__GenesisTransaction,
    Transaction__BlockMetadata,
]


class TransactionArgument:
    VARIANTS = []  # type: typing.Sequence[typing.Type[TransactionArgument]]

    def bcs_serialize(self) -> bytes:
        return bcs.serialize(self, TransactionArgument)

    @staticmethod
    def bcs_deserialize(input: bytes) -> "TransactionArgument":
        v, buffer = bcs.deserialize(input, TransactionArgument)
        if buffer:
            raise st.DeserializationError("Some input bytes were not read")
        return v


@dataclass(frozen=True)
class TransactionArgument__U8(TransactionArgument):
    INDEX = 0  # type: int
    value: st.uint8


@dataclass(frozen=True)
class TransactionArgument__U64(TransactionArgument):
    INDEX = 1  # type: int
    value: st.uint64


@dataclass(frozen=True)
class TransactionArgument__U128(TransactionArgument):
    INDEX = 2  # type: int
    value: st.uint128


@dataclass(frozen=True)
class TransactionArgument__Address(TransactionArgument):
    INDEX = 3  # type: int
    value: "AccountAddress"


@dataclass(frozen=True)
class TransactionArgument__U8Vector(TransactionArgument):
    INDEX = 4  # type: int
    value: bytes


@dataclass(frozen=True)
class TransactionArgument__Bool(TransactionArgument):
    INDEX = 5  # type: int
    value: bool


TransactionArgument.VARIANTS = [
    TransactionArgument__U8,
    TransactionArgument__U64,
    TransactionArgument__U128,
    TransactionArgument__Address,
    TransactionArgument__U8Vector,
    TransactionArgument__Bool,
]


class TransactionAuthenticator:
    VARIANTS = []  # type: typing.Sequence[typing.Type[TransactionAuthenticator]]

    def bcs_serialize(self) -> bytes:
        return bcs.serialize(self, TransactionAuthenticator)

    @staticmethod
    def bcs_deserialize(input: bytes) -> "TransactionAuthenticator":
        v, buffer = bcs.deserialize(input, TransactionAuthenticator)
        if buffer:
            raise st.DeserializationError("Some input bytes were not read")
        return v


@dataclass(frozen=True)
class TransactionAuthenticator__Ed25519(TransactionAuthenticator):
    INDEX = 0  # type: int
    public_key: "Ed25519PublicKey"
    signature: "Ed25519Signature"


@dataclass(frozen=True)
class TransactionAuthenticator__MultiEd25519(TransactionAuthenticator):
    INDEX = 1  # type: int
    public_key: "MultiEd25519PublicKey"
    signature: "MultiEd25519Signature"


TransactionAuthenticator.VARIANTS = [
    TransactionAuthenticator__Ed25519,
    TransactionAuthenticator__MultiEd25519,
]


class TransactionPayload:
    VARIANTS = []  # type: typing.Sequence[typing.Type[TransactionPayload]]

    def bcs_serialize(self) -> bytes:
        return bcs.serialize(self, TransactionPayload)

    @staticmethod
    def bcs_deserialize(input: bytes) -> "TransactionPayload":
        v, buffer = bcs.deserialize(input, TransactionPayload)
        if buffer:
            raise st.DeserializationError("Some input bytes were not read")
        return v


@dataclass(frozen=True)
class TransactionPayload__WriteSet(TransactionPayload):
    INDEX = 0  # type: int
    value: "WriteSetPayload"


@dataclass(frozen=True)
class TransactionPayload__Script(TransactionPayload):
    INDEX = 1  # type: int
    value: "Script"


@dataclass(frozen=True)
class TransactionPayload__Module(TransactionPayload):
    INDEX = 2  # type: int
    value: "Module"


@dataclass(frozen=True)
class TransactionPayload__ScriptFunction(TransactionPayload):
    INDEX = 3  # type: int
    value: "ScriptFunction"


TransactionPayload.VARIANTS = [
    TransactionPayload__WriteSet,
    TransactionPayload__Script,
    TransactionPayload__Module,
    TransactionPayload__ScriptFunction,
]


class TravelRuleMetadata:
    VARIANTS = []  # type: typing.Sequence[typing.Type[TravelRuleMetadata]]

    def bcs_serialize(self) -> bytes:
        return bcs.serialize(self, TravelRuleMetadata)

    @staticmethod
    def bcs_deserialize(input: bytes) -> "TravelRuleMetadata":
        v, buffer = bcs.deserialize(input, TravelRuleMetadata)
        if buffer:
            raise st.DeserializationError("Some input bytes were not read")
        return v


@dataclass(frozen=True)
class TravelRuleMetadata__TravelRuleMetadataVersion0(TravelRuleMetadata):
    INDEX = 0  # type: int
    value: "TravelRuleMetadataV0"


TravelRuleMetadata.VARIANTS = [
    TravelRuleMetadata__TravelRuleMetadataVersion0,
]


@dataclass(frozen=True)
class TravelRuleMetadataV0:
    off_chain_reference_id: typing.Optional[str]

    def bcs_serialize(self) -> bytes:
        return bcs.serialize(self, TravelRuleMetadataV0)

    @staticmethod
    def bcs_deserialize(input: bytes) -> "TravelRuleMetadataV0":
        v, buffer = bcs.deserialize(input, TravelRuleMetadataV0)
        if buffer:
            raise st.DeserializationError("Some input bytes were not read")
        return v


class TypeTag:
    VARIANTS = []  # type: typing.Sequence[typing.Type[TypeTag]]

    def bcs_serialize(self) -> bytes:
        return bcs.serialize(self, TypeTag)

    @staticmethod
    def bcs_deserialize(input: bytes) -> "TypeTag":
        v, buffer = bcs.deserialize(input, TypeTag)
        if buffer:
            raise st.DeserializationError("Some input bytes were not read")
        return v

    CORE_CODE_ADDRESS: AccountAddress = AccountAddress.from_hex("00000000000000000000000000000001")

    @staticmethod
    def from_currency_code(code: str) -> "TypeTag":
        if isinstance(code, str):
            return TypeTag__Struct(
                value=StructTag(
                    address=TypeTag.CORE_CODE_ADDRESS,
                    module=Identifier(code),
                    name=Identifier(code),
                    type_params=[],
                )
            )

        raise TypeError(f"unknown currency code type: {code}")

    def to_currency_code(self) -> str:
        if isinstance(self, TypeTag__Struct):
            return self.value.name.value

        raise TypeError(f"unknown currency code type: {self}")


@dataclass(frozen=True)
class TypeTag__Bool(TypeTag):
    INDEX = 0  # type: int
    pass


@dataclass(frozen=True)
class TypeTag__U8(TypeTag):
    INDEX = 1  # type: int
    pass


@dataclass(frozen=True)
class TypeTag__U64(TypeTag):
    INDEX = 2  # type: int
    pass


@dataclass(frozen=True)
class TypeTag__U128(TypeTag):
    INDEX = 3  # type: int
    pass


@dataclass(frozen=True)
class TypeTag__Address(TypeTag):
    INDEX = 4  # type: int
    pass


@dataclass(frozen=True)
class TypeTag__Signer(TypeTag):
    INDEX = 5  # type: int
    pass


@dataclass(frozen=True)
class TypeTag__Vector(TypeTag):
    INDEX = 6  # type: int
    value: "TypeTag"


@dataclass(frozen=True)
class TypeTag__Struct(TypeTag):
    INDEX = 7  # type: int
    value: "StructTag"


TypeTag.VARIANTS = [
    TypeTag__Bool,
    TypeTag__U8,
    TypeTag__U64,
    TypeTag__U128,
    TypeTag__Address,
    TypeTag__Signer,
    TypeTag__Vector,
    TypeTag__Struct,
]


@dataclass(frozen=True)
class UnstructuredBytesMetadata:
    metadata: typing.Optional[bytes]

    def bcs_serialize(self) -> bytes:
        return bcs.serialize(self, UnstructuredBytesMetadata)

    @staticmethod
    def bcs_deserialize(input: bytes) -> "UnstructuredBytesMetadata":
        v, buffer = bcs.deserialize(input, UnstructuredBytesMetadata)
        if buffer:
            raise st.DeserializationError("Some input bytes were not read")
        return v


class WriteOp:
    VARIANTS = []  # type: typing.Sequence[typing.Type[WriteOp]]

    def bcs_serialize(self) -> bytes:
        return bcs.serialize(self, WriteOp)

    @staticmethod
    def bcs_deserialize(input: bytes) -> "WriteOp":
        v, buffer = bcs.deserialize(input, WriteOp)
        if buffer:
            raise st.DeserializationError("Some input bytes were not read")
        return v


@dataclass(frozen=True)
class WriteOp__Deletion(WriteOp):
    INDEX = 0  # type: int
    pass


@dataclass(frozen=True)
class WriteOp__Value(WriteOp):
    INDEX = 1  # type: int
    value: bytes


WriteOp.VARIANTS = [
    WriteOp__Deletion,
    WriteOp__Value,
]


@dataclass(frozen=True)
class WriteSet:
    value: "WriteSetMut"

    def bcs_serialize(self) -> bytes:
        return bcs.serialize(self, WriteSet)

    @staticmethod
    def bcs_deserialize(input: bytes) -> "WriteSet":
        v, buffer = bcs.deserialize(input, WriteSet)
        if buffer:
            raise st.DeserializationError("Some input bytes were not read")
        return v


@dataclass(frozen=True)
class WriteSetMut:
    write_set: typing.Sequence[typing.Tuple["AccessPath", "WriteOp"]]

    def bcs_serialize(self) -> bytes:
        return bcs.serialize(self, WriteSetMut)

    @staticmethod
    def bcs_deserialize(input: bytes) -> "WriteSetMut":
        v, buffer = bcs.deserialize(input, WriteSetMut)
        if buffer:
            raise st.DeserializationError("Some input bytes were not read")
        return v


class WriteSetPayload:
    VARIANTS = []  # type: typing.Sequence[typing.Type[WriteSetPayload]]

    def bcs_serialize(self) -> bytes:
        return bcs.serialize(self, WriteSetPayload)

    @staticmethod
    def bcs_deserialize(input: bytes) -> "WriteSetPayload":
        v, buffer = bcs.deserialize(input, WriteSetPayload)
        if buffer:
            raise st.DeserializationError("Some input bytes were not read")
        return v


@dataclass(frozen=True)
class WriteSetPayload__Direct(WriteSetPayload):
    INDEX = 0  # type: int
    value: "ChangeSet"


@dataclass(frozen=True)
class WriteSetPayload__Script(WriteSetPayload):
    INDEX = 1  # type: int
    execute_as: "AccountAddress"
    script: "Script"


WriteSetPayload.VARIANTS = [
    WriteSetPayload__Direct,
    WriteSetPayload__Script,
]

Classes

class AccessPath (address: AccountAddress, path: bytes)

AccessPath(address: 'AccountAddress', path: bytes)

Expand source code
@dataclass(frozen=True)
class AccessPath:
    address: "AccountAddress"
    path: bytes

    def bcs_serialize(self) -> bytes:
        return bcs.serialize(self, AccessPath)

    @staticmethod
    def bcs_deserialize(input: bytes) -> "AccessPath":
        v, buffer = bcs.deserialize(input, AccessPath)
        if buffer:
            raise st.DeserializationError("Some input bytes were not read")
        return v

Class variables

var addressAccountAddress
var path : bytes

Static methods

def bcs_deserialize(input: bytes) ‑> AccessPath
Expand source code
@staticmethod
def bcs_deserialize(input: bytes) -> "AccessPath":
    v, buffer = bcs.deserialize(input, AccessPath)
    if buffer:
        raise st.DeserializationError("Some input bytes were not read")
    return v

Methods

def bcs_serialize(self) ‑> bytes
Expand source code
def bcs_serialize(self) -> bytes:
    return bcs.serialize(self, AccessPath)
class AccountAddress (value: Tuple[numpy.uint8, numpy.uint8, numpy.uint8, numpy.uint8, numpy.uint8, numpy.uint8, numpy.uint8, numpy.uint8, numpy.uint8, numpy.uint8, numpy.uint8, numpy.uint8, numpy.uint8, numpy.uint8, numpy.uint8, numpy.uint8])

AccountAddress(value: Tuple[numpy.uint8, numpy.uint8, numpy.uint8, numpy.uint8, numpy.uint8, numpy.uint8, numpy.uint8, numpy.uint8, numpy.uint8, numpy.uint8, numpy.uint8, numpy.uint8, numpy.uint8, numpy.uint8, numpy.uint8, numpy.uint8])

Expand source code
@dataclass(frozen=True)
class AccountAddress:
    value: typing.Tuple[
        st.uint8,
        st.uint8,
        st.uint8,
        st.uint8,
        st.uint8,
        st.uint8,
        st.uint8,
        st.uint8,
        st.uint8,
        st.uint8,
        st.uint8,
        st.uint8,
        st.uint8,
        st.uint8,
        st.uint8,
        st.uint8,
    ]

    def bcs_serialize(self) -> bytes:
        return bcs.serialize(self, AccountAddress)

    @staticmethod
    def bcs_deserialize(input: bytes) -> "AccountAddress":
        v, buffer = bcs.deserialize(input, AccountAddress)
        if buffer:
            raise st.DeserializationError("Some input bytes were not read")
        return v

    LENGTH = 16  # type: int

    def to_bytes(self) -> bytes:
        """Convert account address to bytes."""
        return bytes(typing.cast(typing.Iterable[int], self.value))

    @staticmethod
    def from_bytes(addr: bytes) -> "AccountAddress":
        """Create an account address from bytes."""
        if len(addr) != AccountAddress.LENGTH:
            raise ValueError("Incorrect length for an account address")
        return AccountAddress(value=tuple(st.uint8(x) for x in addr))  # pyre-ignore

    def to_hex(self) -> str:
        """Convert account address to an hexadecimal string."""
        return self.to_bytes().hex()

    @staticmethod
    def from_hex(addr: str) -> "AccountAddress":
        """Create an account address from an hexadecimal string."""
        return AccountAddress.from_bytes(bytes.fromhex(addr))

Class variables

var LENGTH
var value : Tuple[numpy.uint8, numpy.uint8, numpy.uint8, numpy.uint8, numpy.uint8, numpy.uint8, numpy.uint8, numpy.uint8, numpy.uint8, numpy.uint8, numpy.uint8, numpy.uint8, numpy.uint8, numpy.uint8, numpy.uint8, numpy.uint8]

Static methods

def bcs_deserialize(input: bytes) ‑> AccountAddress
Expand source code
@staticmethod
def bcs_deserialize(input: bytes) -> "AccountAddress":
    v, buffer = bcs.deserialize(input, AccountAddress)
    if buffer:
        raise st.DeserializationError("Some input bytes were not read")
    return v
def from_bytes(addr: bytes) ‑> AccountAddress

Create an account address from bytes.

Expand source code
@staticmethod
def from_bytes(addr: bytes) -> "AccountAddress":
    """Create an account address from bytes."""
    if len(addr) != AccountAddress.LENGTH:
        raise ValueError("Incorrect length for an account address")
    return AccountAddress(value=tuple(st.uint8(x) for x in addr))  # pyre-ignore
def from_hex(addr: str) ‑> AccountAddress

Create an account address from an hexadecimal string.

Expand source code
@staticmethod
def from_hex(addr: str) -> "AccountAddress":
    """Create an account address from an hexadecimal string."""
    return AccountAddress.from_bytes(bytes.fromhex(addr))

Methods

def bcs_serialize(self) ‑> bytes
Expand source code
def bcs_serialize(self) -> bytes:
    return bcs.serialize(self, AccountAddress)
def to_bytes(self) ‑> bytes

Convert account address to bytes.

Expand source code
def to_bytes(self) -> bytes:
    """Convert account address to bytes."""
    return bytes(typing.cast(typing.Iterable[int], self.value))
def to_hex(self) ‑> str

Convert account address to an hexadecimal string.

Expand source code
def to_hex(self) -> str:
    """Convert account address to an hexadecimal string."""
    return self.to_bytes().hex()
class BlockMetadata (id: HashValue, round: numpy.uint64, timestamp_usecs: numpy.uint64, previous_block_votes: Sequence[ForwardRef('AccountAddress')], proposer: AccountAddress)

BlockMetadata(id: 'HashValue', round: numpy.uint64, timestamp_usecs: numpy.uint64, previous_block_votes: Sequence[ForwardRef('AccountAddress')], proposer: 'AccountAddress')

Expand source code
@dataclass(frozen=True)
class BlockMetadata:
    id: "HashValue"
    round: st.uint64
    timestamp_usecs: st.uint64
    previous_block_votes: typing.Sequence["AccountAddress"]
    proposer: "AccountAddress"

    def bcs_serialize(self) -> bytes:
        return bcs.serialize(self, BlockMetadata)

    @staticmethod
    def bcs_deserialize(input: bytes) -> "BlockMetadata":
        v, buffer = bcs.deserialize(input, BlockMetadata)
        if buffer:
            raise st.DeserializationError("Some input bytes were not read")
        return v

Class variables

var idHashValue
var previous_block_votes : Sequence[AccountAddress]
var proposerAccountAddress
var round : numpy.uint64
var timestamp_usecs : numpy.uint64

Static methods

def bcs_deserialize(input: bytes) ‑> BlockMetadata
Expand source code
@staticmethod
def bcs_deserialize(input: bytes) -> "BlockMetadata":
    v, buffer = bcs.deserialize(input, BlockMetadata)
    if buffer:
        raise st.DeserializationError("Some input bytes were not read")
    return v

Methods

def bcs_serialize(self) ‑> bytes
Expand source code
def bcs_serialize(self) -> bytes:
    return bcs.serialize(self, BlockMetadata)
class ChainId (value: numpy.uint8)

ChainId(value: numpy.uint8)

Expand source code
@dataclass(frozen=True)
class ChainId:
    value: st.uint8

    def bcs_serialize(self) -> bytes:
        return bcs.serialize(self, ChainId)

    @staticmethod
    def bcs_deserialize(input: bytes) -> "ChainId":
        v, buffer = bcs.deserialize(input, ChainId)
        if buffer:
            raise st.DeserializationError("Some input bytes were not read")
        return v

    @staticmethod
    def from_int(id: int) -> "ChainId":
        return ChainId(value=st.uint8(id))

    def to_int(self) -> int:
        return int(self.value)

Class variables

var value : numpy.uint8

Static methods

def bcs_deserialize(input: bytes) ‑> ChainId
Expand source code
@staticmethod
def bcs_deserialize(input: bytes) -> "ChainId":
    v, buffer = bcs.deserialize(input, ChainId)
    if buffer:
        raise st.DeserializationError("Some input bytes were not read")
    return v
def from_int(id: int) ‑> ChainId
Expand source code
@staticmethod
def from_int(id: int) -> "ChainId":
    return ChainId(value=st.uint8(id))

Methods

def bcs_serialize(self) ‑> bytes
Expand source code
def bcs_serialize(self) -> bytes:
    return bcs.serialize(self, ChainId)
def to_int(self) ‑> int
Expand source code
def to_int(self) -> int:
    return int(self.value)
class ChangeSet (write_set: WriteSet, events: Sequence[ForwardRef('ContractEvent')])

ChangeSet(write_set: 'WriteSet', events: Sequence[ForwardRef('ContractEvent')])

Expand source code
@dataclass(frozen=True)
class ChangeSet:
    write_set: "WriteSet"
    events: typing.Sequence["ContractEvent"]

    def bcs_serialize(self) -> bytes:
        return bcs.serialize(self, ChangeSet)

    @staticmethod
    def bcs_deserialize(input: bytes) -> "ChangeSet":
        v, buffer = bcs.deserialize(input, ChangeSet)
        if buffer:
            raise st.DeserializationError("Some input bytes were not read")
        return v

Class variables

var events : Sequence[ContractEvent]
var write_setWriteSet

Static methods

def bcs_deserialize(input: bytes) ‑> ChangeSet
Expand source code
@staticmethod
def bcs_deserialize(input: bytes) -> "ChangeSet":
    v, buffer = bcs.deserialize(input, ChangeSet)
    if buffer:
        raise st.DeserializationError("Some input bytes were not read")
    return v

Methods

def bcs_serialize(self) ‑> bytes
Expand source code
def bcs_serialize(self) -> bytes:
    return bcs.serialize(self, ChangeSet)
class CoinTradeMetadata
Expand source code
class CoinTradeMetadata:
    VARIANTS = []  # type: typing.Sequence[typing.Type[CoinTradeMetadata]]

    def bcs_serialize(self) -> bytes:
        return bcs.serialize(self, CoinTradeMetadata)

    @staticmethod
    def bcs_deserialize(input: bytes) -> "CoinTradeMetadata":
        v, buffer = bcs.deserialize(input, CoinTradeMetadata)
        if buffer:
            raise st.DeserializationError("Some input bytes were not read")
        return v

Subclasses

Class variables

var VARIANTS

Static methods

def bcs_deserialize(input: bytes) ‑> CoinTradeMetadata
Expand source code
@staticmethod
def bcs_deserialize(input: bytes) -> "CoinTradeMetadata":
    v, buffer = bcs.deserialize(input, CoinTradeMetadata)
    if buffer:
        raise st.DeserializationError("Some input bytes were not read")
    return v

Methods

def bcs_serialize(self) ‑> bytes
Expand source code
def bcs_serialize(self) -> bytes:
    return bcs.serialize(self, CoinTradeMetadata)
class CoinTradeMetadataV0 (trade_ids: Sequence[str])

CoinTradeMetadataV0(trade_ids: Sequence[str])

Expand source code
@dataclass(frozen=True)
class CoinTradeMetadataV0:
    trade_ids: typing.Sequence[str]

    def bcs_serialize(self) -> bytes:
        return bcs.serialize(self, CoinTradeMetadataV0)

    @staticmethod
    def bcs_deserialize(input: bytes) -> "CoinTradeMetadataV0":
        v, buffer = bcs.deserialize(input, CoinTradeMetadataV0)
        if buffer:
            raise st.DeserializationError("Some input bytes were not read")
        return v

Class variables

var trade_ids : Sequence[str]

Static methods

def bcs_deserialize(input: bytes) ‑> CoinTradeMetadataV0
Expand source code
@staticmethod
def bcs_deserialize(input: bytes) -> "CoinTradeMetadataV0":
    v, buffer = bcs.deserialize(input, CoinTradeMetadataV0)
    if buffer:
        raise st.DeserializationError("Some input bytes were not read")
    return v

Methods

def bcs_serialize(self) ‑> bytes
Expand source code
def bcs_serialize(self) -> bytes:
    return bcs.serialize(self, CoinTradeMetadataV0)
class CoinTradeMetadata__CoinTradeMetadataV0 (value: CoinTradeMetadataV0)

CoinTradeMetadata__CoinTradeMetadataV0(value: 'CoinTradeMetadataV0')

Expand source code
@dataclass(frozen=True)
class CoinTradeMetadata__CoinTradeMetadataV0(CoinTradeMetadata):
    INDEX = 0  # type: int
    value: "CoinTradeMetadataV0"

Ancestors

Class variables

var INDEX
var valueCoinTradeMetadataV0
class ContractEvent
Expand source code
class ContractEvent:
    VARIANTS = []  # type: typing.Sequence[typing.Type[ContractEvent]]

    def bcs_serialize(self) -> bytes:
        return bcs.serialize(self, ContractEvent)

    @staticmethod
    def bcs_deserialize(input: bytes) -> "ContractEvent":
        v, buffer = bcs.deserialize(input, ContractEvent)
        if buffer:
            raise st.DeserializationError("Some input bytes were not read")
        return v

Subclasses

Class variables

var VARIANTS

Static methods

def bcs_deserialize(input: bytes) ‑> ContractEvent
Expand source code
@staticmethod
def bcs_deserialize(input: bytes) -> "ContractEvent":
    v, buffer = bcs.deserialize(input, ContractEvent)
    if buffer:
        raise st.DeserializationError("Some input bytes were not read")
    return v

Methods

def bcs_serialize(self) ‑> bytes
Expand source code
def bcs_serialize(self) -> bytes:
    return bcs.serialize(self, ContractEvent)
class ContractEventV0 (key: EventKey, sequence_number: numpy.uint64, type_tag: TypeTag, event_data: bytes)

ContractEventV0(key: 'EventKey', sequence_number: numpy.uint64, type_tag: 'TypeTag', event_data: bytes)

Expand source code
@dataclass(frozen=True)
class ContractEventV0:
    key: "EventKey"
    sequence_number: st.uint64
    type_tag: "TypeTag"
    event_data: bytes

    def bcs_serialize(self) -> bytes:
        return bcs.serialize(self, ContractEventV0)

    @staticmethod
    def bcs_deserialize(input: bytes) -> "ContractEventV0":
        v, buffer = bcs.deserialize(input, ContractEventV0)
        if buffer:
            raise st.DeserializationError("Some input bytes were not read")
        return v

Class variables

var event_data : bytes
var keyEventKey
var sequence_number : numpy.uint64
var type_tagTypeTag

Static methods

def bcs_deserialize(input: bytes) ‑> ContractEventV0
Expand source code
@staticmethod
def bcs_deserialize(input: bytes) -> "ContractEventV0":
    v, buffer = bcs.deserialize(input, ContractEventV0)
    if buffer:
        raise st.DeserializationError("Some input bytes were not read")
    return v

Methods

def bcs_serialize(self) ‑> bytes
Expand source code
def bcs_serialize(self) -> bytes:
    return bcs.serialize(self, ContractEventV0)
class ContractEvent__V0 (value: ContractEventV0)

ContractEvent__V0(value: 'ContractEventV0')

Expand source code
@dataclass(frozen=True)
class ContractEvent__V0(ContractEvent):
    INDEX = 0  # type: int
    value: "ContractEventV0"

Ancestors

Class variables

var INDEX
var valueContractEventV0
class Ed25519PublicKey (value: bytes)

Ed25519PublicKey(value: bytes)

Expand source code
@dataclass(frozen=True)
class Ed25519PublicKey:
    value: bytes

    def bcs_serialize(self) -> bytes:
        return bcs.serialize(self, Ed25519PublicKey)

    @staticmethod
    def bcs_deserialize(input: bytes) -> "Ed25519PublicKey":
        v, buffer = bcs.deserialize(input, Ed25519PublicKey)
        if buffer:
            raise st.DeserializationError("Some input bytes were not read")
        return v

Class variables

var value : bytes

Static methods

def bcs_deserialize(input: bytes) ‑> Ed25519PublicKey
Expand source code
@staticmethod
def bcs_deserialize(input: bytes) -> "Ed25519PublicKey":
    v, buffer = bcs.deserialize(input, Ed25519PublicKey)
    if buffer:
        raise st.DeserializationError("Some input bytes were not read")
    return v

Methods

def bcs_serialize(self) ‑> bytes
Expand source code
def bcs_serialize(self) -> bytes:
    return bcs.serialize(self, Ed25519PublicKey)
class Ed25519Signature (value: bytes)

Ed25519Signature(value: bytes)

Expand source code
@dataclass(frozen=True)
class Ed25519Signature:
    value: bytes

    def bcs_serialize(self) -> bytes:
        return bcs.serialize(self, Ed25519Signature)

    @staticmethod
    def bcs_deserialize(input: bytes) -> "Ed25519Signature":
        v, buffer = bcs.deserialize(input, Ed25519Signature)
        if buffer:
            raise st.DeserializationError("Some input bytes were not read")
        return v

Class variables

var value : bytes

Static methods

def bcs_deserialize(input: bytes) ‑> Ed25519Signature
Expand source code
@staticmethod
def bcs_deserialize(input: bytes) -> "Ed25519Signature":
    v, buffer = bcs.deserialize(input, Ed25519Signature)
    if buffer:
        raise st.DeserializationError("Some input bytes were not read")
    return v

Methods

def bcs_serialize(self) ‑> bytes
Expand source code
def bcs_serialize(self) -> bytes:
    return bcs.serialize(self, Ed25519Signature)
class EventKey (value: bytes)

EventKey(value: bytes)

Expand source code
@dataclass(frozen=True)
class EventKey:
    value: bytes

    def bcs_serialize(self) -> bytes:
        return bcs.serialize(self, EventKey)

    @staticmethod
    def bcs_deserialize(input: bytes) -> "EventKey":
        v, buffer = bcs.deserialize(input, EventKey)
        if buffer:
            raise st.DeserializationError("Some input bytes were not read")
        return v

Class variables

var value : bytes

Static methods

def bcs_deserialize(input: bytes) ‑> EventKey
Expand source code
@staticmethod
def bcs_deserialize(input: bytes) -> "EventKey":
    v, buffer = bcs.deserialize(input, EventKey)
    if buffer:
        raise st.DeserializationError("Some input bytes were not read")
    return v

Methods

def bcs_serialize(self) ‑> bytes
Expand source code
def bcs_serialize(self) -> bytes:
    return bcs.serialize(self, EventKey)
class GeneralMetadata
Expand source code
class GeneralMetadata:
    VARIANTS = []  # type: typing.Sequence[typing.Type[GeneralMetadata]]

    def bcs_serialize(self) -> bytes:
        return bcs.serialize(self, GeneralMetadata)

    @staticmethod
    def bcs_deserialize(input: bytes) -> "GeneralMetadata":
        v, buffer = bcs.deserialize(input, GeneralMetadata)
        if buffer:
            raise st.DeserializationError("Some input bytes were not read")
        return v

Subclasses

Class variables

var VARIANTS

Static methods

def bcs_deserialize(input: bytes) ‑> GeneralMetadata
Expand source code
@staticmethod
def bcs_deserialize(input: bytes) -> "GeneralMetadata":
    v, buffer = bcs.deserialize(input, GeneralMetadata)
    if buffer:
        raise st.DeserializationError("Some input bytes were not read")
    return v

Methods

def bcs_serialize(self) ‑> bytes
Expand source code
def bcs_serialize(self) -> bytes:
    return bcs.serialize(self, GeneralMetadata)
class GeneralMetadataV0 (to_subaddress: Optional[bytes], from_subaddress: Optional[bytes], referenced_event: Optional[numpy.uint64])

GeneralMetadataV0(to_subaddress: Optional[bytes], from_subaddress: Optional[bytes], referenced_event: Optional[numpy.uint64])

Expand source code
@dataclass(frozen=True)
class GeneralMetadataV0:
    to_subaddress: typing.Optional[bytes]
    from_subaddress: typing.Optional[bytes]
    referenced_event: typing.Optional[st.uint64]

    def bcs_serialize(self) -> bytes:
        return bcs.serialize(self, GeneralMetadataV0)

    @staticmethod
    def bcs_deserialize(input: bytes) -> "GeneralMetadataV0":
        v, buffer = bcs.deserialize(input, GeneralMetadataV0)
        if buffer:
            raise st.DeserializationError("Some input bytes were not read")
        return v

Class variables

var from_subaddress : Optional[bytes]
var referenced_event : Optional[numpy.uint64]
var to_subaddress : Optional[bytes]

Static methods

def bcs_deserialize(input: bytes) ‑> GeneralMetadataV0
Expand source code
@staticmethod
def bcs_deserialize(input: bytes) -> "GeneralMetadataV0":
    v, buffer = bcs.deserialize(input, GeneralMetadataV0)
    if buffer:
        raise st.DeserializationError("Some input bytes were not read")
    return v

Methods

def bcs_serialize(self) ‑> bytes
Expand source code
def bcs_serialize(self) -> bytes:
    return bcs.serialize(self, GeneralMetadataV0)
class GeneralMetadata__GeneralMetadataVersion0 (value: GeneralMetadataV0)

GeneralMetadata__GeneralMetadataVersion0(value: 'GeneralMetadataV0')

Expand source code
@dataclass(frozen=True)
class GeneralMetadata__GeneralMetadataVersion0(GeneralMetadata):
    INDEX = 0  # type: int
    value: "GeneralMetadataV0"

Ancestors

Class variables

var INDEX
var valueGeneralMetadataV0
class HashValue (value: bytes)

HashValue(value: bytes)

Expand source code
@dataclass(frozen=True)
class HashValue:
    value: bytes

    def bcs_serialize(self) -> bytes:
        return bcs.serialize(self, HashValue)

    @staticmethod
    def bcs_deserialize(input: bytes) -> "HashValue":
        v, buffer = bcs.deserialize(input, HashValue)
        if buffer:
            raise st.DeserializationError("Some input bytes were not read")
        return v

Class variables

var value : bytes

Static methods

def bcs_deserialize(input: bytes) ‑> HashValue
Expand source code
@staticmethod
def bcs_deserialize(input: bytes) -> "HashValue":
    v, buffer = bcs.deserialize(input, HashValue)
    if buffer:
        raise st.DeserializationError("Some input bytes were not read")
    return v

Methods

def bcs_serialize(self) ‑> bytes
Expand source code
def bcs_serialize(self) -> bytes:
    return bcs.serialize(self, HashValue)
class Identifier (value: str)

Identifier(value: str)

Expand source code
@dataclass(frozen=True)
class Identifier:
    value: str

    def bcs_serialize(self) -> bytes:
        return bcs.serialize(self, Identifier)

    @staticmethod
    def bcs_deserialize(input: bytes) -> "Identifier":
        v, buffer = bcs.deserialize(input, Identifier)
        if buffer:
            raise st.DeserializationError("Some input bytes were not read")
        return v

Class variables

var value : str

Static methods

def bcs_deserialize(input: bytes) ‑> Identifier
Expand source code
@staticmethod
def bcs_deserialize(input: bytes) -> "Identifier":
    v, buffer = bcs.deserialize(input, Identifier)
    if buffer:
        raise st.DeserializationError("Some input bytes were not read")
    return v

Methods

def bcs_serialize(self) ‑> bytes
Expand source code
def bcs_serialize(self) -> bytes:
    return bcs.serialize(self, Identifier)
class Metadata
Expand source code
class Metadata:
    VARIANTS = []  # type: typing.Sequence[typing.Type[Metadata]]

    def bcs_serialize(self) -> bytes:
        return bcs.serialize(self, Metadata)

    @staticmethod
    def bcs_deserialize(input: bytes) -> "Metadata":
        v, buffer = bcs.deserialize(input, Metadata)
        if buffer:
            raise st.DeserializationError("Some input bytes were not read")
        return v

    def decode_structure(self) -> typing.Union[None, "GeneralMetadataV0", "TravelRuleMetadataV0", "RefundMetadataV0"]:
        """decode metadata structure

        Returns None for a non-structure type or undefined
        """

        type_index = type(self).INDEX
        if type_index == 1:
            return typing.cast(GeneralMetadataV0, self.value.value)
        elif type_index == 2:
            return typing.cast(TravelRuleMetadataV0, self.value.value)
        elif type_index == 4:
            return typing.cast(RefundMetadataV0, self.value.value)
        elif type_index == 5:
            return typing.cast(CoinTradeMetadataV0, self.value.value)
        return None

Subclasses

Class variables

var VARIANTS

Static methods

def bcs_deserialize(input: bytes) ‑> Metadata
Expand source code
@staticmethod
def bcs_deserialize(input: bytes) -> "Metadata":
    v, buffer = bcs.deserialize(input, Metadata)
    if buffer:
        raise st.DeserializationError("Some input bytes were not read")
    return v

Methods

def bcs_serialize(self) ‑> bytes
Expand source code
def bcs_serialize(self) -> bytes:
    return bcs.serialize(self, Metadata)
def decode_structure(self) ‑> Union[NoneType, GeneralMetadataV0TravelRuleMetadataV0RefundMetadataV0]

decode metadata structure

Returns None for a non-structure type or undefined

Expand source code
def decode_structure(self) -> typing.Union[None, "GeneralMetadataV0", "TravelRuleMetadataV0", "RefundMetadataV0"]:
    """decode metadata structure

    Returns None for a non-structure type or undefined
    """

    type_index = type(self).INDEX
    if type_index == 1:
        return typing.cast(GeneralMetadataV0, self.value.value)
    elif type_index == 2:
        return typing.cast(TravelRuleMetadataV0, self.value.value)
    elif type_index == 4:
        return typing.cast(RefundMetadataV0, self.value.value)
    elif type_index == 5:
        return typing.cast(CoinTradeMetadataV0, self.value.value)
    return None
class Metadata__CoinTradeMetadata (value: CoinTradeMetadata)

Metadata__CoinTradeMetadata(value: 'CoinTradeMetadata')

Expand source code
@dataclass(frozen=True)
class Metadata__CoinTradeMetadata(Metadata):
    INDEX = 5  # type: int
    value: "CoinTradeMetadata"

Ancestors

Class variables

var INDEX
var valueCoinTradeMetadata

Inherited members

class Metadata__GeneralMetadata (value: GeneralMetadata)

Metadata__GeneralMetadata(value: 'GeneralMetadata')

Expand source code
@dataclass(frozen=True)
class Metadata__GeneralMetadata(Metadata):
    INDEX = 1  # type: int
    value: "GeneralMetadata"

Ancestors

Class variables

var INDEX
var valueGeneralMetadata

Inherited members

class Metadata__RefundMetadata (value: RefundMetadata)

Metadata__RefundMetadata(value: 'RefundMetadata')

Expand source code
@dataclass(frozen=True)
class Metadata__RefundMetadata(Metadata):
    INDEX = 4  # type: int
    value: "RefundMetadata"

Ancestors

Class variables

var INDEX
var valueRefundMetadata

Inherited members

class Metadata__TravelRuleMetadata (value: TravelRuleMetadata)

Metadata__TravelRuleMetadata(value: 'TravelRuleMetadata')

Expand source code
@dataclass(frozen=True)
class Metadata__TravelRuleMetadata(Metadata):
    INDEX = 2  # type: int
    value: "TravelRuleMetadata"

Ancestors

Class variables

var INDEX
var valueTravelRuleMetadata

Inherited members

class Metadata__Undefined

Metadata__Undefined()

Expand source code
@dataclass(frozen=True)
class Metadata__Undefined(Metadata):
    INDEX = 0  # type: int
    pass

Ancestors

Class variables

var INDEX

Inherited members

class Metadata__UnstructuredBytesMetadata (value: UnstructuredBytesMetadata)

Metadata__UnstructuredBytesMetadata(value: 'UnstructuredBytesMetadata')

Expand source code
@dataclass(frozen=True)
class Metadata__UnstructuredBytesMetadata(Metadata):
    INDEX = 3  # type: int
    value: "UnstructuredBytesMetadata"

Ancestors

Class variables

var INDEX
var valueUnstructuredBytesMetadata

Inherited members

class Module (code: bytes)

Module(code: bytes)

Expand source code
@dataclass(frozen=True)
class Module:
    code: bytes

    def bcs_serialize(self) -> bytes:
        return bcs.serialize(self, Module)

    @staticmethod
    def bcs_deserialize(input: bytes) -> "Module":
        v, buffer = bcs.deserialize(input, Module)
        if buffer:
            raise st.DeserializationError("Some input bytes were not read")
        return v

Class variables

var code : bytes

Static methods

def bcs_deserialize(input: bytes) ‑> Module
Expand source code
@staticmethod
def bcs_deserialize(input: bytes) -> "Module":
    v, buffer = bcs.deserialize(input, Module)
    if buffer:
        raise st.DeserializationError("Some input bytes were not read")
    return v

Methods

def bcs_serialize(self) ‑> bytes
Expand source code
def bcs_serialize(self) -> bytes:
    return bcs.serialize(self, Module)
class ModuleId (address: AccountAddress, name: Identifier)

ModuleId(address: 'AccountAddress', name: 'Identifier')

Expand source code
@dataclass(frozen=True)
class ModuleId:
    address: "AccountAddress"
    name: "Identifier"

    def bcs_serialize(self) -> bytes:
        return bcs.serialize(self, ModuleId)

    @staticmethod
    def bcs_deserialize(input: bytes) -> "ModuleId":
        v, buffer = bcs.deserialize(input, ModuleId)
        if buffer:
            raise st.DeserializationError("Some input bytes were not read")
        return v

Class variables

var addressAccountAddress
var nameIdentifier

Static methods

def bcs_deserialize(input: bytes) ‑> ModuleId
Expand source code
@staticmethod
def bcs_deserialize(input: bytes) -> "ModuleId":
    v, buffer = bcs.deserialize(input, ModuleId)
    if buffer:
        raise st.DeserializationError("Some input bytes were not read")
    return v

Methods

def bcs_serialize(self) ‑> bytes
Expand source code
def bcs_serialize(self) -> bytes:
    return bcs.serialize(self, ModuleId)
class MultiEd25519PublicKey (value: bytes)

MultiEd25519PublicKey(value: bytes)

Expand source code
@dataclass(frozen=True)
class MultiEd25519PublicKey:
    value: bytes

    def bcs_serialize(self) -> bytes:
        return bcs.serialize(self, MultiEd25519PublicKey)

    @staticmethod
    def bcs_deserialize(input: bytes) -> "MultiEd25519PublicKey":
        v, buffer = bcs.deserialize(input, MultiEd25519PublicKey)
        if buffer:
            raise st.DeserializationError("Some input bytes were not read")
        return v

Class variables

var value : bytes

Static methods

def bcs_deserialize(input: bytes) ‑> MultiEd25519PublicKey
Expand source code
@staticmethod
def bcs_deserialize(input: bytes) -> "MultiEd25519PublicKey":
    v, buffer = bcs.deserialize(input, MultiEd25519PublicKey)
    if buffer:
        raise st.DeserializationError("Some input bytes were not read")
    return v

Methods

def bcs_serialize(self) ‑> bytes
Expand source code
def bcs_serialize(self) -> bytes:
    return bcs.serialize(self, MultiEd25519PublicKey)
class MultiEd25519Signature (value: bytes)

MultiEd25519Signature(value: bytes)

Expand source code
@dataclass(frozen=True)
class MultiEd25519Signature:
    value: bytes

    def bcs_serialize(self) -> bytes:
        return bcs.serialize(self, MultiEd25519Signature)

    @staticmethod
    def bcs_deserialize(input: bytes) -> "MultiEd25519Signature":
        v, buffer = bcs.deserialize(input, MultiEd25519Signature)
        if buffer:
            raise st.DeserializationError("Some input bytes were not read")
        return v

Class variables

var value : bytes

Static methods

def bcs_deserialize(input: bytes) ‑> MultiEd25519Signature
Expand source code
@staticmethod
def bcs_deserialize(input: bytes) -> "MultiEd25519Signature":
    v, buffer = bcs.deserialize(input, MultiEd25519Signature)
    if buffer:
        raise st.DeserializationError("Some input bytes were not read")
    return v

Methods

def bcs_serialize(self) ‑> bytes
Expand source code
def bcs_serialize(self) -> bytes:
    return bcs.serialize(self, MultiEd25519Signature)
class RawTransaction (sender: AccountAddress, sequence_number: numpy.uint64, payload: TransactionPayload, max_gas_amount: numpy.uint64, gas_unit_price: numpy.uint64, gas_currency_code: str, expiration_timestamp_secs: numpy.uint64, chain_id: ChainId)

RawTransaction(sender: 'AccountAddress', sequence_number: numpy.uint64, payload: 'TransactionPayload', max_gas_amount: numpy.uint64, gas_unit_price: numpy.uint64, gas_currency_code: str, expiration_timestamp_secs: numpy.uint64, chain_id: 'ChainId')

Expand source code
@dataclass(frozen=True)
class RawTransaction:
    sender: "AccountAddress"
    sequence_number: st.uint64
    payload: "TransactionPayload"
    max_gas_amount: st.uint64
    gas_unit_price: st.uint64
    gas_currency_code: str
    expiration_timestamp_secs: st.uint64
    chain_id: "ChainId"

    def bcs_serialize(self) -> bytes:
        return bcs.serialize(self, RawTransaction)

    @staticmethod
    def bcs_deserialize(input: bytes) -> "RawTransaction":
        v, buffer = bcs.deserialize(input, RawTransaction)
        if buffer:
            raise st.DeserializationError("Some input bytes were not read")
        return v

Class variables

var chain_idChainId
var expiration_timestamp_secs : numpy.uint64
var gas_currency_code : str
var gas_unit_price : numpy.uint64
var max_gas_amount : numpy.uint64
var payloadTransactionPayload
var senderAccountAddress
var sequence_number : numpy.uint64

Static methods

def bcs_deserialize(input: bytes) ‑> RawTransaction
Expand source code
@staticmethod
def bcs_deserialize(input: bytes) -> "RawTransaction":
    v, buffer = bcs.deserialize(input, RawTransaction)
    if buffer:
        raise st.DeserializationError("Some input bytes were not read")
    return v

Methods

def bcs_serialize(self) ‑> bytes
Expand source code
def bcs_serialize(self) -> bytes:
    return bcs.serialize(self, RawTransaction)
class RefundMetadata
Expand source code
class RefundMetadata:
    VARIANTS = []  # type: typing.Sequence[typing.Type[RefundMetadata]]

    def bcs_serialize(self) -> bytes:
        return bcs.serialize(self, RefundMetadata)

    @staticmethod
    def bcs_deserialize(input: bytes) -> "RefundMetadata":
        v, buffer = bcs.deserialize(input, RefundMetadata)
        if buffer:
            raise st.DeserializationError("Some input bytes were not read")
        return v

Subclasses

Class variables

var VARIANTS

Static methods

def bcs_deserialize(input: bytes) ‑> RefundMetadata
Expand source code
@staticmethod
def bcs_deserialize(input: bytes) -> "RefundMetadata":
    v, buffer = bcs.deserialize(input, RefundMetadata)
    if buffer:
        raise st.DeserializationError("Some input bytes were not read")
    return v

Methods

def bcs_serialize(self) ‑> bytes
Expand source code
def bcs_serialize(self) -> bytes:
    return bcs.serialize(self, RefundMetadata)
class RefundMetadataV0 (transaction_version: numpy.uint64, reason: RefundReason)

RefundMetadataV0(transaction_version: numpy.uint64, reason: 'RefundReason')

Expand source code
@dataclass(frozen=True)
class RefundMetadataV0:
    transaction_version: st.uint64
    reason: "RefundReason"

    def bcs_serialize(self) -> bytes:
        return bcs.serialize(self, RefundMetadataV0)

    @staticmethod
    def bcs_deserialize(input: bytes) -> "RefundMetadataV0":
        v, buffer = bcs.deserialize(input, RefundMetadataV0)
        if buffer:
            raise st.DeserializationError("Some input bytes were not read")
        return v

Class variables

var reasonRefundReason
var transaction_version : numpy.uint64

Static methods

def bcs_deserialize(input: bytes) ‑> RefundMetadataV0
Expand source code
@staticmethod
def bcs_deserialize(input: bytes) -> "RefundMetadataV0":
    v, buffer = bcs.deserialize(input, RefundMetadataV0)
    if buffer:
        raise st.DeserializationError("Some input bytes were not read")
    return v

Methods

def bcs_serialize(self) ‑> bytes
Expand source code
def bcs_serialize(self) -> bytes:
    return bcs.serialize(self, RefundMetadataV0)
class RefundMetadata__RefundMetadataV0 (value: RefundMetadataV0)

RefundMetadata__RefundMetadataV0(value: 'RefundMetadataV0')

Expand source code
@dataclass(frozen=True)
class RefundMetadata__RefundMetadataV0(RefundMetadata):
    INDEX = 0  # type: int
    value: "RefundMetadataV0"

Ancestors

Class variables

var INDEX
var valueRefundMetadataV0
class RefundReason
Expand source code
class RefundReason:
    VARIANTS = []  # type: typing.Sequence[typing.Type[RefundReason]]

    def bcs_serialize(self) -> bytes:
        return bcs.serialize(self, RefundReason)

    @staticmethod
    def bcs_deserialize(input: bytes) -> "RefundReason":
        v, buffer = bcs.deserialize(input, RefundReason)
        if buffer:
            raise st.DeserializationError("Some input bytes were not read")
        return v

Subclasses

Class variables

var VARIANTS

Static methods

def bcs_deserialize(input: bytes) ‑> RefundReason
Expand source code
@staticmethod
def bcs_deserialize(input: bytes) -> "RefundReason":
    v, buffer = bcs.deserialize(input, RefundReason)
    if buffer:
        raise st.DeserializationError("Some input bytes were not read")
    return v

Methods

def bcs_serialize(self) ‑> bytes
Expand source code
def bcs_serialize(self) -> bytes:
    return bcs.serialize(self, RefundReason)
class RefundReason__InvalidSubaddress

RefundReason__InvalidSubaddress()

Expand source code
@dataclass(frozen=True)
class RefundReason__InvalidSubaddress(RefundReason):
    INDEX = 1  # type: int
    pass

Ancestors

Class variables

var INDEX
class RefundReason__OtherReason

RefundReason__OtherReason()

Expand source code
@dataclass(frozen=True)
class RefundReason__OtherReason(RefundReason):
    INDEX = 0  # type: int
    pass

Ancestors

Class variables

var INDEX
class RefundReason__UserInitiatedFullRefund

RefundReason__UserInitiatedFullRefund()

Expand source code
@dataclass(frozen=True)
class RefundReason__UserInitiatedFullRefund(RefundReason):
    INDEX = 3  # type: int
    pass

Ancestors

Class variables

var INDEX
class RefundReason__UserInitiatedPartialRefund

RefundReason__UserInitiatedPartialRefund()

Expand source code
@dataclass(frozen=True)
class RefundReason__UserInitiatedPartialRefund(RefundReason):
    INDEX = 2  # type: int
    pass

Ancestors

Class variables

var INDEX
class Script (code: bytes, ty_args: Sequence[ForwardRef('TypeTag')], args: Sequence[ForwardRef('TransactionArgument')])

Script(code: bytes, ty_args: Sequence[ForwardRef('TypeTag')], args: Sequence[ForwardRef('TransactionArgument')])

Expand source code
@dataclass(frozen=True)
class Script:
    code: bytes
    ty_args: typing.Sequence["TypeTag"]
    args: typing.Sequence["TransactionArgument"]

    def bcs_serialize(self) -> bytes:
        return bcs.serialize(self, Script)

    @staticmethod
    def bcs_deserialize(input: bytes) -> "Script":
        v, buffer = bcs.deserialize(input, Script)
        if buffer:
            raise st.DeserializationError("Some input bytes were not read")
        return v

Class variables

var args : Sequence[TransactionArgument]
var code : bytes
var ty_args : Sequence[TypeTag]

Static methods

def bcs_deserialize(input: bytes) ‑> Script
Expand source code
@staticmethod
def bcs_deserialize(input: bytes) -> "Script":
    v, buffer = bcs.deserialize(input, Script)
    if buffer:
        raise st.DeserializationError("Some input bytes were not read")
    return v

Methods

def bcs_serialize(self) ‑> bytes
Expand source code
def bcs_serialize(self) -> bytes:
    return bcs.serialize(self, Script)
class ScriptFunction (module: ModuleId, function: Identifier, ty_args: Sequence[ForwardRef('TypeTag')], args: Sequence[bytes])

ScriptFunction(module: 'ModuleId', function: 'Identifier', ty_args: Sequence[ForwardRef('TypeTag')], args: Sequence[bytes])

Expand source code
@dataclass(frozen=True)
class ScriptFunction:
    module: "ModuleId"
    function: "Identifier"
    ty_args: typing.Sequence["TypeTag"]
    args: typing.Sequence[bytes]

    def bcs_serialize(self) -> bytes:
        return bcs.serialize(self, ScriptFunction)

    @staticmethod
    def bcs_deserialize(input: bytes) -> "ScriptFunction":
        v, buffer = bcs.deserialize(input, ScriptFunction)
        if buffer:
            raise st.DeserializationError("Some input bytes were not read")
        return v

Class variables

var args : Sequence[bytes]
var functionIdentifier
var moduleModuleId
var ty_args : Sequence[TypeTag]

Static methods

def bcs_deserialize(input: bytes) ‑> ScriptFunction
Expand source code
@staticmethod
def bcs_deserialize(input: bytes) -> "ScriptFunction":
    v, buffer = bcs.deserialize(input, ScriptFunction)
    if buffer:
        raise st.DeserializationError("Some input bytes were not read")
    return v

Methods

def bcs_serialize(self) ‑> bytes
Expand source code
def bcs_serialize(self) -> bytes:
    return bcs.serialize(self, ScriptFunction)
class SignedTransaction (raw_txn: RawTransaction, authenticator: TransactionAuthenticator)

SignedTransaction(raw_txn: 'RawTransaction', authenticator: 'TransactionAuthenticator')

Expand source code
@dataclass(frozen=True)
class SignedTransaction:
    raw_txn: "RawTransaction"
    authenticator: "TransactionAuthenticator"

    def bcs_serialize(self) -> bytes:
        return bcs.serialize(self, SignedTransaction)

    @staticmethod
    def bcs_deserialize(input: bytes) -> "SignedTransaction":
        v, buffer = bcs.deserialize(input, SignedTransaction)
        if buffer:
            raise st.DeserializationError("Some input bytes were not read")
        return v

    @staticmethod
    def from_raw_txn_and_ed25519_key(txn: RawTransaction, public_key: bytes, signature: bytes) -> "SignedTransaction":
        return SignedTransaction(
            raw_txn=txn,
            authenticator=TransactionAuthenticator__Ed25519(
                public_key=Ed25519PublicKey(value=public_key),
                signature=Ed25519Signature(value=signature),
            ),
        )

Class variables

var authenticatorTransactionAuthenticator
var raw_txnRawTransaction

Static methods

def bcs_deserialize(input: bytes) ‑> SignedTransaction
Expand source code
@staticmethod
def bcs_deserialize(input: bytes) -> "SignedTransaction":
    v, buffer = bcs.deserialize(input, SignedTransaction)
    if buffer:
        raise st.DeserializationError("Some input bytes were not read")
    return v
def from_raw_txn_and_ed25519_key(txn: RawTransaction, public_key: bytes, signature: bytes) ‑> SignedTransaction
Expand source code
@staticmethod
def from_raw_txn_and_ed25519_key(txn: RawTransaction, public_key: bytes, signature: bytes) -> "SignedTransaction":
    return SignedTransaction(
        raw_txn=txn,
        authenticator=TransactionAuthenticator__Ed25519(
            public_key=Ed25519PublicKey(value=public_key),
            signature=Ed25519Signature(value=signature),
        ),
    )

Methods

def bcs_serialize(self) ‑> bytes
Expand source code
def bcs_serialize(self) -> bytes:
    return bcs.serialize(self, SignedTransaction)
class StructTag (address: AccountAddress, module: Identifier, name: Identifier, type_params: Sequence[ForwardRef('TypeTag')])

StructTag(address: 'AccountAddress', module: 'Identifier', name: 'Identifier', type_params: Sequence[ForwardRef('TypeTag')])

Expand source code
@dataclass(frozen=True)
class StructTag:
    address: "AccountAddress"
    module: "Identifier"
    name: "Identifier"
    type_params: typing.Sequence["TypeTag"]

    def bcs_serialize(self) -> bytes:
        return bcs.serialize(self, StructTag)

    @staticmethod
    def bcs_deserialize(input: bytes) -> "StructTag":
        v, buffer = bcs.deserialize(input, StructTag)
        if buffer:
            raise st.DeserializationError("Some input bytes were not read")
        return v

Class variables

var addressAccountAddress
var moduleIdentifier
var nameIdentifier
var type_params : Sequence[TypeTag]

Static methods

def bcs_deserialize(input: bytes) ‑> StructTag
Expand source code
@staticmethod
def bcs_deserialize(input: bytes) -> "StructTag":
    v, buffer = bcs.deserialize(input, StructTag)
    if buffer:
        raise st.DeserializationError("Some input bytes were not read")
    return v

Methods

def bcs_serialize(self) ‑> bytes
Expand source code
def bcs_serialize(self) -> bytes:
    return bcs.serialize(self, StructTag)
class Transaction
Expand source code
class Transaction:
    VARIANTS = []  # type: typing.Sequence[typing.Type[Transaction]]

    def bcs_serialize(self) -> bytes:
        return bcs.serialize(self, Transaction)

    @staticmethod
    def bcs_deserialize(input: bytes) -> "Transaction":
        v, buffer = bcs.deserialize(input, Transaction)
        if buffer:
            raise st.DeserializationError("Some input bytes were not read")
        return v

Subclasses

Class variables

var VARIANTS

Static methods

def bcs_deserialize(input: bytes) ‑> Transaction
Expand source code
@staticmethod
def bcs_deserialize(input: bytes) -> "Transaction":
    v, buffer = bcs.deserialize(input, Transaction)
    if buffer:
        raise st.DeserializationError("Some input bytes were not read")
    return v

Methods

def bcs_serialize(self) ‑> bytes
Expand source code
def bcs_serialize(self) -> bytes:
    return bcs.serialize(self, Transaction)
class TransactionArgument
Expand source code
class TransactionArgument:
    VARIANTS = []  # type: typing.Sequence[typing.Type[TransactionArgument]]

    def bcs_serialize(self) -> bytes:
        return bcs.serialize(self, TransactionArgument)

    @staticmethod
    def bcs_deserialize(input: bytes) -> "TransactionArgument":
        v, buffer = bcs.deserialize(input, TransactionArgument)
        if buffer:
            raise st.DeserializationError("Some input bytes were not read")
        return v

Subclasses

Class variables

var VARIANTS

Static methods

def bcs_deserialize(input: bytes) ‑> TransactionArgument
Expand source code
@staticmethod
def bcs_deserialize(input: bytes) -> "TransactionArgument":
    v, buffer = bcs.deserialize(input, TransactionArgument)
    if buffer:
        raise st.DeserializationError("Some input bytes were not read")
    return v

Methods

def bcs_serialize(self) ‑> bytes
Expand source code
def bcs_serialize(self) -> bytes:
    return bcs.serialize(self, TransactionArgument)
class TransactionArgument__Address (value: AccountAddress)

TransactionArgument__Address(value: 'AccountAddress')

Expand source code
@dataclass(frozen=True)
class TransactionArgument__Address(TransactionArgument):
    INDEX = 3  # type: int
    value: "AccountAddress"

Ancestors

Class variables

var INDEX
var valueAccountAddress
class TransactionArgument__Bool (value: bool)

TransactionArgument__Bool(value: bool)

Expand source code
@dataclass(frozen=True)
class TransactionArgument__Bool(TransactionArgument):
    INDEX = 5  # type: int
    value: bool

Ancestors

Class variables

var INDEX
var value : bool
class TransactionArgument__U128 (value: uint128)

TransactionArgument__U128(value: diem.serde_types.uint128)

Expand source code
@dataclass(frozen=True)
class TransactionArgument__U128(TransactionArgument):
    INDEX = 2  # type: int
    value: st.uint128

Ancestors

Class variables

var INDEX
var valueuint128
class TransactionArgument__U64 (value: numpy.uint64)

TransactionArgument__U64(value: numpy.uint64)

Expand source code
@dataclass(frozen=True)
class TransactionArgument__U64(TransactionArgument):
    INDEX = 1  # type: int
    value: st.uint64

Ancestors

Class variables

var INDEX
var value : numpy.uint64
class TransactionArgument__U8 (value: numpy.uint8)

TransactionArgument__U8(value: numpy.uint8)

Expand source code
@dataclass(frozen=True)
class TransactionArgument__U8(TransactionArgument):
    INDEX = 0  # type: int
    value: st.uint8

Ancestors

Class variables

var INDEX
var value : numpy.uint8
class TransactionArgument__U8Vector (value: bytes)

TransactionArgument__U8Vector(value: bytes)

Expand source code
@dataclass(frozen=True)
class TransactionArgument__U8Vector(TransactionArgument):
    INDEX = 4  # type: int
    value: bytes

Ancestors

Class variables

var INDEX
var value : bytes
class TransactionAuthenticator
Expand source code
class TransactionAuthenticator:
    VARIANTS = []  # type: typing.Sequence[typing.Type[TransactionAuthenticator]]

    def bcs_serialize(self) -> bytes:
        return bcs.serialize(self, TransactionAuthenticator)

    @staticmethod
    def bcs_deserialize(input: bytes) -> "TransactionAuthenticator":
        v, buffer = bcs.deserialize(input, TransactionAuthenticator)
        if buffer:
            raise st.DeserializationError("Some input bytes were not read")
        return v

Subclasses

Class variables

var VARIANTS

Static methods

def bcs_deserialize(input: bytes) ‑> TransactionAuthenticator
Expand source code
@staticmethod
def bcs_deserialize(input: bytes) -> "TransactionAuthenticator":
    v, buffer = bcs.deserialize(input, TransactionAuthenticator)
    if buffer:
        raise st.DeserializationError("Some input bytes were not read")
    return v

Methods

def bcs_serialize(self) ‑> bytes
Expand source code
def bcs_serialize(self) -> bytes:
    return bcs.serialize(self, TransactionAuthenticator)
class TransactionAuthenticator__Ed25519 (public_key: Ed25519PublicKey, signature: Ed25519Signature)

TransactionAuthenticator__Ed25519(public_key: 'Ed25519PublicKey', signature: 'Ed25519Signature')

Expand source code
@dataclass(frozen=True)
class TransactionAuthenticator__Ed25519(TransactionAuthenticator):
    INDEX = 0  # type: int
    public_key: "Ed25519PublicKey"
    signature: "Ed25519Signature"

Ancestors

Class variables

var INDEX
var public_keyEd25519PublicKey
var signatureEd25519Signature
class TransactionAuthenticator__MultiEd25519 (public_key: MultiEd25519PublicKey, signature: MultiEd25519Signature)

TransactionAuthenticator__MultiEd25519(public_key: 'MultiEd25519PublicKey', signature: 'MultiEd25519Signature')

Expand source code
@dataclass(frozen=True)
class TransactionAuthenticator__MultiEd25519(TransactionAuthenticator):
    INDEX = 1  # type: int
    public_key: "MultiEd25519PublicKey"
    signature: "MultiEd25519Signature"

Ancestors

Class variables

var INDEX
var public_keyMultiEd25519PublicKey
var signatureMultiEd25519Signature
class TransactionPayload
Expand source code
class TransactionPayload:
    VARIANTS = []  # type: typing.Sequence[typing.Type[TransactionPayload]]

    def bcs_serialize(self) -> bytes:
        return bcs.serialize(self, TransactionPayload)

    @staticmethod
    def bcs_deserialize(input: bytes) -> "TransactionPayload":
        v, buffer = bcs.deserialize(input, TransactionPayload)
        if buffer:
            raise st.DeserializationError("Some input bytes were not read")
        return v

Subclasses

Class variables

var VARIANTS

Static methods

def bcs_deserialize(input: bytes) ‑> TransactionPayload
Expand source code
@staticmethod
def bcs_deserialize(input: bytes) -> "TransactionPayload":
    v, buffer = bcs.deserialize(input, TransactionPayload)
    if buffer:
        raise st.DeserializationError("Some input bytes were not read")
    return v

Methods

def bcs_serialize(self) ‑> bytes
Expand source code
def bcs_serialize(self) -> bytes:
    return bcs.serialize(self, TransactionPayload)
class TransactionPayload__Module (value: Module)

TransactionPayload__Module(value: 'Module')

Expand source code
@dataclass(frozen=True)
class TransactionPayload__Module(TransactionPayload):
    INDEX = 2  # type: int
    value: "Module"

Ancestors

Class variables

var INDEX
var valueModule
class TransactionPayload__Script (value: Script)

TransactionPayload__Script(value: 'Script')

Expand source code
@dataclass(frozen=True)
class TransactionPayload__Script(TransactionPayload):
    INDEX = 1  # type: int
    value: "Script"

Ancestors

Class variables

var INDEX
var valueScript
class TransactionPayload__ScriptFunction (value: ScriptFunction)

TransactionPayload__ScriptFunction(value: 'ScriptFunction')

Expand source code
@dataclass(frozen=True)
class TransactionPayload__ScriptFunction(TransactionPayload):
    INDEX = 3  # type: int
    value: "ScriptFunction"

Ancestors

Class variables

var INDEX
var valueScriptFunction
class TransactionPayload__WriteSet (value: WriteSetPayload)

TransactionPayload__WriteSet(value: 'WriteSetPayload')

Expand source code
@dataclass(frozen=True)
class TransactionPayload__WriteSet(TransactionPayload):
    INDEX = 0  # type: int
    value: "WriteSetPayload"

Ancestors

Class variables

var INDEX
var valueWriteSetPayload
class Transaction__BlockMetadata (value: BlockMetadata)

Transaction__BlockMetadata(value: 'BlockMetadata')

Expand source code
@dataclass(frozen=True)
class Transaction__BlockMetadata(Transaction):
    INDEX = 2  # type: int
    value: "BlockMetadata"

Ancestors

Class variables

var INDEX
var valueBlockMetadata
class Transaction__GenesisTransaction (value: WriteSetPayload)

Transaction__GenesisTransaction(value: 'WriteSetPayload')

Expand source code
@dataclass(frozen=True)
class Transaction__GenesisTransaction(Transaction):
    INDEX = 1  # type: int
    value: "WriteSetPayload"

Ancestors

Class variables

var INDEX
var valueWriteSetPayload
class Transaction__UserTransaction (value: SignedTransaction)

Transaction__UserTransaction(value: 'SignedTransaction')

Expand source code
@dataclass(frozen=True)
class Transaction__UserTransaction(Transaction):
    INDEX = 0  # type: int
    value: "SignedTransaction"

Ancestors

Class variables

var INDEX
var valueSignedTransaction
class TravelRuleMetadata
Expand source code
class TravelRuleMetadata:
    VARIANTS = []  # type: typing.Sequence[typing.Type[TravelRuleMetadata]]

    def bcs_serialize(self) -> bytes:
        return bcs.serialize(self, TravelRuleMetadata)

    @staticmethod
    def bcs_deserialize(input: bytes) -> "TravelRuleMetadata":
        v, buffer = bcs.deserialize(input, TravelRuleMetadata)
        if buffer:
            raise st.DeserializationError("Some input bytes were not read")
        return v

Subclasses

Class variables

var VARIANTS

Static methods

def bcs_deserialize(input: bytes) ‑> TravelRuleMetadata
Expand source code
@staticmethod
def bcs_deserialize(input: bytes) -> "TravelRuleMetadata":
    v, buffer = bcs.deserialize(input, TravelRuleMetadata)
    if buffer:
        raise st.DeserializationError("Some input bytes were not read")
    return v

Methods

def bcs_serialize(self) ‑> bytes
Expand source code
def bcs_serialize(self) -> bytes:
    return bcs.serialize(self, TravelRuleMetadata)
class TravelRuleMetadataV0 (off_chain_reference_id: Optional[str])

TravelRuleMetadataV0(off_chain_reference_id: Optional[str])

Expand source code
@dataclass(frozen=True)
class TravelRuleMetadataV0:
    off_chain_reference_id: typing.Optional[str]

    def bcs_serialize(self) -> bytes:
        return bcs.serialize(self, TravelRuleMetadataV0)

    @staticmethod
    def bcs_deserialize(input: bytes) -> "TravelRuleMetadataV0":
        v, buffer = bcs.deserialize(input, TravelRuleMetadataV0)
        if buffer:
            raise st.DeserializationError("Some input bytes were not read")
        return v

Class variables

var off_chain_reference_id : Optional[str]

Static methods

def bcs_deserialize(input: bytes) ‑> TravelRuleMetadataV0
Expand source code
@staticmethod
def bcs_deserialize(input: bytes) -> "TravelRuleMetadataV0":
    v, buffer = bcs.deserialize(input, TravelRuleMetadataV0)
    if buffer:
        raise st.DeserializationError("Some input bytes were not read")
    return v

Methods

def bcs_serialize(self) ‑> bytes
Expand source code
def bcs_serialize(self) -> bytes:
    return bcs.serialize(self, TravelRuleMetadataV0)
class TravelRuleMetadata__TravelRuleMetadataVersion0 (value: TravelRuleMetadataV0)

TravelRuleMetadata__TravelRuleMetadataVersion0(value: 'TravelRuleMetadataV0')

Expand source code
@dataclass(frozen=True)
class TravelRuleMetadata__TravelRuleMetadataVersion0(TravelRuleMetadata):
    INDEX = 0  # type: int
    value: "TravelRuleMetadataV0"

Ancestors

Class variables

var INDEX
var valueTravelRuleMetadataV0
class TypeTag
Expand source code
class TypeTag:
    VARIANTS = []  # type: typing.Sequence[typing.Type[TypeTag]]

    def bcs_serialize(self) -> bytes:
        return bcs.serialize(self, TypeTag)

    @staticmethod
    def bcs_deserialize(input: bytes) -> "TypeTag":
        v, buffer = bcs.deserialize(input, TypeTag)
        if buffer:
            raise st.DeserializationError("Some input bytes were not read")
        return v

    CORE_CODE_ADDRESS: AccountAddress = AccountAddress.from_hex("00000000000000000000000000000001")

    @staticmethod
    def from_currency_code(code: str) -> "TypeTag":
        if isinstance(code, str):
            return TypeTag__Struct(
                value=StructTag(
                    address=TypeTag.CORE_CODE_ADDRESS,
                    module=Identifier(code),
                    name=Identifier(code),
                    type_params=[],
                )
            )

        raise TypeError(f"unknown currency code type: {code}")

    def to_currency_code(self) -> str:
        if isinstance(self, TypeTag__Struct):
            return self.value.name.value

        raise TypeError(f"unknown currency code type: {self}")

Subclasses

Class variables

var CORE_CODE_ADDRESSAccountAddress
var VARIANTS

Static methods

def bcs_deserialize(input: bytes) ‑> TypeTag
Expand source code
@staticmethod
def bcs_deserialize(input: bytes) -> "TypeTag":
    v, buffer = bcs.deserialize(input, TypeTag)
    if buffer:
        raise st.DeserializationError("Some input bytes were not read")
    return v
def from_currency_code(code: str) ‑> TypeTag
Expand source code
@staticmethod
def from_currency_code(code: str) -> "TypeTag":
    if isinstance(code, str):
        return TypeTag__Struct(
            value=StructTag(
                address=TypeTag.CORE_CODE_ADDRESS,
                module=Identifier(code),
                name=Identifier(code),
                type_params=[],
            )
        )

    raise TypeError(f"unknown currency code type: {code}")

Methods

def bcs_serialize(self) ‑> bytes
Expand source code
def bcs_serialize(self) -> bytes:
    return bcs.serialize(self, TypeTag)
def to_currency_code(self) ‑> str
Expand source code
def to_currency_code(self) -> str:
    if isinstance(self, TypeTag__Struct):
        return self.value.name.value

    raise TypeError(f"unknown currency code type: {self}")
class TypeTag__Address

TypeTag__Address()

Expand source code
@dataclass(frozen=True)
class TypeTag__Address(TypeTag):
    INDEX = 4  # type: int
    pass

Ancestors

Class variables

var CORE_CODE_ADDRESSAccountAddress
var INDEX
class TypeTag__Bool

TypeTag__Bool()

Expand source code
@dataclass(frozen=True)
class TypeTag__Bool(TypeTag):
    INDEX = 0  # type: int
    pass

Ancestors

Class variables

var CORE_CODE_ADDRESSAccountAddress
var INDEX
class TypeTag__Signer

TypeTag__Signer()

Expand source code
@dataclass(frozen=True)
class TypeTag__Signer(TypeTag):
    INDEX = 5  # type: int
    pass

Ancestors

Class variables

var CORE_CODE_ADDRESSAccountAddress
var INDEX
class TypeTag__Struct (value: StructTag)

TypeTag__Struct(value: 'StructTag')

Expand source code
@dataclass(frozen=True)
class TypeTag__Struct(TypeTag):
    INDEX = 7  # type: int
    value: "StructTag"

Ancestors

Class variables

var INDEX
var valueStructTag
class TypeTag__U128

TypeTag__U128()

Expand source code
@dataclass(frozen=True)
class TypeTag__U128(TypeTag):
    INDEX = 3  # type: int
    pass

Ancestors

Class variables

var CORE_CODE_ADDRESSAccountAddress
var INDEX
class TypeTag__U64

TypeTag__U64()

Expand source code
@dataclass(frozen=True)
class TypeTag__U64(TypeTag):
    INDEX = 2  # type: int
    pass

Ancestors

Class variables

var CORE_CODE_ADDRESSAccountAddress
var INDEX
class TypeTag__U8

TypeTag__U8()

Expand source code
@dataclass(frozen=True)
class TypeTag__U8(TypeTag):
    INDEX = 1  # type: int
    pass

Ancestors

Class variables

var CORE_CODE_ADDRESSAccountAddress
var INDEX
class TypeTag__Vector (value: TypeTag)

TypeTag__Vector(value: 'TypeTag')

Expand source code
@dataclass(frozen=True)
class TypeTag__Vector(TypeTag):
    INDEX = 6  # type: int
    value: "TypeTag"

Ancestors

Class variables

var INDEX
var valueTypeTag
class UnstructuredBytesMetadata (metadata: Optional[bytes])

UnstructuredBytesMetadata(metadata: Optional[bytes])

Expand source code
@dataclass(frozen=True)
class UnstructuredBytesMetadata:
    metadata: typing.Optional[bytes]

    def bcs_serialize(self) -> bytes:
        return bcs.serialize(self, UnstructuredBytesMetadata)

    @staticmethod
    def bcs_deserialize(input: bytes) -> "UnstructuredBytesMetadata":
        v, buffer = bcs.deserialize(input, UnstructuredBytesMetadata)
        if buffer:
            raise st.DeserializationError("Some input bytes were not read")
        return v

Class variables

var metadata : Optional[bytes]

Static methods

def bcs_deserialize(input: bytes) ‑> UnstructuredBytesMetadata
Expand source code
@staticmethod
def bcs_deserialize(input: bytes) -> "UnstructuredBytesMetadata":
    v, buffer = bcs.deserialize(input, UnstructuredBytesMetadata)
    if buffer:
        raise st.DeserializationError("Some input bytes were not read")
    return v

Methods

def bcs_serialize(self) ‑> bytes
Expand source code
def bcs_serialize(self) -> bytes:
    return bcs.serialize(self, UnstructuredBytesMetadata)
class WriteOp
Expand source code
class WriteOp:
    VARIANTS = []  # type: typing.Sequence[typing.Type[WriteOp]]

    def bcs_serialize(self) -> bytes:
        return bcs.serialize(self, WriteOp)

    @staticmethod
    def bcs_deserialize(input: bytes) -> "WriteOp":
        v, buffer = bcs.deserialize(input, WriteOp)
        if buffer:
            raise st.DeserializationError("Some input bytes were not read")
        return v

Subclasses

Class variables

var VARIANTS

Static methods

def bcs_deserialize(input: bytes) ‑> WriteOp
Expand source code
@staticmethod
def bcs_deserialize(input: bytes) -> "WriteOp":
    v, buffer = bcs.deserialize(input, WriteOp)
    if buffer:
        raise st.DeserializationError("Some input bytes were not read")
    return v

Methods

def bcs_serialize(self) ‑> bytes
Expand source code
def bcs_serialize(self) -> bytes:
    return bcs.serialize(self, WriteOp)
class WriteOp__Deletion

WriteOp__Deletion()

Expand source code
@dataclass(frozen=True)
class WriteOp__Deletion(WriteOp):
    INDEX = 0  # type: int
    pass

Ancestors

Class variables

var INDEX
class WriteOp__Value (value: bytes)

WriteOp__Value(value: bytes)

Expand source code
@dataclass(frozen=True)
class WriteOp__Value(WriteOp):
    INDEX = 1  # type: int
    value: bytes

Ancestors

Class variables

var INDEX
var value : bytes
class WriteSet (value: WriteSetMut)

WriteSet(value: 'WriteSetMut')

Expand source code
@dataclass(frozen=True)
class WriteSet:
    value: "WriteSetMut"

    def bcs_serialize(self) -> bytes:
        return bcs.serialize(self, WriteSet)

    @staticmethod
    def bcs_deserialize(input: bytes) -> "WriteSet":
        v, buffer = bcs.deserialize(input, WriteSet)
        if buffer:
            raise st.DeserializationError("Some input bytes were not read")
        return v

Class variables

var valueWriteSetMut

Static methods

def bcs_deserialize(input: bytes) ‑> WriteSet
Expand source code
@staticmethod
def bcs_deserialize(input: bytes) -> "WriteSet":
    v, buffer = bcs.deserialize(input, WriteSet)
    if buffer:
        raise st.DeserializationError("Some input bytes were not read")
    return v

Methods

def bcs_serialize(self) ‑> bytes
Expand source code
def bcs_serialize(self) -> bytes:
    return bcs.serialize(self, WriteSet)
class WriteSetMut (write_set: Sequence[Tuple[ForwardRef('AccessPath'), ForwardRef('WriteOp')]])

WriteSetMut(write_set: Sequence[Tuple[ForwardRef('AccessPath'), ForwardRef('WriteOp')]])

Expand source code
@dataclass(frozen=True)
class WriteSetMut:
    write_set: typing.Sequence[typing.Tuple["AccessPath", "WriteOp"]]

    def bcs_serialize(self) -> bytes:
        return bcs.serialize(self, WriteSetMut)

    @staticmethod
    def bcs_deserialize(input: bytes) -> "WriteSetMut":
        v, buffer = bcs.deserialize(input, WriteSetMut)
        if buffer:
            raise st.DeserializationError("Some input bytes were not read")
        return v

Class variables

var write_set : Sequence[Tuple[AccessPathWriteOp]]

Static methods

def bcs_deserialize(input: bytes) ‑> WriteSetMut
Expand source code
@staticmethod
def bcs_deserialize(input: bytes) -> "WriteSetMut":
    v, buffer = bcs.deserialize(input, WriteSetMut)
    if buffer:
        raise st.DeserializationError("Some input bytes were not read")
    return v

Methods

def bcs_serialize(self) ‑> bytes
Expand source code
def bcs_serialize(self) -> bytes:
    return bcs.serialize(self, WriteSetMut)
class WriteSetPayload
Expand source code
class WriteSetPayload:
    VARIANTS = []  # type: typing.Sequence[typing.Type[WriteSetPayload]]

    def bcs_serialize(self) -> bytes:
        return bcs.serialize(self, WriteSetPayload)

    @staticmethod
    def bcs_deserialize(input: bytes) -> "WriteSetPayload":
        v, buffer = bcs.deserialize(input, WriteSetPayload)
        if buffer:
            raise st.DeserializationError("Some input bytes were not read")
        return v

Subclasses

Class variables

var VARIANTS

Static methods

def bcs_deserialize(input: bytes) ‑> WriteSetPayload
Expand source code
@staticmethod
def bcs_deserialize(input: bytes) -> "WriteSetPayload":
    v, buffer = bcs.deserialize(input, WriteSetPayload)
    if buffer:
        raise st.DeserializationError("Some input bytes were not read")
    return v

Methods

def bcs_serialize(self) ‑> bytes
Expand source code
def bcs_serialize(self) -> bytes:
    return bcs.serialize(self, WriteSetPayload)
class WriteSetPayload__Direct (value: ChangeSet)

WriteSetPayload__Direct(value: 'ChangeSet')

Expand source code
@dataclass(frozen=True)
class WriteSetPayload__Direct(WriteSetPayload):
    INDEX = 0  # type: int
    value: "ChangeSet"

Ancestors

Class variables

var INDEX
var valueChangeSet
class WriteSetPayload__Script (execute_as: AccountAddress, script: Script)

WriteSetPayload__Script(execute_as: 'AccountAddress', script: 'Script')

Expand source code
@dataclass(frozen=True)
class WriteSetPayload__Script(WriteSetPayload):
    INDEX = 1  # type: int
    execute_as: "AccountAddress"
    script: "Script"

Ancestors

Class variables

var INDEX
var execute_asAccountAddress
var scriptScript