@xswap-link/sdk 0.2.5 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/main.yml +2 -2
- package/.github/workflows/publish.yml +2 -2
- package/CHANGELOG.md +12 -0
- package/dist/index.css +325 -257
- package/dist/index.d.mts +4 -2
- package/dist/index.d.ts +4 -2
- package/dist/index.js +1296 -516
- package/dist/index.mjs +1323 -537
- package/package.json +1 -1
- package/src/components/Alert/index.tsx +1 -1
- package/src/components/Skeleton/index.tsx +3 -1
- package/src/components/Spinner/index.tsx +28 -0
- package/src/components/TxConfigForm/BalanceComponent.tsx +1 -1
- package/src/components/TxConfigForm/Button.tsx +1 -1
- package/src/components/TxConfigForm/ChainListElement.tsx +2 -2
- package/src/components/TxConfigForm/ConfirmationAmount.tsx +91 -0
- package/src/components/TxConfigForm/Description.tsx +5 -3
- package/src/components/TxConfigForm/ErrorField.tsx +4 -2
- package/src/components/TxConfigForm/FeesDetails.tsx +25 -31
- package/src/components/TxConfigForm/Form.tsx +763 -118
- package/src/components/TxConfigForm/History.tsx +5 -5
- package/src/components/TxConfigForm/HistoryCard.tsx +33 -40
- package/src/components/TxConfigForm/PoweredBy.tsx +2 -2
- package/src/components/TxConfigForm/Settings.tsx +33 -27
- package/src/components/TxConfigForm/Summary.tsx +33 -31
- package/src/components/TxConfigForm/SwapPanel.tsx +12 -15
- package/src/components/TxConfigForm/TokenPicker.tsx +36 -34
- package/src/components/TxConfigForm/TopBar.tsx +8 -8
- package/src/components/TxConfigForm/UsdPrice.tsx +4 -14
- package/src/components/TxConfigForm/index.tsx +37 -10
- package/src/components/TxStatusButton/index.tsx +42 -28
- package/src/components/UnknownTokenLogo/UnknownTokenLogo.tsx +1 -1
- package/src/components/global.css +7 -5
- package/src/components/icons/CircularProgressIcon.tsx +1 -1
- package/src/components/icons/ErrorIcon.tsx +32 -0
- package/src/components/icons/SignIcon.tsx +17 -0
- package/src/components/icons/SuccessIcon.tsx +29 -0
- package/src/components/icons/index.ts +3 -0
- package/src/config/init.tsx +42 -24
- package/src/constants/index.ts +2 -2
- package/src/models/payloads/GetSwapTxPayload.ts +2 -0
- package/src/services/integrations/monitoring.ts +10 -3
- package/src/services/integrations/transactions.ts +9 -3
- package/src/utils/contracts.ts +18 -0
- package/src/utils/index.ts +1 -0
- package/src/utils/parseWeb3Error.ts +93 -0
- package/tailwind.config.js +40 -0
|
@@ -100,21 +100,21 @@ export const History: FC<Props> = ({ signer, supportedChains }) => {
|
|
|
100
100
|
|
|
101
101
|
if (!signer)
|
|
102
102
|
return (
|
|
103
|
-
<div className="flex items-center justify-center w-full h-[30vh]">
|
|
103
|
+
<div className="xpay-flex xpay-items-center xpay-justify-center xpay-w-full xpay-h-[30vh]">
|
|
104
104
|
Connect a wallet to browse history
|
|
105
105
|
</div>
|
|
106
106
|
);
|
|
107
107
|
|
|
108
108
|
return (
|
|
109
|
-
<div className="flex items-center justify-center w-full">
|
|
110
|
-
<div className="w-full h-96 overflow-scroll overflow-x-hidden">
|
|
109
|
+
<div className="xpay-flex xpay-items-center xpay-justify-center xpay-w-full">
|
|
110
|
+
<div className="xpay-w-full xpay-h-96 xpay-overflow-scroll xpay-overflow-x-hidden">
|
|
111
111
|
{fetchedHistory?.length === 0 && historyLoadedOnce && (
|
|
112
|
-
<div className="w-full text-center py-4 px-0 text-[rgb(158,158,158)]">
|
|
112
|
+
<div className="xpay-w-full xpay-text-center xpay-py-4 xpay-px-0 xpay-text-[rgb(158,158,158)]">
|
|
113
113
|
Your history is empty...
|
|
114
114
|
</div>
|
|
115
115
|
)}
|
|
116
116
|
{!fetchedHistory && !historyLoadedOnce && (
|
|
117
|
-
<div className="flex w-full h-full items-center justify-center">
|
|
117
|
+
<div className="xpay-flex xpay-w-full xpay-h-full xpay-items-center xpay-justify-center">
|
|
118
118
|
<CircularProgressIcon />
|
|
119
119
|
</div>
|
|
120
120
|
)}
|
|
@@ -1,14 +1,7 @@
|
|
|
1
1
|
import { FC, useCallback, useMemo } from "react";
|
|
2
|
-
import { getDate } from "@src/utils";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
ArrowRightIcon,
|
|
7
|
-
ArrowUpRightIcon,
|
|
8
|
-
CheckIcon,
|
|
9
|
-
HourGlassIcon,
|
|
10
|
-
XMarkIcon,
|
|
11
|
-
} from "@src/components/icons";
|
|
2
|
+
import { deepMergeObjects, getDate, weiToHumanReadable } from "@src/utils";
|
|
3
|
+
import { Chain, Token, Transaction } from "@src/models";
|
|
4
|
+
import { ArrowRightIcon, ArrowUpRightIcon } from "@src/components/icons";
|
|
12
5
|
import { MINIMUM_DISPLAYED_TOKEN_AMOUNT } from "@src/constants";
|
|
13
6
|
|
|
14
7
|
interface Props {
|
|
@@ -75,25 +68,25 @@ export const HistoryCard: FC<Props> = ({ transaction, supportedChains }) => {
|
|
|
75
68
|
);
|
|
76
69
|
|
|
77
70
|
return (
|
|
78
|
-
<div className="flex flex-col
|
|
79
|
-
<div className="flex w-full items-center justify-between">
|
|
80
|
-
<div className="text-sm sm:text-base">{date}</div>
|
|
81
|
-
<div className="flex items-center">
|
|
71
|
+
<div className="xpay-flex xpay-flex-col xpay-global-border xpay-rounded-xl xpay-bg-[rgb(15,15,15)] xpay-text-white xpay-text-xs sm:xpay-text-sm xpay-p-4 xpay-gap-3 xpay-mb-2">
|
|
72
|
+
<div className="xpay-flex xpay-w-full xpay-items-center xpay-justify-between">
|
|
73
|
+
<div className="xpay-text-sm sm:xpay-text-base">{date}</div>
|
|
74
|
+
<div className="xpay-flex xpay-items-center">
|
|
82
75
|
{transaction.status === "IN_PROGRESS" && (
|
|
83
|
-
<div className="flex items-center">
|
|
84
|
-
<div className="text-[rgb(250,200,100)]">In progress</div>
|
|
76
|
+
<div className="xpay-flex xpay-items-center">
|
|
77
|
+
<div className="xpay-text-[rgb(250,200,100)]">In progress</div>
|
|
85
78
|
</div>
|
|
86
79
|
)}
|
|
87
80
|
|
|
88
81
|
{transaction.status === "DONE" && (
|
|
89
|
-
<div className="flex items-center">
|
|
90
|
-
<div className="text-[rgb(100,200,100)]">Done</div>
|
|
82
|
+
<div className="xpay-flex xpay-items-center">
|
|
83
|
+
<div className="xpay-text-[rgb(100,200,100)]">Done</div>
|
|
91
84
|
</div>
|
|
92
85
|
)}
|
|
93
86
|
|
|
94
87
|
{transaction.status === "REVERTED" && (
|
|
95
|
-
<div className="flex items-center">
|
|
96
|
-
<div className="text-[rgb(255,100,100)]">Reverted</div>
|
|
88
|
+
<div className="xpay-flex xpay-items-center">
|
|
89
|
+
<div className="xpay-text-[rgb(255,100,100)]">Reverted</div>
|
|
97
90
|
</div>
|
|
98
91
|
)}
|
|
99
92
|
|
|
@@ -105,76 +98,76 @@ export const HistoryCard: FC<Props> = ({ transaction, supportedChains }) => {
|
|
|
105
98
|
}/${transaction.hash}`}
|
|
106
99
|
target="_blank"
|
|
107
100
|
rel="noreferrer"
|
|
108
|
-
className="ml-2 no-underline"
|
|
101
|
+
className="xpay-ml-2 xpay-no-underline visited:xpay-text-white hover:xpay-text-white"
|
|
109
102
|
aria-label="Show the transaction in the chain explorer"
|
|
110
103
|
>
|
|
111
|
-
<div className="w-3.5 h-3.5">
|
|
104
|
+
<div className="xpay-w-3.5 xpay-h-3.5">
|
|
112
105
|
<ArrowUpRightIcon />
|
|
113
106
|
</div>
|
|
114
107
|
</a>
|
|
115
108
|
</div>
|
|
116
109
|
</div>
|
|
117
|
-
<div className="flex justify-between flex-wrap gap-2">
|
|
118
|
-
<div className="flex items-center">
|
|
119
|
-
<div className="flex items-center">
|
|
110
|
+
<div className="xpay-flex xpay-justify-between xpay-flex-wrap xpay-gap-2">
|
|
111
|
+
<div className="xpay-flex xpay-items-center">
|
|
112
|
+
<div className="xpay-flex xpay-items-center">
|
|
120
113
|
<img
|
|
121
114
|
src={sourceChainData?.image}
|
|
122
115
|
alt={`${sourceChainData?.name} logo`}
|
|
123
|
-
className="w-5 h-5 mr-1"
|
|
116
|
+
className="xpay-w-5 xpay-h-5 xpay-mr-1"
|
|
124
117
|
/>
|
|
125
118
|
<div>{sourceChainData?.displayName}</div>
|
|
126
119
|
</div>
|
|
127
120
|
|
|
128
|
-
<div className="w-3.5 h-3.5 my-0 mx-1.5">
|
|
121
|
+
<div className="xpay-w-3.5 xpay-h-3.5 xpay-my-0 xpay-mx-1.5">
|
|
129
122
|
<ArrowRightIcon />
|
|
130
123
|
</div>
|
|
131
124
|
|
|
132
|
-
<div className="flex items-center">
|
|
125
|
+
<div className="xpay-flex xpay-items-center">
|
|
133
126
|
<img
|
|
134
127
|
src={targetChainData?.image}
|
|
135
128
|
alt={`${targetChainData?.name} logo`}
|
|
136
|
-
className="w-5 h-5 mr-1"
|
|
129
|
+
className="xpay-w-5 xpay-h-5 xpay-mr-1"
|
|
137
130
|
/>
|
|
138
131
|
<div>{targetChainData?.displayName}</div>
|
|
139
132
|
</div>
|
|
140
133
|
</div>
|
|
141
134
|
|
|
142
|
-
<div className="flex items-center mb-2 last:mb-0">
|
|
143
|
-
<div className="flex items-center flex-wrap">
|
|
144
|
-
<div className="flex items-center">
|
|
135
|
+
<div className="xpay-flex xpay-items-center xpay-mb-2 last:xpay-mb-0">
|
|
136
|
+
<div className="xpay-flex xpay-items-center xpay-flex-wrap">
|
|
137
|
+
<div className="xpay-flex xpay-items-center">
|
|
145
138
|
{Number(transferredAmount) < MINIMUM_DISPLAYED_TOKEN_AMOUNT
|
|
146
139
|
? `<${MINIMUM_DISPLAYED_TOKEN_AMOUNT}`
|
|
147
140
|
: transferredAmount}
|
|
148
|
-
<div className="ml-1">{tokenData?.symbol}</div>
|
|
141
|
+
<div className="xpay-ml-1">{tokenData?.symbol}</div>
|
|
149
142
|
{tokenData?.image ? (
|
|
150
143
|
<img
|
|
151
144
|
src={tokenData?.image}
|
|
152
145
|
alt={tokenData?.name || ""}
|
|
153
|
-
className="w-5 h-5 ml-1"
|
|
146
|
+
className="xpay-w-5 xpay-h-5 xpay-ml-1"
|
|
154
147
|
/>
|
|
155
148
|
) : (
|
|
156
|
-
<div className="flex items-center justify-center w-5 h-5 text-[10px] ml-1 rounded-full bg-[#272e40] text-[#e0e7fa]">
|
|
149
|
+
<div className="xpay-flex xpay-items-center xpay-justify-center xpay-w-5 xpay-h-5 xpay-text-[10px] xpay-ml-1 xpay-rounded-full xpay-bg-[#272e40] xpay-text-[#e0e7fa]">
|
|
157
150
|
{tokenData?.symbol.substring(0, 1)}
|
|
158
151
|
</div>
|
|
159
152
|
)}
|
|
160
153
|
</div>
|
|
161
154
|
{transaction.tokenOutAddress && (
|
|
162
155
|
<>
|
|
163
|
-
<div className="w-3.5 h-3.5 my-0 mx-1.5">
|
|
156
|
+
<div className="xpay-w-3.5 xpay-h-3.5 xpay-my-0 xpay-mx-1.5">
|
|
164
157
|
<ArrowRightIcon />
|
|
165
158
|
</div>
|
|
166
|
-
<div className="flex items-center">
|
|
159
|
+
<div className="xpay-flex xpay-items-center">
|
|
167
160
|
{Number(receivedAmount) < 0.0001 ? "<0.0001" : receivedAmount}
|
|
168
|
-
<div className="ml-1">{tokenOutData?.symbol}</div>
|
|
161
|
+
<div className="xpay-ml-1">{tokenOutData?.symbol}</div>
|
|
169
162
|
|
|
170
163
|
{tokenOutData?.image ? (
|
|
171
164
|
<img
|
|
172
165
|
src={tokenOutData?.image}
|
|
173
166
|
alt={tokenOutData?.name || ""}
|
|
174
|
-
className="w-5 h-5 ml-1"
|
|
167
|
+
className="xpay-w-5 xpay-h-5 xpay-ml-1"
|
|
175
168
|
/>
|
|
176
169
|
) : (
|
|
177
|
-
<div className="flex items-center justify-center w-5 h-5 text-[10px] ml-1 rounded-full bg-[#272e40] text-[#e0e7fa]">
|
|
170
|
+
<div className="xpay-flex xpay-items-center xpay-justify-center xpay-w-5 xpay-h-5 xpay-text-[10px] xpay-ml-1 xpay-rounded-full xpay-bg-[#272e40] xpay-text-[#e0e7fa]">
|
|
178
171
|
{tokenData?.symbol.substring(0, 1)}
|
|
179
172
|
</div>
|
|
180
173
|
)}
|
|
@@ -2,8 +2,8 @@ import { ChainlinkCCIPIcon, XSwapBadgeIcon } from "@src/components/icons";
|
|
|
2
2
|
|
|
3
3
|
export const PoweredBy = () => {
|
|
4
4
|
return (
|
|
5
|
-
<div className="flex justify-center items-center gap-2 my-3">
|
|
6
|
-
<span className="text-x_grey">Powered by</span>
|
|
5
|
+
<div className="xpay-flex xpay-justify-center xpay-items-center xpay-gap-2 xpay-my-3">
|
|
6
|
+
<span className="xpay-text-x_grey">Powered by</span>
|
|
7
7
|
<XSwapBadgeIcon />
|
|
8
8
|
<span>✕</span>
|
|
9
9
|
<ChainlinkCCIPIcon />
|
|
@@ -30,42 +30,46 @@ export const Settings: FC<Props> = ({
|
|
|
30
30
|
}, [slippageActivePresetIndex, usingSlippageInput]);
|
|
31
31
|
|
|
32
32
|
return (
|
|
33
|
-
<div className="absolute w-[310px] right-0 top-[46px] z-10 bg-black border border-solid border-[rgba(54,129,198,1)] p-4 rounded-xl">
|
|
34
|
-
<div className="flex flex-col gap-4 justify-between">
|
|
35
|
-
<div className="flex justify-between">
|
|
36
|
-
<div className="text-base">Settings</div>
|
|
33
|
+
<div className="xpay-absolute xpay-w-[310px] xpay-right-0 xpay-top-[46px] xpay-z-10 xpay-bg-black xpay-border xpay-border-solid xpay-border-[rgba(54,129,198,1)] xpay-p-4 xpay-rounded-xl">
|
|
34
|
+
<div className="xpay-flex xpay-flex-col xpay-gap-4 xpay-justify-between">
|
|
35
|
+
<div className="xpay-flex xpay-justify-between">
|
|
36
|
+
<div className="xpay-text-base">Settings</div>
|
|
37
37
|
<div
|
|
38
|
-
className="cursor-pointer"
|
|
38
|
+
className="xpay-cursor-pointer"
|
|
39
39
|
onClick={() => setSettingsShown(false)}
|
|
40
40
|
>
|
|
41
41
|
<CloseIcon />
|
|
42
42
|
</div>
|
|
43
43
|
</div>
|
|
44
44
|
<div>
|
|
45
|
-
<div className="flex gap-2 items-center">
|
|
46
|
-
<div className="text-sm text-[rgba(255,255,255,0.6)]">
|
|
45
|
+
<div className="xpay-flex xpay-gap-2 xpay-items-center">
|
|
46
|
+
<div className="xpay-text-sm xpay-text-[rgba(255,255,255,0.6)]">
|
|
47
47
|
Express delivery
|
|
48
48
|
</div>
|
|
49
49
|
<div>
|
|
50
50
|
<span
|
|
51
|
-
className="inline-flex w-14 h-9 p-3 relative align-middle box-border overflow-hidden cursor-pointer"
|
|
51
|
+
className="xpay-inline-flex xpay-w-14 xpay-h-9 xpay-p-3 xpay-relative xpay-align-middle xpay-box-border xpay-overflow-hidden xpay-cursor-pointer"
|
|
52
52
|
onClick={() => {
|
|
53
53
|
setExpressChecked((x) => !x);
|
|
54
54
|
}}
|
|
55
55
|
>
|
|
56
|
-
<span className="h-full, w-full rounded-lg bg-[rgba(255,255,255,0.3)]"></span>
|
|
56
|
+
<span className="xpay-h-full, xpay-w-full xpay-rounded-lg xpay-bg-[rgba(255,255,255,0.3)]"></span>
|
|
57
57
|
<span
|
|
58
|
-
className={`transition-all w-5 h-5 rounded-full absolute translate-y-[-4px]
|
|
59
|
-
${
|
|
58
|
+
className={`xpay-transition-all xpay-w-5 xpay-h-5 xpay-rounded-full xpay-absolute xpay-translate-y-[-4px]
|
|
59
|
+
${
|
|
60
|
+
expressChecked
|
|
61
|
+
? "xpay-translate-x-[12px] xpay-bg-x_blue"
|
|
62
|
+
: "xpay-bg-white"
|
|
63
|
+
} `}
|
|
60
64
|
></span>
|
|
61
65
|
</span>
|
|
62
66
|
</div>
|
|
63
67
|
</div>
|
|
64
|
-
<div className="flex gap-4">
|
|
65
|
-
<div className="min-w-[26px] min-h-[26px] text-[#ffa726]">
|
|
68
|
+
<div className="xpay-flex xpay-gap-4">
|
|
69
|
+
<div className="xpay-min-w-[26px] xpay-min-h-[26px] xpay-text-[#ffa726]">
|
|
66
70
|
<InfoIcon />
|
|
67
71
|
</div>
|
|
68
|
-
<div className="text-xs text-left">
|
|
72
|
+
<div className="xpay-text-xs xpay-text-left">
|
|
69
73
|
Express delivery is a special feature of XSwap that reduces
|
|
70
74
|
transaction time across chains to around 30 seconds. It is
|
|
71
75
|
currently available for swaps below a value of $ 1000 USD.
|
|
@@ -73,20 +77,22 @@ export const Settings: FC<Props> = ({
|
|
|
73
77
|
</div>
|
|
74
78
|
</div>
|
|
75
79
|
|
|
76
|
-
<div className="flex flex-col gap-2
|
|
77
|
-
<div className="
|
|
78
|
-
|
|
79
|
-
|
|
80
|
+
<div className="xpay-flex xpay-flex-col xpay-gap-2">
|
|
81
|
+
<div className="xpay-text-[rgba(255,255,255,0.6)] xpay-text-sm">
|
|
82
|
+
Slippage
|
|
83
|
+
</div>
|
|
84
|
+
<div className="xpay-flex xpay-gap-2">
|
|
85
|
+
<div className="xpay-flex xpay-items-center xpay-bg-[rgba(15,15,15,1)] p-1 xpay-global-border xpay-rounded-xl">
|
|
80
86
|
{SLIPPAGE_PRESETS.map((preset, index) => (
|
|
81
87
|
<div
|
|
82
88
|
key={index}
|
|
83
|
-
className={`transition-all cursor-pointer block rounded-lg p-2 border-none text-sm leading-[10px] ${
|
|
89
|
+
className={`xpay-transition-all xpay-cursor-pointer xpay-block xpay-rounded-lg xpay-p-2 xpay-border-none xpay-text-sm xpay-leading-[10px] ${
|
|
84
90
|
index === slippageActivePresetIndex && !usingSlippageInput
|
|
85
|
-
? "text-white"
|
|
86
|
-
: "text-[rgba(255,255,255,0.2)]"
|
|
91
|
+
? "xpay-text-white"
|
|
92
|
+
: "xpay-text-[rgba(255,255,255,0.2)]"
|
|
87
93
|
} ${
|
|
88
94
|
index === slippageActivePresetIndex && !usingSlippageInput
|
|
89
|
-
? "bg-gradient-to-r from-[#3681c6] to-[#2b4a9d]"
|
|
95
|
+
? "xpay-bg-gradient-to-r xpay-from-[#3681c6] xpay-to-[#2b4a9d]"
|
|
90
96
|
: ""
|
|
91
97
|
}`}
|
|
92
98
|
onClick={() => {
|
|
@@ -98,9 +104,9 @@ export const Settings: FC<Props> = ({
|
|
|
98
104
|
</div>
|
|
99
105
|
))}
|
|
100
106
|
</div>
|
|
101
|
-
<div className="bg-[rgba(39,39,39,1)] p-2 border border-solid border-[rgba(82,82,82,1)] rounded-xl text-white flex items-center">
|
|
107
|
+
<div className="xpay-bg-[rgba(39,39,39,1)] xpay-p-2 xpay-border xpay-border-solid xpay-border-[rgba(82,82,82,1)] xpay-rounded-xl xpay-text-white xpay-flex xpay-items-center">
|
|
102
108
|
<input
|
|
103
|
-
className="text-white border-none bg-[rgba(39,39,39,1)] w-10 placeholder:text-[rgba(255,255,255,0.2)] focus:outline-none text-sm leading-none"
|
|
109
|
+
className="xpay-text-white xpay-border-none xpay-bg-[rgba(39,39,39,1)] xpay-w-10 placeholder:xpay-text-[rgba(255,255,255,0.2)] focus:xpay-outline-none xpay-text-sm xpay-leading-none"
|
|
104
110
|
placeholder="1.5"
|
|
105
111
|
value={usingSlippageInput ? slippage : ""}
|
|
106
112
|
onChange={(e) => {
|
|
@@ -118,11 +124,11 @@ export const Settings: FC<Props> = ({
|
|
|
118
124
|
<PercentageIcon />
|
|
119
125
|
</div>
|
|
120
126
|
</div>
|
|
121
|
-
<div className="flex gap-4">
|
|
122
|
-
<div className="min-w-[26px] min-h-[26px] text-[#ffa726]">
|
|
127
|
+
<div className="xpay-flex xpay-gap-4">
|
|
128
|
+
<div className="xpay-min-w-[26px] xpay-min-h-[26px] xpay-text-[#ffa726]">
|
|
123
129
|
<InfoIcon />
|
|
124
130
|
</div>
|
|
125
|
-
<div className="text-xs text-left">
|
|
131
|
+
<div className="xpay-text-xs xpay-text-left">
|
|
126
132
|
Slippage is the price variation you are willing to accept in the
|
|
127
133
|
event that the price of the trade changes while it is processing.
|
|
128
134
|
<br /> <br />
|
|
@@ -27,7 +27,7 @@ export const Summary: FC<Props> = ({
|
|
|
27
27
|
weiToHumanReadable({
|
|
28
28
|
amount: route?.estAmountOut || "0",
|
|
29
29
|
decimals: dstToken?.decimals || 18,
|
|
30
|
-
precisionFractionalPlaces:
|
|
30
|
+
precisionFractionalPlaces: 8,
|
|
31
31
|
}),
|
|
32
32
|
[route, dstToken],
|
|
33
33
|
);
|
|
@@ -41,44 +41,45 @@ export const Summary: FC<Props> = ({
|
|
|
41
41
|
}, [dstChain]);
|
|
42
42
|
|
|
43
43
|
return (
|
|
44
|
-
<div className="flex flex-col
|
|
45
|
-
<div className="flex justify-between">
|
|
46
|
-
<div className="flex flex-col gap-1">
|
|
47
|
-
<p className="text-[rgba(255,255,255,0.6)] text-sm">
|
|
44
|
+
<div className="xpay-flex xpay-flex-col xpay-global-border xpay-rounded-lg xpay-bg-[rgba(15,15,15,1)] xpay-p-4 xpay-relative">
|
|
45
|
+
<div className="xpay-flex xpay-justify-between">
|
|
46
|
+
<div className="xpay-flex xpay-flex-col xpay-gap-1">
|
|
47
|
+
<p className="xpay-text-[rgba(255,255,255,0.6)] xpay-text-sm">
|
|
48
|
+
You receive
|
|
49
|
+
</p>
|
|
48
50
|
{isGettingRoute ? (
|
|
49
51
|
<Skeleton
|
|
50
|
-
width="w-[100px]"
|
|
51
|
-
height="h-[36px]"
|
|
52
|
-
other="sm:w-[190px]"
|
|
52
|
+
width="xpay-w-[100px]"
|
|
53
|
+
height="xpay-h-[36px]"
|
|
54
|
+
other="sm:xpay-w-[190px]"
|
|
53
55
|
/>
|
|
54
56
|
) : (
|
|
55
|
-
<div className="flex gap-2 items-center text-white text-xl sm:text-3xl">
|
|
57
|
+
<div className="xpay-flex xpay-gap-2 xpay-items-center xpay-text-white xpay-text-xl sm:xpay-text-3xl">
|
|
56
58
|
{amountReadable}
|
|
57
59
|
</div>
|
|
58
60
|
)}
|
|
59
61
|
</div>
|
|
60
|
-
<div className="flex flex-col items-end gap-1 text-sm">
|
|
61
|
-
<div className="flex justify-center items-center gap-1">
|
|
62
|
-
<div className="w-5 h-5">
|
|
62
|
+
<div className="xpay-flex xpay-flex-col xpay-items-end xpay-gap-1 xpay-text-sm">
|
|
63
|
+
<div className="xpay-flex xpay-justify-center xpay-items-center xpay-gap-1">
|
|
64
|
+
<div className="xpay-w-5 xpay-h-5">
|
|
63
65
|
{dstToken?.image ? (
|
|
64
66
|
<img
|
|
65
|
-
className="w-5 h-5"
|
|
67
|
+
className="xpay-w-5 xpay-h-5"
|
|
66
68
|
src={dstToken?.image}
|
|
67
69
|
alt={dstToken?.name}
|
|
68
70
|
/>
|
|
69
71
|
) : (
|
|
70
|
-
<UnknownTokenLogo
|
|
71
|
-
tokenName={"?"}
|
|
72
|
-
className="token-select__generated-logo"
|
|
73
|
-
/>
|
|
72
|
+
<UnknownTokenLogo tokenName={"?"} />
|
|
74
73
|
)}
|
|
75
74
|
</div>
|
|
76
|
-
<p className="text-base sm:text-xl">{dstToken?.name}</p>
|
|
75
|
+
<p className="xpay-text-base sm:xpay-text-xl">{dstToken?.name}</p>
|
|
77
76
|
</div>
|
|
78
|
-
<div className="flex justify-center items-center gap-1">
|
|
79
|
-
<p className="text-[rgba(255,255,255,0.6)] text-right">
|
|
80
|
-
|
|
81
|
-
|
|
77
|
+
<div className="xpay-flex xpay-justify-center xpay-items-center xpay-gap-1">
|
|
78
|
+
<p className="xpay-text-[rgba(255,255,255,0.6)] xpay-text-right">
|
|
79
|
+
on{" "}
|
|
80
|
+
</p>
|
|
81
|
+
<div className="xpay-flex xpay-items-center xpay-gap-1 xpay-text-white">
|
|
82
|
+
<div className="xpay-w-4 xpay-h-4">
|
|
82
83
|
<img src={dstChain?.image} alt={dstChain?.name} />
|
|
83
84
|
</div>
|
|
84
85
|
<div>{dstChain?.displayName}</div>
|
|
@@ -86,15 +87,16 @@ export const Summary: FC<Props> = ({
|
|
|
86
87
|
</div>
|
|
87
88
|
</div>
|
|
88
89
|
</div>
|
|
89
|
-
<
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
90
|
+
<div className="xpay-pt-2">
|
|
91
|
+
<UsdPrice
|
|
92
|
+
prices={prices}
|
|
93
|
+
token={dstToken}
|
|
94
|
+
amount={amountReadable}
|
|
95
|
+
loading={isGettingRoute}
|
|
96
|
+
/>
|
|
97
|
+
</div>
|
|
98
|
+
<div className="xpay-absolute xpay-right-[50%] xpay-top-0 xpay-translate-x-1/2 xpay-translate-y-[-60%] xpay-global-border xpay-rounded-xl p-[5px] xpay-bg-[rgba(15,15,15,1)]">
|
|
99
|
+
<div className="xpay-flex xpay-items-center xpay-justify-center xpay-rounded-lg xpay-w-8 xpay-h-8 xpay-bg-gradient-to-l xpay-from-[rgba(54,129,198,1)] xpay-to-[rgba(43,74,157,1)] ">
|
|
98
100
|
<ArrowDownIcon />
|
|
99
101
|
</div>
|
|
100
102
|
</div>
|
|
@@ -19,7 +19,6 @@ interface Props {
|
|
|
19
19
|
balances: TokenBalances | undefined;
|
|
20
20
|
prices: TokenPrices | undefined;
|
|
21
21
|
supportedChains: Chain[];
|
|
22
|
-
setExceedsExpressDeliveryLimit: (exceeds: boolean) => void;
|
|
23
22
|
}
|
|
24
23
|
|
|
25
24
|
export const SwapPanel: FC<Props> = ({
|
|
@@ -33,7 +32,6 @@ export const SwapPanel: FC<Props> = ({
|
|
|
33
32
|
balances,
|
|
34
33
|
prices,
|
|
35
34
|
supportedChains,
|
|
36
|
-
setExceedsExpressDeliveryLimit,
|
|
37
35
|
}) => {
|
|
38
36
|
const [chainListShown, setChainListShown] = useState(false);
|
|
39
37
|
const [tokenListShown, setTokenListShown] = useState(false);
|
|
@@ -83,14 +81,14 @@ export const SwapPanel: FC<Props> = ({
|
|
|
83
81
|
);
|
|
84
82
|
|
|
85
83
|
return (
|
|
86
|
-
<div className="flex justify-between
|
|
87
|
-
<div className="flex flex-col justify-between gap-2 overflow-hidden w-1/2">
|
|
88
|
-
<div className="flex flex-col gap-1">
|
|
89
|
-
<p className="text-white opacity-60 text-xs sm:text-sm font-medium">
|
|
84
|
+
<div className="xpay-flex xpay-justify-between xpay-global-border xpay-rounded-lg xpay-bg-[rgba(15,15,15,1)] xpay-p-4">
|
|
85
|
+
<div className="xpay-flex xpay-flex-col xpay-justify-between xpay-gap-2 xpay-overflow-hidden xpay-w-1/2">
|
|
86
|
+
<div className="xpay-flex xpay-flex-col xpay-gap-1">
|
|
87
|
+
<p className="xpay-text-white xpay-opacity-60 xpay-text-xs sm:xpay-text-sm xpay-font-medium">
|
|
90
88
|
You pay
|
|
91
89
|
</p>
|
|
92
90
|
<input
|
|
93
|
-
className="p-0 border-none outline-none bg-transparent text-2xl overflow-ellipsis"
|
|
91
|
+
className="xpay-p-0 xpay-border-none xpay-outline-none xpay-bg-transparent xpay-text-2xl xpay-overflow-ellipsis"
|
|
94
92
|
value={amount}
|
|
95
93
|
onChange={(e) => {
|
|
96
94
|
if (e.target.value === ".") return;
|
|
@@ -105,20 +103,18 @@ export const SwapPanel: FC<Props> = ({
|
|
|
105
103
|
placeholder="0"
|
|
106
104
|
/>
|
|
107
105
|
</div>
|
|
108
|
-
<div className="flex items-center text-sm text-[rgba(255,255,255,0.6)]">
|
|
106
|
+
<div className="xpay-flex xpay-items-center xpay-text-sm xpay-text-[rgba(255,255,255,0.6)]">
|
|
109
107
|
<UsdPrice
|
|
110
108
|
prices={prices}
|
|
111
109
|
token={srcToken}
|
|
112
110
|
amount={amount}
|
|
113
111
|
loading={false}
|
|
114
|
-
type="src"
|
|
115
|
-
setExceedsExpressDeliveryLimit={setExceedsExpressDeliveryLimit}
|
|
116
112
|
/>
|
|
117
113
|
</div>
|
|
118
114
|
</div>
|
|
119
|
-
<div className="flex flex-col relative items-end gap-2.5 w-1/2 text-xs">
|
|
115
|
+
<div className="xpay-flex xpay-flex-col xpay-relative xpay-items-end xpay-gap-2.5 xpay-w-1/2 xpay-text-xs">
|
|
120
116
|
<div
|
|
121
|
-
className="flex gap-2 items-center p-2 max-w-full cursor-pointer bg-black text-white
|
|
117
|
+
className="xpay-flex xpay-gap-2 xpay-items-center xpay-p-2 xpay-max-w-full xpay-cursor-pointer xpay-bg-black xpay-text-white xpay-global-border xpay-rounded-3xl xpay-whitespace-nowrap"
|
|
122
118
|
onClick={() => {
|
|
123
119
|
setTokenListShown((state) => !state);
|
|
124
120
|
}}
|
|
@@ -145,7 +141,7 @@ export const SwapPanel: FC<Props> = ({
|
|
|
145
141
|
)}
|
|
146
142
|
<div
|
|
147
143
|
onClick={handleMaxClick}
|
|
148
|
-
className="flex gap-1 items-center font-medium text-white opacity-60 py-0.5 cursor-pointer"
|
|
144
|
+
className="xpay-flex xpay-gap-1 xpay-items-center xpay-font-medium xpay-text-white xpay-opacity-60 xpay-py-0.5 xpay-cursor-pointer"
|
|
149
145
|
>
|
|
150
146
|
{signer && (
|
|
151
147
|
<BalanceComponent balances={balances} srcToken={srcToken} />
|
|
@@ -153,7 +149,7 @@ export const SwapPanel: FC<Props> = ({
|
|
|
153
149
|
</div>
|
|
154
150
|
<div
|
|
155
151
|
ref={buttonRef}
|
|
156
|
-
className="bg-black
|
|
152
|
+
className="xpay-bg-black xpay-global-border xpay-rounded-2xl xpay-whitespace-nowrap xpay-flex xpay-items-center xpay-p-2 xpay-cursor-pointer xpay-gap-2"
|
|
157
153
|
onClick={() => setChainListShown((prev) => !prev)}
|
|
158
154
|
>
|
|
159
155
|
<img
|
|
@@ -169,7 +165,7 @@ export const SwapPanel: FC<Props> = ({
|
|
|
169
165
|
{chainListShown && (
|
|
170
166
|
<ul
|
|
171
167
|
ref={listRef}
|
|
172
|
-
className="bg-black
|
|
168
|
+
className="xpay-bg-black xpay-global-border xpay-rounded-lg xpay-whitespace-nowrap xpay-z-1 xpay-right-0 xpay-top-10 xpay-px-2 xpay-max-w-full xpay-max-h-[40vh] xpay-overflow-auto xpay-absolute xpay-text-sm xpay-z-20"
|
|
173
169
|
>
|
|
174
170
|
{chainListOptions.map((chain, index) => (
|
|
175
171
|
<ChainListElement
|
|
@@ -178,6 +174,7 @@ export const SwapPanel: FC<Props> = ({
|
|
|
178
174
|
setSrcChain={setSrcChain}
|
|
179
175
|
setChainListShown={setChainListShown}
|
|
180
176
|
chain={chain}
|
|
177
|
+
key={chain.chainId}
|
|
181
178
|
/>
|
|
182
179
|
))}
|
|
183
180
|
</ul>
|