@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/dist/index.mjs
CHANGED
|
@@ -23,7 +23,7 @@ var xswap_config_default = {
|
|
|
23
23
|
};
|
|
24
24
|
|
|
25
25
|
// package.json
|
|
26
|
-
var version = "0.2.
|
|
26
|
+
var version = "0.2.6";
|
|
27
27
|
|
|
28
28
|
// src/components/WaitingForInit/index.tsx
|
|
29
29
|
import { jsx } from "react/jsx-runtime";
|
|
@@ -50,19 +50,19 @@ var WaitingForInit = () => {
|
|
|
50
50
|
|
|
51
51
|
// src/config/init.tsx
|
|
52
52
|
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
53
|
-
var
|
|
54
|
-
var
|
|
55
|
-
var
|
|
53
|
+
var xpayRoot;
|
|
54
|
+
var xpayInitIndicatorRoot;
|
|
55
|
+
var xpayTxStatusRoot;
|
|
56
56
|
var initCompleted = false;
|
|
57
57
|
var initDocument = () => {
|
|
58
58
|
if (typeof document === "undefined") {
|
|
59
59
|
throw new Error("Can't render XPay components from server side.");
|
|
60
60
|
}
|
|
61
|
-
|
|
61
|
+
createXPayInitIndicatorRoot();
|
|
62
62
|
Promise.all([
|
|
63
63
|
createStyleElement(),
|
|
64
|
-
|
|
65
|
-
|
|
64
|
+
createXPayRoot(),
|
|
65
|
+
createXPayTxStatusRoot()
|
|
66
66
|
]).then(() => {
|
|
67
67
|
initCompleted = true;
|
|
68
68
|
});
|
|
@@ -87,68 +87,30 @@ var createStyleElement = async () => {
|
|
|
87
87
|
style.textContent = text;
|
|
88
88
|
document.body.appendChild(style);
|
|
89
89
|
};
|
|
90
|
-
var
|
|
90
|
+
var createXPayRoot = async () => {
|
|
91
91
|
const xswapElement = document.createElement("div");
|
|
92
|
-
xswapElement.setAttribute("id", "
|
|
92
|
+
xswapElement.setAttribute("id", "xpay-root");
|
|
93
|
+
xswapElement.setAttribute("class", "xpay");
|
|
93
94
|
document.body.appendChild(xswapElement);
|
|
94
|
-
|
|
95
|
+
xpayRoot = createRoot(xswapElement);
|
|
95
96
|
};
|
|
96
|
-
var
|
|
97
|
+
var createXPayTxStatusRoot = async () => {
|
|
97
98
|
const txStatusElement = document.createElement("div");
|
|
98
|
-
txStatusElement.setAttribute("id", "
|
|
99
|
-
txStatusElement.setAttribute("class", "
|
|
99
|
+
txStatusElement.setAttribute("id", "xpay-tx-status");
|
|
100
|
+
txStatusElement.setAttribute("class", "xpay-tx-status");
|
|
100
101
|
document.body.appendChild(txStatusElement);
|
|
101
|
-
|
|
102
|
+
xpayTxStatusRoot = createRoot(txStatusElement);
|
|
102
103
|
};
|
|
103
|
-
var
|
|
104
|
+
var createXPayInitIndicatorRoot = () => {
|
|
104
105
|
const initIndicatorElement = document.createElement("div");
|
|
105
|
-
initIndicatorElement.setAttribute("id", "
|
|
106
|
+
initIndicatorElement.setAttribute("id", "xpay-init-indicator");
|
|
106
107
|
document.body.appendChild(initIndicatorElement);
|
|
107
|
-
|
|
108
|
+
xpayInitIndicatorRoot = createRoot(initIndicatorElement);
|
|
108
109
|
};
|
|
109
110
|
var displayInitIndicator = (display) => {
|
|
110
|
-
display ?
|
|
111
|
+
display ? xpayInitIndicatorRoot.render(/* @__PURE__ */ jsx2(WaitingForInit, {})) : xpayInitIndicatorRoot.render("");
|
|
111
112
|
};
|
|
112
113
|
|
|
113
|
-
// src/models/Addresses.ts
|
|
114
|
-
var ContractName = /* @__PURE__ */ ((ContractName2) => {
|
|
115
|
-
ContractName2["BatchQuery"] = "BatchQuery";
|
|
116
|
-
ContractName2["FeeCollector"] = "FeeCollector";
|
|
117
|
-
ContractName2["XSwapRouter"] = "XSwapRouter";
|
|
118
|
-
return ContractName2;
|
|
119
|
-
})(ContractName || {});
|
|
120
|
-
|
|
121
|
-
// src/models/Ecosystem.ts
|
|
122
|
-
var Ecosystem = /* @__PURE__ */ ((Ecosystem2) => {
|
|
123
|
-
Ecosystem2["EVM"] = "evm";
|
|
124
|
-
return Ecosystem2;
|
|
125
|
-
})(Ecosystem || {});
|
|
126
|
-
|
|
127
|
-
// src/models/Environment.ts
|
|
128
|
-
var Environment = /* @__PURE__ */ ((Environment2) => {
|
|
129
|
-
Environment2["PROD"] = "production";
|
|
130
|
-
Environment2["DEV"] = "develop";
|
|
131
|
-
Environment2["LOCAL"] = "local";
|
|
132
|
-
return Environment2;
|
|
133
|
-
})(Environment || {});
|
|
134
|
-
|
|
135
|
-
// src/models/Web3Environment.ts
|
|
136
|
-
var Web3Environment = /* @__PURE__ */ ((Web3Environment2) => {
|
|
137
|
-
Web3Environment2["DEVNET"] = "devnet";
|
|
138
|
-
Web3Environment2["TESTNET"] = "testnet";
|
|
139
|
-
Web3Environment2["MAINNET"] = "mainnet";
|
|
140
|
-
return Web3Environment2;
|
|
141
|
-
})(Web3Environment || {});
|
|
142
|
-
|
|
143
|
-
// src/models/XSwapCallType.ts
|
|
144
|
-
var XSwapCallType = /* @__PURE__ */ ((XSwapCallType2) => {
|
|
145
|
-
XSwapCallType2[XSwapCallType2["DEFAULT"] = 0] = "DEFAULT";
|
|
146
|
-
XSwapCallType2[XSwapCallType2["FULL_TOKEN_BALANCE"] = 1] = "FULL_TOKEN_BALANCE";
|
|
147
|
-
XSwapCallType2[XSwapCallType2["FULL_NATIVE_BALANCE"] = 2] = "FULL_NATIVE_BALANCE";
|
|
148
|
-
XSwapCallType2[XSwapCallType2["COLLECT_TOKEN_BALANCE"] = 3] = "COLLECT_TOKEN_BALANCE";
|
|
149
|
-
return XSwapCallType2;
|
|
150
|
-
})(XSwapCallType || {});
|
|
151
|
-
|
|
152
114
|
// src/services/api.ts
|
|
153
115
|
async function _sendRequest(urlPath, options) {
|
|
154
116
|
const response = await fetch(`${xswap_config_default.apiUrl}${urlPath}`, {
|
|
@@ -191,10 +153,57 @@ async function getPrices(payload) {
|
|
|
191
153
|
})}`
|
|
192
154
|
);
|
|
193
155
|
}
|
|
156
|
+
async function getTxStatus(payload) {
|
|
157
|
+
return await _sendRequest(
|
|
158
|
+
`/getTxStatus?${new URLSearchParams({
|
|
159
|
+
data: JSON.stringify(payload)
|
|
160
|
+
// todo remove once gcp starts working
|
|
161
|
+
})}`
|
|
162
|
+
);
|
|
163
|
+
}
|
|
194
164
|
|
|
195
165
|
// src/services/integrations/customCalls/staking.ts
|
|
196
166
|
import { ethers as ethers2 } from "ethers";
|
|
197
167
|
|
|
168
|
+
// src/models/Addresses.ts
|
|
169
|
+
var ContractName = /* @__PURE__ */ ((ContractName2) => {
|
|
170
|
+
ContractName2["BatchQuery"] = "BatchQuery";
|
|
171
|
+
ContractName2["FeeCollector"] = "FeeCollector";
|
|
172
|
+
ContractName2["XSwapRouter"] = "XSwapRouter";
|
|
173
|
+
return ContractName2;
|
|
174
|
+
})(ContractName || {});
|
|
175
|
+
|
|
176
|
+
// src/models/Ecosystem.ts
|
|
177
|
+
var Ecosystem = /* @__PURE__ */ ((Ecosystem2) => {
|
|
178
|
+
Ecosystem2["EVM"] = "evm";
|
|
179
|
+
return Ecosystem2;
|
|
180
|
+
})(Ecosystem || {});
|
|
181
|
+
|
|
182
|
+
// src/models/Environment.ts
|
|
183
|
+
var Environment = /* @__PURE__ */ ((Environment2) => {
|
|
184
|
+
Environment2["PROD"] = "production";
|
|
185
|
+
Environment2["DEV"] = "develop";
|
|
186
|
+
Environment2["LOCAL"] = "local";
|
|
187
|
+
return Environment2;
|
|
188
|
+
})(Environment || {});
|
|
189
|
+
|
|
190
|
+
// src/models/Web3Environment.ts
|
|
191
|
+
var Web3Environment = /* @__PURE__ */ ((Web3Environment2) => {
|
|
192
|
+
Web3Environment2["DEVNET"] = "devnet";
|
|
193
|
+
Web3Environment2["TESTNET"] = "testnet";
|
|
194
|
+
Web3Environment2["MAINNET"] = "mainnet";
|
|
195
|
+
return Web3Environment2;
|
|
196
|
+
})(Web3Environment || {});
|
|
197
|
+
|
|
198
|
+
// src/models/XSwapCallType.ts
|
|
199
|
+
var XSwapCallType = /* @__PURE__ */ ((XSwapCallType2) => {
|
|
200
|
+
XSwapCallType2[XSwapCallType2["DEFAULT"] = 0] = "DEFAULT";
|
|
201
|
+
XSwapCallType2[XSwapCallType2["FULL_TOKEN_BALANCE"] = 1] = "FULL_TOKEN_BALANCE";
|
|
202
|
+
XSwapCallType2[XSwapCallType2["FULL_NATIVE_BALANCE"] = 2] = "FULL_NATIVE_BALANCE";
|
|
203
|
+
XSwapCallType2[XSwapCallType2["COLLECT_TOKEN_BALANCE"] = 3] = "COLLECT_TOKEN_BALANCE";
|
|
204
|
+
return XSwapCallType2;
|
|
205
|
+
})(XSwapCallType || {});
|
|
206
|
+
|
|
198
207
|
// src/utils/contracts.ts
|
|
199
208
|
import { ethers } from "ethers";
|
|
200
209
|
|
|
@@ -626,6 +635,9 @@ var shortAddress = (address) => {
|
|
|
626
635
|
address.length
|
|
627
636
|
)}`;
|
|
628
637
|
};
|
|
638
|
+
var isETHAddressValid = (address) => {
|
|
639
|
+
return /^0x[a-fA-F0-9]{40}$/.test(address);
|
|
640
|
+
};
|
|
629
641
|
|
|
630
642
|
// src/utils/index.ts
|
|
631
643
|
import { format } from "date-fns";
|
|
@@ -654,19 +666,19 @@ var getDate = (blockTimestamp) => {
|
|
|
654
666
|
};
|
|
655
667
|
|
|
656
668
|
// src/services/integrations/monitoring.ts
|
|
657
|
-
import { ethers as
|
|
669
|
+
import { ethers as ethers5 } from "ethers";
|
|
658
670
|
|
|
659
671
|
// src/components/Alert/index.tsx
|
|
660
672
|
import { jsxs } from "react/jsx-runtime";
|
|
661
673
|
var Alert = ({ desc }) => {
|
|
662
|
-
return /* @__PURE__ */ jsxs("div", { className: "border border-solid border-x_alert rounded-3xl text-x_alert_light text-xs py-0.5 px-2", children: [
|
|
674
|
+
return /* @__PURE__ */ jsxs("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", children: [
|
|
663
675
|
"\u26A0\uFE0F ",
|
|
664
676
|
desc
|
|
665
677
|
] });
|
|
666
678
|
};
|
|
667
679
|
|
|
668
680
|
// src/components/TxConfigForm/index.tsx
|
|
669
|
-
import { useMemo as
|
|
681
|
+
import { useMemo as useMemo8 } from "react";
|
|
670
682
|
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
|
671
683
|
import { WagmiProvider } from "wagmi";
|
|
672
684
|
|
|
@@ -831,7 +843,7 @@ var CircularProgressIcon = () => {
|
|
|
831
843
|
return /* @__PURE__ */ jsxs2(
|
|
832
844
|
"svg",
|
|
833
845
|
{
|
|
834
|
-
className: "animate-spin-slow text-white",
|
|
846
|
+
className: "animate-spin-slow xpay-text-white",
|
|
835
847
|
width: "33",
|
|
836
848
|
height: "33",
|
|
837
849
|
viewBox: "0 0 33 33",
|
|
@@ -1146,8 +1158,8 @@ var XSwapLogo = () => {
|
|
|
1146
1158
|
// src/components/TxConfigForm/PoweredBy.tsx
|
|
1147
1159
|
import { jsx as jsx25, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1148
1160
|
var PoweredBy = () => {
|
|
1149
|
-
return /* @__PURE__ */ jsxs6("div", { className: "flex justify-center items-center gap-2 my-3", children: [
|
|
1150
|
-
/* @__PURE__ */ jsx25("span", { className: "text-x_grey", children: "Powered by" }),
|
|
1161
|
+
return /* @__PURE__ */ jsxs6("div", { className: "xpay-flex xpay-justify-center xpay-items-center xpay-gap-2 xpay-my-3", children: [
|
|
1162
|
+
/* @__PURE__ */ jsx25("span", { className: "xpay-text-x_grey", children: "Powered by" }),
|
|
1151
1163
|
/* @__PURE__ */ jsx25(XSwapBadgeIcon, {}),
|
|
1152
1164
|
/* @__PURE__ */ jsx25("span", { children: "\u2715" }),
|
|
1153
1165
|
/* @__PURE__ */ jsx25(ChainlinkCCIPIcon, {})
|
|
@@ -1228,13 +1240,13 @@ var HistoryCard = ({ transaction, supportedChains }) => {
|
|
|
1228
1240
|
const targetChainData = supportedChains.find(
|
|
1229
1241
|
(chain) => chain.chainId === transaction.targetChainId
|
|
1230
1242
|
);
|
|
1231
|
-
return /* @__PURE__ */ jsxs7("div", { className: "flex flex-col
|
|
1232
|
-
/* @__PURE__ */ jsxs7("div", { className: "flex w-full items-center justify-between", children: [
|
|
1233
|
-
/* @__PURE__ */ jsx26("div", { className: "text-sm sm:text-base", children: date }),
|
|
1234
|
-
/* @__PURE__ */ jsxs7("div", { className: "flex items-center", children: [
|
|
1235
|
-
transaction.status === "IN_PROGRESS" && /* @__PURE__ */ jsx26("div", { className: "flex items-center", children: /* @__PURE__ */ jsx26("div", { className: "text-[rgb(250,200,100)]", children: "In progress" }) }),
|
|
1236
|
-
transaction.status === "DONE" && /* @__PURE__ */ jsx26("div", { className: "flex items-center", children: /* @__PURE__ */ jsx26("div", { className: "text-[rgb(100,200,100)]", children: "Done" }) }),
|
|
1237
|
-
transaction.status === "REVERTED" && /* @__PURE__ */ jsx26("div", { className: "flex items-center", children: /* @__PURE__ */ jsx26("div", { className: "text-[rgb(255,100,100)]", children: "Reverted" }) }),
|
|
1243
|
+
return /* @__PURE__ */ jsxs7("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", children: [
|
|
1244
|
+
/* @__PURE__ */ jsxs7("div", { className: "xpay-flex xpay-w-full xpay-items-center xpay-justify-between", children: [
|
|
1245
|
+
/* @__PURE__ */ jsx26("div", { className: "xpay-text-sm sm:xpay-text-base", children: date }),
|
|
1246
|
+
/* @__PURE__ */ jsxs7("div", { className: "xpay-flex xpay-items-center", children: [
|
|
1247
|
+
transaction.status === "IN_PROGRESS" && /* @__PURE__ */ jsx26("div", { className: "xpay-flex xpay-items-center", children: /* @__PURE__ */ jsx26("div", { className: "xpay-text-[rgb(250,200,100)]", children: "In progress" }) }),
|
|
1248
|
+
transaction.status === "DONE" && /* @__PURE__ */ jsx26("div", { className: "xpay-flex xpay-items-center", children: /* @__PURE__ */ jsx26("div", { className: "xpay-text-[rgb(100,200,100)]", children: "Done" }) }),
|
|
1249
|
+
transaction.status === "REVERTED" && /* @__PURE__ */ jsx26("div", { className: "xpay-flex xpay-items-center", children: /* @__PURE__ */ jsx26("div", { className: "xpay-text-[rgb(255,100,100)]", children: "Reverted" }) }),
|
|
1238
1250
|
/* @__PURE__ */ jsx26(
|
|
1239
1251
|
"a",
|
|
1240
1252
|
{
|
|
@@ -1243,65 +1255,65 @@ var HistoryCard = ({ transaction, supportedChains }) => {
|
|
|
1243
1255
|
)?.transactionExplorer}/${transaction.hash}`,
|
|
1244
1256
|
target: "_blank",
|
|
1245
1257
|
rel: "noreferrer",
|
|
1246
|
-
className: "ml-2 no-underline",
|
|
1258
|
+
className: "xpay-ml-2 xpay-no-underline",
|
|
1247
1259
|
"aria-label": "Show the transaction in the chain explorer",
|
|
1248
|
-
children: /* @__PURE__ */ jsx26("div", { className: "w-3.5 h-3.5", children: /* @__PURE__ */ jsx26(ArrowUpRightIcon, {}) })
|
|
1260
|
+
children: /* @__PURE__ */ jsx26("div", { className: "xpay-w-3.5 xpay-h-3.5", children: /* @__PURE__ */ jsx26(ArrowUpRightIcon, {}) })
|
|
1249
1261
|
}
|
|
1250
1262
|
)
|
|
1251
1263
|
] })
|
|
1252
1264
|
] }),
|
|
1253
|
-
/* @__PURE__ */ jsxs7("div", { className: "flex justify-between flex-wrap gap-2", children: [
|
|
1254
|
-
/* @__PURE__ */ jsxs7("div", { className: "flex items-center", children: [
|
|
1255
|
-
/* @__PURE__ */ jsxs7("div", { className: "flex items-center", children: [
|
|
1265
|
+
/* @__PURE__ */ jsxs7("div", { className: "xpay-flex xpay-justify-between xpay-flex-wrap xpay-gap-2", children: [
|
|
1266
|
+
/* @__PURE__ */ jsxs7("div", { className: "xpay-flex xpay-items-center", children: [
|
|
1267
|
+
/* @__PURE__ */ jsxs7("div", { className: "xpay-flex xpay-items-center", children: [
|
|
1256
1268
|
/* @__PURE__ */ jsx26(
|
|
1257
1269
|
"img",
|
|
1258
1270
|
{
|
|
1259
1271
|
src: sourceChainData?.image,
|
|
1260
1272
|
alt: `${sourceChainData?.name} logo`,
|
|
1261
|
-
className: "w-5 h-5 mr-1"
|
|
1273
|
+
className: "xpay-w-5 xpay-h-5 xpay-mr-1"
|
|
1262
1274
|
}
|
|
1263
1275
|
),
|
|
1264
1276
|
/* @__PURE__ */ jsx26("div", { children: sourceChainData?.displayName })
|
|
1265
1277
|
] }),
|
|
1266
|
-
/* @__PURE__ */ jsx26("div", { className: "w-3.5 h-3.5 my-0 mx-1.5", children: /* @__PURE__ */ jsx26(ArrowRightIcon, {}) }),
|
|
1267
|
-
/* @__PURE__ */ jsxs7("div", { className: "flex items-center", children: [
|
|
1278
|
+
/* @__PURE__ */ jsx26("div", { className: "xpay-w-3.5 xpay-h-3.5 xpay-my-0 xpay-mx-1.5", children: /* @__PURE__ */ jsx26(ArrowRightIcon, {}) }),
|
|
1279
|
+
/* @__PURE__ */ jsxs7("div", { className: "xpay-flex xpay-items-center", children: [
|
|
1268
1280
|
/* @__PURE__ */ jsx26(
|
|
1269
1281
|
"img",
|
|
1270
1282
|
{
|
|
1271
1283
|
src: targetChainData?.image,
|
|
1272
1284
|
alt: `${targetChainData?.name} logo`,
|
|
1273
|
-
className: "w-5 h-5 mr-1"
|
|
1285
|
+
className: "xpay-w-5 xpay-h-5 xpay-mr-1"
|
|
1274
1286
|
}
|
|
1275
1287
|
),
|
|
1276
1288
|
/* @__PURE__ */ jsx26("div", { children: targetChainData?.displayName })
|
|
1277
1289
|
] })
|
|
1278
1290
|
] }),
|
|
1279
|
-
/* @__PURE__ */ jsx26("div", { className: "flex items-center mb-2 last:mb-0", children: /* @__PURE__ */ jsxs7("div", { className: "flex items-center flex-wrap", children: [
|
|
1280
|
-
/* @__PURE__ */ jsxs7("div", { className: "flex items-center", children: [
|
|
1291
|
+
/* @__PURE__ */ jsx26("div", { className: "xpay-flex xpay-items-center xpay-mb-2 last:xpay-mb-0", children: /* @__PURE__ */ jsxs7("div", { className: "xpay-flex xpay-items-center xpay-flex-wrap", children: [
|
|
1292
|
+
/* @__PURE__ */ jsxs7("div", { className: "xpay-flex xpay-items-center", children: [
|
|
1281
1293
|
Number(transferredAmount) < MINIMUM_DISPLAYED_TOKEN_AMOUNT ? `<${MINIMUM_DISPLAYED_TOKEN_AMOUNT}` : transferredAmount,
|
|
1282
|
-
/* @__PURE__ */ jsx26("div", { className: "ml-1", children: tokenData?.symbol }),
|
|
1294
|
+
/* @__PURE__ */ jsx26("div", { className: "xpay-ml-1", children: tokenData?.symbol }),
|
|
1283
1295
|
tokenData?.image ? /* @__PURE__ */ jsx26(
|
|
1284
1296
|
"img",
|
|
1285
1297
|
{
|
|
1286
1298
|
src: tokenData?.image,
|
|
1287
1299
|
alt: tokenData?.name || "",
|
|
1288
|
-
className: "w-5 h-5 ml-1"
|
|
1300
|
+
className: "xpay-w-5 xpay-h-5 xpay-ml-1"
|
|
1289
1301
|
}
|
|
1290
|
-
) : /* @__PURE__ */ jsx26("div", { className: "flex items-center justify-center w-5 h-5 text-[10px] ml-1 rounded-full bg-[#272e40] text-[#e0e7fa]", children: tokenData?.symbol.substring(0, 1) })
|
|
1302
|
+
) : /* @__PURE__ */ jsx26("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]", children: tokenData?.symbol.substring(0, 1) })
|
|
1291
1303
|
] }),
|
|
1292
1304
|
transaction.tokenOutAddress && /* @__PURE__ */ jsxs7(Fragment, { children: [
|
|
1293
|
-
/* @__PURE__ */ jsx26("div", { className: "w-3.5 h-3.5 my-0 mx-1.5", children: /* @__PURE__ */ jsx26(ArrowRightIcon, {}) }),
|
|
1294
|
-
/* @__PURE__ */ jsxs7("div", { className: "flex items-center", children: [
|
|
1305
|
+
/* @__PURE__ */ jsx26("div", { className: "xpay-w-3.5 xpay-h-3.5 xpay-my-0 xpay-mx-1.5", children: /* @__PURE__ */ jsx26(ArrowRightIcon, {}) }),
|
|
1306
|
+
/* @__PURE__ */ jsxs7("div", { className: "xpay-flex xpay-items-center", children: [
|
|
1295
1307
|
Number(receivedAmount) < 1e-4 ? "<0.0001" : receivedAmount,
|
|
1296
|
-
/* @__PURE__ */ jsx26("div", { className: "ml-1", children: tokenOutData?.symbol }),
|
|
1308
|
+
/* @__PURE__ */ jsx26("div", { className: "xpay-ml-1", children: tokenOutData?.symbol }),
|
|
1297
1309
|
tokenOutData?.image ? /* @__PURE__ */ jsx26(
|
|
1298
1310
|
"img",
|
|
1299
1311
|
{
|
|
1300
1312
|
src: tokenOutData?.image,
|
|
1301
1313
|
alt: tokenOutData?.name || "",
|
|
1302
|
-
className: "w-5 h-5 ml-1"
|
|
1314
|
+
className: "xpay-w-5 xpay-h-5 xpay-ml-1"
|
|
1303
1315
|
}
|
|
1304
|
-
) : /* @__PURE__ */ jsx26("div", { className: "flex items-center justify-center w-5 h-5 text-[10px] ml-1 rounded-full bg-[#272e40] text-[#e0e7fa]", children: tokenData?.symbol.substring(0, 1) })
|
|
1316
|
+
) : /* @__PURE__ */ jsx26("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]", children: tokenData?.symbol.substring(0, 1) })
|
|
1305
1317
|
] })
|
|
1306
1318
|
] })
|
|
1307
1319
|
] }) })
|
|
@@ -1320,15 +1332,35 @@ var History = ({ signer, supportedChains }) => {
|
|
|
1320
1332
|
const fetchedTransactions = [];
|
|
1321
1333
|
if (downloadedHistory) {
|
|
1322
1334
|
for (const entry of downloadedHistory.history) {
|
|
1335
|
+
let status = "IN_PROGRESS";
|
|
1323
1336
|
if (!entry.source) {
|
|
1324
1337
|
continue;
|
|
1325
1338
|
}
|
|
1326
|
-
|
|
1327
|
-
|
|
1339
|
+
if (entry.failed) {
|
|
1340
|
+
status = "REVERTED";
|
|
1341
|
+
}
|
|
1328
1342
|
if (!!entry.target) {
|
|
1329
1343
|
status = "DONE";
|
|
1330
|
-
}
|
|
1331
|
-
|
|
1344
|
+
}
|
|
1345
|
+
if (entry.transferType === "SINGLE_CHAIN") {
|
|
1346
|
+
if (!entry.target) {
|
|
1347
|
+
continue;
|
|
1348
|
+
}
|
|
1349
|
+
const blockTimestampMs2 = new Date(entry.target.blockTime).getTime();
|
|
1350
|
+
const estimatedDeliveryTimestamp2 = blockTimestampMs2 / 1e3;
|
|
1351
|
+
fetchedTransactions.push({
|
|
1352
|
+
hash: entry.target.transactionHash,
|
|
1353
|
+
timestamp: blockTimestampMs2 / 1e3,
|
|
1354
|
+
sourceChainId: entry.target.blockchainId,
|
|
1355
|
+
targetChainId: entry.target.blockchainId,
|
|
1356
|
+
amountWei: entry.source.tokenAmount,
|
|
1357
|
+
tokenAddress: entry.source.tokenAddress,
|
|
1358
|
+
tokenOutAddress: entry.target?.tokenAmount,
|
|
1359
|
+
tokenOutAmount: entry.target?.tokenAmount,
|
|
1360
|
+
estimatedDeliveryTimestamp: estimatedDeliveryTimestamp2,
|
|
1361
|
+
status
|
|
1362
|
+
});
|
|
1363
|
+
continue;
|
|
1332
1364
|
}
|
|
1333
1365
|
const blockTimestampMs = new Date(entry.source.blockTime).getTime();
|
|
1334
1366
|
const estimatedDeliveryTimestamp = new BigNumberJS2(
|
|
@@ -1362,10 +1394,10 @@ var History = ({ signer, supportedChains }) => {
|
|
|
1362
1394
|
return () => clearInterval(timer);
|
|
1363
1395
|
}, [signer, fetchHistory, getHistory, historyLoadedOnce]);
|
|
1364
1396
|
if (!signer)
|
|
1365
|
-
return /* @__PURE__ */ jsx27("div", { className: "flex items-center justify-center w-full h-[30vh]", children: "Connect a wallet to browse history" });
|
|
1366
|
-
return /* @__PURE__ */ jsx27("div", { className: "flex items-center justify-center w-full", children: /* @__PURE__ */ jsxs8("div", { className: "w-full h-96 overflow-scroll overflow-x-hidden", children: [
|
|
1367
|
-
fetchedHistory?.length === 0 && historyLoadedOnce && /* @__PURE__ */ jsx27("div", { className: "w-full text-center py-4 px-0 text-[rgb(158,158,158)]", children: "Your history is empty..." }),
|
|
1368
|
-
!fetchedHistory && !historyLoadedOnce && /* @__PURE__ */ jsx27("div", { className: "flex w-full h-full items-center justify-center", children: /* @__PURE__ */ jsx27(CircularProgressIcon, {}) }),
|
|
1397
|
+
return /* @__PURE__ */ jsx27("div", { className: "xpay-flex xpay-items-center xpay-justify-center xpay-w-full xpay-h-[30vh]", children: "Connect a wallet to browse history" });
|
|
1398
|
+
return /* @__PURE__ */ jsx27("div", { className: "xpay-flex xpay-items-center xpay-justify-center xpay-w-full", children: /* @__PURE__ */ jsxs8("div", { className: "xpay-w-full xpay-h-96 xpay-overflow-scroll xpay-overflow-x-hidden", children: [
|
|
1399
|
+
fetchedHistory?.length === 0 && historyLoadedOnce && /* @__PURE__ */ jsx27("div", { className: "xpay-w-full xpay-text-center xpay-py-4 xpay-px-0 xpay-text-[rgb(158,158,158)]", children: "Your history is empty..." }),
|
|
1400
|
+
!fetchedHistory && !historyLoadedOnce && /* @__PURE__ */ jsx27("div", { className: "xpay-flex xpay-w-full xpay-h-full xpay-items-center xpay-justify-center", children: /* @__PURE__ */ jsx27(CircularProgressIcon, {}) }),
|
|
1369
1401
|
fetchedHistory?.map((transaction, index) => /* @__PURE__ */ jsx27(
|
|
1370
1402
|
HistoryCard,
|
|
1371
1403
|
{
|
|
@@ -1386,26 +1418,26 @@ var TopBar = ({
|
|
|
1386
1418
|
historyTabShown,
|
|
1387
1419
|
onClose
|
|
1388
1420
|
}) => {
|
|
1389
|
-
return /* @__PURE__ */ jsxs9("div", { className: "flex w-full justify-between items-center mx-auto p-2", children: [
|
|
1390
|
-
/* @__PURE__ */ jsx28("div", { className: "rounded-lg text-[rgba(255,255,255,0.6)] text-xs sm:text-base whitespace-nowrap", children: signer ? `Connected wallet: ${shortAddress(signer)}` : `Wallet disconnected` }),
|
|
1391
|
-
/* @__PURE__ */ jsxs9("div", { className: "flex gap-2 justify-center items-center", children: [
|
|
1421
|
+
return /* @__PURE__ */ jsxs9("div", { className: "xpay-flex xpay-w-full xpay-justify-between xpay-items-center xpay-mx-auto xpay-p-2", children: [
|
|
1422
|
+
/* @__PURE__ */ jsx28("div", { className: "xpay-rounded-lg xpay-text-[rgba(255,255,255,0.6)] xpay-text-xs sm:xpay-text-base xpay-whitespace-nowrap", children: signer ? `Connected wallet: ${shortAddress(signer)}` : `Wallet disconnected` }),
|
|
1423
|
+
/* @__PURE__ */ jsxs9("div", { className: "xpay-flex xpay-gap-2 xpay-justify-center xpay-items-center", children: [
|
|
1392
1424
|
!historyTabShown && /* @__PURE__ */ jsx28(
|
|
1393
1425
|
"div",
|
|
1394
1426
|
{
|
|
1395
1427
|
onClick: () => setSettingsShown(true),
|
|
1396
|
-
className: "flex items-center text-xs gap-1 cursor-pointer",
|
|
1397
|
-
children: /* @__PURE__ */ jsx28("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", children: /* @__PURE__ */ jsx28(SettingsIcon, {}) })
|
|
1428
|
+
className: "xpay-flex xpay-items-center xpay-text-xs xpay-gap-1 xpay-cursor-pointer",
|
|
1429
|
+
children: /* @__PURE__ */ jsx28("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", children: /* @__PURE__ */ jsx28(SettingsIcon, {}) })
|
|
1398
1430
|
}
|
|
1399
1431
|
),
|
|
1400
1432
|
/* @__PURE__ */ jsx28(
|
|
1401
1433
|
"div",
|
|
1402
1434
|
{
|
|
1403
1435
|
onClick: () => setHistoryTabShown((x) => !x),
|
|
1404
|
-
className: "flex items-center text-sm gap-1 cursor-pointer",
|
|
1405
|
-
children: !historyTabShown ? /* @__PURE__ */ jsx28(Fragment2, { children: /* @__PURE__ */ jsx28("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", children: /* @__PURE__ */ jsx28(HistoryIcon, {}) }) }) : /* @__PURE__ */ jsx28("div", { children: "Back" })
|
|
1436
|
+
className: "xpay-flex xpay-items-center xpay-text-sm xpay-gap-1 xpay-cursor-pointer",
|
|
1437
|
+
children: !historyTabShown ? /* @__PURE__ */ jsx28(Fragment2, { children: /* @__PURE__ */ jsx28("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", children: /* @__PURE__ */ jsx28(HistoryIcon, {}) }) }) : /* @__PURE__ */ jsx28("div", { children: "Back" })
|
|
1406
1438
|
}
|
|
1407
1439
|
),
|
|
1408
|
-
/* @__PURE__ */ jsx28("div", { className: "cursor-pointer text-white", onClick: onClose, children: /* @__PURE__ */ jsx28(CloseIcon, {}) })
|
|
1440
|
+
/* @__PURE__ */ jsx28("div", { className: "xpay-cursor-pointer xpay-text-white", onClick: onClose, children: /* @__PURE__ */ jsx28(CloseIcon, {}) })
|
|
1409
1441
|
] })
|
|
1410
1442
|
] });
|
|
1411
1443
|
};
|
|
@@ -1429,53 +1461,53 @@ var Settings = ({
|
|
|
1429
1461
|
);
|
|
1430
1462
|
}
|
|
1431
1463
|
}, [slippageActivePresetIndex, usingSlippageInput]);
|
|
1432
|
-
return /* @__PURE__ */ jsx29("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", children: /* @__PURE__ */ jsxs10("div", { className: "flex flex-col gap-4 justify-between", children: [
|
|
1433
|
-
/* @__PURE__ */ jsxs10("div", { className: "flex justify-between", children: [
|
|
1434
|
-
/* @__PURE__ */ jsx29("div", { className: "text-base", children: "Settings" }),
|
|
1464
|
+
return /* @__PURE__ */ jsx29("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", children: /* @__PURE__ */ jsxs10("div", { className: "xpay-flex xpay-flex-col xpay-gap-4 xpay-justify-between", children: [
|
|
1465
|
+
/* @__PURE__ */ jsxs10("div", { className: "xpay-flex xpay-justify-between", children: [
|
|
1466
|
+
/* @__PURE__ */ jsx29("div", { className: "xpay-text-base", children: "Settings" }),
|
|
1435
1467
|
/* @__PURE__ */ jsx29(
|
|
1436
1468
|
"div",
|
|
1437
1469
|
{
|
|
1438
|
-
className: "cursor-pointer",
|
|
1470
|
+
className: "xpay-cursor-pointer",
|
|
1439
1471
|
onClick: () => setSettingsShown(false),
|
|
1440
1472
|
children: /* @__PURE__ */ jsx29(CloseIcon, {})
|
|
1441
1473
|
}
|
|
1442
1474
|
)
|
|
1443
1475
|
] }),
|
|
1444
1476
|
/* @__PURE__ */ jsxs10("div", { children: [
|
|
1445
|
-
/* @__PURE__ */ jsxs10("div", { className: "flex gap-2 items-center", children: [
|
|
1446
|
-
/* @__PURE__ */ jsx29("div", { className: "text-sm text-[rgba(255,255,255,0.6)]", children: "Express delivery" }),
|
|
1477
|
+
/* @__PURE__ */ jsxs10("div", { className: "xpay-flex xpay-gap-2 xpay-items-center", children: [
|
|
1478
|
+
/* @__PURE__ */ jsx29("div", { className: "xpay-text-sm xpay-text-[rgba(255,255,255,0.6)]", children: "Express delivery" }),
|
|
1447
1479
|
/* @__PURE__ */ jsx29("div", { children: /* @__PURE__ */ jsxs10(
|
|
1448
1480
|
"span",
|
|
1449
1481
|
{
|
|
1450
|
-
className: "inline-flex w-14 h-9 p-3 relative align-middle box-border overflow-hidden cursor-pointer",
|
|
1482
|
+
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",
|
|
1451
1483
|
onClick: () => {
|
|
1452
1484
|
setExpressChecked((x) => !x);
|
|
1453
1485
|
},
|
|
1454
1486
|
children: [
|
|
1455
|
-
/* @__PURE__ */ jsx29("span", { className: "h-full, w-full rounded-lg bg-[rgba(255,255,255,0.3)]" }),
|
|
1487
|
+
/* @__PURE__ */ jsx29("span", { className: "xpay-h-full, xpay-w-full xpay-rounded-lg xpay-bg-[rgba(255,255,255,0.3)]" }),
|
|
1456
1488
|
/* @__PURE__ */ jsx29(
|
|
1457
1489
|
"span",
|
|
1458
1490
|
{
|
|
1459
|
-
className: `transition-all w-5 h-5 rounded-full absolute translate-y-[-4px]
|
|
1460
|
-
${expressChecked ? "translate-x-[12px] bg-x_blue" : "bg-white"} `
|
|
1491
|
+
className: `xpay-transition-all xpay-w-5 xpay-h-5 xpay-rounded-full xpay-absolute xpay-translate-y-[-4px]
|
|
1492
|
+
${expressChecked ? "xpay-translate-x-[12px] xpay-bg-x_blue" : "xpay-bg-white"} `
|
|
1461
1493
|
}
|
|
1462
1494
|
)
|
|
1463
1495
|
]
|
|
1464
1496
|
}
|
|
1465
1497
|
) })
|
|
1466
1498
|
] }),
|
|
1467
|
-
/* @__PURE__ */ jsxs10("div", { className: "flex gap-4", children: [
|
|
1468
|
-
/* @__PURE__ */ jsx29("div", { className: "min-w-[26px] min-h-[26px] text-[#ffa726]", children: /* @__PURE__ */ jsx29(InfoIcon, {}) }),
|
|
1469
|
-
/* @__PURE__ */ jsx29("div", { className: "text-xs text-left", children: "Express 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." })
|
|
1499
|
+
/* @__PURE__ */ jsxs10("div", { className: "xpay-flex xpay-gap-4", children: [
|
|
1500
|
+
/* @__PURE__ */ jsx29("div", { className: "xpay-min-w-[26px] xpay-min-h-[26px] xpay-text-[#ffa726]", children: /* @__PURE__ */ jsx29(InfoIcon, {}) }),
|
|
1501
|
+
/* @__PURE__ */ jsx29("div", { className: "xpay-text-xs xpay-text-left", children: "Express 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." })
|
|
1470
1502
|
] })
|
|
1471
1503
|
] }),
|
|
1472
|
-
/* @__PURE__ */ jsxs10("div", { className: "flex flex-col gap-2
|
|
1473
|
-
/* @__PURE__ */ jsx29("div", { className: "
|
|
1474
|
-
/* @__PURE__ */ jsxs10("div", { className: "flex gap-2", children: [
|
|
1475
|
-
/* @__PURE__ */ jsx29("div", { className: "flex items-center bg-[rgba(15,15,15,1)] p-1
|
|
1504
|
+
/* @__PURE__ */ jsxs10("div", { className: "xpay-flex xpay-flex-col xpay-gap-2", children: [
|
|
1505
|
+
/* @__PURE__ */ jsx29("div", { className: "xpay-text-[rgba(255,255,255,0.6)] xpay-text-sm", children: "Slippage" }),
|
|
1506
|
+
/* @__PURE__ */ jsxs10("div", { className: "xpay-flex xpay-gap-2", children: [
|
|
1507
|
+
/* @__PURE__ */ jsx29("div", { className: "xpay-flex xpay-items-center xpay-bg-[rgba(15,15,15,1)] p-1 xpay-global-border xpay-rounded-xl", children: SLIPPAGE_PRESETS.map((preset, index) => /* @__PURE__ */ jsx29(
|
|
1476
1508
|
"div",
|
|
1477
1509
|
{
|
|
1478
|
-
className: `transition-all cursor-pointer block rounded-lg p-2 border-none text-sm leading-[10px] ${index === slippageActivePresetIndex && !usingSlippageInput ? "text-white" : "text-[rgba(255,255,255,0.2)]"} ${index === slippageActivePresetIndex && !usingSlippageInput ? "bg-gradient-to-r from-[#3681c6] to-[#2b4a9d]" : ""}`,
|
|
1510
|
+
className: `xpay-transition-all xpay-cursor-pointer xpay-block xpay-rounded-lg xpay-p-2 xpay-border-none xpay-text-sm xpay-leading-[10px] ${index === slippageActivePresetIndex && !usingSlippageInput ? "xpay-text-white" : "xpay-text-[rgba(255,255,255,0.2)]"} ${index === slippageActivePresetIndex && !usingSlippageInput ? "xpay-bg-gradient-to-r xpay-from-[#3681c6] xpay-to-[#2b4a9d]" : ""}`,
|
|
1479
1511
|
onClick: () => {
|
|
1480
1512
|
setUsingSlippageInput(false);
|
|
1481
1513
|
setSlippageActivePresetIndex(index);
|
|
@@ -1484,11 +1516,11 @@ var Settings = ({
|
|
|
1484
1516
|
},
|
|
1485
1517
|
index
|
|
1486
1518
|
)) }),
|
|
1487
|
-
/* @__PURE__ */ jsxs10("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", children: [
|
|
1519
|
+
/* @__PURE__ */ jsxs10("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", children: [
|
|
1488
1520
|
/* @__PURE__ */ jsx29(
|
|
1489
1521
|
"input",
|
|
1490
1522
|
{
|
|
1491
|
-
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",
|
|
1523
|
+
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",
|
|
1492
1524
|
placeholder: "1.5",
|
|
1493
1525
|
value: usingSlippageInput ? slippage : "",
|
|
1494
1526
|
onChange: (e) => {
|
|
@@ -1507,9 +1539,9 @@ var Settings = ({
|
|
|
1507
1539
|
/* @__PURE__ */ jsx29(PercentageIcon, {})
|
|
1508
1540
|
] })
|
|
1509
1541
|
] }),
|
|
1510
|
-
/* @__PURE__ */ jsxs10("div", { className: "flex gap-4", children: [
|
|
1511
|
-
/* @__PURE__ */ jsx29("div", { className: "min-w-[26px] min-h-[26px] text-[#ffa726]", children: /* @__PURE__ */ jsx29(InfoIcon, {}) }),
|
|
1512
|
-
/* @__PURE__ */ jsxs10("div", { className: "text-xs text-left", children: [
|
|
1542
|
+
/* @__PURE__ */ jsxs10("div", { className: "xpay-flex xpay-gap-4", children: [
|
|
1543
|
+
/* @__PURE__ */ jsx29("div", { className: "xpay-min-w-[26px] xpay-min-h-[26px] xpay-text-[#ffa726]", children: /* @__PURE__ */ jsx29(InfoIcon, {}) }),
|
|
1544
|
+
/* @__PURE__ */ jsxs10("div", { className: "xpay-text-xs xpay-text-left", children: [
|
|
1513
1545
|
"Slippage is the price variation you are willing to accept in the event that the price of the trade changes while it is processing.",
|
|
1514
1546
|
/* @__PURE__ */ jsx29("br", {}),
|
|
1515
1547
|
" ",
|
|
@@ -1522,6 +1554,7 @@ var Settings = ({
|
|
|
1522
1554
|
};
|
|
1523
1555
|
|
|
1524
1556
|
// src/components/TxConfigForm/FeesDetails.tsx
|
|
1557
|
+
import { useMemo as useMemo2 } from "react";
|
|
1525
1558
|
import { jsx as jsx30, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
1526
1559
|
var FeesDetails = ({
|
|
1527
1560
|
isGettingRoute,
|
|
@@ -1534,12 +1567,15 @@ var FeesDetails = ({
|
|
|
1534
1567
|
feesDetailsShown,
|
|
1535
1568
|
setFeesDetailsShown
|
|
1536
1569
|
}) => {
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1570
|
+
const isExpressDeliveryPossible = useMemo2(() => {
|
|
1571
|
+
return expressChecked && !exceedsExpressDeliveryLimit;
|
|
1572
|
+
}, [expressChecked, exceedsExpressDeliveryLimit]);
|
|
1573
|
+
return /* @__PURE__ */ jsxs11("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", children: [
|
|
1574
|
+
/* @__PURE__ */ jsxs11("div", { className: "xpay-flex xpay-w-full xpay-items-center xpay-justify-between xpay-text-xs sm:xpay-text-sm", children: [
|
|
1575
|
+
/* @__PURE__ */ jsxs11("div", { className: "xpay-flex xpay-items-center xpay-gap-1 xpay-font-medium xpay-text-white xpay-opacity-60", children: [
|
|
1540
1576
|
/* @__PURE__ */ jsx30(CoinsIcon, {}),
|
|
1541
|
-
/* @__PURE__ */ jsx30("div", { className: "mr-1", children: "Fees:" }),
|
|
1542
|
-
isGettingRoute ? /* @__PURE__ */ jsx30(Skeleton, { width: "w-20", height: "h-4" }) : ` ${weiToHumanReadable({
|
|
1577
|
+
/* @__PURE__ */ jsx30("div", { className: "xpay-mr-1", children: "Fees:" }),
|
|
1578
|
+
isGettingRoute ? /* @__PURE__ */ jsx30(Skeleton, { width: "xpay-w-20", height: "xpay-h-4" }) : ` ${weiToHumanReadable({
|
|
1543
1579
|
amount: safeBigNumberFrom(
|
|
1544
1580
|
route?.xSwapFees.xSwapFee.nativeFee || "0"
|
|
1545
1581
|
).add(safeBigNumberFrom(route?.xSwapFees.ccipFee || "0")).add(
|
|
@@ -1549,14 +1585,14 @@ var FeesDetails = ({
|
|
|
1549
1585
|
precisionFractionalPlaces: 5
|
|
1550
1586
|
})} ${paymentToken?.symbol}`
|
|
1551
1587
|
] }),
|
|
1552
|
-
/* @__PURE__ */ jsxs11("div", { className: "flex gap-1 items-center", children: [
|
|
1553
|
-
/* @__PURE__ */ jsxs11(
|
|
1588
|
+
/* @__PURE__ */ jsxs11("div", { className: "xpay-flex xpay-gap-1 xpay-items-center", children: [
|
|
1589
|
+
route?.xSwapFees.expressDeliveryFee && !isGettingRoute && /* @__PURE__ */ jsxs11(
|
|
1554
1590
|
"div",
|
|
1555
1591
|
{
|
|
1556
|
-
className: `flex gap-1 items-center font-medium ${
|
|
1592
|
+
className: `xpay-flex xpay-gap-1 xpay-items-center xpay-font-medium ${isExpressDeliveryPossible ? "xpay-text-x_green" : "xpay-text-white xpay-opacity-60"}`,
|
|
1557
1593
|
children: [
|
|
1558
1594
|
/* @__PURE__ */ jsx30(TimerIcon, {}),
|
|
1559
|
-
|
|
1595
|
+
isExpressDeliveryPossible ? "Fast ~ 30sec " : "Normal ~ 30min"
|
|
1560
1596
|
]
|
|
1561
1597
|
}
|
|
1562
1598
|
),
|
|
@@ -1564,39 +1600,39 @@ var FeesDetails = ({
|
|
|
1564
1600
|
"div",
|
|
1565
1601
|
{
|
|
1566
1602
|
onClick: () => setFeesDetailsShown((x) => !x),
|
|
1567
|
-
className: "font-medium text-white opacity-60 cursor-pointer flex items-center w-[15px] h-[9px]",
|
|
1603
|
+
className: "xpay-font-medium xpay-text-white xpay-opacity-60 xpay-cursor-pointer xpay-flex xpay-items-center xpay-w-[15px] xpay-h-[9px]",
|
|
1568
1604
|
children: feesDetailsShown ? /* @__PURE__ */ jsx30(ChevronUpIcon, {}) : /* @__PURE__ */ jsx30(ChevronDownIcon, {})
|
|
1569
1605
|
}
|
|
1570
1606
|
)
|
|
1571
1607
|
] })
|
|
1572
1608
|
] }),
|
|
1573
|
-
feesDetailsShown && /* @__PURE__ */ jsxs11("div", { className: "flex w-full items-center justify-between gap-2", children: [
|
|
1574
|
-
/* @__PURE__ */ jsxs11("div", { className: "flex flex-col text-[10px] gap-1", children: [
|
|
1575
|
-
/* @__PURE__ */ jsxs11("div", { className: "flex justify-between font-medium text-white opacity-60 gap-1", children: [
|
|
1609
|
+
feesDetailsShown && /* @__PURE__ */ jsxs11("div", { className: "xpay-flex xpay-w-full xpay-items-center xpay-justify-between xpay-gap-2", children: [
|
|
1610
|
+
/* @__PURE__ */ jsxs11("div", { className: "xpay-flex xpay-flex-col xpay-text-[10px] xpay-gap-1", children: [
|
|
1611
|
+
/* @__PURE__ */ jsxs11("div", { className: "xpay-flex xpay-justify-between xpay-font-medium xpay-text-white xpay-opacity-60 xpay-gap-1", children: [
|
|
1576
1612
|
/* @__PURE__ */ jsx30("div", { children: "CCIP Fee:" }),
|
|
1577
|
-
/* @__PURE__ */ jsx30("div", { className: "whitespace-nowrap", children: ` ${weiToHumanReadable({
|
|
1613
|
+
/* @__PURE__ */ jsx30("div", { className: "xpay-whitespace-nowrap", children: ` ${weiToHumanReadable({
|
|
1578
1614
|
amount: route?.xSwapFees.ccipFee || "0",
|
|
1579
1615
|
decimals: 18,
|
|
1580
1616
|
precisionFractionalPlaces: 5
|
|
1581
1617
|
})} ${paymentToken?.symbol}` })
|
|
1582
1618
|
] }),
|
|
1583
|
-
/* @__PURE__ */ jsxs11("div", { className: "flex justify-between font-medium text-white opacity-60 gap-1", children: [
|
|
1619
|
+
/* @__PURE__ */ jsxs11("div", { className: "xpay-flex xpay-justify-between xpay-font-medium xpay-text-white xpay-opacity-60 xpay-gap-1", children: [
|
|
1584
1620
|
/* @__PURE__ */ jsx30("div", { children: "Native Fee:" }),
|
|
1585
|
-
/* @__PURE__ */ jsx30("div", { className: "whitespace-nowrap", children: ` ${weiToHumanReadable({
|
|
1621
|
+
/* @__PURE__ */ jsx30("div", { className: "xpay-whitespace-nowrap", children: ` ${weiToHumanReadable({
|
|
1586
1622
|
amount: route?.xSwapFees.xSwapFee.nativeFee || "0",
|
|
1587
1623
|
decimals: 18,
|
|
1588
1624
|
precisionFractionalPlaces: 5
|
|
1589
1625
|
})} ${paymentToken?.symbol}` })
|
|
1590
1626
|
] })
|
|
1591
1627
|
] }),
|
|
1592
|
-
/* @__PURE__ */ jsxs11("div", { className: "flex flex-col text-[10px] gap-1", children: [
|
|
1593
|
-
/* @__PURE__ */ jsxs11("div", { className: "flex justify-between font-medium text-white opacity-60 gap-1", children: [
|
|
1628
|
+
/* @__PURE__ */ jsxs11("div", { className: "xpay-flex xpay-flex-col xpay-text-[10px] xpay-gap-1", children: [
|
|
1629
|
+
/* @__PURE__ */ jsxs11("div", { className: "xpay-flex xpay-justify-between xpay-font-medium xpay-text-white xpay-opacity-60 xpay-gap-1", children: [
|
|
1594
1630
|
/* @__PURE__ */ jsx30("div", { children: "Slippage:" }),
|
|
1595
|
-
/* @__PURE__ */ jsx30("div", { className: "whitespace-nowrap", children: `${slippage}%` })
|
|
1631
|
+
/* @__PURE__ */ jsx30("div", { className: "xpay-whitespace-nowrap", children: `${slippage}%` })
|
|
1596
1632
|
] }),
|
|
1597
|
-
/* @__PURE__ */ jsxs11("div", { className: "flex justify-between font-medium text-white opacity-60 gap-1", children: [
|
|
1633
|
+
/* @__PURE__ */ jsxs11("div", { className: "xpay-flex xpay-justify-between xpay-font-medium xpay-text-white xpay-opacity-60 xpay-gap-1", children: [
|
|
1598
1634
|
/* @__PURE__ */ jsx30("div", { children: "Min amount out:" }),
|
|
1599
|
-
/* @__PURE__ */ jsxs11("div", { className: "whitespace-nowrap", children: [
|
|
1635
|
+
/* @__PURE__ */ jsxs11("div", { className: "xpay-whitespace-nowrap", children: [
|
|
1600
1636
|
weiToHumanReadable({
|
|
1601
1637
|
amount: route?.minAmountOut || "0",
|
|
1602
1638
|
decimals: dstToken?.decimals || 18,
|
|
@@ -1612,7 +1648,7 @@ var FeesDetails = ({
|
|
|
1612
1648
|
};
|
|
1613
1649
|
|
|
1614
1650
|
// src/components/TxConfigForm/Summary.tsx
|
|
1615
|
-
import { useEffect as useEffect5, useMemo as
|
|
1651
|
+
import { useEffect as useEffect5, useMemo as useMemo4, useState as useState5 } from "react";
|
|
1616
1652
|
|
|
1617
1653
|
// src/components/TxConfigForm/UsdPrice.tsx
|
|
1618
1654
|
import { useEffect as useEffect4, useState as useState4 } from "react";
|
|
@@ -1637,11 +1673,23 @@ var UsdPrice = ({
|
|
|
1637
1673
|
setUsdPrice(newUsdPrice);
|
|
1638
1674
|
}
|
|
1639
1675
|
}, [token, prices, amount]);
|
|
1640
|
-
return /* @__PURE__ */ jsx31("div", { className: "opacity-60 py-4", children: loading ? /* @__PURE__ */ jsx31(Skeleton, { width: "w-12", height: "h-4" }) : token ? prices && prices[token.address] ? /* @__PURE__ */ jsx31("div", { children: `$${usdPrice}` }) : /* @__PURE__ */ jsx31(Alert, { desc: "Unknown price" }) : /* @__PURE__ */ jsx31(Fragment3, { children: "$0.00" }) });
|
|
1676
|
+
return /* @__PURE__ */ jsx31("div", { className: "xpay-opacity-60 xpay-py-4", children: loading ? /* @__PURE__ */ jsx31(Skeleton, { width: "xpay-w-12", height: "xpay-h-4" }) : token ? prices && prices[token.address] ? /* @__PURE__ */ jsx31("div", { children: `$${usdPrice}` }) : /* @__PURE__ */ jsx31(Alert, { desc: "Unknown price" }) : /* @__PURE__ */ jsx31(Fragment3, { children: "$0.00" }) });
|
|
1677
|
+
};
|
|
1678
|
+
|
|
1679
|
+
// src/components/UnknownTokenLogo/UnknownTokenLogo.tsx
|
|
1680
|
+
import { jsx as jsx32 } from "react/jsx-runtime";
|
|
1681
|
+
var UnknownTokenLogo = ({ tokenName, className }) => {
|
|
1682
|
+
return /* @__PURE__ */ jsx32(
|
|
1683
|
+
"div",
|
|
1684
|
+
{
|
|
1685
|
+
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}`,
|
|
1686
|
+
children: tokenName.substring(0, 1)
|
|
1687
|
+
}
|
|
1688
|
+
);
|
|
1641
1689
|
};
|
|
1642
1690
|
|
|
1643
1691
|
// src/components/TxConfigForm/Summary.tsx
|
|
1644
|
-
import { jsx as
|
|
1692
|
+
import { jsx as jsx33, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
1645
1693
|
var Summary = ({
|
|
1646
1694
|
isGettingRoute,
|
|
1647
1695
|
route,
|
|
@@ -1649,7 +1697,7 @@ var Summary = ({
|
|
|
1649
1697
|
dstChain
|
|
1650
1698
|
}) => {
|
|
1651
1699
|
const [prices, setPrices] = useState5();
|
|
1652
|
-
const amountReadable =
|
|
1700
|
+
const amountReadable = useMemo4(
|
|
1653
1701
|
() => weiToHumanReadable({
|
|
1654
1702
|
amount: route?.estAmountOut || "0",
|
|
1655
1703
|
decimals: dstToken?.decimals || 18,
|
|
@@ -1664,34 +1712,44 @@ var Summary = ({
|
|
|
1664
1712
|
);
|
|
1665
1713
|
}
|
|
1666
1714
|
}, [dstChain]);
|
|
1667
|
-
return /* @__PURE__ */ jsxs12("div", { className: "flex flex-col
|
|
1668
|
-
/* @__PURE__ */ jsxs12("div", { className: "flex justify-between", children: [
|
|
1669
|
-
/* @__PURE__ */ jsxs12("div", { className: "flex flex-col gap-1", children: [
|
|
1670
|
-
/* @__PURE__ */
|
|
1671
|
-
isGettingRoute ? /* @__PURE__ */
|
|
1715
|
+
return /* @__PURE__ */ jsxs12("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", children: [
|
|
1716
|
+
/* @__PURE__ */ jsxs12("div", { className: "xpay-flex xpay-justify-between", children: [
|
|
1717
|
+
/* @__PURE__ */ jsxs12("div", { className: "xpay-flex xpay-flex-col xpay-gap-1", children: [
|
|
1718
|
+
/* @__PURE__ */ jsx33("p", { className: "xpay-text-[rgba(255,255,255,0.6)] xpay-text-sm", children: "You receive" }),
|
|
1719
|
+
isGettingRoute ? /* @__PURE__ */ jsx33(
|
|
1672
1720
|
Skeleton,
|
|
1673
1721
|
{
|
|
1674
|
-
width: "w-[100px]",
|
|
1675
|
-
height: "h-[36px]",
|
|
1676
|
-
other: "sm:w-[190px]"
|
|
1722
|
+
width: "xpay-w-[100px]",
|
|
1723
|
+
height: "xpay-h-[36px]",
|
|
1724
|
+
other: "sm:xpay-w-[190px]"
|
|
1677
1725
|
}
|
|
1678
|
-
) : /* @__PURE__ */
|
|
1726
|
+
) : /* @__PURE__ */ jsx33("div", { className: "xpay-flex xpay-gap-2 xpay-items-center xpay-text-white xpay-text-xl sm:xpay-text-3xl", children: amountReadable })
|
|
1679
1727
|
] }),
|
|
1680
|
-
/* @__PURE__ */ jsxs12("div", { className: "flex flex-col items-end gap-1 text-sm", children: [
|
|
1681
|
-
/* @__PURE__ */ jsxs12("div", { className: "flex justify-center items-center gap-1", children: [
|
|
1682
|
-
/* @__PURE__ */
|
|
1683
|
-
|
|
1728
|
+
/* @__PURE__ */ jsxs12("div", { className: "xpay-flex xpay-flex-col xpay-items-end xpay-gap-1 xpay-text-sm", children: [
|
|
1729
|
+
/* @__PURE__ */ jsxs12("div", { className: "xpay-flex xpay-justify-center xpay-items-center xpay-gap-1", children: [
|
|
1730
|
+
/* @__PURE__ */ jsx33("div", { className: "xpay-w-5 xpay-h-5", children: dstToken?.image ? /* @__PURE__ */ jsx33(
|
|
1731
|
+
"img",
|
|
1732
|
+
{
|
|
1733
|
+
className: "xpay-w-5 xpay-h-5",
|
|
1734
|
+
src: dstToken?.image,
|
|
1735
|
+
alt: dstToken?.name
|
|
1736
|
+
}
|
|
1737
|
+
) : /* @__PURE__ */ jsx33(UnknownTokenLogo, { tokenName: "?" }) }),
|
|
1738
|
+
/* @__PURE__ */ jsx33("p", { className: "xpay-text-base sm:xpay-text-xl", children: dstToken?.name })
|
|
1684
1739
|
] }),
|
|
1685
|
-
/* @__PURE__ */ jsxs12("div", { className: "flex justify-center items-center gap-1", children: [
|
|
1686
|
-
/* @__PURE__ */
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1740
|
+
/* @__PURE__ */ jsxs12("div", { className: "xpay-flex xpay-justify-center xpay-items-center xpay-gap-1", children: [
|
|
1741
|
+
/* @__PURE__ */ jsxs12("p", { className: "xpay-text-[rgba(255,255,255,0.6)] xpay-text-right", children: [
|
|
1742
|
+
"on",
|
|
1743
|
+
" "
|
|
1744
|
+
] }),
|
|
1745
|
+
/* @__PURE__ */ jsxs12("div", { className: "xpay-flex xpay-items-center xpay-gap-1 xpay-text-white", children: [
|
|
1746
|
+
/* @__PURE__ */ jsx33("div", { className: "xpay-w-4 xpay-h-4", children: /* @__PURE__ */ jsx33("img", { src: dstChain?.image, alt: dstChain?.name }) }),
|
|
1747
|
+
/* @__PURE__ */ jsx33("div", { children: dstChain?.displayName })
|
|
1690
1748
|
] })
|
|
1691
1749
|
] })
|
|
1692
1750
|
] })
|
|
1693
1751
|
] }),
|
|
1694
|
-
/* @__PURE__ */
|
|
1752
|
+
/* @__PURE__ */ jsx33(
|
|
1695
1753
|
UsdPrice,
|
|
1696
1754
|
{
|
|
1697
1755
|
prices,
|
|
@@ -1701,17 +1759,17 @@ var Summary = ({
|
|
|
1701
1759
|
type: "dst"
|
|
1702
1760
|
}
|
|
1703
1761
|
),
|
|
1704
|
-
/* @__PURE__ */
|
|
1762
|
+
/* @__PURE__ */ jsx33("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)]", children: /* @__PURE__ */ jsx33("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)] ", children: /* @__PURE__ */ jsx33(ArrowDownIcon, {}) }) })
|
|
1705
1763
|
] });
|
|
1706
1764
|
};
|
|
1707
1765
|
|
|
1708
1766
|
// src/components/TxConfigForm/SwapPanel.tsx
|
|
1709
|
-
import { useState as useState7, useEffect as useEffect6, useRef as useRef2, useMemo as
|
|
1767
|
+
import { useState as useState7, useEffect as useEffect6, useRef as useRef2, useMemo as useMemo7 } from "react";
|
|
1710
1768
|
|
|
1711
1769
|
// src/components/TxConfigForm/TokenPicker.tsx
|
|
1712
|
-
import { useState as useState6, useMemo as
|
|
1770
|
+
import { useState as useState6, useMemo as useMemo5 } from "react";
|
|
1713
1771
|
import { createPortal } from "react-dom";
|
|
1714
|
-
import { Fragment as Fragment4, jsx as
|
|
1772
|
+
import { Fragment as Fragment4, jsx as jsx34, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
1715
1773
|
var TokenPicker = ({
|
|
1716
1774
|
onCloseClick,
|
|
1717
1775
|
tokens,
|
|
@@ -1721,7 +1779,6 @@ var TokenPicker = ({
|
|
|
1721
1779
|
balances
|
|
1722
1780
|
}) => {
|
|
1723
1781
|
const [searchValue, setSearchValue] = useState6("");
|
|
1724
|
-
const modalRoot = document.querySelector("#xswap-modal");
|
|
1725
1782
|
const onBackdropClick = (e) => {
|
|
1726
1783
|
e.stopPropagation();
|
|
1727
1784
|
e.nativeEvent.stopImmediatePropagation();
|
|
@@ -1729,7 +1786,7 @@ var TokenPicker = ({
|
|
|
1729
1786
|
onCloseClick();
|
|
1730
1787
|
}
|
|
1731
1788
|
};
|
|
1732
|
-
const filteredTokens =
|
|
1789
|
+
const filteredTokens = useMemo5(() => {
|
|
1733
1790
|
const isMatch = (value, searchValue2) => value.toLowerCase().indexOf(searchValue2.toLowerCase()) > -1;
|
|
1734
1791
|
return tokens?.filter(
|
|
1735
1792
|
(token) => isMatch(token.symbol, searchValue) || isMatch(token.name, searchValue) || token.address === searchValue.toLowerCase()
|
|
@@ -1737,91 +1794,92 @@ var TokenPicker = ({
|
|
|
1737
1794
|
(a, b) => a.priority < b.priority ? 1 : balances && balances[a.address] && balances[b.address] && balances[a.address]?.lte(balances[b.address] || "0") ? 1 : -1
|
|
1738
1795
|
);
|
|
1739
1796
|
}, [searchValue, tokens]);
|
|
1740
|
-
|
|
1741
|
-
|
|
1797
|
+
const xpayRoot2 = document.querySelector("#xpay-root");
|
|
1798
|
+
return xpayRoot2 ? createPortal(
|
|
1799
|
+
/* @__PURE__ */ jsx34(
|
|
1742
1800
|
"div",
|
|
1743
1801
|
{
|
|
1744
1802
|
onClick: onBackdropClick,
|
|
1745
|
-
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",
|
|
1746
|
-
children: /* @__PURE__ */ jsxs13("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)]", children: [
|
|
1747
|
-
/* @__PURE__ */
|
|
1803
|
+
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",
|
|
1804
|
+
children: /* @__PURE__ */ jsxs13("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)]", children: [
|
|
1805
|
+
/* @__PURE__ */ jsx34(
|
|
1748
1806
|
"div",
|
|
1749
1807
|
{
|
|
1750
1808
|
onClick: onCloseClick,
|
|
1751
|
-
className: "absolute top-4 right-4 cursor-pointer",
|
|
1752
|
-
children: /* @__PURE__ */
|
|
1809
|
+
className: "xpay-absolute xpay-top-4 xpay-right-4 xpay-cursor-pointer",
|
|
1810
|
+
children: /* @__PURE__ */ jsx34(CloseIcon, {})
|
|
1753
1811
|
}
|
|
1754
1812
|
),
|
|
1755
|
-
/* @__PURE__ */
|
|
1756
|
-
/* @__PURE__ */ jsxs13("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)]", children: [
|
|
1757
|
-
/* @__PURE__ */
|
|
1758
|
-
/* @__PURE__ */
|
|
1813
|
+
/* @__PURE__ */ jsx34("p", { className: "xpay-text-base xpay-mb-4", children: "Pick a token" }),
|
|
1814
|
+
/* @__PURE__ */ jsxs13("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)]", children: [
|
|
1815
|
+
/* @__PURE__ */ jsx34("div", { className: "xpay-w-6 xpay-h-6", children: /* @__PURE__ */ jsx34(SearchIcon, {}) }),
|
|
1816
|
+
/* @__PURE__ */ jsx34(
|
|
1759
1817
|
"input",
|
|
1760
1818
|
{
|
|
1761
1819
|
placeholder: "Search name or paste address",
|
|
1762
1820
|
value: searchValue,
|
|
1763
1821
|
onChange: (e) => setSearchValue(e.target.value),
|
|
1764
|
-
className: "relative h-[41px] leading-[41px] font-normal z-[1] w-full text-white bg-transparent border-none outline-none placeholder:text-sm"
|
|
1822
|
+
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"
|
|
1765
1823
|
}
|
|
1766
1824
|
)
|
|
1767
1825
|
] }),
|
|
1768
|
-
/* @__PURE__ */
|
|
1826
|
+
/* @__PURE__ */ jsx34("div", { className: "xpay-my-4 xpay-mx-0 xpay-flex xpay-flex-wrap xpay-gap-3", children: tokens?.filter((token) => token?.quickPick).map((token) => /* @__PURE__ */ jsxs13(
|
|
1769
1827
|
"div",
|
|
1770
1828
|
{
|
|
1771
|
-
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 ${token.address === selectedToken?.address ? "bg-[rgb(35, 35, 35)]" : ""}`,
|
|
1829
|
+
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 ${token.address === selectedToken?.address ? "xpay-bg-[rgb(35, 35, 35)]" : ""}`,
|
|
1772
1830
|
onClick: () => {
|
|
1773
1831
|
setSelectedToken(token);
|
|
1774
1832
|
onCloseClick();
|
|
1775
1833
|
},
|
|
1776
1834
|
children: [
|
|
1777
|
-
/* @__PURE__ */
|
|
1778
|
-
|
|
1835
|
+
/* @__PURE__ */ jsx34(
|
|
1836
|
+
"img",
|
|
1837
|
+
{
|
|
1838
|
+
src: token.image,
|
|
1839
|
+
alt: token.name,
|
|
1840
|
+
className: "xpay-w-5"
|
|
1841
|
+
}
|
|
1842
|
+
),
|
|
1843
|
+
/* @__PURE__ */ jsx34("div", { className: "xpay-text-sm", children: token.symbol })
|
|
1779
1844
|
]
|
|
1780
1845
|
},
|
|
1781
1846
|
token.address
|
|
1782
1847
|
)) }),
|
|
1783
|
-
/* @__PURE__ */
|
|
1784
|
-
/* @__PURE__ */
|
|
1848
|
+
/* @__PURE__ */ jsx34("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)]" }),
|
|
1849
|
+
/* @__PURE__ */ jsx34("div", { className: "xpay-overflow-y-scroll xpay-h-full xpay-mx-[-24px] xpay-w-[100%+48px] xpay-flex xpay-flex-col", children: filteredTokens && filteredTokens.length > 0 ? filteredTokens.map((token, index) => /* @__PURE__ */ jsxs13(
|
|
1785
1850
|
"div",
|
|
1786
1851
|
{
|
|
1787
|
-
className: `flex gap-3 py-2 px-[24px] w-full items-center hover:bg-[rgb(25,25,25)] hover:cursor-pointer ${token.address === selectedToken?.address ? "bg-[rgb(35,35,35)]" : ""}`,
|
|
1852
|
+
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 ${token.address === selectedToken?.address ? "xpay-bg-[rgb(35,35,35)]" : ""}`,
|
|
1788
1853
|
onClick: () => {
|
|
1789
1854
|
setSelectedToken(token);
|
|
1790
1855
|
onCloseClick();
|
|
1791
1856
|
},
|
|
1792
1857
|
children: [
|
|
1793
|
-
token.image ? /* @__PURE__ */
|
|
1794
|
-
|
|
1795
|
-
{
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
className: "token-picker__all__logo"
|
|
1799
|
-
}
|
|
1800
|
-
) : /* @__PURE__ */ jsx33("div", { className: "flex items-center justify-center w-9 h-9 text-[15px] ml-1 rounded-full bg-[#272e40] text-[#e0e7fa]", children: token?.symbol.substring(0, 1) }),
|
|
1801
|
-
/* @__PURE__ */ jsxs13("div", { className: "flex justify-between items-center gap-1 overflow-hidden grow", children: [
|
|
1802
|
-
/* @__PURE__ */ jsxs13("div", { className: "flex flex-col leading-[16px]", children: [
|
|
1803
|
-
/* @__PURE__ */ jsx33("div", { className: "overflow-hidden whitespace-nowrap text-ellipsis text-[15px]", children: token.name }),
|
|
1804
|
-
/* @__PURE__ */ jsx33("div", { className: "text-[#888] text-[11px]", children: token.symbol })
|
|
1858
|
+
token.image ? /* @__PURE__ */ jsx34("img", { src: token.image, alt: token.name }) : /* @__PURE__ */ jsx34("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]", children: token?.symbol.substring(0, 1) }),
|
|
1859
|
+
/* @__PURE__ */ jsxs13("div", { className: "xpay-flex xpay-justify-between xpay-items-center xpay-gap-1 xpay-overflow-hidden xpay-grow", children: [
|
|
1860
|
+
/* @__PURE__ */ jsxs13("div", { className: "xpay-flex xpay-flex-col xpay-leading-[16px]", children: [
|
|
1861
|
+
/* @__PURE__ */ jsx34("div", { className: "xpay-overflow-hidden xpay-whitespace-nowrap xpay-text-ellipsis xpay-text-[15px]", children: token.name }),
|
|
1862
|
+
/* @__PURE__ */ jsx34("div", { className: "xpay-text-[#888] xpay-text-[11px]", children: token.symbol })
|
|
1805
1863
|
] }),
|
|
1806
|
-
signer && /* @__PURE__ */
|
|
1864
|
+
signer && /* @__PURE__ */ jsx34(Fragment4, { children: balances && balances[token.address] && token.decimals ? /* @__PURE__ */ jsx34("div", { className: "xpay-text-xs", children: weiToHumanReadable({
|
|
1807
1865
|
amount: balances[token.address]?.toString() || "0",
|
|
1808
1866
|
decimals: token.decimals,
|
|
1809
1867
|
precisionFractionalPlaces: 4
|
|
1810
|
-
}) }) : /* @__PURE__ */
|
|
1868
|
+
}) }) : /* @__PURE__ */ jsx34(Skeleton, { width: "xpay-w-12", height: "xpay-h-3" }) })
|
|
1811
1869
|
] })
|
|
1812
1870
|
]
|
|
1813
1871
|
},
|
|
1814
1872
|
`${index}_${token.address}`
|
|
1815
|
-
)) : /* @__PURE__ */
|
|
1873
|
+
)) : /* @__PURE__ */ jsx34("div", { className: "xpay-mt-4 xpay-flex xpay-justify-center", children: /* @__PURE__ */ jsx34("p", { className: "xpay-text-sm xpay-text-white", children: "No tokens found." }) }) })
|
|
1816
1874
|
] })
|
|
1817
1875
|
}
|
|
1818
1876
|
),
|
|
1819
|
-
|
|
1877
|
+
xpayRoot2
|
|
1820
1878
|
) : null;
|
|
1821
1879
|
};
|
|
1822
1880
|
|
|
1823
1881
|
// src/components/TxConfigForm/ChainListElement.tsx
|
|
1824
|
-
import { jsx as
|
|
1882
|
+
import { jsx as jsx35, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
1825
1883
|
var ChainListElement = ({
|
|
1826
1884
|
chain,
|
|
1827
1885
|
setSrcChain,
|
|
@@ -1833,27 +1891,27 @@ var ChainListElement = ({
|
|
|
1833
1891
|
/* @__PURE__ */ jsxs14(
|
|
1834
1892
|
"li",
|
|
1835
1893
|
{
|
|
1836
|
-
className: "bg-transparent border-none flex gap-1 items-center cursor-pointer py-2 w-full",
|
|
1894
|
+
className: "xpay-bg-transparent xpay-border-none xpay-flex xpay-gap-1 xpay-items-center xpay-cursor-pointer xpay-py-2 xpay-w-full",
|
|
1837
1895
|
onClick: () => {
|
|
1838
1896
|
setSrcChain(chain);
|
|
1839
1897
|
setChainListShown(false);
|
|
1840
1898
|
},
|
|
1841
1899
|
children: [
|
|
1842
|
-
/* @__PURE__ */
|
|
1900
|
+
/* @__PURE__ */ jsx35("img", { width: 12, height: 12, src: chain.image, alt: chain.displayName }),
|
|
1843
1901
|
chain.displayName
|
|
1844
1902
|
]
|
|
1845
1903
|
}
|
|
1846
1904
|
),
|
|
1847
|
-
index !== length - 1 && /* @__PURE__ */
|
|
1905
|
+
index !== length - 1 && /* @__PURE__ */ jsx35("div", { className: "xpay-h-px xpay-mx-2 xpay-bg-[rgba(255,255,255,0.15)]" })
|
|
1848
1906
|
] }, `${chain.ecosystem}-${chain.chainId}`);
|
|
1849
1907
|
};
|
|
1850
1908
|
|
|
1851
1909
|
// src/components/TxConfigForm/BalanceComponent.tsx
|
|
1852
|
-
import { useMemo as
|
|
1910
|
+
import { useMemo as useMemo6 } from "react";
|
|
1853
1911
|
import BigNumber3 from "bignumber.js";
|
|
1854
|
-
import { Fragment as Fragment5, jsx as
|
|
1912
|
+
import { Fragment as Fragment5, jsx as jsx36, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
1855
1913
|
var BalanceComponent = ({ srcToken, balances }) => {
|
|
1856
|
-
const balanceText =
|
|
1914
|
+
const balanceText = useMemo6(() => {
|
|
1857
1915
|
if (!balances || !srcToken) return "0";
|
|
1858
1916
|
if (balances[srcToken.address]?.toString() === "0") return "0";
|
|
1859
1917
|
const fullHumanReadable = weiToHumanReadable({
|
|
@@ -1879,12 +1937,12 @@ var BalanceComponent = ({ srcToken, balances }) => {
|
|
|
1879
1937
|
decimals: srcToken.decimals,
|
|
1880
1938
|
precisionFractionalPlaces: 4
|
|
1881
1939
|
}) : 0,
|
|
1882
|
-
/* @__PURE__ */
|
|
1940
|
+
/* @__PURE__ */ jsx36("span", { className: "xpay-bg-gradient-to-r xpay-from-x_blue_light xpay-to-x_blue_dark xpay-bg-clip-text xpay-text-transparent", children: "Max" })
|
|
1883
1941
|
] });
|
|
1884
1942
|
};
|
|
1885
1943
|
|
|
1886
1944
|
// src/components/TxConfigForm/SwapPanel.tsx
|
|
1887
|
-
import { jsx as
|
|
1945
|
+
import { jsx as jsx37, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
1888
1946
|
var SwapPanel = ({
|
|
1889
1947
|
amount,
|
|
1890
1948
|
setAmount,
|
|
@@ -1916,7 +1974,7 @@ var SwapPanel = ({
|
|
|
1916
1974
|
weiToHumanReadable({
|
|
1917
1975
|
amount: balances[srcToken.address]?.toString() || "0",
|
|
1918
1976
|
decimals: srcToken.decimals,
|
|
1919
|
-
precisionFractionalPlaces:
|
|
1977
|
+
precisionFractionalPlaces: srcToken.decimals
|
|
1920
1978
|
})
|
|
1921
1979
|
);
|
|
1922
1980
|
};
|
|
@@ -1926,18 +1984,18 @@ var SwapPanel = ({
|
|
|
1926
1984
|
return () => document.removeEventListener("mousedown", handleClickOutside);
|
|
1927
1985
|
}
|
|
1928
1986
|
}, [chainListShown]);
|
|
1929
|
-
const chainListOptions =
|
|
1987
|
+
const chainListOptions = useMemo7(
|
|
1930
1988
|
() => supportedChains.filter((chain) => chain.chainId !== srcChain?.chainId),
|
|
1931
1989
|
[supportedChains, srcChain]
|
|
1932
1990
|
);
|
|
1933
|
-
return /* @__PURE__ */ jsxs16("div", { className: "flex justify-between
|
|
1934
|
-
/* @__PURE__ */ jsxs16("div", { className: "flex flex-col justify-between gap-2 overflow-hidden w-1/2", children: [
|
|
1935
|
-
/* @__PURE__ */ jsxs16("div", { className: "flex flex-col gap-1", children: [
|
|
1936
|
-
/* @__PURE__ */
|
|
1937
|
-
/* @__PURE__ */
|
|
1991
|
+
return /* @__PURE__ */ jsxs16("div", { className: "xpay-flex xpay-justify-between xpay-global-border xpay-rounded-lg xpay-bg-[rgba(15,15,15,1)] xpay-p-4", children: [
|
|
1992
|
+
/* @__PURE__ */ jsxs16("div", { className: "xpay-flex xpay-flex-col xpay-justify-between xpay-gap-2 xpay-overflow-hidden xpay-w-1/2", children: [
|
|
1993
|
+
/* @__PURE__ */ jsxs16("div", { className: "xpay-flex xpay-flex-col xpay-gap-1", children: [
|
|
1994
|
+
/* @__PURE__ */ jsx37("p", { className: "xpay-text-white xpay-opacity-60 xpay-text-xs sm:xpay-text-sm xpay-font-medium", children: "You pay" }),
|
|
1995
|
+
/* @__PURE__ */ jsx37(
|
|
1938
1996
|
"input",
|
|
1939
1997
|
{
|
|
1940
|
-
className: "p-0 border-none outline-none bg-transparent text-2xl overflow-ellipsis",
|
|
1998
|
+
className: "xpay-p-0 xpay-border-none xpay-outline-none xpay-bg-transparent xpay-text-2xl xpay-overflow-ellipsis",
|
|
1941
1999
|
value: amount,
|
|
1942
2000
|
onChange: (e) => {
|
|
1943
2001
|
if (e.target.value === ".") return;
|
|
@@ -1953,7 +2011,7 @@ var SwapPanel = ({
|
|
|
1953
2011
|
}
|
|
1954
2012
|
)
|
|
1955
2013
|
] }),
|
|
1956
|
-
/* @__PURE__ */
|
|
2014
|
+
/* @__PURE__ */ jsx37("div", { className: "xpay-flex xpay-items-center xpay-text-sm xpay-text-[rgba(255,255,255,0.6)]", children: /* @__PURE__ */ jsx37(
|
|
1957
2015
|
UsdPrice,
|
|
1958
2016
|
{
|
|
1959
2017
|
prices,
|
|
@@ -1965,16 +2023,16 @@ var SwapPanel = ({
|
|
|
1965
2023
|
}
|
|
1966
2024
|
) })
|
|
1967
2025
|
] }),
|
|
1968
|
-
/* @__PURE__ */ jsxs16("div", { className: "flex flex-col relative items-end gap-2.5 w-1/2 text-xs", children: [
|
|
2026
|
+
/* @__PURE__ */ jsxs16("div", { className: "xpay-flex xpay-flex-col xpay-relative xpay-items-end xpay-gap-2.5 xpay-w-1/2 xpay-text-xs", children: [
|
|
1969
2027
|
/* @__PURE__ */ jsxs16(
|
|
1970
2028
|
"div",
|
|
1971
2029
|
{
|
|
1972
|
-
className: "flex gap-2 items-center p-2 max-w-full cursor-pointer bg-black text-white
|
|
2030
|
+
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",
|
|
1973
2031
|
onClick: () => {
|
|
1974
2032
|
setTokenListShown((state) => !state);
|
|
1975
2033
|
},
|
|
1976
2034
|
children: [
|
|
1977
|
-
/* @__PURE__ */
|
|
2035
|
+
/* @__PURE__ */ jsx37(
|
|
1978
2036
|
"img",
|
|
1979
2037
|
{
|
|
1980
2038
|
height: 16,
|
|
@@ -1983,12 +2041,12 @@ var SwapPanel = ({
|
|
|
1983
2041
|
alt: srcToken?.name
|
|
1984
2042
|
}
|
|
1985
2043
|
),
|
|
1986
|
-
/* @__PURE__ */
|
|
1987
|
-
/* @__PURE__ */
|
|
2044
|
+
/* @__PURE__ */ jsx37("div", { children: srcToken?.symbol }),
|
|
2045
|
+
/* @__PURE__ */ jsx37(DownArrowIcon, {})
|
|
1988
2046
|
]
|
|
1989
2047
|
}
|
|
1990
2048
|
),
|
|
1991
|
-
tokenListShown && /* @__PURE__ */
|
|
2049
|
+
tokenListShown && /* @__PURE__ */ jsx37(
|
|
1992
2050
|
TokenPicker,
|
|
1993
2051
|
{
|
|
1994
2052
|
onCloseClick: () => setTokenListShown(false),
|
|
@@ -1999,22 +2057,22 @@ var SwapPanel = ({
|
|
|
1999
2057
|
balances
|
|
2000
2058
|
}
|
|
2001
2059
|
),
|
|
2002
|
-
/* @__PURE__ */
|
|
2060
|
+
/* @__PURE__ */ jsx37(
|
|
2003
2061
|
"div",
|
|
2004
2062
|
{
|
|
2005
2063
|
onClick: handleMaxClick,
|
|
2006
|
-
className: "flex gap-1 items-center font-medium text-white opacity-60 py-0.5 cursor-pointer",
|
|
2007
|
-
children: signer && /* @__PURE__ */
|
|
2064
|
+
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",
|
|
2065
|
+
children: signer && /* @__PURE__ */ jsx37(BalanceComponent, { balances, srcToken })
|
|
2008
2066
|
}
|
|
2009
2067
|
),
|
|
2010
2068
|
/* @__PURE__ */ jsxs16(
|
|
2011
2069
|
"div",
|
|
2012
2070
|
{
|
|
2013
2071
|
ref: buttonRef,
|
|
2014
|
-
className: "bg-black
|
|
2072
|
+
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",
|
|
2015
2073
|
onClick: () => setChainListShown((prev) => !prev),
|
|
2016
2074
|
children: [
|
|
2017
|
-
/* @__PURE__ */
|
|
2075
|
+
/* @__PURE__ */ jsx37(
|
|
2018
2076
|
"img",
|
|
2019
2077
|
{
|
|
2020
2078
|
width: "16",
|
|
@@ -2023,17 +2081,17 @@ var SwapPanel = ({
|
|
|
2023
2081
|
alt: srcChain?.name
|
|
2024
2082
|
}
|
|
2025
2083
|
),
|
|
2026
|
-
/* @__PURE__ */
|
|
2027
|
-
/* @__PURE__ */
|
|
2084
|
+
/* @__PURE__ */ jsx37("div", { children: srcChain?.displayName }),
|
|
2085
|
+
/* @__PURE__ */ jsx37(DownArrowIcon, {})
|
|
2028
2086
|
]
|
|
2029
2087
|
}
|
|
2030
2088
|
),
|
|
2031
|
-
chainListShown && /* @__PURE__ */
|
|
2089
|
+
chainListShown && /* @__PURE__ */ jsx37(
|
|
2032
2090
|
"ul",
|
|
2033
2091
|
{
|
|
2034
2092
|
ref: listRef,
|
|
2035
|
-
className: "bg-black
|
|
2036
|
-
children: chainListOptions.map((chain, index) => /* @__PURE__ */
|
|
2093
|
+
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",
|
|
2094
|
+
children: chainListOptions.map((chain, index) => /* @__PURE__ */ jsx37(
|
|
2037
2095
|
ChainListElement,
|
|
2038
2096
|
{
|
|
2039
2097
|
index,
|
|
@@ -2050,30 +2108,30 @@ var SwapPanel = ({
|
|
|
2050
2108
|
};
|
|
2051
2109
|
|
|
2052
2110
|
// src/components/TxConfigForm/ErrorField.tsx
|
|
2053
|
-
import { jsx as
|
|
2111
|
+
import { jsx as jsx38 } from "react/jsx-runtime";
|
|
2054
2112
|
var ErrorField = ({ error }) => {
|
|
2055
|
-
return /* @__PURE__ */
|
|
2113
|
+
return /* @__PURE__ */ jsx38(
|
|
2056
2114
|
"div",
|
|
2057
2115
|
{
|
|
2058
|
-
className: `flex justify-center mb-1 items-center w-full rounded-2xl bg-x_error_background border border-solid ${error.length > 0 ? "border-x_error_border" : "border-transparent"}`,
|
|
2116
|
+
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 ${error.length > 0 ? "xpay-border-x_error_border" : "xpay-border-transparent"}`,
|
|
2059
2117
|
children: error
|
|
2060
2118
|
}
|
|
2061
2119
|
);
|
|
2062
2120
|
};
|
|
2063
2121
|
|
|
2064
2122
|
// src/components/TxConfigForm/Description.tsx
|
|
2065
|
-
import { jsx as
|
|
2123
|
+
import { jsx as jsx39 } from "react/jsx-runtime";
|
|
2066
2124
|
var Description = ({ description }) => {
|
|
2067
|
-
return /* @__PURE__ */
|
|
2125
|
+
return /* @__PURE__ */ jsx39("div", { className: "xpay-flex xpay-flex-col xpay-items-start xpay-rounded-lg xpay-px-4 xpay-py-2", children: /* @__PURE__ */ jsx39("div", { className: "xpay-w-full xpay-flex xpay-gap-4 xpay-items-start xpay-justify-between xpay-text-xl", children: description }) });
|
|
2068
2126
|
};
|
|
2069
2127
|
|
|
2070
2128
|
// src/components/TxConfigForm/Button.tsx
|
|
2071
|
-
import { jsx as
|
|
2129
|
+
import { jsx as jsx40 } from "react/jsx-runtime";
|
|
2072
2130
|
var Button = ({ children, onClick, type, disabled }) => {
|
|
2073
|
-
return /* @__PURE__ */
|
|
2131
|
+
return /* @__PURE__ */ jsx40(
|
|
2074
2132
|
"button",
|
|
2075
2133
|
{
|
|
2076
|
-
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",
|
|
2134
|
+
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",
|
|
2077
2135
|
onClick,
|
|
2078
2136
|
type,
|
|
2079
2137
|
disabled,
|
|
@@ -2083,8 +2141,9 @@ var Button = ({ children, onClick, type, disabled }) => {
|
|
|
2083
2141
|
};
|
|
2084
2142
|
|
|
2085
2143
|
// src/components/TxConfigForm/Form.tsx
|
|
2086
|
-
import { jsx as
|
|
2144
|
+
import { jsx as jsx41, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
2087
2145
|
var Form = ({
|
|
2146
|
+
integratorId,
|
|
2088
2147
|
dstChainId,
|
|
2089
2148
|
dstTokenAddr,
|
|
2090
2149
|
customContractCalls,
|
|
@@ -2131,14 +2190,24 @@ var Form = ({
|
|
|
2131
2190
|
setDstChain(supportedChains.find((chain) => chain.chainId === dstChainId));
|
|
2132
2191
|
}, [supportedChains, dstChainId]);
|
|
2133
2192
|
useEffect7(() => {
|
|
2134
|
-
|
|
2135
|
-
dstChain
|
|
2193
|
+
(async () => {
|
|
2194
|
+
if (!dstChain) {
|
|
2195
|
+
return;
|
|
2196
|
+
}
|
|
2197
|
+
let dstTokenResult = dstChain?.tokens.find(
|
|
2136
2198
|
(token) => token.address.toLowerCase() === dstTokenAddr.toLowerCase()
|
|
2137
|
-
)
|
|
2138
|
-
|
|
2199
|
+
);
|
|
2200
|
+
if (!dstTokenResult) {
|
|
2201
|
+
dstTokenResult = await getCustomTokenData(
|
|
2202
|
+
dstChain,
|
|
2203
|
+
dstTokenAddr.toLowerCase()
|
|
2204
|
+
);
|
|
2205
|
+
}
|
|
2206
|
+
setDstToken(dstTokenResult);
|
|
2207
|
+
})();
|
|
2139
2208
|
}, [dstChain]);
|
|
2140
2209
|
useEffect7(() => {
|
|
2141
|
-
if (srcChain && srcToken && dstChain && debouncedAmount && paymentToken && slippage) {
|
|
2210
|
+
if (integratorId && srcChain && srcToken && dstChain && debouncedAmount && paymentToken && slippage) {
|
|
2142
2211
|
setFormError("");
|
|
2143
2212
|
const timeout = setTimeout(() => {
|
|
2144
2213
|
setFormError("Getting Route is taking longer than usually");
|
|
@@ -2150,6 +2219,7 @@ var Form = ({
|
|
|
2150
2219
|
`Configuration error: selected token ($${srcToken.symbol} ${srcToken.name}) has unknown decimals param.`
|
|
2151
2220
|
);
|
|
2152
2221
|
getRoute({
|
|
2222
|
+
integratorId,
|
|
2153
2223
|
fromAmount: ethers3.utils.parseUnits(debouncedAmount, srcToken.decimals).toString(),
|
|
2154
2224
|
fromAddress: signer || ADDRESSES[srcChain.chainId].FeeCollector,
|
|
2155
2225
|
fromChain: srcChain.chainId,
|
|
@@ -2218,10 +2288,10 @@ var Form = ({
|
|
|
2218
2288
|
return /* @__PURE__ */ jsxs17(
|
|
2219
2289
|
"form",
|
|
2220
2290
|
{
|
|
2221
|
-
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",
|
|
2291
|
+
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",
|
|
2222
2292
|
onSubmit: handleSubmit,
|
|
2223
2293
|
children: [
|
|
2224
|
-
/* @__PURE__ */
|
|
2294
|
+
/* @__PURE__ */ jsx41(
|
|
2225
2295
|
TopBar,
|
|
2226
2296
|
{
|
|
2227
2297
|
signer,
|
|
@@ -2231,7 +2301,7 @@ var Form = ({
|
|
|
2231
2301
|
onClose
|
|
2232
2302
|
}
|
|
2233
2303
|
),
|
|
2234
|
-
settingsShown && /* @__PURE__ */
|
|
2304
|
+
settingsShown && /* @__PURE__ */ jsx41(
|
|
2235
2305
|
Settings,
|
|
2236
2306
|
{
|
|
2237
2307
|
expressChecked,
|
|
@@ -2241,9 +2311,9 @@ var Form = ({
|
|
|
2241
2311
|
setSlippage
|
|
2242
2312
|
}
|
|
2243
2313
|
),
|
|
2244
|
-
historyTabShown ? /* @__PURE__ */
|
|
2245
|
-
desc && /* @__PURE__ */
|
|
2246
|
-
/* @__PURE__ */
|
|
2314
|
+
historyTabShown ? /* @__PURE__ */ jsx41(History, { signer, supportedChains }) : /* @__PURE__ */ jsxs17("div", { className: "xpay-flex xpay-flex-col xpay-gap-2", children: [
|
|
2315
|
+
desc && /* @__PURE__ */ jsx41(Description, { description: desc }),
|
|
2316
|
+
/* @__PURE__ */ jsx41(
|
|
2247
2317
|
SwapPanel,
|
|
2248
2318
|
{
|
|
2249
2319
|
amount,
|
|
@@ -2259,7 +2329,7 @@ var Form = ({
|
|
|
2259
2329
|
setExceedsExpressDeliveryLimit
|
|
2260
2330
|
}
|
|
2261
2331
|
),
|
|
2262
|
-
/* @__PURE__ */
|
|
2332
|
+
/* @__PURE__ */ jsx41(
|
|
2263
2333
|
Summary,
|
|
2264
2334
|
{
|
|
2265
2335
|
isGettingRoute,
|
|
@@ -2268,7 +2338,7 @@ var Form = ({
|
|
|
2268
2338
|
dstChain
|
|
2269
2339
|
}
|
|
2270
2340
|
),
|
|
2271
|
-
/* @__PURE__ */
|
|
2341
|
+
/* @__PURE__ */ jsx41(
|
|
2272
2342
|
FeesDetails,
|
|
2273
2343
|
{
|
|
2274
2344
|
route,
|
|
@@ -2282,8 +2352,8 @@ var Form = ({
|
|
|
2282
2352
|
setFeesDetailsShown
|
|
2283
2353
|
}
|
|
2284
2354
|
),
|
|
2285
|
-
formError.length > 0 && /* @__PURE__ */
|
|
2286
|
-
signer && srcChain && srcChain.chainId !== account.chainId?.toString() ? /* @__PURE__ */
|
|
2355
|
+
formError.length > 0 && /* @__PURE__ */ jsx41(ErrorField, { error: formError }),
|
|
2356
|
+
signer && srcChain && srcChain.chainId !== account.chainId?.toString() ? /* @__PURE__ */ jsx41(Button, { type: "button", onClick: handleSwitchChain, children: "Switch chain" }) : /* @__PURE__ */ jsx41(
|
|
2287
2357
|
Button,
|
|
2288
2358
|
{
|
|
2289
2359
|
type: "submit",
|
|
@@ -2298,8 +2368,9 @@ var Form = ({
|
|
|
2298
2368
|
};
|
|
2299
2369
|
|
|
2300
2370
|
// src/components/TxConfigForm/index.tsx
|
|
2301
|
-
import { jsx as
|
|
2371
|
+
import { jsx as jsx42, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
2302
2372
|
var TxConfigForm = ({
|
|
2373
|
+
integratorId,
|
|
2303
2374
|
dstChainId,
|
|
2304
2375
|
dstTokenAddr,
|
|
2305
2376
|
customContractCalls,
|
|
@@ -2316,19 +2387,20 @@ var TxConfigForm = ({
|
|
|
2316
2387
|
}
|
|
2317
2388
|
};
|
|
2318
2389
|
const queryClient = new QueryClient();
|
|
2319
|
-
const wagmiConfig =
|
|
2390
|
+
const wagmiConfig = useMemo8(
|
|
2320
2391
|
() => getWagmiConfig(supportedChains),
|
|
2321
2392
|
supportedChains
|
|
2322
2393
|
);
|
|
2323
|
-
return /* @__PURE__ */
|
|
2394
|
+
return /* @__PURE__ */ jsx42(WagmiProvider, { config: wagmiConfig, children: /* @__PURE__ */ jsx42(QueryClientProvider, { client: queryClient, children: /* @__PURE__ */ jsx42(
|
|
2324
2395
|
"div",
|
|
2325
2396
|
{
|
|
2326
|
-
className: "top-0 left-0 right-0 bottom-0 bg-[rgba(0,0,0,0.8)] fixed flex items-center justify-center z-10",
|
|
2397
|
+
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",
|
|
2327
2398
|
onClick: onBackdropClick,
|
|
2328
|
-
children: /* @__PURE__ */ jsxs18("div", { className: "relative bg-black rounded-3xl overflow-auto text-white border-2 border-solid border-[rgba(255,255,255,0.1)]", children: [
|
|
2329
|
-
/* @__PURE__ */
|
|
2399
|
+
children: /* @__PURE__ */ jsxs18("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)]", children: [
|
|
2400
|
+
/* @__PURE__ */ jsx42(
|
|
2330
2401
|
Form,
|
|
2331
2402
|
{
|
|
2403
|
+
integratorId,
|
|
2332
2404
|
dstChainId,
|
|
2333
2405
|
dstTokenAddr,
|
|
2334
2406
|
customContractCalls,
|
|
@@ -2338,12 +2410,13 @@ var TxConfigForm = ({
|
|
|
2338
2410
|
onClose
|
|
2339
2411
|
}
|
|
2340
2412
|
),
|
|
2341
|
-
/* @__PURE__ */
|
|
2413
|
+
/* @__PURE__ */ jsx42(PoweredBy, {})
|
|
2342
2414
|
] })
|
|
2343
2415
|
}
|
|
2344
2416
|
) }) });
|
|
2345
2417
|
};
|
|
2346
2418
|
var openTxConfigForm = async ({
|
|
2419
|
+
integratorId,
|
|
2347
2420
|
dstChainId,
|
|
2348
2421
|
dstTokenAddr,
|
|
2349
2422
|
customContractCalls,
|
|
@@ -2353,10 +2426,11 @@ var openTxConfigForm = async ({
|
|
|
2353
2426
|
try {
|
|
2354
2427
|
return await new Promise(async (resolve) => {
|
|
2355
2428
|
await waitForInitialization();
|
|
2356
|
-
|
|
2357
|
-
/* @__PURE__ */
|
|
2429
|
+
xpayRoot.render(
|
|
2430
|
+
/* @__PURE__ */ jsx42(
|
|
2358
2431
|
TxConfigForm,
|
|
2359
2432
|
{
|
|
2433
|
+
integratorId,
|
|
2360
2434
|
dstChainId,
|
|
2361
2435
|
dstTokenAddr,
|
|
2362
2436
|
customContractCalls,
|
|
@@ -2364,10 +2438,10 @@ var openTxConfigForm = async ({
|
|
|
2364
2438
|
supportedChains,
|
|
2365
2439
|
onSubmit: (route) => {
|
|
2366
2440
|
resolve(route);
|
|
2367
|
-
|
|
2441
|
+
xpayRoot.render("");
|
|
2368
2442
|
},
|
|
2369
2443
|
onClose: () => {
|
|
2370
|
-
|
|
2444
|
+
xpayRoot.render("");
|
|
2371
2445
|
}
|
|
2372
2446
|
}
|
|
2373
2447
|
)
|
|
@@ -2379,93 +2453,106 @@ var openTxConfigForm = async ({
|
|
|
2379
2453
|
};
|
|
2380
2454
|
|
|
2381
2455
|
// src/components/TxStatusButton/index.tsx
|
|
2382
|
-
import { useMemo as
|
|
2383
|
-
import { Fragment as Fragment6, jsx as
|
|
2456
|
+
import { useMemo as useMemo9, useState as useState9 } from "react";
|
|
2457
|
+
import { Fragment as Fragment6, jsx as jsx43, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
2384
2458
|
var TxStatusButton = ({ transaction }) => {
|
|
2385
2459
|
const {
|
|
2386
|
-
fromChain,
|
|
2387
|
-
fromChainImage,
|
|
2388
|
-
fromToken,
|
|
2389
|
-
fromTokenImage,
|
|
2390
|
-
fromAmount,
|
|
2391
|
-
toChain,
|
|
2392
|
-
toChainImage,
|
|
2460
|
+
srcChain: fromChain,
|
|
2461
|
+
srcChainImage: fromChainImage,
|
|
2462
|
+
srcToken: fromToken,
|
|
2463
|
+
srcTokenImage: fromTokenImage,
|
|
2464
|
+
srcAmount: fromAmount,
|
|
2465
|
+
dstChain: toChain,
|
|
2466
|
+
dstChainImage: toChainImage,
|
|
2393
2467
|
isDone,
|
|
2394
|
-
txHash,
|
|
2395
2468
|
explorer
|
|
2396
2469
|
} = transaction;
|
|
2397
2470
|
const [isWide, setIsWide] = useState9(false);
|
|
2398
|
-
const background =
|
|
2399
|
-
() => isDone ? "bg-[rgba(2,2,2,1)] bg-gradient-to-r from-[rgba(76,175,80,0.2)] to-[rgba(46,125,50,0.2)]" : "bg-[rgba(2,2,2,1)] bg-gradient-to-r from-[rgba(54,129,198,0.2)] to-[rgba(43,74,157,0.2)]",
|
|
2471
|
+
const background = useMemo9(
|
|
2472
|
+
() => isDone ? "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)]" : "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)]",
|
|
2400
2473
|
[isDone]
|
|
2401
2474
|
);
|
|
2402
|
-
const border =
|
|
2403
|
-
() => isDone ? "border border-solid border-x_green_dark" : "border border-solid border-x_blue_dark",
|
|
2475
|
+
const border = useMemo9(
|
|
2476
|
+
() => isDone ? "xpay-border xpay-border-solid xpay-border-x_green_dark" : "xpay-border xpay-border-solid xpay-border-x_blue_dark",
|
|
2404
2477
|
[isDone]
|
|
2405
2478
|
);
|
|
2406
|
-
return /* @__PURE__ */ jsxs19(
|
|
2407
|
-
|
|
2408
|
-
|
|
2409
|
-
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
|
|
2414
|
-
|
|
2415
|
-
|
|
2416
|
-
|
|
2417
|
-
|
|
2418
|
-
|
|
2419
|
-
|
|
2420
|
-
|
|
2421
|
-
|
|
2422
|
-
|
|
2423
|
-
|
|
2424
|
-
|
|
2425
|
-
|
|
2426
|
-
|
|
2427
|
-
|
|
2428
|
-
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
|
|
2479
|
+
return /* @__PURE__ */ jsxs19(
|
|
2480
|
+
"div",
|
|
2481
|
+
{
|
|
2482
|
+
className: "xpay-flex xpay-gap-2",
|
|
2483
|
+
onClick: () => setIsWide((x) => !x),
|
|
2484
|
+
children: [
|
|
2485
|
+
isWide && /* @__PURE__ */ jsxs19(
|
|
2486
|
+
"div",
|
|
2487
|
+
{
|
|
2488
|
+
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}`,
|
|
2489
|
+
children: [
|
|
2490
|
+
/* @__PURE__ */ jsxs19("div", { className: "xpay-flex xpay-justify-between xpay-flex-col xpay-gap-2 sm:xpay-gap-5 sm:xpay-flex-row xpay-w-full", children: [
|
|
2491
|
+
/* @__PURE__ */ jsxs19("div", { className: "xpay-flex xpay-items-center xpay-gap-2", children: [
|
|
2492
|
+
/* @__PURE__ */ jsx43(
|
|
2493
|
+
"img",
|
|
2494
|
+
{
|
|
2495
|
+
className: "xpay-w-5 xpay-h-5",
|
|
2496
|
+
src: fromChainImage,
|
|
2497
|
+
alt: "source chain"
|
|
2498
|
+
}
|
|
2499
|
+
),
|
|
2500
|
+
/* @__PURE__ */ jsx43("div", { children: fromChain }),
|
|
2501
|
+
/* @__PURE__ */ jsx43("div", { className: "xpay-w-3.5 xpay-h-3.5", children: /* @__PURE__ */ jsx43(ArrowRightIcon, {}) }),
|
|
2502
|
+
/* @__PURE__ */ jsx43(
|
|
2503
|
+
"img",
|
|
2504
|
+
{
|
|
2505
|
+
className: "xpay-w-5 xpay-h-5",
|
|
2506
|
+
src: toChainImage,
|
|
2507
|
+
alt: "to chain"
|
|
2508
|
+
}
|
|
2509
|
+
),
|
|
2510
|
+
/* @__PURE__ */ jsx43("div", { children: toChain })
|
|
2511
|
+
] }),
|
|
2512
|
+
/* @__PURE__ */ jsxs19("div", { className: "xpay-flex xpay-items-center xpay-gap-2", children: [
|
|
2513
|
+
/* @__PURE__ */ jsx43("div", { children: "Sent" }),
|
|
2514
|
+
/* @__PURE__ */ jsx43("div", { children: fromAmount }),
|
|
2515
|
+
/* @__PURE__ */ jsx43("div", { children: fromToken }),
|
|
2516
|
+
fromTokenImage ? /* @__PURE__ */ jsx43(
|
|
2517
|
+
"img",
|
|
2518
|
+
{
|
|
2519
|
+
className: "xpay-w-5 xpay-h-5",
|
|
2520
|
+
src: fromTokenImage,
|
|
2521
|
+
alt: "source token"
|
|
2522
|
+
}
|
|
2523
|
+
) : /* @__PURE__ */ jsx43(UnknownTokenLogo, { tokenName: "?" })
|
|
2524
|
+
] })
|
|
2525
|
+
] }),
|
|
2526
|
+
/* @__PURE__ */ jsx43(
|
|
2527
|
+
"a",
|
|
2433
2528
|
{
|
|
2434
|
-
|
|
2435
|
-
|
|
2436
|
-
|
|
2529
|
+
href: explorer,
|
|
2530
|
+
target: "_blank",
|
|
2531
|
+
rel: "noreferrer",
|
|
2532
|
+
className: "xpay-no-underline xpay-cursor-pointer",
|
|
2533
|
+
"aria-label": "Show the transaction in the chain explorer",
|
|
2534
|
+
children: /* @__PURE__ */ jsx43("div", { className: "xpay-w-3.5 xpay-h-3.5", children: /* @__PURE__ */ jsx43(ArrowUpRightIcon, {}) })
|
|
2437
2535
|
}
|
|
2438
2536
|
)
|
|
2537
|
+
]
|
|
2538
|
+
}
|
|
2539
|
+
),
|
|
2540
|
+
/* @__PURE__ */ jsx43(
|
|
2541
|
+
"div",
|
|
2542
|
+
{
|
|
2543
|
+
className: `xpay-text-white xpay-rounded-xl xpay-cursor-pointer ${background} ${border}`,
|
|
2544
|
+
children: /* @__PURE__ */ jsxs19("div", { className: "xpay-flex xpay-gap-2 xpay-items-center xpay-h-14 xpay-w-20 xpay-justify-center", children: [
|
|
2545
|
+
/* @__PURE__ */ jsx43(ArrowLeftIcon, {}),
|
|
2546
|
+
/* @__PURE__ */ jsx43("div", { className: "xpay-relative xpay-flex xpay-items-center xpay-justify-center xpay-w-9 xpay-h-9", children: isDone ? /* @__PURE__ */ jsx43("div", { className: "xpay-text-x_green xpay-w-5 xpay-h-5", children: /* @__PURE__ */ jsx43(CheckIcon, {}) }) : /* @__PURE__ */ jsxs19(Fragment6, { children: [
|
|
2547
|
+
/* @__PURE__ */ jsx43("div", { className: "xpay-w-5 xpay-h-5", children: /* @__PURE__ */ jsx43(XSwapLogo, {}) }),
|
|
2548
|
+
/* @__PURE__ */ jsx43("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", children: /* @__PURE__ */ jsx43(CircularProgressIcon, {}) })
|
|
2549
|
+
] }) })
|
|
2439
2550
|
] })
|
|
2440
|
-
|
|
2441
|
-
|
|
2442
|
-
|
|
2443
|
-
|
|
2444
|
-
|
|
2445
|
-
target: "_blank",
|
|
2446
|
-
rel: "noreferrer",
|
|
2447
|
-
className: "no-underline cursor-pointer",
|
|
2448
|
-
"aria-label": "Show the transaction in the chain explorer",
|
|
2449
|
-
children: /* @__PURE__ */ jsx42("div", { className: "w-3.5 h-3.5", children: /* @__PURE__ */ jsx42(ArrowUpRightIcon, {}) })
|
|
2450
|
-
}
|
|
2451
|
-
)
|
|
2452
|
-
]
|
|
2453
|
-
}
|
|
2454
|
-
),
|
|
2455
|
-
/* @__PURE__ */ jsx42(
|
|
2456
|
-
"div",
|
|
2457
|
-
{
|
|
2458
|
-
className: `text-white rounded-xl cursor-pointer ${background} ${border}`,
|
|
2459
|
-
children: /* @__PURE__ */ jsxs19("div", { className: "flex gap-2 items-center h-14 w-20 justify-center", children: [
|
|
2460
|
-
/* @__PURE__ */ jsx42(ArrowLeftIcon, {}),
|
|
2461
|
-
/* @__PURE__ */ jsx42("div", { className: "relative flex items-center justify-center w-9 h-9", children: isDone ? /* @__PURE__ */ jsx42("div", { className: "text-x_green w-5 h-5", children: /* @__PURE__ */ jsx42(CheckIcon, {}) }) : /* @__PURE__ */ jsxs19(Fragment6, { children: [
|
|
2462
|
-
/* @__PURE__ */ jsx42("div", { className: "w-5 h-5", children: /* @__PURE__ */ jsx42(XSwapLogo, {}) }),
|
|
2463
|
-
/* @__PURE__ */ jsx42("div", { className: "absolute flex items-center justify-center top-0 left-0 right-0 bottom-0 text-white", children: /* @__PURE__ */ jsx42(CircularProgressIcon, {}) })
|
|
2464
|
-
] }) })
|
|
2465
|
-
] })
|
|
2466
|
-
}
|
|
2467
|
-
)
|
|
2468
|
-
] });
|
|
2551
|
+
}
|
|
2552
|
+
)
|
|
2553
|
+
]
|
|
2554
|
+
}
|
|
2555
|
+
);
|
|
2469
2556
|
};
|
|
2470
2557
|
var renderedTransactions = [];
|
|
2471
2558
|
var addTransactionToRenderedTransactions = (transaction) => {
|
|
@@ -2487,25 +2574,71 @@ var updateTransactionDoneInRenderedTransactions = (txHash) => {
|
|
|
2487
2574
|
}
|
|
2488
2575
|
};
|
|
2489
2576
|
var renderTxStatusButtons = () => {
|
|
2490
|
-
const buttons = renderedTransactions.map((item) => /* @__PURE__ */
|
|
2491
|
-
|
|
2577
|
+
const buttons = renderedTransactions.map((item) => /* @__PURE__ */ jsx43(TxStatusButton, { transaction: item }, item.txHash));
|
|
2578
|
+
xpayTxStatusRoot.render(buttons);
|
|
2492
2579
|
};
|
|
2493
2580
|
|
|
2494
2581
|
// src/components/Skeleton/index.tsx
|
|
2495
|
-
import { jsx as
|
|
2582
|
+
import { jsx as jsx44 } from "react/jsx-runtime";
|
|
2496
2583
|
var Skeleton = ({ width, height }) => {
|
|
2497
|
-
return /* @__PURE__ */
|
|
2584
|
+
return /* @__PURE__ */ jsx44(
|
|
2585
|
+
"div",
|
|
2586
|
+
{
|
|
2587
|
+
className: `xpay-bg-current xpay-rounded xpay-animate-pulse ${width} ${height}`
|
|
2588
|
+
}
|
|
2589
|
+
);
|
|
2498
2590
|
};
|
|
2499
2591
|
|
|
2500
2592
|
// src/services/integrations/monitoring.ts
|
|
2501
2593
|
import retry from "async-retry";
|
|
2502
|
-
|
|
2594
|
+
|
|
2595
|
+
// src/services/blockchain.ts
|
|
2596
|
+
import { ethers as ethers4 } from "ethers";
|
|
2597
|
+
var getCustomTokenData = async (chain, tokenAddress) => {
|
|
2598
|
+
const rpcUrl = chain.publicRpcUrls[0];
|
|
2599
|
+
const customTokenContract = new ethers4.Contract(
|
|
2600
|
+
tokenAddress.toLowerCase(),
|
|
2601
|
+
ERC20Abi,
|
|
2602
|
+
ethers4.getDefaultProvider(rpcUrl)
|
|
2603
|
+
);
|
|
2604
|
+
try {
|
|
2605
|
+
const query = async (contract, method, args = []) => {
|
|
2606
|
+
if (contract?.provider) {
|
|
2607
|
+
const response = await contract[method](...args);
|
|
2608
|
+
return response;
|
|
2609
|
+
}
|
|
2610
|
+
return null;
|
|
2611
|
+
};
|
|
2612
|
+
const responses = await Promise.all([
|
|
2613
|
+
query(customTokenContract, "decimals"),
|
|
2614
|
+
query(customTokenContract, "name"),
|
|
2615
|
+
query(customTokenContract, "symbol")
|
|
2616
|
+
]);
|
|
2617
|
+
const [decimals, name, symbol] = responses;
|
|
2618
|
+
return {
|
|
2619
|
+
address: tokenAddress,
|
|
2620
|
+
symbol,
|
|
2621
|
+
name,
|
|
2622
|
+
decimals,
|
|
2623
|
+
quickPick: false,
|
|
2624
|
+
supported: true,
|
|
2625
|
+
priority: 0
|
|
2626
|
+
};
|
|
2627
|
+
} catch (_) {
|
|
2628
|
+
throw new Error(
|
|
2629
|
+
`Provided token ${tokenAddress} does not exists on chain ${chain.displayName}`
|
|
2630
|
+
);
|
|
2631
|
+
}
|
|
2632
|
+
};
|
|
2633
|
+
|
|
2634
|
+
// src/services/integrations/monitoring.ts
|
|
2635
|
+
var renderTxStatus = async (txChainId, txHash) => {
|
|
2503
2636
|
const txReceipt = await getTxReceipt(txChainId, txHash);
|
|
2504
2637
|
const supportedChains = (await getChains()).filter(
|
|
2505
2638
|
({ web3Environment, swapSupported }) => web3Environment === "mainnet" /* MAINNET */ && swapSupported
|
|
2506
2639
|
);
|
|
2507
2640
|
const messageSentEvent = txReceipt.logs?.find((log) => {
|
|
2508
|
-
return log.topics[0] ===
|
|
2641
|
+
return log.topics[0] === ethers5.utils.id(MSG_SENT_EVENT_SIG);
|
|
2509
2642
|
});
|
|
2510
2643
|
if (!messageSentEvent) {
|
|
2511
2644
|
throw new Error(
|
|
@@ -2513,7 +2646,7 @@ var monitorTransactionStatus = async (txChainId, txHash) => {
|
|
|
2513
2646
|
);
|
|
2514
2647
|
}
|
|
2515
2648
|
const messageId = messageSentEvent?.topics[1];
|
|
2516
|
-
const iface = new
|
|
2649
|
+
const iface = new ethers5.utils.Interface(MSG_SENT_EVENT_ABI);
|
|
2517
2650
|
const decodedMessageSentEvent = iface.parseLog(messageSentEvent);
|
|
2518
2651
|
if (!decodedMessageSentEvent) {
|
|
2519
2652
|
throw new Error(
|
|
@@ -2523,9 +2656,16 @@ var monitorTransactionStatus = async (txChainId, txHash) => {
|
|
|
2523
2656
|
const srcChain = supportedChains.find(
|
|
2524
2657
|
(chain) => chain.chainId === txChainId.toString()
|
|
2525
2658
|
);
|
|
2526
|
-
|
|
2659
|
+
if (!srcChain) {
|
|
2660
|
+
throw new Error(`Unknown src chain ${txChainId}`);
|
|
2661
|
+
}
|
|
2662
|
+
const tokenAddress = decodedMessageSentEvent.args?.token.toString();
|
|
2663
|
+
let srcToken = srcChain.tokens.find(
|
|
2527
2664
|
(token) => token.address === decodedMessageSentEvent.args?.token.toString()
|
|
2528
2665
|
);
|
|
2666
|
+
if (!srcToken) {
|
|
2667
|
+
srcToken = await getCustomTokenData(srcChain, tokenAddress);
|
|
2668
|
+
}
|
|
2529
2669
|
const dstChain = supportedChains.find(
|
|
2530
2670
|
(chain) => chain.ccipChainId === decodedMessageSentEvent.args?.destinationChainSelector?.toString()
|
|
2531
2671
|
);
|
|
@@ -2533,19 +2673,20 @@ var monitorTransactionStatus = async (txChainId, txHash) => {
|
|
|
2533
2673
|
if (!dstChainId) {
|
|
2534
2674
|
throw new Error(`Unknown destination chain!`);
|
|
2535
2675
|
}
|
|
2676
|
+
const tokenAmount = weiToHumanReadable({
|
|
2677
|
+
amount: decodedMessageSentEvent.args?.tokenAmount.toString(),
|
|
2678
|
+
decimals: srcToken?.decimals || 18,
|
|
2679
|
+
precisionFractionalPlaces: 4
|
|
2680
|
+
});
|
|
2536
2681
|
const transaction = {
|
|
2537
2682
|
txHash,
|
|
2538
|
-
|
|
2539
|
-
|
|
2540
|
-
|
|
2541
|
-
|
|
2542
|
-
|
|
2543
|
-
|
|
2544
|
-
|
|
2545
|
-
amount: decodedMessageSentEvent.args?.tokenAmount.toString(),
|
|
2546
|
-
decimals: srcToken?.decimals || 18,
|
|
2547
|
-
precisionFractionalPlaces: 4
|
|
2548
|
-
}),
|
|
2683
|
+
srcChain: srcChain.displayName,
|
|
2684
|
+
srcChainImage: srcChain.image,
|
|
2685
|
+
dstChain: dstChain.displayName,
|
|
2686
|
+
dstChainImage: dstChain.image,
|
|
2687
|
+
srcToken: srcToken?.symbol,
|
|
2688
|
+
srcTokenImage: srcToken?.image,
|
|
2689
|
+
srcAmount: tokenAmount === "0" ? "<0.0001" : tokenAmount,
|
|
2549
2690
|
isDone: false,
|
|
2550
2691
|
explorer: `${CCIP_EXPLORER}/tx/${txHash}`
|
|
2551
2692
|
};
|
|
@@ -2555,16 +2696,16 @@ var monitorTransactionStatus = async (txChainId, txHash) => {
|
|
|
2555
2696
|
if (!xSwapRouterOnDestinationAddress) {
|
|
2556
2697
|
throw new Error(`Unknown destination XSwapRouter!`);
|
|
2557
2698
|
}
|
|
2558
|
-
const xSwapRouterOnDestination = new
|
|
2699
|
+
const xSwapRouterOnDestination = new ethers5.Contract(
|
|
2559
2700
|
xSwapRouterOnDestinationAddress,
|
|
2560
2701
|
MSG_RECEIVED_EVENT_ABI,
|
|
2561
|
-
|
|
2702
|
+
ethers5.getDefaultProvider(
|
|
2562
2703
|
supportedChains.find((chain) => chain.chainId === dstChainId)?.publicRpcUrls[0]
|
|
2563
2704
|
)
|
|
2564
2705
|
);
|
|
2565
2706
|
const msgReceivedEventFilter = {
|
|
2566
2707
|
address: xSwapRouterOnDestinationAddress,
|
|
2567
|
-
topics: [
|
|
2708
|
+
topics: [ethers5.utils.id(MSG_RECEIVED_EVENT_SIG), messageId]
|
|
2568
2709
|
};
|
|
2569
2710
|
const onSuccess = async () => {
|
|
2570
2711
|
updateTransactionDoneInRenderedTransactions(txHash);
|
|
@@ -2575,6 +2716,11 @@ var monitorTransactionStatus = async (txChainId, txHash) => {
|
|
|
2575
2716
|
removeTransactionFromRenderedTransactions(txHash);
|
|
2576
2717
|
renderTxStatusButtons();
|
|
2577
2718
|
};
|
|
2719
|
+
getTxStatus({ transferId: messageId }).then((response) => {
|
|
2720
|
+
if (response.status === "DONE") {
|
|
2721
|
+
onSuccess();
|
|
2722
|
+
}
|
|
2723
|
+
});
|
|
2578
2724
|
xSwapRouterOnDestination.once(msgReceivedEventFilter, () => onSuccess());
|
|
2579
2725
|
};
|
|
2580
2726
|
var getTxReceipt = async (txChainId, txHash) => {
|
|
@@ -2582,7 +2728,7 @@ var getTxReceipt = async (txChainId, txHash) => {
|
|
|
2582
2728
|
const chain = (await getChains()).find(
|
|
2583
2729
|
(chain2) => chain2.chainId === txChainId
|
|
2584
2730
|
);
|
|
2585
|
-
const provider = new
|
|
2731
|
+
const provider = new ethers5.providers.JsonRpcProvider(
|
|
2586
2732
|
chain?.publicRpcUrls[0]
|
|
2587
2733
|
);
|
|
2588
2734
|
return await retry(async () => {
|
|
@@ -2600,7 +2746,8 @@ var getTxReceipt = async (txChainId, txHash) => {
|
|
|
2600
2746
|
};
|
|
2601
2747
|
|
|
2602
2748
|
// src/services/integrations/transactions.ts
|
|
2603
|
-
var
|
|
2749
|
+
var openTransactionModal = async ({
|
|
2750
|
+
integratorId,
|
|
2604
2751
|
dstChain,
|
|
2605
2752
|
dstToken,
|
|
2606
2753
|
customContractCalls = [],
|
|
@@ -2611,6 +2758,7 @@ var getSwapTx = async ({
|
|
|
2611
2758
|
);
|
|
2612
2759
|
validateSwapTxData(supportedChains, dstChain, dstToken);
|
|
2613
2760
|
const route = await openTxConfigForm({
|
|
2761
|
+
integratorId,
|
|
2614
2762
|
dstChainId: dstChain,
|
|
2615
2763
|
dstTokenAddr: dstToken,
|
|
2616
2764
|
customContractCalls,
|
|
@@ -2626,19 +2774,27 @@ var validateSwapTxData = (supportedChains, dstChain, dstToken) => {
|
|
|
2626
2774
|
if (!supportedDstChain) {
|
|
2627
2775
|
throw new Error(`Provided chain '${dstChain}' is not supported`);
|
|
2628
2776
|
}
|
|
2629
|
-
if (!
|
|
2630
|
-
throw new Error(
|
|
2777
|
+
if (!isETHAddressValid(dstToken)) {
|
|
2778
|
+
throw new Error(
|
|
2779
|
+
`Provided token address ${dstToken} on chain ${dstChain} is not correct`
|
|
2780
|
+
);
|
|
2631
2781
|
}
|
|
2632
2782
|
};
|
|
2633
2783
|
|
|
2634
2784
|
// src/index.ts
|
|
2635
2785
|
initDocument();
|
|
2786
|
+
var XPay = {
|
|
2787
|
+
openTransactionModal,
|
|
2788
|
+
renderTxStatus
|
|
2789
|
+
};
|
|
2790
|
+
var src_default = XPay;
|
|
2636
2791
|
export {
|
|
2637
2792
|
ContractName,
|
|
2638
2793
|
Ecosystem,
|
|
2639
2794
|
Environment,
|
|
2640
2795
|
Web3Environment,
|
|
2641
2796
|
XSwapCallType,
|
|
2642
|
-
|
|
2643
|
-
|
|
2797
|
+
src_default as default,
|
|
2798
|
+
openTransactionModal,
|
|
2799
|
+
renderTxStatus
|
|
2644
2800
|
};
|