parent
48de0cb469
commit
6a8ce5b5c0
@ -0,0 +1,17 @@
|
|||||||
|
use std::str::FromStr;
|
||||||
|
|
||||||
|
use bitcoin::bip32::DerivationPath;
|
||||||
|
use trezor_client::utils::convert_path;
|
||||||
|
|
||||||
|
fn do_main() -> Result<(), trezor_client::Error> {
|
||||||
|
let mut trezor = trezor_client::unique(false)?;
|
||||||
|
trezor.init_device(None)?;
|
||||||
|
let path = DerivationPath::from_str("m/44'/501'/0'/0'").expect("Hardended Derivation Path");
|
||||||
|
let solana_address = trezor.solana_get_address(convert_path(&path))?;
|
||||||
|
println!("solana address: {:?}", solana_address);
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
do_main().unwrap()
|
||||||
|
}
|
@ -0,0 +1,15 @@
|
|||||||
|
use super::{handle_interaction, Trezor};
|
||||||
|
use crate::{error::Result, protos};
|
||||||
|
|
||||||
|
impl Trezor {
|
||||||
|
// SOLANA
|
||||||
|
pub fn solana_get_address(&mut self, path: Vec<u32>) -> Result<String> {
|
||||||
|
let mut req = protos::SolanaGetAddress::new();
|
||||||
|
req.address_n = path;
|
||||||
|
req.show_display = Some(true);
|
||||||
|
let address = handle_interaction(
|
||||||
|
self.call(req, Box::new(|_, m: protos::SolanaAddress| Ok(m.address().into())))?,
|
||||||
|
)?;
|
||||||
|
Ok(address)
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in new issue