Struct AsmToken
One entry in an TapscriptSegment/ArkadeScriptSegment's
Asm/Witness/Signers list — mirrors the ts-sdk's AsmToken/
WitnessRef/SignerRef unions (string | number | bigint | Uint8Array).
public readonly struct AsmToken : IEquatable<AsmToken>
- Implements
- Inherited Members
Remarks
A pure data holder with value semantics: it does not resolve $param placeholders,
look up opcodes, or encode anything. Resolution happens later, once constructor args
(and, for witness tokens, call args) are known. The implicit conversions let callers write
asm/witness lists as bare literals (["HASH160", "$hash", 42]) instead of factory calls.
Properties
Bytes
public byte[]? Bytes { get; }
Property Value
- byte[]
IsParam
True when this is a \(param</code> placeholder (a <xref href="NArk.Arkade.Program.Models.AsmToken.Text" data-throw-if-not-resolved="false"></xref> token starting with <code>\)).
public bool IsParam { get; }
Property Value
Kind
public AsmTokenKind Kind { get; }
Property Value
Number
public BigInteger? Number { get; }
Property Value
ParamName
The parameter name for a IsParam token (without the $ prefix).
public string ParamName { get; }
Property Value
Text
public string? Text { get; }
Property Value
Methods
Equals(AsmToken)
Value equality: same Kind and payload. Text compares ordinally (opcode/param/ signer names are case-sensitive, matching how they resolve), bytes compare by content.
public bool Equals(AsmToken other)
Parameters
otherAsmToken
Returns
Equals(object?)
Indicates whether this instance and a specified object are equal.
public override bool Equals(object? obj)
Parameters
objobjectThe object to compare with the current instance.
Returns
- bool
true if
objand this instance are the same type and represent the same value; otherwise, false.
FromBytes(byte[])
Wrap raw bytes.
public static AsmToken FromBytes(byte[] bytes)
Parameters
bytesbyte[]
Returns
FromNumber(BigInteger)
Wrap a numeric literal.
public static AsmToken FromNumber(BigInteger number)
Parameters
numberBigInteger
Returns
FromText(string)
Wrap an opcode mnemonic, $param placeholder, or signer keyword.
public static AsmToken FromText(string text)
Parameters
textstring
Returns
GetHashCode()
Returns the hash code for this instance.
public override int GetHashCode()
Returns
- int
A 32-bit signed integer that is the hash code for this instance.
Operators
operator ==(AsmToken, AsmToken)
Value equality — see Equals(AsmToken).
public static bool operator ==(AsmToken left, AsmToken right)
Parameters
Returns
implicit operator AsmToken(byte[])
Implicitly wrap raw bytes — see FromBytes(byte[]).
public static implicit operator AsmToken(byte[] bytes)
Parameters
bytesbyte[]
Returns
implicit operator AsmToken(long)
Implicitly wrap an integer literal (also covers int via widening) — see FromNumber(BigInteger).
public static implicit operator AsmToken(long number)
Parameters
numberlong
Returns
implicit operator AsmToken(BigInteger)
Implicitly wrap an arbitrary-precision integer — see FromNumber(BigInteger).
public static implicit operator AsmToken(BigInteger number)
Parameters
numberBigInteger
Returns
implicit operator AsmToken(string)
Implicitly wrap an opcode mnemonic / $param / signer keyword — see FromText(string).
public static implicit operator AsmToken(string text)
Parameters
textstring
Returns
operator !=(AsmToken, AsmToken)
Value inequality — see Equals(AsmToken).
public static bool operator !=(AsmToken left, AsmToken right)