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 for this type is defined by the following ABNF:

owner = owner-address / owner-object / owner-shared / owner-immutable

owner-address = %d00 address
owner-object = %d01 object-id
owner-shared = %d02 u64
owner-immutable = %d03

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