@jup-ag/plugin 1.0.1 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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 +470 -618
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -85,7 +85,7 @@ var require_package = __commonJS({
|
|
|
85
85
|
"package.json"(exports2, module2) {
|
|
86
86
|
module2.exports = {
|
|
87
87
|
name: "@jup-ag/plugin",
|
|
88
|
-
version: "1.0.
|
|
88
|
+
version: "1.0.2",
|
|
89
89
|
private: false,
|
|
90
90
|
license: "MIT",
|
|
91
91
|
scripts: {
|
|
@@ -123,7 +123,7 @@ var require_package = __commonJS({
|
|
|
123
123
|
"@jup-ag/wallet-adapter": "0.2.3",
|
|
124
124
|
"@popperjs/core": "^2.11.8",
|
|
125
125
|
"@solana/wallet-adapter-wallets": "0.19.33",
|
|
126
|
-
"@tanstack/react-query": "
|
|
126
|
+
"@tanstack/react-query": "5.85.5",
|
|
127
127
|
"bn.js": "5.2.1",
|
|
128
128
|
clsx: "^2.1.1",
|
|
129
129
|
"decimal.js": "10.4.3",
|
|
@@ -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,15 +1914,18 @@ var TransactionFee = ({ gasFee, gasless }) => {
|
|
|
2044
1914
|
};
|
|
2045
1915
|
var TransactionFee_default = TransactionFee;
|
|
2046
1916
|
|
|
2047
|
-
// src/
|
|
1917
|
+
// src/components/PriceInfo/index.tsx
|
|
2048
1918
|
var import_react_query5 = require("@tanstack/react-query");
|
|
2049
|
-
|
|
2050
|
-
|
|
1919
|
+
|
|
1920
|
+
// src/queries/queries.ts
|
|
1921
|
+
var import_react_query4 = require("@tanstack/react-query");
|
|
1922
|
+
var UltraQueries = {
|
|
1923
|
+
routers: (0, import_react_query4.queryOptions)({
|
|
2051
1924
|
queryKey: ["routers"],
|
|
2052
|
-
queryFn:
|
|
2053
|
-
|
|
1925
|
+
queryFn: ultraSwapService.getRouters,
|
|
1926
|
+
gcTime: Infinity,
|
|
2054
1927
|
staleTime: Infinity
|
|
2055
|
-
}
|
|
1928
|
+
})
|
|
2056
1929
|
};
|
|
2057
1930
|
|
|
2058
1931
|
// src/components/PriceInfo/index.tsx
|
|
@@ -2072,14 +1945,14 @@ var Index = ({
|
|
|
2072
1945
|
// If there's no selectedRoute, we will use first route value to temporarily calculate
|
|
2073
1946
|
outputDecimal: toTokenInfo.decimals
|
|
2074
1947
|
};
|
|
2075
|
-
const { data: routerInfo } =
|
|
1948
|
+
const { data: routerInfo } = (0, import_react_query5.useQuery)(__spreadProps(__spreadValues({}, UltraQueries.routers), {
|
|
2076
1949
|
select: (data) => {
|
|
2077
1950
|
if (!quoteResponse) {
|
|
2078
1951
|
return null;
|
|
2079
1952
|
}
|
|
2080
1953
|
return data.find((router2) => router2.id === quoteResponse.quoteResponse.router);
|
|
2081
1954
|
}
|
|
2082
|
-
});
|
|
1955
|
+
}));
|
|
2083
1956
|
const priceImpact = formatNumber.format(
|
|
2084
1957
|
new import_decimal6.default((quoteResponse == null ? void 0 : quoteResponse.quoteResponse.priceImpactPct) || 0).mul(100).toDP(2)
|
|
2085
1958
|
);
|
|
@@ -2105,7 +1978,7 @@ var Index = ({
|
|
|
2105
1978
|
}
|
|
2106
1979
|
return 0;
|
|
2107
1980
|
}, [quoteResponse]);
|
|
2108
|
-
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: cn("mt-4 space-y-4
|
|
1981
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: cn("mt-4 space-y-4 ", containerClassName), children: [
|
|
2109
1982
|
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex items-center justify-between text-xs", children: [
|
|
2110
1983
|
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "text-primary-text/50", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { children: "Rate" }) }),
|
|
2111
1984
|
import_jsbi3.default.greaterThan(rateParams.inAmount, import_jsbi3.default.BigInt(0)) && import_jsbi3.default.greaterThan(rateParams.outAmount, import_jsbi3.default.BigInt(0)) ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
@@ -2182,28 +2055,6 @@ var SwitchPairButton = ({
|
|
|
2182
2055
|
};
|
|
2183
2056
|
var SwitchPairButton_default = SwitchPairButton;
|
|
2184
2057
|
|
|
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
2058
|
// src/components/Form.tsx
|
|
2208
2059
|
var import_decimal7 = __toESM(require("decimal.js"));
|
|
2209
2060
|
|
|
@@ -2211,10 +2062,10 @@ var import_decimal7 = __toESM(require("decimal.js"));
|
|
|
2211
2062
|
var import_react_query6 = require("@tanstack/react-query");
|
|
2212
2063
|
|
|
2213
2064
|
// src/hooks/useMobile.ts
|
|
2214
|
-
var
|
|
2065
|
+
var import_react15 = require("react");
|
|
2215
2066
|
var import_react_use = require("react-use");
|
|
2216
2067
|
var useMobile = () => {
|
|
2217
|
-
const [isDesktop, setIsDesktop] = (0,
|
|
2068
|
+
const [isDesktop, setIsDesktop] = (0, import_react15.useState)(false);
|
|
2218
2069
|
(0, import_react_use.useIsomorphicLayoutEffect)(() => {
|
|
2219
2070
|
function updateSize() {
|
|
2220
2071
|
const desktopQuery = window.matchMedia("(min-width: 1024px)");
|
|
@@ -2228,7 +2079,7 @@ var useMobile = () => {
|
|
|
2228
2079
|
};
|
|
2229
2080
|
|
|
2230
2081
|
// src/components/Popover/Popover.tsx
|
|
2231
|
-
var
|
|
2082
|
+
var import_react16 = require("react");
|
|
2232
2083
|
var import_react_popper = require("react-popper");
|
|
2233
2084
|
var import_lodash = __toESM(require("lodash.debounce"));
|
|
2234
2085
|
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
@@ -2248,16 +2099,16 @@ var Popover = ({
|
|
|
2248
2099
|
offset,
|
|
2249
2100
|
drawShades = false
|
|
2250
2101
|
}) => {
|
|
2251
|
-
const isLocalMode = (0,
|
|
2102
|
+
const isLocalMode = (0, import_react16.useMemo)(
|
|
2252
2103
|
() => typeof isOpen === "undefined",
|
|
2253
2104
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
2254
2105
|
[]
|
|
2255
2106
|
);
|
|
2256
2107
|
const isMobile = useMobile();
|
|
2257
|
-
const [localOpen, setLocalOpen] = (0,
|
|
2258
|
-
const [referenceElement, setReferenceElement] = (0,
|
|
2259
|
-
const [popperElement, setPopperElement] = (0,
|
|
2260
|
-
const shouldShowArrow = (0,
|
|
2108
|
+
const [localOpen, setLocalOpen] = (0, import_react16.useState)(isLocalMode ? false : true);
|
|
2109
|
+
const [referenceElement, setReferenceElement] = (0, import_react16.useState)(null);
|
|
2110
|
+
const [popperElement, setPopperElement] = (0, import_react16.useState)(null);
|
|
2111
|
+
const shouldShowArrow = (0, import_react16.useMemo)(() => Boolean(popoverContent) && arrow, [popoverContent, arrow]);
|
|
2261
2112
|
const modifiers = offset ? [
|
|
2262
2113
|
{
|
|
2263
2114
|
name: "offset",
|
|
@@ -2271,7 +2122,7 @@ var Popover = ({
|
|
|
2271
2122
|
placement,
|
|
2272
2123
|
modifiers
|
|
2273
2124
|
});
|
|
2274
|
-
const handleClose = (0,
|
|
2125
|
+
const handleClose = (0, import_react16.useCallback)(
|
|
2275
2126
|
(0, import_lodash.default)(
|
|
2276
2127
|
() => {
|
|
2277
2128
|
if (isLocalMode) {
|
|
@@ -2286,7 +2137,7 @@ var Popover = ({
|
|
|
2286
2137
|
),
|
|
2287
2138
|
[setLocalOpen, isLocalMode, onClose, trigger, persistOnClick]
|
|
2288
2139
|
);
|
|
2289
|
-
const handleOpen = (0,
|
|
2140
|
+
const handleOpen = (0, import_react16.useCallback)(() => {
|
|
2290
2141
|
handleClose.cancel();
|
|
2291
2142
|
setLocalOpen(true);
|
|
2292
2143
|
}, [setLocalOpen, handleClose]);
|
|
@@ -2406,7 +2257,7 @@ var PopoverTooltip = ({
|
|
|
2406
2257
|
var PopoverTooltip_default = PopoverTooltip;
|
|
2407
2258
|
|
|
2408
2259
|
// src/components/JupShield.tsx
|
|
2409
|
-
var
|
|
2260
|
+
var import_react17 = require("react");
|
|
2410
2261
|
|
|
2411
2262
|
// src/components/Plural/index.tsx
|
|
2412
2263
|
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
@@ -2453,7 +2304,7 @@ var Warnings = ({
|
|
|
2453
2304
|
children,
|
|
2454
2305
|
isHighRisk
|
|
2455
2306
|
}) => {
|
|
2456
|
-
const warningTitle = (0,
|
|
2307
|
+
const warningTitle = (0, import_react17.useCallback)((warning2) => {
|
|
2457
2308
|
return parseShieldWarningtoSentenceCase(warning2);
|
|
2458
2309
|
}, []);
|
|
2459
2310
|
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex gap-1", children: [
|
|
@@ -2469,9 +2320,9 @@ var JupShield = ({ tokenAddress }) => {
|
|
|
2469
2320
|
const { data, isFetching } = (0, import_react_query6.useQuery)({
|
|
2470
2321
|
queryKey: ["shield", tokenAddress],
|
|
2471
2322
|
queryFn: () => ultraSwapService.getShield([tokenAddress]),
|
|
2472
|
-
|
|
2323
|
+
gcTime: 5 * 6e4,
|
|
2473
2324
|
staleTime: 5 * 6e4,
|
|
2474
|
-
|
|
2325
|
+
placeholderData: import_react_query6.keepPreviousData,
|
|
2475
2326
|
select: (data2) => {
|
|
2476
2327
|
const warnings = data2.warnings[tokenAddress];
|
|
2477
2328
|
return {
|
|
@@ -2524,10 +2375,166 @@ var JupShield = ({ tokenAddress }) => {
|
|
|
2524
2375
|
};
|
|
2525
2376
|
var JupShield_default = JupShield;
|
|
2526
2377
|
|
|
2527
|
-
// src/
|
|
2378
|
+
// src/queries/useUltraSwapMutation.ts
|
|
2379
|
+
var import_wallet_adapter2 = require("@jup-ag/wallet-adapter");
|
|
2380
|
+
var import_react_query7 = require("@tanstack/react-query");
|
|
2381
|
+
var import_buffer = require("buffer");
|
|
2382
|
+
var import_web34 = require("@solana/web3.js");
|
|
2383
|
+
|
|
2384
|
+
// src/entity/TransactionError.ts
|
|
2385
|
+
var TransactionError = class extends Error {
|
|
2386
|
+
constructor(message, txid, code, programIds, serializedTx) {
|
|
2387
|
+
super(message);
|
|
2388
|
+
this.name = "TransactionError";
|
|
2389
|
+
this.txid = txid;
|
|
2390
|
+
this.code = code;
|
|
2391
|
+
this.programIds = programIds;
|
|
2392
|
+
this.serializedTx = serializedTx;
|
|
2393
|
+
}
|
|
2394
|
+
};
|
|
2395
|
+
|
|
2396
|
+
// src/queries/useUltraSwapMutation.ts
|
|
2397
|
+
var UltraSwapError = class extends Error {
|
|
2398
|
+
constructor(message, type2, txid) {
|
|
2399
|
+
super(message);
|
|
2400
|
+
this.type = type2;
|
|
2401
|
+
this.txid = txid;
|
|
2402
|
+
}
|
|
2403
|
+
};
|
|
2404
|
+
function useUltraSwapMutation() {
|
|
2405
|
+
const { wallet, signTransaction } = useWalletPassThrough();
|
|
2406
|
+
return (0, import_react_query7.useMutation)({
|
|
2407
|
+
mutationFn: (_0) => __async(this, [_0], function* ({
|
|
2408
|
+
setTxStatus,
|
|
2409
|
+
setLastSwapResult,
|
|
2410
|
+
fromTokenInfo,
|
|
2411
|
+
toTokenInfo,
|
|
2412
|
+
quoteResponseMeta
|
|
2413
|
+
}) {
|
|
2414
|
+
const publicKey = wallet == null ? void 0 : wallet.adapter.publicKey;
|
|
2415
|
+
if (!signTransaction || !publicKey) {
|
|
2416
|
+
throw new UltraSwapError(
|
|
2417
|
+
"Wallet not connected, or missing wallet functions",
|
|
2418
|
+
"WALLET_SIGNING_FAILED" /* WALLET_SIGNING_FAILED */
|
|
2419
|
+
);
|
|
2420
|
+
}
|
|
2421
|
+
setTxStatus({
|
|
2422
|
+
txid: "",
|
|
2423
|
+
status: "pending-approval"
|
|
2424
|
+
});
|
|
2425
|
+
const selectedQuote = quoteResponseMeta.original;
|
|
2426
|
+
const { transaction, requestId } = selectedQuote;
|
|
2427
|
+
if (!transaction) throw new Error("Missing transaction");
|
|
2428
|
+
const based64tx = import_buffer.Buffer.from(transaction, "base64");
|
|
2429
|
+
const versionedTransaction = import_web34.VersionedTransaction.deserialize(new Uint8Array(based64tx));
|
|
2430
|
+
const signedTransaction = yield signTransaction(versionedTransaction);
|
|
2431
|
+
const serializedTransaction = import_buffer.Buffer.from(signedTransaction.serialize()).toString("base64");
|
|
2432
|
+
setTxStatus({
|
|
2433
|
+
txid: "",
|
|
2434
|
+
status: "sending"
|
|
2435
|
+
});
|
|
2436
|
+
const response = yield ultraSwapService.submitSwap(serializedTransaction, requestId);
|
|
2437
|
+
const { signature, status } = response;
|
|
2438
|
+
if (status === "Failed") {
|
|
2439
|
+
throw new UltraSwapError(response.error, "FAILED" /* FAILED */, signature);
|
|
2440
|
+
}
|
|
2441
|
+
const { inputAmountResult, outputAmountResult } = response;
|
|
2442
|
+
setTxStatus({
|
|
2443
|
+
txid: signature,
|
|
2444
|
+
status: "success"
|
|
2445
|
+
});
|
|
2446
|
+
setLastSwapResult({
|
|
2447
|
+
swapResult: {
|
|
2448
|
+
txid: signature,
|
|
2449
|
+
inputAddress: new import_web34.PublicKey(fromTokenInfo.id),
|
|
2450
|
+
outputAddress: new import_web34.PublicKey(toTokenInfo.id),
|
|
2451
|
+
inputAmount: Number(inputAmountResult),
|
|
2452
|
+
outputAmount: Number(outputAmountResult)
|
|
2453
|
+
},
|
|
2454
|
+
quoteReponse: quoteResponseMeta
|
|
2455
|
+
});
|
|
2456
|
+
return signature;
|
|
2457
|
+
}),
|
|
2458
|
+
onError: (error, variables) => __async(this, null, function* () {
|
|
2459
|
+
const { setTxStatus, setLastSwapResult, quoteResponseMeta } = variables;
|
|
2460
|
+
if (error instanceof import_wallet_adapter2.WalletSignTransactionError) {
|
|
2461
|
+
const message = error.message || error.error || "Transaction cancelled";
|
|
2462
|
+
setLastSwapResult({
|
|
2463
|
+
swapResult: {
|
|
2464
|
+
error: new TransactionError(message)
|
|
2465
|
+
},
|
|
2466
|
+
quoteReponse: quoteResponseMeta
|
|
2467
|
+
});
|
|
2468
|
+
return;
|
|
2469
|
+
}
|
|
2470
|
+
if (error instanceof Error) {
|
|
2471
|
+
setLastSwapResult({
|
|
2472
|
+
swapResult: {
|
|
2473
|
+
error: new TransactionError(error.message)
|
|
2474
|
+
},
|
|
2475
|
+
quoteReponse: quoteResponseMeta
|
|
2476
|
+
});
|
|
2477
|
+
return;
|
|
2478
|
+
}
|
|
2479
|
+
if ("json" in error) {
|
|
2480
|
+
const json = yield error.json();
|
|
2481
|
+
setLastSwapResult({
|
|
2482
|
+
swapResult: {
|
|
2483
|
+
error: new TransactionError(json.error || "Unknown error")
|
|
2484
|
+
},
|
|
2485
|
+
quoteReponse: quoteResponseMeta
|
|
2486
|
+
});
|
|
2487
|
+
setTxStatus({
|
|
2488
|
+
txid: json.txid || "",
|
|
2489
|
+
status: "fail"
|
|
2490
|
+
});
|
|
2491
|
+
}
|
|
2492
|
+
})
|
|
2493
|
+
});
|
|
2494
|
+
}
|
|
2495
|
+
|
|
2496
|
+
// src/components/SubmitButton.tsx
|
|
2497
|
+
var import_react18 = require("react");
|
|
2528
2498
|
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
2499
|
+
var SubmitButton = ({ onSubmit }) => {
|
|
2500
|
+
const {
|
|
2501
|
+
quoteResponseMeta,
|
|
2502
|
+
loading,
|
|
2503
|
+
errors,
|
|
2504
|
+
swapping: { txStatus },
|
|
2505
|
+
form
|
|
2506
|
+
} = useSwapContext();
|
|
2507
|
+
const shouldButtonDisabled = (0, import_react18.useMemo)(() => {
|
|
2508
|
+
if (!quoteResponseMeta || loading || !!errors.fromValue || (txStatus == null ? void 0 : txStatus.status) === "loading" || (txStatus == null ? void 0 : txStatus.status) === "sending" || (txStatus == null ? void 0 : txStatus.status) === "pending-approval") {
|
|
2509
|
+
return true;
|
|
2510
|
+
}
|
|
2511
|
+
return false;
|
|
2512
|
+
}, [quoteResponseMeta, loading, errors.fromValue, txStatus]);
|
|
2513
|
+
const buttonText = (0, import_react18.useMemo)(() => {
|
|
2514
|
+
var _a2;
|
|
2515
|
+
if (errors.fromValue) return errors.fromValue.title;
|
|
2516
|
+
if ((_a2 = quoteResponseMeta == null ? void 0 : quoteResponseMeta.quoteResponse) == null ? void 0 : _a2.errorMessage) return quoteResponseMeta.quoteResponse.errorMessage;
|
|
2517
|
+
if (loading) return "Loading";
|
|
2518
|
+
if ((txStatus == null ? void 0 : txStatus.status) === "sending") return "Sending";
|
|
2519
|
+
if ((txStatus == null ? void 0 : txStatus.status) === "pending-approval") return "Pending Approval";
|
|
2520
|
+
return "Swap";
|
|
2521
|
+
}, [txStatus, errors.fromValue, loading, quoteResponseMeta]);
|
|
2522
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
2523
|
+
JupButton_default,
|
|
2524
|
+
{
|
|
2525
|
+
size: "lg",
|
|
2526
|
+
className: cn("w-full mt-4 disabled:opacity-50 !text-uiv2-text/75 !bg-primary "),
|
|
2527
|
+
onClick: onSubmit,
|
|
2528
|
+
disabled: shouldButtonDisabled,
|
|
2529
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { children: buttonText })
|
|
2530
|
+
}
|
|
2531
|
+
);
|
|
2532
|
+
};
|
|
2533
|
+
|
|
2534
|
+
// src/components/Form.tsx
|
|
2535
|
+
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
2529
2536
|
var FormInputContainer = ({ tokenInfo, onBalanceClick, title, pairSelectDisabled, onClickSelectPair, children, value }) => {
|
|
2530
|
-
return /* @__PURE__ */ (0,
|
|
2537
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
2531
2538
|
"div",
|
|
2532
2539
|
{
|
|
2533
2540
|
className: cn(
|
|
@@ -2536,9 +2543,9 @@ var FormInputContainer = ({ tokenInfo, onBalanceClick, title, pairSelectDisabled
|
|
|
2536
2543
|
"group focus-within:border-primary/50 focus-within:shadow-swap-input-dark rounded-xl"
|
|
2537
2544
|
),
|
|
2538
2545
|
children: [
|
|
2539
|
-
/* @__PURE__ */ (0,
|
|
2540
|
-
/* @__PURE__ */ (0,
|
|
2541
|
-
tokenInfo && /* @__PURE__ */ (0,
|
|
2546
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex justify-between items-center text-xs text-primary-text", children: [
|
|
2547
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { children: title }),
|
|
2548
|
+
tokenInfo && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
2542
2549
|
"div",
|
|
2543
2550
|
{
|
|
2544
2551
|
className: cn("flex space-x-1 text-xs items-center text-primary-text/50 fill-current ", {
|
|
@@ -2548,16 +2555,16 @@ var FormInputContainer = ({ tokenInfo, onBalanceClick, title, pairSelectDisabled
|
|
|
2548
2555
|
onBalanceClick == null ? void 0 : onBalanceClick(e);
|
|
2549
2556
|
},
|
|
2550
2557
|
children: [
|
|
2551
|
-
/* @__PURE__ */ (0,
|
|
2552
|
-
/* @__PURE__ */ (0,
|
|
2553
|
-
/* @__PURE__ */ (0,
|
|
2558
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(WalletIcon_default, { width: 10, height: 10 }),
|
|
2559
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Coinbalance_default, { mintAddress: tokenInfo.id, hideZeroBalance: false }),
|
|
2560
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { children: tokenInfo.symbol })
|
|
2554
2561
|
]
|
|
2555
2562
|
}
|
|
2556
2563
|
)
|
|
2557
2564
|
] }),
|
|
2558
|
-
/* @__PURE__ */ (0,
|
|
2559
|
-
/* @__PURE__ */ (0,
|
|
2560
|
-
/* @__PURE__ */ (0,
|
|
2565
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex", children: [
|
|
2566
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { children: [
|
|
2567
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
2561
2568
|
"button",
|
|
2562
2569
|
{
|
|
2563
2570
|
type: "button",
|
|
@@ -2567,25 +2574,25 @@ var FormInputContainer = ({ tokenInfo, onBalanceClick, title, pairSelectDisabled
|
|
|
2567
2574
|
disabled: pairSelectDisabled,
|
|
2568
2575
|
onClick: onClickSelectPair,
|
|
2569
2576
|
children: [
|
|
2570
|
-
/* @__PURE__ */ (0,
|
|
2571
|
-
/* @__PURE__ */ (0,
|
|
2572
|
-
pairSelectDisabled ? null : /* @__PURE__ */ (0,
|
|
2577
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "h-5 w-5", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(TokenIcon_default, { info: tokenInfo, width: 20, height: 20 }) }),
|
|
2578
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "ml-4 mr-2 font-semibold", translate: "no", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "truncate", children: tokenInfo == null ? void 0 : tokenInfo.symbol }) }),
|
|
2579
|
+
pairSelectDisabled ? null : /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "text-primary-text/25 fill-current", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ChevronDownIcon_default, {}) })
|
|
2573
2580
|
]
|
|
2574
2581
|
}
|
|
2575
2582
|
),
|
|
2576
|
-
/* @__PURE__ */ (0,
|
|
2583
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "flex justify-between items-center h-[20px]", children: (tokenInfo == null ? void 0 : tokenInfo.id) && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(JupShield_default, { tokenAddress: tokenInfo.id }) })
|
|
2577
2584
|
] }),
|
|
2578
|
-
/* @__PURE__ */ (0,
|
|
2585
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex flex-col items-end justify-between w-full", children: [
|
|
2579
2586
|
children,
|
|
2580
|
-
/* @__PURE__ */ (0,
|
|
2587
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "text-xs text-primary-text/50", children: tokenInfo && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(CoinBalanceUSD, { tokenInfo, amount: value }) })
|
|
2581
2588
|
] })
|
|
2582
2589
|
] })
|
|
2583
2590
|
]
|
|
2584
2591
|
}
|
|
2585
2592
|
);
|
|
2586
2593
|
};
|
|
2587
|
-
var Form = ({
|
|
2588
|
-
const { publicKey } = useWalletPassThrough();
|
|
2594
|
+
var Form = ({ setSelectPairSelector }) => {
|
|
2595
|
+
const { publicKey, wallet } = useWalletPassThrough();
|
|
2589
2596
|
const { data: balances } = useBalances();
|
|
2590
2597
|
const {
|
|
2591
2598
|
form,
|
|
@@ -2595,19 +2602,32 @@ var Form = ({ onSubmit, isDisabled, setSelectPairSelector }) => {
|
|
|
2595
2602
|
quoteResponseMeta,
|
|
2596
2603
|
formProps: { fixedAmount, swapMode, fixedMint },
|
|
2597
2604
|
loading,
|
|
2598
|
-
refresh,
|
|
2599
|
-
quoteError,
|
|
2600
|
-
errors,
|
|
2601
2605
|
isToPairFocused,
|
|
2602
|
-
|
|
2606
|
+
setTxStatus,
|
|
2607
|
+
setLastSwapResult
|
|
2603
2608
|
} = useSwapContext();
|
|
2604
|
-
const [hasExpired, timeDiff] = useTimeDiff_default();
|
|
2605
2609
|
const { setScreen } = useScreenState();
|
|
2606
|
-
|
|
2607
|
-
|
|
2608
|
-
|
|
2610
|
+
const { mutateAsync: ultraSwapMutation } = useUltraSwapMutation();
|
|
2611
|
+
const onSubmit = (0, import_react19.useCallback)(() => __async(void 0, null, function* () {
|
|
2612
|
+
if (!wallet || !wallet.adapter.publicKey || !quoteResponseMeta) {
|
|
2613
|
+
return null;
|
|
2609
2614
|
}
|
|
2610
|
-
|
|
2615
|
+
try {
|
|
2616
|
+
if (!fromTokenInfo) throw new Error("Missing fromTokenInfo");
|
|
2617
|
+
if (!toTokenInfo) throw new Error("Missing toTokenInfo");
|
|
2618
|
+
yield ultraSwapMutation({
|
|
2619
|
+
quoteResponseMeta,
|
|
2620
|
+
fromTokenInfo,
|
|
2621
|
+
toTokenInfo,
|
|
2622
|
+
setTxStatus,
|
|
2623
|
+
setLastSwapResult
|
|
2624
|
+
});
|
|
2625
|
+
} catch (error) {
|
|
2626
|
+
console.log("Swap error", error);
|
|
2627
|
+
} finally {
|
|
2628
|
+
setScreen("Swapping");
|
|
2629
|
+
}
|
|
2630
|
+
}), [wallet, quoteResponseMeta, ultraSwapMutation, fromTokenInfo, toTokenInfo, setTxStatus, setLastSwapResult, setScreen]);
|
|
2611
2631
|
const shouldDisabledFromSelector = (0, import_react19.useMemo)(() => {
|
|
2612
2632
|
if ((fromTokenInfo == null ? void 0 : fromTokenInfo.id) === fixedMint) {
|
|
2613
2633
|
return true;
|
|
@@ -2707,15 +2727,9 @@ var Form = ({ onSubmit, isDisabled, setSelectPairSelector }) => {
|
|
|
2707
2727
|
},
|
|
2708
2728
|
[setScreen]
|
|
2709
2729
|
);
|
|
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)(
|
|
2730
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "h-full flex flex-col items-center justify-center", children: [
|
|
2731
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "w-full mt-2 rounded-xl flex flex-col px-2", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex-col", children: [
|
|
2732
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
2719
2733
|
FormInputContainer,
|
|
2720
2734
|
{
|
|
2721
2735
|
tokenInfo: fromTokenInfo,
|
|
@@ -2727,7 +2741,7 @@ var Form = ({ onSubmit, isDisabled, setSelectPairSelector }) => {
|
|
|
2727
2741
|
pairSelectDisabled: shouldDisabledFromSelector,
|
|
2728
2742
|
onClickSelectPair: onClickSelectFromMint,
|
|
2729
2743
|
value: form.fromValue,
|
|
2730
|
-
children: (fromTokenInfo == null ? void 0 : fromTokenInfo.decimals) && /* @__PURE__ */ (0,
|
|
2744
|
+
children: (fromTokenInfo == null ? void 0 : fromTokenInfo.decimals) && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
2731
2745
|
import_react_number_format.NumericFormat,
|
|
2732
2746
|
{
|
|
2733
2747
|
disabled: fixedAmount || swapMode === SwapMode.ExactOut,
|
|
@@ -2754,8 +2768,8 @@ var Form = ({ onSubmit, isDisabled, setSelectPairSelector }) => {
|
|
|
2754
2768
|
)
|
|
2755
2769
|
}
|
|
2756
2770
|
),
|
|
2757
|
-
/* @__PURE__ */ (0,
|
|
2758
|
-
/* @__PURE__ */ (0,
|
|
2771
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "relative z-10 -my-3 flex justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(SwitchPairButton_default, { onClick: onClickSwitchPair, className: cn("transition-all") }) }),
|
|
2772
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
2759
2773
|
FormInputContainer,
|
|
2760
2774
|
{
|
|
2761
2775
|
tokenInfo: toTokenInfo,
|
|
@@ -2763,7 +2777,7 @@ var Form = ({ onSubmit, isDisabled, setSelectPairSelector }) => {
|
|
|
2763
2777
|
pairSelectDisabled: shouldDisabledToSelector,
|
|
2764
2778
|
onClickSelectPair: onClickSelectToMint,
|
|
2765
2779
|
value: form.toValue,
|
|
2766
|
-
children: (toTokenInfo == null ? void 0 : toTokenInfo.decimals) && /* @__PURE__ */ (0,
|
|
2780
|
+
children: (toTokenInfo == null ? void 0 : toTokenInfo.decimals) && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
2767
2781
|
import_react_number_format.NumericFormat,
|
|
2768
2782
|
{
|
|
2769
2783
|
inputMode: "decimal",
|
|
@@ -2794,21 +2808,9 @@ var Form = ({ onSubmit, isDisabled, setSelectPairSelector }) => {
|
|
|
2794
2808
|
}
|
|
2795
2809
|
)
|
|
2796
2810
|
] }) }),
|
|
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)(
|
|
2811
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "w-full px-2", children: [
|
|
2812
|
+
!walletPublicKey ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(JupButton_default, { size: "lg", className: "w-full mt-4 bg-primary !text-uiv2-text/75", onClick: handleClick, children: "Connect Wallet" }) : /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(SubmitButton, { onSubmit }),
|
|
2813
|
+
quoteResponseMeta && fromTokenInfo && toTokenInfo ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
2812
2814
|
PriceInfo_default,
|
|
2813
2815
|
{
|
|
2814
2816
|
quoteResponse: quoteResponseMeta,
|
|
@@ -2828,9 +2830,9 @@ var import_react_virtualized_auto_sizer = __toESM(require("react-virtualized-aut
|
|
|
2828
2830
|
var import_react_window = require("react-window");
|
|
2829
2831
|
|
|
2830
2832
|
// src/icons/LeftArrowIcon.tsx
|
|
2831
|
-
var
|
|
2833
|
+
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
2832
2834
|
var LeftArrowIcon = ({ width = "12", height = "12" }) => {
|
|
2833
|
-
return /* @__PURE__ */ (0,
|
|
2835
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("svg", { width, height, viewBox: "0 0 53 52", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
2834
2836
|
"path",
|
|
2835
2837
|
{
|
|
2836
2838
|
d: "M17.3336 23.8334H43.7062V28.1667H17.3336L28.9555 39.7887L25.8919 42.8524L9.03955 26L25.8919 9.14771L28.9555 12.2114L17.3336 23.8334Z",
|
|
@@ -2841,9 +2843,9 @@ var LeftArrowIcon = ({ width = "12", height = "12" }) => {
|
|
|
2841
2843
|
var LeftArrowIcon_default = LeftArrowIcon;
|
|
2842
2844
|
|
|
2843
2845
|
// src/icons/SearchIcon.tsx
|
|
2844
|
-
var
|
|
2846
|
+
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
2845
2847
|
var SearchIcon = () => {
|
|
2846
|
-
return /* @__PURE__ */ (0,
|
|
2848
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "flex items-center text-primary-text fill-current", children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("svg", { width: "18", height: "18", viewBox: "0 0 18 18", fill: "inherit", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
2847
2849
|
"path",
|
|
2848
2850
|
{
|
|
2849
2851
|
d: "M7.30327 14.6058C8.75327 14.6074 10.1705 14.1746 11.3729 13.3637L15.5971 17.5871C16.1463 18.1371 17.0377 18.1371 17.5877 17.5871C18.1377 17.0371 18.1377 16.1457 17.5877 15.5964L13.3643 11.3722C14.5823 9.55661 14.9229 7.28943 14.2909 5.19563C13.6596 3.10183 12.1229 1.40183 10.1033 0.56283C8.08365 -0.276231 5.79385 -0.16607 3.86505 0.86283C1.93537 1.89251 0.569053 3.73243 0.140853 5.87683C-0.286487 8.02143 0.269759 10.2448 1.65725 11.9354C3.04397 13.6261 5.11665 14.6064 7.30325 14.6058H7.30327ZM7.30327 1.68943C8.79233 1.68865 10.2197 2.28005 11.2729 3.33319C12.3252 4.38631 12.9166 5.81359 12.9166 7.30279C12.9166 8.79199 12.3252 10.2192 11.2729 11.2724C10.2198 12.3247 8.79247 12.9162 7.30327 12.9162C5.81407 12.9162 4.38687 12.3247 3.33367 11.2724C2.28133 10.2193 1.68913 8.79199 1.68991 7.30279C1.69148 5.81451 2.28287 4.38719 3.33523 3.33479C4.38759 2.28239 5.81483 1.69103 7.30323 1.68947L7.30327 1.68943Z",
|
|
@@ -2863,7 +2865,7 @@ var import_decimal8 = __toESM(require("decimal.js"));
|
|
|
2863
2865
|
|
|
2864
2866
|
// src/contexts/preferredExplorer/index.tsx
|
|
2865
2867
|
var import_react20 = require("react");
|
|
2866
|
-
var
|
|
2868
|
+
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
2867
2869
|
var AVAILABLE_EXPLORER = [
|
|
2868
2870
|
{
|
|
2869
2871
|
name: "Solana Explorer",
|
|
@@ -2939,7 +2941,7 @@ var PreferredExplorerProvider = ({
|
|
|
2939
2941
|
(mint, cluster) => explorerObject.getToken(mint, cluster),
|
|
2940
2942
|
[explorerObject]
|
|
2941
2943
|
);
|
|
2942
|
-
return /* @__PURE__ */ (0,
|
|
2944
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
2943
2945
|
PreferredExplorerContext.Provider,
|
|
2944
2946
|
{
|
|
2945
2947
|
value: { explorer, getExplorer, getTokenExplorer, setExplorer: (explorer2) => setExplorer(explorer2) },
|
|
@@ -2953,8 +2955,8 @@ function usePreferredExplorer() {
|
|
|
2953
2955
|
}
|
|
2954
2956
|
|
|
2955
2957
|
// src/icons/ExternalIcon.tsx
|
|
2956
|
-
var
|
|
2957
|
-
var ExternalIcon = () => /* @__PURE__ */ (0,
|
|
2958
|
+
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
2959
|
+
var ExternalIcon = () => /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("svg", { width: "10", height: "10", viewBox: "0 0 10 10", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
2958
2960
|
"path",
|
|
2959
2961
|
{
|
|
2960
2962
|
d: "M4 2V3H1.5V8.5H7V6H8V9C8 9.13261 7.94732 9.25979 7.85355 9.35355C7.75979 9.44732 7.63261 9.5 7.5 9.5H1C0.867392 9.5 0.740215 9.44732 0.646447 9.35355C0.552678 9.25979 0.5 9.13261 0.5 9V2.5C0.5 2.36739 0.552678 2.24021 0.646447 2.14645C0.740215 2.05268 0.867392 2 1 2H4ZM9.5 0.5V4.5H8.5V2.2065L4.6035 6.1035L3.8965 5.3965L7.7925 1.5H5.5V0.5H9.5Z",
|
|
@@ -2964,10 +2966,10 @@ var ExternalIcon = () => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("svg", {
|
|
|
2964
2966
|
var ExternalIcon_default = ExternalIcon;
|
|
2965
2967
|
|
|
2966
2968
|
// src/components/TokenLink.tsx
|
|
2967
|
-
var
|
|
2969
|
+
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
2968
2970
|
var TokenLink = ({ tokenInfo, className }) => {
|
|
2969
2971
|
const { getTokenExplorer } = usePreferredExplorer();
|
|
2970
|
-
return /* @__PURE__ */ (0,
|
|
2972
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(
|
|
2971
2973
|
"a",
|
|
2972
2974
|
{
|
|
2973
2975
|
target: "_blank",
|
|
@@ -2979,8 +2981,8 @@ var TokenLink = ({ tokenInfo, className }) => {
|
|
|
2979
2981
|
href: getTokenExplorer(tokenInfo.id),
|
|
2980
2982
|
onClick: (e) => e.stopPropagation(),
|
|
2981
2983
|
children: [
|
|
2982
|
-
/* @__PURE__ */ (0,
|
|
2983
|
-
/* @__PURE__ */ (0,
|
|
2984
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: "text-xxs", children: shortenAddress(tokenInfo.id) }),
|
|
2985
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(ExternalIcon_default, {})
|
|
2984
2986
|
]
|
|
2985
2987
|
}
|
|
2986
2988
|
);
|
|
@@ -2989,9 +2991,9 @@ TokenLink.displayName = "TokenLink";
|
|
|
2989
2991
|
var TokenLink_default = TokenLink;
|
|
2990
2992
|
|
|
2991
2993
|
// src/components/CheckedBadge.tsx
|
|
2992
|
-
var
|
|
2994
|
+
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
2993
2995
|
var CheckedBadge = ({ width = 24, height = 24 }) => {
|
|
2994
|
-
return /* @__PURE__ */ (0,
|
|
2996
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(
|
|
2995
2997
|
"svg",
|
|
2996
2998
|
{
|
|
2997
2999
|
width,
|
|
@@ -3000,7 +3002,7 @@ var CheckedBadge = ({ width = 24, height = 24 }) => {
|
|
|
3000
3002
|
fill: "none",
|
|
3001
3003
|
xmlns: "http://www.w3.org/2000/svg",
|
|
3002
3004
|
children: [
|
|
3003
|
-
/* @__PURE__ */ (0,
|
|
3005
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
3004
3006
|
"path",
|
|
3005
3007
|
{
|
|
3006
3008
|
d: "M13.8179 4.54512L13.6275 4.27845C12.8298 3.16176 11.1702 3.16176 10.3725 4.27845L10.1821 4.54512C9.76092 5.13471 9.05384 5.45043 8.33373 5.37041L7.48471 5.27608C6.21088 5.13454 5.13454 6.21088 5.27608 7.48471L5.37041 8.33373C5.45043 9.05384 5.13471 9.76092 4.54512 10.1821L4.27845 10.3725C3.16176 11.1702 3.16176 12.8298 4.27845 13.6275L4.54512 13.8179C5.13471 14.2391 5.45043 14.9462 5.37041 15.6663L5.27608 16.5153C5.13454 17.7891 6.21088 18.8655 7.48471 18.7239L8.33373 18.6296C9.05384 18.5496 9.76092 18.8653 10.1821 19.4549L10.3725 19.7215C11.1702 20.8382 12.8298 20.8382 13.6275 19.7215L13.8179 19.4549C14.2391 18.8653 14.9462 18.5496 15.6663 18.6296L16.5153 18.7239C17.7891 18.8655 18.8655 17.7891 18.7239 16.5153L18.6296 15.6663C18.5496 14.9462 18.8653 14.2391 19.4549 13.8179L19.7215 13.6275C20.8382 12.8298 20.8382 11.1702 19.7215 10.3725L19.4549 10.1821C18.8653 9.76092 18.5496 9.05384 18.6296 8.33373L18.7239 7.48471C18.8655 6.21088 17.7891 5.13454 16.5153 5.27608L15.6663 5.37041C14.9462 5.45043 14.2391 5.13471 13.8179 4.54512Z",
|
|
@@ -3010,7 +3012,7 @@ var CheckedBadge = ({ width = 24, height = 24 }) => {
|
|
|
3010
3012
|
strokeLinejoin: "round"
|
|
3011
3013
|
}
|
|
3012
3014
|
),
|
|
3013
|
-
/* @__PURE__ */ (0,
|
|
3015
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
3014
3016
|
"path",
|
|
3015
3017
|
{
|
|
3016
3018
|
d: "M9 12L10.8189 13.8189V13.8189C10.9189 13.9189 11.0811 13.9189 11.1811 13.8189V13.8189L15 10",
|
|
@@ -3027,27 +3029,25 @@ var CheckedBadge = ({ width = 24, height = 24 }) => {
|
|
|
3027
3029
|
var CheckedBadge_default = CheckedBadge;
|
|
3028
3030
|
|
|
3029
3031
|
// src/queries/useLstApy.ts
|
|
3030
|
-
var
|
|
3032
|
+
var import_react_query8 = require("@tanstack/react-query");
|
|
3031
3033
|
function useLstApyFetcher() {
|
|
3032
|
-
return (0,
|
|
3033
|
-
["lst-apy"],
|
|
3034
|
-
() => __async(this, null, function* () {
|
|
3034
|
+
return (0, import_react_query8.useQuery)({
|
|
3035
|
+
queryKey: ["lst-apy"],
|
|
3036
|
+
queryFn: () => __async(this, null, function* () {
|
|
3035
3037
|
const lstApy = yield fetch(`https://worker.jup.ag/lst-apys`);
|
|
3036
3038
|
const apyResult = yield lstApy.json();
|
|
3037
3039
|
return apyResult;
|
|
3038
3040
|
}),
|
|
3039
|
-
|
|
3040
|
-
|
|
3041
|
-
|
|
3042
|
-
|
|
3043
|
-
|
|
3044
|
-
}
|
|
3045
|
-
);
|
|
3041
|
+
retry: 3,
|
|
3042
|
+
placeholderData: import_react_query8.keepPreviousData,
|
|
3043
|
+
staleTime: 3e5
|
|
3044
|
+
// 5m
|
|
3045
|
+
});
|
|
3046
3046
|
}
|
|
3047
3047
|
|
|
3048
3048
|
// src/components/FormPairRow.tsx
|
|
3049
|
-
var
|
|
3050
|
-
var
|
|
3049
|
+
var import_react_query9 = require("@tanstack/react-query");
|
|
3050
|
+
var import_jsx_runtime39 = require("react/jsx-runtime");
|
|
3051
3051
|
var PAIR_ROW_HEIGHT = 72;
|
|
3052
3052
|
var LSTTag = ({ mintAddress }) => {
|
|
3053
3053
|
const { data: lstApy } = useLstApyFetcher();
|
|
@@ -3059,7 +3059,7 @@ var LSTTag = ({ mintAddress }) => {
|
|
|
3059
3059
|
}
|
|
3060
3060
|
return;
|
|
3061
3061
|
}, [lstApy, mintAddress]);
|
|
3062
|
-
return /* @__PURE__ */ (0,
|
|
3062
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("p", { className: "rounded-md text-xxs leading-none transition-all py-0.5 px-1 text-primary/50 border border-primary/50 font-semibold", children: [
|
|
3063
3063
|
"LST ",
|
|
3064
3064
|
apy ? `${apy}%` : ""
|
|
3065
3065
|
] });
|
|
@@ -3095,10 +3095,10 @@ var MultiTags = ({ item }) => {
|
|
|
3095
3095
|
const remainingTags = [];
|
|
3096
3096
|
if (!renderedTag) return null;
|
|
3097
3097
|
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,
|
|
3098
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "flex justify-end gap-x-1", children: [
|
|
3099
|
+
isFrozen && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("p", { className: "border rounded-md text-xxs leading-none transition-all py-0.5 px-1 border-warning/50 text-warning/50", children: "Frozen" }),
|
|
3100
|
+
isToken2022 && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("p", { className: "rounded-md text-xxs leading-none transition-all py-0.5 px-1 bg-black/10 font-semibold text-primary-text/20", children: "Token2022" }),
|
|
3101
|
+
remainingTags == null ? void 0 : remainingTags.map((tag, idx) => /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
3102
3102
|
"div",
|
|
3103
3103
|
{
|
|
3104
3104
|
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 +3106,7 @@ var MultiTags = ({ item }) => {
|
|
|
3106
3106
|
},
|
|
3107
3107
|
idx
|
|
3108
3108
|
)),
|
|
3109
|
-
isLST && /* @__PURE__ */ (0,
|
|
3109
|
+
isLST && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(LSTTag, { mintAddress: item.id })
|
|
3110
3110
|
] });
|
|
3111
3111
|
};
|
|
3112
3112
|
var FormPairRow = (props) => {
|
|
@@ -3119,7 +3119,7 @@ var FormPairRow = (props) => {
|
|
|
3119
3119
|
showExplorer = true,
|
|
3120
3120
|
enableUnknownTokenWarning = true
|
|
3121
3121
|
} = props;
|
|
3122
|
-
const queryClient = (0,
|
|
3122
|
+
const queryClient = (0, import_react_query9.useQueryClient)();
|
|
3123
3123
|
const onClick = import_react21.default.useCallback(() => {
|
|
3124
3124
|
queryClient.setQueryData([...ASSET_QUERY_KEY, item.id], [item]);
|
|
3125
3125
|
onSubmit(item);
|
|
@@ -3129,27 +3129,27 @@ var FormPairRow = (props) => {
|
|
|
3129
3129
|
const balance = (_a2 = balances == null ? void 0 : balances[item.id]) == null ? void 0 : _a2.uiAmount;
|
|
3130
3130
|
const usdValue = balance ? new import_decimal8.default(balance).mul(item.usdPrice || 0) : void 0;
|
|
3131
3131
|
const usdValueDisplay = usdValue && usdValue.gte(0.01) ? `$${formatNumber.format(usdValue, 2)}` : "";
|
|
3132
|
-
return /* @__PURE__ */ (0,
|
|
3132
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
3133
3133
|
"li",
|
|
3134
3134
|
{
|
|
3135
3135
|
className: `rounded cursor-pointer px-5 my-1 list-none flex w-full items-center bg-interactive hover:bg-interactive/80`,
|
|
3136
3136
|
style: __spreadValues({ maxHeight: PAIR_ROW_HEIGHT - 4, height: PAIR_ROW_HEIGHT - 4 }, style),
|
|
3137
3137
|
onClick,
|
|
3138
3138
|
translate: "no",
|
|
3139
|
-
children: /* @__PURE__ */ (0,
|
|
3140
|
-
/* @__PURE__ */ (0,
|
|
3141
|
-
/* @__PURE__ */ (0,
|
|
3142
|
-
/* @__PURE__ */ (0,
|
|
3143
|
-
/* @__PURE__ */ (0,
|
|
3144
|
-
checkIsStrictOrVerified(item) && /* @__PURE__ */ (0,
|
|
3139
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "flex h-full w-full items-center space-x-4", children: [
|
|
3140
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: "flex-shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: "bg-gray-200 rounded-full", children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(TokenIcon_default, { info: item, width: 36, height: 36, enableUnknownTokenWarning }) }) }),
|
|
3141
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: "flex-1 min-w-0", children: /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "flex flex-col gap-y-px", children: [
|
|
3142
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "flex items-center", children: [
|
|
3143
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("p", { className: "text-sm font-medium text-primary-text truncate", children: item.symbol }),
|
|
3144
|
+
checkIsStrictOrVerified(item) && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("p", { className: "rounded-md text-xxs leading-none transition-all py-0.5 px-1 text-primary", children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(CheckedBadge_default, { width: 18, height: 18 }) })
|
|
3145
3145
|
] }),
|
|
3146
|
-
/* @__PURE__ */ (0,
|
|
3147
|
-
showExplorer ? /* @__PURE__ */ (0,
|
|
3146
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("p", { className: "text-xs text-primary-text/50 dark:text-primary-text-35 truncate", children: item.id === WRAPPED_SOL_MINT.toBase58() ? "Solana" : item.name }),
|
|
3147
|
+
showExplorer ? /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: "-ml-1 z-10 w-fit", onClick: (e) => e.stopPropagation(), children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(TokenLink_default, { tokenInfo: item }) }) : null
|
|
3148
3148
|
] }) }),
|
|
3149
|
-
/* @__PURE__ */ (0,
|
|
3150
|
-
/* @__PURE__ */ (0,
|
|
3151
|
-
usdValueDisplay ? /* @__PURE__ */ (0,
|
|
3152
|
-
/* @__PURE__ */ (0,
|
|
3149
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "text-xs text-primary-text/50 text-right h-full flex flex-col justify-evenly", children: [
|
|
3150
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Coinbalance_default, { mintAddress: item.id, hideZeroBalance: true }),
|
|
3151
|
+
usdValueDisplay ? /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("p", { children: usdValueDisplay }) : null,
|
|
3152
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(MultiTags, __spreadValues({}, props))
|
|
3153
3153
|
] })
|
|
3154
3154
|
] })
|
|
3155
3155
|
}
|
|
@@ -3159,12 +3159,12 @@ var FormPairRow_default = FormPairRow;
|
|
|
3159
3159
|
|
|
3160
3160
|
// src/hooks/useSearch.ts
|
|
3161
3161
|
var import_react22 = require("react");
|
|
3162
|
-
var
|
|
3162
|
+
var import_react_query10 = require("@tanstack/react-query");
|
|
3163
3163
|
var CHUNK_SIZE = 100;
|
|
3164
3164
|
var useSearch = (mintAddresses, options = {}) => {
|
|
3165
3165
|
var _a2, _b;
|
|
3166
3166
|
const mintAddressesString = (0, import_react22.useMemo)(() => mintAddresses.join(","), [mintAddresses]);
|
|
3167
|
-
return (0,
|
|
3167
|
+
return (0, import_react_query10.useQuery)({
|
|
3168
3168
|
queryKey: ["search", mintAddressesString],
|
|
3169
3169
|
queryFn: () => __async(void 0, null, function* () {
|
|
3170
3170
|
if (mintAddresses.length === 0) {
|
|
@@ -3186,13 +3186,13 @@ var useSearch = (mintAddresses, options = {}) => {
|
|
|
3186
3186
|
};
|
|
3187
3187
|
|
|
3188
3188
|
// src/components/FormPairSelector.tsx
|
|
3189
|
-
var
|
|
3189
|
+
var import_jsx_runtime40 = require("react/jsx-runtime");
|
|
3190
3190
|
var PAIR_ROW_HEIGHT2 = 72;
|
|
3191
3191
|
var SEARCH_BOX_HEIGHT = 56;
|
|
3192
3192
|
var rowRenderer = (0, import_react23.memo)((props) => {
|
|
3193
3193
|
const { data, index, style } = props;
|
|
3194
3194
|
const item = data.searchResult[index];
|
|
3195
|
-
return /* @__PURE__ */ (0,
|
|
3195
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(FormPairRow_default, { item, style, onSubmit: data.onSubmit }, item.address);
|
|
3196
3196
|
}, import_react_window.areEqual);
|
|
3197
3197
|
var FormPairSelector = ({ onSubmit, onClose }) => {
|
|
3198
3198
|
const [search, setSearch] = (0, import_react23.useState)("");
|
|
@@ -3226,20 +3226,20 @@ var FormPairSelector = ({ onSubmit, onClose }) => {
|
|
|
3226
3226
|
var _a2;
|
|
3227
3227
|
return (_a2 = inputRef.current) == null ? void 0 : _a2.focus();
|
|
3228
3228
|
}, [inputRef]);
|
|
3229
|
-
return /* @__PURE__ */ (0,
|
|
3230
|
-
/* @__PURE__ */ (0,
|
|
3231
|
-
/* @__PURE__ */ (0,
|
|
3232
|
-
/* @__PURE__ */ (0,
|
|
3233
|
-
/* @__PURE__ */ (0,
|
|
3229
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "flex flex-col h-full w-full py-4 px-2 bg-black", children: [
|
|
3230
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "flex w-full justify-between", children: [
|
|
3231
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "text-primary-text fill-current w-6 h-6 cursor-pointer", onClick: onClose, children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(LeftArrowIcon_default, { width: 24, height: 24 }) }),
|
|
3232
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "text-primary-text", children: "Select Token" }),
|
|
3233
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: " w-6 h-6" })
|
|
3234
3234
|
] }),
|
|
3235
|
-
/* @__PURE__ */ (0,
|
|
3235
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(
|
|
3236
3236
|
"div",
|
|
3237
3237
|
{
|
|
3238
3238
|
className: "flex px-5 mt-4 w-[98%] rounded-xl bg-module",
|
|
3239
3239
|
style: { height: SEARCH_BOX_HEIGHT, maxHeight: SEARCH_BOX_HEIGHT },
|
|
3240
3240
|
children: [
|
|
3241
|
-
/* @__PURE__ */ (0,
|
|
3242
|
-
/* @__PURE__ */ (0,
|
|
3241
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(SearchIcon_default, {}),
|
|
3242
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
3243
3243
|
"input",
|
|
3244
3244
|
{
|
|
3245
3245
|
autoComplete: "off",
|
|
@@ -3252,9 +3252,9 @@ var FormPairSelector = ({ onSubmit, onClose }) => {
|
|
|
3252
3252
|
]
|
|
3253
3253
|
}
|
|
3254
3254
|
),
|
|
3255
|
-
/* @__PURE__ */ (0,
|
|
3256
|
-
searchResult && searchResult.length > 0 && /* @__PURE__ */ (0,
|
|
3257
|
-
return /* @__PURE__ */ (0,
|
|
3255
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "mt-2", style: { flexGrow: 1 }, children: [
|
|
3256
|
+
searchResult && searchResult.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_react_virtualized_auto_sizer.default, { children: ({ height, width }) => {
|
|
3257
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
3258
3258
|
import_react_window.FixedSizeList,
|
|
3259
3259
|
{
|
|
3260
3260
|
ref: listRef,
|
|
@@ -3271,48 +3271,17 @@ var FormPairSelector = ({ onSubmit, onClose }) => {
|
|
|
3271
3271
|
}
|
|
3272
3272
|
);
|
|
3273
3273
|
} }),
|
|
3274
|
-
isLoading ? /* @__PURE__ */ (0,
|
|
3274
|
+
isLoading ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "mt-4 mb-4 text-center text-primary-text/50", children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { children: "Loading..." }) }) : searchResult && searchResult.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "mt-4 mb-4 text-center text-primary-text/50", children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { children: "No tokens found" }) }) : /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_jsx_runtime40.Fragment, {})
|
|
3275
3275
|
] })
|
|
3276
3276
|
] });
|
|
3277
3277
|
};
|
|
3278
3278
|
var FormPairSelector_default = FormPairSelector;
|
|
3279
3279
|
|
|
3280
3280
|
// src/components/screens/InitialScreen.tsx
|
|
3281
|
-
var
|
|
3282
|
-
var import_jsx_runtime40 = require("react/jsx-runtime");
|
|
3281
|
+
var import_jsx_runtime41 = require("react/jsx-runtime");
|
|
3283
3282
|
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]);
|
|
3283
|
+
const { form, setForm, loading } = useSwapContext();
|
|
3298
3284
|
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
3285
|
const [selectPairSelector, setSelectPairSelector] = (0, import_react24.useState)(null);
|
|
3317
3286
|
const onSelectMint = (0, import_react24.useCallback)(
|
|
3318
3287
|
(tokenInfo) => __async(void 0, null, function* () {
|
|
@@ -3331,128 +3300,28 @@ var InitialScreen = () => {
|
|
|
3331
3300
|
}),
|
|
3332
3301
|
[selectPairSelector, setForm]
|
|
3333
3302
|
);
|
|
3334
|
-
|
|
3335
|
-
|
|
3336
|
-
}, [setScreen]);
|
|
3337
|
-
return /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(import_jsx_runtime40.Fragment, { children: [
|
|
3338
|
-
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
3303
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(import_jsx_runtime41.Fragment, { children: [
|
|
3304
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
3339
3305
|
"form",
|
|
3340
3306
|
{
|
|
3341
|
-
onSubmit: onSubmitToConfirmation,
|
|
3342
3307
|
className: cn({
|
|
3343
3308
|
hidden: Boolean(selectPairSelector)
|
|
3344
3309
|
}),
|
|
3345
|
-
children: /* @__PURE__ */ (0,
|
|
3346
|
-
Form_default,
|
|
3347
|
-
{
|
|
3348
|
-
onSubmit: onSubmitToConfirmation,
|
|
3349
|
-
isDisabled,
|
|
3350
|
-
setSelectPairSelector
|
|
3351
|
-
}
|
|
3352
|
-
)
|
|
3310
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Form_default, { isDisabled, setSelectPairSelector })
|
|
3353
3311
|
}
|
|
3354
3312
|
),
|
|
3355
|
-
selectPairSelector !== null ? /* @__PURE__ */ (0,
|
|
3356
|
-
FormPairSelector_default,
|
|
3357
|
-
{
|
|
3358
|
-
onSubmit: onSelectMint,
|
|
3359
|
-
onClose: () => setSelectPairSelector(null)
|
|
3360
|
-
}
|
|
3361
|
-
) }) : null
|
|
3313
|
+
selectPairSelector !== null ? /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: "absolute top-0 left-0 h-full w-full bg-black rounded-lg overflow-hidden", children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(FormPairSelector_default, { onSubmit: onSelectMint, onClose: () => setSelectPairSelector(null) }) }) : null
|
|
3362
3314
|
] });
|
|
3363
3315
|
};
|
|
3364
3316
|
var InitialScreen_default = InitialScreen;
|
|
3365
3317
|
|
|
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
3318
|
// 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;
|
|
3319
|
+
var import_react25 = require("react");
|
|
3451
3320
|
|
|
3452
3321
|
// src/icons/SuccessIcon.tsx
|
|
3453
|
-
var
|
|
3322
|
+
var import_jsx_runtime42 = require("react/jsx-runtime");
|
|
3454
3323
|
var SuccessIcon = (props) => {
|
|
3455
|
-
return /* @__PURE__ */ (0,
|
|
3324
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("svg", __spreadProps(__spreadValues({ xmlns: "http://www.w3.org/2000/svg", width: "256", height: "256", viewBox: "0 0 256 256" }, props), { children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
3456
3325
|
"path",
|
|
3457
3326
|
{
|
|
3458
3327
|
fill: "currentColor",
|
|
@@ -3463,19 +3332,19 @@ var SuccessIcon = (props) => {
|
|
|
3463
3332
|
var SuccessIcon_default = SuccessIcon;
|
|
3464
3333
|
|
|
3465
3334
|
// src/components/screens/SwappingScreen.tsx
|
|
3466
|
-
var
|
|
3335
|
+
var import_jsx_runtime43 = require("react/jsx-runtime");
|
|
3467
3336
|
var ErrorIcon = () => {
|
|
3468
|
-
return /* @__PURE__ */ (0,
|
|
3469
|
-
/* @__PURE__ */ (0,
|
|
3470
|
-
/* @__PURE__ */ (0,
|
|
3471
|
-
/* @__PURE__ */ (0,
|
|
3337
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("svg", { width: "40", height: "40", viewBox: "0 0 40 40", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
|
|
3338
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("g", { clipPath: "url(#clip0_7547_116874)", children: [
|
|
3339
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("circle", { cx: "20", cy: "20", r: "20", fill: "#F04A44" }),
|
|
3340
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
3472
3341
|
"path",
|
|
3473
3342
|
{
|
|
3474
3343
|
d: "M19.8444 25.4321C18.6773 25.4332 17.7205 24.5092 17.6793 23.3431L17.1718 9.04107C17.1507 8.45326 17.3706 7.88344 17.7786 7.46056C18.1867 7.03768 18.7492 6.7998 19.337 6.7998H20.3519C20.9397 6.7998 21.5021 7.03768 21.9102 7.46056C22.3183 7.88344 22.5382 8.45329 22.5171 9.04107L22.0096 23.3431C21.9684 24.5092 21.0116 25.4332 19.8444 25.4321Z",
|
|
3475
3344
|
fill: "white"
|
|
3476
3345
|
}
|
|
3477
3346
|
),
|
|
3478
|
-
/* @__PURE__ */ (0,
|
|
3347
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
3479
3348
|
"path",
|
|
3480
3349
|
{
|
|
3481
3350
|
d: "M22.8893 30.4989C22.8893 32.1809 21.5266 33.5436 19.8446 33.5436C18.1626 33.5436 16.7998 32.1809 16.7998 30.4989C16.7998 28.8169 18.1626 27.4541 19.8446 27.4541C21.5266 27.4541 22.8893 28.8169 22.8893 30.4989Z",
|
|
@@ -3483,7 +3352,7 @@ var ErrorIcon = () => {
|
|
|
3483
3352
|
}
|
|
3484
3353
|
)
|
|
3485
3354
|
] }),
|
|
3486
|
-
/* @__PURE__ */ (0,
|
|
3355
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("clipPath", { id: "clip0_7547_116874", children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("rect", { width: "40", height: "40", fill: "white" }) }) })
|
|
3487
3356
|
] });
|
|
3488
3357
|
};
|
|
3489
3358
|
var SwappingScreen = () => {
|
|
@@ -3497,7 +3366,7 @@ var SwappingScreen = () => {
|
|
|
3497
3366
|
refresh
|
|
3498
3367
|
} = useSwapContext();
|
|
3499
3368
|
const { screen: screen2, setScreen } = useScreenState();
|
|
3500
|
-
const [errorMessage, setErrorMessage] = (0,
|
|
3369
|
+
const [errorMessage, setErrorMessage] = (0, import_react25.useState)("");
|
|
3501
3370
|
const onSwapMore = () => {
|
|
3502
3371
|
reset();
|
|
3503
3372
|
setErrorMessage("");
|
|
@@ -3510,7 +3379,7 @@ var SwappingScreen = () => {
|
|
|
3510
3379
|
setScreen("Initial");
|
|
3511
3380
|
refresh();
|
|
3512
3381
|
};
|
|
3513
|
-
(0,
|
|
3382
|
+
(0, import_react25.useEffect)(() => {
|
|
3514
3383
|
var _a2, _b, _c, _d;
|
|
3515
3384
|
if (screen2 !== "Swapping") return;
|
|
3516
3385
|
if ((lastSwapResult == null ? void 0 : lastSwapResult.swapResult) && "error" in (lastSwapResult == null ? void 0 : lastSwapResult.swapResult)) {
|
|
@@ -3541,23 +3410,8 @@ var SwappingScreen = () => {
|
|
|
3541
3410
|
setScreen("Initial");
|
|
3542
3411
|
};
|
|
3543
3412
|
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
3413
|
const SuccessContent = () => {
|
|
3560
|
-
const { inputAmount, outputAmount, explorerLink } = (0,
|
|
3414
|
+
const { inputAmount, outputAmount, explorerLink } = (0, import_react25.useMemo)(() => {
|
|
3561
3415
|
return {
|
|
3562
3416
|
inputAmount: (lastSwapResult == null ? void 0 : lastSwapResult.swapResult) && "inputAmount" in (lastSwapResult == null ? void 0 : lastSwapResult.swapResult) ? lastSwapResult == null ? void 0 : lastSwapResult.swapResult.inputAmount : 0,
|
|
3563
3417
|
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 +3421,28 @@ var SwappingScreen = () => {
|
|
|
3567
3421
|
if (!fromTokenInfo || !toTokenInfo || !(lastSwapResult == null ? void 0 : lastSwapResult.quoteReponse)) {
|
|
3568
3422
|
return null;
|
|
3569
3423
|
}
|
|
3570
|
-
return /* @__PURE__ */ (0,
|
|
3571
|
-
/* @__PURE__ */ (0,
|
|
3572
|
-
/* @__PURE__ */ (0,
|
|
3573
|
-
/* @__PURE__ */ (0,
|
|
3424
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(import_jsx_runtime43.Fragment, { children: [
|
|
3425
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: "flex justify-center mt-8", children: /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: " flex justify-center relative items-center", children: [
|
|
3426
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: "bg-success bg-opacity-[15%] animate-pulse h-[60px] w-[60px] rounded-full" }),
|
|
3427
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: "rounded-full absolute justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(SuccessIcon_default, { className: "text-success", height: 56, width: 56 }) })
|
|
3574
3428
|
] }) }),
|
|
3575
|
-
/* @__PURE__ */ (0,
|
|
3576
|
-
/* @__PURE__ */ (0,
|
|
3577
|
-
/* @__PURE__ */ (0,
|
|
3429
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "flex flex-col justify-center items-center gap-y-2", children: [
|
|
3430
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "mt-2 flex flex-col items-center justify-center text-center px-4", children: [
|
|
3431
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("p", { className: "text-xs font-semibold text-primary-text", children: [
|
|
3578
3432
|
"Swapped ",
|
|
3579
3433
|
readableValue(inputAmount, fromTokenInfo.decimals),
|
|
3580
3434
|
" ",
|
|
3581
3435
|
fromTokenInfo.symbol,
|
|
3582
3436
|
" to"
|
|
3583
3437
|
] }),
|
|
3584
|
-
/* @__PURE__ */ (0,
|
|
3438
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("p", { className: "text-2xl font-semibold text-primary-text", children: [
|
|
3585
3439
|
readableValue(outputAmount, toTokenInfo.decimals),
|
|
3586
3440
|
" ",
|
|
3587
3441
|
toTokenInfo.symbol
|
|
3588
3442
|
] })
|
|
3589
3443
|
] }),
|
|
3590
|
-
/* @__PURE__ */ (0,
|
|
3591
|
-
/* @__PURE__ */ (0,
|
|
3444
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: " bg-module rounded-xl overflow-y-auto w-full webkit-scrollbar py-3 max-h-[260px] px-3", children: [
|
|
3445
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
3592
3446
|
PriceInfo_default,
|
|
3593
3447
|
{
|
|
3594
3448
|
quoteResponse: lastSwapResult == null ? void 0 : lastSwapResult.quoteReponse,
|
|
@@ -3598,9 +3452,9 @@ var SwappingScreen = () => {
|
|
|
3598
3452
|
containerClassName: " border-none mt-0"
|
|
3599
3453
|
}
|
|
3600
3454
|
),
|
|
3601
|
-
explorerLink && /* @__PURE__ */ (0,
|
|
3602
|
-
/* @__PURE__ */ (0,
|
|
3603
|
-
/* @__PURE__ */ (0,
|
|
3455
|
+
explorerLink && /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "flex items-center justify-between text-xs text-primary-text/50 mt-4", children: [
|
|
3456
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { children: "Transaction" }) }),
|
|
3457
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
|
|
3604
3458
|
"a",
|
|
3605
3459
|
{
|
|
3606
3460
|
href: explorerLink,
|
|
@@ -3616,73 +3470,72 @@ var SwappingScreen = () => {
|
|
|
3616
3470
|
] })
|
|
3617
3471
|
] })
|
|
3618
3472
|
] }),
|
|
3619
|
-
/* @__PURE__ */ (0,
|
|
3620
|
-
/* @__PURE__ */ (0,
|
|
3473
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "pb-4 flex space-x-2", children: [
|
|
3474
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
3621
3475
|
JupButton_default,
|
|
3622
3476
|
{
|
|
3623
3477
|
size: "lg",
|
|
3624
3478
|
className: "w-full mt-4 disabled:opacity-50 !text-uiv2-text/75 leading-none !max-h-14 bg-primary",
|
|
3625
3479
|
onClick: onSwapMore,
|
|
3626
|
-
children: /* @__PURE__ */ (0,
|
|
3480
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: "text-sm", children: "Swap More" }) })
|
|
3627
3481
|
}
|
|
3628
3482
|
),
|
|
3629
|
-
displayMode !== "integrated" ? /* @__PURE__ */ (0,
|
|
3483
|
+
displayMode !== "integrated" ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
3630
3484
|
JupButton_default,
|
|
3631
3485
|
{
|
|
3632
3486
|
size: "lg",
|
|
3633
3487
|
className: "w-full mt-4 disabled:opacity-50 leading-none !max-h-14 text-primary-text bg-interactive",
|
|
3634
3488
|
onClick: onClose,
|
|
3635
|
-
children: /* @__PURE__ */ (0,
|
|
3489
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: "text-sm", children: "Close" })
|
|
3636
3490
|
}
|
|
3637
3491
|
) : null
|
|
3638
3492
|
] })
|
|
3639
3493
|
] });
|
|
3640
3494
|
};
|
|
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,
|
|
3495
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "flex flex-col h-full w-full px-2", children: [
|
|
3496
|
+
errorMessage || (txStatus == null ? void 0 : txStatus.status) === "fail" ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "flex flex-col items-center justify-center text-center mt-12", children: [
|
|
3497
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(ErrorIcon, {}),
|
|
3498
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("p", { className: "text-primary-text mt-2", children: "Swap Failed" }),
|
|
3499
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("p", { className: "text-primary-text/50 text-xs mt-2", children: "We were unable to complete the swap, please try again." }),
|
|
3500
|
+
errorMessage ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("p", { className: "text-primary-text/50 text-xs mt-2 break-all", children: errorMessage }) : "",
|
|
3501
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
3648
3502
|
JupButton_default,
|
|
3649
3503
|
{
|
|
3650
3504
|
size: "lg",
|
|
3651
3505
|
className: "w-full mt-6 disabled:opacity-50 !text-uiv2-text/75 leading-none !max-h-14 bg-primary",
|
|
3652
3506
|
onClick: onGoBack,
|
|
3653
|
-
children: /* @__PURE__ */ (0,
|
|
3507
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { children: "Retry" })
|
|
3654
3508
|
}
|
|
3655
3509
|
)
|
|
3656
3510
|
] }) }) : 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,
|
|
3511
|
+
!errorMessage && (txStatus == null ? void 0 : txStatus.status) === "timeout" ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: "flex justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "flex flex-col items-center justify-center text-center mt-12", children: [
|
|
3512
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(ErrorIcon, {}),
|
|
3513
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("p", { className: "text-primary-text mt-2", children: "Transaction timed-out" }),
|
|
3514
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("p", { className: "text-primary-text/50 text-xs mt-2", children: "We were unable to complete the swap, please try again." }),
|
|
3515
|
+
errorMessage ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("p", { className: "text-primary-text/50 text-xs mt-2", children: errorMessage }) : "",
|
|
3516
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
3663
3517
|
JupButton_default,
|
|
3664
3518
|
{
|
|
3665
3519
|
size: "lg",
|
|
3666
3520
|
className: "w-full mt-6 disabled:opacity-50 !text-uiv2-text/75 leading-none !max-h-14 bg-primary",
|
|
3667
3521
|
onClick: onGoBack,
|
|
3668
|
-
children: /* @__PURE__ */ (0,
|
|
3522
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { children: "Retry" })
|
|
3669
3523
|
}
|
|
3670
3524
|
)
|
|
3671
3525
|
] }) }) : null,
|
|
3672
|
-
!errorMessage &&
|
|
3673
|
-
!errorMessage && (txStatus == null ? void 0 : txStatus.status) === "success" ? /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(SuccessContent, {}) : null
|
|
3526
|
+
!errorMessage && (txStatus == null ? void 0 : txStatus.status) === "success" ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(SuccessContent, {}) : null
|
|
3674
3527
|
] });
|
|
3675
3528
|
};
|
|
3676
3529
|
var SwappingScreen_default = SwappingScreen;
|
|
3677
3530
|
|
|
3678
3531
|
// src/components/screens/WalletScreen.tsx
|
|
3679
3532
|
var import_wallet_adapter3 = require("@jup-ag/wallet-adapter");
|
|
3680
|
-
var
|
|
3533
|
+
var import_react26 = require("react");
|
|
3681
3534
|
|
|
3682
3535
|
// src/icons/CloseIcon.tsx
|
|
3683
|
-
var
|
|
3536
|
+
var import_jsx_runtime44 = require("react/jsx-runtime");
|
|
3684
3537
|
var CloseIcon = ({ width = 20, height = 20 }) => {
|
|
3685
|
-
return /* @__PURE__ */ (0,
|
|
3538
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("svg", { width, height, viewBox: "0 0 20 21", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
3686
3539
|
"path",
|
|
3687
3540
|
{
|
|
3688
3541
|
d: "M2.0336 16.2126L8.2336 10.0126L2.0336 3.81263C1.7961 3.57903 1.66172 3.25951 1.66016 2.92669C1.65938 2.59309 1.79141 2.27357 2.02734 2.03763C2.26328 1.80247 2.5828 1.67045 2.9164 1.67201C3.25 1.67357 3.56874 1.80795 3.80234 2.04623L9.99994 8.24623L16.1999 2.04623C16.4335 1.80795 16.7523 1.67357 17.0859 1.67201C17.4187 1.67045 17.739 1.80248 17.9749 2.03763C18.2109 2.27357 18.3429 2.59309 18.3413 2.92669C18.3406 3.25951 18.2062 3.57903 17.9687 3.81263L11.7663 10.0126L17.9663 16.2126C18.2038 16.4462 18.3382 16.7658 18.3397 17.0986C18.3405 17.4322 18.2085 17.7517 17.9725 17.9876C17.7366 18.2228 17.4171 18.3548 17.0835 18.3533C16.7499 18.3517 16.4311 18.2173 16.1975 17.979L9.99994 11.779L3.79994 17.979C3.31088 18.4611 2.52494 18.4579 2.039 17.9736C1.55384 17.4884 1.54994 16.7025 2.03119 16.2126L2.0336 16.2126Z",
|
|
@@ -3693,7 +3546,7 @@ var CloseIcon = ({ width = 20, height = 20 }) => {
|
|
|
3693
3546
|
var CloseIcon_default = CloseIcon;
|
|
3694
3547
|
|
|
3695
3548
|
// src/components/screens/WalletScreen.tsx
|
|
3696
|
-
var
|
|
3549
|
+
var import_jsx_runtime45 = require("react/jsx-runtime");
|
|
3697
3550
|
var WalletScreen = () => {
|
|
3698
3551
|
const { setScreen } = useScreenState();
|
|
3699
3552
|
const { handleConnectClick } = (0, import_wallet_adapter3.useUnifiedWalletContext)();
|
|
@@ -3707,37 +3560,37 @@ var WalletScreen = () => {
|
|
|
3707
3560
|
setScreen("Initial");
|
|
3708
3561
|
}
|
|
3709
3562
|
});
|
|
3710
|
-
const numberOfWallets = (0,
|
|
3563
|
+
const numberOfWallets = (0, import_react26.useMemo)(() => {
|
|
3711
3564
|
return wallets == null ? void 0 : wallets.length;
|
|
3712
3565
|
}, [wallets]);
|
|
3713
|
-
const hasWallet = (0,
|
|
3566
|
+
const hasWallet = (0, import_react26.useMemo)(() => {
|
|
3714
3567
|
return numberOfWallets > 0;
|
|
3715
3568
|
}, [numberOfWallets]);
|
|
3716
|
-
return /* @__PURE__ */ (0,
|
|
3717
|
-
/* @__PURE__ */ (0,
|
|
3718
|
-
/* @__PURE__ */ (0,
|
|
3569
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { className: "text-primary-text p-2", children: [
|
|
3570
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { className: "flex justify-between items-center mb-2 h-[28px] ", children: [
|
|
3571
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("h1", { className: "text-sm font-bold", children: [
|
|
3719
3572
|
"Available Wallets (",
|
|
3720
3573
|
numberOfWallets,
|
|
3721
3574
|
")"
|
|
3722
3575
|
] }),
|
|
3723
|
-
/* @__PURE__ */ (0,
|
|
3576
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
3724
3577
|
"button",
|
|
3725
3578
|
{
|
|
3726
3579
|
onClick: () => setScreen("Initial"),
|
|
3727
3580
|
className: "text-primary-text hover:text-primary-text/50 transition-colors bg-interactive rounded-full p-1",
|
|
3728
|
-
children: /* @__PURE__ */ (0,
|
|
3581
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(CloseIcon_default, { width: 15, height: 15 })
|
|
3729
3582
|
}
|
|
3730
3583
|
)
|
|
3731
3584
|
] }),
|
|
3732
|
-
!hasWallet && /* @__PURE__ */ (0,
|
|
3733
|
-
/* @__PURE__ */ (0,
|
|
3585
|
+
!hasWallet && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("div", { className: "text-sm font-medium text-primary-text flex items-center justify-center h-full py-4", children: "No wallet found" }),
|
|
3586
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)("div", { className: "grid grid-cols-2 gap-2", children: wallets == null ? void 0 : wallets.map((wallet) => /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
3734
3587
|
"button",
|
|
3735
3588
|
{
|
|
3736
3589
|
onClick: (e) => handleConnect(e, wallet),
|
|
3737
3590
|
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,
|
|
3591
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("div", { className: "flex items-center justify-between", children: /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { className: "flex items-center gap-3", children: [
|
|
3592
|
+
wallet.adapter.icon && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("img", { src: wallet.adapter.icon, alt: `${wallet.adapter.name} icon`, className: "w-8 h-8" }),
|
|
3593
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("h2", { className: "text-sm font-medium", children: wallet.adapter.name }) })
|
|
3741
3594
|
] }) })
|
|
3742
3595
|
},
|
|
3743
3596
|
wallet.adapter.name
|
|
@@ -3747,46 +3600,46 @@ var WalletScreen = () => {
|
|
|
3747
3600
|
var WalletScreen_default = WalletScreen;
|
|
3748
3601
|
|
|
3749
3602
|
// src/icons/JupiterLogoV2.tsx
|
|
3750
|
-
var
|
|
3603
|
+
var import_jsx_runtime46 = require("react/jsx-runtime");
|
|
3751
3604
|
var JupiterLogoV2 = (props) => {
|
|
3752
|
-
return /* @__PURE__ */ (0,
|
|
3753
|
-
/* @__PURE__ */ (0,
|
|
3754
|
-
/* @__PURE__ */ (0,
|
|
3605
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("svg", __spreadProps(__spreadValues({ xmlns: "http://www.w3.org/2000/svg", width: "128", height: "128", viewBox: "0 0 33 32", fill: "none" }, props), { children: [
|
|
3606
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("g", { clipPath: "url(#clip0_11565_169621)", children: /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("g", { filter: "url(#filter0_d_11565_169621)", children: [
|
|
3607
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
3755
3608
|
"path",
|
|
3756
3609
|
{
|
|
3757
3610
|
d: "M3.09074 25.1666C4.44267 27.0471 6.17683 28.6205 8.1795 29.7838C10.1822 30.947 12.4081 31.6738 14.7114 31.9165C13.5264 30.1333 11.8039 28.4928 9.65354 27.2438C7.50318 25.9948 5.22592 25.3125 3.09074 25.1666Z",
|
|
3758
3611
|
fill: "url(#paint0_linear_11565_169621)"
|
|
3759
3612
|
}
|
|
3760
3613
|
),
|
|
3761
|
-
/* @__PURE__ */ (0,
|
|
3614
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
3762
3615
|
"path",
|
|
3763
3616
|
{
|
|
3764
3617
|
d: "M12.543 22.2705C8.40015 19.8636 3.91612 19.2502 0.707663 20.3338C1.0174 21.3575 1.42589 22.3487 1.92738 23.2934C4.71498 23.2288 7.75856 23.9859 10.5906 25.6308C13.4227 27.2757 15.5888 29.5459 16.9143 32C17.9839 31.9672 19.0479 31.8309 20.0913 31.5932C19.4426 28.2698 16.6849 24.6779 12.543 22.2705Z",
|
|
3765
3618
|
fill: "url(#paint1_linear_11565_169621)"
|
|
3766
3619
|
}
|
|
3767
3620
|
),
|
|
3768
|
-
/* @__PURE__ */ (0,
|
|
3621
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
3769
3622
|
"path",
|
|
3770
3623
|
{
|
|
3771
3624
|
d: "M32.2852 12.5009C31.7585 10.3584 30.8054 8.34403 29.4829 6.57804C28.1604 4.81205 26.4956 3.33067 24.5879 2.22235C22.6802 1.11403 20.5687 0.401504 18.3796 0.127309C16.1904 -0.146885 13.9684 0.0228794 11.8463 0.626465C15.3915 1.06033 19.3267 2.39122 23.1859 4.63324C27.0452 6.87525 30.1533 9.63411 32.2852 12.5009Z",
|
|
3772
3625
|
fill: "url(#paint2_linear_11565_169621)"
|
|
3773
3626
|
}
|
|
3774
3627
|
),
|
|
3775
|
-
/* @__PURE__ */ (0,
|
|
3628
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
3776
3629
|
"path",
|
|
3777
3630
|
{
|
|
3778
3631
|
d: "M27.1271 20.3583C25.3124 17.3446 22.2038 14.4588 18.3743 12.2342C14.5449 10.0095 10.4991 8.7388 6.98531 8.65474C3.894 8.58152 1.57389 9.48017 0.621548 11.1197C0.616125 11.1294 0.608532 11.1386 0.602566 11.1484C0.516877 11.4559 0.44312 11.7639 0.37587 12.0731C1.70568 11.5481 3.24645 11.2558 4.95969 11.2232C8.76959 11.1517 13.0334 12.3703 16.9681 14.6562C20.9027 16.9422 24.0759 20.0438 25.9003 23.3878C26.7182 24.8944 27.2285 26.3777 27.4308 27.7948C27.6662 27.5844 27.8972 27.3669 28.1212 27.1408C28.1272 27.1305 28.131 27.1196 28.1369 27.1088C29.0893 25.4677 28.721 23.0076 27.1271 20.3583Z",
|
|
3779
3632
|
fill: "url(#paint3_linear_11565_169621)"
|
|
3780
3633
|
}
|
|
3781
3634
|
),
|
|
3782
|
-
/* @__PURE__ */ (0,
|
|
3635
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
3783
3636
|
"path",
|
|
3784
3637
|
{
|
|
3785
3638
|
d: "M15.4609 17.2485C9.59662 13.8416 3.11626 13.3079 0 15.6855C0.00612096 16.4297 0.0630166 17.1726 0.170292 17.9091C1.08699 17.6312 2.03177 17.4562 2.98718 17.3874C6.46952 17.1254 10.3087 18.0957 13.7927 20.1207C17.2766 22.1458 20.023 25.0018 21.5209 28.1543C21.935 29.018 22.2508 29.9254 22.4624 30.8595C23.1555 30.5878 23.8294 30.2694 24.4794 29.9066C25.0011 26.0213 21.3268 20.656 15.4609 17.2485Z",
|
|
3786
3639
|
fill: "url(#paint4_linear_11565_169621)"
|
|
3787
3640
|
}
|
|
3788
3641
|
),
|
|
3789
|
-
/* @__PURE__ */ (0,
|
|
3642
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
3790
3643
|
"path",
|
|
3791
3644
|
{
|
|
3792
3645
|
d: "M30.1434 15.3141C28.3082 12.3036 25.1724 9.40969 21.3158 7.17039C17.4593 4.93109 13.3977 3.64033 9.87257 3.53674C7.1853 3.45919 5.10382 4.11053 4.02457 5.34109C8.50588 4.58182 14.4168 5.85794 20.146 9.18625C25.8753 12.5146 29.9135 17.0181 31.4722 21.2868C32.0064 19.7406 31.5416 17.6098 30.1434 15.3141Z",
|
|
@@ -3794,8 +3647,8 @@ var JupiterLogoV2 = (props) => {
|
|
|
3794
3647
|
}
|
|
3795
3648
|
)
|
|
3796
3649
|
] }) }),
|
|
3797
|
-
/* @__PURE__ */ (0,
|
|
3798
|
-
/* @__PURE__ */ (0,
|
|
3650
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("defs", { children: [
|
|
3651
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(
|
|
3799
3652
|
"filter",
|
|
3800
3653
|
{
|
|
3801
3654
|
id: "filter0_d_11565_169621",
|
|
@@ -3806,8 +3659,8 @@ var JupiterLogoV2 = (props) => {
|
|
|
3806
3659
|
filterUnits: "userSpaceOnUse",
|
|
3807
3660
|
colorInterpolationFilters: "sRGB",
|
|
3808
3661
|
children: [
|
|
3809
|
-
/* @__PURE__ */ (0,
|
|
3810
|
-
/* @__PURE__ */ (0,
|
|
3662
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("feFlood", { floodOpacity: "0", result: "BackgroundImageFix" }),
|
|
3663
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
3811
3664
|
"feColorMatrix",
|
|
3812
3665
|
{
|
|
3813
3666
|
in: "SourceAlpha",
|
|
@@ -3816,16 +3669,16 @@ var JupiterLogoV2 = (props) => {
|
|
|
3816
3669
|
result: "hardAlpha"
|
|
3817
3670
|
}
|
|
3818
3671
|
),
|
|
3819
|
-
/* @__PURE__ */ (0,
|
|
3820
|
-
/* @__PURE__ */ (0,
|
|
3821
|
-
/* @__PURE__ */ (0,
|
|
3822
|
-
/* @__PURE__ */ (0,
|
|
3823
|
-
/* @__PURE__ */ (0,
|
|
3824
|
-
/* @__PURE__ */ (0,
|
|
3672
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("feOffset", { dy: "2.27449" }),
|
|
3673
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("feGaussianBlur", { stdDeviation: "11.3724" }),
|
|
3674
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("feComposite", { in2: "hardAlpha", operator: "out" }),
|
|
3675
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("feColorMatrix", { type: "matrix", values: "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.1 0" }),
|
|
3676
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("feBlend", { mode: "normal", in2: "BackgroundImageFix", result: "effect1_dropShadow_11565_169621" }),
|
|
3677
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("feBlend", { mode: "normal", in: "SourceGraphic", in2: "effect1_dropShadow_11565_169621", result: "shape" })
|
|
3825
3678
|
]
|
|
3826
3679
|
}
|
|
3827
3680
|
),
|
|
3828
|
-
/* @__PURE__ */ (0,
|
|
3681
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(
|
|
3829
3682
|
"linearGradient",
|
|
3830
3683
|
{
|
|
3831
3684
|
id: "paint0_linear_11565_169621",
|
|
@@ -3835,12 +3688,12 @@ var JupiterLogoV2 = (props) => {
|
|
|
3835
3688
|
y2: "32",
|
|
3836
3689
|
gradientUnits: "userSpaceOnUse",
|
|
3837
3690
|
children: [
|
|
3838
|
-
/* @__PURE__ */ (0,
|
|
3839
|
-
/* @__PURE__ */ (0,
|
|
3691
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("stop", { offset: "0.0001", stopColor: "currentColor" }),
|
|
3692
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("stop", { offset: "1", stopColor: "currentColor" })
|
|
3840
3693
|
]
|
|
3841
3694
|
}
|
|
3842
3695
|
),
|
|
3843
|
-
/* @__PURE__ */ (0,
|
|
3696
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(
|
|
3844
3697
|
"linearGradient",
|
|
3845
3698
|
{
|
|
3846
3699
|
id: "paint1_linear_11565_169621",
|
|
@@ -3850,12 +3703,12 @@ var JupiterLogoV2 = (props) => {
|
|
|
3850
3703
|
y2: "32",
|
|
3851
3704
|
gradientUnits: "userSpaceOnUse",
|
|
3852
3705
|
children: [
|
|
3853
|
-
/* @__PURE__ */ (0,
|
|
3854
|
-
/* @__PURE__ */ (0,
|
|
3706
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("stop", { offset: "0.0001", stopColor: "currentColor" }),
|
|
3707
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("stop", { offset: "1", stopColor: "currentColor" })
|
|
3855
3708
|
]
|
|
3856
3709
|
}
|
|
3857
3710
|
),
|
|
3858
|
-
/* @__PURE__ */ (0,
|
|
3711
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(
|
|
3859
3712
|
"linearGradient",
|
|
3860
3713
|
{
|
|
3861
3714
|
id: "paint2_linear_11565_169621",
|
|
@@ -3865,12 +3718,12 @@ var JupiterLogoV2 = (props) => {
|
|
|
3865
3718
|
y2: "32",
|
|
3866
3719
|
gradientUnits: "userSpaceOnUse",
|
|
3867
3720
|
children: [
|
|
3868
|
-
/* @__PURE__ */ (0,
|
|
3869
|
-
/* @__PURE__ */ (0,
|
|
3721
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("stop", { offset: "0.0001", stopColor: "currentColor" }),
|
|
3722
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("stop", { offset: "1", stopColor: "currentColor" })
|
|
3870
3723
|
]
|
|
3871
3724
|
}
|
|
3872
3725
|
),
|
|
3873
|
-
/* @__PURE__ */ (0,
|
|
3726
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(
|
|
3874
3727
|
"linearGradient",
|
|
3875
3728
|
{
|
|
3876
3729
|
id: "paint3_linear_11565_169621",
|
|
@@ -3880,12 +3733,12 @@ var JupiterLogoV2 = (props) => {
|
|
|
3880
3733
|
y2: "32",
|
|
3881
3734
|
gradientUnits: "userSpaceOnUse",
|
|
3882
3735
|
children: [
|
|
3883
|
-
/* @__PURE__ */ (0,
|
|
3884
|
-
/* @__PURE__ */ (0,
|
|
3736
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("stop", { offset: "0.0001", stopColor: "currentColor" }),
|
|
3737
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("stop", { offset: "1", stopColor: "currentColor" })
|
|
3885
3738
|
]
|
|
3886
3739
|
}
|
|
3887
3740
|
),
|
|
3888
|
-
/* @__PURE__ */ (0,
|
|
3741
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(
|
|
3889
3742
|
"linearGradient",
|
|
3890
3743
|
{
|
|
3891
3744
|
id: "paint4_linear_11565_169621",
|
|
@@ -3895,12 +3748,12 @@ var JupiterLogoV2 = (props) => {
|
|
|
3895
3748
|
y2: "32",
|
|
3896
3749
|
gradientUnits: "userSpaceOnUse",
|
|
3897
3750
|
children: [
|
|
3898
|
-
/* @__PURE__ */ (0,
|
|
3899
|
-
/* @__PURE__ */ (0,
|
|
3751
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("stop", { offset: "0.0001", stopColor: "currentColor" }),
|
|
3752
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("stop", { offset: "1", stopColor: "currentColor" })
|
|
3900
3753
|
]
|
|
3901
3754
|
}
|
|
3902
3755
|
),
|
|
3903
|
-
/* @__PURE__ */ (0,
|
|
3756
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(
|
|
3904
3757
|
"linearGradient",
|
|
3905
3758
|
{
|
|
3906
3759
|
id: "paint5_linear_11565_169621",
|
|
@@ -3910,50 +3763,49 @@ var JupiterLogoV2 = (props) => {
|
|
|
3910
3763
|
y2: "32",
|
|
3911
3764
|
gradientUnits: "userSpaceOnUse",
|
|
3912
3765
|
children: [
|
|
3913
|
-
/* @__PURE__ */ (0,
|
|
3914
|
-
/* @__PURE__ */ (0,
|
|
3766
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("stop", { offset: "0.0001", stopColor: "currentColor" }),
|
|
3767
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("stop", { offset: "1", stopColor: "currentColor" })
|
|
3915
3768
|
]
|
|
3916
3769
|
}
|
|
3917
3770
|
),
|
|
3918
|
-
/* @__PURE__ */ (0,
|
|
3771
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("clipPath", { id: "clip0_11565_169621", children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("rect", { width: "32.2852", height: "32", fill: "white" }) })
|
|
3919
3772
|
] })
|
|
3920
3773
|
] }));
|
|
3921
3774
|
};
|
|
3922
3775
|
var JupiterLogoV2_default = JupiterLogoV2;
|
|
3923
3776
|
|
|
3924
3777
|
// src/components/Jupiter.tsx
|
|
3925
|
-
var
|
|
3778
|
+
var import_jsx_runtime47 = require("react/jsx-runtime");
|
|
3926
3779
|
var Content = () => {
|
|
3927
3780
|
const { screen: screen2 } = useScreenState();
|
|
3928
|
-
return /* @__PURE__ */ (0,
|
|
3929
|
-
/* @__PURE__ */ (0,
|
|
3930
|
-
screen2 === "Initial" ? /* @__PURE__ */ (0,
|
|
3931
|
-
/* @__PURE__ */ (0,
|
|
3932
|
-
/* @__PURE__ */ (0,
|
|
3781
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { id: "jupiter-plugin", className: " h-full bg-background relative flex flex-col justify-between", children: [
|
|
3782
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { children: [
|
|
3783
|
+
screen2 === "Initial" ? /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(import_jsx_runtime47.Fragment, { children: [
|
|
3784
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(Header_default, {}),
|
|
3785
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(InitialScreen_default, {})
|
|
3933
3786
|
] }) : null,
|
|
3934
|
-
screen2 === "
|
|
3935
|
-
screen2 === "
|
|
3936
|
-
screen2 === "Wallet" ? /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(WalletScreen_default, {}) : null
|
|
3787
|
+
screen2 === "Swapping" ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(SwappingScreen_default, {}) : null,
|
|
3788
|
+
screen2 === "Wallet" ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(WalletScreen_default, {}) : null
|
|
3937
3789
|
] }),
|
|
3938
|
-
/* @__PURE__ */ (0,
|
|
3790
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("span", { className: "text-primary-text/50 text-xs p-2 flex-row flex gap-1 justify-center", children: [
|
|
3939
3791
|
"Powered by",
|
|
3940
|
-
/* @__PURE__ */ (0,
|
|
3941
|
-
/* @__PURE__ */ (0,
|
|
3792
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("a", { href: "https://jup.ag", target: "_blank", rel: "noreferrer noopener", className: "flex items-center gap-1 ", children: [
|
|
3793
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(JupiterLogoV2_default, { className: "text-primary-text/50", width: 15, height: 15 }),
|
|
3942
3794
|
"Jupiter"
|
|
3943
3795
|
] })
|
|
3944
3796
|
] })
|
|
3945
3797
|
] });
|
|
3946
3798
|
};
|
|
3947
3799
|
var JupiterApp = (props) => {
|
|
3948
|
-
return /* @__PURE__ */ (0,
|
|
3800
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(SwapContextProvider, __spreadProps(__spreadValues({}, props), { children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(BrandingProvider, __spreadProps(__spreadValues({}, props), { children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(Content, {}) })) }));
|
|
3949
3801
|
};
|
|
3950
3802
|
var Jupiter_default = JupiterApp;
|
|
3951
3803
|
|
|
3952
3804
|
// src/contexts/ContextProvider.tsx
|
|
3953
3805
|
var import_wallet_adapter4 = require("@jup-ag/wallet-adapter");
|
|
3954
|
-
var
|
|
3955
|
-
var
|
|
3956
|
-
var
|
|
3806
|
+
var import_react27 = __toESM(require("react"));
|
|
3807
|
+
var import_react28 = require("react");
|
|
3808
|
+
var import_jsx_runtime48 = require("react/jsx-runtime");
|
|
3957
3809
|
var noop = () => {
|
|
3958
3810
|
};
|
|
3959
3811
|
var WalletContextProvider = ({
|
|
@@ -3964,18 +3816,18 @@ var WalletContextProvider = ({
|
|
|
3964
3816
|
if (typeof window === "undefined") return void 0;
|
|
3965
3817
|
return window.Jupiter.enableWalletPassthrough;
|
|
3966
3818
|
})();
|
|
3967
|
-
const wallets = (0,
|
|
3819
|
+
const wallets = (0, import_react28.useMemo)(() => {
|
|
3968
3820
|
if (enableWalletPassthrough) {
|
|
3969
3821
|
return [];
|
|
3970
3822
|
}
|
|
3971
3823
|
return [];
|
|
3972
3824
|
}, [enableWalletPassthrough]);
|
|
3973
|
-
const [showWalletStatus, setShowWalletStatus] = (0,
|
|
3825
|
+
const [showWalletStatus, setShowWalletStatus] = (0, import_react27.useState)({
|
|
3974
3826
|
show: false,
|
|
3975
3827
|
message: ""
|
|
3976
3828
|
});
|
|
3977
|
-
const ShouldWrapWalletProvider = (0,
|
|
3978
|
-
return enableWalletPassthrough ?
|
|
3829
|
+
const ShouldWrapWalletProvider = (0, import_react28.useMemo)(() => {
|
|
3830
|
+
return enableWalletPassthrough ? import_react27.default.Fragment : ({ children: children2 }) => /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
3979
3831
|
import_wallet_adapter4.UnifiedWalletProvider,
|
|
3980
3832
|
{
|
|
3981
3833
|
wallets,
|
|
@@ -3997,11 +3849,11 @@ var WalletContextProvider = ({
|
|
|
3997
3849
|
onNotInstalled: ({ walletName, metadata }) => {
|
|
3998
3850
|
setShowWalletStatus({
|
|
3999
3851
|
show: true,
|
|
4000
|
-
message: /* @__PURE__ */ (0,
|
|
3852
|
+
message: /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("p", { className: "space-y-1", children: [
|
|
4001
3853
|
walletName,
|
|
4002
3854
|
" is not installed.",
|
|
4003
|
-
/* @__PURE__ */ (0,
|
|
4004
|
-
/* @__PURE__ */ (0,
|
|
3855
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("p", { className: "space-x-1", children: [
|
|
3856
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(
|
|
4005
3857
|
"a",
|
|
4006
3858
|
{
|
|
4007
3859
|
className: "underline font-semibold",
|
|
@@ -4015,7 +3867,7 @@ var WalletContextProvider = ({
|
|
|
4015
3867
|
]
|
|
4016
3868
|
}
|
|
4017
3869
|
),
|
|
4018
|
-
/* @__PURE__ */ (0,
|
|
3870
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("span", { children: "to install it." })
|
|
4019
3871
|
] })
|
|
4020
3872
|
] })
|
|
4021
3873
|
});
|
|
@@ -4033,27 +3885,27 @@ var WalletContextProvider = ({
|
|
|
4033
3885
|
}
|
|
4034
3886
|
);
|
|
4035
3887
|
}, [autoConnect, enableWalletPassthrough, wallets]);
|
|
4036
|
-
return /* @__PURE__ */ (0,
|
|
4037
|
-
/* @__PURE__ */ (0,
|
|
4038
|
-
showWalletStatus.show && showWalletStatus.message ? /* @__PURE__ */ (0,
|
|
3888
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(import_jsx_runtime48.Fragment, { children: [
|
|
3889
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(ShouldWrapWalletProvider, { children }),
|
|
3890
|
+
showWalletStatus.show && showWalletStatus.message ? /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { className: "absolute bottom-2 w-full px-2", children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { className: "w-full h-full bg-white/10 rounded-lg p-2 text-warning text-xs", children: showWalletStatus.message }) }) : null
|
|
4039
3891
|
] });
|
|
4040
3892
|
};
|
|
4041
3893
|
var ContextProvider = (props) => {
|
|
4042
|
-
return /* @__PURE__ */ (0,
|
|
3894
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_jsx_runtime48.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(WalletContextProvider, __spreadProps(__spreadValues({}, props), { children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(PreferredExplorerProvider, { defaultExplorer: props.defaultExplorer, children: props.children }) })) });
|
|
4043
3895
|
};
|
|
4044
3896
|
|
|
4045
3897
|
// src/index.tsx
|
|
4046
|
-
var
|
|
4047
|
-
var
|
|
4048
|
-
var
|
|
3898
|
+
var import_react_query11 = require("@tanstack/react-query");
|
|
3899
|
+
var import_react29 = require("react");
|
|
3900
|
+
var import_jsx_runtime49 = require("react/jsx-runtime");
|
|
4049
3901
|
var App = () => {
|
|
4050
|
-
const queryClient = (0,
|
|
3902
|
+
const queryClient = (0, import_react29.useMemo)(() => new import_react_query11.QueryClient(), []);
|
|
4051
3903
|
const [props] = (0, import_jotai4.useAtom)(appProps);
|
|
4052
3904
|
if (!props) return null;
|
|
4053
|
-
return /* @__PURE__ */ (0,
|
|
3905
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_react_query11.QueryClientProvider, { client: queryClient, children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(ContextProvider, __spreadProps(__spreadValues({}, props), { children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(WalletPassthroughProvider_default, { children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(ScreenProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(Jupiter_default, __spreadValues({}, props)) }) }) })) });
|
|
4054
3906
|
};
|
|
4055
3907
|
var RenderJupiter = () => {
|
|
4056
|
-
return /* @__PURE__ */ (0,
|
|
3908
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_jotai4.Provider, { store: typeof window !== "undefined" ? window.Jupiter.store : void 0, children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(App, {}) });
|
|
4057
3909
|
};
|
|
4058
3910
|
|
|
4059
3911
|
// src/npmlibary.tsx
|