import type { AnyCompilerConfigurationIgnoreOperations, CompilationContextBCH, CompilationData, CompilationResult, Output, Scenario, ScenarioGenerationDebuggingResult, WalletTemplateScenario, WalletTemplateScenarioBytecode, WalletTemplateScenarioData, WalletTemplateScenarioOutput } from '../lib.js'; /** * The contents of an {@link WalletTemplateScenario} without the `name` * and `description`. */ export type ScenarioDefinition = Pick; type RequiredTwoLevels = { [P in keyof T]-?: Required; }; /** * A scenario definition produced when a child scenario `extends` a parent * scenario; this "extended" scenario definition is the same as the parent * scenario definition, but any properties defined in the child scenario * definition replace those found in the parent scenario definition. * * All scenarios extend the default scenario, so the `data`, `transaction` (and * all `transaction` properties), and `sourceOutputs` properties are guaranteed * to be defined in any extended scenario definition. */ export type ExtendedScenarioDefinition = Required> & Required> & RequiredTwoLevels>; /** * Given a compiler configuration, generate the default scenario that is * extended by all the configuration's scenarios. * * For details on default scenario generation, see * {@link WalletTemplateScenario.extends}. * * @param configuration - the compiler configuration from which to generate the * default scenario */ export declare const generateDefaultScenarioDefinition: , CompilationContext>(configuration: Configuration) => ExtendedScenarioDefinition | string; /** * Extend the `data` property of a scenario definition with values from a parent * scenario definition. Returns the extended value for `data`. * * @param parentData - the scenario `data` that is extended by the child * scenario * @param childData - the scenario `data` that may override values from the * parent scenario */ export declare const extendScenarioDefinitionData: (parentData: NonNullable, childData: NonNullable) => { keys?: { privateKeys?: { [variableId: string]: string; } | undefined; } | undefined; hdKeys?: { addressIndex?: number | undefined; hdPublicKeys?: { [entityId: string]: string; } | undefined; hdPrivateKeys?: { [entityId: string]: string; } | undefined; } | undefined; bytecode?: { [fullIdentifier: string]: string; } | undefined; currentBlockHeight?: number | undefined; currentBlockTime?: number | undefined; }; /** * Extend a child scenario definition with values from a parent scenario * definition. Returns the extended values for `data`, `transaction`, and * `value`. * * @param parentScenario - the scenario that is extended by the child scenario * @param childScenario - the scenario that may override values from the parent * scenario */ export declare const extendScenarioDefinition: (parentScenario: ParentScenarioType, childScenario: WalletTemplateScenario) => ParentScenarioType extends ExtendedScenarioDefinition ? ExtendedScenarioDefinition : ScenarioDefinition; /** * Generate the full scenario that is extended by the provided scenario * identifier. Scenarios for which `extends` is `undefined` extend the default * scenario for the provided compiler configuration. */ export declare const generateExtendedScenario: , CompilationContext>({ configuration, scenarioId, sourceScenarioIds, }: { /** * The compiler configuration from which to generate the extended scenario */ configuration: Configuration; /** * The identifier of the scenario from which to generate the extended scenario */ scenarioId?: string | undefined; /** * an array of scenario identifiers indicating the path taken to arrive at the * current scenario - used to detect and prevent cycles in extending scenarios * (defaults to `[]`) */ sourceScenarioIds?: string[] | undefined; }) => ExtendedScenarioDefinition | string; /** * Derive standard {@link CompilationData} properties from an extended scenario * definition. * * @param definition - a scenario definition that has been extended by the * default scenario definition */ export declare const extendedScenarioDefinitionToCompilationData: (definition: Required> & ScenarioDefinition) => CompilationData; /** * Extend a {@link CompilationData} object with the compiled result of the * bytecode scripts provided by an {@link WalletTemplateScenarioData}. */ export declare const extendCompilationDataWithScenarioBytecode: , CompilationContext>({ compilationData, configuration, scenarioDataBytecodeScripts, }: { /** * The compilation data to extend. */ compilationData: CompilationData; /** * The compiler configuration in which to compile the scripts. */ configuration: Configuration; /** * The {@link WalletTemplateScenarioData.bytecode} property. */ scenarioDataBytecodeScripts: NonNullable; }) => string | CompilationData; /** * Compile a {@link WalletTemplateScenarioOutput.valueSatoshis}, * returning the `Uint8Array` result. */ export declare const compileWalletTemplateScenarioValueSatoshis: (valueSatoshisDefinition?: WalletTemplateScenarioOutput['valueSatoshis']) => bigint; /** * Compile an {@link WalletTemplateScenarioBytecode} definition for an * {@link WalletTemplateScenario}, returning either a * simple `Uint8Array` result or a full CashAssembly {@link CompilationResult}. */ export declare const compileWalletTemplateScenarioBytecode: ({ data, debug, scriptId, }: { data: CompilationData; debug?: Debug | undefined; scriptId: string; }) => Debug extends true ? CompilationResult : import("./compiler-types.js").BytecodeGenerationResult, ProgramState>({ bytecodeDefinition, compilationContext, configuration, defaultOverride, extendedScenario, generateBytecode, lockingOrUnlockingScriptIdUnderTest, }: { bytecodeDefinition: WalletTemplateScenarioBytecode; compilationContext?: CompilationContextBCH | undefined; configuration: Configuration; extendedScenario: ExtendedScenarioDefinition; defaultOverride: WalletTemplateScenarioData; generateBytecode: GenerateBytecode; lockingOrUnlockingScriptIdUnderTest?: string | undefined; }) => Uint8Array | CompilationResult | { errors: [{ error: string; }]; success: false; }; /** * Compile a {@link WalletTemplateScenarioOutput.token}, * returning the {@link Output.token} result. */ export declare const compileScenarioOutputTokenData: (output: WalletTemplateScenarioOutput) => Pick; /** * Generate a scenario given a compiler configuration. If neither `scenarioId` * or `unlockingScriptId` are provided, the default scenario for the compiler * configuration will be generated. * * Returns either the full `CompilationData` for the selected scenario or an * error message (as a `string`). * * Note, this method should typically not be used directly, use * {@link Compiler.generateScenario} instead. */ export declare const generateScenarioBCH: ({ data, debug, scriptId, }: { data: CompilationData; debug?: Debug | undefined; scriptId: string; }) => Debug extends true ? CompilationResult : import("./compiler-types.js").BytecodeGenerationResult, ProgramState, Debug_1 extends boolean>({ configuration, generateBytecode, scenarioId, unlockingScriptId, lockingScriptId: providedLockingScriptId, }: { /** * The compiler configuration from which to generate the scenario. */ configuration: Configuration; generateBytecode: GenerateBytecode; /** * The ID of the scenario to generate. If `undefined`, the default scenario. */ scenarioId?: string | undefined; /** * The ID of the unlocking script under test by this scenario. If * `undefined` but required by the scenario, an error will be produced. */ unlockingScriptId?: string | undefined; /** * If this scenario does not require an `unlockingScriptId` (an "isolated" * locking script with no defined unlocking scripts), the ID of the locking * script to generate for this scenario. * * If `unlockingScriptId` is defined, the locking script ID will be read * from `configuration`, and an error will be produced if `lockingScriptId` * is also defined. */ lockingScriptId?: string | undefined; }, debug?: Debug_1 | undefined) => string | (Debug_1 extends true ? ScenarioGenerationDebuggingResult : Scenario); export {}; //# sourceMappingURL=scenarios.d.ts.map