Add input currency mode to Unified SwapBridge metrics#8909
Conversation
|
@metamaskbot publish-preview |
|
Preview builds have been published. Learn how to use preview builds in other projects. Expand for full list of packages and versions. |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit a3d4476. Configure here.
2c17c00 to
82e64ea
Compare
|
@metamaskbot publish-preview |
|
Preview builds have been published. Learn how to use preview builds in other projects. Expand for full list of packages and versions. |
| token_amount_source: string; | ||
| input_currency_mode: InputCurrencyMode; | ||
| }; | ||
|
|
||
| type InputCurrencyModeProperties = { | ||
| input_currency_mode?: InputCurrencyMode; | ||
| }; |
There was a problem hiding this comment.
The segment-schema properties should map to the types defined in this file. For example, the new request-metadata input_currency_mode field needs to be added to RequestMetadata. This ensures payloads from clients are type-safe and they pass segment's validation

Summary
input_currency_modeto Unified SwapBridge quote, submit, and completion metrics.InputCurrencyModeenum in@metamask/bridge-controllerwithfiatandcryptovalues.cryptofor backward compatibility.input_currency_modewithout local casts.Testing
@metamask/bridge-controllerand@metamask/bridge-status-controllerwith coverage disabled.Note
Low Risk
Analytics-only field with typed defaults; does not alter quote fetching, transaction submission, or security-sensitive paths.
Overview
Adds
input_currency_mode(fiat|crypto) to Unified SwapBridge analytics so clients can report whether the user entered the source amount in fiat or crypto.@metamask/bridge-controllerintroduces exportedInputCurrencyMode, extends metrics types, and readsinput_currency_modefrom theupdateBridgeQuoteRequestParamscontext (defaultcrypto). That value is attached to Input Changed, Quotes Requested, and Quotes Received payloads.@metamask/bridge-status-controllercarries the mode from quote context into submit/intent flows, persists it on bridge history, and includes it on Submitted (via pre-confirmation props) and Completed / Failed (from history, still defaulting to crypto when absent).Changelogs and Jest snapshots were updated for the new property; no swap/bridge execution logic changes.
Reviewed by Cursor Bugbot for commit f39f9dc. Bugbot is set up for automated code reviews on this repo. Configure here.