Skip to main content

StructTag

StructTag Objects​

class StructTag(StructTagProtocol)

Type information for a move struct

BCS

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

from_bcs​

@classmethod
def from_bcs(cls, bcs: bytes) -> StructTag

Create this type from BCS encoded bytes.

from_json​

@classmethod
def from_json(cls, json: str) -> StructTag

Create this type from a JSON encoded string.

new_dynamic_field​

@classmethod
def new_dynamic_field(cls, key: TypeTag, value: TypeTag) -> StructTag

Creates a new dynamic field struct tag (0x2::dynamic_field::Field<KeyType, ValueType>)

new_name​

@classmethod
def new_name(cls, address: Address) -> StructTag

Creates a new IOTA-Names Name struct tag with the given package address.

new_timelocked_gas_balance​

@classmethod
def new_timelocked_gas_balance(cls) -> StructTag

Creates a new timelocked IOTA balance struct tag (0x2::timelock::TimeLock<0x2::balance::Balance<0x2::iota::IOTA>>)

address​

def address() -> Address

Returns the address part of a StructTag

coin_type​

def coin_type() -> TypeTag

Returns the coin type part of a StructTag, panics if this is not a Coin type

is_dynamic_field​

def is_dynamic_field() -> bool

Checks if this is a Dynamic Field type (0x2::dynamic_field::Field<KeyType, ValueType>)

is_gas_balance​

def is_gas_balance() -> bool

Checks if this is an IOTA balance type (0x2::balance::Balance<0x2::iota::IOTA>)

is_name​

def is_name() -> bool

Checks if this is an IOTA-Names Name type. Note that this does not check the package address, so it will return true for any struct with the correct module and type name with no type params.

is_same_type_as​

def is_same_type_as(other: StructTag) -> bool

Returns whether the type (excluding the type params) is the same as another struct tag.

is_timelocked_balance​

def is_timelocked_balance() -> bool

Checks if this is a timelocked coin balance TimeLock<Balance<T>>

is_timelocked_gas_balance​

def is_timelocked_gas_balance() -> bool

Checks if this is a timelocked IOTA balance type (0x2::timelock::TimeLock<0x2::balance::Balance<0x2::iota::IOTA>>)

module​

def module() -> Identifier

Returns the module part of a StructTag

name​

def name() -> Identifier

Returns the name part of a StructTag

opt_coin_type​

def opt_coin_type() -> typing.Optional[TypeTag]

Returns the coin type part of a StructTag, if this is a Coin type

to_bcs​

def to_bcs() -> bytes

Convert this type to BCS encoded bytes.

to_canonical_string​

def to_canonical_string(with_prefix: bool) -> str

Returns the string representation of this struct tag using the canonical display, with or without a 0x prefix.

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.

type_args​

def type_args() -> typing.List[TypeTag]

Returns the type params part of a StructTag