@jup-ag/plugin 1.0.0 → 1.0.2
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/README.md +4 -0
- package/dist/global.css +0 -47
- package/dist/index.css +0 -36
- package/dist/index.css.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +474 -619
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -85,7 +85,7 @@ var require_package = __commonJS({
|
|
|
85
85
|
"package.json"(exports2, module2) {
|
|
86
86
|
module2.exports = {
|
|
87
87
|
name: "@jup-ag/plugin",
|
|
88
|
-
version: "1.0.
|
|
88
|
+
version: "1.0.2",
|
|
89
89
|
private: false,
|
|
90
90
|
license: "MIT",
|
|
91
91
|
scripts: {
|
|
@@ -123,7 +123,7 @@ var require_package = __commonJS({
|
|
|
123
123
|
"@jup-ag/wallet-adapter": "0.2.3",
|
|
124
124
|
"@popperjs/core": "^2.11.8",
|
|
125
125
|
"@solana/wallet-adapter-wallets": "0.19.33",
|
|
126
|
-
"@tanstack/react-query": "
|
|
126
|
+
"@tanstack/react-query": "5.85.5",
|
|
127
127
|
"bn.js": "5.2.1",
|
|
128
128
|
clsx: "^2.1.1",
|
|
129
129
|
"decimal.js": "10.4.3",
|
|
@@ -323,12 +323,15 @@ var packageJson = require_package();
|
|
|
323
323
|
var bundleName = `plugin-${packageJson.version}`;
|
|
324
324
|
var scriptDomain = (() => {
|
|
325
325
|
var _a2;
|
|
326
|
+
if (!process.env.NEXT_PUBLIC_IS_PLUGIN_DEV) {
|
|
327
|
+
return null;
|
|
328
|
+
}
|
|
326
329
|
if (typeof window === "undefined" || typeof document === "undefined") return "";
|
|
327
330
|
const url = (_a2 = document.currentScript) == null ? void 0 : _a2.src;
|
|
328
331
|
if (url) {
|
|
329
332
|
return new URL(url).origin;
|
|
330
333
|
}
|
|
331
|
-
return
|
|
334
|
+
return null;
|
|
332
335
|
})() || "https://plugin.jup.ag";
|
|
333
336
|
function loadRemote(id, href, type2) {
|
|
334
337
|
return __async(this, null, function* () {
|
|
@@ -652,6 +655,8 @@ var USDC_MINT = new import_web3.PublicKey("EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZ
|
|
|
652
655
|
var USDT_MINT = new import_web3.PublicKey("Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB");
|
|
653
656
|
var JLP_MINT = new import_web3.PublicKey("27G8MtK7VtTcCHkpASjSDdkWWYfoqT6ggEuKidVJidD4");
|
|
654
657
|
var WRAPPED_SOL_MINT = new import_web3.PublicKey("So11111111111111111111111111111111111111112");
|
|
658
|
+
var MINIMUM_SOL_BALANCE = 0.01;
|
|
659
|
+
var MAX_INPUT_LIMIT = 1e14;
|
|
655
660
|
var INITIAL_FORM_CONFIG = Object.freeze({
|
|
656
661
|
simulateWalletPassthrough: false,
|
|
657
662
|
defaultExplorer: "Solana Explorer",
|
|
@@ -1006,7 +1011,8 @@ var FormattedUltraQuoteResponse = (0, import_superstruct.type)({
|
|
|
1006
1011
|
requestId: (0, import_superstruct.string)(),
|
|
1007
1012
|
prioritizationFeeLamports: (0, import_superstruct.optional)((0, import_superstruct.number)()),
|
|
1008
1013
|
feeBps: (0, import_superstruct.number)(),
|
|
1009
|
-
router: (0, import_superstruct.string)()
|
|
1014
|
+
router: (0, import_superstruct.string)(),
|
|
1015
|
+
errorMessage: (0, import_superstruct.optional)((0, import_superstruct.string)())
|
|
1010
1016
|
});
|
|
1011
1017
|
|
|
1012
1018
|
// src/queries/useQuoteQuery.ts
|
|
@@ -1037,133 +1043,13 @@ var useQuoteQuery = (params, shouldRefetch = true) => {
|
|
|
1037
1043
|
refetchInterval: shouldRefetch ? 5e3 : false,
|
|
1038
1044
|
retry: 0,
|
|
1039
1045
|
enabled: Number(amount) > 0,
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
console.error("useQuoteQuery", error);
|
|
1043
|
-
}
|
|
1046
|
+
gcTime: 0,
|
|
1047
|
+
staleTime: 0
|
|
1044
1048
|
});
|
|
1045
1049
|
};
|
|
1046
1050
|
|
|
1047
|
-
// src/queries/useUltraSwapMutation.ts
|
|
1048
|
-
var import_wallet_adapter2 = require("@jup-ag/wallet-adapter");
|
|
1049
|
-
var import_react_query2 = require("@tanstack/react-query");
|
|
1050
|
-
var import_buffer = require("buffer");
|
|
1051
|
-
var import_web34 = require("@solana/web3.js");
|
|
1052
|
-
|
|
1053
|
-
// src/entity/TransactionError.ts
|
|
1054
|
-
var TransactionError = class extends Error {
|
|
1055
|
-
constructor(message, txid, code, programIds, serializedTx) {
|
|
1056
|
-
super(message);
|
|
1057
|
-
this.name = "TransactionError";
|
|
1058
|
-
this.txid = txid;
|
|
1059
|
-
this.code = code;
|
|
1060
|
-
this.programIds = programIds;
|
|
1061
|
-
this.serializedTx = serializedTx;
|
|
1062
|
-
}
|
|
1063
|
-
};
|
|
1064
|
-
|
|
1065
|
-
// src/queries/useUltraSwapMutation.ts
|
|
1066
|
-
var UltraSwapError = class extends Error {
|
|
1067
|
-
constructor(message, type2, txid) {
|
|
1068
|
-
super(message);
|
|
1069
|
-
this.type = type2;
|
|
1070
|
-
this.txid = txid;
|
|
1071
|
-
}
|
|
1072
|
-
};
|
|
1073
|
-
function useUltraSwapMutation() {
|
|
1074
|
-
const { wallet, signTransaction } = useWalletPassThrough();
|
|
1075
|
-
return (0, import_react_query2.useMutation)({
|
|
1076
|
-
mutationFn: (_0) => __async(this, [_0], function* ({
|
|
1077
|
-
setTxStatus,
|
|
1078
|
-
setLastSwapResult,
|
|
1079
|
-
fromTokenInfo,
|
|
1080
|
-
toTokenInfo,
|
|
1081
|
-
quoteResponseMeta
|
|
1082
|
-
}) {
|
|
1083
|
-
const publicKey = wallet == null ? void 0 : wallet.adapter.publicKey;
|
|
1084
|
-
if (!signTransaction || !publicKey) {
|
|
1085
|
-
throw new UltraSwapError(
|
|
1086
|
-
"Wallet not connected, or missing wallet functions",
|
|
1087
|
-
"WALLET_SIGNING_FAILED" /* WALLET_SIGNING_FAILED */
|
|
1088
|
-
);
|
|
1089
|
-
}
|
|
1090
|
-
setTxStatus({
|
|
1091
|
-
txid: "",
|
|
1092
|
-
status: "pending-approval"
|
|
1093
|
-
});
|
|
1094
|
-
const selectedQuote = quoteResponseMeta.original;
|
|
1095
|
-
const { transaction, requestId } = selectedQuote;
|
|
1096
|
-
if (!transaction) throw new Error("Missing transaction");
|
|
1097
|
-
const based64tx = import_buffer.Buffer.from(transaction, "base64");
|
|
1098
|
-
const versionedTransaction = import_web34.VersionedTransaction.deserialize(new Uint8Array(based64tx));
|
|
1099
|
-
const signedTransaction = yield signTransaction(versionedTransaction);
|
|
1100
|
-
const serializedTransaction = import_buffer.Buffer.from(signedTransaction.serialize()).toString("base64");
|
|
1101
|
-
setTxStatus({
|
|
1102
|
-
txid: "",
|
|
1103
|
-
status: "sending"
|
|
1104
|
-
});
|
|
1105
|
-
const response = yield ultraSwapService.submitSwap(serializedTransaction, requestId);
|
|
1106
|
-
const { signature, status } = response;
|
|
1107
|
-
if (status === "Failed") {
|
|
1108
|
-
throw new UltraSwapError(response.error, "FAILED" /* FAILED */, signature);
|
|
1109
|
-
}
|
|
1110
|
-
const { inputAmountResult, outputAmountResult } = response;
|
|
1111
|
-
setTxStatus({
|
|
1112
|
-
txid: signature,
|
|
1113
|
-
status: "success"
|
|
1114
|
-
});
|
|
1115
|
-
setLastSwapResult({
|
|
1116
|
-
swapResult: {
|
|
1117
|
-
txid: signature,
|
|
1118
|
-
inputAddress: new import_web34.PublicKey(fromTokenInfo.id),
|
|
1119
|
-
outputAddress: new import_web34.PublicKey(toTokenInfo.id),
|
|
1120
|
-
inputAmount: Number(inputAmountResult),
|
|
1121
|
-
outputAmount: Number(outputAmountResult)
|
|
1122
|
-
},
|
|
1123
|
-
quoteReponse: quoteResponseMeta
|
|
1124
|
-
});
|
|
1125
|
-
return signature;
|
|
1126
|
-
}),
|
|
1127
|
-
onError: (error, variables) => __async(this, null, function* () {
|
|
1128
|
-
const { setTxStatus, setLastSwapResult, quoteResponseMeta } = variables;
|
|
1129
|
-
if (error instanceof import_wallet_adapter2.WalletSignTransactionError) {
|
|
1130
|
-
const message = error.message || error.error || "Transaction cancelled";
|
|
1131
|
-
setLastSwapResult({
|
|
1132
|
-
swapResult: {
|
|
1133
|
-
error: new TransactionError(message)
|
|
1134
|
-
},
|
|
1135
|
-
quoteReponse: quoteResponseMeta
|
|
1136
|
-
});
|
|
1137
|
-
return;
|
|
1138
|
-
}
|
|
1139
|
-
if (error instanceof Error) {
|
|
1140
|
-
setLastSwapResult({
|
|
1141
|
-
swapResult: {
|
|
1142
|
-
error: new TransactionError(error.message)
|
|
1143
|
-
},
|
|
1144
|
-
quoteReponse: quoteResponseMeta
|
|
1145
|
-
});
|
|
1146
|
-
return;
|
|
1147
|
-
}
|
|
1148
|
-
if ("json" in error) {
|
|
1149
|
-
const json = yield error.json();
|
|
1150
|
-
setLastSwapResult({
|
|
1151
|
-
swapResult: {
|
|
1152
|
-
error: new TransactionError(json.error || "Unknown error")
|
|
1153
|
-
},
|
|
1154
|
-
quoteReponse: quoteResponseMeta
|
|
1155
|
-
});
|
|
1156
|
-
setTxStatus({
|
|
1157
|
-
txid: json.txid || "",
|
|
1158
|
-
status: "fail"
|
|
1159
|
-
});
|
|
1160
|
-
}
|
|
1161
|
-
})
|
|
1162
|
-
});
|
|
1163
|
-
}
|
|
1164
|
-
|
|
1165
1051
|
// src/hooks/useBalances.ts
|
|
1166
|
-
var
|
|
1052
|
+
var import_react_query2 = require("@tanstack/react-query");
|
|
1167
1053
|
var import_react6 = require("react");
|
|
1168
1054
|
var ULTRA_NATIVESOL_ID = "SOL";
|
|
1169
1055
|
var WSOL_ID = WRAPPED_SOL_MINT.toString();
|
|
@@ -1184,13 +1070,13 @@ var useBalances = () => {
|
|
|
1184
1070
|
if (!publicKey) return "";
|
|
1185
1071
|
return publicKey.toString();
|
|
1186
1072
|
}, [publicKey]);
|
|
1187
|
-
return (0,
|
|
1073
|
+
return (0, import_react_query2.useQuery)({
|
|
1188
1074
|
queryKey: ["ultra", "balances", address],
|
|
1189
1075
|
queryFn: (_0) => __async(void 0, [_0], function* ({ signal }) {
|
|
1190
1076
|
return yield ultraSwapService.getBalance(address, signal);
|
|
1191
1077
|
}),
|
|
1192
1078
|
enabled: !!address && getPluginInView(),
|
|
1193
|
-
|
|
1079
|
+
gcTime: 2e4,
|
|
1194
1080
|
staleTime: 2e4,
|
|
1195
1081
|
refetchOnWindowFocus: false,
|
|
1196
1082
|
refetchIntervalInBackground: false,
|
|
@@ -1200,7 +1086,7 @@ var useBalances = () => {
|
|
|
1200
1086
|
};
|
|
1201
1087
|
|
|
1202
1088
|
// src/hooks/useAsset.ts
|
|
1203
|
-
var
|
|
1089
|
+
var import_react_query3 = require("@tanstack/react-query");
|
|
1204
1090
|
|
|
1205
1091
|
// src/contexts/SearchService.ts
|
|
1206
1092
|
var BASE_URL = "https://datapi.jup.ag";
|
|
@@ -1225,7 +1111,7 @@ var searchService = new SearchService();
|
|
|
1225
1111
|
// src/hooks/useAsset.ts
|
|
1226
1112
|
var ASSET_QUERY_KEY = ["search", "assets"];
|
|
1227
1113
|
var useAsset = (mint) => {
|
|
1228
|
-
return (0,
|
|
1114
|
+
return (0, import_react_query3.useQuery)({
|
|
1229
1115
|
queryKey: [...ASSET_QUERY_KEY, mint],
|
|
1230
1116
|
queryFn: () => searchService.search(mint),
|
|
1231
1117
|
enabled: !!mint,
|
|
@@ -1256,7 +1142,7 @@ var SwapContextProvider = (props) => {
|
|
|
1256
1142
|
const { displayMode, scriptDomain: scriptDomain2, formProps: originalFormProps, children, enableWalletPassthrough } = props;
|
|
1257
1143
|
const { screen: screen2 } = useScreenState();
|
|
1258
1144
|
const { wallet } = useWalletPassThrough();
|
|
1259
|
-
const { refetch: refetchBalances } = useBalances();
|
|
1145
|
+
const { data: balances, refetch: refetchBalances } = useBalances();
|
|
1260
1146
|
const isToPairFocused = (0, import_react7.useRef)(false);
|
|
1261
1147
|
const walletPublicKey = (0, import_react7.useMemo)(() => {
|
|
1262
1148
|
var _a3;
|
|
@@ -1300,6 +1186,10 @@ var SwapContextProvider = (props) => {
|
|
|
1300
1186
|
setupInitialAmount();
|
|
1301
1187
|
}, [formProps.initialAmount, setupInitialAmount]);
|
|
1302
1188
|
const debouncedForm = useDebounce(form, 250);
|
|
1189
|
+
const debouncePending = (0, import_react7.useMemo)(
|
|
1190
|
+
() => JSON.stringify(form) !== JSON.stringify(debouncedForm),
|
|
1191
|
+
[form, debouncedForm]
|
|
1192
|
+
);
|
|
1303
1193
|
const amount = (0, import_react7.useMemo)(() => {
|
|
1304
1194
|
if (!fromTokenInfo || !toTokenInfo) {
|
|
1305
1195
|
return import_jsbi2.default.BigInt(0);
|
|
@@ -1341,6 +1231,11 @@ var SwapContextProvider = (props) => {
|
|
|
1341
1231
|
// Stop refetching when transaction is in progress
|
|
1342
1232
|
!txStatus
|
|
1343
1233
|
);
|
|
1234
|
+
const balance = (0, import_react7.useMemo)(() => {
|
|
1235
|
+
var _a3;
|
|
1236
|
+
if (!balances) return 0;
|
|
1237
|
+
return ((_a3 = balances[form.fromMint]) == null ? void 0 : _a3.uiAmount) || 0;
|
|
1238
|
+
}, [balances, form.fromMint]);
|
|
1344
1239
|
(0, import_react7.useEffect)(() => {
|
|
1345
1240
|
if (quoteError) {
|
|
1346
1241
|
if (typeof quoteError === "string") {
|
|
@@ -1354,8 +1249,14 @@ var SwapContextProvider = (props) => {
|
|
|
1354
1249
|
});
|
|
1355
1250
|
return;
|
|
1356
1251
|
}
|
|
1252
|
+
if (form.fromValue && new import_decimal2.default(form.fromValue).gt(balance)) {
|
|
1253
|
+
setErrors({
|
|
1254
|
+
fromValue: { title: `Insufficient ${fromTokenInfo == null ? void 0 : fromTokenInfo.symbol}`, message: "" }
|
|
1255
|
+
});
|
|
1256
|
+
return;
|
|
1257
|
+
}
|
|
1357
1258
|
setErrors({});
|
|
1358
|
-
}, [quoteError]);
|
|
1259
|
+
}, [quoteError, balance, form.fromValue, fromTokenInfo]);
|
|
1359
1260
|
const lastRefreshTimestamp = (0, import_react7.useMemo)(() => {
|
|
1360
1261
|
if (loading) {
|
|
1361
1262
|
return (/* @__PURE__ */ new Date()).getTime();
|
|
@@ -1394,29 +1295,6 @@ var SwapContextProvider = (props) => {
|
|
|
1394
1295
|
});
|
|
1395
1296
|
}, [form.fromValue, form.toValue, fromTokenInfo, quoteResponseMeta, toTokenInfo]);
|
|
1396
1297
|
const [lastSwapResult, setLastSwapResult] = (0, import_react7.useState)(null);
|
|
1397
|
-
const { mutateAsync: ultraSwapMutation } = useUltraSwapMutation();
|
|
1398
|
-
const onSubmit = (0, import_react7.useCallback)(() => __async(void 0, null, function* () {
|
|
1399
|
-
if (!walletPublicKey || !(wallet == null ? void 0 : wallet.adapter) || !quoteResponseMeta) {
|
|
1400
|
-
return null;
|
|
1401
|
-
}
|
|
1402
|
-
setTxStatus({
|
|
1403
|
-
txid: "",
|
|
1404
|
-
status: "loading"
|
|
1405
|
-
});
|
|
1406
|
-
try {
|
|
1407
|
-
if (!fromTokenInfo) throw new Error("Missing fromTokenInfo");
|
|
1408
|
-
if (!toTokenInfo) throw new Error("Missing toTokenInfo");
|
|
1409
|
-
yield ultraSwapMutation({
|
|
1410
|
-
quoteResponseMeta,
|
|
1411
|
-
fromTokenInfo,
|
|
1412
|
-
toTokenInfo,
|
|
1413
|
-
setTxStatus,
|
|
1414
|
-
setLastSwapResult
|
|
1415
|
-
});
|
|
1416
|
-
} catch (error) {
|
|
1417
|
-
console.log("Swap error", error);
|
|
1418
|
-
}
|
|
1419
|
-
}), [walletPublicKey, wallet == null ? void 0 : wallet.adapter, quoteResponseMeta, ultraSwapMutation, fromTokenInfo, toTokenInfo]);
|
|
1420
1298
|
const reset = (0, import_react7.useCallback)(
|
|
1421
1299
|
({ resetValues } = { resetValues: false }) => {
|
|
1422
1300
|
if (resetValues) {
|
|
@@ -1455,11 +1333,12 @@ var SwapContextProvider = (props) => {
|
|
|
1455
1333
|
toTokenInfo,
|
|
1456
1334
|
quoteResponseMeta,
|
|
1457
1335
|
setQuoteResponseMeta,
|
|
1458
|
-
onSubmit,
|
|
1336
|
+
// onSubmit,
|
|
1459
1337
|
lastSwapResult,
|
|
1338
|
+
setLastSwapResult,
|
|
1460
1339
|
reset,
|
|
1461
1340
|
refresh,
|
|
1462
|
-
loading,
|
|
1341
|
+
loading: loading || debouncePending,
|
|
1463
1342
|
quoteError,
|
|
1464
1343
|
lastRefreshTimestamp,
|
|
1465
1344
|
isToPairFocused,
|
|
@@ -1469,6 +1348,7 @@ var SwapContextProvider = (props) => {
|
|
|
1469
1348
|
swapping: {
|
|
1470
1349
|
txStatus
|
|
1471
1350
|
},
|
|
1351
|
+
setTxStatus,
|
|
1472
1352
|
enableWalletPassthrough
|
|
1473
1353
|
},
|
|
1474
1354
|
children
|
|
@@ -1630,13 +1510,6 @@ var import_react24 = require("react");
|
|
|
1630
1510
|
var import_react19 = require("react");
|
|
1631
1511
|
var import_react_number_format = require("react-number-format");
|
|
1632
1512
|
|
|
1633
|
-
// src/misc/constants.ts
|
|
1634
|
-
var import_web35 = require("@solana/web3.js");
|
|
1635
|
-
var MINIMUM_SOL_BALANCE = 0.01;
|
|
1636
|
-
var ROUTE_CACHE_DURATION = 2e4;
|
|
1637
|
-
var MAX_INPUT_LIMIT = 1e14;
|
|
1638
|
-
var WRAPPED_SOL_MINT2 = new import_web35.PublicKey("So11111111111111111111111111111111111111112");
|
|
1639
|
-
|
|
1640
1513
|
// src/components/Coinbalance.tsx
|
|
1641
1514
|
var React6 = __toESM(require("react"));
|
|
1642
1515
|
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
@@ -2041,15 +1914,18 @@ var TransactionFee = ({ gasFee, gasless }) => {
|
|
|
2041
1914
|
};
|
|
2042
1915
|
var TransactionFee_default = TransactionFee;
|
|
2043
1916
|
|
|
2044
|
-
// src/
|
|
1917
|
+
// src/components/PriceInfo/index.tsx
|
|
2045
1918
|
var import_react_query5 = require("@tanstack/react-query");
|
|
2046
|
-
|
|
2047
|
-
|
|
1919
|
+
|
|
1920
|
+
// src/queries/queries.ts
|
|
1921
|
+
var import_react_query4 = require("@tanstack/react-query");
|
|
1922
|
+
var UltraQueries = {
|
|
1923
|
+
routers: (0, import_react_query4.queryOptions)({
|
|
2048
1924
|
queryKey: ["routers"],
|
|
2049
|
-
queryFn:
|
|
2050
|
-
|
|
1925
|
+
queryFn: ultraSwapService.getRouters,
|
|
1926
|
+
gcTime: Infinity,
|
|
2051
1927
|
staleTime: Infinity
|
|
2052
|
-
}
|
|
1928
|
+
})
|
|
2053
1929
|
};
|
|
2054
1930
|
|
|
2055
1931
|
// src/components/PriceInfo/index.tsx
|
|
@@ -2069,14 +1945,14 @@ var Index = ({
|
|
|
2069
1945
|
// If there's no selectedRoute, we will use first route value to temporarily calculate
|
|
2070
1946
|
outputDecimal: toTokenInfo.decimals
|
|
2071
1947
|
};
|
|
2072
|
-
const { data: routerInfo } =
|
|
1948
|
+
const { data: routerInfo } = (0, import_react_query5.useQuery)(__spreadProps(__spreadValues({}, UltraQueries.routers), {
|
|
2073
1949
|
select: (data) => {
|
|
2074
1950
|
if (!quoteResponse) {
|
|
2075
1951
|
return null;
|
|
2076
1952
|
}
|
|
2077
1953
|
return data.find((router2) => router2.id === quoteResponse.quoteResponse.router);
|
|
2078
1954
|
}
|
|
2079
|
-
});
|
|
1955
|
+
}));
|
|
2080
1956
|
const priceImpact = formatNumber.format(
|
|
2081
1957
|
new import_decimal6.default((quoteResponse == null ? void 0 : quoteResponse.quoteResponse.priceImpactPct) || 0).mul(100).toDP(2)
|
|
2082
1958
|
);
|
|
@@ -2102,7 +1978,7 @@ var Index = ({
|
|
|
2102
1978
|
}
|
|
2103
1979
|
return 0;
|
|
2104
1980
|
}, [quoteResponse]);
|
|
2105
|
-
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: cn("mt-4 space-y-4
|
|
1981
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: cn("mt-4 space-y-4 ", containerClassName), children: [
|
|
2106
1982
|
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex items-center justify-between text-xs", children: [
|
|
2107
1983
|
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "text-primary-text/50", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { children: "Rate" }) }),
|
|
2108
1984
|
import_jsbi3.default.greaterThan(rateParams.inAmount, import_jsbi3.default.BigInt(0)) && import_jsbi3.default.greaterThan(rateParams.outAmount, import_jsbi3.default.BigInt(0)) ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
@@ -2179,28 +2055,6 @@ var SwitchPairButton = ({
|
|
|
2179
2055
|
};
|
|
2180
2056
|
var SwitchPairButton_default = SwitchPairButton;
|
|
2181
2057
|
|
|
2182
|
-
// src/components/useTimeDiff/useTimeDiff.tsx
|
|
2183
|
-
var import_react15 = __toESM(require("react"));
|
|
2184
|
-
var useTimeDiff = () => {
|
|
2185
|
-
const { lastRefreshTimestamp } = useSwapContext();
|
|
2186
|
-
const [hasExpired, setHasExpired] = import_react15.default.useState(false);
|
|
2187
|
-
const [timeDiff, setTimeDiff] = (0, import_react15.useState)(0);
|
|
2188
|
-
(0, import_react15.useEffect)(() => {
|
|
2189
|
-
const intervalId = setInterval(() => {
|
|
2190
|
-
if (!lastRefreshTimestamp) {
|
|
2191
|
-
return;
|
|
2192
|
-
}
|
|
2193
|
-
const value = Date.now() > lastRefreshTimestamp + ROUTE_CACHE_DURATION;
|
|
2194
|
-
const elapsedSeconds = (Date.now() - (lastRefreshTimestamp + ROUTE_CACHE_DURATION)) / 1e3;
|
|
2195
|
-
setTimeDiff(elapsedSeconds / (ROUTE_CACHE_DURATION / 1e3) * 100);
|
|
2196
|
-
setHasExpired(value);
|
|
2197
|
-
}, 1e3);
|
|
2198
|
-
return () => clearInterval(intervalId);
|
|
2199
|
-
}, [lastRefreshTimestamp]);
|
|
2200
|
-
return [hasExpired, timeDiff];
|
|
2201
|
-
};
|
|
2202
|
-
var useTimeDiff_default = useTimeDiff;
|
|
2203
|
-
|
|
2204
2058
|
// src/components/Form.tsx
|
|
2205
2059
|
var import_decimal7 = __toESM(require("decimal.js"));
|
|
2206
2060
|
|
|
@@ -2208,10 +2062,10 @@ var import_decimal7 = __toESM(require("decimal.js"));
|
|
|
2208
2062
|
var import_react_query6 = require("@tanstack/react-query");
|
|
2209
2063
|
|
|
2210
2064
|
// src/hooks/useMobile.ts
|
|
2211
|
-
var
|
|
2065
|
+
var import_react15 = require("react");
|
|
2212
2066
|
var import_react_use = require("react-use");
|
|
2213
2067
|
var useMobile = () => {
|
|
2214
|
-
const [isDesktop, setIsDesktop] = (0,
|
|
2068
|
+
const [isDesktop, setIsDesktop] = (0, import_react15.useState)(false);
|
|
2215
2069
|
(0, import_react_use.useIsomorphicLayoutEffect)(() => {
|
|
2216
2070
|
function updateSize() {
|
|
2217
2071
|
const desktopQuery = window.matchMedia("(min-width: 1024px)");
|
|
@@ -2225,7 +2079,7 @@ var useMobile = () => {
|
|
|
2225
2079
|
};
|
|
2226
2080
|
|
|
2227
2081
|
// src/components/Popover/Popover.tsx
|
|
2228
|
-
var
|
|
2082
|
+
var import_react16 = require("react");
|
|
2229
2083
|
var import_react_popper = require("react-popper");
|
|
2230
2084
|
var import_lodash = __toESM(require("lodash.debounce"));
|
|
2231
2085
|
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
@@ -2245,16 +2099,16 @@ var Popover = ({
|
|
|
2245
2099
|
offset,
|
|
2246
2100
|
drawShades = false
|
|
2247
2101
|
}) => {
|
|
2248
|
-
const isLocalMode = (0,
|
|
2102
|
+
const isLocalMode = (0, import_react16.useMemo)(
|
|
2249
2103
|
() => typeof isOpen === "undefined",
|
|
2250
2104
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
2251
2105
|
[]
|
|
2252
2106
|
);
|
|
2253
2107
|
const isMobile = useMobile();
|
|
2254
|
-
const [localOpen, setLocalOpen] = (0,
|
|
2255
|
-
const [referenceElement, setReferenceElement] = (0,
|
|
2256
|
-
const [popperElement, setPopperElement] = (0,
|
|
2257
|
-
const shouldShowArrow = (0,
|
|
2108
|
+
const [localOpen, setLocalOpen] = (0, import_react16.useState)(isLocalMode ? false : true);
|
|
2109
|
+
const [referenceElement, setReferenceElement] = (0, import_react16.useState)(null);
|
|
2110
|
+
const [popperElement, setPopperElement] = (0, import_react16.useState)(null);
|
|
2111
|
+
const shouldShowArrow = (0, import_react16.useMemo)(() => Boolean(popoverContent) && arrow, [popoverContent, arrow]);
|
|
2258
2112
|
const modifiers = offset ? [
|
|
2259
2113
|
{
|
|
2260
2114
|
name: "offset",
|
|
@@ -2268,7 +2122,7 @@ var Popover = ({
|
|
|
2268
2122
|
placement,
|
|
2269
2123
|
modifiers
|
|
2270
2124
|
});
|
|
2271
|
-
const handleClose = (0,
|
|
2125
|
+
const handleClose = (0, import_react16.useCallback)(
|
|
2272
2126
|
(0, import_lodash.default)(
|
|
2273
2127
|
() => {
|
|
2274
2128
|
if (isLocalMode) {
|
|
@@ -2283,7 +2137,7 @@ var Popover = ({
|
|
|
2283
2137
|
),
|
|
2284
2138
|
[setLocalOpen, isLocalMode, onClose, trigger, persistOnClick]
|
|
2285
2139
|
);
|
|
2286
|
-
const handleOpen = (0,
|
|
2140
|
+
const handleOpen = (0, import_react16.useCallback)(() => {
|
|
2287
2141
|
handleClose.cancel();
|
|
2288
2142
|
setLocalOpen(true);
|
|
2289
2143
|
}, [setLocalOpen, handleClose]);
|
|
@@ -2403,7 +2257,7 @@ var PopoverTooltip = ({
|
|
|
2403
2257
|
var PopoverTooltip_default = PopoverTooltip;
|
|
2404
2258
|
|
|
2405
2259
|
// src/components/JupShield.tsx
|
|
2406
|
-
var
|
|
2260
|
+
var import_react17 = require("react");
|
|
2407
2261
|
|
|
2408
2262
|
// src/components/Plural/index.tsx
|
|
2409
2263
|
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
@@ -2450,7 +2304,7 @@ var Warnings = ({
|
|
|
2450
2304
|
children,
|
|
2451
2305
|
isHighRisk
|
|
2452
2306
|
}) => {
|
|
2453
|
-
const warningTitle = (0,
|
|
2307
|
+
const warningTitle = (0, import_react17.useCallback)((warning2) => {
|
|
2454
2308
|
return parseShieldWarningtoSentenceCase(warning2);
|
|
2455
2309
|
}, []);
|
|
2456
2310
|
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex gap-1", children: [
|
|
@@ -2466,9 +2320,9 @@ var JupShield = ({ tokenAddress }) => {
|
|
|
2466
2320
|
const { data, isFetching } = (0, import_react_query6.useQuery)({
|
|
2467
2321
|
queryKey: ["shield", tokenAddress],
|
|
2468
2322
|
queryFn: () => ultraSwapService.getShield([tokenAddress]),
|
|
2469
|
-
|
|
2323
|
+
gcTime: 5 * 6e4,
|
|
2470
2324
|
staleTime: 5 * 6e4,
|
|
2471
|
-
|
|
2325
|
+
placeholderData: import_react_query6.keepPreviousData,
|
|
2472
2326
|
select: (data2) => {
|
|
2473
2327
|
const warnings = data2.warnings[tokenAddress];
|
|
2474
2328
|
return {
|
|
@@ -2521,10 +2375,166 @@ var JupShield = ({ tokenAddress }) => {
|
|
|
2521
2375
|
};
|
|
2522
2376
|
var JupShield_default = JupShield;
|
|
2523
2377
|
|
|
2524
|
-
// src/
|
|
2378
|
+
// src/queries/useUltraSwapMutation.ts
|
|
2379
|
+
var import_wallet_adapter2 = require("@jup-ag/wallet-adapter");
|
|
2380
|
+
var import_react_query7 = require("@tanstack/react-query");
|
|
2381
|
+
var import_buffer = require("buffer");
|
|
2382
|
+
var import_web34 = require("@solana/web3.js");
|
|
2383
|
+
|
|
2384
|
+
// src/entity/TransactionError.ts
|
|
2385
|
+
var TransactionError = class extends Error {
|
|
2386
|
+
constructor(message, txid, code, programIds, serializedTx) {
|
|
2387
|
+
super(message);
|
|
2388
|
+
this.name = "TransactionError";
|
|
2389
|
+
this.txid = txid;
|
|
2390
|
+
this.code = code;
|
|
2391
|
+
this.programIds = programIds;
|
|
2392
|
+
this.serializedTx = serializedTx;
|
|
2393
|
+
}
|
|
2394
|
+
};
|
|
2395
|
+
|
|
2396
|
+
// src/queries/useUltraSwapMutation.ts
|
|
2397
|
+
var UltraSwapError = class extends Error {
|
|
2398
|
+
constructor(message, type2, txid) {
|
|
2399
|
+
super(message);
|
|
2400
|
+
this.type = type2;
|
|
2401
|
+
this.txid = txid;
|
|
2402
|
+
}
|
|
2403
|
+
};
|
|
2404
|
+
function useUltraSwapMutation() {
|
|
2405
|
+
const { wallet, signTransaction } = useWalletPassThrough();
|
|
2406
|
+
return (0, import_react_query7.useMutation)({
|
|
2407
|
+
mutationFn: (_0) => __async(this, [_0], function* ({
|
|
2408
|
+
setTxStatus,
|
|
2409
|
+
setLastSwapResult,
|
|
2410
|
+
fromTokenInfo,
|
|
2411
|
+
toTokenInfo,
|
|
2412
|
+
quoteResponseMeta
|
|
2413
|
+
}) {
|
|
2414
|
+
const publicKey = wallet == null ? void 0 : wallet.adapter.publicKey;
|
|
2415
|
+
if (!signTransaction || !publicKey) {
|
|
2416
|
+
throw new UltraSwapError(
|
|
2417
|
+
"Wallet not connected, or missing wallet functions",
|
|
2418
|
+
"WALLET_SIGNING_FAILED" /* WALLET_SIGNING_FAILED */
|
|
2419
|
+
);
|
|
2420
|
+
}
|
|
2421
|
+
setTxStatus({
|
|
2422
|
+
txid: "",
|
|
2423
|
+
status: "pending-approval"
|
|
2424
|
+
});
|
|
2425
|
+
const selectedQuote = quoteResponseMeta.original;
|
|
2426
|
+
const { transaction, requestId } = selectedQuote;
|
|
2427
|
+
if (!transaction) throw new Error("Missing transaction");
|
|
2428
|
+
const based64tx = import_buffer.Buffer.from(transaction, "base64");
|
|
2429
|
+
const versionedTransaction = import_web34.VersionedTransaction.deserialize(new Uint8Array(based64tx));
|
|
2430
|
+
const signedTransaction = yield signTransaction(versionedTransaction);
|
|
2431
|
+
const serializedTransaction = import_buffer.Buffer.from(signedTransaction.serialize()).toString("base64");
|
|
2432
|
+
setTxStatus({
|
|
2433
|
+
txid: "",
|
|
2434
|
+
status: "sending"
|
|
2435
|
+
});
|
|
2436
|
+
const response = yield ultraSwapService.submitSwap(serializedTransaction, requestId);
|
|
2437
|
+
const { signature, status } = response;
|
|
2438
|
+
if (status === "Failed") {
|
|
2439
|
+
throw new UltraSwapError(response.error, "FAILED" /* FAILED */, signature);
|
|
2440
|
+
}
|
|
2441
|
+
const { inputAmountResult, outputAmountResult } = response;
|
|
2442
|
+
setTxStatus({
|
|
2443
|
+
txid: signature,
|
|
2444
|
+
status: "success"
|
|
2445
|
+
});
|
|
2446
|
+
setLastSwapResult({
|
|
2447
|
+
swapResult: {
|
|
2448
|
+
txid: signature,
|
|
2449
|
+
inputAddress: new import_web34.PublicKey(fromTokenInfo.id),
|
|
2450
|
+
outputAddress: new import_web34.PublicKey(toTokenInfo.id),
|
|
2451
|
+
inputAmount: Number(inputAmountResult),
|
|
2452
|
+
outputAmount: Number(outputAmountResult)
|
|
2453
|
+
},
|
|
2454
|
+
quoteReponse: quoteResponseMeta
|
|
2455
|
+
});
|
|
2456
|
+
return signature;
|
|
2457
|
+
}),
|
|
2458
|
+
onError: (error, variables) => __async(this, null, function* () {
|
|
2459
|
+
const { setTxStatus, setLastSwapResult, quoteResponseMeta } = variables;
|
|
2460
|
+
if (error instanceof import_wallet_adapter2.WalletSignTransactionError) {
|
|
2461
|
+
const message = error.message || error.error || "Transaction cancelled";
|
|
2462
|
+
setLastSwapResult({
|
|
2463
|
+
swapResult: {
|
|
2464
|
+
error: new TransactionError(message)
|
|
2465
|
+
},
|
|
2466
|
+
quoteReponse: quoteResponseMeta
|
|
2467
|
+
});
|
|
2468
|
+
return;
|
|
2469
|
+
}
|
|
2470
|
+
if (error instanceof Error) {
|
|
2471
|
+
setLastSwapResult({
|
|
2472
|
+
swapResult: {
|
|
2473
|
+
error: new TransactionError(error.message)
|
|
2474
|
+
},
|
|
2475
|
+
quoteReponse: quoteResponseMeta
|
|
2476
|
+
});
|
|
2477
|
+
return;
|
|
2478
|
+
}
|
|
2479
|
+
if ("json" in error) {
|
|
2480
|
+
const json = yield error.json();
|
|
2481
|
+
setLastSwapResult({
|
|
2482
|
+
swapResult: {
|
|
2483
|
+
error: new TransactionError(json.error || "Unknown error")
|
|
2484
|
+
},
|
|
2485
|
+
quoteReponse: quoteResponseMeta
|
|
2486
|
+
});
|
|
2487
|
+
setTxStatus({
|
|
2488
|
+
txid: json.txid || "",
|
|
2489
|
+
status: "fail"
|
|
2490
|
+
});
|
|
2491
|
+
}
|
|
2492
|
+
})
|
|
2493
|
+
});
|
|
2494
|
+
}
|
|
2495
|
+
|
|
2496
|
+
// src/components/SubmitButton.tsx
|
|
2497
|
+
var import_react18 = require("react");
|
|
2525
2498
|
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
2499
|
+
var SubmitButton = ({ onSubmit }) => {
|
|
2500
|
+
const {
|
|
2501
|
+
quoteResponseMeta,
|
|
2502
|
+
loading,
|
|
2503
|
+
errors,
|
|
2504
|
+
swapping: { txStatus },
|
|
2505
|
+
form
|
|
2506
|
+
} = useSwapContext();
|
|
2507
|
+
const shouldButtonDisabled = (0, import_react18.useMemo)(() => {
|
|
2508
|
+
if (!quoteResponseMeta || loading || !!errors.fromValue || (txStatus == null ? void 0 : txStatus.status) === "loading" || (txStatus == null ? void 0 : txStatus.status) === "sending" || (txStatus == null ? void 0 : txStatus.status) === "pending-approval") {
|
|
2509
|
+
return true;
|
|
2510
|
+
}
|
|
2511
|
+
return false;
|
|
2512
|
+
}, [quoteResponseMeta, loading, errors.fromValue, txStatus]);
|
|
2513
|
+
const buttonText = (0, import_react18.useMemo)(() => {
|
|
2514
|
+
var _a2;
|
|
2515
|
+
if (errors.fromValue) return errors.fromValue.title;
|
|
2516
|
+
if ((_a2 = quoteResponseMeta == null ? void 0 : quoteResponseMeta.quoteResponse) == null ? void 0 : _a2.errorMessage) return quoteResponseMeta.quoteResponse.errorMessage;
|
|
2517
|
+
if (loading) return "Loading";
|
|
2518
|
+
if ((txStatus == null ? void 0 : txStatus.status) === "sending") return "Sending";
|
|
2519
|
+
if ((txStatus == null ? void 0 : txStatus.status) === "pending-approval") return "Pending Approval";
|
|
2520
|
+
return "Swap";
|
|
2521
|
+
}, [txStatus, errors.fromValue, loading, quoteResponseMeta]);
|
|
2522
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
2523
|
+
JupButton_default,
|
|
2524
|
+
{
|
|
2525
|
+
size: "lg",
|
|
2526
|
+
className: cn("w-full mt-4 disabled:opacity-50 !text-uiv2-text/75 !bg-primary "),
|
|
2527
|
+
onClick: onSubmit,
|
|
2528
|
+
disabled: shouldButtonDisabled,
|
|
2529
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { children: buttonText })
|
|
2530
|
+
}
|
|
2531
|
+
);
|
|
2532
|
+
};
|
|
2533
|
+
|
|
2534
|
+
// src/components/Form.tsx
|
|
2535
|
+
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
2526
2536
|
var FormInputContainer = ({ tokenInfo, onBalanceClick, title, pairSelectDisabled, onClickSelectPair, children, value }) => {
|
|
2527
|
-
return /* @__PURE__ */ (0,
|
|
2537
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
2528
2538
|
"div",
|
|
2529
2539
|
{
|
|
2530
2540
|
className: cn(
|
|
@@ -2533,9 +2543,9 @@ var FormInputContainer = ({ tokenInfo, onBalanceClick, title, pairSelectDisabled
|
|
|
2533
2543
|
"group focus-within:border-primary/50 focus-within:shadow-swap-input-dark rounded-xl"
|
|
2534
2544
|
),
|
|
2535
2545
|
children: [
|
|
2536
|
-
/* @__PURE__ */ (0,
|
|
2537
|
-
/* @__PURE__ */ (0,
|
|
2538
|
-
tokenInfo && /* @__PURE__ */ (0,
|
|
2546
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex justify-between items-center text-xs text-primary-text", children: [
|
|
2547
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { children: title }),
|
|
2548
|
+
tokenInfo && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
2539
2549
|
"div",
|
|
2540
2550
|
{
|
|
2541
2551
|
className: cn("flex space-x-1 text-xs items-center text-primary-text/50 fill-current ", {
|
|
@@ -2545,16 +2555,16 @@ var FormInputContainer = ({ tokenInfo, onBalanceClick, title, pairSelectDisabled
|
|
|
2545
2555
|
onBalanceClick == null ? void 0 : onBalanceClick(e);
|
|
2546
2556
|
},
|
|
2547
2557
|
children: [
|
|
2548
|
-
/* @__PURE__ */ (0,
|
|
2549
|
-
/* @__PURE__ */ (0,
|
|
2550
|
-
/* @__PURE__ */ (0,
|
|
2558
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(WalletIcon_default, { width: 10, height: 10 }),
|
|
2559
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Coinbalance_default, { mintAddress: tokenInfo.id, hideZeroBalance: false }),
|
|
2560
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { children: tokenInfo.symbol })
|
|
2551
2561
|
]
|
|
2552
2562
|
}
|
|
2553
2563
|
)
|
|
2554
2564
|
] }),
|
|
2555
|
-
/* @__PURE__ */ (0,
|
|
2556
|
-
/* @__PURE__ */ (0,
|
|
2557
|
-
/* @__PURE__ */ (0,
|
|
2565
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex", children: [
|
|
2566
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { children: [
|
|
2567
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
2558
2568
|
"button",
|
|
2559
2569
|
{
|
|
2560
2570
|
type: "button",
|
|
@@ -2564,25 +2574,25 @@ var FormInputContainer = ({ tokenInfo, onBalanceClick, title, pairSelectDisabled
|
|
|
2564
2574
|
disabled: pairSelectDisabled,
|
|
2565
2575
|
onClick: onClickSelectPair,
|
|
2566
2576
|
children: [
|
|
2567
|
-
/* @__PURE__ */ (0,
|
|
2568
|
-
/* @__PURE__ */ (0,
|
|
2569
|
-
pairSelectDisabled ? null : /* @__PURE__ */ (0,
|
|
2577
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "h-5 w-5", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(TokenIcon_default, { info: tokenInfo, width: 20, height: 20 }) }),
|
|
2578
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "ml-4 mr-2 font-semibold", translate: "no", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "truncate", children: tokenInfo == null ? void 0 : tokenInfo.symbol }) }),
|
|
2579
|
+
pairSelectDisabled ? null : /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "text-primary-text/25 fill-current", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ChevronDownIcon_default, {}) })
|
|
2570
2580
|
]
|
|
2571
2581
|
}
|
|
2572
2582
|
),
|
|
2573
|
-
/* @__PURE__ */ (0,
|
|
2583
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "flex justify-between items-center h-[20px]", children: (tokenInfo == null ? void 0 : tokenInfo.id) && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(JupShield_default, { tokenAddress: tokenInfo.id }) })
|
|
2574
2584
|
] }),
|
|
2575
|
-
/* @__PURE__ */ (0,
|
|
2585
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex flex-col items-end justify-between w-full", children: [
|
|
2576
2586
|
children,
|
|
2577
|
-
/* @__PURE__ */ (0,
|
|
2587
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "text-xs text-primary-text/50", children: tokenInfo && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(CoinBalanceUSD, { tokenInfo, amount: value }) })
|
|
2578
2588
|
] })
|
|
2579
2589
|
] })
|
|
2580
2590
|
]
|
|
2581
2591
|
}
|
|
2582
2592
|
);
|
|
2583
2593
|
};
|
|
2584
|
-
var Form = ({
|
|
2585
|
-
const { publicKey } = useWalletPassThrough();
|
|
2594
|
+
var Form = ({ setSelectPairSelector }) => {
|
|
2595
|
+
const { publicKey, wallet } = useWalletPassThrough();
|
|
2586
2596
|
const { data: balances } = useBalances();
|
|
2587
2597
|
const {
|
|
2588
2598
|
form,
|
|
@@ -2592,19 +2602,32 @@ var Form = ({ onSubmit, isDisabled, setSelectPairSelector }) => {
|
|
|
2592
2602
|
quoteResponseMeta,
|
|
2593
2603
|
formProps: { fixedAmount, swapMode, fixedMint },
|
|
2594
2604
|
loading,
|
|
2595
|
-
refresh,
|
|
2596
|
-
quoteError,
|
|
2597
|
-
errors,
|
|
2598
2605
|
isToPairFocused,
|
|
2599
|
-
|
|
2606
|
+
setTxStatus,
|
|
2607
|
+
setLastSwapResult
|
|
2600
2608
|
} = useSwapContext();
|
|
2601
|
-
const [hasExpired, timeDiff] = useTimeDiff_default();
|
|
2602
2609
|
const { setScreen } = useScreenState();
|
|
2603
|
-
|
|
2604
|
-
|
|
2605
|
-
|
|
2610
|
+
const { mutateAsync: ultraSwapMutation } = useUltraSwapMutation();
|
|
2611
|
+
const onSubmit = (0, import_react19.useCallback)(() => __async(void 0, null, function* () {
|
|
2612
|
+
if (!wallet || !wallet.adapter.publicKey || !quoteResponseMeta) {
|
|
2613
|
+
return null;
|
|
2606
2614
|
}
|
|
2607
|
-
|
|
2615
|
+
try {
|
|
2616
|
+
if (!fromTokenInfo) throw new Error("Missing fromTokenInfo");
|
|
2617
|
+
if (!toTokenInfo) throw new Error("Missing toTokenInfo");
|
|
2618
|
+
yield ultraSwapMutation({
|
|
2619
|
+
quoteResponseMeta,
|
|
2620
|
+
fromTokenInfo,
|
|
2621
|
+
toTokenInfo,
|
|
2622
|
+
setTxStatus,
|
|
2623
|
+
setLastSwapResult
|
|
2624
|
+
});
|
|
2625
|
+
} catch (error) {
|
|
2626
|
+
console.log("Swap error", error);
|
|
2627
|
+
} finally {
|
|
2628
|
+
setScreen("Swapping");
|
|
2629
|
+
}
|
|
2630
|
+
}), [wallet, quoteResponseMeta, ultraSwapMutation, fromTokenInfo, toTokenInfo, setTxStatus, setLastSwapResult, setScreen]);
|
|
2608
2631
|
const shouldDisabledFromSelector = (0, import_react19.useMemo)(() => {
|
|
2609
2632
|
if ((fromTokenInfo == null ? void 0 : fromTokenInfo.id) === fixedMint) {
|
|
2610
2633
|
return true;
|
|
@@ -2704,15 +2727,9 @@ var Form = ({ onSubmit, isDisabled, setSelectPairSelector }) => {
|
|
|
2704
2727
|
},
|
|
2705
2728
|
[setScreen]
|
|
2706
2729
|
);
|
|
2707
|
-
|
|
2708
|
-
|
|
2709
|
-
|
|
2710
|
-
}
|
|
2711
|
-
return false;
|
|
2712
|
-
}, [isDisabled, loading, errors.fromValue]);
|
|
2713
|
-
return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "h-full flex flex-col items-center justify-center", children: [
|
|
2714
|
-
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "w-full mt-2 rounded-xl flex flex-col px-2", children: /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex-col", children: [
|
|
2715
|
-
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
2730
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "h-full flex flex-col items-center justify-center", children: [
|
|
2731
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "w-full mt-2 rounded-xl flex flex-col px-2", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex-col", children: [
|
|
2732
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
2716
2733
|
FormInputContainer,
|
|
2717
2734
|
{
|
|
2718
2735
|
tokenInfo: fromTokenInfo,
|
|
@@ -2724,7 +2741,7 @@ var Form = ({ onSubmit, isDisabled, setSelectPairSelector }) => {
|
|
|
2724
2741
|
pairSelectDisabled: shouldDisabledFromSelector,
|
|
2725
2742
|
onClickSelectPair: onClickSelectFromMint,
|
|
2726
2743
|
value: form.fromValue,
|
|
2727
|
-
children: (fromTokenInfo == null ? void 0 : fromTokenInfo.decimals) && /* @__PURE__ */ (0,
|
|
2744
|
+
children: (fromTokenInfo == null ? void 0 : fromTokenInfo.decimals) && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
2728
2745
|
import_react_number_format.NumericFormat,
|
|
2729
2746
|
{
|
|
2730
2747
|
disabled: fixedAmount || swapMode === SwapMode.ExactOut,
|
|
@@ -2751,8 +2768,8 @@ var Form = ({ onSubmit, isDisabled, setSelectPairSelector }) => {
|
|
|
2751
2768
|
)
|
|
2752
2769
|
}
|
|
2753
2770
|
),
|
|
2754
|
-
/* @__PURE__ */ (0,
|
|
2755
|
-
/* @__PURE__ */ (0,
|
|
2771
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "relative z-10 -my-3 flex justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(SwitchPairButton_default, { onClick: onClickSwitchPair, className: cn("transition-all") }) }),
|
|
2772
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
2756
2773
|
FormInputContainer,
|
|
2757
2774
|
{
|
|
2758
2775
|
tokenInfo: toTokenInfo,
|
|
@@ -2760,7 +2777,7 @@ var Form = ({ onSubmit, isDisabled, setSelectPairSelector }) => {
|
|
|
2760
2777
|
pairSelectDisabled: shouldDisabledToSelector,
|
|
2761
2778
|
onClickSelectPair: onClickSelectToMint,
|
|
2762
2779
|
value: form.toValue,
|
|
2763
|
-
children: (toTokenInfo == null ? void 0 : toTokenInfo.decimals) && /* @__PURE__ */ (0,
|
|
2780
|
+
children: (toTokenInfo == null ? void 0 : toTokenInfo.decimals) && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
2764
2781
|
import_react_number_format.NumericFormat,
|
|
2765
2782
|
{
|
|
2766
2783
|
inputMode: "decimal",
|
|
@@ -2791,21 +2808,9 @@ var Form = ({ onSubmit, isDisabled, setSelectPairSelector }) => {
|
|
|
2791
2808
|
}
|
|
2792
2809
|
)
|
|
2793
2810
|
] }) }),
|
|
2794
|
-
/* @__PURE__ */ (0,
|
|
2795
|
-
!walletPublicKey ? /* @__PURE__ */ (0,
|
|
2796
|
-
|
|
2797
|
-
{
|
|
2798
|
-
size: "lg",
|
|
2799
|
-
className: cn("w-full mt-4 disabled:opacity-50 !text-uiv2-text/75 !bg-primary "),
|
|
2800
|
-
onClick: () => {
|
|
2801
|
-
onSubmit();
|
|
2802
|
-
onSubmitUltra();
|
|
2803
|
-
},
|
|
2804
|
-
disabled: shouldButtonDisabled,
|
|
2805
|
-
children: loading ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { children: "Loading" }) : errors.fromValue ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { children: errors.fromValue.title }) : /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { children: "Swap" })
|
|
2806
|
-
}
|
|
2807
|
-
),
|
|
2808
|
-
quoteResponseMeta && fromTokenInfo && toTokenInfo ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
2811
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "w-full px-2", children: [
|
|
2812
|
+
!walletPublicKey ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(JupButton_default, { size: "lg", className: "w-full mt-4 bg-primary !text-uiv2-text/75", onClick: handleClick, children: "Connect Wallet" }) : /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(SubmitButton, { onSubmit }),
|
|
2813
|
+
quoteResponseMeta && fromTokenInfo && toTokenInfo ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
2809
2814
|
PriceInfo_default,
|
|
2810
2815
|
{
|
|
2811
2816
|
quoteResponse: quoteResponseMeta,
|
|
@@ -2825,9 +2830,9 @@ var import_react_virtualized_auto_sizer = __toESM(require("react-virtualized-aut
|
|
|
2825
2830
|
var import_react_window = require("react-window");
|
|
2826
2831
|
|
|
2827
2832
|
// src/icons/LeftArrowIcon.tsx
|
|
2828
|
-
var
|
|
2833
|
+
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
2829
2834
|
var LeftArrowIcon = ({ width = "12", height = "12" }) => {
|
|
2830
|
-
return /* @__PURE__ */ (0,
|
|
2835
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("svg", { width, height, viewBox: "0 0 53 52", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
2831
2836
|
"path",
|
|
2832
2837
|
{
|
|
2833
2838
|
d: "M17.3336 23.8334H43.7062V28.1667H17.3336L28.9555 39.7887L25.8919 42.8524L9.03955 26L25.8919 9.14771L28.9555 12.2114L17.3336 23.8334Z",
|
|
@@ -2838,9 +2843,9 @@ var LeftArrowIcon = ({ width = "12", height = "12" }) => {
|
|
|
2838
2843
|
var LeftArrowIcon_default = LeftArrowIcon;
|
|
2839
2844
|
|
|
2840
2845
|
// src/icons/SearchIcon.tsx
|
|
2841
|
-
var
|
|
2846
|
+
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
2842
2847
|
var SearchIcon = () => {
|
|
2843
|
-
return /* @__PURE__ */ (0,
|
|
2848
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "flex items-center text-primary-text fill-current", children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("svg", { width: "18", height: "18", viewBox: "0 0 18 18", fill: "inherit", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
2844
2849
|
"path",
|
|
2845
2850
|
{
|
|
2846
2851
|
d: "M7.30327 14.6058C8.75327 14.6074 10.1705 14.1746 11.3729 13.3637L15.5971 17.5871C16.1463 18.1371 17.0377 18.1371 17.5877 17.5871C18.1377 17.0371 18.1377 16.1457 17.5877 15.5964L13.3643 11.3722C14.5823 9.55661 14.9229 7.28943 14.2909 5.19563C13.6596 3.10183 12.1229 1.40183 10.1033 0.56283C8.08365 -0.276231 5.79385 -0.16607 3.86505 0.86283C1.93537 1.89251 0.569053 3.73243 0.140853 5.87683C-0.286487 8.02143 0.269759 10.2448 1.65725 11.9354C3.04397 13.6261 5.11665 14.6064 7.30325 14.6058H7.30327ZM7.30327 1.68943C8.79233 1.68865 10.2197 2.28005 11.2729 3.33319C12.3252 4.38631 12.9166 5.81359 12.9166 7.30279C12.9166 8.79199 12.3252 10.2192 11.2729 11.2724C10.2198 12.3247 8.79247 12.9162 7.30327 12.9162C5.81407 12.9162 4.38687 12.3247 3.33367 11.2724C2.28133 10.2193 1.68913 8.79199 1.68991 7.30279C1.69148 5.81451 2.28287 4.38719 3.33523 3.33479C4.38759 2.28239 5.81483 1.69103 7.30323 1.68947L7.30327 1.68943Z",
|
|
@@ -2860,7 +2865,7 @@ var import_decimal8 = __toESM(require("decimal.js"));
|
|
|
2860
2865
|
|
|
2861
2866
|
// src/contexts/preferredExplorer/index.tsx
|
|
2862
2867
|
var import_react20 = require("react");
|
|
2863
|
-
var
|
|
2868
|
+
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
2864
2869
|
var AVAILABLE_EXPLORER = [
|
|
2865
2870
|
{
|
|
2866
2871
|
name: "Solana Explorer",
|
|
@@ -2936,7 +2941,7 @@ var PreferredExplorerProvider = ({
|
|
|
2936
2941
|
(mint, cluster) => explorerObject.getToken(mint, cluster),
|
|
2937
2942
|
[explorerObject]
|
|
2938
2943
|
);
|
|
2939
|
-
return /* @__PURE__ */ (0,
|
|
2944
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
2940
2945
|
PreferredExplorerContext.Provider,
|
|
2941
2946
|
{
|
|
2942
2947
|
value: { explorer, getExplorer, getTokenExplorer, setExplorer: (explorer2) => setExplorer(explorer2) },
|
|
@@ -2950,8 +2955,8 @@ function usePreferredExplorer() {
|
|
|
2950
2955
|
}
|
|
2951
2956
|
|
|
2952
2957
|
// src/icons/ExternalIcon.tsx
|
|
2953
|
-
var
|
|
2954
|
-
var ExternalIcon = () => /* @__PURE__ */ (0,
|
|
2958
|
+
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
2959
|
+
var ExternalIcon = () => /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("svg", { width: "10", height: "10", viewBox: "0 0 10 10", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
2955
2960
|
"path",
|
|
2956
2961
|
{
|
|
2957
2962
|
d: "M4 2V3H1.5V8.5H7V6H8V9C8 9.13261 7.94732 9.25979 7.85355 9.35355C7.75979 9.44732 7.63261 9.5 7.5 9.5H1C0.867392 9.5 0.740215 9.44732 0.646447 9.35355C0.552678 9.25979 0.5 9.13261 0.5 9V2.5C0.5 2.36739 0.552678 2.24021 0.646447 2.14645C0.740215 2.05268 0.867392 2 1 2H4ZM9.5 0.5V4.5H8.5V2.2065L4.6035 6.1035L3.8965 5.3965L7.7925 1.5H5.5V0.5H9.5Z",
|
|
@@ -2961,10 +2966,10 @@ var ExternalIcon = () => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("svg", {
|
|
|
2961
2966
|
var ExternalIcon_default = ExternalIcon;
|
|
2962
2967
|
|
|
2963
2968
|
// src/components/TokenLink.tsx
|
|
2964
|
-
var
|
|
2969
|
+
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
2965
2970
|
var TokenLink = ({ tokenInfo, className }) => {
|
|
2966
2971
|
const { getTokenExplorer } = usePreferredExplorer();
|
|
2967
|
-
return /* @__PURE__ */ (0,
|
|
2972
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(
|
|
2968
2973
|
"a",
|
|
2969
2974
|
{
|
|
2970
2975
|
target: "_blank",
|
|
@@ -2976,8 +2981,8 @@ var TokenLink = ({ tokenInfo, className }) => {
|
|
|
2976
2981
|
href: getTokenExplorer(tokenInfo.id),
|
|
2977
2982
|
onClick: (e) => e.stopPropagation(),
|
|
2978
2983
|
children: [
|
|
2979
|
-
/* @__PURE__ */ (0,
|
|
2980
|
-
/* @__PURE__ */ (0,
|
|
2984
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: "text-xxs", children: shortenAddress(tokenInfo.id) }),
|
|
2985
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(ExternalIcon_default, {})
|
|
2981
2986
|
]
|
|
2982
2987
|
}
|
|
2983
2988
|
);
|
|
@@ -2986,9 +2991,9 @@ TokenLink.displayName = "TokenLink";
|
|
|
2986
2991
|
var TokenLink_default = TokenLink;
|
|
2987
2992
|
|
|
2988
2993
|
// src/components/CheckedBadge.tsx
|
|
2989
|
-
var
|
|
2994
|
+
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
2990
2995
|
var CheckedBadge = ({ width = 24, height = 24 }) => {
|
|
2991
|
-
return /* @__PURE__ */ (0,
|
|
2996
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(
|
|
2992
2997
|
"svg",
|
|
2993
2998
|
{
|
|
2994
2999
|
width,
|
|
@@ -2997,7 +3002,7 @@ var CheckedBadge = ({ width = 24, height = 24 }) => {
|
|
|
2997
3002
|
fill: "none",
|
|
2998
3003
|
xmlns: "http://www.w3.org/2000/svg",
|
|
2999
3004
|
children: [
|
|
3000
|
-
/* @__PURE__ */ (0,
|
|
3005
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
3001
3006
|
"path",
|
|
3002
3007
|
{
|
|
3003
3008
|
d: "M13.8179 4.54512L13.6275 4.27845C12.8298 3.16176 11.1702 3.16176 10.3725 4.27845L10.1821 4.54512C9.76092 5.13471 9.05384 5.45043 8.33373 5.37041L7.48471 5.27608C6.21088 5.13454 5.13454 6.21088 5.27608 7.48471L5.37041 8.33373C5.45043 9.05384 5.13471 9.76092 4.54512 10.1821L4.27845 10.3725C3.16176 11.1702 3.16176 12.8298 4.27845 13.6275L4.54512 13.8179C5.13471 14.2391 5.45043 14.9462 5.37041 15.6663L5.27608 16.5153C5.13454 17.7891 6.21088 18.8655 7.48471 18.7239L8.33373 18.6296C9.05384 18.5496 9.76092 18.8653 10.1821 19.4549L10.3725 19.7215C11.1702 20.8382 12.8298 20.8382 13.6275 19.7215L13.8179 19.4549C14.2391 18.8653 14.9462 18.5496 15.6663 18.6296L16.5153 18.7239C17.7891 18.8655 18.8655 17.7891 18.7239 16.5153L18.6296 15.6663C18.5496 14.9462 18.8653 14.2391 19.4549 13.8179L19.7215 13.6275C20.8382 12.8298 20.8382 11.1702 19.7215 10.3725L19.4549 10.1821C18.8653 9.76092 18.5496 9.05384 18.6296 8.33373L18.7239 7.48471C18.8655 6.21088 17.7891 5.13454 16.5153 5.27608L15.6663 5.37041C14.9462 5.45043 14.2391 5.13471 13.8179 4.54512Z",
|
|
@@ -3007,7 +3012,7 @@ var CheckedBadge = ({ width = 24, height = 24 }) => {
|
|
|
3007
3012
|
strokeLinejoin: "round"
|
|
3008
3013
|
}
|
|
3009
3014
|
),
|
|
3010
|
-
/* @__PURE__ */ (0,
|
|
3015
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
3011
3016
|
"path",
|
|
3012
3017
|
{
|
|
3013
3018
|
d: "M9 12L10.8189 13.8189V13.8189C10.9189 13.9189 11.0811 13.9189 11.1811 13.8189V13.8189L15 10",
|
|
@@ -3024,27 +3029,25 @@ var CheckedBadge = ({ width = 24, height = 24 }) => {
|
|
|
3024
3029
|
var CheckedBadge_default = CheckedBadge;
|
|
3025
3030
|
|
|
3026
3031
|
// src/queries/useLstApy.ts
|
|
3027
|
-
var
|
|
3032
|
+
var import_react_query8 = require("@tanstack/react-query");
|
|
3028
3033
|
function useLstApyFetcher() {
|
|
3029
|
-
return (0,
|
|
3030
|
-
["lst-apy"],
|
|
3031
|
-
() => __async(this, null, function* () {
|
|
3034
|
+
return (0, import_react_query8.useQuery)({
|
|
3035
|
+
queryKey: ["lst-apy"],
|
|
3036
|
+
queryFn: () => __async(this, null, function* () {
|
|
3032
3037
|
const lstApy = yield fetch(`https://worker.jup.ag/lst-apys`);
|
|
3033
3038
|
const apyResult = yield lstApy.json();
|
|
3034
3039
|
return apyResult;
|
|
3035
3040
|
}),
|
|
3036
|
-
|
|
3037
|
-
|
|
3038
|
-
|
|
3039
|
-
|
|
3040
|
-
|
|
3041
|
-
}
|
|
3042
|
-
);
|
|
3041
|
+
retry: 3,
|
|
3042
|
+
placeholderData: import_react_query8.keepPreviousData,
|
|
3043
|
+
staleTime: 3e5
|
|
3044
|
+
// 5m
|
|
3045
|
+
});
|
|
3043
3046
|
}
|
|
3044
3047
|
|
|
3045
3048
|
// src/components/FormPairRow.tsx
|
|
3046
|
-
var
|
|
3047
|
-
var
|
|
3049
|
+
var import_react_query9 = require("@tanstack/react-query");
|
|
3050
|
+
var import_jsx_runtime39 = require("react/jsx-runtime");
|
|
3048
3051
|
var PAIR_ROW_HEIGHT = 72;
|
|
3049
3052
|
var LSTTag = ({ mintAddress }) => {
|
|
3050
3053
|
const { data: lstApy } = useLstApyFetcher();
|
|
@@ -3056,7 +3059,7 @@ var LSTTag = ({ mintAddress }) => {
|
|
|
3056
3059
|
}
|
|
3057
3060
|
return;
|
|
3058
3061
|
}, [lstApy, mintAddress]);
|
|
3059
|
-
return /* @__PURE__ */ (0,
|
|
3062
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("p", { className: "rounded-md text-xxs leading-none transition-all py-0.5 px-1 text-primary/50 border border-primary/50 font-semibold", children: [
|
|
3060
3063
|
"LST ",
|
|
3061
3064
|
apy ? `${apy}%` : ""
|
|
3062
3065
|
] });
|
|
@@ -3092,10 +3095,10 @@ var MultiTags = ({ item }) => {
|
|
|
3092
3095
|
const remainingTags = [];
|
|
3093
3096
|
if (!renderedTag) return null;
|
|
3094
3097
|
const { isToken2022, isFrozen, isLST } = renderedTag;
|
|
3095
|
-
return /* @__PURE__ */ (0,
|
|
3096
|
-
isFrozen && /* @__PURE__ */ (0,
|
|
3097
|
-
isToken2022 && /* @__PURE__ */ (0,
|
|
3098
|
-
remainingTags == null ? void 0 : remainingTags.map((tag, idx) => /* @__PURE__ */ (0,
|
|
3098
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "flex justify-end gap-x-1", children: [
|
|
3099
|
+
isFrozen && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("p", { className: "border rounded-md text-xxs leading-none transition-all py-0.5 px-1 border-warning/50 text-warning/50", children: "Frozen" }),
|
|
3100
|
+
isToken2022 && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("p", { className: "rounded-md text-xxs leading-none transition-all py-0.5 px-1 bg-black/10 font-semibold text-primary-text/20", children: "Token2022" }),
|
|
3101
|
+
remainingTags == null ? void 0 : remainingTags.map((tag, idx) => /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
3099
3102
|
"div",
|
|
3100
3103
|
{
|
|
3101
3104
|
className: "rounded-md text-xxs leading-none transition-all py-0.5 px-1 bg-black/10 font-semibold text-primary-text/20",
|
|
@@ -3103,7 +3106,7 @@ var MultiTags = ({ item }) => {
|
|
|
3103
3106
|
},
|
|
3104
3107
|
idx
|
|
3105
3108
|
)),
|
|
3106
|
-
isLST && /* @__PURE__ */ (0,
|
|
3109
|
+
isLST && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(LSTTag, { mintAddress: item.id })
|
|
3107
3110
|
] });
|
|
3108
3111
|
};
|
|
3109
3112
|
var FormPairRow = (props) => {
|
|
@@ -3116,7 +3119,7 @@ var FormPairRow = (props) => {
|
|
|
3116
3119
|
showExplorer = true,
|
|
3117
3120
|
enableUnknownTokenWarning = true
|
|
3118
3121
|
} = props;
|
|
3119
|
-
const queryClient = (0,
|
|
3122
|
+
const queryClient = (0, import_react_query9.useQueryClient)();
|
|
3120
3123
|
const onClick = import_react21.default.useCallback(() => {
|
|
3121
3124
|
queryClient.setQueryData([...ASSET_QUERY_KEY, item.id], [item]);
|
|
3122
3125
|
onSubmit(item);
|
|
@@ -3126,27 +3129,27 @@ var FormPairRow = (props) => {
|
|
|
3126
3129
|
const balance = (_a2 = balances == null ? void 0 : balances[item.id]) == null ? void 0 : _a2.uiAmount;
|
|
3127
3130
|
const usdValue = balance ? new import_decimal8.default(balance).mul(item.usdPrice || 0) : void 0;
|
|
3128
3131
|
const usdValueDisplay = usdValue && usdValue.gte(0.01) ? `$${formatNumber.format(usdValue, 2)}` : "";
|
|
3129
|
-
return /* @__PURE__ */ (0,
|
|
3132
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
3130
3133
|
"li",
|
|
3131
3134
|
{
|
|
3132
3135
|
className: `rounded cursor-pointer px-5 my-1 list-none flex w-full items-center bg-interactive hover:bg-interactive/80`,
|
|
3133
3136
|
style: __spreadValues({ maxHeight: PAIR_ROW_HEIGHT - 4, height: PAIR_ROW_HEIGHT - 4 }, style),
|
|
3134
3137
|
onClick,
|
|
3135
3138
|
translate: "no",
|
|
3136
|
-
children: /* @__PURE__ */ (0,
|
|
3137
|
-
/* @__PURE__ */ (0,
|
|
3138
|
-
/* @__PURE__ */ (0,
|
|
3139
|
-
/* @__PURE__ */ (0,
|
|
3140
|
-
/* @__PURE__ */ (0,
|
|
3141
|
-
checkIsStrictOrVerified(item) && /* @__PURE__ */ (0,
|
|
3139
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "flex h-full w-full items-center space-x-4", children: [
|
|
3140
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: "flex-shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: "bg-gray-200 rounded-full", children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(TokenIcon_default, { info: item, width: 36, height: 36, enableUnknownTokenWarning }) }) }),
|
|
3141
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: "flex-1 min-w-0", children: /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "flex flex-col gap-y-px", children: [
|
|
3142
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "flex items-center", children: [
|
|
3143
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("p", { className: "text-sm font-medium text-primary-text truncate", children: item.symbol }),
|
|
3144
|
+
checkIsStrictOrVerified(item) && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("p", { className: "rounded-md text-xxs leading-none transition-all py-0.5 px-1 text-primary", children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(CheckedBadge_default, { width: 18, height: 18 }) })
|
|
3142
3145
|
] }),
|
|
3143
|
-
/* @__PURE__ */ (0,
|
|
3144
|
-
showExplorer ? /* @__PURE__ */ (0,
|
|
3146
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("p", { className: "text-xs text-primary-text/50 dark:text-primary-text-35 truncate", children: item.id === WRAPPED_SOL_MINT.toBase58() ? "Solana" : item.name }),
|
|
3147
|
+
showExplorer ? /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: "-ml-1 z-10 w-fit", onClick: (e) => e.stopPropagation(), children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(TokenLink_default, { tokenInfo: item }) }) : null
|
|
3145
3148
|
] }) }),
|
|
3146
|
-
/* @__PURE__ */ (0,
|
|
3147
|
-
/* @__PURE__ */ (0,
|
|
3148
|
-
usdValueDisplay ? /* @__PURE__ */ (0,
|
|
3149
|
-
/* @__PURE__ */ (0,
|
|
3149
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "text-xs text-primary-text/50 text-right h-full flex flex-col justify-evenly", children: [
|
|
3150
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Coinbalance_default, { mintAddress: item.id, hideZeroBalance: true }),
|
|
3151
|
+
usdValueDisplay ? /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("p", { children: usdValueDisplay }) : null,
|
|
3152
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(MultiTags, __spreadValues({}, props))
|
|
3150
3153
|
] })
|
|
3151
3154
|
] })
|
|
3152
3155
|
}
|
|
@@ -3156,12 +3159,12 @@ var FormPairRow_default = FormPairRow;
|
|
|
3156
3159
|
|
|
3157
3160
|
// src/hooks/useSearch.ts
|
|
3158
3161
|
var import_react22 = require("react");
|
|
3159
|
-
var
|
|
3162
|
+
var import_react_query10 = require("@tanstack/react-query");
|
|
3160
3163
|
var CHUNK_SIZE = 100;
|
|
3161
3164
|
var useSearch = (mintAddresses, options = {}) => {
|
|
3162
3165
|
var _a2, _b;
|
|
3163
3166
|
const mintAddressesString = (0, import_react22.useMemo)(() => mintAddresses.join(","), [mintAddresses]);
|
|
3164
|
-
return (0,
|
|
3167
|
+
return (0, import_react_query10.useQuery)({
|
|
3165
3168
|
queryKey: ["search", mintAddressesString],
|
|
3166
3169
|
queryFn: () => __async(void 0, null, function* () {
|
|
3167
3170
|
if (mintAddresses.length === 0) {
|
|
@@ -3183,13 +3186,13 @@ var useSearch = (mintAddresses, options = {}) => {
|
|
|
3183
3186
|
};
|
|
3184
3187
|
|
|
3185
3188
|
// src/components/FormPairSelector.tsx
|
|
3186
|
-
var
|
|
3189
|
+
var import_jsx_runtime40 = require("react/jsx-runtime");
|
|
3187
3190
|
var PAIR_ROW_HEIGHT2 = 72;
|
|
3188
3191
|
var SEARCH_BOX_HEIGHT = 56;
|
|
3189
3192
|
var rowRenderer = (0, import_react23.memo)((props) => {
|
|
3190
3193
|
const { data, index, style } = props;
|
|
3191
3194
|
const item = data.searchResult[index];
|
|
3192
|
-
return /* @__PURE__ */ (0,
|
|
3195
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(FormPairRow_default, { item, style, onSubmit: data.onSubmit }, item.address);
|
|
3193
3196
|
}, import_react_window.areEqual);
|
|
3194
3197
|
var FormPairSelector = ({ onSubmit, onClose }) => {
|
|
3195
3198
|
const [search, setSearch] = (0, import_react23.useState)("");
|
|
@@ -3223,20 +3226,20 @@ var FormPairSelector = ({ onSubmit, onClose }) => {
|
|
|
3223
3226
|
var _a2;
|
|
3224
3227
|
return (_a2 = inputRef.current) == null ? void 0 : _a2.focus();
|
|
3225
3228
|
}, [inputRef]);
|
|
3226
|
-
return /* @__PURE__ */ (0,
|
|
3227
|
-
/* @__PURE__ */ (0,
|
|
3228
|
-
/* @__PURE__ */ (0,
|
|
3229
|
-
/* @__PURE__ */ (0,
|
|
3230
|
-
/* @__PURE__ */ (0,
|
|
3229
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "flex flex-col h-full w-full py-4 px-2 bg-black", children: [
|
|
3230
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "flex w-full justify-between", children: [
|
|
3231
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "text-primary-text fill-current w-6 h-6 cursor-pointer", onClick: onClose, children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(LeftArrowIcon_default, { width: 24, height: 24 }) }),
|
|
3232
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "text-primary-text", children: "Select Token" }),
|
|
3233
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: " w-6 h-6" })
|
|
3231
3234
|
] }),
|
|
3232
|
-
/* @__PURE__ */ (0,
|
|
3235
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(
|
|
3233
3236
|
"div",
|
|
3234
3237
|
{
|
|
3235
3238
|
className: "flex px-5 mt-4 w-[98%] rounded-xl bg-module",
|
|
3236
3239
|
style: { height: SEARCH_BOX_HEIGHT, maxHeight: SEARCH_BOX_HEIGHT },
|
|
3237
3240
|
children: [
|
|
3238
|
-
/* @__PURE__ */ (0,
|
|
3239
|
-
/* @__PURE__ */ (0,
|
|
3241
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(SearchIcon_default, {}),
|
|
3242
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
3240
3243
|
"input",
|
|
3241
3244
|
{
|
|
3242
3245
|
autoComplete: "off",
|
|
@@ -3249,9 +3252,9 @@ var FormPairSelector = ({ onSubmit, onClose }) => {
|
|
|
3249
3252
|
]
|
|
3250
3253
|
}
|
|
3251
3254
|
),
|
|
3252
|
-
/* @__PURE__ */ (0,
|
|
3253
|
-
searchResult && searchResult.length > 0 && /* @__PURE__ */ (0,
|
|
3254
|
-
return /* @__PURE__ */ (0,
|
|
3255
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "mt-2", style: { flexGrow: 1 }, children: [
|
|
3256
|
+
searchResult && searchResult.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_react_virtualized_auto_sizer.default, { children: ({ height, width }) => {
|
|
3257
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
3255
3258
|
import_react_window.FixedSizeList,
|
|
3256
3259
|
{
|
|
3257
3260
|
ref: listRef,
|
|
@@ -3268,48 +3271,17 @@ var FormPairSelector = ({ onSubmit, onClose }) => {
|
|
|
3268
3271
|
}
|
|
3269
3272
|
);
|
|
3270
3273
|
} }),
|
|
3271
|
-
isLoading ? /* @__PURE__ */ (0,
|
|
3274
|
+
isLoading ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "mt-4 mb-4 text-center text-primary-text/50", children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { children: "Loading..." }) }) : searchResult && searchResult.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "mt-4 mb-4 text-center text-primary-text/50", children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { children: "No tokens found" }) }) : /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_jsx_runtime40.Fragment, {})
|
|
3272
3275
|
] })
|
|
3273
3276
|
] });
|
|
3274
3277
|
};
|
|
3275
3278
|
var FormPairSelector_default = FormPairSelector;
|
|
3276
3279
|
|
|
3277
3280
|
// src/components/screens/InitialScreen.tsx
|
|
3278
|
-
var
|
|
3279
|
-
var import_jsx_runtime40 = require("react/jsx-runtime");
|
|
3281
|
+
var import_jsx_runtime41 = require("react/jsx-runtime");
|
|
3280
3282
|
var InitialScreen = () => {
|
|
3281
|
-
const {
|
|
3282
|
-
const {
|
|
3283
|
-
form,
|
|
3284
|
-
setForm,
|
|
3285
|
-
setErrors,
|
|
3286
|
-
quoteResponseMeta,
|
|
3287
|
-
loading
|
|
3288
|
-
} = useSwapContext();
|
|
3289
|
-
const { setScreen } = useScreenState();
|
|
3290
|
-
const balance = (0, import_react24.useMemo)(() => {
|
|
3291
|
-
var _a2;
|
|
3292
|
-
if (!balances) return 0;
|
|
3293
|
-
return ((_a2 = balances[form.fromMint]) == null ? void 0 : _a2.uiAmount) || 0;
|
|
3294
|
-
}, [balances, form.fromMint]);
|
|
3283
|
+
const { form, setForm, loading } = useSwapContext();
|
|
3295
3284
|
const [isDisabled, setIsDisabled] = (0, import_react24.useState)(false);
|
|
3296
|
-
const { data: asset } = useAsset(form.fromMint);
|
|
3297
|
-
(0, import_react24.useEffect)(() => {
|
|
3298
|
-
if (!form.fromValue || !form.fromMint || !form.toMint || !form.toValue || !quoteResponseMeta || loading) {
|
|
3299
|
-
setErrors({});
|
|
3300
|
-
setIsDisabled(true);
|
|
3301
|
-
return;
|
|
3302
|
-
}
|
|
3303
|
-
if (new import_decimal9.default(form.fromValue).gt(balance)) {
|
|
3304
|
-
setErrors({
|
|
3305
|
-
fromValue: { title: `Insufficient ${asset == null ? void 0 : asset.symbol}`, message: "" }
|
|
3306
|
-
});
|
|
3307
|
-
setIsDisabled(true);
|
|
3308
|
-
return;
|
|
3309
|
-
}
|
|
3310
|
-
setErrors({});
|
|
3311
|
-
setIsDisabled(false);
|
|
3312
|
-
}, [form, asset, balance, quoteResponseMeta, loading, setErrors]);
|
|
3313
3285
|
const [selectPairSelector, setSelectPairSelector] = (0, import_react24.useState)(null);
|
|
3314
3286
|
const onSelectMint = (0, import_react24.useCallback)(
|
|
3315
3287
|
(tokenInfo) => __async(void 0, null, function* () {
|
|
@@ -3328,128 +3300,28 @@ var InitialScreen = () => {
|
|
|
3328
3300
|
}),
|
|
3329
3301
|
[selectPairSelector, setForm]
|
|
3330
3302
|
);
|
|
3331
|
-
|
|
3332
|
-
|
|
3333
|
-
}, [setScreen]);
|
|
3334
|
-
return /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(import_jsx_runtime40.Fragment, { children: [
|
|
3335
|
-
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
3303
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(import_jsx_runtime41.Fragment, { children: [
|
|
3304
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
3336
3305
|
"form",
|
|
3337
3306
|
{
|
|
3338
|
-
onSubmit: onSubmitToConfirmation,
|
|
3339
3307
|
className: cn({
|
|
3340
3308
|
hidden: Boolean(selectPairSelector)
|
|
3341
3309
|
}),
|
|
3342
|
-
children: /* @__PURE__ */ (0,
|
|
3343
|
-
Form_default,
|
|
3344
|
-
{
|
|
3345
|
-
onSubmit: onSubmitToConfirmation,
|
|
3346
|
-
isDisabled,
|
|
3347
|
-
setSelectPairSelector
|
|
3348
|
-
}
|
|
3349
|
-
)
|
|
3310
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Form_default, { isDisabled, setSelectPairSelector })
|
|
3350
3311
|
}
|
|
3351
3312
|
),
|
|
3352
|
-
selectPairSelector !== null ? /* @__PURE__ */ (0,
|
|
3353
|
-
FormPairSelector_default,
|
|
3354
|
-
{
|
|
3355
|
-
onSubmit: onSelectMint,
|
|
3356
|
-
onClose: () => setSelectPairSelector(null)
|
|
3357
|
-
}
|
|
3358
|
-
) }) : null
|
|
3313
|
+
selectPairSelector !== null ? /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: "absolute top-0 left-0 h-full w-full bg-black rounded-lg overflow-hidden", children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(FormPairSelector_default, { onSubmit: onSelectMint, onClose: () => setSelectPairSelector(null) }) }) : null
|
|
3359
3314
|
] });
|
|
3360
3315
|
};
|
|
3361
3316
|
var InitialScreen_default = InitialScreen;
|
|
3362
3317
|
|
|
3363
|
-
// src/components/screens/ReviewOrderScreen.tsx
|
|
3364
|
-
var import_react25 = require("react");
|
|
3365
|
-
var import_jsx_runtime41 = require("react/jsx-runtime");
|
|
3366
|
-
var ConfirmationScreen = () => {
|
|
3367
|
-
const {
|
|
3368
|
-
fromTokenInfo,
|
|
3369
|
-
toTokenInfo,
|
|
3370
|
-
onSubmit: onSubmitJupiter,
|
|
3371
|
-
quoteResponseMeta,
|
|
3372
|
-
loading,
|
|
3373
|
-
refresh
|
|
3374
|
-
} = useSwapContext();
|
|
3375
|
-
const [hasExpired] = useTimeDiff_default();
|
|
3376
|
-
const { setScreen } = useScreenState();
|
|
3377
|
-
const onGoBack = () => {
|
|
3378
|
-
refresh();
|
|
3379
|
-
setScreen("Initial");
|
|
3380
|
-
};
|
|
3381
|
-
const onSubmit = (0, import_react25.useCallback)(() => __async(void 0, null, function* () {
|
|
3382
|
-
setScreen("Swapping");
|
|
3383
|
-
onSubmitJupiter();
|
|
3384
|
-
}), [onSubmitJupiter, setScreen]);
|
|
3385
|
-
return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: "flex flex-col h-full w-full py-4 px-2", children: [
|
|
3386
|
-
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: "flex w-full justify-between", children: [
|
|
3387
|
-
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: "text-primary-text fill-current w-6 h-6 cursor-pointer", onClick: onGoBack, children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(LeftArrowIcon_default, { width: 24, height: 24 }) }),
|
|
3388
|
-
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: "text-primary-text", children: "Review Order" }),
|
|
3389
|
-
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: " w-6 h-6" })
|
|
3390
|
-
] }),
|
|
3391
|
-
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { children: quoteResponseMeta && fromTokenInfo && toTokenInfo ? /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
3392
|
-
PriceInfo_default,
|
|
3393
|
-
{
|
|
3394
|
-
quoteResponse: quoteResponseMeta,
|
|
3395
|
-
fromTokenInfo,
|
|
3396
|
-
toTokenInfo,
|
|
3397
|
-
loading,
|
|
3398
|
-
containerClassName: "bg-modiu; border-none"
|
|
3399
|
-
}
|
|
3400
|
-
) : null }),
|
|
3401
|
-
hasExpired ? /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(JupButton_default, { size: "lg", className: "w-full mt-4 disabled:opacity-50 !p-0", onClick: onGoBack, children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("span", { className: "text-sm", children: "Refresh" }) }) : /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
3402
|
-
JupButton_default,
|
|
3403
|
-
{
|
|
3404
|
-
size: "lg",
|
|
3405
|
-
className: cn(
|
|
3406
|
-
"w-full mt-4 disabled:opacity-50 !text-uiv2-text/75 leading-none !max-h-14 bg-gradient-to-r from-[#00BEF0] to-[#C7F284]"
|
|
3407
|
-
),
|
|
3408
|
-
onClick: onSubmit,
|
|
3409
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("span", { children: "Confirm" })
|
|
3410
|
-
}
|
|
3411
|
-
)
|
|
3412
|
-
] });
|
|
3413
|
-
};
|
|
3414
|
-
var ReviewOrderScreen_default = ConfirmationScreen;
|
|
3415
|
-
|
|
3416
3318
|
// src/components/screens/SwappingScreen.tsx
|
|
3417
|
-
var
|
|
3418
|
-
|
|
3419
|
-
// src/components/Spinner/index.tsx
|
|
3420
|
-
var import_jsx_runtime42 = require("react/jsx-runtime");
|
|
3421
|
-
var Spinner = ({
|
|
3422
|
-
className,
|
|
3423
|
-
baseColor = "currentColor",
|
|
3424
|
-
spinnerColor = "currentColor",
|
|
3425
|
-
width = 16,
|
|
3426
|
-
height = 16
|
|
3427
|
-
}) => /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: `rounded-full flex items-center justify-center ${className}`, style: { width, height }, children: /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
|
|
3428
|
-
"svg",
|
|
3429
|
-
{
|
|
3430
|
-
className: "animate-spin h-5 w-5 text-black dark:text-primary-text",
|
|
3431
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
3432
|
-
fill: "none",
|
|
3433
|
-
viewBox: "0 0 24 24",
|
|
3434
|
-
children: [
|
|
3435
|
-
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("circle", { className: "opacity-25", cx: "12", cy: "12", r: "10", stroke: baseColor, strokeWidth: "4" }),
|
|
3436
|
-
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
3437
|
-
"path",
|
|
3438
|
-
{
|
|
3439
|
-
className: "opacity-75",
|
|
3440
|
-
fill: spinnerColor,
|
|
3441
|
-
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"
|
|
3442
|
-
}
|
|
3443
|
-
)
|
|
3444
|
-
]
|
|
3445
|
-
}
|
|
3446
|
-
) });
|
|
3447
|
-
var Spinner_default = Spinner;
|
|
3319
|
+
var import_react25 = require("react");
|
|
3448
3320
|
|
|
3449
3321
|
// src/icons/SuccessIcon.tsx
|
|
3450
|
-
var
|
|
3322
|
+
var import_jsx_runtime42 = require("react/jsx-runtime");
|
|
3451
3323
|
var SuccessIcon = (props) => {
|
|
3452
|
-
return /* @__PURE__ */ (0,
|
|
3324
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("svg", __spreadProps(__spreadValues({ xmlns: "http://www.w3.org/2000/svg", width: "256", height: "256", viewBox: "0 0 256 256" }, props), { children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
3453
3325
|
"path",
|
|
3454
3326
|
{
|
|
3455
3327
|
fill: "currentColor",
|
|
@@ -3460,19 +3332,19 @@ var SuccessIcon = (props) => {
|
|
|
3460
3332
|
var SuccessIcon_default = SuccessIcon;
|
|
3461
3333
|
|
|
3462
3334
|
// src/components/screens/SwappingScreen.tsx
|
|
3463
|
-
var
|
|
3335
|
+
var import_jsx_runtime43 = require("react/jsx-runtime");
|
|
3464
3336
|
var ErrorIcon = () => {
|
|
3465
|
-
return /* @__PURE__ */ (0,
|
|
3466
|
-
/* @__PURE__ */ (0,
|
|
3467
|
-
/* @__PURE__ */ (0,
|
|
3468
|
-
/* @__PURE__ */ (0,
|
|
3337
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("svg", { width: "40", height: "40", viewBox: "0 0 40 40", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
|
|
3338
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("g", { clipPath: "url(#clip0_7547_116874)", children: [
|
|
3339
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("circle", { cx: "20", cy: "20", r: "20", fill: "#F04A44" }),
|
|
3340
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
3469
3341
|
"path",
|
|
3470
3342
|
{
|
|
3471
3343
|
d: "M19.8444 25.4321C18.6773 25.4332 17.7205 24.5092 17.6793 23.3431L17.1718 9.04107C17.1507 8.45326 17.3706 7.88344 17.7786 7.46056C18.1867 7.03768 18.7492 6.7998 19.337 6.7998H20.3519C20.9397 6.7998 21.5021 7.03768 21.9102 7.46056C22.3183 7.88344 22.5382 8.45329 22.5171 9.04107L22.0096 23.3431C21.9684 24.5092 21.0116 25.4332 19.8444 25.4321Z",
|
|
3472
3344
|
fill: "white"
|
|
3473
3345
|
}
|
|
3474
3346
|
),
|
|
3475
|
-
/* @__PURE__ */ (0,
|
|
3347
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
3476
3348
|
"path",
|
|
3477
3349
|
{
|
|
3478
3350
|
d: "M22.8893 30.4989C22.8893 32.1809 21.5266 33.5436 19.8446 33.5436C18.1626 33.5436 16.7998 32.1809 16.7998 30.4989C16.7998 28.8169 18.1626 27.4541 19.8446 27.4541C21.5266 27.4541 22.8893 28.8169 22.8893 30.4989Z",
|
|
@@ -3480,7 +3352,7 @@ var ErrorIcon = () => {
|
|
|
3480
3352
|
}
|
|
3481
3353
|
)
|
|
3482
3354
|
] }),
|
|
3483
|
-
/* @__PURE__ */ (0,
|
|
3355
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("clipPath", { id: "clip0_7547_116874", children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("rect", { width: "40", height: "40", fill: "white" }) }) })
|
|
3484
3356
|
] });
|
|
3485
3357
|
};
|
|
3486
3358
|
var SwappingScreen = () => {
|
|
@@ -3494,7 +3366,7 @@ var SwappingScreen = () => {
|
|
|
3494
3366
|
refresh
|
|
3495
3367
|
} = useSwapContext();
|
|
3496
3368
|
const { screen: screen2, setScreen } = useScreenState();
|
|
3497
|
-
const [errorMessage, setErrorMessage] = (0,
|
|
3369
|
+
const [errorMessage, setErrorMessage] = (0, import_react25.useState)("");
|
|
3498
3370
|
const onSwapMore = () => {
|
|
3499
3371
|
reset();
|
|
3500
3372
|
setErrorMessage("");
|
|
@@ -3507,7 +3379,7 @@ var SwappingScreen = () => {
|
|
|
3507
3379
|
setScreen("Initial");
|
|
3508
3380
|
refresh();
|
|
3509
3381
|
};
|
|
3510
|
-
(0,
|
|
3382
|
+
(0, import_react25.useEffect)(() => {
|
|
3511
3383
|
var _a2, _b, _c, _d;
|
|
3512
3384
|
if (screen2 !== "Swapping") return;
|
|
3513
3385
|
if ((lastSwapResult == null ? void 0 : lastSwapResult.swapResult) && "error" in (lastSwapResult == null ? void 0 : lastSwapResult.swapResult)) {
|
|
@@ -3538,23 +3410,8 @@ var SwappingScreen = () => {
|
|
|
3538
3410
|
setScreen("Initial");
|
|
3539
3411
|
};
|
|
3540
3412
|
const { explorer, getExplorer } = usePreferredExplorer();
|
|
3541
|
-
const isLoading = (txStatus == null ? void 0 : txStatus.status) === "loading" || (txStatus == null ? void 0 : txStatus.status) === "pending-approval" || (txStatus == null ? void 0 : txStatus.status) === "sending";
|
|
3542
|
-
const Content2 = () => {
|
|
3543
|
-
return /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_jsx_runtime44.Fragment, { children: [
|
|
3544
|
-
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: "flex w-full justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: "text-primary-text", children: "Swapping" }) }),
|
|
3545
|
-
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: "flex w-full justify-center items-center mt-9", children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: "h-16 w-16 animate-hue duration-100", children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(JupiterLogo_default, { width: 64, height: 64 }) }) }),
|
|
3546
|
-
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: "flex flex-col w-full justify-center items-center px-5 mt-7", children: isLoading && /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { className: "flex items-center w-full rounded-xl p-4 bg-module mb-2", children: [
|
|
3547
|
-
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(Spinner_default, { spinnerColor: "white" }),
|
|
3548
|
-
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: "ml-4 flex w-full justify-between", children: /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("span", { className: "text-primary-text text-sm", children: [
|
|
3549
|
-
txStatus.status === "loading" && "Preparing transactions",
|
|
3550
|
-
txStatus.status === "pending-approval" && "Pending Approval",
|
|
3551
|
-
txStatus.status === "sending" && "Swapping"
|
|
3552
|
-
] }) })
|
|
3553
|
-
] }) })
|
|
3554
|
-
] });
|
|
3555
|
-
};
|
|
3556
3413
|
const SuccessContent = () => {
|
|
3557
|
-
const { inputAmount, outputAmount, explorerLink } = (0,
|
|
3414
|
+
const { inputAmount, outputAmount, explorerLink } = (0, import_react25.useMemo)(() => {
|
|
3558
3415
|
return {
|
|
3559
3416
|
inputAmount: (lastSwapResult == null ? void 0 : lastSwapResult.swapResult) && "inputAmount" in (lastSwapResult == null ? void 0 : lastSwapResult.swapResult) ? lastSwapResult == null ? void 0 : lastSwapResult.swapResult.inputAmount : 0,
|
|
3560
3417
|
outputAmount: (lastSwapResult == null ? void 0 : lastSwapResult.swapResult) && "outputAmount" in (lastSwapResult == null ? void 0 : lastSwapResult.swapResult) ? lastSwapResult == null ? void 0 : lastSwapResult.swapResult.outputAmount : 0,
|
|
@@ -3564,28 +3421,28 @@ var SwappingScreen = () => {
|
|
|
3564
3421
|
if (!fromTokenInfo || !toTokenInfo || !(lastSwapResult == null ? void 0 : lastSwapResult.quoteReponse)) {
|
|
3565
3422
|
return null;
|
|
3566
3423
|
}
|
|
3567
|
-
return /* @__PURE__ */ (0,
|
|
3568
|
-
/* @__PURE__ */ (0,
|
|
3569
|
-
/* @__PURE__ */ (0,
|
|
3570
|
-
/* @__PURE__ */ (0,
|
|
3424
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(import_jsx_runtime43.Fragment, { children: [
|
|
3425
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: "flex justify-center mt-8", children: /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: " flex justify-center relative items-center", children: [
|
|
3426
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: "bg-success bg-opacity-[15%] animate-pulse h-[60px] w-[60px] rounded-full" }),
|
|
3427
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: "rounded-full absolute justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(SuccessIcon_default, { className: "text-success", height: 56, width: 56 }) })
|
|
3571
3428
|
] }) }),
|
|
3572
|
-
/* @__PURE__ */ (0,
|
|
3573
|
-
/* @__PURE__ */ (0,
|
|
3574
|
-
/* @__PURE__ */ (0,
|
|
3429
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "flex flex-col justify-center items-center gap-y-2", children: [
|
|
3430
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "mt-2 flex flex-col items-center justify-center text-center px-4", children: [
|
|
3431
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("p", { className: "text-xs font-semibold text-primary-text", children: [
|
|
3575
3432
|
"Swapped ",
|
|
3576
3433
|
readableValue(inputAmount, fromTokenInfo.decimals),
|
|
3577
3434
|
" ",
|
|
3578
3435
|
fromTokenInfo.symbol,
|
|
3579
3436
|
" to"
|
|
3580
3437
|
] }),
|
|
3581
|
-
/* @__PURE__ */ (0,
|
|
3438
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("p", { className: "text-2xl font-semibold text-primary-text", children: [
|
|
3582
3439
|
readableValue(outputAmount, toTokenInfo.decimals),
|
|
3583
3440
|
" ",
|
|
3584
3441
|
toTokenInfo.symbol
|
|
3585
3442
|
] })
|
|
3586
3443
|
] }),
|
|
3587
|
-
/* @__PURE__ */ (0,
|
|
3588
|
-
/* @__PURE__ */ (0,
|
|
3444
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: " bg-module rounded-xl overflow-y-auto w-full webkit-scrollbar py-3 max-h-[260px] px-3", children: [
|
|
3445
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
3589
3446
|
PriceInfo_default,
|
|
3590
3447
|
{
|
|
3591
3448
|
quoteResponse: lastSwapResult == null ? void 0 : lastSwapResult.quoteReponse,
|
|
@@ -3595,9 +3452,9 @@ var SwappingScreen = () => {
|
|
|
3595
3452
|
containerClassName: " border-none mt-0"
|
|
3596
3453
|
}
|
|
3597
3454
|
),
|
|
3598
|
-
explorerLink && /* @__PURE__ */ (0,
|
|
3599
|
-
/* @__PURE__ */ (0,
|
|
3600
|
-
/* @__PURE__ */ (0,
|
|
3455
|
+
explorerLink && /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "flex items-center justify-between text-xs text-primary-text/50 mt-4", children: [
|
|
3456
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { children: "Transaction" }) }),
|
|
3457
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
|
|
3601
3458
|
"a",
|
|
3602
3459
|
{
|
|
3603
3460
|
href: explorerLink,
|
|
@@ -3613,73 +3470,72 @@ var SwappingScreen = () => {
|
|
|
3613
3470
|
] })
|
|
3614
3471
|
] })
|
|
3615
3472
|
] }),
|
|
3616
|
-
/* @__PURE__ */ (0,
|
|
3617
|
-
/* @__PURE__ */ (0,
|
|
3473
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "pb-4 flex space-x-2", children: [
|
|
3474
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
3618
3475
|
JupButton_default,
|
|
3619
3476
|
{
|
|
3620
3477
|
size: "lg",
|
|
3621
3478
|
className: "w-full mt-4 disabled:opacity-50 !text-uiv2-text/75 leading-none !max-h-14 bg-primary",
|
|
3622
3479
|
onClick: onSwapMore,
|
|
3623
|
-
children: /* @__PURE__ */ (0,
|
|
3480
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: "text-sm", children: "Swap More" }) })
|
|
3624
3481
|
}
|
|
3625
3482
|
),
|
|
3626
|
-
displayMode !== "integrated" ? /* @__PURE__ */ (0,
|
|
3483
|
+
displayMode !== "integrated" ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
3627
3484
|
JupButton_default,
|
|
3628
3485
|
{
|
|
3629
3486
|
size: "lg",
|
|
3630
3487
|
className: "w-full mt-4 disabled:opacity-50 leading-none !max-h-14 text-primary-text bg-interactive",
|
|
3631
3488
|
onClick: onClose,
|
|
3632
|
-
children: /* @__PURE__ */ (0,
|
|
3489
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: "text-sm", children: "Close" })
|
|
3633
3490
|
}
|
|
3634
3491
|
) : null
|
|
3635
3492
|
] })
|
|
3636
3493
|
] });
|
|
3637
3494
|
};
|
|
3638
|
-
return /* @__PURE__ */ (0,
|
|
3639
|
-
errorMessage || (txStatus == null ? void 0 : txStatus.status) === "fail" ? /* @__PURE__ */ (0,
|
|
3640
|
-
/* @__PURE__ */ (0,
|
|
3641
|
-
/* @__PURE__ */ (0,
|
|
3642
|
-
/* @__PURE__ */ (0,
|
|
3643
|
-
errorMessage ? /* @__PURE__ */ (0,
|
|
3644
|
-
/* @__PURE__ */ (0,
|
|
3495
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "flex flex-col h-full w-full px-2", children: [
|
|
3496
|
+
errorMessage || (txStatus == null ? void 0 : txStatus.status) === "fail" ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "flex flex-col items-center justify-center text-center mt-12", children: [
|
|
3497
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(ErrorIcon, {}),
|
|
3498
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("p", { className: "text-primary-text mt-2", children: "Swap Failed" }),
|
|
3499
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("p", { className: "text-primary-text/50 text-xs mt-2", children: "We were unable to complete the swap, please try again." }),
|
|
3500
|
+
errorMessage ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("p", { className: "text-primary-text/50 text-xs mt-2 break-all", children: errorMessage }) : "",
|
|
3501
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
3645
3502
|
JupButton_default,
|
|
3646
3503
|
{
|
|
3647
3504
|
size: "lg",
|
|
3648
3505
|
className: "w-full mt-6 disabled:opacity-50 !text-uiv2-text/75 leading-none !max-h-14 bg-primary",
|
|
3649
3506
|
onClick: onGoBack,
|
|
3650
|
-
children: /* @__PURE__ */ (0,
|
|
3507
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { children: "Retry" })
|
|
3651
3508
|
}
|
|
3652
3509
|
)
|
|
3653
3510
|
] }) }) : null,
|
|
3654
|
-
!errorMessage && (txStatus == null ? void 0 : txStatus.status) === "timeout" ? /* @__PURE__ */ (0,
|
|
3655
|
-
/* @__PURE__ */ (0,
|
|
3656
|
-
/* @__PURE__ */ (0,
|
|
3657
|
-
/* @__PURE__ */ (0,
|
|
3658
|
-
errorMessage ? /* @__PURE__ */ (0,
|
|
3659
|
-
/* @__PURE__ */ (0,
|
|
3511
|
+
!errorMessage && (txStatus == null ? void 0 : txStatus.status) === "timeout" ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: "flex justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "flex flex-col items-center justify-center text-center mt-12", children: [
|
|
3512
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(ErrorIcon, {}),
|
|
3513
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("p", { className: "text-primary-text mt-2", children: "Transaction timed-out" }),
|
|
3514
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("p", { className: "text-primary-text/50 text-xs mt-2", children: "We were unable to complete the swap, please try again." }),
|
|
3515
|
+
errorMessage ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("p", { className: "text-primary-text/50 text-xs mt-2", children: errorMessage }) : "",
|
|
3516
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
3660
3517
|
JupButton_default,
|
|
3661
3518
|
{
|
|
3662
3519
|
size: "lg",
|
|
3663
3520
|
className: "w-full mt-6 disabled:opacity-50 !text-uiv2-text/75 leading-none !max-h-14 bg-primary",
|
|
3664
3521
|
onClick: onGoBack,
|
|
3665
|
-
children: /* @__PURE__ */ (0,
|
|
3522
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { children: "Retry" })
|
|
3666
3523
|
}
|
|
3667
3524
|
)
|
|
3668
3525
|
] }) }) : null,
|
|
3669
|
-
!errorMessage &&
|
|
3670
|
-
!errorMessage && (txStatus == null ? void 0 : txStatus.status) === "success" ? /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(SuccessContent, {}) : null
|
|
3526
|
+
!errorMessage && (txStatus == null ? void 0 : txStatus.status) === "success" ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(SuccessContent, {}) : null
|
|
3671
3527
|
] });
|
|
3672
3528
|
};
|
|
3673
3529
|
var SwappingScreen_default = SwappingScreen;
|
|
3674
3530
|
|
|
3675
3531
|
// src/components/screens/WalletScreen.tsx
|
|
3676
3532
|
var import_wallet_adapter3 = require("@jup-ag/wallet-adapter");
|
|
3677
|
-
var
|
|
3533
|
+
var import_react26 = require("react");
|
|
3678
3534
|
|
|
3679
3535
|
// src/icons/CloseIcon.tsx
|
|
3680
|
-
var
|
|
3536
|
+
var import_jsx_runtime44 = require("react/jsx-runtime");
|
|
3681
3537
|
var CloseIcon = ({ width = 20, height = 20 }) => {
|
|
3682
|
-
return /* @__PURE__ */ (0,
|
|
3538
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("svg", { width, height, viewBox: "0 0 20 21", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
3683
3539
|
"path",
|
|
3684
3540
|
{
|
|
3685
3541
|
d: "M2.0336 16.2126L8.2336 10.0126L2.0336 3.81263C1.7961 3.57903 1.66172 3.25951 1.66016 2.92669C1.65938 2.59309 1.79141 2.27357 2.02734 2.03763C2.26328 1.80247 2.5828 1.67045 2.9164 1.67201C3.25 1.67357 3.56874 1.80795 3.80234 2.04623L9.99994 8.24623L16.1999 2.04623C16.4335 1.80795 16.7523 1.67357 17.0859 1.67201C17.4187 1.67045 17.739 1.80248 17.9749 2.03763C18.2109 2.27357 18.3429 2.59309 18.3413 2.92669C18.3406 3.25951 18.2062 3.57903 17.9687 3.81263L11.7663 10.0126L17.9663 16.2126C18.2038 16.4462 18.3382 16.7658 18.3397 17.0986C18.3405 17.4322 18.2085 17.7517 17.9725 17.9876C17.7366 18.2228 17.4171 18.3548 17.0835 18.3533C16.7499 18.3517 16.4311 18.2173 16.1975 17.979L9.99994 11.779L3.79994 17.979C3.31088 18.4611 2.52494 18.4579 2.039 17.9736C1.55384 17.4884 1.54994 16.7025 2.03119 16.2126L2.0336 16.2126Z",
|
|
@@ -3690,7 +3546,7 @@ var CloseIcon = ({ width = 20, height = 20 }) => {
|
|
|
3690
3546
|
var CloseIcon_default = CloseIcon;
|
|
3691
3547
|
|
|
3692
3548
|
// src/components/screens/WalletScreen.tsx
|
|
3693
|
-
var
|
|
3549
|
+
var import_jsx_runtime45 = require("react/jsx-runtime");
|
|
3694
3550
|
var WalletScreen = () => {
|
|
3695
3551
|
const { setScreen } = useScreenState();
|
|
3696
3552
|
const { handleConnectClick } = (0, import_wallet_adapter3.useUnifiedWalletContext)();
|
|
@@ -3704,37 +3560,37 @@ var WalletScreen = () => {
|
|
|
3704
3560
|
setScreen("Initial");
|
|
3705
3561
|
}
|
|
3706
3562
|
});
|
|
3707
|
-
const numberOfWallets = (0,
|
|
3563
|
+
const numberOfWallets = (0, import_react26.useMemo)(() => {
|
|
3708
3564
|
return wallets == null ? void 0 : wallets.length;
|
|
3709
3565
|
}, [wallets]);
|
|
3710
|
-
const hasWallet = (0,
|
|
3566
|
+
const hasWallet = (0, import_react26.useMemo)(() => {
|
|
3711
3567
|
return numberOfWallets > 0;
|
|
3712
3568
|
}, [numberOfWallets]);
|
|
3713
|
-
return /* @__PURE__ */ (0,
|
|
3714
|
-
/* @__PURE__ */ (0,
|
|
3715
|
-
/* @__PURE__ */ (0,
|
|
3569
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { className: "text-primary-text p-2", children: [
|
|
3570
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { className: "flex justify-between items-center mb-2 h-[28px] ", children: [
|
|
3571
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("h1", { className: "text-sm font-bold", children: [
|
|
3716
3572
|
"Available Wallets (",
|
|
3717
3573
|
numberOfWallets,
|
|
3718
3574
|
")"
|
|
3719
3575
|
] }),
|
|
3720
|
-
/* @__PURE__ */ (0,
|
|
3576
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
3721
3577
|
"button",
|
|
3722
3578
|
{
|
|
3723
3579
|
onClick: () => setScreen("Initial"),
|
|
3724
3580
|
className: "text-primary-text hover:text-primary-text/50 transition-colors bg-interactive rounded-full p-1",
|
|
3725
|
-
children: /* @__PURE__ */ (0,
|
|
3581
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(CloseIcon_default, { width: 15, height: 15 })
|
|
3726
3582
|
}
|
|
3727
3583
|
)
|
|
3728
3584
|
] }),
|
|
3729
|
-
!hasWallet && /* @__PURE__ */ (0,
|
|
3730
|
-
/* @__PURE__ */ (0,
|
|
3585
|
+
!hasWallet && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("div", { className: "text-sm font-medium text-primary-text flex items-center justify-center h-full py-4", children: "No wallet found" }),
|
|
3586
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)("div", { className: "grid grid-cols-2 gap-2", children: wallets == null ? void 0 : wallets.map((wallet) => /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
3731
3587
|
"button",
|
|
3732
3588
|
{
|
|
3733
3589
|
onClick: (e) => handleConnect(e, wallet),
|
|
3734
3590
|
className: `w-full text-left bg-interactive p-4 rounded-lg transition-colors ${"hover:bg-interactive/80 cursor-pointer"}`,
|
|
3735
|
-
children: /* @__PURE__ */ (0,
|
|
3736
|
-
wallet.adapter.icon && /* @__PURE__ */ (0,
|
|
3737
|
-
/* @__PURE__ */ (0,
|
|
3591
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("div", { className: "flex items-center justify-between", children: /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { className: "flex items-center gap-3", children: [
|
|
3592
|
+
wallet.adapter.icon && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("img", { src: wallet.adapter.icon, alt: `${wallet.adapter.name} icon`, className: "w-8 h-8" }),
|
|
3593
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("h2", { className: "text-sm font-medium", children: wallet.adapter.name }) })
|
|
3738
3594
|
] }) })
|
|
3739
3595
|
},
|
|
3740
3596
|
wallet.adapter.name
|
|
@@ -3744,46 +3600,46 @@ var WalletScreen = () => {
|
|
|
3744
3600
|
var WalletScreen_default = WalletScreen;
|
|
3745
3601
|
|
|
3746
3602
|
// src/icons/JupiterLogoV2.tsx
|
|
3747
|
-
var
|
|
3603
|
+
var import_jsx_runtime46 = require("react/jsx-runtime");
|
|
3748
3604
|
var JupiterLogoV2 = (props) => {
|
|
3749
|
-
return /* @__PURE__ */ (0,
|
|
3750
|
-
/* @__PURE__ */ (0,
|
|
3751
|
-
/* @__PURE__ */ (0,
|
|
3605
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("svg", __spreadProps(__spreadValues({ xmlns: "http://www.w3.org/2000/svg", width: "128", height: "128", viewBox: "0 0 33 32", fill: "none" }, props), { children: [
|
|
3606
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("g", { clipPath: "url(#clip0_11565_169621)", children: /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("g", { filter: "url(#filter0_d_11565_169621)", children: [
|
|
3607
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
3752
3608
|
"path",
|
|
3753
3609
|
{
|
|
3754
3610
|
d: "M3.09074 25.1666C4.44267 27.0471 6.17683 28.6205 8.1795 29.7838C10.1822 30.947 12.4081 31.6738 14.7114 31.9165C13.5264 30.1333 11.8039 28.4928 9.65354 27.2438C7.50318 25.9948 5.22592 25.3125 3.09074 25.1666Z",
|
|
3755
3611
|
fill: "url(#paint0_linear_11565_169621)"
|
|
3756
3612
|
}
|
|
3757
3613
|
),
|
|
3758
|
-
/* @__PURE__ */ (0,
|
|
3614
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
3759
3615
|
"path",
|
|
3760
3616
|
{
|
|
3761
3617
|
d: "M12.543 22.2705C8.40015 19.8636 3.91612 19.2502 0.707663 20.3338C1.0174 21.3575 1.42589 22.3487 1.92738 23.2934C4.71498 23.2288 7.75856 23.9859 10.5906 25.6308C13.4227 27.2757 15.5888 29.5459 16.9143 32C17.9839 31.9672 19.0479 31.8309 20.0913 31.5932C19.4426 28.2698 16.6849 24.6779 12.543 22.2705Z",
|
|
3762
3618
|
fill: "url(#paint1_linear_11565_169621)"
|
|
3763
3619
|
}
|
|
3764
3620
|
),
|
|
3765
|
-
/* @__PURE__ */ (0,
|
|
3621
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
3766
3622
|
"path",
|
|
3767
3623
|
{
|
|
3768
3624
|
d: "M32.2852 12.5009C31.7585 10.3584 30.8054 8.34403 29.4829 6.57804C28.1604 4.81205 26.4956 3.33067 24.5879 2.22235C22.6802 1.11403 20.5687 0.401504 18.3796 0.127309C16.1904 -0.146885 13.9684 0.0228794 11.8463 0.626465C15.3915 1.06033 19.3267 2.39122 23.1859 4.63324C27.0452 6.87525 30.1533 9.63411 32.2852 12.5009Z",
|
|
3769
3625
|
fill: "url(#paint2_linear_11565_169621)"
|
|
3770
3626
|
}
|
|
3771
3627
|
),
|
|
3772
|
-
/* @__PURE__ */ (0,
|
|
3628
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
3773
3629
|
"path",
|
|
3774
3630
|
{
|
|
3775
3631
|
d: "M27.1271 20.3583C25.3124 17.3446 22.2038 14.4588 18.3743 12.2342C14.5449 10.0095 10.4991 8.7388 6.98531 8.65474C3.894 8.58152 1.57389 9.48017 0.621548 11.1197C0.616125 11.1294 0.608532 11.1386 0.602566 11.1484C0.516877 11.4559 0.44312 11.7639 0.37587 12.0731C1.70568 11.5481 3.24645 11.2558 4.95969 11.2232C8.76959 11.1517 13.0334 12.3703 16.9681 14.6562C20.9027 16.9422 24.0759 20.0438 25.9003 23.3878C26.7182 24.8944 27.2285 26.3777 27.4308 27.7948C27.6662 27.5844 27.8972 27.3669 28.1212 27.1408C28.1272 27.1305 28.131 27.1196 28.1369 27.1088C29.0893 25.4677 28.721 23.0076 27.1271 20.3583Z",
|
|
3776
3632
|
fill: "url(#paint3_linear_11565_169621)"
|
|
3777
3633
|
}
|
|
3778
3634
|
),
|
|
3779
|
-
/* @__PURE__ */ (0,
|
|
3635
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
3780
3636
|
"path",
|
|
3781
3637
|
{
|
|
3782
3638
|
d: "M15.4609 17.2485C9.59662 13.8416 3.11626 13.3079 0 15.6855C0.00612096 16.4297 0.0630166 17.1726 0.170292 17.9091C1.08699 17.6312 2.03177 17.4562 2.98718 17.3874C6.46952 17.1254 10.3087 18.0957 13.7927 20.1207C17.2766 22.1458 20.023 25.0018 21.5209 28.1543C21.935 29.018 22.2508 29.9254 22.4624 30.8595C23.1555 30.5878 23.8294 30.2694 24.4794 29.9066C25.0011 26.0213 21.3268 20.656 15.4609 17.2485Z",
|
|
3783
3639
|
fill: "url(#paint4_linear_11565_169621)"
|
|
3784
3640
|
}
|
|
3785
3641
|
),
|
|
3786
|
-
/* @__PURE__ */ (0,
|
|
3642
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
3787
3643
|
"path",
|
|
3788
3644
|
{
|
|
3789
3645
|
d: "M30.1434 15.3141C28.3082 12.3036 25.1724 9.40969 21.3158 7.17039C17.4593 4.93109 13.3977 3.64033 9.87257 3.53674C7.1853 3.45919 5.10382 4.11053 4.02457 5.34109C8.50588 4.58182 14.4168 5.85794 20.146 9.18625C25.8753 12.5146 29.9135 17.0181 31.4722 21.2868C32.0064 19.7406 31.5416 17.6098 30.1434 15.3141Z",
|
|
@@ -3791,8 +3647,8 @@ var JupiterLogoV2 = (props) => {
|
|
|
3791
3647
|
}
|
|
3792
3648
|
)
|
|
3793
3649
|
] }) }),
|
|
3794
|
-
/* @__PURE__ */ (0,
|
|
3795
|
-
/* @__PURE__ */ (0,
|
|
3650
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("defs", { children: [
|
|
3651
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(
|
|
3796
3652
|
"filter",
|
|
3797
3653
|
{
|
|
3798
3654
|
id: "filter0_d_11565_169621",
|
|
@@ -3803,8 +3659,8 @@ var JupiterLogoV2 = (props) => {
|
|
|
3803
3659
|
filterUnits: "userSpaceOnUse",
|
|
3804
3660
|
colorInterpolationFilters: "sRGB",
|
|
3805
3661
|
children: [
|
|
3806
|
-
/* @__PURE__ */ (0,
|
|
3807
|
-
/* @__PURE__ */ (0,
|
|
3662
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("feFlood", { floodOpacity: "0", result: "BackgroundImageFix" }),
|
|
3663
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
3808
3664
|
"feColorMatrix",
|
|
3809
3665
|
{
|
|
3810
3666
|
in: "SourceAlpha",
|
|
@@ -3813,16 +3669,16 @@ var JupiterLogoV2 = (props) => {
|
|
|
3813
3669
|
result: "hardAlpha"
|
|
3814
3670
|
}
|
|
3815
3671
|
),
|
|
3816
|
-
/* @__PURE__ */ (0,
|
|
3817
|
-
/* @__PURE__ */ (0,
|
|
3818
|
-
/* @__PURE__ */ (0,
|
|
3819
|
-
/* @__PURE__ */ (0,
|
|
3820
|
-
/* @__PURE__ */ (0,
|
|
3821
|
-
/* @__PURE__ */ (0,
|
|
3672
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("feOffset", { dy: "2.27449" }),
|
|
3673
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("feGaussianBlur", { stdDeviation: "11.3724" }),
|
|
3674
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("feComposite", { in2: "hardAlpha", operator: "out" }),
|
|
3675
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("feColorMatrix", { type: "matrix", values: "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.1 0" }),
|
|
3676
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("feBlend", { mode: "normal", in2: "BackgroundImageFix", result: "effect1_dropShadow_11565_169621" }),
|
|
3677
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("feBlend", { mode: "normal", in: "SourceGraphic", in2: "effect1_dropShadow_11565_169621", result: "shape" })
|
|
3822
3678
|
]
|
|
3823
3679
|
}
|
|
3824
3680
|
),
|
|
3825
|
-
/* @__PURE__ */ (0,
|
|
3681
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(
|
|
3826
3682
|
"linearGradient",
|
|
3827
3683
|
{
|
|
3828
3684
|
id: "paint0_linear_11565_169621",
|
|
@@ -3832,12 +3688,12 @@ var JupiterLogoV2 = (props) => {
|
|
|
3832
3688
|
y2: "32",
|
|
3833
3689
|
gradientUnits: "userSpaceOnUse",
|
|
3834
3690
|
children: [
|
|
3835
|
-
/* @__PURE__ */ (0,
|
|
3836
|
-
/* @__PURE__ */ (0,
|
|
3691
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("stop", { offset: "0.0001", stopColor: "currentColor" }),
|
|
3692
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("stop", { offset: "1", stopColor: "currentColor" })
|
|
3837
3693
|
]
|
|
3838
3694
|
}
|
|
3839
3695
|
),
|
|
3840
|
-
/* @__PURE__ */ (0,
|
|
3696
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(
|
|
3841
3697
|
"linearGradient",
|
|
3842
3698
|
{
|
|
3843
3699
|
id: "paint1_linear_11565_169621",
|
|
@@ -3847,12 +3703,12 @@ var JupiterLogoV2 = (props) => {
|
|
|
3847
3703
|
y2: "32",
|
|
3848
3704
|
gradientUnits: "userSpaceOnUse",
|
|
3849
3705
|
children: [
|
|
3850
|
-
/* @__PURE__ */ (0,
|
|
3851
|
-
/* @__PURE__ */ (0,
|
|
3706
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("stop", { offset: "0.0001", stopColor: "currentColor" }),
|
|
3707
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("stop", { offset: "1", stopColor: "currentColor" })
|
|
3852
3708
|
]
|
|
3853
3709
|
}
|
|
3854
3710
|
),
|
|
3855
|
-
/* @__PURE__ */ (0,
|
|
3711
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(
|
|
3856
3712
|
"linearGradient",
|
|
3857
3713
|
{
|
|
3858
3714
|
id: "paint2_linear_11565_169621",
|
|
@@ -3862,12 +3718,12 @@ var JupiterLogoV2 = (props) => {
|
|
|
3862
3718
|
y2: "32",
|
|
3863
3719
|
gradientUnits: "userSpaceOnUse",
|
|
3864
3720
|
children: [
|
|
3865
|
-
/* @__PURE__ */ (0,
|
|
3866
|
-
/* @__PURE__ */ (0,
|
|
3721
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("stop", { offset: "0.0001", stopColor: "currentColor" }),
|
|
3722
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("stop", { offset: "1", stopColor: "currentColor" })
|
|
3867
3723
|
]
|
|
3868
3724
|
}
|
|
3869
3725
|
),
|
|
3870
|
-
/* @__PURE__ */ (0,
|
|
3726
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(
|
|
3871
3727
|
"linearGradient",
|
|
3872
3728
|
{
|
|
3873
3729
|
id: "paint3_linear_11565_169621",
|
|
@@ -3877,12 +3733,12 @@ var JupiterLogoV2 = (props) => {
|
|
|
3877
3733
|
y2: "32",
|
|
3878
3734
|
gradientUnits: "userSpaceOnUse",
|
|
3879
3735
|
children: [
|
|
3880
|
-
/* @__PURE__ */ (0,
|
|
3881
|
-
/* @__PURE__ */ (0,
|
|
3736
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("stop", { offset: "0.0001", stopColor: "currentColor" }),
|
|
3737
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("stop", { offset: "1", stopColor: "currentColor" })
|
|
3882
3738
|
]
|
|
3883
3739
|
}
|
|
3884
3740
|
),
|
|
3885
|
-
/* @__PURE__ */ (0,
|
|
3741
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(
|
|
3886
3742
|
"linearGradient",
|
|
3887
3743
|
{
|
|
3888
3744
|
id: "paint4_linear_11565_169621",
|
|
@@ -3892,12 +3748,12 @@ var JupiterLogoV2 = (props) => {
|
|
|
3892
3748
|
y2: "32",
|
|
3893
3749
|
gradientUnits: "userSpaceOnUse",
|
|
3894
3750
|
children: [
|
|
3895
|
-
/* @__PURE__ */ (0,
|
|
3896
|
-
/* @__PURE__ */ (0,
|
|
3751
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("stop", { offset: "0.0001", stopColor: "currentColor" }),
|
|
3752
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("stop", { offset: "1", stopColor: "currentColor" })
|
|
3897
3753
|
]
|
|
3898
3754
|
}
|
|
3899
3755
|
),
|
|
3900
|
-
/* @__PURE__ */ (0,
|
|
3756
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(
|
|
3901
3757
|
"linearGradient",
|
|
3902
3758
|
{
|
|
3903
3759
|
id: "paint5_linear_11565_169621",
|
|
@@ -3907,50 +3763,49 @@ var JupiterLogoV2 = (props) => {
|
|
|
3907
3763
|
y2: "32",
|
|
3908
3764
|
gradientUnits: "userSpaceOnUse",
|
|
3909
3765
|
children: [
|
|
3910
|
-
/* @__PURE__ */ (0,
|
|
3911
|
-
/* @__PURE__ */ (0,
|
|
3766
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("stop", { offset: "0.0001", stopColor: "currentColor" }),
|
|
3767
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("stop", { offset: "1", stopColor: "currentColor" })
|
|
3912
3768
|
]
|
|
3913
3769
|
}
|
|
3914
3770
|
),
|
|
3915
|
-
/* @__PURE__ */ (0,
|
|
3771
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("clipPath", { id: "clip0_11565_169621", children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("rect", { width: "32.2852", height: "32", fill: "white" }) })
|
|
3916
3772
|
] })
|
|
3917
3773
|
] }));
|
|
3918
3774
|
};
|
|
3919
3775
|
var JupiterLogoV2_default = JupiterLogoV2;
|
|
3920
3776
|
|
|
3921
3777
|
// src/components/Jupiter.tsx
|
|
3922
|
-
var
|
|
3778
|
+
var import_jsx_runtime47 = require("react/jsx-runtime");
|
|
3923
3779
|
var Content = () => {
|
|
3924
3780
|
const { screen: screen2 } = useScreenState();
|
|
3925
|
-
return /* @__PURE__ */ (0,
|
|
3926
|
-
/* @__PURE__ */ (0,
|
|
3927
|
-
screen2 === "Initial" ? /* @__PURE__ */ (0,
|
|
3928
|
-
/* @__PURE__ */ (0,
|
|
3929
|
-
/* @__PURE__ */ (0,
|
|
3781
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { id: "jupiter-plugin", className: " h-full bg-background relative flex flex-col justify-between", children: [
|
|
3782
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { children: [
|
|
3783
|
+
screen2 === "Initial" ? /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(import_jsx_runtime47.Fragment, { children: [
|
|
3784
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(Header_default, {}),
|
|
3785
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(InitialScreen_default, {})
|
|
3930
3786
|
] }) : null,
|
|
3931
|
-
screen2 === "
|
|
3932
|
-
screen2 === "
|
|
3933
|
-
screen2 === "Wallet" ? /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(WalletScreen_default, {}) : null
|
|
3787
|
+
screen2 === "Swapping" ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(SwappingScreen_default, {}) : null,
|
|
3788
|
+
screen2 === "Wallet" ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(WalletScreen_default, {}) : null
|
|
3934
3789
|
] }),
|
|
3935
|
-
/* @__PURE__ */ (0,
|
|
3790
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("span", { className: "text-primary-text/50 text-xs p-2 flex-row flex gap-1 justify-center", children: [
|
|
3936
3791
|
"Powered by",
|
|
3937
|
-
/* @__PURE__ */ (0,
|
|
3938
|
-
/* @__PURE__ */ (0,
|
|
3792
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("a", { href: "https://jup.ag", target: "_blank", rel: "noreferrer noopener", className: "flex items-center gap-1 ", children: [
|
|
3793
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(JupiterLogoV2_default, { className: "text-primary-text/50", width: 15, height: 15 }),
|
|
3939
3794
|
"Jupiter"
|
|
3940
3795
|
] })
|
|
3941
3796
|
] })
|
|
3942
3797
|
] });
|
|
3943
3798
|
};
|
|
3944
3799
|
var JupiterApp = (props) => {
|
|
3945
|
-
return /* @__PURE__ */ (0,
|
|
3800
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(SwapContextProvider, __spreadProps(__spreadValues({}, props), { children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(BrandingProvider, __spreadProps(__spreadValues({}, props), { children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(Content, {}) })) }));
|
|
3946
3801
|
};
|
|
3947
3802
|
var Jupiter_default = JupiterApp;
|
|
3948
3803
|
|
|
3949
3804
|
// src/contexts/ContextProvider.tsx
|
|
3950
3805
|
var import_wallet_adapter4 = require("@jup-ag/wallet-adapter");
|
|
3951
|
-
var
|
|
3952
|
-
var
|
|
3953
|
-
var
|
|
3806
|
+
var import_react27 = __toESM(require("react"));
|
|
3807
|
+
var import_react28 = require("react");
|
|
3808
|
+
var import_jsx_runtime48 = require("react/jsx-runtime");
|
|
3954
3809
|
var noop = () => {
|
|
3955
3810
|
};
|
|
3956
3811
|
var WalletContextProvider = ({
|
|
@@ -3961,18 +3816,18 @@ var WalletContextProvider = ({
|
|
|
3961
3816
|
if (typeof window === "undefined") return void 0;
|
|
3962
3817
|
return window.Jupiter.enableWalletPassthrough;
|
|
3963
3818
|
})();
|
|
3964
|
-
const wallets = (0,
|
|
3819
|
+
const wallets = (0, import_react28.useMemo)(() => {
|
|
3965
3820
|
if (enableWalletPassthrough) {
|
|
3966
3821
|
return [];
|
|
3967
3822
|
}
|
|
3968
3823
|
return [];
|
|
3969
3824
|
}, [enableWalletPassthrough]);
|
|
3970
|
-
const [showWalletStatus, setShowWalletStatus] = (0,
|
|
3825
|
+
const [showWalletStatus, setShowWalletStatus] = (0, import_react27.useState)({
|
|
3971
3826
|
show: false,
|
|
3972
3827
|
message: ""
|
|
3973
3828
|
});
|
|
3974
|
-
const ShouldWrapWalletProvider = (0,
|
|
3975
|
-
return enableWalletPassthrough ?
|
|
3829
|
+
const ShouldWrapWalletProvider = (0, import_react28.useMemo)(() => {
|
|
3830
|
+
return enableWalletPassthrough ? import_react27.default.Fragment : ({ children: children2 }) => /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
3976
3831
|
import_wallet_adapter4.UnifiedWalletProvider,
|
|
3977
3832
|
{
|
|
3978
3833
|
wallets,
|
|
@@ -3994,11 +3849,11 @@ var WalletContextProvider = ({
|
|
|
3994
3849
|
onNotInstalled: ({ walletName, metadata }) => {
|
|
3995
3850
|
setShowWalletStatus({
|
|
3996
3851
|
show: true,
|
|
3997
|
-
message: /* @__PURE__ */ (0,
|
|
3852
|
+
message: /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("p", { className: "space-y-1", children: [
|
|
3998
3853
|
walletName,
|
|
3999
3854
|
" is not installed.",
|
|
4000
|
-
/* @__PURE__ */ (0,
|
|
4001
|
-
/* @__PURE__ */ (0,
|
|
3855
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("p", { className: "space-x-1", children: [
|
|
3856
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(
|
|
4002
3857
|
"a",
|
|
4003
3858
|
{
|
|
4004
3859
|
className: "underline font-semibold",
|
|
@@ -4012,7 +3867,7 @@ var WalletContextProvider = ({
|
|
|
4012
3867
|
]
|
|
4013
3868
|
}
|
|
4014
3869
|
),
|
|
4015
|
-
/* @__PURE__ */ (0,
|
|
3870
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("span", { children: "to install it." })
|
|
4016
3871
|
] })
|
|
4017
3872
|
] })
|
|
4018
3873
|
});
|
|
@@ -4030,27 +3885,27 @@ var WalletContextProvider = ({
|
|
|
4030
3885
|
}
|
|
4031
3886
|
);
|
|
4032
3887
|
}, [autoConnect, enableWalletPassthrough, wallets]);
|
|
4033
|
-
return /* @__PURE__ */ (0,
|
|
4034
|
-
/* @__PURE__ */ (0,
|
|
4035
|
-
showWalletStatus.show && showWalletStatus.message ? /* @__PURE__ */ (0,
|
|
3888
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(import_jsx_runtime48.Fragment, { children: [
|
|
3889
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(ShouldWrapWalletProvider, { children }),
|
|
3890
|
+
showWalletStatus.show && showWalletStatus.message ? /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { className: "absolute bottom-2 w-full px-2", children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { className: "w-full h-full bg-white/10 rounded-lg p-2 text-warning text-xs", children: showWalletStatus.message }) }) : null
|
|
4036
3891
|
] });
|
|
4037
3892
|
};
|
|
4038
3893
|
var ContextProvider = (props) => {
|
|
4039
|
-
return /* @__PURE__ */ (0,
|
|
3894
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_jsx_runtime48.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(WalletContextProvider, __spreadProps(__spreadValues({}, props), { children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(PreferredExplorerProvider, { defaultExplorer: props.defaultExplorer, children: props.children }) })) });
|
|
4040
3895
|
};
|
|
4041
3896
|
|
|
4042
3897
|
// src/index.tsx
|
|
4043
|
-
var
|
|
4044
|
-
var
|
|
4045
|
-
var
|
|
3898
|
+
var import_react_query11 = require("@tanstack/react-query");
|
|
3899
|
+
var import_react29 = require("react");
|
|
3900
|
+
var import_jsx_runtime49 = require("react/jsx-runtime");
|
|
4046
3901
|
var App = () => {
|
|
4047
|
-
const queryClient = (0,
|
|
3902
|
+
const queryClient = (0, import_react29.useMemo)(() => new import_react_query11.QueryClient(), []);
|
|
4048
3903
|
const [props] = (0, import_jotai4.useAtom)(appProps);
|
|
4049
3904
|
if (!props) return null;
|
|
4050
|
-
return /* @__PURE__ */ (0,
|
|
3905
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_react_query11.QueryClientProvider, { client: queryClient, children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(ContextProvider, __spreadProps(__spreadValues({}, props), { children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(WalletPassthroughProvider_default, { children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(ScreenProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(Jupiter_default, __spreadValues({}, props)) }) }) })) });
|
|
4051
3906
|
};
|
|
4052
3907
|
var RenderJupiter = () => {
|
|
4053
|
-
return /* @__PURE__ */ (0,
|
|
3908
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_jotai4.Provider, { store: typeof window !== "undefined" ? window.Jupiter.store : void 0, children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(App, {}) });
|
|
4054
3909
|
};
|
|
4055
3910
|
|
|
4056
3911
|
// src/npmlibary.tsx
|