import type { AnyCompilerConfiguration, AuthenticationProgramCommon, AuthenticationProgramStateCommon, AuthenticationProgramStateControlStack, AuthenticationProgramStateMinimum, AuthenticationProgramStateStack, BytecodeGenerationResult, CompilationContextBCH, CompilationData, CompilationResult, Compiler, CompilerConfiguration, WalletTemplate } from '../lib.js'; /** * Create a {@link Compiler.generateBytecode} method given a compiler * configuration. */ export declare const createCompilerGenerateBytecodeFunction: , ProgramState extends AuthenticationProgramStateControlStack & AuthenticationProgramStateMinimum & AuthenticationProgramStateStack>(compilerConfiguration: Configuration) => ({ data, debug, scriptId, }: { scriptId: string; data: CompilationData; debug?: boolean | undefined; }) => Debug extends true ? CompilationResult : BytecodeGenerationResult; /** * Create a {@link Compiler} from the provided compiler configuration. This * method requires a full {@link CompilerConfiguration} and does not provide any * crypto or VM implementations. * * @param configuration - the configuration from which to create the compiler */ export declare const compilerConfigurationToCompilerBCH: , ProgramState extends AuthenticationProgramStateControlStack & AuthenticationProgramStateMinimum & AuthenticationProgramStateStack>(configuration: Configuration) => Compiler; export declare const compilerConfigurationToCompiler: , ProgramState extends AuthenticationProgramStateControlStack & AuthenticationProgramStateMinimum & AuthenticationProgramStateStack>(configuration: Configuration) => Compiler; /** * A common {@link createAuthenticationProgram} implementation for * most compilers. * * Accepts the compiled contents of an evaluation and produces a * {@link AuthenticationProgramCommon} that can be evaluated to produce the * resulting program state. * * The precise shape of the authentication program produced by this method is * critical to the determinism of CashAssembly evaluations for the compiler in * which it is used, it therefore must be standardized between compiler * implementations. * * @param evaluationBytecode - the compiled bytecode to incorporate in the * created authentication program */ export declare const createAuthenticationProgramEvaluationCommon: (evaluationBytecode: Uint8Array) => AuthenticationProgramCommon; /** * Create a compiler using the default common compiler configuration. Because * this compiler has no access to a VM, it cannot compile evaluations. * * @param scriptsAndOverrides - a compiler configuration from which properties * will be used to override properties of the default common compiler * configuration – must include the `scripts` property */ export declare const createCompilerCommon: , ProgramState extends AuthenticationProgramStateCommon>(scriptsAndOverrides: Configuration) => Compiler; /** * Perform a simplified compilation on a CashAssembly script containing only hex * literals, bigint literals, UTF8 literals, and push statements. Scripts may * not contain variables/operations, evaluations, or opcode identifiers (use hex * literals instead). * * This is useful for accepting complex user input in advanced interfaces, * especially for `AddressData` and `WalletData`. * * Returns the compiled bytecode as a `Uint8Array`, or throws an error message. * * @param script - a simple CashAssembly script containing no variables or * evaluations */ export declare const compileCashAssembly: (script: string) => string | Uint8Array; /** * Re-assemble a string of disassembled bytecode * (see {@link disassembleBytecode}). * * @param opcodes - a mapping of opcodes to their respective Uint8Array * representation * @param disassembledBytecode - the disassembled bytecode to re-assemble */ export declare const assembleBytecode: (opcodes: { [opcode: string]: Uint8Array; }, disassembledBytecode: string) => import("../lib.js").CompilationResultParseError | { bytecode: Uint8Array; success: true; } | import("../lib.js").CompilationResultReduceError | import("../lib.js").CompilationResultResolveError | import("../lib.js").CompilationResultSuccess; /** * Re-assemble a string of disassembled BCH bytecode; see * {@link disassembleBytecodeBCH}. * * Note, this method performs automatic minimization of push instructions. * * @param disassembledBytecode - the disassembled BCH bytecode to re-assemble */ export declare const assembleBytecodeBCH: (disassembledBytecode: string) => import("../lib.js").CompilationResultParseError | { bytecode: Uint8Array; success: true; } | import("../lib.js").CompilationResultReduceError | import("../lib.js").CompilationResultResolveError | import("../lib.js").CompilationResultSuccess; /** * A convenience method to compile CashAssembly (using * {@link assembleBytecodeBCH}) to bytecode. If compilation fails, errors are * returned as a string. */ export declare const cashAssemblyToBin: (cashAssemblyScript: string) => string | Uint8Array; /** * Re-assemble a string of disassembled BCH bytecode; see * {@link disassembleBytecodeBTC}. * * Note, this method performs automatic minimization of push instructions. * * @param disassembledBytecode - the disassembled BTC bytecode to re-assemble */ export declare const assembleBytecodeBTC: (disassembledBytecode: string) => import("../lib.js").CompilationResultParseError | { bytecode: Uint8Array; success: true; } | import("../lib.js").CompilationResultReduceError | import("../lib.js").CompilationResultResolveError | import("../lib.js").CompilationResultSuccess; /** * Create a partial {@link CompilerConfiguration} from an * {@link WalletTemplate} by extracting and formatting the `scripts` and * `variables` properties. * * Note, if this {@link WalletTemplate} might be malformed, first * validate it with {@link importWalletTemplate}. * * @param template - the {@link WalletTemplate} from which to extract * the compiler configuration */ export declare const walletTemplateToCompilerConfiguration: (template: WalletTemplate) => Pick; //# sourceMappingURL=compiler-utils.d.ts.map