Skip to content

Build invoice payment network fee comparator #242

Description

@Kingsman-99

Label: complexity: high
Points: 200

Description

For payers choosing between direct token payment vs. pay_with_token/bridge_pay (DEX swap path), compare estimated total cost (resource fee + any swap slippage) across both paths to recommend the cheaper option.

Technical Context

New src/feeComparator.ts. Combines Issue 34's fee estimator with a swap-cost estimate (querying the configured DEX contract's quote, if available) to produce a side-by-side comparison.

Acceptance Criteria

  • compareFundingPaths(invoice, sourceToken, amount) returns { direct: CostEstimate | "unsupported", swap: CostEstimate | "unsupported", recommended: "direct"|"swap" }
  • Marks a path "unsupported" rather than erroring when, e.g., the source token isn't the invoice token and no DEX is configured
  • Tests: both-supported comparison picks the cheaper path; one-path-unsupported case handled correctly

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions