@jup-ag/plugin 1.0.1 → 1.0.3
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/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 +461 -638
- 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.3",
|
|
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",
|
|
@@ -655,6 +655,8 @@ var USDC_MINT = new import_web3.PublicKey("EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZ
|
|
|
655
655
|
var USDT_MINT = new import_web3.PublicKey("Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB");
|
|
656
656
|
var JLP_MINT = new import_web3.PublicKey("27G8MtK7VtTcCHkpASjSDdkWWYfoqT6ggEuKidVJidD4");
|
|
657
657
|
var WRAPPED_SOL_MINT = new import_web3.PublicKey("So11111111111111111111111111111111111111112");
|
|
658
|
+
var MINIMUM_SOL_BALANCE = 0.01;
|
|
659
|
+
var MAX_INPUT_LIMIT = 1e14;
|
|
658
660
|
var INITIAL_FORM_CONFIG = Object.freeze({
|
|
659
661
|
simulateWalletPassthrough: false,
|
|
660
662
|
defaultExplorer: "Solana Explorer",
|
|
@@ -1009,7 +1011,8 @@ var FormattedUltraQuoteResponse = (0, import_superstruct.type)({
|
|
|
1009
1011
|
requestId: (0, import_superstruct.string)(),
|
|
1010
1012
|
prioritizationFeeLamports: (0, import_superstruct.optional)((0, import_superstruct.number)()),
|
|
1011
1013
|
feeBps: (0, import_superstruct.number)(),
|
|
1012
|
-
router: (0, import_superstruct.string)()
|
|
1014
|
+
router: (0, import_superstruct.string)(),
|
|
1015
|
+
errorMessage: (0, import_superstruct.optional)((0, import_superstruct.string)())
|
|
1013
1016
|
});
|
|
1014
1017
|
|
|
1015
1018
|
// src/queries/useQuoteQuery.ts
|
|
@@ -1040,133 +1043,13 @@ var useQuoteQuery = (params, shouldRefetch = true) => {
|
|
|
1040
1043
|
refetchInterval: shouldRefetch ? 5e3 : false,
|
|
1041
1044
|
retry: 0,
|
|
1042
1045
|
enabled: Number(amount) > 0,
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
console.error("useQuoteQuery", error);
|
|
1046
|
-
}
|
|
1046
|
+
gcTime: 0,
|
|
1047
|
+
staleTime: 0
|
|
1047
1048
|
});
|
|
1048
1049
|
};
|
|
1049
1050
|
|
|
1050
|
-
// src/queries/useUltraSwapMutation.ts
|
|
1051
|
-
var import_wallet_adapter2 = require("@jup-ag/wallet-adapter");
|
|
1052
|
-
var import_react_query2 = require("@tanstack/react-query");
|
|
1053
|
-
var import_buffer = require("buffer");
|
|
1054
|
-
var import_web34 = require("@solana/web3.js");
|
|
1055
|
-
|
|
1056
|
-
// src/entity/TransactionError.ts
|
|
1057
|
-
var TransactionError = class extends Error {
|
|
1058
|
-
constructor(message, txid, code, programIds, serializedTx) {
|
|
1059
|
-
super(message);
|
|
1060
|
-
this.name = "TransactionError";
|
|
1061
|
-
this.txid = txid;
|
|
1062
|
-
this.code = code;
|
|
1063
|
-
this.programIds = programIds;
|
|
1064
|
-
this.serializedTx = serializedTx;
|
|
1065
|
-
}
|
|
1066
|
-
};
|
|
1067
|
-
|
|
1068
|
-
// src/queries/useUltraSwapMutation.ts
|
|
1069
|
-
var UltraSwapError = class extends Error {
|
|
1070
|
-
constructor(message, type2, txid) {
|
|
1071
|
-
super(message);
|
|
1072
|
-
this.type = type2;
|
|
1073
|
-
this.txid = txid;
|
|
1074
|
-
}
|
|
1075
|
-
};
|
|
1076
|
-
function useUltraSwapMutation() {
|
|
1077
|
-
const { wallet, signTransaction } = useWalletPassThrough();
|
|
1078
|
-
return (0, import_react_query2.useMutation)({
|
|
1079
|
-
mutationFn: (_0) => __async(this, [_0], function* ({
|
|
1080
|
-
setTxStatus,
|
|
1081
|
-
setLastSwapResult,
|
|
1082
|
-
fromTokenInfo,
|
|
1083
|
-
toTokenInfo,
|
|
1084
|
-
quoteResponseMeta
|
|
1085
|
-
}) {
|
|
1086
|
-
const publicKey = wallet == null ? void 0 : wallet.adapter.publicKey;
|
|
1087
|
-
if (!signTransaction || !publicKey) {
|
|
1088
|
-
throw new UltraSwapError(
|
|
1089
|
-
"Wallet not connected, or missing wallet functions",
|
|
1090
|
-
"WALLET_SIGNING_FAILED" /* WALLET_SIGNING_FAILED */
|
|
1091
|
-
);
|
|
1092
|
-
}
|
|
1093
|
-
setTxStatus({
|
|
1094
|
-
txid: "",
|
|
1095
|
-
status: "pending-approval"
|
|
1096
|
-
});
|
|
1097
|
-
const selectedQuote = quoteResponseMeta.original;
|
|
1098
|
-
const { transaction, requestId } = selectedQuote;
|
|
1099
|
-
if (!transaction) throw new Error("Missing transaction");
|
|
1100
|
-
const based64tx = import_buffer.Buffer.from(transaction, "base64");
|
|
1101
|
-
const versionedTransaction = import_web34.VersionedTransaction.deserialize(new Uint8Array(based64tx));
|
|
1102
|
-
const signedTransaction = yield signTransaction(versionedTransaction);
|
|
1103
|
-
const serializedTransaction = import_buffer.Buffer.from(signedTransaction.serialize()).toString("base64");
|
|
1104
|
-
setTxStatus({
|
|
1105
|
-
txid: "",
|
|
1106
|
-
status: "sending"
|
|
1107
|
-
});
|
|
1108
|
-
const response = yield ultraSwapService.submitSwap(serializedTransaction, requestId);
|
|
1109
|
-
const { signature, status } = response;
|
|
1110
|
-
if (status === "Failed") {
|
|
1111
|
-
throw new UltraSwapError(response.error, "FAILED" /* FAILED */, signature);
|
|
1112
|
-
}
|
|
1113
|
-
const { inputAmountResult, outputAmountResult } = response;
|
|
1114
|
-
setTxStatus({
|
|
1115
|
-
txid: signature,
|
|
1116
|
-
status: "success"
|
|
1117
|
-
});
|
|
1118
|
-
setLastSwapResult({
|
|
1119
|
-
swapResult: {
|
|
1120
|
-
txid: signature,
|
|
1121
|
-
inputAddress: new import_web34.PublicKey(fromTokenInfo.id),
|
|
1122
|
-
outputAddress: new import_web34.PublicKey(toTokenInfo.id),
|
|
1123
|
-
inputAmount: Number(inputAmountResult),
|
|
1124
|
-
outputAmount: Number(outputAmountResult)
|
|
1125
|
-
},
|
|
1126
|
-
quoteReponse: quoteResponseMeta
|
|
1127
|
-
});
|
|
1128
|
-
return signature;
|
|
1129
|
-
}),
|
|
1130
|
-
onError: (error, variables) => __async(this, null, function* () {
|
|
1131
|
-
const { setTxStatus, setLastSwapResult, quoteResponseMeta } = variables;
|
|
1132
|
-
if (error instanceof import_wallet_adapter2.WalletSignTransactionError) {
|
|
1133
|
-
const message = error.message || error.error || "Transaction cancelled";
|
|
1134
|
-
setLastSwapResult({
|
|
1135
|
-
swapResult: {
|
|
1136
|
-
error: new TransactionError(message)
|
|
1137
|
-
},
|
|
1138
|
-
quoteReponse: quoteResponseMeta
|
|
1139
|
-
});
|
|
1140
|
-
return;
|
|
1141
|
-
}
|
|
1142
|
-
if (error instanceof Error) {
|
|
1143
|
-
setLastSwapResult({
|
|
1144
|
-
swapResult: {
|
|
1145
|
-
error: new TransactionError(error.message)
|
|
1146
|
-
},
|
|
1147
|
-
quoteReponse: quoteResponseMeta
|
|
1148
|
-
});
|
|
1149
|
-
return;
|
|
1150
|
-
}
|
|
1151
|
-
if ("json" in error) {
|
|
1152
|
-
const json = yield error.json();
|
|
1153
|
-
setLastSwapResult({
|
|
1154
|
-
swapResult: {
|
|
1155
|
-
error: new TransactionError(json.error || "Unknown error")
|
|
1156
|
-
},
|
|
1157
|
-
quoteReponse: quoteResponseMeta
|
|
1158
|
-
});
|
|
1159
|
-
setTxStatus({
|
|
1160
|
-
txid: json.txid || "",
|
|
1161
|
-
status: "fail"
|
|
1162
|
-
});
|
|
1163
|
-
}
|
|
1164
|
-
})
|
|
1165
|
-
});
|
|
1166
|
-
}
|
|
1167
|
-
|
|
1168
1051
|
// src/hooks/useBalances.ts
|
|
1169
|
-
var
|
|
1052
|
+
var import_react_query2 = require("@tanstack/react-query");
|
|
1170
1053
|
var import_react6 = require("react");
|
|
1171
1054
|
var ULTRA_NATIVESOL_ID = "SOL";
|
|
1172
1055
|
var WSOL_ID = WRAPPED_SOL_MINT.toString();
|
|
@@ -1187,13 +1070,13 @@ var useBalances = () => {
|
|
|
1187
1070
|
if (!publicKey) return "";
|
|
1188
1071
|
return publicKey.toString();
|
|
1189
1072
|
}, [publicKey]);
|
|
1190
|
-
return (0,
|
|
1073
|
+
return (0, import_react_query2.useQuery)({
|
|
1191
1074
|
queryKey: ["ultra", "balances", address],
|
|
1192
1075
|
queryFn: (_0) => __async(void 0, [_0], function* ({ signal }) {
|
|
1193
1076
|
return yield ultraSwapService.getBalance(address, signal);
|
|
1194
1077
|
}),
|
|
1195
1078
|
enabled: !!address && getPluginInView(),
|
|
1196
|
-
|
|
1079
|
+
gcTime: 2e4,
|
|
1197
1080
|
staleTime: 2e4,
|
|
1198
1081
|
refetchOnWindowFocus: false,
|
|
1199
1082
|
refetchIntervalInBackground: false,
|
|
@@ -1203,7 +1086,7 @@ var useBalances = () => {
|
|
|
1203
1086
|
};
|
|
1204
1087
|
|
|
1205
1088
|
// src/hooks/useAsset.ts
|
|
1206
|
-
var
|
|
1089
|
+
var import_react_query3 = require("@tanstack/react-query");
|
|
1207
1090
|
|
|
1208
1091
|
// src/contexts/SearchService.ts
|
|
1209
1092
|
var BASE_URL = "https://datapi.jup.ag";
|
|
@@ -1228,7 +1111,7 @@ var searchService = new SearchService();
|
|
|
1228
1111
|
// src/hooks/useAsset.ts
|
|
1229
1112
|
var ASSET_QUERY_KEY = ["search", "assets"];
|
|
1230
1113
|
var useAsset = (mint) => {
|
|
1231
|
-
return (0,
|
|
1114
|
+
return (0, import_react_query3.useQuery)({
|
|
1232
1115
|
queryKey: [...ASSET_QUERY_KEY, mint],
|
|
1233
1116
|
queryFn: () => searchService.search(mint),
|
|
1234
1117
|
enabled: !!mint,
|
|
@@ -1259,7 +1142,7 @@ var SwapContextProvider = (props) => {
|
|
|
1259
1142
|
const { displayMode, scriptDomain: scriptDomain2, formProps: originalFormProps, children, enableWalletPassthrough } = props;
|
|
1260
1143
|
const { screen: screen2 } = useScreenState();
|
|
1261
1144
|
const { wallet } = useWalletPassThrough();
|
|
1262
|
-
const { refetch: refetchBalances } = useBalances();
|
|
1145
|
+
const { data: balances, refetch: refetchBalances } = useBalances();
|
|
1263
1146
|
const isToPairFocused = (0, import_react7.useRef)(false);
|
|
1264
1147
|
const walletPublicKey = (0, import_react7.useMemo)(() => {
|
|
1265
1148
|
var _a3;
|
|
@@ -1303,6 +1186,10 @@ var SwapContextProvider = (props) => {
|
|
|
1303
1186
|
setupInitialAmount();
|
|
1304
1187
|
}, [formProps.initialAmount, setupInitialAmount]);
|
|
1305
1188
|
const debouncedForm = useDebounce(form, 250);
|
|
1189
|
+
const debouncePending = (0, import_react7.useMemo)(
|
|
1190
|
+
() => JSON.stringify(form) !== JSON.stringify(debouncedForm),
|
|
1191
|
+
[form, debouncedForm]
|
|
1192
|
+
);
|
|
1306
1193
|
const amount = (0, import_react7.useMemo)(() => {
|
|
1307
1194
|
if (!fromTokenInfo || !toTokenInfo) {
|
|
1308
1195
|
return import_jsbi2.default.BigInt(0);
|
|
@@ -1344,6 +1231,11 @@ var SwapContextProvider = (props) => {
|
|
|
1344
1231
|
// Stop refetching when transaction is in progress
|
|
1345
1232
|
!txStatus
|
|
1346
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]);
|
|
1347
1239
|
(0, import_react7.useEffect)(() => {
|
|
1348
1240
|
if (quoteError) {
|
|
1349
1241
|
if (typeof quoteError === "string") {
|
|
@@ -1357,8 +1249,14 @@ var SwapContextProvider = (props) => {
|
|
|
1357
1249
|
});
|
|
1358
1250
|
return;
|
|
1359
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
|
+
}
|
|
1360
1258
|
setErrors({});
|
|
1361
|
-
}, [quoteError]);
|
|
1259
|
+
}, [quoteError, balance, form.fromValue, fromTokenInfo]);
|
|
1362
1260
|
const lastRefreshTimestamp = (0, import_react7.useMemo)(() => {
|
|
1363
1261
|
if (loading) {
|
|
1364
1262
|
return (/* @__PURE__ */ new Date()).getTime();
|
|
@@ -1397,29 +1295,6 @@ var SwapContextProvider = (props) => {
|
|
|
1397
1295
|
});
|
|
1398
1296
|
}, [form.fromValue, form.toValue, fromTokenInfo, quoteResponseMeta, toTokenInfo]);
|
|
1399
1297
|
const [lastSwapResult, setLastSwapResult] = (0, import_react7.useState)(null);
|
|
1400
|
-
const { mutateAsync: ultraSwapMutation } = useUltraSwapMutation();
|
|
1401
|
-
const onSubmit = (0, import_react7.useCallback)(() => __async(void 0, null, function* () {
|
|
1402
|
-
if (!walletPublicKey || !(wallet == null ? void 0 : wallet.adapter) || !quoteResponseMeta) {
|
|
1403
|
-
return null;
|
|
1404
|
-
}
|
|
1405
|
-
setTxStatus({
|
|
1406
|
-
txid: "",
|
|
1407
|
-
status: "loading"
|
|
1408
|
-
});
|
|
1409
|
-
try {
|
|
1410
|
-
if (!fromTokenInfo) throw new Error("Missing fromTokenInfo");
|
|
1411
|
-
if (!toTokenInfo) throw new Error("Missing toTokenInfo");
|
|
1412
|
-
yield ultraSwapMutation({
|
|
1413
|
-
quoteResponseMeta,
|
|
1414
|
-
fromTokenInfo,
|
|
1415
|
-
toTokenInfo,
|
|
1416
|
-
setTxStatus,
|
|
1417
|
-
setLastSwapResult
|
|
1418
|
-
});
|
|
1419
|
-
} catch (error) {
|
|
1420
|
-
console.log("Swap error", error);
|
|
1421
|
-
}
|
|
1422
|
-
}), [walletPublicKey, wallet == null ? void 0 : wallet.adapter, quoteResponseMeta, ultraSwapMutation, fromTokenInfo, toTokenInfo]);
|
|
1423
1298
|
const reset = (0, import_react7.useCallback)(
|
|
1424
1299
|
({ resetValues } = { resetValues: false }) => {
|
|
1425
1300
|
if (resetValues) {
|
|
@@ -1458,11 +1333,12 @@ var SwapContextProvider = (props) => {
|
|
|
1458
1333
|
toTokenInfo,
|
|
1459
1334
|
quoteResponseMeta,
|
|
1460
1335
|
setQuoteResponseMeta,
|
|
1461
|
-
onSubmit,
|
|
1336
|
+
// onSubmit,
|
|
1462
1337
|
lastSwapResult,
|
|
1338
|
+
setLastSwapResult,
|
|
1463
1339
|
reset,
|
|
1464
1340
|
refresh,
|
|
1465
|
-
loading,
|
|
1341
|
+
loading: loading || debouncePending,
|
|
1466
1342
|
quoteError,
|
|
1467
1343
|
lastRefreshTimestamp,
|
|
1468
1344
|
isToPairFocused,
|
|
@@ -1472,6 +1348,7 @@ var SwapContextProvider = (props) => {
|
|
|
1472
1348
|
swapping: {
|
|
1473
1349
|
txStatus
|
|
1474
1350
|
},
|
|
1351
|
+
setTxStatus,
|
|
1475
1352
|
enableWalletPassthrough
|
|
1476
1353
|
},
|
|
1477
1354
|
children
|
|
@@ -1633,13 +1510,6 @@ var import_react24 = require("react");
|
|
|
1633
1510
|
var import_react19 = require("react");
|
|
1634
1511
|
var import_react_number_format = require("react-number-format");
|
|
1635
1512
|
|
|
1636
|
-
// src/misc/constants.ts
|
|
1637
|
-
var import_web35 = require("@solana/web3.js");
|
|
1638
|
-
var MINIMUM_SOL_BALANCE = 0.01;
|
|
1639
|
-
var ROUTE_CACHE_DURATION = 2e4;
|
|
1640
|
-
var MAX_INPUT_LIMIT = 1e14;
|
|
1641
|
-
var WRAPPED_SOL_MINT2 = new import_web35.PublicKey("So11111111111111111111111111111111111111112");
|
|
1642
|
-
|
|
1643
1513
|
// src/components/Coinbalance.tsx
|
|
1644
1514
|
var React6 = __toESM(require("react"));
|
|
1645
1515
|
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
@@ -2044,17 +1914,6 @@ var TransactionFee = ({ gasFee, gasless }) => {
|
|
|
2044
1914
|
};
|
|
2045
1915
|
var TransactionFee_default = TransactionFee;
|
|
2046
1916
|
|
|
2047
|
-
// src/queries/useUltraRouter.ts
|
|
2048
|
-
var import_react_query5 = require("@tanstack/react-query");
|
|
2049
|
-
var useUltraRouters = (options) => {
|
|
2050
|
-
return (0, import_react_query5.useQuery)(__spreadValues({
|
|
2051
|
-
queryKey: ["routers"],
|
|
2052
|
-
queryFn: () => ultraSwapService.getRouters(),
|
|
2053
|
-
cacheTime: Infinity,
|
|
2054
|
-
staleTime: Infinity
|
|
2055
|
-
}, options));
|
|
2056
|
-
};
|
|
2057
|
-
|
|
2058
1917
|
// src/components/PriceInfo/index.tsx
|
|
2059
1918
|
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
2060
1919
|
var Index = ({
|
|
@@ -2072,14 +1931,6 @@ var Index = ({
|
|
|
2072
1931
|
// If there's no selectedRoute, we will use first route value to temporarily calculate
|
|
2073
1932
|
outputDecimal: toTokenInfo.decimals
|
|
2074
1933
|
};
|
|
2075
|
-
const { data: routerInfo } = useUltraRouters({
|
|
2076
|
-
select: (data) => {
|
|
2077
|
-
if (!quoteResponse) {
|
|
2078
|
-
return null;
|
|
2079
|
-
}
|
|
2080
|
-
return data.find((router2) => router2.id === quoteResponse.quoteResponse.router);
|
|
2081
|
-
}
|
|
2082
|
-
});
|
|
2083
1934
|
const priceImpact = formatNumber.format(
|
|
2084
1935
|
new import_decimal6.default((quoteResponse == null ? void 0 : quoteResponse.quoteResponse.priceImpactPct) || 0).mul(100).toDP(2)
|
|
2085
1936
|
);
|
|
@@ -2105,7 +1956,7 @@ var Index = ({
|
|
|
2105
1956
|
}
|
|
2106
1957
|
return 0;
|
|
2107
1958
|
}, [quoteResponse]);
|
|
2108
|
-
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: cn("mt-4 space-y-4
|
|
1959
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: cn("mt-4 space-y-4 ", containerClassName), children: [
|
|
2109
1960
|
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex items-center justify-between text-xs", children: [
|
|
2110
1961
|
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "text-primary-text/50", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { children: "Rate" }) }),
|
|
2111
1962
|
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)(
|
|
@@ -2123,13 +1974,6 @@ var Index = ({
|
|
|
2123
1974
|
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { children: "Price Impact" }) }),
|
|
2124
1975
|
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "text-primary-text", children: priceImpactText })
|
|
2125
1976
|
] }),
|
|
2126
|
-
router && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex items-center justify-between text-xs", children: [
|
|
2127
|
-
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "text-primary-text/50", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { children: "Router" }) }),
|
|
2128
|
-
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "flex items-center gap-1", children: routerInfo && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_jsx_runtime24.Fragment, { children: [
|
|
2129
|
-
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("img", { src: routerInfo.icon, alt: quoteResponse.quoteResponse.router, width: 10, height: 10 }),
|
|
2130
|
-
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "text-primary-text", children: routerInfo.name })
|
|
2131
|
-
] }) })
|
|
2132
|
-
] }),
|
|
2133
1977
|
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex items-center justify-between text-xs", children: [
|
|
2134
1978
|
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "text-primary-text/50", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { children: "Fee" }) }),
|
|
2135
1979
|
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "text-primary-text", children: [
|
|
@@ -2182,39 +2026,17 @@ var SwitchPairButton = ({
|
|
|
2182
2026
|
};
|
|
2183
2027
|
var SwitchPairButton_default = SwitchPairButton;
|
|
2184
2028
|
|
|
2185
|
-
// src/components/useTimeDiff/useTimeDiff.tsx
|
|
2186
|
-
var import_react15 = __toESM(require("react"));
|
|
2187
|
-
var useTimeDiff = () => {
|
|
2188
|
-
const { lastRefreshTimestamp } = useSwapContext();
|
|
2189
|
-
const [hasExpired, setHasExpired] = import_react15.default.useState(false);
|
|
2190
|
-
const [timeDiff, setTimeDiff] = (0, import_react15.useState)(0);
|
|
2191
|
-
(0, import_react15.useEffect)(() => {
|
|
2192
|
-
const intervalId = setInterval(() => {
|
|
2193
|
-
if (!lastRefreshTimestamp) {
|
|
2194
|
-
return;
|
|
2195
|
-
}
|
|
2196
|
-
const value = Date.now() > lastRefreshTimestamp + ROUTE_CACHE_DURATION;
|
|
2197
|
-
const elapsedSeconds = (Date.now() - (lastRefreshTimestamp + ROUTE_CACHE_DURATION)) / 1e3;
|
|
2198
|
-
setTimeDiff(elapsedSeconds / (ROUTE_CACHE_DURATION / 1e3) * 100);
|
|
2199
|
-
setHasExpired(value);
|
|
2200
|
-
}, 1e3);
|
|
2201
|
-
return () => clearInterval(intervalId);
|
|
2202
|
-
}, [lastRefreshTimestamp]);
|
|
2203
|
-
return [hasExpired, timeDiff];
|
|
2204
|
-
};
|
|
2205
|
-
var useTimeDiff_default = useTimeDiff;
|
|
2206
|
-
|
|
2207
2029
|
// src/components/Form.tsx
|
|
2208
2030
|
var import_decimal7 = __toESM(require("decimal.js"));
|
|
2209
2031
|
|
|
2210
2032
|
// src/components/JupShield.tsx
|
|
2211
|
-
var
|
|
2033
|
+
var import_react_query4 = require("@tanstack/react-query");
|
|
2212
2034
|
|
|
2213
2035
|
// src/hooks/useMobile.ts
|
|
2214
|
-
var
|
|
2036
|
+
var import_react15 = require("react");
|
|
2215
2037
|
var import_react_use = require("react-use");
|
|
2216
2038
|
var useMobile = () => {
|
|
2217
|
-
const [isDesktop, setIsDesktop] = (0,
|
|
2039
|
+
const [isDesktop, setIsDesktop] = (0, import_react15.useState)(false);
|
|
2218
2040
|
(0, import_react_use.useIsomorphicLayoutEffect)(() => {
|
|
2219
2041
|
function updateSize() {
|
|
2220
2042
|
const desktopQuery = window.matchMedia("(min-width: 1024px)");
|
|
@@ -2228,7 +2050,7 @@ var useMobile = () => {
|
|
|
2228
2050
|
};
|
|
2229
2051
|
|
|
2230
2052
|
// src/components/Popover/Popover.tsx
|
|
2231
|
-
var
|
|
2053
|
+
var import_react16 = require("react");
|
|
2232
2054
|
var import_react_popper = require("react-popper");
|
|
2233
2055
|
var import_lodash = __toESM(require("lodash.debounce"));
|
|
2234
2056
|
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
@@ -2248,16 +2070,16 @@ var Popover = ({
|
|
|
2248
2070
|
offset,
|
|
2249
2071
|
drawShades = false
|
|
2250
2072
|
}) => {
|
|
2251
|
-
const isLocalMode = (0,
|
|
2073
|
+
const isLocalMode = (0, import_react16.useMemo)(
|
|
2252
2074
|
() => typeof isOpen === "undefined",
|
|
2253
2075
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
2254
2076
|
[]
|
|
2255
2077
|
);
|
|
2256
2078
|
const isMobile = useMobile();
|
|
2257
|
-
const [localOpen, setLocalOpen] = (0,
|
|
2258
|
-
const [referenceElement, setReferenceElement] = (0,
|
|
2259
|
-
const [popperElement, setPopperElement] = (0,
|
|
2260
|
-
const shouldShowArrow = (0,
|
|
2079
|
+
const [localOpen, setLocalOpen] = (0, import_react16.useState)(isLocalMode ? false : true);
|
|
2080
|
+
const [referenceElement, setReferenceElement] = (0, import_react16.useState)(null);
|
|
2081
|
+
const [popperElement, setPopperElement] = (0, import_react16.useState)(null);
|
|
2082
|
+
const shouldShowArrow = (0, import_react16.useMemo)(() => Boolean(popoverContent) && arrow, [popoverContent, arrow]);
|
|
2261
2083
|
const modifiers = offset ? [
|
|
2262
2084
|
{
|
|
2263
2085
|
name: "offset",
|
|
@@ -2271,7 +2093,7 @@ var Popover = ({
|
|
|
2271
2093
|
placement,
|
|
2272
2094
|
modifiers
|
|
2273
2095
|
});
|
|
2274
|
-
const handleClose = (0,
|
|
2096
|
+
const handleClose = (0, import_react16.useCallback)(
|
|
2275
2097
|
(0, import_lodash.default)(
|
|
2276
2098
|
() => {
|
|
2277
2099
|
if (isLocalMode) {
|
|
@@ -2286,7 +2108,7 @@ var Popover = ({
|
|
|
2286
2108
|
),
|
|
2287
2109
|
[setLocalOpen, isLocalMode, onClose, trigger, persistOnClick]
|
|
2288
2110
|
);
|
|
2289
|
-
const handleOpen = (0,
|
|
2111
|
+
const handleOpen = (0, import_react16.useCallback)(() => {
|
|
2290
2112
|
handleClose.cancel();
|
|
2291
2113
|
setLocalOpen(true);
|
|
2292
2114
|
}, [setLocalOpen, handleClose]);
|
|
@@ -2406,7 +2228,7 @@ var PopoverTooltip = ({
|
|
|
2406
2228
|
var PopoverTooltip_default = PopoverTooltip;
|
|
2407
2229
|
|
|
2408
2230
|
// src/components/JupShield.tsx
|
|
2409
|
-
var
|
|
2231
|
+
var import_react17 = require("react");
|
|
2410
2232
|
|
|
2411
2233
|
// src/components/Plural/index.tsx
|
|
2412
2234
|
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
@@ -2453,7 +2275,7 @@ var Warnings = ({
|
|
|
2453
2275
|
children,
|
|
2454
2276
|
isHighRisk
|
|
2455
2277
|
}) => {
|
|
2456
|
-
const warningTitle = (0,
|
|
2278
|
+
const warningTitle = (0, import_react17.useCallback)((warning2) => {
|
|
2457
2279
|
return parseShieldWarningtoSentenceCase(warning2);
|
|
2458
2280
|
}, []);
|
|
2459
2281
|
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex gap-1", children: [
|
|
@@ -2466,12 +2288,12 @@ var Warnings = ({
|
|
|
2466
2288
|
};
|
|
2467
2289
|
var JupShield = ({ tokenAddress }) => {
|
|
2468
2290
|
const isMobile = useMobile();
|
|
2469
|
-
const { data, isFetching } = (0,
|
|
2291
|
+
const { data, isFetching } = (0, import_react_query4.useQuery)({
|
|
2470
2292
|
queryKey: ["shield", tokenAddress],
|
|
2471
2293
|
queryFn: () => ultraSwapService.getShield([tokenAddress]),
|
|
2472
|
-
|
|
2294
|
+
gcTime: 5 * 6e4,
|
|
2473
2295
|
staleTime: 5 * 6e4,
|
|
2474
|
-
|
|
2296
|
+
placeholderData: import_react_query4.keepPreviousData,
|
|
2475
2297
|
select: (data2) => {
|
|
2476
2298
|
const warnings = data2.warnings[tokenAddress];
|
|
2477
2299
|
return {
|
|
@@ -2524,10 +2346,166 @@ var JupShield = ({ tokenAddress }) => {
|
|
|
2524
2346
|
};
|
|
2525
2347
|
var JupShield_default = JupShield;
|
|
2526
2348
|
|
|
2527
|
-
// src/
|
|
2349
|
+
// src/queries/useUltraSwapMutation.ts
|
|
2350
|
+
var import_wallet_adapter2 = require("@jup-ag/wallet-adapter");
|
|
2351
|
+
var import_react_query5 = require("@tanstack/react-query");
|
|
2352
|
+
var import_buffer = require("buffer");
|
|
2353
|
+
var import_web34 = require("@solana/web3.js");
|
|
2354
|
+
|
|
2355
|
+
// src/entity/TransactionError.ts
|
|
2356
|
+
var TransactionError = class extends Error {
|
|
2357
|
+
constructor(message, txid, code, programIds, serializedTx) {
|
|
2358
|
+
super(message);
|
|
2359
|
+
this.name = "TransactionError";
|
|
2360
|
+
this.txid = txid;
|
|
2361
|
+
this.code = code;
|
|
2362
|
+
this.programIds = programIds;
|
|
2363
|
+
this.serializedTx = serializedTx;
|
|
2364
|
+
}
|
|
2365
|
+
};
|
|
2366
|
+
|
|
2367
|
+
// src/queries/useUltraSwapMutation.ts
|
|
2368
|
+
var UltraSwapError = class extends Error {
|
|
2369
|
+
constructor(message, type2, txid) {
|
|
2370
|
+
super(message);
|
|
2371
|
+
this.type = type2;
|
|
2372
|
+
this.txid = txid;
|
|
2373
|
+
}
|
|
2374
|
+
};
|
|
2375
|
+
function useUltraSwapMutation() {
|
|
2376
|
+
const { wallet, signTransaction } = useWalletPassThrough();
|
|
2377
|
+
return (0, import_react_query5.useMutation)({
|
|
2378
|
+
mutationFn: (_0) => __async(this, [_0], function* ({
|
|
2379
|
+
setTxStatus,
|
|
2380
|
+
setLastSwapResult,
|
|
2381
|
+
fromTokenInfo,
|
|
2382
|
+
toTokenInfo,
|
|
2383
|
+
quoteResponseMeta
|
|
2384
|
+
}) {
|
|
2385
|
+
const publicKey = wallet == null ? void 0 : wallet.adapter.publicKey;
|
|
2386
|
+
if (!signTransaction || !publicKey) {
|
|
2387
|
+
throw new UltraSwapError(
|
|
2388
|
+
"Wallet not connected, or missing wallet functions",
|
|
2389
|
+
"WALLET_SIGNING_FAILED" /* WALLET_SIGNING_FAILED */
|
|
2390
|
+
);
|
|
2391
|
+
}
|
|
2392
|
+
setTxStatus({
|
|
2393
|
+
txid: "",
|
|
2394
|
+
status: "pending-approval"
|
|
2395
|
+
});
|
|
2396
|
+
const selectedQuote = quoteResponseMeta.original;
|
|
2397
|
+
const { transaction, requestId } = selectedQuote;
|
|
2398
|
+
if (!transaction) throw new Error("Missing transaction");
|
|
2399
|
+
const based64tx = import_buffer.Buffer.from(transaction, "base64");
|
|
2400
|
+
const versionedTransaction = import_web34.VersionedTransaction.deserialize(new Uint8Array(based64tx));
|
|
2401
|
+
const signedTransaction = yield signTransaction(versionedTransaction);
|
|
2402
|
+
const serializedTransaction = import_buffer.Buffer.from(signedTransaction.serialize()).toString("base64");
|
|
2403
|
+
setTxStatus({
|
|
2404
|
+
txid: "",
|
|
2405
|
+
status: "sending"
|
|
2406
|
+
});
|
|
2407
|
+
const response = yield ultraSwapService.submitSwap(serializedTransaction, requestId);
|
|
2408
|
+
const { signature, status } = response;
|
|
2409
|
+
if (status === "Failed") {
|
|
2410
|
+
throw new UltraSwapError(response.error, "FAILED" /* FAILED */, signature);
|
|
2411
|
+
}
|
|
2412
|
+
const { inputAmountResult, outputAmountResult } = response;
|
|
2413
|
+
setTxStatus({
|
|
2414
|
+
txid: signature,
|
|
2415
|
+
status: "success"
|
|
2416
|
+
});
|
|
2417
|
+
setLastSwapResult({
|
|
2418
|
+
swapResult: {
|
|
2419
|
+
txid: signature,
|
|
2420
|
+
inputAddress: new import_web34.PublicKey(fromTokenInfo.id),
|
|
2421
|
+
outputAddress: new import_web34.PublicKey(toTokenInfo.id),
|
|
2422
|
+
inputAmount: Number(inputAmountResult),
|
|
2423
|
+
outputAmount: Number(outputAmountResult)
|
|
2424
|
+
},
|
|
2425
|
+
quoteReponse: quoteResponseMeta
|
|
2426
|
+
});
|
|
2427
|
+
return signature;
|
|
2428
|
+
}),
|
|
2429
|
+
onError: (error, variables) => __async(this, null, function* () {
|
|
2430
|
+
const { setTxStatus, setLastSwapResult, quoteResponseMeta } = variables;
|
|
2431
|
+
if (error instanceof import_wallet_adapter2.WalletSignTransactionError) {
|
|
2432
|
+
const message = error.message || error.error || "Transaction cancelled";
|
|
2433
|
+
setLastSwapResult({
|
|
2434
|
+
swapResult: {
|
|
2435
|
+
error: new TransactionError(message)
|
|
2436
|
+
},
|
|
2437
|
+
quoteReponse: quoteResponseMeta
|
|
2438
|
+
});
|
|
2439
|
+
return;
|
|
2440
|
+
}
|
|
2441
|
+
if (error instanceof Error) {
|
|
2442
|
+
setLastSwapResult({
|
|
2443
|
+
swapResult: {
|
|
2444
|
+
error: new TransactionError(error.message)
|
|
2445
|
+
},
|
|
2446
|
+
quoteReponse: quoteResponseMeta
|
|
2447
|
+
});
|
|
2448
|
+
return;
|
|
2449
|
+
}
|
|
2450
|
+
if ("json" in error) {
|
|
2451
|
+
const json = yield error.json();
|
|
2452
|
+
setLastSwapResult({
|
|
2453
|
+
swapResult: {
|
|
2454
|
+
error: new TransactionError(json.error || "Unknown error")
|
|
2455
|
+
},
|
|
2456
|
+
quoteReponse: quoteResponseMeta
|
|
2457
|
+
});
|
|
2458
|
+
setTxStatus({
|
|
2459
|
+
txid: json.txid || "",
|
|
2460
|
+
status: "fail"
|
|
2461
|
+
});
|
|
2462
|
+
}
|
|
2463
|
+
})
|
|
2464
|
+
});
|
|
2465
|
+
}
|
|
2466
|
+
|
|
2467
|
+
// src/components/SubmitButton.tsx
|
|
2468
|
+
var import_react18 = require("react");
|
|
2528
2469
|
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
2470
|
+
var SubmitButton = ({ onSubmit }) => {
|
|
2471
|
+
const {
|
|
2472
|
+
quoteResponseMeta,
|
|
2473
|
+
loading,
|
|
2474
|
+
errors,
|
|
2475
|
+
swapping: { txStatus },
|
|
2476
|
+
form
|
|
2477
|
+
} = useSwapContext();
|
|
2478
|
+
const shouldButtonDisabled = (0, import_react18.useMemo)(() => {
|
|
2479
|
+
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") {
|
|
2480
|
+
return true;
|
|
2481
|
+
}
|
|
2482
|
+
return false;
|
|
2483
|
+
}, [quoteResponseMeta, loading, errors.fromValue, txStatus]);
|
|
2484
|
+
const buttonText = (0, import_react18.useMemo)(() => {
|
|
2485
|
+
var _a2;
|
|
2486
|
+
if (errors.fromValue) return errors.fromValue.title;
|
|
2487
|
+
if ((_a2 = quoteResponseMeta == null ? void 0 : quoteResponseMeta.quoteResponse) == null ? void 0 : _a2.errorMessage) return quoteResponseMeta.quoteResponse.errorMessage;
|
|
2488
|
+
if (loading) return "Loading";
|
|
2489
|
+
if ((txStatus == null ? void 0 : txStatus.status) === "sending") return "Sending";
|
|
2490
|
+
if ((txStatus == null ? void 0 : txStatus.status) === "pending-approval") return "Pending Approval";
|
|
2491
|
+
return "Swap";
|
|
2492
|
+
}, [txStatus, errors.fromValue, loading, quoteResponseMeta]);
|
|
2493
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
2494
|
+
JupButton_default,
|
|
2495
|
+
{
|
|
2496
|
+
size: "lg",
|
|
2497
|
+
className: cn("w-full mt-4 disabled:opacity-50 !text-uiv2-text/75 !bg-primary "),
|
|
2498
|
+
onClick: onSubmit,
|
|
2499
|
+
disabled: shouldButtonDisabled,
|
|
2500
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { children: buttonText })
|
|
2501
|
+
}
|
|
2502
|
+
);
|
|
2503
|
+
};
|
|
2504
|
+
|
|
2505
|
+
// src/components/Form.tsx
|
|
2506
|
+
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
2529
2507
|
var FormInputContainer = ({ tokenInfo, onBalanceClick, title, pairSelectDisabled, onClickSelectPair, children, value }) => {
|
|
2530
|
-
return /* @__PURE__ */ (0,
|
|
2508
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
2531
2509
|
"div",
|
|
2532
2510
|
{
|
|
2533
2511
|
className: cn(
|
|
@@ -2536,9 +2514,9 @@ var FormInputContainer = ({ tokenInfo, onBalanceClick, title, pairSelectDisabled
|
|
|
2536
2514
|
"group focus-within:border-primary/50 focus-within:shadow-swap-input-dark rounded-xl"
|
|
2537
2515
|
),
|
|
2538
2516
|
children: [
|
|
2539
|
-
/* @__PURE__ */ (0,
|
|
2540
|
-
/* @__PURE__ */ (0,
|
|
2541
|
-
tokenInfo && /* @__PURE__ */ (0,
|
|
2517
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex justify-between items-center text-xs text-primary-text", children: [
|
|
2518
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { children: title }),
|
|
2519
|
+
tokenInfo && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
2542
2520
|
"div",
|
|
2543
2521
|
{
|
|
2544
2522
|
className: cn("flex space-x-1 text-xs items-center text-primary-text/50 fill-current ", {
|
|
@@ -2548,16 +2526,16 @@ var FormInputContainer = ({ tokenInfo, onBalanceClick, title, pairSelectDisabled
|
|
|
2548
2526
|
onBalanceClick == null ? void 0 : onBalanceClick(e);
|
|
2549
2527
|
},
|
|
2550
2528
|
children: [
|
|
2551
|
-
/* @__PURE__ */ (0,
|
|
2552
|
-
/* @__PURE__ */ (0,
|
|
2553
|
-
/* @__PURE__ */ (0,
|
|
2529
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(WalletIcon_default, { width: 10, height: 10 }),
|
|
2530
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Coinbalance_default, { mintAddress: tokenInfo.id, hideZeroBalance: false }),
|
|
2531
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { children: tokenInfo.symbol })
|
|
2554
2532
|
]
|
|
2555
2533
|
}
|
|
2556
2534
|
)
|
|
2557
2535
|
] }),
|
|
2558
|
-
/* @__PURE__ */ (0,
|
|
2559
|
-
/* @__PURE__ */ (0,
|
|
2560
|
-
/* @__PURE__ */ (0,
|
|
2536
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex", children: [
|
|
2537
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { children: [
|
|
2538
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
2561
2539
|
"button",
|
|
2562
2540
|
{
|
|
2563
2541
|
type: "button",
|
|
@@ -2567,25 +2545,25 @@ var FormInputContainer = ({ tokenInfo, onBalanceClick, title, pairSelectDisabled
|
|
|
2567
2545
|
disabled: pairSelectDisabled,
|
|
2568
2546
|
onClick: onClickSelectPair,
|
|
2569
2547
|
children: [
|
|
2570
|
-
/* @__PURE__ */ (0,
|
|
2571
|
-
/* @__PURE__ */ (0,
|
|
2572
|
-
pairSelectDisabled ? null : /* @__PURE__ */ (0,
|
|
2548
|
+
/* @__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 }) }),
|
|
2549
|
+
/* @__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 }) }),
|
|
2550
|
+
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, {}) })
|
|
2573
2551
|
]
|
|
2574
2552
|
}
|
|
2575
2553
|
),
|
|
2576
|
-
/* @__PURE__ */ (0,
|
|
2554
|
+
/* @__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 }) })
|
|
2577
2555
|
] }),
|
|
2578
|
-
/* @__PURE__ */ (0,
|
|
2556
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex flex-col items-end justify-between w-full", children: [
|
|
2579
2557
|
children,
|
|
2580
|
-
/* @__PURE__ */ (0,
|
|
2558
|
+
/* @__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 }) })
|
|
2581
2559
|
] })
|
|
2582
2560
|
] })
|
|
2583
2561
|
]
|
|
2584
2562
|
}
|
|
2585
2563
|
);
|
|
2586
2564
|
};
|
|
2587
|
-
var Form = ({
|
|
2588
|
-
const { publicKey } = useWalletPassThrough();
|
|
2565
|
+
var Form = ({ setSelectPairSelector }) => {
|
|
2566
|
+
const { publicKey, wallet } = useWalletPassThrough();
|
|
2589
2567
|
const { data: balances } = useBalances();
|
|
2590
2568
|
const {
|
|
2591
2569
|
form,
|
|
@@ -2595,19 +2573,32 @@ var Form = ({ onSubmit, isDisabled, setSelectPairSelector }) => {
|
|
|
2595
2573
|
quoteResponseMeta,
|
|
2596
2574
|
formProps: { fixedAmount, swapMode, fixedMint },
|
|
2597
2575
|
loading,
|
|
2598
|
-
refresh,
|
|
2599
|
-
quoteError,
|
|
2600
|
-
errors,
|
|
2601
2576
|
isToPairFocused,
|
|
2602
|
-
|
|
2577
|
+
setTxStatus,
|
|
2578
|
+
setLastSwapResult
|
|
2603
2579
|
} = useSwapContext();
|
|
2604
|
-
const [hasExpired, timeDiff] = useTimeDiff_default();
|
|
2605
2580
|
const { setScreen } = useScreenState();
|
|
2606
|
-
|
|
2607
|
-
|
|
2608
|
-
|
|
2581
|
+
const { mutateAsync: ultraSwapMutation } = useUltraSwapMutation();
|
|
2582
|
+
const onSubmit = (0, import_react19.useCallback)(() => __async(void 0, null, function* () {
|
|
2583
|
+
if (!wallet || !wallet.adapter.publicKey || !quoteResponseMeta) {
|
|
2584
|
+
return null;
|
|
2609
2585
|
}
|
|
2610
|
-
|
|
2586
|
+
try {
|
|
2587
|
+
if (!fromTokenInfo) throw new Error("Missing fromTokenInfo");
|
|
2588
|
+
if (!toTokenInfo) throw new Error("Missing toTokenInfo");
|
|
2589
|
+
yield ultraSwapMutation({
|
|
2590
|
+
quoteResponseMeta,
|
|
2591
|
+
fromTokenInfo,
|
|
2592
|
+
toTokenInfo,
|
|
2593
|
+
setTxStatus,
|
|
2594
|
+
setLastSwapResult
|
|
2595
|
+
});
|
|
2596
|
+
} catch (error) {
|
|
2597
|
+
console.log("Swap error", error);
|
|
2598
|
+
} finally {
|
|
2599
|
+
setScreen("Swapping");
|
|
2600
|
+
}
|
|
2601
|
+
}), [wallet, quoteResponseMeta, ultraSwapMutation, fromTokenInfo, toTokenInfo, setTxStatus, setLastSwapResult, setScreen]);
|
|
2611
2602
|
const shouldDisabledFromSelector = (0, import_react19.useMemo)(() => {
|
|
2612
2603
|
if ((fromTokenInfo == null ? void 0 : fromTokenInfo.id) === fixedMint) {
|
|
2613
2604
|
return true;
|
|
@@ -2707,15 +2698,9 @@ var Form = ({ onSubmit, isDisabled, setSelectPairSelector }) => {
|
|
|
2707
2698
|
},
|
|
2708
2699
|
[setScreen]
|
|
2709
2700
|
);
|
|
2710
|
-
|
|
2711
|
-
|
|
2712
|
-
|
|
2713
|
-
}
|
|
2714
|
-
return false;
|
|
2715
|
-
}, [isDisabled, loading, errors.fromValue]);
|
|
2716
|
-
return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "h-full flex flex-col items-center justify-center", children: [
|
|
2717
|
-
/* @__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: [
|
|
2718
|
-
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
2701
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "h-full flex flex-col items-center justify-center", children: [
|
|
2702
|
+
/* @__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: [
|
|
2703
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
2719
2704
|
FormInputContainer,
|
|
2720
2705
|
{
|
|
2721
2706
|
tokenInfo: fromTokenInfo,
|
|
@@ -2727,7 +2712,7 @@ var Form = ({ onSubmit, isDisabled, setSelectPairSelector }) => {
|
|
|
2727
2712
|
pairSelectDisabled: shouldDisabledFromSelector,
|
|
2728
2713
|
onClickSelectPair: onClickSelectFromMint,
|
|
2729
2714
|
value: form.fromValue,
|
|
2730
|
-
children: (fromTokenInfo == null ? void 0 : fromTokenInfo.decimals) && /* @__PURE__ */ (0,
|
|
2715
|
+
children: (fromTokenInfo == null ? void 0 : fromTokenInfo.decimals) && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
2731
2716
|
import_react_number_format.NumericFormat,
|
|
2732
2717
|
{
|
|
2733
2718
|
disabled: fixedAmount || swapMode === SwapMode.ExactOut,
|
|
@@ -2754,8 +2739,8 @@ var Form = ({ onSubmit, isDisabled, setSelectPairSelector }) => {
|
|
|
2754
2739
|
)
|
|
2755
2740
|
}
|
|
2756
2741
|
),
|
|
2757
|
-
/* @__PURE__ */ (0,
|
|
2758
|
-
/* @__PURE__ */ (0,
|
|
2742
|
+
/* @__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") }) }),
|
|
2743
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
2759
2744
|
FormInputContainer,
|
|
2760
2745
|
{
|
|
2761
2746
|
tokenInfo: toTokenInfo,
|
|
@@ -2763,7 +2748,7 @@ var Form = ({ onSubmit, isDisabled, setSelectPairSelector }) => {
|
|
|
2763
2748
|
pairSelectDisabled: shouldDisabledToSelector,
|
|
2764
2749
|
onClickSelectPair: onClickSelectToMint,
|
|
2765
2750
|
value: form.toValue,
|
|
2766
|
-
children: (toTokenInfo == null ? void 0 : toTokenInfo.decimals) && /* @__PURE__ */ (0,
|
|
2751
|
+
children: (toTokenInfo == null ? void 0 : toTokenInfo.decimals) && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
2767
2752
|
import_react_number_format.NumericFormat,
|
|
2768
2753
|
{
|
|
2769
2754
|
inputMode: "decimal",
|
|
@@ -2794,21 +2779,9 @@ var Form = ({ onSubmit, isDisabled, setSelectPairSelector }) => {
|
|
|
2794
2779
|
}
|
|
2795
2780
|
)
|
|
2796
2781
|
] }) }),
|
|
2797
|
-
/* @__PURE__ */ (0,
|
|
2798
|
-
!walletPublicKey ? /* @__PURE__ */ (0,
|
|
2799
|
-
|
|
2800
|
-
{
|
|
2801
|
-
size: "lg",
|
|
2802
|
-
className: cn("w-full mt-4 disabled:opacity-50 !text-uiv2-text/75 !bg-primary "),
|
|
2803
|
-
onClick: () => {
|
|
2804
|
-
onSubmit();
|
|
2805
|
-
onSubmitUltra();
|
|
2806
|
-
},
|
|
2807
|
-
disabled: shouldButtonDisabled,
|
|
2808
|
-
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" })
|
|
2809
|
-
}
|
|
2810
|
-
),
|
|
2811
|
-
quoteResponseMeta && fromTokenInfo && toTokenInfo ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
2782
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "w-full px-2", children: [
|
|
2783
|
+
!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 }),
|
|
2784
|
+
quoteResponseMeta && fromTokenInfo && toTokenInfo ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
2812
2785
|
PriceInfo_default,
|
|
2813
2786
|
{
|
|
2814
2787
|
quoteResponse: quoteResponseMeta,
|
|
@@ -2828,9 +2801,9 @@ var import_react_virtualized_auto_sizer = __toESM(require("react-virtualized-aut
|
|
|
2828
2801
|
var import_react_window = require("react-window");
|
|
2829
2802
|
|
|
2830
2803
|
// src/icons/LeftArrowIcon.tsx
|
|
2831
|
-
var
|
|
2804
|
+
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
2832
2805
|
var LeftArrowIcon = ({ width = "12", height = "12" }) => {
|
|
2833
|
-
return /* @__PURE__ */ (0,
|
|
2806
|
+
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)(
|
|
2834
2807
|
"path",
|
|
2835
2808
|
{
|
|
2836
2809
|
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",
|
|
@@ -2841,9 +2814,9 @@ var LeftArrowIcon = ({ width = "12", height = "12" }) => {
|
|
|
2841
2814
|
var LeftArrowIcon_default = LeftArrowIcon;
|
|
2842
2815
|
|
|
2843
2816
|
// src/icons/SearchIcon.tsx
|
|
2844
|
-
var
|
|
2817
|
+
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
2845
2818
|
var SearchIcon = () => {
|
|
2846
|
-
return /* @__PURE__ */ (0,
|
|
2819
|
+
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)(
|
|
2847
2820
|
"path",
|
|
2848
2821
|
{
|
|
2849
2822
|
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",
|
|
@@ -2863,7 +2836,7 @@ var import_decimal8 = __toESM(require("decimal.js"));
|
|
|
2863
2836
|
|
|
2864
2837
|
// src/contexts/preferredExplorer/index.tsx
|
|
2865
2838
|
var import_react20 = require("react");
|
|
2866
|
-
var
|
|
2839
|
+
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
2867
2840
|
var AVAILABLE_EXPLORER = [
|
|
2868
2841
|
{
|
|
2869
2842
|
name: "Solana Explorer",
|
|
@@ -2939,7 +2912,7 @@ var PreferredExplorerProvider = ({
|
|
|
2939
2912
|
(mint, cluster) => explorerObject.getToken(mint, cluster),
|
|
2940
2913
|
[explorerObject]
|
|
2941
2914
|
);
|
|
2942
|
-
return /* @__PURE__ */ (0,
|
|
2915
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
2943
2916
|
PreferredExplorerContext.Provider,
|
|
2944
2917
|
{
|
|
2945
2918
|
value: { explorer, getExplorer, getTokenExplorer, setExplorer: (explorer2) => setExplorer(explorer2) },
|
|
@@ -2953,8 +2926,8 @@ function usePreferredExplorer() {
|
|
|
2953
2926
|
}
|
|
2954
2927
|
|
|
2955
2928
|
// src/icons/ExternalIcon.tsx
|
|
2956
|
-
var
|
|
2957
|
-
var ExternalIcon = () => /* @__PURE__ */ (0,
|
|
2929
|
+
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
2930
|
+
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)(
|
|
2958
2931
|
"path",
|
|
2959
2932
|
{
|
|
2960
2933
|
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",
|
|
@@ -2964,10 +2937,10 @@ var ExternalIcon = () => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("svg", {
|
|
|
2964
2937
|
var ExternalIcon_default = ExternalIcon;
|
|
2965
2938
|
|
|
2966
2939
|
// src/components/TokenLink.tsx
|
|
2967
|
-
var
|
|
2940
|
+
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
2968
2941
|
var TokenLink = ({ tokenInfo, className }) => {
|
|
2969
2942
|
const { getTokenExplorer } = usePreferredExplorer();
|
|
2970
|
-
return /* @__PURE__ */ (0,
|
|
2943
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(
|
|
2971
2944
|
"a",
|
|
2972
2945
|
{
|
|
2973
2946
|
target: "_blank",
|
|
@@ -2979,8 +2952,8 @@ var TokenLink = ({ tokenInfo, className }) => {
|
|
|
2979
2952
|
href: getTokenExplorer(tokenInfo.id),
|
|
2980
2953
|
onClick: (e) => e.stopPropagation(),
|
|
2981
2954
|
children: [
|
|
2982
|
-
/* @__PURE__ */ (0,
|
|
2983
|
-
/* @__PURE__ */ (0,
|
|
2955
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: "text-xxs", children: shortenAddress(tokenInfo.id) }),
|
|
2956
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(ExternalIcon_default, {})
|
|
2984
2957
|
]
|
|
2985
2958
|
}
|
|
2986
2959
|
);
|
|
@@ -2989,9 +2962,9 @@ TokenLink.displayName = "TokenLink";
|
|
|
2989
2962
|
var TokenLink_default = TokenLink;
|
|
2990
2963
|
|
|
2991
2964
|
// src/components/CheckedBadge.tsx
|
|
2992
|
-
var
|
|
2965
|
+
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
2993
2966
|
var CheckedBadge = ({ width = 24, height = 24 }) => {
|
|
2994
|
-
return /* @__PURE__ */ (0,
|
|
2967
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(
|
|
2995
2968
|
"svg",
|
|
2996
2969
|
{
|
|
2997
2970
|
width,
|
|
@@ -3000,7 +2973,7 @@ var CheckedBadge = ({ width = 24, height = 24 }) => {
|
|
|
3000
2973
|
fill: "none",
|
|
3001
2974
|
xmlns: "http://www.w3.org/2000/svg",
|
|
3002
2975
|
children: [
|
|
3003
|
-
/* @__PURE__ */ (0,
|
|
2976
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
3004
2977
|
"path",
|
|
3005
2978
|
{
|
|
3006
2979
|
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",
|
|
@@ -3010,7 +2983,7 @@ var CheckedBadge = ({ width = 24, height = 24 }) => {
|
|
|
3010
2983
|
strokeLinejoin: "round"
|
|
3011
2984
|
}
|
|
3012
2985
|
),
|
|
3013
|
-
/* @__PURE__ */ (0,
|
|
2986
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
3014
2987
|
"path",
|
|
3015
2988
|
{
|
|
3016
2989
|
d: "M9 12L10.8189 13.8189V13.8189C10.9189 13.9189 11.0811 13.9189 11.1811 13.8189V13.8189L15 10",
|
|
@@ -3027,27 +3000,25 @@ var CheckedBadge = ({ width = 24, height = 24 }) => {
|
|
|
3027
3000
|
var CheckedBadge_default = CheckedBadge;
|
|
3028
3001
|
|
|
3029
3002
|
// src/queries/useLstApy.ts
|
|
3030
|
-
var
|
|
3003
|
+
var import_react_query6 = require("@tanstack/react-query");
|
|
3031
3004
|
function useLstApyFetcher() {
|
|
3032
|
-
return (0,
|
|
3033
|
-
["lst-apy"],
|
|
3034
|
-
() => __async(this, null, function* () {
|
|
3005
|
+
return (0, import_react_query6.useQuery)({
|
|
3006
|
+
queryKey: ["lst-apy"],
|
|
3007
|
+
queryFn: () => __async(this, null, function* () {
|
|
3035
3008
|
const lstApy = yield fetch(`https://worker.jup.ag/lst-apys`);
|
|
3036
3009
|
const apyResult = yield lstApy.json();
|
|
3037
3010
|
return apyResult;
|
|
3038
3011
|
}),
|
|
3039
|
-
|
|
3040
|
-
|
|
3041
|
-
|
|
3042
|
-
|
|
3043
|
-
|
|
3044
|
-
}
|
|
3045
|
-
);
|
|
3012
|
+
retry: 3,
|
|
3013
|
+
placeholderData: import_react_query6.keepPreviousData,
|
|
3014
|
+
staleTime: 3e5
|
|
3015
|
+
// 5m
|
|
3016
|
+
});
|
|
3046
3017
|
}
|
|
3047
3018
|
|
|
3048
3019
|
// src/components/FormPairRow.tsx
|
|
3049
|
-
var
|
|
3050
|
-
var
|
|
3020
|
+
var import_react_query7 = require("@tanstack/react-query");
|
|
3021
|
+
var import_jsx_runtime39 = require("react/jsx-runtime");
|
|
3051
3022
|
var PAIR_ROW_HEIGHT = 72;
|
|
3052
3023
|
var LSTTag = ({ mintAddress }) => {
|
|
3053
3024
|
const { data: lstApy } = useLstApyFetcher();
|
|
@@ -3059,7 +3030,7 @@ var LSTTag = ({ mintAddress }) => {
|
|
|
3059
3030
|
}
|
|
3060
3031
|
return;
|
|
3061
3032
|
}, [lstApy, mintAddress]);
|
|
3062
|
-
return /* @__PURE__ */ (0,
|
|
3033
|
+
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: [
|
|
3063
3034
|
"LST ",
|
|
3064
3035
|
apy ? `${apy}%` : ""
|
|
3065
3036
|
] });
|
|
@@ -3095,10 +3066,10 @@ var MultiTags = ({ item }) => {
|
|
|
3095
3066
|
const remainingTags = [];
|
|
3096
3067
|
if (!renderedTag) return null;
|
|
3097
3068
|
const { isToken2022, isFrozen, isLST } = renderedTag;
|
|
3098
|
-
return /* @__PURE__ */ (0,
|
|
3099
|
-
isFrozen && /* @__PURE__ */ (0,
|
|
3100
|
-
isToken2022 && /* @__PURE__ */ (0,
|
|
3101
|
-
remainingTags == null ? void 0 : remainingTags.map((tag, idx) => /* @__PURE__ */ (0,
|
|
3069
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "flex justify-end gap-x-1", children: [
|
|
3070
|
+
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" }),
|
|
3071
|
+
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" }),
|
|
3072
|
+
remainingTags == null ? void 0 : remainingTags.map((tag, idx) => /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
3102
3073
|
"div",
|
|
3103
3074
|
{
|
|
3104
3075
|
className: "rounded-md text-xxs leading-none transition-all py-0.5 px-1 bg-black/10 font-semibold text-primary-text/20",
|
|
@@ -3106,7 +3077,7 @@ var MultiTags = ({ item }) => {
|
|
|
3106
3077
|
},
|
|
3107
3078
|
idx
|
|
3108
3079
|
)),
|
|
3109
|
-
isLST && /* @__PURE__ */ (0,
|
|
3080
|
+
isLST && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(LSTTag, { mintAddress: item.id })
|
|
3110
3081
|
] });
|
|
3111
3082
|
};
|
|
3112
3083
|
var FormPairRow = (props) => {
|
|
@@ -3119,7 +3090,7 @@ var FormPairRow = (props) => {
|
|
|
3119
3090
|
showExplorer = true,
|
|
3120
3091
|
enableUnknownTokenWarning = true
|
|
3121
3092
|
} = props;
|
|
3122
|
-
const queryClient = (0,
|
|
3093
|
+
const queryClient = (0, import_react_query7.useQueryClient)();
|
|
3123
3094
|
const onClick = import_react21.default.useCallback(() => {
|
|
3124
3095
|
queryClient.setQueryData([...ASSET_QUERY_KEY, item.id], [item]);
|
|
3125
3096
|
onSubmit(item);
|
|
@@ -3129,27 +3100,27 @@ var FormPairRow = (props) => {
|
|
|
3129
3100
|
const balance = (_a2 = balances == null ? void 0 : balances[item.id]) == null ? void 0 : _a2.uiAmount;
|
|
3130
3101
|
const usdValue = balance ? new import_decimal8.default(balance).mul(item.usdPrice || 0) : void 0;
|
|
3131
3102
|
const usdValueDisplay = usdValue && usdValue.gte(0.01) ? `$${formatNumber.format(usdValue, 2)}` : "";
|
|
3132
|
-
return /* @__PURE__ */ (0,
|
|
3103
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
3133
3104
|
"li",
|
|
3134
3105
|
{
|
|
3135
3106
|
className: `rounded cursor-pointer px-5 my-1 list-none flex w-full items-center bg-interactive hover:bg-interactive/80`,
|
|
3136
3107
|
style: __spreadValues({ maxHeight: PAIR_ROW_HEIGHT - 4, height: PAIR_ROW_HEIGHT - 4 }, style),
|
|
3137
3108
|
onClick,
|
|
3138
3109
|
translate: "no",
|
|
3139
|
-
children: /* @__PURE__ */ (0,
|
|
3140
|
-
/* @__PURE__ */ (0,
|
|
3141
|
-
/* @__PURE__ */ (0,
|
|
3142
|
-
/* @__PURE__ */ (0,
|
|
3143
|
-
/* @__PURE__ */ (0,
|
|
3144
|
-
checkIsStrictOrVerified(item) && /* @__PURE__ */ (0,
|
|
3110
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "flex h-full w-full items-center space-x-4", children: [
|
|
3111
|
+
/* @__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 }) }) }),
|
|
3112
|
+
/* @__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: [
|
|
3113
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "flex items-center", children: [
|
|
3114
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("p", { className: "text-sm font-medium text-primary-text truncate", children: item.symbol }),
|
|
3115
|
+
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 }) })
|
|
3145
3116
|
] }),
|
|
3146
|
-
/* @__PURE__ */ (0,
|
|
3147
|
-
showExplorer ? /* @__PURE__ */ (0,
|
|
3117
|
+
/* @__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 }),
|
|
3118
|
+
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
|
|
3148
3119
|
] }) }),
|
|
3149
|
-
/* @__PURE__ */ (0,
|
|
3150
|
-
/* @__PURE__ */ (0,
|
|
3151
|
-
usdValueDisplay ? /* @__PURE__ */ (0,
|
|
3152
|
-
/* @__PURE__ */ (0,
|
|
3120
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "text-xs text-primary-text/50 text-right h-full flex flex-col justify-evenly", children: [
|
|
3121
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Coinbalance_default, { mintAddress: item.id, hideZeroBalance: true }),
|
|
3122
|
+
usdValueDisplay ? /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("p", { children: usdValueDisplay }) : null,
|
|
3123
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(MultiTags, __spreadValues({}, props))
|
|
3153
3124
|
] })
|
|
3154
3125
|
] })
|
|
3155
3126
|
}
|
|
@@ -3159,12 +3130,12 @@ var FormPairRow_default = FormPairRow;
|
|
|
3159
3130
|
|
|
3160
3131
|
// src/hooks/useSearch.ts
|
|
3161
3132
|
var import_react22 = require("react");
|
|
3162
|
-
var
|
|
3133
|
+
var import_react_query8 = require("@tanstack/react-query");
|
|
3163
3134
|
var CHUNK_SIZE = 100;
|
|
3164
3135
|
var useSearch = (mintAddresses, options = {}) => {
|
|
3165
3136
|
var _a2, _b;
|
|
3166
3137
|
const mintAddressesString = (0, import_react22.useMemo)(() => mintAddresses.join(","), [mintAddresses]);
|
|
3167
|
-
return (0,
|
|
3138
|
+
return (0, import_react_query8.useQuery)({
|
|
3168
3139
|
queryKey: ["search", mintAddressesString],
|
|
3169
3140
|
queryFn: () => __async(void 0, null, function* () {
|
|
3170
3141
|
if (mintAddresses.length === 0) {
|
|
@@ -3186,13 +3157,13 @@ var useSearch = (mintAddresses, options = {}) => {
|
|
|
3186
3157
|
};
|
|
3187
3158
|
|
|
3188
3159
|
// src/components/FormPairSelector.tsx
|
|
3189
|
-
var
|
|
3160
|
+
var import_jsx_runtime40 = require("react/jsx-runtime");
|
|
3190
3161
|
var PAIR_ROW_HEIGHT2 = 72;
|
|
3191
3162
|
var SEARCH_BOX_HEIGHT = 56;
|
|
3192
3163
|
var rowRenderer = (0, import_react23.memo)((props) => {
|
|
3193
3164
|
const { data, index, style } = props;
|
|
3194
3165
|
const item = data.searchResult[index];
|
|
3195
|
-
return /* @__PURE__ */ (0,
|
|
3166
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(FormPairRow_default, { item, style, onSubmit: data.onSubmit }, item.address);
|
|
3196
3167
|
}, import_react_window.areEqual);
|
|
3197
3168
|
var FormPairSelector = ({ onSubmit, onClose }) => {
|
|
3198
3169
|
const [search, setSearch] = (0, import_react23.useState)("");
|
|
@@ -3226,20 +3197,20 @@ var FormPairSelector = ({ onSubmit, onClose }) => {
|
|
|
3226
3197
|
var _a2;
|
|
3227
3198
|
return (_a2 = inputRef.current) == null ? void 0 : _a2.focus();
|
|
3228
3199
|
}, [inputRef]);
|
|
3229
|
-
return /* @__PURE__ */ (0,
|
|
3230
|
-
/* @__PURE__ */ (0,
|
|
3231
|
-
/* @__PURE__ */ (0,
|
|
3232
|
-
/* @__PURE__ */ (0,
|
|
3233
|
-
/* @__PURE__ */ (0,
|
|
3200
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "flex flex-col h-full w-full py-4 px-2 bg-black", children: [
|
|
3201
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "flex w-full justify-between", children: [
|
|
3202
|
+
/* @__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 }) }),
|
|
3203
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "text-primary-text", children: "Select Token" }),
|
|
3204
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: " w-6 h-6" })
|
|
3234
3205
|
] }),
|
|
3235
|
-
/* @__PURE__ */ (0,
|
|
3206
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(
|
|
3236
3207
|
"div",
|
|
3237
3208
|
{
|
|
3238
3209
|
className: "flex px-5 mt-4 w-[98%] rounded-xl bg-module",
|
|
3239
3210
|
style: { height: SEARCH_BOX_HEIGHT, maxHeight: SEARCH_BOX_HEIGHT },
|
|
3240
3211
|
children: [
|
|
3241
|
-
/* @__PURE__ */ (0,
|
|
3242
|
-
/* @__PURE__ */ (0,
|
|
3212
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(SearchIcon_default, {}),
|
|
3213
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
3243
3214
|
"input",
|
|
3244
3215
|
{
|
|
3245
3216
|
autoComplete: "off",
|
|
@@ -3252,9 +3223,9 @@ var FormPairSelector = ({ onSubmit, onClose }) => {
|
|
|
3252
3223
|
]
|
|
3253
3224
|
}
|
|
3254
3225
|
),
|
|
3255
|
-
/* @__PURE__ */ (0,
|
|
3256
|
-
searchResult && searchResult.length > 0 && /* @__PURE__ */ (0,
|
|
3257
|
-
return /* @__PURE__ */ (0,
|
|
3226
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "mt-2", style: { flexGrow: 1 }, children: [
|
|
3227
|
+
searchResult && searchResult.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_react_virtualized_auto_sizer.default, { children: ({ height, width }) => {
|
|
3228
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
3258
3229
|
import_react_window.FixedSizeList,
|
|
3259
3230
|
{
|
|
3260
3231
|
ref: listRef,
|
|
@@ -3271,48 +3242,17 @@ var FormPairSelector = ({ onSubmit, onClose }) => {
|
|
|
3271
3242
|
}
|
|
3272
3243
|
);
|
|
3273
3244
|
} }),
|
|
3274
|
-
isLoading ? /* @__PURE__ */ (0,
|
|
3245
|
+
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, {})
|
|
3275
3246
|
] })
|
|
3276
3247
|
] });
|
|
3277
3248
|
};
|
|
3278
3249
|
var FormPairSelector_default = FormPairSelector;
|
|
3279
3250
|
|
|
3280
3251
|
// src/components/screens/InitialScreen.tsx
|
|
3281
|
-
var
|
|
3282
|
-
var import_jsx_runtime40 = require("react/jsx-runtime");
|
|
3252
|
+
var import_jsx_runtime41 = require("react/jsx-runtime");
|
|
3283
3253
|
var InitialScreen = () => {
|
|
3284
|
-
const {
|
|
3285
|
-
const {
|
|
3286
|
-
form,
|
|
3287
|
-
setForm,
|
|
3288
|
-
setErrors,
|
|
3289
|
-
quoteResponseMeta,
|
|
3290
|
-
loading
|
|
3291
|
-
} = useSwapContext();
|
|
3292
|
-
const { setScreen } = useScreenState();
|
|
3293
|
-
const balance = (0, import_react24.useMemo)(() => {
|
|
3294
|
-
var _a2;
|
|
3295
|
-
if (!balances) return 0;
|
|
3296
|
-
return ((_a2 = balances[form.fromMint]) == null ? void 0 : _a2.uiAmount) || 0;
|
|
3297
|
-
}, [balances, form.fromMint]);
|
|
3254
|
+
const { form, setForm, loading } = useSwapContext();
|
|
3298
3255
|
const [isDisabled, setIsDisabled] = (0, import_react24.useState)(false);
|
|
3299
|
-
const { data: asset } = useAsset(form.fromMint);
|
|
3300
|
-
(0, import_react24.useEffect)(() => {
|
|
3301
|
-
if (!form.fromValue || !form.fromMint || !form.toMint || !form.toValue || !quoteResponseMeta || loading) {
|
|
3302
|
-
setErrors({});
|
|
3303
|
-
setIsDisabled(true);
|
|
3304
|
-
return;
|
|
3305
|
-
}
|
|
3306
|
-
if (new import_decimal9.default(form.fromValue).gt(balance)) {
|
|
3307
|
-
setErrors({
|
|
3308
|
-
fromValue: { title: `Insufficient ${asset == null ? void 0 : asset.symbol}`, message: "" }
|
|
3309
|
-
});
|
|
3310
|
-
setIsDisabled(true);
|
|
3311
|
-
return;
|
|
3312
|
-
}
|
|
3313
|
-
setErrors({});
|
|
3314
|
-
setIsDisabled(false);
|
|
3315
|
-
}, [form, asset, balance, quoteResponseMeta, loading, setErrors]);
|
|
3316
3256
|
const [selectPairSelector, setSelectPairSelector] = (0, import_react24.useState)(null);
|
|
3317
3257
|
const onSelectMint = (0, import_react24.useCallback)(
|
|
3318
3258
|
(tokenInfo) => __async(void 0, null, function* () {
|
|
@@ -3331,128 +3271,28 @@ var InitialScreen = () => {
|
|
|
3331
3271
|
}),
|
|
3332
3272
|
[selectPairSelector, setForm]
|
|
3333
3273
|
);
|
|
3334
|
-
|
|
3335
|
-
|
|
3336
|
-
}, [setScreen]);
|
|
3337
|
-
return /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(import_jsx_runtime40.Fragment, { children: [
|
|
3338
|
-
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
3274
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(import_jsx_runtime41.Fragment, { children: [
|
|
3275
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
3339
3276
|
"form",
|
|
3340
3277
|
{
|
|
3341
|
-
onSubmit: onSubmitToConfirmation,
|
|
3342
3278
|
className: cn({
|
|
3343
3279
|
hidden: Boolean(selectPairSelector)
|
|
3344
3280
|
}),
|
|
3345
|
-
children: /* @__PURE__ */ (0,
|
|
3346
|
-
Form_default,
|
|
3347
|
-
{
|
|
3348
|
-
onSubmit: onSubmitToConfirmation,
|
|
3349
|
-
isDisabled,
|
|
3350
|
-
setSelectPairSelector
|
|
3351
|
-
}
|
|
3352
|
-
)
|
|
3281
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Form_default, { isDisabled, setSelectPairSelector })
|
|
3353
3282
|
}
|
|
3354
3283
|
),
|
|
3355
|
-
selectPairSelector !== null ? /* @__PURE__ */ (0,
|
|
3356
|
-
FormPairSelector_default,
|
|
3357
|
-
{
|
|
3358
|
-
onSubmit: onSelectMint,
|
|
3359
|
-
onClose: () => setSelectPairSelector(null)
|
|
3360
|
-
}
|
|
3361
|
-
) }) : null
|
|
3284
|
+
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
|
|
3362
3285
|
] });
|
|
3363
3286
|
};
|
|
3364
3287
|
var InitialScreen_default = InitialScreen;
|
|
3365
3288
|
|
|
3366
|
-
// src/components/screens/ReviewOrderScreen.tsx
|
|
3367
|
-
var import_react25 = require("react");
|
|
3368
|
-
var import_jsx_runtime41 = require("react/jsx-runtime");
|
|
3369
|
-
var ConfirmationScreen = () => {
|
|
3370
|
-
const {
|
|
3371
|
-
fromTokenInfo,
|
|
3372
|
-
toTokenInfo,
|
|
3373
|
-
onSubmit: onSubmitJupiter,
|
|
3374
|
-
quoteResponseMeta,
|
|
3375
|
-
loading,
|
|
3376
|
-
refresh
|
|
3377
|
-
} = useSwapContext();
|
|
3378
|
-
const [hasExpired] = useTimeDiff_default();
|
|
3379
|
-
const { setScreen } = useScreenState();
|
|
3380
|
-
const onGoBack = () => {
|
|
3381
|
-
refresh();
|
|
3382
|
-
setScreen("Initial");
|
|
3383
|
-
};
|
|
3384
|
-
const onSubmit = (0, import_react25.useCallback)(() => __async(void 0, null, function* () {
|
|
3385
|
-
setScreen("Swapping");
|
|
3386
|
-
onSubmitJupiter();
|
|
3387
|
-
}), [onSubmitJupiter, setScreen]);
|
|
3388
|
-
return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: "flex flex-col h-full w-full py-4 px-2", children: [
|
|
3389
|
-
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: "flex w-full justify-between", children: [
|
|
3390
|
-
/* @__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 }) }),
|
|
3391
|
-
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: "text-primary-text", children: "Review Order" }),
|
|
3392
|
-
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: " w-6 h-6" })
|
|
3393
|
-
] }),
|
|
3394
|
-
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { children: quoteResponseMeta && fromTokenInfo && toTokenInfo ? /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
3395
|
-
PriceInfo_default,
|
|
3396
|
-
{
|
|
3397
|
-
quoteResponse: quoteResponseMeta,
|
|
3398
|
-
fromTokenInfo,
|
|
3399
|
-
toTokenInfo,
|
|
3400
|
-
loading,
|
|
3401
|
-
containerClassName: "bg-modiu; border-none"
|
|
3402
|
-
}
|
|
3403
|
-
) : null }),
|
|
3404
|
-
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)(
|
|
3405
|
-
JupButton_default,
|
|
3406
|
-
{
|
|
3407
|
-
size: "lg",
|
|
3408
|
-
className: cn(
|
|
3409
|
-
"w-full mt-4 disabled:opacity-50 !text-uiv2-text/75 leading-none !max-h-14 bg-gradient-to-r from-[#00BEF0] to-[#C7F284]"
|
|
3410
|
-
),
|
|
3411
|
-
onClick: onSubmit,
|
|
3412
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("span", { children: "Confirm" })
|
|
3413
|
-
}
|
|
3414
|
-
)
|
|
3415
|
-
] });
|
|
3416
|
-
};
|
|
3417
|
-
var ReviewOrderScreen_default = ConfirmationScreen;
|
|
3418
|
-
|
|
3419
3289
|
// src/components/screens/SwappingScreen.tsx
|
|
3420
|
-
var
|
|
3421
|
-
|
|
3422
|
-
// src/components/Spinner/index.tsx
|
|
3423
|
-
var import_jsx_runtime42 = require("react/jsx-runtime");
|
|
3424
|
-
var Spinner = ({
|
|
3425
|
-
className,
|
|
3426
|
-
baseColor = "currentColor",
|
|
3427
|
-
spinnerColor = "currentColor",
|
|
3428
|
-
width = 16,
|
|
3429
|
-
height = 16
|
|
3430
|
-
}) => /* @__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)(
|
|
3431
|
-
"svg",
|
|
3432
|
-
{
|
|
3433
|
-
className: "animate-spin h-5 w-5 text-black dark:text-primary-text",
|
|
3434
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
3435
|
-
fill: "none",
|
|
3436
|
-
viewBox: "0 0 24 24",
|
|
3437
|
-
children: [
|
|
3438
|
-
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("circle", { className: "opacity-25", cx: "12", cy: "12", r: "10", stroke: baseColor, strokeWidth: "4" }),
|
|
3439
|
-
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
3440
|
-
"path",
|
|
3441
|
-
{
|
|
3442
|
-
className: "opacity-75",
|
|
3443
|
-
fill: spinnerColor,
|
|
3444
|
-
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"
|
|
3445
|
-
}
|
|
3446
|
-
)
|
|
3447
|
-
]
|
|
3448
|
-
}
|
|
3449
|
-
) });
|
|
3450
|
-
var Spinner_default = Spinner;
|
|
3290
|
+
var import_react25 = require("react");
|
|
3451
3291
|
|
|
3452
3292
|
// src/icons/SuccessIcon.tsx
|
|
3453
|
-
var
|
|
3293
|
+
var import_jsx_runtime42 = require("react/jsx-runtime");
|
|
3454
3294
|
var SuccessIcon = (props) => {
|
|
3455
|
-
return /* @__PURE__ */ (0,
|
|
3295
|
+
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)(
|
|
3456
3296
|
"path",
|
|
3457
3297
|
{
|
|
3458
3298
|
fill: "currentColor",
|
|
@@ -3463,19 +3303,19 @@ var SuccessIcon = (props) => {
|
|
|
3463
3303
|
var SuccessIcon_default = SuccessIcon;
|
|
3464
3304
|
|
|
3465
3305
|
// src/components/screens/SwappingScreen.tsx
|
|
3466
|
-
var
|
|
3306
|
+
var import_jsx_runtime43 = require("react/jsx-runtime");
|
|
3467
3307
|
var ErrorIcon = () => {
|
|
3468
|
-
return /* @__PURE__ */ (0,
|
|
3469
|
-
/* @__PURE__ */ (0,
|
|
3470
|
-
/* @__PURE__ */ (0,
|
|
3471
|
-
/* @__PURE__ */ (0,
|
|
3308
|
+
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: [
|
|
3309
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("g", { clipPath: "url(#clip0_7547_116874)", children: [
|
|
3310
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("circle", { cx: "20", cy: "20", r: "20", fill: "#F04A44" }),
|
|
3311
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
3472
3312
|
"path",
|
|
3473
3313
|
{
|
|
3474
3314
|
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",
|
|
3475
3315
|
fill: "white"
|
|
3476
3316
|
}
|
|
3477
3317
|
),
|
|
3478
|
-
/* @__PURE__ */ (0,
|
|
3318
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
3479
3319
|
"path",
|
|
3480
3320
|
{
|
|
3481
3321
|
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",
|
|
@@ -3483,7 +3323,7 @@ var ErrorIcon = () => {
|
|
|
3483
3323
|
}
|
|
3484
3324
|
)
|
|
3485
3325
|
] }),
|
|
3486
|
-
/* @__PURE__ */ (0,
|
|
3326
|
+
/* @__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" }) }) })
|
|
3487
3327
|
] });
|
|
3488
3328
|
};
|
|
3489
3329
|
var SwappingScreen = () => {
|
|
@@ -3497,7 +3337,7 @@ var SwappingScreen = () => {
|
|
|
3497
3337
|
refresh
|
|
3498
3338
|
} = useSwapContext();
|
|
3499
3339
|
const { screen: screen2, setScreen } = useScreenState();
|
|
3500
|
-
const [errorMessage, setErrorMessage] = (0,
|
|
3340
|
+
const [errorMessage, setErrorMessage] = (0, import_react25.useState)("");
|
|
3501
3341
|
const onSwapMore = () => {
|
|
3502
3342
|
reset();
|
|
3503
3343
|
setErrorMessage("");
|
|
@@ -3510,7 +3350,7 @@ var SwappingScreen = () => {
|
|
|
3510
3350
|
setScreen("Initial");
|
|
3511
3351
|
refresh();
|
|
3512
3352
|
};
|
|
3513
|
-
(0,
|
|
3353
|
+
(0, import_react25.useEffect)(() => {
|
|
3514
3354
|
var _a2, _b, _c, _d;
|
|
3515
3355
|
if (screen2 !== "Swapping") return;
|
|
3516
3356
|
if ((lastSwapResult == null ? void 0 : lastSwapResult.swapResult) && "error" in (lastSwapResult == null ? void 0 : lastSwapResult.swapResult)) {
|
|
@@ -3541,23 +3381,8 @@ var SwappingScreen = () => {
|
|
|
3541
3381
|
setScreen("Initial");
|
|
3542
3382
|
};
|
|
3543
3383
|
const { explorer, getExplorer } = usePreferredExplorer();
|
|
3544
|
-
const isLoading = (txStatus == null ? void 0 : txStatus.status) === "loading" || (txStatus == null ? void 0 : txStatus.status) === "pending-approval" || (txStatus == null ? void 0 : txStatus.status) === "sending";
|
|
3545
|
-
const Content2 = () => {
|
|
3546
|
-
return /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_jsx_runtime44.Fragment, { children: [
|
|
3547
|
-
/* @__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" }) }),
|
|
3548
|
-
/* @__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 }) }) }),
|
|
3549
|
-
/* @__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: [
|
|
3550
|
-
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(Spinner_default, { spinnerColor: "white" }),
|
|
3551
|
-
/* @__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: [
|
|
3552
|
-
txStatus.status === "loading" && "Preparing transactions",
|
|
3553
|
-
txStatus.status === "pending-approval" && "Pending Approval",
|
|
3554
|
-
txStatus.status === "sending" && "Swapping"
|
|
3555
|
-
] }) })
|
|
3556
|
-
] }) })
|
|
3557
|
-
] });
|
|
3558
|
-
};
|
|
3559
3384
|
const SuccessContent = () => {
|
|
3560
|
-
const { inputAmount, outputAmount, explorerLink } = (0,
|
|
3385
|
+
const { inputAmount, outputAmount, explorerLink } = (0, import_react25.useMemo)(() => {
|
|
3561
3386
|
return {
|
|
3562
3387
|
inputAmount: (lastSwapResult == null ? void 0 : lastSwapResult.swapResult) && "inputAmount" in (lastSwapResult == null ? void 0 : lastSwapResult.swapResult) ? lastSwapResult == null ? void 0 : lastSwapResult.swapResult.inputAmount : 0,
|
|
3563
3388
|
outputAmount: (lastSwapResult == null ? void 0 : lastSwapResult.swapResult) && "outputAmount" in (lastSwapResult == null ? void 0 : lastSwapResult.swapResult) ? lastSwapResult == null ? void 0 : lastSwapResult.swapResult.outputAmount : 0,
|
|
@@ -3567,28 +3392,28 @@ var SwappingScreen = () => {
|
|
|
3567
3392
|
if (!fromTokenInfo || !toTokenInfo || !(lastSwapResult == null ? void 0 : lastSwapResult.quoteReponse)) {
|
|
3568
3393
|
return null;
|
|
3569
3394
|
}
|
|
3570
|
-
return /* @__PURE__ */ (0,
|
|
3571
|
-
/* @__PURE__ */ (0,
|
|
3572
|
-
/* @__PURE__ */ (0,
|
|
3573
|
-
/* @__PURE__ */ (0,
|
|
3395
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(import_jsx_runtime43.Fragment, { children: [
|
|
3396
|
+
/* @__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: [
|
|
3397
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: "bg-success bg-opacity-[15%] animate-pulse h-[60px] w-[60px] rounded-full" }),
|
|
3398
|
+
/* @__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 }) })
|
|
3574
3399
|
] }) }),
|
|
3575
|
-
/* @__PURE__ */ (0,
|
|
3576
|
-
/* @__PURE__ */ (0,
|
|
3577
|
-
/* @__PURE__ */ (0,
|
|
3400
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "flex flex-col justify-center items-center gap-y-2", children: [
|
|
3401
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "mt-2 flex flex-col items-center justify-center text-center px-4", children: [
|
|
3402
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("p", { className: "text-xs font-semibold text-primary-text", children: [
|
|
3578
3403
|
"Swapped ",
|
|
3579
3404
|
readableValue(inputAmount, fromTokenInfo.decimals),
|
|
3580
3405
|
" ",
|
|
3581
3406
|
fromTokenInfo.symbol,
|
|
3582
3407
|
" to"
|
|
3583
3408
|
] }),
|
|
3584
|
-
/* @__PURE__ */ (0,
|
|
3409
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("p", { className: "text-2xl font-semibold text-primary-text", children: [
|
|
3585
3410
|
readableValue(outputAmount, toTokenInfo.decimals),
|
|
3586
3411
|
" ",
|
|
3587
3412
|
toTokenInfo.symbol
|
|
3588
3413
|
] })
|
|
3589
3414
|
] }),
|
|
3590
|
-
/* @__PURE__ */ (0,
|
|
3591
|
-
/* @__PURE__ */ (0,
|
|
3415
|
+
/* @__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: [
|
|
3416
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
3592
3417
|
PriceInfo_default,
|
|
3593
3418
|
{
|
|
3594
3419
|
quoteResponse: lastSwapResult == null ? void 0 : lastSwapResult.quoteReponse,
|
|
@@ -3598,9 +3423,9 @@ var SwappingScreen = () => {
|
|
|
3598
3423
|
containerClassName: " border-none mt-0"
|
|
3599
3424
|
}
|
|
3600
3425
|
),
|
|
3601
|
-
explorerLink && /* @__PURE__ */ (0,
|
|
3602
|
-
/* @__PURE__ */ (0,
|
|
3603
|
-
/* @__PURE__ */ (0,
|
|
3426
|
+
explorerLink && /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "flex items-center justify-between text-xs text-primary-text/50 mt-4", children: [
|
|
3427
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { children: "Transaction" }) }),
|
|
3428
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
|
|
3604
3429
|
"a",
|
|
3605
3430
|
{
|
|
3606
3431
|
href: explorerLink,
|
|
@@ -3616,73 +3441,72 @@ var SwappingScreen = () => {
|
|
|
3616
3441
|
] })
|
|
3617
3442
|
] })
|
|
3618
3443
|
] }),
|
|
3619
|
-
/* @__PURE__ */ (0,
|
|
3620
|
-
/* @__PURE__ */ (0,
|
|
3444
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "pb-4 flex space-x-2", children: [
|
|
3445
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
3621
3446
|
JupButton_default,
|
|
3622
3447
|
{
|
|
3623
3448
|
size: "lg",
|
|
3624
3449
|
className: "w-full mt-4 disabled:opacity-50 !text-uiv2-text/75 leading-none !max-h-14 bg-primary",
|
|
3625
3450
|
onClick: onSwapMore,
|
|
3626
|
-
children: /* @__PURE__ */ (0,
|
|
3451
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: "text-sm", children: "Swap More" }) })
|
|
3627
3452
|
}
|
|
3628
3453
|
),
|
|
3629
|
-
displayMode !== "integrated" ? /* @__PURE__ */ (0,
|
|
3454
|
+
displayMode !== "integrated" ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
3630
3455
|
JupButton_default,
|
|
3631
3456
|
{
|
|
3632
3457
|
size: "lg",
|
|
3633
3458
|
className: "w-full mt-4 disabled:opacity-50 leading-none !max-h-14 text-primary-text bg-interactive",
|
|
3634
3459
|
onClick: onClose,
|
|
3635
|
-
children: /* @__PURE__ */ (0,
|
|
3460
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: "text-sm", children: "Close" })
|
|
3636
3461
|
}
|
|
3637
3462
|
) : null
|
|
3638
3463
|
] })
|
|
3639
3464
|
] });
|
|
3640
3465
|
};
|
|
3641
|
-
return /* @__PURE__ */ (0,
|
|
3642
|
-
errorMessage || (txStatus == null ? void 0 : txStatus.status) === "fail" ? /* @__PURE__ */ (0,
|
|
3643
|
-
/* @__PURE__ */ (0,
|
|
3644
|
-
/* @__PURE__ */ (0,
|
|
3645
|
-
/* @__PURE__ */ (0,
|
|
3646
|
-
errorMessage ? /* @__PURE__ */ (0,
|
|
3647
|
-
/* @__PURE__ */ (0,
|
|
3466
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "flex flex-col h-full w-full px-2", children: [
|
|
3467
|
+
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: [
|
|
3468
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(ErrorIcon, {}),
|
|
3469
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("p", { className: "text-primary-text mt-2", children: "Swap Failed" }),
|
|
3470
|
+
/* @__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." }),
|
|
3471
|
+
errorMessage ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("p", { className: "text-primary-text/50 text-xs mt-2 break-all", children: errorMessage }) : "",
|
|
3472
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
3648
3473
|
JupButton_default,
|
|
3649
3474
|
{
|
|
3650
3475
|
size: "lg",
|
|
3651
3476
|
className: "w-full mt-6 disabled:opacity-50 !text-uiv2-text/75 leading-none !max-h-14 bg-primary",
|
|
3652
3477
|
onClick: onGoBack,
|
|
3653
|
-
children: /* @__PURE__ */ (0,
|
|
3478
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { children: "Retry" })
|
|
3654
3479
|
}
|
|
3655
3480
|
)
|
|
3656
3481
|
] }) }) : null,
|
|
3657
|
-
!errorMessage && (txStatus == null ? void 0 : txStatus.status) === "timeout" ? /* @__PURE__ */ (0,
|
|
3658
|
-
/* @__PURE__ */ (0,
|
|
3659
|
-
/* @__PURE__ */ (0,
|
|
3660
|
-
/* @__PURE__ */ (0,
|
|
3661
|
-
errorMessage ? /* @__PURE__ */ (0,
|
|
3662
|
-
/* @__PURE__ */ (0,
|
|
3482
|
+
!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: [
|
|
3483
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(ErrorIcon, {}),
|
|
3484
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("p", { className: "text-primary-text mt-2", children: "Transaction timed-out" }),
|
|
3485
|
+
/* @__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." }),
|
|
3486
|
+
errorMessage ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("p", { className: "text-primary-text/50 text-xs mt-2", children: errorMessage }) : "",
|
|
3487
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
3663
3488
|
JupButton_default,
|
|
3664
3489
|
{
|
|
3665
3490
|
size: "lg",
|
|
3666
3491
|
className: "w-full mt-6 disabled:opacity-50 !text-uiv2-text/75 leading-none !max-h-14 bg-primary",
|
|
3667
3492
|
onClick: onGoBack,
|
|
3668
|
-
children: /* @__PURE__ */ (0,
|
|
3493
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { children: "Retry" })
|
|
3669
3494
|
}
|
|
3670
3495
|
)
|
|
3671
3496
|
] }) }) : null,
|
|
3672
|
-
!errorMessage &&
|
|
3673
|
-
!errorMessage && (txStatus == null ? void 0 : txStatus.status) === "success" ? /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(SuccessContent, {}) : null
|
|
3497
|
+
!errorMessage && (txStatus == null ? void 0 : txStatus.status) === "success" ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(SuccessContent, {}) : null
|
|
3674
3498
|
] });
|
|
3675
3499
|
};
|
|
3676
3500
|
var SwappingScreen_default = SwappingScreen;
|
|
3677
3501
|
|
|
3678
3502
|
// src/components/screens/WalletScreen.tsx
|
|
3679
3503
|
var import_wallet_adapter3 = require("@jup-ag/wallet-adapter");
|
|
3680
|
-
var
|
|
3504
|
+
var import_react26 = require("react");
|
|
3681
3505
|
|
|
3682
3506
|
// src/icons/CloseIcon.tsx
|
|
3683
|
-
var
|
|
3507
|
+
var import_jsx_runtime44 = require("react/jsx-runtime");
|
|
3684
3508
|
var CloseIcon = ({ width = 20, height = 20 }) => {
|
|
3685
|
-
return /* @__PURE__ */ (0,
|
|
3509
|
+
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)(
|
|
3686
3510
|
"path",
|
|
3687
3511
|
{
|
|
3688
3512
|
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",
|
|
@@ -3693,7 +3517,7 @@ var CloseIcon = ({ width = 20, height = 20 }) => {
|
|
|
3693
3517
|
var CloseIcon_default = CloseIcon;
|
|
3694
3518
|
|
|
3695
3519
|
// src/components/screens/WalletScreen.tsx
|
|
3696
|
-
var
|
|
3520
|
+
var import_jsx_runtime45 = require("react/jsx-runtime");
|
|
3697
3521
|
var WalletScreen = () => {
|
|
3698
3522
|
const { setScreen } = useScreenState();
|
|
3699
3523
|
const { handleConnectClick } = (0, import_wallet_adapter3.useUnifiedWalletContext)();
|
|
@@ -3707,37 +3531,37 @@ var WalletScreen = () => {
|
|
|
3707
3531
|
setScreen("Initial");
|
|
3708
3532
|
}
|
|
3709
3533
|
});
|
|
3710
|
-
const numberOfWallets = (0,
|
|
3534
|
+
const numberOfWallets = (0, import_react26.useMemo)(() => {
|
|
3711
3535
|
return wallets == null ? void 0 : wallets.length;
|
|
3712
3536
|
}, [wallets]);
|
|
3713
|
-
const hasWallet = (0,
|
|
3537
|
+
const hasWallet = (0, import_react26.useMemo)(() => {
|
|
3714
3538
|
return numberOfWallets > 0;
|
|
3715
3539
|
}, [numberOfWallets]);
|
|
3716
|
-
return /* @__PURE__ */ (0,
|
|
3717
|
-
/* @__PURE__ */ (0,
|
|
3718
|
-
/* @__PURE__ */ (0,
|
|
3540
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { className: "text-primary-text p-2", children: [
|
|
3541
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { className: "flex justify-between items-center mb-2 h-[28px] ", children: [
|
|
3542
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("h1", { className: "text-sm font-bold", children: [
|
|
3719
3543
|
"Available Wallets (",
|
|
3720
3544
|
numberOfWallets,
|
|
3721
3545
|
")"
|
|
3722
3546
|
] }),
|
|
3723
|
-
/* @__PURE__ */ (0,
|
|
3547
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
3724
3548
|
"button",
|
|
3725
3549
|
{
|
|
3726
3550
|
onClick: () => setScreen("Initial"),
|
|
3727
3551
|
className: "text-primary-text hover:text-primary-text/50 transition-colors bg-interactive rounded-full p-1",
|
|
3728
|
-
children: /* @__PURE__ */ (0,
|
|
3552
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(CloseIcon_default, { width: 15, height: 15 })
|
|
3729
3553
|
}
|
|
3730
3554
|
)
|
|
3731
3555
|
] }),
|
|
3732
|
-
!hasWallet && /* @__PURE__ */ (0,
|
|
3733
|
-
/* @__PURE__ */ (0,
|
|
3556
|
+
!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" }),
|
|
3557
|
+
/* @__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)(
|
|
3734
3558
|
"button",
|
|
3735
3559
|
{
|
|
3736
3560
|
onClick: (e) => handleConnect(e, wallet),
|
|
3737
3561
|
className: `w-full text-left bg-interactive p-4 rounded-lg transition-colors ${"hover:bg-interactive/80 cursor-pointer"}`,
|
|
3738
|
-
children: /* @__PURE__ */ (0,
|
|
3739
|
-
wallet.adapter.icon && /* @__PURE__ */ (0,
|
|
3740
|
-
/* @__PURE__ */ (0,
|
|
3562
|
+
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: [
|
|
3563
|
+
wallet.adapter.icon && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("img", { src: wallet.adapter.icon, alt: `${wallet.adapter.name} icon`, className: "w-8 h-8" }),
|
|
3564
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("h2", { className: "text-sm font-medium", children: wallet.adapter.name }) })
|
|
3741
3565
|
] }) })
|
|
3742
3566
|
},
|
|
3743
3567
|
wallet.adapter.name
|
|
@@ -3747,46 +3571,46 @@ var WalletScreen = () => {
|
|
|
3747
3571
|
var WalletScreen_default = WalletScreen;
|
|
3748
3572
|
|
|
3749
3573
|
// src/icons/JupiterLogoV2.tsx
|
|
3750
|
-
var
|
|
3574
|
+
var import_jsx_runtime46 = require("react/jsx-runtime");
|
|
3751
3575
|
var JupiterLogoV2 = (props) => {
|
|
3752
|
-
return /* @__PURE__ */ (0,
|
|
3753
|
-
/* @__PURE__ */ (0,
|
|
3754
|
-
/* @__PURE__ */ (0,
|
|
3576
|
+
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: [
|
|
3577
|
+
/* @__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: [
|
|
3578
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
3755
3579
|
"path",
|
|
3756
3580
|
{
|
|
3757
3581
|
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",
|
|
3758
3582
|
fill: "url(#paint0_linear_11565_169621)"
|
|
3759
3583
|
}
|
|
3760
3584
|
),
|
|
3761
|
-
/* @__PURE__ */ (0,
|
|
3585
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
3762
3586
|
"path",
|
|
3763
3587
|
{
|
|
3764
3588
|
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",
|
|
3765
3589
|
fill: "url(#paint1_linear_11565_169621)"
|
|
3766
3590
|
}
|
|
3767
3591
|
),
|
|
3768
|
-
/* @__PURE__ */ (0,
|
|
3592
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
3769
3593
|
"path",
|
|
3770
3594
|
{
|
|
3771
3595
|
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",
|
|
3772
3596
|
fill: "url(#paint2_linear_11565_169621)"
|
|
3773
3597
|
}
|
|
3774
3598
|
),
|
|
3775
|
-
/* @__PURE__ */ (0,
|
|
3599
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
3776
3600
|
"path",
|
|
3777
3601
|
{
|
|
3778
3602
|
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",
|
|
3779
3603
|
fill: "url(#paint3_linear_11565_169621)"
|
|
3780
3604
|
}
|
|
3781
3605
|
),
|
|
3782
|
-
/* @__PURE__ */ (0,
|
|
3606
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
3783
3607
|
"path",
|
|
3784
3608
|
{
|
|
3785
3609
|
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",
|
|
3786
3610
|
fill: "url(#paint4_linear_11565_169621)"
|
|
3787
3611
|
}
|
|
3788
3612
|
),
|
|
3789
|
-
/* @__PURE__ */ (0,
|
|
3613
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
3790
3614
|
"path",
|
|
3791
3615
|
{
|
|
3792
3616
|
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",
|
|
@@ -3794,8 +3618,8 @@ var JupiterLogoV2 = (props) => {
|
|
|
3794
3618
|
}
|
|
3795
3619
|
)
|
|
3796
3620
|
] }) }),
|
|
3797
|
-
/* @__PURE__ */ (0,
|
|
3798
|
-
/* @__PURE__ */ (0,
|
|
3621
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("defs", { children: [
|
|
3622
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(
|
|
3799
3623
|
"filter",
|
|
3800
3624
|
{
|
|
3801
3625
|
id: "filter0_d_11565_169621",
|
|
@@ -3806,8 +3630,8 @@ var JupiterLogoV2 = (props) => {
|
|
|
3806
3630
|
filterUnits: "userSpaceOnUse",
|
|
3807
3631
|
colorInterpolationFilters: "sRGB",
|
|
3808
3632
|
children: [
|
|
3809
|
-
/* @__PURE__ */ (0,
|
|
3810
|
-
/* @__PURE__ */ (0,
|
|
3633
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("feFlood", { floodOpacity: "0", result: "BackgroundImageFix" }),
|
|
3634
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
3811
3635
|
"feColorMatrix",
|
|
3812
3636
|
{
|
|
3813
3637
|
in: "SourceAlpha",
|
|
@@ -3816,16 +3640,16 @@ var JupiterLogoV2 = (props) => {
|
|
|
3816
3640
|
result: "hardAlpha"
|
|
3817
3641
|
}
|
|
3818
3642
|
),
|
|
3819
|
-
/* @__PURE__ */ (0,
|
|
3820
|
-
/* @__PURE__ */ (0,
|
|
3821
|
-
/* @__PURE__ */ (0,
|
|
3822
|
-
/* @__PURE__ */ (0,
|
|
3823
|
-
/* @__PURE__ */ (0,
|
|
3824
|
-
/* @__PURE__ */ (0,
|
|
3643
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("feOffset", { dy: "2.27449" }),
|
|
3644
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("feGaussianBlur", { stdDeviation: "11.3724" }),
|
|
3645
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("feComposite", { in2: "hardAlpha", operator: "out" }),
|
|
3646
|
+
/* @__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" }),
|
|
3647
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("feBlend", { mode: "normal", in2: "BackgroundImageFix", result: "effect1_dropShadow_11565_169621" }),
|
|
3648
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("feBlend", { mode: "normal", in: "SourceGraphic", in2: "effect1_dropShadow_11565_169621", result: "shape" })
|
|
3825
3649
|
]
|
|
3826
3650
|
}
|
|
3827
3651
|
),
|
|
3828
|
-
/* @__PURE__ */ (0,
|
|
3652
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(
|
|
3829
3653
|
"linearGradient",
|
|
3830
3654
|
{
|
|
3831
3655
|
id: "paint0_linear_11565_169621",
|
|
@@ -3835,12 +3659,12 @@ var JupiterLogoV2 = (props) => {
|
|
|
3835
3659
|
y2: "32",
|
|
3836
3660
|
gradientUnits: "userSpaceOnUse",
|
|
3837
3661
|
children: [
|
|
3838
|
-
/* @__PURE__ */ (0,
|
|
3839
|
-
/* @__PURE__ */ (0,
|
|
3662
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("stop", { offset: "0.0001", stopColor: "currentColor" }),
|
|
3663
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("stop", { offset: "1", stopColor: "currentColor" })
|
|
3840
3664
|
]
|
|
3841
3665
|
}
|
|
3842
3666
|
),
|
|
3843
|
-
/* @__PURE__ */ (0,
|
|
3667
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(
|
|
3844
3668
|
"linearGradient",
|
|
3845
3669
|
{
|
|
3846
3670
|
id: "paint1_linear_11565_169621",
|
|
@@ -3850,12 +3674,12 @@ var JupiterLogoV2 = (props) => {
|
|
|
3850
3674
|
y2: "32",
|
|
3851
3675
|
gradientUnits: "userSpaceOnUse",
|
|
3852
3676
|
children: [
|
|
3853
|
-
/* @__PURE__ */ (0,
|
|
3854
|
-
/* @__PURE__ */ (0,
|
|
3677
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("stop", { offset: "0.0001", stopColor: "currentColor" }),
|
|
3678
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("stop", { offset: "1", stopColor: "currentColor" })
|
|
3855
3679
|
]
|
|
3856
3680
|
}
|
|
3857
3681
|
),
|
|
3858
|
-
/* @__PURE__ */ (0,
|
|
3682
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(
|
|
3859
3683
|
"linearGradient",
|
|
3860
3684
|
{
|
|
3861
3685
|
id: "paint2_linear_11565_169621",
|
|
@@ -3865,12 +3689,12 @@ var JupiterLogoV2 = (props) => {
|
|
|
3865
3689
|
y2: "32",
|
|
3866
3690
|
gradientUnits: "userSpaceOnUse",
|
|
3867
3691
|
children: [
|
|
3868
|
-
/* @__PURE__ */ (0,
|
|
3869
|
-
/* @__PURE__ */ (0,
|
|
3692
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("stop", { offset: "0.0001", stopColor: "currentColor" }),
|
|
3693
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("stop", { offset: "1", stopColor: "currentColor" })
|
|
3870
3694
|
]
|
|
3871
3695
|
}
|
|
3872
3696
|
),
|
|
3873
|
-
/* @__PURE__ */ (0,
|
|
3697
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(
|
|
3874
3698
|
"linearGradient",
|
|
3875
3699
|
{
|
|
3876
3700
|
id: "paint3_linear_11565_169621",
|
|
@@ -3880,12 +3704,12 @@ var JupiterLogoV2 = (props) => {
|
|
|
3880
3704
|
y2: "32",
|
|
3881
3705
|
gradientUnits: "userSpaceOnUse",
|
|
3882
3706
|
children: [
|
|
3883
|
-
/* @__PURE__ */ (0,
|
|
3884
|
-
/* @__PURE__ */ (0,
|
|
3707
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("stop", { offset: "0.0001", stopColor: "currentColor" }),
|
|
3708
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("stop", { offset: "1", stopColor: "currentColor" })
|
|
3885
3709
|
]
|
|
3886
3710
|
}
|
|
3887
3711
|
),
|
|
3888
|
-
/* @__PURE__ */ (0,
|
|
3712
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(
|
|
3889
3713
|
"linearGradient",
|
|
3890
3714
|
{
|
|
3891
3715
|
id: "paint4_linear_11565_169621",
|
|
@@ -3895,12 +3719,12 @@ var JupiterLogoV2 = (props) => {
|
|
|
3895
3719
|
y2: "32",
|
|
3896
3720
|
gradientUnits: "userSpaceOnUse",
|
|
3897
3721
|
children: [
|
|
3898
|
-
/* @__PURE__ */ (0,
|
|
3899
|
-
/* @__PURE__ */ (0,
|
|
3722
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("stop", { offset: "0.0001", stopColor: "currentColor" }),
|
|
3723
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("stop", { offset: "1", stopColor: "currentColor" })
|
|
3900
3724
|
]
|
|
3901
3725
|
}
|
|
3902
3726
|
),
|
|
3903
|
-
/* @__PURE__ */ (0,
|
|
3727
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(
|
|
3904
3728
|
"linearGradient",
|
|
3905
3729
|
{
|
|
3906
3730
|
id: "paint5_linear_11565_169621",
|
|
@@ -3910,50 +3734,49 @@ var JupiterLogoV2 = (props) => {
|
|
|
3910
3734
|
y2: "32",
|
|
3911
3735
|
gradientUnits: "userSpaceOnUse",
|
|
3912
3736
|
children: [
|
|
3913
|
-
/* @__PURE__ */ (0,
|
|
3914
|
-
/* @__PURE__ */ (0,
|
|
3737
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("stop", { offset: "0.0001", stopColor: "currentColor" }),
|
|
3738
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("stop", { offset: "1", stopColor: "currentColor" })
|
|
3915
3739
|
]
|
|
3916
3740
|
}
|
|
3917
3741
|
),
|
|
3918
|
-
/* @__PURE__ */ (0,
|
|
3742
|
+
/* @__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" }) })
|
|
3919
3743
|
] })
|
|
3920
3744
|
] }));
|
|
3921
3745
|
};
|
|
3922
3746
|
var JupiterLogoV2_default = JupiterLogoV2;
|
|
3923
3747
|
|
|
3924
3748
|
// src/components/Jupiter.tsx
|
|
3925
|
-
var
|
|
3749
|
+
var import_jsx_runtime47 = require("react/jsx-runtime");
|
|
3926
3750
|
var Content = () => {
|
|
3927
3751
|
const { screen: screen2 } = useScreenState();
|
|
3928
|
-
return /* @__PURE__ */ (0,
|
|
3929
|
-
/* @__PURE__ */ (0,
|
|
3930
|
-
screen2 === "Initial" ? /* @__PURE__ */ (0,
|
|
3931
|
-
/* @__PURE__ */ (0,
|
|
3932
|
-
/* @__PURE__ */ (0,
|
|
3752
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { id: "jupiter-plugin", className: " h-full bg-background relative flex flex-col justify-between", children: [
|
|
3753
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { children: [
|
|
3754
|
+
screen2 === "Initial" ? /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(import_jsx_runtime47.Fragment, { children: [
|
|
3755
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(Header_default, {}),
|
|
3756
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(InitialScreen_default, {})
|
|
3933
3757
|
] }) : null,
|
|
3934
|
-
screen2 === "
|
|
3935
|
-
screen2 === "
|
|
3936
|
-
screen2 === "Wallet" ? /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(WalletScreen_default, {}) : null
|
|
3758
|
+
screen2 === "Swapping" ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(SwappingScreen_default, {}) : null,
|
|
3759
|
+
screen2 === "Wallet" ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(WalletScreen_default, {}) : null
|
|
3937
3760
|
] }),
|
|
3938
|
-
/* @__PURE__ */ (0,
|
|
3761
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("span", { className: "text-primary-text/50 text-xs p-2 flex-row flex gap-1 justify-center", children: [
|
|
3939
3762
|
"Powered by",
|
|
3940
|
-
/* @__PURE__ */ (0,
|
|
3941
|
-
/* @__PURE__ */ (0,
|
|
3763
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("a", { href: "https://jup.ag", target: "_blank", rel: "noreferrer noopener", className: "flex items-center gap-1 ", children: [
|
|
3764
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(JupiterLogoV2_default, { className: "text-primary-text/50", width: 15, height: 15 }),
|
|
3942
3765
|
"Jupiter"
|
|
3943
3766
|
] })
|
|
3944
3767
|
] })
|
|
3945
3768
|
] });
|
|
3946
3769
|
};
|
|
3947
3770
|
var JupiterApp = (props) => {
|
|
3948
|
-
return /* @__PURE__ */ (0,
|
|
3771
|
+
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, {}) })) }));
|
|
3949
3772
|
};
|
|
3950
3773
|
var Jupiter_default = JupiterApp;
|
|
3951
3774
|
|
|
3952
3775
|
// src/contexts/ContextProvider.tsx
|
|
3953
3776
|
var import_wallet_adapter4 = require("@jup-ag/wallet-adapter");
|
|
3954
|
-
var
|
|
3955
|
-
var
|
|
3956
|
-
var
|
|
3777
|
+
var import_react27 = __toESM(require("react"));
|
|
3778
|
+
var import_react28 = require("react");
|
|
3779
|
+
var import_jsx_runtime48 = require("react/jsx-runtime");
|
|
3957
3780
|
var noop = () => {
|
|
3958
3781
|
};
|
|
3959
3782
|
var WalletContextProvider = ({
|
|
@@ -3964,18 +3787,18 @@ var WalletContextProvider = ({
|
|
|
3964
3787
|
if (typeof window === "undefined") return void 0;
|
|
3965
3788
|
return window.Jupiter.enableWalletPassthrough;
|
|
3966
3789
|
})();
|
|
3967
|
-
const wallets = (0,
|
|
3790
|
+
const wallets = (0, import_react28.useMemo)(() => {
|
|
3968
3791
|
if (enableWalletPassthrough) {
|
|
3969
3792
|
return [];
|
|
3970
3793
|
}
|
|
3971
3794
|
return [];
|
|
3972
3795
|
}, [enableWalletPassthrough]);
|
|
3973
|
-
const [showWalletStatus, setShowWalletStatus] = (0,
|
|
3796
|
+
const [showWalletStatus, setShowWalletStatus] = (0, import_react27.useState)({
|
|
3974
3797
|
show: false,
|
|
3975
3798
|
message: ""
|
|
3976
3799
|
});
|
|
3977
|
-
const ShouldWrapWalletProvider = (0,
|
|
3978
|
-
return enableWalletPassthrough ?
|
|
3800
|
+
const ShouldWrapWalletProvider = (0, import_react28.useMemo)(() => {
|
|
3801
|
+
return enableWalletPassthrough ? import_react27.default.Fragment : ({ children: children2 }) => /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
3979
3802
|
import_wallet_adapter4.UnifiedWalletProvider,
|
|
3980
3803
|
{
|
|
3981
3804
|
wallets,
|
|
@@ -3997,11 +3820,11 @@ var WalletContextProvider = ({
|
|
|
3997
3820
|
onNotInstalled: ({ walletName, metadata }) => {
|
|
3998
3821
|
setShowWalletStatus({
|
|
3999
3822
|
show: true,
|
|
4000
|
-
message: /* @__PURE__ */ (0,
|
|
3823
|
+
message: /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("p", { className: "space-y-1", children: [
|
|
4001
3824
|
walletName,
|
|
4002
3825
|
" is not installed.",
|
|
4003
|
-
/* @__PURE__ */ (0,
|
|
4004
|
-
/* @__PURE__ */ (0,
|
|
3826
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("p", { className: "space-x-1", children: [
|
|
3827
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(
|
|
4005
3828
|
"a",
|
|
4006
3829
|
{
|
|
4007
3830
|
className: "underline font-semibold",
|
|
@@ -4015,7 +3838,7 @@ var WalletContextProvider = ({
|
|
|
4015
3838
|
]
|
|
4016
3839
|
}
|
|
4017
3840
|
),
|
|
4018
|
-
/* @__PURE__ */ (0,
|
|
3841
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("span", { children: "to install it." })
|
|
4019
3842
|
] })
|
|
4020
3843
|
] })
|
|
4021
3844
|
});
|
|
@@ -4033,27 +3856,27 @@ var WalletContextProvider = ({
|
|
|
4033
3856
|
}
|
|
4034
3857
|
);
|
|
4035
3858
|
}, [autoConnect, enableWalletPassthrough, wallets]);
|
|
4036
|
-
return /* @__PURE__ */ (0,
|
|
4037
|
-
/* @__PURE__ */ (0,
|
|
4038
|
-
showWalletStatus.show && showWalletStatus.message ? /* @__PURE__ */ (0,
|
|
3859
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(import_jsx_runtime48.Fragment, { children: [
|
|
3860
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(ShouldWrapWalletProvider, { children }),
|
|
3861
|
+
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
|
|
4039
3862
|
] });
|
|
4040
3863
|
};
|
|
4041
3864
|
var ContextProvider = (props) => {
|
|
4042
|
-
return /* @__PURE__ */ (0,
|
|
3865
|
+
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 }) })) });
|
|
4043
3866
|
};
|
|
4044
3867
|
|
|
4045
3868
|
// src/index.tsx
|
|
4046
|
-
var
|
|
4047
|
-
var
|
|
4048
|
-
var
|
|
3869
|
+
var import_react_query9 = require("@tanstack/react-query");
|
|
3870
|
+
var import_react29 = require("react");
|
|
3871
|
+
var import_jsx_runtime49 = require("react/jsx-runtime");
|
|
4049
3872
|
var App = () => {
|
|
4050
|
-
const queryClient = (0,
|
|
3873
|
+
const queryClient = (0, import_react29.useMemo)(() => new import_react_query9.QueryClient(), []);
|
|
4051
3874
|
const [props] = (0, import_jotai4.useAtom)(appProps);
|
|
4052
3875
|
if (!props) return null;
|
|
4053
|
-
return /* @__PURE__ */ (0,
|
|
3876
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_react_query9.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)) }) }) })) });
|
|
4054
3877
|
};
|
|
4055
3878
|
var RenderJupiter = () => {
|
|
4056
|
-
return /* @__PURE__ */ (0,
|
|
3879
|
+
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, {}) });
|
|
4057
3880
|
};
|
|
4058
3881
|
|
|
4059
3882
|
// src/npmlibary.tsx
|