@rango-dev/widget-embedded 0.43.1-next.1 → 0.43.1-next.10

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 (139) hide show
  1. package/dist/components/BlockchainList/BlockchainList.d.ts.map +1 -1
  2. package/dist/components/BlockchainSelectorButton/BlockchainSelectorButton.d.ts.map +1 -1
  3. package/dist/components/BlockchainsSection/BlockchainsSection.d.ts.map +1 -1
  4. package/dist/components/ConfirmWalletsModal/ConfirmWalletsModal.d.ts.map +1 -1
  5. package/dist/components/ConfirmWalletsModal/WalletList.d.ts.map +1 -1
  6. package/dist/components/CustomDestination/CustomDestination.d.ts.map +1 -1
  7. package/dist/components/CustomDestination/CustomDestination.styles.d.ts +1 -0
  8. package/dist/components/CustomDestination/CustomDestination.styles.d.ts.map +1 -1
  9. package/dist/components/CustomTokenModal/CustomTokenModal.d.ts.map +1 -1
  10. package/dist/components/FilterSelector/FilterSelectorContent.d.ts.map +1 -1
  11. package/dist/components/HeaderButtons/NotificationsBadge.d.ts.map +1 -1
  12. package/dist/components/HistoryGroupedList/HistoryGroupedList.d.ts.map +1 -1
  13. package/dist/components/NoResult/NoResult.d.ts.map +1 -1
  14. package/dist/components/NotificationContent/NotificationContent.d.ts.map +1 -1
  15. package/dist/components/Quote/Quote.d.ts.map +1 -1
  16. package/dist/components/Quote/Quote.types.d.ts +2 -1
  17. package/dist/components/Quote/Quote.types.d.ts.map +1 -1
  18. package/dist/components/Quote/QuoteCostDetails.d.ts.map +1 -1
  19. package/dist/components/Quote/QuoteSummary.d.ts.map +1 -1
  20. package/dist/components/Quote/QuoteTrigger.d.ts.map +1 -1
  21. package/dist/components/QuoteWarningsAndErrors/HighValueLossWarningModal.d.ts.map +1 -1
  22. package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.d.ts.map +1 -1
  23. package/dist/components/QuoteWarningsAndErrors/SlippageWariningModal.d.ts.map +1 -1
  24. package/dist/components/QuoteWarningsAndErrors/UnknownPriceWarningModal.d.ts.map +1 -1
  25. package/dist/components/Quotes/Quotes.d.ts.map +1 -1
  26. package/dist/components/Quotes/SelectStrategy.d.ts.map +1 -1
  27. package/dist/components/RefreshModal/RefreshModal.d.ts.map +1 -1
  28. package/dist/components/SearchInput/SearchInput.d.ts.map +1 -1
  29. package/dist/components/Slippage/Slippage.d.ts.map +1 -1
  30. package/dist/components/StatefulConnectModal/StatefulConnectModal.d.ts +1 -0
  31. package/dist/components/StatefulConnectModal/StatefulConnectModal.d.ts.map +1 -1
  32. package/dist/components/SwapDetails/SwapDetails.d.ts.map +1 -1
  33. package/dist/components/SwapDetailsAlerts/SwapDetailsAlerts.Failed.d.ts.map +1 -1
  34. package/dist/components/SwapDetailsAlerts/SwapDetailsAlerts.Warning.d.ts.map +1 -1
  35. package/dist/components/SwapDetailsAlerts/SwapDetailsAlerts.d.ts.map +1 -1
  36. package/dist/components/SwapDetailsModal/SwapDetailsCompleteModal.d.ts.map +1 -1
  37. package/dist/components/SwapDetailsModal/SwapDetailsModal.WalletState.d.ts.map +1 -1
  38. package/dist/components/SwapDetailsModal/SwapDetailsModal.d.ts.map +1 -1
  39. package/dist/components/SwapDetailsModal/SwapDetailsModal.helpers.d.ts.map +1 -1
  40. package/dist/components/SwapMetrics/SwapMetrics.helpers.d.ts.map +1 -1
  41. package/dist/components/SwitchFromAndTo/SwitchFromAndTo.d.ts.map +1 -1
  42. package/dist/components/WalletStatefulConnect/DerivationPath.d.ts.map +1 -1
  43. package/dist/components/WalletStatefulConnect/ExperimentalChain.d.ts +1 -0
  44. package/dist/components/WalletStatefulConnect/ExperimentalChain.d.ts.map +1 -1
  45. package/dist/components/WalletStatefulConnect/NamespaceDetachedItem.d.ts.map +1 -1
  46. package/dist/components/WalletStatefulConnect/NamespaceListItem.d.ts.map +1 -1
  47. package/dist/components/WalletStatefulConnect/Namespaces.d.ts.map +1 -1
  48. package/dist/components/common/ActivateTabModal/ActivateTabModal.d.ts.map +1 -1
  49. package/dist/containers/Inputs/Inputs.d.ts.map +1 -1
  50. package/dist/containers/QuoteInfo/QuoteInfo.d.ts.map +1 -1
  51. package/dist/containers/QuoteInfo/QuoteInfo.types.d.ts +1 -0
  52. package/dist/containers/QuoteInfo/QuoteInfo.types.d.ts.map +1 -1
  53. package/dist/containers/Settings/Lists.d.ts.map +1 -1
  54. package/dist/index.js +2 -2
  55. package/dist/index.js.map +3 -3
  56. package/dist/pages/AddCustomTokenPage.d.ts.map +1 -1
  57. package/dist/pages/ConfirmSwapPage.d.ts.map +1 -1
  58. package/dist/pages/CustomTokensPage.d.ts.map +1 -1
  59. package/dist/pages/HistoryPage.d.ts.map +1 -1
  60. package/dist/pages/Home.d.ts.map +1 -1
  61. package/dist/pages/LanguagePage.d.ts.map +1 -1
  62. package/dist/pages/LiquiditySourcePage.d.ts.map +1 -1
  63. package/dist/pages/SelectBlockchainPage.d.ts.map +1 -1
  64. package/dist/pages/SelectSwapItemPage/SelectSwapItemsPage.d.ts.map +1 -1
  65. package/dist/pages/SettingsPage.d.ts.map +1 -1
  66. package/dist/pages/WalletsPage.d.ts.map +1 -1
  67. package/dist/store/slices/wallets.d.ts +1 -0
  68. package/dist/store/slices/wallets.d.ts.map +1 -1
  69. package/dist/types/config.d.ts +1 -1
  70. package/dist/utils/swap.d.ts.map +1 -1
  71. package/dist/widget-embedded.build.json +1 -1
  72. package/package.json +10 -10
  73. package/src/components/BlockchainList/BlockchainList.tsx +4 -1
  74. package/src/components/BlockchainList/LoadingBlockchainList.tsx +1 -1
  75. package/src/components/BlockchainSelectorButton/BlockchainSelectorButton.tsx +2 -1
  76. package/src/components/BlockchainsSection/BlockchainsSection.tsx +8 -2
  77. package/src/components/ConfirmWalletsModal/ConfirmWalletsModal.tsx +8 -1
  78. package/src/components/ConfirmWalletsModal/WalletList.tsx +10 -4
  79. package/src/components/CustomDestination/CustomDestination.tsx +2 -1
  80. package/src/components/CustomTokenModal/CustomTokenModal.tsx +1 -0
  81. package/src/components/FilterSelector/FilterSelectorContent.tsx +1 -0
  82. package/src/components/HeaderButtons/InProgressTransactionBadge.tsx +1 -1
  83. package/src/components/HeaderButtons/NotificationsBadge.tsx +5 -1
  84. package/src/components/HistoryGroupedList/HistoryGroupedList.tsx +1 -0
  85. package/src/components/ImportCustomToken/ImportCustomToken.tsx +1 -1
  86. package/src/components/NoResult/NoResult.tsx +2 -1
  87. package/src/components/NotificationContent/NotificationContent.tsx +1 -0
  88. package/src/components/Quote/Quote.tsx +8 -2
  89. package/src/components/Quote/Quote.types.ts +2 -1
  90. package/src/components/Quote/QuoteCostDetails.tsx +9 -3
  91. package/src/components/Quote/QuoteSummary.tsx +2 -0
  92. package/src/components/Quote/QuoteTrigger.tsx +1 -0
  93. package/src/components/QuoteWarningsAndErrors/HighValueLossWarningModal.tsx +1 -0
  94. package/src/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.tsx +1 -0
  95. package/src/components/QuoteWarningsAndErrors/SlippageWariningModal.tsx +1 -0
  96. package/src/components/QuoteWarningsAndErrors/UnknownPriceWarningModal.tsx +1 -0
  97. package/src/components/Quotes/Quotes.tsx +1 -0
  98. package/src/components/Quotes/SelectStrategy.tsx +1 -0
  99. package/src/components/RefreshModal/RefreshModal.tsx +2 -0
  100. package/src/components/SearchInput/SearchInput.tsx +7 -2
  101. package/src/components/Slippage/Slippage.tsx +3 -0
  102. package/src/components/StatefulConnectModal/StatefulConnectModal.tsx +2 -0
  103. package/src/components/SwapDetails/SwapDetails.tsx +2 -1
  104. package/src/components/SwapDetailsAlerts/SwapDetailsAlerts.Failed.tsx +2 -0
  105. package/src/components/SwapDetailsAlerts/SwapDetailsAlerts.Warning.tsx +9 -1
  106. package/src/components/SwapDetailsAlerts/SwapDetailsAlerts.tsx +8 -1
  107. package/src/components/SwapDetailsModal/SwapDetailsCompleteModal.tsx +2 -0
  108. package/src/components/SwapDetailsModal/SwapDetailsModal.WalletState.tsx +1 -0
  109. package/src/components/SwapDetailsModal/SwapDetailsModal.helpers.tsx +4 -0
  110. package/src/components/SwapDetailsModal/SwapDetailsModal.tsx +1 -0
  111. package/src/components/SwapMetrics/SwapMetrics.helpers.ts +6 -2
  112. package/src/components/SwitchFromAndTo/SwitchFromAndTo.tsx +1 -0
  113. package/src/components/WalletStatefulConnect/DerivationPath.tsx +2 -0
  114. package/src/components/WalletStatefulConnect/Detached.tsx +1 -1
  115. package/src/components/WalletStatefulConnect/ExperimentalChain.tsx +3 -1
  116. package/src/components/WalletStatefulConnect/NamespaceDetachedItem.tsx +3 -2
  117. package/src/components/WalletStatefulConnect/NamespaceListItem.tsx +4 -1
  118. package/src/components/WalletStatefulConnect/Namespaces.tsx +1 -0
  119. package/src/components/WalletStatefulConnect/SupportedChainsList.tsx +1 -1
  120. package/src/components/common/ActivateTabModal/ActivateTabModal.tsx +1 -0
  121. package/src/containers/ExpandedQuotes/ExpandedQuotes.tsx +1 -1
  122. package/src/containers/Inputs/Inputs.tsx +2 -0
  123. package/src/containers/QuoteInfo/QuoteInfo.tsx +2 -1
  124. package/src/containers/QuoteInfo/QuoteInfo.types.ts +1 -0
  125. package/src/containers/Settings/Lists.tsx +13 -3
  126. package/src/pages/AddCustomTokenPage.tsx +7 -1
  127. package/src/pages/ConfirmSwapPage.tsx +9 -1
  128. package/src/pages/CustomTokensPage.tsx +2 -0
  129. package/src/pages/HistoryPage.tsx +2 -0
  130. package/src/pages/Home.tsx +1 -0
  131. package/src/pages/LanguagePage.tsx +2 -0
  132. package/src/pages/LiquiditySourcePage.tsx +6 -1
  133. package/src/pages/SelectBlockchainPage.tsx +1 -0
  134. package/src/pages/SelectSwapItemPage/SelectSwapItemsPage.tsx +1 -0
  135. package/src/pages/SettingsPage.tsx +1 -0
  136. package/src/pages/WalletsPage.tsx +1 -0
  137. package/src/store/slices/wallets.ts +2 -0
  138. package/src/types/config.ts +1 -1
  139. package/src/utils/swap.ts +2 -1
@@ -11,6 +11,7 @@ export function WarningAlert(props: WaningAlertsProps) {
11
11
  return (
12
12
  <Alert
13
13
  type="warning"
14
+ id="widget-swap-details-change-network-alert"
14
15
  title={message.shortMessage}
15
16
  action={
16
17
  <Button
@@ -36,6 +37,7 @@ export function WarningAlert(props: WaningAlertsProps) {
36
37
  <Alert
37
38
  type="warning"
38
39
  title={message.shortMessage}
40
+ id="widget-swap-details-warning-alert-connect-wallet-alert"
39
41
  action={
40
42
  <Button
41
43
  id="widget-swap-details-warning-alert-connect-wallet-btn"
@@ -53,5 +55,11 @@ export function WarningAlert(props: WaningAlertsProps) {
53
55
  );
54
56
  }
55
57
 
56
- return <Alert type="warning" title={message.shortMessage} />;
58
+ return (
59
+ <Alert
60
+ id="widget-swap-details-short-alert"
61
+ type="warning"
62
+ title={message.shortMessage}
63
+ />
64
+ );
57
65
  }
@@ -40,6 +40,7 @@ export function SwapDetailsAlerts(props: SwapAlertsProps) {
40
40
  return (
41
41
  <Fragment key={key}>
42
42
  <Alert
43
+ id="widget-swap-details-tx-alert"
43
44
  type={
44
45
  lastUrl
45
46
  ? (loading && 'loading') || (error && 'error') || 'success'
@@ -65,7 +66,13 @@ export function SwapDetailsAlerts(props: SwapAlertsProps) {
65
66
  </Fragment>
66
67
  );
67
68
  })}
68
- {waitingProgress && <Alert type="loading" title={message.shortMessage} />}
69
+ {waitingProgress && (
70
+ <Alert
71
+ id="widget-swap-details-loading-alert"
72
+ type="loading"
73
+ title={message.shortMessage}
74
+ />
75
+ )}
69
76
  {step.status !== 'failed' && hasWarning && (
70
77
  <WarningAlert
71
78
  switchNetwork={switchNetwork}
@@ -44,6 +44,7 @@ export function SwapDetailsCompleteModal(props: CompleteModalPropTypes) {
44
44
  <WatermarkedModal
45
45
  open={open}
46
46
  onClose={onClose}
47
+ id="widget-swap-details-complete-modal"
47
48
  container={
48
49
  document.getElementById(WIDGET_UI_ID.SWAP_BOX_ID) || document.body
49
50
  }>
@@ -52,6 +53,7 @@ export function SwapDetailsCompleteModal(props: CompleteModalPropTypes) {
52
53
  <TokenAmount
53
54
  direction="vertical"
54
55
  tooltipContainer={getContainer()}
56
+ id="widget-swap-details-complete-modal-success-token-amount-container"
55
57
  type="output"
56
58
  centerAlign={true}
57
59
  price={{
@@ -73,6 +73,7 @@ export const WalletStateContent = (props: WalletStateContentProps) => {
73
73
  </WalletContainer>
74
74
  )}
75
75
  <StatefulConnectModal
76
+ id="widget-swap-details-modal"
76
77
  wallet={selectedWalletToConnect}
77
78
  onClose={() => {
78
79
  setSelectedWalletToConnect(undefined);
@@ -19,4 +19,8 @@ export const modalNetworkValues: Record<
19
19
  type: 'success',
20
20
  title: i18n.t('Network Changed'),
21
21
  },
22
+ [PendingSwapNetworkStatus.NetworkChangeFailed]: {
23
+ type: 'warning',
24
+ title: i18n.t('Network Change Failed'),
25
+ },
22
26
  };
@@ -29,6 +29,7 @@ export function SwapDetailsModal(props: ModalPropTypes) {
29
29
 
30
30
  return (
31
31
  <WatermarkedModal
32
+ id="widget-swap-details-modal"
32
33
  open={!!state}
33
34
  onClose={onClose}
34
35
  container={
@@ -41,14 +41,18 @@ export function getUsdExchangeRate(params: {
41
41
  if (!toTokenUsdPrice || !fromTokenUsdPrice) {
42
42
  return { rawValue: '0', displayValue: '0' };
43
43
  }
44
-
45
44
  const toPrice = new BigNumber(toTokenUsdPrice);
46
45
  const fromPrice = new BigNumber(fromTokenUsdPrice);
47
46
  const rawValue = toPrice.dividedBy(fromPrice);
48
47
  let displayValue: string;
49
48
 
50
49
  if (rawValue.isLessThan(1)) {
51
- displayValue = rawValue.toFixed(SMALL_VALUE_DECIMALS);
50
+ /*
51
+ * Format the number with up to SMALL_VALUE_DECIMALS digits after the decimal point,
52
+ * then remove any trailing zeros.
53
+ * Example: "0.120000" → "0.12", "0.00000000000010" → "0.0000000000001"
54
+ */
55
+ displayValue = rawValue.toFixed(SMALL_VALUE_DECIMALS).replace(/\.?0+$/, '');
52
56
  } else if (rawValue.toFixed(0).length > LARGE_VALUE_MAX_DIGITS) {
53
57
  displayValue = rawValue.toFixed(0).slice(0, LARGE_VALUE_MAX_DIGITS);
54
58
  } else {
@@ -15,6 +15,7 @@ export function SwitchFromAndToButton() {
15
15
  return (
16
16
  <SwitchButtonContainer>
17
17
  <StyledButton
18
+ id="widget-switch-from-and-to-btn"
18
19
  onClick={(event) => {
19
20
  const button = event.currentTarget;
20
21
 
@@ -100,6 +100,7 @@ export function DerivationPath(props: PropTypes) {
100
100
  {i18n.t('Choose Derivation Path Template')}
101
101
  </InputLabel>
102
102
  <Select
103
+ id="widget-derivation-path-template-select"
103
104
  value={selectedDerivationPathId || ''}
104
105
  options={derivationPaths.map((derivationPath) => ({
105
106
  value: derivationPath.id,
@@ -116,6 +117,7 @@ export function DerivationPath(props: PropTypes) {
116
117
  : i18n.t('Enter Index')}
117
118
  </InputLabel>
118
119
  <TextField
120
+ id="widget-derivation-path-template-input"
119
121
  type={isCustomOptionSelected ? 'text' : 'number'}
120
122
  variant="contained"
121
123
  value={derivationPathIndex}
@@ -25,7 +25,7 @@ export function Detached(props: PropTypes) {
25
25
  icon={<Image src={targetWallet.image} size={45} />}
26
26
  />
27
27
  <Divider size={20} />
28
- <NamespaceList>
28
+ <NamespaceList id="widget-detached-namespace-list" as={'ul'}>
29
29
  {targetWallet.needsNamespace?.data.map((namespace, index, array) => (
30
30
  <React.Fragment key={namespace.id}>
31
31
  {namespace.unsupported ? (
@@ -5,13 +5,15 @@ import React from 'react';
5
5
  interface PropTypes {
6
6
  displayName?: string;
7
7
  onConfirm: () => void;
8
+ id: string;
8
9
  }
9
10
 
10
11
  export function ExperimentalChain(props: PropTypes) {
11
- const { displayName, onConfirm } = props;
12
+ const { displayName, onConfirm, id } = props;
12
13
 
13
14
  return (
14
15
  <MessageBox
16
+ id={id}
15
17
  title={i18n.t({
16
18
  id: 'Add {blockchainDisplayName} Chain',
17
19
  values: { blockchainDisplayName: displayName },
@@ -97,7 +97,7 @@ export const NamespaceDetachedItem = function NamespaceDetachedItem(
97
97
  size={40}
98
98
  />
99
99
  <NamespaceItemInnerContent>
100
- <NamespaceDetachedItemInfo>
100
+ <NamespaceDetachedItemInfo className="widget-namespace-detached-item-info-div">
101
101
  <Typography variant="label" size="large">
102
102
  {namespace.label}
103
103
  </Typography>
@@ -124,6 +124,7 @@ export const NamespaceDetachedItem = function NamespaceDetachedItem(
124
124
  )}
125
125
  {!namespaceState.connected && error && (
126
126
  <NamespaceItemErrorDropdownToggle
127
+ className="widget-namespace-detached-item-error-toggle-btn"
127
128
  onClick={() =>
128
129
  setErrorIsExpanded((errorIsExpanded) => !errorIsExpanded)
129
130
  }>
@@ -167,7 +168,7 @@ export const NamespaceDetachedItem = function NamespaceDetachedItem(
167
168
  {!namespaceState.connected && !!error && errorIsExpanded && (
168
169
  <>
169
170
  <Divider size={4} />
170
- <NamespaceItemError>
171
+ <NamespaceItemError id="widget-namespace-item-error-div">
171
172
  <Typography variant="body" size="small" color="neutral700">
172
173
  {(error.cause as Error)?.message || error.message}
173
174
  </Typography>
@@ -21,7 +21,10 @@ export function NamespaceListItem(props: NamespaceItemPropTypes) {
21
21
  const supportedChains = namespace.getSupportedChains(blockchains);
22
22
  const showSupportedChains = supportedChains.length > 1;
23
23
  return (
24
- <NamespaceItemContainer onClick={onClick} clickable>
24
+ <NamespaceItemContainer
25
+ onClick={onClick}
26
+ clickable
27
+ className="widget-namespace-list-item">
25
28
  <NamespaceItemContent>
26
29
  <NamespaceLogo
27
30
  src={getBlockchainLogo(blockchains, namespace.id)}
@@ -117,6 +117,7 @@ export function Namespaces(props: PropTypes) {
117
117
  <>
118
118
  <Divider size={20} />
119
119
  <Alert
120
+ id="widget-wallet-stateful-connect-alert"
120
121
  variant="alarm"
121
122
  type="info"
122
123
  title={i18n.t(
@@ -15,7 +15,7 @@ const SUPPORTED_CHAINS_MAX_DISPLAYED_NUMBER = 3;
15
15
  export function SupportedChainsList(props: PropTypes) {
16
16
  const { chains } = props;
17
17
  return (
18
- <SupportedChainsContainer>
18
+ <SupportedChainsContainer id="widget-supported-chains-container">
19
19
  {chains
20
20
  .slice(0, SUPPORTED_CHAINS_MAX_DISPLAYED_NUMBER)
21
21
  .map((chain, index) => (
@@ -15,6 +15,7 @@ export function ActivateTabModal(props: PropTypes) {
15
15
  open={open}
16
16
  dismissible
17
17
  onClose={onClose}
18
+ id="widget-active-tab-modal"
18
19
  container={getContainer()}>
19
20
  <MessageBox
20
21
  title={i18n.t('Activate current tab')}
@@ -47,7 +47,7 @@ export function ExpandedQuotes(props: PropTypes) {
47
47
  return (
48
48
  <Container
49
49
  expandMode={config?.variant === 'full-expanded' ? 'full' : 'default'}
50
- className={`${containerClass} ${LayoutContainer()}`}
50
+ className={`${containerClass} ${LayoutContainer()} widget-expanded-quotes-container`}
51
51
  id={WIDGET_UI_ID.EXPANDED_BOX_ID}>
52
52
  <Header
53
53
  title={i18n.t('Routes')}
@@ -78,6 +78,7 @@ export function Inputs(props: PropTypes) {
78
78
  <FromContainer>
79
79
  <SwapInput
80
80
  label={i18n.t('From')}
81
+ id="widget-swap-from"
81
82
  mode="From"
82
83
  onInputChange={setInputAmount}
83
84
  onInputBlur={sanitizeInputAmount}
@@ -133,6 +134,7 @@ export function Inputs(props: PropTypes) {
133
134
  sharpBottomStyle={!isExpandable && (!!selectedQuote || fetchingQuote)}
134
135
  label={i18n.t('To')}
135
136
  mode="To"
137
+ id="widget-swap-to-input"
136
138
  fetchingQuote={fetchingQuote}
137
139
  chain={{
138
140
  displayName: toBlockchain?.displayName || '',
@@ -23,6 +23,7 @@ export function QuoteInfo(props: PropTypes) {
23
23
  onClick,
24
24
  showModalFee,
25
25
  selected,
26
+ id,
26
27
  onClickAllRoutes,
27
28
  fullExpandedMode = false,
28
29
  container,
@@ -50,7 +51,7 @@ export function QuoteInfo(props: PropTypes) {
50
51
  }
51
52
 
52
53
  return showQuote ? (
53
- <QuoteContainer onClick={() => onClick?.(quote)}>
54
+ <QuoteContainer onClick={() => onClick?.(quote)} id={id}>
54
55
  <Quote
55
56
  quote={quote}
56
57
  error={error}
@@ -9,6 +9,7 @@ export type PropTypes = {
9
9
  tagHidden?: boolean;
10
10
  error: QuoteError | null;
11
11
  warning: QuoteWarning | null;
12
+ id: string;
12
13
  autoScrollOnExpanding?: boolean;
13
14
  expanded?: boolean;
14
15
  onClickAllRoutes?: () => void;
@@ -73,6 +73,7 @@ const themesList = [
73
73
  const getThemeIcon = (theme: ThemeMode) => {
74
74
  const iconProps: SvgIconProps = { color: 'gray', size: 16 };
75
75
 
76
+ // eslint-disable-next-line @typescript-eslint/switch-exhaustiveness-check
76
77
  switch (theme) {
77
78
  case 'auto':
78
79
  return <AutoThemeIcon {...iconProps} />;
@@ -131,6 +132,7 @@ export function SettingsLists() {
131
132
  ).length;
132
133
 
133
134
  const handleSwapperEndItem = (totalSelected: number, total: number) => {
135
+ // eslint-disable-next-line @typescript-eslint/switch-exhaustiveness-check
134
136
  switch (fetchStatus) {
135
137
  case 'loading':
136
138
  return <Skeleton variant="text" size="medium" width={50} />;
@@ -230,7 +232,7 @@ export function SettingsLists() {
230
232
  const infiniteApprovalItem = {
231
233
  id: 'widget-setting-infinite-approval-item-btn',
232
234
  title: (
233
- <>
235
+ <React.Fragment>
234
236
  <Typography variant="title" size="xmedium">
235
237
  {i18n.t('Infinite approval')}
236
238
  </Typography>
@@ -251,7 +253,7 @@ export function SettingsLists() {
251
253
  }>
252
254
  <InfoIcon color="gray" />
253
255
  </Tooltip>
254
- </>
256
+ </React.Fragment>
255
257
  ),
256
258
  start: <InfinityIcon color="gray" size={16} />,
257
259
  end: <Switch checked={infiniteApprove} />,
@@ -272,6 +274,7 @@ export function SettingsLists() {
272
274
  container={getContainer()}
273
275
  items={themesList}
274
276
  value={theme}
277
+ className="widget-setting-theme-item-tabs-container"
275
278
  onChange={(item) => setTheme(item.id as ThemeMode)}
276
279
  type="primary"
277
280
  borderRadius="small"
@@ -298,7 +301,14 @@ export function SettingsLists() {
298
301
 
299
302
  return (
300
303
  <List
301
- type={<ListItemButton hasDivider id="_" onClick={() => console.log()} />}
304
+ type={
305
+ <ListItemButton
306
+ className="widget-settings-list-item-btn"
307
+ hasDivider
308
+ id="_"
309
+ onClick={() => console.log()}
310
+ />
311
+ }
302
312
  items={settingItems}
303
313
  />
304
314
  );
@@ -93,6 +93,7 @@ export function AddCustomTokenPage() {
93
93
  <Divider size={10} />
94
94
  <TextField
95
95
  fullWidth
96
+ id="widget-add-custom-token-token-address-input"
96
97
  disabled={!blockchain}
97
98
  variant="contained"
98
99
  placeholder={i18n.t('Enter token address')}
@@ -107,7 +108,12 @@ export function AddCustomTokenPage() {
107
108
  {!isValidAddress && !!address && (
108
109
  <>
109
110
  <Divider size={4} />
110
- <Alert type="error" variant="alarm" title="Invalid Address" />
111
+ <Alert
112
+ id="widget-add-custom-token-invalid-address-alert"
113
+ type="error"
114
+ variant="alarm"
115
+ title="Invalid Address"
116
+ />
111
117
  </>
112
118
  )}
113
119
  </div>
@@ -199,7 +199,14 @@ export function ConfirmSwapPage() {
199
199
  const quoteError = confirmSwapResult.error;
200
200
  const alerts = [];
201
201
  if (dbErrorMessage) {
202
- alerts.push(<Alert type="error" variant="alarm" title={dbErrorMessage} />);
202
+ alerts.push(
203
+ <Alert
204
+ id="widget-confirm-swap-db-error-alert"
205
+ type="error"
206
+ variant="alarm"
207
+ title={dbErrorMessage}
208
+ />
209
+ );
203
210
  }
204
211
 
205
212
  if (quoteWarning || quoteError) {
@@ -304,6 +311,7 @@ export function ConfirmSwapPage() {
304
311
  <QuoteInfo
305
312
  quote={selectedQuote}
306
313
  type="swap-preview"
314
+ id="widget-confirm-swap-quote-container"
307
315
  expanded
308
316
  tagHidden
309
317
  error={confirmSwapResult.error}
@@ -94,6 +94,7 @@ export function CustomTokensPage() {
94
94
  {!!customTokens.length ? (
95
95
  <>
96
96
  <SearchInput
97
+ id="widget-custom-tokens-search-token-input"
97
98
  value={searchedFor}
98
99
  setValue={setSearchedFor}
99
100
  fullWidth
@@ -152,6 +153,7 @@ export function CustomTokensPage() {
152
153
  </Content>
153
154
  <WatermarkedModal
154
155
  open={isDeleteModalOpen}
156
+ id="widget-custom-tokens-delete-modal"
155
157
  dismissible
156
158
  onClose={() => setIsDeleteModalOpen(false)}
157
159
  container={getContainer()}>
@@ -159,6 +159,7 @@ export function HistoryPage() {
159
159
  fullWidth
160
160
  variant="contained"
161
161
  placeholder={i18n.t('Search Transaction')}
162
+ id="widget-history-search-transaction-input"
162
163
  autoFocus
163
164
  onChange={handleSearch}
164
165
  style={{ height: 36 }}
@@ -211,6 +212,7 @@ export function HistoryPage() {
211
212
  <WatermarkedModal
212
213
  open={openClearModal}
213
214
  onClose={onCloseModal}
215
+ id="widget-history-clear-modal"
214
216
  container={getContainer()}>
215
217
  <Divider size={20} />
216
218
  <MessageBox
@@ -217,6 +217,7 @@ export function Home() {
217
217
  quote={selectedQuote}
218
218
  loading={fetchingQuote}
219
219
  error={quoteError}
220
+ id="widget-home-expandable-quote-container"
220
221
  tagHidden={false}
221
222
  warning={currentQuoteWarning}
222
223
  type="basic"
@@ -45,6 +45,7 @@ export function LanguagePage() {
45
45
  <PageContainer>
46
46
  <Alert
47
47
  type="warning"
48
+ id="widget-language-machine-translation-alarm-alert"
48
49
  variant="alarm"
49
50
  title="Warning: We are using machine translation, so the translations may be inaccurate."
50
51
  />
@@ -54,6 +55,7 @@ export function LanguagePage() {
54
55
  type={
55
56
  <ListItemButton
56
57
  title={i18n.t('language')}
58
+ className="widget-language-list-item-btn"
57
59
  id="_"
58
60
  onClick={() => console.log()}
59
61
  />
@@ -70,6 +70,7 @@ export function LiquiditySourcePage({ sourceType }: PropTypes) {
70
70
 
71
71
  const list = liquiditySources.map((sourceItem) => {
72
72
  const { selected, groupTitle, logo, id, ...restSourceItem } = sourceItem;
73
+
73
74
  return {
74
75
  id: `widget-setting-liquidity-source-${replaceSpacesWithDash(
75
76
  id.toLowerCase()
@@ -129,6 +130,7 @@ export function LiquiditySourcePage({ sourceType }: PropTypes) {
129
130
  <SearchInput
130
131
  value={searchedFor}
131
132
  setValue={setSearchedFor}
133
+ id="widget-liquidity-source-search-input"
132
134
  fullWidth
133
135
  color="light"
134
136
  variant="contained"
@@ -148,7 +150,9 @@ export function LiquiditySourcePage({ sourceType }: PropTypes) {
148
150
  </NotFoundContainer>
149
151
  ) : (
150
152
  fetchStatus === 'success' && (
151
- <LiquiditySourceList disabled={campaignMode}>
153
+ <LiquiditySourceList
154
+ disabled={campaignMode}
155
+ className="widget-liquidity-source-list">
152
156
  {filteredList.map((sourceItem) => {
153
157
  const { groupTitle, ...otherProps } = sourceItem;
154
158
 
@@ -158,6 +162,7 @@ export function LiquiditySourcePage({ sourceType }: PropTypes) {
158
162
  style={{ height: '61px' }}
159
163
  {...otherProps}
160
164
  selected={false}
165
+ className="widget-liquidity-source-list-item-btn"
161
166
  hasDivider
162
167
  />
163
168
  </React.Fragment>
@@ -58,6 +58,7 @@ export function SelectBlockchainPage(props: PropTypes) {
58
58
  value={searchedFor}
59
59
  autoFocus
60
60
  placeholder={i18n.t('Search Chain')}
61
+ id="widget-select-blockchain-search-input"
61
62
  color="light"
62
63
  variant="contained"
63
64
  size="large"
@@ -117,6 +117,7 @@ export function SelectSwapItemsPage(props: PropTypes) {
117
117
  <Divider size={24} />
118
118
  <SearchInput
119
119
  value={searchedFor}
120
+ id="widget-select-swap-item-search-input"
120
121
  autoFocus
121
122
  placeholder={i18n.t('Search Token')}
122
123
  color="light"
@@ -42,6 +42,7 @@ export function SettingsPage() {
42
42
  <Alert
43
43
  type="info"
44
44
  variant="alarm"
45
+ id="widget-settings-campaign-mode-alert"
45
46
  title={i18n.t(
46
47
  "Currently, you're in campaign mode with restrictions on liquidity sources. Would you like to switch out of this mode and make use of all available liquidity sources?"
47
48
  )}
@@ -112,6 +112,7 @@ export function WalletsPage() {
112
112
  );
113
113
  })}
114
114
  <StatefulConnectModal
115
+ id="widget-state-full-connect-modal"
115
116
  wallet={selectedWalletToConnect}
116
117
  onClose={() => {
117
118
  setSelectedWalletToConnect(undefined);
@@ -60,6 +60,7 @@ interface DeprecatedTokenBalance {
60
60
  rawAmount: string;
61
61
  decimal: number | null;
62
62
  amount: string;
63
+ isSupported: boolean;
63
64
  logo: string | null;
64
65
  usdPrice: number | null;
65
66
  }
@@ -807,6 +808,7 @@ export const createWalletsSlice = keepLastUpdated<AppStoreState, WalletsSlice>(
807
808
  rawAmount: balance.amount,
808
809
  decimal: balance.decimals,
809
810
  amount: amount.toString(),
811
+ isSupported: !!token,
810
812
  logo: token?.image || null,
811
813
  usdPrice: token?.usdPrice || null,
812
814
  });
@@ -200,7 +200,7 @@ export type TonConnectConfig = {
200
200
  * exchange.It can also used to limit source swap blockchains/tokens to some limited ones.
201
201
  * @property {TrezorManifest} trezorManifest - Trezor Connect Manifest requires that you,
202
202
  * as a Trezor Connect integrator,share your e-mail and application url.
203
- * @property {TonConnectConfig} tonConnect - Configuration for TON Connect compatible providers like MyTonWallet.
203
+ * @property {TonConnectConfig} tonConnect - Configuration for the TON Connect provider.
204
204
  * @property {BlockchainAndTokenConfig} to - The "to" property is an optional property of type
205
205
  * "BlockchainAndTokenConfig" that specifies the default blockchain and token to which the user wants to
206
206
  * exchange.It can also used to limit destination swap blockchains/tokens to some limited ones.
package/src/utils/swap.ts CHANGED
@@ -305,8 +305,9 @@ export function getTotalFeeInUsd(
305
305
 
306
306
  export function getUsdFee(fee: SwapFee): BigNumber {
307
307
  let totalFeeInUsd = ZERO;
308
+ const price = new BigNumber(fee.price || 0);
308
309
  totalFeeInUsd = totalFeeInUsd.plus(
309
- new BigNumber(fee.amount).multipliedBy(fee.price || 0)
310
+ new BigNumber(fee.amount).multipliedBy(price)
310
311
  );
311
312
 
312
313
  return totalFeeInUsd;