@xswap-link/sdk 0.0.13 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/main.yml +2 -1
- package/.github/workflows/publish.yml +2 -1
- package/.prettierrc +7 -0
- package/CHANGELOG.md +27 -1
- package/README.md +23 -14
- package/dist/index.css +1108 -0
- package/dist/index.d.mts +212 -52
- package/dist/index.d.ts +212 -52
- package/dist/index.js +2184 -85
- package/dist/index.mjs +2148 -76
- package/nodemon.json +5 -0
- package/package.json +20 -3
- package/postcss.config.js +3 -0
- package/src/components/Alert/index.tsx +9 -0
- package/src/components/Skeleton/index.tsx +10 -0
- package/src/components/TxConfigForm/BalanceComponent.tsx +51 -0
- package/src/components/TxConfigForm/ChainListElement.tsx +36 -0
- package/src/components/TxConfigForm/Description.tsx +15 -0
- package/src/components/TxConfigForm/ErrorField.tsx +17 -0
- package/src/components/TxConfigForm/FeesDetails.tsx +105 -0
- package/src/components/TxConfigForm/Form.tsx +250 -0
- package/src/components/TxConfigForm/History.tsx +155 -0
- package/src/components/TxConfigForm/HistoryCard.tsx +209 -0
- package/src/components/TxConfigForm/Settings.tsx +137 -0
- package/src/components/TxConfigForm/Summary.tsx +57 -0
- package/src/components/TxConfigForm/SwapPanel.tsx +191 -0
- package/src/components/TxConfigForm/TokenPicker.tsx +171 -0
- package/src/components/TxConfigForm/TopBar.tsx +53 -0
- package/src/components/TxConfigForm/index.tsx +121 -0
- package/src/components/global.css +34 -0
- package/src/components/icons/ArrowDownIcon.tsx +16 -0
- package/src/components/icons/ArrowRightIcon.tsx +11 -0
- package/src/components/icons/ArrowUpRightIcon.tsx +11 -0
- package/src/components/icons/ChainlinkCCIPIcon.tsx +23 -0
- package/src/components/icons/CheckIcon.tsx +11 -0
- package/src/components/icons/ChevronDownIcon.tsx +15 -0
- package/src/components/icons/ChevronUpIcon.tsx +15 -0
- package/src/components/icons/CircularProgressIcon.tsx +24 -0
- package/src/components/icons/CloseIcon.tsx +15 -0
- package/src/components/icons/CoinsIcon.tsx +17 -0
- package/src/components/icons/DownArrorIcon.tsx +17 -0
- package/src/components/icons/HistoryIcon.tsx +16 -0
- package/src/components/icons/HourGlassIcon.tsx +11 -0
- package/src/components/icons/InfoIcon.tsx +13 -0
- package/src/components/icons/PercentageIcon.tsx +29 -0
- package/src/components/icons/SearchIcon.tsx +15 -0
- package/src/components/icons/SettingsIcon.tsx +16 -0
- package/src/components/icons/TimerIcon.tsx +15 -0
- package/src/components/icons/XMarkIcon.tsx +11 -0
- package/src/components/icons/XSwapBadgeIcon.tsx +23 -0
- package/src/components/icons/index.ts +20 -0
- package/src/components/index.ts +3 -0
- package/src/config/index.ts +1 -0
- package/src/config/wagmiConfig.ts +45 -0
- package/src/constants/index.ts +9 -5
- package/src/contracts/abi/BatchQuery.json +52 -0
- package/src/contracts/abi/index.ts +2 -0
- package/src/contracts/addresses.ts +34 -0
- package/src/contracts/index.ts +1 -0
- package/src/hooks/index.ts +1 -0
- package/src/hooks/useDebounce.tsx +21 -0
- package/src/index.ts +6 -0
- package/src/models/Addresses.ts +12 -0
- package/src/models/Route.ts +17 -5
- package/src/models/TokenData.ts +45 -0
- package/src/models/TransactionHistory.ts +48 -0
- package/src/models/XSwapConfig.ts +3 -0
- package/src/models/forms/TxConfigFormData.ts +8 -0
- package/src/models/forms/index.ts +1 -0
- package/src/models/index.ts +6 -6
- package/src/models/integrations/GenerateStakingCallsParams.ts +8 -0
- package/src/models/integrations/index.ts +1 -0
- package/src/models/payloads/GetPricesPayload.ts +4 -0
- package/src/models/payloads/GetRoutePayload.ts +1 -3
- package/src/models/payloads/GetSwapTxPayload.ts +8 -0
- package/src/models/payloads/index.ts +2 -0
- package/src/services/api.ts +46 -64
- package/src/services/index.ts +1 -0
- package/src/services/integrations/customCalls/index.ts +1 -0
- package/src/services/integrations/customCalls/staking.ts +83 -0
- package/src/services/integrations/index.ts +2 -0
- package/src/services/integrations/transactions.ts +30 -0
- package/src/utils/contracts.ts +153 -11
- package/src/utils/index.ts +49 -1
- package/src/utils/numbers.ts +47 -0
- package/src/utils/strings.ts +6 -0
- package/tailwind.config.js +19 -0
- package/test/api.test.ts +1 -1
- package/tsconfig.json +10 -1
- package/xswap.config.ts +18 -0
- package/index.ts +0 -5
- package/src/models/ApiOverrides.ts +0 -3
- package/src/models/Chain.ts +0 -20
- package/src/models/Prices.ts +0 -9
- package/src/models/Token.ts +0 -10
- package/src/models/XSwapFee.ts +0 -4
- package/src/models/XSwapFees.ts +0 -7
- package/src/utils/bigNumbers.ts +0 -7
package/dist/index.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
2
3
|
var __defProp = Object.defineProperty;
|
|
3
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
5
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
8
|
var __export = (target, all) => {
|
|
7
9
|
for (var name in all)
|
|
@@ -15,31 +17,228 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
15
17
|
}
|
|
16
18
|
return to;
|
|
17
19
|
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
18
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
29
|
|
|
20
|
-
// index.ts
|
|
21
|
-
var
|
|
22
|
-
__export(
|
|
23
|
-
|
|
24
|
-
|
|
30
|
+
// src/index.ts
|
|
31
|
+
var src_exports = {};
|
|
32
|
+
__export(src_exports, {
|
|
33
|
+
ADDRESSES: () => ADDRESSES,
|
|
34
|
+
Alert: () => Alert,
|
|
35
|
+
BALANCES_CHUNK_SIZE: () => BALANCES_CHUNK_SIZE,
|
|
36
|
+
BALANCE_DISPLAY_MIN_LIMIT: () => BALANCE_DISPLAY_MIN_LIMIT,
|
|
37
|
+
BatchQueryAbi: () => BatchQueryAbi,
|
|
38
|
+
ContractName: () => ContractName,
|
|
25
39
|
DEFAULT_ECOSYSTEM: () => DEFAULT_ECOSYSTEM,
|
|
26
|
-
|
|
27
|
-
DEFAULT_NATIVE_FEE_MULTIPLIER_PERCENTAGE: () => DEFAULT_NATIVE_FEE_MULTIPLIER_PERCENTAGE,
|
|
40
|
+
DELIVERY_TIME: () => DELIVERY_TIME,
|
|
28
41
|
ERC20Abi: () => ERC20Abi,
|
|
42
|
+
EXPRESS_DELIVERY_TIME: () => EXPRESS_DELIVERY_TIME,
|
|
29
43
|
Ecosystem: () => Ecosystem,
|
|
30
44
|
Environment: () => Environment,
|
|
45
|
+
IERC20: () => IERC20,
|
|
46
|
+
MINIMUM_DISPLAYED_TOKEN_AMOUNT: () => MINIMUM_DISPLAYED_TOKEN_AMOUNT,
|
|
47
|
+
NUMBER_INPUT_REGEX: () => NUMBER_INPUT_REGEX,
|
|
48
|
+
ROUTE_TIMEOUT_MS: () => ROUTE_TIMEOUT_MS,
|
|
49
|
+
SLIPPAGE_PRESETS: () => SLIPPAGE_PRESETS,
|
|
50
|
+
Skeleton: () => Skeleton,
|
|
31
51
|
Web3Environment: () => Web3Environment,
|
|
32
52
|
XSwapCallType: () => XSwapCallType,
|
|
33
53
|
XSwapRouterAbi: () => XSwapRouterAbi,
|
|
54
|
+
chunkArray: () => chunkArray,
|
|
55
|
+
deepMergeObjects: () => deepMergeObjects,
|
|
56
|
+
findPlaceholderIndex: () => findPlaceholderIndex,
|
|
34
57
|
generateApproveTxData: () => generateApproveTxData,
|
|
58
|
+
generateRandomBigNumber: () => generateRandomBigNumber,
|
|
59
|
+
generateStakingCalls: () => generateStakingCalls,
|
|
60
|
+
generateUniqueRandomBigNumber: () => generateUniqueRandomBigNumber,
|
|
61
|
+
getBalanceOf: () => getBalanceOf,
|
|
62
|
+
getBalances: () => getBalances,
|
|
35
63
|
getBridgeTokens: () => getBridgeTokens,
|
|
36
64
|
getChainData: () => getChainData,
|
|
37
65
|
getChains: () => getChains,
|
|
66
|
+
getHistory: () => getHistory,
|
|
67
|
+
getPrices: () => getPrices,
|
|
38
68
|
getRoute: () => getRoute,
|
|
69
|
+
getSwapTx: () => getSwapTx,
|
|
39
70
|
getTokens: () => getTokens,
|
|
40
|
-
|
|
71
|
+
openTxConfigForm: () => openTxConfigForm,
|
|
72
|
+
replaceNull: () => replaceNull,
|
|
73
|
+
safeBigNumberFrom: () => safeBigNumberFrom,
|
|
74
|
+
shortAddress: () => shortAddress,
|
|
75
|
+
weiToHumanReadable: () => weiToHumanReadable
|
|
41
76
|
});
|
|
42
|
-
module.exports = __toCommonJS(
|
|
77
|
+
module.exports = __toCommonJS(src_exports);
|
|
78
|
+
|
|
79
|
+
// src/components/Alert/index.tsx
|
|
80
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
81
|
+
var Alert = ({ desc }) => {
|
|
82
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "border border-solid border-x_alert rounded-3xl text-x_alert_light text-xs py-0.5 px-2", children: [
|
|
83
|
+
"\u26A0\uFE0F ",
|
|
84
|
+
desc
|
|
85
|
+
] });
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
// src/components/TxConfigForm/index.tsx
|
|
89
|
+
var import_react9 = require("react");
|
|
90
|
+
var import_client = require("react-dom/client");
|
|
91
|
+
var import_react_query = require("@tanstack/react-query");
|
|
92
|
+
var import_wagmi3 = require("wagmi");
|
|
93
|
+
|
|
94
|
+
// src/config/wagmiConfig.ts
|
|
95
|
+
var import_wagmi = require("wagmi");
|
|
96
|
+
var import_connectors = require("wagmi/connectors");
|
|
97
|
+
var WagmiChains = __toESM(require("viem/chains"));
|
|
98
|
+
var import_chains = require("viem/chains");
|
|
99
|
+
var getWagmiConfig = (supportedChains) => {
|
|
100
|
+
const chains = mapChains(supportedChains);
|
|
101
|
+
const transports = mapTransports(chains);
|
|
102
|
+
return (0, import_wagmi.createConfig)({
|
|
103
|
+
chains,
|
|
104
|
+
transports,
|
|
105
|
+
connectors: [
|
|
106
|
+
(0, import_connectors.injected)(),
|
|
107
|
+
(0, import_connectors.metaMask)(),
|
|
108
|
+
(0, import_connectors.safe)(),
|
|
109
|
+
(0, import_connectors.walletConnect)({ projectId: "c392898b45ac587a280b5eb33e92aeb0" })
|
|
110
|
+
]
|
|
111
|
+
});
|
|
112
|
+
};
|
|
113
|
+
var mapChains = (supportedChains) => {
|
|
114
|
+
const result = [import_chains.mainnet];
|
|
115
|
+
result.push(
|
|
116
|
+
...Object.values(WagmiChains).filter(
|
|
117
|
+
(chain) => chain.id !== import_chains.mainnet.id && supportedChains.some(({ chainId }) => chainId === chain.id.toString())
|
|
118
|
+
)
|
|
119
|
+
);
|
|
120
|
+
return result;
|
|
121
|
+
};
|
|
122
|
+
var mapTransports = (chains) => {
|
|
123
|
+
const transports = {};
|
|
124
|
+
chains.forEach((chain) => {
|
|
125
|
+
transports[chain.id] = (0, import_wagmi.http)();
|
|
126
|
+
});
|
|
127
|
+
return transports;
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
// src/components/icons/CloseIcon.tsx
|
|
131
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
132
|
+
var CloseIcon = () => {
|
|
133
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
134
|
+
"svg",
|
|
135
|
+
{
|
|
136
|
+
height: "18",
|
|
137
|
+
width: "18",
|
|
138
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
139
|
+
viewBox: "0 0 10.312 8.319",
|
|
140
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
141
|
+
"path",
|
|
142
|
+
{
|
|
143
|
+
fill: "white",
|
|
144
|
+
d: "M6.073 4.078 10.151 0H9.093A1.87 1.87 0 0 0 7.77.548L5.157 3.162 2.543.548A1.87 1.87 0 0 0 1.22 0H.161L4.24 4.078 0 8.318h1.058a1.87 1.87 0 0 0 1.322-.547l2.777-2.777 2.776 2.777a1.869 1.869 0 0 0 1.322.548h1.058Z"
|
|
145
|
+
}
|
|
146
|
+
)
|
|
147
|
+
}
|
|
148
|
+
);
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
// src/components/TxConfigForm/Form.tsx
|
|
152
|
+
var import_react8 = require("react");
|
|
153
|
+
var import_ethers4 = require("ethers");
|
|
154
|
+
var import_wagmi2 = require("wagmi");
|
|
155
|
+
|
|
156
|
+
// xswap.config.ts
|
|
157
|
+
var xSwapConfig = {
|
|
158
|
+
apiUrl: "https://xswap.link/api"
|
|
159
|
+
};
|
|
160
|
+
var xSwapConfigLocal = {};
|
|
161
|
+
try {
|
|
162
|
+
xSwapConfigLocal = require("./xswap.config.local").default;
|
|
163
|
+
} catch {
|
|
164
|
+
}
|
|
165
|
+
var xswap_config_default = {
|
|
166
|
+
...xSwapConfig,
|
|
167
|
+
...xSwapConfigLocal
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
// src/services/api.ts
|
|
171
|
+
async function _sendRequest(urlPath, options) {
|
|
172
|
+
const response = await fetch(`${xswap_config_default.apiUrl}${urlPath}`, {
|
|
173
|
+
method: "GET",
|
|
174
|
+
headers: {
|
|
175
|
+
"Content-Type": "application/json",
|
|
176
|
+
"Cache-Control": "no-cache",
|
|
177
|
+
...options?.headers
|
|
178
|
+
},
|
|
179
|
+
...options
|
|
180
|
+
});
|
|
181
|
+
if (!response.ok) {
|
|
182
|
+
throw new Error(
|
|
183
|
+
`API request failed with status ${response.status}: ${response.statusText}`
|
|
184
|
+
);
|
|
185
|
+
}
|
|
186
|
+
return response.json();
|
|
187
|
+
}
|
|
188
|
+
async function getRoute(payload) {
|
|
189
|
+
return _sendRequest("/route", {
|
|
190
|
+
method: "POST",
|
|
191
|
+
body: JSON.stringify(payload)
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
async function getChains(ecosystem) {
|
|
195
|
+
return _sendRequest(`/chains?data=${JSON.stringify({ ecosystem })}
|
|
196
|
+
`);
|
|
197
|
+
}
|
|
198
|
+
async function getChainData(chainId, ecosystem) {
|
|
199
|
+
return _sendRequest(
|
|
200
|
+
`/chains?data=${JSON.stringify({
|
|
201
|
+
chainId,
|
|
202
|
+
ecosystem
|
|
203
|
+
})}`
|
|
204
|
+
);
|
|
205
|
+
}
|
|
206
|
+
async function getTokens(chainId, address, ecosystem) {
|
|
207
|
+
return _sendRequest(
|
|
208
|
+
`/tokens?data=${JSON.stringify({
|
|
209
|
+
chainId,
|
|
210
|
+
address,
|
|
211
|
+
ecosystem
|
|
212
|
+
})}`
|
|
213
|
+
);
|
|
214
|
+
}
|
|
215
|
+
async function getBridgeTokens() {
|
|
216
|
+
return _sendRequest(`/bridgeTokens`);
|
|
217
|
+
}
|
|
218
|
+
async function getHistory(payload) {
|
|
219
|
+
return await _sendRequest(
|
|
220
|
+
`/history?${new URLSearchParams({
|
|
221
|
+
data: JSON.stringify(payload)
|
|
222
|
+
})}`
|
|
223
|
+
);
|
|
224
|
+
}
|
|
225
|
+
async function getPrices(payload) {
|
|
226
|
+
return await _sendRequest(
|
|
227
|
+
`/tokenPrices?${new URLSearchParams({
|
|
228
|
+
data: JSON.stringify(payload)
|
|
229
|
+
})}`
|
|
230
|
+
);
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
// src/services/integrations/customCalls/staking.ts
|
|
234
|
+
var import_ethers3 = require("ethers");
|
|
235
|
+
|
|
236
|
+
// src/models/Addresses.ts
|
|
237
|
+
var ContractName = /* @__PURE__ */ ((ContractName2) => {
|
|
238
|
+
ContractName2["BatchQuery"] = "BatchQuery";
|
|
239
|
+
ContractName2["FeeCollector"] = "FeeCollector";
|
|
240
|
+
return ContractName2;
|
|
241
|
+
})(ContractName || {});
|
|
43
242
|
|
|
44
243
|
// src/models/Ecosystem.ts
|
|
45
244
|
var Ecosystem = /* @__PURE__ */ ((Ecosystem2) => {
|
|
@@ -72,12 +271,96 @@ var XSwapCallType = /* @__PURE__ */ ((XSwapCallType2) => {
|
|
|
72
271
|
return XSwapCallType2;
|
|
73
272
|
})(XSwapCallType || {});
|
|
74
273
|
|
|
75
|
-
// src/
|
|
76
|
-
var
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
var
|
|
80
|
-
var
|
|
274
|
+
// src/utils/contracts.ts
|
|
275
|
+
var import_ethers2 = require("ethers");
|
|
276
|
+
|
|
277
|
+
// src/utils/numbers.ts
|
|
278
|
+
var import_bignumber = require("bignumber.js");
|
|
279
|
+
var import_ethers = require("ethers");
|
|
280
|
+
var safeBigNumberFrom = (value) => {
|
|
281
|
+
import_bignumber.BigNumber.config({ DECIMAL_PLACES: 0 });
|
|
282
|
+
return import_ethers.BigNumber.from(new import_bignumber.BigNumber(value).div(1).toFixed());
|
|
283
|
+
};
|
|
284
|
+
var weiToHumanReadable = ({
|
|
285
|
+
amount,
|
|
286
|
+
decimals,
|
|
287
|
+
precisionFractionalPlaces,
|
|
288
|
+
prettifySmallNumber = false
|
|
289
|
+
}) => {
|
|
290
|
+
const decimalsFactor = Math.pow(10, decimals);
|
|
291
|
+
import_bignumber.BigNumber.config({ DECIMAL_PLACES: precisionFractionalPlaces });
|
|
292
|
+
const res = new import_bignumber.BigNumber(amount).div(decimalsFactor).toFixed();
|
|
293
|
+
if (prettifySmallNumber && res === "0" && amount !== "0") {
|
|
294
|
+
return `<${(1 / 10 ** precisionFractionalPlaces).toFixed(
|
|
295
|
+
precisionFractionalPlaces
|
|
296
|
+
)}`;
|
|
297
|
+
}
|
|
298
|
+
return res;
|
|
299
|
+
};
|
|
300
|
+
var generateRandomBigNumber = (length) => {
|
|
301
|
+
return import_ethers.BigNumber.from(import_ethers.utils.randomBytes(length));
|
|
302
|
+
};
|
|
303
|
+
var generateUniqueRandomBigNumber = (length, existingValues) => {
|
|
304
|
+
let result;
|
|
305
|
+
while (result === void 0 || existingValues.includes(result)) {
|
|
306
|
+
result = generateRandomBigNumber(length);
|
|
307
|
+
}
|
|
308
|
+
return result;
|
|
309
|
+
};
|
|
310
|
+
|
|
311
|
+
// src/contracts/abi/BatchQuery.json
|
|
312
|
+
var BatchQuery_default = [
|
|
313
|
+
{
|
|
314
|
+
inputs: [],
|
|
315
|
+
name: "MismatchedLength",
|
|
316
|
+
type: "error"
|
|
317
|
+
},
|
|
318
|
+
{
|
|
319
|
+
inputs: [
|
|
320
|
+
{
|
|
321
|
+
internalType: "uint256",
|
|
322
|
+
name: "index",
|
|
323
|
+
type: "uint256"
|
|
324
|
+
},
|
|
325
|
+
{
|
|
326
|
+
internalType: "address",
|
|
327
|
+
name: "targetAddress",
|
|
328
|
+
type: "address"
|
|
329
|
+
},
|
|
330
|
+
{
|
|
331
|
+
internalType: "bytes",
|
|
332
|
+
name: "calldataBytes",
|
|
333
|
+
type: "bytes"
|
|
334
|
+
}
|
|
335
|
+
],
|
|
336
|
+
name: "QueryFailed",
|
|
337
|
+
type: "error"
|
|
338
|
+
},
|
|
339
|
+
{
|
|
340
|
+
inputs: [
|
|
341
|
+
{
|
|
342
|
+
internalType: "address[]",
|
|
343
|
+
name: "targetAddresses",
|
|
344
|
+
type: "address[]"
|
|
345
|
+
},
|
|
346
|
+
{
|
|
347
|
+
internalType: "bytes[]",
|
|
348
|
+
name: "calldatas",
|
|
349
|
+
type: "bytes[]"
|
|
350
|
+
}
|
|
351
|
+
],
|
|
352
|
+
name: "batchQuery",
|
|
353
|
+
outputs: [
|
|
354
|
+
{
|
|
355
|
+
internalType: "bytes[]",
|
|
356
|
+
name: "",
|
|
357
|
+
type: "bytes[]"
|
|
358
|
+
}
|
|
359
|
+
],
|
|
360
|
+
stateMutability: "view",
|
|
361
|
+
type: "function"
|
|
362
|
+
}
|
|
363
|
+
];
|
|
81
364
|
|
|
82
365
|
// src/contracts/abi/ERC20.json
|
|
83
366
|
var ERC20_default = [
|
|
@@ -1548,113 +1831,1929 @@ var XSwapRouter_default = [
|
|
|
1548
1831
|
];
|
|
1549
1832
|
|
|
1550
1833
|
// src/contracts/abi/index.ts
|
|
1834
|
+
var BatchQueryAbi = BatchQuery_default;
|
|
1551
1835
|
var ERC20Abi = ERC20_default;
|
|
1552
1836
|
var XSwapRouterAbi = XSwapRouter_default;
|
|
1553
1837
|
|
|
1554
|
-
// src/
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1838
|
+
// src/contracts/addresses.ts
|
|
1839
|
+
var ADDRESSES = {
|
|
1840
|
+
// arbitrum
|
|
1841
|
+
"42161": {
|
|
1842
|
+
["BatchQuery" /* BatchQuery */]: "0xb5f9934ea0810ef5faa677e8c68c6983b88664b1",
|
|
1843
|
+
["FeeCollector" /* FeeCollector */]: "0xb37275558f02f05104c2ba35199d16adeb43432f"
|
|
1844
|
+
},
|
|
1845
|
+
// avalanche
|
|
1846
|
+
"43114": {
|
|
1847
|
+
["BatchQuery" /* BatchQuery */]: "0xb5f9934ea0810ef5faa677e8c68c6983b88664b1",
|
|
1848
|
+
["FeeCollector" /* FeeCollector */]: "0xb37275558f02f05104c2ba35199d16adeb43432f"
|
|
1849
|
+
},
|
|
1850
|
+
// base
|
|
1851
|
+
"8453": {
|
|
1852
|
+
["BatchQuery" /* BatchQuery */]: "0xb5f9934ea0810ef5faa677e8c68c6983b88664b1",
|
|
1853
|
+
["FeeCollector" /* FeeCollector */]: "0xb37275558f02f05104c2ba35199d16adeb43432f"
|
|
1854
|
+
},
|
|
1855
|
+
// ethereum
|
|
1856
|
+
"1": {
|
|
1857
|
+
["BatchQuery" /* BatchQuery */]: "0xb5f9934ea0810ef5faa677e8c68c6983b88664b1",
|
|
1858
|
+
["FeeCollector" /* FeeCollector */]: "0xb37275558f02f05104c2ba35199d16adeb43432f"
|
|
1859
|
+
},
|
|
1860
|
+
// optimism
|
|
1861
|
+
"10": {
|
|
1862
|
+
["BatchQuery" /* BatchQuery */]: "0xb5f9934ea0810ef5faa677e8c68c6983b88664b1",
|
|
1863
|
+
["FeeCollector" /* FeeCollector */]: "0xb37275558f02f05104c2ba35199d16adeb43432f"
|
|
1864
|
+
},
|
|
1865
|
+
// polygon
|
|
1866
|
+
"137": {
|
|
1867
|
+
["BatchQuery" /* BatchQuery */]: "0xb5f9934ea0810ef5faa677e8c68c6983b88664b1",
|
|
1868
|
+
["FeeCollector" /* FeeCollector */]: "0xb37275558f02f05104c2ba35199d16adeb43432f"
|
|
1869
|
+
}
|
|
1870
|
+
};
|
|
1871
|
+
|
|
1872
|
+
// src/constants/index.ts
|
|
1873
|
+
var DEFAULT_ECOSYSTEM = "evm" /* EVM */;
|
|
1874
|
+
var NUMBER_INPUT_REGEX = /^[0-9]*[.,]?[0-9]*$/;
|
|
1875
|
+
var SLIPPAGE_PRESETS = [0.5, 1.5, 3];
|
|
1876
|
+
var DELIVERY_TIME = 30 * 1e3 * 60;
|
|
1877
|
+
var EXPRESS_DELIVERY_TIME = 30 * 1e3;
|
|
1878
|
+
var BALANCES_CHUNK_SIZE = 500;
|
|
1879
|
+
var BALANCE_DISPLAY_MIN_LIMIT = 1e-4;
|
|
1880
|
+
var ROUTE_TIMEOUT_MS = 5e3;
|
|
1881
|
+
var MINIMUM_DISPLAYED_TOKEN_AMOUNT = 1e-5;
|
|
1882
|
+
|
|
1883
|
+
// src/utils/contracts.ts
|
|
1884
|
+
var IERC20 = new import_ethers2.ethers.utils.Interface(ERC20Abi);
|
|
1885
|
+
var getBalanceOf = async (wallet, token, rpcUrl) => {
|
|
1886
|
+
const provider = import_ethers2.ethers.getDefaultProvider(rpcUrl);
|
|
1887
|
+
if (token === import_ethers2.ethers.constants.AddressZero) {
|
|
1888
|
+
return import_ethers2.ethers.utils.formatEther(await provider.getBalance(wallet));
|
|
1889
|
+
}
|
|
1890
|
+
const contract = new import_ethers2.ethers.Contract(token, ERC20Abi, provider);
|
|
1891
|
+
return import_ethers2.ethers.utils.formatUnits(
|
|
1892
|
+
await contract.balanceOf(wallet),
|
|
1893
|
+
await contract.decimals()
|
|
1894
|
+
);
|
|
1895
|
+
};
|
|
1896
|
+
var getBalances = async (chain, wallet) => {
|
|
1897
|
+
return {
|
|
1898
|
+
...await getNativeBalance(chain, wallet),
|
|
1899
|
+
...await getErc20Balances(chain, wallet)
|
|
1900
|
+
};
|
|
1901
|
+
};
|
|
1902
|
+
var getNativeBalance = async (chain, wallet) => {
|
|
1903
|
+
const native = chain.tokens.find(
|
|
1904
|
+
({ address }) => address === import_ethers2.ethers.constants.AddressZero
|
|
1905
|
+
);
|
|
1906
|
+
if (native) {
|
|
1907
|
+
const provider = import_ethers2.ethers.getDefaultProvider(chain.publicRpcUrls[0]);
|
|
1908
|
+
const balance = await provider.getBalance(wallet);
|
|
1909
|
+
return {
|
|
1910
|
+
[native.address]: balance
|
|
1911
|
+
};
|
|
1912
|
+
}
|
|
1913
|
+
return {};
|
|
1914
|
+
};
|
|
1915
|
+
var getErc20Balances = async (chain, wallet) => {
|
|
1916
|
+
const erc20Tokens = chain.tokens.filter(
|
|
1917
|
+
({ address }) => address !== import_ethers2.ethers.constants.AddressZero
|
|
1918
|
+
);
|
|
1919
|
+
const tokenChunks = chunkArray(erc20Tokens, BALANCES_CHUNK_SIZE);
|
|
1920
|
+
const promises = tokenChunks.map(async (tokenChunk) => {
|
|
1921
|
+
const tokenAddresses = tokenChunk.map((token) => token.address);
|
|
1922
|
+
const calldatas = tokenChunk.map(
|
|
1923
|
+
() => IERC20.encodeFunctionData("balanceOf", [wallet])
|
|
1924
|
+
);
|
|
1925
|
+
const contractAddress = ADDRESSES[chain.chainId]?.BatchQuery;
|
|
1926
|
+
const rpcUrl = chain.publicRpcUrls[0];
|
|
1927
|
+
if (contractAddress && rpcUrl) {
|
|
1928
|
+
const contract = new import_ethers2.ethers.Contract(
|
|
1929
|
+
contractAddress,
|
|
1930
|
+
BatchQueryAbi,
|
|
1931
|
+
import_ethers2.ethers.getDefaultProvider(rpcUrl)
|
|
1932
|
+
);
|
|
1933
|
+
return await contract["batchQuery"](tokenAddresses, calldatas);
|
|
1562
1934
|
}
|
|
1935
|
+
return Promise.resolve();
|
|
1563
1936
|
});
|
|
1564
|
-
|
|
1937
|
+
const tokenBalances = (await Promise.all(promises)).flat().map(
|
|
1938
|
+
(encodedBalance) => import_ethers2.ethers.utils.defaultAbiCoder.decode(["uint256"], encodedBalance)[0]
|
|
1939
|
+
);
|
|
1940
|
+
const balances = {};
|
|
1941
|
+
erc20Tokens.forEach((token, index) => {
|
|
1942
|
+
balances[token.address] = tokenBalances[index];
|
|
1943
|
+
});
|
|
1944
|
+
return balances;
|
|
1945
|
+
};
|
|
1946
|
+
var generateApproveTxData = (tokenAddress, spender, amount) => {
|
|
1947
|
+
return tokenAddress !== import_ethers2.ethers.constants.AddressZero ? {
|
|
1948
|
+
to: tokenAddress,
|
|
1949
|
+
value: safeBigNumberFrom("0"),
|
|
1950
|
+
data: IERC20.encodeFunctionData("approve", [spender, amount])
|
|
1951
|
+
} : void 0;
|
|
1952
|
+
};
|
|
1953
|
+
var findPlaceholderIndex = (abi, funName, funParams, placeholderValue) => {
|
|
1954
|
+
if (funParams.flat(Infinity).filter((param) => param === placeholderValue).length !== 1) {
|
|
1955
|
+
throw new Error("Random placeholder value must be provided and unique.");
|
|
1956
|
+
}
|
|
1957
|
+
const iface = new import_ethers2.ethers.utils.Interface(abi);
|
|
1958
|
+
const functionFragment = iface.getFunction(funName);
|
|
1959
|
+
if (!functionFragment) {
|
|
1960
|
+
throw new Error(`Can't find function "${funName}" in provided ABI.`);
|
|
1961
|
+
}
|
|
1962
|
+
const encodedFunData = iface.encodeFunctionData(functionFragment, funParams);
|
|
1963
|
+
const paramData = encodedFunData.slice(10);
|
|
1964
|
+
const chunks = [];
|
|
1965
|
+
for (let i = 0; i < paramData.length; i += 64) {
|
|
1966
|
+
chunks.push(paramData.slice(i, i + 64));
|
|
1967
|
+
}
|
|
1968
|
+
const searchValue = placeholderValue.toHexString().slice(2).padStart(64, "0");
|
|
1969
|
+
const result = chunks.findIndex((chunk) => chunk === searchValue);
|
|
1970
|
+
if (result === -1) {
|
|
1971
|
+
throw new Error("Randomized parameter not found in the encoded data.");
|
|
1972
|
+
}
|
|
1973
|
+
return result;
|
|
1974
|
+
};
|
|
1975
|
+
|
|
1976
|
+
// src/utils/strings.ts
|
|
1977
|
+
var shortAddress = (address) => {
|
|
1978
|
+
return `${address?.substring(0, 5)}...${address?.substring(
|
|
1979
|
+
address.length - 5,
|
|
1980
|
+
address.length
|
|
1981
|
+
)}`;
|
|
1982
|
+
};
|
|
1983
|
+
|
|
1984
|
+
// src/utils/index.ts
|
|
1985
|
+
var replaceNull = (values, newValue) => {
|
|
1986
|
+
const modifiedValues = [...values];
|
|
1987
|
+
for (let i = 0; i < modifiedValues.length; i++) {
|
|
1988
|
+
if (Array.isArray(modifiedValues[i])) {
|
|
1989
|
+
modifiedValues[i] = replaceNull(modifiedValues[i], newValue);
|
|
1990
|
+
} else {
|
|
1991
|
+
if (modifiedValues[i] === null) {
|
|
1992
|
+
modifiedValues[i] = newValue;
|
|
1993
|
+
}
|
|
1994
|
+
}
|
|
1995
|
+
}
|
|
1996
|
+
return modifiedValues;
|
|
1997
|
+
};
|
|
1998
|
+
var deepMergeObjects = (obj1, obj2) => {
|
|
1999
|
+
for (const key in obj2) {
|
|
2000
|
+
if (obj2.hasOwnProperty(key)) {
|
|
2001
|
+
if (obj1.hasOwnProperty(key) && typeof obj1[key] === "object" && typeof obj2[key] === "object") {
|
|
2002
|
+
deepMergeObjects(obj1[key], obj2[key]);
|
|
2003
|
+
} else {
|
|
2004
|
+
obj1[key] = obj2[key];
|
|
2005
|
+
}
|
|
2006
|
+
}
|
|
2007
|
+
}
|
|
2008
|
+
return { ...obj1 };
|
|
2009
|
+
};
|
|
2010
|
+
var chunkArray = (array, chunkSize) => {
|
|
2011
|
+
const result = [];
|
|
2012
|
+
for (let i = 0; i < array.length; i += chunkSize) {
|
|
2013
|
+
result.push(array.slice(i, i + chunkSize));
|
|
2014
|
+
}
|
|
2015
|
+
return result;
|
|
2016
|
+
};
|
|
2017
|
+
|
|
2018
|
+
// src/services/integrations/customCalls/staking.ts
|
|
2019
|
+
var generateStakingCalls = ({
|
|
2020
|
+
token,
|
|
2021
|
+
staking,
|
|
2022
|
+
stakingAbi,
|
|
2023
|
+
stakingFunName,
|
|
2024
|
+
stakingFunParams
|
|
2025
|
+
}) => {
|
|
2026
|
+
const flatStakingFunParams = stakingFunParams.flat(Infinity);
|
|
2027
|
+
if (flatStakingFunParams.filter((param) => param === null).length !== 1) {
|
|
1565
2028
|
throw new Error(
|
|
1566
|
-
|
|
2029
|
+
"Exactly 1 'null' value should be provided in 'funParams' in order to override token balance"
|
|
1567
2030
|
);
|
|
1568
2031
|
}
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
2032
|
+
const randomBigNumber = generateUniqueRandomBigNumber(
|
|
2033
|
+
32,
|
|
2034
|
+
flatStakingFunParams
|
|
2035
|
+
);
|
|
2036
|
+
const modifiedStakingFunParams = replaceNull(
|
|
2037
|
+
stakingFunParams,
|
|
2038
|
+
randomBigNumber
|
|
2039
|
+
);
|
|
2040
|
+
const approveFunParams = [staking, randomBigNumber];
|
|
2041
|
+
const stakingApproveCall = {
|
|
2042
|
+
callType: 1 /* FULL_TOKEN_BALANCE */,
|
|
2043
|
+
target: token,
|
|
2044
|
+
callData: IERC20.encodeFunctionData("approve", approveFunParams),
|
|
2045
|
+
payload: import_ethers3.ethers.utils.defaultAbiCoder.encode(
|
|
2046
|
+
["address", "uint256"],
|
|
2047
|
+
[
|
|
2048
|
+
token,
|
|
2049
|
+
findPlaceholderIndex(
|
|
2050
|
+
JSON.stringify(ERC20Abi),
|
|
2051
|
+
"approve",
|
|
2052
|
+
approveFunParams,
|
|
2053
|
+
randomBigNumber
|
|
2054
|
+
)
|
|
2055
|
+
]
|
|
2056
|
+
),
|
|
2057
|
+
value: "0"
|
|
2058
|
+
};
|
|
2059
|
+
const stakingCall = {
|
|
2060
|
+
callType: 1 /* FULL_TOKEN_BALANCE */,
|
|
2061
|
+
target: staking,
|
|
2062
|
+
callData: new import_ethers3.ethers.utils.Interface(stakingAbi).encodeFunctionData(
|
|
2063
|
+
stakingFunName,
|
|
2064
|
+
modifiedStakingFunParams
|
|
2065
|
+
),
|
|
2066
|
+
payload: import_ethers3.ethers.utils.defaultAbiCoder.encode(
|
|
2067
|
+
["address", "uint256"],
|
|
2068
|
+
[
|
|
2069
|
+
token,
|
|
2070
|
+
findPlaceholderIndex(
|
|
2071
|
+
stakingAbi,
|
|
2072
|
+
stakingFunName,
|
|
2073
|
+
modifiedStakingFunParams,
|
|
2074
|
+
randomBigNumber
|
|
2075
|
+
)
|
|
2076
|
+
]
|
|
2077
|
+
),
|
|
2078
|
+
value: "0"
|
|
2079
|
+
};
|
|
2080
|
+
return [stakingApproveCall, stakingCall];
|
|
2081
|
+
};
|
|
2082
|
+
|
|
2083
|
+
// src/services/integrations/transactions.ts
|
|
2084
|
+
var getSwapTx = async ({
|
|
2085
|
+
dstChain,
|
|
2086
|
+
dstToken,
|
|
2087
|
+
customContractCalls = [],
|
|
2088
|
+
desc
|
|
2089
|
+
}) => {
|
|
2090
|
+
const supportedChains = (await getChains()).filter(
|
|
2091
|
+
({ web3Environment, swapSupported }) => web3Environment === "mainnet" /* MAINNET */ && swapSupported
|
|
2092
|
+
);
|
|
2093
|
+
const route = await openTxConfigForm({
|
|
2094
|
+
dstChainId: dstChain,
|
|
2095
|
+
dstTokenAddr: dstToken,
|
|
2096
|
+
customContractCalls,
|
|
2097
|
+
desc,
|
|
2098
|
+
supportedChains
|
|
2099
|
+
});
|
|
2100
|
+
return route.transactions;
|
|
2101
|
+
};
|
|
2102
|
+
|
|
2103
|
+
// src/hooks/useDebounce.tsx
|
|
2104
|
+
var import_react = require("react");
|
|
2105
|
+
var useDebounce = (value, delay) => {
|
|
2106
|
+
const timeoutRef = (0, import_react.useRef)(null);
|
|
2107
|
+
(0, import_react.useEffect)(() => {
|
|
2108
|
+
if (timeoutRef.current)
|
|
2109
|
+
clearTimeout(timeoutRef.current);
|
|
2110
|
+
timeoutRef.current = setTimeout(() => {
|
|
2111
|
+
setValue(value);
|
|
2112
|
+
}, delay);
|
|
2113
|
+
return () => {
|
|
2114
|
+
if (timeoutRef.current)
|
|
2115
|
+
clearTimeout(timeoutRef.current);
|
|
2116
|
+
};
|
|
2117
|
+
}, [value, delay]);
|
|
2118
|
+
const [debouncedValue, setValue] = (0, import_react.useState)(value);
|
|
2119
|
+
return debouncedValue;
|
|
2120
|
+
};
|
|
2121
|
+
|
|
2122
|
+
// src/components/TxConfigForm/History.tsx
|
|
2123
|
+
var import_react3 = require("react");
|
|
2124
|
+
var import_bignumber2 = __toESM(require("bignumber.js"));
|
|
2125
|
+
|
|
2126
|
+
// src/components/TxConfigForm/HistoryCard.tsx
|
|
2127
|
+
var import_react2 = require("react");
|
|
2128
|
+
var import_date_fns = require("date-fns");
|
|
2129
|
+
|
|
2130
|
+
// src/components/icons/ArrowRightIcon.tsx
|
|
2131
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
2132
|
+
var ArrowRightIcon = () => {
|
|
2133
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
2134
|
+
"svg",
|
|
1574
2135
|
{
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
2136
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2137
|
+
viewBox: "0 0 448 512",
|
|
2138
|
+
fill: "currentColor",
|
|
2139
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M438.6 278.6c12.5-12.5 12.5-32.8 0-45.3l-160-160c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3L338.8 224 32 224c-17.7 0-32 14.3-32 32s14.3 32 32 32l306.7 0L233.4 393.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0l160-160z" })
|
|
2140
|
+
}
|
|
1579
2141
|
);
|
|
1580
|
-
}
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
2142
|
+
};
|
|
2143
|
+
|
|
2144
|
+
// src/components/icons/ArrowDownIcon.tsx
|
|
2145
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
2146
|
+
var ArrowDownIcon = () => {
|
|
2147
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
2148
|
+
"svg",
|
|
1585
2149
|
{
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
2150
|
+
width: "20",
|
|
2151
|
+
height: "20",
|
|
2152
|
+
viewBox: "0 0 20 20",
|
|
2153
|
+
fill: "none",
|
|
2154
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2155
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
2156
|
+
"path",
|
|
2157
|
+
{
|
|
2158
|
+
d: "M12 2.45932L12 12.8957L15.8625 9.15023L18 11.1866L10.5 18.4593L3 11.1866L5.1375 9.15023L9 12.8957L9 2.45932L12 2.45932Z",
|
|
2159
|
+
fill: "white"
|
|
2160
|
+
}
|
|
2161
|
+
)
|
|
2162
|
+
}
|
|
1589
2163
|
);
|
|
1590
|
-
}
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
2164
|
+
};
|
|
2165
|
+
|
|
2166
|
+
// src/components/icons/ArrowUpRightIcon.tsx
|
|
2167
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
2168
|
+
var ArrowUpRightIcon = () => {
|
|
2169
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
2170
|
+
"svg",
|
|
1595
2171
|
{
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
2172
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2173
|
+
viewBox: "0 0 512 512",
|
|
2174
|
+
fill: "currentColor",
|
|
2175
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("path", { d: "M320 0c-17.7 0-32 14.3-32 32s14.3 32 32 32h82.7L201.4 265.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0L448 109.3V192c0 17.7 14.3 32 32 32s32-14.3 32-32V32c0-17.7-14.3-32-32-32H320zM80 32C35.8 32 0 67.8 0 112V432c0 44.2 35.8 80 80 80H400c44.2 0 80-35.8 80-80V320c0-17.7-14.3-32-32-32s-32 14.3-32 32V432c0 8.8-7.2 16-16 16H80c-8.8 0-16-7.2-16-16V112c0-8.8 7.2-16 16-16H192c17.7 0 32-14.3 32-32s-14.3-32-32-32H80z" })
|
|
2176
|
+
}
|
|
1599
2177
|
);
|
|
1600
|
-
}
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
2178
|
+
};
|
|
2179
|
+
|
|
2180
|
+
// src/components/icons/CheckIcon.tsx
|
|
2181
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
2182
|
+
var CheckIcon = () => {
|
|
2183
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
2184
|
+
"svg",
|
|
1605
2185
|
{
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
2186
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2187
|
+
viewBox: "0 0 448 512",
|
|
2188
|
+
fill: "currentColor",
|
|
2189
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("path", { d: "M438.6 105.4c12.5 12.5 12.5 32.8 0 45.3l-256 256c-12.5 12.5-32.8 12.5-45.3 0l-128-128c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0L160 338.7 393.4 105.4c12.5-12.5 32.8-12.5 45.3 0z" })
|
|
2190
|
+
}
|
|
1609
2191
|
);
|
|
1610
|
-
}
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
2192
|
+
};
|
|
2193
|
+
|
|
2194
|
+
// src/components/icons/ChevronDownIcon.tsx
|
|
2195
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
2196
|
+
var ChevronDownIcon = () => {
|
|
2197
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
2198
|
+
"svg",
|
|
2199
|
+
{
|
|
2200
|
+
width: "12",
|
|
2201
|
+
height: "12",
|
|
2202
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2203
|
+
viewBox: "0 0 512 512",
|
|
2204
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
2205
|
+
"path",
|
|
2206
|
+
{
|
|
2207
|
+
fill: "currentColor",
|
|
2208
|
+
d: "M233.4 406.6c12.5 12.5 32.8 12.5 45.3 0l192-192c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L256 338.7 86.6 169.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3l192 192z"
|
|
2209
|
+
}
|
|
2210
|
+
)
|
|
2211
|
+
}
|
|
2212
|
+
);
|
|
2213
|
+
};
|
|
2214
|
+
|
|
2215
|
+
// src/components/icons/ChevronUpIcon.tsx
|
|
2216
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
2217
|
+
var ChevronUpIcon = () => {
|
|
2218
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
2219
|
+
"svg",
|
|
1614
2220
|
{
|
|
1615
|
-
|
|
2221
|
+
height: "12",
|
|
2222
|
+
width: "12",
|
|
2223
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2224
|
+
viewBox: "0 0 512 512",
|
|
2225
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
2226
|
+
"path",
|
|
2227
|
+
{
|
|
2228
|
+
fill: "currentColor",
|
|
2229
|
+
d: "M233.4 105.4c12.5-12.5 32.8-12.5 45.3 0l192 192c12.5 12.5 12.5 32.8 0 45.3s-32.8 12.5-45.3 0L256 173.3 86.6 342.6c-12.5 12.5-32.8 12.5-45.3 0s-12.5-32.8 0-45.3l192-192z"
|
|
2230
|
+
}
|
|
2231
|
+
)
|
|
2232
|
+
}
|
|
2233
|
+
);
|
|
2234
|
+
};
|
|
2235
|
+
|
|
2236
|
+
// src/components/icons/CircularProgressIcon.tsx
|
|
2237
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
2238
|
+
var CircularProgressIcon = () => {
|
|
2239
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
2240
|
+
"svg",
|
|
2241
|
+
{
|
|
2242
|
+
className: "animate-spin -ml-1 mr-3 h-10 w-10 text-white",
|
|
2243
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2244
|
+
fill: "none",
|
|
2245
|
+
viewBox: "0 0 24 24",
|
|
2246
|
+
children: [
|
|
2247
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2248
|
+
"circle",
|
|
2249
|
+
{
|
|
2250
|
+
className: "opacity-25",
|
|
2251
|
+
cx: "12",
|
|
2252
|
+
cy: "12",
|
|
2253
|
+
r: "10",
|
|
2254
|
+
stroke: "currentColor",
|
|
2255
|
+
strokeWidth: "4"
|
|
2256
|
+
}
|
|
2257
|
+
),
|
|
2258
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2259
|
+
"path",
|
|
2260
|
+
{
|
|
2261
|
+
className: "opacity-75",
|
|
2262
|
+
fill: "currentColor",
|
|
2263
|
+
d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
|
|
2264
|
+
}
|
|
2265
|
+
)
|
|
2266
|
+
]
|
|
2267
|
+
}
|
|
2268
|
+
);
|
|
2269
|
+
};
|
|
2270
|
+
|
|
2271
|
+
// src/components/icons/CoinsIcon.tsx
|
|
2272
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
2273
|
+
var CoinsIcon = () => {
|
|
2274
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
2275
|
+
"svg",
|
|
2276
|
+
{
|
|
2277
|
+
width: "24",
|
|
2278
|
+
height: "24",
|
|
2279
|
+
viewBox: "0 0 24 24",
|
|
2280
|
+
fill: "none",
|
|
2281
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2282
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
2283
|
+
"path",
|
|
2284
|
+
{
|
|
2285
|
+
d: "M15 20C12.7667 20 10.875 19.225 9.325 17.675C7.775 16.125 7 14.2333 7 12C7 9.76667 7.775 7.875 9.325 6.325C10.875 4.775 12.7667 4 15 4C17.2333 4 19.125 4.775 20.675 6.325C22.225 7.875 23 9.76667 23 12C23 14.2333 22.225 16.125 20.675 17.675C19.125 19.225 17.2333 20 15 20ZM7 19.75C5.23333 19.2833 3.79167 18.3333 2.675 16.9C1.55833 15.4667 1 13.8333 1 12C1 10.1667 1.55833 8.53333 2.675 7.1C3.79167 5.66667 5.23333 4.71667 7 4.25V6.35C5.8 6.76667 4.83333 7.49167 4.1 8.525C3.36667 9.55833 3 10.7167 3 12C3 13.2833 3.36667 14.4417 4.1 15.475C4.83333 16.5083 5.8 17.2333 7 17.65V19.75ZM15 18C16.6667 18 18.0833 17.4167 19.25 16.25C20.4167 15.0833 21 13.6667 21 12C21 10.3333 20.4167 8.91667 19.25 7.75C18.0833 6.58333 16.6667 6 15 6C13.3333 6 11.9167 6.58333 10.75 7.75C9.58333 8.91667 9 10.3333 9 12C9 13.6667 9.58333 15.0833 10.75 16.25C11.9167 17.4167 13.3333 18 15 18Z",
|
|
2286
|
+
fill: "white",
|
|
2287
|
+
fillOpacity: "0.6"
|
|
2288
|
+
}
|
|
2289
|
+
)
|
|
2290
|
+
}
|
|
2291
|
+
);
|
|
2292
|
+
};
|
|
2293
|
+
|
|
2294
|
+
// src/components/icons/DownArrorIcon.tsx
|
|
2295
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
2296
|
+
var DownArrowIcon = () => {
|
|
2297
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
2298
|
+
"svg",
|
|
2299
|
+
{
|
|
2300
|
+
width: 16,
|
|
2301
|
+
height: 16,
|
|
2302
|
+
viewBox: "0 0 16 16",
|
|
2303
|
+
fill: "none",
|
|
2304
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2305
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
2306
|
+
"path",
|
|
2307
|
+
{
|
|
2308
|
+
d: "M8.00008 9.76921L5.06421 6.83334H10.9359L8.00008 9.76921Z",
|
|
2309
|
+
fill: "white",
|
|
2310
|
+
fillOpacity: "0.2"
|
|
2311
|
+
}
|
|
2312
|
+
)
|
|
2313
|
+
}
|
|
2314
|
+
);
|
|
2315
|
+
};
|
|
2316
|
+
|
|
2317
|
+
// src/components/icons/HistoryIcon.tsx
|
|
2318
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
2319
|
+
var HistoryIcon = () => {
|
|
2320
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
2321
|
+
"svg",
|
|
2322
|
+
{
|
|
2323
|
+
width: "20",
|
|
2324
|
+
height: "20",
|
|
2325
|
+
viewBox: "0 0 20 20",
|
|
2326
|
+
fill: "none",
|
|
2327
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2328
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
2329
|
+
"path",
|
|
2330
|
+
{
|
|
2331
|
+
d: "M9.98413 17.5C8.1633 17.5 6.57667 16.8646 5.22424 15.5938C3.8718 14.3229 3.09663 12.7361 2.89871 10.8333H4.52163C4.70635 12.2778 5.3166 13.4722 6.35236 14.4167C7.38812 15.3611 8.59871 15.8333 9.98413 15.8333C11.5279 15.8333 12.8374 15.2674 13.9128 14.1354C14.9881 13.0035 15.5258 11.625 15.5258 10C15.5258 8.375 14.9881 6.99653 13.9128 5.86458C12.8374 4.73264 11.5279 4.16667 9.98413 4.16667C9.07371 4.16667 8.22267 4.38889 7.43101 4.83333C6.63934 5.27778 5.97302 5.88889 5.43205 6.66667H7.60913V8.33333H2.85913V3.33333H4.44246V5.29167C5.11538 4.40278 5.93673 3.71528 6.90653 3.22917C7.87632 2.74306 8.90219 2.5 9.98413 2.5C10.9737 2.5 11.9006 2.69792 12.7649 3.09375C13.6291 3.48958 14.3812 4.02431 15.0211 4.69792C15.661 5.37153 16.169 6.16319 16.5451 7.07292C16.9211 7.98264 17.1091 8.95833 17.1091 10C17.1091 11.0417 16.9211 12.0174 16.5451 12.9271C16.169 13.8368 15.661 14.6285 15.0211 15.3021C14.3812 15.9757 13.6291 16.5104 12.7649 16.9062C11.9006 17.3021 10.9737 17.5 9.98413 17.5ZM12.2008 13.5L9.19246 10.3333V5.83333H10.7758V9.66667L13.3091 12.3333L12.2008 13.5Z",
|
|
2332
|
+
fill: "white"
|
|
2333
|
+
}
|
|
2334
|
+
)
|
|
2335
|
+
}
|
|
2336
|
+
);
|
|
2337
|
+
};
|
|
2338
|
+
|
|
2339
|
+
// src/components/icons/HourGlassIcon.tsx
|
|
2340
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
2341
|
+
var HourGlassIcon = () => {
|
|
2342
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
2343
|
+
"svg",
|
|
2344
|
+
{
|
|
2345
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2346
|
+
viewBox: "0 0 384 512",
|
|
2347
|
+
fill: "currentColor",
|
|
2348
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("path", { d: "M0 32C0 14.3 14.3 0 32 0H64 320h32c17.7 0 32 14.3 32 32s-14.3 32-32 32V75c0 42.4-16.9 83.1-46.9 113.1L237.3 256l67.9 67.9c30 30 46.9 70.7 46.9 113.1v11c17.7 0 32 14.3 32 32s-14.3 32-32 32H320 64 32c-17.7 0-32-14.3-32-32s14.3-32 32-32V437c0-42.4 16.9-83.1 46.9-113.1L146.7 256 78.9 188.1C48.9 158.1 32 117.4 32 75V64C14.3 64 0 49.7 0 32zM96 64V75c0 25.5 10.1 49.9 28.1 67.9L192 210.7l67.9-67.9c18-18 28.1-42.4 28.1-67.9V64H96zm0 384H288V437c0-25.5-10.1-49.9-28.1-67.9L192 301.3l-67.9 67.9c-18 18-28.1 42.4-28.1 67.9v11z" })
|
|
2349
|
+
}
|
|
2350
|
+
);
|
|
2351
|
+
};
|
|
2352
|
+
|
|
2353
|
+
// src/components/icons/SearchIcon.tsx
|
|
2354
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
2355
|
+
var SearchIcon = () => {
|
|
2356
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2357
|
+
"svg",
|
|
2358
|
+
{
|
|
2359
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2360
|
+
height: "24",
|
|
2361
|
+
width: "24",
|
|
2362
|
+
viewBox: "0 -960 960 960",
|
|
2363
|
+
fill: "#ffffffc0",
|
|
2364
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("path", { d: "M784-120 532-372q-30 24-69 38t-83 14q-109 0-184.5-75.5T120-580q0-109 75.5-184.5T380-840q109 0 184.5 75.5T640-580q0 44-14 83t-38 69l252 252-56 56ZM380-400q75 0 127.5-52.5T560-580q0-75-52.5-127.5T380-760q-75 0-127.5 52.5T200-580q0 75 52.5 127.5T380-400Z" })
|
|
2365
|
+
}
|
|
2366
|
+
);
|
|
2367
|
+
};
|
|
2368
|
+
|
|
2369
|
+
// src/components/icons/XMarkIcon.tsx
|
|
2370
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
2371
|
+
var XMarkIcon = () => {
|
|
2372
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2373
|
+
"svg",
|
|
2374
|
+
{
|
|
2375
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2376
|
+
viewBox: "0 0 384 512",
|
|
2377
|
+
fill: "current",
|
|
2378
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("path", { d: "M342.6 150.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L192 210.7 86.6 105.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3L146.7 256 41.4 361.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0L192 301.3 297.4 406.6c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L237.3 256 342.6 150.6z" })
|
|
2379
|
+
}
|
|
2380
|
+
);
|
|
2381
|
+
};
|
|
2382
|
+
|
|
2383
|
+
// src/components/icons/PercentageIcon.tsx
|
|
2384
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
2385
|
+
var PercentageIcon = () => {
|
|
2386
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
2387
|
+
"svg",
|
|
2388
|
+
{
|
|
2389
|
+
width: "12",
|
|
2390
|
+
height: "12",
|
|
2391
|
+
viewBox: "0 0 12 12",
|
|
2392
|
+
fill: "none",
|
|
2393
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2394
|
+
children: [
|
|
2395
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2396
|
+
"path",
|
|
2397
|
+
{
|
|
2398
|
+
d: "M3.00008 5.33329C2.35564 5.33329 1.80564 5.10552 1.35008 4.64996C0.894526 4.1944 0.666748 3.6444 0.666748 2.99996C0.666748 2.35551 0.894526 1.80551 1.35008 1.34996C1.80564 0.894404 2.35564 0.666626 3.00008 0.666626C3.64453 0.666626 4.19453 0.894404 4.65008 1.34996C5.10564 1.80551 5.33342 2.35551 5.33342 2.99996C5.33342 3.6444 5.10564 4.1944 4.65008 4.64996C4.19453 5.10552 3.64453 5.33329 3.00008 5.33329ZM3.00008 3.99996C3.27786 3.99996 3.51397 3.90274 3.70841 3.70829C3.90286 3.51385 4.00008 3.27774 4.00008 2.99996C4.00008 2.72218 3.90286 2.48607 3.70841 2.29163C3.51397 2.09718 3.27786 1.99996 3.00008 1.99996C2.7223 1.99996 2.48619 2.09718 2.29175 2.29163C2.0973 2.48607 2.00008 2.72218 2.00008 2.99996C2.00008 3.27774 2.0973 3.51385 2.29175 3.70829C2.48619 3.90274 2.7223 3.99996 3.00008 3.99996ZM9.00008 11.3333C8.35564 11.3333 7.80564 11.1055 7.35008 10.65C6.89453 10.1944 6.66675 9.6444 6.66675 8.99996C6.66675 8.35552 6.89453 7.80552 7.35008 7.34996C7.80564 6.8944 8.35564 6.66663 9.00008 6.66663C9.64453 6.66663 10.1945 6.8944 10.6501 7.34996C11.1056 7.80552 11.3334 8.35552 11.3334 8.99996C11.3334 9.6444 11.1056 10.1944 10.6501 10.65C10.1945 11.1055 9.64453 11.3333 9.00008 11.3333ZM9.00008 9.99996C9.27786 9.99996 9.51397 9.90274 9.70842 9.70829C9.90286 9.51385 10.0001 9.27774 10.0001 8.99996C10.0001 8.72218 9.90286 8.48607 9.70842 8.29163C9.51397 8.09718 9.27786 7.99996 9.00008 7.99996C8.7223 7.99996 8.48619 8.09718 8.29175 8.29163C8.0973 8.48607 8.00008 8.72218 8.00008 8.99996C8.00008 9.27774 8.0973 9.51385 8.29175 9.70829C8.48619 9.90274 8.7223 9.99996 9.00008 9.99996ZM1.60008 11.3333L0.666748 10.4L10.4001 0.666626L11.3334 1.59996L1.60008 11.3333Z",
|
|
2399
|
+
fill: "url(#paint0_linear_32_1164)"
|
|
2400
|
+
}
|
|
2401
|
+
),
|
|
2402
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
2403
|
+
"linearGradient",
|
|
2404
|
+
{
|
|
2405
|
+
id: "paint0_linear_32_1164",
|
|
2406
|
+
x1: "0.666748",
|
|
2407
|
+
y1: "0.666626",
|
|
2408
|
+
x2: "11.9132",
|
|
2409
|
+
y2: "1.31767",
|
|
2410
|
+
gradientUnits: "userSpaceOnUse",
|
|
2411
|
+
children: [
|
|
2412
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("stop", { stopColor: "#3681C6" }),
|
|
2413
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("stop", { offset: "1", stopColor: "#2B4A9D" })
|
|
2414
|
+
]
|
|
2415
|
+
}
|
|
2416
|
+
) })
|
|
2417
|
+
]
|
|
2418
|
+
}
|
|
2419
|
+
);
|
|
2420
|
+
};
|
|
2421
|
+
|
|
2422
|
+
// src/components/icons/TimerIcon.tsx
|
|
2423
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
2424
|
+
var TimerIcon = () => {
|
|
2425
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
2426
|
+
"svg",
|
|
2427
|
+
{
|
|
2428
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2429
|
+
height: "16",
|
|
2430
|
+
viewBox: "0 -960 960 960",
|
|
2431
|
+
width: "16",
|
|
2432
|
+
fill: "currentColor",
|
|
2433
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("path", { d: "M360-840v-80h240v80H360Zm80 440h80v-240h-80v240Zm40 320q-74 0-139.5-28.5T226-186q-49-49-77.5-114.5T120-440q0-74 28.5-139.5T226-694q49-49 114.5-77.5T480-800q62 0 119 20t107 58l56-56 56 56-56 56q38 50 58 107t20 119q0 74-28.5 139.5T734-186q-49 49-114.5 77.5T480-80Zm0-80q116 0 198-82t82-198q0-116-82-198t-198-82q-116 0-198 82t-82 198q0 116 82 198t198 82Zm0-280Z" })
|
|
2434
|
+
}
|
|
2435
|
+
);
|
|
2436
|
+
};
|
|
2437
|
+
|
|
2438
|
+
// src/components/icons/InfoIcon.tsx
|
|
2439
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
2440
|
+
var InfoIcon = () => {
|
|
2441
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2442
|
+
"svg",
|
|
2443
|
+
{
|
|
2444
|
+
width: "28",
|
|
2445
|
+
height: "28",
|
|
2446
|
+
viewBox: "0 0 28 28",
|
|
2447
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2448
|
+
fill: "currentColor",
|
|
2449
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("path", { d: "M12.6667 20.6666H15.3334V12.6666H12.6667V20.6666ZM14.0001 9.99996C14.3779 9.99996 14.6945 9.87218 14.9501 9.61663C15.2056 9.36107 15.3334 9.0444 15.3334 8.66663C15.3334 8.28885 15.2056 7.97218 14.9501 7.71663C14.6945 7.46107 14.3779 7.33329 14.0001 7.33329C13.6223 7.33329 13.3056 7.46107 13.0501 7.71663C12.7945 7.97218 12.6667 8.28885 12.6667 8.66663C12.6667 9.0444 12.7945 9.36107 13.0501 9.61663C13.3056 9.87218 13.6223 9.99996 14.0001 9.99996ZM14.0001 27.3333C12.1556 27.3333 10.4223 26.9833 8.80008 26.2833C7.17786 25.5833 5.76675 24.6333 4.56675 23.4333C3.36675 22.2333 2.41675 20.8222 1.71675 19.2C1.01675 17.5777 0.666748 15.8444 0.666748 14C0.666748 12.1555 1.01675 10.4222 1.71675 8.79996C2.41675 7.17774 3.36675 5.76663 4.56675 4.56663C5.76675 3.36663 7.17786 2.41663 8.80008 1.71663C10.4223 1.01663 12.1556 0.666626 14.0001 0.666626C15.8445 0.666626 17.5779 1.01663 19.2001 1.71663C20.8223 2.41663 22.2334 3.36663 23.4334 4.56663C24.6334 5.76663 25.5834 7.17774 26.2834 8.79996C26.9834 10.4222 27.3334 12.1555 27.3334 14C27.3334 15.8444 26.9834 17.5777 26.2834 19.2C25.5834 20.8222 24.6334 22.2333 23.4334 23.4333C22.2334 24.6333 20.8223 25.5833 19.2001 26.2833C17.5779 26.9833 15.8445 27.3333 14.0001 27.3333ZM14.0001 24.6666C16.9779 24.6666 19.5001 23.6333 21.5667 21.5666C23.6334 19.5 24.6667 16.9777 24.6667 14C24.6667 11.0222 23.6334 8.49996 21.5667 6.43329C19.5001 4.36663 16.9779 3.33329 14.0001 3.33329C11.0223 3.33329 8.50008 4.36663 6.43341 6.43329C4.36675 8.49996 3.33341 11.0222 3.33341 14C3.33341 16.9777 4.36675 19.5 6.43341 21.5666C8.50008 23.6333 11.0223 24.6666 14.0001 24.6666Z" })
|
|
2450
|
+
}
|
|
2451
|
+
);
|
|
2452
|
+
};
|
|
2453
|
+
|
|
2454
|
+
// src/components/icons/SettingsIcon.tsx
|
|
2455
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
2456
|
+
var SettingsIcon = () => {
|
|
2457
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
2458
|
+
"svg",
|
|
2459
|
+
{
|
|
2460
|
+
width: "18",
|
|
2461
|
+
height: "18",
|
|
2462
|
+
viewBox: "0 0 18 18",
|
|
2463
|
+
fill: "none",
|
|
2464
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2465
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
2466
|
+
"path",
|
|
2467
|
+
{
|
|
2468
|
+
d: "M6.62325 17.5L6.26504 14.78C6.07101 14.7092 5.88818 14.6242 5.71653 14.525C5.54489 14.4258 5.37698 14.3196 5.2128 14.2063L2.54862 15.2688L0.0859375 11.2312L2.39191 9.57375C2.37698 9.47458 2.36952 9.37896 2.36952 9.28687V8.71313C2.36952 8.62104 2.37698 8.52542 2.39191 8.42625L0.0859375 6.76875L2.54862 2.73125L5.2128 3.79375C5.37698 3.68042 5.54862 3.57417 5.72773 3.475C5.90683 3.37583 6.08594 3.29083 6.26504 3.22L6.62325 0.5H11.5486L11.9068 3.22C12.1009 3.29083 12.2837 3.37583 12.4553 3.475C12.627 3.57417 12.7949 3.68042 12.9591 3.79375L15.6233 2.73125L18.0859 6.76875L15.78 8.42625C15.7949 8.52542 15.8024 8.62104 15.8024 8.71313V9.28687C15.8024 9.37896 15.7874 9.47458 15.7576 9.57375L18.0635 11.2312L15.6009 15.2688L12.9591 14.2063C12.7949 14.3196 12.6233 14.4258 12.4441 14.525C12.265 14.6242 12.0859 14.7092 11.9068 14.78L11.5486 17.5H6.62325ZM9.13071 11.975C9.99639 11.975 10.7352 11.6846 11.3471 11.1038C11.9591 10.5229 12.265 9.82167 12.265 9C12.265 8.17833 11.9591 7.47708 11.3471 6.89625C10.7352 6.31542 9.99639 6.025 9.13071 6.025C8.25012 6.025 7.50758 6.31542 6.9031 6.89625C6.29862 7.47708 5.99639 8.17833 5.99639 9C5.99639 9.82167 6.29862 10.5229 6.9031 11.1038C7.50758 11.6846 8.25012 11.975 9.13071 11.975ZM9.13071 10.275C8.75758 10.275 8.44042 10.151 8.17922 9.90312C7.91803 9.65521 7.78743 9.35417 7.78743 9C7.78743 8.64583 7.91803 8.34479 8.17922 8.09688C8.44042 7.84896 8.75758 7.725 9.13071 7.725C9.50385 7.725 9.82101 7.84896 10.0822 8.09688C10.3434 8.34479 10.474 8.64583 10.474 9C10.474 9.35417 10.3434 9.65521 10.0822 9.90312C9.82101 10.151 9.50385 10.275 9.13071 10.275ZM8.19042 15.8H9.95907L10.2725 13.5475C10.7352 13.4342 11.1643 13.2677 11.5598 13.0481C11.9553 12.8285 12.3173 12.5629 12.6456 12.2513L14.8621 13.1225L15.7352 11.6775L13.8098 10.2963C13.8844 10.0979 13.9367 9.88896 13.9665 9.66938C13.9964 9.44979 14.0113 9.22667 14.0113 9C14.0113 8.77333 13.9964 8.55021 13.9665 8.33063C13.9367 8.11104 13.8844 7.90208 13.8098 7.70375L15.7352 6.3225L14.8621 4.8775L12.6456 5.77C12.3173 5.44417 11.9553 5.17146 11.5598 4.95188C11.1643 4.73229 10.7352 4.56583 10.2725 4.4525L9.98146 2.2H8.2128L7.89937 4.4525C7.43668 4.56583 7.00758 4.73229 6.61206 4.95188C6.21653 5.17146 5.85459 5.43708 5.52624 5.74875L3.30982 4.8775L2.43668 6.3225L4.36206 7.6825C4.28743 7.895 4.23519 8.1075 4.20534 8.32C4.17549 8.5325 4.16056 8.75917 4.16056 9C4.16056 9.22667 4.17549 9.44625 4.20534 9.65875C4.23519 9.87125 4.28743 10.0837 4.36206 10.2963L2.43668 11.6775L3.30982 13.1225L5.52624 12.23C5.85459 12.5558 6.21653 12.8285 6.61206 13.0481C7.00758 13.2677 7.43668 13.4342 7.89937 13.5475L8.19042 15.8Z",
|
|
2469
|
+
fill: "white"
|
|
2470
|
+
}
|
|
2471
|
+
)
|
|
2472
|
+
}
|
|
2473
|
+
);
|
|
2474
|
+
};
|
|
2475
|
+
|
|
2476
|
+
// src/components/icons/XSwapBadgeIcon.tsx
|
|
2477
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
2478
|
+
var XSwapBadgeIcon = () => {
|
|
2479
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
2480
|
+
"svg",
|
|
2481
|
+
{
|
|
2482
|
+
version: "1.2",
|
|
2483
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2484
|
+
viewBox: "0 0 80 27",
|
|
2485
|
+
width: "80",
|
|
2486
|
+
height: "27",
|
|
2487
|
+
children: [
|
|
2488
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("title", { children: "xswap-badge" }),
|
|
2489
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2490
|
+
"image",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VEETMOlKUd4BOZB6qECgi2tYG2tAc0xd0Q37ph2PpM8w/8F5b5vxMZgXxqOY5SmbXxkgn8fxcZgVw/8vEsC6Xvk5dE4L8BBYs8HFbmQE4AAAAASUVORK5CYII="
|
|
2496
|
+
}
|
|
2497
|
+
) }),
|
|
2498
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("style", {}),
|
|
2499
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("use", { id: "Background", href: "#img1iVBORw0KGgoAAAANSUhEUgAAAF", x: "0", y: "1" })
|
|
2500
|
+
]
|
|
2501
|
+
}
|
|
2502
|
+
);
|
|
2503
|
+
};
|
|
2504
|
+
|
|
2505
|
+
// src/components/icons/ChainlinkCCIPIcon.tsx
|
|
2506
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
2507
|
+
var ChainlinkCCIPIcon = () => {
|
|
2508
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
2509
|
+
"svg",
|
|
2510
|
+
{
|
|
2511
|
+
version: "1.2",
|
|
2512
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2513
|
+
viewBox: "0 0 67 27",
|
|
2514
|
+
width: "67",
|
|
2515
|
+
height: "27",
|
|
2516
|
+
children: [
|
|
2517
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("title", { children: "chainlink-CCIP" }),
|
|
2518
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
2519
|
+
"image",
|
|
2520
|
+
{
|
|
2521
|
+
width: "67",
|
|
2522
|
+
height: "27",
|
|
2523
|
+
id: "imgiVBORw0KGgoAAA",
|
|
2524
|
+
href: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEMAAAAbCAYAAAAnFzLpAAAAAXNSR0IB2cksfwAADPtJREFUeJzdWQtUlcUWngNItexilpq6gsrKFLVCEAgFRBBMeYsooGJKlqZi6k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BM8QWnJ6PY4Byo1J3oX7n4ifGkl+s8TFkfMjkzWzFzJP9/dXP+/1rU/0r5Dy2/8Z6sDkzgAAAAAElFTkSuQmCC"
|
|
2525
|
+
}
|
|
2526
|
+
) }),
|
|
2527
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("style", {}),
|
|
2528
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("use", { id: "Background", href: "#imgiVBORw0KGgoAAA", x: "0", y: "0" })
|
|
2529
|
+
]
|
|
2530
|
+
}
|
|
2531
|
+
);
|
|
2532
|
+
};
|
|
2533
|
+
|
|
2534
|
+
// src/components/TxConfigForm/HistoryCard.tsx
|
|
2535
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
2536
|
+
var HistoryCard = ({ transaction, supportedChains }) => {
|
|
2537
|
+
const getDate = (0, import_react2.useCallback)((blockTimestamp) => {
|
|
2538
|
+
const date2 = new Date(blockTimestamp * 1e3);
|
|
2539
|
+
return (0, import_date_fns.format)(date2, "d MMM yyyy HH:mm:ss");
|
|
2540
|
+
}, []);
|
|
2541
|
+
const date = getDate(transaction.timestamp);
|
|
2542
|
+
const supportedTokens = (0, import_react2.useMemo)(() => {
|
|
2543
|
+
const customTokens = JSON.parse(
|
|
2544
|
+
localStorage.getItem("custom-tokens") || "{}"
|
|
2545
|
+
);
|
|
2546
|
+
const chainIdToTokenAddressToData = {};
|
|
2547
|
+
supportedChains.forEach((chain) => {
|
|
2548
|
+
chainIdToTokenAddressToData[chain.chainId] = {};
|
|
2549
|
+
chain.tokens.forEach((token) => {
|
|
2550
|
+
chainIdToTokenAddressToData[chain.chainId][token.address] = token;
|
|
2551
|
+
});
|
|
2552
|
+
});
|
|
2553
|
+
return deepMergeObjects(chainIdToTokenAddressToData, customTokens);
|
|
2554
|
+
}, [supportedChains]);
|
|
2555
|
+
const findTokenDataByAddressAndChain = (0, import_react2.useCallback)(
|
|
2556
|
+
(tokenAddress, chainId) => {
|
|
2557
|
+
return supportedTokens[chainId]?.[tokenAddress];
|
|
1616
2558
|
},
|
|
1617
|
-
|
|
2559
|
+
[supportedTokens]
|
|
1618
2560
|
);
|
|
1619
|
-
|
|
2561
|
+
const tokenData = findTokenDataByAddressAndChain(
|
|
2562
|
+
transaction.tokenAddress.toLowerCase(),
|
|
2563
|
+
transaction.sourceChainId
|
|
2564
|
+
);
|
|
2565
|
+
const tokenOutData = transaction.tokenOutAddress ? findTokenDataByAddressAndChain(
|
|
2566
|
+
transaction.tokenOutAddress?.toLowerCase(),
|
|
2567
|
+
transaction.targetChainId
|
|
2568
|
+
) : void 0;
|
|
2569
|
+
const transferredAmount = weiToHumanReadable({
|
|
2570
|
+
amount: transaction.amountWei,
|
|
2571
|
+
decimals: tokenData?.decimals || 18,
|
|
2572
|
+
precisionFractionalPlaces: 4
|
|
2573
|
+
});
|
|
2574
|
+
const receivedAmount = weiToHumanReadable({
|
|
2575
|
+
amount: transaction?.tokenOutAmount || "0",
|
|
2576
|
+
decimals: tokenOutData?.decimals || 18,
|
|
2577
|
+
precisionFractionalPlaces: 4
|
|
2578
|
+
});
|
|
2579
|
+
const sourceChainData = supportedChains.find(
|
|
2580
|
+
(chain) => chain.chainId === transaction.sourceChainId
|
|
2581
|
+
);
|
|
2582
|
+
const targetChainData = supportedChains.find(
|
|
2583
|
+
(chain) => chain.chainId === transaction.targetChainId
|
|
2584
|
+
);
|
|
2585
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex flex-col border border-solid border-[rgba(255,255,255,0.1)] rounded-xl bg-[rgb(15,15,15)] p-2 gap-4 mb-2", children: [
|
|
2586
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex items-center", children: [
|
|
2587
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "text-[rgba(255,255,255,0.6)] text-xs", children: date }),
|
|
2588
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex flex-grow justify-end items-center", children: [
|
|
2589
|
+
transaction.status === "IN_PROGRESS" && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex items-center", children: [
|
|
2590
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "w-3.5 h-3.5 mr-1 text-[rgb(250,200,100)]", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(HourGlassIcon, {}) }),
|
|
2591
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "text-xs text-[rgb(250,200,100)]", children: "In progress" })
|
|
2592
|
+
] }),
|
|
2593
|
+
transaction.status === "DONE" && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex items-center", children: [
|
|
2594
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "w-3.5 h-3.5 mr-1 text-[rgb(100,200,100)]", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(CheckIcon, {}) }),
|
|
2595
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "text-xs text-[rgb(100,200,100)]", children: "Done" })
|
|
2596
|
+
] }),
|
|
2597
|
+
transaction.status === "REVERTED" && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex items-center", children: [
|
|
2598
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "w-4 h-4 mr-1 text-[rgb(255,100,100)]", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(XMarkIcon, {}) }),
|
|
2599
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "text-xs text-[rgb(255,100,100)]", children: "Reverted" })
|
|
2600
|
+
] }),
|
|
2601
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
2602
|
+
"a",
|
|
2603
|
+
{
|
|
2604
|
+
href: `${supportedChains.find(
|
|
2605
|
+
(chain) => chain.chainId === transaction.sourceChainId
|
|
2606
|
+
)?.transactionExplorer}/${transaction.hash}`,
|
|
2607
|
+
target: "_blank",
|
|
2608
|
+
rel: "noreferrer",
|
|
2609
|
+
className: "ml-2 no-underline",
|
|
2610
|
+
"aria-label": "Show the transaction in the chain explorer",
|
|
2611
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "w-3.5 h-3.5 text-[rgba(255,255,255,0.6)]", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ArrowUpRightIcon, {}) })
|
|
2612
|
+
}
|
|
2613
|
+
)
|
|
2614
|
+
] })
|
|
2615
|
+
] }),
|
|
2616
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex flex-wrap gap-8", children: [
|
|
2617
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex flex-grow items-center", children: [
|
|
2618
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex items-center", children: [
|
|
2619
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
2620
|
+
"img",
|
|
2621
|
+
{
|
|
2622
|
+
src: sourceChainData?.image,
|
|
2623
|
+
alt: `${sourceChainData?.name} logo`,
|
|
2624
|
+
className: "w-5 h-5 mr-1"
|
|
2625
|
+
}
|
|
2626
|
+
),
|
|
2627
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "text-xs text-[rgba(255,255,255,0.6)]", children: sourceChainData?.displayName })
|
|
2628
|
+
] }),
|
|
2629
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "w-3.5 h-3.5 text-[rgba(255,255,255,0.6)] my-0 mx-1.5", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ArrowRightIcon, {}) }),
|
|
2630
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex items-center", children: [
|
|
2631
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
2632
|
+
"img",
|
|
2633
|
+
{
|
|
2634
|
+
src: targetChainData?.image,
|
|
2635
|
+
alt: `${targetChainData?.name} logo`,
|
|
2636
|
+
className: "w-5 h-5 mr-1"
|
|
2637
|
+
}
|
|
2638
|
+
),
|
|
2639
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "text-xs text-[rgba(255,255,255,0.6)]", children: targetChainData?.displayName })
|
|
2640
|
+
] })
|
|
2641
|
+
] }),
|
|
2642
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "flex items-center mb-2 last:mb-0", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex flex-1 items-center flex-wrap text-xs text-[rgba(255,255,255,0.6)]", children: [
|
|
2643
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex items-center", children: [
|
|
2644
|
+
Number(transferredAmount) < 1e-4 ? "<0.0001" : transferredAmount,
|
|
2645
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "text-xs ml-1 text-rgba(255,255,255,0.6)", children: tokenData?.symbol }),
|
|
2646
|
+
tokenData?.image ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
2647
|
+
"img",
|
|
2648
|
+
{
|
|
2649
|
+
src: tokenData?.image,
|
|
2650
|
+
alt: tokenData?.name || "",
|
|
2651
|
+
className: "w-5 h-5 ml-1"
|
|
2652
|
+
}
|
|
2653
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime22.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) })
|
|
2654
|
+
] }),
|
|
2655
|
+
transaction.tokenOutAddress && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_jsx_runtime22.Fragment, { children: [
|
|
2656
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "w-3.5 h-3.5 text-[rgba(255,255,255,0.6)] my-0 mx-1.5", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ArrowRightIcon, {}) }),
|
|
2657
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex items-center", children: [
|
|
2658
|
+
Number(receivedAmount) < 1e-4 ? "<0.0001" : receivedAmount,
|
|
2659
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "text-xs ml-1 text-[rgba(255,255,255,0.6)]", children: tokenOutData?.symbol }),
|
|
2660
|
+
tokenOutData?.image ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
2661
|
+
"img",
|
|
2662
|
+
{
|
|
2663
|
+
src: tokenOutData?.image,
|
|
2664
|
+
alt: tokenOutData?.name || "",
|
|
2665
|
+
className: "w-5 h-5 ml-1"
|
|
2666
|
+
}
|
|
2667
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime22.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) })
|
|
2668
|
+
] })
|
|
2669
|
+
] })
|
|
2670
|
+
] }) })
|
|
2671
|
+
] })
|
|
2672
|
+
] });
|
|
2673
|
+
};
|
|
1620
2674
|
|
|
1621
|
-
// src/
|
|
1622
|
-
var
|
|
1623
|
-
var
|
|
1624
|
-
var
|
|
1625
|
-
|
|
1626
|
-
|
|
2675
|
+
// src/components/TxConfigForm/History.tsx
|
|
2676
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
2677
|
+
var PENDING_TXS_LOCAL_STORAGE_KEY = "pending_transactions";
|
|
2678
|
+
var History = ({ signer, supportedChains }) => {
|
|
2679
|
+
const [mappedHistory, setMappedHistory] = (0, import_react3.useState)();
|
|
2680
|
+
const [historyLoadedOnce, setHistoryLoadedOnce] = (0, import_react3.useState)(false);
|
|
2681
|
+
const getLocalHistory = () => {
|
|
2682
|
+
return JSON.parse(
|
|
2683
|
+
localStorage.getItem(PENDING_TXS_LOCAL_STORAGE_KEY) || "{}"
|
|
2684
|
+
);
|
|
2685
|
+
};
|
|
2686
|
+
const setLocalHistory = (data) => {
|
|
2687
|
+
localStorage.setItem(PENDING_TXS_LOCAL_STORAGE_KEY, JSON.stringify(data));
|
|
2688
|
+
};
|
|
2689
|
+
const fetchHistory = (0, import_react3.useCallback)(async () => {
|
|
2690
|
+
const downloadedHistory = await getHistory({ walletAddress: signer });
|
|
2691
|
+
const fetchedTransactions = [];
|
|
2692
|
+
if (downloadedHistory) {
|
|
2693
|
+
for (const entry of downloadedHistory.history) {
|
|
2694
|
+
if (!entry.source) {
|
|
2695
|
+
continue;
|
|
2696
|
+
}
|
|
2697
|
+
let status;
|
|
2698
|
+
if (entry.failed)
|
|
2699
|
+
status = "REVERTED";
|
|
2700
|
+
if (!!entry.target) {
|
|
2701
|
+
status = "DONE";
|
|
2702
|
+
} else {
|
|
2703
|
+
status = "IN_PROGRESS";
|
|
2704
|
+
}
|
|
2705
|
+
const blockTimestampMs = new Date(entry.source.blockTime).getTime();
|
|
2706
|
+
const estimatedDeliveryTimestamp = new import_bignumber2.default(
|
|
2707
|
+
entry.source.valueForInstantCcipRecieve
|
|
2708
|
+
).gt(0) ? blockTimestampMs + EXPRESS_DELIVERY_TIME : blockTimestampMs + DELIVERY_TIME;
|
|
2709
|
+
fetchedTransactions.push({
|
|
2710
|
+
hash: entry.source.transactionHash,
|
|
2711
|
+
timestamp: blockTimestampMs / 1e3,
|
|
2712
|
+
sourceChainId: entry.source.blockchainId,
|
|
2713
|
+
targetChainId: entry.source.targetBlockchainId,
|
|
2714
|
+
amountWei: entry.source.tokenAmount,
|
|
2715
|
+
tokenAddress: entry.source.tokenAddress,
|
|
2716
|
+
tokenOutAddress: entry.target?.tokenAddress || entry.source.tokenOutAddress,
|
|
2717
|
+
tokenOutAmount: entry.target?.tokenAmount || entry.source.estimatedAmountOut,
|
|
2718
|
+
estimatedDeliveryTimestamp,
|
|
2719
|
+
status
|
|
2720
|
+
});
|
|
2721
|
+
}
|
|
2722
|
+
const txHashToTxFromAPI = {};
|
|
2723
|
+
for (const transaction of fetchedTransactions) {
|
|
2724
|
+
txHashToTxFromAPI[transaction.hash] = transaction;
|
|
2725
|
+
}
|
|
2726
|
+
const localHistory = getLocalHistory();
|
|
2727
|
+
const newLocalHistory = {};
|
|
2728
|
+
for (const [walletAddress, transactions] of Object.entries(
|
|
2729
|
+
localHistory
|
|
2730
|
+
)) {
|
|
2731
|
+
if (walletAddress.toLowerCase() !== signer.toLowerCase()) {
|
|
2732
|
+
continue;
|
|
2733
|
+
}
|
|
2734
|
+
const newLocalHistoryForWallet = [];
|
|
2735
|
+
for (const transaction of transactions) {
|
|
2736
|
+
if (!txHashToTxFromAPI[transaction.hash]) {
|
|
2737
|
+
fetchedTransactions.push(transaction);
|
|
2738
|
+
newLocalHistoryForWallet.push(transaction);
|
|
2739
|
+
continue;
|
|
2740
|
+
}
|
|
2741
|
+
if (txHashToTxFromAPI[transaction.hash] && transaction.status === "DONE" && txHashToTxFromAPI[transaction.hash]?.status === "IN_PROGRESS") {
|
|
2742
|
+
txHashToTxFromAPI[transaction.hash].status = "DONE";
|
|
2743
|
+
}
|
|
2744
|
+
if (txHashToTxFromAPI[transaction.hash]?.status === "DONE" || txHashToTxFromAPI[transaction.hash]?.status === "REVERTED") {
|
|
2745
|
+
continue;
|
|
2746
|
+
}
|
|
2747
|
+
}
|
|
2748
|
+
newLocalHistory[walletAddress.toLowerCase()] = newLocalHistoryForWallet;
|
|
2749
|
+
}
|
|
2750
|
+
setLocalHistory(newLocalHistory);
|
|
2751
|
+
setMappedHistory(
|
|
2752
|
+
fetchedTransactions.sort((a, b) => b.timestamp - a.timestamp)
|
|
2753
|
+
);
|
|
2754
|
+
setHistoryLoadedOnce(true);
|
|
2755
|
+
}
|
|
2756
|
+
}, [signer, getHistory]);
|
|
2757
|
+
(0, import_react3.useEffect)(() => {
|
|
2758
|
+
if (!historyLoadedOnce)
|
|
2759
|
+
fetchHistory();
|
|
2760
|
+
const timer = setInterval(() => {
|
|
2761
|
+
fetchHistory();
|
|
2762
|
+
}, 6e4);
|
|
2763
|
+
return () => clearInterval(timer);
|
|
2764
|
+
}, [signer, fetchHistory, getHistory, historyLoadedOnce]);
|
|
2765
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "flex items-center justify-center w-full", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "w-full h-[50vh] overflow-scroll overflow-x-hidden", children: [
|
|
2766
|
+
mappedHistory?.length === 0 && historyLoadedOnce && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "w-full text-center py-4 px-0 text-[rgb(158,158,158)]", children: "Your history is empty..." }),
|
|
2767
|
+
!mappedHistory && !historyLoadedOnce && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "flex w-full h-full items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(CircularProgressIcon, {}) }),
|
|
2768
|
+
mappedHistory?.map((transaction, index) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
2769
|
+
HistoryCard,
|
|
2770
|
+
{
|
|
2771
|
+
transaction,
|
|
2772
|
+
supportedChains
|
|
2773
|
+
},
|
|
2774
|
+
index
|
|
2775
|
+
))
|
|
2776
|
+
] }) });
|
|
1627
2777
|
};
|
|
1628
2778
|
|
|
1629
|
-
// src/
|
|
1630
|
-
var
|
|
1631
|
-
var
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
2779
|
+
// src/components/TxConfigForm/TopBar.tsx
|
|
2780
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
2781
|
+
var TopBar = ({
|
|
2782
|
+
signer,
|
|
2783
|
+
setSettingsShown,
|
|
2784
|
+
setHistoryTabShown,
|
|
2785
|
+
historyTabShown
|
|
2786
|
+
}) => {
|
|
2787
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex w-full justify-between mx-auto pl-4 pr-8 pt-2", children: [
|
|
2788
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "rounded-lg text-[rgba(255,255,255,0.6)] text-base whitespace-nowrap", children: signer ? `Connected wallet: ${shortAddress(signer)}` : `Disconnected` }),
|
|
2789
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex gap-2", children: [
|
|
2790
|
+
!historyTabShown && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2791
|
+
"div",
|
|
2792
|
+
{
|
|
2793
|
+
onClick: () => setSettingsShown(true),
|
|
2794
|
+
className: "flex items-center text-xs gap-1 cursor-pointer",
|
|
2795
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.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_runtime24.jsx)(SettingsIcon, {}) })
|
|
2796
|
+
}
|
|
2797
|
+
),
|
|
2798
|
+
signer && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2799
|
+
"div",
|
|
2800
|
+
{
|
|
2801
|
+
onClick: () => setHistoryTabShown((x) => !x),
|
|
2802
|
+
className: "flex items-center text-sm gap-1 cursor-pointer",
|
|
2803
|
+
children: !historyTabShown ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_jsx_runtime24.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime24.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_runtime24.jsx)(HistoryIcon, {}) }) }) : /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { children: "Back" })
|
|
2804
|
+
}
|
|
2805
|
+
)
|
|
2806
|
+
] })
|
|
2807
|
+
] });
|
|
2808
|
+
};
|
|
2809
|
+
|
|
2810
|
+
// src/components/TxConfigForm/Settings.tsx
|
|
2811
|
+
var import_react4 = require("react");
|
|
2812
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
2813
|
+
var Settings = ({
|
|
2814
|
+
setSlippage,
|
|
2815
|
+
setSettingsShown,
|
|
2816
|
+
slippage,
|
|
2817
|
+
expressChecked,
|
|
2818
|
+
setExpressChecked
|
|
2819
|
+
}) => {
|
|
2820
|
+
const [slippageActivePresetIndex, setSlippageActivePresetIndex] = (0, import_react4.useState)(1);
|
|
2821
|
+
const [usingSlippageInput, setUsingSlippageInput] = (0, import_react4.useState)(false);
|
|
2822
|
+
(0, import_react4.useEffect)(() => {
|
|
2823
|
+
if (!usingSlippageInput) {
|
|
2824
|
+
setSlippage(
|
|
2825
|
+
SLIPPAGE_PRESETS[slippageActivePresetIndex]?.toString() || "1.5"
|
|
2826
|
+
);
|
|
2827
|
+
}
|
|
2828
|
+
}, [slippageActivePresetIndex, usingSlippageInput]);
|
|
2829
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.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_runtime25.jsxs)("div", { className: "flex flex-col gap-4 justify-between", children: [
|
|
2830
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex justify-between", children: [
|
|
2831
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "text-base", children: "Settings" }),
|
|
2832
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2833
|
+
"div",
|
|
2834
|
+
{
|
|
2835
|
+
className: "cursor-pointer",
|
|
2836
|
+
onClick: () => setSettingsShown(false),
|
|
2837
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(CloseIcon, {})
|
|
2838
|
+
}
|
|
2839
|
+
)
|
|
2840
|
+
] }),
|
|
2841
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { children: [
|
|
2842
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex gap-2 items-center", children: [
|
|
2843
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "text-sm text-[rgba(255,255,255,0.6)]", children: "Express delivery" }),
|
|
2844
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
2845
|
+
"span",
|
|
2846
|
+
{
|
|
2847
|
+
className: "inline-flex w-14 h-9 p-3 relative align-middle box-border overflow-hidden cursor-pointer",
|
|
2848
|
+
onClick: () => {
|
|
2849
|
+
setExpressChecked((x) => !x);
|
|
2850
|
+
},
|
|
2851
|
+
children: [
|
|
2852
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "h-full, w-full rounded-lg bg-[rgba(255,255,255,0.3)]" }),
|
|
2853
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2854
|
+
"span",
|
|
2855
|
+
{
|
|
2856
|
+
className: `transition-all w-5 h-5 rounded-full absolute translate-y-[-4px]
|
|
2857
|
+
${expressChecked ? "translate-x-[12px] bg-x_blue" : "bg-white"} `
|
|
2858
|
+
}
|
|
2859
|
+
)
|
|
2860
|
+
]
|
|
2861
|
+
}
|
|
2862
|
+
) })
|
|
2863
|
+
] }),
|
|
2864
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex gap-4", children: [
|
|
2865
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "min-w-[26px] min-h-[26px] text-[#ffa726]", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(InfoIcon, {}) }),
|
|
2866
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.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." })
|
|
2867
|
+
] })
|
|
2868
|
+
] }),
|
|
2869
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex flex-col gap-2 ", children: [
|
|
2870
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: " text-[rgba(255,255,255,0.6)] text-sm", children: "Slippage" }),
|
|
2871
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex gap-2", children: [
|
|
2872
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "flex items-center bg-[rgba(15,15,15,1)] p-1 globalBorder rounded-xl", children: SLIPPAGE_PRESETS.map((preset, index) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2873
|
+
"div",
|
|
2874
|
+
{
|
|
2875
|
+
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]" : ""}`,
|
|
2876
|
+
onClick: () => {
|
|
2877
|
+
setUsingSlippageInput(false);
|
|
2878
|
+
setSlippageActivePresetIndex(index);
|
|
2879
|
+
},
|
|
2880
|
+
children: `${preset.toFixed(1)}%`
|
|
2881
|
+
},
|
|
2882
|
+
index
|
|
2883
|
+
)) }),
|
|
2884
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.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: [
|
|
2885
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2886
|
+
"input",
|
|
2887
|
+
{
|
|
2888
|
+
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",
|
|
2889
|
+
placeholder: "1.5",
|
|
2890
|
+
value: usingSlippageInput ? slippage : "",
|
|
2891
|
+
onChange: (e) => {
|
|
2892
|
+
if (e.target.value.length > 0) {
|
|
2893
|
+
if (NUMBER_INPUT_REGEX.test(e.target.value)) {
|
|
2894
|
+
setUsingSlippageInput(true);
|
|
2895
|
+
setSlippage(e.target.value.replace(/,/g, "."));
|
|
2896
|
+
}
|
|
2897
|
+
} else {
|
|
2898
|
+
setUsingSlippageInput(false);
|
|
2899
|
+
setSlippageActivePresetIndex(1);
|
|
2900
|
+
}
|
|
2901
|
+
}
|
|
2902
|
+
}
|
|
2903
|
+
),
|
|
2904
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(PercentageIcon, {})
|
|
2905
|
+
] })
|
|
2906
|
+
] }),
|
|
2907
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex gap-4", children: [
|
|
2908
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "min-w-[26px] min-h-[26px] text-[#ffa726]", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(InfoIcon, {}) }),
|
|
2909
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "text-xs text-left", children: [
|
|
2910
|
+
"Slippage is the price variation you are willing to accept in the event that the price of the trade changes while it is processing.",
|
|
2911
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("br", {}),
|
|
2912
|
+
" ",
|
|
2913
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("br", {}),
|
|
2914
|
+
"If the trade fails due to too-low slippage, you will receive USDC on the destination chain."
|
|
2915
|
+
] })
|
|
2916
|
+
] })
|
|
2917
|
+
] })
|
|
2918
|
+
] }) });
|
|
2919
|
+
};
|
|
2920
|
+
|
|
2921
|
+
// src/components/TxConfigForm/FeesDetails.tsx
|
|
2922
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
2923
|
+
var FeesDetails = ({
|
|
2924
|
+
isGettingRoute,
|
|
2925
|
+
route,
|
|
2926
|
+
paymentToken,
|
|
2927
|
+
dstToken,
|
|
2928
|
+
expressChecked,
|
|
2929
|
+
slippage,
|
|
2930
|
+
feesDetailsShown,
|
|
2931
|
+
setFeesDetailsShown
|
|
2932
|
+
}) => {
|
|
2933
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex flex-col gap-3 globalBorder rounded-lg bg-[rgba(15,15,15,1)] p-4 mb-1", children: [
|
|
2934
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex w-full items-center justify-between", children: [
|
|
2935
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex items-center gap-1 text-sm font-medium text-white opacity-60", children: [
|
|
2936
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(CoinsIcon, {}),
|
|
2937
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "mr-1", children: "Fees:" }),
|
|
2938
|
+
isGettingRoute ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "bg-current rounded animate-pulse w-20 h-4" }) : ` ${weiToHumanReadable({
|
|
2939
|
+
amount: safeBigNumberFrom(
|
|
2940
|
+
route?.xSwapFees.xSwapFee.nativeFee || "0"
|
|
2941
|
+
).add(safeBigNumberFrom(route?.xSwapFees.ccipFee || "0")).add(
|
|
2942
|
+
safeBigNumberFrom(route?.xSwapFees.expressDeliveryFee || "0")
|
|
2943
|
+
).toString(),
|
|
2944
|
+
decimals: 18,
|
|
2945
|
+
precisionFractionalPlaces: 5
|
|
2946
|
+
})} ${paymentToken?.symbol}`
|
|
2947
|
+
] }),
|
|
2948
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex gap-1", children: [
|
|
2949
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
2950
|
+
"div",
|
|
2951
|
+
{
|
|
2952
|
+
className: `flex gap-1 text-xs font-medium ${expressChecked ? "text-x_green" : "text-white opacity-60"}`,
|
|
2953
|
+
children: [
|
|
2954
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(TimerIcon, {}),
|
|
2955
|
+
expressChecked ? "Fast ~ 30sec " : "Normal ~ 30min"
|
|
2956
|
+
]
|
|
2957
|
+
}
|
|
2958
|
+
),
|
|
2959
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
2960
|
+
"div",
|
|
2961
|
+
{
|
|
2962
|
+
onClick: () => setFeesDetailsShown((x) => !x),
|
|
2963
|
+
className: "text-xs font-medium text-white opacity-60 cursor-pointer flex items-center",
|
|
2964
|
+
children: feesDetailsShown ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ChevronUpIcon, {}) : /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ChevronDownIcon, {})
|
|
2965
|
+
}
|
|
2966
|
+
)
|
|
2967
|
+
] })
|
|
2968
|
+
] }),
|
|
2969
|
+
feesDetailsShown && /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex w-full items-center justify-between ", children: [
|
|
2970
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex flex-col text-[10px] gap-1", children: [
|
|
2971
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "font-medium text-white opacity-60", children: [
|
|
2972
|
+
"CCIP Fee:",
|
|
2973
|
+
` ${weiToHumanReadable({
|
|
2974
|
+
amount: route?.xSwapFees.ccipFee || "0",
|
|
2975
|
+
decimals: 18,
|
|
2976
|
+
precisionFractionalPlaces: 5
|
|
2977
|
+
})} ${paymentToken?.symbol}`
|
|
2978
|
+
] }),
|
|
2979
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "font-medium text-white opacity-60", children: [
|
|
2980
|
+
"Native Fee:",
|
|
2981
|
+
` ${weiToHumanReadable({
|
|
2982
|
+
amount: route?.xSwapFees.xSwapFee.nativeFee || "0",
|
|
2983
|
+
decimals: 18,
|
|
2984
|
+
precisionFractionalPlaces: 5
|
|
2985
|
+
})} ${paymentToken?.symbol}`
|
|
2986
|
+
] })
|
|
2987
|
+
] }),
|
|
2988
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex flex-col text-[10px] gap-1", children: [
|
|
2989
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "font-medium text-white opacity-60", children: [
|
|
2990
|
+
"Slippage: ",
|
|
2991
|
+
`${slippage}%`
|
|
2992
|
+
] }),
|
|
2993
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "font-medium text-white opacity-60", children: [
|
|
2994
|
+
"Min amount out:",
|
|
2995
|
+
" ",
|
|
2996
|
+
weiToHumanReadable({
|
|
2997
|
+
amount: route?.minAmountOut || "0",
|
|
2998
|
+
decimals: dstToken?.decimals || 18,
|
|
2999
|
+
precisionFractionalPlaces: 5
|
|
3000
|
+
}),
|
|
3001
|
+
" ",
|
|
3002
|
+
dstToken?.symbol
|
|
3003
|
+
] })
|
|
3004
|
+
] })
|
|
3005
|
+
] })
|
|
3006
|
+
] });
|
|
3007
|
+
};
|
|
3008
|
+
|
|
3009
|
+
// src/components/TxConfigForm/Summary.tsx
|
|
3010
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
3011
|
+
var Summary = ({
|
|
3012
|
+
isGettingRoute,
|
|
3013
|
+
amount,
|
|
3014
|
+
route,
|
|
3015
|
+
dstToken,
|
|
3016
|
+
dstChain
|
|
3017
|
+
}) => {
|
|
3018
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex justify-between globalBorder rounded-lg bg-[rgba(15,15,15,1)] p-4 relative", children: [
|
|
3019
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex flex-col gap-2", children: [
|
|
3020
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("p", { className: "text-[rgba(255,255,255,0.6)] text-sm", children: "You receive" }),
|
|
3021
|
+
isGettingRoute && amount.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "bg-current rounded animate-pulse w-[190px] h-7" }) : /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex gap-2 items-center text-white text-2xl", children: [
|
|
3022
|
+
weiToHumanReadable({
|
|
3023
|
+
amount: route?.estAmountOut || "0",
|
|
3024
|
+
decimals: dstToken?.decimals || 18,
|
|
3025
|
+
precisionFractionalPlaces: 5
|
|
3026
|
+
}),
|
|
3027
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "w-6 h-6", children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("img", { src: dstToken?.image, alt: dstToken?.name }) }),
|
|
3028
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("p", { children: dstToken?.symbol })
|
|
3029
|
+
] })
|
|
3030
|
+
] }),
|
|
3031
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex flex-col gap-1 text-sm", children: [
|
|
3032
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("p", { className: "text-[rgba(255,255,255,0.6)] text-right", children: "on chain:" }),
|
|
3033
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex gap-1 text-white", children: [
|
|
3034
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "w-4 h-4", children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("img", { src: dstChain?.image, alt: dstChain?.name }) }),
|
|
3035
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { children: dstChain?.displayName })
|
|
3036
|
+
] })
|
|
3037
|
+
] }),
|
|
3038
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "absolute right-[50%] top-0 translate-x-1/2 translate-y-[-60%] globalBorder rounded-xl p-[5px] bg-[rgba(15,15,15,1)]", children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: " flex items-center justify-center rounded-lg w-8 h-8 bg-gradient-to-l from-[rgba(54,129,198,1)] to-[rgba(43,74,157,1)] ", children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ArrowDownIcon, {}) }) })
|
|
3039
|
+
] });
|
|
3040
|
+
};
|
|
3041
|
+
|
|
3042
|
+
// src/components/TxConfigForm/SwapPanel.tsx
|
|
3043
|
+
var import_react7 = require("react");
|
|
3044
|
+
|
|
3045
|
+
// src/components/TxConfigForm/TokenPicker.tsx
|
|
3046
|
+
var import_react5 = require("react");
|
|
3047
|
+
var import_react_dom = require("react-dom");
|
|
3048
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
3049
|
+
var TokenPicker = ({
|
|
3050
|
+
onCloseClick,
|
|
3051
|
+
tokens,
|
|
3052
|
+
selectedToken,
|
|
3053
|
+
setSelectedToken,
|
|
3054
|
+
signer,
|
|
3055
|
+
balances
|
|
3056
|
+
}) => {
|
|
3057
|
+
const [searchValue, setSearchValue] = (0, import_react5.useState)("");
|
|
3058
|
+
const modalRoot = document.querySelector(".xswap");
|
|
3059
|
+
const onBackdropClick = (e) => {
|
|
3060
|
+
e.stopPropagation();
|
|
3061
|
+
e.nativeEvent.stopImmediatePropagation();
|
|
3062
|
+
if (e.target === e.currentTarget) {
|
|
3063
|
+
onCloseClick();
|
|
3064
|
+
}
|
|
3065
|
+
};
|
|
3066
|
+
const filteredTokens = (0, import_react5.useMemo)(() => {
|
|
3067
|
+
const isMatch = (value, searchValue2) => value.toLowerCase().indexOf(searchValue2.toLowerCase()) > -1;
|
|
3068
|
+
return tokens?.filter(
|
|
3069
|
+
(token) => isMatch(token.symbol, searchValue) || isMatch(token.name, searchValue) || token.address === searchValue.toLowerCase()
|
|
3070
|
+
);
|
|
3071
|
+
}, [searchValue, tokens]);
|
|
3072
|
+
return modalRoot ? (0, import_react_dom.createPortal)(
|
|
3073
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
3074
|
+
"div",
|
|
3075
|
+
{
|
|
3076
|
+
onClick: onBackdropClick,
|
|
3077
|
+
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",
|
|
3078
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "relative bg-black rounded-3xl p-6 max-h-[70%] flex flex-col text-base text-white w-[452px] h-[70%] border border-solid border-[rgba(255,255,255,0.2)]", children: [
|
|
3079
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
3080
|
+
"div",
|
|
3081
|
+
{
|
|
3082
|
+
onClick: onCloseClick,
|
|
3083
|
+
className: "absolute top-4 right-4 cursor-pointer",
|
|
3084
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(CloseIcon, {})
|
|
3085
|
+
}
|
|
3086
|
+
),
|
|
3087
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("p", { className: "text-base mb-4", children: "Pick a token" }),
|
|
3088
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex items-center border border-solid border-[rgba(255,255,255,0.1)] rounded-lg py-0 px-3 gap-2 bg-[rgba(15,15,15,1)]", children: [
|
|
3089
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "w-6 h-6", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(SearchIcon, {}) }),
|
|
3090
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
3091
|
+
"input",
|
|
3092
|
+
{
|
|
3093
|
+
placeholder: "Search name or paste address",
|
|
3094
|
+
value: searchValue,
|
|
3095
|
+
onChange: (e) => setSearchValue(e.target.value),
|
|
3096
|
+
className: "relative h-[41px] leading-[41px] font-normal z-[1] w-full text-white bg-transparent border-none outline-none placeholder:text-sm"
|
|
3097
|
+
}
|
|
3098
|
+
)
|
|
3099
|
+
] }),
|
|
3100
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "my-4 mx-0 flex flex-wrap gap-3", children: tokens?.filter((token) => token?.quickPick).map((token) => /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
3101
|
+
"div",
|
|
3102
|
+
{
|
|
3103
|
+
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)]" : ""}`,
|
|
3104
|
+
onClick: () => {
|
|
3105
|
+
setSelectedToken(token);
|
|
3106
|
+
onCloseClick();
|
|
3107
|
+
},
|
|
3108
|
+
children: [
|
|
3109
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("img", { src: token.image, alt: token.name, className: "w-5" }),
|
|
3110
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "text-sm", children: token.symbol })
|
|
3111
|
+
]
|
|
3112
|
+
},
|
|
3113
|
+
token.address
|
|
3114
|
+
)) }),
|
|
3115
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "h-[2px] my-0 mx-[-24px] w-[100%+48px] px-12 bg-[rgba(255,255,255,0.1)]" }),
|
|
3116
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "overflow-y-scroll h-full mx-[-24px] w-[100%+48px] flex flex-col", children: filteredTokens && filteredTokens.length > 0 ? filteredTokens.sort(
|
|
3117
|
+
(a, b) => balances && balances[a.address] && balances[b.address] && balances[a.address]?.lte(balances[b.address] || "0") ? 1 : -1
|
|
3118
|
+
).map((token, index) => /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
3119
|
+
"div",
|
|
3120
|
+
{
|
|
3121
|
+
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)]" : ""}`,
|
|
3122
|
+
onClick: () => {
|
|
3123
|
+
setSelectedToken(token);
|
|
3124
|
+
onCloseClick();
|
|
3125
|
+
},
|
|
3126
|
+
children: [
|
|
3127
|
+
token.image ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
3128
|
+
"img",
|
|
3129
|
+
{
|
|
3130
|
+
src: token.image,
|
|
3131
|
+
alt: token.name,
|
|
3132
|
+
className: "token-picker__all__logo"
|
|
3133
|
+
}
|
|
3134
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime28.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) }),
|
|
3135
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex justify-between items-center gap-1 overflow-hidden grow", children: [
|
|
3136
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex flex-col leading-[16px]", children: [
|
|
3137
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "overflow-hidden whitespace-nowrap text-ellipsis text-[15px]", children: token.name }),
|
|
3138
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "text-[#888] text-[11px]", children: token.symbol })
|
|
3139
|
+
] }),
|
|
3140
|
+
signer && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_jsx_runtime28.Fragment, { children: balances && balances[token.address] && token.decimals ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "text-xs", children: weiToHumanReadable({
|
|
3141
|
+
amount: balances[token.address]?.toString() || "0",
|
|
3142
|
+
decimals: token.decimals,
|
|
3143
|
+
precisionFractionalPlaces: 4
|
|
3144
|
+
}) }) : /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Skeleton, { w: "w-12", h: "h-3" }) })
|
|
3145
|
+
] })
|
|
3146
|
+
]
|
|
3147
|
+
},
|
|
3148
|
+
`${index}_${token.address}`
|
|
3149
|
+
)) : /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "mt-4 flex justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("p", { className: "text-sm text-white", children: "No tokens found." }) }) })
|
|
3150
|
+
] })
|
|
3151
|
+
}
|
|
3152
|
+
),
|
|
3153
|
+
modalRoot
|
|
3154
|
+
) : null;
|
|
3155
|
+
};
|
|
3156
|
+
|
|
3157
|
+
// src/components/TxConfigForm/ChainListElement.tsx
|
|
3158
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
3159
|
+
var ChainListElement = ({
|
|
3160
|
+
chain,
|
|
3161
|
+
setSrcChain,
|
|
3162
|
+
setChainListShown,
|
|
3163
|
+
index,
|
|
3164
|
+
length
|
|
3165
|
+
}) => {
|
|
3166
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { children: [
|
|
3167
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
|
|
3168
|
+
"li",
|
|
3169
|
+
{
|
|
3170
|
+
className: "bg-transparent border-none flex gap-1 items-center cursor-pointer py-2 w-full",
|
|
3171
|
+
onClick: () => {
|
|
3172
|
+
setSrcChain(chain);
|
|
3173
|
+
setChainListShown(false);
|
|
3174
|
+
},
|
|
3175
|
+
children: [
|
|
3176
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("img", { width: 12, height: 12, src: chain.image, alt: chain.displayName }),
|
|
3177
|
+
chain.displayName
|
|
3178
|
+
]
|
|
3179
|
+
}
|
|
3180
|
+
),
|
|
3181
|
+
index !== length - 1 && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "h-px mx-2 bg-[rgba(255,255,255,0.15)]" })
|
|
3182
|
+
] }, `${chain.ecosystem}-${chain.chainId}`);
|
|
3183
|
+
};
|
|
3184
|
+
|
|
3185
|
+
// src/components/TxConfigForm/BalanceComponent.tsx
|
|
3186
|
+
var import_react6 = require("react");
|
|
3187
|
+
var import_bignumber3 = __toESM(require("bignumber.js"));
|
|
3188
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
3189
|
+
var BalanceComponent = ({ srcToken, balances }) => {
|
|
3190
|
+
const balanceText = (0, import_react6.useMemo)(() => {
|
|
3191
|
+
if (!balances || !srcToken)
|
|
3192
|
+
return "0";
|
|
3193
|
+
if (balances[srcToken.address]?.toString() === "0")
|
|
3194
|
+
return "0";
|
|
3195
|
+
const fullHumanReadable = weiToHumanReadable({
|
|
3196
|
+
amount: balances[srcToken.address]?.toString() || "0",
|
|
3197
|
+
decimals: srcToken.decimals,
|
|
3198
|
+
precisionFractionalPlaces: srcToken.decimals
|
|
3199
|
+
});
|
|
3200
|
+
if (new import_bignumber3.default(fullHumanReadable).lt(
|
|
3201
|
+
MINIMUM_DISPLAYED_TOKEN_AMOUNT.toString()
|
|
3202
|
+
))
|
|
3203
|
+
return `<${MINIMUM_DISPLAYED_TOKEN_AMOUNT}`;
|
|
3204
|
+
return weiToHumanReadable({
|
|
3205
|
+
amount: balances[srcToken.address]?.toString() || "0",
|
|
3206
|
+
decimals: srcToken.decimals,
|
|
3207
|
+
precisionFractionalPlaces: 5
|
|
3208
|
+
});
|
|
3209
|
+
}, [srcToken, balances]);
|
|
3210
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_jsx_runtime30.Fragment, { children: [
|
|
3211
|
+
"Balance:",
|
|
3212
|
+
" ",
|
|
3213
|
+
srcToken && balances ? weiToHumanReadable({
|
|
3214
|
+
amount: balances[srcToken.address]?.toString() || "0",
|
|
3215
|
+
decimals: srcToken.decimals,
|
|
3216
|
+
precisionFractionalPlaces: 4
|
|
3217
|
+
}) : 0,
|
|
3218
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: "bg-gradient-to-r from-x_blue_light to-x_blue_dark bg-clip-text text-transparent", children: "Max" })
|
|
3219
|
+
] });
|
|
3220
|
+
};
|
|
3221
|
+
|
|
3222
|
+
// src/components/TxConfigForm/SwapPanel.tsx
|
|
3223
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
3224
|
+
var SwapPanel = ({
|
|
3225
|
+
amount,
|
|
3226
|
+
setAmount,
|
|
3227
|
+
srcToken,
|
|
3228
|
+
setSrcToken,
|
|
3229
|
+
srcChain,
|
|
3230
|
+
setSrcChain,
|
|
3231
|
+
signer,
|
|
3232
|
+
balances,
|
|
3233
|
+
prices,
|
|
3234
|
+
supportedChains
|
|
3235
|
+
}) => {
|
|
3236
|
+
const [chainListShown, setChainListShown] = (0, import_react7.useState)(false);
|
|
3237
|
+
const [tokenListShown, setTokenListShown] = (0, import_react7.useState)(false);
|
|
3238
|
+
const listRef = (0, import_react7.useRef)(null);
|
|
3239
|
+
const buttonRef = (0, import_react7.useRef)(null);
|
|
3240
|
+
const handleClickOutside = (event) => {
|
|
3241
|
+
if (listRef.current && buttonRef.current) {
|
|
3242
|
+
const listElement = listRef.current;
|
|
3243
|
+
const buttonElement = buttonRef.current;
|
|
3244
|
+
if (!listElement.contains(event.target) && !buttonElement.contains(event.target))
|
|
3245
|
+
setChainListShown(false);
|
|
3246
|
+
}
|
|
3247
|
+
};
|
|
3248
|
+
const handleMaxClick = () => {
|
|
3249
|
+
if (balances && srcToken && balances[srcToken.address] && balances[srcToken.address]?.toString() !== "0")
|
|
3250
|
+
setAmount(
|
|
3251
|
+
weiToHumanReadable({
|
|
3252
|
+
amount: balances[srcToken.address]?.toString() || "0",
|
|
3253
|
+
decimals: srcToken.decimals,
|
|
3254
|
+
precisionFractionalPlaces: 4
|
|
3255
|
+
})
|
|
3256
|
+
);
|
|
3257
|
+
};
|
|
3258
|
+
(0, import_react7.useEffect)(() => {
|
|
3259
|
+
if (chainListShown) {
|
|
3260
|
+
document.addEventListener("mousedown", handleClickOutside);
|
|
3261
|
+
return () => document.removeEventListener("mousedown", handleClickOutside);
|
|
3262
|
+
}
|
|
3263
|
+
}, [chainListShown]);
|
|
3264
|
+
const chainListOptions = (0, import_react7.useMemo)(
|
|
3265
|
+
() => supportedChains.filter((chain) => chain.chainId !== srcChain?.chainId),
|
|
3266
|
+
[supportedChains, srcChain]
|
|
3267
|
+
);
|
|
3268
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex flex-col items-start globalBorder rounded-lg bg-[rgba(15,15,15,1)] p-4", children: [
|
|
3269
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "w-full flex gap-4 items-start justify-between mb-4", children: [
|
|
3270
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex flex-col gap-2 overflow-hidden w-1/2", children: [
|
|
3271
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("p", { className: "text-white opacity-60 text-sm font-medium", children: "You pay" }),
|
|
3272
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
3273
|
+
"input",
|
|
3274
|
+
{
|
|
3275
|
+
className: "p-0 border-none outline-none bg-transparent text-2xl overflow-ellipsis",
|
|
3276
|
+
value: amount,
|
|
3277
|
+
onChange: (e) => {
|
|
3278
|
+
if (e.target.value === ".")
|
|
3279
|
+
return;
|
|
3280
|
+
if (NUMBER_INPUT_REGEX.test(e.target.value)) {
|
|
3281
|
+
setAmount(e.target.value.replace(/,/g, "."));
|
|
3282
|
+
}
|
|
3283
|
+
},
|
|
3284
|
+
inputMode: "decimal",
|
|
3285
|
+
spellCheck: "false",
|
|
3286
|
+
autoComplete: "off",
|
|
3287
|
+
autoCorrect: "off",
|
|
3288
|
+
placeholder: "0"
|
|
3289
|
+
}
|
|
3290
|
+
)
|
|
3291
|
+
] }),
|
|
3292
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex flex-col relative items-end gap-2.5 w-1/2 text-xs", children: [
|
|
3293
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
|
|
3294
|
+
"div",
|
|
3295
|
+
{
|
|
3296
|
+
ref: buttonRef,
|
|
3297
|
+
className: "bg-black globalBorder rounded-2xl whitespace-nowrap flex items-center p-2 cursor-pointer gap-2",
|
|
3298
|
+
onClick: () => setChainListShown((prev) => !prev),
|
|
3299
|
+
children: [
|
|
3300
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
3301
|
+
"img",
|
|
3302
|
+
{
|
|
3303
|
+
width: "16",
|
|
3304
|
+
height: "16",
|
|
3305
|
+
src: srcChain?.image,
|
|
3306
|
+
alt: srcChain?.name
|
|
3307
|
+
}
|
|
3308
|
+
),
|
|
3309
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { children: srcChain?.displayName }),
|
|
3310
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(DownArrowIcon, {})
|
|
3311
|
+
]
|
|
3312
|
+
}
|
|
3313
|
+
),
|
|
3314
|
+
chainListShown && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
3315
|
+
"ul",
|
|
3316
|
+
{
|
|
3317
|
+
ref: listRef,
|
|
3318
|
+
className: "bg-black globalBorder rounded-lg whitespace-nowrap z-1 right-0 top-10 px-2 max-w-full max-h-[40vh] overflow-auto absolute text-sm z-20",
|
|
3319
|
+
children: chainListOptions.map((chain, index) => /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
3320
|
+
ChainListElement,
|
|
3321
|
+
{
|
|
3322
|
+
index,
|
|
3323
|
+
length: supportedChains.length,
|
|
3324
|
+
setSrcChain,
|
|
3325
|
+
setChainListShown,
|
|
3326
|
+
chain
|
|
3327
|
+
}
|
|
3328
|
+
))
|
|
3329
|
+
}
|
|
3330
|
+
),
|
|
3331
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
|
|
3332
|
+
"div",
|
|
3333
|
+
{
|
|
3334
|
+
className: "flex gap-2 items-center p-2 max-w-full cursor-pointer bg-black text-white globalBorder rounded-3xl whitespace-nowrap",
|
|
3335
|
+
onClick: () => {
|
|
3336
|
+
setTokenListShown((state) => !state);
|
|
3337
|
+
},
|
|
3338
|
+
children: [
|
|
3339
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
3340
|
+
"img",
|
|
3341
|
+
{
|
|
3342
|
+
height: 16,
|
|
3343
|
+
width: 16,
|
|
3344
|
+
src: srcToken?.image,
|
|
3345
|
+
alt: srcToken?.name
|
|
3346
|
+
}
|
|
3347
|
+
),
|
|
3348
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { children: srcToken?.symbol }),
|
|
3349
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(DownArrowIcon, {})
|
|
3350
|
+
]
|
|
3351
|
+
}
|
|
3352
|
+
),
|
|
3353
|
+
tokenListShown && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
3354
|
+
TokenPicker,
|
|
3355
|
+
{
|
|
3356
|
+
onCloseClick: () => setTokenListShown(false),
|
|
3357
|
+
tokens: srcChain?.tokens,
|
|
3358
|
+
signer,
|
|
3359
|
+
selectedToken: srcToken,
|
|
3360
|
+
setSelectedToken: (token) => setSrcToken(token),
|
|
3361
|
+
balances
|
|
3362
|
+
}
|
|
3363
|
+
)
|
|
3364
|
+
] })
|
|
3365
|
+
] }),
|
|
3366
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex justify-between items-center w-full text-sm text-[rgba(255,255,255,0.6)] relative", children: [
|
|
3367
|
+
srcToken ? prices && prices[srcToken.address] ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { children: `$${(Number(amount) * Number(prices[srcToken.address])).toFixed(
|
|
3368
|
+
2
|
|
3369
|
+
)}` }) : /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Alert, { desc: "Unknown price" }) : /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_jsx_runtime31.Fragment, { children: "$0.00" }),
|
|
3370
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
3371
|
+
"div",
|
|
3372
|
+
{
|
|
3373
|
+
onClick: handleMaxClick,
|
|
3374
|
+
className: "flex gap-1 items-center font-medium text-white opacity-60 py-0.5 cursor-pointer",
|
|
3375
|
+
children: signer && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(BalanceComponent, { balances, srcToken })
|
|
3376
|
+
}
|
|
3377
|
+
)
|
|
3378
|
+
] })
|
|
3379
|
+
] });
|
|
3380
|
+
};
|
|
3381
|
+
|
|
3382
|
+
// src/components/TxConfigForm/ErrorField.tsx
|
|
3383
|
+
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
3384
|
+
var ErrorField = ({ error }) => {
|
|
3385
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
3386
|
+
"div",
|
|
3387
|
+
{
|
|
3388
|
+
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"}`,
|
|
3389
|
+
children: error
|
|
3390
|
+
}
|
|
3391
|
+
);
|
|
3392
|
+
};
|
|
3393
|
+
|
|
3394
|
+
// src/components/TxConfigForm/Description.tsx
|
|
3395
|
+
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
3396
|
+
var Description = ({ description }) => {
|
|
3397
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "flex flex-col items-start rounded-lg px-4 py-2", children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "w-full flex gap-4 items-start justify-between text-xl", children: description }) });
|
|
3398
|
+
};
|
|
3399
|
+
|
|
3400
|
+
// src/components/TxConfigForm/Form.tsx
|
|
3401
|
+
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
3402
|
+
var Form = ({
|
|
3403
|
+
dstChainId,
|
|
3404
|
+
dstTokenAddr,
|
|
3405
|
+
customContractCalls,
|
|
3406
|
+
desc,
|
|
3407
|
+
supportedChains,
|
|
3408
|
+
onSubmit
|
|
3409
|
+
}) => {
|
|
3410
|
+
const [signer, setSigner] = (0, import_react8.useState)();
|
|
3411
|
+
const [dstChain, setDstChain] = (0, import_react8.useState)();
|
|
3412
|
+
const [dstToken, setDstToken] = (0, import_react8.useState)();
|
|
3413
|
+
const [srcChain, setSrcChain] = (0, import_react8.useState)();
|
|
3414
|
+
const [srcToken, setSrcToken] = (0, import_react8.useState)();
|
|
3415
|
+
const [amount, setAmount] = (0, import_react8.useState)("");
|
|
3416
|
+
const [paymentToken, setPaymentToken] = (0, import_react8.useState)();
|
|
3417
|
+
const [route, setRoute] = (0, import_react8.useState)();
|
|
3418
|
+
const [expressChecked, setExpressChecked] = (0, import_react8.useState)(true);
|
|
3419
|
+
const [historyTabShown, setHistoryTabShown] = (0, import_react8.useState)(false);
|
|
3420
|
+
const [isGettingRoute, setIsGettingRoute] = (0, import_react8.useState)(false);
|
|
3421
|
+
const [prices, setPrices] = (0, import_react8.useState)();
|
|
3422
|
+
const [balances, setBalances] = (0, import_react8.useState)();
|
|
3423
|
+
const [settingsShown, setSettingsShown] = (0, import_react8.useState)(false);
|
|
3424
|
+
const [formError, setFormError] = (0, import_react8.useState)("");
|
|
3425
|
+
const [slippage, setSlippage] = (0, import_react8.useState)("1.5");
|
|
3426
|
+
const [feesDetailsShown, setFeesDetailsShown] = (0, import_react8.useState)(false);
|
|
3427
|
+
const debouncedAmount = useDebounce(amount, 1e3);
|
|
3428
|
+
const account = (0, import_wagmi2.useAccount)();
|
|
3429
|
+
const { switchChainAsync } = (0, import_wagmi2.useSwitchChain)();
|
|
3430
|
+
(0, import_react8.useEffect)(() => {
|
|
3431
|
+
setSigner(account.address);
|
|
3432
|
+
}, [account.address]);
|
|
3433
|
+
(0, import_react8.useEffect)(() => {
|
|
3434
|
+
if (supportedChains.some(
|
|
3435
|
+
({ chainId }) => chainId === account.chainId?.toString()
|
|
3436
|
+
)) {
|
|
3437
|
+
setSrcChain(
|
|
3438
|
+
supportedChains.find(
|
|
3439
|
+
({ chainId }) => chainId === account.chainId?.toString()
|
|
3440
|
+
)
|
|
3441
|
+
);
|
|
3442
|
+
}
|
|
3443
|
+
}, [account.chainId]);
|
|
3444
|
+
(0, import_react8.useEffect)(() => {
|
|
3445
|
+
setDstChain(supportedChains.find((chain) => chain.chainId === dstChainId));
|
|
3446
|
+
}, [supportedChains, dstChainId]);
|
|
3447
|
+
(0, import_react8.useEffect)(() => {
|
|
3448
|
+
setDstToken(
|
|
3449
|
+
dstChain?.tokens.find(
|
|
3450
|
+
(token) => token.address.toLowerCase() === dstTokenAddr.toLowerCase()
|
|
3451
|
+
)
|
|
3452
|
+
);
|
|
3453
|
+
}, [dstChain]);
|
|
3454
|
+
(0, import_react8.useEffect)(() => {
|
|
3455
|
+
if (srcChain && srcToken && dstChain && debouncedAmount && paymentToken && slippage) {
|
|
3456
|
+
setFormError("");
|
|
3457
|
+
const timeout = setTimeout(() => {
|
|
3458
|
+
setFormError("Getting Route is taking longer than usually");
|
|
3459
|
+
}, ROUTE_TIMEOUT_MS);
|
|
3460
|
+
setIsGettingRoute(true);
|
|
3461
|
+
setFeesDetailsShown(false);
|
|
3462
|
+
getRoute({
|
|
3463
|
+
fromAmount: import_ethers4.ethers.utils.parseUnits(debouncedAmount, srcToken?.decimals).toString(),
|
|
3464
|
+
fromAddress: signer || ADDRESSES[srcChain.chainId].FeeCollector,
|
|
3465
|
+
fromChain: srcChain.chainId,
|
|
3466
|
+
fromToken: srcToken.address,
|
|
3467
|
+
toAddress: signer || ADDRESSES[dstChain.chainId].FeeCollector,
|
|
3468
|
+
toChain: dstChainId,
|
|
3469
|
+
toToken: dstTokenAddr,
|
|
3470
|
+
paymentToken: paymentToken.address,
|
|
3471
|
+
slippage: Number(slippage),
|
|
3472
|
+
expressDelivery: expressChecked,
|
|
3473
|
+
customContractCalls
|
|
3474
|
+
}).then((response) => {
|
|
3475
|
+
setRoute(response);
|
|
3476
|
+
setFormError("");
|
|
3477
|
+
}).catch((err) => {
|
|
3478
|
+
setFormError(err.message);
|
|
3479
|
+
}).finally(() => {
|
|
3480
|
+
setIsGettingRoute(false);
|
|
3481
|
+
clearTimeout(timeout);
|
|
3482
|
+
});
|
|
3483
|
+
}
|
|
3484
|
+
}, [
|
|
3485
|
+
signer,
|
|
3486
|
+
srcChain,
|
|
3487
|
+
srcToken,
|
|
3488
|
+
debouncedAmount,
|
|
3489
|
+
paymentToken,
|
|
3490
|
+
slippage,
|
|
3491
|
+
expressChecked
|
|
3492
|
+
]);
|
|
3493
|
+
(0, import_react8.useEffect)(() => {
|
|
3494
|
+
if (srcChain) {
|
|
3495
|
+
setPaymentToken(
|
|
3496
|
+
srcChain.tokens.find(
|
|
3497
|
+
(token) => token.address.toLowerCase() === import_ethers4.ethers.constants.AddressZero.toLowerCase()
|
|
3498
|
+
)
|
|
3499
|
+
);
|
|
3500
|
+
}
|
|
3501
|
+
}, [srcChain]);
|
|
3502
|
+
(0, import_react8.useEffect)(() => {
|
|
3503
|
+
setAmount("");
|
|
3504
|
+
setFormError("");
|
|
3505
|
+
}, [srcToken]);
|
|
3506
|
+
(0, import_react8.useEffect)(() => {
|
|
3507
|
+
setSrcToken(srcChain?.tokens[0]);
|
|
3508
|
+
}, [srcChain]);
|
|
3509
|
+
(0, import_react8.useEffect)(() => {
|
|
3510
|
+
if (srcChain) {
|
|
3511
|
+
getPrices({ chainId: srcChain.chainId, currency: "USD" }).then(
|
|
3512
|
+
(prices2) => setPrices(prices2)
|
|
3513
|
+
);
|
|
3514
|
+
}
|
|
3515
|
+
}, [srcChain]);
|
|
3516
|
+
(0, import_react8.useEffect)(() => {
|
|
3517
|
+
if (srcChain && signer) {
|
|
3518
|
+
getBalances(srcChain, signer).then((balances2) => setBalances(balances2));
|
|
3519
|
+
}
|
|
3520
|
+
}, [srcChain, signer]);
|
|
3521
|
+
const handleSubmit = (event) => {
|
|
3522
|
+
event.preventDefault();
|
|
3523
|
+
if (route)
|
|
3524
|
+
onSubmit(route);
|
|
3525
|
+
};
|
|
3526
|
+
const handleSwitchChain = async () => {
|
|
3527
|
+
await switchChainAsync({ chainId: Number(srcChain?.chainId) });
|
|
1638
3528
|
};
|
|
3529
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
|
|
3530
|
+
"form",
|
|
3531
|
+
{
|
|
3532
|
+
className: "flex flex-col gap-2 z-10 my-0 mx-auto p-4 rounded-3xl overflow-hidden font-light w-[360px] sm:w-[600px]",
|
|
3533
|
+
onSubmit: handleSubmit,
|
|
3534
|
+
children: [
|
|
3535
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
3536
|
+
TopBar,
|
|
3537
|
+
{
|
|
3538
|
+
signer,
|
|
3539
|
+
historyTabShown,
|
|
3540
|
+
setHistoryTabShown,
|
|
3541
|
+
setSettingsShown
|
|
3542
|
+
}
|
|
3543
|
+
),
|
|
3544
|
+
settingsShown && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
3545
|
+
Settings,
|
|
3546
|
+
{
|
|
3547
|
+
expressChecked,
|
|
3548
|
+
setExpressChecked,
|
|
3549
|
+
setSettingsShown,
|
|
3550
|
+
slippage,
|
|
3551
|
+
setSlippage
|
|
3552
|
+
}
|
|
3553
|
+
),
|
|
3554
|
+
historyTabShown ? signer && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(History, { signer, supportedChains }) : /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: "flex flex-col gap-2", children: [
|
|
3555
|
+
desc && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Description, { description: desc }),
|
|
3556
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
3557
|
+
SwapPanel,
|
|
3558
|
+
{
|
|
3559
|
+
amount,
|
|
3560
|
+
setAmount,
|
|
3561
|
+
srcToken,
|
|
3562
|
+
setSrcToken,
|
|
3563
|
+
srcChain,
|
|
3564
|
+
signer,
|
|
3565
|
+
balances,
|
|
3566
|
+
prices,
|
|
3567
|
+
supportedChains,
|
|
3568
|
+
setSrcChain
|
|
3569
|
+
}
|
|
3570
|
+
),
|
|
3571
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
3572
|
+
Summary,
|
|
3573
|
+
{
|
|
3574
|
+
isGettingRoute,
|
|
3575
|
+
amount,
|
|
3576
|
+
route,
|
|
3577
|
+
dstToken,
|
|
3578
|
+
dstChain
|
|
3579
|
+
}
|
|
3580
|
+
),
|
|
3581
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
3582
|
+
FeesDetails,
|
|
3583
|
+
{
|
|
3584
|
+
route,
|
|
3585
|
+
isGettingRoute,
|
|
3586
|
+
paymentToken,
|
|
3587
|
+
dstToken,
|
|
3588
|
+
expressChecked,
|
|
3589
|
+
slippage,
|
|
3590
|
+
feesDetailsShown,
|
|
3591
|
+
setFeesDetailsShown
|
|
3592
|
+
}
|
|
3593
|
+
),
|
|
3594
|
+
formError.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(ErrorField, { error: formError }),
|
|
3595
|
+
srcChain && srcChain.chainId !== account.chainId?.toString() ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("button", { type: "button", onClick: handleSwitchChain, children: "Switch chain" }) : /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
3596
|
+
"button",
|
|
3597
|
+
{
|
|
3598
|
+
type: "submit",
|
|
3599
|
+
disabled: !signer || !route || isGettingRoute,
|
|
3600
|
+
children: "Submit"
|
|
3601
|
+
}
|
|
3602
|
+
)
|
|
3603
|
+
] })
|
|
3604
|
+
]
|
|
3605
|
+
}
|
|
3606
|
+
);
|
|
3607
|
+
};
|
|
3608
|
+
|
|
3609
|
+
// src/components/TxConfigForm/index.tsx
|
|
3610
|
+
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
3611
|
+
var TxConfigForm = ({
|
|
3612
|
+
dstChainId,
|
|
3613
|
+
dstTokenAddr,
|
|
3614
|
+
customContractCalls,
|
|
3615
|
+
desc,
|
|
3616
|
+
supportedChains,
|
|
3617
|
+
onSubmit,
|
|
3618
|
+
onClose
|
|
3619
|
+
}) => {
|
|
3620
|
+
const onBackdropClick = (e) => {
|
|
3621
|
+
e.stopPropagation();
|
|
3622
|
+
e.nativeEvent.stopImmediatePropagation();
|
|
3623
|
+
if (e.target === e.currentTarget) {
|
|
3624
|
+
onClose();
|
|
3625
|
+
}
|
|
3626
|
+
};
|
|
3627
|
+
const queryClient = new import_react_query.QueryClient();
|
|
3628
|
+
const wagmiConfig = (0, import_react9.useMemo)(
|
|
3629
|
+
() => getWagmiConfig(supportedChains),
|
|
3630
|
+
supportedChains
|
|
3631
|
+
);
|
|
3632
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_wagmi3.WagmiProvider, { config: wagmiConfig, children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_react_query.QueryClientProvider, { client: queryClient, children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
3633
|
+
"div",
|
|
3634
|
+
{
|
|
3635
|
+
className: "top-0 left-0 right-0 bottom-0 bg-[rgba(0,0,0,0.8)] fixed flex items-center justify-center z-10",
|
|
3636
|
+
onClick: onBackdropClick,
|
|
3637
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "relative bg-black rounded-3xl w-lg overflow-auto text-white border-2 border-solid border-[rgba(255,255,255,0.1)]", children: [
|
|
3638
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
3639
|
+
Form,
|
|
3640
|
+
{
|
|
3641
|
+
dstChainId,
|
|
3642
|
+
dstTokenAddr,
|
|
3643
|
+
customContractCalls,
|
|
3644
|
+
desc,
|
|
3645
|
+
supportedChains,
|
|
3646
|
+
onSubmit
|
|
3647
|
+
}
|
|
3648
|
+
),
|
|
3649
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
3650
|
+
"div",
|
|
3651
|
+
{
|
|
3652
|
+
className: "absolute top-7 right-4 cursor-pointer text-white",
|
|
3653
|
+
onClick: onClose,
|
|
3654
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(CloseIcon, {})
|
|
3655
|
+
}
|
|
3656
|
+
),
|
|
3657
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "swappage__poweredby", children: [
|
|
3658
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { children: "Powered by" }),
|
|
3659
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(XSwapBadgeIcon, {}),
|
|
3660
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { children: "\u2715" }),
|
|
3661
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(ChainlinkCCIPIcon, {})
|
|
3662
|
+
] })
|
|
3663
|
+
] })
|
|
3664
|
+
}
|
|
3665
|
+
) }) });
|
|
3666
|
+
};
|
|
3667
|
+
var openTxConfigForm = async ({
|
|
3668
|
+
dstChainId,
|
|
3669
|
+
dstTokenAddr,
|
|
3670
|
+
customContractCalls,
|
|
3671
|
+
desc,
|
|
3672
|
+
supportedChains
|
|
3673
|
+
}) => {
|
|
3674
|
+
try {
|
|
3675
|
+
return await new Promise((resolve) => {
|
|
3676
|
+
txConfigFormRoot.render(
|
|
3677
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
3678
|
+
TxConfigForm,
|
|
3679
|
+
{
|
|
3680
|
+
dstChainId,
|
|
3681
|
+
dstTokenAddr,
|
|
3682
|
+
customContractCalls,
|
|
3683
|
+
desc,
|
|
3684
|
+
supportedChains,
|
|
3685
|
+
onSubmit: (route) => {
|
|
3686
|
+
resolve(route);
|
|
3687
|
+
txConfigFormRoot.render("");
|
|
3688
|
+
},
|
|
3689
|
+
onClose: () => {
|
|
3690
|
+
txConfigFormRoot.render("");
|
|
3691
|
+
}
|
|
3692
|
+
}
|
|
3693
|
+
)
|
|
3694
|
+
);
|
|
3695
|
+
});
|
|
3696
|
+
} catch (err) {
|
|
3697
|
+
throw new Error(`XSwap component error, ${err}`);
|
|
3698
|
+
}
|
|
3699
|
+
};
|
|
3700
|
+
var txConfigFormRoot;
|
|
3701
|
+
if (typeof document !== "undefined") {
|
|
3702
|
+
const xswapElement = document.createElement("div");
|
|
3703
|
+
xswapElement.setAttribute("id", "txConfigFormRoot");
|
|
3704
|
+
xswapElement.classList.add("xswap");
|
|
3705
|
+
document.body.appendChild(xswapElement);
|
|
3706
|
+
txConfigFormRoot = (0, import_client.createRoot)(xswapElement);
|
|
3707
|
+
}
|
|
3708
|
+
|
|
3709
|
+
// src/components/Skeleton/index.tsx
|
|
3710
|
+
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
3711
|
+
var Skeleton = ({ w, h }) => {
|
|
3712
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: `bg-current rounded animate-pulse ${w} ${h}` });
|
|
1639
3713
|
};
|
|
1640
3714
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1641
3715
|
0 && (module.exports = {
|
|
1642
|
-
|
|
1643
|
-
|
|
3716
|
+
ADDRESSES,
|
|
3717
|
+
Alert,
|
|
3718
|
+
BALANCES_CHUNK_SIZE,
|
|
3719
|
+
BALANCE_DISPLAY_MIN_LIMIT,
|
|
3720
|
+
BatchQueryAbi,
|
|
3721
|
+
ContractName,
|
|
1644
3722
|
DEFAULT_ECOSYSTEM,
|
|
1645
|
-
|
|
1646
|
-
DEFAULT_NATIVE_FEE_MULTIPLIER_PERCENTAGE,
|
|
3723
|
+
DELIVERY_TIME,
|
|
1647
3724
|
ERC20Abi,
|
|
3725
|
+
EXPRESS_DELIVERY_TIME,
|
|
1648
3726
|
Ecosystem,
|
|
1649
3727
|
Environment,
|
|
3728
|
+
IERC20,
|
|
3729
|
+
MINIMUM_DISPLAYED_TOKEN_AMOUNT,
|
|
3730
|
+
NUMBER_INPUT_REGEX,
|
|
3731
|
+
ROUTE_TIMEOUT_MS,
|
|
3732
|
+
SLIPPAGE_PRESETS,
|
|
3733
|
+
Skeleton,
|
|
1650
3734
|
Web3Environment,
|
|
1651
3735
|
XSwapCallType,
|
|
1652
3736
|
XSwapRouterAbi,
|
|
3737
|
+
chunkArray,
|
|
3738
|
+
deepMergeObjects,
|
|
3739
|
+
findPlaceholderIndex,
|
|
1653
3740
|
generateApproveTxData,
|
|
3741
|
+
generateRandomBigNumber,
|
|
3742
|
+
generateStakingCalls,
|
|
3743
|
+
generateUniqueRandomBigNumber,
|
|
3744
|
+
getBalanceOf,
|
|
3745
|
+
getBalances,
|
|
1654
3746
|
getBridgeTokens,
|
|
1655
3747
|
getChainData,
|
|
1656
3748
|
getChains,
|
|
3749
|
+
getHistory,
|
|
3750
|
+
getPrices,
|
|
1657
3751
|
getRoute,
|
|
3752
|
+
getSwapTx,
|
|
1658
3753
|
getTokens,
|
|
1659
|
-
|
|
3754
|
+
openTxConfigForm,
|
|
3755
|
+
replaceNull,
|
|
3756
|
+
safeBigNumberFrom,
|
|
3757
|
+
shortAddress,
|
|
3758
|
+
weiToHumanReadable
|
|
1660
3759
|
});
|