@xswap-link/sdk 0.2.4 → 0.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/dist/index.css +244 -267
- package/dist/index.d.mts +19 -12
- package/dist/index.d.ts +19 -12
- package/dist/index.js +588 -432
- package/dist/index.mjs +539 -383
- package/package.json +1 -1
- package/src/components/Alert/index.tsx +1 -1
- package/src/components/Skeleton/index.tsx +3 -1
- 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/Description.tsx +2 -2
- package/src/components/TxConfigForm/ErrorField.tsx +4 -2
- package/src/components/TxConfigForm/FeesDetails.tsx +35 -31
- package/src/components/TxConfigForm/Form.tsx +23 -7
- package/src/components/TxConfigForm/History.tsx +36 -9
- 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 -20
- package/src/components/TxConfigForm/SwapPanel.tsx +12 -12
- package/src/components/TxConfigForm/TokenPicker.tsx +36 -34
- package/src/components/TxConfigForm/TopBar.tsx +8 -8
- package/src/components/TxConfigForm/UsdPrice.tsx +2 -2
- package/src/components/TxConfigForm/index.tsx +11 -6
- package/src/components/TxStatusButton/index.tsx +47 -35
- package/src/components/UnknownTokenLogo/UnknownTokenLogo.tsx +14 -0
- package/src/components/global.css +7 -5
- package/src/components/icons/CircularProgressIcon.tsx +1 -1
- package/src/config/init.tsx +19 -18
- package/src/index.ts +9 -1
- package/src/models/TokenData.ts +1 -1
- package/src/models/TransactionHistory.ts +12 -8
- package/src/models/payloads/GetRoutePayload.ts +1 -0
- package/src/models/payloads/GetSwapTxPayload.ts +1 -0
- package/src/services/api.ts +9 -0
- package/src/services/blockchain.ts +49 -0
- package/src/services/index.ts +1 -0
- package/src/services/integrations/monitoring.ts +34 -14
- package/src/services/integrations/transactions.ts +8 -3
- package/src/utils/strings.ts +4 -0
- package/tailwind.config.js +1 -0
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@ import React from "react";
|
|
|
2
2
|
|
|
3
3
|
export const Alert = ({ desc }: { desc: string }) => {
|
|
4
4
|
return (
|
|
5
|
-
<div className="border border-solid border-x_alert rounded-3xl text-x_alert_light text-xs py-0.5 px-2">
|
|
5
|
+
<div className="xpay-border xpay-border-solid xpay-border-x_alert xpay-rounded-3xl xpay-text-x_alert_light xpay-text-xs xpay-py-0.5 xpay-px-2">
|
|
6
6
|
⚠️ {desc}
|
|
7
7
|
</div>
|
|
8
8
|
);
|
|
@@ -8,6 +8,8 @@ type Props = {
|
|
|
8
8
|
|
|
9
9
|
export const Skeleton = ({ width, height }: Props) => {
|
|
10
10
|
return (
|
|
11
|
-
<div
|
|
11
|
+
<div
|
|
12
|
+
className={`xpay-bg-current xpay-rounded xpay-animate-pulse ${width} ${height}`}
|
|
13
|
+
/>
|
|
12
14
|
);
|
|
13
15
|
};
|
|
@@ -43,7 +43,7 @@ export const BalanceComponent: FC<Props> = ({ srcToken, balances }) => {
|
|
|
43
43
|
precisionFractionalPlaces: 4,
|
|
44
44
|
})
|
|
45
45
|
: 0}
|
|
46
|
-
<span className="bg-gradient-to-r from-x_blue_light to-x_blue_dark bg-clip-text text-transparent">
|
|
46
|
+
<span className="xpay-bg-gradient-to-r xpay-from-x_blue_light xpay-to-x_blue_dark xpay-bg-clip-text xpay-text-transparent">
|
|
47
47
|
Max
|
|
48
48
|
</span>
|
|
49
49
|
</>
|
|
@@ -9,7 +9,7 @@ interface Props {
|
|
|
9
9
|
export const Button: FC<Props> = ({ children, onClick, type, disabled }) => {
|
|
10
10
|
return (
|
|
11
11
|
<button
|
|
12
|
-
className="text-white border-none rounded-2xl text-xl py-4 cursor-pointer w-full bg-gradient-to-r from-[#3681c6] to-[#2b4a9d] disabled:opacity-25"
|
|
12
|
+
className="xpay-text-white xpay-border-none xpay-rounded-2xl xpay-text-xl xpay-py-4 xpay-cursor-pointer xpay-w-full xpay-bg-gradient-to-r xpay-from-[#3681c6] xpay-to-[#2b4a9d] disabled:xpay-opacity-25"
|
|
13
13
|
onClick={onClick}
|
|
14
14
|
type={type}
|
|
15
15
|
disabled={disabled}
|
|
@@ -19,7 +19,7 @@ export const ChainListElement: FC<Props> = ({
|
|
|
19
19
|
return (
|
|
20
20
|
<div key={`${chain.ecosystem}-${chain.chainId}`}>
|
|
21
21
|
<li
|
|
22
|
-
className="bg-transparent border-none flex gap-1 items-center cursor-pointer py-2 w-full"
|
|
22
|
+
className="xpay-bg-transparent xpay-border-none xpay-flex xpay-gap-1 xpay-items-center xpay-cursor-pointer xpay-py-2 xpay-w-full"
|
|
23
23
|
onClick={() => {
|
|
24
24
|
setSrcChain(chain);
|
|
25
25
|
setChainListShown(false);
|
|
@@ -29,7 +29,7 @@ export const ChainListElement: FC<Props> = ({
|
|
|
29
29
|
{chain.displayName}
|
|
30
30
|
</li>
|
|
31
31
|
{index !== length - 1 && (
|
|
32
|
-
<div className="h-px mx-2 bg-[rgba(255,255,255,0.15)]"></div>
|
|
32
|
+
<div className="xpay-h-px xpay-mx-2 xpay-bg-[rgba(255,255,255,0.15)]"></div>
|
|
33
33
|
)}
|
|
34
34
|
</div>
|
|
35
35
|
);
|
|
@@ -6,8 +6,8 @@ interface Props {
|
|
|
6
6
|
|
|
7
7
|
export const Description: FC<Props> = ({ description }) => {
|
|
8
8
|
return (
|
|
9
|
-
<div className="flex flex-col items-start rounded-lg px-4 py-2">
|
|
10
|
-
<div className="w-full flex gap-4 items-start justify-between text-xl">
|
|
9
|
+
<div className="xpay-flex xpay-flex-col xpay-items-start xpay-rounded-lg xpay-px-4 xpay-py-2">
|
|
10
|
+
<div className="xpay-w-full xpay-flex xpay-gap-4 xpay-items-start xpay-justify-between xpay-text-xl">
|
|
11
11
|
{description}
|
|
12
12
|
</div>
|
|
13
13
|
</div>
|
|
@@ -7,8 +7,10 @@ interface Props {
|
|
|
7
7
|
export const ErrorField: FC<Props> = ({ error }) => {
|
|
8
8
|
return (
|
|
9
9
|
<div
|
|
10
|
-
className={`flex justify-center mb-1 items-center w-full rounded-2xl bg-x_error_background border border-solid ${
|
|
11
|
-
error.length > 0
|
|
10
|
+
className={`xpay-flex xpay-justify-center xpay-mb-1 xpay-items-center xpay-w-full xpay-rounded-2xl xpay-bg-x_error_background xpay-border xpay-border-solid ${
|
|
11
|
+
error.length > 0
|
|
12
|
+
? "xpay-border-x_error_border"
|
|
13
|
+
: "xpay-border-transparent"
|
|
12
14
|
}`}
|
|
13
15
|
>
|
|
14
16
|
{error}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FC } from "react";
|
|
1
|
+
import { FC, useMemo } from "react";
|
|
2
2
|
import { CoinsIcon, TimerIcon, ChevronUpIcon, ChevronDownIcon } from "../icons";
|
|
3
3
|
import { safeBigNumberFrom, weiToHumanReadable } from "@src/utils";
|
|
4
4
|
import { Route, Token } from "@src/models";
|
|
@@ -27,14 +27,18 @@ export const FeesDetails: FC<Props> = ({
|
|
|
27
27
|
feesDetailsShown,
|
|
28
28
|
setFeesDetailsShown,
|
|
29
29
|
}) => {
|
|
30
|
+
const isExpressDeliveryPossible = useMemo(() => {
|
|
31
|
+
return expressChecked && !exceedsExpressDeliveryLimit;
|
|
32
|
+
}, [expressChecked, exceedsExpressDeliveryLimit]);
|
|
33
|
+
|
|
30
34
|
return (
|
|
31
|
-
<div className="flex flex-col gap-3
|
|
32
|
-
<div className="flex w-full items-center justify-between text-xs sm:text-sm">
|
|
33
|
-
<div className="flex items-center gap-1 font-medium text-white opacity-60">
|
|
35
|
+
<div className="xpay-flex xpay-flex-col xpay-gap-3 xpay-global-border xpay-rounded-lg xpay-bg-[rgba(15,15,15,1)] xpay-p-2 sm:xpay-p-4 xpay-mb-1">
|
|
36
|
+
<div className="xpay-flex xpay-w-full xpay-items-center xpay-justify-between xpay-text-xs sm:xpay-text-sm">
|
|
37
|
+
<div className="xpay-flex xpay-items-center xpay-gap-1 xpay-font-medium xpay-text-white xpay-opacity-60">
|
|
34
38
|
<CoinsIcon />
|
|
35
|
-
<div className="mr-1">Fees:</div>
|
|
39
|
+
<div className="xpay-mr-1">Fees:</div>
|
|
36
40
|
{isGettingRoute ? (
|
|
37
|
-
<Skeleton width="w-20" height="h-4" />
|
|
41
|
+
<Skeleton width="xpay-w-20" height="xpay-h-4" />
|
|
38
42
|
) : (
|
|
39
43
|
` ${weiToHumanReadable({
|
|
40
44
|
amount: safeBigNumberFrom(
|
|
@@ -50,33 +54,33 @@ export const FeesDetails: FC<Props> = ({
|
|
|
50
54
|
})} ${paymentToken?.symbol}`
|
|
51
55
|
)}
|
|
52
56
|
</div>
|
|
53
|
-
<div className="flex gap-1 items-center">
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
? "Fast ~ 30sec "
|
|
64
|
-
|
|
65
|
-
|
|
57
|
+
<div className="xpay-flex xpay-gap-1 xpay-items-center">
|
|
58
|
+
{route?.xSwapFees.expressDeliveryFee && !isGettingRoute && (
|
|
59
|
+
<div
|
|
60
|
+
className={`xpay-flex xpay-gap-1 xpay-items-center xpay-font-medium ${
|
|
61
|
+
isExpressDeliveryPossible
|
|
62
|
+
? "xpay-text-x_green"
|
|
63
|
+
: "xpay-text-white xpay-opacity-60"
|
|
64
|
+
}`}
|
|
65
|
+
>
|
|
66
|
+
<TimerIcon />
|
|
67
|
+
{isExpressDeliveryPossible ? "Fast ~ 30sec " : "Normal ~ 30min"}
|
|
68
|
+
</div>
|
|
69
|
+
)}
|
|
66
70
|
<div
|
|
67
71
|
onClick={() => setFeesDetailsShown((x) => !x)}
|
|
68
|
-
className="font-medium text-white opacity-60 cursor-pointer flex items-center w-[15px] h-[9px]"
|
|
72
|
+
className="xpay-font-medium xpay-text-white xpay-opacity-60 xpay-cursor-pointer xpay-flex xpay-items-center xpay-w-[15px] xpay-h-[9px]"
|
|
69
73
|
>
|
|
70
74
|
{feesDetailsShown ? <ChevronUpIcon /> : <ChevronDownIcon />}
|
|
71
75
|
</div>
|
|
72
76
|
</div>
|
|
73
77
|
</div>
|
|
74
78
|
{feesDetailsShown && (
|
|
75
|
-
<div className="flex w-full items-center justify-between gap-2">
|
|
76
|
-
<div className="flex flex-col text-[10px] gap-1">
|
|
77
|
-
<div className="flex justify-between font-medium text-white opacity-60 gap-1">
|
|
79
|
+
<div className="xpay-flex xpay-w-full xpay-items-center xpay-justify-between xpay-gap-2">
|
|
80
|
+
<div className="xpay-flex xpay-flex-col xpay-text-[10px] xpay-gap-1">
|
|
81
|
+
<div className="xpay-flex xpay-justify-between xpay-font-medium xpay-text-white xpay-opacity-60 xpay-gap-1">
|
|
78
82
|
<div>CCIP Fee:</div>
|
|
79
|
-
<div className="whitespace-nowrap">
|
|
83
|
+
<div className="xpay-whitespace-nowrap">
|
|
80
84
|
{` ${weiToHumanReadable({
|
|
81
85
|
amount: route?.xSwapFees.ccipFee || "0",
|
|
82
86
|
decimals: 18,
|
|
@@ -84,9 +88,9 @@ export const FeesDetails: FC<Props> = ({
|
|
|
84
88
|
})} ${paymentToken?.symbol}`}
|
|
85
89
|
</div>
|
|
86
90
|
</div>
|
|
87
|
-
<div className="flex justify-between font-medium text-white opacity-60 gap-1">
|
|
91
|
+
<div className="xpay-flex xpay-justify-between xpay-font-medium xpay-text-white xpay-opacity-60 xpay-gap-1">
|
|
88
92
|
<div>Native Fee:</div>
|
|
89
|
-
<div className="whitespace-nowrap">
|
|
93
|
+
<div className="xpay-whitespace-nowrap">
|
|
90
94
|
{` ${weiToHumanReadable({
|
|
91
95
|
amount: route?.xSwapFees.xSwapFee.nativeFee || "0",
|
|
92
96
|
decimals: 18,
|
|
@@ -95,14 +99,14 @@ export const FeesDetails: FC<Props> = ({
|
|
|
95
99
|
</div>
|
|
96
100
|
</div>
|
|
97
101
|
</div>
|
|
98
|
-
<div className="flex flex-col text-[10px] gap-1">
|
|
99
|
-
<div className="flex justify-between font-medium text-white opacity-60 gap-1">
|
|
102
|
+
<div className="xpay-flex xpay-flex-col xpay-text-[10px] xpay-gap-1">
|
|
103
|
+
<div className="xpay-flex xpay-justify-between xpay-font-medium xpay-text-white xpay-opacity-60 xpay-gap-1">
|
|
100
104
|
<div>Slippage:</div>
|
|
101
|
-
<div className="whitespace-nowrap">{`${slippage}%`}</div>
|
|
105
|
+
<div className="xpay-whitespace-nowrap">{`${slippage}%`}</div>
|
|
102
106
|
</div>
|
|
103
|
-
<div className="flex justify-between font-medium text-white opacity-60 gap-1">
|
|
107
|
+
<div className="xpay-flex xpay-justify-between xpay-font-medium xpay-text-white xpay-opacity-60 xpay-gap-1">
|
|
104
108
|
<div>Min amount out:</div>
|
|
105
|
-
<div className="whitespace-nowrap">
|
|
109
|
+
<div className="xpay-whitespace-nowrap">
|
|
106
110
|
{weiToHumanReadable({
|
|
107
111
|
amount: route?.minAmountOut || "0",
|
|
108
112
|
decimals: dstToken?.decimals || 18,
|
|
@@ -3,7 +3,7 @@ import React, { FormEvent, useEffect, useState } from "react";
|
|
|
3
3
|
import { ethers } from "ethers";
|
|
4
4
|
import { useAccount, useSwitchChain } from "wagmi";
|
|
5
5
|
import { Chain, Route, Token, TokenBalances, TokenPrices } from "@src/models";
|
|
6
|
-
import { getPrices, getRoute } from "@src/services";
|
|
6
|
+
import { getCustomTokenData, getPrices, getRoute } from "@src/services";
|
|
7
7
|
import { getBalances } from "@src/utils";
|
|
8
8
|
import { ROUTE_TIMEOUT_MS } from "@src/constants";
|
|
9
9
|
import { TxConfigFormProps } from "@src/components";
|
|
@@ -21,6 +21,7 @@ import { DEFAULT_SOURCE_CHAIN_ID } from "@src/constants";
|
|
|
21
21
|
import { Button } from "./Button";
|
|
22
22
|
|
|
23
23
|
export const Form = ({
|
|
24
|
+
integratorId,
|
|
24
25
|
dstChainId,
|
|
25
26
|
dstTokenAddr,
|
|
26
27
|
customContractCalls,
|
|
@@ -77,15 +78,29 @@ export const Form = ({
|
|
|
77
78
|
}, [supportedChains, dstChainId]);
|
|
78
79
|
|
|
79
80
|
useEffect(() => {
|
|
80
|
-
|
|
81
|
-
dstChain
|
|
81
|
+
(async () => {
|
|
82
|
+
if (!dstChain) {
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
let dstTokenResult = dstChain?.tokens.find(
|
|
82
87
|
(token) => token.address.toLowerCase() === dstTokenAddr.toLowerCase(),
|
|
83
|
-
)
|
|
84
|
-
|
|
88
|
+
);
|
|
89
|
+
|
|
90
|
+
if (!dstTokenResult) {
|
|
91
|
+
dstTokenResult = await getCustomTokenData(
|
|
92
|
+
dstChain,
|
|
93
|
+
dstTokenAddr.toLowerCase(),
|
|
94
|
+
);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
setDstToken(dstTokenResult);
|
|
98
|
+
})();
|
|
85
99
|
}, [dstChain]);
|
|
86
100
|
|
|
87
101
|
useEffect(() => {
|
|
88
102
|
if (
|
|
103
|
+
integratorId &&
|
|
89
104
|
srcChain &&
|
|
90
105
|
srcToken &&
|
|
91
106
|
dstChain &&
|
|
@@ -104,6 +119,7 @@ export const Form = ({
|
|
|
104
119
|
`Configuration error: selected token ($${srcToken.symbol} ${srcToken.name}) has unknown decimals param.`,
|
|
105
120
|
);
|
|
106
121
|
getRoute({
|
|
122
|
+
integratorId,
|
|
107
123
|
fromAmount: ethers.utils
|
|
108
124
|
.parseUnits(debouncedAmount, srcToken.decimals)
|
|
109
125
|
.toString(),
|
|
@@ -186,7 +202,7 @@ export const Form = ({
|
|
|
186
202
|
|
|
187
203
|
return (
|
|
188
204
|
<form
|
|
189
|
-
className="flex flex-col gap-2 z-10 my-0 p-2 md:p-4 rounded-3xl overflow-hidden font-light sm:w-x_desktop"
|
|
205
|
+
className="xpay-flex xpay-flex-col xpay-gap-2 xpay-z-10 xpay-my-0 xpay-p-2 md:xpay-p-4 xpay-rounded-3xl xpay-overflow-hidden xpay-font-light sm:xpay-w-x_desktop"
|
|
190
206
|
onSubmit={handleSubmit}
|
|
191
207
|
>
|
|
192
208
|
<TopBar
|
|
@@ -208,7 +224,7 @@ export const Form = ({
|
|
|
208
224
|
{historyTabShown ? (
|
|
209
225
|
<History signer={signer} supportedChains={supportedChains} />
|
|
210
226
|
) : (
|
|
211
|
-
<div className="flex flex-col gap-2">
|
|
227
|
+
<div className="xpay-flex xpay-flex-col xpay-gap-2">
|
|
212
228
|
{desc && <Description description={desc} />}
|
|
213
229
|
<SwapPanel
|
|
214
230
|
amount={amount}
|
|
@@ -21,15 +21,42 @@ export const History: FC<Props> = ({ signer, supportedChains }) => {
|
|
|
21
21
|
const fetchedTransactions: Transaction[] = [];
|
|
22
22
|
if (downloadedHistory) {
|
|
23
23
|
for (const entry of downloadedHistory.history) {
|
|
24
|
+
let status: TransactionStatus = "IN_PROGRESS";
|
|
25
|
+
|
|
26
|
+
// single chain tx
|
|
24
27
|
if (!entry.source) {
|
|
25
28
|
continue;
|
|
26
29
|
}
|
|
27
|
-
|
|
28
|
-
if (entry.failed)
|
|
30
|
+
|
|
31
|
+
if (entry.failed) {
|
|
32
|
+
status = "REVERTED";
|
|
33
|
+
}
|
|
29
34
|
if (!!entry.target) {
|
|
30
35
|
status = "DONE";
|
|
31
|
-
}
|
|
32
|
-
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
if (entry.transferType === "SINGLE_CHAIN") {
|
|
39
|
+
if (!entry.target) {
|
|
40
|
+
continue;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const blockTimestampMs = new Date(entry.target.blockTime).getTime();
|
|
44
|
+
const estimatedDeliveryTimestamp = blockTimestampMs / 1000;
|
|
45
|
+
|
|
46
|
+
fetchedTransactions.push({
|
|
47
|
+
hash: entry.target.transactionHash,
|
|
48
|
+
timestamp: blockTimestampMs / 1000,
|
|
49
|
+
sourceChainId: entry.target.blockchainId,
|
|
50
|
+
targetChainId: entry.target.blockchainId,
|
|
51
|
+
amountWei: entry.source.tokenAmount,
|
|
52
|
+
tokenAddress: entry.source.tokenAddress,
|
|
53
|
+
tokenOutAddress: entry.target?.tokenAmount,
|
|
54
|
+
tokenOutAmount: entry.target?.tokenAmount,
|
|
55
|
+
estimatedDeliveryTimestamp,
|
|
56
|
+
status,
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
continue;
|
|
33
60
|
}
|
|
34
61
|
|
|
35
62
|
const blockTimestampMs = new Date(entry.source.blockTime).getTime();
|
|
@@ -73,21 +100,21 @@ export const History: FC<Props> = ({ signer, supportedChains }) => {
|
|
|
73
100
|
|
|
74
101
|
if (!signer)
|
|
75
102
|
return (
|
|
76
|
-
<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]">
|
|
77
104
|
Connect a wallet to browse history
|
|
78
105
|
</div>
|
|
79
106
|
);
|
|
80
107
|
|
|
81
108
|
return (
|
|
82
|
-
<div className="flex items-center justify-center w-full">
|
|
83
|
-
<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">
|
|
84
111
|
{fetchedHistory?.length === 0 && historyLoadedOnce && (
|
|
85
|
-
<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)]">
|
|
86
113
|
Your history is empty...
|
|
87
114
|
</div>
|
|
88
115
|
)}
|
|
89
116
|
{!fetchedHistory && !historyLoadedOnce && (
|
|
90
|
-
<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">
|
|
91
118
|
<CircularProgressIcon />
|
|
92
119
|
</div>
|
|
93
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"
|
|
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 />
|