Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve the process of getting a handle to a specific wallet with Kmd #16

Open
manuelmauro opened this issue Apr 29, 2021 · 3 comments
Open
Assignees

Comments

@manuelmauro
Copy link
Owner

This is a snippet of the current workflow.

    let list_response = kmd.list_wallets()?;
    let wallet_id = match list_response
        .wallets
        .into_iter()
        .find(|wallet| wallet.name == "unencrypted-default-wallet")
    {
        Some(wallet) => wallet.id,
        None => return Err("Wallet not found".into()),
    };
    let init_response = kmd.init_wallet_handle(&wallet_id, "")?;
    let wallet_handle_token = init_response.wallet_handle_token;
    println!("Wallet Handle: {}", wallet_handle_token);
@manuelmauro manuelmauro self-assigned this Apr 29, 2021
@manuelmauro
Copy link
Owner Author

@i-schuetz do you have any idea about this? I am thinking that the crate algonaut_client might stay very low-level with functions almost 1-to-1 with Algorand's API, while improving the ergonomics in the parent algonaut crate or in a new one. In this case adding a struct with a function like get(wallet_name: &str).

@ivnsch
Copy link
Contributor

ivnsch commented May 6, 2021

Yeah, this shouldn't be added to the client. I'd probably create a v1::Kmd that wraps around the client and adds convenience like this. You could rename the current Kmd in KmdBuilder or similar.

@manuelmauro
Copy link
Owner Author

Great, seems a good solution! I only have mixed feelings on builders' naming convention. I noticed that reqwest follows this convention while crates like actix seems not to.

@ivnsch ivnsch mentioned this issue Jun 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants