@metamask/bridge-controller 40.0.0 → 41.1.0
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 +23 -1
- package/dist/bridge-controller.cjs +5 -2
- package/dist/bridge-controller.cjs.map +1 -1
- package/dist/bridge-controller.d.cts.map +1 -1
- package/dist/bridge-controller.d.mts.map +1 -1
- package/dist/bridge-controller.mjs +5 -2
- package/dist/bridge-controller.mjs.map +1 -1
- package/dist/selectors.d.cts +78 -0
- package/dist/selectors.d.cts.map +1 -1
- package/dist/selectors.d.mts +78 -0
- package/dist/selectors.d.mts.map +1 -1
- package/dist/types.cjs.map +1 -1
- package/dist/types.d.cts +4 -0
- package/dist/types.d.cts.map +1 -1
- package/dist/types.d.mts +4 -0
- package/dist/types.d.mts.map +1 -1
- package/dist/types.mjs.map +1 -1
- package/dist/utils/fetch.cjs +1 -0
- package/dist/utils/fetch.cjs.map +1 -1
- package/dist/utils/fetch.d.cts.map +1 -1
- package/dist/utils/fetch.d.mts.map +1 -1
- package/dist/utils/fetch.mjs +1 -0
- package/dist/utils/fetch.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 +2 -1
- package/dist/utils/metrics/constants.d.cts.map +1 -1
- package/dist/utils/metrics/constants.d.mts +2 -1
- 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 +14 -3
- package/dist/utils/metrics/types.d.cts.map +1 -1
- package/dist/utils/metrics/types.d.mts +14 -3
- package/dist/utils/metrics/types.d.mts.map +1 -1
- package/dist/utils/metrics/types.mjs.map +1 -1
- package/dist/utils/validators.cjs +4 -0
- package/dist/utils/validators.cjs.map +1 -1
- package/dist/utils/validators.d.cts +12 -0
- package/dist/utils/validators.d.cts.map +1 -1
- package/dist/utils/validators.d.mts +12 -0
- package/dist/utils/validators.d.mts.map +1 -1
- package/dist/utils/validators.mjs +4 -0
- package/dist/utils/validators.mjs.map +1 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.cjs","sourceRoot":"","sources":["../../../src/utils/metrics/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { CaipAssetType, CaipChainId } from '@metamask/utils';\n\nimport type {\n UnifiedSwapBridgeEventName,\n MetaMetricsSwapsEventSource,\n MetricsActionType,\n MetricsSwapType,\n} from './constants';\nimport type { SortOrder, StatusTypes } from '../../types';\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\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 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};\n\nexport type TradeData = {\n usd_quoted_gas: number;\n gas_included: 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\nexport type InputValues = {\n token_source: CaipAssetType;\n token_destination: CaipAssetType;\n chain_source: CaipChainId;\n chain_destination: CaipChainId;\n slippage: number;\n};\n\n/**\n * Properties that are required to be provided when trackUnifiedSwapBridgeEvent is called\n */\nexport type RequiredEventContextFromClient = {\n [UnifiedSwapBridgeEventName.ButtonClicked]: {\n location: MetaMetricsSwapsEventSource;\n } & Pick<RequestParams, 'token_symbol_source' | 'token_symbol_destination'>;\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 input_value: InputValues[keyof InputValues];\n };\n [UnifiedSwapBridgeEventName.InputSourceDestinationFlipped]: {\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 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'\n > & {\n token_symbol_source: RequestParams['token_symbol_source'];\n token_symbol_destination: RequestParams['token_symbol_destination'];\n };\n [UnifiedSwapBridgeEventName.QuotesReceived]: TradeData & {\n warnings: string[]; // TODO standardize warnings\n best_quote_provider: QuoteFetchData['best_quote_provider'];\n price_impact: QuoteFetchData['price_impact'];\n can_submit: QuoteFetchData['can_submit'];\n };\n [UnifiedSwapBridgeEventName.QuoteError]: 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.SnapConfirmationViewed]: Pick<\n QuoteFetchData,\n 'price_impact'\n > &\n TradeData;\n [UnifiedSwapBridgeEventName.Submitted]: TradeData &\n Pick<QuoteFetchData, 'price_impact'> &\n
|
|
1
|
+
{"version":3,"file":"types.cjs","sourceRoot":"","sources":["../../../src/utils/metrics/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { CaipAssetType, CaipChainId } from '@metamask/utils';\n\nimport type {\n UnifiedSwapBridgeEventName,\n MetaMetricsSwapsEventSource,\n MetricsActionType,\n MetricsSwapType,\n} from './constants';\nimport type { SortOrder, StatusTypes } from '../../types';\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\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 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};\n\nexport type TradeData = {\n usd_quoted_gas: number;\n gas_included: 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\nexport type InputValues = {\n token_source: CaipAssetType;\n token_destination: CaipAssetType;\n chain_source: CaipChainId;\n chain_destination: CaipChainId;\n slippage: number;\n};\n\n/**\n * Properties that are required to be provided when trackUnifiedSwapBridgeEvent is called\n */\nexport type RequiredEventContextFromClient = {\n [UnifiedSwapBridgeEventName.ButtonClicked]: {\n location: MetaMetricsSwapsEventSource;\n } & Pick<RequestParams, 'token_symbol_source' | 'token_symbol_destination'>;\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 input_value: InputValues[keyof InputValues];\n };\n [UnifiedSwapBridgeEventName.InputSourceDestinationFlipped]: {\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 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'\n > & {\n token_symbol_source: RequestParams['token_symbol_source'];\n token_symbol_destination: RequestParams['token_symbol_destination'];\n };\n [UnifiedSwapBridgeEventName.QuotesReceived]: TradeData & {\n warnings: string[]; // TODO standardize warnings\n best_quote_provider: QuoteFetchData['best_quote_provider'];\n price_impact: QuoteFetchData['price_impact'];\n can_submit: QuoteFetchData['can_submit'];\n };\n [UnifiedSwapBridgeEventName.QuoteError]: 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.SnapConfirmationViewed]: Pick<\n QuoteFetchData,\n 'price_impact'\n > &\n TradeData;\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 | 'chain_id_source'\n | 'chain_id_destination'\n > & {\n action_type: MetricsActionType;\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 };\n [UnifiedSwapBridgeEventName.Failed]:\n | // Tx failed before confirmation\n (TradeData &\n Pick<QuoteFetchData, 'price_impact'> &\n Pick<RequestMetadata, 'stx_enabled' | 'usd_amount_source'> &\n Pick<\n RequestParams,\n 'token_symbol_source' | 'token_symbol_destination'\n > & { error_message: string }) // Tx failed after confirmation\n | (RequestParams &\n RequestMetadata &\n Pick<QuoteFetchData, 'price_impact'> &\n TxStatusData &\n TradeData & {\n actual_time_minutes: number;\n error_message?: string;\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};\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 [UnifiedSwapBridgeEventName.InputChanged]: {\n input: InputKeys;\n input_value: string;\n };\n [UnifiedSwapBridgeEventName.InputSourceDestinationFlipped]: 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.QuoteError]: RequestParams &\n RequestMetadata & {\n has_sufficient_funds: boolean;\n error_message: string;\n };\n [UnifiedSwapBridgeEventName.SnapConfirmationViewed]: RequestMetadata &\n RequestParams &\n QuoteFetchData &\n TradeData;\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};\n\n/**\n * trackUnifiedSwapBridgeEvent payload properties consist of required properties from the client\n * and properties from the bridge controller\n */\nexport type CrossChainSwapsEventProperties<\n T extends UnifiedSwapBridgeEventName,\n> =\n | {\n action_type: MetricsActionType;\n }\n | Pick<EventPropertiesFromControllerState, T>[T]\n | Pick<RequiredEventContextFromClient, T>[T];\n"]}
|
|
@@ -85,13 +85,16 @@ export type RequiredEventContextFromClient = {
|
|
|
85
85
|
token_symbol_destination: RequestParams['token_symbol_destination'];
|
|
86
86
|
} & Pick<RequestMetadata, 'security_warnings'>;
|
|
87
87
|
[UnifiedSwapBridgeEventName.SnapConfirmationViewed]: Pick<QuoteFetchData, 'price_impact'> & TradeData;
|
|
88
|
-
[UnifiedSwapBridgeEventName.Submitted]: TradeData & Pick<QuoteFetchData, 'price_impact'> &
|
|
89
|
-
|
|
88
|
+
[UnifiedSwapBridgeEventName.Submitted]: TradeData & Pick<QuoteFetchData, 'price_impact'> & Omit<RequestMetadata, 'security_warnings'> & Pick<RequestParams, 'token_symbol_source' | 'token_symbol_destination' | 'chain_id_source' | 'chain_id_destination'> & {
|
|
89
|
+
action_type: MetricsActionType;
|
|
90
|
+
};
|
|
91
|
+
[UnifiedSwapBridgeEventName.Completed]: TradeData & Pick<QuoteFetchData, 'price_impact'> & Omit<RequestMetadata, 'security_warnings'> & TxStatusData & RequestParams & {
|
|
90
92
|
actual_time_minutes: number;
|
|
91
93
|
usd_actual_return: number;
|
|
92
94
|
usd_actual_gas: number;
|
|
93
95
|
quote_vs_execution_ratio: number;
|
|
94
96
|
quoted_vs_used_gas_ratio: number;
|
|
97
|
+
action_type: MetricsActionType;
|
|
95
98
|
};
|
|
96
99
|
[UnifiedSwapBridgeEventName.Failed]: // Tx failed before confirmation
|
|
97
100
|
(TradeData & Pick<QuoteFetchData, 'price_impact'> & Pick<RequestMetadata, 'stx_enabled' | 'usd_amount_source'> & Pick<RequestParams, 'token_symbol_source' | 'token_symbol_destination'> & {
|
|
@@ -116,6 +119,13 @@ export type RequiredEventContextFromClient = {
|
|
|
116
119
|
price_impact: QuoteFetchData['price_impact'];
|
|
117
120
|
can_submit: QuoteFetchData['can_submit'];
|
|
118
121
|
};
|
|
122
|
+
[UnifiedSwapBridgeEventName.AssetDetailTooltipClicked]: {
|
|
123
|
+
token_name: string;
|
|
124
|
+
token_symbol: string;
|
|
125
|
+
token_contract: string;
|
|
126
|
+
chain_name: string;
|
|
127
|
+
chain_id: string;
|
|
128
|
+
};
|
|
119
129
|
};
|
|
120
130
|
/**
|
|
121
131
|
* Properties that can be derived from the bridge controller state
|
|
@@ -139,7 +149,7 @@ export type EventPropertiesFromControllerState = {
|
|
|
139
149
|
error_message: string;
|
|
140
150
|
};
|
|
141
151
|
[UnifiedSwapBridgeEventName.SnapConfirmationViewed]: RequestMetadata & RequestParams & QuoteFetchData & TradeData;
|
|
142
|
-
[UnifiedSwapBridgeEventName.Submitted]:
|
|
152
|
+
[UnifiedSwapBridgeEventName.Submitted]: null;
|
|
143
153
|
[UnifiedSwapBridgeEventName.Completed]: null;
|
|
144
154
|
[UnifiedSwapBridgeEventName.Failed]: RequestParams & RequestMetadata & TxStatusData & TradeData & Pick<QuoteFetchData, 'price_impact'> & {
|
|
145
155
|
actual_time_minutes: number;
|
|
@@ -147,6 +157,7 @@ export type EventPropertiesFromControllerState = {
|
|
|
147
157
|
[UnifiedSwapBridgeEventName.AllQuotesOpened]: RequestParams & RequestMetadata & TradeData & QuoteFetchData;
|
|
148
158
|
[UnifiedSwapBridgeEventName.AllQuotesSorted]: RequestParams & RequestMetadata & TradeData & QuoteFetchData;
|
|
149
159
|
[UnifiedSwapBridgeEventName.QuoteSelected]: RequestParams & RequestMetadata & QuoteFetchData & TradeData;
|
|
160
|
+
[UnifiedSwapBridgeEventName.AssetDetailTooltipClicked]: null;
|
|
150
161
|
};
|
|
151
162
|
/**
|
|
152
163
|
* trackUnifiedSwapBridgeEvent payload properties consist of required properties from the client
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.cts","sourceRoot":"","sources":["../../../src/utils/metrics/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE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_destination: RequestParams['token_symbol_destination'];
|
|
86
86
|
} & Pick<RequestMetadata, 'security_warnings'>;
|
|
87
87
|
[UnifiedSwapBridgeEventName.SnapConfirmationViewed]: Pick<QuoteFetchData, 'price_impact'> & TradeData;
|
|
88
|
-
[UnifiedSwapBridgeEventName.Submitted]: TradeData & Pick<QuoteFetchData, 'price_impact'> &
|
|
89
|
-
|
|
88
|
+
[UnifiedSwapBridgeEventName.Submitted]: TradeData & Pick<QuoteFetchData, 'price_impact'> & Omit<RequestMetadata, 'security_warnings'> & Pick<RequestParams, 'token_symbol_source' | 'token_symbol_destination' | 'chain_id_source' | 'chain_id_destination'> & {
|
|
89
|
+
action_type: MetricsActionType;
|
|
90
|
+
};
|
|
91
|
+
[UnifiedSwapBridgeEventName.Completed]: TradeData & Pick<QuoteFetchData, 'price_impact'> & Omit<RequestMetadata, 'security_warnings'> & TxStatusData & RequestParams & {
|
|
90
92
|
actual_time_minutes: number;
|
|
91
93
|
usd_actual_return: number;
|
|
92
94
|
usd_actual_gas: number;
|
|
93
95
|
quote_vs_execution_ratio: number;
|
|
94
96
|
quoted_vs_used_gas_ratio: number;
|
|
97
|
+
action_type: MetricsActionType;
|
|
95
98
|
};
|
|
96
99
|
[UnifiedSwapBridgeEventName.Failed]: // Tx failed before confirmation
|
|
97
100
|
(TradeData & Pick<QuoteFetchData, 'price_impact'> & Pick<RequestMetadata, 'stx_enabled' | 'usd_amount_source'> & Pick<RequestParams, 'token_symbol_source' | 'token_symbol_destination'> & {
|
|
@@ -116,6 +119,13 @@ export type RequiredEventContextFromClient = {
|
|
|
116
119
|
price_impact: QuoteFetchData['price_impact'];
|
|
117
120
|
can_submit: QuoteFetchData['can_submit'];
|
|
118
121
|
};
|
|
122
|
+
[UnifiedSwapBridgeEventName.AssetDetailTooltipClicked]: {
|
|
123
|
+
token_name: string;
|
|
124
|
+
token_symbol: string;
|
|
125
|
+
token_contract: string;
|
|
126
|
+
chain_name: string;
|
|
127
|
+
chain_id: string;
|
|
128
|
+
};
|
|
119
129
|
};
|
|
120
130
|
/**
|
|
121
131
|
* Properties that can be derived from the bridge controller state
|
|
@@ -139,7 +149,7 @@ export type EventPropertiesFromControllerState = {
|
|
|
139
149
|
error_message: string;
|
|
140
150
|
};
|
|
141
151
|
[UnifiedSwapBridgeEventName.SnapConfirmationViewed]: RequestMetadata & RequestParams & QuoteFetchData & TradeData;
|
|
142
|
-
[UnifiedSwapBridgeEventName.Submitted]:
|
|
152
|
+
[UnifiedSwapBridgeEventName.Submitted]: null;
|
|
143
153
|
[UnifiedSwapBridgeEventName.Completed]: null;
|
|
144
154
|
[UnifiedSwapBridgeEventName.Failed]: RequestParams & RequestMetadata & TxStatusData & TradeData & Pick<QuoteFetchData, 'price_impact'> & {
|
|
145
155
|
actual_time_minutes: number;
|
|
@@ -147,6 +157,7 @@ export type EventPropertiesFromControllerState = {
|
|
|
147
157
|
[UnifiedSwapBridgeEventName.AllQuotesOpened]: RequestParams & RequestMetadata & TradeData & QuoteFetchData;
|
|
148
158
|
[UnifiedSwapBridgeEventName.AllQuotesSorted]: RequestParams & RequestMetadata & TradeData & QuoteFetchData;
|
|
149
159
|
[UnifiedSwapBridgeEventName.QuoteSelected]: RequestParams & RequestMetadata & QuoteFetchData & TradeData;
|
|
160
|
+
[UnifiedSwapBridgeEventName.AssetDetailTooltipClicked]: null;
|
|
150
161
|
};
|
|
151
162
|
/**
|
|
152
163
|
* trackUnifiedSwapBridgeEvent payload properties consist of required properties from the client
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.mts","sourceRoot":"","sources":["../../../src/utils/metrics/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,wBAAwB;AAElE,OAAO,KAAK,EACV,0BAA0B,EAC1B,2BAA2B,EAC3B,iBAAiB,EACjB,eAAe,EAChB,wBAAoB;AACrB,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,wBAAoB;AAE1D;;GAEG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C;KACvB,CAAC;IACJ,CAAC,0BAA0B,CAAC,sBAAsB,CAAC,EAAE,eAAe,GAClE,aAAa,GACb,cAAc,GACd,SAAS,CAAC;IACZ,CAAC,0BAA0B,CAAC,SAAS,CAAC,EAAE,IAAI,CAAC;IAC7C,CAAC,0BAA0B,CAAC,SAAS,CAAC,EAAE,IAAI,CAAC;IAC7C,CAAC,0BAA0B,CAAC,MAAM,CAAC,EAAE,aAAa,GAChD,eAAe,GACf,YAAY,GACZ,SAAS,GACT,IAAI,CAAC,cAAc,EAAE,cAAc,CAAC,GAAG;QACrC,mBAAmB,EAAE,MAAM,CAAC;KAC7B,CAAC;IACJ,CAAC,0BAA0B,CAAC,eAAe,CAAC,EAAE,aAAa,GACzD,eAAe,GACf,SAAS,GACT,cAAc,CAAC;IACjB,CAAC,0BAA0B,CAAC,eAAe,CAAC,EAAE,aAAa,GACzD,eAAe,GACf,SAAS,GACT,cAAc,CAAC;IACjB,CAAC,0BAA0B,CAAC,aAAa,CAAC,EAAE,aAAa,GACvD,eAAe,GACf,cAAc,GACd,SAAS,CAAC;IACZ,CAAC,0BAA0B,CAAC,yBAAyB,CAAC,EAAE,IAAI,CAAC;CAC9D,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,8BAA8B,CACxC,CAAC,SAAS,0BAA0B,IAElC;IACE,WAAW,EAAE,iBAAiB,CAAC;CAChC,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":["import type { CaipAssetType, CaipChainId } from '@metamask/utils';\n\nimport type {\n UnifiedSwapBridgeEventName,\n MetaMetricsSwapsEventSource,\n MetricsActionType,\n MetricsSwapType,\n} from './constants';\nimport type { SortOrder, StatusTypes } from '../../types';\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\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 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};\n\nexport type TradeData = {\n usd_quoted_gas: number;\n gas_included: 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\nexport type InputValues = {\n token_source: CaipAssetType;\n token_destination: CaipAssetType;\n chain_source: CaipChainId;\n chain_destination: CaipChainId;\n slippage: number;\n};\n\n/**\n * Properties that are required to be provided when trackUnifiedSwapBridgeEvent is called\n */\nexport type RequiredEventContextFromClient = {\n [UnifiedSwapBridgeEventName.ButtonClicked]: {\n location: MetaMetricsSwapsEventSource;\n } & Pick<RequestParams, 'token_symbol_source' | 'token_symbol_destination'>;\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 input_value: InputValues[keyof InputValues];\n };\n [UnifiedSwapBridgeEventName.InputSourceDestinationFlipped]: {\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 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'\n > & {\n token_symbol_source: RequestParams['token_symbol_source'];\n token_symbol_destination: RequestParams['token_symbol_destination'];\n };\n [UnifiedSwapBridgeEventName.QuotesReceived]: TradeData & {\n warnings: string[]; // TODO standardize warnings\n best_quote_provider: QuoteFetchData['best_quote_provider'];\n price_impact: QuoteFetchData['price_impact'];\n can_submit: QuoteFetchData['can_submit'];\n };\n [UnifiedSwapBridgeEventName.QuoteError]: 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.SnapConfirmationViewed]: Pick<\n QuoteFetchData,\n 'price_impact'\n > &\n TradeData;\n [UnifiedSwapBridgeEventName.Submitted]: TradeData &\n Pick<QuoteFetchData, 'price_impact'> &\n
|
|
1
|
+
{"version":3,"file":"types.mjs","sourceRoot":"","sources":["../../../src/utils/metrics/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { CaipAssetType, CaipChainId } from '@metamask/utils';\n\nimport type {\n UnifiedSwapBridgeEventName,\n MetaMetricsSwapsEventSource,\n MetricsActionType,\n MetricsSwapType,\n} from './constants';\nimport type { SortOrder, StatusTypes } from '../../types';\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\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 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};\n\nexport type TradeData = {\n usd_quoted_gas: number;\n gas_included: 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\nexport type InputValues = {\n token_source: CaipAssetType;\n token_destination: CaipAssetType;\n chain_source: CaipChainId;\n chain_destination: CaipChainId;\n slippage: number;\n};\n\n/**\n * Properties that are required to be provided when trackUnifiedSwapBridgeEvent is called\n */\nexport type RequiredEventContextFromClient = {\n [UnifiedSwapBridgeEventName.ButtonClicked]: {\n location: MetaMetricsSwapsEventSource;\n } & Pick<RequestParams, 'token_symbol_source' | 'token_symbol_destination'>;\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 input_value: InputValues[keyof InputValues];\n };\n [UnifiedSwapBridgeEventName.InputSourceDestinationFlipped]: {\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 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'\n > & {\n token_symbol_source: RequestParams['token_symbol_source'];\n token_symbol_destination: RequestParams['token_symbol_destination'];\n };\n [UnifiedSwapBridgeEventName.QuotesReceived]: TradeData & {\n warnings: string[]; // TODO standardize warnings\n best_quote_provider: QuoteFetchData['best_quote_provider'];\n price_impact: QuoteFetchData['price_impact'];\n can_submit: QuoteFetchData['can_submit'];\n };\n [UnifiedSwapBridgeEventName.QuoteError]: 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.SnapConfirmationViewed]: Pick<\n QuoteFetchData,\n 'price_impact'\n > &\n TradeData;\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 | 'chain_id_source'\n | 'chain_id_destination'\n > & {\n action_type: MetricsActionType;\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 };\n [UnifiedSwapBridgeEventName.Failed]:\n | // Tx failed before confirmation\n (TradeData &\n Pick<QuoteFetchData, 'price_impact'> &\n Pick<RequestMetadata, 'stx_enabled' | 'usd_amount_source'> &\n Pick<\n RequestParams,\n 'token_symbol_source' | 'token_symbol_destination'\n > & { error_message: string }) // Tx failed after confirmation\n | (RequestParams &\n RequestMetadata &\n Pick<QuoteFetchData, 'price_impact'> &\n TxStatusData &\n TradeData & {\n actual_time_minutes: number;\n error_message?: string;\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};\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 [UnifiedSwapBridgeEventName.InputChanged]: {\n input: InputKeys;\n input_value: string;\n };\n [UnifiedSwapBridgeEventName.InputSourceDestinationFlipped]: 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.QuoteError]: RequestParams &\n RequestMetadata & {\n has_sufficient_funds: boolean;\n error_message: string;\n };\n [UnifiedSwapBridgeEventName.SnapConfirmationViewed]: RequestMetadata &\n RequestParams &\n QuoteFetchData &\n TradeData;\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};\n\n/**\n * trackUnifiedSwapBridgeEvent payload properties consist of required properties from the client\n * and properties from the bridge controller\n */\nexport type CrossChainSwapsEventProperties<\n T extends UnifiedSwapBridgeEventName,\n> =\n | {\n action_type: MetricsActionType;\n }\n | Pick<EventPropertiesFromControllerState, T>[T]\n | Pick<RequiredEventContextFromClient, T>[T];\n"]}
|
|
@@ -145,6 +145,10 @@ exports.QuoteSchema = (0, superstruct_1.type)({
|
|
|
145
145
|
])),
|
|
146
146
|
}),
|
|
147
147
|
gasIncluded: (0, superstruct_1.optional)((0, superstruct_1.boolean)()),
|
|
148
|
+
/**
|
|
149
|
+
* Whether the quote can use EIP-7702 delegated gasless execution
|
|
150
|
+
*/
|
|
151
|
+
gasless7702: (0, superstruct_1.optional)((0, superstruct_1.boolean)()),
|
|
148
152
|
bridgeId: (0, superstruct_1.string)(),
|
|
149
153
|
bridges: (0, superstruct_1.array)((0, superstruct_1.string)()),
|
|
150
154
|
steps: (0, superstruct_1.array)(exports.StepSchema),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validators.cjs","sourceRoot":"","sources":["../../src/utils/validators.ts"],"names":[],"mappings":";;;AAAA,iEAA+D;AAE/D,uDAgB+B;AAC/B,2CAAyE;AAEzE,IAAY,OAIX;AAJD,WAAY,OAAO;IACjB,oCAAyB,CAAA;IACzB,4BAAiB,CAAA;IACjB,2BAAgB,CAAA;AAClB,CAAC,EAJW,OAAO,uBAAP,OAAO,QAIlB;AAED,IAAY,SAEX;AAFD,WAAY,SAAS;IACnB,4BAAe,CAAA;AACjB,CAAC,EAFW,SAAS,yBAAT,SAAS,QAEpB;AAED,IAAY,WAIX;AAJD,WAAY,WAAW;IACrB,gCAAiB,CAAA;IACjB,4BAAa,CAAA;IACb,gCAAiB,CAAA;AACnB,CAAC,EAJW,WAAW,2BAAX,WAAW,QAItB;AAED,MAAM,gBAAgB,GAAG,IAAA,oBAAM,EAAS,YAAY,EAAE,CAAC,CAAU,EAAE,EAAE,CACnE,IAAA,oCAAiB,EAAC,CAAW,EAAE,EAAE,gBAAgB,EAAE,KAAK,EAAE,CAAC,CAC5D,CAAC;AAEF,MAAM,eAAe,GAAG,IAAA,oBAAM,EAAS,WAAW,EAAE,CAAC,CAAU,EAAE,EAAE,CACjE,IAAA,yBAAiB,EAAC,CAAW,CAAC,CAC/B,CAAC;AAEK,MAAM,YAAY,GAAG,CAAC,CAAS,EAAE,EAAE,CAAC,OAAO,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC;AAAjD,QAAA,YAAY,gBAAqC;AAC9D,MAAM,uBAAuB,GAAG,IAAA,qBAAO,EAAC,IAAA,oBAAM,GAAE,EAAE,QAAQ,CAAC,CAAC;AAE5D,MAAM,aAAa,GAAG,IAAA,oBAAM,GAAE,CAAC;AAElB,QAAA,iBAAi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AClC,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AALW,QAAA,qBAAqB,yBAKhC","sourcesContent":["import { isValidHexAddress } from '@metamask/controller-utils';\nimport type { Infer } from '@metamask/superstruct';\nimport {\n string,\n boolean,\n number,\n type,\n is,\n record,\n array,\n nullable,\n optional,\n enums,\n define,\n union,\n assert,\n pattern,\n intersection,\n} from '@metamask/superstruct';\nimport { CaipAssetTypeStruct, isStrictHexString } from '@metamask/utils';\n\nexport enum FeeType {\n METABRIDGE = 'metabridge',\n REFUEL = 'refuel',\n TX_FEE = 'txFee',\n}\n\nexport enum FeatureId {\n PERPS = 'perps',\n}\n\nexport enum ActionTypes {\n BRIDGE = 'bridge',\n SWAP = 'swap',\n REFUEL = 'refuel',\n}\n\nconst HexAddressSchema = define<string>('HexAddress', (v: unknown) =>\n isValidHexAddress(v as string, { allowNonPrefixed: false }),\n);\n\nconst HexStringSchema = define<string>('HexString', (v: unknown) =>\n isStrictHexString(v as string),\n);\n\nexport const truthyString = (s: string) => Boolean(s?.length);\nconst TruthyDigitStringSchema = pattern(string(), /^\\d+$/u);\n\nconst ChainIdSchema = number();\n\nexport const BridgeAssetSchema = type({\n /**\n * The chainId of the token\n */\n chainId: ChainIdSchema,\n /**\n * An address that the metaswap-api recognizes as the default token\n */\n address: string(),\n /**\n * The assetId of the token\n */\n assetId: CaipAssetTypeStruct,\n /**\n * The symbol of token object\n */\n symbol: string(),\n /**\n * The name for the network\n */\n name: string(),\n decimals: number(),\n /**\n * URL for token icon\n */\n icon: optional(nullable(string())),\n /**\n * URL for token icon\n */\n iconUrl: optional(nullable(string())),\n});\n\nexport const ChainConfigurationSchema = type({\n isActiveSrc: boolean(),\n isActiveDest: boolean(),\n refreshRate: optional(number()),\n topAssets: optional(array(string())),\n isUnifiedUIEnabled: optional(boolean()),\n isSingleSwapBridgeButtonEnabled: optional(boolean()),\n});\n\nexport const PriceImpactThresholdSchema = type({\n gasless: number(),\n normal: number(),\n});\n\nconst GenericQuoteRequestSchema = type({\n aggIds: optional(array(string())),\n bridgeIds: optional(array(string())),\n noFee: optional(boolean()),\n});\n\nconst FeatureIdSchema = enums(Object.values(FeatureId));\n\n/**\n * This is the schema for the feature flags response from the RemoteFeatureFlagController\n */\nexport const PlatformConfigSchema = type({\n priceImpactThreshold: optional(PriceImpactThresholdSchema),\n quoteRequestOverrides: optional(\n record(FeatureIdSchema, optional(GenericQuoteRequestSchema)),\n ),\n minimumVersion: string(),\n refreshRate: number(),\n maxRefreshCount: number(),\n support: boolean(),\n chains: record(string(), ChainConfigurationSchema),\n});\n\nexport const validateFeatureFlagsResponse = (\n data: unknown,\n): data is Infer<typeof PlatformConfigSchema> => {\n return is(data, PlatformConfigSchema);\n};\n\nexport const validateSwapsTokenObject = (\n data: unknown,\n): data is Infer<typeof BridgeAssetSchema> => {\n return is(data, BridgeAssetSchema);\n};\n\nexport const FeeDataSchema = type({\n amount: TruthyDigitStringSchema,\n asset: BridgeAssetSchema,\n});\n\nexport const ProtocolSchema = type({\n name: string(),\n displayName: optional(string()),\n icon: optional(string()),\n});\n\nexport const StepSchema = type({\n action: enums(Object.values(ActionTypes)),\n srcChainId: ChainIdSchema,\n destChainId: optional(ChainIdSchema),\n srcAsset: BridgeAssetSchema,\n destAsset: BridgeAssetSchema,\n srcAmount: string(),\n destAmount: string(),\n protocol: ProtocolSchema,\n});\n\nconst RefuelDataSchema = StepSchema;\n\nexport const QuoteSchema = type({\n requestId: string(),\n srcChainId: ChainIdSchema,\n srcAsset: BridgeAssetSchema,\n /**\n * The amount sent, in atomic amount: amount sent - fees\n * Some tokens have a fee of 0, so sometimes it's equal to amount sent\n */\n srcTokenAmount: string(),\n destChainId: ChainIdSchema,\n destAsset: BridgeAssetSchema,\n /**\n * The amount received, in atomic amount\n */\n destTokenAmount: string(),\n feeData: type({\n [FeeType.METABRIDGE]: FeeDataSchema,\n /**\n * This is the fee for the swap transaction taken from either the\n * src or dest token if the quote has gas fees included or \"gasless\"\n */\n [FeeType.TX_FEE]: optional(\n intersection([\n FeeDataSchema,\n type({\n maxFeePerGas: string(),\n maxPriorityFeePerGas: string(),\n }),\n ]),\n ),\n }),\n gasIncluded: optional(boolean()),\n bridgeId: string(),\n bridges: array(string()),\n steps: array(StepSchema),\n refuel: optional(RefuelDataSchema),\n priceData: optional(\n type({\n totalFromAmountUsd: optional(string()),\n totalToAmountUsd: optional(string()),\n priceImpact: optional(string()),\n }),\n ),\n});\n\nexport const TxDataSchema = type({\n chainId: number(),\n to: HexAddressSchema,\n from: HexAddressSchema,\n value: HexStringSchema,\n data: HexStringSchema,\n gasLimit: nullable(number()),\n effectiveGas: optional(number()),\n});\n\nexport const QuoteResponseSchema = type({\n quote: QuoteSchema,\n estimatedProcessingTimeInSeconds: number(),\n approval: optional(TxDataSchema),\n trade: union([TxDataSchema, string()]),\n});\n\nexport const validateQuoteResponse = (\n data: unknown,\n): data is Infer<typeof QuoteResponseSchema> => {\n assert(data, QuoteResponseSchema);\n return true;\n};\n"]}
|
|
1
|
+
{"version":3,"file":"validators.cjs","sourceRoot":"","sources":["../../src/utils/validators.ts"],"names":[],"mappings":";;;AAAA,iEAA+D;AAE/D,uDAgB+B;AAC/B,2CAAyE;AAEzE,IAAY,OAIX;AAJD,WAAY,OAAO;IACjB,oCAAyB,CAAA;IACzB,4BAAiB,CAAA;IACjB,2BAAgB,CAAA;AAClB,CAAC,EAJW,OAAO,uBAAP,OAAO,QAIlB;AAED,IAAY,SAEX;AAFD,WAAY,SAAS;IACnB,4BAAe,CAAA;AACjB,CAAC,EAFW,SAAS,yBAAT,SAAS,QAEpB;AAED,IAAY,WAIX;AAJD,WAAY,WAAW;IACrB,gCAAiB,CAAA;IACjB,4BAAa,CAAA;IACb,gCAAiB,CAAA;AACnB,CAAC,EAJW,WAAW,2BAAX,WAAW,QAItB;AAED,MAAM,gBAAgB,GAAG,IAAA,oBAAM,EAAS,YAAY,EAAE,CAAC,CAAU,EAAE,EAAE,CACnE,IAAA,oCAAiB,EAAC,CAAW,EAAE,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EAAE,eAAe;IACrB,QAAQ,EAAE,IAAA,sBAAQ,EAAC,IAAA,oBAAM,GAAE,CAAC;IAC5B,YAAY,EAAE,IAAA,sBAAQ,EAAC,IAAA,oBAAM,GAAE,CAAC;CACjC,CAAC,CAAC;AAEU,QAAA,mBAAmB,GAAG,IAAA,kBAAI,EAAC;IACtC,KAAK,EAAE,mBAAW;IAClB,gCAAgC,EAAE,IAAA,oBAAM,GAAE;IAC1C,QAAQ,EAAE,IAAA,sBAAQ,EAAC,oBAAY,CAAC;IAChC,KAAK,EAAE,IAAA,mBAAK,EAAC,CAAC,oBAAY,EAAE,IAAA,oBAAM,GAAE,CAAC,CAAC;CACvC,CAAC,CAAC;AAEI,MAAM,qBAAqB,GAAG,CACnC,IAAa,EAC8B,EAAE;IAC7C,IAAA,oBAAM,EAAC,IAAI,EAAE,2BAAmB,CAAC,CAAC;IAClC,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AALW,QAAA,qBAAqB,yBAKhC","sourcesContent":["import { isValidHexAddress } from '@metamask/controller-utils';\nimport type { Infer } from '@metamask/superstruct';\nimport {\n string,\n boolean,\n number,\n type,\n is,\n record,\n array,\n nullable,\n optional,\n enums,\n define,\n union,\n assert,\n pattern,\n intersection,\n} from '@metamask/superstruct';\nimport { CaipAssetTypeStruct, isStrictHexString } from '@metamask/utils';\n\nexport enum FeeType {\n METABRIDGE = 'metabridge',\n REFUEL = 'refuel',\n TX_FEE = 'txFee',\n}\n\nexport enum FeatureId {\n PERPS = 'perps',\n}\n\nexport enum ActionTypes {\n BRIDGE = 'bridge',\n SWAP = 'swap',\n REFUEL = 'refuel',\n}\n\nconst HexAddressSchema = define<string>('HexAddress', (v: unknown) =>\n isValidHexAddress(v as string, { allowNonPrefixed: false }),\n);\n\nconst HexStringSchema = define<string>('HexString', (v: unknown) =>\n isStrictHexString(v as string),\n);\n\nexport const truthyString = (s: string) => Boolean(s?.length);\nconst TruthyDigitStringSchema = pattern(string(), /^\\d+$/u);\n\nconst ChainIdSchema = number();\n\nexport const BridgeAssetSchema = type({\n /**\n * The chainId of the token\n */\n chainId: ChainIdSchema,\n /**\n * An address that the metaswap-api recognizes as the default token\n */\n address: string(),\n /**\n * The assetId of the token\n */\n assetId: CaipAssetTypeStruct,\n /**\n * The symbol of token object\n */\n symbol: string(),\n /**\n * The name for the network\n */\n name: string(),\n decimals: number(),\n /**\n * URL for token icon\n */\n icon: optional(nullable(string())),\n /**\n * URL for token icon\n */\n iconUrl: optional(nullable(string())),\n});\n\nexport const ChainConfigurationSchema = type({\n isActiveSrc: boolean(),\n isActiveDest: boolean(),\n refreshRate: optional(number()),\n topAssets: optional(array(string())),\n isUnifiedUIEnabled: optional(boolean()),\n isSingleSwapBridgeButtonEnabled: optional(boolean()),\n});\n\nexport const PriceImpactThresholdSchema = type({\n gasless: number(),\n normal: number(),\n});\n\nconst GenericQuoteRequestSchema = type({\n aggIds: optional(array(string())),\n bridgeIds: optional(array(string())),\n noFee: optional(boolean()),\n});\n\nconst FeatureIdSchema = enums(Object.values(FeatureId));\n\n/**\n * This is the schema for the feature flags response from the RemoteFeatureFlagController\n */\nexport const PlatformConfigSchema = type({\n priceImpactThreshold: optional(PriceImpactThresholdSchema),\n quoteRequestOverrides: optional(\n record(FeatureIdSchema, optional(GenericQuoteRequestSchema)),\n ),\n minimumVersion: string(),\n refreshRate: number(),\n maxRefreshCount: number(),\n support: boolean(),\n chains: record(string(), ChainConfigurationSchema),\n});\n\nexport const validateFeatureFlagsResponse = (\n data: unknown,\n): data is Infer<typeof PlatformConfigSchema> => {\n return is(data, PlatformConfigSchema);\n};\n\nexport const validateSwapsTokenObject = (\n data: unknown,\n): data is Infer<typeof BridgeAssetSchema> => {\n return is(data, BridgeAssetSchema);\n};\n\nexport const FeeDataSchema = type({\n amount: TruthyDigitStringSchema,\n asset: BridgeAssetSchema,\n});\n\nexport const ProtocolSchema = type({\n name: string(),\n displayName: optional(string()),\n icon: optional(string()),\n});\n\nexport const StepSchema = type({\n action: enums(Object.values(ActionTypes)),\n srcChainId: ChainIdSchema,\n destChainId: optional(ChainIdSchema),\n srcAsset: BridgeAssetSchema,\n destAsset: BridgeAssetSchema,\n srcAmount: string(),\n destAmount: string(),\n protocol: ProtocolSchema,\n});\n\nconst RefuelDataSchema = StepSchema;\n\nexport const QuoteSchema = type({\n requestId: string(),\n srcChainId: ChainIdSchema,\n srcAsset: BridgeAssetSchema,\n /**\n * The amount sent, in atomic amount: amount sent - fees\n * Some tokens have a fee of 0, so sometimes it's equal to amount sent\n */\n srcTokenAmount: string(),\n destChainId: ChainIdSchema,\n destAsset: BridgeAssetSchema,\n /**\n * The amount received, in atomic amount\n */\n destTokenAmount: string(),\n feeData: type({\n [FeeType.METABRIDGE]: FeeDataSchema,\n /**\n * This is the fee for the swap transaction taken from either the\n * src or dest token if the quote has gas fees included or \"gasless\"\n */\n [FeeType.TX_FEE]: optional(\n intersection([\n FeeDataSchema,\n type({\n maxFeePerGas: string(),\n maxPriorityFeePerGas: string(),\n }),\n ]),\n ),\n }),\n gasIncluded: optional(boolean()),\n /**\n * Whether the quote can use EIP-7702 delegated gasless execution\n */\n gasless7702: optional(boolean()),\n bridgeId: string(),\n bridges: array(string()),\n steps: array(StepSchema),\n refuel: optional(RefuelDataSchema),\n priceData: optional(\n type({\n totalFromAmountUsd: optional(string()),\n totalToAmountUsd: optional(string()),\n priceImpact: optional(string()),\n }),\n ),\n});\n\nexport const TxDataSchema = type({\n chainId: number(),\n to: HexAddressSchema,\n from: HexAddressSchema,\n value: HexStringSchema,\n data: HexStringSchema,\n gasLimit: nullable(number()),\n effectiveGas: optional(number()),\n});\n\nexport const QuoteResponseSchema = type({\n quote: QuoteSchema,\n estimatedProcessingTimeInSeconds: number(),\n approval: optional(TxDataSchema),\n trade: union([TxDataSchema, string()]),\n});\n\nexport const validateQuoteResponse = (\n data: unknown,\n): data is Infer<typeof QuoteResponseSchema> => {\n assert(data, QuoteResponseSchema);\n return true;\n};\n"]}
|
|
@@ -477,6 +477,7 @@ export declare const QuoteSchema: import("@metamask/superstruct").Struct<{
|
|
|
477
477
|
destChainId?: number | undefined;
|
|
478
478
|
} | undefined;
|
|
479
479
|
gasIncluded?: boolean | undefined;
|
|
480
|
+
gasless7702?: boolean | undefined;
|
|
480
481
|
priceData?: {
|
|
481
482
|
totalFromAmountUsd?: string | undefined;
|
|
482
483
|
totalToAmountUsd?: string | undefined;
|
|
@@ -683,6 +684,10 @@ export declare const QuoteSchema: import("@metamask/superstruct").Struct<{
|
|
|
683
684
|
}) | undefined, null>;
|
|
684
685
|
}>;
|
|
685
686
|
gasIncluded: import("@metamask/superstruct").Struct<boolean | undefined, null>;
|
|
687
|
+
/**
|
|
688
|
+
* Whether the quote can use EIP-7702 delegated gasless execution
|
|
689
|
+
*/
|
|
690
|
+
gasless7702: import("@metamask/superstruct").Struct<boolean | undefined, null>;
|
|
686
691
|
bridgeId: import("@metamask/superstruct").Struct<string, null>;
|
|
687
692
|
bridges: import("@metamask/superstruct").Struct<string[], import("@metamask/superstruct").Struct<string, null>>;
|
|
688
693
|
steps: import("@metamask/superstruct").Struct<{
|
|
@@ -1130,6 +1135,7 @@ export declare const QuoteResponseSchema: import("@metamask/superstruct").Struct
|
|
|
1130
1135
|
destChainId?: number | undefined;
|
|
1131
1136
|
} | undefined;
|
|
1132
1137
|
gasIncluded?: boolean | undefined;
|
|
1138
|
+
gasless7702?: boolean | undefined;
|
|
1133
1139
|
priceData?: {
|
|
1134
1140
|
totalFromAmountUsd?: string | undefined;
|
|
1135
1141
|
totalToAmountUsd?: string | undefined;
|
|
@@ -1280,6 +1286,7 @@ export declare const QuoteResponseSchema: import("@metamask/superstruct").Struct
|
|
|
1280
1286
|
destChainId?: number | undefined;
|
|
1281
1287
|
} | undefined;
|
|
1282
1288
|
gasIncluded?: boolean | undefined;
|
|
1289
|
+
gasless7702?: boolean | undefined;
|
|
1283
1290
|
priceData?: {
|
|
1284
1291
|
totalFromAmountUsd?: string | undefined;
|
|
1285
1292
|
totalToAmountUsd?: string | undefined;
|
|
@@ -1486,6 +1493,10 @@ export declare const QuoteResponseSchema: import("@metamask/superstruct").Struct
|
|
|
1486
1493
|
}) | undefined, null>;
|
|
1487
1494
|
}>;
|
|
1488
1495
|
gasIncluded: import("@metamask/superstruct").Struct<boolean | undefined, null>;
|
|
1496
|
+
/**
|
|
1497
|
+
* Whether the quote can use EIP-7702 delegated gasless execution
|
|
1498
|
+
*/
|
|
1499
|
+
gasless7702: import("@metamask/superstruct").Struct<boolean | undefined, null>;
|
|
1489
1500
|
bridgeId: import("@metamask/superstruct").Struct<string, null>;
|
|
1490
1501
|
bridges: import("@metamask/superstruct").Struct<string[], import("@metamask/superstruct").Struct<string, null>>;
|
|
1491
1502
|
steps: import("@metamask/superstruct").Struct<{
|
|
@@ -1944,6 +1955,7 @@ export declare const validateQuoteResponse: (data: unknown) => data is {
|
|
|
1944
1955
|
destChainId?: number | undefined;
|
|
1945
1956
|
} | undefined;
|
|
1946
1957
|
gasIncluded?: boolean | undefined;
|
|
1958
|
+
gasless7702?: boolean | undefined;
|
|
1947
1959
|
priceData?: {
|
|
1948
1960
|
totalFromAmountUsd?: string | undefined;
|
|
1949
1961
|
totalToAmountUsd?: string | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validators.d.cts","sourceRoot":"","sources":["../../src/utils/validators.ts"],"names":[],"mappings":"AAqBA,oBAAY,OAAO;IACjB,UAAU,eAAe;IACzB,MAAM,WAAW;IACjB,MAAM,UAAU;CACjB;AAED,oBAAY,SAAS;IACnB,KAAK,UAAU;CAChB;AAED,oBAAY,WAAW;IACrB,MAAM,WAAW;IACjB,IAAI,SAAS;IACb,MAAM,WAAW;CAClB;AAUD,eAAO,MAAM,YAAY,MAAO,MAAM,YAAuB,CAAC;AAK9D,eAAO,MAAM,iBAAiB;;;;;;;;;;IAC5B;;OAEG;;IAEH;;OAEG;;IAEH;;OAEG;;IAEH;;OAEG;;IAEH;;OAEG;;;IAGH;;OAEG;;IAEH;;OAE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BAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gBA3BH;;mBAEG;;gBAEH;;mBAEG;;gBAEH;;mBAEG;;gBAEH;;mBAEG;;gBAEH;;mBAEG;;;gBAGH;;mBAEG;;gBAEH;;mBAEG;;;;;;;;;;;;;gBA3BH;;mBAEG;;gBAEH;;mBAEG;;gBAEH;;mBAEG;;gBAEH;;mBAEG;;gBAEH;;mBAEG;;;gBAGH;;mBAEG;;gBAEH;;mBAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA6IH,CAAC;AAEH,eAAO,MAAM,qBAAqB,SAC1B,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAId,CAAC"}
|
|
@@ -477,6 +477,7 @@ export declare const QuoteSchema: import("@metamask/superstruct").Struct<{
|
|
|
477
477
|
destChainId?: number | undefined;
|
|
478
478
|
} | undefined;
|
|
479
479
|
gasIncluded?: boolean | undefined;
|
|
480
|
+
gasless7702?: boolean | undefined;
|
|
480
481
|
priceData?: {
|
|
481
482
|
totalFromAmountUsd?: string | undefined;
|
|
482
483
|
totalToAmountUsd?: string | undefined;
|
|
@@ -683,6 +684,10 @@ export declare const QuoteSchema: import("@metamask/superstruct").Struct<{
|
|
|
683
684
|
}) | undefined, null>;
|
|
684
685
|
}>;
|
|
685
686
|
gasIncluded: import("@metamask/superstruct").Struct<boolean | undefined, null>;
|
|
687
|
+
/**
|
|
688
|
+
* Whether the quote can use EIP-7702 delegated gasless execution
|
|
689
|
+
*/
|
|
690
|
+
gasless7702: import("@metamask/superstruct").Struct<boolean | undefined, null>;
|
|
686
691
|
bridgeId: import("@metamask/superstruct").Struct<string, null>;
|
|
687
692
|
bridges: import("@metamask/superstruct").Struct<string[], import("@metamask/superstruct").Struct<string, null>>;
|
|
688
693
|
steps: import("@metamask/superstruct").Struct<{
|
|
@@ -1130,6 +1135,7 @@ export declare const QuoteResponseSchema: import("@metamask/superstruct").Struct
|
|
|
1130
1135
|
destChainId?: number | undefined;
|
|
1131
1136
|
} | undefined;
|
|
1132
1137
|
gasIncluded?: boolean | undefined;
|
|
1138
|
+
gasless7702?: boolean | undefined;
|
|
1133
1139
|
priceData?: {
|
|
1134
1140
|
totalFromAmountUsd?: string | undefined;
|
|
1135
1141
|
totalToAmountUsd?: string | undefined;
|
|
@@ -1280,6 +1286,7 @@ export declare const QuoteResponseSchema: import("@metamask/superstruct").Struct
|
|
|
1280
1286
|
destChainId?: number | undefined;
|
|
1281
1287
|
} | undefined;
|
|
1282
1288
|
gasIncluded?: boolean | undefined;
|
|
1289
|
+
gasless7702?: boolean | undefined;
|
|
1283
1290
|
priceData?: {
|
|
1284
1291
|
totalFromAmountUsd?: string | undefined;
|
|
1285
1292
|
totalToAmountUsd?: string | undefined;
|
|
@@ -1486,6 +1493,10 @@ export declare const QuoteResponseSchema: import("@metamask/superstruct").Struct
|
|
|
1486
1493
|
}) | undefined, null>;
|
|
1487
1494
|
}>;
|
|
1488
1495
|
gasIncluded: import("@metamask/superstruct").Struct<boolean | undefined, null>;
|
|
1496
|
+
/**
|
|
1497
|
+
* Whether the quote can use EIP-7702 delegated gasless execution
|
|
1498
|
+
*/
|
|
1499
|
+
gasless7702: import("@metamask/superstruct").Struct<boolean | undefined, null>;
|
|
1489
1500
|
bridgeId: import("@metamask/superstruct").Struct<string, null>;
|
|
1490
1501
|
bridges: import("@metamask/superstruct").Struct<string[], import("@metamask/superstruct").Struct<string, null>>;
|
|
1491
1502
|
steps: import("@metamask/superstruct").Struct<{
|
|
@@ -1944,6 +1955,7 @@ export declare const validateQuoteResponse: (data: unknown) => data is {
|
|
|
1944
1955
|
destChainId?: number | undefined;
|
|
1945
1956
|
} | undefined;
|
|
1946
1957
|
gasIncluded?: boolean | undefined;
|
|
1958
|
+
gasless7702?: boolean | undefined;
|
|
1947
1959
|
priceData?: {
|
|
1948
1960
|
totalFromAmountUsd?: string | undefined;
|
|
1949
1961
|
totalToAmountUsd?: string | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validators.d.mts","sourceRoot":"","sources":["../../src/utils/validators.ts"],"names":[],"mappings":"AAqBA,oBAAY,OAAO;IACjB,UAAU,eAAe;IACzB,MAAM,WAAW;IACjB,MAAM,UAAU;CACjB;AAED,oBAAY,SAAS;IACnB,KAAK,UAAU;CAChB;AAED,oBAAY,WAAW;IACrB,MAAM,WAAW;IACjB,IAAI,SAAS;IACb,MAAM,WAAW;CAClB;AAUD,eAAO,MAAM,YAAY,MAAO,MAAM,YAAuB,CAAC;AAK9D,eAAO,MAAM,iBAAiB;;;;;;;;;;IAC5B;;OAEG;;IAEH;;OAEG;;IAEH;;OAEG;;IAEH;;OAEG;;IAEH;;OAEG;;;IAGH;;OAEG;;IAEH;;OAEG;;EAEH,CAAC;AAEH,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;EAOnC,CAAC;AAEH,eAAO,MAAM,0BAA0B;;;;;;EAGrC,CAAC;AAUH;;GAEG;AACH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAU/B,CAAC;AAEH,eAAO,MAAM,4BAA4B,SACjC,OAAO;;;;;;;;;;;;;;;;;;;;;;CAGd,CAAC;AAEF,eAAO,MAAM,wBAAwB,SAC7B,OAAO;;;;;;;;;CAGd,CAAC;AAEF,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;QAhFxB;;WAEG;;QAEH;;WAEG;;QAEH;;WAEG;;QAEH;;WAEG;;QAEH;;WAEG;;;QAGH;;WAEG;;QAEH;;WAEG;;;EAwDH,CAAC;AAEH,eAAO,MAAM,cAAc;;;;;;;;E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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAId,CAAC"}
|
|
@@ -139,6 +139,10 @@ export const QuoteSchema = type({
|
|
|
139
139
|
])),
|
|
140
140
|
}),
|
|
141
141
|
gasIncluded: optional(boolean()),
|
|
142
|
+
/**
|
|
143
|
+
* Whether the quote can use EIP-7702 delegated gasless execution
|
|
144
|
+
*/
|
|
145
|
+
gasless7702: optional(boolean()),
|
|
142
146
|
bridgeId: string(),
|
|
143
147
|
bridges: array(string()),
|
|
144
148
|
steps: array(StepSchema),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validators.mjs","sourceRoot":"","sources":["../../src/utils/validators.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,mCAAmC;AAE/D,OAAO,EACL,MAAM,EACN,OAAO,EACP,MAAM,EACN,IAAI,EACJ,EAAE,EACF,MAAM,EACN,KAAK,EACL,QAAQ,EACR,QAAQ,EACR,KAAK,EACL,MAAM,EACN,KAAK,EACL,MAAM,EACN,OAAO,EACP,YAAY,EACb,8BAA8B;AAC/B,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,wBAAwB;AAEzE,MAAM,CAAN,IAAY,OAIX;AAJD,WAAY,OAAO;IACjB,oCAAyB,CAAA;IACzB,4BAAiB,CAAA;IACjB,2BAAgB,CAAA;AAClB,CAAC,EAJW,OAAO,KAAP,OAAO,QAIlB;AAED,MAAM,CAAN,IAAY,SAEX;AAFD,WAAY,SAAS;IACnB,4BAAe,CAAA;AACjB,CAAC,EAFW,SAAS,KAAT,SAAS,QAEpB;AAED,MAAM,CAAN,IAAY,WAIX;AAJD,WAAY,WAAW;IACrB,gCAAiB,CAAA;IACjB,4BAAa,CAAA;IACb,gCAAiB,CAAA;AACnB,CAAC,EAJW,WAAW,KAAX,WAAW,QAItB;AAED,MAAM,gBAAgB,GAAG,MAAM,CAAS,YAAY,EAAE,CAAC,CAAU,EAAE,EAA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EAAE,CAAC;IAChC,QAAQ,EAAE,MAAM,EAAE;IAClB,OAAO,EAAE,KAAK,CAAC,MAAM,EAAE,CAAC;IACxB,KAAK,EAAE,KAAK,CAAC,UAAU,CAAC;IACxB,MAAM,EAAE,QAAQ,CAAC,gBAAgB,CAAC;IAClC,SAAS,EAAE,QAAQ,CACjB,IAAI,CAAC;QACH,kBAAkB,EAAE,QAAQ,CAAC,MAAM,EAAE,CAAC;QACtC,gBAAgB,EAAE,QAAQ,CAAC,MAAM,EAAE,CAAC;QACpC,WAAW,EAAE,QAAQ,CAAC,MAAM,EAAE,CAAC;KAChC,CAAC,CACH;CACF,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,YAAY,GAAG,IAAI,CAAC;IAC/B,OAAO,EAAE,MAAM,EAAE;IACjB,EAAE,EAAE,gBAAgB;IACpB,IAAI,EAAE,gBAAgB;IACtB,KAAK,EAAE,eAAe;IACtB,IAAI,EAAE,eAAe;IACrB,QAAQ,EAAE,QAAQ,CAAC,MAAM,EAAE,CAAC;IAC5B,YAAY,EAAE,QAAQ,CAAC,MAAM,EAAE,CAAC;CACjC,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,mBAAmB,GAAG,IAAI,CAAC;IACtC,KAAK,EAAE,WAAW;IAClB,gCAAgC,EAAE,MAAM,EAAE;IAC1C,QAAQ,EAAE,QAAQ,CAAC,YAAY,CAAC;IAChC,KAAK,EAAE,KAAK,CAAC,CAAC,YAAY,EAAE,MAAM,EAAE,CAAC,CAAC;CACvC,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CACnC,IAAa,EAC8B,EAAE;IAC7C,MAAM,CAAC,IAAI,EAAE,mBAAmB,CAAC,CAAC;IAClC,OAAO,IAAI,CAAC;AACd,CAAC,CAAC","sourcesContent":["import { isValidHexAddress } from '@metamask/controller-utils';\nimport type { Infer } from '@metamask/superstruct';\nimport {\n string,\n boolean,\n number,\n type,\n is,\n record,\n array,\n nullable,\n optional,\n enums,\n define,\n union,\n assert,\n pattern,\n intersection,\n} from '@metamask/superstruct';\nimport { CaipAssetTypeStruct, isStrictHexString } from '@metamask/utils';\n\nexport enum FeeType {\n METABRIDGE = 'metabridge',\n REFUEL = 'refuel',\n TX_FEE = 'txFee',\n}\n\nexport enum FeatureId {\n PERPS = 'perps',\n}\n\nexport enum ActionTypes {\n BRIDGE = 'bridge',\n SWAP = 'swap',\n REFUEL = 'refuel',\n}\n\nconst HexAddressSchema = define<string>('HexAddress', (v: unknown) =>\n isValidHexAddress(v as string, { allowNonPrefixed: false }),\n);\n\nconst HexStringSchema = define<string>('HexString', (v: unknown) =>\n isStrictHexString(v as string),\n);\n\nexport const truthyString = (s: string) => Boolean(s?.length);\nconst TruthyDigitStringSchema = pattern(string(), /^\\d+$/u);\n\nconst ChainIdSchema = number();\n\nexport const BridgeAssetSchema = type({\n /**\n * The chainId of the token\n */\n chainId: ChainIdSchema,\n /**\n * An address that the metaswap-api recognizes as the default token\n */\n address: string(),\n /**\n * The assetId of the token\n */\n assetId: CaipAssetTypeStruct,\n /**\n * The symbol of token object\n */\n symbol: string(),\n /**\n * The name for the network\n */\n name: string(),\n decimals: number(),\n /**\n * URL for token icon\n */\n icon: optional(nullable(string())),\n /**\n * URL for token icon\n */\n iconUrl: optional(nullable(string())),\n});\n\nexport const ChainConfigurationSchema = type({\n isActiveSrc: boolean(),\n isActiveDest: boolean(),\n refreshRate: optional(number()),\n topAssets: optional(array(string())),\n isUnifiedUIEnabled: optional(boolean()),\n isSingleSwapBridgeButtonEnabled: optional(boolean()),\n});\n\nexport const PriceImpactThresholdSchema = type({\n gasless: number(),\n normal: number(),\n});\n\nconst GenericQuoteRequestSchema = type({\n aggIds: optional(array(string())),\n bridgeIds: optional(array(string())),\n noFee: optional(boolean()),\n});\n\nconst FeatureIdSchema = enums(Object.values(FeatureId));\n\n/**\n * This is the schema for the feature flags response from the RemoteFeatureFlagController\n */\nexport const PlatformConfigSchema = type({\n priceImpactThreshold: optional(PriceImpactThresholdSchema),\n quoteRequestOverrides: optional(\n record(FeatureIdSchema, optional(GenericQuoteRequestSchema)),\n ),\n minimumVersion: string(),\n refreshRate: number(),\n maxRefreshCount: number(),\n support: boolean(),\n chains: record(string(), ChainConfigurationSchema),\n});\n\nexport const validateFeatureFlagsResponse = (\n data: unknown,\n): data is Infer<typeof PlatformConfigSchema> => {\n return is(data, PlatformConfigSchema);\n};\n\nexport const validateSwapsTokenObject = (\n data: unknown,\n): data is Infer<typeof BridgeAssetSchema> => {\n return is(data, BridgeAssetSchema);\n};\n\nexport const FeeDataSchema = type({\n amount: TruthyDigitStringSchema,\n asset: BridgeAssetSchema,\n});\n\nexport const ProtocolSchema = type({\n name: string(),\n displayName: optional(string()),\n icon: optional(string()),\n});\n\nexport const StepSchema = type({\n action: enums(Object.values(ActionTypes)),\n srcChainId: ChainIdSchema,\n destChainId: optional(ChainIdSchema),\n srcAsset: BridgeAssetSchema,\n destAsset: BridgeAssetSchema,\n srcAmount: string(),\n destAmount: string(),\n protocol: ProtocolSchema,\n});\n\nconst RefuelDataSchema = StepSchema;\n\nexport const QuoteSchema = type({\n requestId: string(),\n srcChainId: ChainIdSchema,\n srcAsset: BridgeAssetSchema,\n /**\n * The amount sent, in atomic amount: amount sent - fees\n * Some tokens have a fee of 0, so sometimes it's equal to amount sent\n */\n srcTokenAmount: string(),\n destChainId: ChainIdSchema,\n destAsset: BridgeAssetSchema,\n /**\n * The amount received, in atomic amount\n */\n destTokenAmount: string(),\n feeData: type({\n [FeeType.METABRIDGE]: FeeDataSchema,\n /**\n * This is the fee for the swap transaction taken from either the\n * src or dest token if the quote has gas fees included or \"gasless\"\n */\n [FeeType.TX_FEE]: optional(\n intersection([\n FeeDataSchema,\n type({\n maxFeePerGas: string(),\n maxPriorityFeePerGas: string(),\n }),\n ]),\n ),\n }),\n gasIncluded: optional(boolean()),\n bridgeId: string(),\n bridges: array(string()),\n steps: array(StepSchema),\n refuel: optional(RefuelDataSchema),\n priceData: optional(\n type({\n totalFromAmountUsd: optional(string()),\n totalToAmountUsd: optional(string()),\n priceImpact: optional(string()),\n }),\n ),\n});\n\nexport const TxDataSchema = type({\n chainId: number(),\n to: HexAddressSchema,\n from: HexAddressSchema,\n value: HexStringSchema,\n data: HexStringSchema,\n gasLimit: nullable(number()),\n effectiveGas: optional(number()),\n});\n\nexport const QuoteResponseSchema = type({\n quote: QuoteSchema,\n estimatedProcessingTimeInSeconds: number(),\n approval: optional(TxDataSchema),\n trade: union([TxDataSchema, string()]),\n});\n\nexport const validateQuoteResponse = (\n data: unknown,\n): data is Infer<typeof QuoteResponseSchema> => {\n assert(data, QuoteResponseSchema);\n return true;\n};\n"]}
|
|
1
|
+
{"version":3,"file":"validators.mjs","sourceRoot":"","sources":["../../src/utils/validators.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,mCAAmC;AAE/D,OAAO,EACL,MAAM,EACN,OAAO,EACP,MAAM,EACN,IAAI,EACJ,EAAE,EACF,MAAM,EACN,KAAK,EACL,QAAQ,EACR,QAAQ,EACR,KAAK,EACL,MAAM,EACN,KAAK,EACL,MAAM,EACN,OAAO,EACP,YAAY,EACb,8BAA8B;AAC/B,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,wBAAwB;AAEzE,MAAM,CAAN,IAAY,OAIX;AAJD,WAAY,OAAO;IACjB,oCAAyB,CAAA;IACzB,4BAAiB,CAAA;IACjB,2BAAgB,CAAA;AAClB,CAAC,EAJW,OAAO,KAAP,OAAO,QAIlB;AAED,MAAM,CAAN,IAAY,SAEX;AAFD,WAAY,SAAS;IACnB,4BAAe,CAAA;AACjB,CAAC,EAFW,SAAS,KAAT,SAAS,QAEpB;AAED,MAAM,CAAN,IAAY,WAIX;AAJD,WAAY,WAAW;IACrB,gCAAiB,CAAA;IACjB,4BAAa,CAAA;IACb,gCAAiB,CAAA;AACnB,CAAC,EAJW,WAAW,KAAX,WAAW,QAItB;AAED,MAAM,gBAAgB,GAAG,MAAM,CAAS,Y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controller-utils';\nimport type { Infer } from '@metamask/superstruct';\nimport {\n string,\n boolean,\n number,\n type,\n is,\n record,\n array,\n nullable,\n optional,\n enums,\n define,\n union,\n assert,\n pattern,\n intersection,\n} from '@metamask/superstruct';\nimport { CaipAssetTypeStruct, isStrictHexString } from '@metamask/utils';\n\nexport enum FeeType {\n METABRIDGE = 'metabridge',\n REFUEL = 'refuel',\n TX_FEE = 'txFee',\n}\n\nexport enum FeatureId {\n PERPS = 'perps',\n}\n\nexport enum ActionTypes {\n BRIDGE = 'bridge',\n SWAP = 'swap',\n REFUEL = 'refuel',\n}\n\nconst HexAddressSchema = define<string>('HexAddress', (v: unknown) =>\n isValidHexAddress(v as string, { allowNonPrefixed: false }),\n);\n\nconst HexStringSchema = define<string>('HexString', (v: unknown) =>\n isStrictHexString(v as string),\n);\n\nexport const truthyString = (s: string) => Boolean(s?.length);\nconst TruthyDigitStringSchema = pattern(string(), /^\\d+$/u);\n\nconst ChainIdSchema = number();\n\nexport const BridgeAssetSchema = type({\n /**\n * The chainId of the token\n */\n chainId: ChainIdSchema,\n /**\n * An address that the metaswap-api recognizes as the default token\n */\n address: string(),\n /**\n * The assetId of the token\n */\n assetId: CaipAssetTypeStruct,\n /**\n * The symbol of token object\n */\n symbol: string(),\n /**\n * The name for the network\n */\n name: string(),\n decimals: number(),\n /**\n * URL for token icon\n */\n icon: optional(nullable(string())),\n /**\n * URL for token icon\n */\n iconUrl: optional(nullable(string())),\n});\n\nexport const ChainConfigurationSchema = type({\n isActiveSrc: boolean(),\n isActiveDest: boolean(),\n refreshRate: optional(number()),\n topAssets: optional(array(string())),\n isUnifiedUIEnabled: optional(boolean()),\n isSingleSwapBridgeButtonEnabled: optional(boolean()),\n});\n\nexport const PriceImpactThresholdSchema = type({\n gasless: number(),\n normal: number(),\n});\n\nconst GenericQuoteRequestSchema = type({\n aggIds: optional(array(string())),\n bridgeIds: optional(array(string())),\n noFee: optional(boolean()),\n});\n\nconst FeatureIdSchema = enums(Object.values(FeatureId));\n\n/**\n * This is the schema for the feature flags response from the RemoteFeatureFlagController\n */\nexport const PlatformConfigSchema = type({\n priceImpactThreshold: optional(PriceImpactThresholdSchema),\n quoteRequestOverrides: optional(\n record(FeatureIdSchema, optional(GenericQuoteRequestSchema)),\n ),\n minimumVersion: string(),\n refreshRate: number(),\n maxRefreshCount: number(),\n support: boolean(),\n chains: record(string(), ChainConfigurationSchema),\n});\n\nexport const validateFeatureFlagsResponse = (\n data: unknown,\n): data is Infer<typeof PlatformConfigSchema> => {\n return is(data, PlatformConfigSchema);\n};\n\nexport const validateSwapsTokenObject = (\n data: unknown,\n): data is Infer<typeof BridgeAssetSchema> => {\n return is(data, BridgeAssetSchema);\n};\n\nexport const FeeDataSchema = type({\n amount: TruthyDigitStringSchema,\n asset: BridgeAssetSchema,\n});\n\nexport const ProtocolSchema = type({\n name: string(),\n displayName: optional(string()),\n icon: optional(string()),\n});\n\nexport const StepSchema = type({\n action: enums(Object.values(ActionTypes)),\n srcChainId: ChainIdSchema,\n destChainId: optional(ChainIdSchema),\n srcAsset: BridgeAssetSchema,\n destAsset: BridgeAssetSchema,\n srcAmount: string(),\n destAmount: string(),\n protocol: ProtocolSchema,\n});\n\nconst RefuelDataSchema = StepSchema;\n\nexport const QuoteSchema = type({\n requestId: string(),\n srcChainId: ChainIdSchema,\n srcAsset: BridgeAssetSchema,\n /**\n * The amount sent, in atomic amount: amount sent - fees\n * Some tokens have a fee of 0, so sometimes it's equal to amount sent\n */\n srcTokenAmount: string(),\n destChainId: ChainIdSchema,\n destAsset: BridgeAssetSchema,\n /**\n * The amount received, in atomic amount\n */\n destTokenAmount: string(),\n feeData: type({\n [FeeType.METABRIDGE]: FeeDataSchema,\n /**\n * This is the fee for the swap transaction taken from either the\n * src or dest token if the quote has gas fees included or \"gasless\"\n */\n [FeeType.TX_FEE]: optional(\n intersection([\n FeeDataSchema,\n type({\n maxFeePerGas: string(),\n maxPriorityFeePerGas: string(),\n }),\n ]),\n ),\n }),\n gasIncluded: optional(boolean()),\n /**\n * Whether the quote can use EIP-7702 delegated gasless execution\n */\n gasless7702: optional(boolean()),\n bridgeId: string(),\n bridges: array(string()),\n steps: array(StepSchema),\n refuel: optional(RefuelDataSchema),\n priceData: optional(\n type({\n totalFromAmountUsd: optional(string()),\n totalToAmountUsd: optional(string()),\n priceImpact: optional(string()),\n }),\n ),\n});\n\nexport const TxDataSchema = type({\n chainId: number(),\n to: HexAddressSchema,\n from: HexAddressSchema,\n value: HexStringSchema,\n data: HexStringSchema,\n gasLimit: nullable(number()),\n effectiveGas: optional(number()),\n});\n\nexport const QuoteResponseSchema = type({\n quote: QuoteSchema,\n estimatedProcessingTimeInSeconds: number(),\n approval: optional(TxDataSchema),\n trade: union([TxDataSchema, string()]),\n});\n\nexport const validateQuoteResponse = (\n data: unknown,\n): data is Infer<typeof QuoteResponseSchema> => {\n assert(data, QuoteResponseSchema);\n return true;\n};\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@metamask/bridge-controller",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "41.1.0",
|
|
4
4
|
"description": "Manages bridge-related quote fetching functionality for MetaMask",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"MetaMask",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"@ethersproject/constants": "^5.7.0",
|
|
53
53
|
"@ethersproject/contracts": "^5.7.0",
|
|
54
54
|
"@ethersproject/providers": "^5.7.0",
|
|
55
|
-
"@metamask/base-controller": "^8.
|
|
55
|
+
"@metamask/base-controller": "^8.2.0",
|
|
56
56
|
"@metamask/controller-utils": "^11.12.0",
|
|
57
57
|
"@metamask/gas-fee-controller": "^24.0.0",
|
|
58
58
|
"@metamask/keyring-api": "^20.1.0",
|