Refactor SignerSource to expose DerivationPath to other kinds of signers (#16933)
* One use statement * Add stdin uri scheme * Convert parse_signer_source to return Result * A-Z deps * Convert Usb data to Locator * Pull DerivationPath out of Locator * Wrap SignerSource to share derivation_path * Review comments * Check Filepath existence, readability in parse_signer_source
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
use {
|
||||
crate::{
|
||||
ledger::get_ledger_from_info,
|
||||
locator::Manufacturer,
|
||||
locator::{Locator, Manufacturer},
|
||||
remote_wallet::{
|
||||
RemoteWallet, RemoteWalletError, RemoteWalletInfo, RemoteWalletManager,
|
||||
RemoteWalletType,
|
||||
@@ -56,12 +56,13 @@ impl Signer for RemoteKeypair {
|
||||
}
|
||||
|
||||
pub fn generate_remote_keypair(
|
||||
path: String,
|
||||
locator: Locator,
|
||||
derivation_path: DerivationPath,
|
||||
wallet_manager: &RemoteWalletManager,
|
||||
confirm_key: bool,
|
||||
keypair_name: &str,
|
||||
) -> Result<RemoteKeypair, RemoteWalletError> {
|
||||
let (remote_wallet_info, derivation_path) = RemoteWalletInfo::parse_path(path)?;
|
||||
let remote_wallet_info = RemoteWalletInfo::parse_locator(locator);
|
||||
if remote_wallet_info.manufacturer == Manufacturer::Ledger {
|
||||
let ledger = get_ledger_from_info(remote_wallet_info, keypair_name, wallet_manager)?;
|
||||
let path = format!("{}{}", ledger.pretty_path, derivation_path.get_query());
|
||||
|
Reference in New Issue
Block a user