rust_hdwallet/hdwallet/cryptocurrencies/
bitcloud.rs1use crate::hdwallet::slip44::coin_types;
2
3use super::icryptocurrency::{
4 CryptocurrencyDescriptor, Info, InfoItem, InfoValue, NetworkDescriptor, XPrivateKeyVersions,
5 XPublicKeyVersions,
6};
7use super::NetworkName;
8
9pub struct Mainnet;
10
11impl Mainnet {
12 pub const NAME: &'static str = "mainnet";
13 pub const PUBLIC_KEY_ADDRESS_PREFIX: u32 = 0x19;
14 pub const SCRIPT_ADDRESS_PREFIX: u32 = 0x05;
15 pub const MESSAGE_PREFIX: &'static [u8] = b"\x18BitCloud Signed Message:\n";
16 pub const WIF_PREFIX: u8 = 0x99;
17 pub const XPRIVATE_KEY_VERSIONS: XPrivateKeyVersions = &[
18 ("P2PKH", 0x0488ade4),
19 ("P2SH", 0x0488ade4),
20 ];
21 pub const XPUBLIC_KEY_VERSIONS: XPublicKeyVersions = &[
22 ("P2PKH", 0x0488b21e),
23 ("P2SH", 0x0488b21e),
24 ];
25}
26
27pub static MAINNET: NetworkDescriptor = NetworkDescriptor {
28 name: Mainnet::NAME,
29 public_key_address_prefix: Some(Mainnet::PUBLIC_KEY_ADDRESS_PREFIX),
30 script_address_prefix: Some(Mainnet::SCRIPT_ADDRESS_PREFIX),
31 hrp: None,
32 witness_versions: None,
33 xprivate_key_versions: Some(Mainnet::XPRIVATE_KEY_VERSIONS),
34 xpublic_key_versions: Some(Mainnet::XPUBLIC_KEY_VERSIONS),
35 message_prefix: Some(Mainnet::MESSAGE_PREFIX),
36 wif_prefix: Some(Mainnet::WIF_PREFIX),
37 legacy_public_key_address_prefix: None,
38 std_public_key_address_prefix: None,
39 legacy_script_address_prefix: None,
40 std_script_address_prefix: None,
41 standard: None,
42 integrated: None,
43 sub_address: None,
44 network_type: None,
45 payment_address_hrp: None,
46 reward_address_hrp: None,
47};
48
49pub static NETWORKS: &[(&'static str, &'static NetworkDescriptor)] = &[("MAINNET", &MAINNET)];
50
51pub struct BitCloud {
52 pub network: NetworkName,
53}
54
55impl BitCloud {
56 pub const NAME: &'static str = "Bit-Cloud";
57 pub const SYMBOL: &'static str = "BTDX";
58 pub const COIN_TYPE: u32 = coin_types::BITCLOUD;
59 pub const ECC: &'static str = "SLIP10Secp256k1ECC";
60 pub const SUPPORT_BIP38: bool = true;
61 pub const DEFAULT_HD: &'static str = "BIP44";
62 pub const DEFAULT_PATH: &'static str = "m/44'/218'/0'/0/0";
63 pub const DEFAULT_ADDRESS: &'static str = "P2PKH";
64 pub const ENTROPIES: &'static [&'static str] = &["BIP39"];
65 pub const MNEMONICS: &'static [&'static str] = &["BIP39"];
66 pub const SEEDS: &'static [&'static str] = &["BIP39"];
67 pub const HDS: &'static [&'static str] = &["BIP32", "BIP44"];
68 pub const ADDRESSES: &'static [&'static str] = &["P2PKH", "P2SH"];
69 pub const SEMANTICS: &'static [&'static str] = &["p2pkh", "p2sh"];
70 pub const DEFAULT_SEMANTIC: Option<&'static str> = Some("p2pkh");
71
72 pub const INFO: Info<'static> = Info(&[
73 InfoItem {
74 key: "SOURCE_CODE",
75 value: InfoValue::Str("https://github.com/LIMXTEC/Bitcloud"),
76 },
77 InfoItem {
78 key: "WHITEPAPER",
79 value: InfoValue::Str("https://github.com/LIMXTEC/Bitcloud/blob/master/README.md"),
80 },
81 InfoItem {
82 key: "WEBSITES",
83 value: InfoValue::List(&["https://bit-cloud.cc"]),
84 },
85 ]);
86
87 #[must_use]
88 pub fn network_descriptor(&self) -> &'static NetworkDescriptor {
89 match self.network {
90 NetworkName::Mainnet => &MAINNET,
91 NetworkName::Testnet | NetworkName::Regtest => &MAINNET,
92 }
93 }
94}
95
96pub static DESCRIPTOR: CryptocurrencyDescriptor = CryptocurrencyDescriptor {
97 name: BitCloud::NAME,
98 symbol: BitCloud::SYMBOL,
99 info: BitCloud::INFO,
100 ecc: BitCloud::ECC,
101 coin_type: BitCloud::COIN_TYPE,
102 support_bip38: BitCloud::SUPPORT_BIP38,
103 networks: NETWORKS,
104 default_network: &MAINNET,
105 entropies: BitCloud::ENTROPIES,
106 mnemonics: BitCloud::MNEMONICS,
107 seeds: BitCloud::SEEDS,
108 hds: BitCloud::HDS,
109 default_hd: BitCloud::DEFAULT_HD,
110 default_path: BitCloud::DEFAULT_PATH,
111 addresses: BitCloud::ADDRESSES,
112 default_address: BitCloud::DEFAULT_ADDRESS,
113 address_types: None,
114 default_address_type: None,
115 address_prefixes: None,
116 default_address_prefix: None,
117 semantics: BitCloud::SEMANTICS,
118 default_semantic: BitCloud::DEFAULT_SEMANTIC,
119 params: None,
120};