Skip to main content

StructTag

StructTag

class StructTag

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

init(address:module:name:typeParams:)

convenience init(address: Address, module: Identifier, name: Identifier, typeParams: [TypeTag] = [])

debugDescription

var debugDescription: String { get }

A textual representation of this instance, suitable for debugging.

Calling this property directly is discouraged. Instead, convert an instance of any type to a string by using the String(reflecting:) initializer. This initializer works with any type, and uses the custom debugDescription property for types that conform to CustomDebugStringConvertible:

struct Point: CustomDebugStringConvertible {
let x: Int, y: Int

var debugDescription: String {
return "(\(x), \(y))"
}
}

let p = Point(x: 21, y: 30)
let s = String(reflecting: p)
print(s)
// Prints "(21, 30)"

The conversion of p to a string in the assignment to s uses the Point type's debugDescription property.

description

var description: String { get }

A textual representation of this instance.

Calling this property directly is discouraged. Instead, convert an instance of any type to a string by using the String(describing:) initializer. This initializer works with any type, and uses the custom description property for types that conform to CustomStringConvertible:

struct Point: CustomStringConvertible {
let x: Int, y: Int

var description: String {
return "(\(x), \(y))"
}
}

let p = Point(x: 21, y: 30)
let s = String(describing: p)
print(s)
// Prints "(21, 30)"

The conversion of p to a string in the assignment to s uses the Point type's description property.

address()

func address() -> Address

Returns the address part of a StructTag

coinType()

func coinType() -> TypeTag

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

coinTypeOpt()

func coinTypeOpt() -> TypeTag?

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

hash(into:)

func hash(into hasher: inout Hasher)

Hashes the essential components of this value by feeding them into the given hasher.

Implement this method to conform to the Hashable protocol. The components used for hashing must be the same as the components compared in your type's == operator implementation. Call hasher.combine(_:) with each of these components.

  • Important: In your implementation of hash(into:), don't call finalize() on the hasher instance provided, or replace it with a different instance. Doing so may become a compile-time error in the future.

  • Parameter hasher: The hasher to use when combining the components of this instance.

isAlias()

func isAlias() -> Bool

isAliasOutput()

func isAliasOutput() -> Bool

isAsciiString()

func isAsciiString() -> Bool

isAuthenticatorFunctionRefV1Key()

func isAuthenticatorFunctionRefV1Key() -> Bool

isBag()

func isBag() -> Bool

isBalance()

func isBalance() -> Bool

isBasicOutput()

func isBasicOutput() -> Bool

isClock()

func isClock() -> Bool

isCoin()

func isCoin() -> Bool

isCoinManager()

func isCoinManager() -> Bool

isCoinMetadata()

func isCoinMetadata() -> Bool

isConfig()

func isConfig() -> Bool

isConfigSetting()

func isConfigSetting() -> Bool

isDenyCapV1()

func isDenyCapV1() -> Bool

isDenyListAddressKey()

func isDenyListAddressKey() -> Bool

isDenyListConfigKey()

func isDenyListConfigKey() -> Bool

isDenyListGlobalPauseKey()

func isDenyListGlobalPauseKey() -> Bool

isDisplayCreated()

func isDisplayCreated() -> Bool

isDisplayVersionUpdated()

func isDisplayVersionUpdated() -> Bool

isDynamicField()

func isDynamicField() -> Bool

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

isDynamicObjectFieldWrapper()

func isDynamicObjectFieldWrapper() -> Bool

isGas()

func isGas() -> Bool

isGasBalance()

func isGasBalance() -> Bool

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

isGasCoin()

func isGasCoin() -> Bool

isId()

func isId() -> Bool

isIotaSystemAdminCap()

func isIotaSystemAdminCap() -> Bool

isIotaSystemState()

func isIotaSystemState() -> Bool

isIotaTreasuryCap()

func isIotaTreasuryCap() -> Bool

isIrc27Metadata()

func isIrc27Metadata() -> Bool

isKiosk()

func isKiosk() -> Bool

isKioskOwnerCap()

func isKioskOwnerCap() -> Bool

isName()

func isName() -> 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.

isNft()

func isNft() -> Bool

isNftOutput()

func isNftOutput() -> Bool

isObjectBag()

func isObjectBag() -> Bool

isOption()

func isOption() -> Bool

isPackageMetadataKey()

func isPackageMetadataKey() -> Bool

isPublisher()

func isPublisher() -> Bool

isRandom()

func isRandom() -> Bool

isRegulatedCoinMetadata()

func isRegulatedCoinMetadata() -> Bool

isSameTypeAs(other:)

func isSameTypeAs(other: StructTag) -> Bool

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

isStakedIota()

func isStakedIota() -> Bool

isString()

func isString() -> Bool

isSystemEpochInfoEvent()

func isSystemEpochInfoEvent() -> Bool

isTimeLock()

func isTimeLock() -> Bool

isTimelockedBalance()

func isTimelockedBalance() -> Bool

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

isTimelockedGasBalance()

func isTimelockedGasBalance() -> Bool

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

isTimelockedStakedIota()

func isTimelockedStakedIota() -> Bool

isTransferReceiving()

func isTransferReceiving() -> Bool

isTreasuryCap()

func isTreasuryCap() -> Bool

isTxContext()

func isTxContext() -> Bool

isUid()

func isUid() -> Bool

isUpgradeCap()

func isUpgradeCap() -> Bool

isUpgradeReceipt()

func isUpgradeReceipt() -> Bool

isUpgradeTicket()

func isUpgradeTicket() -> Bool

isUrl()

func isUrl() -> Bool

module()

func module() -> Identifier

Returns the module part of a StructTag

name()

func name() -> Identifier

Returns the name part of a StructTag

toCanonicalString(withPrefix:)

func toCanonicalString(withPrefix: Bool) -> String

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

typeArgs()

func typeArgs() -> [TypeTag]

Returns the type params part of a StructTag

newAlias()

static func newAlias() -> StructTag

newAliasOutput(typeTag:)

static func newAliasOutput(typeTag: TypeTag) -> StructTag

newAsciiString()

static func newAsciiString() -> StructTag

newAuthenticatorFunctionRefV1Key()

static func newAuthenticatorFunctionRefV1Key() -> StructTag

newBag()

static func newBag() -> StructTag

newBalance(typeTag:)

static func newBalance(typeTag: TypeTag) -> StructTag

newBasicOutput(typeTag:)

static func newBasicOutput(typeTag: TypeTag) -> StructTag

newClock()

static func newClock() -> StructTag

newCoin(typeTag:)

static func newCoin(typeTag: TypeTag) -> StructTag

newCoinManager(structTag:)

static func newCoinManager(structTag: StructTag) -> StructTag

newCoinMetadata(structTag:)

static func newCoinMetadata(structTag: StructTag) -> StructTag

newConfig(typeTag:)

static func newConfig(typeTag: TypeTag) -> StructTag

newConfigSetting(typeTag:)

static func newConfigSetting(typeTag: TypeTag) -> StructTag

newDenyCapV1(typeTag:)

static func newDenyCapV1(typeTag: TypeTag) -> StructTag

newDenyListAddressKey()

static func newDenyListAddressKey() -> StructTag

newDenyListConfigKey()

static func newDenyListConfigKey() -> StructTag

newDenyListGlobalPauseKey()

static func newDenyListGlobalPauseKey() -> StructTag

newDisplayCreated(structTag:)

static func newDisplayCreated(structTag: StructTag) -> StructTag

newDisplayVersionUpdated(structTag:)

static func newDisplayVersionUpdated(structTag: StructTag) -> StructTag

newDynamicField(key:value:)

static func newDynamicField(key: TypeTag, value: TypeTag) -> StructTag

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

newDynamicObjectFieldWrapper(typeTag:)

static func newDynamicObjectFieldWrapper(typeTag: TypeTag) -> StructTag

newGas()

static func newGas() -> StructTag

newGasCoin()

static func newGasCoin() -> StructTag

newId()

static func newId() -> StructTag

newIotaSystemAdminCap()

static func newIotaSystemAdminCap() -> StructTag

newIotaSystemState()

static func newIotaSystemState() -> StructTag

newIotaTreasuryCap()

static func newIotaTreasuryCap() -> StructTag

newIrc27Metadata()

static func newIrc27Metadata() -> StructTag

newKiosk()

static func newKiosk() -> StructTag

newKioskOwnerCap()

static func newKioskOwnerCap() -> StructTag

newName(address:)

static func newName(address: Address) -> StructTag

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

newNft()

static func newNft() -> StructTag

newNftOutput(typeTag:)

static func newNftOutput(typeTag: TypeTag) -> StructTag

newObjectBag()

static func newObjectBag() -> StructTag

newOption(typeTag:)

static func newOption(typeTag: TypeTag) -> StructTag

newPackageMetadataKey()

static func newPackageMetadataKey() -> StructTag

newPublisher()

static func newPublisher() -> StructTag

newRandom()

static func newRandom() -> StructTag

newRegulatedCoinMetadata(typeTag:)

static func newRegulatedCoinMetadata(typeTag: TypeTag) -> StructTag

newStakedIota()

static func newStakedIota() -> StructTag

newString()

static func newString() -> StructTag

newSystemEpochInfoEvent()

static func newSystemEpochInfoEvent() -> StructTag

newTimeLock(typeTag:)

static func newTimeLock(typeTag: TypeTag) -> StructTag

newTimelockedGasBalance()

static func newTimelockedGasBalance() -> StructTag

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

newTimelockedStakedIota()

static func newTimelockedStakedIota() -> StructTag

newTransferReceiving(typeTag:)

static func newTransferReceiving(typeTag: TypeTag) -> StructTag

newTreasuryCap(structTag:)

static func newTreasuryCap(structTag: StructTag) -> StructTag

newTxContext()

static func newTxContext() -> StructTag

newUid()

static func newUid() -> StructTag

newUpgradeCap()

static func newUpgradeCap() -> StructTag

newUpgradeReceipt()

static func newUpgradeReceipt() -> StructTag

newUpgradeTicket()

static func newUpgradeTicket() -> StructTag

newUrl()

static func newUrl() -> StructTag

!=(_:_:)

static func != (lhs: Self, rhs: Self) -> Bool

Returns a Boolean value indicating whether two values are not equal.

Inequality is the inverse of equality. For any values a and b, a != b implies that a == b is false.

This is the default implementation of the not-equal-to operator (!=) for any type that conforms to Equatable.

  • Parameters:
    • lhs: A value to compare.
    • rhs: Another value to compare.

==(_:_:)

static func == (self: StructTag, other: StructTag) -> Bool

Returns a Boolean value indicating whether two values are equal.

Equality is the inverse of inequality. For any values a and b, a == b implies that a != b is false.

  • Parameters:
    • lhs: A value to compare.
    • rhs: Another value to compare.