1 | <?php |
||
5 | class Network implements NetworkInterface |
||
6 | { |
||
7 | /** |
||
8 | * @var string |
||
9 | */ |
||
10 | private $addressByte; |
||
11 | |||
12 | /** |
||
13 | * @var string |
||
14 | */ |
||
15 | private $privByte; |
||
16 | |||
17 | /** |
||
18 | * @var string |
||
19 | */ |
||
20 | private $p2shByte; |
||
21 | |||
22 | /** |
||
23 | * @var string |
||
24 | */ |
||
25 | private $witnessV0KeyHash; |
||
26 | |||
27 | /** |
||
28 | * @var string |
||
29 | */ |
||
30 | private $witnessV0ScriptHash; |
||
31 | |||
32 | /** |
||
33 | * @var bool |
||
34 | */ |
||
35 | private $testnet; |
||
36 | |||
37 | /** |
||
38 | * @var null|string |
||
39 | */ |
||
40 | private $xpubByte; |
||
41 | |||
42 | /** |
||
43 | * @var null|string |
||
44 | */ |
||
45 | private $xprivByte; |
||
46 | |||
47 | /** |
||
48 | * @var string |
||
49 | */ |
||
50 | private $netMagicBytes; |
||
51 | |||
52 | /** |
||
53 | * Load basic data, throw exception if it's not provided |
||
54 | * |
||
55 | * @param string $addressByte |
||
56 | * @param string $p2shByte |
||
57 | * @param string $privByte |
||
58 | * @param bool $testnet |
||
59 | * @throws \Exception |
||
60 | */ |
||
61 | 312 | public function __construct($addressByte, $p2shByte, $privByte, $testnet = false) |
|
84 | |||
85 | /** |
||
86 | * @inheritdoc |
||
87 | */ |
||
88 | 24 | public function isTestnet() |
|
92 | |||
93 | /** |
||
94 | * @inheritdoc |
||
95 | */ |
||
96 | 174 | public function getAddressByte() |
|
100 | |||
101 | /** |
||
102 | * @inheritdoc |
||
103 | */ |
||
104 | 42 | public function getPrivByte() |
|
108 | |||
109 | /** |
||
110 | * @inheritdoc |
||
111 | */ |
||
112 | 186 | public function getP2shByte() |
|
116 | |||
117 | /** |
||
118 | * Get version bytes for XPUB key |
||
119 | * |
||
120 | * @return string |
||
121 | * @throws \Exception |
||
122 | */ |
||
123 | 132 | public function getHDPubByte() |
|
131 | |||
132 | /** |
||
133 | * Set version bytes for XPUB key |
||
134 | * |
||
135 | * @param string $bytes |
||
136 | * @return $this |
||
137 | */ |
||
138 | 234 | public function setHDPubByte($bytes) |
|
146 | |||
147 | /** |
||
148 | * Get version bytes for XPRIV key |
||
149 | * |
||
150 | * @return string |
||
151 | * @throws \Exception |
||
152 | */ |
||
153 | 132 | public function getHDPrivByte() |
|
161 | |||
162 | /** |
||
163 | * Set version bytes for XPRIV key |
||
164 | * |
||
165 | * @param string $bytes |
||
166 | * @return $this |
||
167 | */ |
||
168 | 234 | public function setHDPrivByte($bytes) |
|
176 | |||
177 | /** |
||
178 | * @param string $witnessByte |
||
179 | * @return $this |
||
180 | */ |
||
181 | 222 | public function setP2WPKHByte($witnessByte) |
|
190 | |||
191 | /** |
||
192 | * @return string |
||
193 | * @throws \Exception |
||
194 | */ |
||
195 | public function getP2WPKHByte() |
||
203 | |||
204 | /** |
||
205 | * @param string $witnessByte |
||
206 | * @return $this |
||
207 | */ |
||
208 | 222 | public function setP2WSHByte($witnessByte) |
|
217 | |||
218 | /** |
||
219 | * @return string |
||
220 | * @throws \Exception |
||
221 | */ |
||
222 | public function getP2WSHByte() |
||
230 | |||
231 | |||
232 | /** |
||
233 | * @param string $bytes |
||
234 | * @return $this |
||
235 | */ |
||
236 | 222 | public function setNetMagicBytes($bytes) |
|
241 | |||
242 | /** |
||
243 | * @return string |
||
244 | * @throws \Exception |
||
245 | */ |
||
246 | 30 | public function getNetMagicBytes() |
|
254 | } |
||
255 |