Skip to content

Refactor wallet code to eliminate most plan::foo methods in favor of the Planner API #1396

Open
@hdevalence

Description

@hdevalence

Is your feature request related to a problem? Please describe.

Now that we have the Planner API, we have a bunch of methods like

/// Generate a new transaction plan delegating stake
#[instrument(skip(fvk, view, rng, rate_data, unbonded_amount, fee, source_address))]
pub async fn delegate<V, R>(
    fvk: &FullViewingKey,
    view: &mut V,
    rng: R,
    rate_data: RateData,
    unbonded_amount: u64,
    fee: Fee,
    source_address: Option<u64>,
) -> Result<TransactionPlan>
where
    V: ViewClient,
    R: RngCore + CryptoRng,
{
    Planner::new(rng)
        .fee(fee)
        .delegate(unbonded_amount, rate_data)
        .plan(view, fvk, source_address.map(Into::into))
        .await
        .context("can't build delegate plan")
}

which is just a worse wrapper around the Planner API.

Describe the solution you'd like

All of these methods, with the exception of sweep, should be eliminated, making sure that the planner API is at least as ergonomic as the method it's eliminating. Alternatively, if there's some reason we can't eliminate one, we should have a reason why it doesn't fit the planner API. (For instance, we can't eliminate sweep, because it makes a list of transaction plans, while the planner API does a single transaction, so that's a differently shaped problem).

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-clientArea: Design and implementation for client functionalityC-enhancementCategory: an enhancement to the codebaseE-easyEffort: Easy_P-lowPriority: low

    Type

    No type

    Projects

    Status

    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions