@xswap-link/sdk 0.14.0 → 0.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/dist/index.d.mts +4 -0
  3. package/dist/index.d.ts +4 -0
  4. package/dist/index.global.js +92 -92
  5. package/dist/index.js +3208 -2862
  6. package/dist/index.js.map +1 -1
  7. package/dist/index.mjs +3083 -2740
  8. package/dist/index.mjs.map +1 -1
  9. package/localTheme.ts +6 -4
  10. package/package.json +1 -1
  11. package/src/assets/icons/AdjustmentsIcon.tsx +5 -7
  12. package/src/assets/icons/ChainlinkMarkIcon.tsx +4 -5
  13. package/src/assets/icons/CheckCircleThinIcon.tsx +22 -0
  14. package/src/assets/icons/ChevronDownThinIcon.tsx +39 -0
  15. package/src/assets/icons/ChevronDownWideThinIcon.tsx +18 -0
  16. package/src/assets/icons/ChevronsUpDownThinIcon.tsx +21 -0
  17. package/src/assets/icons/ClockIcon.tsx +3 -7
  18. package/src/assets/icons/CloseIcon.tsx +9 -4
  19. package/src/assets/icons/ErrorCircleThinIcon.tsx +22 -0
  20. package/src/assets/icons/LinkExternalThinIcon.tsx +19 -0
  21. package/src/assets/icons/LoadingRingIcon.tsx +22 -0
  22. package/src/assets/icons/ProgressRingThinIcon.tsx +29 -0
  23. package/src/assets/icons/SearchThinIcon.tsx +15 -0
  24. package/src/assets/icons/SignThinIcon.tsx +15 -0
  25. package/src/assets/icons/WalletCheckThinIcon.tsx +24 -0
  26. package/src/assets/icons/WarningIcon.tsx +8 -5
  27. package/src/assets/icons/index.ts +11 -0
  28. package/src/components/Modal/index.tsx +14 -9
  29. package/src/components/PoweredBy/index.tsx +6 -8
  30. package/src/components/Swap/Header/index.tsx +2 -4
  31. package/src/components/Swap/HistoryView/ActivityCard/index.tsx +110 -115
  32. package/src/components/Swap/HistoryView/index.tsx +10 -7
  33. package/src/components/Swap/PickerView/index.tsx +151 -0
  34. package/src/components/Swap/ReorderButton/ReorderButton.tsx +4 -4
  35. package/src/components/Swap/SettingsView/Delivery/index.tsx +19 -17
  36. package/src/components/Swap/SettingsView/InfiniteApproval/index.tsx +19 -17
  37. package/src/components/Swap/SettingsView/Slippage/index.tsx +55 -49
  38. package/src/components/Swap/SwapView/ConfirmationView/TokenTiles/index.tsx +69 -0
  39. package/src/components/Swap/SwapView/ConfirmationView/TxOverview/Header/index.tsx +13 -25
  40. package/src/components/Swap/SwapView/ConfirmationView/TxOverview/Steps/index.tsx +65 -113
  41. package/src/components/Swap/SwapView/ConfirmationView/TxOverview/index.tsx +68 -26
  42. package/src/components/Swap/SwapView/ConfirmationView/TxResult/index.tsx +51 -74
  43. package/src/components/Swap/SwapView/FeesPanel/DeliveryInfo/index.tsx +1 -1
  44. package/src/components/Swap/SwapView/FeesPanel/index.tsx +5 -5
  45. package/src/components/Swap/SwapView/SwapButton/index.tsx +2 -31
  46. package/src/components/Swap/SwapView/SwapPanel/AmountPanel/Balance/index.tsx +2 -2
  47. package/src/components/Swap/SwapView/SwapPanel/AmountPanel/index.tsx +2 -2
  48. package/src/components/Swap/SwapView/SwapPanel/TokenPanel/ChainPicker/index.tsx +143 -0
  49. package/src/components/Swap/SwapView/SwapPanel/TokenPanel/TokenPicker/NetworkFilter/index.tsx +19 -16
  50. package/src/components/Swap/SwapView/SwapPanel/TokenPanel/TokenPicker/TokenItem/index.tsx +11 -4
  51. package/src/components/Swap/SwapView/SwapPanel/TokenPanel/TokenPicker/index.tsx +185 -105
  52. package/src/components/Swap/SwapView/SwapPanel/TokenPanel/index.tsx +54 -120
  53. package/src/components/Swap/SwapView/SwapPanel/UsdValue/index.tsx +2 -2
  54. package/src/components/Swap/SwapView/SwapPanel/WalletPanel/index.tsx +10 -16
  55. package/src/components/Swap/SwapView/SwapPanel/index.tsx +4 -4
  56. package/src/components/Swap/SwapView/WalletPicker/index.tsx +131 -139
  57. package/src/components/Swap/SwapView/index.tsx +11 -7
  58. package/src/components/Swap/WalletPickerView/index.tsx +65 -0
  59. package/src/components/Swap/index.tsx +39 -8
  60. package/src/components/ToggleButton/index.tsx +5 -7
  61. package/src/components/TokenLogo/index.tsx +1 -1
  62. package/src/components/TxConfigForm/index.tsx +2 -2
  63. package/src/components/TxModal/index.tsx +14 -4
  64. package/src/components/global.css +18 -1
  65. package/src/constants/index.ts +4 -0
  66. package/src/context/HistoryProvider.tsx +1 -1
  67. package/src/context/SwapProvider.tsx +193 -81
  68. package/src/context/TxUIWrapper.tsx +3 -3
  69. package/src/hooks/useEvmContractApi.ts +28 -4
  70. package/src/models/payloads/GetBalancesPayload.ts +1 -0
  71. package/src/services/api.ts +37 -0
  72. package/src/utils/index.ts +27 -1
  73. package/src/utils/tokens.ts +20 -1
  74. package/src/utils/validation.ts +9 -4
  75. package/tailwind.config.js +4 -1
  76. package/src/components/Swap/SwapView/ConfirmationView/TxOverview/ArrowIcon.tsx +0 -13
  77. package/src/components/Swap/SwapView/ConfirmationView/TxOverview/SwapPanel/index.tsx +0 -72
  78. package/src/components/Swap/SwapView/ConfirmationView/TxResult/TokenItem/index.tsx +0 -25
@@ -1,14 +1,9 @@
1
1
  import {
2
- faArrowUpRightFromSquare,
3
- faChevronRight,
4
- } from "@fortawesome/free-solid-svg-icons";
5
- import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
6
- import {
7
- Spinner,
8
- Timer,
9
- TimerDisplayFormat,
10
- TokenLogo,
11
- } from "@src/components";
2
+ ChevronDownThinSmallIcon,
3
+ LinkExternalThinIcon,
4
+ LoadingRingIcon,
5
+ } from "@src/assets/icons";
6
+ import { Timer, TimerDisplayFormat, TokenLogoWithChain } from "@src/components";
12
7
  import { CCIP_EXPLORER } from "@src/constants";
13
8
  import { useSwapContext } from "@src/context";
14
9
  import { useWallet } from "@src/context/WalletProvider";
@@ -54,16 +49,12 @@ export const ActivityCard = ({ transaction }: Props) => {
54
49
  (chain) => chain.chainId === transaction.targetChainId,
55
50
  );
56
51
 
57
- const date = format(
58
- new Date(transaction.timestamp * 1000),
59
- "dd.MM.yyyy · hh.mmaa",
60
- );
52
+ const txDate = new Date(transaction.timestamp * 1000);
53
+ const date = format(txDate, "dd.MM.yyyy");
54
+ const time = format(txDate, "hh.mmaa");
61
55
 
62
56
  const receivedToken = dstToken || srcToken;
63
57
 
64
- const amountToken =
65
- transaction.tokenOutAmount && dstToken ? dstToken : srcToken;
66
-
67
58
  const amount = useMemo(() => {
68
59
  if (transaction.tokenOutAmount && dstToken) {
69
60
  return weiToHumanReadable({
@@ -98,112 +89,116 @@ export const ActivityCard = ({ transaction }: Props) => {
98
89
  )?.transactionExplorer
99
90
  }/${transaction.hash}`;
100
91
 
92
+ const destinationChain = dstChain || srcChain;
93
+
101
94
  return (
102
- <div className="flex flex-col gap-px pb-2">
103
- <div className="flex items-center justify-between gap-2 px-4 py-2 rounded-t-xl bg-t_bg_tertiary bg-opacity-5">
104
- <p className="text-xs leading-[18px] tracking-[0.01em] text-t_text_primary text-opacity-50 whitespace-nowrap">
105
- {date}
106
- </p>
107
- <div className="flex items-center gap-2">
108
- {transaction.status === "IN_PROGRESS" ? (
109
- <div className="flex items-center gap-1.5 px-2 py-1 rounded-md bg-t_warning_dark bg-opacity-10 text-t_text_orange">
110
- <Spinner className="w-3 h-3" />
111
- <p className="text-xs leading-[18px] whitespace-nowrap">
112
- {`Est. Time `}
113
- <Timer
114
- displayFormat={TimerDisplayFormat.Minutes}
115
- expiryTimestamp={
116
- new Date(transaction.estimatedDeliveryTimestamp)
117
- }
118
- customTextOnExpire="finalizing"
119
- />
120
- </p>
121
- </div>
122
- ) : transaction.status === "DONE" ? (
123
- <p className="text-xs leading-[18px] text-t_text_green px-2 py-1">
124
- Done
125
- </p>
126
- ) : transaction.status === "REVERTED" ? (
127
- <p className="text-xs leading-[18px] text-t_text_red px-2 py-1">
128
- Reverted
129
- </p>
130
- ) : null}
131
- <a
132
- href={explorerUrl}
133
- target="_blank"
134
- rel="noreferrer"
135
- className="flex items-center justify-center w-6 h-6 rounded-md bg-t_bg_tertiary bg-opacity-5 no-underline text-t_text_primary hover:bg-opacity-10 transition-colors"
136
- aria-label="Show the transaction in the chain explorer"
137
- >
138
- <FontAwesomeIcon
139
- icon={faArrowUpRightFromSquare}
140
- className="w-3 h-3 opacity-70"
141
- />
142
- </a>
95
+ <div className="pb-2">
96
+ <div className="flex flex-col gap-4 p-4 rounded-2xl bg-t_bg_tertiary bg-opacity-[0.03]">
97
+ <div className="flex items-center justify-between gap-2">
98
+ <div className="flex items-center gap-2 px-3 py-2 rounded-md bg-t_bg_tertiary bg-opacity-[0.03]">
99
+ <span className="text-xs leading-[18px] tracking-[0.01em] text-t_text_primary text-opacity-50 whitespace-nowrap">
100
+ {date}
101
+ </span>
102
+ <span className="w-0.5 h-0.5 shrink-0 bg-t_text_primary opacity-25" />
103
+ <span className="text-xs leading-[18px] tracking-[0.01em] text-t_text_primary text-opacity-50 whitespace-nowrap">
104
+ {time}
105
+ </span>
106
+ </div>
107
+ <div className="flex items-center gap-2">
108
+ {transaction.status === "IN_PROGRESS" ? (
109
+ <div className="flex items-center gap-2 px-3 py-2 rounded-md bg-t_text_orange bg-opacity-[0.07] text-t_text_orange">
110
+ <LoadingRingIcon className="w-4 h-4 shrink-0 animate-spin" />
111
+ <p className="text-xs leading-[18px] whitespace-nowrap">
112
+ {`Est. Time `}
113
+ <Timer
114
+ displayFormat={TimerDisplayFormat.Minutes}
115
+ expiryTimestamp={
116
+ new Date(transaction.estimatedDeliveryTimestamp)
117
+ }
118
+ customTextOnExpire="- finalizing"
119
+ />
120
+ </p>
121
+ </div>
122
+ ) : transaction.status === "DONE" ? (
123
+ <div className="flex items-center px-3 py-2 rounded-md bg-t_text_green bg-opacity-5">
124
+ <p className="text-xs leading-[18px] whitespace-nowrap text-t_text_green text-opacity-80">
125
+ Done
126
+ </p>
127
+ </div>
128
+ ) : transaction.status === "REVERTED" ? (
129
+ <div className="flex items-center px-3 py-2 rounded-md bg-t_bg_tertiary bg-opacity-[0.03]">
130
+ <p className="text-xs leading-[18px] whitespace-nowrap text-t_text_primary text-opacity-50">
131
+ Reverted
132
+ </p>
133
+ </div>
134
+ ) : null}
135
+ <a
136
+ href={explorerUrl}
137
+ target="_blank"
138
+ rel="noreferrer"
139
+ className="flex items-center justify-center w-[34px] h-[34px] shrink-0 rounded-md bg-t_bg_tertiary bg-opacity-5 no-underline text-t_text_primary hover:bg-opacity-10 transition-colors"
140
+ aria-label="Show the transaction in the chain explorer"
141
+ >
142
+ <LinkExternalThinIcon className="w-3 h-3 opacity-50" />
143
+ </a>
144
+ </div>
143
145
  </div>
144
- </div>
145
- <div className="flex items-center gap-3 px-4 py-3 rounded-b-xl bg-t_bg_tertiary bg-opacity-[0.03]">
146
- <div className="flex items-center shrink-0">
147
- {dstToken && (
148
- <div className="flex items-end -mr-2">
149
- <TokenLogo
150
- token={srcToken}
151
- className="min-w-[38px] w-[38px] h-[38px] -mr-2.5"
152
- generatedLogoClassName="min-w-[38px] w-[38px] h-[38px] text-[15px] -mr-2.5"
153
- />
154
- {srcChain && (
155
- <img
156
- src={srcChain.image}
157
- alt={srcChain.name}
158
- className="w-4 h-4 shrink-0 border border-solid border-t_bg_secondary rounded-full"
146
+ <div className="flex items-center gap-3">
147
+ <div className="flex items-center shrink-0">
148
+ {dstToken && (
149
+ <div className="-mr-2">
150
+ <TokenLogoWithChain
151
+ token={srcToken}
152
+ chain={srcChain}
153
+ tokenLogoClassName="min-w-10 w-10 h-10 border border-solid border-t_bg_secondary"
154
+ generatedLogoClassName="min-w-10 w-10 h-10 text-[16px] border border-solid border-t_bg_secondary"
155
+ chainLogoClassName="w-[18px]"
159
156
  />
160
- )}
161
- </div>
162
- )}
163
- <div className="flex items-end">
164
- <TokenLogo
157
+ </div>
158
+ )}
159
+ <TokenLogoWithChain
165
160
  token={receivedToken}
166
- className="min-w-[38px] w-[38px] h-[38px] -mr-2.5"
167
- generatedLogoClassName="min-w-[38px] w-[38px] h-[38px] text-[15px] -mr-2.5"
161
+ chain={dstChain}
162
+ tokenLogoClassName="min-w-10 w-10 h-10 border border-solid border-t_bg_secondary"
163
+ generatedLogoClassName="min-w-10 w-10 h-10 text-[16px] border border-solid border-t_bg_secondary"
164
+ chainLogoClassName="w-[18px]"
168
165
  />
169
- {dstChain && (
170
- <img
171
- src={dstChain.image}
172
- alt={dstChain.name}
173
- className="w-4 h-4 shrink-0 border border-solid border-t_bg_secondary rounded-full"
174
- />
175
- )}
176
166
  </div>
177
- </div>
178
- <div className="flex justify-between items-center gap-2 w-full min-w-0">
179
- <div className="text-left min-w-0">
180
- <div className="flex items-center gap-1.5 text-sm font-medium leading-5 tracking-[0.01em] text-t_text_primary">
181
- <span>{srcToken?.symbol || "?"}</span>
182
- {dstToken && (
183
- <>
184
- <FontAwesomeIcon
185
- icon={faChevronRight}
186
- className="w-2.5 h-2.5 opacity-50"
187
- />
188
- <span>{dstToken.symbol}</span>
189
- </>
190
- )}
191
- </div>
192
- <div className="flex gap-2 items-center text-xs leading-[18px] tracking-[0.01em] text-t_text_primary text-opacity-50">
193
- <span className="whitespace-nowrap truncate">
194
- {`Receiver ${receiverAddress ? shortAddress(receiverAddress) : "-"}`}
195
- </span>
196
- </div>
197
- </div>
198
- <div className="text-right shrink-0">
199
- <div className="text-sm font-medium leading-5 tracking-[0.01em] text-t_text_primary">
200
- {amountToken ? `${amount} ${amountToken.symbol}` : amount}
167
+ <div className="flex justify-between items-center gap-2 w-full min-w-0">
168
+ <div className="flex flex-col gap-0.5 text-left min-w-0">
169
+ <div className="flex items-center gap-2 text-sm font-medium leading-5 tracking-[0.01em] text-t_text_primary">
170
+ <span>{srcToken?.symbol || "?"}</span>
171
+ {dstToken && (
172
+ <>
173
+ <ChevronDownThinSmallIcon className="w-4 h-4 shrink-0 -rotate-90 opacity-50" />
174
+ <span className="truncate">{dstToken.symbol}</span>
175
+ </>
176
+ )}
177
+ </div>
178
+ <div className="flex items-center gap-2 text-xs leading-[18px] tracking-[0.01em] text-t_text_primary text-opacity-50 min-w-0">
179
+ {destinationChain && (
180
+ <>
181
+ <span className="whitespace-nowrap truncate">
182
+ {`Destination ${destinationChain.displayName || destinationChain.name}`}
183
+ </span>
184
+ <span className="w-0.5 h-0.5 shrink-0 bg-t_text_primary opacity-25" />
185
+ </>
186
+ )}
187
+ <span className="whitespace-nowrap">
188
+ {receiverAddress ? shortAddress(receiverAddress) : "-"}
189
+ </span>
190
+ </div>
201
191
  </div>
202
- {amountUsd && (
203
- <div className="text-xs leading-[18px] tracking-[0.01em] text-t_text_primary text-opacity-50">
204
- {`${amountUsd} USD`}
192
+ <div className="flex flex-col gap-0.5 text-right shrink-0">
193
+ <div className="text-sm font-medium leading-5 tracking-[0.01em] text-t_text_primary">
194
+ {amount}
205
195
  </div>
206
- )}
196
+ {amountUsd && (
197
+ <div className="text-xs leading-[18px] tracking-[0.01em] text-t_text_primary text-opacity-50">
198
+ {`${amountUsd} USD`}
199
+ </div>
200
+ )}
201
+ </div>
207
202
  </div>
208
203
  </div>
209
204
  </div>
@@ -56,13 +56,16 @@ export const HistoryView = () => {
56
56
  }
57
57
 
58
58
  return (
59
- <Virtuoso
60
- data={unifiedHistory}
61
- style={{ height: "424px" }}
62
- itemContent={(_, transaction) => {
63
- return <ActivityCard transaction={transaction} />;
64
- }}
65
- />
59
+ <div className="relative h-full">
60
+ <Virtuoso
61
+ data={unifiedHistory}
62
+ style={{ height: "100%" }}
63
+ itemContent={(_, transaction) => {
64
+ return <ActivityCard transaction={transaction} />;
65
+ }}
66
+ />
67
+ <div className="pointer-events-none absolute bottom-0 inset-x-0 h-16 bg-gradient-to-t from-t_bg_primary/[0.65] to-transparent" />
68
+ </div>
66
69
  );
67
70
  }, [
68
71
  historyLoadedOnce,
@@ -0,0 +1,151 @@
1
+ import { useSwapContext } from "@src/context";
2
+ import { Chain, TokenOption } from "@src/models";
3
+ import {
4
+ isBridgeTokenConnectionSupported,
5
+ isChainConnectionSupported,
6
+ } from "@src/utils";
7
+ import { ChainPicker } from "../SwapView/SwapPanel/TokenPanel/ChainPicker";
8
+ import { TokenPicker } from "../SwapView/SwapPanel/TokenPanel/TokenPicker";
9
+
10
+ /**
11
+ * Token/network picker rendered while `activePicker` is set:
12
+ * - sm and up it replaces the swap view inside the widget container, so it
13
+ * sits on the exact same glass background,
14
+ * - below sm the same element becomes a bottom sheet pinned to the viewport.
15
+ */
16
+ export const PickerView = () => {
17
+ const {
18
+ activePicker,
19
+ setActivePicker,
20
+ bridgeUI,
21
+ srcChain,
22
+ dstChain,
23
+ srcToken,
24
+ dstToken,
25
+ srcChainTokensOptions,
26
+ srcChainOtherTokensOptions,
27
+ dstChainTokensOptions,
28
+ dstChainOtherTokensOptions,
29
+ setSrcToken,
30
+ setSrcChain,
31
+ setDstToken,
32
+ setDstChain,
33
+ supportedChains,
34
+ dstChainOptions,
35
+ bridgeTokensDictionary,
36
+ } = useSwapContext();
37
+
38
+ const type = activePicker ?? "source";
39
+ // In bridge mode the destination token is derived from the source token,
40
+ // so the destination side picks a chain instead of a token.
41
+ const bridgeDestination = bridgeUI && type === "destination";
42
+ const chain = type === "source" ? srcChain : dstChain;
43
+ const token = type === "source" ? srcToken : dstToken;
44
+ const tokens =
45
+ type === "source" ? srcChainTokensOptions : dstChainTokensOptions;
46
+ const otherTokens =
47
+ type === "source" ? srcChainOtherTokensOptions : dstChainOtherTokensOptions;
48
+
49
+ const close = () => setActivePicker(null);
50
+
51
+ const onTokenSelect = (token: TokenOption) => {
52
+ const newChain = supportedChains.find(
53
+ (chain) => chain.chainId === token.chainId,
54
+ );
55
+
56
+ if (type === "source") {
57
+ setSrcToken(token);
58
+ setSrcChain(newChain);
59
+ // The new source token cannot reach the current destination —
60
+ // reset the destination so the user picks a reachable one.
61
+ if (
62
+ dstChain &&
63
+ (!isChainConnectionSupported(newChain, dstChain.chainId, bridgeUI) ||
64
+ (bridgeUI &&
65
+ !isBridgeTokenConnectionSupported({
66
+ token,
67
+ tokenChain: newChain,
68
+ dstChainId: dstChain.chainId,
69
+ bridgeTokensDictionary,
70
+ })))
71
+ ) {
72
+ setDstChain(undefined);
73
+ setDstToken(undefined);
74
+ }
75
+ } else {
76
+ setDstToken(token);
77
+ setDstChain(newChain);
78
+ // The current source cannot reach the new destination chain —
79
+ // reset the source so the user picks a reachable one.
80
+ if (
81
+ srcChain &&
82
+ newChain &&
83
+ !isChainConnectionSupported(srcChain, newChain.chainId, bridgeUI)
84
+ ) {
85
+ setSrcChain(undefined);
86
+ setSrcToken(undefined);
87
+ }
88
+ }
89
+ close();
90
+ };
91
+
92
+ const onDstChainSelect = (newChain: Chain & { disabled?: boolean }) => {
93
+ // The current source cannot reach the new destination chain —
94
+ // reset the source so the user picks a reachable one.
95
+ if (newChain.disabled || newChain.chainId === srcChain?.chainId) {
96
+ setSrcChain(undefined);
97
+ setSrcToken(undefined);
98
+ }
99
+ setDstChain(newChain);
100
+ // The destination token gets derived from the source token and the
101
+ // new chain by the SwapProvider validation effect.
102
+ setDstToken(undefined);
103
+ close();
104
+ };
105
+
106
+ if (!activePicker) {
107
+ return null;
108
+ }
109
+
110
+ return (
111
+ <div
112
+ className="fixed top-0 left-0 right-0 bottom-0 z-10 flex flex-col justify-end bg-[rgba(2,2,2,0.8)] sm:absolute sm:z-[1] sm:justify-start sm:bg-transparent"
113
+ onMouseDown={(e) => {
114
+ if (e.target === e.currentTarget) {
115
+ e.stopPropagation();
116
+ e.nativeEvent.stopImmediatePropagation();
117
+ e.preventDefault();
118
+ close();
119
+ }
120
+ }}
121
+ >
122
+ <div className="flex flex-col w-full h-[85vh] max-h-full overflow-hidden p-4 pt-2.5 rounded-t-[24px] border-t border-solid border-t_text_primary border-opacity-10 bg-gradient-to-r from-t_bg_secondary/50 to-t_bg_secondary/50 bg-t_bg_primary sm:h-full sm:p-0 sm:rounded-none sm:border-0 sm:bg-none sm:bg-transparent">
123
+ <div className="sm:hidden mx-auto mb-4 h-1 w-8 rounded-full bg-t_bg_tertiary bg-opacity-10 shrink-0" />
124
+ {bridgeDestination ? (
125
+ <ChainPicker
126
+ chains={dstChainOptions}
127
+ selectedChainId={dstChain?.chainId}
128
+ sameChainId={srcChain?.chainId}
129
+ onSelect={onDstChainSelect}
130
+ onClose={close}
131
+ />
132
+ ) : (
133
+ <TokenPicker
134
+ type={type}
135
+ chain={chain}
136
+ tokens={tokens}
137
+ otherTokens={otherTokens}
138
+ selectedTokenAddress={token?.address}
139
+ onSelect={onTokenSelect}
140
+ isOpen
141
+ setModalOpen={(open) => {
142
+ if (!open) {
143
+ close();
144
+ }
145
+ }}
146
+ />
147
+ )}
148
+ </div>
149
+ </div>
150
+ );
151
+ };
@@ -1,4 +1,4 @@
1
- import { CaretsUpDownIcon } from "@src/assets/icons";
1
+ import { ChevronsUpDownThinIcon } from "@src/assets/icons";
2
2
  import { useSwapContext } from "@src/context";
3
3
  import { FC } from "react";
4
4
 
@@ -26,10 +26,10 @@ export const ReorderButton: FC = () => {
26
26
  <button
27
27
  onClick={onReorderClick}
28
28
  aria-label="Switch target token with the source token"
29
- className="absolute left-1/2 -translate-x-1/2 -translate-y-1/2 flex items-center justify-center w-8 h-8 rounded-md bg-t_bg_secondary border border-solid border-t_text_primary border-opacity-10 hover:border-opacity-25 transition-colors"
29
+ className="absolute left-1/2 -translate-x-1/2 -translate-y-1/2 flex items-center justify-center w-8 h-8 rounded-md backdrop-blur-[24px] bg-t_bg_secondary bg-opacity-50 bg-gradient-to-r from-t_bg_tertiary/5 to-t_bg_tertiary/5 hover:from-t_bg_tertiary/10 hover:to-t_bg_tertiary/10 transition-colors"
30
30
  >
31
- <div className="flex fill-t_text_primary opacity-75 [&_svg]:w-2.5 [&_svg]:h-4">
32
- <CaretsUpDownIcon />
31
+ <div className="flex text-t_text_primary opacity-50">
32
+ <ChevronsUpDownThinIcon />
33
33
  </div>
34
34
  </button>
35
35
  </div>
@@ -8,27 +8,29 @@ export const Delivery = () => {
8
8
  const { expressDelivery, setExpressDelivery } = useSwapContext();
9
9
 
10
10
  return (
11
- <div className="flex gap-2 items-center justify-between p-4 rounded-xl bg-gradient-to-r from-t_bg_tertiary/[0.02] to-t_bg_tertiary/[0.01]">
12
- <div className="flex items-center gap-3 min-w-0">
11
+ <div className="flex gap-2 items-center justify-between py-4 px-6 rounded-xl bg-gradient-to-r from-t_bg_tertiary/[0.03] to-t_bg_tertiary/[0.01]">
12
+ <div className="flex items-center gap-2 min-w-0">
13
13
  <h2 className="text-sm leading-6 tracking-[0.01em] text-t_text_primary whitespace-nowrap">
14
14
  Fast Delivery
15
15
  </h2>
16
16
  <div className="w-0.5 h-0.5 bg-t_text_primary opacity-25 shrink-0" />
17
- <p className="text-sm leading-6 tracking-[0.01em] text-t_text_primary text-opacity-50 whitespace-nowrap truncate">
18
- {expressDelivery ? "Max. Time 30 Sec." : "Max. Time 30 Min."}
19
- </p>
20
- <Tooltip
21
- text={
22
- "Fast Delivery is a special feature of XSwap that reduces transaction time across chains to around 30 seconds. It is currently available for swaps below a value of $1000 USD."
23
- }
24
- position="BOTTOM"
25
- triggerRef={tooltipTriggerRef}
26
- id="express-delivery-tooltip"
27
- />
28
- <HelpIcon
29
- ref={tooltipTriggerRef}
30
- className="cursor-help fill-t_text_primary opacity-30 w-4 h-4 shrink-0"
31
- />
17
+ <div className="flex items-center gap-1.5 min-w-0">
18
+ <p className="text-sm leading-6 tracking-[0.01em] text-t_text_primary text-opacity-50 whitespace-nowrap truncate">
19
+ {expressDelivery ? "Est. Time 30 Sec." : "Est. Time 30 Min."}
20
+ </p>
21
+ <Tooltip
22
+ text={
23
+ "Fast Delivery is a special feature of XSwap that reduces transaction time across chains to around 30 seconds. It is currently available for swaps below a value of $1000 USD."
24
+ }
25
+ position="BOTTOM"
26
+ triggerRef={tooltipTriggerRef}
27
+ id="express-delivery-tooltip"
28
+ />
29
+ <HelpIcon
30
+ ref={tooltipTriggerRef}
31
+ className="cursor-help fill-t_text_primary opacity-30 w-4 h-4 shrink-0"
32
+ />
33
+ </div>
32
34
  </div>
33
35
  <ToggleButton
34
36
  checked={expressDelivery}
@@ -9,27 +9,29 @@ export const InfiniteApproval = () => {
9
9
  const { infiniteApproval, setInfiniteApproval } = useSwapContext();
10
10
 
11
11
  return (
12
- <div className="flex gap-2 items-center justify-between p-4 rounded-xl bg-gradient-to-r from-t_bg_tertiary/[0.02] to-t_bg_tertiary/[0.01]">
13
- <div className="flex items-center gap-3 min-w-0">
12
+ <div className="flex gap-2 items-center justify-between py-4 px-6 rounded-xl bg-gradient-to-r from-t_bg_tertiary/[0.03] to-t_bg_tertiary/[0.01]">
13
+ <div className="flex items-center gap-2 min-w-0">
14
14
  <h2 className="text-sm leading-6 tracking-[0.01em] text-t_text_primary whitespace-nowrap">
15
15
  Persistent Access
16
16
  </h2>
17
17
  <div className="w-0.5 h-0.5 bg-t_text_primary opacity-25 shrink-0" />
18
- <p className="text-sm leading-6 tracking-[0.01em] text-t_text_primary text-opacity-50 whitespace-nowrap truncate">
19
- Don't Ask Every Tx.
20
- </p>
21
- <Tooltip
22
- text={
23
- "Enabling persistent access (infinite approval) allows to access your tokens without requiring repeated approvals for each transaction. This streamlines multiple transactions but may pose a security risk if the spender's address is compromised."
24
- }
25
- position="BOTTOM"
26
- triggerRef={tooltipTriggerRef}
27
- id="infinite-approval-tooltip"
28
- />
29
- <HelpIcon
30
- ref={tooltipTriggerRef}
31
- className="cursor-help fill-t_text_primary opacity-30 w-4 h-4 shrink-0"
32
- />
18
+ <div className="flex items-center gap-1.5 min-w-0">
19
+ <p className="text-sm leading-6 tracking-[0.01em] text-t_text_primary text-opacity-50 whitespace-nowrap truncate">
20
+ Don't Ask Every Tx.
21
+ </p>
22
+ <Tooltip
23
+ text={
24
+ "Enabling persistent access (infinite approval) allows to access your tokens without requiring repeated approvals for each transaction. This streamlines multiple transactions but may pose a security risk if the spender's address is compromised."
25
+ }
26
+ position="BOTTOM"
27
+ triggerRef={tooltipTriggerRef}
28
+ id="infinite-approval-tooltip"
29
+ />
30
+ <HelpIcon
31
+ ref={tooltipTriggerRef}
32
+ className="cursor-help fill-t_text_primary opacity-30 w-4 h-4 shrink-0"
33
+ />
34
+ </div>
33
35
  </div>
34
36
  <ToggleButton
35
37
  checked={infiniteApproval}