-
Notifications
You must be signed in to change notification settings - Fork 1
/
slip44.rs
48 lines (44 loc) · 1.01 KB
/
slip44.rs
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
use ethers_core::types::U256;
use super::CoinType;
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum SLIP44 {
Hedera,
Ripple,
Solana,
Cardano,
Stellar,
Bitcoin,
Binance,
Litecoin,
Dogecoin,
Ethereum,
Polkadot,
Rootstock,
EthereumClassic,
Other(U256),
}
impl From<u32> for SLIP44 {
fn from(val: u32) -> SLIP44 {
match val {
0 => SLIP44::Bitcoin,
2 => SLIP44::Litecoin,
3 => SLIP44::Dogecoin,
60 => SLIP44::Ethereum,
61 => SLIP44::EthereumClassic,
144 => SLIP44::Ripple,
148 => SLIP44::Stellar,
3030 => SLIP44::Hedera,
1815 => SLIP44::Cardano,
137 => SLIP44::Rootstock,
714 => SLIP44::Binance,
501 => SLIP44::Solana,
354 => SLIP44::Polkadot,
val => SLIP44::Other(val.into()),
}
}
}
impl From<SLIP44> for CoinType {
fn from(val: SLIP44) -> Self {
CoinType::Slip44(val)
}
}