MCPcopy Create free account
hub / github.com/NoteProtocol/NoteWallet / finalizeCommitInput

Function finalizeCommitInput

src/btc/btc-p2tr-commit-data.ts:9–27  ·  view source on GitHub ↗
(
  psbt: bitcoin.Psbt,
  inputIndex: number,
  tapLeafScript: TapLeafScript
)

Source from the content-addressed store, hash-verified

7import {witnessStackToScriptWitness} from "./witness_stack_to_script_witness";
8
9export 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

Callers 1

createP2TRCommitDataPsbtFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected