Skip to content

feat(core): add maximum-balance mint-swap mode #396

Description

@igbopharaoh

Context

This is follow-up work for the proposed MintSwap V1 implementation in #383. It assumes #383 is
reviewed and merged first.

Problem

Callers cannot request that Coco move the maximum safely transferable sat balance from one mint to
another. The destination amount cannot be calculated by simply subtracting an estimated fee because
proof fees, fee reserves, denominations, and mint limits affect the result.

Scope

  • Add a sat-only maximum-balance or sweep mode.
  • Freeze the eligible source balance during preparation.
  • Use bounded quote attempts to find a feasible destination amount.
  • Never exceed the frozen source budget.
  • Report any remaining source balance explicitly.
  • Do not promise that exactly zero sats will remain.

Acceptance criteria

  • Proofs reserved by other operations are excluded from the frozen balance.
  • Funds received after preparation begins do not increase the authorized budget.
  • Quote attempts are bounded and durably recorded.
  • Abandoned destination quotes are never paid.
  • Preparation rolls back safely if no positive amount is feasible.
  • Execution uses one immutable prepared plan.
  • Prepared and settled residual amounts are exposed to the caller.
  • Fee-return support is required so unused reserve can be recovered.

Blocked by

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status
    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions