Class ArkContractParser
public class ArkContractParser
- Inheritance
-
ArkContractParser
- Inherited Members
Methods
Parse(string, Network)
public static ArkContract? Parse(string contract, Network network)
Parameters
contractstringnetworkNetwork
Returns
Parse(string, Dictionary<string, string>, Network)
public static ArkContract? Parse(string type, Dictionary<string, string> contractData, Network network)
Parameters
typestringcontractDataDictionary<string, string>networkNetwork
Returns
Register(IArkContractParser)
Teaches the parser a contract type defined outside this assembly.
public static void Register(IArkContractParser parser)
Parameters
parserIArkContractParserParser 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
typestringThe contract type name as persisted.
parseFunc<Dictionary<string, string>, Network, ArkContract>Rebuilds the contract from its stored data.