1 | <?php |
||
12 | class WitnessScriptFactory |
||
13 | { |
||
14 | /** |
||
15 | * @var OutputScriptFactory |
||
16 | */ |
||
17 | private $scriptPubKey; |
||
18 | |||
19 | /** |
||
20 | * @var Opcodes |
||
21 | */ |
||
22 | private $opcodes; |
||
23 | |||
24 | /** |
||
25 | * WitnessScriptFactory constructor. |
||
26 | * @param OutputScriptFactory $scriptPubKey |
||
27 | * @param Opcodes $opcodes |
||
28 | */ |
||
29 | public function __construct(OutputScriptFactory $scriptPubKey, Opcodes $opcodes) |
||
34 | |||
35 | /** |
||
36 | * Parse a ScriptInterface into a WitnessProgram |
||
37 | * |
||
38 | * @param ScriptInterface $script |
||
39 | * @return WitnessProgram |
||
40 | */ |
||
41 | public function parse(ScriptInterface $script) |
||
56 | |||
57 | /** |
||
58 | * Create a multisig witness program |
||
59 | * |
||
60 | * @param int $version |
||
61 | * @param int $m |
||
62 | * @param array $keys |
||
63 | * @param bool|true $sort |
||
64 | * @return WitnessProgram |
||
65 | */ |
||
66 | public function multisig($version, $m, array $keys, $sort = true) |
||
70 | |||
71 | /** |
||
72 | * Create a pay-to-pubkey witness program |
||
73 | * |
||
74 | * @param int $version |
||
75 | * @param PublicKeyInterface $publicKey |
||
76 | * @return WitnessProgram |
||
77 | */ |
||
78 | public function payToPubKey($version, PublicKeyInterface $publicKey) |
||
82 | |||
83 | /** |
||
84 | * Create a pay-to-pubkey-hash witness program |
||
85 | * |
||
86 | * @param int $version |
||
87 | * @param PublicKeyInterface $publicKey |
||
88 | * @return WitnessProgram |
||
89 | */ |
||
90 | public function payToPubKeyHash($version, PublicKeyInterface $publicKey) |
||
94 | } |
||
95 |