1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
use lazy_static::lazy_static;
use sp_std::vec::Vec;
use crate::utils::sha256::{sha256, BinarySha256Hash};
pub struct Network {
passphrase: Vec<u8>,
id: BinarySha256Hash,
}
impl Network {
pub fn new(passphrase: &[u8]) -> Network {
let id = sha256(passphrase);
let passphrase = passphrase.to_vec();
Network { passphrase, id }
}
pub fn get_passphrase(&self) -> &Vec<u8> {
&self.passphrase
}
pub fn get_id(&self) -> &BinarySha256Hash {
&self.id
}
}
lazy_static! {
pub static ref TEST_NETWORK: Network = Network::new(b"Test SDF Network ; September 2015");
pub static ref PUBLIC_NETWORK: Network =
Network::new(b"Public Global Stellar Network ; September 2015");
}