1 | <?php |
||
16 | class OutputScriptFactory |
||
17 | { |
||
18 | /** |
||
19 | * @param AddressInterface $address |
||
20 | * @return ScriptInterface |
||
21 | 10 | */ |
|
22 | public function payToAddress(AddressInterface $address) |
||
28 | |||
29 | /** |
||
30 | * @param PublicKeyInterface $publicKey |
||
31 | * @return ScriptInterface |
||
32 | 2 | */ |
|
33 | public function p2pk(PublicKeyInterface $publicKey) |
||
34 | 2 | { |
|
35 | return $this->payToPubKey($publicKey); |
||
36 | } |
||
37 | |||
38 | /** |
||
39 | * @param BufferInterface $pubKeyHash |
||
40 | * @return ScriptInterface |
||
41 | 4 | */ |
|
42 | public function p2pkh(BufferInterface $pubKeyHash) |
||
46 | |||
47 | /** |
||
48 | * @param BufferInterface $scriptHash |
||
49 | * @return ScriptInterface |
||
50 | 24 | */ |
|
51 | public function p2sh(BufferInterface $scriptHash) |
||
55 | |||
56 | /** |
||
57 | * @param BufferInterface $witnessScriptHash |
||
58 | * @return ScriptInterface |
||
59 | 6 | */ |
|
60 | public function p2wsh(BufferInterface $witnessScriptHash) |
||
64 | |||
65 | /** |
||
66 | * @param BufferInterface $witnessKeyHash |
||
67 | * @return ScriptInterface |
||
68 | 2 | */ |
|
69 | public function p2wkh(BufferInterface $witnessKeyHash) |
||
73 | /** |
||
74 | * Create a Pay to pubkey output |
||
75 | * |
||
76 | * @param PublicKeyInterface $publicKey |
||
77 | * @return ScriptInterface |
||
78 | 12 | */ |
|
79 | public function payToPubKey(PublicKeyInterface $publicKey) |
||
83 | |||
84 | /** |
||
85 | * Create a P2PKH output script |
||
86 | * |
||
87 | * @param BufferInterface $pubKeyHash |
||
88 | * @return ScriptInterface |
||
89 | 46 | */ |
|
90 | public function payToPubKeyHash(BufferInterface $pubKeyHash) |
||
98 | |||
99 | /** |
||
100 | /** |
||
101 | * Create a P2SH output script |
||
102 | * |
||
103 | * @param BufferInterface $scriptHash |
||
104 | * @return ScriptInterface |
||
105 | 50 | */ |
|
106 | public function payToScriptHash(BufferInterface $scriptHash) |
||
114 | |||
115 | /** |
||
116 | * @param int $m |
||
117 | * @param PublicKeyInterface[] $keys |
||
118 | * @param bool|true $sort |
||
119 | * @return ScriptInterface |
||
120 | 26 | */ |
|
121 | public function multisig($m, array $keys = [], $sort = true) |
||
127 | 26 | ||
128 | /** |
||
129 | * @param int $m |
||
130 | * @param BufferInterface[] $keys |
||
131 | 26 | * @param bool|true $sort |
|
132 | * @return ScriptInterface |
||
133 | */ |
||
134 | public function multisigKeyBuffers($m, array $keys = [], $sort = true) |
||
165 | |||
166 | /** |
||
167 | * @param BufferInterface $keyHash |
||
168 | * @return ScriptInterface |
||
169 | 8 | */ |
|
170 | public function witnessKeyHash(BufferInterface $keyHash) |
||
178 | |||
179 | /** |
||
180 | * @param BufferInterface $scriptHash |
||
181 | * @return ScriptInterface |
||
182 | 6 | */ |
|
183 | public function witnessScriptHash(BufferInterface $scriptHash) |
||
191 | |||
192 | /** |
||
193 | * @param BufferInterface $commitment |
||
194 | * @return ScriptInterface |
||
195 | */ |
||
196 | public function witnessCoinbaseCommitment(BufferInterface $commitment) |
||
207 | } |
||
208 |