( psbt: bitcoin.Psbt, inputIndex: number, tapLeafScript: TapLeafScript )
| 7 | import {witnessStackToScriptWitness} from "./witness_stack_to_script_witness"; |
| 8 | |
| 9 | export function finalizeCommitInput( |
| 10 | psbt: bitcoin.Psbt, |
| 11 | inputIndex: number, |
| 12 | tapLeafScript: TapLeafScript |
| 13 | ) { |
| 14 | function getNoteFinalScripts(index: number, input: any) { |
| 15 | const scriptSolution = [input.tapScriptSig[0].signature]; |
| 16 | const witness = scriptSolution |
| 17 | .concat(tapLeafScript.script) |
| 18 | .concat(tapLeafScript.controlBlock); |
| 19 | |
| 20 | const finalScriptWitness = witnessStackToScriptWitness(witness); |
| 21 | |
| 22 | return { |
| 23 | finalScriptWitness, |
| 24 | }; |
| 25 | } |
| 26 | psbt.finalizeInput(inputIndex, getNoteFinalScripts); |
| 27 | } |
| 28 | |
| 29 | // Build a P2WSH transaction to generate NOTE information |
| 30 | // According to the protocol, the first input of the transaction is the NOTE information protocol, and the unlock script is the NOTE script hash |
no outgoing calls
no test coverage detected