feat: Derive fiat asset from feature flags before hardcoded fallback#8631
Open
feat: Derive fiat asset from feature flags before hardcoded fallback#8631
Conversation
5425439 to
b24eac7
Compare
b24eac7 to
7ef80a6
Compare
7ef80a6 to
1096df7
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Explanation
Currently
deriveFiatAssetForFiatPaymentresolves 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:
confirmations_pay_fiat.assetPerTransactionType[txType]viaRemoteFeatureFlagControllerFIAT_ASSET_ID_BY_TX_TYPEconstantThe function signature gains a
messengerparameter (already available at the call site infiat-quotes.ts), and the return type tightens fromTransactionPayFiatAsset | undefinedtoTransactionPayFiatAssetsince the ETH mainnet fallback guarantees a value.References
confirmations_pay_fiatChecklist
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:
deriveFiatAssetForFiatPaymentnow readsconfirmations_pay_fiat.assetPerTransactionType[txType](including batch txs via first nested type), then falls back toFIAT_ASSET_ID_BY_TX_TYPE, and finally to a newETH_MAINNET_FIAT_ASSETdefault.This changes the function signature to require a
messenger, updatesgetFiatQuotesto use it, removes the “missing fiat asset mapping returns []” path, and adds unit tests plus a newgetFiatAssetPerTransactionTypehelper infeature-flags.Reviewed by Cursor Bugbot for commit 1096df7. Bugbot is set up for automated code reviews on this repo. Configure here.