Skip to main content

StructTag

StructTag Objects​

class StructTag(StructTagProtocol)

Type information for a move struct

BCS

The BCS serialized form for this type is defined by the following ABNF:

struct-tag = address            ; address of the package
identifier ; name of the module
identifier ; name of the type
(vector type-tag) ; type parameters

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

coin_type_opt​

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

Returns the coin type part of a StructTag, if this is 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

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.

type_args​

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

Returns the type params part of a StructTag