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 | * Load basic data, throw exception if it's not provided |
||
44 | * |
||
45 | * @param string $addressByte |
||
46 | * @param string $p2shByte |
||
47 | * @param string $privByte |
||
48 | * @param bool $testnet |
||
49 | * @throws \Exception |
||
50 | */ |
||
51 | public function __construct($addressByte, $p2shByte, $privByte, $testnet = false) |
||
74 | |||
75 | 282 | /** |
|
76 | 6 | * @inheritdoc |
|
77 | */ |
||
78 | public function isTestnet() |
||
82 | 276 | ||
83 | 276 | /** |
|
84 | * @inheritdoc |
||
85 | */ |
||
86 | public function getAddressByte() |
||
90 | 24 | ||
91 | /** |
||
92 | * @inheritdoc |
||
93 | */ |
||
94 | public function getPrivByte() |
||
98 | 138 | ||
99 | /** |
||
100 | * @inheritdoc |
||
101 | */ |
||
102 | public function getP2shByte() |
||
106 | 42 | ||
107 | /** |
||
108 | * Get version bytes for XPUB key |
||
109 | * |
||
110 | * @return string |
||
111 | * @throws \Exception |
||
112 | 150 | */ |
|
113 | public function getHDPubByte() |
||
121 | |||
122 | /** |
||
123 | 138 | * Set version bytes for XPUB key |
|
124 | * |
||
125 | 138 | * @param string $bytes |
|
126 | 6 | * @return $this |
|
127 | */ |
||
128 | public function setHDPubByte($bytes) |
||
136 | |||
137 | /** |
||
138 | 222 | * Get version bytes for XPRIV key |
|
139 | * |
||
140 | 222 | * @return string |
|
141 | 222 | * @throws \Exception |
|
142 | 111 | */ |
|
143 | public function getHDPrivByte() |
||
151 | |||
152 | /** |
||
153 | 138 | * Set version bytes for XPRIV key |
|
154 | * |
||
155 | 138 | * @param string $bytes |
|
156 | 6 | * @return $this |
|
157 | */ |
||
158 | public function setHDPrivByte($bytes) |
||
166 | |||
167 | /** |
||
168 | 222 | * @param string $bytes |
|
169 | * @return $this |
||
170 | 222 | */ |
|
171 | 222 | public function setNetMagicBytes($bytes) |
|
176 | |||
177 | /** |
||
178 | * @return string |
||
179 | * @throws \Exception |
||
180 | */ |
||
181 | 210 | public function getNetMagicBytes() |
|
189 | } |
||
190 |