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,
}