1use ledger_zondax_generic::LedgerAppError;
2
3#[derive(Debug, thiserror::Error)]
5pub enum EthError<E: std::error::Error> {
6 #[error("Ledger | {0}")]
7 Ledger(#[from] LedgerAppError<E>),
9
10 #[error("Missing response data: {0}")]
12 MissingResponseData(String),
13
14 #[error("{0}")]
16 Other(String),
17}
18
19pub enum ChunkPayloadType {
21 First = 0x00,
23 Subsequent = 0x80,
25}
26
27#[derive(Debug)]
29pub struct BIP44Path {
30 pub purpose: u32,
32 pub coin: u32,
34 pub account: u32,
36 pub change: u32,
38 pub index: u32,
40}
41
42impl BIP44Path {
43 pub fn serialize_bip44(&self) -> Vec<u8> {
45 use byteorder::{BigEndian, WriteBytesExt};
46 let mut m = Vec::new();
47
48 m.write_u8(5).unwrap(); m.write_u32::<BigEndian>(self.purpose).unwrap();
50 m.write_u32::<BigEndian>(self.coin).unwrap();
51 m.write_u32::<BigEndian>(self.account).unwrap();
52 m.write_u32::<BigEndian>(self.change).unwrap();
53 m.write_u32::<BigEndian>(self.index).unwrap();
54
55 m
56 }
57}
58
59#[derive(Debug)]
60pub struct LedgerEthTransactionResolution {
61 pub erc20_tokens: Vec<String>,
63 pub nfts: Vec<String>,
65 pub external_plugins: Vec<ExternalPluginData>,
67 pub plugin: Vec<String>,
69}
70
71#[derive(Debug)]
72pub struct ExternalPluginData {
73 pub payload: String,
74 pub signature: String,
75}