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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
use ledger_zondax_generic::LedgerAppError;
#[derive(Debug, thiserror::Error)]
pub enum EthError<E: std::error::Error> {
#[error("Ledger | {0}")]
Ledger(#[from] LedgerAppError<E>),
#[error("Missing response data: {0}")]
MissingResponseData(String),
#[error("{0}")]
Other(String),
}
pub enum ChunkPayloadType {
First = 0x00,
Subsequent = 0x80,
}
#[derive(Debug)]
pub struct BIP44Path {
pub purpose: u32,
pub coin: u32,
pub account: u32,
pub change: u32,
pub index: u32,
}
impl BIP44Path {
pub fn serialize_bip44(&self) -> Vec<u8> {
use byteorder::{BigEndian, WriteBytesExt};
let mut m = Vec::new();
m.write_u8(5).unwrap(); m.write_u32::<BigEndian>(self.purpose).unwrap();
m.write_u32::<BigEndian>(self.coin).unwrap();
m.write_u32::<BigEndian>(self.account).unwrap();
m.write_u32::<BigEndian>(self.change).unwrap();
m.write_u32::<BigEndian>(self.index).unwrap();
m
}
}
#[derive(Debug)]
pub struct LedgerEthTransactionResolution {
pub erc20_tokens: Vec<String>,
pub nfts: Vec<String>,
pub external_plugins: Vec<ExternalPluginData>,
pub plugin: Vec<String>,
}
#[derive(Debug)]
pub struct ExternalPluginData {
pub payload: String,
pub signature: String,
}