Skip to content

Add invoice payment currency converter (multi-asset) #244

Description

@Kingsman-99

Label: complexity: high
Points: 200

Description

For UIs displaying invoice amounts in a payer's preferred fiat/asset reference, this issue adds a converter using the contract's existing price-oracle pattern (mirroring price_oracle/get_price from the contract side) at the SDK level for arbitrary display conversions, not just payment-affecting ones.

Technical Context

New src/currencyConverter.ts. convertAmount(amount, fromToken, toDisplayCurrency, oracleAddress) calls the same oracle contract interface (get_price) the contract uses, but purely for display — does not affect payment amounts.

Acceptance Criteria

  • convertAmount(...) returns a converted bigint/display string with no payment-side effects
  • Caches oracle price lookups for priceCacheTtlMs (default 10s) to avoid spamming the oracle contract
  • Clearly documented as display-only (not used for pay() calculations)
  • Tests: conversion math correctness; cache hit avoids second oracle call

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