Skip to main content

OwnerProtocol

OwnerProtocol Objects​

class OwnerProtocol(typing.Protocol)

Enum of different types of ownership for an object.

BCS

The BCS serialized form of this type is specified in bcs-schema.abnf.

address_or_object​

def address_or_object() -> typing.Optional[Address]

Returns an Address if this object is owned by an address or object, and None if it is shared or immutable.

as_address​

def as_address() -> Address

Convert this owner into an address owner if it is one, or panic otherwise

as_object​

def as_object() -> ObjectId

Convert this owner into an object owner if it is one, or panic otherwise

as_opt_address​

def as_opt_address() -> typing.Optional[Address]

Convert this owner into an address owner if it is one, or return None otherwise

as_opt_object​

def as_opt_object() -> typing.Optional[ObjectId]

Convert this owner into an object owner if it is one, or return None otherwise

as_opt_shared​

def as_opt_shared() -> typing.Optional[Version]

Convert this owner into a shared owner if it is one, or return None otherwise

as_shared​

def as_shared() -> Version

Convert this owner into a shared owner if it is one, or panic otherwise

is_address​

def is_address() -> bool

Check if this is an address owner

is_immutable​

def is_immutable() -> bool

Check if this is an immutable owner

is_object​

def is_object() -> bool

Check if this is an object owner

is_shared​

def is_shared() -> bool

Check if this is a shared owner

to_bcs​

def to_bcs() -> bytes

Convert this type to BCS encoded bytes.

to_display_string​

def to_display_string() -> str

Render this type as human-readable text.

Some types also print this through the binding's native string conversion; this method is the spelling every object type has.

The layout is meant for reading and can change between releases. Use the JSON or BCS conversions for output that gets parsed.

to_json​

def to_json() -> str

Convert this type to a JSON encoded string.