Type alias CompilerConfiguration<CompilationContext, CompilerKeyOperations, CompilerSigningSerializationOperations, CompilerAddressDataOperations, CompilerWalletDataOperations, CompilerCurrentBlockHeightOperations, CompilerCurrentBlockTimeOperations>

CompilerConfiguration<CompilationContext, CompilerKeyOperations, CompilerSigningSerializationOperations, CompilerAddressDataOperations, CompilerWalletDataOperations, CompilerCurrentBlockHeightOperations, CompilerCurrentBlockTimeOperations>: {
    createAuthenticationProgram?: ((evaluationBytecode) => any);
    entityOwnership?: {
        [variableId: string]: string;
    };
    lockingScriptTypes?: {
        [lockingScriptId: string]: "p2sh20" | "p2sh32" | "standard";
    };
    opcodes?: {
        [opcodeIdentifier: string]: Uint8Array;
    };
    operations?: {
        addressData?: CompilerAddressDataOperations extends string
            ? {
                [operationId in CompilerAddressDataOperations]?: CompilerOperation<CompilationContext>
            }
            : CompilerOperation<CompilationContext>;
        currentBlockHeight?: CompilerCurrentBlockHeightOperations extends string
            ? {
                [operationId in CompilerCurrentBlockHeightOperations]?: CompilerOperation<CompilationContext>
            }
            : CompilerOperation<CompilationContext>;
        currentBlockTime?: CompilerCurrentBlockTimeOperations extends string
            ? {
                [operationId in CompilerCurrentBlockTimeOperations]?: CompilerOperation<CompilationContext>
            }
            : CompilerOperation<CompilationContext>;
        hdKey?: CompilerKeyOperations extends string
            ? {
                [operationId in CompilerKeyOperations]?: CompilerOperation<CompilationContext>
            }
            : CompilerOperation<CompilationContext>;
        key?: CompilerKeyOperations extends string
            ? {
                [operationId in CompilerKeyOperations]?: CompilerOperation<CompilationContext>
            }
            : CompilerOperation<CompilationContext>;
        signingSerialization?: CompilerSigningSerializationOperations extends string
            ? {
                [operationId in CompilerSigningSerializationOperations]?: CompilerOperation<CompilationContext>
            }
            : CompilerOperation<CompilationContext>;
        walletData?: CompilerWalletDataOperations extends string
            ? {
                [operationId in CompilerWalletDataOperations]?: CompilerOperation<CompilationContext>
            }
            : CompilerOperation<CompilationContext>;
    };
    ripemd160?: {
        hash: Ripemd160["hash"];
    };
    scenarios?: {
        [scriptId: string]: WalletTemplateScenario;
    };
    scripts: {
        [scriptId: string]: string;
    };
    secp256k1?: {
        addTweakPrivateKey: Secp256k1["addTweakPrivateKey"];
        addTweakPublicKeyCompressed: Secp256k1["addTweakPublicKeyCompressed"];
        derivePublicKeyCompressed: Secp256k1["derivePublicKeyCompressed"];
        signMessageHashDER: Secp256k1["signMessageHashDER"];
        signMessageHashSchnorr: Secp256k1["signMessageHashSchnorr"];
        validatePublicKey: Secp256k1["validatePublicKey"];
    };
    sha256?: {
        hash: Sha256["hash"];
    };
    sha512?: {
        hash: Sha512["hash"];
    };
    sourceScriptIds?: string[];
    unlockingScriptTimeLockTypes?: {
        [unlockingScriptId: string]: "height" | "timestamp";
    };
    unlockingScripts?: {
        [unlockingScriptId: string]: string;
    };
    variables?: {
        [variableId: string]: WalletTemplateVariable;
    };
    vm?: AuthenticationVirtualMachine<any, any, any>;
}

The full context required to compile a given CashAssembly Template script – everything required for the compiler to understand the CompilationData and generate the compiled bytecode (targeting a specific AuthenticationVirtualMachine).

Type Parameters

  • CompilationContext = unknown

    additional data available to compiler operations, e.g. transaction signing serialization components

  • CompilerKeyOperations extends string | false = CompilerOperationsKeysCommon

    a list of valid compiler operations for Key and HdKey variables, e.g. 'public_key' | 'signature', or false if only a single compiler operation is used for all instances

  • CompilerSigningSerializationOperations extends string | false = CompilerOperationsSigningSerializationCommon

    a list of valid compiler operations for Key and HdKey variables, e.g. "version" | "transaction_outpoints" | ..., or false if only a single compiler operation is used for all signing_serialization instances

  • CompilerAddressDataOperations extends string | false = false

    a list of valid compiler operations for AddressData variables or false if only a single compiler operation is used for all AddressData instances (default: false)

  • CompilerWalletDataOperations extends string | false = false

    a list of valid compiler operations for WalletData variables or false if only a single compiler operation is used for all WalletData instances (default: false)

  • CompilerCurrentBlockHeightOperations extends string | false = false

    a list of valid compiler operations for current_block_height variables or false if only a single compiler operation is used for all instances (default: false)

  • CompilerCurrentBlockTimeOperations extends string | false = false

    a list of valid compiler operations for current_block_time variables or false if only a single compiler operation is used for all instances (default: false)

Type declaration

Remarks

A CompilerConfiguration must include a subset of the script's WalletTemplate – all the variables and scripts referenced (including children of children) by the script in question.

The context must also include an object mapping of opcode identifiers to the bytecode they generate.

If keys are used, an implementation of sha256 and secp256k1 is required. If the script requires evaluations during compilation, the evaluating AuthenticationVirtualMachine must also be included.

Generated using TypeDoc