1 | <?php |
||
15 | class OutputScriptFactory |
||
16 | { |
||
17 | /** |
||
18 | * @param AddressInterface $address |
||
19 | * @return ScriptInterface |
||
20 | */ |
||
21 | 10 | public function payToAddress(AddressInterface $address) |
|
27 | |||
28 | /** |
||
29 | * @param PublicKeyInterface $publicKey |
||
30 | * @return ScriptInterface |
||
31 | */ |
||
32 | 2 | public function p2pk(PublicKeyInterface $publicKey) |
|
36 | |||
37 | /** |
||
38 | * @param BufferInterface $pubKeyHash |
||
39 | * @return ScriptInterface |
||
40 | */ |
||
41 | 4 | public function p2pkh(BufferInterface $pubKeyHash) |
|
42 | { |
||
43 | 4 | return $this->payToPubKeyHash($pubKeyHash); |
|
44 | } |
||
45 | |||
46 | /** |
||
47 | * @param BufferInterface $scriptHash |
||
48 | * @return ScriptInterface |
||
49 | */ |
||
50 | 2 | public function p2sh(BufferInterface $scriptHash) |
|
51 | { |
||
52 | 2 | return $this->payToScriptHash($scriptHash); |
|
53 | } |
||
54 | |||
55 | /** |
||
56 | * @param BufferInterface $witnessScriptHash |
||
57 | * @return ScriptInterface |
||
58 | */ |
||
59 | 2 | public function p2wsh(BufferInterface $witnessScriptHash) |
|
63 | |||
64 | /** |
||
65 | * @param BufferInterface $witnessKeyHash |
||
66 | * @return ScriptInterface |
||
67 | */ |
||
68 | 2 | public function p2wkh(BufferInterface $witnessKeyHash) |
|
72 | /** |
||
73 | * Create a Pay to pubkey output |
||
74 | * |
||
75 | * @param PublicKeyInterface $publicKey |
||
76 | * @return ScriptInterface |
||
77 | */ |
||
78 | 12 | public function payToPubKey(PublicKeyInterface $publicKey) |
|
82 | |||
83 | /** |
||
84 | * Create a P2PKH output script |
||
85 | * |
||
86 | * @param BufferInterface $pubKeyHash |
||
87 | * @return ScriptInterface |
||
88 | */ |
||
89 | 40 | public function payToPubKeyHash(BufferInterface $pubKeyHash) |
|
97 | |||
98 | /** |
||
99 | /** |
||
100 | * Create a P2SH output script |
||
101 | * |
||
102 | * @param BufferInterface $scriptHash |
||
103 | * @return ScriptInterface |
||
104 | */ |
||
105 | 40 | public function payToScriptHash(BufferInterface $scriptHash) |
|
113 | |||
114 | /** |
||
115 | * @param int $m |
||
116 | * @param PublicKeyInterface[] $keys |
||
117 | * @param bool|true $sort |
||
118 | * @return ScriptInterface |
||
119 | */ |
||
120 | 26 | public function multisig($m, array $keys = [], $sort = true) |
|
151 | |||
152 | /** |
||
153 | * @param BufferInterface $keyHash |
||
154 | * @return ScriptInterface |
||
155 | */ |
||
156 | 2 | public function witnessKeyHash(BufferInterface $keyHash) |
|
164 | |||
165 | /** |
||
166 | * @param BufferInterface $scriptHash |
||
167 | * @return ScriptInterface |
||
168 | */ |
||
169 | 4 | public function witnessScriptHash(BufferInterface $scriptHash) |
|
177 | |||
178 | /** |
||
179 | * @param BufferInterface $commitment |
||
180 | * @return ScriptInterface |
||
181 | */ |
||
182 | 6 | public function witnessCoinbaseCommitment(BufferInterface $commitment) |
|
193 | } |
||
194 |