@metamask-previews/bridge-controller 77.6.0-preview-68ba7f84e → 77.8.0-preview-5959fe813

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.
Files changed (246) hide show
  1. package/CHANGELOG.md +42 -7
  2. package/dist/bridge-controller.cjs +13 -8
  3. package/dist/bridge-controller.cjs.map +1 -1
  4. package/dist/bridge-controller.d.cts +2 -1
  5. package/dist/bridge-controller.d.cts.map +1 -1
  6. package/dist/bridge-controller.d.mts +2 -1
  7. package/dist/bridge-controller.d.mts.map +1 -1
  8. package/dist/bridge-controller.mjs +10 -5
  9. package/dist/bridge-controller.mjs.map +1 -1
  10. package/dist/coercers/quote-response-v1-to-v2.cjs +137 -0
  11. package/dist/coercers/quote-response-v1-to-v2.cjs.map +1 -0
  12. package/dist/coercers/quote-response-v1-to-v2.d.cts +13 -0
  13. package/dist/coercers/quote-response-v1-to-v2.d.cts.map +1 -0
  14. package/dist/coercers/quote-response-v1-to-v2.d.mts +13 -0
  15. package/dist/coercers/quote-response-v1-to-v2.d.mts.map +1 -0
  16. package/dist/coercers/quote-response-v1-to-v2.mjs +132 -0
  17. package/dist/coercers/quote-response-v1-to-v2.mjs.map +1 -0
  18. package/dist/coercers/quote-response-v2-to-v1.cjs +173 -0
  19. package/dist/coercers/quote-response-v2-to-v1.cjs.map +1 -0
  20. package/dist/coercers/quote-response-v2-to-v1.d.cts +13 -0
  21. package/dist/coercers/quote-response-v2-to-v1.d.cts.map +1 -0
  22. package/dist/coercers/quote-response-v2-to-v1.d.mts +13 -0
  23. package/dist/coercers/quote-response-v2-to-v1.d.mts.map +1 -0
  24. package/dist/coercers/quote-response-v2-to-v1.mjs +169 -0
  25. package/dist/coercers/quote-response-v2-to-v1.mjs.map +1 -0
  26. package/dist/constants/bridge.cjs +2 -1
  27. package/dist/constants/bridge.cjs.map +1 -1
  28. package/dist/constants/bridge.d.cts +1 -0
  29. package/dist/constants/bridge.d.cts.map +1 -1
  30. package/dist/constants/bridge.d.mts +1 -0
  31. package/dist/constants/bridge.d.mts.map +1 -1
  32. package/dist/constants/bridge.mjs +1 -0
  33. package/dist/constants/bridge.mjs.map +1 -1
  34. package/dist/index.cjs +32 -7
  35. package/dist/index.cjs.map +1 -1
  36. package/dist/index.d.cts +17 -5
  37. package/dist/index.d.cts.map +1 -1
  38. package/dist/index.d.mts +17 -5
  39. package/dist/index.d.mts.map +1 -1
  40. package/dist/index.mjs +12 -3
  41. package/dist/index.mjs.map +1 -1
  42. package/dist/selectors.cjs +52 -100
  43. package/dist/selectors.cjs.map +1 -1
  44. package/dist/selectors.d.cts +11198 -31552
  45. package/dist/selectors.d.cts.map +1 -1
  46. package/dist/selectors.d.mts +11198 -31552
  47. package/dist/selectors.d.mts.map +1 -1
  48. package/dist/selectors.mjs +52 -100
  49. package/dist/selectors.mjs.map +1 -1
  50. package/dist/types.cjs.map +1 -1
  51. package/dist/types.d.cts +4 -87
  52. package/dist/types.d.cts.map +1 -1
  53. package/dist/types.d.mts +4 -87
  54. package/dist/types.d.mts.map +1 -1
  55. package/dist/types.mjs.map +1 -1
  56. package/dist/utils/bridge.cjs +2 -6
  57. package/dist/utils/bridge.cjs.map +1 -1
  58. package/dist/utils/bridge.d.cts +2 -19
  59. package/dist/utils/bridge.d.cts.map +1 -1
  60. package/dist/utils/bridge.d.mts +2 -19
  61. package/dist/utils/bridge.d.mts.map +1 -1
  62. package/dist/utils/bridge.mjs +1 -4
  63. package/dist/utils/bridge.mjs.map +1 -1
  64. package/dist/utils/caip-formatters.cjs +0 -3
  65. package/dist/utils/caip-formatters.cjs.map +1 -1
  66. package/dist/utils/caip-formatters.d.cts.map +1 -1
  67. package/dist/utils/caip-formatters.d.mts.map +1 -1
  68. package/dist/utils/caip-formatters.mjs +0 -3
  69. package/dist/utils/caip-formatters.mjs.map +1 -1
  70. package/dist/utils/feature-flags.d.cts +2 -2
  71. package/dist/utils/feature-flags.d.mts +2 -2
  72. package/dist/utils/fetch.cjs +37 -40
  73. package/dist/utils/fetch.cjs.map +1 -1
  74. package/dist/utils/fetch.d.cts +10 -4
  75. package/dist/utils/fetch.d.cts.map +1 -1
  76. package/dist/utils/fetch.d.mts +10 -4
  77. package/dist/utils/fetch.d.mts.map +1 -1
  78. package/dist/utils/fetch.mjs +37 -40
  79. package/dist/utils/fetch.mjs.map +1 -1
  80. package/dist/utils/metrics/constants.cjs +1 -0
  81. package/dist/utils/metrics/constants.cjs.map +1 -1
  82. package/dist/utils/metrics/constants.d.cts +2 -1
  83. package/dist/utils/metrics/constants.d.cts.map +1 -1
  84. package/dist/utils/metrics/constants.d.mts +2 -1
  85. package/dist/utils/metrics/constants.d.mts.map +1 -1
  86. package/dist/utils/metrics/constants.mjs +1 -0
  87. package/dist/utils/metrics/constants.mjs.map +1 -1
  88. package/dist/utils/metrics/properties.cjs +6 -6
  89. package/dist/utils/metrics/properties.cjs.map +1 -1
  90. package/dist/utils/metrics/properties.d.cts +9 -5
  91. package/dist/utils/metrics/properties.d.cts.map +1 -1
  92. package/dist/utils/metrics/properties.d.mts +9 -5
  93. package/dist/utils/metrics/properties.d.mts.map +1 -1
  94. package/dist/utils/metrics/properties.mjs +6 -6
  95. package/dist/utils/metrics/properties.mjs.map +1 -1
  96. package/dist/utils/metrics/types.cjs.map +1 -1
  97. package/dist/utils/metrics/types.d.cts +1 -1
  98. package/dist/utils/metrics/types.d.cts.map +1 -1
  99. package/dist/utils/metrics/types.d.mts +1 -1
  100. package/dist/utils/metrics/types.d.mts.map +1 -1
  101. package/dist/utils/metrics/types.mjs.map +1 -1
  102. package/dist/utils/number-formatters.cjs +106 -0
  103. package/dist/utils/number-formatters.cjs.map +1 -0
  104. package/dist/utils/number-formatters.d.cts +34 -0
  105. package/dist/utils/number-formatters.d.cts.map +1 -0
  106. package/dist/utils/number-formatters.d.mts +34 -0
  107. package/dist/utils/number-formatters.d.mts.map +1 -0
  108. package/dist/utils/number-formatters.mjs +99 -0
  109. package/dist/utils/number-formatters.mjs.map +1 -0
  110. package/dist/utils/quote-fees.cjs +23 -22
  111. package/dist/utils/quote-fees.cjs.map +1 -1
  112. package/dist/utils/quote-fees.d.cts +4 -2
  113. package/dist/utils/quote-fees.d.cts.map +1 -1
  114. package/dist/utils/quote-fees.d.mts +4 -2
  115. package/dist/utils/quote-fees.d.mts.map +1 -1
  116. package/dist/utils/quote-fees.mjs +24 -23
  117. package/dist/utils/quote-fees.mjs.map +1 -1
  118. package/dist/utils/quote-metadata/calculators.cjs +340 -0
  119. package/dist/utils/quote-metadata/calculators.cjs.map +1 -0
  120. package/dist/utils/quote-metadata/calculators.d.cts +125 -0
  121. package/dist/utils/quote-metadata/calculators.d.cts.map +1 -0
  122. package/dist/utils/quote-metadata/calculators.d.mts +125 -0
  123. package/dist/utils/quote-metadata/calculators.d.mts.map +1 -0
  124. package/dist/utils/quote-metadata/calculators.mjs +323 -0
  125. package/dist/utils/quote-metadata/calculators.mjs.map +1 -0
  126. package/dist/utils/quote-metadata/merge.cjs +38 -0
  127. package/dist/utils/quote-metadata/merge.cjs.map +1 -0
  128. package/dist/utils/quote-metadata/merge.d.cts +12 -0
  129. package/dist/utils/quote-metadata/merge.d.cts.map +1 -0
  130. package/dist/utils/quote-metadata/merge.d.mts +12 -0
  131. package/dist/utils/quote-metadata/merge.d.mts.map +1 -0
  132. package/dist/utils/quote-metadata/merge.mjs +35 -0
  133. package/dist/utils/quote-metadata/merge.mjs.map +1 -0
  134. package/dist/utils/quote-metadata/to-normalized-amounts.cjs +38 -0
  135. package/dist/utils/quote-metadata/to-normalized-amounts.cjs.map +1 -0
  136. package/dist/utils/quote-metadata/to-normalized-amounts.d.cts +10 -0
  137. package/dist/utils/quote-metadata/to-normalized-amounts.d.cts.map +1 -0
  138. package/dist/utils/quote-metadata/to-normalized-amounts.d.mts +10 -0
  139. package/dist/utils/quote-metadata/to-normalized-amounts.d.mts.map +1 -0
  140. package/dist/utils/quote-metadata/to-normalized-amounts.mjs +34 -0
  141. package/dist/utils/quote-metadata/to-normalized-amounts.mjs.map +1 -0
  142. package/dist/utils/quote-metadata/to-quote-metadata-v1.cjs +39 -0
  143. package/dist/utils/quote-metadata/to-quote-metadata-v1.cjs.map +1 -0
  144. package/dist/utils/quote-metadata/to-quote-metadata-v1.d.cts +13 -0
  145. package/dist/utils/quote-metadata/to-quote-metadata-v1.d.cts.map +1 -0
  146. package/dist/utils/quote-metadata/to-quote-metadata-v1.d.mts +13 -0
  147. package/dist/utils/quote-metadata/to-quote-metadata-v1.d.mts.map +1 -0
  148. package/dist/utils/quote-metadata/to-quote-metadata-v1.mjs +36 -0
  149. package/dist/utils/quote-metadata/to-quote-metadata-v1.mjs.map +1 -0
  150. package/dist/utils/quote-metadata/to-quote-metadata-v2.cjs +94 -0
  151. package/dist/utils/quote-metadata/to-quote-metadata-v2.cjs.map +1 -0
  152. package/dist/utils/quote-metadata/to-quote-metadata-v2.d.cts +12 -0
  153. package/dist/utils/quote-metadata/to-quote-metadata-v2.d.cts.map +1 -0
  154. package/dist/utils/quote-metadata/to-quote-metadata-v2.d.mts +12 -0
  155. package/dist/utils/quote-metadata/to-quote-metadata-v2.d.mts.map +1 -0
  156. package/dist/utils/quote-metadata/to-quote-metadata-v2.mjs +90 -0
  157. package/dist/utils/quote-metadata/to-quote-metadata-v2.mjs.map +1 -0
  158. package/dist/utils/quote-metadata/types.cjs +3 -0
  159. package/dist/utils/quote-metadata/types.cjs.map +1 -0
  160. package/dist/utils/quote-metadata/types.d.cts +87 -0
  161. package/dist/utils/quote-metadata/types.d.cts.map +1 -0
  162. package/dist/utils/quote-metadata/types.d.mts +87 -0
  163. package/dist/utils/quote-metadata/types.d.mts.map +1 -0
  164. package/dist/utils/quote-metadata/types.mjs +2 -0
  165. package/dist/utils/quote-metadata/types.mjs.map +1 -0
  166. package/dist/utils/slippage.d.cts +1 -1
  167. package/dist/utils/slippage.d.mts +1 -1
  168. package/dist/utils/sort-quotes.cjs +16 -0
  169. package/dist/utils/sort-quotes.cjs.map +1 -0
  170. package/dist/utils/sort-quotes.d.cts +4 -0
  171. package/dist/utils/sort-quotes.d.cts.map +1 -0
  172. package/dist/utils/sort-quotes.d.mts +4 -0
  173. package/dist/utils/sort-quotes.d.mts.map +1 -0
  174. package/dist/utils/sort-quotes.mjs +12 -0
  175. package/dist/utils/sort-quotes.mjs.map +1 -0
  176. package/dist/validators/amount-and-asset.cjs +27 -0
  177. package/dist/validators/amount-and-asset.cjs.map +1 -0
  178. package/dist/validators/amount-and-asset.d.cts +62 -0
  179. package/dist/validators/amount-and-asset.d.cts.map +1 -0
  180. package/dist/validators/amount-and-asset.d.mts +62 -0
  181. package/dist/validators/amount-and-asset.d.mts.map +1 -0
  182. package/dist/validators/amount-and-asset.mjs +24 -0
  183. package/dist/validators/amount-and-asset.mjs.map +1 -0
  184. package/dist/validators/batch-sell.d.cts +8 -8
  185. package/dist/validators/batch-sell.d.mts +8 -8
  186. package/dist/validators/bridge-asset.cjs +65 -1
  187. package/dist/validators/bridge-asset.cjs.map +1 -1
  188. package/dist/validators/bridge-asset.d.cts +99 -5
  189. package/dist/validators/bridge-asset.d.cts.map +1 -1
  190. package/dist/validators/bridge-asset.d.mts +99 -5
  191. package/dist/validators/bridge-asset.d.mts.map +1 -1
  192. package/dist/validators/bridge-asset.mjs +64 -1
  193. package/dist/validators/bridge-asset.mjs.map +1 -1
  194. package/dist/validators/feature-flags.d.cts +5 -5
  195. package/dist/validators/feature-flags.d.mts +5 -5
  196. package/dist/validators/intent.d.cts +3 -3
  197. package/dist/validators/intent.d.mts +3 -3
  198. package/dist/validators/quote-request.cjs +57 -0
  199. package/dist/validators/quote-request.cjs.map +1 -0
  200. package/dist/validators/quote-request.d.cts +4 -0
  201. package/dist/validators/quote-request.d.cts.map +1 -0
  202. package/dist/validators/quote-request.d.mts +4 -0
  203. package/dist/validators/quote-request.d.mts.map +1 -0
  204. package/dist/validators/quote-request.mjs +52 -0
  205. package/dist/validators/quote-request.mjs.map +1 -0
  206. package/dist/validators/quote-response-v1.d.cts +179 -176
  207. package/dist/validators/quote-response-v1.d.cts.map +1 -1
  208. package/dist/validators/quote-response-v1.d.mts +179 -176
  209. package/dist/validators/quote-response-v1.d.mts.map +1 -1
  210. package/dist/validators/quote-response.cjs +116 -0
  211. package/dist/validators/quote-response.cjs.map +1 -0
  212. package/dist/validators/quote-response.d.cts +1979 -0
  213. package/dist/validators/quote-response.d.cts.map +1 -0
  214. package/dist/validators/quote-response.d.mts +1979 -0
  215. package/dist/validators/quote-response.d.mts.map +1 -0
  216. package/dist/validators/quote-response.mjs +112 -0
  217. package/dist/validators/quote-response.mjs.map +1 -0
  218. package/dist/validators/quote.cjs +75 -2
  219. package/dist/validators/quote.cjs.map +1 -1
  220. package/dist/validators/quote.d.cts +407 -44
  221. package/dist/validators/quote.d.cts.map +1 -1
  222. package/dist/validators/quote.d.mts +407 -44
  223. package/dist/validators/quote.d.mts.map +1 -1
  224. package/dist/validators/quote.mjs +76 -3
  225. package/dist/validators/quote.mjs.map +1 -1
  226. package/dist/validators/step.cjs +7 -1
  227. package/dist/validators/step.cjs.map +1 -1
  228. package/dist/validators/step.d.cts +197 -26
  229. package/dist/validators/step.d.cts.map +1 -1
  230. package/dist/validators/step.d.mts +197 -26
  231. package/dist/validators/step.d.mts.map +1 -1
  232. package/dist/validators/step.mjs +7 -1
  233. package/dist/validators/step.mjs.map +1 -1
  234. package/dist/validators/token-feature.d.cts +2 -2
  235. package/dist/validators/token-feature.d.mts +2 -2
  236. package/dist/validators/trade.d.cts +2 -2
  237. package/dist/validators/trade.d.mts +2 -2
  238. package/package.json +8 -8
  239. package/dist/utils/quote.cjs +0 -368
  240. package/dist/utils/quote.cjs.map +0 -1
  241. package/dist/utils/quote.d.cts +0 -98
  242. package/dist/utils/quote.d.cts.map +0 -1
  243. package/dist/utils/quote.d.mts +0 -98
  244. package/dist/utils/quote.d.mts.map +0 -1
  245. package/dist/utils/quote.mjs +0 -347
  246. package/dist/utils/quote.mjs.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kCAvhBmB,wBAAwB;;kCAEtB,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4hBpC,CAAC;AAEF,eAAO,MAAM,yCAAyC,UAC7C,cAAc,WAIR,CAAC;AAEhB,eAAO,MAAM,mBAAmB,UAAW,cAAc;;;;GACpC,CAAC;AAEtB,eAAO,MAAM,+BAA+B;8BA1iBhB,wBAAwB;;8BAEtB,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4CA2iBb,WAAW,mCAAmC,CAAC,CAAC,CAAC,CAAC,6DAElD,WAAW,mCAAmC,CAAC,CAAC,CAAC,CAAC,6DAElD,WAAW,mCAAmC,CAAC,CAAC,CAAC,CAAC,4EAIlD,WAAW,mCAAmC,CAAC,CAAC,CAAC,CAAC;;;;;;;;CAuBzE,CAAC"}
@@ -7,10 +7,13 @@ const { orderBy } = $lodash;
7
7
  import { createSelector as createSelector_, createStructuredSelector as createStructuredSelector_ } from "reselect";
8
8
  import { BRIDGE_PREFERRED_GAS_ESTIMATE } from "./constants/bridge.mjs";
9
9
  import { RequestStatus, SortOrder } from "./types.mjs";
10
- import { getNativeAssetForChainId, isEvmQuoteResponse, isNativeAddress, isNonEvmChainId } from "./utils/bridge.mjs";
10
+ import { getNativeAssetForChainId, isNativeAddress, isNonEvmChainId } from "./utils/bridge.mjs";
11
11
  import { formatAddressToAssetId, formatAddressToCaipReference, formatChainIdToCaip, formatChainIdToHex } from "./utils/caip-formatters.mjs";
12
12
  import { processFeatureFlags } from "./utils/feature-flags.mjs";
13
- import { calcAdjustedReturn, calcCost, calcEstimatedAndMaxTotalGasFee, calcIncludedTxFees, calcRelayerFee, calcSentAmount, calcNonEvmTotalNetworkFee, calcSwapRate, calcToAmount, calcTotalEstimatedNetworkFee, calcTotalMaxNetworkFee, calcBatchFees } from "./utils/quote.mjs";
13
+ import { sumAmounts } from "./utils/number-formatters.mjs";
14
+ import { calcBatchFees } from "./utils/quote-metadata/calculators.mjs";
15
+ import { calcQuoteMetadata } from "./utils/quote-metadata/calculators.mjs";
16
+ import { mergeQuoteMetadata } from "./utils/quote-metadata/merge.mjs";
14
17
  import { getDefaultSlippagePercentage } from "./utils/slippage.mjs";
15
18
  /**
16
19
  * Creates a structured selector for the bridge controller
@@ -165,7 +168,7 @@ export const selectIsAssetExchangeRateInState = (state, assetId) => Boolean(sele
165
168
  */
166
169
  const selectBridgeFeesPerGas = createBridgeSelector([
167
170
  (state) => state.gasFeeEstimatesByChainId,
168
- (state) => state.quotes?.[0]?.quote.srcChainId,
171
+ (state) => state.quotes?.[0]?.chainId,
169
172
  ], (gasFeeEstimatesByChainId, srcChainId) => {
170
173
  if (!srcChainId) {
171
174
  return null;
@@ -184,82 +187,29 @@ const selectBridgeFeesPerGas = createBridgeSelector([
184
187
  maxFeePerGasInDecGwei: gasFeeEstimates.high?.suggestedMaxFeePerGas,
185
188
  };
186
189
  });
187
- // Selects cross-chain swap quotes including their metadata
188
- const selectBridgeQuotesWithMetadata = createBridgeSelector([
190
+ const selectExchangeRateSources = createStructuredBridgeSelector({
191
+ currencyRates: (state) => state.currencyRates,
192
+ marketData: (state) => state.marketData,
193
+ conversionRates: (state) => state.conversionRates,
194
+ assetExchangeRates: (state) => state.assetExchangeRates,
195
+ });
196
+ // Selects metadata for cross-chain swap quotes
197
+ const selectMetadata = createBridgeSelector([
189
198
  ({ quotes }) => quotes,
190
199
  selectBridgeFeesPerGas,
191
- (state) => state,
192
- createBridgeSelector([
193
- (state) => state,
194
- ({ quoteRequest: [{ destChainId, destTokenAddress }] }) => destTokenAddress
195
- ? formatAddressToAssetId(destTokenAddress, destChainId)
196
- : undefined,
197
- ], selectExchangeRateByAssetId),
198
- createBridgeSelector([
199
- (state) => state,
200
- ({ quoteRequest: [{ srcChainId }] }) => srcChainId
201
- ? getNativeAssetForChainId(srcChainId)?.assetId
202
- : undefined,
203
- ], selectExchangeRateByAssetId),
204
- ], (quotes, bridgeFeesPerGas, exchangeRateSources, destTokenExchangeRate, nativeExchangeRate) => {
205
- const newQuotes = quotes.map((quote) => {
206
- const sourceAssetId = formatAddressToAssetId(quote.quote.srcAsset.address, quote.quote.srcChainId) ?? quote.quote.srcAsset.assetId;
207
- const srcTokenExchangeRate = selectExchangeRateByAssetId(exchangeRateSources, sourceAssetId);
208
- const sentAmount = calcSentAmount(quote.quote, srcTokenExchangeRate);
209
- const toTokenAmount = calcToAmount(quote.quote.destTokenAmount, quote.quote.destAsset, destTokenExchangeRate);
210
- const minToTokenAmount = calcToAmount(quote.quote.minDestTokenAmount, quote.quote.destAsset, destTokenExchangeRate);
211
- const includedTxFees = calcIncludedTxFees(quote.quote, srcTokenExchangeRate, destTokenExchangeRate);
212
- let totalEstimatedNetworkFee, totalMaxNetworkFee, relayerFee, gasFee;
213
- if (isEvmQuoteResponse(quote)) {
214
- relayerFee = calcRelayerFee(quote, nativeExchangeRate);
215
- gasFee = calcEstimatedAndMaxTotalGasFee({
216
- bridgeQuote: quote,
217
- ...bridgeFeesPerGas,
218
- ...nativeExchangeRate,
219
- });
220
- // Uses effectiveGasFee to calculate the total estimated network fee
221
- totalEstimatedNetworkFee = calcTotalEstimatedNetworkFee(gasFee, relayerFee);
222
- totalMaxNetworkFee = calcTotalMaxNetworkFee(gasFee, relayerFee);
223
- }
224
- else {
225
- // Use the new generic function for all non-EVM chains
226
- totalEstimatedNetworkFee = calcNonEvmTotalNetworkFee(quote, nativeExchangeRate);
227
- gasFee = {
228
- effective: totalEstimatedNetworkFee,
229
- total: totalEstimatedNetworkFee,
230
- max: totalEstimatedNetworkFee,
231
- };
232
- totalMaxNetworkFee = totalEstimatedNetworkFee;
233
- }
234
- const adjustedReturn = calcAdjustedReturn(toTokenAmount, totalEstimatedNetworkFee, quote.quote);
235
- const cost = calcCost(adjustedReturn, sentAmount);
236
- return {
237
- ...quote,
238
- // QuoteMetadata fields
239
- sentAmount,
240
- toTokenAmount,
241
- minToTokenAmount,
242
- swapRate: calcSwapRate(sentAmount.amount, toTokenAmount.amount),
243
- /**
244
- This is the amount required to submit all the transactions.
245
- Includes the relayer fee or other native fees.
246
- Should be used for balance checks and tx submission.
247
- */
248
- totalNetworkFee: totalEstimatedNetworkFee,
249
- totalMaxNetworkFee,
250
- /**
251
- This contains gas fee estimates for the bridge transaction
252
- Does not include the relayer fee (if needed), just the gasLimit and effectiveGas returned by the bridge API.
253
- Should only be used for display purposes.
254
- */
255
- gasFee,
256
- adjustedReturn,
257
- cost,
258
- includedTxFees,
259
- };
260
- });
261
- return newQuotes;
200
+ selectExchangeRateSources,
201
+ ({ quoteRequest }) => quoteRequest,
202
+ ], (quotes, bridgeFeesPerGas, exchangeRateSources, quoteRequest) => {
203
+ const { destTokenAddress, srcChainId, destChainId } = quoteRequest[0] ?? {};
204
+ return quotes.map((quote) => calcQuoteMetadata(quote, {
205
+ srcTokenExchangeRate: selectExchangeRateByAssetId(exchangeRateSources, quote.quote.src.asset.assetId),
206
+ bridgeFeesPerGas,
207
+ destTokenExchangeRate: selectExchangeRateByAssetId(exchangeRateSources, formatAddressToAssetId(destTokenAddress ?? quote.quote.dest.asset.assetId, destChainId)),
208
+ nativeExchangeRate: selectExchangeRateByAssetId(exchangeRateSources, getNativeAssetForChainId(srcChainId ?? quote.chainId)?.assetId),
209
+ }));
262
210
  });
211
+ // Selects cross-chain swap quotes including their metadata
212
+ const selectBridgeQuotesWithMetadata = createBridgeSelector([selectMetadata, ({ quotes }) => quotes], (quoteMetadata, quotes) => quotes.map((quote, index) => mergeQuoteMetadata(quote, quoteMetadata[index])));
263
213
  const selectSortedBridgeQuotes = createBridgeSelector([
264
214
  selectBridgeQuotesWithMetadata,
265
215
  (_, { sortOrder }) => sortOrder,
@@ -268,21 +218,22 @@ const selectSortedBridgeQuotes = createBridgeSelector([
268
218
  case SortOrder.ETA_ASC:
269
219
  return orderBy(quotesWithMetadata, (quote) => quote.estimatedProcessingTimeInSeconds, 'asc');
270
220
  default:
271
- if (quotesWithMetadata.every((quote) => quote.cost.valueInCurrency)) {
272
- return orderBy(quotesWithMetadata, ({ cost }) => Number(cost.valueInCurrency), 'asc');
221
+ if (quotesWithMetadata.every((quote) => quote.quote.priceData?.cost?.valueInCurrency)) {
222
+ return orderBy(quotesWithMetadata, ({ quote: { priceData } }) => Number(priceData?.cost?.valueInCurrency), 'asc');
273
223
  }
274
- if (quotesWithMetadata.every((quote) => quote.quote.priceData?.priceImpact)) {
275
- return orderBy(quotesWithMetadata, ({ quote }) => Number(quote.priceData?.priceImpact), 'asc');
224
+ if (quotesWithMetadata.every((quote) => quote.quote.priceData?.priceImpact?.amount)) {
225
+ return orderBy(quotesWithMetadata, ({ quote }) => Number(quote.priceData?.priceImpact?.amount), 'asc');
276
226
  }
277
- return orderBy(quotesWithMetadata, ({ quote }) => Number(quote.destTokenAmount), 'desc');
227
+ return orderBy(quotesWithMetadata, ({ quote }) => Number(quote.dest.amount), 'desc');
278
228
  }
279
229
  });
280
230
  const selectRecommendedQuote = createBridgeSelector([selectSortedBridgeQuotes], (quotes) => (quotes.length > 0 ? quotes[0] : null));
281
231
  const selectActiveQuote = createBridgeSelector([
282
232
  selectRecommendedQuote,
283
233
  selectSortedBridgeQuotes,
284
- (_, { selectedQuote }) => selectedQuote,
285
- ], (recommendedQuote, sortedQuotes, selectedQuote) => sortedQuotes.find((quote) => quote.quote.requestId === selectedQuote?.quote.requestId) ?? recommendedQuote);
234
+ (_, { selectedQuote }) => selectedQuote?.quote.requestId,
235
+ ], (recommendedQuote, sortedQuotes, requestId) => sortedQuotes.find((quote) => quote.quote.requestId === requestId) ??
236
+ recommendedQuote);
286
237
  const selectIsQuoteGoingToRefresh = createBridgeSelector([
287
238
  selectBridgeFeatureFlags,
288
239
  // If at least one quote request is sufficiently funded, continue polling until max refresh count is reached
@@ -338,21 +289,22 @@ const selectRecommendedQuotes = createBridgeSelector([
338
289
  acc[requestIndex] ?? (acc[requestIndex] = quote);
339
290
  return acc;
340
291
  }, Array(requestCount).fill(null)));
341
- const selectMetadataSum = createBridgeSelector([
342
- selectRecommendedQuotes,
343
- (_, { key, }) => key,
344
- ], (recommendedQuotes, key) => recommendedQuotes.reduce((acc, quote) => {
345
- acc.usd = new BigNumber(acc.usd ?? 0)
346
- .plus(quote?.[key]?.usd ?? 0)
347
- .toString();
348
- acc.valueInCurrency = new BigNumber(acc.valueInCurrency ?? 0)
349
- .plus(quote?.[key]?.valueInCurrency ?? 0)
350
- .toString();
351
- acc.amount = new BigNumber(acc.amount ?? 0)
352
- .plus(quote?.[key]?.amount ?? 0)
353
- .toString();
354
- return acc;
355
- }, { usd: null, valueInCurrency: null, amount: '0' }));
292
+ const selectDestAmountSum = createBridgeSelector([selectRecommendedQuotes], (recommendedQuotes) => {
293
+ return sumAmounts(recommendedQuotes.map((quote) => quote?.quote.dest));
294
+ });
295
+ const selectMinDestAmountSum = createBridgeSelector([selectDestAmountSum], (destAmountSum) => {
296
+ if (!destAmountSum) {
297
+ return undefined;
298
+ }
299
+ const { minAmount, minAmountNormalized, minAmountValueInCurrency, minAmountUsd, asset, } = destAmountSum;
300
+ return {
301
+ amount: minAmount,
302
+ normalizedAmount: minAmountNormalized,
303
+ valueInCurrency: minAmountValueInCurrency,
304
+ usd: minAmountUsd,
305
+ asset,
306
+ };
307
+ });
356
308
  /**
357
309
  * Selects the recommended swap quotes for a batch of quote requests.
358
310
  *
@@ -375,8 +327,8 @@ const selectMetadataSum = createBridgeSelector([
375
327
  */
376
328
  export const selectBatchSellQuotes = createStructuredBridgeSelector({
377
329
  recommendedQuotes: selectRecommendedQuotes,
378
- totalReceived: (state, opts) => selectMetadataSum(state, { ...opts, key: 'toTokenAmount' }),
379
- minimumReceived: (state, opts) => selectMetadataSum(state, { ...opts, key: 'minToTokenAmount' }),
330
+ totalReceived: selectDestAmountSum,
331
+ minimumReceived: selectMinDestAmountSum,
380
332
  quotesLastFetchedMs: (state) => state.quotesLastFetched,
381
333
  isLoading: (state) => state.quotesLoadingStatus === RequestStatus.LOADING,
382
334
  quoteFetchError: (state) => state.quoteFetchError,
@@ -1 +1 @@
1
- {"version":3,"file":"selectors.mjs","sourceRoot":"","sources":["../src/selectors.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,OAAO,EAAE,UAAU,EAAE,+BAA+B;AAWpD,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,wBAAwB;AACxE,OAAO,EAAE,SAAS,EAAE,qBAAqB;;;AAEzC,OAAO,EACL,cAAc,IAAI,eAAe,EACjC,wBAAwB,IAAI,yBAAyB,EACtD,iBAAiB;AAElB,OAAO,EAAE,6BAA6B,EAAE,+BAA2B;AAOnE,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,oBAAgB;AACnD,OAAO,EACL,wBAAwB,EACxB,kBAAkB,EAClB,eAAe,EACf,eAAe,EAChB,2BAAuB;AACxB,OAAO,EACL,sBAAsB,EACtB,4BAA4B,EAC5B,mBAAmB,EACnB,kBAAkB,EACnB,oCAAgC;AACjC,OAAO,EAAE,mBAAmB,EAAE,kCAA8B;AAC5D,OAAO,EACL,kBAAkB,EAClB,QAAQ,EACR,8BAA8B,EAC9B,kBAAkB,EAClB,cAAc,EACd,cAAc,EACd,yBAAyB,EACzB,YAAY,EACZ,YAAY,EACZ,4BAA4B,EAC5B,sBAAsB,EACtB,aAAa,EACd,0BAAsB;AACvB,OAAO,EAAE,4BAA4B,EAAE,6BAAyB;AA0ChE;;GAEG;AACH,MAAM,8BAA8B,GAClC,yBAAyB,CAAC,SAAS,EAAkB,CAAC;AACxD;;GAEG;AACH,MAAM,oBAAoB,GAAG,eAAe,CAAC,SAAS,EAAkB,CAAC;AAYzE,MAAM,0BAA0B,GAC9B,eAAe,CAAC,SAAS,EAAoC,CAAC;AAEhE;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,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AAC,KAAK,CAAC,CAAC,MAAM;IACjD,CAAC,CAAC,EAAE,cAAkE,EAAE,EAAE,CACxE,cAAc,CAAC,eAAe;IAChC,CAAC,CAAC,EAAE,cAAkE,EAAE,EAAE,CACxE,cAAc,CAAC,gBAAgB;IACjC,CAAC,CAAC,EAAE,cAAkE,EAAE,EAAE,CACxE,cAAc,CAAC,UAAU;QACvB,CAAC,CAAC,mBAAmB,CAAC,cAAc,CAAC,UAAU,CAAC;QAChD,CAAC,CAAC,SAAS;IACf,CAAC,CAAC,EAAE,cAAkE,EAAE,EAAE,CACxE,cAAc,CAAC,WAAW;QACxB,CAAC,CAAC,mBAAmB,CAAC,cAAc,CAAC,WAAW,CAAC;QACjD,CAAC,CAAC,SAAS;CAChB,EACD,CACE,mBAAmB,EACnB,eAAe,EACf,gBAAgB,EAChB,UAAU,EACV,WAAW,EACX,EAAE;IACF,OAAO,4BAA4B,CACjC;QACE,eAAe;QACf,gBAAgB;QAChB,UAAU;QACV,WAAW;KACZ,EACD,UAAU,CAAC,CAAC,CAAC,mBAAmB,CAAC,UAAU,CAAC,EAAE,WAAW,CAAC,CAAC,CAAC,SAAS,EACrE,WAAW,CAAC,CAAC,CAAC,mBAAmB,CAAC,WAAW,CAAC,EAAE,WAAW,CAAC,CAAC,CAAC,SAAS,CACxE,CAAC;AACJ,CAAC,CACF,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/explicit-function-return-type */\nimport { getAddress } from '@ethersproject/address';\nimport type {\n CurrencyRateState,\n MultichainAssetsRatesControllerState,\n TokenRatesControllerState,\n} from '@metamask/assets-controllers';\nimport type {\n GasFeeEstimates,\n GasFeeEstimatesByChainId,\n} from '@metamask/gas-fee-controller';\nimport type { CaipAssetType } from '@metamask/utils';\nimport { isStrictHexString, parseCaipAssetType } from '@metamask/utils';\nimport { BigNumber } from 'bignumber.js';\nimport { orderBy } from 'lodash';\nimport {\n createSelector as createSelector_,\n createStructuredSelector as createStructuredSelector_,\n} from 'reselect';\n\nimport { BRIDGE_PREFERRED_GAS_ESTIMATE } from './constants/bridge';\nimport type {\n BridgeControllerState,\n ExchangeRate,\n QuoteMetadata,\n TokenAmountValues,\n} from './types';\nimport { RequestStatus, SortOrder } from './types';\nimport {\n getNativeAssetForChainId,\n isEvmQuoteResponse,\n isNativeAddress,\n isNonEvmChainId,\n} from './utils/bridge';\nimport {\n formatAddressToAssetId,\n formatAddressToCaipReference,\n formatChainIdToCaip,\n formatChainIdToHex,\n} from './utils/caip-formatters';\nimport { processFeatureFlags } from './utils/feature-flags';\nimport {\n calcAdjustedReturn,\n calcCost,\n calcEstimatedAndMaxTotalGasFee,\n calcIncludedTxFees,\n calcRelayerFee,\n calcSentAmount,\n calcNonEvmTotalNetworkFee,\n calcSwapRate,\n calcToAmount,\n calcTotalEstimatedNetworkFee,\n calcTotalMaxNetworkFee,\n calcBatchFees,\n} from './utils/quote';\nimport { getDefaultSlippagePercentage } from './utils/slippage';\nimport type { QuoteResponseV1 } from './validators/quote-response-v1';\n\n/**\n * The controller states that provide exchange rates\n */\ntype ExchangeRateControllerState = MultichainAssetsRatesControllerState &\n TokenRatesControllerState &\n CurrencyRateState &\n Pick<BridgeControllerState, 'assetExchangeRates'>;\n/**\n * The state of the bridge controller and all its dependency controllers\n */\ntype RemoteFeatureFlagControllerState = {\n remoteFeatureFlags: {\n bridgeConfig: unknown;\n };\n};\n\n/**\n * Minimal shape required for exchange-rate lookups (used by getExchangeRateByChainIdAndAddress).\n * Uses types from assets-controllers; marketData and conversionRates also accept the bridge format.\n */\nexport type ExchangeRateSourcesForLookup = Pick<\n BridgeControllerState,\n 'assetExchangeRates'\n> &\n Partial<Pick<CurrencyRateState, 'currencyRates'>> &\n Partial<Pick<MultichainAssetsRatesControllerState, 'historicalPrices'>> & {\n marketData?:\n | TokenRatesControllerState['marketData']\n | Record<string, Record<string, { price?: number; currency?: string }>>;\n conversionRates?:\n | MultichainAssetsRatesControllerState['conversionRates']\n | Record<string, { rate: string }>;\n };\n\nexport type BridgeAppState = BridgeControllerState & {\n gasFeeEstimatesByChainId: GasFeeEstimatesByChainId;\n} & ExchangeRateControllerState & {\n participateInMetaMetrics: boolean;\n } & RemoteFeatureFlagControllerState;\n/**\n * Creates a structured selector for the bridge controller\n */\nconst createStructuredBridgeSelector =\n createStructuredSelector_.withTypes<BridgeAppState>();\n/**\n * Creates a typed selector for the bridge controller\n */\nconst createBridgeSelector = createSelector_.withTypes<BridgeAppState>();\n/**\n * Required parameters that clients must provide for the bridge quotes selector\n */\ntype BridgeQuotesClientParams = {\n sortOrder: SortOrder;\n selectedQuote: (QuoteResponseV1 & QuoteMetadata) | null;\n};\n\ntype EvmTokenExchangeRate = { price?: number; currency?: string };\ntype EvmTokenExchangeRates = Record<string, EvmTokenExchangeRate>;\n\nconst createFeatureFlagsSelector =\n createSelector_.withTypes<RemoteFeatureFlagControllerState>();\n\n/**\n * Selects the bridge feature flags\n *\n * @param state - The state of the bridge controller\n * @returns The bridge feature flags\n *\n * @example\n * ```ts\n * const featureFlags = useSelector(state => selectBridgeFeatureFlags(state));\n *\n * Or\n *\n * export const selectBridgeFeatureFlags = createSelector(\n * selectRemoteFeatureFlags,\n * (remoteFeatureFlags) =>\n * selectBridgeFeatureFlagsBase({\n * bridgeConfig: remoteFeatureFlags.bridgeConfig,\n * }),\n * );\n * ```\n */\nexport const selectBridgeFeatureFlags = createFeatureFlagsSelector(\n [(state) => state.remoteFeatureFlags.bridgeConfig],\n (bridgeConfig: unknown) => processFeatureFlags(bridgeConfig),\n);\n\nconst getEvmTokenExchangeRateForAddress = (\n evmTokenExchangeRates: EvmTokenExchangeRates | undefined,\n address: string,\n): EvmTokenExchangeRate | null | undefined => {\n try {\n return isStrictHexString(address)\n ? (evmTokenExchangeRates?.[getAddress(address)] ??\n evmTokenExchangeRates?.[address.toLowerCase()])\n : null;\n } catch {\n return null;\n }\n};\n\n/**\n * Selects the asset exchange rate for a given chain and address\n *\n * @param exchangeRateSources - the controller states containing the exchange rates\n * @param assetId - the assetId to get the exchange rate for\n * @returns The asset exchange rate for the given assetId\n */\nexport const selectExchangeRateByAssetId = (\n exchangeRateSources: ExchangeRateSourcesForLookup,\n assetId?: CaipAssetType,\n): ExchangeRate => {\n if (!assetId) {\n return {};\n }\n\n const { assetExchangeRates, currencyRates, marketData, conversionRates } =\n exchangeRateSources;\n\n // If the asset exchange rate is available in the bridge controller, use it\n // This is defined if the token's rate is not available from the assets controllers\n const bridgeControllerRate =\n assetExchangeRates?.[assetId.toLowerCase() as CaipAssetType] ??\n assetExchangeRates?.[assetId];\n if (\n bridgeControllerRate?.exchangeRate &&\n bridgeControllerRate?.usdExchangeRate\n ) {\n return bridgeControllerRate;\n }\n\n const { chainId } = parseCaipAssetType(assetId);\n\n // If the chain is a non-EVM chain, use the conversion rate from the multichain assets controller\n if (isNonEvmChainId(chainId)) {\n const conversionRatesByKey = conversionRates as\n | Record<string, { rate?: string }>\n | undefined;\n const multichainAssetExchangeRate = conversionRatesByKey?.[assetId];\n const rate = multichainAssetExchangeRate?.rate;\n if (rate) {\n // The multichain rate is denominated in the user's selected currency.\n // To get a USD rate, find the user's-currency-to-USD conversion factor from any EVM native currency rate.\n const nativeCurrencyRate = Object.values(currencyRates ?? {}).find(\n (rateEntry) =>\n rateEntry?.conversionRate !== undefined &&\n rateEntry?.conversionRate !== null &&\n rateEntry?.usdConversionRate !== undefined &&\n rateEntry?.usdConversionRate !== null,\n );\n const usersCurrencyToUsdRate =\n nativeCurrencyRate?.conversionRate !== undefined &&\n nativeCurrencyRate?.conversionRate !== null &&\n nativeCurrencyRate?.usdConversionRate !== undefined &&\n nativeCurrencyRate?.usdConversionRate !== null\n ? new BigNumber(nativeCurrencyRate.usdConversionRate).div(\n nativeCurrencyRate.conversionRate,\n )\n : undefined;\n const usdExchangeRate = usersCurrencyToUsdRate\n ? new BigNumber(rate).times(usersCurrencyToUsdRate).toString()\n : undefined;\n return {\n exchangeRate: rate,\n usdExchangeRate,\n };\n }\n return {};\n }\n\n const address = formatAddressToCaipReference(assetId);\n\n // If the chain is an EVM chain, use the conversion rate from the currency rates controller\n if (isNativeAddress(address)) {\n const { symbol } = getNativeAssetForChainId(chainId);\n const evmNativeExchangeRate = currencyRates?.[symbol];\n if (evmNativeExchangeRate) {\n return {\n exchangeRate: evmNativeExchangeRate.conversionRate?.toString(),\n usdExchangeRate: evmNativeExchangeRate.usdConversionRate?.toString(),\n };\n }\n return {};\n }\n // If the chain is an EVM chain and the asset is not the native asset, use the conversion rate from the token rates controller\n if (!isNonEvmChainId(chainId)) {\n const marketDataByChain =\n (marketData as Record<string, EvmTokenExchangeRates> | undefined) ?? {};\n const evmTokenExchangeRates =\n marketDataByChain[formatChainIdToHex(chainId)];\n const evmTokenExchangeRateForAddress = getEvmTokenExchangeRateForAddress(\n evmTokenExchangeRates,\n address,\n );\n const currencyKey = evmTokenExchangeRateForAddress?.currency;\n const nativeCurrencyRate =\n currencyKey !== undefined && currencyKey !== null\n ? currencyRates?.[currencyKey]\n : undefined;\n const price = evmTokenExchangeRateForAddress?.price;\n // A missing or zero price is not a usable exchange rate. Returning a \"0\"\n // rate here is harmful in two ways: it surfaces a $0 fiat value, and it\n // makes `selectIsAssetExchangeRateInState` treat the token as already\n // priced (the non-empty \"0\" string is truthy), which prevents the\n // controller from fetching the real rate. Fall through to `{}` instead so\n // the rate gets fetched from the price API.\n if (price && nativeCurrencyRate) {\n return {\n exchangeRate: new BigNumber(price)\n .multipliedBy(nativeCurrencyRate.conversionRate ?? 0)\n .toString(),\n usdExchangeRate: new BigNumber(price)\n .multipliedBy(nativeCurrencyRate.usdConversionRate ?? 0)\n .toString(),\n };\n }\n }\n\n return {};\n};\n\n/**\n * Checks whether an exchange rate is available for a given assetId\n *\n * @param state The state of the bridge controller and its dependency controllers\n * @param assetId The assetId to check\n * @returns Whether an exchange rate is available for the given chain and address\n */\nexport const selectIsAssetExchangeRateInState = (\n state: ExchangeRateSourcesForLookup,\n assetId?: CaipAssetType,\n) =>\n Boolean(selectExchangeRateByAssetId(state, assetId)?.exchangeRate) &&\n Boolean(selectExchangeRateByAssetId(state, assetId)?.usdExchangeRate);\n\n/**\n * Selects the gas fee estimates from the gas fee controller. All potential networks\n * support EIP1559 gas fees so assume that gasFeeEstimates is of type GasFeeEstimates\n *\n * @param state - The state of the bridge controller and its dependency controllers\n * @param state.gasFeeEstimatesByChainId - gasEstimates by Hex ChainId\n * @param state.quotes - Fetched bridge/swap quotes\n * @returns The gas fee estimates in decGWEI\n */\nconst selectBridgeFeesPerGas = createBridgeSelector(\n [\n (state) => state.gasFeeEstimatesByChainId,\n (state) => state.quotes?.[0]?.quote.srcChainId,\n ],\n (gasFeeEstimatesByChainId, srcChainId) => {\n if (!srcChainId) {\n return null;\n }\n if (isNonEvmChainId(srcChainId)) {\n return null;\n }\n // @ts-expect-error - all supported networks use this type of estimates\n const gasFeeEstimates: GasFeeEstimates | undefined =\n gasFeeEstimatesByChainId?.[\n formatChainIdToHex(srcChainId) as keyof typeof gasFeeEstimatesByChainId\n ]?.gasFeeEstimates;\n if (!gasFeeEstimates) {\n return null;\n }\n return {\n estimatedBaseFeeInDecGwei: gasFeeEstimates.estimatedBaseFee,\n feePerGasInDecGwei:\n gasFeeEstimates[BRIDGE_PREFERRED_GAS_ESTIMATE]?.suggestedMaxFeePerGas,\n maxFeePerGasInDecGwei: gasFeeEstimates.high?.suggestedMaxFeePerGas,\n };\n },\n);\n\n// Selects cross-chain swap quotes including their metadata\nconst selectBridgeQuotesWithMetadata = createBridgeSelector(\n [\n ({ quotes }) => quotes,\n selectBridgeFeesPerGas,\n (state) => state,\n createBridgeSelector(\n [\n (state) => state,\n ({ quoteRequest: [{ destChainId, destTokenAddress }] }) =>\n destTokenAddress\n ? formatAddressToAssetId(destTokenAddress, destChainId)\n : undefined,\n ],\n selectExchangeRateByAssetId,\n ),\n createBridgeSelector(\n [\n (state) => state,\n ({ quoteRequest: [{ srcChainId }] }) =>\n srcChainId\n ? getNativeAssetForChainId(srcChainId)?.assetId\n : undefined,\n ],\n selectExchangeRateByAssetId,\n ),\n ],\n (\n quotes,\n bridgeFeesPerGas,\n exchangeRateSources,\n destTokenExchangeRate,\n nativeExchangeRate,\n ) => {\n const newQuotes = quotes.map((quote) => {\n const sourceAssetId =\n formatAddressToAssetId(\n quote.quote.srcAsset.address,\n quote.quote.srcChainId,\n ) ?? quote.quote.srcAsset.assetId;\n const srcTokenExchangeRate = selectExchangeRateByAssetId(\n exchangeRateSources,\n sourceAssetId,\n );\n const sentAmount = calcSentAmount(quote.quote, srcTokenExchangeRate);\n const toTokenAmount = calcToAmount(\n quote.quote.destTokenAmount,\n quote.quote.destAsset,\n destTokenExchangeRate,\n );\n const minToTokenAmount = calcToAmount(\n quote.quote.minDestTokenAmount,\n quote.quote.destAsset,\n destTokenExchangeRate,\n );\n\n const includedTxFees = calcIncludedTxFees(\n quote.quote,\n srcTokenExchangeRate,\n destTokenExchangeRate,\n );\n\n let totalEstimatedNetworkFee,\n totalMaxNetworkFee,\n relayerFee,\n gasFee: QuoteMetadata['gasFee'];\n\n if (isEvmQuoteResponse(quote)) {\n relayerFee = calcRelayerFee(quote, nativeExchangeRate);\n gasFee = calcEstimatedAndMaxTotalGasFee({\n bridgeQuote: quote,\n ...bridgeFeesPerGas,\n ...nativeExchangeRate,\n });\n // Uses effectiveGasFee to calculate the total estimated network fee\n totalEstimatedNetworkFee = calcTotalEstimatedNetworkFee(\n gasFee,\n relayerFee,\n );\n totalMaxNetworkFee = calcTotalMaxNetworkFee(gasFee, relayerFee);\n } else {\n // Use the new generic function for all non-EVM chains\n totalEstimatedNetworkFee = calcNonEvmTotalNetworkFee(\n quote,\n nativeExchangeRate,\n );\n gasFee = {\n effective: totalEstimatedNetworkFee,\n total: totalEstimatedNetworkFee,\n max: totalEstimatedNetworkFee,\n };\n totalMaxNetworkFee = totalEstimatedNetworkFee;\n }\n\n const adjustedReturn = calcAdjustedReturn(\n toTokenAmount,\n totalEstimatedNetworkFee,\n quote.quote,\n );\n const cost = calcCost(adjustedReturn, sentAmount);\n\n return {\n ...quote,\n // QuoteMetadata fields\n sentAmount,\n toTokenAmount,\n minToTokenAmount,\n swapRate: calcSwapRate(sentAmount.amount, toTokenAmount.amount),\n /**\n This is the amount required to submit all the transactions.\n Includes the relayer fee or other native fees.\n Should be used for balance checks and tx submission.\n */\n totalNetworkFee: totalEstimatedNetworkFee,\n totalMaxNetworkFee,\n /**\n This contains gas fee estimates for the bridge transaction\n Does not include the relayer fee (if needed), just the gasLimit and effectiveGas returned by the bridge API.\n Should only be used for display purposes.\n */\n gasFee,\n adjustedReturn,\n cost,\n includedTxFees,\n };\n });\n\n return newQuotes;\n },\n);\n\nconst selectSortedBridgeQuotes = createBridgeSelector(\n [\n selectBridgeQuotesWithMetadata,\n (_, { sortOrder }: BridgeQuotesClientParams) => sortOrder,\n ],\n (quotesWithMetadata, sortOrder): (QuoteResponseV1 & QuoteMetadata)[] => {\n switch (sortOrder) {\n case SortOrder.ETA_ASC:\n return orderBy(\n quotesWithMetadata,\n (quote) => quote.estimatedProcessingTimeInSeconds,\n 'asc',\n );\n default:\n if (quotesWithMetadata.every((quote) => quote.cost.valueInCurrency)) {\n return orderBy(\n quotesWithMetadata,\n ({ cost }) => Number(cost.valueInCurrency),\n 'asc',\n );\n }\n if (\n quotesWithMetadata.every(\n (quote) => quote.quote.priceData?.priceImpact,\n )\n ) {\n return orderBy(\n quotesWithMetadata,\n ({ quote }) => Number(quote.priceData?.priceImpact),\n 'asc',\n );\n }\n return orderBy(\n quotesWithMetadata,\n ({ quote }) => Number(quote.destTokenAmount),\n 'desc',\n );\n }\n },\n);\n\nconst selectRecommendedQuote = createBridgeSelector(\n [selectSortedBridgeQuotes],\n (quotes) => (quotes.length > 0 ? quotes[0] : null),\n);\n\nconst selectActiveQuote = createBridgeSelector(\n [\n selectRecommendedQuote,\n selectSortedBridgeQuotes,\n (_, { selectedQuote }) => selectedQuote,\n ],\n (recommendedQuote, sortedQuotes, selectedQuote) =>\n sortedQuotes.find(\n (quote) => quote.quote.requestId === selectedQuote?.quote.requestId,\n ) ?? recommendedQuote,\n);\n\nconst selectIsQuoteGoingToRefresh = createBridgeSelector(\n [\n selectBridgeFeatureFlags,\n // If at least one quote request is sufficiently funded, continue polling until max refresh count is reached\n (state) =>\n state.quoteRequest.every((quoteRequest) =>\n Boolean(quoteRequest.insufficientBal),\n ),\n (state) => state.quotesRefreshCount,\n ],\n (featureFlags, insufficientBal, quotesRefreshCount) =>\n insufficientBal ? false : featureFlags.maxRefreshCount > quotesRefreshCount,\n);\n\nconst selectQuoteRefreshRate = createBridgeSelector(\n [selectBridgeFeatureFlags, (state) => state.quoteRequest[0]?.srcChainId],\n (featureFlags, srcChainId) =>\n (srcChainId\n ? featureFlags.chains[formatChainIdToCaip(srcChainId)]?.refreshRate\n : featureFlags.refreshRate) ?? featureFlags.refreshRate,\n);\n\nexport const selectIsQuoteExpired = createBridgeSelector(\n [\n selectIsQuoteGoingToRefresh,\n ({ quotesLastFetched }) => quotesLastFetched,\n selectQuoteRefreshRate,\n (_, _ignoredParam, currentTimeInMs: number) => currentTimeInMs,\n ],\n (isQuoteGoingToRefresh, quotesLastFetched, refreshRate, currentTimeInMs) =>\n Boolean(\n !isQuoteGoingToRefresh &&\n quotesLastFetched &&\n currentTimeInMs - quotesLastFetched > refreshRate,\n ),\n);\n\n/**\n * Selects sorted cross-chain swap quotes. By default, the quotes are sorted by cost in ascending order.\n *\n * @param state - The state of the bridge controller and its dependency controllers\n * @param sortOrder - The sort order of the quotes\n * @param selectedQuote - The quote that is currently selected by the user, should be cleared by clients when the req params change\n * @returns The activeQuote, recommendedQuote, sortedQuotes, and other quote fetching metadata\n *\n * @example\n * ```ts\n * const quotes = useSelector(state => selectBridgeQuotes(\n * { ...state.metamask, bridgeConfig: remoteFeatureFlags.bridgeConfig },\n * {\n * sortOrder: state.bridge.sortOrder,\n * selectedQuote: state.bridge.selectedQuote,\n * }\n * ));\n * ```\n */\nexport const selectBridgeQuotes = createStructuredBridgeSelector({\n sortedQuotes: selectSortedBridgeQuotes,\n recommendedQuote: selectRecommendedQuote,\n activeQuote: selectActiveQuote,\n quotesLastFetchedMs: (state) => state.quotesLastFetched,\n isLoading: (state) => state.quotesLoadingStatus === RequestStatus.LOADING,\n quoteFetchError: (state) => state.quoteFetchError,\n quotesRefreshCount: (state) => state.quotesRefreshCount,\n quotesInitialLoadTimeMs: (state) => state.quotesInitialLoadTime,\n isQuoteGoingToRefresh: selectIsQuoteGoingToRefresh,\n});\n\nconst selectRecommendedQuotes = createBridgeSelector(\n [\n selectSortedBridgeQuotes,\n (_, { requestCount }: { requestCount: number }) => requestCount,\n ],\n (quotes, requestCount) =>\n quotes.reduce((acc, quote) => {\n const requestIndex = quote.quoteRequestIndex ?? 0;\n acc[requestIndex] ??= quote;\n return acc;\n }, Array<(QuoteResponseV1 & QuoteMetadata) | null>(requestCount).fill(null)),\n);\n\nconst selectMetadataSum = createBridgeSelector(\n [\n selectRecommendedQuotes,\n (\n _,\n {\n key,\n }: { key: 'totalNetworkFee' | 'minToTokenAmount' | 'toTokenAmount' },\n ) => key,\n ],\n (recommendedQuotes, key) =>\n recommendedQuotes.reduce<TokenAmountValues>(\n (acc, quote) => {\n acc.usd = new BigNumber(acc.usd ?? 0)\n .plus(quote?.[key]?.usd ?? 0)\n .toString();\n acc.valueInCurrency = new BigNumber(acc.valueInCurrency ?? 0)\n .plus(quote?.[key]?.valueInCurrency ?? 0)\n .toString();\n acc.amount = new BigNumber(acc.amount ?? 0)\n .plus(quote?.[key]?.amount ?? 0)\n .toString();\n return acc;\n },\n { usd: null, valueInCurrency: null, amount: '0' },\n ),\n);\n\n/**\n * Selects the recommended swap quotes for a batch of quote requests.\n *\n * @param state - The state of the bridge controller and its dependency controllers\n * @param sortOrder - The sort order of the quotes\n * @param requestCount - The number of quote requests fetched in the batch\n * @returns The quotes for multiple quote requests, including their recommendedQuotes,\n * totalReceived, minimumReceived, totalNetworkFee, and other quote fetching metadata.\n *\n * @example\n * ```ts\n * const quotes = useSelector(state => selectBatchSellQuotes(\n * { ...state.metamask },\n * {\n * sortOrder: state.bridge.sortOrder,\n * requestCount: 4,\n * }\n * ));\n * ```\n */\nexport const selectBatchSellQuotes = createStructuredBridgeSelector({\n recommendedQuotes: selectRecommendedQuotes,\n totalReceived: (state, opts) =>\n selectMetadataSum(state, { ...opts, key: 'toTokenAmount' }),\n minimumReceived: (state, opts) =>\n selectMetadataSum(state, { ...opts, key: 'minToTokenAmount' }),\n quotesLastFetchedMs: (state) => state.quotesLastFetched,\n isLoading: (state) => state.quotesLoadingStatus === RequestStatus.LOADING,\n quoteFetchError: (state) => state.quoteFetchError,\n quotesRefreshCount: (state) => state.quotesRefreshCount,\n quotesInitialLoadTimeMs: (state) => state.quotesInitialLoadTime,\n isQuoteGoingToRefresh: selectIsQuoteGoingToRefresh,\n});\n\nconst selectBatchSellFees = createBridgeSelector(\n [\n (state) => state.batchSellTrades?.fee?.amount,\n (state) => state.batchSellTrades?.fee?.asset,\n (state) =>\n selectExchangeRateByAssetId(\n state,\n state.batchSellTrades?.fee?.asset?.assetId,\n ),\n ],\n (feeAmount, feeAsset, exchangeRate) => {\n return feeAmount && feeAsset && exchangeRate\n ? calcBatchFees(feeAmount, feeAsset, exchangeRate)\n : undefined;\n },\n);\n\n/**\n * Selects the batch transactions and fees for a batch of quotes\n *\n * @param state - The state of the bridge controller and its dependency controllers\n * @returns The total transaction fees and whether the batch sell trades are submittable.\n *\n * @example\n * ```ts\n * const { totalNetworkFee, isBatchSellTradeAvailable } = useSelector(state => selectBatchSellTrades(state.metamask));\n * ```\n */\nexport const selectBatchSellTrades = createBridgeSelector(\n [\n (state) => state.batchSellTradesLoadingStatus === RequestStatus.FETCHED,\n (state) => state.batchSellTrades,\n selectBatchSellFees,\n (state) => state.batchSellTradesLoadingStatus === RequestStatus.LOADING,\n ],\n (isBatchSellTradeAvailable, batchSellTrades, batchFees, isLoading) => {\n return {\n totalNetworkFee: batchFees,\n /**\n * Whether the batch sell trades have been fetched and transactions are ready to be submitted\n */\n isBatchSellTradeAvailable:\n isBatchSellTradeAvailable &&\n Boolean(batchSellTrades?.transactions?.length),\n isLoading,\n };\n },\n);\n\nexport const selectMinimumBalanceForRentExemptionInSOL = (\n state: BridgeAppState,\n) =>\n new BigNumber(state.minimumBalanceForRentExemptionInLamports ?? 0)\n .div(10 ** 9)\n .toString();\n\nexport const selectTokenWarnings = (state: BridgeAppState) =>\n state.tokenWarnings;\n\nexport const selectDefaultSlippagePercentage = createBridgeSelector(\n [\n (state) => selectBridgeFeatureFlags(state).chains,\n (_, slippageParams: Parameters<typeof getDefaultSlippagePercentage>[0]) =>\n slippageParams.srcTokenAddress,\n (_, slippageParams: Parameters<typeof getDefaultSlippagePercentage>[0]) =>\n slippageParams.destTokenAddress,\n (_, slippageParams: Parameters<typeof getDefaultSlippagePercentage>[0]) =>\n slippageParams.srcChainId\n ? formatChainIdToCaip(slippageParams.srcChainId)\n : undefined,\n (_, slippageParams: Parameters<typeof getDefaultSlippagePercentage>[0]) =>\n slippageParams.destChainId\n ? formatChainIdToCaip(slippageParams.destChainId)\n : undefined,\n ],\n (\n featureFlagsByChain,\n srcTokenAddress,\n destTokenAddress,\n srcChainId,\n destChainId,\n ) => {\n return getDefaultSlippagePercentage(\n {\n srcTokenAddress,\n destTokenAddress,\n srcChainId,\n destChainId,\n },\n srcChainId ? featureFlagsByChain[srcChainId]?.stablecoins : undefined,\n destChainId ? featureFlagsByChain[destChainId]?.stablecoins : undefined,\n );\n },\n);\n"]}
1
+ {"version":3,"file":"selectors.mjs","sourceRoot":"","sources":["../src/selectors.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,OAAO,EAAE,UAAU,EAAE,+BAA+B;AAWpD,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,wBAAwB;AACxE,OAAO,EAAE,SAAS,EAAE,qBAAqB;;;AAEzC,OAAO,EACL,cAAc,IAAI,eAAe,EACjC,wBAAwB,IAAI,yBAAyB,EACtD,iBAAiB;AAElB,OAAO,EAAE,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SAAS,CAAC,KAAK,CAAC,wCAAwC,IAAI,CAAC,CAAC;KAC/D,GAAG,CAAC,EAAE,IAAI,CAAC,CAAC;KACZ,QAAQ,EAAE,CAAC;AAEhB,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,KAAqB,EAAE,EAAE,CAC3D,KAAK,CAAC,aAAa,CAAC;AAEtB,MAAM,CAAC,MAAM,+BAA+B,GAAG,oBAAoB,CACjE;IACE,CAAC,KAAK,EAAE,EAAE,CAAC,wBAAwB,CAAC,KAAK,CAAC,CAAC,MAAM;IACjD,CAAC,CAAC,EAAE,cAAkE,EAAE,EAAE,CACxE,cAAc,CAAC,eAAe;IAChC,CAAC,CAAC,EAAE,cAAkE,EAAE,EAAE,CACxE,cAAc,CAAC,gBAAgB;IACjC,CAAC,CAAC,EAAE,cAAkE,EAAE,EAAE,CACxE,cAAc,CAAC,UAAU;QACvB,CAAC,CAAC,mBAAmB,CAAC,cAAc,CAAC,UAAU,CAAC;QAChD,CAAC,CAAC,SAAS;IACf,CAAC,CAAC,EAAE,cAAkE,EAAE,EAAE,CACxE,cAAc,CAAC,WAAW;QACxB,CAAC,CAAC,mBAAmB,CAAC,cAAc,CAAC,WAAW,CAAC;QACjD,CAAC,CAAC,SAAS;CAChB,EACD,CACE,mBAAmB,EACnB,eAAe,EACf,gBAAgB,EAChB,UAAU,EACV,WAAW,EACX,EAAE;IACF,OAAO,4BAA4B,CACjC;QACE,eAAe;QACf,gBAAgB;QAChB,UAAU;QACV,WAAW;KACZ,EACD,UAAU,CAAC,CAAC,CAAC,mBAAmB,CAAC,UAAU,CAAC,EAAE,WAAW,CAAC,CAAC,CAAC,SAAS,EACrE,WAAW,CAAC,CAAC,CAAC,mBAAmB,CAAC,WAAW,CAAC,EAAE,WAAW,CAAC,CAAC,CAAC,SAAS,CACxE,CAAC;AACJ,CAAC,CACF,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/explicit-function-return-type */\nimport { getAddress } from '@ethersproject/address';\nimport type {\n CurrencyRateState,\n MultichainAssetsRatesControllerState,\n TokenRatesControllerState,\n} from '@metamask/assets-controllers';\nimport type {\n GasFeeEstimates,\n GasFeeEstimatesByChainId,\n} from '@metamask/gas-fee-controller';\nimport type { CaipAssetType } from '@metamask/utils';\nimport { isStrictHexString, parseCaipAssetType } from '@metamask/utils';\nimport { BigNumber } from 'bignumber.js';\nimport { orderBy } from 'lodash';\nimport {\n createSelector as createSelector_,\n createStructuredSelector as createStructuredSelector_,\n} from 'reselect';\n\nimport { BRIDGE_PREFERRED_GAS_ESTIMATE } from './constants/bridge';\nimport type { BridgeControllerState, DeepPartial, ExchangeRate } from './types';\nimport { RequestStatus, SortOrder } from './types';\nimport {\n getNativeAssetForChainId,\n isNativeAddress,\n isNonEvmChainId,\n} from './utils/bridge';\nimport {\n formatAddressToAssetId,\n formatAddressToCaipReference,\n formatChainIdToCaip,\n formatChainIdToHex,\n} from './utils/caip-formatters';\nimport { processFeatureFlags } from './utils/feature-flags';\nimport { sumAmounts } from './utils/number-formatters';\nimport { calcBatchFees } from './utils/quote-metadata/calculators';\nimport { calcQuoteMetadata } from './utils/quote-metadata/calculators';\nimport { mergeQuoteMetadata } from './utils/quote-metadata/merge';\nimport type { QuoteMetadata } from './utils/quote-metadata/types';\nimport { getDefaultSlippagePercentage } from './utils/slippage';\nimport type { QuoteResponse } from './validators/quote-response';\n\n/**\n * The controller states that provide exchange rates\n */\ntype ExchangeRateControllerState = MultichainAssetsRatesControllerState &\n TokenRatesControllerState &\n CurrencyRateState &\n Pick<BridgeControllerState, 'assetExchangeRates'>;\n/**\n * The state of the bridge controller and all its dependency controllers\n */\ntype RemoteFeatureFlagControllerState = {\n remoteFeatureFlags: {\n bridgeConfig: unknown;\n };\n};\n\n/**\n * Minimal shape required for exchange-rate lookups (used by getExchangeRateByChainIdAndAddress).\n * Uses types from assets-controllers; marketData and conversionRates also accept the bridge format.\n */\nexport type ExchangeRateSourcesForLookup = Pick<\n BridgeControllerState,\n 'assetExchangeRates'\n> &\n Partial<Pick<CurrencyRateState, 'currencyRates'>> & {\n marketData?:\n | TokenRatesControllerState['marketData']\n | Record<string, Record<string, { price?: number; currency?: string }>>;\n conversionRates?:\n | MultichainAssetsRatesControllerState['conversionRates']\n | Record<string, { rate: string }>;\n };\n\nexport type BridgeAppState = BridgeControllerState & {\n gasFeeEstimatesByChainId: GasFeeEstimatesByChainId;\n} & ExchangeRateControllerState & {\n participateInMetaMetrics: boolean;\n } & RemoteFeatureFlagControllerState;\n/**\n * Creates a structured selector for the bridge controller\n */\nconst createStructuredBridgeSelector =\n createStructuredSelector_.withTypes<BridgeAppState>();\n/**\n * Creates a typed selector for the bridge controller\n */\nconst createBridgeSelector = createSelector_.withTypes<BridgeAppState>();\n/**\n * Required parameters that clients must provide for the bridge quotes selector\n */\ntype BridgeQuotesClientParams = {\n sortOrder: SortOrder;\n selectedQuote: (QuoteResponse & QuoteMetadata) | null;\n};\n\ntype EvmTokenExchangeRate = { price?: number; currency?: string };\ntype EvmTokenExchangeRates = Record<string, EvmTokenExchangeRate>;\n\nconst createFeatureFlagsSelector =\n createSelector_.withTypes<RemoteFeatureFlagControllerState>();\n\n/**\n * Selects the bridge feature flags\n *\n * @param state - The state of the bridge controller\n * @returns The bridge feature flags\n *\n * @example\n * ```ts\n * const featureFlags = useSelector(state => selectBridgeFeatureFlags(state));\n *\n * Or\n *\n * export const selectBridgeFeatureFlags = createSelector(\n * selectRemoteFeatureFlags,\n * (remoteFeatureFlags) =>\n * selectBridgeFeatureFlagsBase({\n * bridgeConfig: remoteFeatureFlags.bridgeConfig,\n * }),\n * );\n * ```\n */\nexport const selectBridgeFeatureFlags = createFeatureFlagsSelector(\n [(state) => state.remoteFeatureFlags.bridgeConfig],\n (bridgeConfig: unknown) => processFeatureFlags(bridgeConfig),\n);\n\nconst getEvmTokenExchangeRateForAddress = (\n evmTokenExchangeRates: EvmTokenExchangeRates | undefined,\n address: string,\n): EvmTokenExchangeRate | null | undefined => {\n try {\n return isStrictHexString(address)\n ? (evmTokenExchangeRates?.[getAddress(address)] ??\n evmTokenExchangeRates?.[address.toLowerCase()])\n : null;\n } catch {\n return null;\n }\n};\n\n/**\n * Selects the asset exchange rate for a given chain and address\n *\n * @param exchangeRateSources - the controller states containing the exchange rates\n * @param assetId - the assetId to get the exchange rate for\n * @returns The asset exchange rate for the given assetId\n */\nexport const selectExchangeRateByAssetId = (\n exchangeRateSources: ExchangeRateSourcesForLookup,\n assetId?: CaipAssetType,\n): ExchangeRate => {\n if (!assetId) {\n return {};\n }\n\n const { assetExchangeRates, currencyRates, marketData, conversionRates } =\n exchangeRateSources;\n\n // If the asset exchange rate is available in the bridge controller, use it\n // This is defined if the token's rate is not available from the assets controllers\n const bridgeControllerRate =\n assetExchangeRates?.[assetId.toLowerCase() as CaipAssetType] ??\n assetExchangeRates?.[assetId];\n if (\n bridgeControllerRate?.exchangeRate &&\n bridgeControllerRate?.usdExchangeRate\n ) {\n return bridgeControllerRate;\n }\n\n const { chainId } = parseCaipAssetType(assetId);\n\n // If the chain is a non-EVM chain, use the conversion rate from the multichain assets controller\n if (isNonEvmChainId(chainId)) {\n const conversionRatesByKey = conversionRates as\n | Record<string, { rate?: string }>\n | undefined;\n const multichainAssetExchangeRate = conversionRatesByKey?.[assetId];\n const rate = multichainAssetExchangeRate?.rate;\n if (rate) {\n // The multichain rate is denominated in the user's selected currency.\n // To get a USD rate, find the user's-currency-to-USD conversion factor from any EVM native currency rate.\n const nativeCurrencyRate = Object.values(currencyRates ?? {}).find(\n (rateEntry) =>\n rateEntry?.conversionRate !== undefined &&\n rateEntry?.conversionRate !== null &&\n rateEntry?.usdConversionRate !== undefined &&\n rateEntry?.usdConversionRate !== null,\n );\n const usersCurrencyToUsdRate =\n nativeCurrencyRate?.conversionRate !== undefined &&\n nativeCurrencyRate?.conversionRate !== null &&\n nativeCurrencyRate?.usdConversionRate !== undefined &&\n nativeCurrencyRate?.usdConversionRate !== null\n ? new BigNumber(nativeCurrencyRate.usdConversionRate).div(\n nativeCurrencyRate.conversionRate,\n )\n : undefined;\n const usdExchangeRate = usersCurrencyToUsdRate\n ? new BigNumber(rate).times(usersCurrencyToUsdRate).toString()\n : undefined;\n return {\n exchangeRate: rate,\n usdExchangeRate,\n };\n }\n return {};\n }\n\n const address = formatAddressToCaipReference(assetId);\n\n // If the chain is an EVM chain, use the conversion rate from the currency rates controller\n if (isNativeAddress(address)) {\n const { symbol } = getNativeAssetForChainId(chainId);\n const evmNativeExchangeRate = currencyRates?.[symbol];\n if (evmNativeExchangeRate) {\n return {\n exchangeRate: evmNativeExchangeRate.conversionRate?.toString(),\n usdExchangeRate: evmNativeExchangeRate.usdConversionRate?.toString(),\n };\n }\n return {};\n }\n // If the chain is an EVM chain and the asset is not the native asset, use the conversion rate from the token rates controller\n if (!isNonEvmChainId(chainId)) {\n const marketDataByChain =\n (marketData as Record<string, EvmTokenExchangeRates> | undefined) ?? {};\n const evmTokenExchangeRates =\n marketDataByChain[formatChainIdToHex(chainId)];\n const evmTokenExchangeRateForAddress = getEvmTokenExchangeRateForAddress(\n evmTokenExchangeRates,\n address,\n );\n const currencyKey = evmTokenExchangeRateForAddress?.currency;\n const nativeCurrencyRate =\n currencyKey !== undefined && currencyKey !== null\n ? currencyRates?.[currencyKey]\n : undefined;\n const price = evmTokenExchangeRateForAddress?.price;\n // A missing or zero price is not a usable exchange rate. Returning a \"0\"\n // rate here is harmful in two ways: it surfaces a $0 fiat value, and it\n // makes `selectIsAssetExchangeRateInState` treat the token as already\n // priced (the non-empty \"0\" string is truthy), which prevents the\n // controller from fetching the real rate. Fall through to `{}` instead so\n // the rate gets fetched from the price API.\n if (price && nativeCurrencyRate) {\n return {\n exchangeRate: new BigNumber(price)\n .multipliedBy(nativeCurrencyRate.conversionRate ?? 0)\n .toString(),\n usdExchangeRate: new BigNumber(price)\n .multipliedBy(nativeCurrencyRate.usdConversionRate ?? 0)\n .toString(),\n };\n }\n }\n\n return {};\n};\n\n/**\n * Checks whether an exchange rate is available for a given assetId\n *\n * @param state The state of the bridge controller and its dependency controllers\n * @param assetId The assetId to check\n * @returns Whether an exchange rate is available for the given chain and address\n */\nexport const selectIsAssetExchangeRateInState = (\n state: ExchangeRateSourcesForLookup,\n assetId?: CaipAssetType,\n) =>\n Boolean(selectExchangeRateByAssetId(state, assetId)?.exchangeRate) &&\n Boolean(selectExchangeRateByAssetId(state, assetId)?.usdExchangeRate);\n\n/**\n * Selects the gas fee estimates from the gas fee controller. All potential networks\n * support EIP1559 gas fees so assume that gasFeeEstimates is of type GasFeeEstimates\n *\n * @param state - The state of the bridge controller and its dependency controllers\n * @param state.gasFeeEstimatesByChainId - gasEstimates by Hex ChainId\n * @param state.quotes - Fetched bridge/swap quotes\n * @returns The gas fee estimates in decGWEI\n */\nconst selectBridgeFeesPerGas = createBridgeSelector(\n [\n (state) => state.gasFeeEstimatesByChainId,\n (state) => state.quotes?.[0]?.chainId,\n ],\n (gasFeeEstimatesByChainId, srcChainId) => {\n if (!srcChainId) {\n return null;\n }\n if (isNonEvmChainId(srcChainId)) {\n return null;\n }\n // @ts-expect-error - all supported networks use this type of estimates\n const gasFeeEstimates: GasFeeEstimates | undefined =\n gasFeeEstimatesByChainId?.[\n formatChainIdToHex(srcChainId) as keyof typeof gasFeeEstimatesByChainId\n ]?.gasFeeEstimates;\n if (!gasFeeEstimates) {\n return null;\n }\n return {\n estimatedBaseFeeInDecGwei: gasFeeEstimates.estimatedBaseFee,\n feePerGasInDecGwei:\n gasFeeEstimates[BRIDGE_PREFERRED_GAS_ESTIMATE]?.suggestedMaxFeePerGas,\n maxFeePerGasInDecGwei: gasFeeEstimates.high?.suggestedMaxFeePerGas,\n };\n },\n);\n\nconst selectExchangeRateSources = createStructuredBridgeSelector({\n currencyRates: (state) => state.currencyRates,\n marketData: (state) => state.marketData,\n conversionRates: (state) => state.conversionRates,\n assetExchangeRates: (state) => state.assetExchangeRates,\n});\n\n// Selects metadata for cross-chain swap quotes\nconst selectMetadata = createBridgeSelector(\n [\n ({ quotes }) => quotes,\n selectBridgeFeesPerGas,\n selectExchangeRateSources,\n ({ quoteRequest }) => quoteRequest,\n ],\n (quotes, bridgeFeesPerGas, exchangeRateSources, quoteRequest) => {\n const { destTokenAddress, srcChainId, destChainId } = quoteRequest[0] ?? {};\n\n return quotes.map((quote) =>\n calcQuoteMetadata(quote, {\n srcTokenExchangeRate: selectExchangeRateByAssetId(\n exchangeRateSources,\n quote.quote.src.asset.assetId,\n ),\n bridgeFeesPerGas,\n destTokenExchangeRate: selectExchangeRateByAssetId(\n exchangeRateSources,\n formatAddressToAssetId(\n destTokenAddress ?? quote.quote.dest.asset.assetId,\n destChainId,\n ),\n ),\n nativeExchangeRate: selectExchangeRateByAssetId(\n exchangeRateSources,\n getNativeAssetForChainId(srcChainId ?? quote.chainId)?.assetId,\n ),\n }),\n );\n },\n);\n\n// Selects cross-chain swap quotes including their metadata\nconst selectBridgeQuotesWithMetadata = createBridgeSelector(\n [selectMetadata, ({ quotes }) => quotes],\n (quoteMetadata, quotes) =>\n quotes.map((quote, index) =>\n mergeQuoteMetadata(quote, quoteMetadata[index]),\n ),\n);\n\nconst selectSortedBridgeQuotes = createBridgeSelector(\n [\n selectBridgeQuotesWithMetadata,\n (_, { sortOrder }: BridgeQuotesClientParams) => sortOrder,\n ],\n (quotesWithMetadata, sortOrder): (QuoteResponse & QuoteMetadata)[] => {\n switch (sortOrder) {\n case SortOrder.ETA_ASC:\n return orderBy(\n quotesWithMetadata,\n (quote) => quote.estimatedProcessingTimeInSeconds,\n 'asc',\n );\n default:\n if (\n quotesWithMetadata.every(\n (quote) => quote.quote.priceData?.cost?.valueInCurrency,\n )\n ) {\n return orderBy(\n quotesWithMetadata,\n ({ quote: { priceData } }) =>\n Number(priceData?.cost?.valueInCurrency),\n 'asc',\n );\n }\n if (\n quotesWithMetadata.every(\n (quote) => quote.quote.priceData?.priceImpact?.amount,\n )\n ) {\n return orderBy(\n quotesWithMetadata,\n ({ quote }) => Number(quote.priceData?.priceImpact?.amount),\n 'asc',\n );\n }\n return orderBy(\n quotesWithMetadata,\n ({ quote }) => Number(quote.dest.amount),\n 'desc',\n );\n }\n },\n);\n\nconst selectRecommendedQuote = createBridgeSelector(\n [selectSortedBridgeQuotes],\n (quotes) => (quotes.length > 0 ? quotes[0] : null),\n);\n\nconst selectActiveQuote = createBridgeSelector(\n [\n selectRecommendedQuote,\n selectSortedBridgeQuotes,\n (_, { selectedQuote }) => selectedQuote?.quote.requestId,\n ],\n (recommendedQuote, sortedQuotes, requestId) =>\n sortedQuotes.find((quote) => quote.quote.requestId === requestId) ??\n recommendedQuote,\n);\n\nconst selectIsQuoteGoingToRefresh = createBridgeSelector(\n [\n selectBridgeFeatureFlags,\n // If at least one quote request is sufficiently funded, continue polling until max refresh count is reached\n (state) =>\n state.quoteRequest.every((quoteRequest) =>\n Boolean(quoteRequest.insufficientBal),\n ),\n (state) => state.quotesRefreshCount,\n ],\n (featureFlags, insufficientBal, quotesRefreshCount) =>\n insufficientBal ? false : featureFlags.maxRefreshCount > quotesRefreshCount,\n);\n\nconst selectQuoteRefreshRate = createBridgeSelector(\n [selectBridgeFeatureFlags, (state) => state.quoteRequest[0]?.srcChainId],\n (featureFlags, srcChainId) =>\n (srcChainId\n ? featureFlags.chains[formatChainIdToCaip(srcChainId)]?.refreshRate\n : featureFlags.refreshRate) ?? featureFlags.refreshRate,\n);\n\nexport const selectIsQuoteExpired = createBridgeSelector(\n [\n selectIsQuoteGoingToRefresh,\n ({ quotesLastFetched }) => quotesLastFetched,\n selectQuoteRefreshRate,\n (_, _ignoredParam, currentTimeInMs: number) => currentTimeInMs,\n ],\n (isQuoteGoingToRefresh, quotesLastFetched, refreshRate, currentTimeInMs) =>\n Boolean(\n !isQuoteGoingToRefresh &&\n quotesLastFetched &&\n currentTimeInMs - quotesLastFetched > refreshRate,\n ),\n);\n\n/**\n * Selects sorted cross-chain swap quotes. By default, the quotes are sorted by cost in ascending order.\n *\n * @param state - The state of the bridge controller and its dependency controllers\n * @param sortOrder - The sort order of the quotes\n * @param selectedQuote - The quote that is currently selected by the user, should be cleared by clients when the req params change\n * @returns The activeQuote, recommendedQuote, sortedQuotes, and other quote fetching metadata\n *\n * @example\n * ```ts\n * const quotes = useSelector(state => selectBridgeQuotes(\n * { ...state.metamask, bridgeConfig: remoteFeatureFlags.bridgeConfig },\n * {\n * sortOrder: state.bridge.sortOrder,\n * selectedQuote: state.bridge.selectedQuote,\n * }\n * ));\n * ```\n */\nexport const selectBridgeQuotes = createStructuredBridgeSelector({\n sortedQuotes: selectSortedBridgeQuotes,\n recommendedQuote: selectRecommendedQuote,\n activeQuote: selectActiveQuote,\n quotesLastFetchedMs: (state) => state.quotesLastFetched,\n isLoading: (state) => state.quotesLoadingStatus === RequestStatus.LOADING,\n quoteFetchError: (state) => state.quoteFetchError,\n quotesRefreshCount: (state) => state.quotesRefreshCount,\n quotesInitialLoadTimeMs: (state) => state.quotesInitialLoadTime,\n isQuoteGoingToRefresh: selectIsQuoteGoingToRefresh,\n});\n\nconst selectRecommendedQuotes = createBridgeSelector(\n [\n selectSortedBridgeQuotes,\n (_, { requestCount }: { requestCount: number }) => requestCount,\n ],\n (quotes, requestCount) =>\n quotes.reduce((acc, quote) => {\n const requestIndex = quote.quoteRequestIndex ?? 0;\n acc[requestIndex] ??= quote;\n return acc;\n }, Array<QuoteResponse | null>(requestCount).fill(null)),\n);\nconst selectDestAmountSum = createBridgeSelector(\n [selectRecommendedQuotes],\n (recommendedQuotes) => {\n return sumAmounts(recommendedQuotes.map((quote) => quote?.quote.dest));\n },\n);\n\nconst selectMinDestAmountSum = createBridgeSelector(\n [selectDestAmountSum],\n (destAmountSum): DeepPartial<QuoteResponse['quote']['dest']> | undefined => {\n if (!destAmountSum) {\n return undefined;\n }\n\n const {\n minAmount,\n minAmountNormalized,\n minAmountValueInCurrency,\n minAmountUsd,\n asset,\n } = destAmountSum;\n\n return {\n amount: minAmount,\n normalizedAmount: minAmountNormalized,\n valueInCurrency: minAmountValueInCurrency,\n usd: minAmountUsd,\n asset,\n };\n },\n);\n\n/**\n * Selects the recommended swap quotes for a batch of quote requests.\n *\n * @param state - The state of the bridge controller and its dependency controllers\n * @param sortOrder - The sort order of the quotes\n * @param requestCount - The number of quote requests fetched in the batch\n * @returns The quotes for multiple quote requests, including their recommendedQuotes,\n * totalReceived, minimumReceived, totalNetworkFee, and other quote fetching metadata.\n *\n * @example\n * ```ts\n * const quotes = useSelector(state => selectBatchSellQuotes(\n * { ...state.metamask },\n * {\n * sortOrder: state.bridge.sortOrder,\n * requestCount: 4,\n * }\n * ));\n * ```\n */\nexport const selectBatchSellQuotes = createStructuredBridgeSelector({\n recommendedQuotes: selectRecommendedQuotes,\n totalReceived: selectDestAmountSum,\n minimumReceived: selectMinDestAmountSum,\n quotesLastFetchedMs: (state) => state.quotesLastFetched,\n isLoading: (state) => state.quotesLoadingStatus === RequestStatus.LOADING,\n quoteFetchError: (state) => state.quoteFetchError,\n quotesRefreshCount: (state) => state.quotesRefreshCount,\n quotesInitialLoadTimeMs: (state) => state.quotesInitialLoadTime,\n isQuoteGoingToRefresh: selectIsQuoteGoingToRefresh,\n});\n\nconst selectBatchSellFees = createBridgeSelector(\n [\n (state) => state.batchSellTrades?.fee?.amount,\n (state) => state.batchSellTrades?.fee?.asset,\n (state) =>\n selectExchangeRateByAssetId(\n state,\n state.batchSellTrades?.fee?.asset?.assetId,\n ),\n ],\n (feeAmount, feeAsset, exchangeRate) => {\n return feeAmount && feeAsset && exchangeRate\n ? calcBatchFees(feeAmount, feeAsset, exchangeRate)\n : undefined;\n },\n);\n\n/**\n * Selects the batch transactions and fees for a batch of quotes\n *\n * @param state - The state of the bridge controller and its dependency controllers\n * @returns The total transaction fees and whether the batch sell trades are submittable.\n *\n * @example\n * ```ts\n * const { totalNetworkFee, isBatchSellTradeAvailable } = useSelector(state => selectBatchSellTrades(state.metamask));\n * ```\n */\nexport const selectBatchSellTrades = createBridgeSelector(\n [\n (state) => state.batchSellTradesLoadingStatus === RequestStatus.FETCHED,\n (state) => state.batchSellTrades,\n selectBatchSellFees,\n (state) => state.batchSellTradesLoadingStatus === RequestStatus.LOADING,\n ],\n (isBatchSellTradeAvailable, batchSellTrades, batchFees, isLoading) => {\n return {\n totalNetworkFee: batchFees,\n /**\n * Whether the batch sell trades have been fetched and transactions are ready to be submitted\n */\n isBatchSellTradeAvailable:\n isBatchSellTradeAvailable &&\n Boolean(batchSellTrades?.transactions?.length),\n isLoading,\n };\n },\n);\n\nexport const selectMinimumBalanceForRentExemptionInSOL = (\n state: BridgeAppState,\n) =>\n new BigNumber(state.minimumBalanceForRentExemptionInLamports ?? 0)\n .div(10 ** 9)\n .toString();\n\nexport const selectTokenWarnings = (state: BridgeAppState) =>\n state.tokenWarnings;\n\nexport const selectDefaultSlippagePercentage = createBridgeSelector(\n [\n (state) => selectBridgeFeatureFlags(state).chains,\n (_, slippageParams: Parameters<typeof getDefaultSlippagePercentage>[0]) =>\n slippageParams.srcTokenAddress,\n (_, slippageParams: Parameters<typeof getDefaultSlippagePercentage>[0]) =>\n slippageParams.destTokenAddress,\n (_, slippageParams: Parameters<typeof getDefaultSlippagePercentage>[0]) =>\n slippageParams.srcChainId\n ? formatChainIdToCaip(slippageParams.srcChainId)\n : undefined,\n (_, slippageParams: Parameters<typeof getDefaultSlippagePercentage>[0]) =>\n slippageParams.destChainId\n ? formatChainIdToCaip(slippageParams.destChainId)\n : undefined,\n ],\n (\n featureFlagsByChain,\n srcTokenAddress,\n destTokenAddress,\n srcChainId,\n destChainId,\n ) => {\n return getDefaultSlippagePercentage(\n {\n srcTokenAddress,\n destTokenAddress,\n srcChainId,\n destChainId,\n },\n srcChainId ? featureFlagsByChain[srcChainId]?.stablecoins : undefined,\n destChainId ? featureFlagsByChain[destChainId]?.stablecoins : undefined,\n );\n },\n);\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"types.cjs","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";;;AAuDA;;GAEG;AACH,IAAY,SAYX;AAZD,WAAY,SAAS;IACnB,4DAA4D;IAC5D,8BAAiB,CAAA;IACjB,qBAAqB;IACrB,4BAAe,CAAA;IACf,kCAAkC;IAClC,wBAAW,CAAA;IACX;;;OAGG;IACH,gCAAmB,CAAA;AACrB,CAAC,EAZW,SAAS,yBAAT,SAAS,QAYpB;AA4GD;;GAEG;AACH,IAAY,SAGX;AAHD,WAAY,SAAS;IACnB,wCAA2B,CAAA;IAC3B,wCAA2B,CAAA;AAC7B,CAAC,EAHW,SAAS,yBAAT,SAAS,QAGpB;AAyED,IAAY,WAMX;AAND,WAAY,WAAW;IACrB,sCAAuB,CAAA;IACvB,kCAAmB,CAAA;IACnB,gCAAiB,CAAA;IACjB,kCAAmB,CAAA;IACnB,oCAAqB,CAAA;AACvB,CAAC,EANW,WAAW,2BAAX,WAAW,QAMtB;AAkDD,IAAY,OAqBX;AArBD,WAAY,OAAO;IACjB,mCAAO,CAAA;IACP,8CAAa,CAAA;IACb,oCAAQ,CAAA;IACR,6CAAa,CAAA;IACb,2CAAY,CAAA;IACZ,wCAAW,CAAA;IACX,iDAAgB,CAAA;IAChB,mDAAiB,CAAA;IACjB,2CAAa,CAAA;IACb,wDAAyB,CAAA;IACzB,gDAAoB,CAAA;IACpB,4FAA4F;IAC5F,wDAAwB,CAAA;IACxB,6CAAgB,CAAA;IAChB,sCAAU,CAAA;IACV,yCAAW,CAAA;IACX,+CAAc,CAAA;IACd,8CAAc,CAAA;IACd,sCAAU,CAAA;IACV,kDAAgB,CAAA;AAClB,CAAC,EArBW,OAAO,uBAAP,OAAO,QAqBlB;AAQD,IAAY,aAIX;AAJD,WAAY,aAAa;IACvB,uDAAW,CAAA;IACX,uDAAW,CAAA;IACX,mDAAS,CAAA;AACX,CAAC,EAJW,aAAa,6BAAb,aAAa,QAIxB","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\nimport type { AccountsControllerGetAccountByAddressAction } from '@metamask/accounts-controller';\nimport type { AssetsControllerGetExchangeRatesForBridgeAction } from '@metamask/assets-controller';\nimport type {\n CurrencyRateControllerGetStateAction,\n MultichainAssetsRatesControllerGetStateAction,\n TokenRatesControllerGetStateAction,\n} from '@metamask/assets-controllers';\nimport type {\n ControllerGetStateAction,\n ControllerStateChangeEvent,\n} from '@metamask/base-controller';\nimport type { Messenger } from '@metamask/messenger';\nimport type {\n NetworkControllerFindNetworkClientIdByChainIdAction,\n NetworkControllerGetNetworkClientByIdAction,\n} from '@metamask/network-controller';\nimport type { AuthenticationControllerGetBearerTokenAction } from '@metamask/profile-sync-controller/auth';\nimport type { RemoteFeatureFlagControllerGetStateAction } from '@metamask/remote-feature-flag-controller';\nimport type { SnapControllerHandleRequestAction } from '@metamask/snaps-controllers';\nimport type { Infer } from '@metamask/superstruct';\nimport type {\n CaipAccountId,\n CaipAssetId,\n CaipAssetType,\n CaipChainId,\n Hex,\n} from '@metamask/utils';\n\nimport type { BridgeController } from './bridge-controller';\nimport type { BridgeControllerMethodActions } from './bridge-controller-method-action-types';\nimport type { BRIDGE_CONTROLLER_NAME } from './constants/bridge';\nimport type { SimulatedGasFeeLimitsSchema } from './validators/batch-sell';\nimport type { BatchSellTradesResponseSchema } from './validators/batch-sell';\nimport type { BridgeAssetSchema } from './validators/bridge-asset';\nimport type {\n ChainConfigurationSchema,\n ChainRankingSchema,\n PlatformConfigSchema,\n} from './validators/feature-flags';\nimport type { IntentSchema } from './validators/intent';\nimport type { TxFeeGasLimitsSchema } from './validators/quote';\nimport type { FeeDataSchema } from './validators/quote';\nimport type { GaslessPropertiesSchema } from './validators/quote';\nimport type { QuoteResponseV1 } from './validators/quote-response-v1';\nimport type { QuoteStreamCompleteSchema } from './validators/quote-stream-complete';\nimport type { StepSchema } from './validators/step';\nimport type { TokenFeatureSchema } from './validators/token-feature';\n\nexport type FetchFunction = (\n input: RequestInfo | URL | string,\n init?: RequestInit,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n) => Promise<any>;\n\n/**\n * The types of assets that a user can send\n */\nexport enum AssetType {\n /** The native asset for the current network, such as ETH */\n native = 'NATIVE',\n /** An ERC20 token */\n token = 'TOKEN',\n /** An ERC721 or ERC1155 token. */\n NFT = 'NFT',\n /**\n * A transaction interacting with a contract that isn't a token method\n * interaction will be marked as dealing with an unknown asset type.\n */\n unknown = 'UNKNOWN',\n}\n\nexport type ChainConfiguration = Infer<typeof ChainConfigurationSchema>;\n\nexport type ChainRanking = Infer<typeof ChainRankingSchema>;\n\n/**\n * @deprecated Avoid introducing new usages and use the QuoteResponseV2 feeData.network value instead\n */\nexport type L1GasFees = {\n l1GasFeesInHexWei?: Hex; // l1 fees for approval and trade in hex wei, appended by BridgeController.#appendL1GasFees\n};\n\n/**\n * @deprecated Avoid introducing new usages and use the QuoteResponseV2 feeData.network value instead\n */\nexport type NonEvmFees = {\n nonEvmFeesInNative?: string; // Non-EVM chain fees in native units (SOL for Solana, BTC for Bitcoin)\n};\n\nexport type InputPrimaryDenomination = 'token_amount' | 'fiat_value';\n\n/**\n * The types of values for the token amount and its values when converted to the user's selected currency and USD\n */\nexport type TokenAmountValues = {\n /**\n * The amount of the token\n *\n * @example \"1.005\"\n */\n amount: string;\n /**\n * The amount of the token in the user's selected currency\n *\n * @example \"4.55\"\n */\n valueInCurrency: string | null;\n /**\n * The amount of the token in USD\n *\n * @example \"1.234\"\n */\n usd: string | null;\n};\n\n/**\n * Asset exchange rate values for a given chain and address\n */\nexport type ExchangeRate = { exchangeRate?: string; usdExchangeRate?: string };\n\n/**\n * Values derived from the quote response\n *\n * @deprecated Avoid introducing new usages and use the QuoteResponse V2 type instead\n */\nexport type QuoteMetadata = {\n /**\n * If gas is included, this is the value of the src or dest token that was used to pay for the gas.\n * Show this value to indicate transaction fees for gasless quotes.\n */\n includedTxFees?: TokenAmountValues | null;\n /**\n * The gas fee for the bridge transaction.\n * effective is the gas fee that is shown to the user. If this value is not\n * included in the trade, the calculation falls back to the gasLimit (total)\n * total is the gas fee that is spent by the user, including refunds.\n * max is the max gas fee that will be used by the transaction.\n */\n gasFee: Record<'effective' | 'total' | 'max', TokenAmountValues>;\n /**\n * The total network fee required to submit the trade and any approvals. This includes\n * the relayer fee or other native fees. Should be used for balance checks and tx submission.\n * Note: This is only accurate for non-gasless transactions. Use {@link QuoteMetadata.includedTxFees} to\n * get the total network fee for gasless transactions.\n */\n totalNetworkFee: TokenAmountValues; // estimatedGasFees + relayerFees\n totalMaxNetworkFee: TokenAmountValues; // maxGasFees + relayerFees\n /**\n * The amount that the user will receive (destTokenAmount)\n */\n toTokenAmount: TokenAmountValues;\n /**\n * The minimum amount that the user will receive (minDestTokenAmount)\n */\n minToTokenAmount: TokenAmountValues;\n /**\n * If gas is included: {@link QuoteMetadata.toTokenAmount} - {@link QuoteMetadata.includedTxFees}.\n * Otherwise: {@link QuoteMetadata.toTokenAmount} - {@link QuoteMetadata.totalNetworkFee}.\n */\n adjustedReturn: Omit<TokenAmountValues, 'amount'>;\n /**\n * The amount that the user will send, including fees that are paid in the src token\n * {@link Quote.srcTokenAmount} + {@link Quote.feeData[FeeType.METABRIDGE].amount} + {@link Quote.feeData[FeeType.TX_FEE].amount}\n */\n sentAmount: TokenAmountValues;\n /**\n * The swap rate is the amount that the user will receive per amount sent. Accounts for fees paid in the src or dest token.\n * This is calculated as {@link QuoteMetadata.toTokenAmount} / {@link QuoteMetadata.sentAmount}.\n */\n swapRate: string;\n /**\n * The cost of the trade, which is the difference between the amount sent and the adjusted return.\n * This is calculated as {@link QuoteMetadata.sentAmount} - {@link QuoteMetadata.adjustedReturn}.\n */\n cost: Omit<TokenAmountValues, 'amount'>; // sentAmount - adjustedReturn\n};\n\n/**\n * Sort order set by the user\n */\nexport enum SortOrder {\n COST_ASC = 'cost_ascending',\n ETA_ASC = 'time_descending',\n}\n\n/**\n * This is the interface for the asset object returned by the bridge-api\n * This type is used in the QuoteResponse and in the fetchBridgeTokens response\n */\nexport type BridgeAsset = Infer<typeof BridgeAssetSchema>;\n\n/**\n * This is the interface for the token object used in the extension client\n * In addition to the {@link BridgeAsset} fields, it includes balance information\n */\nexport type BridgeToken = {\n address: string;\n symbol: string;\n image: string;\n decimals: number;\n chainId: number | Hex | ChainId | CaipChainId;\n balance: string; // raw balance\n // TODO deprecate this field and use balance instead\n string: string | undefined; // normalized balance as a stringified number\n tokenFiatAmount?: number | null;\n occurrences?: number;\n};\n\ntype DecimalChainId = string;\nexport type GasMultiplierByChainId = Record<DecimalChainId, number>;\n\nexport type FeatureFlagResponse = Infer<typeof PlatformConfigSchema>;\n\n// TODO move definition to validators.ts\n/**\n * This is the interface for the quote request sent to the bridge-api\n * and should only be used by the fetchBridgeQuotes utility function\n * Components and redux stores should use the {@link GenericQuoteRequest} type\n */\nexport type QuoteRequest<\n ChainIdType = ChainId | number,\n TokenAddressType = string,\n WalletAddressType = string,\n> = {\n walletAddress: WalletAddressType;\n destWalletAddress?: WalletAddressType;\n srcChainId: ChainIdType;\n destChainId: ChainIdType;\n srcTokenAddress: TokenAddressType;\n destTokenAddress: TokenAddressType;\n /**\n * This is the amount sent, in atomic amount\n */\n srcTokenAmount: string;\n slippage?: number;\n aggIds?: string[];\n bridgeIds?: string[];\n insufficientBal?: boolean;\n resetApproval?: boolean;\n refuel?: boolean;\n /**\n * Whether the response should include gasless swap quotes\n * This should be true if the user has opted in to STX on the client\n * and the current network has STX support\n */\n gasIncluded: boolean;\n /**\n * Whether to request quotes that use EIP-7702 delegated gasless execution\n */\n gasIncluded7702: boolean;\n /**\n * The fee that will be charged by MetaMask\n */\n fee?: number;\n};\n\nexport enum StatusTypes {\n SUBMITTED = 'SUBMITTED',\n UNKNOWN = 'UNKNOWN',\n FAILED = 'FAILED',\n PENDING = 'PENDING',\n COMPLETE = 'COMPLETE',\n}\n\n/**\n * These are types that components pass in. Since data is a mix of types when coming from the redux store, we need to use a generic type that can cover all the types.\n * Payloads with this type are transformed into QuoteRequest by fetchBridgeQuotes right before fetching quotes\n */\nexport type GenericQuoteRequest = QuoteRequest<\n Hex | CaipChainId | string | number, // chainIds\n Hex | CaipAssetId | string, // assetIds/addresses\n Hex | CaipAccountId | string // accountIds/addresses\n>;\n\nexport type Step = Infer<typeof StepSchema>;\n\nexport type RefuelData = Step;\n\nexport type FeeData = Infer<typeof FeeDataSchema>;\n\nexport type Intent = Infer<typeof IntentSchema>;\nexport type IntentOrderLike = Intent['order'];\n\nexport type BatchSellTradesRequest = {\n quotes: QuoteResponseV1[];\n stxEnabled: boolean;\n};\n\n/**\n * This is the bridge-api response for the obtainGaslessBatch method\n */\nexport type BatchSellTradesResponse = Infer<\n typeof BatchSellTradesResponseSchema\n>;\n\nexport type SimulatedGasFeeLimits = Infer<typeof SimulatedGasFeeLimitsSchema>;\nexport type TxFeeGasLimits = Infer<typeof TxFeeGasLimitsSchema>;\n\nexport type GaslessProperties = Infer<typeof GaslessPropertiesSchema>;\n\nexport type DeepPartial<Type> = Type extends string\n ? Type\n : {\n [K in keyof Type]?: Type[K] extends (infer U)[]\n ? DeepPartial<U>[]\n : Type[K] extends readonly (infer U)[]\n ? readonly DeepPartial<U>[]\n : Type[K] extends object\n ? DeepPartial<Type[K]>\n : Type[K];\n };\n\nexport enum ChainId {\n ETH = 1,\n OPTIMISM = 10,\n BSC = 56,\n POLYGON = 137,\n ZKSYNC = 324,\n BASE = 8453,\n ARBITRUM = 42161,\n AVALANCHE = 43114,\n LINEA = 59144,\n SOLANA = 1151111081099710,\n BTC = 20000000000001,\n /** Internal bridge / token-list id for Stellar pubnet (Token API chain: stellar:pubnet). */\n STELLAR = 20000000000002,\n TRON = 728126428,\n SEI = 1329,\n MONAD = 143,\n HYPEREVM = 999,\n MEGAETH = 4326,\n ARC = 5042,\n ROBINHOOD = 4663,\n}\n\nexport type FeatureFlagsPlatformConfig = Infer<typeof PlatformConfigSchema>;\n\nexport type TokenFeature = Infer<typeof TokenFeatureSchema>;\n\nexport type QuoteStreamCompleteData = Infer<typeof QuoteStreamCompleteSchema>;\n\nexport enum RequestStatus {\n LOADING = 0,\n FETCHED = 1,\n ERROR = 2,\n}\n\nexport type BridgeControllerState = {\n quoteRequest: Partial<GenericQuoteRequest>[];\n quotes: (QuoteResponseV1 & L1GasFees & NonEvmFees)[];\n /**\n * The time elapsed between the initial quote fetch and when the first valid quote was received\n */\n quotesInitialLoadTime: number | null;\n /**\n * The timestamp of when the latest quote fetch started\n */\n quotesLastFetched: number | null;\n /**\n * The status of the quote fetch, including fee calculations and validations\n * This is set to\n * - LOADING when the quote fetch starts\n * - FETCHED when the process completes successfully, including when quotes are empty\n * - ERROR when any errors occur\n *\n * When SSE is enabled, this is set to LOADING even when a quote is available. It is only\n * set to FETCHED when the stream is closed and all quotes have been received\n */\n quotesLoadingStatus: RequestStatus | null;\n quoteFetchError: string | null;\n /**\n * The number of times the quotes have been refreshed, starts at 0 and is\n * incremented at the end of each quote fetch\n */\n quotesRefreshCount: number;\n /**\n * Asset exchange rates for EVM and multichain assets that are not indexed by the assets controllers\n */\n assetExchangeRates: Record<CaipAssetType, ExchangeRate>;\n /**\n * When the src token is SOL, this needs to be subtracted from their balance to determine\n * the max amount that can be sent.\n */\n minimumBalanceForRentExemptionInLamports: string | null;\n /**\n * Security alerts for the destination token in the current quote request,\n * populated from `token_warning` SSE events.\n */\n tokenWarnings: TokenFeature[];\n /**\n * Client-supplied security classification for the destination token in the\n * current quote request, used as the `token_security_type_destination`\n * analytics property. Set via the `context` arg of\n * `updateBridgeQuoteRequestParams` and reset whenever the quote request is\n * reset. `null` when the client has no security data for the token.\n */\n tokenSecurityTypeDestination: string | null;\n /**\n * The denomination currently shown as the primary source amount input.\n * This is persisted as a user preference so returning to the flow restores\n * the last selected fiat/token display mode.\n */\n inputPrimaryDenomination: InputPrimaryDenomination;\n /**\n * Metadata about the completed quote stream, populated from the `complete` SSE event.\n * Set to null at the start of each fetch and updated when the complete event is received.\n */\n quoteStreamComplete: QuoteStreamCompleteData | null;\n /**\n * Contains gasless transaction data and fees for BatchSell quotes, provided by the obtainGaslessBatch API\n */\n batchSellTrades: BatchSellTradesResponse | null;\n /**\n * The status of the batch sell trades fetch, including fee calculations and validations\n */\n batchSellTradesLoadingStatus: RequestStatus | null;\n};\n\n/**\n * @deprecated Use the separate method action types (e.g.,\n * `BridgeControllerFetchQuotesAction`) instead.\n */\nexport type BridgeControllerAction<\n FunctionName extends keyof BridgeController,\n> = {\n type: `${typeof BRIDGE_CONTROLLER_NAME}:${FunctionName}`;\n handler: BridgeController[FunctionName];\n};\n\nexport type BridgeControllerGetStateAction = ControllerGetStateAction<\n typeof BRIDGE_CONTROLLER_NAME,\n BridgeControllerState\n>;\n\nexport type BridgeControllerStateChangeEvent = ControllerStateChangeEvent<\n typeof BRIDGE_CONTROLLER_NAME,\n BridgeControllerState\n>;\n\nexport type BridgeControllerActions =\n | BridgeControllerGetStateAction\n | BridgeControllerMethodActions;\n\nexport type BridgeControllerEvents = BridgeControllerStateChangeEvent;\n\nexport type AllowedActions =\n | AccountsControllerGetAccountByAddressAction\n | AuthenticationControllerGetBearerTokenAction\n | CurrencyRateControllerGetStateAction\n | TokenRatesControllerGetStateAction\n | MultichainAssetsRatesControllerGetStateAction\n | SnapControllerHandleRequestAction\n | NetworkControllerFindNetworkClientIdByChainIdAction\n | NetworkControllerGetNetworkClientByIdAction\n | RemoteFeatureFlagControllerGetStateAction\n | AssetsControllerGetExchangeRatesForBridgeAction;\nexport type AllowedEvents = never;\n\n/**\n * The messenger for the BridgeController.\n */\nexport type BridgeControllerMessenger = Messenger<\n typeof BRIDGE_CONTROLLER_NAME,\n BridgeControllerActions | AllowedActions,\n BridgeControllerEvents | AllowedEvents\n>;\n"]}
1
+ {"version":3,"file":"types.cjs","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";;;AAuDA;;GAEG;AACH,IAAY,SAYX;AAZD,WAAY,SAAS;IACnB,4DAA4D;IAC5D,8BAAiB,CAAA;IACjB,qBAAqB;IACrB,4BAAe,CAAA;IACf,kCAAkC;IAClC,wBAAW,CAAA;IACX;;;OAGG;IACH,gCAAmB,CAAA;AACrB,CAAC,EAZW,SAAS,yBAAT,SAAS,QAYpB;AA2BD;;GAEG;AACH,IAAY,SAGX;AAHD,WAAY,SAAS;IACnB,wCAA2B,CAAA;IAC3B,wCAA2B,CAAA;AAC7B,CAAC,EAHW,SAAS,yBAAT,SAAS,QAGpB;AAmED,IAAY,WAMX;AAND,WAAY,WAAW;IACrB,sCAAuB,CAAA;IACvB,kCAAmB,CAAA;IACnB,gCAAiB,CAAA;IACjB,kCAAmB,CAAA;IACnB,oCAAqB,CAAA;AACvB,CAAC,EANW,WAAW,2BAAX,WAAW,QAMtB;AAsDD,IAAY,OAqBX;AArBD,WAAY,OAAO;IACjB,mCAAO,CAAA;IACP,8CAAa,CAAA;IACb,oCAAQ,CAAA;IACR,6CAAa,CAAA;IACb,2CAAY,CAAA;IACZ,wCAAW,CAAA;IACX,iDAAgB,CAAA;IAChB,mDAAiB,CAAA;IACjB,2CAAa,CAAA;IACb,wDAAyB,CAAA;IACzB,gDAAoB,CAAA;IACpB,4FAA4F;IAC5F,wDAAwB,CAAA;IACxB,6CAAgB,CAAA;IAChB,sCAAU,CAAA;IACV,yCAAW,CAAA;IACX,+CAAc,CAAA;IACd,8CAAc,CAAA;IACd,sCAAU,CAAA;IACV,kDAAgB,CAAA;AAClB,CAAC,EArBW,OAAO,uBAAP,OAAO,QAqBlB;AAQD,IAAY,aAIX;AAJD,WAAY,aAAa;IACvB,uDAAW,CAAA;IACX,uDAAW,CAAA;IACX,mDAAS,CAAA;AACX,CAAC,EAJW,aAAa,6BAAb,aAAa,QAIxB","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\nimport type { AccountsControllerGetAccountByAddressAction } from '@metamask/accounts-controller';\nimport type { AssetsControllerGetExchangeRatesForBridgeAction } from '@metamask/assets-controller';\nimport type {\n CurrencyRateControllerGetStateAction,\n MultichainAssetsRatesControllerGetStateAction,\n TokenRatesControllerGetStateAction,\n} from '@metamask/assets-controllers';\nimport type {\n ControllerGetStateAction,\n ControllerStateChangeEvent,\n} from '@metamask/base-controller';\nimport type { Messenger } from '@metamask/messenger';\nimport type {\n NetworkControllerFindNetworkClientIdByChainIdAction,\n NetworkControllerGetNetworkClientByIdAction,\n} from '@metamask/network-controller';\nimport type { AuthenticationControllerGetBearerTokenAction } from '@metamask/profile-sync-controller/auth';\nimport type { RemoteFeatureFlagControllerGetStateAction } from '@metamask/remote-feature-flag-controller';\nimport type { SnapControllerHandleRequestAction } from '@metamask/snaps-controllers';\nimport type { Infer } from '@metamask/superstruct';\nimport type {\n CaipAccountId,\n CaipAssetId,\n CaipAssetType,\n CaipChainId,\n Hex,\n} from '@metamask/utils';\n\nimport type { BridgeController } from './bridge-controller';\nimport type { BridgeControllerMethodActions } from './bridge-controller-method-action-types';\nimport type { BRIDGE_CONTROLLER_NAME } from './constants/bridge';\nimport type { SimulatedGasFeeLimitsSchema } from './validators/batch-sell';\nimport type { BatchSellTradesResponseSchema } from './validators/batch-sell';\nimport type {\n ChainConfigurationSchema,\n ChainRankingSchema,\n PlatformConfigSchema,\n} from './validators/feature-flags';\nimport type { IntentSchema } from './validators/intent';\nimport type { TxFeeGasLimitsSchema } from './validators/quote';\nimport type { FeeDataSchema } from './validators/quote';\nimport type { GaslessPropertiesSchema } from './validators/quote';\nimport type { QuoteResponse } from './validators/quote-response';\nimport type { QuoteResponseV1 } from './validators/quote-response-v1';\nimport type { QuoteStreamCompleteSchema } from './validators/quote-stream-complete';\nimport type { StepSchema } from './validators/step';\nimport type { TokenFeatureSchema } from './validators/token-feature';\n\nexport type FetchFunction = (\n input: RequestInfo | URL | string,\n init?: RequestInit,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n) => Promise<any>;\n\n/**\n * The types of assets that a user can send\n */\nexport enum AssetType {\n /** The native asset for the current network, such as ETH */\n native = 'NATIVE',\n /** An ERC20 token */\n token = 'TOKEN',\n /** An ERC721 or ERC1155 token. */\n NFT = 'NFT',\n /**\n * A transaction interacting with a contract that isn't a token method\n * interaction will be marked as dealing with an unknown asset type.\n */\n unknown = 'UNKNOWN',\n}\n\nexport type ChainConfiguration = Infer<typeof ChainConfigurationSchema>;\n\nexport type ChainRanking = Infer<typeof ChainRankingSchema>;\n\n/**\n * @deprecated Avoid introducing new usages and use the QuoteResponseV2 feeData.network value instead\n */\nexport type L1GasFees = {\n l1GasFeesInHexWei?: Hex; // l1 fees for approval and trade in hex wei, appended by BridgeController.#appendL1GasFees\n};\n\n/**\n * @deprecated Avoid introducing new usages and use the QuoteResponseV2 feeData.network value instead\n */\nexport type NonEvmFees = {\n nonEvmFeesInNative?: string; // Non-EVM chain fees in native units (SOL for Solana, BTC for Bitcoin)\n};\n\nexport type InputPrimaryDenomination = 'token_amount' | 'fiat_value';\n\n/**\n * Asset exchange rate values for a given chain and address\n */\nexport type ExchangeRate = { exchangeRate?: string; usdExchangeRate?: string };\n\n/**\n * Sort order set by the user\n */\nexport enum SortOrder {\n COST_ASC = 'cost_ascending',\n ETA_ASC = 'time_descending',\n}\n\n/**\n * This is the interface for the token object used in the extension client\n * In addition to the {@link BridgeAsset} fields, it includes balance information\n */\nexport type BridgeToken = {\n address: string;\n symbol: string;\n image: string;\n decimals: number;\n chainId: number | Hex | ChainId | CaipChainId;\n balance: string; // raw balance\n // TODO deprecate this field and use balance instead\n string: string | undefined; // normalized balance as a stringified number\n tokenFiatAmount?: number | null;\n occurrences?: number;\n};\n\ntype DecimalChainId = string;\nexport type GasMultiplierByChainId = Record<DecimalChainId, number>;\n\nexport type FeatureFlagResponse = Infer<typeof PlatformConfigSchema>;\n\n// TODO move definition to validators.ts\n/**\n * This is the interface for the quote request sent to the bridge-api\n * and should only be used by the fetchBridgeQuotes utility function\n * Components and redux stores should use the {@link GenericQuoteRequest} type\n */\nexport type QuoteRequest<\n ChainIdType = ChainId | number,\n TokenAddressType = string,\n WalletAddressType = string,\n> = {\n walletAddress: WalletAddressType;\n destWalletAddress?: WalletAddressType;\n srcChainId: ChainIdType;\n destChainId: ChainIdType;\n srcTokenAddress: TokenAddressType;\n destTokenAddress: TokenAddressType;\n /**\n * This is the amount sent, in atomic amount\n */\n srcTokenAmount: string;\n slippage?: number;\n aggIds?: string[];\n bridgeIds?: string[];\n insufficientBal?: boolean;\n resetApproval?: boolean;\n refuel?: boolean;\n /**\n * Whether the response should include gasless swap quotes\n * This should be true if the user has opted in to STX on the client\n * and the current network has STX support\n */\n gasIncluded: boolean;\n /**\n * Whether to request quotes that use EIP-7702 delegated gasless execution\n */\n gasIncluded7702: boolean;\n /**\n * The fee that will be charged by MetaMask\n */\n fee?: number;\n};\n\nexport enum StatusTypes {\n SUBMITTED = 'SUBMITTED',\n UNKNOWN = 'UNKNOWN',\n FAILED = 'FAILED',\n PENDING = 'PENDING',\n COMPLETE = 'COMPLETE',\n}\n\n/**\n * These are types that components pass in. Since data is a mix of types when coming from the redux store, we need to use a generic type that can cover all the types.\n * Payloads with this type are transformed into QuoteRequest by fetchBridgeQuotes right before fetching quotes\n */\nexport type GenericQuoteRequest = QuoteRequest<\n Hex | CaipChainId | string | number, // chainIds\n Hex | CaipAssetId | string, // assetIds/addresses\n Hex | CaipAccountId | string // accountIds/addresses\n>;\n\nexport type Step = Infer<typeof StepSchema>;\n\nexport type RefuelData = Step;\n\nexport type FeeData = Infer<typeof FeeDataSchema>;\n\nexport type Intent = Infer<typeof IntentSchema>;\nexport type IntentOrderLike = Intent['order'];\n\nexport type BatchSellTradesRequest = {\n quotes: QuoteResponseV1[];\n stxEnabled: boolean;\n};\n\n/**\n * This is the bridge-api response for the obtainGaslessBatch method\n */\nexport type BatchSellTradesResponse = Infer<\n typeof BatchSellTradesResponseSchema\n>;\n\nexport type SimulatedGasFeeLimits = Infer<typeof SimulatedGasFeeLimitsSchema>;\nexport type TxFeeGasLimits = Infer<typeof TxFeeGasLimitsSchema>;\n\nexport type GaslessProperties = Infer<typeof GaslessPropertiesSchema>;\n\ntype DeepPartialValue<Type> =\n NonNullable<Type> extends (infer U)[]\n ? DeepPartial<U>[]\n : NonNullable<Type> extends readonly (infer U)[]\n ? readonly DeepPartial<U>[]\n : NonNullable<Type> extends object\n ? DeepPartial<NonNullable<Type>>\n : Type;\nexport type DeepPartial<Type> = Type extends string\n ? Type\n : {\n [K in keyof Type]?: null extends Type[K]\n ? DeepPartialValue<Type[K]> | null\n : DeepPartialValue<Type[K]>;\n };\n\nexport enum ChainId {\n ETH = 1,\n OPTIMISM = 10,\n BSC = 56,\n POLYGON = 137,\n ZKSYNC = 324,\n BASE = 8453,\n ARBITRUM = 42161,\n AVALANCHE = 43114,\n LINEA = 59144,\n SOLANA = 1151111081099710,\n BTC = 20000000000001,\n /** Internal bridge / token-list id for Stellar pubnet (Token API chain: stellar:pubnet). */\n STELLAR = 20000000000002,\n TRON = 728126428,\n SEI = 1329,\n MONAD = 143,\n HYPEREVM = 999,\n MEGAETH = 4326,\n ARC = 5042,\n ROBINHOOD = 4663,\n}\n\nexport type FeatureFlagsPlatformConfig = Infer<typeof PlatformConfigSchema>;\n\nexport type TokenFeature = Infer<typeof TokenFeatureSchema>;\n\nexport type QuoteStreamCompleteData = Infer<typeof QuoteStreamCompleteSchema>;\n\nexport enum RequestStatus {\n LOADING = 0,\n FETCHED = 1,\n ERROR = 2,\n}\n\nexport type BridgeControllerState = {\n quoteRequest: Partial<GenericQuoteRequest>[];\n quotes: QuoteResponse[];\n /**\n * The time elapsed between the initial quote fetch and when the first valid quote was received\n */\n quotesInitialLoadTime: number | null;\n /**\n * The timestamp of when the latest quote fetch started\n */\n quotesLastFetched: number | null;\n /**\n * The status of the quote fetch, including fee calculations and validations\n * This is set to\n * - LOADING when the quote fetch starts\n * - FETCHED when the process completes successfully, including when quotes are empty\n * - ERROR when any errors occur\n *\n * When SSE is enabled, this is set to LOADING even when a quote is available. It is only\n * set to FETCHED when the stream is closed and all quotes have been received\n */\n quotesLoadingStatus: RequestStatus | null;\n quoteFetchError: string | null;\n /**\n * The number of times the quotes have been refreshed, starts at 0 and is\n * incremented at the end of each quote fetch\n */\n quotesRefreshCount: number;\n /**\n * Asset exchange rates for EVM and multichain assets that are not indexed by the assets controllers\n */\n assetExchangeRates: Record<CaipAssetType, ExchangeRate>;\n /**\n * When the src token is SOL, this needs to be subtracted from their balance to determine\n * the max amount that can be sent.\n */\n minimumBalanceForRentExemptionInLamports: string | null;\n /**\n * Security alerts for the destination token in the current quote request,\n * populated from `token_warning` SSE events.\n */\n tokenWarnings: TokenFeature[];\n /**\n * Client-supplied security classification for the destination token in the\n * current quote request, used as the `token_security_type_destination`\n * analytics property. Set via the `context` arg of\n * `updateBridgeQuoteRequestParams` and reset whenever the quote request is\n * reset. `null` when the client has no security data for the token.\n */\n tokenSecurityTypeDestination: string | null;\n /**\n * The denomination currently shown as the primary source amount input.\n * This is persisted as a user preference so returning to the flow restores\n * the last selected fiat/token display mode.\n */\n inputPrimaryDenomination: InputPrimaryDenomination;\n /**\n * Metadata about the completed quote stream, populated from the `complete` SSE event.\n * Set to null at the start of each fetch and updated when the complete event is received.\n */\n quoteStreamComplete: QuoteStreamCompleteData | null;\n /**\n * Contains gasless transaction data and fees for BatchSell quotes, provided by the obtainGaslessBatch API\n */\n batchSellTrades: BatchSellTradesResponse | null;\n /**\n * The status of the batch sell trades fetch, including fee calculations and validations\n */\n batchSellTradesLoadingStatus: RequestStatus | null;\n};\n\n/**\n * @deprecated Use the separate method action types (e.g.,\n * `BridgeControllerFetchQuotesAction`) instead.\n */\nexport type BridgeControllerAction<\n FunctionName extends keyof BridgeController,\n> = {\n type: `${typeof BRIDGE_CONTROLLER_NAME}:${FunctionName}`;\n handler: BridgeController[FunctionName];\n};\n\nexport type BridgeControllerGetStateAction = ControllerGetStateAction<\n typeof BRIDGE_CONTROLLER_NAME,\n BridgeControllerState\n>;\n\nexport type BridgeControllerStateChangeEvent = ControllerStateChangeEvent<\n typeof BRIDGE_CONTROLLER_NAME,\n BridgeControllerState\n>;\n\nexport type BridgeControllerActions =\n | BridgeControllerGetStateAction\n | BridgeControllerMethodActions;\n\nexport type BridgeControllerEvents = BridgeControllerStateChangeEvent;\n\nexport type AllowedActions =\n | AccountsControllerGetAccountByAddressAction\n | AuthenticationControllerGetBearerTokenAction\n | CurrencyRateControllerGetStateAction\n | TokenRatesControllerGetStateAction\n | MultichainAssetsRatesControllerGetStateAction\n | SnapControllerHandleRequestAction\n | NetworkControllerFindNetworkClientIdByChainIdAction\n | NetworkControllerGetNetworkClientByIdAction\n | RemoteFeatureFlagControllerGetStateAction\n | AssetsControllerGetExchangeRatesForBridgeAction;\nexport type AllowedEvents = never;\n\n/**\n * The messenger for the BridgeController.\n */\nexport type BridgeControllerMessenger = Messenger<\n typeof BRIDGE_CONTROLLER_NAME,\n BridgeControllerActions | AllowedActions,\n BridgeControllerEvents | AllowedEvents\n>;\n"]}