Skip to content

feat: Derive fiat asset from feature flags before hardcoded fallback#8631

Open
OGPoyraz wants to merge 1 commit intomainfrom
ogp/fiat-ff-implementation
Open

feat: Derive fiat asset from feature flags before hardcoded fallback#8631
OGPoyraz wants to merge 1 commit intomainfrom
ogp/fiat-ff-implementation

Conversation

@OGPoyraz
Copy link
Copy Markdown
Member

@OGPoyraz OGPoyraz commented Apr 29, 2026

Explanation

Currently deriveFiatAssetForFiatPayment resolves the fiat asset for a payment entirely from a hardcoded map (FIAT_ASSET_ID_BY_TX_TYPE). This makes it impossible to adjust asset mappings without a code release.

This PR introduces a 3-tier resolution for fiat assets:

  1. Feature flag - reads from confirmations_pay_fiat.assetPerTransactionType[txType] via RemoteFeatureFlagController
  2. Hardcoded map - falls back to the existing FIAT_ASSET_ID_BY_TX_TYPE constant
  3. ETH on mainnet - terminal fallback when neither source has an entry

The function signature gains a messenger parameter (already available at the call site in fiat-quotes.ts), and the return type tightens from TransactionPayFiatAsset | undefined to TransactionPayFiatAsset since the ETH mainnet fallback guarantees a value.

References

  • Feature flag key: confirmations_pay_fiat

Checklist

  • I've updated the test suite for new or updated code as appropriate
  • I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • I've communicated my changes to consumers by updating changelogs for packages I've changed
  • I've introduced breaking changes in this PR and have prepared draft pull requests for clients and consumer packages to resolve them

Note

Medium Risk
Changes runtime fiat quote behavior and introduces a new remote-flag-controlled override plus a mainnet-ETH default, which could affect pricing/quoting for previously-unmapped transaction types if flags are misconfigured.

Overview
Updates fiat quote asset selection to be feature-flag driven: deriveFiatAssetForFiatPayment now reads confirmations_pay_fiat.assetPerTransactionType[txType] (including batch txs via first nested type), then falls back to FIAT_ASSET_ID_BY_TX_TYPE, and finally to a new ETH_MAINNET_FIAT_ASSET default.

This changes the function signature to require a messenger, updates getFiatQuotes to use it, removes the “missing fiat asset mapping returns []” path, and adds unit tests plus a new getFiatAssetPerTransactionType helper in feature-flags.

Reviewed by Cursor Bugbot for commit 1096df7. Bugbot is set up for automated code reviews on this repo. Configure here.

@OGPoyraz OGPoyraz requested review from a team as code owners April 29, 2026 10:47
@OGPoyraz OGPoyraz force-pushed the ogp/fiat-ff-implementation branch from 5425439 to b24eac7 Compare April 29, 2026 10:48
@OGPoyraz OGPoyraz changed the title feat: read fiat asset from feature flags before hardcoded fallback feat: Derive fiat asset from feature flags before hardcoded fallback Apr 29, 2026
@OGPoyraz OGPoyraz force-pushed the ogp/fiat-ff-implementation branch from b24eac7 to 7ef80a6 Compare April 29, 2026 10:51
@OGPoyraz OGPoyraz force-pushed the ogp/fiat-ff-implementation branch from 7ef80a6 to 1096df7 Compare April 29, 2026 11:03
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