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 bool |
||
24 | */ |
||
25 | private $testnet; |
||
26 | |||
27 | /** |
||
28 | * @var null|string |
||
29 | */ |
||
30 | private $xpubByte; |
||
31 | |||
32 | /** |
||
33 | * @var null|string |
||
34 | */ |
||
35 | private $xprivByte; |
||
36 | |||
37 | /** |
||
38 | * @var string |
||
39 | */ |
||
40 | private $netMagicBytes; |
||
41 | |||
42 | /** |
||
43 | * @var null|string |
||
44 | */ |
||
45 | private $segwitAddrPrefix; |
||
46 | |||
47 | /** |
||
48 | * Load basic data, throw exception if it's not provided |
||
49 | * |
||
50 | * @param string $addressByte |
||
51 | 114 | * @param string $p2shByte |
|
52 | * @param string $privByte |
||
53 | 114 | * @param bool $testnet |
|
54 | 2 | * @throws \Exception |
|
55 | */ |
||
56 | public function __construct($addressByte, $p2shByte, $privByte, $testnet = false) |
||
79 | |||
80 | 8 | /** |
|
81 | * @inheritdoc |
||
82 | */ |
||
83 | public function isTestnet() |
||
87 | |||
88 | 46 | /** |
|
89 | * @inheritdoc |
||
90 | */ |
||
91 | public function getAddressByte() |
||
95 | |||
96 | 14 | /** |
|
97 | * @inheritdoc |
||
98 | */ |
||
99 | public function getPrivByte() |
||
103 | |||
104 | 56 | /** |
|
105 | * @inheritdoc |
||
106 | */ |
||
107 | public function getP2shByte() |
||
111 | |||
112 | /** |
||
113 | 60 | * Get version bytes for XPUB key |
|
114 | * |
||
115 | 60 | * @return string |
|
116 | 2 | * @throws \Exception |
|
117 | */ |
||
118 | public function getHDPubByte() |
||
126 | |||
127 | /** |
||
128 | 88 | * Set version bytes for XPUB key |
|
129 | * |
||
130 | 88 | * @param string $bytes |
|
131 | 88 | * @return $this |
|
132 | */ |
||
133 | public function setHDPubByte($bytes) |
||
141 | |||
142 | /** |
||
143 | 60 | * Get version bytes for XPRIV key |
|
144 | * |
||
145 | 60 | * @return string |
|
146 | 2 | * @throws \Exception |
|
147 | */ |
||
148 | public function getHDPrivByte() |
||
156 | |||
157 | /** |
||
158 | 88 | * Set version bytes for XPRIV key |
|
159 | * |
||
160 | 88 | * @param string $bytes |
|
161 | 88 | * @return $this |
|
162 | */ |
||
163 | public function setHDPrivByte($bytes) |
||
171 | 84 | ||
172 | /** |
||
173 | 84 | * @param string $bytes |
|
174 | 84 | * @return $this |
|
175 | */ |
||
176 | public function setNetMagicBytes($bytes) |
||
181 | 10 | ||
182 | /** |
||
183 | 10 | * @return string |
|
184 | 2 | * @throws \Exception |
|
185 | */ |
||
186 | public function getNetMagicBytes() |
||
194 | |||
195 | /** |
||
196 | * @param string $hrp |
||
197 | * @return $this |
||
198 | */ |
||
199 | public function setSegwitBech32Prefix($hrp) |
||
208 | |||
209 | /** |
||
210 | * @return bool |
||
211 | * @throws \Exception |
||
212 | */ |
||
213 | public function getSegwitBech32Prefix() |
||
221 | } |
||
222 |