@arkade-os/sdk Documentation - v0.4.21
    Preparing search index...

    Class AssetRef

    Reference to either an explicit asset id or another asset group in the same packet.

    AssetId

    const refById = AssetRef.fromId(assetId)
    const refByGroup = AssetRef.fromGroupIndex(0)
    Index

    Properties

    ref: AssetRefByID | AssetRefByGroup

    Accessors

    Methods

    • Serialize the asset reference to raw bytes.

      Returns Uint8Array

      Serialized asset reference bytes

      fromBytes

    • Serialize the asset reference into an existing binary writer.

      Parameters

      • writer: BufferWriter

        Writer to append the asset reference to

      Returns void

      serialize

    • Encode the asset reference to a hex string.

      Returns string

      Hex-encoded asset reference

      fromString

    • Decode an asset reference from its serialized bytes.

      Parameters

      • buf: Uint8Array

        Serialized asset reference bytes

      Returns AssetRef

      Decoded asset reference

      Error if the buffer is empty or malformed

    • Create an asset reference that points to another asset group by index.

      Parameters

      • groupIndex: number

        Zero-based asset group index in the packet

      Returns AssetRef

      Asset reference by group index

      fromId

    • Decode an asset reference from a binary reader.

      Parameters

      • reader: BufferReader

        Reader positioned at an asset reference

      Returns AssetRef

      Decoded asset reference

      Error if the type is unknown or the reader does not contain enough bytes

    • Decode an asset reference from its hex string form.

      Parameters

      • s: string

        Hex-encoded asset reference

      Returns AssetRef

      Decoded asset reference

      Error if the string is not valid hex or does not encode a valid asset reference

      toString