1- import { AuthenticationErrorCommon , AuthenticationInstruction , AuthenticationProgramCommon , AuthenticationProgramStateBchSpec , AuthenticationProgramStateCommon , AuthenticationVirtualMachine , AuthenticationVirtualMachineIdentifier , ResolvedTransactionCommon , WalletTemplate , WalletTemplateScriptUnlocking , binToHex , createCompiler , createVirtualMachineBch2023 , createVirtualMachineBch2025 , createVirtualMachineBch2026 , createVirtualMachineBchSpec , decodeAuthenticationInstructions , encodeAuthenticationInstruction , walletTemplateToCompilerConfiguration } from '@bitauth/libauth' ;
1+ import { AuthenticationErrorCommon , AuthenticationInstruction , AuthenticationProgramCommon , AuthenticationProgramStateCommon , AuthenticationVirtualMachine , AuthenticationVirtualMachineIdentifier , ResolvedTransactionCommon , WalletTemplate , WalletTemplateScriptUnlocking , binToHex , createCompiler , createVirtualMachineBch2023 , createVirtualMachineBch2025 , createVirtualMachineBch2026 , createVirtualMachineBchSpec , decodeAuthenticationInstructions , encodeAuthenticationInstruction , walletTemplateToCompilerConfiguration } from '@bitauth/libauth' ;
22import { Artifact , LogEntry , Op , PrimitiveType , StackItem , asmToBytecode , bytecodeToAsm , decodeBool , decodeInt , decodeString } from '@cashscript/utils' ;
33import { findLastIndex , toRegExp } from './utils.js' ;
44import { FailedRequireError , FailedTransactionError , FailedTransactionEvaluationError } from './Errors.js' ;
@@ -7,7 +7,7 @@ import { getBitauthUri } from './LibauthTemplate.js';
77export type DebugResult = AuthenticationProgramStateCommon [ ] ;
88export type DebugResults = Record < string , DebugResult > ;
99
10- const createVirualMachine = ( vmTarget : AuthenticationVirtualMachineIdentifier ) => {
10+ const createVirtualMachine = ( vmTarget : AuthenticationVirtualMachineIdentifier ) : VM => {
1111 switch ( vmTarget ) {
1212 case 'BCH_2023_05' :
1313 return createVirtualMachineBch2023 ( ) ;
@@ -16,11 +16,11 @@ const createVirualMachine = (vmTarget: AuthenticationVirtualMachineIdentifier) =
1616 case 'BCH_2026_05' :
1717 return createVirtualMachineBch2026 ( ) ;
1818 case 'BCH_SPEC' :
19- return createVirtualMachineBchSpec ( ) ;
19+ return createVirtualMachineBchSpec ( ) as unknown as VM ;
2020 default :
21- throw new Error ( `Debugging is not supported for the ${ vmTarget } virtual machine.` ) ; ;
21+ throw new Error ( `Debugging is not supported for the ${ vmTarget } virtual machine.` ) ;
2222 }
23- }
23+ } ;
2424
2525// debugs the template, optionally logging the execution data
2626export const debugTemplate = ( template : WalletTemplate , artifacts : Artifact [ ] ) : DebugResults => {
@@ -176,7 +176,7 @@ type CreateProgramResult = { vm: VM, program: Program };
176176// internal util. instantiates the virtual machine and compiles the template into a program
177177const createProgram = ( template : WalletTemplate , unlockingScriptId : string , scenarioId : string ) : CreateProgramResult => {
178178 const configuration = walletTemplateToCompilerConfiguration ( template ) ;
179- const vm = createVirualMachine ( template . supported [ 0 ] ) ;
179+ const vm = createVirtualMachine ( template . supported [ 0 ] ) ;
180180 const compiler = createCompiler ( configuration ) ;
181181
182182 if ( ! template . scripts [ unlockingScriptId ] ) {
0 commit comments