(template: WalletTemplate)
| 371 | // After debugging, we want to verify the full transaction to ensure it is valid (this catches any errors that are not |
| 372 | // necessarily script errors) |
| 373 | const verifyFullTransaction = (template: WalletTemplate): void => { |
| 374 | const placeholderScriptId = Object.keys(template.scripts).find((key) => 'unlocks' in template.scripts[key]); |
| 375 | const placeholderScenarioId = (template.scripts[placeholderScriptId ?? ''] as WalletTemplateScriptUnlocking)?.passes?.[0]; |
| 376 | |
| 377 | if (!placeholderScenarioId || !placeholderScriptId) { |
| 378 | throw new Error('No placeholder scenario ID or script ID found'); |
| 379 | } |
| 380 | |
| 381 | const { vm, program } = createProgram(template, placeholderScriptId, placeholderScenarioId); |
| 382 | |
| 383 | const verificationResult = vm.verify({ |
| 384 | sourceOutputs: program.sourceOutputs, |
| 385 | transaction: program.transaction, |
| 386 | }); |
| 387 | |
| 388 | if (typeof verificationResult === 'string') { |
| 389 | throw new FailedTransactionError(verificationResult, getBitauthUri(template)); |
| 390 | } |
| 391 | }; |
| 392 | |
| 393 | const isSignatureCheckWithoutVerify = (instruction: AuthenticationInstruction): boolean => { |
| 394 | return [Op.OP_CHECKSIG, Op.OP_CHECKMULTISIG, Op.OP_CHECKDATASIG].includes(instruction.opcode); |
no test coverage detected