@xswap-link/sdk 0.2.5 → 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.
Files changed (30) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/index.css +234 -263
  3. package/dist/index.js +264 -253
  4. package/dist/index.mjs +264 -253
  5. package/package.json +1 -1
  6. package/src/components/Alert/index.tsx +1 -1
  7. package/src/components/Skeleton/index.tsx +3 -1
  8. package/src/components/TxConfigForm/BalanceComponent.tsx +1 -1
  9. package/src/components/TxConfigForm/Button.tsx +1 -1
  10. package/src/components/TxConfigForm/ChainListElement.tsx +2 -2
  11. package/src/components/TxConfigForm/Description.tsx +2 -2
  12. package/src/components/TxConfigForm/ErrorField.tsx +4 -2
  13. package/src/components/TxConfigForm/FeesDetails.tsx +21 -21
  14. package/src/components/TxConfigForm/Form.tsx +2 -2
  15. package/src/components/TxConfigForm/History.tsx +5 -5
  16. package/src/components/TxConfigForm/HistoryCard.tsx +33 -40
  17. package/src/components/TxConfigForm/PoweredBy.tsx +2 -2
  18. package/src/components/TxConfigForm/Settings.tsx +33 -27
  19. package/src/components/TxConfigForm/Summary.tsx +24 -23
  20. package/src/components/TxConfigForm/SwapPanel.tsx +11 -11
  21. package/src/components/TxConfigForm/TokenPicker.tsx +36 -34
  22. package/src/components/TxConfigForm/TopBar.tsx +8 -8
  23. package/src/components/TxConfigForm/UsdPrice.tsx +2 -2
  24. package/src/components/TxConfigForm/index.tsx +6 -6
  25. package/src/components/TxStatusButton/index.tsx +31 -27
  26. package/src/components/UnknownTokenLogo/UnknownTokenLogo.tsx +1 -1
  27. package/src/components/global.css +7 -5
  28. package/src/components/icons/CircularProgressIcon.tsx +1 -1
  29. package/src/config/init.tsx +19 -18
  30. package/tailwind.config.js +1 -0
@@ -83,14 +83,14 @@ export const SwapPanel: FC<Props> = ({
83
83
  );
84
84
 
85
85
  return (
86
- <div className="flex justify-between globalBorder rounded-lg bg-[rgba(15,15,15,1)] p-4">
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">
86
+ <div className="xpay-flex xpay-justify-between xpay-global-border xpay-rounded-lg xpay-bg-[rgba(15,15,15,1)] xpay-p-4">
87
+ <div className="xpay-flex xpay-flex-col xpay-justify-between xpay-gap-2 xpay-overflow-hidden xpay-w-1/2">
88
+ <div className="xpay-flex xpay-flex-col xpay-gap-1">
89
+ <p className="xpay-text-white xpay-opacity-60 xpay-text-xs sm:xpay-text-sm xpay-font-medium">
90
90
  You pay
91
91
  </p>
92
92
  <input
93
- className="p-0 border-none outline-none bg-transparent text-2xl overflow-ellipsis"
93
+ className="xpay-p-0 xpay-border-none xpay-outline-none xpay-bg-transparent xpay-text-2xl xpay-overflow-ellipsis"
94
94
  value={amount}
95
95
  onChange={(e) => {
96
96
  if (e.target.value === ".") return;
@@ -105,7 +105,7 @@ export const SwapPanel: FC<Props> = ({
105
105
  placeholder="0"
106
106
  />
107
107
  </div>
108
- <div className="flex items-center text-sm text-[rgba(255,255,255,0.6)]">
108
+ <div className="xpay-flex xpay-items-center xpay-text-sm xpay-text-[rgba(255,255,255,0.6)]">
109
109
  <UsdPrice
110
110
  prices={prices}
111
111
  token={srcToken}
@@ -116,9 +116,9 @@ export const SwapPanel: FC<Props> = ({
116
116
  />
117
117
  </div>
118
118
  </div>
119
- <div className="flex flex-col relative items-end gap-2.5 w-1/2 text-xs">
119
+ <div className="xpay-flex xpay-flex-col xpay-relative xpay-items-end xpay-gap-2.5 xpay-w-1/2 xpay-text-xs">
120
120
  <div
121
- className="flex gap-2 items-center p-2 max-w-full cursor-pointer bg-black text-white globalBorder rounded-3xl whitespace-nowrap"
121
+ 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
122
  onClick={() => {
123
123
  setTokenListShown((state) => !state);
124
124
  }}
@@ -145,7 +145,7 @@ export const SwapPanel: FC<Props> = ({
145
145
  )}
146
146
  <div
147
147
  onClick={handleMaxClick}
148
- className="flex gap-1 items-center font-medium text-white opacity-60 py-0.5 cursor-pointer"
148
+ 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
149
  >
150
150
  {signer && (
151
151
  <BalanceComponent balances={balances} srcToken={srcToken} />
@@ -153,7 +153,7 @@ export const SwapPanel: FC<Props> = ({
153
153
  </div>
154
154
  <div
155
155
  ref={buttonRef}
156
- className="bg-black globalBorder rounded-2xl whitespace-nowrap flex items-center p-2 cursor-pointer gap-2"
156
+ 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
157
  onClick={() => setChainListShown((prev) => !prev)}
158
158
  >
159
159
  <img
@@ -169,7 +169,7 @@ export const SwapPanel: FC<Props> = ({
169
169
  {chainListShown && (
170
170
  <ul
171
171
  ref={listRef}
172
- className="bg-black globalBorder rounded-lg whitespace-nowrap z-1 right-0 top-10 px-2 max-w-full max-h-[40vh] overflow-auto absolute text-sm z-20"
172
+ 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
173
  >
174
174
  {chainListOptions.map((chain, index) => (
175
175
  <ChainListElement
@@ -24,8 +24,6 @@ export const TokenPicker: FC<Props> = ({
24
24
  }) => {
25
25
  const [searchValue, setSearchValue] = useState("");
26
26
 
27
- const modalRoot = document.querySelector("#xswap-modal");
28
-
29
27
  const onBackdropClick = (e: MouseEvent<HTMLDivElement>) => {
30
28
  e.stopPropagation();
31
29
  e.nativeEvent.stopImmediatePropagation();
@@ -57,40 +55,42 @@ export const TokenPicker: FC<Props> = ({
57
55
  );
58
56
  }, [searchValue, tokens]);
59
57
 
60
- return modalRoot
58
+ const xpayRoot = document.querySelector("#xpay-root");
59
+
60
+ return xpayRoot
61
61
  ? createPortal(
62
62
  <div
63
63
  onClick={onBackdropClick}
64
- className="box-border fixed h-full w-full z-[999] top-0 left-0 bg-[rgba(0,0,0,0.8)] flex items-center justify-center p-5"
64
+ className="xpay-box-border xpay-fixed xpay-h-full xpay-w-full xpay-z-[999] xpay-top-0 xpay-left-0 xpay-bg-[rgba(0,0,0,0.8)] xpay-flex xpay-items-center xpay-justify-center xpay-p-5"
65
65
  >
66
- <div className="relative bg-black rounded-3xl p-6 max-h-[70%] flex flex-col text-base text-white w-[452px] h-[70%] border border-solid border-[rgba(255,255,255,0.2)]">
66
+ <div className="xpay-relative xpay-bg-black xpay-rounded-3xl xpay-p-6 xpay-max-h-[70%] xpay-flex xpay-flex-col xpay-text-base xpay-text-white xpay-w-[452px] xpay-h-[70%] xpay-border xpay-border-solid xpay-border-[rgba(255,255,255,0.2)]">
67
67
  <div
68
68
  onClick={onCloseClick}
69
- className="absolute top-4 right-4 cursor-pointer"
69
+ className="xpay-absolute xpay-top-4 xpay-right-4 xpay-cursor-pointer"
70
70
  >
71
71
  <CloseIcon />
72
72
  </div>
73
- <p className="text-base mb-4">Pick a token</p>
74
- <div className="flex items-center border border-solid border-[rgba(255,255,255,0.1)] rounded-lg py-0 px-3 gap-2 bg-[rgba(15,15,15,1)]">
75
- <div className="w-6 h-6">
73
+ <p className="xpay-text-base xpay-mb-4">Pick a token</p>
74
+ <div className="xpay-flex xpay-items-center xpay-border xpay-border-solid xpay-border-[rgba(255,255,255,0.1)] xpay-rounded-lg xpay-py-0 xpay-px-3 xpay-gap-2 xpay-bg-[rgba(15,15,15,1)]">
75
+ <div className="xpay-w-6 xpay-h-6">
76
76
  <SearchIcon />
77
77
  </div>
78
78
  <input
79
79
  placeholder="Search name or paste address"
80
80
  value={searchValue}
81
81
  onChange={(e) => setSearchValue(e.target.value)}
82
- className="relative h-[41px] leading-[41px] font-normal z-[1] w-full text-white bg-transparent border-none outline-none placeholder:text-sm"
82
+ className="xpay-relative xpay-h-[41px] xpay-leading-[41px] xpay-font-normal xpay-z-[1] xpay-w-full xpay-text-white xpay-bg-transparent xpay-border-none xpay-outline-none placeholder:xpay-text-sm"
83
83
  />
84
84
  </div>
85
- <div className="my-4 mx-0 flex flex-wrap gap-3">
85
+ <div className="xpay-my-4 xpay-mx-0 xpay-flex xpay-flex-wrap xpay-gap-3">
86
86
  {tokens
87
87
  ?.filter((token) => token?.quickPick)
88
88
  .map((token) => (
89
89
  <div
90
90
  key={token.address}
91
- className={`flex gap-2 py-1 px-2 items-center bg-[rgb(15,15,15)] rounded-2xl border border-solid border-[rgba(255,255,255,0.1)] hover:bg-[rgb(25,25,25)] hover:cursor-pointer ${
91
+ className={`xpay-flex xpay-gap-2 xpay-py-1 xpay-px-2 xpay-items-center xpay-bg-[rgb(15,15,15)] xpay-rounded-2xl xpay-border xpay-border-solid xpay-border-[rgba(255,255,255,0.1)] hover:xpay-bg-[rgb(25,25,25)] hover:xpay-cursor-pointer ${
92
92
  token.address === selectedToken?.address
93
- ? "bg-[rgb(35, 35, 35)]"
93
+ ? "xpay-bg-[rgb(35, 35, 35)]"
94
94
  : ""
95
95
  }`}
96
96
  onClick={() => {
@@ -98,20 +98,24 @@ export const TokenPicker: FC<Props> = ({
98
98
  onCloseClick();
99
99
  }}
100
100
  >
101
- <img src={token.image} alt={token.name} className="w-5" />
102
- <div className="text-sm">{token.symbol}</div>
101
+ <img
102
+ src={token.image}
103
+ alt={token.name}
104
+ className="xpay-w-5"
105
+ />
106
+ <div className="xpay-text-sm">{token.symbol}</div>
103
107
  </div>
104
108
  ))}
105
109
  </div>
106
- <div className="h-[2px] my-0 mx-[-24px] w-[100%+48px] px-12 bg-[rgba(255,255,255,0.1)]" />
107
- <div className="overflow-y-scroll h-full mx-[-24px] w-[100%+48px] flex flex-col">
110
+ <div className="xpay-h-[2px] xpay-my-0 xpay-mx-[-24px] xpay-w-[100%+48px] xpay-px-12 xpay-bg-[rgba(255,255,255,0.1)]" />
111
+ <div className="xpay-overflow-y-scroll xpay-h-full xpay-mx-[-24px] xpay-w-[100%+48px] xpay-flex xpay-flex-col">
108
112
  {filteredTokens && filteredTokens.length > 0 ? (
109
113
  filteredTokens.map((token, index) => (
110
114
  <div
111
115
  key={`${index}_${token.address}`}
112
- className={`flex gap-3 py-2 px-[24px] w-full items-center hover:bg-[rgb(25,25,25)] hover:cursor-pointer ${
116
+ className={`xpay-flex xpay-gap-3 xpay-py-2 xpay-px-[24px] xpay-w-full xpay-items-center hover:xpay-bg-[rgb(25,25,25)] hover:xpay-cursor-pointer ${
113
117
  token.address === selectedToken?.address
114
- ? "bg-[rgb(35,35,35)]"
118
+ ? "xpay-bg-[rgb(35,35,35)]"
115
119
  : ""
116
120
  }`}
117
121
  onClick={() => {
@@ -120,22 +124,18 @@ export const TokenPicker: FC<Props> = ({
120
124
  }}
121
125
  >
122
126
  {token.image ? (
123
- <img
124
- src={token.image}
125
- alt={token.name}
126
- className="token-picker__all__logo"
127
- />
127
+ <img src={token.image} alt={token.name} />
128
128
  ) : (
129
- <div className="flex items-center justify-center w-9 h-9 text-[15px] ml-1 rounded-full bg-[#272e40] text-[#e0e7fa]">
129
+ <div className="xpay-flex xpay-items-center xpay-justify-center xpay-w-9 xpay-h-9 xpay-text-[15px] xpay-ml-1 xpay-rounded-full xpay-bg-[#272e40] xpay-text-[#e0e7fa]">
130
130
  {token?.symbol.substring(0, 1)}
131
131
  </div>
132
132
  )}
133
- <div className="flex justify-between items-center gap-1 overflow-hidden grow">
134
- <div className="flex flex-col leading-[16px]">
135
- <div className="overflow-hidden whitespace-nowrap text-ellipsis text-[15px]">
133
+ <div className="xpay-flex xpay-justify-between xpay-items-center xpay-gap-1 xpay-overflow-hidden xpay-grow">
134
+ <div className="xpay-flex xpay-flex-col xpay-leading-[16px]">
135
+ <div className="xpay-overflow-hidden xpay-whitespace-nowrap xpay-text-ellipsis xpay-text-[15px]">
136
136
  {token.name}
137
137
  </div>
138
- <div className="text-[#888] text-[11px]">
138
+ <div className="xpay-text-[#888] xpay-text-[11px]">
139
139
  {token.symbol}
140
140
  </div>
141
141
  </div>
@@ -144,7 +144,7 @@ export const TokenPicker: FC<Props> = ({
144
144
  {balances &&
145
145
  balances[token.address] &&
146
146
  token.decimals ? (
147
- <div className="text-xs">
147
+ <div className="xpay-text-xs">
148
148
  {weiToHumanReadable({
149
149
  amount:
150
150
  balances[token.address]?.toString() || "0",
@@ -153,7 +153,7 @@ export const TokenPicker: FC<Props> = ({
153
153
  })}
154
154
  </div>
155
155
  ) : (
156
- <Skeleton width="w-12" height="h-3" />
156
+ <Skeleton width="xpay-w-12" height="xpay-h-3" />
157
157
  )}
158
158
  </>
159
159
  )}
@@ -161,14 +161,16 @@ export const TokenPicker: FC<Props> = ({
161
161
  </div>
162
162
  ))
163
163
  ) : (
164
- <div className="mt-4 flex justify-center">
165
- <p className="text-sm text-white">No tokens found.</p>
164
+ <div className="xpay-mt-4 xpay-flex xpay-justify-center">
165
+ <p className="xpay-text-sm xpay-text-white">
166
+ No tokens found.
167
+ </p>
166
168
  </div>
167
169
  )}
168
170
  </div>
169
171
  </div>
170
172
  </div>,
171
- modalRoot,
173
+ xpayRoot,
172
174
  )
173
175
  : null;
174
176
  };
@@ -18,30 +18,30 @@ export const TopBar: FC<Props> = ({
18
18
  onClose,
19
19
  }) => {
20
20
  return (
21
- <div className="flex w-full justify-between items-center mx-auto p-2">
22
- <div className="rounded-lg text-[rgba(255,255,255,0.6)] text-xs sm:text-base whitespace-nowrap">
21
+ <div className="xpay-flex xpay-w-full xpay-justify-between xpay-items-center xpay-mx-auto xpay-p-2">
22
+ <div className="xpay-rounded-lg xpay-text-[rgba(255,255,255,0.6)] xpay-text-xs sm:xpay-text-base xpay-whitespace-nowrap">
23
23
  {signer
24
24
  ? `Connected wallet: ${shortAddress(signer)}`
25
25
  : `Wallet disconnected`}
26
26
  </div>
27
- <div className="flex gap-2 justify-center items-center">
27
+ <div className="xpay-flex xpay-gap-2 xpay-justify-center xpay-items-center">
28
28
  {!historyTabShown && (
29
29
  <div
30
30
  onClick={() => setSettingsShown(true)}
31
- className="flex items-center text-xs gap-1 cursor-pointer"
31
+ className="xpay-flex xpay-items-center xpay-text-xs xpay-gap-1 xpay-cursor-pointer"
32
32
  >
33
- <div className="w-7 h-7 rounded-full bg-gradient-to-r from-x_blue_light to-x_blue_dark flex items-center justify-center">
33
+ <div className="xpay-w-7 xpay-h-7 xpay-rounded-full xpay-bg-gradient-to-r xpay-from-x_blue_light xpay-to-x_blue_dark xpay-flex xpay-items-center xpay-justify-center">
34
34
  <SettingsIcon />
35
35
  </div>
36
36
  </div>
37
37
  )}
38
38
  <div
39
39
  onClick={() => setHistoryTabShown((x) => !x)}
40
- className="flex items-center text-sm gap-1 cursor-pointer"
40
+ className="xpay-flex xpay-items-center xpay-text-sm xpay-gap-1 xpay-cursor-pointer"
41
41
  >
42
42
  {!historyTabShown ? (
43
43
  <>
44
- <div className="w-7 h-7 rounded-full bg-gradient-to-r from-x_blue_light to-x_blue_dark flex items-center justify-center">
44
+ <div className="xpay-w-7 xpay-h-7 xpay-rounded-full xpay-bg-gradient-to-r xpay-from-x_blue_light xpay-to-x_blue_dark xpay-flex xpay-items-center xpay-justify-center">
45
45
  <HistoryIcon />
46
46
  </div>
47
47
  </>
@@ -49,7 +49,7 @@ export const TopBar: FC<Props> = ({
49
49
  <div>Back</div>
50
50
  )}
51
51
  </div>
52
- <div className="cursor-pointer text-white" onClick={onClose}>
52
+ <div className="xpay-cursor-pointer xpay-text-white" onClick={onClose}>
53
53
  <CloseIcon />
54
54
  </div>
55
55
  </div>
@@ -37,9 +37,9 @@ export const UsdPrice: FC<Props> = ({
37
37
  }, [token, prices, amount]);
38
38
 
39
39
  return (
40
- <div className="opacity-60 py-4">
40
+ <div className="xpay-opacity-60 xpay-py-4">
41
41
  {loading ? (
42
- <Skeleton width="w-12" height="h-4" />
42
+ <Skeleton width="xpay-w-12" height="xpay-h-4" />
43
43
  ) : token ? (
44
44
  prices && prices[token.address] ? (
45
45
  <div>{`$${usdPrice}`}</div>
@@ -2,7 +2,7 @@ import "@src/global.css";
2
2
  import { MouseEvent, useMemo } from "react";
3
3
  import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
4
4
  import { WagmiProvider } from "wagmi";
5
- import { getWagmiConfig, waitForInitialization, xswapRoot } from "@src/config";
5
+ import { getWagmiConfig, waitForInitialization, xpayRoot } from "@src/config";
6
6
  import { Chain, ContractCall, Route } from "@src/models";
7
7
  import { PoweredBy } from "@src/components/TxConfigForm/PoweredBy";
8
8
  import { Form } from "./Form";
@@ -47,10 +47,10 @@ const TxConfigForm = ({
47
47
  <WagmiProvider config={wagmiConfig}>
48
48
  <QueryClientProvider client={queryClient}>
49
49
  <div
50
- className="top-0 left-0 right-0 bottom-0 bg-[rgba(0,0,0,0.8)] fixed flex items-center justify-center z-10"
50
+ className="xpay-top-0 xpay-left-0 xpay-right-0 xpay-bottom-0 xpay-bg-[rgba(0,0,0,0.8)] xpay-fixed xpay-flex xpay-items-center xpay-justify-center xpay-z-10"
51
51
  onClick={onBackdropClick}
52
52
  >
53
- <div className="relative bg-black rounded-3xl overflow-auto text-white border-2 border-solid border-[rgba(255,255,255,0.1)]">
53
+ <div className="xpay-relative xpay-bg-black xpay-rounded-3xl xpay-overflow-auto xpay-text-white xpay-border-2 xpay-border-solid xpay-border-[rgba(255,255,255,0.1)]">
54
54
  <Form
55
55
  integratorId={integratorId}
56
56
  dstChainId={dstChainId}
@@ -80,7 +80,7 @@ export const openTxConfigForm = async ({
80
80
  try {
81
81
  return await new Promise(async (resolve) => {
82
82
  await waitForInitialization();
83
- xswapRoot.render(
83
+ xpayRoot.render(
84
84
  <TxConfigForm
85
85
  integratorId={integratorId}
86
86
  dstChainId={dstChainId}
@@ -90,10 +90,10 @@ export const openTxConfigForm = async ({
90
90
  supportedChains={supportedChains}
91
91
  onSubmit={(route) => {
92
92
  resolve(route);
93
- xswapRoot.render("");
93
+ xpayRoot.render("");
94
94
  }}
95
95
  onClose={() => {
96
- xswapRoot.render("");
96
+ xpayRoot.render("");
97
97
  }}
98
98
  />,
99
99
  );
@@ -8,7 +8,7 @@ import {
8
8
  XSwapLogo,
9
9
  } from "../icons";
10
10
  import { MonitoredTransaction } from "@src/models";
11
- import { txStatusRoot } from "@src/config";
11
+ import { xpayTxStatusRoot } from "@src/config";
12
12
  import { UnknownTokenLogo } from "../UnknownTokenLogo/UnknownTokenLogo";
13
13
 
14
14
  interface Props {
@@ -32,56 +32,60 @@ export const TxStatusButton: FC<Props> = ({ transaction }) => {
32
32
  const background = useMemo(
33
33
  () =>
34
34
  isDone
35
- ? "bg-[rgba(2,2,2,1)] bg-gradient-to-r from-[rgba(76,175,80,0.2)] to-[rgba(46,125,50,0.2)]"
36
- : "bg-[rgba(2,2,2,1)] bg-gradient-to-r from-[rgba(54,129,198,0.2)] to-[rgba(43,74,157,0.2)]",
35
+ ? "xpay-bg-[rgba(2,2,2,1)] xpay-bg-gradient-to-r xpay-from-[rgba(76,175,80,0.2)] xpay-to-[rgba(46,125,50,0.2)]"
36
+ : "xpay-bg-[rgba(2,2,2,1)] xpay-bg-gradient-to-r xpay-from-[rgba(54,129,198,0.2)] xpay-to-[rgba(43,74,157,0.2)]",
37
37
  [isDone],
38
38
  );
39
39
 
40
40
  const border = useMemo(
41
41
  () =>
42
42
  isDone
43
- ? "border border-solid border-x_green_dark"
44
- : "border border-solid border-x_blue_dark",
43
+ ? "xpay-border xpay-border-solid xpay-border-x_green_dark"
44
+ : "xpay-border xpay-border-solid xpay-border-x_blue_dark",
45
45
  [isDone],
46
46
  );
47
47
 
48
48
  return (
49
- <div className="flex gap-2" onClick={() => setIsWide((x: boolean) => !x)}>
49
+ <div
50
+ className="xpay-flex xpay-gap-2"
51
+ onClick={() => setIsWide((x: boolean) => !x)}
52
+ >
50
53
  {isWide && (
51
54
  <div
52
- className={`flex items-center min-w-60 sm:w-[520px] text-white h-14 px-4 text-sm gap-3 rounded-xl ${background} ${border}`}
55
+ className={`xpay-flex xpay-items-center xpay-min-w-60 sm:xpay-w-[520px] xpay-text-white xpay-h-14 xpay-px-4 xpay-text-sm xpay-gap-3 xpay-rounded-xl ${background} ${border}`}
53
56
  >
54
- <div className="flex justify-between flex-col gap-2 sm:gap-5 sm:flex-row w-full">
55
- <div className="flex items-center gap-2">
57
+ <div className="xpay-flex xpay-justify-between xpay-flex-col xpay-gap-2 sm:xpay-gap-5 sm:xpay-flex-row xpay-w-full">
58
+ <div className="xpay-flex xpay-items-center xpay-gap-2">
56
59
  <img
57
- className="w-5 h-5"
60
+ className="xpay-w-5 xpay-h-5"
58
61
  src={fromChainImage}
59
62
  alt="source chain"
60
63
  />
61
64
  <div>{fromChain}</div>
62
- <div className="w-3.5 h-3.5">
65
+ <div className="xpay-w-3.5 xpay-h-3.5">
63
66
  <ArrowRightIcon />
64
67
  </div>
65
- <img className="w-5 h-5" src={toChainImage} alt="to chain" />
68
+ <img
69
+ className="xpay-w-5 xpay-h-5"
70
+ src={toChainImage}
71
+ alt="to chain"
72
+ />
66
73
  <div>{toChain}</div>
67
74
  </div>
68
75
 
69
- <div className="flex items-center gap-2">
76
+ <div className="xpay-flex xpay-items-center xpay-gap-2">
70
77
  <div>Sent</div>
71
78
  <div>{fromAmount}</div>
72
79
  <div>{fromToken}</div>
73
80
 
74
81
  {fromTokenImage ? (
75
82
  <img
76
- className="w-5 h-5"
83
+ className="xpay-w-5 xpay-h-5"
77
84
  src={fromTokenImage}
78
85
  alt="source token"
79
86
  />
80
87
  ) : (
81
- <UnknownTokenLogo
82
- tokenName={"?"}
83
- className="token-select__generated-logo"
84
- />
88
+ <UnknownTokenLogo tokenName={"?"} />
85
89
  )}
86
90
  </div>
87
91
  </div>
@@ -89,31 +93,31 @@ export const TxStatusButton: FC<Props> = ({ transaction }) => {
89
93
  href={explorer}
90
94
  target="_blank"
91
95
  rel="noreferrer"
92
- className="no-underline cursor-pointer"
96
+ className="xpay-no-underline xpay-cursor-pointer"
93
97
  aria-label="Show the transaction in the chain explorer"
94
98
  >
95
- <div className="w-3.5 h-3.5">
99
+ <div className="xpay-w-3.5 xpay-h-3.5">
96
100
  <ArrowUpRightIcon />
97
101
  </div>
98
102
  </a>
99
103
  </div>
100
104
  )}
101
105
  <div
102
- className={`text-white rounded-xl cursor-pointer ${background} ${border}`}
106
+ className={`xpay-text-white xpay-rounded-xl xpay-cursor-pointer ${background} ${border}`}
103
107
  >
104
- <div className="flex gap-2 items-center h-14 w-20 justify-center">
108
+ <div className="xpay-flex xpay-gap-2 xpay-items-center xpay-h-14 xpay-w-20 xpay-justify-center">
105
109
  <ArrowLeftIcon />
106
- <div className="relative flex items-center justify-center w-9 h-9">
110
+ <div className="xpay-relative xpay-flex xpay-items-center xpay-justify-center xpay-w-9 xpay-h-9">
107
111
  {isDone ? (
108
- <div className="text-x_green w-5 h-5">
112
+ <div className="xpay-text-x_green xpay-w-5 xpay-h-5">
109
113
  <CheckIcon />
110
114
  </div>
111
115
  ) : (
112
116
  <>
113
- <div className="w-5 h-5">
117
+ <div className="xpay-w-5 xpay-h-5">
114
118
  <XSwapLogo />
115
119
  </div>
116
- <div className="absolute flex items-center justify-center top-0 left-0 right-0 bottom-0 text-white">
120
+ <div className="xpay-absolute xpay-flex xpay-items-center xpay-justify-center xpay-top-0 xpay-left-0 xpay-right-0 xpay-bottom-0 xpay-text-white">
117
121
  <CircularProgressIcon />
118
122
  </div>
119
123
  </>
@@ -154,5 +158,5 @@ export const renderTxStatusButtons = () => {
154
158
  const buttons = renderedTransactions.map((item) => (
155
159
  <TxStatusButton key={item.txHash} transaction={item} />
156
160
  ));
157
- txStatusRoot.render(buttons);
161
+ xpayTxStatusRoot.render(buttons);
158
162
  };
@@ -6,7 +6,7 @@ interface Props {
6
6
  export const UnknownTokenLogo = ({ tokenName, className }: Props) => {
7
7
  return (
8
8
  <div
9
- className={`w-5 h-5 rounded-full bg-white shadow-sm flex items-center justify-center text-black ${className}`}
9
+ className={`xpay-w-5 xpay-h-5 xpay-rounded-full xpay-bg-white xpay-shadow-sm xpay-flex xpay-items-center xpay-justify-center xpay-text-black ${className}`}
10
10
  >
11
11
  {tokenName.substring(0, 1)}
12
12
  </div>
@@ -2,7 +2,7 @@
2
2
  @tailwind components;
3
3
  @tailwind utilities;
4
4
 
5
- .xswap {
5
+ .xpay {
6
6
  /* Works on Firefox */
7
7
  * {
8
8
  scrollbar-width: thin;
@@ -23,12 +23,14 @@
23
23
  background-color: #252525;
24
24
  border-radius: 4px;
25
25
  }
26
+ }
26
27
 
27
- .globalBorder {
28
+ @layer components {
29
+ .xpay-global-border {
28
30
  border: 1px solid rgba(255, 255, 255, 0.1);
29
31
  }
30
- }
31
32
 
32
- .xswap-tx-status {
33
- @apply fixed bottom-5 right-2 flex flex-col gap-3 pl-9 items-end w-full z-50;
33
+ .xpay-tx-status {
34
+ @apply xpay-fixed xpay-bottom-5 xpay-right-2 xpay-flex xpay-flex-col xpay-gap-3 xpay-pl-9 xpay-items-end xpay-w-full xpay-z-50;
35
+ }
34
36
  }
@@ -1,7 +1,7 @@
1
1
  export const CircularProgressIcon = () => {
2
2
  return (
3
3
  <svg
4
- className="animate-spin-slow text-white"
4
+ className="animate-spin-slow xpay-text-white"
5
5
  width="33"
6
6
  height="33"
7
7
  viewBox="0 0 33 33"
@@ -3,9 +3,9 @@ import xswapConfig from "../../xswap.config";
3
3
  import { version } from "../../package.json";
4
4
  import { WaitingForInit } from "@src/components/WaitingForInit";
5
5
 
6
- export let initIndicatorRoot: Root;
7
- export let xswapRoot: Root;
8
- export let txStatusRoot: Root;
6
+ export let xpayRoot: Root;
7
+ export let xpayInitIndicatorRoot: Root;
8
+ export let xpayTxStatusRoot: Root;
9
9
 
10
10
  let initCompleted = false;
11
11
 
@@ -13,12 +13,12 @@ export const initDocument = () => {
13
13
  if (typeof document === "undefined") {
14
14
  throw new Error("Can't render XPay components from server side.");
15
15
  }
16
- createInitIndicatorRoot();
16
+ createXPayInitIndicatorRoot();
17
17
 
18
18
  Promise.all([
19
19
  createStyleElement(),
20
- createXSwapRoot(),
21
- createTxStatusRoot(),
20
+ createXPayRoot(),
21
+ createXPayTxStatusRoot(),
22
22
  ]).then(() => {
23
23
  initCompleted = true;
24
24
  });
@@ -46,30 +46,31 @@ const createStyleElement = async () => {
46
46
  document.body.appendChild(style);
47
47
  };
48
48
 
49
- const createXSwapRoot = async () => {
49
+ const createXPayRoot = async () => {
50
50
  const xswapElement = document.createElement("div");
51
- xswapElement.setAttribute("id", "xswap-modal");
51
+ xswapElement.setAttribute("id", "xpay-root");
52
+ xswapElement.setAttribute("class", "xpay");
52
53
  document.body.appendChild(xswapElement);
53
- xswapRoot = createRoot(xswapElement);
54
+ xpayRoot = createRoot(xswapElement);
54
55
  };
55
56
 
56
- const createTxStatusRoot = async () => {
57
+ const createXPayTxStatusRoot = async () => {
57
58
  const txStatusElement = document.createElement("div");
58
- txStatusElement.setAttribute("id", "xswap-tx-status");
59
- txStatusElement.setAttribute("class", "xswap-tx-status");
59
+ txStatusElement.setAttribute("id", "xpay-tx-status");
60
+ txStatusElement.setAttribute("class", "xpay-tx-status");
60
61
  document.body.appendChild(txStatusElement);
61
- txStatusRoot = createRoot(txStatusElement);
62
+ xpayTxStatusRoot = createRoot(txStatusElement);
62
63
  };
63
64
 
64
- const createInitIndicatorRoot = () => {
65
+ const createXPayInitIndicatorRoot = () => {
65
66
  const initIndicatorElement = document.createElement("div");
66
- initIndicatorElement.setAttribute("id", "xswap-init-indicator");
67
+ initIndicatorElement.setAttribute("id", "xpay-init-indicator");
67
68
  document.body.appendChild(initIndicatorElement);
68
- initIndicatorRoot = createRoot(initIndicatorElement);
69
+ xpayInitIndicatorRoot = createRoot(initIndicatorElement);
69
70
  };
70
71
 
71
72
  const displayInitIndicator = (display: boolean) => {
72
73
  display
73
- ? initIndicatorRoot.render(<WaitingForInit />)
74
- : initIndicatorRoot.render("");
74
+ ? xpayInitIndicatorRoot.render(<WaitingForInit />)
75
+ : xpayInitIndicatorRoot.render("");
75
76
  };
@@ -26,4 +26,5 @@ export default {
26
26
  },
27
27
  },
28
28
  plugins: [],
29
+ prefix: "xpay-",
29
30
  };