Skip to content

feat(widget)!: enforce single source of truth for fee/order/slippage/referrer#741

Merged
chybisov merged 1 commit into
mainfrom
feature/emb-389-config-strip-duplicates
May 26, 2026
Merged

feat(widget)!: enforce single source of truth for fee/order/slippage/referrer#741
chybisov merged 1 commit into
mainfrom
feature/emb-389-config-strip-duplicates

Conversation

@chybisov
Copy link
Copy Markdown
Member

Which Linear task is linked to this PR?

EMB-389 — Wave 1, item #3

Why was it implemented this way?

Today four settings exist in two places — top-level WidgetConfig and sdkConfig.routeOptions — with inconsistent precedence between read paths:

Setting Top-level sdkConfig.routeOptions Read-path precedence
fee WidgetConfig.fee routeOptions.fee (via spread) feeConfig?.fee || fee
referrer WidgetConfig.referrer routeOptions.referrer spread order
routePriority WidgetConfig.routePriority routeOptions.order inconsistent — nested wins in SDKClientProvider, top-level wins in useSettingsActions
slippage WidgetConfig.slippage routeOptions.slippage spread order

Setting both desyncs the SDK client from the settings UI.

This PR makes duplication impossible at the type level by extending the existing Omit in WidgetSDKConfig.routeOptions to also strip fee | referrer | order | slippage. This applies the same rule the codebase already follows for bridges and exchanges.

Additionally drops the top-level WidgetConfig.fee so feeConfig.fee is the single way to set the integrator fee.

Alternatives considered:

  • Keep both, document precedence — does not prevent the bug from recurring.
  • Move everything to sdkConfig.routeOptions — these are user-configurable defaults that flow into the settings store/UI, conceptually closer to appearance/fromChain than to apiUrl. Top-level is the right home.

Visual showcase

N/A — backend API type changes; widget renders identically. Smoke test confirms the playground loads with no new console errors.

Checklist before requesting a review

  • I have performed a self-review and testing of my code.
  • This pull request is focused and addresses a single problem.
  • If this PR modifies the Widget API or adds new features that require documentation, I have updated the documentation in the public-docs repository.

Breaking change

Migration:
```diff

  • fee: 0.01,
  • feeConfig: { fee: 0.01 },
  • sdkConfig: { routeOptions: { fee: 0.01 } }
  • feeConfig: { fee: 0.01 }
  • sdkConfig: { routeOptions: { order: 'FASTEST' } }
  • routePriority: 'FASTEST'
  • sdkConfig: { routeOptions: { slippage: 0.005 } }
  • slippage: 0.005
  • sdkConfig: { routeOptions: { referrer: '0x...' } }
  • referrer: '0x...'
    ```

…referrer

Strip fee, referrer, order, slippage from sdkConfig.routeOptions (extends
the existing Omit). Drop top-level WidgetConfig.fee — use feeConfig.fee
instead. Fixes inconsistent precedence between SDKClientProvider and the
settings store.

Refs EMB-389
@github-actions
Copy link
Copy Markdown

E2E Examples — failures

The following example(s) failed:

  • nft-checkout
  • vite-iframe-wagmi

See the workflow run for Playwright reports and logs.

@chybisov chybisov changed the title Enforce single source of truth for fee/order/slippage/referrer feat(widget)!: enforce single source of truth for fee/order/slippage/referrer May 25, 2026
@chybisov chybisov merged commit 5e718f5 into main May 26, 2026
19 of 21 checks passed
@chybisov chybisov deleted the feature/emb-389-config-strip-duplicates branch May 26, 2026 12:27
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.

2 participants