@metamask/bridge-controller 61.0.0 → 62.0.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 +19 -1
- package/dist/index.cjs +3 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/dist/utils/metrics/properties.cjs +21 -1
- package/dist/utils/metrics/properties.cjs.map +1 -1
- package/dist/utils/metrics/properties.d.cts +14 -2
- package/dist/utils/metrics/properties.d.cts.map +1 -1
- package/dist/utils/metrics/properties.d.mts +14 -2
- package/dist/utils/metrics/properties.d.mts.map +1 -1
- package/dist/utils/metrics/properties.mjs +19 -0
- package/dist/utils/metrics/properties.mjs.map +1 -1
- package/dist/utils/metrics/types.cjs.map +1 -1
- package/dist/utils/metrics/types.d.cts +2 -1
- package/dist/utils/metrics/types.d.cts.map +1 -1
- package/dist/utils/metrics/types.d.mts +2 -1
- package/dist/utils/metrics/types.d.mts.map +1 -1
- package/dist/utils/metrics/types.mjs.map +1 -1
- package/package.json +15 -15
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,23 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [62.0.0]
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- Add and export `getQuotesReceivedProperties` utility to build the metrics payload for clients ([#7182](https://github.com/MetaMask/core/pull/7182))
|
|
15
|
+
|
|
16
|
+
### Changed
|
|
17
|
+
|
|
18
|
+
- Bump `@metamask/polling-controller` from `^15.0.0` to `^16.0.0` ([#7202](https://github.com/MetaMask/core/pull/7202))
|
|
19
|
+
- Bump `@metamask/multichain-network-controller` from `^2.0.0` to `^3.0.0` ([#7202](https://github.com/MetaMask/core/pull/7202))
|
|
20
|
+
- Bump `@metamask/gas-fee-controller` from `^25.0.0` to `^26.0.0` ([#7202](https://github.com/MetaMask/core/pull/7202))
|
|
21
|
+
- Bump `@metamask/controller-utils` from `^11.15.0` to `^11.16.0` ([#7202](https://github.com/MetaMask/core/pull/7202))
|
|
22
|
+
- **BREAKING:** Bump `@metamask/transaction-controller` from `^61.0.0` to `^62.0.0` ([#7202](https://github.com/MetaMask/core/pull/7202))
|
|
23
|
+
- **BREAKING:** Bump `@metamask/network-controller` from `^25.0.0` to `^26.0.0` ([#7202](https://github.com/MetaMask/core/pull/7202))
|
|
24
|
+
- **BREAKING:** Bump `@metamask/assets-controllers` from `^89.0.0` to `^90.0.0` ([#7202](https://github.com/MetaMask/core/pull/7202))
|
|
25
|
+
- **BREAKING:** Bump `@metamask/accounts-controller` from `^34.0.0` to `^35.0.0` ([#7202](https://github.com/MetaMask/core/pull/7202))
|
|
26
|
+
|
|
10
27
|
## [61.0.0]
|
|
11
28
|
|
|
12
29
|
### Changed
|
|
@@ -847,7 +864,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
847
864
|
|
|
848
865
|
- Initial release ([#5317](https://github.com/MetaMask/core/pull/5317))
|
|
849
866
|
|
|
850
|
-
[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/bridge-controller@
|
|
867
|
+
[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/bridge-controller@62.0.0...HEAD
|
|
868
|
+
[62.0.0]: https://github.com/MetaMask/core/compare/@metamask/bridge-controller@61.0.0...@metamask/bridge-controller@62.0.0
|
|
851
869
|
[61.0.0]: https://github.com/MetaMask/core/compare/@metamask/bridge-controller@60.1.0...@metamask/bridge-controller@61.0.0
|
|
852
870
|
[60.1.0]: https://github.com/MetaMask/core/compare/@metamask/bridge-controller@60.0.0...@metamask/bridge-controller@60.1.0
|
|
853
871
|
[60.0.0]: https://github.com/MetaMask/core/compare/@metamask/bridge-controller@59.0.0...@metamask/bridge-controller@60.0.0
|
package/dist/index.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
exports.BRIDGE_DEFAULT_SLIPPAGE = exports.getBridgeFeatureFlags = exports.DEFAULT_FEATURE_FLAG_CONFIG = exports.selectMinimumBalanceForRentExemptionInSOL = exports.selectBridgeFeatureFlags = exports.selectIsQuoteExpired = exports.selectExchangeRateByChainIdAndAddress = exports.selectDefaultSlippagePercentage = exports.selectBridgeQuotes = exports.isTronTrade = exports.isBitcoinTrade = exports.extractTradeData = exports.formatAddressToAssetId = exports.formatAddressToCaipReference = exports.formatChainIdToHex = exports.formatChainIdToCaip = exports.getClientHeaders = void 0;
|
|
3
|
+
exports.calcLatestSrcBalance = exports.calcSlippagePercentage = exports.formatEtaInMinutes = exports.isValidQuoteRequest = exports.isCrossChain = exports.getDefaultBridgeControllerState = exports.getNativeAssetForChainId = exports.isNonEvmChainId = exports.isBitcoinChainId = exports.isSolanaChainId = exports.isNativeAddress = exports.isEthUsdt = exports.getEthUsdtResetData = exports.MetricsSwapType = exports.MetricsActionType = exports.SWAPS_API_V2_BASE_URL = exports.SWAPS_CHAINID_DEFAULT_TOKEN_MAP = exports.BRIDGE_PROD_API_BASE_URL = exports.BRIDGE_DEV_API_BASE_URL = exports.METABRIDGE_CHAIN_TO_ADDRESS_MAP = exports.DEFAULT_BRIDGE_CONTROLLER_STATE = exports.DEFAULT_MAX_REFRESH_COUNT = exports.REFRESH_INTERVAL_MS = exports.BRIDGE_MM_FEE_RATE = exports.BRIDGE_PREFERRED_GAS_ESTIMATE = exports.BRIDGE_QUOTE_MAX_RETURN_DIFFERENCE_PERCENTAGE = exports.BRIDGE_QUOTE_MAX_ETA_SECONDS = exports.BRIDGE_CONTROLLER_NAME = exports.BridgeClientId = exports.ALLOWED_BRIDGE_CHAIN_IDS = exports.FeatureId = exports.BridgeAssetSchema = exports.ActionTypes = exports.FeeType = exports.BridgeBackgroundAction = exports.BridgeUserAction = exports.RequestStatus = exports.ChainId = exports.SortOrder = exports.AssetType = exports.StatusTypes = exports.getQuotesReceivedProperties = exports.isCustomSlippage = exports.isHardwareWallet = exports.getSwapType = exports.getRequestParams = exports.formatProviderLabel = exports.UNIFIED_SWAP_BRIDGE_EVENT_CATEGORY = exports.UnifiedSwapBridgeEventName = exports.BridgeController = void 0;
|
|
4
|
+
exports.BRIDGE_DEFAULT_SLIPPAGE = exports.getBridgeFeatureFlags = exports.DEFAULT_FEATURE_FLAG_CONFIG = exports.selectMinimumBalanceForRentExemptionInSOL = exports.selectBridgeFeatureFlags = exports.selectIsQuoteExpired = exports.selectExchangeRateByChainIdAndAddress = exports.selectDefaultSlippagePercentage = exports.selectBridgeQuotes = exports.isTronTrade = exports.isBitcoinTrade = exports.extractTradeData = exports.formatAddressToAssetId = exports.formatAddressToCaipReference = exports.formatChainIdToHex = exports.formatChainIdToCaip = exports.getClientHeaders = exports.fetchBridgeTokens = void 0;
|
|
5
5
|
var bridge_controller_1 = require("./bridge-controller.cjs");
|
|
6
6
|
Object.defineProperty(exports, "BridgeController", { enumerable: true, get: function () { return bridge_controller_1.BridgeController; } });
|
|
7
7
|
var constants_1 = require("./utils/metrics/constants.cjs");
|
|
@@ -13,6 +13,7 @@ Object.defineProperty(exports, "getRequestParams", { enumerable: true, get: func
|
|
|
13
13
|
Object.defineProperty(exports, "getSwapType", { enumerable: true, get: function () { return properties_1.getSwapType; } });
|
|
14
14
|
Object.defineProperty(exports, "isHardwareWallet", { enumerable: true, get: function () { return properties_1.isHardwareWallet; } });
|
|
15
15
|
Object.defineProperty(exports, "isCustomSlippage", { enumerable: true, get: function () { return properties_1.isCustomSlippage; } });
|
|
16
|
+
Object.defineProperty(exports, "getQuotesReceivedProperties", { enumerable: true, get: function () { return properties_1.getQuotesReceivedProperties; } });
|
|
16
17
|
var types_1 = require("./types.cjs");
|
|
17
18
|
Object.defineProperty(exports, "StatusTypes", { enumerable: true, get: function () { return types_1.StatusTypes; } });
|
|
18
19
|
var types_2 = require("./types.cjs");
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;AAAA,6DAAuD;AAA9C,qHAAA,gBAAgB,OAAA;AAEzB,2DAGmC;AAFjC,uHAAA,0BAA0B,OAAA;AAC1B,+HAAA,kCAAkC,OAAA;
|
|
1
|
+
{"version":3,"file":"index.cjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;AAAA,6DAAuD;AAA9C,qHAAA,gBAAgB,OAAA;AAEzB,2DAGmC;AAFjC,uHAAA,0BAA0B,OAAA;AAC1B,+HAAA,kCAAkC,OAAA;AAcpC,6DAOoC;AANlC,iHAAA,mBAAmB,OAAA;AACnB,8GAAA,gBAAgB,OAAA;AAChB,yGAAA,WAAW,OAAA;AACX,8GAAA,gBAAgB,OAAA;AAChB,8GAAA,gBAAgB,OAAA;AAChB,yHAAA,2BAA2B,OAAA;AA8B7B,qCAAsC;AAA7B,oGAAA,WAAW,OAAA;AAEpB,qCASiB;AARf,kGAAA,SAAS,OAAA;AACT,kGAAA,SAAS,OAAA;AACT,gGAAA,OAAO,OAAA;AACP,sGAAA,aAAa,OAAA;AACb,yGAAA,gBAAgB,OAAA;AAChB,+GAAA,sBAAsB,OAAA;AAKxB,qDAK4B;AAJ1B,qGAAA,OAAO,OAAA;AACP,yGAAA,WAAW,OAAA;AACX,+GAAA,iBAAiB,OAAA;AACjB,uGAAA,SAAS,OAAA;AAGX,iDAc4B;AAb1B,kHAAA,wBAAwB,OAAA;AACxB,wGAAA,cAAc,OAAA;AACd,gHAAA,sBAAsB,OAAA;AACtB,sHAAA,4BAA4B,OAAA;AAC5B,uIAAA,6CAA6C,OAAA;AAC7C,uHAAA,6BAA6B,OAAA;AAC7B,4GAAA,kBA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DAAiE;AAAxD,qHAAA,2BAA2B,OAAA;AAEpC,2DAA8D;AAArD,sHAAA,qBAAqB,OAAA;AAE9B,iDAA2D;AAAlD,mHAAA,uBAAuB,OAAA","sourcesContent":["export { BridgeController } from './bridge-controller';\n\nexport {\n UnifiedSwapBridgeEventName,\n UNIFIED_SWAP_BRIDGE_EVENT_CATEGORY,\n} from './utils/metrics/constants';\n\nexport type {\n RequiredEventContextFromClient,\n CrossChainSwapsEventProperties,\n TradeData,\n RequestParams,\n RequestMetadata,\n TxStatusData,\n QuoteFetchData,\n QuoteWarning,\n} from './utils/metrics/types';\n\nexport {\n formatProviderLabel,\n getRequestParams,\n getSwapType,\n isHardwareWallet,\n isCustomSlippage,\n getQuotesReceivedProperties,\n} from './utils/metrics/properties';\n\nexport type {\n ChainConfiguration,\n L1GasFees,\n NonEvmFees,\n QuoteMetadata,\n GasMultiplierByChainId,\n FeatureFlagResponse,\n BridgeAsset,\n GenericQuoteRequest,\n Protocol,\n TokenAmountValues,\n Step,\n RefuelData,\n Quote,\n QuoteResponse,\n FeeData,\n TxData,\n BitcoinTradeData,\n TronTradeData,\n BridgeControllerState,\n BridgeControllerAction,\n BridgeControllerActions,\n BridgeControllerEvents,\n BridgeControllerMessenger,\n FeatureFlagsPlatformConfig,\n} from './types';\n\nexport { StatusTypes } from './types';\n\nexport {\n AssetType,\n SortOrder,\n ChainId,\n RequestStatus,\n BridgeUserAction,\n BridgeBackgroundAction,\n type BridgeControllerGetStateAction,\n type BridgeControllerStateChangeEvent,\n} from './types';\n\nexport {\n FeeType,\n ActionTypes,\n BridgeAssetSchema,\n FeatureId,\n} from './utils/validators';\n\nexport {\n ALLOWED_BRIDGE_CHAIN_IDS,\n BridgeClientId,\n BRIDGE_CONTROLLER_NAME,\n BRIDGE_QUOTE_MAX_ETA_SECONDS,\n BRIDGE_QUOTE_MAX_RETURN_DIFFERENCE_PERCENTAGE,\n BRIDGE_PREFERRED_GAS_ESTIMATE,\n BRIDGE_MM_FEE_RATE,\n REFRESH_INTERVAL_MS,\n DEFAULT_MAX_REFRESH_COUNT,\n DEFAULT_BRIDGE_CONTROLLER_STATE,\n METABRIDGE_CHAIN_TO_ADDRESS_MAP,\n BRIDGE_DEV_API_BASE_URL,\n BRIDGE_PROD_API_BASE_URL,\n} from './constants/bridge';\n\nexport type { AllowedBridgeChainIds } from './constants/bridge';\n\nexport {\n /**\n * @deprecated This type should not be used. Use {@link BridgeAsset} instead.\n */\n type SwapsTokenObject,\n /**\n * @deprecated This map should not be used. Use getNativeAssetForChainId\" } instead.\n */\n SWAPS_CHAINID_DEFAULT_TOKEN_MAP,\n} from './constants/tokens';\n\nexport { SWAPS_API_V2_BASE_URL } from './constants/swaps';\n\nexport { MetricsActionType, MetricsSwapType } from './utils/metrics/constants';\n\nexport {\n getEthUsdtResetData,\n isEthUsdt,\n isNativeAddress,\n isSolanaChainId,\n isBitcoinChainId,\n isNonEvmChainId,\n getNativeAssetForChainId,\n getDefaultBridgeControllerState,\n isCrossChain,\n} from './utils/bridge';\n\nexport {\n isValidQuoteRequest,\n formatEtaInMinutes,\n calcSlippagePercentage,\n} from './utils/quote';\n\nexport { calcLatestSrcBalance } from './utils/balance';\n\nexport { fetchBridgeTokens, getClientHeaders } from './utils/fetch';\n\nexport {\n formatChainIdToCaip,\n formatChainIdToHex,\n formatAddressToCaipReference,\n formatAddressToAssetId,\n} from './utils/caip-formatters';\n\nexport {\n extractTradeData,\n isBitcoinTrade,\n isTronTrade,\n type Trade,\n} from './utils/trade-utils';\n\nexport {\n selectBridgeQuotes,\n selectDefaultSlippagePercentage,\n type BridgeAppState,\n selectExchangeRateByChainIdAndAddress,\n selectIsQuoteExpired,\n selectBridgeFeatureFlags,\n selectMinimumBalanceForRentExemptionInSOL,\n} from './selectors';\n\nexport { DEFAULT_FEATURE_FLAG_CONFIG } from './constants/bridge';\n\nexport { getBridgeFeatureFlags } from './utils/feature-flags';\n\nexport { BRIDGE_DEFAULT_SLIPPAGE } from './utils/slippage';\n"]}
|
package/dist/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { BridgeController } from "./bridge-controller.cjs";
|
|
2
2
|
export { UnifiedSwapBridgeEventName, UNIFIED_SWAP_BRIDGE_EVENT_CATEGORY, } from "./utils/metrics/constants.cjs";
|
|
3
|
-
export type { RequiredEventContextFromClient, CrossChainSwapsEventProperties, TradeData, RequestParams, RequestMetadata, TxStatusData, QuoteFetchData, } from "./utils/metrics/types.cjs";
|
|
4
|
-
export { formatProviderLabel, getRequestParams, getSwapType, isHardwareWallet, isCustomSlippage, } from "./utils/metrics/properties.cjs";
|
|
3
|
+
export type { RequiredEventContextFromClient, CrossChainSwapsEventProperties, TradeData, RequestParams, RequestMetadata, TxStatusData, QuoteFetchData, QuoteWarning, } from "./utils/metrics/types.cjs";
|
|
4
|
+
export { formatProviderLabel, getRequestParams, getSwapType, isHardwareWallet, isCustomSlippage, getQuotesReceivedProperties, } from "./utils/metrics/properties.cjs";
|
|
5
5
|
export type { ChainConfiguration, L1GasFees, NonEvmFees, QuoteMetadata, GasMultiplierByChainId, FeatureFlagResponse, BridgeAsset, GenericQuoteRequest, Protocol, TokenAmountValues, Step, RefuelData, Quote, QuoteResponse, FeeData, TxData, BitcoinTradeData, TronTradeData, BridgeControllerState, BridgeControllerAction, BridgeControllerActions, BridgeControllerEvents, BridgeControllerMessenger, FeatureFlagsPlatformConfig, } from "./types.cjs";
|
|
6
6
|
export { StatusTypes } from "./types.cjs";
|
|
7
7
|
export { AssetType, SortOrder, ChainId, RequestStatus, BridgeUserAction, BridgeBackgroundAction, type BridgeControllerGetStateAction, type BridgeControllerStateChangeEvent, } from "./types.cjs";
|
package/dist/index.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,gCAA4B;AAEvD,OAAO,EACL,0BAA0B,EAC1B,kCAAkC,GACnC,sCAAkC;AAEnC,YAAY,EACV,8BAA8B,EAC9B,8BAA8B,EAC9B,SAAS,EACT,aAAa,EACb,eAAe,EACf,YAAY,EACZ,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,gCAA4B;AAEvD,OAAO,EACL,0BAA0B,EAC1B,kCAAkC,GACnC,sCAAkC;AAEnC,YAAY,EACV,8BAA8B,EAC9B,8BAA8B,EAC9B,SAAS,EACT,aAAa,EACb,eAAe,EACf,YAAY,EACZ,cAAc,EACd,YAAY,GACb,kCAA8B;AAE/B,OAAO,EACL,mBAAmB,EACnB,gBAAgB,EAChB,WAAW,EACX,gBAAgB,EAChB,gBAAgB,EAChB,2BAA2B,GAC5B,uCAAmC;AAEpC,YAAY,EACV,kBAAkB,EAClB,SAAS,EACT,UAAU,EACV,aAAa,EACb,sBAAsB,EACtB,mBAAmB,EACnB,WAAW,EACX,mBAAmB,EACnB,QAAQ,EACR,iBAAiB,EACjB,IAAI,EACJ,UAAU,EACV,KAAK,EACL,aAAa,EACb,OAAO,EACP,MAAM,EACN,gBAAgB,EAChB,aAAa,EACb,qBAAqB,EACrB,sBAAsB,EACtB,uBAAuB,EACvB,sBAAsB,EACtB,yBAAyB,EACzB,0BAA0B,GAC3B,oBAAgB;AAEjB,OAAO,EAAE,WAAW,EAAE,oBAAgB;AAEtC,OAAO,EACL,SAAS,EACT,SAAS,EACT,OAAO,EACP,aAAa,EACb,gBAAgB,EAChB,sBAAsB,EACtB,KAAK,8BAA8B,EACnC,KAAK,gCAAgC,GACtC,oBAAgB;AAEjB,OAAO,EACL,OAAO,EACP,WAAW,EACX,iBAAiB,EACjB,SAAS,GACV,+BAA2B;AAE5B,OAAO,EACL,wBAAwB,EACxB,cAAc,EACd,sBAAsB,EACtB,4BAA4B,EAC5B,6CAA6C,EAC7C,6BAA6B,EAC7B,kBAAkB,EAClB,mBAAmB,EACnB,yBAAyB,EACzB,+BAA+B,EAC/B,+BAA+B,EAC/B,uBAAuB,EACvB,wBAAwB,GACzB,+BAA2B;AAE5B,YAAY,EAAE,qBAAqB,EAAE,+BAA2B;AAEhE,OAAO;AACL;;GAEG;AACH,KAAK,gBAAgB;AACrB;;GAEG;AACH,+BAA+B,GAChC,+BAA2B;AAE5B,OAAO,EAAE,qBAAqB,EAAE,8BAA0B;AAE1D,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,sCAAkC;AAE/E,OAAO,EACL,mBAAmB,EACnB,SAAS,EACT,eAAe,EACf,eAAe,EACf,gBAAgB,EAChB,eAAe,EACf,wBAAwB,EACxB,+BAA+B,EAC/B,YAAY,GACb,2BAAuB;AAExB,OAAO,EACL,mBAAmB,EACnB,kBAAkB,EAClB,sBAAsB,GACvB,0BAAsB;AAEvB,OAAO,EAAE,oBAAoB,EAAE,4BAAwB;AAEvD,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,0BAAsB;AAEpE,OAAO,EACL,mBAAmB,EACnB,kBAAkB,EAClB,4BAA4B,EAC5B,sBAAsB,GACvB,oCAAgC;AAEjC,OAAO,EACL,gBAAgB,EAChB,cAAc,EACd,WAAW,EACX,KAAK,KAAK,GACX,gCAA4B;AAE7B,OAAO,EACL,kBAAkB,EAClB,+BAA+B,EAC/B,KAAK,cAAc,EACnB,qCAAqC,EACrC,oBAAoB,EACpB,wBAAwB,EACxB,yCAAyC,GAC1C,wBAAoB;AAErB,OAAO,EAAE,2BAA2B,EAAE,+BAA2B;AAEjE,OAAO,EAAE,qBAAqB,EAAE,kCAA8B;AAE9D,OAAO,EAAE,uBAAuB,EAAE,6BAAyB"}
|
package/dist/index.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { BridgeController } from "./bridge-controller.mjs";
|
|
2
2
|
export { UnifiedSwapBridgeEventName, UNIFIED_SWAP_BRIDGE_EVENT_CATEGORY, } from "./utils/metrics/constants.mjs";
|
|
3
|
-
export type { RequiredEventContextFromClient, CrossChainSwapsEventProperties, TradeData, RequestParams, RequestMetadata, TxStatusData, QuoteFetchData, } from "./utils/metrics/types.mjs";
|
|
4
|
-
export { formatProviderLabel, getRequestParams, getSwapType, isHardwareWallet, isCustomSlippage, } from "./utils/metrics/properties.mjs";
|
|
3
|
+
export type { RequiredEventContextFromClient, CrossChainSwapsEventProperties, TradeData, RequestParams, RequestMetadata, TxStatusData, QuoteFetchData, QuoteWarning, } from "./utils/metrics/types.mjs";
|
|
4
|
+
export { formatProviderLabel, getRequestParams, getSwapType, isHardwareWallet, isCustomSlippage, getQuotesReceivedProperties, } from "./utils/metrics/properties.mjs";
|
|
5
5
|
export type { ChainConfiguration, L1GasFees, NonEvmFees, QuoteMetadata, GasMultiplierByChainId, FeatureFlagResponse, BridgeAsset, GenericQuoteRequest, Protocol, TokenAmountValues, Step, RefuelData, Quote, QuoteResponse, FeeData, TxData, BitcoinTradeData, TronTradeData, BridgeControllerState, BridgeControllerAction, BridgeControllerActions, BridgeControllerEvents, BridgeControllerMessenger, FeatureFlagsPlatformConfig, } from "./types.mjs";
|
|
6
6
|
export { StatusTypes } from "./types.mjs";
|
|
7
7
|
export { AssetType, SortOrder, ChainId, RequestStatus, BridgeUserAction, BridgeBackgroundAction, type BridgeControllerGetStateAction, type BridgeControllerStateChangeEvent, } from "./types.mjs";
|
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,gCAA4B;AAEvD,OAAO,EACL,0BAA0B,EAC1B,kCAAkC,GACnC,sCAAkC;AAEnC,YAAY,EACV,8BAA8B,EAC9B,8BAA8B,EAC9B,SAAS,EACT,aAAa,EACb,eAAe,EACf,YAAY,EACZ,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"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;;GAEG;AACH,+BAA+B,GAChC,+BAA2B;AAE5B,OAAO,EAAE,qBAAqB,EAAE,8BAA0B;AAE1D,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,sCAAkC;AAE/E,OAAO,EACL,mBAAmB,EACnB,SAAS,EACT,eAAe,EACf,eAAe,EACf,gBAAgB,EAChB,eAAe,EACf,wBAAwB,EACxB,+BAA+B,EAC/B,YAAY,GACb,2BAAuB;AAExB,OAAO,EACL,mBAAmB,EACnB,kBAAkB,EAClB,sBAAsB,GACvB,0BAAsB;AAEvB,OAAO,EAAE,oBAAoB,EAAE,4BAAwB;AAEvD,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,0BAAsB;AAEpE,OAAO,EACL,mBAAmB,EACnB,kBAAkB,EAClB,4BAA4B,EAC5B,sBAAsB,GACvB,oCAAgC;AAEjC,OAAO,EACL,gBAAgB,EAChB,cAAc,EACd,WAAW,EACX,KAAK,KAAK,GACX,gCAA4B;AAE7B,OAAO,EACL,kBAAkB,EAClB,+BAA+B,EAC/B,KAAK,cAAc,EACnB,qCAAqC,EACrC,oBAAoB,EACpB,wBAAwB,EACxB,yCAAyC,GAC1C,wBAAoB;AAErB,OAAO,EAAE,2BAA2B,EAAE,+BAA2B;AAEjE,OAAO,EAAE,qBAAqB,EAAE,kCAA8B;AAE9D,OAAO,EAAE,uBAAuB,EAAE,6BAAyB"}
|
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { BridgeController } from "./bridge-controller.mjs";
|
|
2
2
|
export { UnifiedSwapBridgeEventName, UNIFIED_SWAP_BRIDGE_EVENT_CATEGORY } from "./utils/metrics/constants.mjs";
|
|
3
|
-
export { formatProviderLabel, getRequestParams, getSwapType, isHardwareWallet, isCustomSlippage } from "./utils/metrics/properties.mjs";
|
|
3
|
+
export { formatProviderLabel, getRequestParams, getSwapType, isHardwareWallet, isCustomSlippage, getQuotesReceivedProperties } from "./utils/metrics/properties.mjs";
|
|
4
4
|
export { StatusTypes } from "./types.mjs";
|
|
5
5
|
export { AssetType, SortOrder, ChainId, RequestStatus, BridgeUserAction, BridgeBackgroundAction } from "./types.mjs";
|
|
6
6
|
export { FeeType, ActionTypes, BridgeAssetSchema, FeatureId } from "./utils/validators.mjs";
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,gCAA4B;AAEvD,OAAO,EACL,0BAA0B,EAC1B,kCAAkC,EACnC,sCAAkC;
|
|
1
|
+
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,gCAA4B;AAEvD,OAAO,EACL,0BAA0B,EAC1B,kCAAkC,EACnC,sCAAkC;AAanC,OAAO,EACL,mBAAmB,EACnB,gBAAgB,EAChB,WAAW,EACX,gBAAgB,EAChB,gBAAgB,EAChB,2BAA2B,EAC5B,uCAAmC;AA6BpC,OAAO,EAAE,WAAW,EAAE,oBAAgB;AAEtC,OAAO,EACL,SAAS,EACT,SAAS,EACT,OAAO,EACP,aAAa,EACb,gBAAgB,EAChB,sBAAsB,EAGvB,oBAAgB;AAEjB,OAAO,EACL,OAAO,EACP,WAAW,EACX,iBAAiB,EACjB,SAAS,EACV,+BAA2B;AAE5B,OAAO,EACL,wBAAwB,EACxB,cAAc,EACd,sBAAsB,EACtB,4BAA4B,EAC5B,6CAA6C,EAC7C,6BAA6B,EAC7B,kBAAkB,EAClB,mBAAmB,EACnB,yBAAyB,EACzB,+BAA+B,EAC/B,+BAA+B,EAC/B,uBAAuB,EACvB,wBAAwB,EACzB,+BAA2B;AAI5B,OAAO;AAKL;;GAEG;AACH,+BAA+B,EAChC,+BAA2B;AAE5B,OAAO,EAAE,qBAAqB,EAAE,8BAA0B;AAE1D,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,sCAAkC;AAE/E,OAAO,EACL,mBAAmB,EACnB,SAAS,EACT,eAAe,EACf,eAAe,EACf,gBAAgB,EAChB,eAAe,EACf,wBAAwB,EACxB,+BAA+B,EAC/B,YAAY,EACb,2BAAuB;AAExB,OAAO,EACL,mBAAmB,EACnB,kBAAkB,EAClB,sBAAsB,EACvB,0BAAsB;AAEvB,OAAO,EAAE,oBAAoB,EAAE,4BAAwB;AAEvD,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,0BAAsB;AAEpE,OAAO,EACL,mBAAmB,EACnB,kBAAkB,EAClB,4BAA4B,EAC5B,sBAAsB,EACvB,oCAAgC;AAEjC,OAAO,EACL,gBAAgB,EAChB,cAAc,EACd,WAAW,EAEZ,gCAA4B;AAE7B,OAAO,EACL,kBAAkB,EAClB,+BAA+B,EAE/B,qCAAqC,EACrC,oBAAoB,EACpB,wBAAwB,EACxB,yCAAyC,EAC1C,wBAAoB;AAErB,OAAO,EAAE,2BAA2B,EAAE,+BAA2B;AAEjE,OAAO,EAAE,qBAAqB,EAAE,kCAA8B;AAE9D,OAAO,EAAE,uBAAuB,EAAE,6BAAyB","sourcesContent":["export { BridgeController } from './bridge-controller';\n\nexport {\n UnifiedSwapBridgeEventName,\n UNIFIED_SWAP_BRIDGE_EVENT_CATEGORY,\n} from './utils/metrics/constants';\n\nexport type {\n RequiredEventContextFromClient,\n CrossChainSwapsEventProperties,\n TradeData,\n RequestParams,\n RequestMetadata,\n TxStatusData,\n QuoteFetchData,\n QuoteWarning,\n} from './utils/metrics/types';\n\nexport {\n formatProviderLabel,\n getRequestParams,\n getSwapType,\n isHardwareWallet,\n isCustomSlippage,\n getQuotesReceivedProperties,\n} from './utils/metrics/properties';\n\nexport type {\n ChainConfiguration,\n L1GasFees,\n NonEvmFees,\n QuoteMetadata,\n GasMultiplierByChainId,\n FeatureFlagResponse,\n BridgeAsset,\n GenericQuoteRequest,\n Protocol,\n TokenAmountValues,\n Step,\n RefuelData,\n Quote,\n QuoteResponse,\n FeeData,\n TxData,\n BitcoinTradeData,\n TronTradeData,\n BridgeControllerState,\n BridgeControllerAction,\n BridgeControllerActions,\n BridgeControllerEvents,\n BridgeControllerMessenger,\n FeatureFlagsPlatformConfig,\n} from './types';\n\nexport { StatusTypes } from './types';\n\nexport {\n AssetType,\n SortOrder,\n ChainId,\n RequestStatus,\n BridgeUserAction,\n BridgeBackgroundAction,\n type BridgeControllerGetStateAction,\n type BridgeControllerStateChangeEvent,\n} from './types';\n\nexport {\n FeeType,\n ActionTypes,\n BridgeAssetSchema,\n FeatureId,\n} from './utils/validators';\n\nexport {\n ALLOWED_BRIDGE_CHAIN_IDS,\n BridgeClientId,\n BRIDGE_CONTROLLER_NAME,\n BRIDGE_QUOTE_MAX_ETA_SECONDS,\n BRIDGE_QUOTE_MAX_RETURN_DIFFERENCE_PERCENTAGE,\n BRIDGE_PREFERRED_GAS_ESTIMATE,\n BRIDGE_MM_FEE_RATE,\n REFRESH_INTERVAL_MS,\n DEFAULT_MAX_REFRESH_COUNT,\n DEFAULT_BRIDGE_CONTROLLER_STATE,\n METABRIDGE_CHAIN_TO_ADDRESS_MAP,\n BRIDGE_DEV_API_BASE_URL,\n BRIDGE_PROD_API_BASE_URL,\n} from './constants/bridge';\n\nexport type { AllowedBridgeChainIds } from './constants/bridge';\n\nexport {\n /**\n * @deprecated This type should not be used. Use {@link BridgeAsset} instead.\n */\n type SwapsTokenObject,\n /**\n * @deprecated This map should not be used. Use getNativeAssetForChainId\" } instead.\n */\n SWAPS_CHAINID_DEFAULT_TOKEN_MAP,\n} from './constants/tokens';\n\nexport { SWAPS_API_V2_BASE_URL } from './constants/swaps';\n\nexport { MetricsActionType, MetricsSwapType } from './utils/metrics/constants';\n\nexport {\n getEthUsdtResetData,\n isEthUsdt,\n isNativeAddress,\n isSolanaChainId,\n isBitcoinChainId,\n isNonEvmChainId,\n getNativeAssetForChainId,\n getDefaultBridgeControllerState,\n isCrossChain,\n} from './utils/bridge';\n\nexport {\n isValidQuoteRequest,\n formatEtaInMinutes,\n calcSlippagePercentage,\n} from './utils/quote';\n\nexport { calcLatestSrcBalance } from './utils/balance';\n\nexport { fetchBridgeTokens, getClientHeaders } from './utils/fetch';\n\nexport {\n formatChainIdToCaip,\n formatChainIdToHex,\n formatAddressToCaipReference,\n formatAddressToAssetId,\n} from './utils/caip-formatters';\n\nexport {\n extractTradeData,\n isBitcoinTrade,\n isTronTrade,\n type Trade,\n} from './utils/trade-utils';\n\nexport {\n selectBridgeQuotes,\n selectDefaultSlippagePercentage,\n type BridgeAppState,\n selectExchangeRateByChainIdAndAddress,\n selectIsQuoteExpired,\n selectBridgeFeatureFlags,\n selectMinimumBalanceForRentExemptionInSOL,\n} from './selectors';\n\nexport { DEFAULT_FEATURE_FLAG_CONFIG } from './constants/bridge';\n\nexport { getBridgeFeatureFlags } from './utils/feature-flags';\n\nexport { BRIDGE_DEFAULT_SLIPPAGE } from './utils/slippage';\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isCustomSlippage = exports.isHardwareWallet = exports.getRequestParams = exports.formatProviderLabel = exports.getSwapTypeFromQuote = exports.getSwapType = exports.toInputChangedPropertyValue = exports.toInputChangedPropertyKey = void 0;
|
|
3
|
+
exports.getQuotesReceivedProperties = exports.isCustomSlippage = exports.isHardwareWallet = exports.getRequestParams = exports.formatProviderLabel = exports.getSwapTypeFromQuote = exports.getSwapType = exports.toInputChangedPropertyValue = exports.toInputChangedPropertyKey = void 0;
|
|
4
4
|
const constants_1 = require("./constants.cjs");
|
|
5
5
|
const bridge_1 = require("../../constants/bridge.cjs");
|
|
6
6
|
const types_1 = require("../../types.cjs");
|
|
@@ -69,4 +69,24 @@ const isCustomSlippage = (slippage) => {
|
|
|
69
69
|
return slippage !== bridge_1.DEFAULT_BRIDGE_CONTROLLER_STATE.quoteRequest.slippage;
|
|
70
70
|
};
|
|
71
71
|
exports.isCustomSlippage = isCustomSlippage;
|
|
72
|
+
const getQuotesReceivedProperties = (activeQuote, warnings = [], isSubmittable = true, recommendedQuote) => {
|
|
73
|
+
const provider = activeQuote ? (0, exports.formatProviderLabel)(activeQuote.quote) : '_';
|
|
74
|
+
return {
|
|
75
|
+
can_submit: isSubmittable,
|
|
76
|
+
gas_included: Boolean(activeQuote?.quote?.gasIncluded),
|
|
77
|
+
gas_included_7702: Boolean(activeQuote?.quote?.gasIncluded7702),
|
|
78
|
+
quoted_time_minutes: activeQuote?.estimatedProcessingTimeInSeconds
|
|
79
|
+
? activeQuote.estimatedProcessingTimeInSeconds / 60
|
|
80
|
+
: 0,
|
|
81
|
+
usd_quoted_gas: Number(activeQuote?.gasFee?.effective?.usd ?? 0),
|
|
82
|
+
usd_quoted_return: Number(activeQuote?.toTokenAmount?.usd ?? 0),
|
|
83
|
+
best_quote_provider: recommendedQuote
|
|
84
|
+
? (0, exports.formatProviderLabel)(recommendedQuote.quote)
|
|
85
|
+
: provider,
|
|
86
|
+
provider,
|
|
87
|
+
warnings,
|
|
88
|
+
price_impact: Number(activeQuote?.quote.priceData?.priceImpact ?? 0),
|
|
89
|
+
};
|
|
90
|
+
};
|
|
91
|
+
exports.getQuotesReceivedProperties = getQuotesReceivedProperties;
|
|
72
92
|
//# sourceMappingURL=properties.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"properties.cjs","sourceRoot":"","sources":["../../../src/utils/metrics/properties.ts"],"names":[],"mappings":";;;AAEA,+CAA8C;
|
|
1
|
+
{"version":3,"file":"properties.cjs","sourceRoot":"","sources":["../../../src/utils/metrics/properties.ts"],"names":[],"mappings":";;;AAEA,+CAA8C;AAO9C,uDAAyE;AAEzE,2CAIqB;AACrB,0CAAmE;AACnE,4DAG4B;AAEf,QAAA,yBAAyB,GAElC;IACF,eAAe,EAAE,cAAc;IAC/B,gBAAgB,EAAE,mBAAmB;IACrC,UAAU,EAAE,cAAc;IAC1B,WA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AAA,2BAA2B,+BAuBtC","sourcesContent":["import type { AccountsControllerState } from '@metamask/accounts-controller';\n\nimport { MetricsSwapType } from './constants';\nimport type {\n InputKeys,\n InputValues,\n QuoteWarning,\n RequestParams,\n} from './types';\nimport { DEFAULT_BRIDGE_CONTROLLER_STATE } from '../../constants/bridge';\nimport type { QuoteMetadata, QuoteResponse, TxData } from '../../types';\nimport {\n ChainId,\n type GenericQuoteRequest,\n type QuoteRequest,\n} from '../../types';\nimport { getNativeAssetForChainId, isCrossChain } from '../bridge';\nimport {\n formatAddressToAssetId,\n formatChainIdToCaip,\n} from '../caip-formatters';\n\nexport const toInputChangedPropertyKey: Partial<\n Record<keyof QuoteRequest, InputKeys>\n> = {\n srcTokenAddress: 'token_source',\n destTokenAddress: 'token_destination',\n srcChainId: 'chain_source',\n destChainId: 'chain_destination',\n slippage: 'slippage',\n};\n\nexport const toInputChangedPropertyValue: Partial<\n Record<\n keyof typeof toInputChangedPropertyKey,\n (\n input_value: Partial<GenericQuoteRequest>,\n ) => InputValues[keyof InputValues] | undefined\n >\n> = {\n srcTokenAddress: ({ srcTokenAddress, srcChainId }) =>\n srcChainId\n ? formatAddressToAssetId(srcTokenAddress ?? '', srcChainId)\n : undefined,\n destTokenAddress: ({ destTokenAddress, destChainId }) =>\n destChainId\n ? formatAddressToAssetId(destTokenAddress ?? '', destChainId)\n : undefined,\n srcChainId: ({ srcChainId }) =>\n srcChainId ? formatChainIdToCaip(srcChainId) : undefined,\n destChainId: ({ destChainId }) =>\n destChainId ? formatChainIdToCaip(destChainId) : undefined,\n slippage: ({ slippage }) => (slippage ? Number(slippage) : slippage),\n};\n\nexport const getSwapType = (\n srcChainId?: GenericQuoteRequest['srcChainId'],\n destChainId?: GenericQuoteRequest['destChainId'],\n) => {\n if (srcChainId && !isCrossChain(srcChainId, destChainId ?? srcChainId)) {\n return MetricsSwapType.SINGLE;\n }\n return MetricsSwapType.CROSSCHAIN;\n};\n\nexport const getSwapTypeFromQuote = (\n quoteRequest: Partial<GenericQuoteRequest>,\n) => {\n return getSwapType(quoteRequest.srcChainId, quoteRequest.destChainId);\n};\n\nexport const formatProviderLabel = ({\n bridgeId,\n bridges,\n}: QuoteResponse<TxData | string>['quote']): `${string}_${string}` =>\n `${bridgeId}_${bridges[0]}`;\n\nexport const getRequestParams = ({\n srcChainId,\n destChainId,\n srcTokenAddress,\n destTokenAddress,\n}: Partial<GenericQuoteRequest>): Omit<\n RequestParams,\n 'token_symbol_source' | 'token_symbol_destination'\n> => {\n // Fallback to ETH if srcChainId is not defined. This is ok since the clients default to Ethereum as the source chain\n // This also doesn't happen at runtime since the quote request is validated before metrics are published\n const srcChainIdCaip = formatChainIdToCaip(srcChainId ?? ChainId.ETH);\n return {\n chain_id_source: srcChainIdCaip,\n chain_id_destination: destChainId ? formatChainIdToCaip(destChainId) : null,\n token_address_source: srcTokenAddress\n ? (formatAddressToAssetId(srcTokenAddress, srcChainIdCaip) ??\n getNativeAssetForChainId(srcChainIdCaip)?.assetId ??\n null)\n : (getNativeAssetForChainId(srcChainIdCaip)?.assetId ?? null),\n token_address_destination: destTokenAddress\n ? (formatAddressToAssetId(\n destTokenAddress,\n destChainId ?? srcChainIdCaip,\n ) ?? null)\n : null,\n };\n};\n\nexport const isHardwareWallet = (\n selectedAccount?: AccountsControllerState['internalAccounts']['accounts'][string],\n) => {\n return selectedAccount?.metadata?.keyring.type?.includes('Hardware') ?? false;\n};\n\n/**\n * @param slippage - The slippage percentage\n * @returns Whether the default slippage was overridden by the user\n *\n * @deprecated This function should not be used. Use {@link selectDefaultSlippagePercentage} instead.\n */\nexport const isCustomSlippage = (slippage: GenericQuoteRequest['slippage']) => {\n return slippage !== DEFAULT_BRIDGE_CONTROLLER_STATE.quoteRequest.slippage;\n};\n\nexport const getQuotesReceivedProperties = (\n activeQuote: null | (QuoteResponse & Partial<QuoteMetadata>),\n warnings: QuoteWarning[] = [],\n isSubmittable: boolean = true,\n recommendedQuote?: null | (QuoteResponse & Partial<QuoteMetadata>),\n) => {\n const provider = activeQuote ? formatProviderLabel(activeQuote.quote) : '_';\n return {\n can_submit: isSubmittable,\n gas_included: Boolean(activeQuote?.quote?.gasIncluded),\n gas_included_7702: Boolean(activeQuote?.quote?.gasIncluded7702),\n quoted_time_minutes: activeQuote?.estimatedProcessingTimeInSeconds\n ? activeQuote.estimatedProcessingTimeInSeconds / 60\n : 0,\n usd_quoted_gas: Number(activeQuote?.gasFee?.effective?.usd ?? 0),\n usd_quoted_return: Number(activeQuote?.toTokenAmount?.usd ?? 0),\n best_quote_provider: recommendedQuote\n ? formatProviderLabel(recommendedQuote.quote)\n : provider,\n provider,\n warnings,\n price_impact: Number(activeQuote?.quote.priceData?.priceImpact ?? 0),\n };\n};\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { AccountsControllerState } from "@metamask/accounts-controller";
|
|
2
2
|
import { MetricsSwapType } from "./constants.cjs";
|
|
3
|
-
import type { InputKeys, InputValues, RequestParams } from "./types.cjs";
|
|
4
|
-
import type { QuoteResponse, TxData } from "../../types.cjs";
|
|
3
|
+
import type { InputKeys, InputValues, QuoteWarning, RequestParams } from "./types.cjs";
|
|
4
|
+
import type { QuoteMetadata, QuoteResponse, TxData } from "../../types.cjs";
|
|
5
5
|
import { type GenericQuoteRequest, type QuoteRequest } from "../../types.cjs";
|
|
6
6
|
export declare const toInputChangedPropertyKey: Partial<Record<keyof QuoteRequest, InputKeys>>;
|
|
7
7
|
export declare const toInputChangedPropertyValue: Partial<Record<keyof typeof toInputChangedPropertyKey, (input_value: Partial<GenericQuoteRequest>) => InputValues[keyof InputValues] | undefined>>;
|
|
@@ -17,4 +17,16 @@ export declare const isHardwareWallet: (selectedAccount?: AccountsControllerStat
|
|
|
17
17
|
* @deprecated This function should not be used. Use {@link selectDefaultSlippagePercentage} instead.
|
|
18
18
|
*/
|
|
19
19
|
export declare const isCustomSlippage: (slippage: GenericQuoteRequest['slippage']) => boolean;
|
|
20
|
+
export declare const getQuotesReceivedProperties: (activeQuote: null | (QuoteResponse & Partial<QuoteMetadata>), warnings?: QuoteWarning[], isSubmittable?: boolean, recommendedQuote?: null | (QuoteResponse & Partial<QuoteMetadata>)) => {
|
|
21
|
+
can_submit: boolean;
|
|
22
|
+
gas_included: boolean;
|
|
23
|
+
gas_included_7702: boolean;
|
|
24
|
+
quoted_time_minutes: number;
|
|
25
|
+
usd_quoted_gas: number;
|
|
26
|
+
usd_quoted_return: number;
|
|
27
|
+
best_quote_provider: `${string}_${string}`;
|
|
28
|
+
provider: `${string}_${string}`;
|
|
29
|
+
warnings: QuoteWarning[];
|
|
30
|
+
price_impact: number;
|
|
31
|
+
};
|
|
20
32
|
//# sourceMappingURL=properties.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"properties.d.cts","sourceRoot":"","sources":["../../../src/utils/metrics/properties.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,sCAAsC;AAE7E,OAAO,EAAE,eAAe,EAAE,wBAAoB;AAC9C,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"properties.d.cts","sourceRoot":"","sources":["../../../src/utils/metrics/properties.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,sCAAsC;AAE7E,OAAO,EAAE,eAAe,EAAE,wBAAoB;AAC9C,OAAO,KAAK,EACV,SAAS,EACT,WAAW,EACX,YAAY,EACZ,aAAa,EACd,oBAAgB;AAEjB,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,EAAE,wBAAoB;AACxE,OAAO,EAEL,KAAK,mBAAmB,EACxB,KAAK,YAAY,EAClB,wBAAoB;AAOrB,eAAO,MAAM,yBAAyB,EAAE,OAAO,CAC7C,MAAM,CAAC,MAAM,YAAY,EAAE,SAAS,CAAC,CAOtC,CAAC;AAEF,eAAO,MAAM,2BAA2B,EAAE,OAAO,CAC/C,MAAM,CACJ,MAAM,OAAO,yBAAyB,EACtC,CACE,WAAW,EAAE,OAAO,CAAC,mBAAmB,CAAC,KACtC,WAAW,CAAC,MAAM,WAAW,CAAC,GAAG,SAAS,CAChD,CAeF,CAAC;AAEF,eAAO,MAAM,WAAW,gBACT,mBAAmB,CAAC,YAAY,CAAC,gBAChC,mBAAmB,CAAC,aAAa,CAAC,oBAMjD,CAAC;AAEF,eAAO,MAAM,oBAAoB,iBACjB,QAAQ,mBAAmB,CAAC,oBAG3C,CAAC;AAEF,eAAO,MAAM,mBAAmB,2BAG7B,cAAc,MAAM,GAAG,MAAM,CAAC,CAAC,OAAO,CAAC,KAAG,GAAG,MAAM,IAAI,MAAM,EACnC,CAAC;AAE9B,eAAO,MAAM,gBAAgB,oEAK1B,QAAQ,mBAAmB,CAAC,KAAG,KAChC,aAAa,EACb,qBAAqB,GAAG,0BAA0B,CAoBnD,CAAC;AAEF,eAAO,MAAM,gBAAgB,qBACT,uBAAuB,CAAC,kBAAkB,CAAC,CAAC,UAAU,CAAC,CAAC,MAAM,CAAC,YAGlF,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,aAAc,mBAAmB,CAAC,UAAU,CAAC,YAEzE,CAAC;AAEF,eAAO,MAAM,2BAA2B,gBACzB,IAAI,GAAG,CAAC,aAAa,GAAG,QAAQ,aAAa,CAAC,CAAC,aAClD,YAAY,EAAE,kBACT,OAAO,qBACH,IAAI,GAAG,CAAC,aAAa,GAAG,QAAQ,aAAa,CAAC,CAAC;;;;;;;;;;;CAmBnE,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { AccountsControllerState } from "@metamask/accounts-controller";
|
|
2
2
|
import { MetricsSwapType } from "./constants.mjs";
|
|
3
|
-
import type { InputKeys, InputValues, RequestParams } from "./types.mjs";
|
|
4
|
-
import type { QuoteResponse, TxData } from "../../types.mjs";
|
|
3
|
+
import type { InputKeys, InputValues, QuoteWarning, RequestParams } from "./types.mjs";
|
|
4
|
+
import type { QuoteMetadata, QuoteResponse, TxData } from "../../types.mjs";
|
|
5
5
|
import { type GenericQuoteRequest, type QuoteRequest } from "../../types.mjs";
|
|
6
6
|
export declare const toInputChangedPropertyKey: Partial<Record<keyof QuoteRequest, InputKeys>>;
|
|
7
7
|
export declare const toInputChangedPropertyValue: Partial<Record<keyof typeof toInputChangedPropertyKey, (input_value: Partial<GenericQuoteRequest>) => InputValues[keyof InputValues] | undefined>>;
|
|
@@ -17,4 +17,16 @@ export declare const isHardwareWallet: (selectedAccount?: AccountsControllerStat
|
|
|
17
17
|
* @deprecated This function should not be used. Use {@link selectDefaultSlippagePercentage} instead.
|
|
18
18
|
*/
|
|
19
19
|
export declare const isCustomSlippage: (slippage: GenericQuoteRequest['slippage']) => boolean;
|
|
20
|
+
export declare const getQuotesReceivedProperties: (activeQuote: null | (QuoteResponse & Partial<QuoteMetadata>), warnings?: QuoteWarning[], isSubmittable?: boolean, recommendedQuote?: null | (QuoteResponse & Partial<QuoteMetadata>)) => {
|
|
21
|
+
can_submit: boolean;
|
|
22
|
+
gas_included: boolean;
|
|
23
|
+
gas_included_7702: boolean;
|
|
24
|
+
quoted_time_minutes: number;
|
|
25
|
+
usd_quoted_gas: number;
|
|
26
|
+
usd_quoted_return: number;
|
|
27
|
+
best_quote_provider: `${string}_${string}`;
|
|
28
|
+
provider: `${string}_${string}`;
|
|
29
|
+
warnings: QuoteWarning[];
|
|
30
|
+
price_impact: number;
|
|
31
|
+
};
|
|
20
32
|
//# sourceMappingURL=properties.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"properties.d.mts","sourceRoot":"","sources":["../../../src/utils/metrics/properties.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,sCAAsC;AAE7E,OAAO,EAAE,eAAe,EAAE,wBAAoB;AAC9C,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"properties.d.mts","sourceRoot":"","sources":["../../../src/utils/metrics/properties.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,u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AAC,aAAa,GAAG,QAAQ,aAAa,CAAC,CAAC,aAClD,YAAY,EAAE,kBACT,OAAO,qBACH,IAAI,GAAG,CAAC,aAAa,GAAG,QAAQ,aAAa,CAAC,CAAC;;;;;;;;;;;CAmBnE,CAAC"}
|
|
@@ -60,4 +60,23 @@ export const isHardwareWallet = (selectedAccount) => {
|
|
|
60
60
|
export const isCustomSlippage = (slippage) => {
|
|
61
61
|
return slippage !== DEFAULT_BRIDGE_CONTROLLER_STATE.quoteRequest.slippage;
|
|
62
62
|
};
|
|
63
|
+
export const getQuotesReceivedProperties = (activeQuote, warnings = [], isSubmittable = true, recommendedQuote) => {
|
|
64
|
+
const provider = activeQuote ? formatProviderLabel(activeQuote.quote) : '_';
|
|
65
|
+
return {
|
|
66
|
+
can_submit: isSubmittable,
|
|
67
|
+
gas_included: Boolean(activeQuote?.quote?.gasIncluded),
|
|
68
|
+
gas_included_7702: Boolean(activeQuote?.quote?.gasIncluded7702),
|
|
69
|
+
quoted_time_minutes: activeQuote?.estimatedProcessingTimeInSeconds
|
|
70
|
+
? activeQuote.estimatedProcessingTimeInSeconds / 60
|
|
71
|
+
: 0,
|
|
72
|
+
usd_quoted_gas: Number(activeQuote?.gasFee?.effective?.usd ?? 0),
|
|
73
|
+
usd_quoted_return: Number(activeQuote?.toTokenAmount?.usd ?? 0),
|
|
74
|
+
best_quote_provider: recommendedQuote
|
|
75
|
+
? formatProviderLabel(recommendedQuote.quote)
|
|
76
|
+
: provider,
|
|
77
|
+
provider,
|
|
78
|
+
warnings,
|
|
79
|
+
price_impact: Number(activeQuote?.quote.priceData?.priceImpact ?? 0),
|
|
80
|
+
};
|
|
81
|
+
};
|
|
63
82
|
//# sourceMappingURL=properties.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"properties.mjs","sourceRoot":"","sources":["../../../src/utils/metrics/properties.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,wBAAoB;
|
|
1
|
+
{"version":3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B,EAAE,gBAAgB;YACnC,CAAC,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,KAAK,CAAC;YAC7C,CAAC,CAAC,QAAQ;QACZ,QAAQ;QACR,QAAQ;QACR,YAAY,EAAE,MAAM,CAAC,WAAW,EAAE,KAAK,CAAC,SAAS,EAAE,WAAW,IAAI,CAAC,CAAC;KACrE,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import type { AccountsControllerState } from '@metamask/accounts-controller';\n\nimport { MetricsSwapType } from './constants';\nimport type {\n InputKeys,\n InputValues,\n QuoteWarning,\n RequestParams,\n} from './types';\nimport { DEFAULT_BRIDGE_CONTROLLER_STATE } from '../../constants/bridge';\nimport type { QuoteMetadata, QuoteResponse, TxData } from '../../types';\nimport {\n ChainId,\n type GenericQuoteRequest,\n type QuoteRequest,\n} from '../../types';\nimport { getNativeAssetForChainId, isCrossChain } from '../bridge';\nimport {\n formatAddressToAssetId,\n formatChainIdToCaip,\n} from '../caip-formatters';\n\nexport const toInputChangedPropertyKey: Partial<\n Record<keyof QuoteRequest, InputKeys>\n> = {\n srcTokenAddress: 'token_source',\n destTokenAddress: 'token_destination',\n srcChainId: 'chain_source',\n destChainId: 'chain_destination',\n slippage: 'slippage',\n};\n\nexport const toInputChangedPropertyValue: Partial<\n Record<\n keyof typeof toInputChangedPropertyKey,\n (\n input_value: Partial<GenericQuoteRequest>,\n ) => InputValues[keyof InputValues] | undefined\n >\n> = {\n srcTokenAddress: ({ srcTokenAddress, srcChainId }) =>\n srcChainId\n ? formatAddressToAssetId(srcTokenAddress ?? '', srcChainId)\n : undefined,\n destTokenAddress: ({ destTokenAddress, destChainId }) =>\n destChainId\n ? formatAddressToAssetId(destTokenAddress ?? '', destChainId)\n : undefined,\n srcChainId: ({ srcChainId }) =>\n srcChainId ? formatChainIdToCaip(srcChainId) : undefined,\n destChainId: ({ destChainId }) =>\n destChainId ? formatChainIdToCaip(destChainId) : undefined,\n slippage: ({ slippage }) => (slippage ? Number(slippage) : slippage),\n};\n\nexport const getSwapType = (\n srcChainId?: GenericQuoteRequest['srcChainId'],\n destChainId?: GenericQuoteRequest['destChainId'],\n) => {\n if (srcChainId && !isCrossChain(srcChainId, destChainId ?? srcChainId)) {\n return MetricsSwapType.SINGLE;\n }\n return MetricsSwapType.CROSSCHAIN;\n};\n\nexport const getSwapTypeFromQuote = (\n quoteRequest: Partial<GenericQuoteRequest>,\n) => {\n return getSwapType(quoteRequest.srcChainId, quoteRequest.destChainId);\n};\n\nexport const formatProviderLabel = ({\n bridgeId,\n bridges,\n}: QuoteResponse<TxData | string>['quote']): `${string}_${string}` =>\n `${bridgeId}_${bridges[0]}`;\n\nexport const getRequestParams = ({\n srcChainId,\n destChainId,\n srcTokenAddress,\n destTokenAddress,\n}: Partial<GenericQuoteRequest>): Omit<\n RequestParams,\n 'token_symbol_source' | 'token_symbol_destination'\n> => {\n // Fallback to ETH if srcChainId is not defined. This is ok since the clients default to Ethereum as the source chain\n // This also doesn't happen at runtime since the quote request is validated before metrics are published\n const srcChainIdCaip = formatChainIdToCaip(srcChainId ?? ChainId.ETH);\n return {\n chain_id_source: srcChainIdCaip,\n chain_id_destination: destChainId ? formatChainIdToCaip(destChainId) : null,\n token_address_source: srcTokenAddress\n ? (formatAddressToAssetId(srcTokenAddress, srcChainIdCaip) ??\n getNativeAssetForChainId(srcChainIdCaip)?.assetId ??\n null)\n : (getNativeAssetForChainId(srcChainIdCaip)?.assetId ?? null),\n token_address_destination: destTokenAddress\n ? (formatAddressToAssetId(\n destTokenAddress,\n destChainId ?? srcChainIdCaip,\n ) ?? null)\n : null,\n };\n};\n\nexport const isHardwareWallet = (\n selectedAccount?: AccountsControllerState['internalAccounts']['accounts'][string],\n) => {\n return selectedAccount?.metadata?.keyring.type?.includes('Hardware') ?? false;\n};\n\n/**\n * @param slippage - The slippage percentage\n * @returns Whether the default slippage was overridden by the user\n *\n * @deprecated This function should not be used. Use {@link selectDefaultSlippagePercentage} instead.\n */\nexport const isCustomSlippage = (slippage: GenericQuoteRequest['slippage']) => {\n return slippage !== DEFAULT_BRIDGE_CONTROLLER_STATE.quoteRequest.slippage;\n};\n\nexport const getQuotesReceivedProperties = (\n activeQuote: null | (QuoteResponse & Partial<QuoteMetadata>),\n warnings: QuoteWarning[] = [],\n isSubmittable: boolean = true,\n recommendedQuote?: null | (QuoteResponse & Partial<QuoteMetadata>),\n) => {\n const provider = activeQuote ? formatProviderLabel(activeQuote.quote) : '_';\n return {\n can_submit: isSubmittable,\n gas_included: Boolean(activeQuote?.quote?.gasIncluded),\n gas_included_7702: Boolean(activeQuote?.quote?.gasIncluded7702),\n quoted_time_minutes: activeQuote?.estimatedProcessingTimeInSeconds\n ? activeQuote.estimatedProcessingTimeInSeconds / 60\n : 0,\n usd_quoted_gas: Number(activeQuote?.gasFee?.effective?.usd ?? 0),\n usd_quoted_return: Number(activeQuote?.toTokenAmount?.usd ?? 0),\n best_quote_provider: recommendedQuote\n ? formatProviderLabel(recommendedQuote.quote)\n : provider,\n provider,\n warnings,\n price_impact: Number(activeQuote?.quote.priceData?.priceImpact ?? 0),\n };\n};\n"]}
|
|
@@ -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 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\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.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 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:
|
|
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 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\nexport type InputValues = {\n token_source: CaipAssetType;\n token_destination: CaipAssetType;\n chain_source: CaipChainId;\n chain_destination: CaipChainId;\n slippage: number;\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 | 'price_impact'\n | 'tx_alert';\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.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 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: QuoteWarning[];\n best_quote_provider: QuoteFetchData['best_quote_provider'];\n price_impact: QuoteFetchData['price_impact'];\n can_submit: QuoteFetchData['can_submit'];\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 | '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<\n RequestMetadata,\n 'stx_enabled' | 'usd_amount_source' | 'is_hardware_wallet'\n > &\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 [UnifiedSwapBridgeEventName.QuotesValidationFailed]: {\n failures: string[];\n };\n [UnifiedSwapBridgeEventName.StatusValidationFailed]: {\n failures: 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.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 refresh_count: number;\n };\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"]}
|
|
@@ -51,6 +51,7 @@ export type InputValues = {
|
|
|
51
51
|
chain_destination: CaipChainId;
|
|
52
52
|
slippage: number;
|
|
53
53
|
};
|
|
54
|
+
export type QuoteWarning = 'low_return' | 'no_quotes' | 'insufficient_gas_balance' | 'insufficient_gas_for_selected_quote' | 'insufficient_balance' | 'price_impact' | 'tx_alert';
|
|
54
55
|
/**
|
|
55
56
|
* Properties that are required to be provided when trackUnifiedSwapBridgeEvent is called
|
|
56
57
|
*/
|
|
@@ -76,7 +77,7 @@ export type RequiredEventContextFromClient = {
|
|
|
76
77
|
token_symbol_destination: RequestParams['token_symbol_destination'];
|
|
77
78
|
};
|
|
78
79
|
[UnifiedSwapBridgeEventName.QuotesReceived]: TradeData & {
|
|
79
|
-
warnings:
|
|
80
|
+
warnings: QuoteWarning[];
|
|
80
81
|
best_quote_provider: QuoteFetchData['best_quote_provider'];
|
|
81
82
|
price_impact: QuoteFetchData['price_impact'];
|
|
82
83
|
can_submit: QuoteFetchData['can_submit'];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.cts","sourceRoot":"","sources":["../../../src/utils/metrics/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,wBAAwB;AAElE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,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;IAC7D,CAAC,0BAA0B,CAAC,sBAAsB,CAAC,EAAE,aAAa,GAAG;QACnE,aAAa,EAAE,MAAM,CAAC;KACvB,CAAC;IACF,CAAC,0BAA0B,CAAC,sBAAsB,CAAC,EAAE,aAAa,GAAG;QACnE,aAAa,EAAE,MAAM,CAAC;KACvB,CAAC;CACH,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"}
|
|
@@ -51,6 +51,7 @@ export type InputValues = {
|
|
|
51
51
|
chain_destination: CaipChainId;
|
|
52
52
|
slippage: number;
|
|
53
53
|
};
|
|
54
|
+
export type QuoteWarning = 'low_return' | 'no_quotes' | 'insufficient_gas_balance' | 'insufficient_gas_for_selected_quote' | 'insufficient_balance' | 'price_impact' | 'tx_alert';
|
|
54
55
|
/**
|
|
55
56
|
* Properties that are required to be provided when trackUnifiedSwapBridgeEvent is called
|
|
56
57
|
*/
|
|
@@ -76,7 +77,7 @@ export type RequiredEventContextFromClient = {
|
|
|
76
77
|
token_symbol_destination: RequestParams['token_symbol_destination'];
|
|
77
78
|
};
|
|
78
79
|
[UnifiedSwapBridgeEventName.QuotesReceived]: TradeData & {
|
|
79
|
-
warnings:
|
|
80
|
+
warnings: QuoteWarning[];
|
|
80
81
|
best_quote_provider: QuoteFetchData['best_quote_provider'];
|
|
81
82
|
price_impact: QuoteFetchData['price_impact'];
|
|
82
83
|
can_submit: QuoteFetchData['can_submit'];
|
|
@@ -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;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;CACjD,CAAC;AAEF,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,kBAAkB,EAAE,OAAO,CAAC;IAC5B,SAAS,EAAE,eAAe,CAAC;IAC3B,iBAAiB,EAAE,MAAM,EAAE,CAAC;CAC7B,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC3B,UAAU,EAAE,OAAO,CAAC;IACpB,mBAAmB,CAAC,E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,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 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\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.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 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:
|
|
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 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\nexport type InputValues = {\n token_source: CaipAssetType;\n token_destination: CaipAssetType;\n chain_source: CaipChainId;\n chain_destination: CaipChainId;\n slippage: number;\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 | 'price_impact'\n | 'tx_alert';\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.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 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: QuoteWarning[];\n best_quote_provider: QuoteFetchData['best_quote_provider'];\n price_impact: QuoteFetchData['price_impact'];\n can_submit: QuoteFetchData['can_submit'];\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 | '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<\n RequestMetadata,\n 'stx_enabled' | 'usd_amount_source' | 'is_hardware_wallet'\n > &\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 [UnifiedSwapBridgeEventName.QuotesValidationFailed]: {\n failures: string[];\n };\n [UnifiedSwapBridgeEventName.StatusValidationFailed]: {\n failures: 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.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 refresh_count: number;\n };\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"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@metamask/bridge-controller",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "62.0.0",
|
|
4
4
|
"description": "Manages bridge-related quote fetching functionality for MetaMask",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"MetaMask",
|
|
@@ -54,28 +54,28 @@
|
|
|
54
54
|
"@ethersproject/contracts": "^5.7.0",
|
|
55
55
|
"@ethersproject/providers": "^5.7.0",
|
|
56
56
|
"@metamask/base-controller": "^9.0.0",
|
|
57
|
-
"@metamask/controller-utils": "^11.
|
|
58
|
-
"@metamask/gas-fee-controller": "^
|
|
57
|
+
"@metamask/controller-utils": "^11.16.0",
|
|
58
|
+
"@metamask/gas-fee-controller": "^26.0.0",
|
|
59
59
|
"@metamask/keyring-api": "^21.0.0",
|
|
60
60
|
"@metamask/messenger": "^0.3.0",
|
|
61
61
|
"@metamask/metamask-eth-abis": "^3.1.1",
|
|
62
|
-
"@metamask/multichain-network-controller": "^
|
|
63
|
-
"@metamask/polling-controller": "^
|
|
62
|
+
"@metamask/multichain-network-controller": "^3.0.0",
|
|
63
|
+
"@metamask/polling-controller": "^16.0.0",
|
|
64
64
|
"@metamask/utils": "^11.8.1",
|
|
65
65
|
"bignumber.js": "^9.1.2",
|
|
66
66
|
"reselect": "^5.1.1",
|
|
67
67
|
"uuid": "^8.3.2"
|
|
68
68
|
},
|
|
69
69
|
"devDependencies": {
|
|
70
|
-
"@metamask/accounts-controller": "^
|
|
71
|
-
"@metamask/assets-controllers": "^
|
|
70
|
+
"@metamask/accounts-controller": "^35.0.0",
|
|
71
|
+
"@metamask/assets-controllers": "^90.0.0",
|
|
72
72
|
"@metamask/auto-changelog": "^3.4.4",
|
|
73
|
-
"@metamask/eth-json-rpc-provider": "^
|
|
74
|
-
"@metamask/network-controller": "^
|
|
75
|
-
"@metamask/remote-feature-flag-controller": "^2.0.
|
|
73
|
+
"@metamask/eth-json-rpc-provider": "^6.0.0",
|
|
74
|
+
"@metamask/network-controller": "^26.0.0",
|
|
75
|
+
"@metamask/remote-feature-flag-controller": "^2.0.1",
|
|
76
76
|
"@metamask/snaps-controllers": "^14.0.1",
|
|
77
77
|
"@metamask/superstruct": "^3.1.0",
|
|
78
|
-
"@metamask/transaction-controller": "^
|
|
78
|
+
"@metamask/transaction-controller": "^62.0.0",
|
|
79
79
|
"@ts-bridge/cli": "^0.6.4",
|
|
80
80
|
"@types/jest": "^27.4.1",
|
|
81
81
|
"deepmerge": "^4.2.2",
|
|
@@ -89,12 +89,12 @@
|
|
|
89
89
|
"typescript": "~5.3.3"
|
|
90
90
|
},
|
|
91
91
|
"peerDependencies": {
|
|
92
|
-
"@metamask/accounts-controller": "^
|
|
93
|
-
"@metamask/assets-controllers": "^
|
|
94
|
-
"@metamask/network-controller": "^
|
|
92
|
+
"@metamask/accounts-controller": "^35.0.0",
|
|
93
|
+
"@metamask/assets-controllers": "^90.0.0",
|
|
94
|
+
"@metamask/network-controller": "^26.0.0",
|
|
95
95
|
"@metamask/remote-feature-flag-controller": "^2.0.0",
|
|
96
96
|
"@metamask/snaps-controllers": "^14.0.0",
|
|
97
|
-
"@metamask/transaction-controller": "^
|
|
97
|
+
"@metamask/transaction-controller": "^62.0.0"
|
|
98
98
|
},
|
|
99
99
|
"engines": {
|
|
100
100
|
"node": "^18.18 || >=20"
|