Class ArkProgramContract
An ArkContract whose spending paths come from a compiled ArkadeProgram rather than a hardcoded script shape. Compiles once at construction; GetScriptBuilders() hands the compiled leaves to the base class, which assembles them into a taproot tree exactly like every other contract (GetTaprootSpendInfo()).
public sealed class ArkProgramContract : ArkContract
- Inheritance
-
ArkProgramContract
- Inherited Members
Constructors
ArkProgramContract(OutputDescriptor, ArkadeProgram, IReadOnlyDictionary<string, AsmToken>, OutputDescriptor?, ECXOnlyPubKey?)
Compiles an Arkade program into a spendable contract.
public ArkProgramContract(OutputDescriptor server, ArkadeProgram program, IReadOnlyDictionary<string, AsmToken> args, OutputDescriptor? user = null, ECXOnlyPubKey? emulatorKey = null)
Parameters
serverOutputDescriptorOutput descriptor for the Arkade server's key, bound as
$server.programArkadeProgramThe parsed program artifact to compile.
argsIReadOnlyDictionary<string, AsmToken>Values for the program's declared params, by name.
userOutputDescriptorOptional descriptor for the wallet's own key, bound as
$userwhen the program declares it.emulatorKeyECXOnlyPubKeyOptional emulator signer key; required for functions carrying an ArkadeScript, since the emulator's per-script tweaked key becomes a required signer on that leaf.
Fields
ContractType
The contract type discriminator used in Type and persistence.
public const string ContractType = "ArkadeProgram"
Field Value
Properties
Args
Args this program was compiled against.
public IReadOnlyDictionary<string, AsmToken> Args { get; }
Property Value
CompiledFunctions
All compiled spending paths, in declaration order.
public IReadOnlyList<CompiledArkadeFunction> CompiledFunctions { get; }
Property Value
DefaultScope
The layer this contract type's funds live on by default (on-chain vs off-chain). Abstract so every contract type makes an explicit, compile-time scope decision. Used as the fallback when ToEntity(string, OutputDescriptor?, DateTimeOffset?, ContractActivityState, ContractScope?) is called without a scope override.
public override ContractScope DefaultScope { get; }
Property Value
Type
Contract type discriminator string (e.g. "vtxo", "boarding").
public override string Type { get; }
Property Value
User
Output descriptor for the wallet's own key, bound as the $user param when the program declares it.
public OutputDescriptor? User { get; }
Property Value
Methods
FunctionByName(string)
The compiled spending path with the given function name, if any.
public CompiledArkadeFunction? FunctionByName(string name)
Parameters
namestringThe function name as declared in the program artifact.
Returns
- CompiledArkadeFunction
The compiled function, or
nullwhen the program declares no such function.
GetContractData()
Returns the key-value map of contract parameters used for serialization.
protected override Dictionary<string, string> GetContractData()
Returns
GetScriptBuilders()
Returns the script builders for each tapscript leaf in the tree.
protected override IEnumerable<ScriptBuilder> GetScriptBuilders()
Returns
Parse(Dictionary<string, string>, Network)
Rebuilds a contract from persisted GetContractData() output.
public static ArkProgramContract Parse(Dictionary<string, string> contractData, Network network)
Parameters
contractDataDictionary<string, string>The persisted key/value data produced by
GetContractData.networkNetworkThe network to parse descriptors and keys against.
Returns
- ArkProgramContract
The rebuilt contract, compiled against the persisted program and args.