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

    Class AssetGroup

    An asset group contains inputs, outputs, and all data related to a given asset id.

    • Packet
    • AssetId
    • AssetRef
    const group = AssetGroup.create(
    null, // asset ID: null for new issuance
    null, // control asset ID: null when reissuance not needed
    [], // asset inputs: empty for new issuance
    [AssetOutput.create(0, 1000)], // asset outputs: 1000 units at vout index 0
    [] // metadata: can be empty
    )
    Index

    Constructors

    Properties

    assetId: AssetId | null
    controlAsset: AssetRef | null
    inputs: AssetInput[]
    outputs: AssetOutput[]

    Methods

    • Return true when the group represents an issuance.

      Returns boolean

      true when the group has no asset id

    • Return true when the group represents a reissuance.

      Returns boolean

      true when the group has an asset id and outputs exceed local inputs

      Only local inputs contribute to the comparison; intent-backed inputs contribute 0 here.

    • Serialize the asset group to raw bytes.

      Returns Uint8Array

      Serialized asset group bytes

      fromBytes

    • Serialize the asset group into an existing binary writer.

      Parameters

      • writer: BufferWriter

        Writer to append the asset group to

      Returns void

    • Convert the group into its batch-leaf representation for the given intent txid.

      Parameters

      • intentTxid: Uint8Array

        Intent transaction id used to build the leaf input reference

      Returns AssetGroup

      Batch-leaf asset group

      AssetInput.createIntent

    • Validate the asset group and its child structures.

      Returns void

      Error if the group is empty or violates issuance invariants

    • Decode an asset group from its serialized bytes.

      Parameters

      • buf: Uint8Array

        Serialized asset group bytes

      Returns AssetGroup

      Decoded asset group

      Error if the buffer is empty or malformed

    • Decode an asset group from a binary reader.

      Parameters

      • reader: BufferReader

        Reader positioned at an asset group

      Returns AssetGroup

      Decoded asset group

      Error if the encoded group is malformed

    • Decode an asset group from its hex string form.

      Parameters

      • s: string

        Hex-encoded asset group

      Returns AssetGroup

      Decoded asset group

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

      toString