@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.js
CHANGED
|
@@ -35,8 +35,9 @@ __export(src_exports, {
|
|
|
35
35
|
Environment: () => Environment,
|
|
36
36
|
Web3Environment: () => Web3Environment,
|
|
37
37
|
XSwapCallType: () => XSwapCallType,
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
default: () => src_default,
|
|
39
|
+
openTransactionModal: () => openTransactionModal,
|
|
40
|
+
renderTxStatus: () => renderTxStatus
|
|
40
41
|
});
|
|
41
42
|
module.exports = __toCommonJS(src_exports);
|
|
42
43
|
|
|
@@ -58,7 +59,7 @@ var xswap_config_default = {
|
|
|
58
59
|
};
|
|
59
60
|
|
|
60
61
|
// package.json
|
|
61
|
-
var version = "0.2.
|
|
62
|
+
var version = "0.2.6";
|
|
62
63
|
|
|
63
64
|
// src/components/WaitingForInit/index.tsx
|
|
64
65
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
@@ -85,19 +86,19 @@ var WaitingForInit = () => {
|
|
|
85
86
|
|
|
86
87
|
// src/config/init.tsx
|
|
87
88
|
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
88
|
-
var
|
|
89
|
-
var
|
|
90
|
-
var
|
|
89
|
+
var xpayRoot;
|
|
90
|
+
var xpayInitIndicatorRoot;
|
|
91
|
+
var xpayTxStatusRoot;
|
|
91
92
|
var initCompleted = false;
|
|
92
93
|
var initDocument = () => {
|
|
93
94
|
if (typeof document === "undefined") {
|
|
94
95
|
throw new Error("Can't render XPay components from server side.");
|
|
95
96
|
}
|
|
96
|
-
|
|
97
|
+
createXPayInitIndicatorRoot();
|
|
97
98
|
Promise.all([
|
|
98
99
|
createStyleElement(),
|
|
99
|
-
|
|
100
|
-
|
|
100
|
+
createXPayRoot(),
|
|
101
|
+
createXPayTxStatusRoot()
|
|
101
102
|
]).then(() => {
|
|
102
103
|
initCompleted = true;
|
|
103
104
|
});
|
|
@@ -122,68 +123,30 @@ var createStyleElement = async () => {
|
|
|
122
123
|
style.textContent = text;
|
|
123
124
|
document.body.appendChild(style);
|
|
124
125
|
};
|
|
125
|
-
var
|
|
126
|
+
var createXPayRoot = async () => {
|
|
126
127
|
const xswapElement = document.createElement("div");
|
|
127
|
-
xswapElement.setAttribute("id", "
|
|
128
|
+
xswapElement.setAttribute("id", "xpay-root");
|
|
129
|
+
xswapElement.setAttribute("class", "xpay");
|
|
128
130
|
document.body.appendChild(xswapElement);
|
|
129
|
-
|
|
131
|
+
xpayRoot = (0, import_client.createRoot)(xswapElement);
|
|
130
132
|
};
|
|
131
|
-
var
|
|
133
|
+
var createXPayTxStatusRoot = async () => {
|
|
132
134
|
const txStatusElement = document.createElement("div");
|
|
133
|
-
txStatusElement.setAttribute("id", "
|
|
134
|
-
txStatusElement.setAttribute("class", "
|
|
135
|
+
txStatusElement.setAttribute("id", "xpay-tx-status");
|
|
136
|
+
txStatusElement.setAttribute("class", "xpay-tx-status");
|
|
135
137
|
document.body.appendChild(txStatusElement);
|
|
136
|
-
|
|
138
|
+
xpayTxStatusRoot = (0, import_client.createRoot)(txStatusElement);
|
|
137
139
|
};
|
|
138
|
-
var
|
|
140
|
+
var createXPayInitIndicatorRoot = () => {
|
|
139
141
|
const initIndicatorElement = document.createElement("div");
|
|
140
|
-
initIndicatorElement.setAttribute("id", "
|
|
142
|
+
initIndicatorElement.setAttribute("id", "xpay-init-indicator");
|
|
141
143
|
document.body.appendChild(initIndicatorElement);
|
|
142
|
-
|
|
144
|
+
xpayInitIndicatorRoot = (0, import_client.createRoot)(initIndicatorElement);
|
|
143
145
|
};
|
|
144
146
|
var displayInitIndicator = (display) => {
|
|
145
|
-
display ?
|
|
147
|
+
display ? xpayInitIndicatorRoot.render(/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(WaitingForInit, {})) : xpayInitIndicatorRoot.render("");
|
|
146
148
|
};
|
|
147
149
|
|
|
148
|
-
// src/models/Addresses.ts
|
|
149
|
-
var ContractName = /* @__PURE__ */ ((ContractName2) => {
|
|
150
|
-
ContractName2["BatchQuery"] = "BatchQuery";
|
|
151
|
-
ContractName2["FeeCollector"] = "FeeCollector";
|
|
152
|
-
ContractName2["XSwapRouter"] = "XSwapRouter";
|
|
153
|
-
return ContractName2;
|
|
154
|
-
})(ContractName || {});
|
|
155
|
-
|
|
156
|
-
// src/models/Ecosystem.ts
|
|
157
|
-
var Ecosystem = /* @__PURE__ */ ((Ecosystem2) => {
|
|
158
|
-
Ecosystem2["EVM"] = "evm";
|
|
159
|
-
return Ecosystem2;
|
|
160
|
-
})(Ecosystem || {});
|
|
161
|
-
|
|
162
|
-
// src/models/Environment.ts
|
|
163
|
-
var Environment = /* @__PURE__ */ ((Environment2) => {
|
|
164
|
-
Environment2["PROD"] = "production";
|
|
165
|
-
Environment2["DEV"] = "develop";
|
|
166
|
-
Environment2["LOCAL"] = "local";
|
|
167
|
-
return Environment2;
|
|
168
|
-
})(Environment || {});
|
|
169
|
-
|
|
170
|
-
// src/models/Web3Environment.ts
|
|
171
|
-
var Web3Environment = /* @__PURE__ */ ((Web3Environment2) => {
|
|
172
|
-
Web3Environment2["DEVNET"] = "devnet";
|
|
173
|
-
Web3Environment2["TESTNET"] = "testnet";
|
|
174
|
-
Web3Environment2["MAINNET"] = "mainnet";
|
|
175
|
-
return Web3Environment2;
|
|
176
|
-
})(Web3Environment || {});
|
|
177
|
-
|
|
178
|
-
// src/models/XSwapCallType.ts
|
|
179
|
-
var XSwapCallType = /* @__PURE__ */ ((XSwapCallType2) => {
|
|
180
|
-
XSwapCallType2[XSwapCallType2["DEFAULT"] = 0] = "DEFAULT";
|
|
181
|
-
XSwapCallType2[XSwapCallType2["FULL_TOKEN_BALANCE"] = 1] = "FULL_TOKEN_BALANCE";
|
|
182
|
-
XSwapCallType2[XSwapCallType2["FULL_NATIVE_BALANCE"] = 2] = "FULL_NATIVE_BALANCE";
|
|
183
|
-
XSwapCallType2[XSwapCallType2["COLLECT_TOKEN_BALANCE"] = 3] = "COLLECT_TOKEN_BALANCE";
|
|
184
|
-
return XSwapCallType2;
|
|
185
|
-
})(XSwapCallType || {});
|
|
186
|
-
|
|
187
150
|
// src/services/api.ts
|
|
188
151
|
async function _sendRequest(urlPath, options) {
|
|
189
152
|
const response = await fetch(`${xswap_config_default.apiUrl}${urlPath}`, {
|
|
@@ -226,10 +189,57 @@ async function getPrices(payload) {
|
|
|
226
189
|
})}`
|
|
227
190
|
);
|
|
228
191
|
}
|
|
192
|
+
async function getTxStatus(payload) {
|
|
193
|
+
return await _sendRequest(
|
|
194
|
+
`/getTxStatus?${new URLSearchParams({
|
|
195
|
+
data: JSON.stringify(payload)
|
|
196
|
+
// todo remove once gcp starts working
|
|
197
|
+
})}`
|
|
198
|
+
);
|
|
199
|
+
}
|
|
229
200
|
|
|
230
201
|
// src/services/integrations/customCalls/staking.ts
|
|
231
202
|
var import_ethers3 = require("ethers");
|
|
232
203
|
|
|
204
|
+
// src/models/Addresses.ts
|
|
205
|
+
var ContractName = /* @__PURE__ */ ((ContractName2) => {
|
|
206
|
+
ContractName2["BatchQuery"] = "BatchQuery";
|
|
207
|
+
ContractName2["FeeCollector"] = "FeeCollector";
|
|
208
|
+
ContractName2["XSwapRouter"] = "XSwapRouter";
|
|
209
|
+
return ContractName2;
|
|
210
|
+
})(ContractName || {});
|
|
211
|
+
|
|
212
|
+
// src/models/Ecosystem.ts
|
|
213
|
+
var Ecosystem = /* @__PURE__ */ ((Ecosystem2) => {
|
|
214
|
+
Ecosystem2["EVM"] = "evm";
|
|
215
|
+
return Ecosystem2;
|
|
216
|
+
})(Ecosystem || {});
|
|
217
|
+
|
|
218
|
+
// src/models/Environment.ts
|
|
219
|
+
var Environment = /* @__PURE__ */ ((Environment2) => {
|
|
220
|
+
Environment2["PROD"] = "production";
|
|
221
|
+
Environment2["DEV"] = "develop";
|
|
222
|
+
Environment2["LOCAL"] = "local";
|
|
223
|
+
return Environment2;
|
|
224
|
+
})(Environment || {});
|
|
225
|
+
|
|
226
|
+
// src/models/Web3Environment.ts
|
|
227
|
+
var Web3Environment = /* @__PURE__ */ ((Web3Environment2) => {
|
|
228
|
+
Web3Environment2["DEVNET"] = "devnet";
|
|
229
|
+
Web3Environment2["TESTNET"] = "testnet";
|
|
230
|
+
Web3Environment2["MAINNET"] = "mainnet";
|
|
231
|
+
return Web3Environment2;
|
|
232
|
+
})(Web3Environment || {});
|
|
233
|
+
|
|
234
|
+
// src/models/XSwapCallType.ts
|
|
235
|
+
var XSwapCallType = /* @__PURE__ */ ((XSwapCallType2) => {
|
|
236
|
+
XSwapCallType2[XSwapCallType2["DEFAULT"] = 0] = "DEFAULT";
|
|
237
|
+
XSwapCallType2[XSwapCallType2["FULL_TOKEN_BALANCE"] = 1] = "FULL_TOKEN_BALANCE";
|
|
238
|
+
XSwapCallType2[XSwapCallType2["FULL_NATIVE_BALANCE"] = 2] = "FULL_NATIVE_BALANCE";
|
|
239
|
+
XSwapCallType2[XSwapCallType2["COLLECT_TOKEN_BALANCE"] = 3] = "COLLECT_TOKEN_BALANCE";
|
|
240
|
+
return XSwapCallType2;
|
|
241
|
+
})(XSwapCallType || {});
|
|
242
|
+
|
|
233
243
|
// src/utils/contracts.ts
|
|
234
244
|
var import_ethers = require("ethers");
|
|
235
245
|
|
|
@@ -661,6 +671,9 @@ var shortAddress = (address) => {
|
|
|
661
671
|
address.length
|
|
662
672
|
)}`;
|
|
663
673
|
};
|
|
674
|
+
var isETHAddressValid = (address) => {
|
|
675
|
+
return /^0x[a-fA-F0-9]{40}$/.test(address);
|
|
676
|
+
};
|
|
664
677
|
|
|
665
678
|
// src/utils/index.ts
|
|
666
679
|
var import_date_fns = require("date-fns");
|
|
@@ -689,19 +702,19 @@ var getDate = (blockTimestamp) => {
|
|
|
689
702
|
};
|
|
690
703
|
|
|
691
704
|
// src/services/integrations/monitoring.ts
|
|
692
|
-
var
|
|
705
|
+
var import_ethers6 = require("ethers");
|
|
693
706
|
|
|
694
707
|
// src/components/Alert/index.tsx
|
|
695
708
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
696
709
|
var Alert = ({ desc }) => {
|
|
697
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "border border-solid border-x_alert rounded-3xl text-x_alert_light text-xs py-0.5 px-2", children: [
|
|
710
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.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: [
|
|
698
711
|
"\u26A0\uFE0F ",
|
|
699
712
|
desc
|
|
700
713
|
] });
|
|
701
714
|
};
|
|
702
715
|
|
|
703
716
|
// src/components/TxConfigForm/index.tsx
|
|
704
|
-
var
|
|
717
|
+
var import_react12 = require("react");
|
|
705
718
|
var import_react_query = require("@tanstack/react-query");
|
|
706
719
|
var import_wagmi3 = require("wagmi");
|
|
707
720
|
|
|
@@ -866,7 +879,7 @@ var CircularProgressIcon = () => {
|
|
|
866
879
|
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
867
880
|
"svg",
|
|
868
881
|
{
|
|
869
|
-
className: "animate-spin-slow text-white",
|
|
882
|
+
className: "animate-spin-slow xpay-text-white",
|
|
870
883
|
width: "33",
|
|
871
884
|
height: "33",
|
|
872
885
|
viewBox: "0 0 33 33",
|
|
@@ -1181,8 +1194,8 @@ var XSwapLogo = () => {
|
|
|
1181
1194
|
// src/components/TxConfigForm/PoweredBy.tsx
|
|
1182
1195
|
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
1183
1196
|
var PoweredBy = () => {
|
|
1184
|
-
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex justify-center items-center gap-2 my-3", children: [
|
|
1185
|
-
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "text-x_grey", children: "Powered by" }),
|
|
1197
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "xpay-flex xpay-justify-center xpay-items-center xpay-gap-2 xpay-my-3", children: [
|
|
1198
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "xpay-text-x_grey", children: "Powered by" }),
|
|
1186
1199
|
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(XSwapBadgeIcon, {}),
|
|
1187
1200
|
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { children: "\u2715" }),
|
|
1188
1201
|
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ChainlinkCCIPIcon, {})
|
|
@@ -1190,7 +1203,7 @@ var PoweredBy = () => {
|
|
|
1190
1203
|
};
|
|
1191
1204
|
|
|
1192
1205
|
// src/components/TxConfigForm/Form.tsx
|
|
1193
|
-
var
|
|
1206
|
+
var import_react11 = require("react");
|
|
1194
1207
|
var import_ethers4 = require("ethers");
|
|
1195
1208
|
var import_wagmi2 = require("wagmi");
|
|
1196
1209
|
|
|
@@ -1263,13 +1276,13 @@ var HistoryCard = ({ transaction, supportedChains }) => {
|
|
|
1263
1276
|
const targetChainData = supportedChains.find(
|
|
1264
1277
|
(chain) => chain.chainId === transaction.targetChainId
|
|
1265
1278
|
);
|
|
1266
|
-
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex flex-col
|
|
1267
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex w-full items-center justify-between", children: [
|
|
1268
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "text-sm sm:text-base", children: date }),
|
|
1269
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex items-center", children: [
|
|
1270
|
-
transaction.status === "IN_PROGRESS" && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "flex items-center", children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "text-[rgb(250,200,100)]", children: "In progress" }) }),
|
|
1271
|
-
transaction.status === "DONE" && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "flex items-center", children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "text-[rgb(100,200,100)]", children: "Done" }) }),
|
|
1272
|
-
transaction.status === "REVERTED" && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "flex items-center", children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "text-[rgb(255,100,100)]", children: "Reverted" }) }),
|
|
1279
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("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: [
|
|
1280
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "xpay-flex xpay-w-full xpay-items-center xpay-justify-between", children: [
|
|
1281
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "xpay-text-sm sm:xpay-text-base", children: date }),
|
|
1282
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "xpay-flex xpay-items-center", children: [
|
|
1283
|
+
transaction.status === "IN_PROGRESS" && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "xpay-flex xpay-items-center", children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "xpay-text-[rgb(250,200,100)]", children: "In progress" }) }),
|
|
1284
|
+
transaction.status === "DONE" && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "xpay-flex xpay-items-center", children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "xpay-text-[rgb(100,200,100)]", children: "Done" }) }),
|
|
1285
|
+
transaction.status === "REVERTED" && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "xpay-flex xpay-items-center", children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "xpay-text-[rgb(255,100,100)]", children: "Reverted" }) }),
|
|
1273
1286
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
1274
1287
|
"a",
|
|
1275
1288
|
{
|
|
@@ -1278,65 +1291,65 @@ var HistoryCard = ({ transaction, supportedChains }) => {
|
|
|
1278
1291
|
)?.transactionExplorer}/${transaction.hash}`,
|
|
1279
1292
|
target: "_blank",
|
|
1280
1293
|
rel: "noreferrer",
|
|
1281
|
-
className: "ml-2 no-underline",
|
|
1294
|
+
className: "xpay-ml-2 xpay-no-underline",
|
|
1282
1295
|
"aria-label": "Show the transaction in the chain explorer",
|
|
1283
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "w-3.5 h-3.5", children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ArrowUpRightIcon, {}) })
|
|
1296
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "xpay-w-3.5 xpay-h-3.5", children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ArrowUpRightIcon, {}) })
|
|
1284
1297
|
}
|
|
1285
1298
|
)
|
|
1286
1299
|
] })
|
|
1287
1300
|
] }),
|
|
1288
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex justify-between flex-wrap gap-2", children: [
|
|
1289
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex items-center", children: [
|
|
1290
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex items-center", children: [
|
|
1301
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "xpay-flex xpay-justify-between xpay-flex-wrap xpay-gap-2", children: [
|
|
1302
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "xpay-flex xpay-items-center", children: [
|
|
1303
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "xpay-flex xpay-items-center", children: [
|
|
1291
1304
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
1292
1305
|
"img",
|
|
1293
1306
|
{
|
|
1294
1307
|
src: sourceChainData?.image,
|
|
1295
1308
|
alt: `${sourceChainData?.name} logo`,
|
|
1296
|
-
className: "w-5 h-5 mr-1"
|
|
1309
|
+
className: "xpay-w-5 xpay-h-5 xpay-mr-1"
|
|
1297
1310
|
}
|
|
1298
1311
|
),
|
|
1299
1312
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { children: sourceChainData?.displayName })
|
|
1300
1313
|
] }),
|
|
1301
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "w-3.5 h-3.5 my-0 mx-1.5", children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ArrowRightIcon, {}) }),
|
|
1302
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex items-center", children: [
|
|
1314
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "xpay-w-3.5 xpay-h-3.5 xpay-my-0 xpay-mx-1.5", children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ArrowRightIcon, {}) }),
|
|
1315
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "xpay-flex xpay-items-center", children: [
|
|
1303
1316
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
1304
1317
|
"img",
|
|
1305
1318
|
{
|
|
1306
1319
|
src: targetChainData?.image,
|
|
1307
1320
|
alt: `${targetChainData?.name} logo`,
|
|
1308
|
-
className: "w-5 h-5 mr-1"
|
|
1321
|
+
className: "xpay-w-5 xpay-h-5 xpay-mr-1"
|
|
1309
1322
|
}
|
|
1310
1323
|
),
|
|
1311
1324
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { children: targetChainData?.displayName })
|
|
1312
1325
|
] })
|
|
1313
1326
|
] }),
|
|
1314
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "flex items-center mb-2 last:mb-0", children: /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex items-center flex-wrap", children: [
|
|
1315
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex items-center", children: [
|
|
1327
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "xpay-flex xpay-items-center xpay-mb-2 last:xpay-mb-0", children: /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "xpay-flex xpay-items-center xpay-flex-wrap", children: [
|
|
1328
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "xpay-flex xpay-items-center", children: [
|
|
1316
1329
|
Number(transferredAmount) < MINIMUM_DISPLAYED_TOKEN_AMOUNT ? `<${MINIMUM_DISPLAYED_TOKEN_AMOUNT}` : transferredAmount,
|
|
1317
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "ml-1", children: tokenData?.symbol }),
|
|
1330
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "xpay-ml-1", children: tokenData?.symbol }),
|
|
1318
1331
|
tokenData?.image ? /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
1319
1332
|
"img",
|
|
1320
1333
|
{
|
|
1321
1334
|
src: tokenData?.image,
|
|
1322
1335
|
alt: tokenData?.name || "",
|
|
1323
|
-
className: "w-5 h-5 ml-1"
|
|
1336
|
+
className: "xpay-w-5 xpay-h-5 xpay-ml-1"
|
|
1324
1337
|
}
|
|
1325
|
-
) : /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("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) })
|
|
1338
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("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) })
|
|
1326
1339
|
] }),
|
|
1327
1340
|
transaction.tokenOutAddress && /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_jsx_runtime27.Fragment, { children: [
|
|
1328
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "w-3.5 h-3.5 my-0 mx-1.5", children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ArrowRightIcon, {}) }),
|
|
1329
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex items-center", children: [
|
|
1341
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "xpay-w-3.5 xpay-h-3.5 xpay-my-0 xpay-mx-1.5", children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ArrowRightIcon, {}) }),
|
|
1342
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "xpay-flex xpay-items-center", children: [
|
|
1330
1343
|
Number(receivedAmount) < 1e-4 ? "<0.0001" : receivedAmount,
|
|
1331
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "ml-1", children: tokenOutData?.symbol }),
|
|
1344
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "xpay-ml-1", children: tokenOutData?.symbol }),
|
|
1332
1345
|
tokenOutData?.image ? /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
1333
1346
|
"img",
|
|
1334
1347
|
{
|
|
1335
1348
|
src: tokenOutData?.image,
|
|
1336
1349
|
alt: tokenOutData?.name || "",
|
|
1337
|
-
className: "w-5 h-5 ml-1"
|
|
1350
|
+
className: "xpay-w-5 xpay-h-5 xpay-ml-1"
|
|
1338
1351
|
}
|
|
1339
|
-
) : /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("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) })
|
|
1352
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("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) })
|
|
1340
1353
|
] })
|
|
1341
1354
|
] })
|
|
1342
1355
|
] }) })
|
|
@@ -1355,15 +1368,35 @@ var History = ({ signer, supportedChains }) => {
|
|
|
1355
1368
|
const fetchedTransactions = [];
|
|
1356
1369
|
if (downloadedHistory) {
|
|
1357
1370
|
for (const entry of downloadedHistory.history) {
|
|
1371
|
+
let status = "IN_PROGRESS";
|
|
1358
1372
|
if (!entry.source) {
|
|
1359
1373
|
continue;
|
|
1360
1374
|
}
|
|
1361
|
-
|
|
1362
|
-
|
|
1375
|
+
if (entry.failed) {
|
|
1376
|
+
status = "REVERTED";
|
|
1377
|
+
}
|
|
1363
1378
|
if (!!entry.target) {
|
|
1364
1379
|
status = "DONE";
|
|
1365
|
-
}
|
|
1366
|
-
|
|
1380
|
+
}
|
|
1381
|
+
if (entry.transferType === "SINGLE_CHAIN") {
|
|
1382
|
+
if (!entry.target) {
|
|
1383
|
+
continue;
|
|
1384
|
+
}
|
|
1385
|
+
const blockTimestampMs2 = new Date(entry.target.blockTime).getTime();
|
|
1386
|
+
const estimatedDeliveryTimestamp2 = blockTimestampMs2 / 1e3;
|
|
1387
|
+
fetchedTransactions.push({
|
|
1388
|
+
hash: entry.target.transactionHash,
|
|
1389
|
+
timestamp: blockTimestampMs2 / 1e3,
|
|
1390
|
+
sourceChainId: entry.target.blockchainId,
|
|
1391
|
+
targetChainId: entry.target.blockchainId,
|
|
1392
|
+
amountWei: entry.source.tokenAmount,
|
|
1393
|
+
tokenAddress: entry.source.tokenAddress,
|
|
1394
|
+
tokenOutAddress: entry.target?.tokenAmount,
|
|
1395
|
+
tokenOutAmount: entry.target?.tokenAmount,
|
|
1396
|
+
estimatedDeliveryTimestamp: estimatedDeliveryTimestamp2,
|
|
1397
|
+
status
|
|
1398
|
+
});
|
|
1399
|
+
continue;
|
|
1367
1400
|
}
|
|
1368
1401
|
const blockTimestampMs = new Date(entry.source.blockTime).getTime();
|
|
1369
1402
|
const estimatedDeliveryTimestamp = new import_bignumber2.default(
|
|
@@ -1397,10 +1430,10 @@ var History = ({ signer, supportedChains }) => {
|
|
|
1397
1430
|
return () => clearInterval(timer);
|
|
1398
1431
|
}, [signer, fetchHistory, getHistory, historyLoadedOnce]);
|
|
1399
1432
|
if (!signer)
|
|
1400
|
-
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "flex items-center justify-center w-full h-[30vh]", children: "Connect a wallet to browse history" });
|
|
1401
|
-
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "flex items-center justify-center w-full", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "w-full h-96 overflow-scroll overflow-x-hidden", children: [
|
|
1402
|
-
fetchedHistory?.length === 0 && historyLoadedOnce && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "w-full text-center py-4 px-0 text-[rgb(158,158,158)]", children: "Your history is empty..." }),
|
|
1403
|
-
!fetchedHistory && !historyLoadedOnce && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "flex w-full h-full items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(CircularProgressIcon, {}) }),
|
|
1433
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "xpay-flex xpay-items-center xpay-justify-center xpay-w-full xpay-h-[30vh]", children: "Connect a wallet to browse history" });
|
|
1434
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "xpay-flex xpay-items-center xpay-justify-center xpay-w-full", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "xpay-w-full xpay-h-96 xpay-overflow-scroll xpay-overflow-x-hidden", children: [
|
|
1435
|
+
fetchedHistory?.length === 0 && historyLoadedOnce && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("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..." }),
|
|
1436
|
+
!fetchedHistory && !historyLoadedOnce && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "xpay-flex xpay-w-full xpay-h-full xpay-items-center xpay-justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(CircularProgressIcon, {}) }),
|
|
1404
1437
|
fetchedHistory?.map((transaction, index) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
1405
1438
|
HistoryCard,
|
|
1406
1439
|
{
|
|
@@ -1421,26 +1454,26 @@ var TopBar = ({
|
|
|
1421
1454
|
historyTabShown,
|
|
1422
1455
|
onClose
|
|
1423
1456
|
}) => {
|
|
1424
|
-
return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "flex w-full justify-between items-center mx-auto p-2", children: [
|
|
1425
|
-
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("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` }),
|
|
1426
|
-
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "flex gap-2 justify-center items-center", children: [
|
|
1457
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "xpay-flex xpay-w-full xpay-justify-between xpay-items-center xpay-mx-auto xpay-p-2", children: [
|
|
1458
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("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` }),
|
|
1459
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "xpay-flex xpay-gap-2 xpay-justify-center xpay-items-center", children: [
|
|
1427
1460
|
!historyTabShown && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
1428
1461
|
"div",
|
|
1429
1462
|
{
|
|
1430
1463
|
onClick: () => setSettingsShown(true),
|
|
1431
|
-
className: "flex items-center text-xs gap-1 cursor-pointer",
|
|
1432
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("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__ */ (0, import_jsx_runtime29.jsx)(SettingsIcon, {}) })
|
|
1464
|
+
className: "xpay-flex xpay-items-center xpay-text-xs xpay-gap-1 xpay-cursor-pointer",
|
|
1465
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("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__ */ (0, import_jsx_runtime29.jsx)(SettingsIcon, {}) })
|
|
1433
1466
|
}
|
|
1434
1467
|
),
|
|
1435
1468
|
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
1436
1469
|
"div",
|
|
1437
1470
|
{
|
|
1438
1471
|
onClick: () => setHistoryTabShown((x) => !x),
|
|
1439
|
-
className: "flex items-center text-sm gap-1 cursor-pointer",
|
|
1440
|
-
children: !historyTabShown ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_jsx_runtime29.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("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__ */ (0, import_jsx_runtime29.jsx)(HistoryIcon, {}) }) }) : /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { children: "Back" })
|
|
1472
|
+
className: "xpay-flex xpay-items-center xpay-text-sm xpay-gap-1 xpay-cursor-pointer",
|
|
1473
|
+
children: !historyTabShown ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_jsx_runtime29.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("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__ */ (0, import_jsx_runtime29.jsx)(HistoryIcon, {}) }) }) : /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { children: "Back" })
|
|
1441
1474
|
}
|
|
1442
1475
|
),
|
|
1443
|
-
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "cursor-pointer text-white", onClick: onClose, children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(CloseIcon, {}) })
|
|
1476
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "xpay-cursor-pointer xpay-text-white", onClick: onClose, children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(CloseIcon, {}) })
|
|
1444
1477
|
] })
|
|
1445
1478
|
] });
|
|
1446
1479
|
};
|
|
@@ -1464,53 +1497,53 @@ var Settings = ({
|
|
|
1464
1497
|
);
|
|
1465
1498
|
}
|
|
1466
1499
|
}, [slippageActivePresetIndex, usingSlippageInput]);
|
|
1467
|
-
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("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__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex flex-col gap-4 justify-between", children: [
|
|
1468
|
-
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex justify-between", children: [
|
|
1469
|
-
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "text-base", children: "Settings" }),
|
|
1500
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("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__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "xpay-flex xpay-flex-col xpay-gap-4 xpay-justify-between", children: [
|
|
1501
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "xpay-flex xpay-justify-between", children: [
|
|
1502
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "xpay-text-base", children: "Settings" }),
|
|
1470
1503
|
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
1471
1504
|
"div",
|
|
1472
1505
|
{
|
|
1473
|
-
className: "cursor-pointer",
|
|
1506
|
+
className: "xpay-cursor-pointer",
|
|
1474
1507
|
onClick: () => setSettingsShown(false),
|
|
1475
1508
|
children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(CloseIcon, {})
|
|
1476
1509
|
}
|
|
1477
1510
|
)
|
|
1478
1511
|
] }),
|
|
1479
1512
|
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { children: [
|
|
1480
|
-
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex gap-2 items-center", children: [
|
|
1481
|
-
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "text-sm text-[rgba(255,255,255,0.6)]", children: "Express delivery" }),
|
|
1513
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "xpay-flex xpay-gap-2 xpay-items-center", children: [
|
|
1514
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "xpay-text-sm xpay-text-[rgba(255,255,255,0.6)]", children: "Express delivery" }),
|
|
1482
1515
|
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
|
|
1483
1516
|
"span",
|
|
1484
1517
|
{
|
|
1485
|
-
className: "inline-flex w-14 h-9 p-3 relative align-middle box-border overflow-hidden cursor-pointer",
|
|
1518
|
+
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",
|
|
1486
1519
|
onClick: () => {
|
|
1487
1520
|
setExpressChecked((x) => !x);
|
|
1488
1521
|
},
|
|
1489
1522
|
children: [
|
|
1490
|
-
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: "h-full, w-full rounded-lg bg-[rgba(255,255,255,0.3)]" }),
|
|
1523
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: "xpay-h-full, xpay-w-full xpay-rounded-lg xpay-bg-[rgba(255,255,255,0.3)]" }),
|
|
1491
1524
|
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
1492
1525
|
"span",
|
|
1493
1526
|
{
|
|
1494
|
-
className: `transition-all w-5 h-5 rounded-full absolute translate-y-[-4px]
|
|
1495
|
-
${expressChecked ? "translate-x-[12px] bg-x_blue" : "bg-white"} `
|
|
1527
|
+
className: `xpay-transition-all xpay-w-5 xpay-h-5 xpay-rounded-full xpay-absolute xpay-translate-y-[-4px]
|
|
1528
|
+
${expressChecked ? "xpay-translate-x-[12px] xpay-bg-x_blue" : "xpay-bg-white"} `
|
|
1496
1529
|
}
|
|
1497
1530
|
)
|
|
1498
1531
|
]
|
|
1499
1532
|
}
|
|
1500
1533
|
) })
|
|
1501
1534
|
] }),
|
|
1502
|
-
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex gap-4", children: [
|
|
1503
|
-
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "min-w-[26px] min-h-[26px] text-[#ffa726]", children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(InfoIcon, {}) }),
|
|
1504
|
-
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("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." })
|
|
1535
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "xpay-flex xpay-gap-4", children: [
|
|
1536
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "xpay-min-w-[26px] xpay-min-h-[26px] xpay-text-[#ffa726]", children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(InfoIcon, {}) }),
|
|
1537
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("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." })
|
|
1505
1538
|
] })
|
|
1506
1539
|
] }),
|
|
1507
|
-
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex flex-col gap-2
|
|
1508
|
-
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "
|
|
1509
|
-
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex gap-2", children: [
|
|
1510
|
-
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "flex items-center bg-[rgba(15,15,15,1)] p-1
|
|
1540
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "xpay-flex xpay-flex-col xpay-gap-2", children: [
|
|
1541
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "xpay-text-[rgba(255,255,255,0.6)] xpay-text-sm", children: "Slippage" }),
|
|
1542
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "xpay-flex xpay-gap-2", children: [
|
|
1543
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("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__ */ (0, import_jsx_runtime30.jsx)(
|
|
1511
1544
|
"div",
|
|
1512
1545
|
{
|
|
1513
|
-
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]" : ""}`,
|
|
1546
|
+
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]" : ""}`,
|
|
1514
1547
|
onClick: () => {
|
|
1515
1548
|
setUsingSlippageInput(false);
|
|
1516
1549
|
setSlippageActivePresetIndex(index);
|
|
@@ -1519,11 +1552,11 @@ var Settings = ({
|
|
|
1519
1552
|
},
|
|
1520
1553
|
index
|
|
1521
1554
|
)) }),
|
|
1522
|
-
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("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: [
|
|
1555
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("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: [
|
|
1523
1556
|
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
1524
1557
|
"input",
|
|
1525
1558
|
{
|
|
1526
|
-
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",
|
|
1559
|
+
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",
|
|
1527
1560
|
placeholder: "1.5",
|
|
1528
1561
|
value: usingSlippageInput ? slippage : "",
|
|
1529
1562
|
onChange: (e) => {
|
|
@@ -1542,9 +1575,9 @@ var Settings = ({
|
|
|
1542
1575
|
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(PercentageIcon, {})
|
|
1543
1576
|
] })
|
|
1544
1577
|
] }),
|
|
1545
|
-
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex gap-4", children: [
|
|
1546
|
-
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "min-w-[26px] min-h-[26px] text-[#ffa726]", children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(InfoIcon, {}) }),
|
|
1547
|
-
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "text-xs text-left", children: [
|
|
1578
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "xpay-flex xpay-gap-4", children: [
|
|
1579
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "xpay-min-w-[26px] xpay-min-h-[26px] xpay-text-[#ffa726]", children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(InfoIcon, {}) }),
|
|
1580
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "xpay-text-xs xpay-text-left", children: [
|
|
1548
1581
|
"Slippage is the price variation you are willing to accept in the event that the price of the trade changes while it is processing.",
|
|
1549
1582
|
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("br", {}),
|
|
1550
1583
|
" ",
|
|
@@ -1557,6 +1590,7 @@ var Settings = ({
|
|
|
1557
1590
|
};
|
|
1558
1591
|
|
|
1559
1592
|
// src/components/TxConfigForm/FeesDetails.tsx
|
|
1593
|
+
var import_react5 = require("react");
|
|
1560
1594
|
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
1561
1595
|
var FeesDetails = ({
|
|
1562
1596
|
isGettingRoute,
|
|
@@ -1569,12 +1603,15 @@ var FeesDetails = ({
|
|
|
1569
1603
|
feesDetailsShown,
|
|
1570
1604
|
setFeesDetailsShown
|
|
1571
1605
|
}) => {
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1606
|
+
const isExpressDeliveryPossible = (0, import_react5.useMemo)(() => {
|
|
1607
|
+
return expressChecked && !exceedsExpressDeliveryLimit;
|
|
1608
|
+
}, [expressChecked, exceedsExpressDeliveryLimit]);
|
|
1609
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("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: [
|
|
1610
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "xpay-flex xpay-w-full xpay-items-center xpay-justify-between xpay-text-xs sm:xpay-text-sm", children: [
|
|
1611
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "xpay-flex xpay-items-center xpay-gap-1 xpay-font-medium xpay-text-white xpay-opacity-60", children: [
|
|
1575
1612
|
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(CoinsIcon, {}),
|
|
1576
|
-
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "mr-1", children: "Fees:" }),
|
|
1577
|
-
isGettingRoute ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Skeleton, { width: "w-20", height: "h-4" }) : ` ${weiToHumanReadable({
|
|
1613
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "xpay-mr-1", children: "Fees:" }),
|
|
1614
|
+
isGettingRoute ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Skeleton, { width: "xpay-w-20", height: "xpay-h-4" }) : ` ${weiToHumanReadable({
|
|
1578
1615
|
amount: safeBigNumberFrom(
|
|
1579
1616
|
route?.xSwapFees.xSwapFee.nativeFee || "0"
|
|
1580
1617
|
).add(safeBigNumberFrom(route?.xSwapFees.ccipFee || "0")).add(
|
|
@@ -1584,14 +1621,14 @@ var FeesDetails = ({
|
|
|
1584
1621
|
precisionFractionalPlaces: 5
|
|
1585
1622
|
})} ${paymentToken?.symbol}`
|
|
1586
1623
|
] }),
|
|
1587
|
-
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex gap-1 items-center", children: [
|
|
1588
|
-
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
|
|
1624
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "xpay-flex xpay-gap-1 xpay-items-center", children: [
|
|
1625
|
+
route?.xSwapFees.expressDeliveryFee && !isGettingRoute && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
|
|
1589
1626
|
"div",
|
|
1590
1627
|
{
|
|
1591
|
-
className: `flex gap-1 items-center font-medium ${
|
|
1628
|
+
className: `xpay-flex xpay-gap-1 xpay-items-center xpay-font-medium ${isExpressDeliveryPossible ? "xpay-text-x_green" : "xpay-text-white xpay-opacity-60"}`,
|
|
1592
1629
|
children: [
|
|
1593
1630
|
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(TimerIcon, {}),
|
|
1594
|
-
|
|
1631
|
+
isExpressDeliveryPossible ? "Fast ~ 30sec " : "Normal ~ 30min"
|
|
1595
1632
|
]
|
|
1596
1633
|
}
|
|
1597
1634
|
),
|
|
@@ -1599,39 +1636,39 @@ var FeesDetails = ({
|
|
|
1599
1636
|
"div",
|
|
1600
1637
|
{
|
|
1601
1638
|
onClick: () => setFeesDetailsShown((x) => !x),
|
|
1602
|
-
className: "font-medium text-white opacity-60 cursor-pointer flex items-center w-[15px] h-[9px]",
|
|
1639
|
+
className: "xpay-font-medium xpay-text-white xpay-opacity-60 xpay-cursor-pointer xpay-flex xpay-items-center xpay-w-[15px] xpay-h-[9px]",
|
|
1603
1640
|
children: feesDetailsShown ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(ChevronUpIcon, {}) : /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(ChevronDownIcon, {})
|
|
1604
1641
|
}
|
|
1605
1642
|
)
|
|
1606
1643
|
] })
|
|
1607
1644
|
] }),
|
|
1608
|
-
feesDetailsShown && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex w-full items-center justify-between gap-2", children: [
|
|
1609
|
-
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex flex-col text-[10px] gap-1", children: [
|
|
1610
|
-
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex justify-between font-medium text-white opacity-60 gap-1", children: [
|
|
1645
|
+
feesDetailsShown && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "xpay-flex xpay-w-full xpay-items-center xpay-justify-between xpay-gap-2", children: [
|
|
1646
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "xpay-flex xpay-flex-col xpay-text-[10px] xpay-gap-1", children: [
|
|
1647
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "xpay-flex xpay-justify-between xpay-font-medium xpay-text-white xpay-opacity-60 xpay-gap-1", children: [
|
|
1611
1648
|
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { children: "CCIP Fee:" }),
|
|
1612
|
-
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "whitespace-nowrap", children: ` ${weiToHumanReadable({
|
|
1649
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "xpay-whitespace-nowrap", children: ` ${weiToHumanReadable({
|
|
1613
1650
|
amount: route?.xSwapFees.ccipFee || "0",
|
|
1614
1651
|
decimals: 18,
|
|
1615
1652
|
precisionFractionalPlaces: 5
|
|
1616
1653
|
})} ${paymentToken?.symbol}` })
|
|
1617
1654
|
] }),
|
|
1618
|
-
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex justify-between font-medium text-white opacity-60 gap-1", children: [
|
|
1655
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "xpay-flex xpay-justify-between xpay-font-medium xpay-text-white xpay-opacity-60 xpay-gap-1", children: [
|
|
1619
1656
|
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { children: "Native Fee:" }),
|
|
1620
|
-
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "whitespace-nowrap", children: ` ${weiToHumanReadable({
|
|
1657
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "xpay-whitespace-nowrap", children: ` ${weiToHumanReadable({
|
|
1621
1658
|
amount: route?.xSwapFees.xSwapFee.nativeFee || "0",
|
|
1622
1659
|
decimals: 18,
|
|
1623
1660
|
precisionFractionalPlaces: 5
|
|
1624
1661
|
})} ${paymentToken?.symbol}` })
|
|
1625
1662
|
] })
|
|
1626
1663
|
] }),
|
|
1627
|
-
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex flex-col text-[10px] gap-1", children: [
|
|
1628
|
-
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex justify-between font-medium text-white opacity-60 gap-1", children: [
|
|
1664
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "xpay-flex xpay-flex-col xpay-text-[10px] xpay-gap-1", children: [
|
|
1665
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "xpay-flex xpay-justify-between xpay-font-medium xpay-text-white xpay-opacity-60 xpay-gap-1", children: [
|
|
1629
1666
|
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { children: "Slippage:" }),
|
|
1630
|
-
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "whitespace-nowrap", children: `${slippage}%` })
|
|
1667
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "xpay-whitespace-nowrap", children: `${slippage}%` })
|
|
1631
1668
|
] }),
|
|
1632
|
-
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex justify-between font-medium text-white opacity-60 gap-1", children: [
|
|
1669
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "xpay-flex xpay-justify-between xpay-font-medium xpay-text-white xpay-opacity-60 xpay-gap-1", children: [
|
|
1633
1670
|
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { children: "Min amount out:" }),
|
|
1634
|
-
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "whitespace-nowrap", children: [
|
|
1671
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "xpay-whitespace-nowrap", children: [
|
|
1635
1672
|
weiToHumanReadable({
|
|
1636
1673
|
amount: route?.minAmountOut || "0",
|
|
1637
1674
|
decimals: dstToken?.decimals || 18,
|
|
@@ -1647,10 +1684,10 @@ var FeesDetails = ({
|
|
|
1647
1684
|
};
|
|
1648
1685
|
|
|
1649
1686
|
// src/components/TxConfigForm/Summary.tsx
|
|
1650
|
-
var
|
|
1687
|
+
var import_react7 = require("react");
|
|
1651
1688
|
|
|
1652
1689
|
// src/components/TxConfigForm/UsdPrice.tsx
|
|
1653
|
-
var
|
|
1690
|
+
var import_react6 = require("react");
|
|
1654
1691
|
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
1655
1692
|
var UsdPrice = ({
|
|
1656
1693
|
prices,
|
|
@@ -1660,8 +1697,8 @@ var UsdPrice = ({
|
|
|
1660
1697
|
type,
|
|
1661
1698
|
setExceedsExpressDeliveryLimit
|
|
1662
1699
|
}) => {
|
|
1663
|
-
const [usdPrice, setUsdPrice] = (0,
|
|
1664
|
-
(0,
|
|
1700
|
+
const [usdPrice, setUsdPrice] = (0, import_react6.useState)("0.00");
|
|
1701
|
+
(0, import_react6.useEffect)(() => {
|
|
1665
1702
|
if (token && prices && prices[token.address]) {
|
|
1666
1703
|
const newUsdPrice = (Number(amount) * Number(prices[token.address])).toFixed(2);
|
|
1667
1704
|
if (type === "src" && setExceedsExpressDeliveryLimit) {
|
|
@@ -1672,19 +1709,31 @@ var UsdPrice = ({
|
|
|
1672
1709
|
setUsdPrice(newUsdPrice);
|
|
1673
1710
|
}
|
|
1674
1711
|
}, [token, prices, amount]);
|
|
1675
|
-
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "opacity-60 py-4", children: loading ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Skeleton, { width: "w-12", height: "h-4" }) : token ? prices && prices[token.address] ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { children: `$${usdPrice}` }) : /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Alert, { desc: "Unknown price" }) : /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_jsx_runtime32.Fragment, { children: "$0.00" }) });
|
|
1712
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "xpay-opacity-60 xpay-py-4", children: loading ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Skeleton, { width: "xpay-w-12", height: "xpay-h-4" }) : token ? prices && prices[token.address] ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { children: `$${usdPrice}` }) : /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Alert, { desc: "Unknown price" }) : /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_jsx_runtime32.Fragment, { children: "$0.00" }) });
|
|
1676
1713
|
};
|
|
1677
1714
|
|
|
1678
|
-
// src/components/
|
|
1715
|
+
// src/components/UnknownTokenLogo/UnknownTokenLogo.tsx
|
|
1679
1716
|
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
1717
|
+
var UnknownTokenLogo = ({ tokenName, className }) => {
|
|
1718
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
1719
|
+
"div",
|
|
1720
|
+
{
|
|
1721
|
+
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}`,
|
|
1722
|
+
children: tokenName.substring(0, 1)
|
|
1723
|
+
}
|
|
1724
|
+
);
|
|
1725
|
+
};
|
|
1726
|
+
|
|
1727
|
+
// src/components/TxConfigForm/Summary.tsx
|
|
1728
|
+
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
1680
1729
|
var Summary = ({
|
|
1681
1730
|
isGettingRoute,
|
|
1682
1731
|
route,
|
|
1683
1732
|
dstToken,
|
|
1684
1733
|
dstChain
|
|
1685
1734
|
}) => {
|
|
1686
|
-
const [prices, setPrices] = (0,
|
|
1687
|
-
const amountReadable = (0,
|
|
1735
|
+
const [prices, setPrices] = (0, import_react7.useState)();
|
|
1736
|
+
const amountReadable = (0, import_react7.useMemo)(
|
|
1688
1737
|
() => weiToHumanReadable({
|
|
1689
1738
|
amount: route?.estAmountOut || "0",
|
|
1690
1739
|
decimals: dstToken?.decimals || 18,
|
|
@@ -1692,41 +1741,51 @@ var Summary = ({
|
|
|
1692
1741
|
}),
|
|
1693
1742
|
[route, dstToken]
|
|
1694
1743
|
);
|
|
1695
|
-
(0,
|
|
1744
|
+
(0, import_react7.useEffect)(() => {
|
|
1696
1745
|
if (dstChain) {
|
|
1697
1746
|
getPrices({ chainId: dstChain.chainId, currency: "USD" }).then(
|
|
1698
1747
|
(prices2) => setPrices(prices2)
|
|
1699
1748
|
);
|
|
1700
1749
|
}
|
|
1701
1750
|
}, [dstChain]);
|
|
1702
|
-
return /* @__PURE__ */ (0,
|
|
1703
|
-
/* @__PURE__ */ (0,
|
|
1704
|
-
/* @__PURE__ */ (0,
|
|
1705
|
-
/* @__PURE__ */ (0,
|
|
1706
|
-
isGettingRoute ? /* @__PURE__ */ (0,
|
|
1751
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("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: [
|
|
1752
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "xpay-flex xpay-justify-between", children: [
|
|
1753
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "xpay-flex xpay-flex-col xpay-gap-1", children: [
|
|
1754
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("p", { className: "xpay-text-[rgba(255,255,255,0.6)] xpay-text-sm", children: "You receive" }),
|
|
1755
|
+
isGettingRoute ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
1707
1756
|
Skeleton,
|
|
1708
1757
|
{
|
|
1709
|
-
width: "w-[100px]",
|
|
1710
|
-
height: "h-[36px]",
|
|
1711
|
-
other: "sm:w-[190px]"
|
|
1758
|
+
width: "xpay-w-[100px]",
|
|
1759
|
+
height: "xpay-h-[36px]",
|
|
1760
|
+
other: "sm:xpay-w-[190px]"
|
|
1712
1761
|
}
|
|
1713
|
-
) : /* @__PURE__ */ (0,
|
|
1762
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "xpay-flex xpay-gap-2 xpay-items-center xpay-text-white xpay-text-xl sm:xpay-text-3xl", children: amountReadable })
|
|
1714
1763
|
] }),
|
|
1715
|
-
/* @__PURE__ */ (0,
|
|
1716
|
-
/* @__PURE__ */ (0,
|
|
1717
|
-
/* @__PURE__ */ (0,
|
|
1718
|
-
|
|
1764
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "xpay-flex xpay-flex-col xpay-items-end xpay-gap-1 xpay-text-sm", children: [
|
|
1765
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "xpay-flex xpay-justify-center xpay-items-center xpay-gap-1", children: [
|
|
1766
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "xpay-w-5 xpay-h-5", children: dstToken?.image ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
1767
|
+
"img",
|
|
1768
|
+
{
|
|
1769
|
+
className: "xpay-w-5 xpay-h-5",
|
|
1770
|
+
src: dstToken?.image,
|
|
1771
|
+
alt: dstToken?.name
|
|
1772
|
+
}
|
|
1773
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(UnknownTokenLogo, { tokenName: "?" }) }),
|
|
1774
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("p", { className: "xpay-text-base sm:xpay-text-xl", children: dstToken?.name })
|
|
1719
1775
|
] }),
|
|
1720
|
-
/* @__PURE__ */ (0,
|
|
1721
|
-
/* @__PURE__ */ (0,
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1776
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "xpay-flex xpay-justify-center xpay-items-center xpay-gap-1", children: [
|
|
1777
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("p", { className: "xpay-text-[rgba(255,255,255,0.6)] xpay-text-right", children: [
|
|
1778
|
+
"on",
|
|
1779
|
+
" "
|
|
1780
|
+
] }),
|
|
1781
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "xpay-flex xpay-items-center xpay-gap-1 xpay-text-white", children: [
|
|
1782
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "xpay-w-4 xpay-h-4", children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("img", { src: dstChain?.image, alt: dstChain?.name }) }),
|
|
1783
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { children: dstChain?.displayName })
|
|
1725
1784
|
] })
|
|
1726
1785
|
] })
|
|
1727
1786
|
] })
|
|
1728
1787
|
] }),
|
|
1729
|
-
/* @__PURE__ */ (0,
|
|
1788
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
1730
1789
|
UsdPrice,
|
|
1731
1790
|
{
|
|
1732
1791
|
prices,
|
|
@@ -1736,17 +1795,17 @@ var Summary = ({
|
|
|
1736
1795
|
type: "dst"
|
|
1737
1796
|
}
|
|
1738
1797
|
),
|
|
1739
|
-
/* @__PURE__ */ (0,
|
|
1798
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("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__ */ (0, import_jsx_runtime34.jsx)("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__ */ (0, import_jsx_runtime34.jsx)(ArrowDownIcon, {}) }) })
|
|
1740
1799
|
] });
|
|
1741
1800
|
};
|
|
1742
1801
|
|
|
1743
1802
|
// src/components/TxConfigForm/SwapPanel.tsx
|
|
1744
|
-
var
|
|
1803
|
+
var import_react10 = require("react");
|
|
1745
1804
|
|
|
1746
1805
|
// src/components/TxConfigForm/TokenPicker.tsx
|
|
1747
|
-
var
|
|
1806
|
+
var import_react8 = require("react");
|
|
1748
1807
|
var import_react_dom = require("react-dom");
|
|
1749
|
-
var
|
|
1808
|
+
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
1750
1809
|
var TokenPicker = ({
|
|
1751
1810
|
onCloseClick,
|
|
1752
1811
|
tokens,
|
|
@@ -1755,8 +1814,7 @@ var TokenPicker = ({
|
|
|
1755
1814
|
signer,
|
|
1756
1815
|
balances
|
|
1757
1816
|
}) => {
|
|
1758
|
-
const [searchValue, setSearchValue] = (0,
|
|
1759
|
-
const modalRoot = document.querySelector("#xswap-modal");
|
|
1817
|
+
const [searchValue, setSearchValue] = (0, import_react8.useState)("");
|
|
1760
1818
|
const onBackdropClick = (e) => {
|
|
1761
1819
|
e.stopPropagation();
|
|
1762
1820
|
e.nativeEvent.stopImmediatePropagation();
|
|
@@ -1764,7 +1822,7 @@ var TokenPicker = ({
|
|
|
1764
1822
|
onCloseClick();
|
|
1765
1823
|
}
|
|
1766
1824
|
};
|
|
1767
|
-
const filteredTokens = (0,
|
|
1825
|
+
const filteredTokens = (0, import_react8.useMemo)(() => {
|
|
1768
1826
|
const isMatch = (value, searchValue2) => value.toLowerCase().indexOf(searchValue2.toLowerCase()) > -1;
|
|
1769
1827
|
return tokens?.filter(
|
|
1770
1828
|
(token) => isMatch(token.symbol, searchValue) || isMatch(token.name, searchValue) || token.address === searchValue.toLowerCase()
|
|
@@ -1772,91 +1830,92 @@ var TokenPicker = ({
|
|
|
1772
1830
|
(a, b) => a.priority < b.priority ? 1 : balances && balances[a.address] && balances[b.address] && balances[a.address]?.lte(balances[b.address] || "0") ? 1 : -1
|
|
1773
1831
|
);
|
|
1774
1832
|
}, [searchValue, tokens]);
|
|
1775
|
-
|
|
1776
|
-
|
|
1833
|
+
const xpayRoot2 = document.querySelector("#xpay-root");
|
|
1834
|
+
return xpayRoot2 ? (0, import_react_dom.createPortal)(
|
|
1835
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
1777
1836
|
"div",
|
|
1778
1837
|
{
|
|
1779
1838
|
onClick: onBackdropClick,
|
|
1780
|
-
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",
|
|
1781
|
-
children: /* @__PURE__ */ (0,
|
|
1782
|
-
/* @__PURE__ */ (0,
|
|
1839
|
+
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",
|
|
1840
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("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: [
|
|
1841
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
1783
1842
|
"div",
|
|
1784
1843
|
{
|
|
1785
1844
|
onClick: onCloseClick,
|
|
1786
|
-
className: "absolute top-4 right-4 cursor-pointer",
|
|
1787
|
-
children: /* @__PURE__ */ (0,
|
|
1845
|
+
className: "xpay-absolute xpay-top-4 xpay-right-4 xpay-cursor-pointer",
|
|
1846
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(CloseIcon, {})
|
|
1788
1847
|
}
|
|
1789
1848
|
),
|
|
1790
|
-
/* @__PURE__ */ (0,
|
|
1791
|
-
/* @__PURE__ */ (0,
|
|
1792
|
-
/* @__PURE__ */ (0,
|
|
1793
|
-
/* @__PURE__ */ (0,
|
|
1849
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("p", { className: "xpay-text-base xpay-mb-4", children: "Pick a token" }),
|
|
1850
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("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: [
|
|
1851
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "xpay-w-6 xpay-h-6", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(SearchIcon, {}) }),
|
|
1852
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
1794
1853
|
"input",
|
|
1795
1854
|
{
|
|
1796
1855
|
placeholder: "Search name or paste address",
|
|
1797
1856
|
value: searchValue,
|
|
1798
1857
|
onChange: (e) => setSearchValue(e.target.value),
|
|
1799
|
-
className: "relative h-[41px] leading-[41px] font-normal z-[1] w-full text-white bg-transparent border-none outline-none placeholder:text-sm"
|
|
1858
|
+
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"
|
|
1800
1859
|
}
|
|
1801
1860
|
)
|
|
1802
1861
|
] }),
|
|
1803
|
-
/* @__PURE__ */ (0,
|
|
1862
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("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__ */ (0, import_jsx_runtime35.jsxs)(
|
|
1804
1863
|
"div",
|
|
1805
1864
|
{
|
|
1806
|
-
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)]" : ""}`,
|
|
1865
|
+
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)]" : ""}`,
|
|
1807
1866
|
onClick: () => {
|
|
1808
1867
|
setSelectedToken(token);
|
|
1809
1868
|
onCloseClick();
|
|
1810
1869
|
},
|
|
1811
1870
|
children: [
|
|
1812
|
-
/* @__PURE__ */ (0,
|
|
1813
|
-
|
|
1871
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
1872
|
+
"img",
|
|
1873
|
+
{
|
|
1874
|
+
src: token.image,
|
|
1875
|
+
alt: token.name,
|
|
1876
|
+
className: "xpay-w-5"
|
|
1877
|
+
}
|
|
1878
|
+
),
|
|
1879
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "xpay-text-sm", children: token.symbol })
|
|
1814
1880
|
]
|
|
1815
1881
|
},
|
|
1816
1882
|
token.address
|
|
1817
1883
|
)) }),
|
|
1818
|
-
/* @__PURE__ */ (0,
|
|
1819
|
-
/* @__PURE__ */ (0,
|
|
1884
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("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)]" }),
|
|
1885
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("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__ */ (0, import_jsx_runtime35.jsxs)(
|
|
1820
1886
|
"div",
|
|
1821
1887
|
{
|
|
1822
|
-
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)]" : ""}`,
|
|
1888
|
+
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)]" : ""}`,
|
|
1823
1889
|
onClick: () => {
|
|
1824
1890
|
setSelectedToken(token);
|
|
1825
1891
|
onCloseClick();
|
|
1826
1892
|
},
|
|
1827
1893
|
children: [
|
|
1828
|
-
token.image ? /* @__PURE__ */ (0,
|
|
1829
|
-
|
|
1830
|
-
{
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
className: "token-picker__all__logo"
|
|
1834
|
-
}
|
|
1835
|
-
) : /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("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) }),
|
|
1836
|
-
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex justify-between items-center gap-1 overflow-hidden grow", children: [
|
|
1837
|
-
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex flex-col leading-[16px]", children: [
|
|
1838
|
-
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "overflow-hidden whitespace-nowrap text-ellipsis text-[15px]", children: token.name }),
|
|
1839
|
-
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "text-[#888] text-[11px]", children: token.symbol })
|
|
1894
|
+
token.image ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("img", { src: token.image, alt: token.name }) : /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("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) }),
|
|
1895
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "xpay-flex xpay-justify-between xpay-items-center xpay-gap-1 xpay-overflow-hidden xpay-grow", children: [
|
|
1896
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "xpay-flex xpay-flex-col xpay-leading-[16px]", children: [
|
|
1897
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "xpay-overflow-hidden xpay-whitespace-nowrap xpay-text-ellipsis xpay-text-[15px]", children: token.name }),
|
|
1898
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "xpay-text-[#888] xpay-text-[11px]", children: token.symbol })
|
|
1840
1899
|
] }),
|
|
1841
|
-
signer && /* @__PURE__ */ (0,
|
|
1900
|
+
signer && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_jsx_runtime35.Fragment, { children: balances && balances[token.address] && token.decimals ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "xpay-text-xs", children: weiToHumanReadable({
|
|
1842
1901
|
amount: balances[token.address]?.toString() || "0",
|
|
1843
1902
|
decimals: token.decimals,
|
|
1844
1903
|
precisionFractionalPlaces: 4
|
|
1845
|
-
}) }) : /* @__PURE__ */ (0,
|
|
1904
|
+
}) }) : /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Skeleton, { width: "xpay-w-12", height: "xpay-h-3" }) })
|
|
1846
1905
|
] })
|
|
1847
1906
|
]
|
|
1848
1907
|
},
|
|
1849
1908
|
`${index}_${token.address}`
|
|
1850
|
-
)) : /* @__PURE__ */ (0,
|
|
1909
|
+
)) : /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "xpay-mt-4 xpay-flex xpay-justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("p", { className: "xpay-text-sm xpay-text-white", children: "No tokens found." }) }) })
|
|
1851
1910
|
] })
|
|
1852
1911
|
}
|
|
1853
1912
|
),
|
|
1854
|
-
|
|
1913
|
+
xpayRoot2
|
|
1855
1914
|
) : null;
|
|
1856
1915
|
};
|
|
1857
1916
|
|
|
1858
1917
|
// src/components/TxConfigForm/ChainListElement.tsx
|
|
1859
|
-
var
|
|
1918
|
+
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
1860
1919
|
var ChainListElement = ({
|
|
1861
1920
|
chain,
|
|
1862
1921
|
setSrcChain,
|
|
@@ -1864,31 +1923,31 @@ var ChainListElement = ({
|
|
|
1864
1923
|
index,
|
|
1865
1924
|
length
|
|
1866
1925
|
}) => {
|
|
1867
|
-
return /* @__PURE__ */ (0,
|
|
1868
|
-
/* @__PURE__ */ (0,
|
|
1926
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { children: [
|
|
1927
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
|
|
1869
1928
|
"li",
|
|
1870
1929
|
{
|
|
1871
|
-
className: "bg-transparent border-none flex gap-1 items-center cursor-pointer py-2 w-full",
|
|
1930
|
+
className: "xpay-bg-transparent xpay-border-none xpay-flex xpay-gap-1 xpay-items-center xpay-cursor-pointer xpay-py-2 xpay-w-full",
|
|
1872
1931
|
onClick: () => {
|
|
1873
1932
|
setSrcChain(chain);
|
|
1874
1933
|
setChainListShown(false);
|
|
1875
1934
|
},
|
|
1876
1935
|
children: [
|
|
1877
|
-
/* @__PURE__ */ (0,
|
|
1936
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("img", { width: 12, height: 12, src: chain.image, alt: chain.displayName }),
|
|
1878
1937
|
chain.displayName
|
|
1879
1938
|
]
|
|
1880
1939
|
}
|
|
1881
1940
|
),
|
|
1882
|
-
index !== length - 1 && /* @__PURE__ */ (0,
|
|
1941
|
+
index !== length - 1 && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "xpay-h-px xpay-mx-2 xpay-bg-[rgba(255,255,255,0.15)]" })
|
|
1883
1942
|
] }, `${chain.ecosystem}-${chain.chainId}`);
|
|
1884
1943
|
};
|
|
1885
1944
|
|
|
1886
1945
|
// src/components/TxConfigForm/BalanceComponent.tsx
|
|
1887
|
-
var
|
|
1946
|
+
var import_react9 = require("react");
|
|
1888
1947
|
var import_bignumber3 = __toESM(require("bignumber.js"));
|
|
1889
|
-
var
|
|
1948
|
+
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
1890
1949
|
var BalanceComponent = ({ srcToken, balances }) => {
|
|
1891
|
-
const balanceText = (0,
|
|
1950
|
+
const balanceText = (0, import_react9.useMemo)(() => {
|
|
1892
1951
|
if (!balances || !srcToken) return "0";
|
|
1893
1952
|
if (balances[srcToken.address]?.toString() === "0") return "0";
|
|
1894
1953
|
const fullHumanReadable = weiToHumanReadable({
|
|
@@ -1906,7 +1965,7 @@ var BalanceComponent = ({ srcToken, balances }) => {
|
|
|
1906
1965
|
precisionFractionalPlaces: 5
|
|
1907
1966
|
});
|
|
1908
1967
|
}, [srcToken, balances]);
|
|
1909
|
-
return /* @__PURE__ */ (0,
|
|
1968
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(import_jsx_runtime37.Fragment, { children: [
|
|
1910
1969
|
"Balance:",
|
|
1911
1970
|
" ",
|
|
1912
1971
|
srcToken && balances ? weiToHumanReadable({
|
|
@@ -1914,12 +1973,12 @@ var BalanceComponent = ({ srcToken, balances }) => {
|
|
|
1914
1973
|
decimals: srcToken.decimals,
|
|
1915
1974
|
precisionFractionalPlaces: 4
|
|
1916
1975
|
}) : 0,
|
|
1917
|
-
/* @__PURE__ */ (0,
|
|
1976
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("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" })
|
|
1918
1977
|
] });
|
|
1919
1978
|
};
|
|
1920
1979
|
|
|
1921
1980
|
// src/components/TxConfigForm/SwapPanel.tsx
|
|
1922
|
-
var
|
|
1981
|
+
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
1923
1982
|
var SwapPanel = ({
|
|
1924
1983
|
amount,
|
|
1925
1984
|
setAmount,
|
|
@@ -1933,10 +1992,10 @@ var SwapPanel = ({
|
|
|
1933
1992
|
supportedChains,
|
|
1934
1993
|
setExceedsExpressDeliveryLimit
|
|
1935
1994
|
}) => {
|
|
1936
|
-
const [chainListShown, setChainListShown] = (0,
|
|
1937
|
-
const [tokenListShown, setTokenListShown] = (0,
|
|
1938
|
-
const listRef = (0,
|
|
1939
|
-
const buttonRef = (0,
|
|
1995
|
+
const [chainListShown, setChainListShown] = (0, import_react10.useState)(false);
|
|
1996
|
+
const [tokenListShown, setTokenListShown] = (0, import_react10.useState)(false);
|
|
1997
|
+
const listRef = (0, import_react10.useRef)(null);
|
|
1998
|
+
const buttonRef = (0, import_react10.useRef)(null);
|
|
1940
1999
|
const handleClickOutside = (event) => {
|
|
1941
2000
|
if (listRef.current && buttonRef.current) {
|
|
1942
2001
|
const listElement = listRef.current;
|
|
@@ -1951,28 +2010,28 @@ var SwapPanel = ({
|
|
|
1951
2010
|
weiToHumanReadable({
|
|
1952
2011
|
amount: balances[srcToken.address]?.toString() || "0",
|
|
1953
2012
|
decimals: srcToken.decimals,
|
|
1954
|
-
precisionFractionalPlaces:
|
|
2013
|
+
precisionFractionalPlaces: srcToken.decimals
|
|
1955
2014
|
})
|
|
1956
2015
|
);
|
|
1957
2016
|
};
|
|
1958
|
-
(0,
|
|
2017
|
+
(0, import_react10.useEffect)(() => {
|
|
1959
2018
|
if (chainListShown) {
|
|
1960
2019
|
document.addEventListener("mousedown", handleClickOutside);
|
|
1961
2020
|
return () => document.removeEventListener("mousedown", handleClickOutside);
|
|
1962
2021
|
}
|
|
1963
2022
|
}, [chainListShown]);
|
|
1964
|
-
const chainListOptions = (0,
|
|
2023
|
+
const chainListOptions = (0, import_react10.useMemo)(
|
|
1965
2024
|
() => supportedChains.filter((chain) => chain.chainId !== srcChain?.chainId),
|
|
1966
2025
|
[supportedChains, srcChain]
|
|
1967
2026
|
);
|
|
1968
|
-
return /* @__PURE__ */ (0,
|
|
1969
|
-
/* @__PURE__ */ (0,
|
|
1970
|
-
/* @__PURE__ */ (0,
|
|
1971
|
-
/* @__PURE__ */ (0,
|
|
1972
|
-
/* @__PURE__ */ (0,
|
|
2027
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "xpay-flex xpay-justify-between xpay-global-border xpay-rounded-lg xpay-bg-[rgba(15,15,15,1)] xpay-p-4", children: [
|
|
2028
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "xpay-flex xpay-flex-col xpay-justify-between xpay-gap-2 xpay-overflow-hidden xpay-w-1/2", children: [
|
|
2029
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "xpay-flex xpay-flex-col xpay-gap-1", children: [
|
|
2030
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("p", { className: "xpay-text-white xpay-opacity-60 xpay-text-xs sm:xpay-text-sm xpay-font-medium", children: "You pay" }),
|
|
2031
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
1973
2032
|
"input",
|
|
1974
2033
|
{
|
|
1975
|
-
className: "p-0 border-none outline-none bg-transparent text-2xl overflow-ellipsis",
|
|
2034
|
+
className: "xpay-p-0 xpay-border-none xpay-outline-none xpay-bg-transparent xpay-text-2xl xpay-overflow-ellipsis",
|
|
1976
2035
|
value: amount,
|
|
1977
2036
|
onChange: (e) => {
|
|
1978
2037
|
if (e.target.value === ".") return;
|
|
@@ -1988,7 +2047,7 @@ var SwapPanel = ({
|
|
|
1988
2047
|
}
|
|
1989
2048
|
)
|
|
1990
2049
|
] }),
|
|
1991
|
-
/* @__PURE__ */ (0,
|
|
2050
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: "xpay-flex xpay-items-center xpay-text-sm xpay-text-[rgba(255,255,255,0.6)]", children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
1992
2051
|
UsdPrice,
|
|
1993
2052
|
{
|
|
1994
2053
|
prices,
|
|
@@ -2000,16 +2059,16 @@ var SwapPanel = ({
|
|
|
2000
2059
|
}
|
|
2001
2060
|
) })
|
|
2002
2061
|
] }),
|
|
2003
|
-
/* @__PURE__ */ (0,
|
|
2004
|
-
/* @__PURE__ */ (0,
|
|
2062
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "xpay-flex xpay-flex-col xpay-relative xpay-items-end xpay-gap-2.5 xpay-w-1/2 xpay-text-xs", children: [
|
|
2063
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(
|
|
2005
2064
|
"div",
|
|
2006
2065
|
{
|
|
2007
|
-
className: "flex gap-2 items-center p-2 max-w-full cursor-pointer bg-black text-white
|
|
2066
|
+
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",
|
|
2008
2067
|
onClick: () => {
|
|
2009
2068
|
setTokenListShown((state) => !state);
|
|
2010
2069
|
},
|
|
2011
2070
|
children: [
|
|
2012
|
-
/* @__PURE__ */ (0,
|
|
2071
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
2013
2072
|
"img",
|
|
2014
2073
|
{
|
|
2015
2074
|
height: 16,
|
|
@@ -2018,12 +2077,12 @@ var SwapPanel = ({
|
|
|
2018
2077
|
alt: srcToken?.name
|
|
2019
2078
|
}
|
|
2020
2079
|
),
|
|
2021
|
-
/* @__PURE__ */ (0,
|
|
2022
|
-
/* @__PURE__ */ (0,
|
|
2080
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { children: srcToken?.symbol }),
|
|
2081
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(DownArrowIcon, {})
|
|
2023
2082
|
]
|
|
2024
2083
|
}
|
|
2025
2084
|
),
|
|
2026
|
-
tokenListShown && /* @__PURE__ */ (0,
|
|
2085
|
+
tokenListShown && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
2027
2086
|
TokenPicker,
|
|
2028
2087
|
{
|
|
2029
2088
|
onCloseClick: () => setTokenListShown(false),
|
|
@@ -2034,22 +2093,22 @@ var SwapPanel = ({
|
|
|
2034
2093
|
balances
|
|
2035
2094
|
}
|
|
2036
2095
|
),
|
|
2037
|
-
/* @__PURE__ */ (0,
|
|
2096
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
2038
2097
|
"div",
|
|
2039
2098
|
{
|
|
2040
2099
|
onClick: handleMaxClick,
|
|
2041
|
-
className: "flex gap-1 items-center font-medium text-white opacity-60 py-0.5 cursor-pointer",
|
|
2042
|
-
children: signer && /* @__PURE__ */ (0,
|
|
2100
|
+
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",
|
|
2101
|
+
children: signer && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(BalanceComponent, { balances, srcToken })
|
|
2043
2102
|
}
|
|
2044
2103
|
),
|
|
2045
|
-
/* @__PURE__ */ (0,
|
|
2104
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(
|
|
2046
2105
|
"div",
|
|
2047
2106
|
{
|
|
2048
2107
|
ref: buttonRef,
|
|
2049
|
-
className: "bg-black
|
|
2108
|
+
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",
|
|
2050
2109
|
onClick: () => setChainListShown((prev) => !prev),
|
|
2051
2110
|
children: [
|
|
2052
|
-
/* @__PURE__ */ (0,
|
|
2111
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
2053
2112
|
"img",
|
|
2054
2113
|
{
|
|
2055
2114
|
width: "16",
|
|
@@ -2058,17 +2117,17 @@ var SwapPanel = ({
|
|
|
2058
2117
|
alt: srcChain?.name
|
|
2059
2118
|
}
|
|
2060
2119
|
),
|
|
2061
|
-
/* @__PURE__ */ (0,
|
|
2062
|
-
/* @__PURE__ */ (0,
|
|
2120
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { children: srcChain?.displayName }),
|
|
2121
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(DownArrowIcon, {})
|
|
2063
2122
|
]
|
|
2064
2123
|
}
|
|
2065
2124
|
),
|
|
2066
|
-
chainListShown && /* @__PURE__ */ (0,
|
|
2125
|
+
chainListShown && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
2067
2126
|
"ul",
|
|
2068
2127
|
{
|
|
2069
2128
|
ref: listRef,
|
|
2070
|
-
className: "bg-black
|
|
2071
|
-
children: chainListOptions.map((chain, index) => /* @__PURE__ */ (0,
|
|
2129
|
+
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",
|
|
2130
|
+
children: chainListOptions.map((chain, index) => /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
2072
2131
|
ChainListElement,
|
|
2073
2132
|
{
|
|
2074
2133
|
index,
|
|
@@ -2085,30 +2144,30 @@ var SwapPanel = ({
|
|
|
2085
2144
|
};
|
|
2086
2145
|
|
|
2087
2146
|
// src/components/TxConfigForm/ErrorField.tsx
|
|
2088
|
-
var
|
|
2147
|
+
var import_jsx_runtime39 = require("react/jsx-runtime");
|
|
2089
2148
|
var ErrorField = ({ error }) => {
|
|
2090
|
-
return /* @__PURE__ */ (0,
|
|
2149
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
2091
2150
|
"div",
|
|
2092
2151
|
{
|
|
2093
|
-
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"}`,
|
|
2152
|
+
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"}`,
|
|
2094
2153
|
children: error
|
|
2095
2154
|
}
|
|
2096
2155
|
);
|
|
2097
2156
|
};
|
|
2098
2157
|
|
|
2099
2158
|
// src/components/TxConfigForm/Description.tsx
|
|
2100
|
-
var
|
|
2159
|
+
var import_jsx_runtime40 = require("react/jsx-runtime");
|
|
2101
2160
|
var Description = ({ description }) => {
|
|
2102
|
-
return /* @__PURE__ */ (0,
|
|
2161
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "xpay-flex xpay-flex-col xpay-items-start xpay-rounded-lg xpay-px-4 xpay-py-2", children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "xpay-w-full xpay-flex xpay-gap-4 xpay-items-start xpay-justify-between xpay-text-xl", children: description }) });
|
|
2103
2162
|
};
|
|
2104
2163
|
|
|
2105
2164
|
// src/components/TxConfigForm/Button.tsx
|
|
2106
|
-
var
|
|
2165
|
+
var import_jsx_runtime41 = require("react/jsx-runtime");
|
|
2107
2166
|
var Button = ({ children, onClick, type, disabled }) => {
|
|
2108
|
-
return /* @__PURE__ */ (0,
|
|
2167
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
2109
2168
|
"button",
|
|
2110
2169
|
{
|
|
2111
|
-
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",
|
|
2170
|
+
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",
|
|
2112
2171
|
onClick,
|
|
2113
2172
|
type,
|
|
2114
2173
|
disabled,
|
|
@@ -2118,8 +2177,9 @@ var Button = ({ children, onClick, type, disabled }) => {
|
|
|
2118
2177
|
};
|
|
2119
2178
|
|
|
2120
2179
|
// src/components/TxConfigForm/Form.tsx
|
|
2121
|
-
var
|
|
2180
|
+
var import_jsx_runtime42 = require("react/jsx-runtime");
|
|
2122
2181
|
var Form = ({
|
|
2182
|
+
integratorId,
|
|
2123
2183
|
dstChainId,
|
|
2124
2184
|
dstTokenAddr,
|
|
2125
2185
|
customContractCalls,
|
|
@@ -2128,31 +2188,31 @@ var Form = ({
|
|
|
2128
2188
|
onSubmit,
|
|
2129
2189
|
onClose
|
|
2130
2190
|
}) => {
|
|
2131
|
-
const [signer, setSigner] = (0,
|
|
2132
|
-
const [dstChain, setDstChain] = (0,
|
|
2133
|
-
const [dstToken, setDstToken] = (0,
|
|
2134
|
-
const [srcChain, setSrcChain] = (0,
|
|
2135
|
-
const [srcToken, setSrcToken] = (0,
|
|
2136
|
-
const [amount, setAmount] = (0,
|
|
2137
|
-
const [paymentToken, setPaymentToken] = (0,
|
|
2138
|
-
const [route, setRoute] = (0,
|
|
2139
|
-
const [expressChecked, setExpressChecked] = (0,
|
|
2140
|
-
const [historyTabShown, setHistoryTabShown] = (0,
|
|
2141
|
-
const [isGettingRoute, setIsGettingRoute] = (0,
|
|
2142
|
-
const [prices, setPrices] = (0,
|
|
2143
|
-
const [balances, setBalances] = (0,
|
|
2144
|
-
const [settingsShown, setSettingsShown] = (0,
|
|
2145
|
-
const [formError, setFormError] = (0,
|
|
2146
|
-
const [slippage, setSlippage] = (0,
|
|
2147
|
-
const [feesDetailsShown, setFeesDetailsShown] = (0,
|
|
2148
|
-
const [exceedsExpressDeliveryLimit, setExceedsExpressDeliveryLimit] = (0,
|
|
2191
|
+
const [signer, setSigner] = (0, import_react11.useState)();
|
|
2192
|
+
const [dstChain, setDstChain] = (0, import_react11.useState)();
|
|
2193
|
+
const [dstToken, setDstToken] = (0, import_react11.useState)();
|
|
2194
|
+
const [srcChain, setSrcChain] = (0, import_react11.useState)();
|
|
2195
|
+
const [srcToken, setSrcToken] = (0, import_react11.useState)();
|
|
2196
|
+
const [amount, setAmount] = (0, import_react11.useState)("");
|
|
2197
|
+
const [paymentToken, setPaymentToken] = (0, import_react11.useState)();
|
|
2198
|
+
const [route, setRoute] = (0, import_react11.useState)();
|
|
2199
|
+
const [expressChecked, setExpressChecked] = (0, import_react11.useState)(true);
|
|
2200
|
+
const [historyTabShown, setHistoryTabShown] = (0, import_react11.useState)(false);
|
|
2201
|
+
const [isGettingRoute, setIsGettingRoute] = (0, import_react11.useState)(false);
|
|
2202
|
+
const [prices, setPrices] = (0, import_react11.useState)();
|
|
2203
|
+
const [balances, setBalances] = (0, import_react11.useState)();
|
|
2204
|
+
const [settingsShown, setSettingsShown] = (0, import_react11.useState)(false);
|
|
2205
|
+
const [formError, setFormError] = (0, import_react11.useState)("");
|
|
2206
|
+
const [slippage, setSlippage] = (0, import_react11.useState)("1.5");
|
|
2207
|
+
const [feesDetailsShown, setFeesDetailsShown] = (0, import_react11.useState)(false);
|
|
2208
|
+
const [exceedsExpressDeliveryLimit, setExceedsExpressDeliveryLimit] = (0, import_react11.useState)(false);
|
|
2149
2209
|
const debouncedAmount = useDebounce(amount, 1e3);
|
|
2150
2210
|
const account = (0, import_wagmi2.useAccount)();
|
|
2151
2211
|
const { switchChainAsync } = (0, import_wagmi2.useSwitchChain)();
|
|
2152
|
-
(0,
|
|
2212
|
+
(0, import_react11.useEffect)(() => {
|
|
2153
2213
|
setSigner(account.address);
|
|
2154
2214
|
}, [account.address]);
|
|
2155
|
-
(0,
|
|
2215
|
+
(0, import_react11.useEffect)(() => {
|
|
2156
2216
|
const defaultChain = supportedChains.find(
|
|
2157
2217
|
({ chainId }) => chainId === account.chainId?.toString()
|
|
2158
2218
|
);
|
|
@@ -2162,18 +2222,28 @@ var Form = ({
|
|
|
2162
2222
|
)
|
|
2163
2223
|
);
|
|
2164
2224
|
}, [account.chainId]);
|
|
2165
|
-
(0,
|
|
2225
|
+
(0, import_react11.useEffect)(() => {
|
|
2166
2226
|
setDstChain(supportedChains.find((chain) => chain.chainId === dstChainId));
|
|
2167
2227
|
}, [supportedChains, dstChainId]);
|
|
2168
|
-
(0,
|
|
2169
|
-
|
|
2170
|
-
dstChain
|
|
2228
|
+
(0, import_react11.useEffect)(() => {
|
|
2229
|
+
(async () => {
|
|
2230
|
+
if (!dstChain) {
|
|
2231
|
+
return;
|
|
2232
|
+
}
|
|
2233
|
+
let dstTokenResult = dstChain?.tokens.find(
|
|
2171
2234
|
(token) => token.address.toLowerCase() === dstTokenAddr.toLowerCase()
|
|
2172
|
-
)
|
|
2173
|
-
|
|
2235
|
+
);
|
|
2236
|
+
if (!dstTokenResult) {
|
|
2237
|
+
dstTokenResult = await getCustomTokenData(
|
|
2238
|
+
dstChain,
|
|
2239
|
+
dstTokenAddr.toLowerCase()
|
|
2240
|
+
);
|
|
2241
|
+
}
|
|
2242
|
+
setDstToken(dstTokenResult);
|
|
2243
|
+
})();
|
|
2174
2244
|
}, [dstChain]);
|
|
2175
|
-
(0,
|
|
2176
|
-
if (srcChain && srcToken && dstChain && debouncedAmount && paymentToken && slippage) {
|
|
2245
|
+
(0, import_react11.useEffect)(() => {
|
|
2246
|
+
if (integratorId && srcChain && srcToken && dstChain && debouncedAmount && paymentToken && slippage) {
|
|
2177
2247
|
setFormError("");
|
|
2178
2248
|
const timeout = setTimeout(() => {
|
|
2179
2249
|
setFormError("Getting Route is taking longer than usually");
|
|
@@ -2185,6 +2255,7 @@ var Form = ({
|
|
|
2185
2255
|
`Configuration error: selected token ($${srcToken.symbol} ${srcToken.name}) has unknown decimals param.`
|
|
2186
2256
|
);
|
|
2187
2257
|
getRoute({
|
|
2258
|
+
integratorId,
|
|
2188
2259
|
fromAmount: import_ethers4.ethers.utils.parseUnits(debouncedAmount, srcToken.decimals).toString(),
|
|
2189
2260
|
fromAddress: signer || ADDRESSES[srcChain.chainId].FeeCollector,
|
|
2190
2261
|
fromChain: srcChain.chainId,
|
|
@@ -2215,7 +2286,7 @@ var Form = ({
|
|
|
2215
2286
|
slippage,
|
|
2216
2287
|
expressChecked
|
|
2217
2288
|
]);
|
|
2218
|
-
(0,
|
|
2289
|
+
(0, import_react11.useEffect)(() => {
|
|
2219
2290
|
if (srcChain) {
|
|
2220
2291
|
setPaymentToken(
|
|
2221
2292
|
srcChain.tokens.find(
|
|
@@ -2224,21 +2295,21 @@ var Form = ({
|
|
|
2224
2295
|
);
|
|
2225
2296
|
}
|
|
2226
2297
|
}, [srcChain]);
|
|
2227
|
-
(0,
|
|
2298
|
+
(0, import_react11.useEffect)(() => {
|
|
2228
2299
|
setAmount("");
|
|
2229
2300
|
setFormError("");
|
|
2230
2301
|
}, [srcToken]);
|
|
2231
|
-
(0,
|
|
2302
|
+
(0, import_react11.useEffect)(() => {
|
|
2232
2303
|
setSrcToken(srcChain?.tokens[0]);
|
|
2233
2304
|
}, [srcChain]);
|
|
2234
|
-
(0,
|
|
2305
|
+
(0, import_react11.useEffect)(() => {
|
|
2235
2306
|
if (srcChain) {
|
|
2236
2307
|
getPrices({ chainId: srcChain.chainId, currency: "USD" }).then(
|
|
2237
2308
|
(prices2) => setPrices(prices2)
|
|
2238
2309
|
);
|
|
2239
2310
|
}
|
|
2240
2311
|
}, [srcChain]);
|
|
2241
|
-
(0,
|
|
2312
|
+
(0, import_react11.useEffect)(() => {
|
|
2242
2313
|
if (srcChain && signer) {
|
|
2243
2314
|
getBalances(srcChain, signer).then((balances2) => setBalances(balances2));
|
|
2244
2315
|
}
|
|
@@ -2250,13 +2321,13 @@ var Form = ({
|
|
|
2250
2321
|
const handleSwitchChain = async () => {
|
|
2251
2322
|
await switchChainAsync({ chainId: Number(srcChain?.chainId) });
|
|
2252
2323
|
};
|
|
2253
|
-
return /* @__PURE__ */ (0,
|
|
2324
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
|
|
2254
2325
|
"form",
|
|
2255
2326
|
{
|
|
2256
|
-
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",
|
|
2327
|
+
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",
|
|
2257
2328
|
onSubmit: handleSubmit,
|
|
2258
2329
|
children: [
|
|
2259
|
-
/* @__PURE__ */ (0,
|
|
2330
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
2260
2331
|
TopBar,
|
|
2261
2332
|
{
|
|
2262
2333
|
signer,
|
|
@@ -2266,7 +2337,7 @@ var Form = ({
|
|
|
2266
2337
|
onClose
|
|
2267
2338
|
}
|
|
2268
2339
|
),
|
|
2269
|
-
settingsShown && /* @__PURE__ */ (0,
|
|
2340
|
+
settingsShown && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
2270
2341
|
Settings,
|
|
2271
2342
|
{
|
|
2272
2343
|
expressChecked,
|
|
@@ -2276,9 +2347,9 @@ var Form = ({
|
|
|
2276
2347
|
setSlippage
|
|
2277
2348
|
}
|
|
2278
2349
|
),
|
|
2279
|
-
historyTabShown ? /* @__PURE__ */ (0,
|
|
2280
|
-
desc && /* @__PURE__ */ (0,
|
|
2281
|
-
/* @__PURE__ */ (0,
|
|
2350
|
+
historyTabShown ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(History, { signer, supportedChains }) : /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: "xpay-flex xpay-flex-col xpay-gap-2", children: [
|
|
2351
|
+
desc && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Description, { description: desc }),
|
|
2352
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
2282
2353
|
SwapPanel,
|
|
2283
2354
|
{
|
|
2284
2355
|
amount,
|
|
@@ -2294,7 +2365,7 @@ var Form = ({
|
|
|
2294
2365
|
setExceedsExpressDeliveryLimit
|
|
2295
2366
|
}
|
|
2296
2367
|
),
|
|
2297
|
-
/* @__PURE__ */ (0,
|
|
2368
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
2298
2369
|
Summary,
|
|
2299
2370
|
{
|
|
2300
2371
|
isGettingRoute,
|
|
@@ -2303,7 +2374,7 @@ var Form = ({
|
|
|
2303
2374
|
dstChain
|
|
2304
2375
|
}
|
|
2305
2376
|
),
|
|
2306
|
-
/* @__PURE__ */ (0,
|
|
2377
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
2307
2378
|
FeesDetails,
|
|
2308
2379
|
{
|
|
2309
2380
|
route,
|
|
@@ -2317,8 +2388,8 @@ var Form = ({
|
|
|
2317
2388
|
setFeesDetailsShown
|
|
2318
2389
|
}
|
|
2319
2390
|
),
|
|
2320
|
-
formError.length > 0 && /* @__PURE__ */ (0,
|
|
2321
|
-
signer && srcChain && srcChain.chainId !== account.chainId?.toString() ? /* @__PURE__ */ (0,
|
|
2391
|
+
formError.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(ErrorField, { error: formError }),
|
|
2392
|
+
signer && srcChain && srcChain.chainId !== account.chainId?.toString() ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Button, { type: "button", onClick: handleSwitchChain, children: "Switch chain" }) : /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
2322
2393
|
Button,
|
|
2323
2394
|
{
|
|
2324
2395
|
type: "submit",
|
|
@@ -2333,8 +2404,9 @@ var Form = ({
|
|
|
2333
2404
|
};
|
|
2334
2405
|
|
|
2335
2406
|
// src/components/TxConfigForm/index.tsx
|
|
2336
|
-
var
|
|
2407
|
+
var import_jsx_runtime43 = require("react/jsx-runtime");
|
|
2337
2408
|
var TxConfigForm = ({
|
|
2409
|
+
integratorId,
|
|
2338
2410
|
dstChainId,
|
|
2339
2411
|
dstTokenAddr,
|
|
2340
2412
|
customContractCalls,
|
|
@@ -2351,19 +2423,20 @@ var TxConfigForm = ({
|
|
|
2351
2423
|
}
|
|
2352
2424
|
};
|
|
2353
2425
|
const queryClient = new import_react_query.QueryClient();
|
|
2354
|
-
const wagmiConfig = (0,
|
|
2426
|
+
const wagmiConfig = (0, import_react12.useMemo)(
|
|
2355
2427
|
() => getWagmiConfig(supportedChains),
|
|
2356
2428
|
supportedChains
|
|
2357
2429
|
);
|
|
2358
|
-
return /* @__PURE__ */ (0,
|
|
2430
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_wagmi3.WagmiProvider, { config: wagmiConfig, children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_react_query.QueryClientProvider, { client: queryClient, children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
2359
2431
|
"div",
|
|
2360
2432
|
{
|
|
2361
|
-
className: "top-0 left-0 right-0 bottom-0 bg-[rgba(0,0,0,0.8)] fixed flex items-center justify-center z-10",
|
|
2433
|
+
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",
|
|
2362
2434
|
onClick: onBackdropClick,
|
|
2363
|
-
children: /* @__PURE__ */ (0,
|
|
2364
|
-
/* @__PURE__ */ (0,
|
|
2435
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("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: [
|
|
2436
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
2365
2437
|
Form,
|
|
2366
2438
|
{
|
|
2439
|
+
integratorId,
|
|
2367
2440
|
dstChainId,
|
|
2368
2441
|
dstTokenAddr,
|
|
2369
2442
|
customContractCalls,
|
|
@@ -2373,12 +2446,13 @@ var TxConfigForm = ({
|
|
|
2373
2446
|
onClose
|
|
2374
2447
|
}
|
|
2375
2448
|
),
|
|
2376
|
-
/* @__PURE__ */ (0,
|
|
2449
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(PoweredBy, {})
|
|
2377
2450
|
] })
|
|
2378
2451
|
}
|
|
2379
2452
|
) }) });
|
|
2380
2453
|
};
|
|
2381
2454
|
var openTxConfigForm = async ({
|
|
2455
|
+
integratorId,
|
|
2382
2456
|
dstChainId,
|
|
2383
2457
|
dstTokenAddr,
|
|
2384
2458
|
customContractCalls,
|
|
@@ -2388,10 +2462,11 @@ var openTxConfigForm = async ({
|
|
|
2388
2462
|
try {
|
|
2389
2463
|
return await new Promise(async (resolve) => {
|
|
2390
2464
|
await waitForInitialization();
|
|
2391
|
-
|
|
2392
|
-
/* @__PURE__ */ (0,
|
|
2465
|
+
xpayRoot.render(
|
|
2466
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
2393
2467
|
TxConfigForm,
|
|
2394
2468
|
{
|
|
2469
|
+
integratorId,
|
|
2395
2470
|
dstChainId,
|
|
2396
2471
|
dstTokenAddr,
|
|
2397
2472
|
customContractCalls,
|
|
@@ -2399,10 +2474,10 @@ var openTxConfigForm = async ({
|
|
|
2399
2474
|
supportedChains,
|
|
2400
2475
|
onSubmit: (route) => {
|
|
2401
2476
|
resolve(route);
|
|
2402
|
-
|
|
2477
|
+
xpayRoot.render("");
|
|
2403
2478
|
},
|
|
2404
2479
|
onClose: () => {
|
|
2405
|
-
|
|
2480
|
+
xpayRoot.render("");
|
|
2406
2481
|
}
|
|
2407
2482
|
}
|
|
2408
2483
|
)
|
|
@@ -2414,93 +2489,106 @@ var openTxConfigForm = async ({
|
|
|
2414
2489
|
};
|
|
2415
2490
|
|
|
2416
2491
|
// src/components/TxStatusButton/index.tsx
|
|
2417
|
-
var
|
|
2418
|
-
var
|
|
2492
|
+
var import_react13 = require("react");
|
|
2493
|
+
var import_jsx_runtime44 = require("react/jsx-runtime");
|
|
2419
2494
|
var TxStatusButton = ({ transaction }) => {
|
|
2420
2495
|
const {
|
|
2421
|
-
fromChain,
|
|
2422
|
-
fromChainImage,
|
|
2423
|
-
fromToken,
|
|
2424
|
-
fromTokenImage,
|
|
2425
|
-
fromAmount,
|
|
2426
|
-
toChain,
|
|
2427
|
-
toChainImage,
|
|
2496
|
+
srcChain: fromChain,
|
|
2497
|
+
srcChainImage: fromChainImage,
|
|
2498
|
+
srcToken: fromToken,
|
|
2499
|
+
srcTokenImage: fromTokenImage,
|
|
2500
|
+
srcAmount: fromAmount,
|
|
2501
|
+
dstChain: toChain,
|
|
2502
|
+
dstChainImage: toChainImage,
|
|
2428
2503
|
isDone,
|
|
2429
|
-
txHash,
|
|
2430
2504
|
explorer
|
|
2431
2505
|
} = transaction;
|
|
2432
|
-
const [isWide, setIsWide] = (0,
|
|
2433
|
-
const background = (0,
|
|
2434
|
-
() => 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)]",
|
|
2506
|
+
const [isWide, setIsWide] = (0, import_react13.useState)(false);
|
|
2507
|
+
const background = (0, import_react13.useMemo)(
|
|
2508
|
+
() => 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)]",
|
|
2435
2509
|
[isDone]
|
|
2436
2510
|
);
|
|
2437
|
-
const border = (0,
|
|
2438
|
-
() => isDone ? "border border-solid border-x_green_dark" : "border border-solid border-x_blue_dark",
|
|
2511
|
+
const border = (0, import_react13.useMemo)(
|
|
2512
|
+
() => isDone ? "xpay-border xpay-border-solid xpay-border-x_green_dark" : "xpay-border xpay-border-solid xpay-border-x_blue_dark",
|
|
2439
2513
|
[isDone]
|
|
2440
2514
|
);
|
|
2441
|
-
return /* @__PURE__ */ (0,
|
|
2442
|
-
|
|
2443
|
-
|
|
2444
|
-
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
|
|
2454
|
-
|
|
2455
|
-
|
|
2456
|
-
|
|
2457
|
-
|
|
2458
|
-
|
|
2459
|
-
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
|
|
2515
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(
|
|
2516
|
+
"div",
|
|
2517
|
+
{
|
|
2518
|
+
className: "xpay-flex xpay-gap-2",
|
|
2519
|
+
onClick: () => setIsWide((x) => !x),
|
|
2520
|
+
children: [
|
|
2521
|
+
isWide && /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(
|
|
2522
|
+
"div",
|
|
2523
|
+
{
|
|
2524
|
+
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}`,
|
|
2525
|
+
children: [
|
|
2526
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("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: [
|
|
2527
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { className: "xpay-flex xpay-items-center xpay-gap-2", children: [
|
|
2528
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
2529
|
+
"img",
|
|
2530
|
+
{
|
|
2531
|
+
className: "xpay-w-5 xpay-h-5",
|
|
2532
|
+
src: fromChainImage,
|
|
2533
|
+
alt: "source chain"
|
|
2534
|
+
}
|
|
2535
|
+
),
|
|
2536
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { children: fromChain }),
|
|
2537
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: "xpay-w-3.5 xpay-h-3.5", children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(ArrowRightIcon, {}) }),
|
|
2538
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
2539
|
+
"img",
|
|
2540
|
+
{
|
|
2541
|
+
className: "xpay-w-5 xpay-h-5",
|
|
2542
|
+
src: toChainImage,
|
|
2543
|
+
alt: "to chain"
|
|
2544
|
+
}
|
|
2545
|
+
),
|
|
2546
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { children: toChain })
|
|
2547
|
+
] }),
|
|
2548
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { className: "xpay-flex xpay-items-center xpay-gap-2", children: [
|
|
2549
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { children: "Sent" }),
|
|
2550
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { children: fromAmount }),
|
|
2551
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { children: fromToken }),
|
|
2552
|
+
fromTokenImage ? /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
2553
|
+
"img",
|
|
2554
|
+
{
|
|
2555
|
+
className: "xpay-w-5 xpay-h-5",
|
|
2556
|
+
src: fromTokenImage,
|
|
2557
|
+
alt: "source token"
|
|
2558
|
+
}
|
|
2559
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(UnknownTokenLogo, { tokenName: "?" })
|
|
2560
|
+
] })
|
|
2561
|
+
] }),
|
|
2562
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
2563
|
+
"a",
|
|
2468
2564
|
{
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
|
|
2565
|
+
href: explorer,
|
|
2566
|
+
target: "_blank",
|
|
2567
|
+
rel: "noreferrer",
|
|
2568
|
+
className: "xpay-no-underline xpay-cursor-pointer",
|
|
2569
|
+
"aria-label": "Show the transaction in the chain explorer",
|
|
2570
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: "xpay-w-3.5 xpay-h-3.5", children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(ArrowUpRightIcon, {}) })
|
|
2472
2571
|
}
|
|
2473
2572
|
)
|
|
2573
|
+
]
|
|
2574
|
+
}
|
|
2575
|
+
),
|
|
2576
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
2577
|
+
"div",
|
|
2578
|
+
{
|
|
2579
|
+
className: `xpay-text-white xpay-rounded-xl xpay-cursor-pointer ${background} ${border}`,
|
|
2580
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { className: "xpay-flex xpay-gap-2 xpay-items-center xpay-h-14 xpay-w-20 xpay-justify-center", children: [
|
|
2581
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(ArrowLeftIcon, {}),
|
|
2582
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: "xpay-relative xpay-flex xpay-items-center xpay-justify-center xpay-w-9 xpay-h-9", children: isDone ? /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: "xpay-text-x_green xpay-w-5 xpay-h-5", children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(CheckIcon, {}) }) : /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_jsx_runtime44.Fragment, { children: [
|
|
2583
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: "xpay-w-5 xpay-h-5", children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(XSwapLogo, {}) }),
|
|
2584
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("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__ */ (0, import_jsx_runtime44.jsx)(CircularProgressIcon, {}) })
|
|
2585
|
+
] }) })
|
|
2474
2586
|
] })
|
|
2475
|
-
|
|
2476
|
-
|
|
2477
|
-
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
target: "_blank",
|
|
2481
|
-
rel: "noreferrer",
|
|
2482
|
-
className: "no-underline cursor-pointer",
|
|
2483
|
-
"aria-label": "Show the transaction in the chain explorer",
|
|
2484
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: "w-3.5 h-3.5", children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(ArrowUpRightIcon, {}) })
|
|
2485
|
-
}
|
|
2486
|
-
)
|
|
2487
|
-
]
|
|
2488
|
-
}
|
|
2489
|
-
),
|
|
2490
|
-
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
2491
|
-
"div",
|
|
2492
|
-
{
|
|
2493
|
-
className: `text-white rounded-xl cursor-pointer ${background} ${border}`,
|
|
2494
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "flex gap-2 items-center h-14 w-20 justify-center", children: [
|
|
2495
|
-
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(ArrowLeftIcon, {}),
|
|
2496
|
-
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: "relative flex items-center justify-center w-9 h-9", children: isDone ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: "text-x_green w-5 h-5", children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(CheckIcon, {}) }) : /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(import_jsx_runtime43.Fragment, { children: [
|
|
2497
|
-
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: "w-5 h-5", children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(XSwapLogo, {}) }),
|
|
2498
|
-
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: "absolute flex items-center justify-center top-0 left-0 right-0 bottom-0 text-white", children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(CircularProgressIcon, {}) })
|
|
2499
|
-
] }) })
|
|
2500
|
-
] })
|
|
2501
|
-
}
|
|
2502
|
-
)
|
|
2503
|
-
] });
|
|
2587
|
+
}
|
|
2588
|
+
)
|
|
2589
|
+
]
|
|
2590
|
+
}
|
|
2591
|
+
);
|
|
2504
2592
|
};
|
|
2505
2593
|
var renderedTransactions = [];
|
|
2506
2594
|
var addTransactionToRenderedTransactions = (transaction) => {
|
|
@@ -2522,25 +2610,71 @@ var updateTransactionDoneInRenderedTransactions = (txHash) => {
|
|
|
2522
2610
|
}
|
|
2523
2611
|
};
|
|
2524
2612
|
var renderTxStatusButtons = () => {
|
|
2525
|
-
const buttons = renderedTransactions.map((item) => /* @__PURE__ */ (0,
|
|
2526
|
-
|
|
2613
|
+
const buttons = renderedTransactions.map((item) => /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(TxStatusButton, { transaction: item }, item.txHash));
|
|
2614
|
+
xpayTxStatusRoot.render(buttons);
|
|
2527
2615
|
};
|
|
2528
2616
|
|
|
2529
2617
|
// src/components/Skeleton/index.tsx
|
|
2530
|
-
var
|
|
2618
|
+
var import_jsx_runtime45 = require("react/jsx-runtime");
|
|
2531
2619
|
var Skeleton = ({ width, height }) => {
|
|
2532
|
-
return /* @__PURE__ */ (0,
|
|
2620
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
2621
|
+
"div",
|
|
2622
|
+
{
|
|
2623
|
+
className: `xpay-bg-current xpay-rounded xpay-animate-pulse ${width} ${height}`
|
|
2624
|
+
}
|
|
2625
|
+
);
|
|
2533
2626
|
};
|
|
2534
2627
|
|
|
2535
2628
|
// src/services/integrations/monitoring.ts
|
|
2536
2629
|
var import_async_retry = __toESM(require("async-retry"));
|
|
2537
|
-
|
|
2630
|
+
|
|
2631
|
+
// src/services/blockchain.ts
|
|
2632
|
+
var import_ethers5 = require("ethers");
|
|
2633
|
+
var getCustomTokenData = async (chain, tokenAddress) => {
|
|
2634
|
+
const rpcUrl = chain.publicRpcUrls[0];
|
|
2635
|
+
const customTokenContract = new import_ethers5.ethers.Contract(
|
|
2636
|
+
tokenAddress.toLowerCase(),
|
|
2637
|
+
ERC20Abi,
|
|
2638
|
+
import_ethers5.ethers.getDefaultProvider(rpcUrl)
|
|
2639
|
+
);
|
|
2640
|
+
try {
|
|
2641
|
+
const query = async (contract, method, args = []) => {
|
|
2642
|
+
if (contract?.provider) {
|
|
2643
|
+
const response = await contract[method](...args);
|
|
2644
|
+
return response;
|
|
2645
|
+
}
|
|
2646
|
+
return null;
|
|
2647
|
+
};
|
|
2648
|
+
const responses = await Promise.all([
|
|
2649
|
+
query(customTokenContract, "decimals"),
|
|
2650
|
+
query(customTokenContract, "name"),
|
|
2651
|
+
query(customTokenContract, "symbol")
|
|
2652
|
+
]);
|
|
2653
|
+
const [decimals, name, symbol] = responses;
|
|
2654
|
+
return {
|
|
2655
|
+
address: tokenAddress,
|
|
2656
|
+
symbol,
|
|
2657
|
+
name,
|
|
2658
|
+
decimals,
|
|
2659
|
+
quickPick: false,
|
|
2660
|
+
supported: true,
|
|
2661
|
+
priority: 0
|
|
2662
|
+
};
|
|
2663
|
+
} catch (_) {
|
|
2664
|
+
throw new Error(
|
|
2665
|
+
`Provided token ${tokenAddress} does not exists on chain ${chain.displayName}`
|
|
2666
|
+
);
|
|
2667
|
+
}
|
|
2668
|
+
};
|
|
2669
|
+
|
|
2670
|
+
// src/services/integrations/monitoring.ts
|
|
2671
|
+
var renderTxStatus = async (txChainId, txHash) => {
|
|
2538
2672
|
const txReceipt = await getTxReceipt(txChainId, txHash);
|
|
2539
2673
|
const supportedChains = (await getChains()).filter(
|
|
2540
2674
|
({ web3Environment, swapSupported }) => web3Environment === "mainnet" /* MAINNET */ && swapSupported
|
|
2541
2675
|
);
|
|
2542
2676
|
const messageSentEvent = txReceipt.logs?.find((log) => {
|
|
2543
|
-
return log.topics[0] ===
|
|
2677
|
+
return log.topics[0] === import_ethers6.ethers.utils.id(MSG_SENT_EVENT_SIG);
|
|
2544
2678
|
});
|
|
2545
2679
|
if (!messageSentEvent) {
|
|
2546
2680
|
throw new Error(
|
|
@@ -2548,7 +2682,7 @@ var monitorTransactionStatus = async (txChainId, txHash) => {
|
|
|
2548
2682
|
);
|
|
2549
2683
|
}
|
|
2550
2684
|
const messageId = messageSentEvent?.topics[1];
|
|
2551
|
-
const iface = new
|
|
2685
|
+
const iface = new import_ethers6.ethers.utils.Interface(MSG_SENT_EVENT_ABI);
|
|
2552
2686
|
const decodedMessageSentEvent = iface.parseLog(messageSentEvent);
|
|
2553
2687
|
if (!decodedMessageSentEvent) {
|
|
2554
2688
|
throw new Error(
|
|
@@ -2558,9 +2692,16 @@ var monitorTransactionStatus = async (txChainId, txHash) => {
|
|
|
2558
2692
|
const srcChain = supportedChains.find(
|
|
2559
2693
|
(chain) => chain.chainId === txChainId.toString()
|
|
2560
2694
|
);
|
|
2561
|
-
|
|
2695
|
+
if (!srcChain) {
|
|
2696
|
+
throw new Error(`Unknown src chain ${txChainId}`);
|
|
2697
|
+
}
|
|
2698
|
+
const tokenAddress = decodedMessageSentEvent.args?.token.toString();
|
|
2699
|
+
let srcToken = srcChain.tokens.find(
|
|
2562
2700
|
(token) => token.address === decodedMessageSentEvent.args?.token.toString()
|
|
2563
2701
|
);
|
|
2702
|
+
if (!srcToken) {
|
|
2703
|
+
srcToken = await getCustomTokenData(srcChain, tokenAddress);
|
|
2704
|
+
}
|
|
2564
2705
|
const dstChain = supportedChains.find(
|
|
2565
2706
|
(chain) => chain.ccipChainId === decodedMessageSentEvent.args?.destinationChainSelector?.toString()
|
|
2566
2707
|
);
|
|
@@ -2568,19 +2709,20 @@ var monitorTransactionStatus = async (txChainId, txHash) => {
|
|
|
2568
2709
|
if (!dstChainId) {
|
|
2569
2710
|
throw new Error(`Unknown destination chain!`);
|
|
2570
2711
|
}
|
|
2712
|
+
const tokenAmount = weiToHumanReadable({
|
|
2713
|
+
amount: decodedMessageSentEvent.args?.tokenAmount.toString(),
|
|
2714
|
+
decimals: srcToken?.decimals || 18,
|
|
2715
|
+
precisionFractionalPlaces: 4
|
|
2716
|
+
});
|
|
2571
2717
|
const transaction = {
|
|
2572
2718
|
txHash,
|
|
2573
|
-
|
|
2574
|
-
|
|
2575
|
-
|
|
2576
|
-
|
|
2577
|
-
|
|
2578
|
-
|
|
2579
|
-
|
|
2580
|
-
amount: decodedMessageSentEvent.args?.tokenAmount.toString(),
|
|
2581
|
-
decimals: srcToken?.decimals || 18,
|
|
2582
|
-
precisionFractionalPlaces: 4
|
|
2583
|
-
}),
|
|
2719
|
+
srcChain: srcChain.displayName,
|
|
2720
|
+
srcChainImage: srcChain.image,
|
|
2721
|
+
dstChain: dstChain.displayName,
|
|
2722
|
+
dstChainImage: dstChain.image,
|
|
2723
|
+
srcToken: srcToken?.symbol,
|
|
2724
|
+
srcTokenImage: srcToken?.image,
|
|
2725
|
+
srcAmount: tokenAmount === "0" ? "<0.0001" : tokenAmount,
|
|
2584
2726
|
isDone: false,
|
|
2585
2727
|
explorer: `${CCIP_EXPLORER}/tx/${txHash}`
|
|
2586
2728
|
};
|
|
@@ -2590,16 +2732,16 @@ var monitorTransactionStatus = async (txChainId, txHash) => {
|
|
|
2590
2732
|
if (!xSwapRouterOnDestinationAddress) {
|
|
2591
2733
|
throw new Error(`Unknown destination XSwapRouter!`);
|
|
2592
2734
|
}
|
|
2593
|
-
const xSwapRouterOnDestination = new
|
|
2735
|
+
const xSwapRouterOnDestination = new import_ethers6.ethers.Contract(
|
|
2594
2736
|
xSwapRouterOnDestinationAddress,
|
|
2595
2737
|
MSG_RECEIVED_EVENT_ABI,
|
|
2596
|
-
|
|
2738
|
+
import_ethers6.ethers.getDefaultProvider(
|
|
2597
2739
|
supportedChains.find((chain) => chain.chainId === dstChainId)?.publicRpcUrls[0]
|
|
2598
2740
|
)
|
|
2599
2741
|
);
|
|
2600
2742
|
const msgReceivedEventFilter = {
|
|
2601
2743
|
address: xSwapRouterOnDestinationAddress,
|
|
2602
|
-
topics: [
|
|
2744
|
+
topics: [import_ethers6.ethers.utils.id(MSG_RECEIVED_EVENT_SIG), messageId]
|
|
2603
2745
|
};
|
|
2604
2746
|
const onSuccess = async () => {
|
|
2605
2747
|
updateTransactionDoneInRenderedTransactions(txHash);
|
|
@@ -2610,6 +2752,11 @@ var monitorTransactionStatus = async (txChainId, txHash) => {
|
|
|
2610
2752
|
removeTransactionFromRenderedTransactions(txHash);
|
|
2611
2753
|
renderTxStatusButtons();
|
|
2612
2754
|
};
|
|
2755
|
+
getTxStatus({ transferId: messageId }).then((response) => {
|
|
2756
|
+
if (response.status === "DONE") {
|
|
2757
|
+
onSuccess();
|
|
2758
|
+
}
|
|
2759
|
+
});
|
|
2613
2760
|
xSwapRouterOnDestination.once(msgReceivedEventFilter, () => onSuccess());
|
|
2614
2761
|
};
|
|
2615
2762
|
var getTxReceipt = async (txChainId, txHash) => {
|
|
@@ -2617,7 +2764,7 @@ var getTxReceipt = async (txChainId, txHash) => {
|
|
|
2617
2764
|
const chain = (await getChains()).find(
|
|
2618
2765
|
(chain2) => chain2.chainId === txChainId
|
|
2619
2766
|
);
|
|
2620
|
-
const provider = new
|
|
2767
|
+
const provider = new import_ethers6.ethers.providers.JsonRpcProvider(
|
|
2621
2768
|
chain?.publicRpcUrls[0]
|
|
2622
2769
|
);
|
|
2623
2770
|
return await (0, import_async_retry.default)(async () => {
|
|
@@ -2635,7 +2782,8 @@ var getTxReceipt = async (txChainId, txHash) => {
|
|
|
2635
2782
|
};
|
|
2636
2783
|
|
|
2637
2784
|
// src/services/integrations/transactions.ts
|
|
2638
|
-
var
|
|
2785
|
+
var openTransactionModal = async ({
|
|
2786
|
+
integratorId,
|
|
2639
2787
|
dstChain,
|
|
2640
2788
|
dstToken,
|
|
2641
2789
|
customContractCalls = [],
|
|
@@ -2646,6 +2794,7 @@ var getSwapTx = async ({
|
|
|
2646
2794
|
);
|
|
2647
2795
|
validateSwapTxData(supportedChains, dstChain, dstToken);
|
|
2648
2796
|
const route = await openTxConfigForm({
|
|
2797
|
+
integratorId,
|
|
2649
2798
|
dstChainId: dstChain,
|
|
2650
2799
|
dstTokenAddr: dstToken,
|
|
2651
2800
|
customContractCalls,
|
|
@@ -2661,13 +2810,20 @@ var validateSwapTxData = (supportedChains, dstChain, dstToken) => {
|
|
|
2661
2810
|
if (!supportedDstChain) {
|
|
2662
2811
|
throw new Error(`Provided chain '${dstChain}' is not supported`);
|
|
2663
2812
|
}
|
|
2664
|
-
if (!
|
|
2665
|
-
throw new Error(
|
|
2813
|
+
if (!isETHAddressValid(dstToken)) {
|
|
2814
|
+
throw new Error(
|
|
2815
|
+
`Provided token address ${dstToken} on chain ${dstChain} is not correct`
|
|
2816
|
+
);
|
|
2666
2817
|
}
|
|
2667
2818
|
};
|
|
2668
2819
|
|
|
2669
2820
|
// src/index.ts
|
|
2670
2821
|
initDocument();
|
|
2822
|
+
var XPay = {
|
|
2823
|
+
openTransactionModal,
|
|
2824
|
+
renderTxStatus
|
|
2825
|
+
};
|
|
2826
|
+
var src_default = XPay;
|
|
2671
2827
|
// Annotate the CommonJS export names for ESM import in node:
|
|
2672
2828
|
0 && (module.exports = {
|
|
2673
2829
|
ContractName,
|
|
@@ -2675,6 +2831,6 @@ initDocument();
|
|
|
2675
2831
|
Environment,
|
|
2676
2832
|
Web3Environment,
|
|
2677
2833
|
XSwapCallType,
|
|
2678
|
-
|
|
2679
|
-
|
|
2834
|
+
openTransactionModal,
|
|
2835
|
+
renderTxStatus
|
|
2680
2836
|
});
|