navio-blsct
    Preparing search index...

    Class TokenId

    Represents a token ID. A token ID consists of two parameters: token and subid, both of which are optional. When omitted, default values are used instead of random values.

    Examples:

    const { TokenId } = require('navio-blsct')
    const tid1 = TokenId.default()
    const tid2 = TokenId.fromToken(123)
    const tid3 = TokenId.fromTokenAndSubid(123, 456)
    tid3.getToken() // 123
    tid3.getSubid() // 456
    tid3.equals(tid2) // false
    tid3.equals(tid3) // true
    ser = tid3.serialize()
    deser = TokenId.deserialize(ser)
    deser.serialize() === ser // true

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    obj: any
    objSize: number

    Methods

    • Checks if the current TokenId is equal to another TokenId.

      Parameters

      • other: TokenId

        The TokenId to compare with.

      Returns boolean

      true if both token and subid are equal, false otherwise.

    • Returns the subid number of the TokenId.

      Returns number

      The subid number of the TokenId.

    • Returns the token number of the TokenId.

      Returns number

      The token number of the TokenId.

    • Returns the underlying C++ object, transferring ownership from this instance to the caller.

      Returns any

      The underlying object of the instance.

    • Serializes the instance to a hexadecimal string.

      Returns string

      A hexadecimal string representation of the instance.

    • Returns the size of the underlying C++ object.

      Returns number

      The size of the underlying C++ object in bytes.

    • Returns a string representation of the instance.

      Returns string

      A string representation of the instance.

    • Generates a new default TokenId instance.

      Returns TokenId

      A new TokenId instance with default values for token and subid.

    • Deserializes a hexadecimal string into a TokenId instance.

      Parameters

      • this: new (obj: any) => TokenId
      • hex: string

        The hexadecimal string to convert.

      Returns TokenId

      The TokenId instance represented by the input string.

    • Constucts a new instance using the provided object.

      Type Parameters

      Parameters

      • this: new (obj: any, objSize?: number) => T
      • obj: any

        The object to use for the new instance.

      Returns T

      A new instance of the class.

    • Constructs a new instance using the provided object and size.

      Type Parameters

      Parameters

      • this: new (obj: any) => T
      • obj: any

        The object to use for the new instance.

      • objSize: number

        The size of the object.

      Returns T

      A new instance of the class.

    • Generates a TokenId from the provided token.

      Parameters

      • token: number

        The token number to use for the TokenId.

      Returns TokenId

      A new TokenId instance with the specified token and a default subid.

    • Generates a TokenId from the provided token and subid.

      Parameters

      • token: number

        The token number to use for the TokenId.

      • subid: number

        The subid number to use for the TokenId.

      Returns TokenId

      A new TokenId instance with the specified token and subid.