Skip to content

fix(routes): simplify demo quote fees - #1216

Merged
letstokenize merged 2 commits into
mainfrom
fix/routes-demo-quote-fees
Dec 2, 2026
Merged

letstokenize merged 2 commits into
mainfrom
fix/routes-demo-quote-fees

Conversation

@letstokenize

@letstokenize letstokenize commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

Simplifies the quote summary in the Routes demo's "Get a quote" step.

  • A subsidized (1:1) quote shows only what you send and what the recipient gets: no fee line and no "Covered by Tempo" line. This holds for transfer quotes too, which still list the provider's fee alongside destinationAmountRequired.
  • An unsubsidized quote shows a single Fee line: the whole gap between what is sent and what arrives, so the lines add up. The API's fees list leaves out deductions already taken from destinationAmount, such as conversion. Routes between currencies fall back to the listed fees.
  • Removes the "1:1 delivery preview from the docs demo organization..." note and the state that only it used.

The fee logic moves to quoteFee in src/lib/routes-test.ts, with unit tests.

Checks

  • pnpm test (80 files, 1776 tests), pnpm check, pnpm check:types
  • e2e/routes-demo.test.ts (29 tests, new one for a subsidized transfer quote) against the dev server
  • Screenshots of subsidized and unsubsidized quotes for a transfer and a deposit address, with the Routes API mocked

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nothing blocking. The comments below are optional suggestions. There is no need to push a fix for them before merging.

Comment thread src/lib/routes-test.ts
* quote lists the provider's fee. Otherwise the fees add up per token, such as `0.0001006 ETH`.
*/
export function quoteFee(data: Record<string, unknown>) {
if (data.subsidize === true) return undefined

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 (optional) Senders of a subsidized transfer quote no longer see fees they still pay, such as source-network gas in ETH, so the quote understates their cost. quoteFee returns undefined whenever subsidize === true, which drops every listed fee. A 1:1 subsidy only guarantees the recipient amount. Fix: on subsidized quotes, hide only fees the subsidy covers and keep separately charged fees, such as those with side: 'source'. Or show the fee line whenever fees is non-empty and drop only the 'None' row.

Why this was flagged

A keyed or keyless transfer quote returns subsidize: true with a non-empty fees array. The e2e fixture transferQuote (e2e/routes-demo.test.ts:104-111) shows such a fee: 0.0001006 ETH with side: 'source', commented "Transfers can charge source-network gas in the native asset". quoteFee returns undefined at src/lib/routes-test.ts:126, so QuoteSummary (src/components/RoutesTester.tsx:1847) shows only "You send 1 USDC / Recipient gets 1 USDC.e". On the base branch every listed fee got its own 'Fee' row. src/pages/docs/routes/quotes.mdx:40 says the fees array "lists only separately charged fees", and quotes.mdx:38 tells integrators to show fees. quotes.mdx:46 says the subsidy guarantees delivery: "the recipient receives the amount sent". It says nothing about covering source-side charges. The new e2e test 'shows a subsidized transfer quote at 1:1 with no fee line' locks this in.

Verification: The trigger is a subsidized transfer quote that comes back with a non-empty fees array, such as a source-side ETH network fee. src/lib/routes-test.ts:126 returns early with if (data.subsidize === true) return undefined, before any fee is read. On the base branch, fees.map(...) rendered a "Fee" row for every listed fee, whatever subsidize was.

@letstokenize
letstokenize enabled auto-merge (squash) December 2, 2026 07:21

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No new blocking issues. 1 optional suggestion (a nit or a note on pre-existing code) was found and not posted. Nothing in this review needs a push before merging.

Still open from earlier reviews (1):

  • Unresolved: 1 minor or pre-existing.

@letstokenize
letstokenize merged commit 70c1ad2 into main Dec 2, 2026
14 checks passed
@letstokenize
letstokenize deleted the fix/routes-demo-quote-fees branch December 2, 2026 07:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant