@metamask-previews/bridge-controller 75.1.1-preview-5e683f2 → 75.2.0-preview-be04faa3e
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +9 -1
- package/dist/bridge-controller-method-action-types.cjs.map +1 -1
- package/dist/bridge-controller-method-action-types.d.cts +9 -5
- package/dist/bridge-controller-method-action-types.d.cts.map +1 -1
- package/dist/bridge-controller-method-action-types.d.mts +9 -5
- package/dist/bridge-controller-method-action-types.d.mts.map +1 -1
- package/dist/bridge-controller-method-action-types.mjs.map +1 -1
- package/dist/bridge-controller.cjs +28 -0
- package/dist/bridge-controller.cjs.map +1 -1
- package/dist/bridge-controller.d.cts +2 -1
- package/dist/bridge-controller.d.cts.map +1 -1
- package/dist/bridge-controller.d.mts +2 -1
- package/dist/bridge-controller.d.mts.map +1 -1
- package/dist/bridge-controller.mjs +28 -0
- package/dist/bridge-controller.mjs.map +1 -1
- package/dist/constants/bridge.cjs +1 -0
- package/dist/constants/bridge.cjs.map +1 -1
- package/dist/constants/bridge.d.cts.map +1 -1
- package/dist/constants/bridge.d.mts.map +1 -1
- package/dist/constants/bridge.mjs +1 -0
- package/dist/constants/bridge.mjs.map +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +3 -3
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs.map +1 -1
- package/dist/types.cjs.map +1 -1
- package/dist/types.d.cts +7 -0
- package/dist/types.d.cts.map +1 -1
- package/dist/types.d.mts +7 -0
- package/dist/types.d.mts.map +1 -1
- package/dist/types.mjs.map +1 -1
- package/dist/utils/metrics/constants.cjs +1 -0
- package/dist/utils/metrics/constants.cjs.map +1 -1
- package/dist/utils/metrics/constants.d.cts +1 -0
- package/dist/utils/metrics/constants.d.cts.map +1 -1
- package/dist/utils/metrics/constants.d.mts +1 -0
- package/dist/utils/metrics/constants.d.mts.map +1 -1
- package/dist/utils/metrics/constants.mjs +1 -0
- package/dist/utils/metrics/constants.mjs.map +1 -1
- package/dist/utils/metrics/types.cjs.map +1 -1
- package/dist/utils/metrics/types.d.cts +19 -9
- package/dist/utils/metrics/types.d.cts.map +1 -1
- package/dist/utils/metrics/types.d.mts +19 -9
- package/dist/utils/metrics/types.d.mts.map +1 -1
- package/dist/utils/metrics/types.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.mjs","sourceRoot":"","sources":["../../../src/utils/metrics/constants.ts"],"names":[],"mappings":"AAAA,yDAAyD;AACzD,MAAM,CAAC,MAAM,kCAAkC,GAAG,oBAAoB,CAAC;AAEvE;;GAEG;AACH,MAAM,CAAN,IAAY,
|
|
1
|
+
{"version":3,"file":"constants.mjs","sourceRoot":"","sources":["../../../src/utils/metrics/constants.ts"],"names":[],"mappings":"AAAA,yDAAyD;AACzD,MAAM,CAAC,MAAM,kCAAkC,GAAG,oBAAoB,CAAC;AAEvE;;GAEG;AACH,MAAM,CAAN,IAAY,0BAoBX;AApBD,WAAY,0BAA0B;IACpC,iFAAsE,CAAA;IACtE,2EAAgE,CAAA;IAChE,+EAAoE,CAAA;IACpE,uGAA4F,CAAA;IAC5F,+GAAoG,CAAA;IACpG,qFAA0E,CAAA;IAC1E,mFAAwE,CAAA;IACxE,6EAAkE,CAAA;IAClE,wEAA6D,CAAA;IAC7D,wEAA6D,CAAA;IAC7D,kEAAuD,CAAA;IACvD,sFAA2E,CAAA;IAC3E,sFAA2E,CAAA;IAC3E,iFAAsE,CAAA;IACtE,2GAAgG,CAAA;IAChG,oGAAyF,CAAA;IACzF,oGAAyF,CAAA;IACzF,0FAA+E,CAAA;IAC/E,gGAAqF,CAAA;AACvF,CAAC,EApBW,0BAA0B,KAA1B,0BAA0B,QAoBrC;AAED,MAAM,CAAN,IAAY,aAIX;AAJD,WAAY,aAAa;IACvB,0DAAyC,CAAA;IACzC,oEAAmD,CAAA;IACnD,yDAAwC,CAAA;AAC1C,CAAC,EAJW,aAAa,KAAb,aAAa,QAIxB;AAED,MAAM,CAAN,IAAY,WAMX;AAND,WAAY,WAAW;IACrB,oDAAqC,CAAA;IACrC,4DAA6C,CAAA;IAC7C,oDAAqC,CAAA;IACrC,6DAA8C,CAAA;IAC9C,0EAA2D,CAAA;AAC7D,CAAC,EANW,WAAW,KAAX,WAAW,QAMtB;AAED;;;;GAIG;AACH,MAAM,CAAN,IAAY,2BAKX;AALD,WAAY,2BAA2B;IACrC,qDAAsB,CAAA;IACtB,uDAAwB,CAAA;IACxB,mEAAoC,CAAA;IACpC,kDAAmB,CAAA;AACrB,CAAC,EALW,2BAA2B,KAA3B,2BAA2B,QAKtC;AAED,MAAM,CAAN,IAAY,iBAOX;AAPD,WAAY,iBAAiB;IAC3B,uCAAkB,CAAA;IAClB,uCAAkB,CAAA;IAClB,uCAAkB,CAAA;IAClB,uCAAkB,CAAA;IAClB,uEAAuE;IACvE,gCAAW,CAAA;AACb,CAAC,EAPW,iBAAiB,KAAjB,iBAAiB,QAO5B;AAED,MAAM,CAAN,IAAY,iBAMX;AAND,WAAY,iBAAiB;IAC3B;;OAEG;IACH,oDAA+B,CAAA;IAC/B,oDAA+B,CAAA;AACjC,CAAC,EANW,iBAAiB,KAAjB,iBAAiB,QAM5B;AAED,MAAM,CAAN,IAAY,eAGX;AAHD,WAAY,eAAe;IACzB,0CAAuB,CAAA;IACvB,4CAAyB,CAAA;AAC3B,CAAC,EAHW,eAAe,KAAf,eAAe,QAG1B","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\nexport const UNIFIED_SWAP_BRIDGE_EVENT_CATEGORY = 'Unified SwapBridge';\n\n/**\n * These event names map to events defined in the segment-schema: https://github.com/Consensys/segment-schema/tree/main/libraries/events/metamask-cross-chain-swaps\n */\nexport enum UnifiedSwapBridgeEventName {\n ButtonClicked = `${UNIFIED_SWAP_BRIDGE_EVENT_CATEGORY} Button Clicked`,\n PageViewed = `${UNIFIED_SWAP_BRIDGE_EVENT_CATEGORY} Page Viewed`,\n InputChanged = `${UNIFIED_SWAP_BRIDGE_EVENT_CATEGORY} Input Changed`,\n FiatCryptoToggleClicked = `${UNIFIED_SWAP_BRIDGE_EVENT_CATEGORY} Fiat Crypto Toggle Clicked`,\n InputSourceDestinationSwitched = `${UNIFIED_SWAP_BRIDGE_EVENT_CATEGORY} Source Destination Switched`,\n QuotesRequested = `${UNIFIED_SWAP_BRIDGE_EVENT_CATEGORY} Quotes Requested`,\n QuotesReceived = `${UNIFIED_SWAP_BRIDGE_EVENT_CATEGORY} Quotes Received`,\n QuotesError = `${UNIFIED_SWAP_BRIDGE_EVENT_CATEGORY} Quotes Error`,\n Submitted = `${UNIFIED_SWAP_BRIDGE_EVENT_CATEGORY} Submitted`,\n Completed = `${UNIFIED_SWAP_BRIDGE_EVENT_CATEGORY} Completed`,\n Failed = `${UNIFIED_SWAP_BRIDGE_EVENT_CATEGORY} Failed`,\n AllQuotesOpened = `${UNIFIED_SWAP_BRIDGE_EVENT_CATEGORY} All Quotes Opened`,\n AllQuotesSorted = `${UNIFIED_SWAP_BRIDGE_EVENT_CATEGORY} All Quotes Sorted`,\n QuoteSelected = `${UNIFIED_SWAP_BRIDGE_EVENT_CATEGORY} Quote Selected`,\n AssetDetailTooltipClicked = `${UNIFIED_SWAP_BRIDGE_EVENT_CATEGORY} Asset Detail Tooltip Clicked`,\n QuotesValidationFailed = `${UNIFIED_SWAP_BRIDGE_EVENT_CATEGORY} Quotes Failed Validation`,\n StatusValidationFailed = `${UNIFIED_SWAP_BRIDGE_EVENT_CATEGORY} Status Failed Validation`,\n AssetPickerOpened = `${UNIFIED_SWAP_BRIDGE_EVENT_CATEGORY} Asset Picker Opened`,\n PollingStatusUpdated = `${UNIFIED_SWAP_BRIDGE_EVENT_CATEGORY} Polling Status Updated`,\n}\n\nexport enum PollingStatus {\n MaxPollingReached = 'max_polling_reached',\n InvalidTransactionHash = 'invalid_transaction_hash',\n ManuallyRestarted = 'manually_restarted',\n}\n\nexport enum AbortReason {\n NewQuoteRequest = 'New Quote Request',\n QuoteRequestUpdated = 'Quote Request Updated',\n ResetState = 'Reset controller state',\n TransactionSubmitted = 'Transaction submitted',\n GaslessTxBatchFetched = 'Gasless transaction batch fetched',\n}\n\n/**\n * Identifies the entry point from which the user initiated a swap or bridge flow.\n * Included as the `location` property on every Unified SwapBridge event so\n * analytics can trace the user's origin regardless of where they are in the flow.\n */\nexport enum MetaMetricsSwapsEventSource {\n MainView = 'Main View',\n TokenView = 'Token View',\n TrendingExplore = 'Trending Explore',\n Rewards = 'Rewards',\n}\n\nexport enum InputAmountPreset {\n PERCENT_25 = '25%',\n PERCENT_50 = '50%',\n PERCENT_75 = '75%',\n PERCENT_90 = '90%',\n // \"Max\" may not equal 100% of balance (e.g. gas reserves are withheld)\n MAX = 'MAX',\n}\n\nexport enum MetricsActionType {\n /**\n * @deprecated new events should use SWAPBRIDGE_V1 instead\n */\n CROSSCHAIN_V1 = 'crosschain-v1',\n SWAPBRIDGE_V1 = 'swapbridge-v1',\n}\n\nexport enum MetricsSwapType {\n SINGLE = 'single_chain',\n CROSSCHAIN = 'crosschain',\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.cjs","sourceRoot":"","sources":["../../../src/utils/metrics/types.ts"],"names":[],"mappings":"","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\nimport type { CaipAssetType, CaipChainId } from '@metamask/utils';\n\nimport type { FeatureId, SortOrder, StatusTypes } from '../../types';\nimport type {\n UnifiedSwapBridgeEventName,\n MetaMetricsSwapsEventSource,\n MetricsActionType,\n MetricsSwapType,\n PollingStatus,\n} from './constants';\n\n/**\n * These properties map to properties required by the segment-schema. For example: https://github.com/Consensys/segment-schema/blob/main/libraries/properties/cross-chain-swaps-action.yaml\n */\nexport type RequestParams = {\n chain_id_source: CaipChainId;\n chain_id_destination: CaipChainId | null;\n token_symbol_source: string;\n token_symbol_destination: string | null;\n token_address_source: CaipAssetType;\n token_address_destination: CaipAssetType | null;\n /**\n * Client-supplied security classification for the destination token\n * (e.g. from token security/scanning data). Stored on the controller\n * and merged into every analytics event that includes\n * `token_address_destination`. Pass `null` when no security data is\n * available for the selected destination token.\n */\n token_security_type_destination: string | null;\n};\n\nexport type AccountHardwareType =\n | 'Ledger'\n | 'Trezor'\n | 'QR Hardware'\n | 'Lattice'\n | null;\n\nexport type RequestMetadata = {\n slippage_limit?: number; // undefined === auto\n custom_slippage: boolean;\n usd_amount_source: number; // Use quoteResponse when available\n stx_enabled: boolean;\n is_hardware_wallet: boolean;\n account_hardware_type: AccountHardwareType;\n swap_type: MetricsSwapType;\n security_warnings: string[];\n};\n\nexport type QuoteFetchData = {\n can_submit: boolean;\n best_quote_provider?: `${string}_${string}`;\n quotes_count: number;\n quotes_list: `${string}_${string}`[];\n initial_load_time_all_quotes: number;\n price_impact: number;\n has_gas_included_quote: boolean;\n};\n\nexport type TradeData = {\n usd_quoted_gas: number;\n gas_included: boolean;\n gas_included_7702: boolean;\n quoted_time_minutes: number;\n usd_quoted_return: number;\n provider: `${string}_${string}`;\n};\n\nexport type TxStatusData = {\n allowance_reset_transaction?: StatusTypes;\n approval_transaction?: StatusTypes;\n source_transaction?: StatusTypes;\n destination_transaction?: StatusTypes;\n};\n\nexport type InputKeys =\n | 'token_source'\n | 'token_destination'\n | 'chain_source'\n | 'chain_destination'\n | 'slippage'\n | 'token_amount_source';\n\nexport type InputValues = {\n token_source: CaipAssetType;\n token_destination: CaipAssetType;\n chain_source: CaipChainId;\n chain_destination: CaipChainId;\n slippage: number;\n token_amount_source: string;\n};\n\nexport type QuoteWarning =\n | 'low_return'\n | 'no_quotes'\n | 'insufficient_gas_balance'\n | 'insufficient_gas_for_selected_quote'\n | 'insufficient_balance'\n | 'market_closed'\n | 'price_impact'\n | 'quote_expired'\n | 'tx_alert';\n\n/**\n * Properties that are required to be provided when trackUnifiedSwapBridgeEvent is called.\n * This is the base type without the `location` property which is added to all events\n * via the RequiredEventContextFromClient mapped type.\n */\ntype RequiredEventContextFromClientBase = {\n [UnifiedSwapBridgeEventName.ButtonClicked]: Pick<\n RequestParams,\n 'token_symbol_source' | 'token_symbol_destination'\n > & { environment_type?: string };\n // When type is object, the payload can be anything\n [UnifiedSwapBridgeEventName.PageViewed]: object;\n [UnifiedSwapBridgeEventName.InputChanged]: {\n input:\n | 'token_source'\n | 'token_destination'\n | 'chain_source'\n | 'chain_destination'\n | 'slippage'\n | 'token_amount_source';\n input_value: InputValues[keyof InputValues];\n input_amount_preset?: string;\n };\n [UnifiedSwapBridgeEventName.InputSourceDestinationSwitched]: {\n token_symbol_source: RequestParams['token_symbol_source'];\n token_symbol_destination: RequestParams['token_symbol_destination'];\n token_address_source: RequestParams['token_address_source'];\n token_address_destination: RequestParams['token_address_destination'];\n token_security_type_destination: RequestParams['token_security_type_destination'];\n chain_id_source: RequestParams['chain_id_source'];\n chain_id_destination: RequestParams['chain_id_destination'];\n } & Pick<RequestMetadata, 'security_warnings'>;\n [UnifiedSwapBridgeEventName.QuotesRequested]: Pick<\n RequestMetadata,\n 'stx_enabled' | 'usd_amount_source'\n > & {\n token_symbol_source: RequestParams['token_symbol_source'];\n token_symbol_destination: RequestParams['token_symbol_destination'];\n token_security_type_destination: RequestParams['token_security_type_destination'];\n };\n [UnifiedSwapBridgeEventName.QuotesReceived]: TradeData & {\n warnings: QuoteWarning[];\n best_quote_provider: QuoteFetchData['best_quote_provider'];\n price_impact: QuoteFetchData['price_impact'];\n can_submit: QuoteFetchData['can_submit'];\n usd_balance_source?: number;\n has_sufficient_gas_for_quote?: boolean | null;\n };\n [UnifiedSwapBridgeEventName.QuotesError]: Pick<\n RequestMetadata,\n 'stx_enabled'\n > & {\n token_symbol_source: RequestParams['token_symbol_source'];\n token_symbol_destination: RequestParams['token_symbol_destination'];\n } & Pick<RequestMetadata, 'security_warnings'>;\n // Emitted by BridgeStatusController\n [UnifiedSwapBridgeEventName.Submitted]: TradeData &\n Pick<QuoteFetchData, 'price_impact'> &\n Omit<RequestMetadata, 'security_warnings'> &\n Pick<\n RequestParams,\n | 'token_symbol_source'\n | 'token_symbol_destination'\n | 'token_address_source'\n | 'token_address_destination'\n | 'chain_id_source'\n | 'chain_id_destination'\n | 'token_security_type_destination'\n > & {\n action_type: MetricsActionType;\n batch_id?: string;\n };\n [UnifiedSwapBridgeEventName.Completed]: TradeData &\n Pick<QuoteFetchData, 'price_impact'> &\n Omit<RequestMetadata, 'security_warnings'> &\n TxStatusData &\n RequestParams & {\n actual_time_minutes: number;\n usd_actual_return: number;\n usd_actual_gas: number;\n quote_vs_execution_ratio: number;\n quoted_vs_used_gas_ratio: number;\n action_type: MetricsActionType;\n batch_id?: string;\n };\n [UnifiedSwapBridgeEventName.Failed]: (\n | // Tx failed before confirmation\n (Pick<\n RequestMetadata,\n | 'stx_enabled'\n | 'usd_amount_source'\n | 'is_hardware_wallet'\n | 'account_hardware_type'\n > &\n Pick<\n RequestParams,\n | 'token_symbol_source'\n | 'token_symbol_destination'\n | 'token_address_source'\n | 'token_address_destination'\n | 'token_security_type_destination'\n >)\n // Tx failed after confirmation\n | (RequestParams &\n RequestMetadata &\n TxStatusData & {\n actual_time_minutes: number;\n })\n ) &\n TradeData &\n Pick<QuoteFetchData, 'price_impact'> & {\n error_message: string;\n batch_id?: string;\n };\n [UnifiedSwapBridgeEventName.PollingStatusUpdated]: {\n polling_status: PollingStatus;\n retry_attempts: number;\n };\n [UnifiedSwapBridgeEventName.StatusValidationFailed]: {\n failures: string[];\n refresh_count: number;\n };\n // Emitted by clients\n [UnifiedSwapBridgeEventName.AllQuotesOpened]: Pick<\n TradeData,\n 'gas_included'\n > &\n Pick<QuoteFetchData, 'price_impact'> &\n Pick<RequestParams, 'token_symbol_source' | 'token_symbol_destination'> & {\n stx_enabled: RequestMetadata['stx_enabled'];\n can_submit: QuoteFetchData['can_submit'];\n };\n [UnifiedSwapBridgeEventName.AllQuotesSorted]: Pick<\n TradeData,\n 'gas_included'\n > &\n Pick<QuoteFetchData, 'price_impact'> &\n Pick<RequestParams, 'token_symbol_source' | 'token_symbol_destination'> & {\n stx_enabled: RequestMetadata['stx_enabled'];\n sort_order: SortOrder;\n best_quote_provider: QuoteFetchData['best_quote_provider'];\n can_submit: QuoteFetchData['can_submit'];\n };\n [UnifiedSwapBridgeEventName.QuoteSelected]: TradeData & {\n is_best_quote: boolean;\n best_quote_provider: QuoteFetchData['best_quote_provider'];\n price_impact: QuoteFetchData['price_impact'];\n can_submit: QuoteFetchData['can_submit'];\n };\n [UnifiedSwapBridgeEventName.AssetDetailTooltipClicked]: {\n token_name: string;\n token_symbol: string;\n token_contract: string;\n chain_name: string;\n chain_id: string;\n };\n [UnifiedSwapBridgeEventName.QuotesValidationFailed]: {\n failures: string[];\n };\n [UnifiedSwapBridgeEventName.AssetPickerOpened]: {\n asset_location: 'source' | 'destination';\n };\n};\n\n/**\n * Properties that are required to be provided when trackUnifiedSwapBridgeEvent is called.\n * This combines the event-specific properties from RequiredEventContextFromClientBase\n * with an optional `location` property. When `location` is omitted, the controller\n * falls back to the value stored via `setLocation()` (defaults to MainView).\n *\n * `ab_tests` is the legacy field and `active_ab_tests` is the newer field.\n * Both are kept for a migration window and are treated as separate payloads.\n */\nexport type RequiredEventContextFromClient = {\n [K in keyof RequiredEventContextFromClientBase]: RequiredEventContextFromClientBase[K] & {\n location?: MetaMetricsSwapsEventSource;\n ab_tests?: Record<string, string>;\n active_ab_tests?: { key: string; value: string }[];\n feature_id: FeatureId;\n };\n};\n\n/**\n * Properties that can be derived from the bridge controller state\n */\nexport type EventPropertiesFromControllerState = {\n [UnifiedSwapBridgeEventName.ButtonClicked]: RequestParams;\n [UnifiedSwapBridgeEventName.PageViewed]: RequestParams &\n Omit<\n RequestMetadata,\n 'stx_enabled' | 'usd_amount_source' | 'security_warnings'\n >;\n [UnifiedSwapBridgeEventName.InputChanged]: {\n input: InputKeys;\n input_value: string;\n };\n [UnifiedSwapBridgeEventName.InputSourceDestinationSwitched]: RequestParams;\n [UnifiedSwapBridgeEventName.QuotesRequested]: RequestParams &\n RequestMetadata & {\n has_sufficient_funds: boolean;\n };\n [UnifiedSwapBridgeEventName.QuotesReceived]: RequestParams &\n RequestMetadata &\n QuoteFetchData &\n TradeData & {\n refresh_count: number; // starts from 0\n };\n [UnifiedSwapBridgeEventName.QuotesError]: RequestParams &\n RequestMetadata & {\n has_sufficient_funds: boolean;\n error_message: string;\n };\n [UnifiedSwapBridgeEventName.Submitted]: null;\n [UnifiedSwapBridgeEventName.Completed]: null;\n [UnifiedSwapBridgeEventName.Failed]: RequestParams &\n RequestMetadata &\n TxStatusData &\n TradeData &\n Pick<QuoteFetchData, 'price_impact'> & {\n actual_time_minutes: number;\n };\n [UnifiedSwapBridgeEventName.AllQuotesOpened]: RequestParams &\n RequestMetadata &\n TradeData &\n QuoteFetchData;\n [UnifiedSwapBridgeEventName.AllQuotesSorted]: RequestParams &\n RequestMetadata &\n TradeData &\n QuoteFetchData;\n [UnifiedSwapBridgeEventName.QuoteSelected]: RequestParams &\n RequestMetadata &\n QuoteFetchData &\n TradeData;\n [UnifiedSwapBridgeEventName.AssetDetailTooltipClicked]: null;\n [UnifiedSwapBridgeEventName.QuotesValidationFailed]: RequestParams & {\n refresh_count: number;\n };\n [UnifiedSwapBridgeEventName.StatusValidationFailed]: RequestParams;\n [UnifiedSwapBridgeEventName.AssetPickerOpened]: null;\n [UnifiedSwapBridgeEventName.PollingStatusUpdated]: TradeData &\n Pick<QuoteFetchData, 'price_impact'> &\n Omit<RequestMetadata, 'security_warnings'> &\n Pick<\n RequestParams,\n | 'token_symbol_source'\n | 'token_symbol_destination'\n | 'chain_id_source'\n | 'chain_id_destination'\n > & {\n batch_id?: string;\n };\n};\n\n/**\n * trackUnifiedSwapBridgeEvent payload properties consist of required properties from the client\n * and properties from the bridge controller\n *\n * `ab_tests` will be deprecated in favor of `active_ab_tests` in the future.\n * `ab_tests` and `active_ab_tests` intentionally coexist during migration.\n */\nexport type CrossChainSwapsEventProperties<\n T extends UnifiedSwapBridgeEventName,\n> =\n | {\n feature_id: FeatureId;\n action_type: MetricsActionType;\n location: MetaMetricsSwapsEventSource;\n ab_tests?: Record<string, string>;\n active_ab_tests?: { key: string; value: string }[];\n }\n | Pick<EventPropertiesFromControllerState, T>[T]\n | Pick<RequiredEventContextFromClient, T>[T];\n"]}
|
|
1
|
+
{"version":3,"file":"types.cjs","sourceRoot":"","sources":["../../../src/utils/metrics/types.ts"],"names":[],"mappings":"","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\nimport type { CaipAssetType, CaipChainId } from '@metamask/utils';\n\nimport type {\n FeatureId,\n InputPrimaryDenomination,\n SortOrder,\n StatusTypes,\n} from '../../types';\nimport type {\n UnifiedSwapBridgeEventName,\n MetaMetricsSwapsEventSource,\n MetricsActionType,\n MetricsSwapType,\n PollingStatus,\n} from './constants';\n\n/**\n * These properties map to properties required by the segment-schema. For example: https://github.com/Consensys/segment-schema/blob/main/libraries/properties/cross-chain-swaps-action.yaml\n */\nexport type RequestParams = {\n chain_id_source: CaipChainId;\n chain_id_destination: CaipChainId | null;\n token_symbol_source: string;\n token_symbol_destination: string | null;\n token_address_source: CaipAssetType;\n token_address_destination: CaipAssetType | null;\n /**\n * Client-supplied security classification for the destination token\n * (e.g. from token security/scanning data). Stored on the controller\n * and merged into every analytics event that includes\n * `token_address_destination`. Pass `null` when no security data is\n * available for the selected destination token.\n */\n token_security_type_destination: string | null;\n};\n\nexport type AccountHardwareType =\n | 'Ledger'\n | 'Trezor'\n | 'QR Hardware'\n | 'Lattice'\n | null;\n\nexport type RequestMetadata = {\n slippage_limit?: number; // undefined === auto\n custom_slippage: boolean;\n usd_amount_source: number; // Use quoteResponse when available\n stx_enabled: boolean;\n is_hardware_wallet: boolean;\n account_hardware_type: AccountHardwareType;\n swap_type: MetricsSwapType;\n security_warnings: string[];\n};\n\nexport type QuoteFetchData = {\n can_submit: boolean;\n best_quote_provider?: `${string}_${string}`;\n quotes_count: number;\n quotes_list: `${string}_${string}`[];\n initial_load_time_all_quotes: number;\n price_impact: number;\n has_gas_included_quote: boolean;\n};\n\nexport type TradeData = {\n usd_quoted_gas: number;\n gas_included: boolean;\n gas_included_7702: boolean;\n quoted_time_minutes: number;\n usd_quoted_return: number;\n provider: `${string}_${string}`;\n};\n\nexport type TxStatusData = {\n allowance_reset_transaction?: StatusTypes;\n approval_transaction?: StatusTypes;\n source_transaction?: StatusTypes;\n destination_transaction?: StatusTypes;\n};\n\nexport type InputPrimaryDenominationData = {\n input_primary_denomination?: InputPrimaryDenomination;\n};\n\nexport type InputKeys =\n | 'token_source'\n | 'token_destination'\n | 'chain_source'\n | 'chain_destination'\n | 'slippage'\n | 'token_amount_source';\n\nexport type InputValues = {\n token_source: CaipAssetType;\n token_destination: CaipAssetType;\n chain_source: CaipChainId;\n chain_destination: CaipChainId;\n slippage: number;\n token_amount_source: string;\n};\n\nexport type QuoteWarning =\n | 'low_return'\n | 'no_quotes'\n | 'insufficient_gas_balance'\n | 'insufficient_gas_for_selected_quote'\n | 'insufficient_balance'\n | 'market_closed'\n | 'price_impact'\n | 'quote_expired'\n | 'tx_alert';\n\n/**\n * Properties that are required to be provided when trackUnifiedSwapBridgeEvent is called.\n * This is the base type without the `location` property which is added to all events\n * via the RequiredEventContextFromClient mapped type.\n */\ntype RequiredEventContextFromClientBase = {\n [UnifiedSwapBridgeEventName.ButtonClicked]: Pick<\n RequestParams,\n 'token_symbol_source' | 'token_symbol_destination'\n > & { environment_type?: string };\n // When type is object, the payload can be anything\n [UnifiedSwapBridgeEventName.PageViewed]: object;\n [UnifiedSwapBridgeEventName.InputChanged]: {\n input:\n | 'token_source'\n | 'token_destination'\n | 'chain_source'\n | 'chain_destination'\n | 'slippage'\n | 'token_amount_source';\n input_value: InputValues[keyof InputValues];\n input_amount_preset?: string;\n } & InputPrimaryDenominationData;\n [UnifiedSwapBridgeEventName.FiatCryptoToggleClicked]: {\n token_symbol_source: string;\n token_symbol_destination: string | null;\n previous_primary_denomination: InputPrimaryDenomination;\n new_primary_denomination: InputPrimaryDenomination;\n };\n [UnifiedSwapBridgeEventName.InputSourceDestinationSwitched]: {\n token_symbol_source: RequestParams['token_symbol_source'];\n token_symbol_destination: RequestParams['token_symbol_destination'];\n token_address_source: RequestParams['token_address_source'];\n token_address_destination: RequestParams['token_address_destination'];\n token_security_type_destination: RequestParams['token_security_type_destination'];\n chain_id_source: RequestParams['chain_id_source'];\n chain_id_destination: RequestParams['chain_id_destination'];\n } & Pick<RequestMetadata, 'security_warnings'>;\n [UnifiedSwapBridgeEventName.QuotesRequested]: Pick<\n RequestMetadata,\n 'stx_enabled' | 'usd_amount_source'\n > & {\n token_symbol_source: RequestParams['token_symbol_source'];\n token_symbol_destination: RequestParams['token_symbol_destination'];\n token_security_type_destination: RequestParams['token_security_type_destination'];\n } & InputPrimaryDenominationData;\n [UnifiedSwapBridgeEventName.QuotesReceived]: TradeData &\n InputPrimaryDenominationData & {\n warnings: QuoteWarning[];\n best_quote_provider: QuoteFetchData['best_quote_provider'];\n price_impact: QuoteFetchData['price_impact'];\n can_submit: QuoteFetchData['can_submit'];\n usd_balance_source?: number;\n has_sufficient_gas_for_quote?: boolean | null;\n };\n [UnifiedSwapBridgeEventName.QuotesError]: Pick<\n RequestMetadata,\n 'stx_enabled'\n > & {\n token_symbol_source: RequestParams['token_symbol_source'];\n token_symbol_destination: RequestParams['token_symbol_destination'];\n } & Pick<RequestMetadata, 'security_warnings'>;\n // Emitted by BridgeStatusController\n [UnifiedSwapBridgeEventName.Submitted]: TradeData &\n Pick<QuoteFetchData, 'price_impact'> &\n Omit<RequestMetadata, 'security_warnings'> &\n Pick<\n RequestParams,\n | 'token_symbol_source'\n | 'token_symbol_destination'\n | 'token_address_source'\n | 'token_address_destination'\n | 'chain_id_source'\n | 'chain_id_destination'\n | 'token_security_type_destination'\n > & {\n action_type: MetricsActionType;\n batch_id?: string;\n } & InputPrimaryDenominationData;\n [UnifiedSwapBridgeEventName.Completed]: TradeData &\n Pick<QuoteFetchData, 'price_impact'> &\n Omit<RequestMetadata, 'security_warnings'> &\n TxStatusData &\n RequestParams & {\n actual_time_minutes: number;\n usd_actual_return: number;\n usd_actual_gas: number;\n quote_vs_execution_ratio: number;\n quoted_vs_used_gas_ratio: number;\n action_type: MetricsActionType;\n batch_id?: string;\n } & InputPrimaryDenominationData;\n [UnifiedSwapBridgeEventName.Failed]: (\n | // Tx failed before confirmation\n (Pick<\n RequestMetadata,\n | 'stx_enabled'\n | 'usd_amount_source'\n | 'is_hardware_wallet'\n | 'account_hardware_type'\n > &\n Pick<\n RequestParams,\n | 'token_symbol_source'\n | 'token_symbol_destination'\n | 'token_address_source'\n | 'token_address_destination'\n | 'token_security_type_destination'\n >)\n // Tx failed after confirmation\n | (RequestParams &\n RequestMetadata &\n TxStatusData & {\n actual_time_minutes: number;\n })\n ) &\n TradeData &\n Pick<QuoteFetchData, 'price_impact'> & {\n error_message: string;\n batch_id?: string;\n };\n [UnifiedSwapBridgeEventName.PollingStatusUpdated]: {\n polling_status: PollingStatus;\n retry_attempts: number;\n };\n [UnifiedSwapBridgeEventName.StatusValidationFailed]: {\n failures: string[];\n refresh_count: number;\n };\n // Emitted by clients\n [UnifiedSwapBridgeEventName.AllQuotesOpened]: Pick<\n TradeData,\n 'gas_included'\n > &\n Pick<QuoteFetchData, 'price_impact'> &\n Pick<RequestParams, 'token_symbol_source' | 'token_symbol_destination'> & {\n stx_enabled: RequestMetadata['stx_enabled'];\n can_submit: QuoteFetchData['can_submit'];\n };\n [UnifiedSwapBridgeEventName.AllQuotesSorted]: Pick<\n TradeData,\n 'gas_included'\n > &\n Pick<QuoteFetchData, 'price_impact'> &\n Pick<RequestParams, 'token_symbol_source' | 'token_symbol_destination'> & {\n stx_enabled: RequestMetadata['stx_enabled'];\n sort_order: SortOrder;\n best_quote_provider: QuoteFetchData['best_quote_provider'];\n can_submit: QuoteFetchData['can_submit'];\n };\n [UnifiedSwapBridgeEventName.QuoteSelected]: TradeData & {\n is_best_quote: boolean;\n best_quote_provider: QuoteFetchData['best_quote_provider'];\n price_impact: QuoteFetchData['price_impact'];\n can_submit: QuoteFetchData['can_submit'];\n };\n [UnifiedSwapBridgeEventName.AssetDetailTooltipClicked]: {\n token_name: string;\n token_symbol: string;\n token_contract: string;\n chain_name: string;\n chain_id: string;\n };\n [UnifiedSwapBridgeEventName.QuotesValidationFailed]: {\n failures: string[];\n };\n [UnifiedSwapBridgeEventName.AssetPickerOpened]: {\n asset_location: 'source' | 'destination';\n };\n};\n\n/**\n * Properties that are required to be provided when trackUnifiedSwapBridgeEvent is called.\n * This combines the event-specific properties from RequiredEventContextFromClientBase\n * with an optional `location` property. When `location` is omitted, the controller\n * falls back to the value stored via `setLocation()` (defaults to MainView).\n *\n * `ab_tests` is the legacy field and `active_ab_tests` is the newer field.\n * Both are kept for a migration window and are treated as separate payloads.\n */\nexport type RequiredEventContextFromClient = {\n [K in keyof RequiredEventContextFromClientBase]: RequiredEventContextFromClientBase[K] & {\n location?: MetaMetricsSwapsEventSource;\n ab_tests?: Record<string, string>;\n active_ab_tests?: { key: string; value: string }[];\n feature_id: FeatureId;\n };\n};\n\n/**\n * Properties that can be derived from the bridge controller state\n */\nexport type EventPropertiesFromControllerState = {\n [UnifiedSwapBridgeEventName.ButtonClicked]: RequestParams;\n [UnifiedSwapBridgeEventName.PageViewed]: RequestParams &\n Omit<\n RequestMetadata,\n 'stx_enabled' | 'usd_amount_source' | 'security_warnings'\n > &\n InputPrimaryDenominationData;\n [UnifiedSwapBridgeEventName.InputChanged]: {\n input: InputKeys;\n input_value: string;\n } & InputPrimaryDenominationData;\n [UnifiedSwapBridgeEventName.FiatCryptoToggleClicked]: RequestParams &\n Pick<RequestMetadata, 'swap_type'>;\n [UnifiedSwapBridgeEventName.InputSourceDestinationSwitched]: RequestParams;\n [UnifiedSwapBridgeEventName.QuotesRequested]: RequestParams &\n RequestMetadata & {\n has_sufficient_funds: boolean;\n } & InputPrimaryDenominationData;\n [UnifiedSwapBridgeEventName.QuotesReceived]: RequestParams &\n RequestMetadata &\n QuoteFetchData &\n TradeData & {\n refresh_count: number; // starts from 0\n } & InputPrimaryDenominationData;\n [UnifiedSwapBridgeEventName.QuotesError]: RequestParams &\n RequestMetadata & {\n has_sufficient_funds: boolean;\n error_message: string;\n };\n [UnifiedSwapBridgeEventName.Submitted]: null;\n [UnifiedSwapBridgeEventName.Completed]: null;\n [UnifiedSwapBridgeEventName.Failed]: RequestParams &\n RequestMetadata &\n TxStatusData &\n TradeData &\n Pick<QuoteFetchData, 'price_impact'> & {\n actual_time_minutes: number;\n };\n [UnifiedSwapBridgeEventName.AllQuotesOpened]: RequestParams &\n RequestMetadata &\n TradeData &\n QuoteFetchData;\n [UnifiedSwapBridgeEventName.AllQuotesSorted]: RequestParams &\n RequestMetadata &\n TradeData &\n QuoteFetchData;\n [UnifiedSwapBridgeEventName.QuoteSelected]: RequestParams &\n RequestMetadata &\n QuoteFetchData &\n TradeData;\n [UnifiedSwapBridgeEventName.AssetDetailTooltipClicked]: null;\n [UnifiedSwapBridgeEventName.QuotesValidationFailed]: RequestParams & {\n refresh_count: number;\n };\n [UnifiedSwapBridgeEventName.StatusValidationFailed]: RequestParams;\n [UnifiedSwapBridgeEventName.AssetPickerOpened]: null;\n [UnifiedSwapBridgeEventName.PollingStatusUpdated]: TradeData &\n Pick<QuoteFetchData, 'price_impact'> &\n Omit<RequestMetadata, 'security_warnings'> &\n Pick<\n RequestParams,\n | 'token_symbol_source'\n | 'token_symbol_destination'\n | 'chain_id_source'\n | 'chain_id_destination'\n > & {\n batch_id?: string;\n };\n};\n\n/**\n * trackUnifiedSwapBridgeEvent payload properties consist of required properties from the client\n * and properties from the bridge controller\n *\n * `ab_tests` will be deprecated in favor of `active_ab_tests` in the future.\n * `ab_tests` and `active_ab_tests` intentionally coexist during migration.\n */\nexport type CrossChainSwapsEventProperties<\n T extends UnifiedSwapBridgeEventName,\n> =\n | {\n feature_id: FeatureId;\n action_type: MetricsActionType;\n location: MetaMetricsSwapsEventSource;\n ab_tests?: Record<string, string>;\n active_ab_tests?: { key: string; value: string }[];\n }\n | Pick<EventPropertiesFromControllerState, T>[T]\n | Pick<RequiredEventContextFromClient, T>[T];\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { CaipAssetType, CaipChainId } from "@metamask/utils";
|
|
2
|
-
import type { FeatureId, SortOrder, StatusTypes } from "../../types.cjs";
|
|
2
|
+
import type { FeatureId, InputPrimaryDenomination, SortOrder, StatusTypes } from "../../types.cjs";
|
|
3
3
|
import type { UnifiedSwapBridgeEventName, MetaMetricsSwapsEventSource, MetricsActionType, MetricsSwapType, PollingStatus } from "./constants.cjs";
|
|
4
4
|
/**
|
|
5
5
|
* These properties map to properties required by the segment-schema. For example: https://github.com/Consensys/segment-schema/blob/main/libraries/properties/cross-chain-swaps-action.yaml
|
|
@@ -54,6 +54,9 @@ export type TxStatusData = {
|
|
|
54
54
|
source_transaction?: StatusTypes;
|
|
55
55
|
destination_transaction?: StatusTypes;
|
|
56
56
|
};
|
|
57
|
+
export type InputPrimaryDenominationData = {
|
|
58
|
+
input_primary_denomination?: InputPrimaryDenomination;
|
|
59
|
+
};
|
|
57
60
|
export type InputKeys = 'token_source' | 'token_destination' | 'chain_source' | 'chain_destination' | 'slippage' | 'token_amount_source';
|
|
58
61
|
export type InputValues = {
|
|
59
62
|
token_source: CaipAssetType;
|
|
@@ -78,6 +81,12 @@ type RequiredEventContextFromClientBase = {
|
|
|
78
81
|
input: 'token_source' | 'token_destination' | 'chain_source' | 'chain_destination' | 'slippage' | 'token_amount_source';
|
|
79
82
|
input_value: InputValues[keyof InputValues];
|
|
80
83
|
input_amount_preset?: string;
|
|
84
|
+
} & InputPrimaryDenominationData;
|
|
85
|
+
[UnifiedSwapBridgeEventName.FiatCryptoToggleClicked]: {
|
|
86
|
+
token_symbol_source: string;
|
|
87
|
+
token_symbol_destination: string | null;
|
|
88
|
+
previous_primary_denomination: InputPrimaryDenomination;
|
|
89
|
+
new_primary_denomination: InputPrimaryDenomination;
|
|
81
90
|
};
|
|
82
91
|
[UnifiedSwapBridgeEventName.InputSourceDestinationSwitched]: {
|
|
83
92
|
token_symbol_source: RequestParams['token_symbol_source'];
|
|
@@ -92,8 +101,8 @@ type RequiredEventContextFromClientBase = {
|
|
|
92
101
|
token_symbol_source: RequestParams['token_symbol_source'];
|
|
93
102
|
token_symbol_destination: RequestParams['token_symbol_destination'];
|
|
94
103
|
token_security_type_destination: RequestParams['token_security_type_destination'];
|
|
95
|
-
};
|
|
96
|
-
[UnifiedSwapBridgeEventName.QuotesReceived]: TradeData & {
|
|
104
|
+
} & InputPrimaryDenominationData;
|
|
105
|
+
[UnifiedSwapBridgeEventName.QuotesReceived]: TradeData & InputPrimaryDenominationData & {
|
|
97
106
|
warnings: QuoteWarning[];
|
|
98
107
|
best_quote_provider: QuoteFetchData['best_quote_provider'];
|
|
99
108
|
price_impact: QuoteFetchData['price_impact'];
|
|
@@ -108,7 +117,7 @@ type RequiredEventContextFromClientBase = {
|
|
|
108
117
|
[UnifiedSwapBridgeEventName.Submitted]: TradeData & Pick<QuoteFetchData, 'price_impact'> & Omit<RequestMetadata, 'security_warnings'> & Pick<RequestParams, 'token_symbol_source' | 'token_symbol_destination' | 'token_address_source' | 'token_address_destination' | 'chain_id_source' | 'chain_id_destination' | 'token_security_type_destination'> & {
|
|
109
118
|
action_type: MetricsActionType;
|
|
110
119
|
batch_id?: string;
|
|
111
|
-
};
|
|
120
|
+
} & InputPrimaryDenominationData;
|
|
112
121
|
[UnifiedSwapBridgeEventName.Completed]: TradeData & Pick<QuoteFetchData, 'price_impact'> & Omit<RequestMetadata, 'security_warnings'> & TxStatusData & RequestParams & {
|
|
113
122
|
actual_time_minutes: number;
|
|
114
123
|
usd_actual_return: number;
|
|
@@ -117,7 +126,7 @@ type RequiredEventContextFromClientBase = {
|
|
|
117
126
|
quoted_vs_used_gas_ratio: number;
|
|
118
127
|
action_type: MetricsActionType;
|
|
119
128
|
batch_id?: string;
|
|
120
|
-
};
|
|
129
|
+
} & InputPrimaryDenominationData;
|
|
121
130
|
[UnifiedSwapBridgeEventName.Failed]: (// Tx failed before confirmation
|
|
122
131
|
(Pick<RequestMetadata, 'stx_enabled' | 'usd_amount_source' | 'is_hardware_wallet' | 'account_hardware_type'> & Pick<RequestParams, 'token_symbol_source' | 'token_symbol_destination' | 'token_address_source' | 'token_address_destination' | 'token_security_type_destination'>) | (RequestParams & RequestMetadata & TxStatusData & {
|
|
123
132
|
actual_time_minutes: number;
|
|
@@ -188,18 +197,19 @@ export type RequiredEventContextFromClient = {
|
|
|
188
197
|
*/
|
|
189
198
|
export type EventPropertiesFromControllerState = {
|
|
190
199
|
[UnifiedSwapBridgeEventName.ButtonClicked]: RequestParams;
|
|
191
|
-
[UnifiedSwapBridgeEventName.PageViewed]: RequestParams & Omit<RequestMetadata, 'stx_enabled' | 'usd_amount_source' | 'security_warnings'
|
|
200
|
+
[UnifiedSwapBridgeEventName.PageViewed]: RequestParams & Omit<RequestMetadata, 'stx_enabled' | 'usd_amount_source' | 'security_warnings'> & InputPrimaryDenominationData;
|
|
192
201
|
[UnifiedSwapBridgeEventName.InputChanged]: {
|
|
193
202
|
input: InputKeys;
|
|
194
203
|
input_value: string;
|
|
195
|
-
};
|
|
204
|
+
} & InputPrimaryDenominationData;
|
|
205
|
+
[UnifiedSwapBridgeEventName.FiatCryptoToggleClicked]: RequestParams & Pick<RequestMetadata, 'swap_type'>;
|
|
196
206
|
[UnifiedSwapBridgeEventName.InputSourceDestinationSwitched]: RequestParams;
|
|
197
207
|
[UnifiedSwapBridgeEventName.QuotesRequested]: RequestParams & RequestMetadata & {
|
|
198
208
|
has_sufficient_funds: boolean;
|
|
199
|
-
};
|
|
209
|
+
} & InputPrimaryDenominationData;
|
|
200
210
|
[UnifiedSwapBridgeEventName.QuotesReceived]: RequestParams & RequestMetadata & QuoteFetchData & TradeData & {
|
|
201
211
|
refresh_count: number;
|
|
202
|
-
};
|
|
212
|
+
} & InputPrimaryDenominationData;
|
|
203
213
|
[UnifiedSwapBridgeEventName.QuotesError]: RequestParams & RequestMetadata & {
|
|
204
214
|
has_sufficient_funds: boolean;
|
|
205
215
|
error_message: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.cts","sourceRoot":"","sources":["../../../src/utils/metrics/types.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,wBAAwB;AAElE,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"types.d.cts","sourceRoot":"","sources":["../../../src/utils/metrics/types.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,wBAAwB;AAElE,OAAO,KAAK,EACV,SAAS,EACT,wBAAwB,EACxB,SAAS,EACT,WAAW,EACZ,wBAAoB;AACrB,OAAO,KAAK,EACV,0BAA0B,EAC1B,2BAA2B,EAC3B,iBAAiB,EACjB,eAAe,EACf,aAAa,EACd,wBAAoB;AAErB;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG;IAC1B,eAAe,EAAE,WAAW,CAAC;IAC7B,oBAAoB,EAAE,WAAW,GAAG,IAAI,CAAC;IACzC,mBAAmB,EAAE,MAAM,CAAC;IAC5B,wBAAwB,EAAE,MAAM,GAAG,IAAI,CAAC;IACxC,oBAAoB,EAAE,aAAa,CAAC;IACpC,yBAAyB,EAAE,aAAa,GAAG,IAAI,CAAC;IAChD;;;;;;OAMG;IACH,+BAA+B,EAAE,MAAM,GAAG,IAAI,CAAC;CAChD,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAC3B,QAAQ,GACR,QAAQ,GACR,aAAa,GACb,SAAS,GACT,IAAI,CAAC;AAET,MAAM,MAAM,eAAe,GAAG;IAC5B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,eAAe,EAAE,OAAO,CAAC;IACzB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,WAAW,EAAE,OAAO,CAAC;IACrB,kB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C,EAAE,IAAI,CAAC;IACrD,CAAC,0BAA0B,CAAC,oBAAoB,CAAC,EAAE,SAAS,GAC1D,IAAI,CAAC,cAAc,EAAE,cAAc,CAAC,GACpC,IAAI,CAAC,eAAe,EAAE,mBAAmB,CAAC,GAC1C,IAAI,CACF,aAAa,EACX,qBAAqB,GACrB,0BAA0B,GAC1B,iBAAiB,GACjB,sBAAsB,CACzB,GAAG;QACF,QAAQ,CAAC,EAAE,MAAM,CAAC;KACnB,CAAC;CACL,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,MAAM,8BAA8B,CACxC,CAAC,SAAS,0BAA0B,IAElC;IACE,UAAU,EAAE,SAAS,CAAC;IACtB,WAAW,EAAE,iBAAiB,CAAC;IAC/B,QAAQ,EAAE,2BAA2B,CAAC;IACtC,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAClC,eAAe,CAAC,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;CACpD,GACD,IAAI,CAAC,kCAAkC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,GAC9C,IAAI,CAAC,8BAA8B,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { CaipAssetType, CaipChainId } from "@metamask/utils";
|
|
2
|
-
import type { FeatureId, SortOrder, StatusTypes } from "../../types.mjs";
|
|
2
|
+
import type { FeatureId, InputPrimaryDenomination, SortOrder, StatusTypes } from "../../types.mjs";
|
|
3
3
|
import type { UnifiedSwapBridgeEventName, MetaMetricsSwapsEventSource, MetricsActionType, MetricsSwapType, PollingStatus } from "./constants.mjs";
|
|
4
4
|
/**
|
|
5
5
|
* These properties map to properties required by the segment-schema. For example: https://github.com/Consensys/segment-schema/blob/main/libraries/properties/cross-chain-swaps-action.yaml
|
|
@@ -54,6 +54,9 @@ export type TxStatusData = {
|
|
|
54
54
|
source_transaction?: StatusTypes;
|
|
55
55
|
destination_transaction?: StatusTypes;
|
|
56
56
|
};
|
|
57
|
+
export type InputPrimaryDenominationData = {
|
|
58
|
+
input_primary_denomination?: InputPrimaryDenomination;
|
|
59
|
+
};
|
|
57
60
|
export type InputKeys = 'token_source' | 'token_destination' | 'chain_source' | 'chain_destination' | 'slippage' | 'token_amount_source';
|
|
58
61
|
export type InputValues = {
|
|
59
62
|
token_source: CaipAssetType;
|
|
@@ -78,6 +81,12 @@ type RequiredEventContextFromClientBase = {
|
|
|
78
81
|
input: 'token_source' | 'token_destination' | 'chain_source' | 'chain_destination' | 'slippage' | 'token_amount_source';
|
|
79
82
|
input_value: InputValues[keyof InputValues];
|
|
80
83
|
input_amount_preset?: string;
|
|
84
|
+
} & InputPrimaryDenominationData;
|
|
85
|
+
[UnifiedSwapBridgeEventName.FiatCryptoToggleClicked]: {
|
|
86
|
+
token_symbol_source: string;
|
|
87
|
+
token_symbol_destination: string | null;
|
|
88
|
+
previous_primary_denomination: InputPrimaryDenomination;
|
|
89
|
+
new_primary_denomination: InputPrimaryDenomination;
|
|
81
90
|
};
|
|
82
91
|
[UnifiedSwapBridgeEventName.InputSourceDestinationSwitched]: {
|
|
83
92
|
token_symbol_source: RequestParams['token_symbol_source'];
|
|
@@ -92,8 +101,8 @@ type RequiredEventContextFromClientBase = {
|
|
|
92
101
|
token_symbol_source: RequestParams['token_symbol_source'];
|
|
93
102
|
token_symbol_destination: RequestParams['token_symbol_destination'];
|
|
94
103
|
token_security_type_destination: RequestParams['token_security_type_destination'];
|
|
95
|
-
};
|
|
96
|
-
[UnifiedSwapBridgeEventName.QuotesReceived]: TradeData & {
|
|
104
|
+
} & InputPrimaryDenominationData;
|
|
105
|
+
[UnifiedSwapBridgeEventName.QuotesReceived]: TradeData & InputPrimaryDenominationData & {
|
|
97
106
|
warnings: QuoteWarning[];
|
|
98
107
|
best_quote_provider: QuoteFetchData['best_quote_provider'];
|
|
99
108
|
price_impact: QuoteFetchData['price_impact'];
|
|
@@ -108,7 +117,7 @@ type RequiredEventContextFromClientBase = {
|
|
|
108
117
|
[UnifiedSwapBridgeEventName.Submitted]: TradeData & Pick<QuoteFetchData, 'price_impact'> & Omit<RequestMetadata, 'security_warnings'> & Pick<RequestParams, 'token_symbol_source' | 'token_symbol_destination' | 'token_address_source' | 'token_address_destination' | 'chain_id_source' | 'chain_id_destination' | 'token_security_type_destination'> & {
|
|
109
118
|
action_type: MetricsActionType;
|
|
110
119
|
batch_id?: string;
|
|
111
|
-
};
|
|
120
|
+
} & InputPrimaryDenominationData;
|
|
112
121
|
[UnifiedSwapBridgeEventName.Completed]: TradeData & Pick<QuoteFetchData, 'price_impact'> & Omit<RequestMetadata, 'security_warnings'> & TxStatusData & RequestParams & {
|
|
113
122
|
actual_time_minutes: number;
|
|
114
123
|
usd_actual_return: number;
|
|
@@ -117,7 +126,7 @@ type RequiredEventContextFromClientBase = {
|
|
|
117
126
|
quoted_vs_used_gas_ratio: number;
|
|
118
127
|
action_type: MetricsActionType;
|
|
119
128
|
batch_id?: string;
|
|
120
|
-
};
|
|
129
|
+
} & InputPrimaryDenominationData;
|
|
121
130
|
[UnifiedSwapBridgeEventName.Failed]: (// Tx failed before confirmation
|
|
122
131
|
(Pick<RequestMetadata, 'stx_enabled' | 'usd_amount_source' | 'is_hardware_wallet' | 'account_hardware_type'> & Pick<RequestParams, 'token_symbol_source' | 'token_symbol_destination' | 'token_address_source' | 'token_address_destination' | 'token_security_type_destination'>) | (RequestParams & RequestMetadata & TxStatusData & {
|
|
123
132
|
actual_time_minutes: number;
|
|
@@ -188,18 +197,19 @@ export type RequiredEventContextFromClient = {
|
|
|
188
197
|
*/
|
|
189
198
|
export type EventPropertiesFromControllerState = {
|
|
190
199
|
[UnifiedSwapBridgeEventName.ButtonClicked]: RequestParams;
|
|
191
|
-
[UnifiedSwapBridgeEventName.PageViewed]: RequestParams & Omit<RequestMetadata, 'stx_enabled' | 'usd_amount_source' | 'security_warnings'
|
|
200
|
+
[UnifiedSwapBridgeEventName.PageViewed]: RequestParams & Omit<RequestMetadata, 'stx_enabled' | 'usd_amount_source' | 'security_warnings'> & InputPrimaryDenominationData;
|
|
192
201
|
[UnifiedSwapBridgeEventName.InputChanged]: {
|
|
193
202
|
input: InputKeys;
|
|
194
203
|
input_value: string;
|
|
195
|
-
};
|
|
204
|
+
} & InputPrimaryDenominationData;
|
|
205
|
+
[UnifiedSwapBridgeEventName.FiatCryptoToggleClicked]: RequestParams & Pick<RequestMetadata, 'swap_type'>;
|
|
196
206
|
[UnifiedSwapBridgeEventName.InputSourceDestinationSwitched]: RequestParams;
|
|
197
207
|
[UnifiedSwapBridgeEventName.QuotesRequested]: RequestParams & RequestMetadata & {
|
|
198
208
|
has_sufficient_funds: boolean;
|
|
199
|
-
};
|
|
209
|
+
} & InputPrimaryDenominationData;
|
|
200
210
|
[UnifiedSwapBridgeEventName.QuotesReceived]: RequestParams & RequestMetadata & QuoteFetchData & TradeData & {
|
|
201
211
|
refresh_count: number;
|
|
202
|
-
};
|
|
212
|
+
} & InputPrimaryDenominationData;
|
|
203
213
|
[UnifiedSwapBridgeEventName.QuotesError]: RequestParams & RequestMetadata & {
|
|
204
214
|
has_sufficient_funds: boolean;
|
|
205
215
|
error_message: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.mts","sourceRoot":"","sources":["../../../src/utils/metrics/types.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,wBAAwB;AAElE,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"types.d.mts","sourceRoot":"","sources":["../../../src/utils/metrics/types.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,wBAAwB;AAElE,OAAO,KAAK,EACV,SAAS,EACT,wBAAwB,EACxB,SAAS,EACT,WAAW,EACZ,wBAAoB;AACrB,OAAO,KAAK,EACV,0BAA0B,EAC1B,2BAA2B,E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AE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;CACpD,GACD,IAAI,CAAC,kCAAkC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,GAC9C,IAAI,CAAC,8BAA8B,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.mjs","sourceRoot":"","sources":["../../../src/utils/metrics/types.ts"],"names":[],"mappings":"","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\nimport type { CaipAssetType, CaipChainId } from '@metamask/utils';\n\nimport type { FeatureId, SortOrder, StatusTypes } from '../../types';\nimport type {\n UnifiedSwapBridgeEventName,\n MetaMetricsSwapsEventSource,\n MetricsActionType,\n MetricsSwapType,\n PollingStatus,\n} from './constants';\n\n/**\n * These properties map to properties required by the segment-schema. For example: https://github.com/Consensys/segment-schema/blob/main/libraries/properties/cross-chain-swaps-action.yaml\n */\nexport type RequestParams = {\n chain_id_source: CaipChainId;\n chain_id_destination: CaipChainId | null;\n token_symbol_source: string;\n token_symbol_destination: string | null;\n token_address_source: CaipAssetType;\n token_address_destination: CaipAssetType | null;\n /**\n * Client-supplied security classification for the destination token\n * (e.g. from token security/scanning data). Stored on the controller\n * and merged into every analytics event that includes\n * `token_address_destination`. Pass `null` when no security data is\n * available for the selected destination token.\n */\n token_security_type_destination: string | null;\n};\n\nexport type AccountHardwareType =\n | 'Ledger'\n | 'Trezor'\n | 'QR Hardware'\n | 'Lattice'\n | null;\n\nexport type RequestMetadata = {\n slippage_limit?: number; // undefined === auto\n custom_slippage: boolean;\n usd_amount_source: number; // Use quoteResponse when available\n stx_enabled: boolean;\n is_hardware_wallet: boolean;\n account_hardware_type: AccountHardwareType;\n swap_type: MetricsSwapType;\n security_warnings: string[];\n};\n\nexport type QuoteFetchData = {\n can_submit: boolean;\n best_quote_provider?: `${string}_${string}`;\n quotes_count: number;\n quotes_list: `${string}_${string}`[];\n initial_load_time_all_quotes: number;\n price_impact: number;\n has_gas_included_quote: boolean;\n};\n\nexport type TradeData = {\n usd_quoted_gas: number;\n gas_included: boolean;\n gas_included_7702: boolean;\n quoted_time_minutes: number;\n usd_quoted_return: number;\n provider: `${string}_${string}`;\n};\n\nexport type TxStatusData = {\n allowance_reset_transaction?: StatusTypes;\n approval_transaction?: StatusTypes;\n source_transaction?: StatusTypes;\n destination_transaction?: StatusTypes;\n};\n\nexport type InputKeys =\n | 'token_source'\n | 'token_destination'\n | 'chain_source'\n | 'chain_destination'\n | 'slippage'\n | 'token_amount_source';\n\nexport type InputValues = {\n token_source: CaipAssetType;\n token_destination: CaipAssetType;\n chain_source: CaipChainId;\n chain_destination: CaipChainId;\n slippage: number;\n token_amount_source: string;\n};\n\nexport type QuoteWarning =\n | 'low_return'\n | 'no_quotes'\n | 'insufficient_gas_balance'\n | 'insufficient_gas_for_selected_quote'\n | 'insufficient_balance'\n | 'market_closed'\n | 'price_impact'\n | 'quote_expired'\n | 'tx_alert';\n\n/**\n * Properties that are required to be provided when trackUnifiedSwapBridgeEvent is called.\n * This is the base type without the `location` property which is added to all events\n * via the RequiredEventContextFromClient mapped type.\n */\ntype RequiredEventContextFromClientBase = {\n [UnifiedSwapBridgeEventName.ButtonClicked]: Pick<\n RequestParams,\n 'token_symbol_source' | 'token_symbol_destination'\n > & { environment_type?: string };\n // When type is object, the payload can be anything\n [UnifiedSwapBridgeEventName.PageViewed]: object;\n [UnifiedSwapBridgeEventName.InputChanged]: {\n input:\n | 'token_source'\n | 'token_destination'\n | 'chain_source'\n | 'chain_destination'\n | 'slippage'\n | 'token_amount_source';\n input_value: InputValues[keyof InputValues];\n input_amount_preset?: string;\n };\n [UnifiedSwapBridgeEventName.InputSourceDestinationSwitched]: {\n token_symbol_source: RequestParams['token_symbol_source'];\n token_symbol_destination: RequestParams['token_symbol_destination'];\n token_address_source: RequestParams['token_address_source'];\n token_address_destination: RequestParams['token_address_destination'];\n token_security_type_destination: RequestParams['token_security_type_destination'];\n chain_id_source: RequestParams['chain_id_source'];\n chain_id_destination: RequestParams['chain_id_destination'];\n } & Pick<RequestMetadata, 'security_warnings'>;\n [UnifiedSwapBridgeEventName.QuotesRequested]: Pick<\n RequestMetadata,\n 'stx_enabled' | 'usd_amount_source'\n > & {\n token_symbol_source: RequestParams['token_symbol_source'];\n token_symbol_destination: RequestParams['token_symbol_destination'];\n token_security_type_destination: RequestParams['token_security_type_destination'];\n };\n [UnifiedSwapBridgeEventName.QuotesReceived]: TradeData & {\n warnings: QuoteWarning[];\n best_quote_provider: QuoteFetchData['best_quote_provider'];\n price_impact: QuoteFetchData['price_impact'];\n can_submit: QuoteFetchData['can_submit'];\n usd_balance_source?: number;\n has_sufficient_gas_for_quote?: boolean | null;\n };\n [UnifiedSwapBridgeEventName.QuotesError]: Pick<\n RequestMetadata,\n 'stx_enabled'\n > & {\n token_symbol_source: RequestParams['token_symbol_source'];\n token_symbol_destination: RequestParams['token_symbol_destination'];\n } & Pick<RequestMetadata, 'security_warnings'>;\n // Emitted by BridgeStatusController\n [UnifiedSwapBridgeEventName.Submitted]: TradeData &\n Pick<QuoteFetchData, 'price_impact'> &\n Omit<RequestMetadata, 'security_warnings'> &\n Pick<\n RequestParams,\n | 'token_symbol_source'\n | 'token_symbol_destination'\n | 'token_address_source'\n | 'token_address_destination'\n | 'chain_id_source'\n | 'chain_id_destination'\n | 'token_security_type_destination'\n > & {\n action_type: MetricsActionType;\n batch_id?: string;\n };\n [UnifiedSwapBridgeEventName.Completed]: TradeData &\n Pick<QuoteFetchData, 'price_impact'> &\n Omit<RequestMetadata, 'security_warnings'> &\n TxStatusData &\n RequestParams & {\n actual_time_minutes: number;\n usd_actual_return: number;\n usd_actual_gas: number;\n quote_vs_execution_ratio: number;\n quoted_vs_used_gas_ratio: number;\n action_type: MetricsActionType;\n batch_id?: string;\n };\n [UnifiedSwapBridgeEventName.Failed]: (\n | // Tx failed before confirmation\n (Pick<\n RequestMetadata,\n | 'stx_enabled'\n | 'usd_amount_source'\n | 'is_hardware_wallet'\n | 'account_hardware_type'\n > &\n Pick<\n RequestParams,\n | 'token_symbol_source'\n | 'token_symbol_destination'\n | 'token_address_source'\n | 'token_address_destination'\n | 'token_security_type_destination'\n >)\n // Tx failed after confirmation\n | (RequestParams &\n RequestMetadata &\n TxStatusData & {\n actual_time_minutes: number;\n })\n ) &\n TradeData &\n Pick<QuoteFetchData, 'price_impact'> & {\n error_message: string;\n batch_id?: string;\n };\n [UnifiedSwapBridgeEventName.PollingStatusUpdated]: {\n polling_status: PollingStatus;\n retry_attempts: number;\n };\n [UnifiedSwapBridgeEventName.StatusValidationFailed]: {\n failures: string[];\n refresh_count: number;\n };\n // Emitted by clients\n [UnifiedSwapBridgeEventName.AllQuotesOpened]: Pick<\n TradeData,\n 'gas_included'\n > &\n Pick<QuoteFetchData, 'price_impact'> &\n Pick<RequestParams, 'token_symbol_source' | 'token_symbol_destination'> & {\n stx_enabled: RequestMetadata['stx_enabled'];\n can_submit: QuoteFetchData['can_submit'];\n };\n [UnifiedSwapBridgeEventName.AllQuotesSorted]: Pick<\n TradeData,\n 'gas_included'\n > &\n Pick<QuoteFetchData, 'price_impact'> &\n Pick<RequestParams, 'token_symbol_source' | 'token_symbol_destination'> & {\n stx_enabled: RequestMetadata['stx_enabled'];\n sort_order: SortOrder;\n best_quote_provider: QuoteFetchData['best_quote_provider'];\n can_submit: QuoteFetchData['can_submit'];\n };\n [UnifiedSwapBridgeEventName.QuoteSelected]: TradeData & {\n is_best_quote: boolean;\n best_quote_provider: QuoteFetchData['best_quote_provider'];\n price_impact: QuoteFetchData['price_impact'];\n can_submit: QuoteFetchData['can_submit'];\n };\n [UnifiedSwapBridgeEventName.AssetDetailTooltipClicked]: {\n token_name: string;\n token_symbol: string;\n token_contract: string;\n chain_name: string;\n chain_id: string;\n };\n [UnifiedSwapBridgeEventName.QuotesValidationFailed]: {\n failures: string[];\n };\n [UnifiedSwapBridgeEventName.AssetPickerOpened]: {\n asset_location: 'source' | 'destination';\n };\n};\n\n/**\n * Properties that are required to be provided when trackUnifiedSwapBridgeEvent is called.\n * This combines the event-specific properties from RequiredEventContextFromClientBase\n * with an optional `location` property. When `location` is omitted, the controller\n * falls back to the value stored via `setLocation()` (defaults to MainView).\n *\n * `ab_tests` is the legacy field and `active_ab_tests` is the newer field.\n * Both are kept for a migration window and are treated as separate payloads.\n */\nexport type RequiredEventContextFromClient = {\n [K in keyof RequiredEventContextFromClientBase]: RequiredEventContextFromClientBase[K] & {\n location?: MetaMetricsSwapsEventSource;\n ab_tests?: Record<string, string>;\n active_ab_tests?: { key: string; value: string }[];\n feature_id: FeatureId;\n };\n};\n\n/**\n * Properties that can be derived from the bridge controller state\n */\nexport type EventPropertiesFromControllerState = {\n [UnifiedSwapBridgeEventName.ButtonClicked]: RequestParams;\n [UnifiedSwapBridgeEventName.PageViewed]: RequestParams &\n Omit<\n RequestMetadata,\n 'stx_enabled' | 'usd_amount_source' | 'security_warnings'\n >;\n [UnifiedSwapBridgeEventName.InputChanged]: {\n input: InputKeys;\n input_value: string;\n };\n [UnifiedSwapBridgeEventName.InputSourceDestinationSwitched]: RequestParams;\n [UnifiedSwapBridgeEventName.QuotesRequested]: RequestParams &\n RequestMetadata & {\n has_sufficient_funds: boolean;\n };\n [UnifiedSwapBridgeEventName.QuotesReceived]: RequestParams &\n RequestMetadata &\n QuoteFetchData &\n TradeData & {\n refresh_count: number; // starts from 0\n };\n [UnifiedSwapBridgeEventName.QuotesError]: RequestParams &\n RequestMetadata & {\n has_sufficient_funds: boolean;\n error_message: string;\n };\n [UnifiedSwapBridgeEventName.Submitted]: null;\n [UnifiedSwapBridgeEventName.Completed]: null;\n [UnifiedSwapBridgeEventName.Failed]: RequestParams &\n RequestMetadata &\n TxStatusData &\n TradeData &\n Pick<QuoteFetchData, 'price_impact'> & {\n actual_time_minutes: number;\n };\n [UnifiedSwapBridgeEventName.AllQuotesOpened]: RequestParams &\n RequestMetadata &\n TradeData &\n QuoteFetchData;\n [UnifiedSwapBridgeEventName.AllQuotesSorted]: RequestParams &\n RequestMetadata &\n TradeData &\n QuoteFetchData;\n [UnifiedSwapBridgeEventName.QuoteSelected]: RequestParams &\n RequestMetadata &\n QuoteFetchData &\n TradeData;\n [UnifiedSwapBridgeEventName.AssetDetailTooltipClicked]: null;\n [UnifiedSwapBridgeEventName.QuotesValidationFailed]: RequestParams & {\n refresh_count: number;\n };\n [UnifiedSwapBridgeEventName.StatusValidationFailed]: RequestParams;\n [UnifiedSwapBridgeEventName.AssetPickerOpened]: null;\n [UnifiedSwapBridgeEventName.PollingStatusUpdated]: TradeData &\n Pick<QuoteFetchData, 'price_impact'> &\n Omit<RequestMetadata, 'security_warnings'> &\n Pick<\n RequestParams,\n | 'token_symbol_source'\n | 'token_symbol_destination'\n | 'chain_id_source'\n | 'chain_id_destination'\n > & {\n batch_id?: string;\n };\n};\n\n/**\n * trackUnifiedSwapBridgeEvent payload properties consist of required properties from the client\n * and properties from the bridge controller\n *\n * `ab_tests` will be deprecated in favor of `active_ab_tests` in the future.\n * `ab_tests` and `active_ab_tests` intentionally coexist during migration.\n */\nexport type CrossChainSwapsEventProperties<\n T extends UnifiedSwapBridgeEventName,\n> =\n | {\n feature_id: FeatureId;\n action_type: MetricsActionType;\n location: MetaMetricsSwapsEventSource;\n ab_tests?: Record<string, string>;\n active_ab_tests?: { key: string; value: string }[];\n }\n | Pick<EventPropertiesFromControllerState, T>[T]\n | Pick<RequiredEventContextFromClient, T>[T];\n"]}
|
|
1
|
+
{"version":3,"file":"types.mjs","sourceRoot":"","sources":["../../../src/utils/metrics/types.ts"],"names":[],"mappings":"","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\nimport type { CaipAssetType, CaipChainId } from '@metamask/utils';\n\nimport type {\n FeatureId,\n InputPrimaryDenomination,\n SortOrder,\n StatusTypes,\n} from '../../types';\nimport type {\n UnifiedSwapBridgeEventName,\n MetaMetricsSwapsEventSource,\n MetricsActionType,\n MetricsSwapType,\n PollingStatus,\n} from './constants';\n\n/**\n * These properties map to properties required by the segment-schema. For example: https://github.com/Consensys/segment-schema/blob/main/libraries/properties/cross-chain-swaps-action.yaml\n */\nexport type RequestParams = {\n chain_id_source: CaipChainId;\n chain_id_destination: CaipChainId | null;\n token_symbol_source: string;\n token_symbol_destination: string | null;\n token_address_source: CaipAssetType;\n token_address_destination: CaipAssetType | null;\n /**\n * Client-supplied security classification for the destination token\n * (e.g. from token security/scanning data). Stored on the controller\n * and merged into every analytics event that includes\n * `token_address_destination`. Pass `null` when no security data is\n * available for the selected destination token.\n */\n token_security_type_destination: string | null;\n};\n\nexport type AccountHardwareType =\n | 'Ledger'\n | 'Trezor'\n | 'QR Hardware'\n | 'Lattice'\n | null;\n\nexport type RequestMetadata = {\n slippage_limit?: number; // undefined === auto\n custom_slippage: boolean;\n usd_amount_source: number; // Use quoteResponse when available\n stx_enabled: boolean;\n is_hardware_wallet: boolean;\n account_hardware_type: AccountHardwareType;\n swap_type: MetricsSwapType;\n security_warnings: string[];\n};\n\nexport type QuoteFetchData = {\n can_submit: boolean;\n best_quote_provider?: `${string}_${string}`;\n quotes_count: number;\n quotes_list: `${string}_${string}`[];\n initial_load_time_all_quotes: number;\n price_impact: number;\n has_gas_included_quote: boolean;\n};\n\nexport type TradeData = {\n usd_quoted_gas: number;\n gas_included: boolean;\n gas_included_7702: boolean;\n quoted_time_minutes: number;\n usd_quoted_return: number;\n provider: `${string}_${string}`;\n};\n\nexport type TxStatusData = {\n allowance_reset_transaction?: StatusTypes;\n approval_transaction?: StatusTypes;\n source_transaction?: StatusTypes;\n destination_transaction?: StatusTypes;\n};\n\nexport type InputPrimaryDenominationData = {\n input_primary_denomination?: InputPrimaryDenomination;\n};\n\nexport type InputKeys =\n | 'token_source'\n | 'token_destination'\n | 'chain_source'\n | 'chain_destination'\n | 'slippage'\n | 'token_amount_source';\n\nexport type InputValues = {\n token_source: CaipAssetType;\n token_destination: CaipAssetType;\n chain_source: CaipChainId;\n chain_destination: CaipChainId;\n slippage: number;\n token_amount_source: string;\n};\n\nexport type QuoteWarning =\n | 'low_return'\n | 'no_quotes'\n | 'insufficient_gas_balance'\n | 'insufficient_gas_for_selected_quote'\n | 'insufficient_balance'\n | 'market_closed'\n | 'price_impact'\n | 'quote_expired'\n | 'tx_alert';\n\n/**\n * Properties that are required to be provided when trackUnifiedSwapBridgeEvent is called.\n * This is the base type without the `location` property which is added to all events\n * via the RequiredEventContextFromClient mapped type.\n */\ntype RequiredEventContextFromClientBase = {\n [UnifiedSwapBridgeEventName.ButtonClicked]: Pick<\n RequestParams,\n 'token_symbol_source' | 'token_symbol_destination'\n > & { environment_type?: string };\n // When type is object, the payload can be anything\n [UnifiedSwapBridgeEventName.PageViewed]: object;\n [UnifiedSwapBridgeEventName.InputChanged]: {\n input:\n | 'token_source'\n | 'token_destination'\n | 'chain_source'\n | 'chain_destination'\n | 'slippage'\n | 'token_amount_source';\n input_value: InputValues[keyof InputValues];\n input_amount_preset?: string;\n } & InputPrimaryDenominationData;\n [UnifiedSwapBridgeEventName.FiatCryptoToggleClicked]: {\n token_symbol_source: string;\n token_symbol_destination: string | null;\n previous_primary_denomination: InputPrimaryDenomination;\n new_primary_denomination: InputPrimaryDenomination;\n };\n [UnifiedSwapBridgeEventName.InputSourceDestinationSwitched]: {\n token_symbol_source: RequestParams['token_symbol_source'];\n token_symbol_destination: RequestParams['token_symbol_destination'];\n token_address_source: RequestParams['token_address_source'];\n token_address_destination: RequestParams['token_address_destination'];\n token_security_type_destination: RequestParams['token_security_type_destination'];\n chain_id_source: RequestParams['chain_id_source'];\n chain_id_destination: RequestParams['chain_id_destination'];\n } & Pick<RequestMetadata, 'security_warnings'>;\n [UnifiedSwapBridgeEventName.QuotesRequested]: Pick<\n RequestMetadata,\n 'stx_enabled' | 'usd_amount_source'\n > & {\n token_symbol_source: RequestParams['token_symbol_source'];\n token_symbol_destination: RequestParams['token_symbol_destination'];\n token_security_type_destination: RequestParams['token_security_type_destination'];\n } & InputPrimaryDenominationData;\n [UnifiedSwapBridgeEventName.QuotesReceived]: TradeData &\n InputPrimaryDenominationData & {\n warnings: QuoteWarning[];\n best_quote_provider: QuoteFetchData['best_quote_provider'];\n price_impact: QuoteFetchData['price_impact'];\n can_submit: QuoteFetchData['can_submit'];\n usd_balance_source?: number;\n has_sufficient_gas_for_quote?: boolean | null;\n };\n [UnifiedSwapBridgeEventName.QuotesError]: Pick<\n RequestMetadata,\n 'stx_enabled'\n > & {\n token_symbol_source: RequestParams['token_symbol_source'];\n token_symbol_destination: RequestParams['token_symbol_destination'];\n } & Pick<RequestMetadata, 'security_warnings'>;\n // Emitted by BridgeStatusController\n [UnifiedSwapBridgeEventName.Submitted]: TradeData &\n Pick<QuoteFetchData, 'price_impact'> &\n Omit<RequestMetadata, 'security_warnings'> &\n Pick<\n RequestParams,\n | 'token_symbol_source'\n | 'token_symbol_destination'\n | 'token_address_source'\n | 'token_address_destination'\n | 'chain_id_source'\n | 'chain_id_destination'\n | 'token_security_type_destination'\n > & {\n action_type: MetricsActionType;\n batch_id?: string;\n } & InputPrimaryDenominationData;\n [UnifiedSwapBridgeEventName.Completed]: TradeData &\n Pick<QuoteFetchData, 'price_impact'> &\n Omit<RequestMetadata, 'security_warnings'> &\n TxStatusData &\n RequestParams & {\n actual_time_minutes: number;\n usd_actual_return: number;\n usd_actual_gas: number;\n quote_vs_execution_ratio: number;\n quoted_vs_used_gas_ratio: number;\n action_type: MetricsActionType;\n batch_id?: string;\n } & InputPrimaryDenominationData;\n [UnifiedSwapBridgeEventName.Failed]: (\n | // Tx failed before confirmation\n (Pick<\n RequestMetadata,\n | 'stx_enabled'\n | 'usd_amount_source'\n | 'is_hardware_wallet'\n | 'account_hardware_type'\n > &\n Pick<\n RequestParams,\n | 'token_symbol_source'\n | 'token_symbol_destination'\n | 'token_address_source'\n | 'token_address_destination'\n | 'token_security_type_destination'\n >)\n // Tx failed after confirmation\n | (RequestParams &\n RequestMetadata &\n TxStatusData & {\n actual_time_minutes: number;\n })\n ) &\n TradeData &\n Pick<QuoteFetchData, 'price_impact'> & {\n error_message: string;\n batch_id?: string;\n };\n [UnifiedSwapBridgeEventName.PollingStatusUpdated]: {\n polling_status: PollingStatus;\n retry_attempts: number;\n };\n [UnifiedSwapBridgeEventName.StatusValidationFailed]: {\n failures: string[];\n refresh_count: number;\n };\n // Emitted by clients\n [UnifiedSwapBridgeEventName.AllQuotesOpened]: Pick<\n TradeData,\n 'gas_included'\n > &\n Pick<QuoteFetchData, 'price_impact'> &\n Pick<RequestParams, 'token_symbol_source' | 'token_symbol_destination'> & {\n stx_enabled: RequestMetadata['stx_enabled'];\n can_submit: QuoteFetchData['can_submit'];\n };\n [UnifiedSwapBridgeEventName.AllQuotesSorted]: Pick<\n TradeData,\n 'gas_included'\n > &\n Pick<QuoteFetchData, 'price_impact'> &\n Pick<RequestParams, 'token_symbol_source' | 'token_symbol_destination'> & {\n stx_enabled: RequestMetadata['stx_enabled'];\n sort_order: SortOrder;\n best_quote_provider: QuoteFetchData['best_quote_provider'];\n can_submit: QuoteFetchData['can_submit'];\n };\n [UnifiedSwapBridgeEventName.QuoteSelected]: TradeData & {\n is_best_quote: boolean;\n best_quote_provider: QuoteFetchData['best_quote_provider'];\n price_impact: QuoteFetchData['price_impact'];\n can_submit: QuoteFetchData['can_submit'];\n };\n [UnifiedSwapBridgeEventName.AssetDetailTooltipClicked]: {\n token_name: string;\n token_symbol: string;\n token_contract: string;\n chain_name: string;\n chain_id: string;\n };\n [UnifiedSwapBridgeEventName.QuotesValidationFailed]: {\n failures: string[];\n };\n [UnifiedSwapBridgeEventName.AssetPickerOpened]: {\n asset_location: 'source' | 'destination';\n };\n};\n\n/**\n * Properties that are required to be provided when trackUnifiedSwapBridgeEvent is called.\n * This combines the event-specific properties from RequiredEventContextFromClientBase\n * with an optional `location` property. When `location` is omitted, the controller\n * falls back to the value stored via `setLocation()` (defaults to MainView).\n *\n * `ab_tests` is the legacy field and `active_ab_tests` is the newer field.\n * Both are kept for a migration window and are treated as separate payloads.\n */\nexport type RequiredEventContextFromClient = {\n [K in keyof RequiredEventContextFromClientBase]: RequiredEventContextFromClientBase[K] & {\n location?: MetaMetricsSwapsEventSource;\n ab_tests?: Record<string, string>;\n active_ab_tests?: { key: string; value: string }[];\n feature_id: FeatureId;\n };\n};\n\n/**\n * Properties that can be derived from the bridge controller state\n */\nexport type EventPropertiesFromControllerState = {\n [UnifiedSwapBridgeEventName.ButtonClicked]: RequestParams;\n [UnifiedSwapBridgeEventName.PageViewed]: RequestParams &\n Omit<\n RequestMetadata,\n 'stx_enabled' | 'usd_amount_source' | 'security_warnings'\n > &\n InputPrimaryDenominationData;\n [UnifiedSwapBridgeEventName.InputChanged]: {\n input: InputKeys;\n input_value: string;\n } & InputPrimaryDenominationData;\n [UnifiedSwapBridgeEventName.FiatCryptoToggleClicked]: RequestParams &\n Pick<RequestMetadata, 'swap_type'>;\n [UnifiedSwapBridgeEventName.InputSourceDestinationSwitched]: RequestParams;\n [UnifiedSwapBridgeEventName.QuotesRequested]: RequestParams &\n RequestMetadata & {\n has_sufficient_funds: boolean;\n } & InputPrimaryDenominationData;\n [UnifiedSwapBridgeEventName.QuotesReceived]: RequestParams &\n RequestMetadata &\n QuoteFetchData &\n TradeData & {\n refresh_count: number; // starts from 0\n } & InputPrimaryDenominationData;\n [UnifiedSwapBridgeEventName.QuotesError]: RequestParams &\n RequestMetadata & {\n has_sufficient_funds: boolean;\n error_message: string;\n };\n [UnifiedSwapBridgeEventName.Submitted]: null;\n [UnifiedSwapBridgeEventName.Completed]: null;\n [UnifiedSwapBridgeEventName.Failed]: RequestParams &\n RequestMetadata &\n TxStatusData &\n TradeData &\n Pick<QuoteFetchData, 'price_impact'> & {\n actual_time_minutes: number;\n };\n [UnifiedSwapBridgeEventName.AllQuotesOpened]: RequestParams &\n RequestMetadata &\n TradeData &\n QuoteFetchData;\n [UnifiedSwapBridgeEventName.AllQuotesSorted]: RequestParams &\n RequestMetadata &\n TradeData &\n QuoteFetchData;\n [UnifiedSwapBridgeEventName.QuoteSelected]: RequestParams &\n RequestMetadata &\n QuoteFetchData &\n TradeData;\n [UnifiedSwapBridgeEventName.AssetDetailTooltipClicked]: null;\n [UnifiedSwapBridgeEventName.QuotesValidationFailed]: RequestParams & {\n refresh_count: number;\n };\n [UnifiedSwapBridgeEventName.StatusValidationFailed]: RequestParams;\n [UnifiedSwapBridgeEventName.AssetPickerOpened]: null;\n [UnifiedSwapBridgeEventName.PollingStatusUpdated]: TradeData &\n Pick<QuoteFetchData, 'price_impact'> &\n Omit<RequestMetadata, 'security_warnings'> &\n Pick<\n RequestParams,\n | 'token_symbol_source'\n | 'token_symbol_destination'\n | 'chain_id_source'\n | 'chain_id_destination'\n > & {\n batch_id?: string;\n };\n};\n\n/**\n * trackUnifiedSwapBridgeEvent payload properties consist of required properties from the client\n * and properties from the bridge controller\n *\n * `ab_tests` will be deprecated in favor of `active_ab_tests` in the future.\n * `ab_tests` and `active_ab_tests` intentionally coexist during migration.\n */\nexport type CrossChainSwapsEventProperties<\n T extends UnifiedSwapBridgeEventName,\n> =\n | {\n feature_id: FeatureId;\n action_type: MetricsActionType;\n location: MetaMetricsSwapsEventSource;\n ab_tests?: Record<string, string>;\n active_ab_tests?: { key: string; value: string }[];\n }\n | Pick<EventPropertiesFromControllerState, T>[T]\n | Pick<RequiredEventContextFromClient, T>[T];\n"]}
|
package/package.json
CHANGED