1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
//! Script templates for common transaction types.
//!
//! Provides the `UnlockingScriptTemplate` trait and a P2PKH implementation
//! for creating locking and unlocking scripts during transaction signing.
//! Ported from the Go BSV SDK (`transaction/template/p2pkh`).
use crateTransaction;
use crateTransactionError;
use Script;
/// Trait for script templates that produce unlocking scripts.
///
/// Any signing strategy (P2PKH, P2SH, custom scripts) should implement this
/// trait. The `sign` method receives the full transaction and the input index,
/// computes the appropriate signature hash, signs it, and returns the
/// unlocking script.