Table of Contents

Class AssetPacketBuilder

Namespace
NArk.Core.Assets
Assembly
NArk.Core.dll

Builds an asset packet OP_RETURN TxOut from pre-mapped asset input/output tuples. Callers are responsible for mapping their own vin/vout indices (e.g. applying BIP322 +1 offset).

public static class AssetPacketBuilder
Inheritance
AssetPacketBuilder
Inherited Members

Methods

Build(IReadOnlyCollection<(string assetId, ushort vin, ulong amount)>, IReadOnlyCollection<(string assetId, ushort vout, ulong amount)>?, ushort)

Builds an asset packet OP_RETURN TxOut.

public static TxOut? Build(IReadOnlyCollection<(string assetId, ushort vin, ulong amount)> inputs, IReadOnlyCollection<(string assetId, ushort vout, ulong amount)>? outputs, ushort changeVout)

Parameters

inputs IReadOnlyCollection<(string assetId, ushort vin, ulong amount)>

Asset inputs: (assetId, vin, amount) — caller maps vin indices.

outputs IReadOnlyCollection<(string assetId, ushort vin, ulong amount)>

Explicit asset outputs: (assetId, vout, amount). Null means no explicit outputs.

changeVout ushort

Output index where unaccounted asset change is assigned.

Returns

TxOut

OP_RETURN TxOut, or null if no assets present.

BuildPacket(IReadOnlyCollection<(string assetId, ushort vin, ulong amount)>, IReadOnlyCollection<(string assetId, ushort vout, ulong amount)>?, ushort)

Builds the asset Packet itself (without wrapping it in an Extension/OP_RETURN), so callers can merge it with other IExtensionPacket records into a single Extension.

public static Packet? BuildPacket(IReadOnlyCollection<(string assetId, ushort vin, ulong amount)> inputs, IReadOnlyCollection<(string assetId, ushort vout, ulong amount)>? outputs, ushort changeVout)

Parameters

inputs IReadOnlyCollection<(string assetId, ushort vin, ulong amount)>
outputs IReadOnlyCollection<(string assetId, ushort vin, ulong amount)>
changeVout ushort

Returns

Packet

The asset packet, or null if no assets present.