Skip to content

Add swap-token preview for pay_with_token #289

Description

@Kingsman-99

Labels: complexity: high

Implement previewTokenSwap(invoiceId, sourceToken, sourceAmount) that simulates what the DEX would return before calling pay_with_token. Uses the configured DEX contract's simulation interface.

Acceptance criteria:

  • Returns { estimatedOutput: bigint, priceImpactBps: number, route: string[] }
  • Calls simulate_transaction on the DEX contract rather than submitting
  • Returns error with message if no DEX is configured on the invoice
  • Exported with full TypeScript types

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