Table of Contents

Class ArkContractParser

Namespace
NArk.Core.Contracts
Assembly
NArk.Core.dll
public class ArkContractParser
Inheritance
ArkContractParser
Inherited Members

Methods

Parse(string, Network)

public static ArkContract? Parse(string contract, Network network)

Parameters

contract string
network Network

Returns

ArkContract

Parse(string, Dictionary<string, string>, Network)

public static ArkContract? Parse(string type, Dictionary<string, string> contractData, Network network)

Parameters

type string
contractData Dictionary<string, string>
network Network

Returns

ArkContract

Register(IArkContractParser)

Teaches the parser a contract type defined outside this assembly.

public static void Register(IArkContractParser parser)

Parameters

parser IArkContractParser

Parser for the new type; replaces any parser already claiming it.

Remarks

Without this, a package that adds a contract type can persist it and never read it back: storage records the type name happily, and every later lookup fails to parse. The failure lands nowhere near the cause — as a sweeper that cannot see its own VTXOs, or a coin that cannot be signed — so the type is registered where it is defined rather than being invisibly absent here.

Replacing rather than appending on a repeated type keeps registration idempotent, which matters because DI extension methods are called more than once in tests and in hosts that build several service providers.

Register(string, Func<Dictionary<string, string>, Network, ArkContract?>)

Registers a parser for type from a parse delegate.

public static void Register(string type, Func<Dictionary<string, string>, Network, ArkContract?> parse)

Parameters

type string

The contract type name as persisted.

parse Func<Dictionary<string, string>, Network, ArkContract>

Rebuilds the contract from its stored data.