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

    Class AssetId

    AssetId identifies a specific asset.

    Asset ids are derived from the genesis transaction id plus the asset group index.

    AssetRef

    const assetId = AssetId.create('00'.repeat(32), 0)
    const encoded = assetId.toString()
    const decoded = AssetId.fromString(encoded)
    Index

    Properties

    groupIndex: number
    txid: Uint8Array

    Methods

    • Serialize the asset id to raw bytes.

      Returns Uint8Array

      Serialized asset id bytes

      fromBytes

    • Serialize the asset id into an existing binary writer.

      Parameters

      • writer: BufferWriter

        Writer to append the asset id to

      Returns void

      serialize

    • Validate the asset id fields.

      Returns void

      Error if the txid is empty or the group index is out of range

    • Create an asset id from a genesis transaction id and group index.

      Parameters

      • txid: string

        Hex-encoded genesis transaction id

      • groupIndex: number

        Asset group index within the genesis transaction

      Returns AssetId

      A validated asset id

      Error if the txid is missing, malformed, or not 32 bytes long

      fromString

    • Decode an asset id from its serialized bytes.

      Parameters

      • buf: Uint8Array

        Serialized asset id bytes

      Returns AssetId

      Decoded asset id

      Error if the buffer length is invalid

    • Decode an asset id from a binary reader.

      Parameters

      • reader: BufferReader

        Reader positioned at an asset id

      Returns AssetId

      Decoded asset id

      Error if the reader does not contain enough bytes

    • Decode an asset id from its hex string representation.

      Parameters

      • s: string

        Hex-encoded asset id

      Returns AssetId

      Decoded asset id

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

      toString