@embarkai/ui-kit 0.4.46 → 0.4.48
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/iframe/index.html +1 -1
- package/dist/iframe/main.js +1 -1
- package/dist/index.cjs +795 -774
- package/dist/index.js +453 -435
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -1182,41 +1182,41 @@ var init_helpers = __esm({
|
|
|
1182
1182
|
function ChainSync() {
|
|
1183
1183
|
const { config, callbacksRef } = useProviderConfig();
|
|
1184
1184
|
const qc = (0, import_react_query2.useQueryClient)();
|
|
1185
|
-
const
|
|
1186
|
-
const
|
|
1185
|
+
const address = useSession((st) => st.address);
|
|
1186
|
+
const session = useSession((st) => st.session);
|
|
1187
|
+
const activeChainId = useSession((st) => st.activeChainId);
|
|
1187
1188
|
const prevChainId = (0, import_react2.useRef)(null);
|
|
1188
|
-
const isReverting = (0, import_react2.useRef)(false);
|
|
1189
1189
|
const { mutate: updateChain } = (0, import_react_query2.useMutation)({
|
|
1190
|
-
mutationFn: async (
|
|
1190
|
+
mutationFn: async (toChainId) => {
|
|
1191
|
+
if (!toChainId) {
|
|
1192
|
+
console.warn("[CHAIN_SYNC] No target chainId provided, skipping chain update");
|
|
1193
|
+
return { skip: true };
|
|
1194
|
+
}
|
|
1195
|
+
console.warn("[CHAIN_SYNC] Attempting:", toChainId);
|
|
1191
1196
|
if (!session?.ownerAddress) {
|
|
1192
1197
|
console.warn("[CHAIN_SYNC] No session owner address, aborting chain update");
|
|
1193
|
-
|
|
1198
|
+
return { skip: true };
|
|
1194
1199
|
}
|
|
1195
|
-
if (prevChainId.current ===
|
|
1196
|
-
console.info("[CHAIN_SYNC]
|
|
1197
|
-
return { skip: true
|
|
1200
|
+
if (prevChainId.current === toChainId) {
|
|
1201
|
+
console.info("[CHAIN_SYNC] Chain already selected:", toChainId);
|
|
1202
|
+
return { skip: true };
|
|
1198
1203
|
}
|
|
1199
|
-
console.info("[CHAIN_SYNC]
|
|
1200
|
-
setIsLoading(
|
|
1204
|
+
console.info("[CHAIN_SYNC] syncing to: ", toChainId);
|
|
1205
|
+
const { setIsLoading, setStatus } = useSession.getState();
|
|
1201
1206
|
let targetChainId = null;
|
|
1202
1207
|
switch (true) {
|
|
1203
|
-
case (!!
|
|
1204
|
-
targetChainId =
|
|
1208
|
+
case (!!toChainId && !!(0, import_read2.isChainSupported)(toChainId)):
|
|
1209
|
+
targetChainId = toChainId;
|
|
1205
1210
|
break;
|
|
1206
|
-
case (!!
|
|
1207
|
-
console.warn(`[EMBARKAI]
|
|
1208
|
-
|
|
1209
|
-
case (!!config.current?.network?.chainId && !!(0, import_read2.isChainSupported)(config.current.network.chainId)):
|
|
1210
|
-
targetChainId = config.current.network.chainId;
|
|
1211
|
-
console.info(`[EMBARKAI] Config chainId ${config.current.network.chainId} will be used.`);
|
|
1211
|
+
case (!!toChainId && !(0, import_read2.isChainSupported)(toChainId)):
|
|
1212
|
+
console.warn(`[EMBARKAI] Chain ${toChainId} is not supported. Checking for fallback`);
|
|
1213
|
+
targetChainId = import_read2.DEFAULT_CHAIN_ID;
|
|
1212
1214
|
break;
|
|
1213
|
-
case (!!config.current?.network?.chainId && !(0, import_read2.isChainSupported)(config.current.network.chainId)):
|
|
1214
|
-
console.warn(`No Fallback ChainID Found. Using default chain ${import_read2.DEFAULT_CHAIN_ID} instead.`);
|
|
1215
|
-
// no break, fallthrough to next case
|
|
1216
1215
|
default:
|
|
1217
1216
|
targetChainId = import_read2.DEFAULT_CHAIN_ID;
|
|
1218
1217
|
break;
|
|
1219
1218
|
}
|
|
1219
|
+
setIsLoading(true);
|
|
1220
1220
|
setStatus(`Re-calculating address for chain ${targetChainId}...`);
|
|
1221
1221
|
const chainConfig = (0, import_read2.getChainConfig)(targetChainId);
|
|
1222
1222
|
const chainParams = getChainParams(chainConfig);
|
|
@@ -1234,9 +1234,9 @@ function ChainSync() {
|
|
|
1234
1234
|
};
|
|
1235
1235
|
},
|
|
1236
1236
|
onSuccess: async ({ skip, targetChainId, smartAccountAddress, chainParams }) => {
|
|
1237
|
-
if (skip) return;
|
|
1237
|
+
if (skip || !smartAccountAddress || !chainParams) return;
|
|
1238
1238
|
const { chainConfig } = chainParams;
|
|
1239
|
-
|
|
1239
|
+
const { setIsLoading, setStatus, setActiveChain, setAddress, setSession } = useSession.getState();
|
|
1240
1240
|
setActiveChain(chainParams);
|
|
1241
1241
|
setAddress(smartAccountAddress);
|
|
1242
1242
|
setSession({
|
|
@@ -1245,36 +1245,41 @@ function ChainSync() {
|
|
|
1245
1245
|
address: smartAccountAddress,
|
|
1246
1246
|
factoryAddress: chainConfig.factoryAddress
|
|
1247
1247
|
});
|
|
1248
|
-
|
|
1248
|
+
callbacksRef.current?.onChainChange?.({
|
|
1249
1249
|
chainId: targetChainId,
|
|
1250
1250
|
previousChainId: prevChainId.current
|
|
1251
1251
|
});
|
|
1252
|
-
if (!config.current?.network?.forceChain && targetChainId !== config.current?.network?.chainId) {
|
|
1253
|
-
console.info("[CHAIN_SYNC] Dapp chain request:", targetChainId, "->", config.current?.network?.chainId);
|
|
1254
|
-
setPage("chain-switch-request" /* CHAIN_SWITCH_REQUEST */);
|
|
1255
|
-
}
|
|
1256
1252
|
prevChainId.current = targetChainId;
|
|
1257
|
-
|
|
1253
|
+
qc.invalidateQueries();
|
|
1258
1254
|
setStatus("idle");
|
|
1259
1255
|
setIsLoading(false);
|
|
1260
1256
|
},
|
|
1261
1257
|
onError: (error, selectedChainId) => {
|
|
1262
1258
|
console.error("[CHAIN_SYNC] Failed to switch chain into ", selectedChainId, ":", error);
|
|
1259
|
+
const { setIsLoading, setStatus, setError } = useSession.getState();
|
|
1263
1260
|
setStatus("idle");
|
|
1264
1261
|
setError(error.message);
|
|
1265
1262
|
setIsLoading(false);
|
|
1266
1263
|
}
|
|
1267
1264
|
});
|
|
1268
|
-
const updateChainRelaxed = (0, import_react2.useCallback)((0, import_lodash_es.throttle)(updateChain,
|
|
1265
|
+
const updateChainRelaxed = (0, import_react2.useCallback)((0, import_lodash_es.throttle)(updateChain, 2e3), []);
|
|
1269
1266
|
(0, import_react2.useEffect)(() => {
|
|
1270
|
-
if (!address) return;
|
|
1271
|
-
if (prevChainId.current === activeChainId) return;
|
|
1272
|
-
if (isReverting.current) {
|
|
1273
|
-
isReverting.current = false;
|
|
1274
|
-
return;
|
|
1275
|
-
}
|
|
1267
|
+
if (!address || !activeChainId) return;
|
|
1276
1268
|
updateChainRelaxed(activeChainId);
|
|
1277
1269
|
}, [address, activeChainId]);
|
|
1270
|
+
(0, import_react2.useEffect)(() => {
|
|
1271
|
+
if (!address || !activeChainId) return;
|
|
1272
|
+
const shouldSwitchRequest = !config.current?.network?.forceChain && activeChainId !== config.current?.network?.chainId;
|
|
1273
|
+
async function showSwitchChainRequest() {
|
|
1274
|
+
const stats = await getShareRecoveryStats();
|
|
1275
|
+
const hasRecoveryData = !!stats && (!!stats.created || stats.devices && stats.devices.length > 0);
|
|
1276
|
+
const jwt = import_auth23.jwtTokenManager.getTokens();
|
|
1277
|
+
const isNewUser = !hasRecoveryData && !!jwt?.isNewUser;
|
|
1278
|
+
if (isNewUser || !shouldSwitchRequest) return;
|
|
1279
|
+
useLayoutDataStore.getState().setPage("chain-switch-request" /* CHAIN_SWITCH_REQUEST */);
|
|
1280
|
+
}
|
|
1281
|
+
showSwitchChainRequest();
|
|
1282
|
+
}, [address, activeChainId]);
|
|
1278
1283
|
return null;
|
|
1279
1284
|
}
|
|
1280
1285
|
var import_read2, import_react_query2, import_lodash_es, import_react2;
|
|
@@ -1286,9 +1291,11 @@ var init_ChainSync = __esm({
|
|
|
1286
1291
|
import_react_query2 = require("@tanstack/react-query");
|
|
1287
1292
|
import_lodash_es = require("lodash-es");
|
|
1288
1293
|
import_react2 = require("react");
|
|
1294
|
+
init_auth();
|
|
1289
1295
|
init_constants2();
|
|
1290
1296
|
init_helpers();
|
|
1291
1297
|
init_useLayoutDataStore();
|
|
1298
|
+
init_vaultClient();
|
|
1292
1299
|
}
|
|
1293
1300
|
});
|
|
1294
1301
|
|
|
@@ -1301,7 +1308,7 @@ var init_ChainSync2 = __esm({
|
|
|
1301
1308
|
|
|
1302
1309
|
// src/internal/clients/account/register-smart-account-address.ts
|
|
1303
1310
|
async function registerSmartAccountAddress(chainId, smartAccountAddress, factoryAddress) {
|
|
1304
|
-
const accessToken =
|
|
1311
|
+
const accessToken = import_auth23.jwtTokenManager.getAccessToken();
|
|
1305
1312
|
if (!accessToken) {
|
|
1306
1313
|
console.warn("[Account] No access token available for Smart Account registration");
|
|
1307
1314
|
return { success: true, chainId, smartAccountAddress, alreadySet: false };
|
|
@@ -1346,7 +1353,7 @@ async function registerSmartAccountAddress(chainId, smartAccountAddress, factory
|
|
|
1346
1353
|
}
|
|
1347
1354
|
}
|
|
1348
1355
|
async function getAllSmartAccounts() {
|
|
1349
|
-
const accessToken =
|
|
1356
|
+
const accessToken = import_auth23.jwtTokenManager.getAccessToken();
|
|
1350
1357
|
if (!accessToken) {
|
|
1351
1358
|
console.warn("[Account] No access token available");
|
|
1352
1359
|
return [];
|
|
@@ -1373,7 +1380,7 @@ async function getAllSmartAccounts() {
|
|
|
1373
1380
|
}
|
|
1374
1381
|
}
|
|
1375
1382
|
async function getSmartAccountForChain(chainId) {
|
|
1376
|
-
const accessToken =
|
|
1383
|
+
const accessToken = import_auth23.jwtTokenManager.getAccessToken();
|
|
1377
1384
|
if (!accessToken) {
|
|
1378
1385
|
console.warn("[Account] No access token available");
|
|
1379
1386
|
return null;
|
|
@@ -1989,7 +1996,7 @@ var init_httpClient = __esm({
|
|
|
1989
1996
|
...headers
|
|
1990
1997
|
};
|
|
1991
1998
|
if (requireAuth) {
|
|
1992
|
-
const accessToken =
|
|
1999
|
+
const accessToken = import_auth23.jwtTokenManager.getAccessToken();
|
|
1993
2000
|
if (accessToken) {
|
|
1994
2001
|
requestHeaders["Authorization"] = `Bearer ${accessToken}`;
|
|
1995
2002
|
}
|
|
@@ -2006,9 +2013,9 @@ var init_httpClient = __esm({
|
|
|
2006
2013
|
try {
|
|
2007
2014
|
const response = await fetch(url, requestConfig);
|
|
2008
2015
|
if (response.status === 401 && requireAuth) {
|
|
2009
|
-
const refreshSuccess = await
|
|
2016
|
+
const refreshSuccess = await import_auth23.jwtTokenManager.refreshAccessToken();
|
|
2010
2017
|
if (refreshSuccess) {
|
|
2011
|
-
const newAccessToken =
|
|
2018
|
+
const newAccessToken = import_auth23.jwtTokenManager.getAccessToken();
|
|
2012
2019
|
if (newAccessToken) {
|
|
2013
2020
|
requestHeaders["Authorization"] = `Bearer ${newAccessToken}`;
|
|
2014
2021
|
requestConfig.headers = requestHeaders;
|
|
@@ -2430,34 +2437,37 @@ var init_useAutoConnect = __esm({
|
|
|
2430
2437
|
|
|
2431
2438
|
// src/internal/hooks/useBackupStatusChanges.ts
|
|
2432
2439
|
function useBackupStatusChanges() {
|
|
2433
|
-
const setHasServerVault = useSession((st) => st.setHasServerVault);
|
|
2434
|
-
const setPage = useLayoutDataStore((st) => st.setPage);
|
|
2435
2440
|
const { mutate: handleBackupStatusChanged } = (0, import_react_query3.useMutation)({
|
|
2436
2441
|
mutationFn: async (event) => {
|
|
2437
2442
|
const customEvent = event;
|
|
2438
2443
|
console.log("[BACKUP STATUS] changed:", customEvent?.detail);
|
|
2439
|
-
return {
|
|
2444
|
+
return {
|
|
2445
|
+
stats: await getShareRecoveryStats(),
|
|
2446
|
+
detail: customEvent?.detail
|
|
2447
|
+
};
|
|
2440
2448
|
},
|
|
2441
2449
|
onSuccess: ({ stats, detail }) => {
|
|
2450
|
+
const { setHasServerVault } = useSession.getState();
|
|
2442
2451
|
const hasRecoveryData = stats && (!!stats.created || !!stats?.devices?.length);
|
|
2443
2452
|
if (!!hasRecoveryData) {
|
|
2444
|
-
console.log(
|
|
2445
|
-
"[BACKUP STATUS] Recovery data found after backup status change.\n Redirect to main menu:",
|
|
2446
|
-
detail?.navigateToMainMenu
|
|
2447
|
-
);
|
|
2448
2453
|
setHasServerVault(true);
|
|
2449
|
-
|
|
2450
|
-
|
|
2454
|
+
const jwt = import_auth23.jwtTokenManager.getTokens();
|
|
2455
|
+
const isNewUserTouched = localStorage.getItem(NEW_USER_TOUCHED_KEY) === "true";
|
|
2456
|
+
if (!isNewUserTouched && !!jwt?.isNewUser) {
|
|
2457
|
+
localStorage.setItem(NEW_USER_TOUCHED_KEY, "true");
|
|
2458
|
+
useLayoutDataStore.getState().setPage("nickname-settings" /* NICKNAME_SETTINGS */);
|
|
2459
|
+
}
|
|
2460
|
+
if (!!isNewUserTouched && !jwt?.isNewUser) {
|
|
2461
|
+
localStorage.removeItem(NEW_USER_TOUCHED_KEY);
|
|
2451
2462
|
}
|
|
2452
|
-
console.info("[BACKUP STATUS] Recovery data found in vault, marking as has-server-vault");
|
|
2453
2463
|
} else {
|
|
2454
2464
|
setHasServerVault(false);
|
|
2455
|
-
setPage("keysare-backup" /* KEYSARE_BACKUP */);
|
|
2465
|
+
useLayoutDataStore.getState().setPage("keysare-backup" /* KEYSARE_BACKUP */);
|
|
2456
2466
|
console.warn("[BACKUP STATUS] No recovery data found in vault, marking as no-server-vault");
|
|
2457
2467
|
}
|
|
2458
2468
|
},
|
|
2459
2469
|
onError: (error) => {
|
|
2460
|
-
setHasServerVault(false);
|
|
2470
|
+
useSession.getState().setHasServerVault(false);
|
|
2461
2471
|
console.warn("[BACKUP STATUS] Failed to fetch initial vault status:", error);
|
|
2462
2472
|
}
|
|
2463
2473
|
});
|
|
@@ -2468,14 +2478,16 @@ function useBackupStatusChanges() {
|
|
|
2468
2478
|
};
|
|
2469
2479
|
}, []);
|
|
2470
2480
|
}
|
|
2471
|
-
var import_react_query3, import_react4;
|
|
2481
|
+
var import_react_query3, import_react4, NEW_USER_TOUCHED_KEY;
|
|
2472
2482
|
var init_useBackupStatusChanges = __esm({
|
|
2473
2483
|
"src/internal/hooks/useBackupStatusChanges.ts"() {
|
|
2474
2484
|
init_SessionContext();
|
|
2475
2485
|
import_react_query3 = require("@tanstack/react-query");
|
|
2476
2486
|
import_react4 = require("react");
|
|
2487
|
+
init_auth();
|
|
2477
2488
|
init_vaultClient();
|
|
2478
2489
|
init_useLayoutDataStore();
|
|
2490
|
+
NEW_USER_TOUCHED_KEY = "embarkai-is-new-user-touhced";
|
|
2479
2491
|
}
|
|
2480
2492
|
});
|
|
2481
2493
|
|
|
@@ -6640,7 +6652,7 @@ function PassKeyStep(props) {
|
|
|
6640
6652
|
setPasskeyStatus("checking available passkeys...");
|
|
6641
6653
|
setIsLoading(true);
|
|
6642
6654
|
try {
|
|
6643
|
-
|
|
6655
|
+
import_auth23.jwtTokenManager.clearTokens();
|
|
6644
6656
|
setPasskeyStatus("authenticating with passkey...");
|
|
6645
6657
|
const result = await authenticateWithPasskey(
|
|
6646
6658
|
void 0,
|
|
@@ -7131,8 +7143,8 @@ function Social(props) {
|
|
|
7131
7143
|
const iframeManager = getIframeManager2();
|
|
7132
7144
|
const finalizeSocialLogin = async (rawLoginResponse, providerKey, userData) => {
|
|
7133
7145
|
let loginResponse2 = await normalizeSocialLoginResponse(rawLoginResponse, providerKey, userData);
|
|
7134
|
-
const existingAccessToken =
|
|
7135
|
-
const existingRefreshToken =
|
|
7146
|
+
const existingAccessToken = import_auth23.jwtTokenManager.getAccessToken();
|
|
7147
|
+
const existingRefreshToken = import_auth23.jwtTokenManager.getRefreshToken();
|
|
7136
7148
|
if (existingAccessToken && existingRefreshToken && !loginResponse2.accessToken) {
|
|
7137
7149
|
console.log("[AuthModal] Using tokens already stored by iframe-manager");
|
|
7138
7150
|
loginResponse2 = {
|
|
@@ -7161,7 +7173,7 @@ function Social(props) {
|
|
|
7161
7173
|
setIsLoading(false);
|
|
7162
7174
|
return;
|
|
7163
7175
|
}
|
|
7164
|
-
await
|
|
7176
|
+
await import_auth23.jwtTokenManager.clearTokens();
|
|
7165
7177
|
if (!loginResponse2.accessToken || !loginResponse2.refreshToken) {
|
|
7166
7178
|
console.warn(
|
|
7167
7179
|
"[AuthModal] Authentication tokens were not issued; continuing with cookie-based session only."
|
|
@@ -7170,7 +7182,7 @@ function Social(props) {
|
|
|
7170
7182
|
let tokensPersisted = false;
|
|
7171
7183
|
const persistTokensIfAvailable = async () => {
|
|
7172
7184
|
if (!tokensPersisted && loginResponse2.accessToken && loginResponse2.refreshToken) {
|
|
7173
|
-
await
|
|
7185
|
+
await import_auth23.jwtTokenManager.setTokens(loginResponse2);
|
|
7174
7186
|
tokensPersisted = true;
|
|
7175
7187
|
}
|
|
7176
7188
|
};
|
|
@@ -7607,25 +7619,15 @@ function useAuthMenuHandlers() {
|
|
|
7607
7619
|
const { config, callbacksRef } = useProviderConfig();
|
|
7608
7620
|
const qc = (0, import_react_query5.useQueryClient)();
|
|
7609
7621
|
const pendingLoginResponseRef = (0, import_react15.useRef)(null);
|
|
7610
|
-
const setPage = useLayoutDataStore((st) => st.setPage);
|
|
7611
|
-
const setIsDialogForced = useLayoutStore((st) => st.setIsDialogForced);
|
|
7612
7622
|
const [telegramCleanup, setTelegramCleanup] = (0, import_react15.useState)(null);
|
|
7613
|
-
const
|
|
7614
|
-
|
|
7615
|
-
|
|
7616
|
-
activeChainId,
|
|
7617
|
-
setError,
|
|
7618
|
-
setStatus,
|
|
7619
|
-
setSession,
|
|
7620
|
-
setAddress,
|
|
7621
|
-
setRecoveryUserId,
|
|
7622
|
-
setHasServerVault,
|
|
7623
|
-
setIsLoading
|
|
7624
|
-
} = useSession();
|
|
7623
|
+
const usePaymaster = useSession((st) => st.usePaymaster);
|
|
7624
|
+
const publicClient = useSession((st) => st.publicClient);
|
|
7625
|
+
const activeChainId = useSession((st) => st.activeChainId);
|
|
7625
7626
|
const setStep = useAuthStore((st) => st.setStep);
|
|
7626
7627
|
const setAlert = useAuthStore((st) => st.setAlert);
|
|
7627
7628
|
const createSessionWithKeyshare = (0, import_react15.useCallback)(
|
|
7628
7629
|
async (userId, hasServerKeyshare, isNewUser) => {
|
|
7630
|
+
const { setStatus } = useSession.getState();
|
|
7629
7631
|
try {
|
|
7630
7632
|
try {
|
|
7631
7633
|
callbacksRef.current?.onConnecting?.({ method: "wallet" });
|
|
@@ -7663,9 +7665,19 @@ function useAuthMenuHandlers() {
|
|
|
7663
7665
|
throw error;
|
|
7664
7666
|
}
|
|
7665
7667
|
},
|
|
7666
|
-
[
|
|
7668
|
+
[usePaymaster, activeChainId]
|
|
7667
7669
|
);
|
|
7668
7670
|
const onAuthSuccess = (0, import_react15.useCallback)(async () => {
|
|
7671
|
+
const {
|
|
7672
|
+
//
|
|
7673
|
+
setSession,
|
|
7674
|
+
setAddress,
|
|
7675
|
+
setStatus,
|
|
7676
|
+
setIsLoading,
|
|
7677
|
+
setError,
|
|
7678
|
+
setHasServerVault,
|
|
7679
|
+
setRecoveryUserId
|
|
7680
|
+
} = useSession.getState();
|
|
7669
7681
|
setIsLoading(true);
|
|
7670
7682
|
setStep("loading");
|
|
7671
7683
|
const loginResponse = pendingLoginResponseRef.current;
|
|
@@ -7683,7 +7695,7 @@ function useAuthMenuHandlers() {
|
|
|
7683
7695
|
const iframeManager = getIframeManager2();
|
|
7684
7696
|
await iframeManager.authenticate(userId, loginResponse.avatar, loginResponse.displayName);
|
|
7685
7697
|
if (loginResponse.accessToken && loginResponse.refreshToken) {
|
|
7686
|
-
await
|
|
7698
|
+
await import_auth23.jwtTokenManager.setTokens(loginResponse);
|
|
7687
7699
|
} else {
|
|
7688
7700
|
console.warn("[ConnectWalletButton] Login response missing tokens; skipping jwtTokenManager.setTokens");
|
|
7689
7701
|
}
|
|
@@ -7729,11 +7741,11 @@ function useAuthMenuHandlers() {
|
|
|
7729
7741
|
if (!!jwt?.isNewUser || !hasKeyshareVaultBackup) {
|
|
7730
7742
|
if (!!jwt?.isNewUser) console.log("[AuthMenu] New user detected - forcing backup flow");
|
|
7731
7743
|
if (!hasKeyshareVaultBackup) console.log("[AuthMenu] No recovery data found - forcing backup flow");
|
|
7732
|
-
setIsDialogForced(true);
|
|
7733
|
-
setPage("keysare-backup" /* KEYSARE_BACKUP */);
|
|
7744
|
+
useLayoutStore.getState().setIsDialogForced(true);
|
|
7745
|
+
useLayoutDataStore.getState().setPage("keysare-backup" /* KEYSARE_BACKUP */);
|
|
7734
7746
|
} else {
|
|
7735
|
-
setIsDialogForced(false);
|
|
7736
|
-
setPage(null);
|
|
7747
|
+
useLayoutStore.getState().setIsDialogForced(false);
|
|
7748
|
+
useLayoutDataStore.getState().setPage(null);
|
|
7737
7749
|
}
|
|
7738
7750
|
}, 100);
|
|
7739
7751
|
} catch (error) {
|
|
@@ -7745,12 +7757,10 @@ function useAuthMenuHandlers() {
|
|
|
7745
7757
|
setAddress(null);
|
|
7746
7758
|
setRecoveryUserId(userId);
|
|
7747
7759
|
setStatus("recovery_needed");
|
|
7748
|
-
setTimeout(() =>
|
|
7749
|
-
setPage("keyshare-restore" /* KEYSHARE_RESTORE */);
|
|
7750
|
-
}, 100);
|
|
7760
|
+
setTimeout(() => useLayoutDataStore.getState().setPage("keyshare-restore" /* KEYSHARE_RESTORE */), 100);
|
|
7751
7761
|
} else {
|
|
7752
7762
|
pendingLoginResponseRef.current = null;
|
|
7753
|
-
await
|
|
7763
|
+
await import_auth23.jwtTokenManager.clearTokens();
|
|
7754
7764
|
setStatus("error");
|
|
7755
7765
|
setError(error?.message || String(error));
|
|
7756
7766
|
setAlert({
|
|
@@ -7763,20 +7773,7 @@ function useAuthMenuHandlers() {
|
|
|
7763
7773
|
setIsLoading(false);
|
|
7764
7774
|
setStep("signin");
|
|
7765
7775
|
}
|
|
7766
|
-
}, [
|
|
7767
|
-
qc,
|
|
7768
|
-
setStep,
|
|
7769
|
-
setPage,
|
|
7770
|
-
setError,
|
|
7771
|
-
setStatus,
|
|
7772
|
-
setSession,
|
|
7773
|
-
setAlert,
|
|
7774
|
-
setAddress,
|
|
7775
|
-
setRecoveryUserId,
|
|
7776
|
-
setHasServerVault,
|
|
7777
|
-
setIsDialogForced,
|
|
7778
|
-
createSessionWithKeyshare
|
|
7779
|
-
]);
|
|
7776
|
+
}, [qc, setStep, setAlert, createSessionWithKeyshare]);
|
|
7780
7777
|
const goBackToSignIn = (0, import_react15.useCallback)(() => {
|
|
7781
7778
|
setStep("signin");
|
|
7782
7779
|
setAlert(null);
|
|
@@ -8209,7 +8206,7 @@ var init_AuthMenu = __esm({
|
|
|
8209
8206
|
const loginResponse = pendingWalletLogin;
|
|
8210
8207
|
setPendingWalletLogin(null);
|
|
8211
8208
|
console.log("[AuthMenu] Processing wallet login response:", loginResponse);
|
|
8212
|
-
|
|
8209
|
+
import_auth23.jwtTokenManager.clearTokens().then(() => {
|
|
8213
8210
|
pendingLoginResponseRef.current = loginResponse;
|
|
8214
8211
|
onAuthSuccess();
|
|
8215
8212
|
});
|
|
@@ -9479,7 +9476,7 @@ var init_queryKeys = __esm({
|
|
|
9479
9476
|
|
|
9480
9477
|
// src/internal/components/BuyMenu/binance/api.ts
|
|
9481
9478
|
function iframe() {
|
|
9482
|
-
const accessToken =
|
|
9479
|
+
const accessToken = import_auth23.jwtTokenManager.getAccessToken();
|
|
9483
9480
|
if (!accessToken) {
|
|
9484
9481
|
throw new Error("Access token is not available");
|
|
9485
9482
|
}
|
|
@@ -10391,7 +10388,7 @@ var init_binance = __esm({
|
|
|
10391
10388
|
|
|
10392
10389
|
// src/internal/components/BuyMenu/finchpay/api.ts
|
|
10393
10390
|
function iframe2() {
|
|
10394
|
-
const accessToken =
|
|
10391
|
+
const accessToken = import_auth23.jwtTokenManager.getAccessToken();
|
|
10395
10392
|
if (!accessToken) {
|
|
10396
10393
|
throw new Error("Access token is not available");
|
|
10397
10394
|
}
|
|
@@ -11633,67 +11630,43 @@ var init_LumiaIcon2 = __esm({
|
|
|
11633
11630
|
}
|
|
11634
11631
|
});
|
|
11635
11632
|
|
|
11636
|
-
// src/
|
|
11637
|
-
var import_read11,
|
|
11633
|
+
// src/internal/assets/networks/index.ts
|
|
11634
|
+
var import_read11, NETWORKS_ICONS;
|
|
11638
11635
|
var init_networks3 = __esm({
|
|
11639
|
-
"src/
|
|
11636
|
+
"src/internal/assets/networks/index.ts"() {
|
|
11637
|
+
import_read11 = require("@embarkai/core/read");
|
|
11640
11638
|
init_ArbitrumIcon();
|
|
11641
11639
|
init_BaseIcon();
|
|
11642
11640
|
init_BscIcon();
|
|
11643
11641
|
init_EthereumIcon();
|
|
11644
11642
|
init_LumiaIcon2();
|
|
11645
|
-
|
|
11646
|
-
|
|
11647
|
-
|
|
11648
|
-
|
|
11649
|
-
|
|
11650
|
-
|
|
11651
|
-
|
|
11652
|
-
|
|
11653
|
-
|
|
11654
|
-
|
|
11655
|
-
|
|
11656
|
-
|
|
11657
|
-
|
|
11658
|
-
|
|
11659
|
-
|
|
11660
|
-
|
|
11661
|
-
|
|
11662
|
-
|
|
11663
|
-
|
|
11664
|
-
|
|
11665
|
-
|
|
11666
|
-
|
|
11667
|
-
|
|
11668
|
-
|
|
11669
|
-
|
|
11670
|
-
|
|
11671
|
-
|
|
11672
|
-
Icon: BSCIcon,
|
|
11673
|
-
isActive: true
|
|
11674
|
-
},
|
|
11675
|
-
{
|
|
11676
|
-
chainId: import_read11.ARBITRUM_SEPOLIA_CHAIN_ID,
|
|
11677
|
-
name: "Arbitrum Sepolia",
|
|
11678
|
-
badge: "TESTNET",
|
|
11679
|
-
Icon: ArbitrumIcon,
|
|
11680
|
-
isActive: true
|
|
11681
|
-
},
|
|
11682
|
-
{
|
|
11683
|
-
chainId: import_read11.BASE_SEPOLIA_CHAIN_ID,
|
|
11684
|
-
name: "Base Sepolia",
|
|
11685
|
-
badge: "TESTNET",
|
|
11686
|
-
Icon: BaseIcon,
|
|
11687
|
-
isActive: true
|
|
11688
|
-
},
|
|
11689
|
-
{
|
|
11690
|
-
chainId: import_read11.LUMIA_PULSAR_TESTNET_CHAIN_ID,
|
|
11691
|
-
name: "Lumia Pulsar Testnet",
|
|
11692
|
-
badge: "TESTNET",
|
|
11693
|
-
Icon: LumiaIcon2,
|
|
11694
|
-
isActive: true
|
|
11695
|
-
}
|
|
11696
|
-
];
|
|
11643
|
+
NETWORKS_ICONS = {
|
|
11644
|
+
[import_read11.LUMIA_MAINNET_CHAIN_ID]: LumiaIcon2,
|
|
11645
|
+
[import_read11.LUMIA_TESTNET_CHAIN_ID]: LumiaIcon2,
|
|
11646
|
+
[import_read11.LUMIA_PULSAR_TESTNET_CHAIN_ID]: LumiaIcon2,
|
|
11647
|
+
[import_read11.BASE_SEPOLIA_CHAIN_ID]: BaseIcon,
|
|
11648
|
+
[import_read11.BSC_MAINNET_CHAIN_ID]: BSCIcon,
|
|
11649
|
+
[import_read11.BSC_TESTNET_CHAIN_ID]: BSCIcon,
|
|
11650
|
+
1: EthereumIcon,
|
|
11651
|
+
[import_read11.ARBITRUM_SEPOLIA_CHAIN_ID]: ArbitrumIcon
|
|
11652
|
+
};
|
|
11653
|
+
}
|
|
11654
|
+
});
|
|
11655
|
+
|
|
11656
|
+
// src/config/networks.ts
|
|
11657
|
+
var import_read12, NETWORK_OPTIONS;
|
|
11658
|
+
var init_networks4 = __esm({
|
|
11659
|
+
"src/config/networks.ts"() {
|
|
11660
|
+
init_networks3();
|
|
11661
|
+
init_EmbarkIcon();
|
|
11662
|
+
import_read12 = require("@embarkai/core/read");
|
|
11663
|
+
NETWORK_OPTIONS = [...import_read12.SUPPORTED_CHAINS].map(([chainId, chain]) => ({
|
|
11664
|
+
chainId,
|
|
11665
|
+
name: chain.name,
|
|
11666
|
+
badge: import_read12.SUPPORTED_MAINNETS.includes(chainId) ? "MAINNET" : "TESTNET",
|
|
11667
|
+
Icon: NETWORKS_ICONS[chainId] || EmbarkIcon,
|
|
11668
|
+
isActive: true
|
|
11669
|
+
}));
|
|
11697
11670
|
}
|
|
11698
11671
|
});
|
|
11699
11672
|
|
|
@@ -11725,7 +11698,7 @@ var init_truncateMiddle = __esm({
|
|
|
11725
11698
|
|
|
11726
11699
|
// src/internal/components/ChainsMenu/ChainsMenu.tsx
|
|
11727
11700
|
function getPaymasterExplorerUrl(chainId, paymasterAddress) {
|
|
11728
|
-
const chainConfig = (0,
|
|
11701
|
+
const chainConfig = (0, import_read13.getChainConfig)(chainId);
|
|
11729
11702
|
const explorerUrl = chainConfig?.blockExplorerUrl;
|
|
11730
11703
|
if (!explorerUrl) return paymasterAddress;
|
|
11731
11704
|
return `${explorerUrl.replace(/\/$/, "")}/address/${paymasterAddress}`;
|
|
@@ -11742,7 +11715,7 @@ function ChainsMenu() {
|
|
|
11742
11715
|
const maxScrollHeight = useLayoutStore((st) => st.maxScrollHeight);
|
|
11743
11716
|
const setPage = useLayoutDataStore((st) => st.setPage);
|
|
11744
11717
|
const visibleNetworks = NETWORK_OPTIONS.filter((option) => option.isActive);
|
|
11745
|
-
const activeChainConfig = activeChainId ? (0,
|
|
11718
|
+
const activeChainConfig = activeChainId ? (0, import_read13.getChainConfig)(activeChainId) : null;
|
|
11746
11719
|
const activeDefaultPaymasterAddress = activeChainConfig?.paymasterAddress;
|
|
11747
11720
|
const activePaymasterQuery = (0, import_react_query15.useQuery)({
|
|
11748
11721
|
queryKey: ["chain-paymaster", config.current.projectId, activeChainId],
|
|
@@ -11883,15 +11856,15 @@ function ChainsMenu() {
|
|
|
11883
11856
|
}
|
|
11884
11857
|
);
|
|
11885
11858
|
}
|
|
11886
|
-
var import_core2,
|
|
11859
|
+
var import_core2, import_read13, import_react_query15, import_lucide_react19, import_react29, import_jsx_runtime48;
|
|
11887
11860
|
var init_ChainsMenu = __esm({
|
|
11888
11861
|
"src/internal/components/ChainsMenu/ChainsMenu.tsx"() {
|
|
11889
|
-
|
|
11862
|
+
init_networks4();
|
|
11890
11863
|
init_ProviderContext();
|
|
11891
11864
|
init_SessionContext();
|
|
11892
11865
|
init_useT();
|
|
11893
11866
|
import_core2 = require("@embarkai/core");
|
|
11894
|
-
|
|
11867
|
+
import_read13 = require("@embarkai/core/read");
|
|
11895
11868
|
import_react_query15 = require("@tanstack/react-query");
|
|
11896
11869
|
import_lucide_react19 = require("lucide-react");
|
|
11897
11870
|
import_react29 = require("react");
|
|
@@ -11914,17 +11887,7 @@ function ChainSwitchRequest() {
|
|
|
11914
11887
|
const config = useProviderConfig().config;
|
|
11915
11888
|
const isLoading = useSession((st) => st.isLoading);
|
|
11916
11889
|
const chainConfig = useSession((st) => st.chainConfig);
|
|
11917
|
-
const setActiveChainId = useSession((st) => st.setActiveChainId);
|
|
11918
|
-
const setPage = useLayoutDataStore((st) => st.setPage);
|
|
11919
11890
|
const maxScrollHeight = useLayoutStore((st) => st.maxScrollHeight);
|
|
11920
|
-
const changeTouchedRef = (0, import_react30.useRef)(false);
|
|
11921
|
-
(0, import_react30.useEffect)(() => {
|
|
11922
|
-
if (!changeTouchedRef.current || chainConfig?.id !== config.current?.network?.chainId) return;
|
|
11923
|
-
setPage(null);
|
|
11924
|
-
return () => {
|
|
11925
|
-
changeTouchedRef.current = false;
|
|
11926
|
-
};
|
|
11927
|
-
}, [chainConfig, setPage]);
|
|
11928
11891
|
const prefferedChain = NETWORK_OPTIONS.find((ch) => ch.chainId === config.current?.network?.chainId) || null;
|
|
11929
11892
|
const PrefferedChainIcon = prefferedChain?.Icon || (() => null);
|
|
11930
11893
|
return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
@@ -11943,7 +11906,7 @@ function ChainSwitchRequest() {
|
|
|
11943
11906
|
size: "icon",
|
|
11944
11907
|
variant: "ghost",
|
|
11945
11908
|
title: t("passport:common.back"),
|
|
11946
|
-
onClick: () => setPage("settings" /* SETTINGS */),
|
|
11909
|
+
onClick: () => useLayoutDataStore.getState().setPage("settings" /* SETTINGS */),
|
|
11947
11910
|
children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_lucide_react20.ArrowLeft, { className: "h-4 w-4" })
|
|
11948
11911
|
}
|
|
11949
11912
|
),
|
|
@@ -11975,8 +11938,8 @@ function ChainSwitchRequest() {
|
|
|
11975
11938
|
disabled: isLoading,
|
|
11976
11939
|
onClick: () => {
|
|
11977
11940
|
if (!config.current?.network?.chainId) return;
|
|
11978
|
-
|
|
11979
|
-
|
|
11941
|
+
useSession.getState().setActiveChainId(config.current.network.chainId);
|
|
11942
|
+
useLayoutDataStore.getState().setPage("chain" /* CHAIN */);
|
|
11980
11943
|
},
|
|
11981
11944
|
children: [
|
|
11982
11945
|
isLoading ? /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_lucide_react20.Loader, { className: "w-6 h-6 animate-spin" }) : /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(PrefferedChainIcon, { className: "w-6 h-6" }),
|
|
@@ -11990,15 +11953,14 @@ function ChainSwitchRequest() {
|
|
|
11990
11953
|
}
|
|
11991
11954
|
);
|
|
11992
11955
|
}
|
|
11993
|
-
var import_lucide_react20,
|
|
11956
|
+
var import_lucide_react20, import_react_i18next2, import_jsx_runtime49;
|
|
11994
11957
|
var init_ChainSwitchRequest = __esm({
|
|
11995
11958
|
"src/internal/components/ChainsMenu/ChainSwitchRequest.tsx"() {
|
|
11996
|
-
|
|
11959
|
+
init_networks4();
|
|
11997
11960
|
init_ProviderContext();
|
|
11998
11961
|
init_SessionContext();
|
|
11999
11962
|
init_useT();
|
|
12000
11963
|
import_lucide_react20 = require("lucide-react");
|
|
12001
|
-
import_react30 = require("react");
|
|
12002
11964
|
import_react_i18next2 = require("react-i18next");
|
|
12003
11965
|
init_useLayoutDataStore();
|
|
12004
11966
|
init_useLayoutStore();
|
|
@@ -12095,8 +12057,8 @@ function DeviceLinkScreen() {
|
|
|
12095
12057
|
const setPage = useLayoutDataStore((s) => s.setPage);
|
|
12096
12058
|
const maxScrollHeight = useLayoutStore((s) => s.maxScrollHeight);
|
|
12097
12059
|
const { mutate: link, isPending } = useLinkDevice();
|
|
12098
|
-
const [code, setCode] = (0,
|
|
12099
|
-
const [error, setError] = (0,
|
|
12060
|
+
const [code, setCode] = (0, import_react30.useState)("");
|
|
12061
|
+
const [error, setError] = (0, import_react30.useState)(null);
|
|
12100
12062
|
const isValid = code.length === 6 && VALID_CHARS.test(code);
|
|
12101
12063
|
function handleCodeChange(value) {
|
|
12102
12064
|
const upper = value.toUpperCase().slice(0, 6);
|
|
@@ -12155,10 +12117,10 @@ function DeviceLinkScreen() {
|
|
|
12155
12117
|
}
|
|
12156
12118
|
);
|
|
12157
12119
|
}
|
|
12158
|
-
var
|
|
12120
|
+
var import_react30, import_lucide_react21, import_jsx_runtime50, VALID_CHARS;
|
|
12159
12121
|
var init_DeviceLinkScreen = __esm({
|
|
12160
12122
|
"src/internal/components/DevicesMenu/DeviceLinkScreen.tsx"() {
|
|
12161
|
-
|
|
12123
|
+
import_react30 = require("react");
|
|
12162
12124
|
import_lucide_react21 = require("lucide-react");
|
|
12163
12125
|
init_Expandable2();
|
|
12164
12126
|
init_button();
|
|
@@ -12691,19 +12653,19 @@ function DeviceManageScreen() {
|
|
|
12691
12653
|
const userId = session?.mpcUserId || "";
|
|
12692
12654
|
const deviceId = pageParams?.deviceId;
|
|
12693
12655
|
const deviceName = pageParams?.deviceName;
|
|
12694
|
-
const guardianRef = (0,
|
|
12695
|
-
const [screen, setScreen] = (0,
|
|
12696
|
-
const [actionState, setActionState] = (0,
|
|
12697
|
-
const [password, setPassword] = (0,
|
|
12698
|
-
const [statusMessage, setStatusMessage] = (0,
|
|
12699
|
-
const [errorMessage, setErrorMessage] = (0,
|
|
12700
|
-
const [waitingConfirm, setWaitingConfirm] = (0,
|
|
12701
|
-
(0,
|
|
12656
|
+
const guardianRef = (0, import_react31.useRef)(null);
|
|
12657
|
+
const [screen, setScreen] = (0, import_react31.useState)({ step: "connecting" });
|
|
12658
|
+
const [actionState, setActionState] = (0, import_react31.useState)(null);
|
|
12659
|
+
const [password, setPassword] = (0, import_react31.useState)("");
|
|
12660
|
+
const [statusMessage, setStatusMessage] = (0, import_react31.useState)(null);
|
|
12661
|
+
const [errorMessage, setErrorMessage] = (0, import_react31.useState)(null);
|
|
12662
|
+
const [waitingConfirm, setWaitingConfirm] = (0, import_react31.useState)(false);
|
|
12663
|
+
(0, import_react31.useEffect)(() => {
|
|
12702
12664
|
if (!statusMessage) return;
|
|
12703
12665
|
const t = setTimeout(() => setStatusMessage(null), 3e3);
|
|
12704
12666
|
return () => clearTimeout(t);
|
|
12705
12667
|
}, [statusMessage]);
|
|
12706
|
-
(0,
|
|
12668
|
+
(0, import_react31.useEffect)(() => {
|
|
12707
12669
|
if (!deviceId || !isWebSerialAvailable()) {
|
|
12708
12670
|
setScreen({ step: "error", message: "WebSerial not available" });
|
|
12709
12671
|
return;
|
|
@@ -12735,7 +12697,7 @@ function DeviceManageScreen() {
|
|
|
12735
12697
|
guardianRef.current?.close();
|
|
12736
12698
|
};
|
|
12737
12699
|
}, [deviceId]);
|
|
12738
|
-
const refreshList = (0,
|
|
12700
|
+
const refreshList = (0, import_react31.useCallback)(async () => {
|
|
12739
12701
|
const guardian = guardianRef.current;
|
|
12740
12702
|
if (!guardian || screen.step !== "connected") return;
|
|
12741
12703
|
try {
|
|
@@ -12744,7 +12706,7 @@ function DeviceManageScreen() {
|
|
|
12744
12706
|
} catch {
|
|
12745
12707
|
}
|
|
12746
12708
|
}, [screen]);
|
|
12747
|
-
const handleBackup = (0,
|
|
12709
|
+
const handleBackup = (0, import_react31.useCallback)(async () => {
|
|
12748
12710
|
const guardian = guardianRef.current;
|
|
12749
12711
|
const iframe4 = getIframeManager();
|
|
12750
12712
|
if (!guardian || !iframe4 || !userId) return;
|
|
@@ -12768,7 +12730,7 @@ function DeviceManageScreen() {
|
|
|
12768
12730
|
setActionState(null);
|
|
12769
12731
|
}
|
|
12770
12732
|
}, [password, userId, refreshList]);
|
|
12771
|
-
const handleOverwrite = (0,
|
|
12733
|
+
const handleOverwrite = (0, import_react31.useCallback)(async () => {
|
|
12772
12734
|
const guardian = guardianRef.current;
|
|
12773
12735
|
const iframe4 = getIframeManager();
|
|
12774
12736
|
if (!guardian || !iframe4 || !userId) return;
|
|
@@ -12788,7 +12750,7 @@ function DeviceManageScreen() {
|
|
|
12788
12750
|
setActionState(null);
|
|
12789
12751
|
}
|
|
12790
12752
|
}, [password, userId, refreshList]);
|
|
12791
|
-
const handleDelete = (0,
|
|
12753
|
+
const handleDelete = (0, import_react31.useCallback)(async (keyshareId) => {
|
|
12792
12754
|
const guardian = guardianRef.current;
|
|
12793
12755
|
if (!guardian) return;
|
|
12794
12756
|
setActionState({ action: "delete", keyshareId, substep: "confirm-device" });
|
|
@@ -12955,10 +12917,10 @@ function DeviceManageScreen() {
|
|
|
12955
12917
|
}
|
|
12956
12918
|
);
|
|
12957
12919
|
}
|
|
12958
|
-
var
|
|
12920
|
+
var import_react31, import_lucide_react22, import_jsx_runtime51;
|
|
12959
12921
|
var init_DeviceManageScreen = __esm({
|
|
12960
12922
|
"src/internal/components/DevicesMenu/DeviceManageScreen.tsx"() {
|
|
12961
|
-
|
|
12923
|
+
import_react31 = require("react");
|
|
12962
12924
|
import_lucide_react22 = require("lucide-react");
|
|
12963
12925
|
init_Expandable2();
|
|
12964
12926
|
init_button();
|
|
@@ -12981,11 +12943,11 @@ function DeviceRestoreScreen() {
|
|
|
12981
12943
|
const keyshareId = pageParams?.keyshareId;
|
|
12982
12944
|
const deviceId = pageParams?.deviceId;
|
|
12983
12945
|
const deviceName = pageParams?.deviceName;
|
|
12984
|
-
const [password, setPassword] = (0,
|
|
12985
|
-
const [isWorking, setIsWorking] = (0,
|
|
12986
|
-
const [statusMessage, setStatusMessage] = (0,
|
|
12987
|
-
const [errorMessage, setErrorMessage] = (0,
|
|
12988
|
-
const handleRestore = (0,
|
|
12946
|
+
const [password, setPassword] = (0, import_react32.useState)("");
|
|
12947
|
+
const [isWorking, setIsWorking] = (0, import_react32.useState)(false);
|
|
12948
|
+
const [statusMessage, setStatusMessage] = (0, import_react32.useState)(null);
|
|
12949
|
+
const [errorMessage, setErrorMessage] = (0, import_react32.useState)(null);
|
|
12950
|
+
const handleRestore = (0, import_react32.useCallback)(async () => {
|
|
12989
12951
|
if (!password || !keyshareId || !userId) return;
|
|
12990
12952
|
const iframe4 = getIframeManager();
|
|
12991
12953
|
if (!iframe4) {
|
|
@@ -13072,10 +13034,10 @@ function DeviceRestoreScreen() {
|
|
|
13072
13034
|
}
|
|
13073
13035
|
);
|
|
13074
13036
|
}
|
|
13075
|
-
var
|
|
13037
|
+
var import_react32, import_lucide_react23, import_jsx_runtime52;
|
|
13076
13038
|
var init_DeviceRestoreScreen = __esm({
|
|
13077
13039
|
"src/internal/components/DevicesMenu/DeviceRestoreScreen.tsx"() {
|
|
13078
|
-
|
|
13040
|
+
import_react32 = require("react");
|
|
13079
13041
|
import_lucide_react23 = require("lucide-react");
|
|
13080
13042
|
init_Expandable2();
|
|
13081
13043
|
init_button();
|
|
@@ -13098,8 +13060,8 @@ function truncateAddress(address) {
|
|
|
13098
13060
|
return `${address.slice(0, 6)}...${address.slice(-4)}`;
|
|
13099
13061
|
}
|
|
13100
13062
|
function DeviceRow({ device }) {
|
|
13101
|
-
const [confirmingUnlink, setConfirmingUnlink] = (0,
|
|
13102
|
-
const [unlinkError, setUnlinkError] = (0,
|
|
13063
|
+
const [confirmingUnlink, setConfirmingUnlink] = (0, import_react33.useState)(false);
|
|
13064
|
+
const [unlinkError, setUnlinkError] = (0, import_react33.useState)(null);
|
|
13103
13065
|
const { mutate: unlink, isPending } = useUnlinkDevice();
|
|
13104
13066
|
if (confirmingUnlink) {
|
|
13105
13067
|
return /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "flex flex-col gap-2 p-3 rounded-lg bg-[var(--ui-kit-bg)]", children: [
|
|
@@ -13213,10 +13175,10 @@ function DevicesMenu() {
|
|
|
13213
13175
|
}
|
|
13214
13176
|
);
|
|
13215
13177
|
}
|
|
13216
|
-
var
|
|
13178
|
+
var import_react33, import_lucide_react24, import_jsx_runtime53;
|
|
13217
13179
|
var init_DevicesMenu = __esm({
|
|
13218
13180
|
"src/internal/components/DevicesMenu/DevicesMenu.tsx"() {
|
|
13219
|
-
|
|
13181
|
+
import_react33 = require("react");
|
|
13220
13182
|
import_lucide_react24 = require("lucide-react");
|
|
13221
13183
|
init_Expandable2();
|
|
13222
13184
|
init_button();
|
|
@@ -13228,12 +13190,43 @@ var init_DevicesMenu = __esm({
|
|
|
13228
13190
|
}
|
|
13229
13191
|
});
|
|
13230
13192
|
|
|
13193
|
+
// src/internal/stores/useExternalWalletStore.ts
|
|
13194
|
+
var import_zustand6, useExternalWalletStore;
|
|
13195
|
+
var init_useExternalWalletStore = __esm({
|
|
13196
|
+
"src/internal/stores/useExternalWalletStore.ts"() {
|
|
13197
|
+
import_zustand6 = require("zustand");
|
|
13198
|
+
useExternalWalletStore = (0, import_zustand6.create)((set) => ({
|
|
13199
|
+
configMode: "linked",
|
|
13200
|
+
activeMode: "linked",
|
|
13201
|
+
externalAddress: null,
|
|
13202
|
+
externalChainId: null,
|
|
13203
|
+
isExternalConnected: false,
|
|
13204
|
+
connectorName: null,
|
|
13205
|
+
setConfigMode: (mode) => set({ configMode: mode }),
|
|
13206
|
+
setActiveMode: (mode) => set({ activeMode: mode }),
|
|
13207
|
+
setExternalWallet: ({ address, chainId, connectorName }) => set({
|
|
13208
|
+
externalAddress: address,
|
|
13209
|
+
externalChainId: chainId,
|
|
13210
|
+
isExternalConnected: true,
|
|
13211
|
+
connectorName
|
|
13212
|
+
}),
|
|
13213
|
+
clearExternalWallet: () => set({
|
|
13214
|
+
externalAddress: null,
|
|
13215
|
+
externalChainId: null,
|
|
13216
|
+
isExternalConnected: false,
|
|
13217
|
+
connectorName: null
|
|
13218
|
+
}),
|
|
13219
|
+
setExternalChainId: (chainId) => set({ externalChainId: chainId })
|
|
13220
|
+
}));
|
|
13221
|
+
}
|
|
13222
|
+
});
|
|
13223
|
+
|
|
13231
13224
|
// src/internal/components/KeyshareRestoreMenu/hooks/useRestoreStore.ts
|
|
13232
|
-
var
|
|
13225
|
+
var import_zustand7, useRestoreStore;
|
|
13233
13226
|
var init_useRestoreStore = __esm({
|
|
13234
13227
|
"src/internal/components/KeyshareRestoreMenu/hooks/useRestoreStore.ts"() {
|
|
13235
|
-
|
|
13236
|
-
useRestoreStore = (0,
|
|
13228
|
+
import_zustand7 = require("zustand");
|
|
13229
|
+
useRestoreStore = (0, import_zustand7.create)((set) => ({
|
|
13237
13230
|
method: null,
|
|
13238
13231
|
// recoveryData: null,
|
|
13239
13232
|
showPassword: false,
|
|
@@ -13278,7 +13271,7 @@ function useOnRestoreSuccess() {
|
|
|
13278
13271
|
setStatus
|
|
13279
13272
|
} = useSession();
|
|
13280
13273
|
const { setError, setSuccess } = useRestoreStore();
|
|
13281
|
-
const createSessionWithKeyshare = (0,
|
|
13274
|
+
const createSessionWithKeyshare = (0, import_react34.useCallback)(
|
|
13282
13275
|
async (userId, hasServerKeyshare, isNewUser) => {
|
|
13283
13276
|
try {
|
|
13284
13277
|
try {
|
|
@@ -13319,7 +13312,7 @@ function useOnRestoreSuccess() {
|
|
|
13319
13312
|
},
|
|
13320
13313
|
[setStatus, usePaymaster, activeChainId, publicClient]
|
|
13321
13314
|
);
|
|
13322
|
-
const onRestoreSuccess = (0,
|
|
13315
|
+
const onRestoreSuccess = (0, import_react34.useCallback)(async () => {
|
|
13323
13316
|
const { verifyToken: verifyToken2, jwtTokenManager: jwtTokenManager4 } = await Promise.resolve().then(() => (init_auth(), auth_exports));
|
|
13324
13317
|
const verify = await verifyToken2();
|
|
13325
13318
|
const hasServerKeyshare = verify?.hasKeyshare ?? jwtTokenManager4.getHasKeyshare() ?? false;
|
|
@@ -13384,12 +13377,12 @@ function useOnRestoreSuccess() {
|
|
|
13384
13377
|
]);
|
|
13385
13378
|
return { onRestoreSuccess };
|
|
13386
13379
|
}
|
|
13387
|
-
var
|
|
13380
|
+
var import_react34;
|
|
13388
13381
|
var init_useOnRestoreSuccess = __esm({
|
|
13389
13382
|
"src/internal/components/KeyshareRestoreMenu/hooks/useOnRestoreSuccess.ts"() {
|
|
13390
13383
|
init_ProviderContext();
|
|
13391
13384
|
init_SessionContext();
|
|
13392
|
-
|
|
13385
|
+
import_react34 = require("react");
|
|
13393
13386
|
init_useLayoutDataStore();
|
|
13394
13387
|
init_useLayoutStore();
|
|
13395
13388
|
init_useRestoreStore();
|
|
@@ -13441,9 +13434,9 @@ __export(passkey_exports2, {
|
|
|
13441
13434
|
linkPasskeyWithWebAuthn: () => linkPasskeyWithWebAuthn
|
|
13442
13435
|
});
|
|
13443
13436
|
async function completePasskeyLinking(payload) {
|
|
13444
|
-
const hasValidToken = await (0,
|
|
13437
|
+
const hasValidToken = await (0, import_auth23.ensureValidToken)();
|
|
13445
13438
|
if (!hasValidToken) throw new Error("No authentication token available");
|
|
13446
|
-
const response = await (0,
|
|
13439
|
+
const response = await (0, import_auth23.authenticatedFetch)(`${getTssUrl3()}/api/auth/link/passkey/complete`, {
|
|
13447
13440
|
method: "POST",
|
|
13448
13441
|
body: JSON.stringify(payload)
|
|
13449
13442
|
});
|
|
@@ -13453,9 +13446,9 @@ async function completePasskeyLinking(payload) {
|
|
|
13453
13446
|
}
|
|
13454
13447
|
}
|
|
13455
13448
|
async function beginPasskeyLinking() {
|
|
13456
|
-
const hasValidToken = await (0,
|
|
13449
|
+
const hasValidToken = await (0, import_auth23.ensureValidToken)();
|
|
13457
13450
|
if (!hasValidToken) throw new Error("No authentication token available");
|
|
13458
|
-
let res = await (0,
|
|
13451
|
+
let res = await (0, import_auth23.authenticatedFetch)(`${getTssUrl3()}/api/auth/link/passkey/begin`, { method: "POST" });
|
|
13459
13452
|
if (res.ok) {
|
|
13460
13453
|
const begin2 = await res.json();
|
|
13461
13454
|
const options2 = {
|
|
@@ -13483,7 +13476,7 @@ async function beginPasskeyLinking() {
|
|
|
13483
13476
|
};
|
|
13484
13477
|
return { challengeId: begin2.challengeId, options: options2 };
|
|
13485
13478
|
}
|
|
13486
|
-
res = await (0,
|
|
13479
|
+
res = await (0, import_auth23.authenticatedFetch)(`${getTssUrl3()}/api/auth/link/passkey/options`, { method: "GET" });
|
|
13487
13480
|
if (!res.ok) throw new Error("Failed to get passkey linking options");
|
|
13488
13481
|
const begin = await res.json();
|
|
13489
13482
|
const options = {
|
|
@@ -13515,7 +13508,7 @@ async function linkPasskeyWithWebAuthn(optionsOverride) {
|
|
|
13515
13508
|
if (!("credentials" in navigator) || !("create" in navigator.credentials)) {
|
|
13516
13509
|
throw new Error("WebAuthn not supported in this browser");
|
|
13517
13510
|
}
|
|
13518
|
-
const userId =
|
|
13511
|
+
const userId = import_auth23.jwtTokenManager.getUserId();
|
|
13519
13512
|
if (!userId) throw new Error("No authenticated user");
|
|
13520
13513
|
let challengeId = null;
|
|
13521
13514
|
let publicKeyOptions = null;
|
|
@@ -13811,36 +13804,37 @@ function useCreateBackup() {
|
|
|
13811
13804
|
const session = useSession((st) => st.session);
|
|
13812
13805
|
const address = useSession((st) => st.address);
|
|
13813
13806
|
const hasServerVault = useSession((st) => st.hasServerVault);
|
|
13814
|
-
const
|
|
13815
|
-
const
|
|
13816
|
-
|
|
13807
|
+
const usePasskey = useRestoreStore((st) => st.usePasskey);
|
|
13808
|
+
const restorePassword = useRestoreStore((st) => st.restorePassword);
|
|
13809
|
+
const selectedCloudProvider = useRestoreStore((st) => st.selectedCloudProvider);
|
|
13810
|
+
(0, import_react35.useEffect)(() => {
|
|
13817
13811
|
if (!hasServerVault) {
|
|
13818
|
-
setMethod("server");
|
|
13819
|
-
setIsDialogForced(true);
|
|
13812
|
+
useRestoreStore.getState().setMethod("server");
|
|
13813
|
+
useLayoutStore.getState().setIsDialogForced(true);
|
|
13820
13814
|
}
|
|
13821
|
-
}, [hasServerVault
|
|
13815
|
+
}, [hasServerVault]);
|
|
13822
13816
|
const recoveryUserId = useSession((st) => st.recoveryUserId);
|
|
13823
13817
|
const passportUserId = session?.mpcUserId || recoveryUserId || "";
|
|
13824
|
-
const onBackupSuccess = (
|
|
13818
|
+
const onBackupSuccess = (0, import_react35.useCallback)(() => {
|
|
13819
|
+
console.log("[EMBARKAI BACKUP] Backup created successfully");
|
|
13820
|
+
}, [hasServerVault]);
|
|
13825
13821
|
const { mutate: createPasswordBackup, isPending: isPasswordBackupCreating } = (0, import_react_query17.useMutation)({
|
|
13826
13822
|
mutationFn: async () => {
|
|
13827
13823
|
const iframeManager = getIframeManager();
|
|
13828
13824
|
if (!iframeManager) {
|
|
13829
13825
|
throw new Error("Iframe manager not initialized");
|
|
13830
13826
|
}
|
|
13831
|
-
const jwt =
|
|
13827
|
+
const jwt = import_auth23.jwtTokenManager.getTokens();
|
|
13832
13828
|
if (!usePasskey && !restorePassword) {
|
|
13833
13829
|
throw new Error("Please provide a password for the backup");
|
|
13834
13830
|
}
|
|
13835
13831
|
const password = !usePasskey ? restorePassword : void 0;
|
|
13836
|
-
const navigateToMainMenu = jwt.isNewUser || !hasServerVault;
|
|
13837
|
-
console.log("[BACKUP STATUS] is new user:", jwt.isNewUser, !hasServerVault, "usePasskey:", usePasskey);
|
|
13838
13832
|
return {
|
|
13839
|
-
response: await iframeManager.createBackup(passportUserId, { method: "server", password }, jwt.accessToken)
|
|
13840
|
-
navigateToMainMenu
|
|
13833
|
+
response: await iframeManager.createBackup(passportUserId, { method: "server", password }, jwt.accessToken)
|
|
13841
13834
|
};
|
|
13842
13835
|
},
|
|
13843
|
-
onSuccess: async ({ response
|
|
13836
|
+
onSuccess: async ({ response }) => {
|
|
13837
|
+
const { setError, setSuccess } = useRestoreStore.getState();
|
|
13844
13838
|
qc.invalidateQueries({ queryKey: [CHECK_BACKUP_QUERY_KEY, address] });
|
|
13845
13839
|
if (response.success) {
|
|
13846
13840
|
setError("");
|
|
@@ -13848,7 +13842,7 @@ function useCreateBackup() {
|
|
|
13848
13842
|
if (typeof window !== "undefined") {
|
|
13849
13843
|
window.dispatchEvent(
|
|
13850
13844
|
new CustomEvent("lumia-passport-backup-status-changed", {
|
|
13851
|
-
detail: { method: "server", success: true
|
|
13845
|
+
detail: { method: "server", success: true }
|
|
13852
13846
|
})
|
|
13853
13847
|
);
|
|
13854
13848
|
}
|
|
@@ -13856,9 +13850,10 @@ function useCreateBackup() {
|
|
|
13856
13850
|
} else {
|
|
13857
13851
|
setError(response.error || "Server backup failed");
|
|
13858
13852
|
}
|
|
13859
|
-
setIsDialogForced(false);
|
|
13853
|
+
useLayoutStore.getState().setIsDialogForced(false);
|
|
13860
13854
|
},
|
|
13861
13855
|
onError: async (error) => {
|
|
13856
|
+
const { setError, setSuccess } = useRestoreStore.getState();
|
|
13862
13857
|
setSuccess("");
|
|
13863
13858
|
if (error?.name === "NotAllowedError" || error?.message?.includes("timed out or was not allowed")) {
|
|
13864
13859
|
setError("Passkey selection was cancelled. Please try again or create a new passkey.");
|
|
@@ -13887,7 +13882,7 @@ function useCreateBackup() {
|
|
|
13887
13882
|
},
|
|
13888
13883
|
onSuccess: async () => {
|
|
13889
13884
|
qc.invalidateQueries({ queryKey: [CHECK_BACKUP_QUERY_KEY, address] });
|
|
13890
|
-
setSuccess("Backup file downloaded successfully");
|
|
13885
|
+
useRestoreStore.getState().setSuccess("Backup file downloaded successfully");
|
|
13891
13886
|
if (typeof window !== "undefined") {
|
|
13892
13887
|
window.dispatchEvent(
|
|
13893
13888
|
new CustomEvent("lumia-passport-backup-status-changed", {
|
|
@@ -13898,13 +13893,13 @@ function useCreateBackup() {
|
|
|
13898
13893
|
onBackupSuccess();
|
|
13899
13894
|
},
|
|
13900
13895
|
onError: async (error) => {
|
|
13901
|
-
setError(error?.message || "Backup creation failed");
|
|
13896
|
+
useRestoreStore.getState().setError(error?.message || "Backup creation failed");
|
|
13902
13897
|
qc.invalidateQueries({ queryKey: [CHECK_BACKUP_QUERY_KEY, address] });
|
|
13903
13898
|
}
|
|
13904
13899
|
});
|
|
13905
13900
|
const { mutate: createPasskey, isPending: isPasskeyCreating } = (0, import_react_query17.useMutation)({
|
|
13906
13901
|
mutationFn: async () => {
|
|
13907
|
-
setIsCreatingPasskey(true);
|
|
13902
|
+
useRestoreStore.getState().setIsCreatingPasskey(true);
|
|
13908
13903
|
const { linkPasskeyWithWebAuthn: linkPasskeyWithWebAuthn2 } = await Promise.resolve().then(() => (init_passkey2(), passkey_exports2));
|
|
13909
13904
|
const { createPasskeyHelpers: createPasskeyHelpers2 } = await Promise.resolve().then(() => (init_passkey(), passkey_exports));
|
|
13910
13905
|
const { credentialId, rawId } = await linkPasskeyWithWebAuthn2();
|
|
@@ -13914,11 +13909,13 @@ function useCreateBackup() {
|
|
|
13914
13909
|
return { credentialId, rawId };
|
|
13915
13910
|
},
|
|
13916
13911
|
onSuccess: async () => {
|
|
13912
|
+
const { setError, setSuccess, setIsCreatingPasskey } = useRestoreStore.getState();
|
|
13917
13913
|
setIsCreatingPasskey(false);
|
|
13918
13914
|
setError(null);
|
|
13919
13915
|
setSuccess("Passkey created successfully. You can now create a backup.");
|
|
13920
13916
|
},
|
|
13921
13917
|
onError: async (error) => {
|
|
13918
|
+
const { setError, setIsCreatingPasskey } = useRestoreStore.getState();
|
|
13922
13919
|
setIsCreatingPasskey(false);
|
|
13923
13920
|
if (error.name === "NotAllowedError") {
|
|
13924
13921
|
setError("Passkey creation cancelled. Please try again.");
|
|
@@ -13951,7 +13948,7 @@ function useCreateBackup() {
|
|
|
13951
13948
|
},
|
|
13952
13949
|
onSuccess: async ({ provider, uploadResult }) => {
|
|
13953
13950
|
console.log("[KeyshareBackup] Cloud backup upload result:", uploadResult);
|
|
13954
|
-
setSuccess(`Successfully created cloud backup on ${provider.name}`);
|
|
13951
|
+
useRestoreStore.getState().setSuccess(`Successfully created cloud backup on ${provider.name}`);
|
|
13955
13952
|
qc.invalidateQueries({ queryKey: [CHECK_BACKUP_QUERY_KEY, address] });
|
|
13956
13953
|
if (typeof window !== "undefined") {
|
|
13957
13954
|
window.dispatchEvent(
|
|
@@ -13963,7 +13960,7 @@ function useCreateBackup() {
|
|
|
13963
13960
|
onBackupSuccess();
|
|
13964
13961
|
},
|
|
13965
13962
|
onError: async (error) => {
|
|
13966
|
-
setError(error?.message || "Backup creation failed");
|
|
13963
|
+
useRestoreStore.getState().setError(error?.message || "Backup creation failed");
|
|
13967
13964
|
qc.invalidateQueries({ queryKey: [CHECK_BACKUP_QUERY_KEY, address] });
|
|
13968
13965
|
}
|
|
13969
13966
|
});
|
|
@@ -13978,12 +13975,13 @@ function useCreateBackup() {
|
|
|
13978
13975
|
createPasskey
|
|
13979
13976
|
};
|
|
13980
13977
|
}
|
|
13981
|
-
var import_react_query17,
|
|
13978
|
+
var import_react_query17, import_react35;
|
|
13982
13979
|
var init_useCreateBackup = __esm({
|
|
13983
13980
|
"src/internal/components/KeyshareRestoreMenu/hooks/useCreateBackup.ts"() {
|
|
13984
13981
|
init_SessionContext();
|
|
13985
13982
|
import_react_query17 = require("@tanstack/react-query");
|
|
13986
|
-
|
|
13983
|
+
import_react35 = require("react");
|
|
13984
|
+
init_auth();
|
|
13987
13985
|
init_useLayoutStore();
|
|
13988
13986
|
init_iframe_manager();
|
|
13989
13987
|
init_constants4();
|
|
@@ -14117,7 +14115,7 @@ function useValidateFileBackup() {
|
|
|
14117
14115
|
const restoreFile = useRestoreStore((st) => st.restoreFile);
|
|
14118
14116
|
const setError = useRestoreStore((st) => st.setError);
|
|
14119
14117
|
const setUsePasskey = useRestoreStore((st) => st.setUsePasskey);
|
|
14120
|
-
(0,
|
|
14118
|
+
(0, import_react36.useEffect)(() => {
|
|
14121
14119
|
if (!restoreFile) {
|
|
14122
14120
|
return;
|
|
14123
14121
|
}
|
|
@@ -14138,10 +14136,10 @@ function useValidateFileBackup() {
|
|
|
14138
14136
|
reader.readAsText(restoreFile);
|
|
14139
14137
|
}, [restoreFile]);
|
|
14140
14138
|
}
|
|
14141
|
-
var
|
|
14139
|
+
var import_react36;
|
|
14142
14140
|
var init_useValidateFileBackup = __esm({
|
|
14143
14141
|
"src/internal/components/KeyshareRestoreMenu/hooks/useValidateFileBackup.ts"() {
|
|
14144
|
-
|
|
14142
|
+
import_react36 = require("react");
|
|
14145
14143
|
init_useRestoreStore();
|
|
14146
14144
|
}
|
|
14147
14145
|
});
|
|
@@ -14169,7 +14167,7 @@ function MethodSelector(props) {
|
|
|
14169
14167
|
setError,
|
|
14170
14168
|
setSuccess
|
|
14171
14169
|
} = useRestoreStore();
|
|
14172
|
-
const recoveryRenderMethods = (0,
|
|
14170
|
+
const recoveryRenderMethods = (0, import_react37.useMemo)(() => {
|
|
14173
14171
|
const methodsWithBackupData = getRecoveryRenderMethods(mode).map((mt) => {
|
|
14174
14172
|
let data = null;
|
|
14175
14173
|
switch (true) {
|
|
@@ -14184,7 +14182,7 @@ function MethodSelector(props) {
|
|
|
14184
14182
|
return methodsWithBackupData;
|
|
14185
14183
|
}, [mode, serverRecoveryStatus]);
|
|
14186
14184
|
if (!!selectedRecoveryMethod) return null;
|
|
14187
|
-
return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
14185
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_react37.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
14188
14186
|
"div",
|
|
14189
14187
|
{
|
|
14190
14188
|
style: { gridTemplateColumns: `repeat(${recoveryRenderMethods.length}, minmax(0, 1fr))` },
|
|
@@ -14218,12 +14216,12 @@ function MethodSelector(props) {
|
|
|
14218
14216
|
}
|
|
14219
14217
|
) });
|
|
14220
14218
|
}
|
|
14221
|
-
var import_lucide_react26,
|
|
14219
|
+
var import_lucide_react26, import_react37, import_jsx_runtime54, getRecoveryRenderMethods;
|
|
14222
14220
|
var init_MethodSelector = __esm({
|
|
14223
14221
|
"src/internal/components/KeyshareRestoreMenu/components/MethodSelector.tsx"() {
|
|
14224
14222
|
init_useT();
|
|
14225
14223
|
import_lucide_react26 = require("lucide-react");
|
|
14226
|
-
|
|
14224
|
+
import_react37 = require("react");
|
|
14227
14225
|
init_guardian_backup();
|
|
14228
14226
|
init_PositiveIcon();
|
|
14229
14227
|
init_button();
|
|
@@ -14257,7 +14255,7 @@ function PasswordPasskey(props) {
|
|
|
14257
14255
|
onCreatePasskey
|
|
14258
14256
|
} = props;
|
|
14259
14257
|
const hasServerVault = useSession((st) => st.hasServerVault);
|
|
14260
|
-
const actionRef = (0,
|
|
14258
|
+
const actionRef = (0, import_react38.useRef)(null);
|
|
14261
14259
|
const {
|
|
14262
14260
|
showPassword,
|
|
14263
14261
|
restorePassword,
|
|
@@ -14271,7 +14269,7 @@ function PasswordPasskey(props) {
|
|
|
14271
14269
|
} = useRestoreStore();
|
|
14272
14270
|
const { config } = useProviderConfig();
|
|
14273
14271
|
const isPasskeyEnabled = config.current.passkey.enabled;
|
|
14274
|
-
(0,
|
|
14272
|
+
(0, import_react38.useEffect)(() => {
|
|
14275
14273
|
if (!isPasskeyEnabled && usePasskey) setUsePasskey(false);
|
|
14276
14274
|
}, [isPasskeyEnabled, usePasskey]);
|
|
14277
14275
|
return /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(import_jsx_runtime55.Fragment, { children: [
|
|
@@ -14426,7 +14424,7 @@ function PasswordPasskey(props) {
|
|
|
14426
14424
|
] })
|
|
14427
14425
|
] });
|
|
14428
14426
|
}
|
|
14429
|
-
var import_lucide_react27,
|
|
14427
|
+
var import_lucide_react27, import_react38, import_jsx_runtime55;
|
|
14430
14428
|
var init_PasswordPasskey = __esm({
|
|
14431
14429
|
"src/internal/components/KeyshareRestoreMenu/components/PasswordPasskey.tsx"() {
|
|
14432
14430
|
init_ProviderContext();
|
|
@@ -14434,7 +14432,7 @@ var init_PasswordPasskey = __esm({
|
|
|
14434
14432
|
init_i18n();
|
|
14435
14433
|
init_utils2();
|
|
14436
14434
|
import_lucide_react27 = require("lucide-react");
|
|
14437
|
-
|
|
14435
|
+
import_react38 = require("react");
|
|
14438
14436
|
init_OtpIcon();
|
|
14439
14437
|
init_button();
|
|
14440
14438
|
init_highlight();
|
|
@@ -14610,7 +14608,7 @@ function Server(props) {
|
|
|
14610
14608
|
const usePasskey = useRestoreStore((st) => st.usePasskey);
|
|
14611
14609
|
const setUsePasskey = useRestoreStore((st) => st.setUsePasskey);
|
|
14612
14610
|
const serverRecoveryStatus = qc.getQueryData([CHECK_BACKUP_QUERY_KEY, address]);
|
|
14613
|
-
(0,
|
|
14611
|
+
(0, import_react39.useEffect)(() => {
|
|
14614
14612
|
if (mode === "backup" || !serverRecoveryStatus?.created?.encryptionMethod) return;
|
|
14615
14613
|
setUsePasskey(serverRecoveryStatus.created.encryptionMethod === "passkey");
|
|
14616
14614
|
}, [mode, serverRecoveryStatus, setUsePasskey]);
|
|
@@ -14633,7 +14631,7 @@ function Server(props) {
|
|
|
14633
14631
|
) : t("passport:backupMenu.vaultRestore")
|
|
14634
14632
|
}
|
|
14635
14633
|
),
|
|
14636
|
-
!!serverRecoveryStatus?.created?.at && /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(Highlight, { type: "
|
|
14634
|
+
!!serverRecoveryStatus?.created?.at && /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(Highlight, { type: "info", className: "flex gap-[var(--ui-kit-gap)]", children: [
|
|
14637
14635
|
serverRecoveryStatus.created.encryptionMethod === "password" ? /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(OtpIcon, { className: "w-4 h-4" }) : /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(import_lucide_react30.Key, { className: "w-4 h-4" }),
|
|
14638
14636
|
/* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("span", { className: "flex-1 block", children: [
|
|
14639
14637
|
t("passport:backupMenu.vaultRecoveryStatus"),
|
|
@@ -14645,7 +14643,7 @@ function Server(props) {
|
|
|
14645
14643
|
] })
|
|
14646
14644
|
] });
|
|
14647
14645
|
}
|
|
14648
|
-
var import_react_query19, import_dayjs3, import_lucide_react30,
|
|
14646
|
+
var import_react_query19, import_dayjs3, import_lucide_react30, import_react39, import_jsx_runtime58;
|
|
14649
14647
|
var init_Server = __esm({
|
|
14650
14648
|
"src/internal/components/KeyshareRestoreMenu/methods/Server.tsx"() {
|
|
14651
14649
|
init_SessionContext();
|
|
@@ -14654,7 +14652,7 @@ var init_Server = __esm({
|
|
|
14654
14652
|
import_react_query19 = require("@tanstack/react-query");
|
|
14655
14653
|
import_dayjs3 = __toESM(require("dayjs"), 1);
|
|
14656
14654
|
import_lucide_react30 = require("lucide-react");
|
|
14657
|
-
|
|
14655
|
+
import_react39 = require("react");
|
|
14658
14656
|
init_highlight();
|
|
14659
14657
|
init_PasswordPasskey();
|
|
14660
14658
|
init_constants4();
|
|
@@ -14817,7 +14815,7 @@ function Cloud2(props) {
|
|
|
14817
14815
|
return availableProviders.map((p) => ({ id: p.id, name: p.name, available: p.isAvailable() }));
|
|
14818
14816
|
}
|
|
14819
14817
|
});
|
|
14820
|
-
(0,
|
|
14818
|
+
(0, import_react40.useEffect)(() => {
|
|
14821
14819
|
if (isCloudProvidersLoading) return;
|
|
14822
14820
|
if (!!cloudProvidersError) {
|
|
14823
14821
|
console.error("[KeyshareBackup] Failed to load cloud providers:", cloudProvidersError);
|
|
@@ -14881,13 +14879,13 @@ function Cloud2(props) {
|
|
|
14881
14879
|
)
|
|
14882
14880
|
] });
|
|
14883
14881
|
}
|
|
14884
|
-
var import_react_query20, import_lucide_react32,
|
|
14882
|
+
var import_react_query20, import_lucide_react32, import_react40, import_jsx_runtime60;
|
|
14885
14883
|
var init_Cloud = __esm({
|
|
14886
14884
|
"src/internal/components/KeyshareRestoreMenu/methods/Cloud.tsx"() {
|
|
14887
14885
|
init_SessionContext();
|
|
14888
14886
|
import_react_query20 = require("@tanstack/react-query");
|
|
14889
14887
|
import_lucide_react32 = require("lucide-react");
|
|
14890
|
-
|
|
14888
|
+
import_react40 = require("react");
|
|
14891
14889
|
init_button();
|
|
14892
14890
|
init_select();
|
|
14893
14891
|
init_PasswordPasskey();
|
|
@@ -14904,8 +14902,8 @@ function Guardian(props) {
|
|
|
14904
14902
|
const session = useSession((st) => st.session);
|
|
14905
14903
|
const recoveryUserId = useSession((st) => st.recoveryUserId);
|
|
14906
14904
|
const { onRestoreSuccess } = useOnRestoreSuccess();
|
|
14907
|
-
const [isWorking, setIsWorking] = (0,
|
|
14908
|
-
const [step, setStep] = (0,
|
|
14905
|
+
const [isWorking, setIsWorking] = (0, import_react41.useState)(false);
|
|
14906
|
+
const [step, setStep] = (0, import_react41.useState)("idle");
|
|
14909
14907
|
const handleGuardianBackup = async () => {
|
|
14910
14908
|
if (!restorePassword) {
|
|
14911
14909
|
setError("Please enter a password");
|
|
@@ -15034,11 +15032,11 @@ function Guardian(props) {
|
|
|
15034
15032
|
] })
|
|
15035
15033
|
] });
|
|
15036
15034
|
}
|
|
15037
|
-
var
|
|
15035
|
+
var import_react41, import_lucide_react33, import_jsx_runtime61;
|
|
15038
15036
|
var init_Guardian = __esm({
|
|
15039
15037
|
"src/internal/components/KeyshareRestoreMenu/methods/Guardian.tsx"() {
|
|
15040
15038
|
init_SessionContext();
|
|
15041
|
-
|
|
15039
|
+
import_react41 = require("react");
|
|
15042
15040
|
import_lucide_react33 = require("lucide-react");
|
|
15043
15041
|
init_iframe_manager();
|
|
15044
15042
|
init_guardian_backup();
|
|
@@ -15061,7 +15059,7 @@ var init_methods = __esm({
|
|
|
15061
15059
|
});
|
|
15062
15060
|
|
|
15063
15061
|
// src/internal/components/KeyshareRestoreMenu/KeyshareRestoreMenu.tsx
|
|
15064
|
-
var import_react_query21, import_lucide_react34,
|
|
15062
|
+
var import_react_query21, import_lucide_react34, import_react42, import_wagmi, import_jsx_runtime62, RESTORE_COMPONENTS, KeyshareRestoreMenu;
|
|
15065
15063
|
var init_KeyshareRestoreMenu = __esm({
|
|
15066
15064
|
"src/internal/components/KeyshareRestoreMenu/KeyshareRestoreMenu.tsx"() {
|
|
15067
15065
|
init_ProviderContext();
|
|
@@ -15069,9 +15067,11 @@ var init_KeyshareRestoreMenu = __esm({
|
|
|
15069
15067
|
init_i18n();
|
|
15070
15068
|
import_react_query21 = require("@tanstack/react-query");
|
|
15071
15069
|
import_lucide_react34 = require("lucide-react");
|
|
15072
|
-
|
|
15070
|
+
import_react42 = require("react");
|
|
15071
|
+
import_wagmi = require("wagmi");
|
|
15073
15072
|
init_useLayoutDataStore();
|
|
15074
15073
|
init_useLayoutStore();
|
|
15074
|
+
init_useExternalWalletStore();
|
|
15075
15075
|
init_vaultClient();
|
|
15076
15076
|
init_Expandable2();
|
|
15077
15077
|
init_button();
|
|
@@ -15093,23 +15093,14 @@ var init_KeyshareRestoreMenu = __esm({
|
|
|
15093
15093
|
const qc = (0, import_react_query21.useQueryClient)();
|
|
15094
15094
|
const { callbacksRef } = useProviderConfig();
|
|
15095
15095
|
const { t } = useT();
|
|
15096
|
-
const
|
|
15096
|
+
const address = useSession((st) => st.address);
|
|
15097
15097
|
const maxScrollHeight = useLayoutStore((st) => st.maxScrollHeight);
|
|
15098
|
-
const
|
|
15099
|
-
const
|
|
15100
|
-
const
|
|
15101
|
-
|
|
15102
|
-
|
|
15103
|
-
|
|
15104
|
-
setError,
|
|
15105
|
-
setShowPassword,
|
|
15106
|
-
setUsePasskey,
|
|
15107
|
-
setRestoreFile,
|
|
15108
|
-
setRestorePassword,
|
|
15109
|
-
setSuccess,
|
|
15110
|
-
setMethod
|
|
15111
|
-
} = useRestoreStore();
|
|
15112
|
-
(0, import_react43.useEffect)(() => {
|
|
15098
|
+
const error = useRestoreStore((st) => st.error);
|
|
15099
|
+
const success = useRestoreStore((st) => st.success);
|
|
15100
|
+
const currentRestoreMethod = useRestoreStore((st) => st.method);
|
|
15101
|
+
(0, import_react42.useEffect)(() => {
|
|
15102
|
+
const { setIsDialogForced } = useLayoutStore.getState();
|
|
15103
|
+
const { setRestorePassword, setRestoreFile, setShowPassword, setUsePasskey, setMethod } = useRestoreStore.getState();
|
|
15113
15104
|
setIsDialogForced(true);
|
|
15114
15105
|
return () => {
|
|
15115
15106
|
setRestorePassword("");
|
|
@@ -15120,6 +15111,18 @@ var init_KeyshareRestoreMenu = __esm({
|
|
|
15120
15111
|
setIsDialogForced(false);
|
|
15121
15112
|
};
|
|
15122
15113
|
}, []);
|
|
15114
|
+
const { disconnect: wagmiDisconnect } = (0, import_wagmi.useDisconnect)({
|
|
15115
|
+
mutation: {
|
|
15116
|
+
onSuccess: () => {
|
|
15117
|
+
useExternalWalletStore.getState().clearExternalWallet();
|
|
15118
|
+
useExternalWalletStore.getState().setExternalChainId(null);
|
|
15119
|
+
console.log("[ExternalWalletStore] Disconnected from external wallet");
|
|
15120
|
+
},
|
|
15121
|
+
onError: (err) => {
|
|
15122
|
+
console.error("[ExternalWalletStore] Error disconnecting from external wallet:", err);
|
|
15123
|
+
}
|
|
15124
|
+
}
|
|
15125
|
+
});
|
|
15123
15126
|
const { onRestoreSuccess } = useOnRestoreSuccess();
|
|
15124
15127
|
const {
|
|
15125
15128
|
restoreFromServer: restoreFromServer2,
|
|
@@ -15135,15 +15138,18 @@ var init_KeyshareRestoreMenu = __esm({
|
|
|
15135
15138
|
queryFn: async () => await getShareRecoveryStats()
|
|
15136
15139
|
});
|
|
15137
15140
|
const hasServerBackup = serverRecoveryStatus?.created || serverRecoveryStatus?.devices?.length > 0;
|
|
15138
|
-
(0,
|
|
15139
|
-
if (!!hasServerBackup) setMethod("server");
|
|
15141
|
+
(0, import_react42.useEffect)(() => {
|
|
15142
|
+
if (!!hasServerBackup) useRestoreStore.getState().setMethod("server");
|
|
15140
15143
|
}, [hasServerBackup]);
|
|
15141
15144
|
const { mutate: disconnect, isPending: isDisconnecting } = (0, import_react_query21.useMutation)({
|
|
15142
15145
|
mutationFn: async () => {
|
|
15146
|
+
const { setStatus, setIsLoading } = useSession.getState();
|
|
15147
|
+
const { setError, setMethod } = useRestoreStore.getState();
|
|
15143
15148
|
setError(null);
|
|
15144
15149
|
setMethod(null);
|
|
15145
15150
|
setStatus("disconnecting");
|
|
15146
15151
|
setIsLoading(true);
|
|
15152
|
+
useLayoutStore.getState().setIsDialogForced(true);
|
|
15147
15153
|
const { jwtTokenManager: jwtTokenManager4 } = await Promise.resolve().then(() => (init_auth(), auth_exports));
|
|
15148
15154
|
const userId = jwtTokenManager4.getUserId() || null;
|
|
15149
15155
|
const { logout: logout2 } = await Promise.resolve().then(() => (init_auth(), auth_exports));
|
|
@@ -15152,20 +15158,23 @@ var init_KeyshareRestoreMenu = __esm({
|
|
|
15152
15158
|
},
|
|
15153
15159
|
onSuccess: async ({ disconnectedUserId }) => {
|
|
15154
15160
|
await qc.resetQueries({ queryKey: [CHECK_BACKUP_QUERY_KEY] });
|
|
15161
|
+
if (!!useExternalWalletStore.getState().externalAddress) wagmiDisconnect();
|
|
15162
|
+
const { setStatus, setIsLoading, setSession, setAddress } = useSession.getState();
|
|
15155
15163
|
setSession(null);
|
|
15156
15164
|
setAddress(null);
|
|
15157
|
-
setError(null);
|
|
15158
15165
|
setStatus("idle");
|
|
15159
15166
|
setIsLoading(false);
|
|
15160
|
-
|
|
15167
|
+
useRestoreStore.getState().setError(null);
|
|
15168
|
+
useLayoutStore.getState().setIsDialogForced(false);
|
|
15161
15169
|
callbacksRef.current?.onDisconnect?.({ address: "0x", userId: disconnectedUserId });
|
|
15162
|
-
setTimeout(() => setPage("auth" /* AUTH */), 50);
|
|
15170
|
+
setTimeout(() => useLayoutDataStore.getState().setPage("auth" /* AUTH */), 50);
|
|
15163
15171
|
},
|
|
15164
15172
|
onError: (err) => {
|
|
15165
|
-
|
|
15173
|
+
const { setStatus, setIsLoading } = useSession.getState();
|
|
15166
15174
|
setStatus("idle");
|
|
15167
15175
|
setIsLoading(false);
|
|
15168
|
-
|
|
15176
|
+
useRestoreStore.getState().setError(err.message || "An unknown error occurred during sign out");
|
|
15177
|
+
useLayoutStore.getState().setIsDialogForced(false);
|
|
15169
15178
|
}
|
|
15170
15179
|
});
|
|
15171
15180
|
const RestoreComponent = currentRestoreMethod ? RESTORE_COMPONENTS[currentRestoreMethod] : null;
|
|
@@ -15199,6 +15208,7 @@ var init_KeyshareRestoreMenu = __esm({
|
|
|
15199
15208
|
labels: { checked: t("passport:common.standard"), unchecked: t("passport:common.advanced") },
|
|
15200
15209
|
checked: currentRestoreMethod !== "server",
|
|
15201
15210
|
onChange: () => {
|
|
15211
|
+
const { setError, setRestorePassword, setRestoreFile, setMethod } = useRestoreStore.getState();
|
|
15202
15212
|
if (!!error) setError(null);
|
|
15203
15213
|
if (currentRestoreMethod === "server") {
|
|
15204
15214
|
setRestorePassword("");
|
|
@@ -15228,6 +15238,15 @@ var init_KeyshareRestoreMenu = __esm({
|
|
|
15228
15238
|
size: "large",
|
|
15229
15239
|
variant: "ghost",
|
|
15230
15240
|
onClick: () => {
|
|
15241
|
+
const {
|
|
15242
|
+
setError,
|
|
15243
|
+
setShowPassword,
|
|
15244
|
+
setUsePasskey,
|
|
15245
|
+
setRestoreFile,
|
|
15246
|
+
setRestorePassword,
|
|
15247
|
+
setSuccess,
|
|
15248
|
+
setMethod
|
|
15249
|
+
} = useRestoreStore.getState();
|
|
15231
15250
|
setError(null);
|
|
15232
15251
|
setShowPassword(false);
|
|
15233
15252
|
setUsePasskey(false);
|
|
@@ -15270,20 +15289,11 @@ function KeyshareBackupMenu() {
|
|
|
15270
15289
|
const { t } = useT();
|
|
15271
15290
|
const setPage = useLayoutDataStore((st) => st.setPage);
|
|
15272
15291
|
const maxScrollHeight = useLayoutStore((st) => st.maxScrollHeight);
|
|
15273
|
-
const
|
|
15274
|
-
|
|
15275
|
-
|
|
15276
|
-
|
|
15277
|
-
|
|
15278
|
-
setSuccess,
|
|
15279
|
-
setError,
|
|
15280
|
-
setRestorePassword,
|
|
15281
|
-
setRestoreFile,
|
|
15282
|
-
setShowPassword,
|
|
15283
|
-
setUsePasskey,
|
|
15284
|
-
setMethod
|
|
15285
|
-
} = useRestoreStore();
|
|
15286
|
-
(0, import_react44.useEffect)(() => {
|
|
15292
|
+
const currentBackupMethod = useRestoreStore((st) => st.method);
|
|
15293
|
+
const error = useRestoreStore((st) => st.error);
|
|
15294
|
+
const success = useRestoreStore((st) => st.success);
|
|
15295
|
+
(0, import_react43.useEffect)(() => {
|
|
15296
|
+
const { setSuccess, setError, setRestorePassword, setRestoreFile, setShowPassword, setUsePasskey, setMethod } = useRestoreStore.getState();
|
|
15287
15297
|
return () => {
|
|
15288
15298
|
setSuccess(null);
|
|
15289
15299
|
setError(null);
|
|
@@ -15297,13 +15307,12 @@ function KeyshareBackupMenu() {
|
|
|
15297
15307
|
const { data: serverRecoveryStatus, isLoading: isRecoveryLoading } = (0, import_react_query22.useQuery)({
|
|
15298
15308
|
retry: false,
|
|
15299
15309
|
enabled: !!address,
|
|
15300
|
-
// Prevent query from running with undefined address
|
|
15301
15310
|
queryKey: [CHECK_BACKUP_QUERY_KEY, address],
|
|
15302
15311
|
queryFn: async () => await getShareRecoveryStats()
|
|
15303
15312
|
});
|
|
15304
15313
|
const hasRecoveryData = serverRecoveryStatus?.created || serverRecoveryStatus?.devices?.length > 0;
|
|
15305
|
-
(0,
|
|
15306
|
-
if (!!hasRecoveryData) setMethod("server");
|
|
15314
|
+
(0, import_react43.useEffect)(() => {
|
|
15315
|
+
if (!!hasRecoveryData) useRestoreStore.getState().setMethod("server");
|
|
15307
15316
|
}, [hasRecoveryData]);
|
|
15308
15317
|
const {
|
|
15309
15318
|
isPasswordBackupCreating,
|
|
@@ -15336,6 +15345,16 @@ function KeyshareBackupMenu() {
|
|
|
15336
15345
|
size: "icon",
|
|
15337
15346
|
title: "Back",
|
|
15338
15347
|
onClick: () => {
|
|
15348
|
+
const {
|
|
15349
|
+
setSuccess,
|
|
15350
|
+
setError,
|
|
15351
|
+
setRestorePassword,
|
|
15352
|
+
setRestoreFile,
|
|
15353
|
+
setShowPassword,
|
|
15354
|
+
setUsePasskey,
|
|
15355
|
+
setMethod,
|
|
15356
|
+
setSelectedCloudProvider
|
|
15357
|
+
} = useRestoreStore.getState();
|
|
15339
15358
|
setRestorePassword("");
|
|
15340
15359
|
setRestoreFile(null);
|
|
15341
15360
|
setShowPassword(false);
|
|
@@ -15358,6 +15377,7 @@ function KeyshareBackupMenu() {
|
|
|
15358
15377
|
labels: { checked: t("passport:common.standard"), unchecked: t("passport:common.advanced") },
|
|
15359
15378
|
checked: currentBackupMethod !== "server",
|
|
15360
15379
|
onChange: () => {
|
|
15380
|
+
const { setError, setRestorePassword, setRestoreFile, setMethod } = useRestoreStore.getState();
|
|
15361
15381
|
if (!!error) setError(null);
|
|
15362
15382
|
if (currentBackupMethod === "server") {
|
|
15363
15383
|
setRestorePassword("");
|
|
@@ -15390,8 +15410,8 @@ function KeyshareBackupMenu() {
|
|
|
15390
15410
|
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)(import_lucide_react35.AlertCircle, { className: "h-4 w-4 flex-shrink-0" }),
|
|
15391
15411
|
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)("span", { className: "block w-full flex-1", children: error })
|
|
15392
15412
|
] }),
|
|
15393
|
-
success && /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(
|
|
15394
|
-
/* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(
|
|
15413
|
+
success && /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(Highlight, { type: "success", className: "w-full flex flex-col gap-[var(--ui-kit-gap)]", children: [
|
|
15414
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("div", { className: "w-full flex gap-[var(--ui-kit-gap)]", children: [
|
|
15395
15415
|
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)(import_lucide_react35.CheckCircle2, { className: "h-4 w-4 flex-shrink-0" }),
|
|
15396
15416
|
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)("span", { className: "block w-full flex-1", children: success })
|
|
15397
15417
|
] }),
|
|
@@ -15401,8 +15421,8 @@ function KeyshareBackupMenu() {
|
|
|
15401
15421
|
variant: "default",
|
|
15402
15422
|
size: "large",
|
|
15403
15423
|
className: "w-full",
|
|
15404
|
-
onClick: () =>
|
|
15405
|
-
children: "
|
|
15424
|
+
onClick: () => useRestoreStore.getState().setSuccess(null),
|
|
15425
|
+
children: t("passport:common.continue")
|
|
15406
15426
|
}
|
|
15407
15427
|
)
|
|
15408
15428
|
] })
|
|
@@ -15410,14 +15430,14 @@ function KeyshareBackupMenu() {
|
|
|
15410
15430
|
}
|
|
15411
15431
|
);
|
|
15412
15432
|
}
|
|
15413
|
-
var import_react_query22, import_lucide_react35,
|
|
15433
|
+
var import_react_query22, import_lucide_react35, import_react43, import_jsx_runtime63, COMPONENTS;
|
|
15414
15434
|
var init_KeyshareBackupMenu = __esm({
|
|
15415
15435
|
"src/internal/components/KeyshareRestoreMenu/KeyshareBackupMenu.tsx"() {
|
|
15416
15436
|
init_SessionContext();
|
|
15417
15437
|
init_i18n();
|
|
15418
15438
|
import_react_query22 = require("@tanstack/react-query");
|
|
15419
15439
|
import_lucide_react35 = require("lucide-react");
|
|
15420
|
-
|
|
15440
|
+
import_react43 = require("react");
|
|
15421
15441
|
init_useLayoutDataStore();
|
|
15422
15442
|
init_useLayoutStore();
|
|
15423
15443
|
init_vaultClient();
|
|
@@ -15455,14 +15475,14 @@ function useColorMode() {
|
|
|
15455
15475
|
const preferedColorMode = config?.preferedColorMode;
|
|
15456
15476
|
const colorMode = useLayoutStore((st) => st.colorMode);
|
|
15457
15477
|
const handleStoreColorMode = useLayoutStore((st) => st.setColorMode);
|
|
15458
|
-
const setColorMode = (0,
|
|
15478
|
+
const setColorMode = (0, import_react44.useCallback)(
|
|
15459
15479
|
(mode) => {
|
|
15460
15480
|
localStorage.setItem(LOCAL_COLOR_MODE_KEY, mode);
|
|
15461
15481
|
handleStoreColorMode(mode);
|
|
15462
15482
|
},
|
|
15463
15483
|
[handleStoreColorMode]
|
|
15464
15484
|
);
|
|
15465
|
-
(0,
|
|
15485
|
+
(0, import_react44.useEffect)(() => {
|
|
15466
15486
|
let targetColorMode = localStorage.getItem(LOCAL_COLOR_MODE_KEY);
|
|
15467
15487
|
if (!targetColorMode && !preferedColorMode) {
|
|
15468
15488
|
const systemMode = window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
|
@@ -15477,10 +15497,10 @@ function useColorMode() {
|
|
|
15477
15497
|
}, []);
|
|
15478
15498
|
return { colorMode, setColorMode };
|
|
15479
15499
|
}
|
|
15480
|
-
var
|
|
15500
|
+
var import_react44;
|
|
15481
15501
|
var init_useColorMode = __esm({
|
|
15482
15502
|
"src/hooks/useColorMode.ts"() {
|
|
15483
|
-
|
|
15503
|
+
import_react44 = require("react");
|
|
15484
15504
|
init_ProviderContext();
|
|
15485
15505
|
init_constants();
|
|
15486
15506
|
init_useLayoutStore();
|
|
@@ -15582,13 +15602,13 @@ var init_SumsubIframeManager = __esm({
|
|
|
15582
15602
|
function useSumsubIframe({ iframeUrl }) {
|
|
15583
15603
|
const config = useProviderConfig().config;
|
|
15584
15604
|
const { colorMode } = useColorMode();
|
|
15585
|
-
const iframeRef = (0,
|
|
15586
|
-
const [isLoading, setIsLoading] = (0,
|
|
15587
|
-
const [error, setError] = (0,
|
|
15588
|
-
const [height, setHeight] = (0,
|
|
15589
|
-
const [status, setStatus] = (0,
|
|
15605
|
+
const iframeRef = (0, import_react45.useRef)(null);
|
|
15606
|
+
const [isLoading, setIsLoading] = (0, import_react45.useState)(true);
|
|
15607
|
+
const [error, setError] = (0, import_react45.useState)(null);
|
|
15608
|
+
const [height, setHeight] = (0, import_react45.useState)(0);
|
|
15609
|
+
const [status, setStatus] = (0, import_react45.useState)("");
|
|
15590
15610
|
const levelName = config.current?.kyc?.options?.levelName;
|
|
15591
|
-
(0,
|
|
15611
|
+
(0, import_react45.useEffect)(() => {
|
|
15592
15612
|
setError(null);
|
|
15593
15613
|
setIsLoading(true);
|
|
15594
15614
|
setStatus("Preparing verification...");
|
|
@@ -15629,12 +15649,12 @@ function useSumsubIframe({ iframeUrl }) {
|
|
|
15629
15649
|
status
|
|
15630
15650
|
};
|
|
15631
15651
|
}
|
|
15632
|
-
var
|
|
15652
|
+
var import_react45;
|
|
15633
15653
|
var init_useSumsubIframe = __esm({
|
|
15634
15654
|
"src/internal/components/KYC/useSumsubIframe.ts"() {
|
|
15635
15655
|
init_ProviderContext();
|
|
15636
15656
|
init_useColorMode();
|
|
15637
|
-
|
|
15657
|
+
import_react45 = require("react");
|
|
15638
15658
|
init_sumsub();
|
|
15639
15659
|
init_SumsubIframeManager();
|
|
15640
15660
|
}
|
|
@@ -15839,9 +15859,9 @@ var init_LanguagesMenu2 = __esm({
|
|
|
15839
15859
|
|
|
15840
15860
|
// src/internal/auth/providers/common.ts
|
|
15841
15861
|
async function getLinkedProviders() {
|
|
15842
|
-
const hasValidToken = await (0,
|
|
15862
|
+
const hasValidToken = await (0, import_auth23.ensureValidToken)();
|
|
15843
15863
|
if (!hasValidToken) throw new Error("No authentication token available");
|
|
15844
|
-
const response = await (0,
|
|
15864
|
+
const response = await (0, import_auth23.authenticatedFetch)(`${getTssUrl3()}/api/auth/providers`, { method: "GET" });
|
|
15845
15865
|
if (!response.ok) {
|
|
15846
15866
|
const errorData = await response.json().catch(() => ({}));
|
|
15847
15867
|
throw new Error(errorData.message || `Failed to fetch providers: ${response.statusText}`);
|
|
@@ -15850,11 +15870,11 @@ async function getLinkedProviders() {
|
|
|
15850
15870
|
return data.providers;
|
|
15851
15871
|
}
|
|
15852
15872
|
async function unlinkProvider(providerType, externalId) {
|
|
15853
|
-
const hasValidToken = await (0,
|
|
15873
|
+
const hasValidToken = await (0, import_auth23.ensureValidToken)();
|
|
15854
15874
|
if (!hasValidToken) throw new Error("No authentication token available");
|
|
15855
15875
|
let url = `${getTssUrl3()}/api/auth/unlink/${providerType}`;
|
|
15856
15876
|
if (externalId) url += `?externalId=${encodeURIComponent(externalId)}`;
|
|
15857
|
-
const response = await (0,
|
|
15877
|
+
const response = await (0, import_auth23.authenticatedFetch)(url, { method: "DELETE" });
|
|
15858
15878
|
if (!response.ok) {
|
|
15859
15879
|
const errorData = await response.json().catch(() => ({}));
|
|
15860
15880
|
throw new Error(errorData.message || `Failed to unlink provider: ${response.statusText}`);
|
|
@@ -15862,12 +15882,12 @@ async function unlinkProvider(providerType, externalId) {
|
|
|
15862
15882
|
try {
|
|
15863
15883
|
const data = await response.json();
|
|
15864
15884
|
if (data?.accessToken && data?.refreshToken && data?.expiresIn) {
|
|
15865
|
-
|
|
15885
|
+
import_auth23.jwtTokenManager.setTokens({
|
|
15866
15886
|
accessToken: data.accessToken,
|
|
15867
15887
|
refreshToken: data.refreshToken,
|
|
15868
|
-
userId:
|
|
15888
|
+
userId: import_auth23.jwtTokenManager.getUserId() || "",
|
|
15869
15889
|
expiresIn: data.expiresIn,
|
|
15870
|
-
hasKeyshare:
|
|
15890
|
+
hasKeyshare: import_auth23.jwtTokenManager.getHasKeyshare() ?? false
|
|
15871
15891
|
});
|
|
15872
15892
|
}
|
|
15873
15893
|
} catch {
|
|
@@ -15908,7 +15928,7 @@ function MainMenu() {
|
|
|
15908
15928
|
const { t } = useT();
|
|
15909
15929
|
const setPage = useLayoutDataStore((st) => st.setPage);
|
|
15910
15930
|
const setTransitionPageHeight = useLayoutDataStore((st) => st.setTransitionPageHeight);
|
|
15911
|
-
(0,
|
|
15931
|
+
(0, import_react46.useEffect)(() => setTransitionPageHeight(DEFAULT_MAIN_MENU_HEIGHT), []);
|
|
15912
15932
|
useProvidersList();
|
|
15913
15933
|
return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("div", { className: "w-full p-[var(--ui-kit-pd)] flex flex-col gap-[var(--ui-kit-gap)]", children: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("div", { className: "w-full grid grid-cols-4 gap-0 md:gap-[var(--ui-kit-gap)] py-[10px] md:py-1", children: MAIN_MENU_BUTTONS.map(({ id, label, icon: Icon2 }) => /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)(
|
|
15914
15934
|
Button,
|
|
@@ -15926,13 +15946,13 @@ function MainMenu() {
|
|
|
15926
15946
|
id
|
|
15927
15947
|
)) }) });
|
|
15928
15948
|
}
|
|
15929
|
-
var import_lucide_react40,
|
|
15949
|
+
var import_lucide_react40, import_react46, import_jsx_runtime68, MAIN_MENU_BUTTONS;
|
|
15930
15950
|
var init_MainMenu = __esm({
|
|
15931
15951
|
"src/internal/components/MainMenu/MainMenu.tsx"() {
|
|
15932
15952
|
init_SessionContext();
|
|
15933
15953
|
init_useT();
|
|
15934
15954
|
import_lucide_react40 = require("lucide-react");
|
|
15935
|
-
|
|
15955
|
+
import_react46 = require("react");
|
|
15936
15956
|
init_constants();
|
|
15937
15957
|
init_useLayoutDataStore();
|
|
15938
15958
|
init_useProvidersList();
|
|
@@ -15970,7 +15990,7 @@ function useLinkedProfiles() {
|
|
|
15970
15990
|
});
|
|
15971
15991
|
let avatar2 = null;
|
|
15972
15992
|
try {
|
|
15973
|
-
avatar2 =
|
|
15993
|
+
avatar2 = import_auth23.jwtTokenManager.getAvatar() || null;
|
|
15974
15994
|
} catch {
|
|
15975
15995
|
avatar2 = null;
|
|
15976
15996
|
}
|
|
@@ -15978,16 +15998,16 @@ function useLinkedProfiles() {
|
|
|
15978
15998
|
}
|
|
15979
15999
|
});
|
|
15980
16000
|
const { profiles = [], avatar = null } = data || {};
|
|
15981
|
-
const refresh = (0,
|
|
16001
|
+
const refresh = (0, import_react47.useCallback)(async () => {
|
|
15982
16002
|
await qc.invalidateQueries({ queryKey: [LINKED_PROFILES_QUERY_KEY, address] });
|
|
15983
16003
|
}, [qc, address]);
|
|
15984
16004
|
return { profiles, avatar, isLoading, isFetching, error, refresh };
|
|
15985
16005
|
}
|
|
15986
|
-
var import_react_query25,
|
|
16006
|
+
var import_react_query25, import_react47, LINKED_PROFILES_QUERY_KEY;
|
|
15987
16007
|
var init_linkedProfiles = __esm({
|
|
15988
16008
|
"src/modules/linkedProfiles.ts"() {
|
|
15989
16009
|
import_react_query25 = require("@tanstack/react-query");
|
|
15990
|
-
|
|
16010
|
+
import_react47 = require("react");
|
|
15991
16011
|
init_SessionContext();
|
|
15992
16012
|
init_auth();
|
|
15993
16013
|
init_common();
|
|
@@ -15997,11 +16017,11 @@ var init_linkedProfiles = __esm({
|
|
|
15997
16017
|
});
|
|
15998
16018
|
|
|
15999
16019
|
// src/internal/components/ManageWalletMenu/hooks/useStore.ts
|
|
16000
|
-
var
|
|
16020
|
+
var import_zustand8, useManageWalletStore;
|
|
16001
16021
|
var init_useStore = __esm({
|
|
16002
16022
|
"src/internal/components/ManageWalletMenu/hooks/useStore.ts"() {
|
|
16003
|
-
|
|
16004
|
-
useManageWalletStore = (0,
|
|
16023
|
+
import_zustand8 = require("zustand");
|
|
16024
|
+
useManageWalletStore = (0, import_zustand8.create)((set) => ({
|
|
16005
16025
|
alert: null,
|
|
16006
16026
|
emailStep: "input",
|
|
16007
16027
|
email: "",
|
|
@@ -16135,9 +16155,9 @@ var init_EmailForm = __esm({
|
|
|
16135
16155
|
|
|
16136
16156
|
// src/internal/auth/providers/email.ts
|
|
16137
16157
|
async function sendEmailLinkCode(email) {
|
|
16138
|
-
const hasValidToken = await (0,
|
|
16158
|
+
const hasValidToken = await (0, import_auth23.ensureValidToken)();
|
|
16139
16159
|
if (!hasValidToken) throw new Error("No authentication token available");
|
|
16140
|
-
const response = await (0,
|
|
16160
|
+
const response = await (0, import_auth23.authenticatedFetch)(`${getTssUrl3()}/api/auth/link/email/send-code`, {
|
|
16141
16161
|
method: "POST",
|
|
16142
16162
|
body: JSON.stringify({ email })
|
|
16143
16163
|
});
|
|
@@ -16147,9 +16167,9 @@ async function sendEmailLinkCode(email) {
|
|
|
16147
16167
|
}
|
|
16148
16168
|
}
|
|
16149
16169
|
async function verifyEmailLinkCode(email, code) {
|
|
16150
|
-
const hasValidToken = await (0,
|
|
16170
|
+
const hasValidToken = await (0, import_auth23.ensureValidToken)();
|
|
16151
16171
|
if (!hasValidToken) throw new Error("No authentication token available");
|
|
16152
|
-
const response = await (0,
|
|
16172
|
+
const response = await (0, import_auth23.authenticatedFetch)(`${getTssUrl3()}/api/auth/link/email/verify-code`, {
|
|
16153
16173
|
method: "POST",
|
|
16154
16174
|
credentials: "include",
|
|
16155
16175
|
body: JSON.stringify({ email, code })
|
|
@@ -16435,7 +16455,7 @@ var init_AddProvider = __esm({
|
|
|
16435
16455
|
|
|
16436
16456
|
// src/internal/components/ManageWalletMenu/EmailNotConnectedWarning.tsx
|
|
16437
16457
|
function EmailNotConnectedWarning() {
|
|
16438
|
-
const providers =
|
|
16458
|
+
const providers = import_auth23.jwtTokenManager.getProviders();
|
|
16439
16459
|
const hasEmail = providers.includes("email");
|
|
16440
16460
|
const { t } = useT();
|
|
16441
16461
|
const config = useProviderConfig().config;
|
|
@@ -16478,7 +16498,7 @@ function useLinkSocial() {
|
|
|
16478
16498
|
const setPage = useLayoutDataStore((st) => st.setPage);
|
|
16479
16499
|
const isWalletLinking = useLayoutDataStore((st) => st.isWalletLinking);
|
|
16480
16500
|
const { providerType, linkIsLoading, setProviderType, setAlert, setLinkIsLoading } = useManageWalletStore();
|
|
16481
|
-
const handleLinkSocialProvider =
|
|
16501
|
+
const handleLinkSocialProvider = import_react48.default.useCallback(
|
|
16482
16502
|
async (providerIdRaw) => {
|
|
16483
16503
|
const providerKey = providerIdRaw.toLowerCase();
|
|
16484
16504
|
const normalizedKey = providerKey === "twitter" ? "x" : providerKey;
|
|
@@ -16502,11 +16522,11 @@ function useLinkSocial() {
|
|
|
16502
16522
|
mode: "link"
|
|
16503
16523
|
};
|
|
16504
16524
|
try {
|
|
16505
|
-
await (0,
|
|
16525
|
+
await (0, import_auth23.ensureValidToken)();
|
|
16506
16526
|
} catch (tokenError) {
|
|
16507
16527
|
console.warn("[ManageWallet] ensureValidToken failed before linking", tokenError);
|
|
16508
16528
|
}
|
|
16509
|
-
const accessToken =
|
|
16529
|
+
const accessToken = import_auth23.jwtTokenManager.getAccessToken();
|
|
16510
16530
|
if (accessToken) {
|
|
16511
16531
|
authConfig.token = accessToken;
|
|
16512
16532
|
}
|
|
@@ -16536,8 +16556,8 @@ function useLinkSocial() {
|
|
|
16536
16556
|
},
|
|
16537
16557
|
[config.social?.providers]
|
|
16538
16558
|
);
|
|
16539
|
-
const [socialLinkStarted, setSocialLinkStarted] =
|
|
16540
|
-
(0,
|
|
16559
|
+
const [socialLinkStarted, setSocialLinkStarted] = import_react48.default.useState(false);
|
|
16560
|
+
(0, import_react48.useEffect)(() => {
|
|
16541
16561
|
const key = providerType?.toLowerCase();
|
|
16542
16562
|
console.log("[useLinkSocial] Effect triggered:", { key, linkIsLoading, socialLinkStarted, isWalletLinking });
|
|
16543
16563
|
if (isWalletLinking) {
|
|
@@ -16555,7 +16575,7 @@ function useLinkSocial() {
|
|
|
16555
16575
|
}
|
|
16556
16576
|
}, [providerType, linkIsLoading, socialLinkStarted, isWalletLinking, handleLinkSocialProvider]);
|
|
16557
16577
|
}
|
|
16558
|
-
var import_react_query30,
|
|
16578
|
+
var import_react_query30, import_react48;
|
|
16559
16579
|
var init_useLinkSocial = __esm({
|
|
16560
16580
|
"src/internal/components/ManageWalletMenu/hooks/useLinkSocial.ts"() {
|
|
16561
16581
|
init_useLayoutDataStore();
|
|
@@ -16563,7 +16583,7 @@ var init_useLinkSocial = __esm({
|
|
|
16563
16583
|
init_SessionContext();
|
|
16564
16584
|
init_linkedProfiles();
|
|
16565
16585
|
import_react_query30 = require("@tanstack/react-query");
|
|
16566
|
-
|
|
16586
|
+
import_react48 = __toESM(require("react"), 1);
|
|
16567
16587
|
init_auth();
|
|
16568
16588
|
init_telegramBrowser();
|
|
16569
16589
|
init_useProvidersList();
|
|
@@ -16573,7 +16593,7 @@ var init_useLinkSocial = __esm({
|
|
|
16573
16593
|
|
|
16574
16594
|
// src/internal/auth/providers/telegram.ts
|
|
16575
16595
|
async function linkTelegram(telegramData) {
|
|
16576
|
-
const hasValidToken = await (0,
|
|
16596
|
+
const hasValidToken = await (0, import_auth23.ensureValidToken)();
|
|
16577
16597
|
if (!hasValidToken) throw new Error("No authentication token available");
|
|
16578
16598
|
const formattedData = {
|
|
16579
16599
|
id: telegramData.id,
|
|
@@ -16584,7 +16604,7 @@ async function linkTelegram(telegramData) {
|
|
|
16584
16604
|
if (telegramData.last_name) formattedData.last_name = telegramData.last_name;
|
|
16585
16605
|
if (telegramData.username) formattedData.username = telegramData.username;
|
|
16586
16606
|
if (telegramData.photo_url) formattedData.photo_url = telegramData.photo_url;
|
|
16587
|
-
const response = await (0,
|
|
16607
|
+
const response = await (0, import_auth23.authenticatedFetch)(`${getTssUrl3()}/api/auth/link/telegram`, {
|
|
16588
16608
|
method: "POST",
|
|
16589
16609
|
body: JSON.stringify(formattedData)
|
|
16590
16610
|
});
|
|
@@ -16632,7 +16652,7 @@ function useLinkTelegram() {
|
|
|
16632
16652
|
const isWalletLinking = useLayoutDataStore((st) => st.isWalletLinking);
|
|
16633
16653
|
const { providerType, linkIsLoading, setLinkIsLoading, setProviderType, setAlert } = useManageWalletStore();
|
|
16634
16654
|
const setPage = useLayoutDataStore((st) => st.setPage);
|
|
16635
|
-
const handleLinkTelegram = (0,
|
|
16655
|
+
const handleLinkTelegram = (0, import_react49.useCallback)(async () => {
|
|
16636
16656
|
try {
|
|
16637
16657
|
if (shouldBlockSocialAuthInTelegram("telegram")) {
|
|
16638
16658
|
setAlert(buildTelegramBrowserRestriction("Telegram", "linking"));
|
|
@@ -16679,8 +16699,8 @@ function useLinkTelegram() {
|
|
|
16679
16699
|
setLinkIsLoading(false);
|
|
16680
16700
|
}
|
|
16681
16701
|
}, [config.social?.providers]);
|
|
16682
|
-
const [telegramLinkStarted, setTelegramLinkStarted] = (0,
|
|
16683
|
-
(0,
|
|
16702
|
+
const [telegramLinkStarted, setTelegramLinkStarted] = (0, import_react49.useState)(false);
|
|
16703
|
+
(0, import_react49.useEffect)(() => {
|
|
16684
16704
|
console.log("[useLinkTelegram] Effect triggered:", {
|
|
16685
16705
|
providerType,
|
|
16686
16706
|
linkIsLoading,
|
|
@@ -16697,20 +16717,20 @@ function useLinkTelegram() {
|
|
|
16697
16717
|
handleLinkTelegram();
|
|
16698
16718
|
}
|
|
16699
16719
|
}, [providerType, handleLinkTelegram, linkIsLoading, telegramLinkStarted, isWalletLinking]);
|
|
16700
|
-
(0,
|
|
16720
|
+
(0, import_react49.useEffect)(() => {
|
|
16701
16721
|
if (providerType !== "telegram") {
|
|
16702
16722
|
setTelegramLinkStarted(false);
|
|
16703
16723
|
}
|
|
16704
16724
|
}, [providerType]);
|
|
16705
16725
|
}
|
|
16706
|
-
var import_react_query31,
|
|
16726
|
+
var import_react_query31, import_react49;
|
|
16707
16727
|
var init_useLinkTelegram = __esm({
|
|
16708
16728
|
"src/internal/components/ManageWalletMenu/hooks/useLinkTelegram.ts"() {
|
|
16709
16729
|
init_ProviderContext();
|
|
16710
16730
|
init_SessionContext();
|
|
16711
16731
|
init_linkedProfiles();
|
|
16712
16732
|
import_react_query31 = require("@tanstack/react-query");
|
|
16713
|
-
|
|
16733
|
+
import_react49 = require("react");
|
|
16714
16734
|
init_telegram2();
|
|
16715
16735
|
init_useLayoutDataStore();
|
|
16716
16736
|
init_telegramBrowser();
|
|
@@ -16843,7 +16863,7 @@ function ManageWalletMenu() {
|
|
|
16843
16863
|
} = useManageWalletStore();
|
|
16844
16864
|
const configuredProviders = getConfiguredProviders(config.current);
|
|
16845
16865
|
const { data: providers = [], isLoading: isProvidersLoading, error: providersError } = useProvidersList();
|
|
16846
|
-
const renderProviders = (0,
|
|
16866
|
+
const renderProviders = (0, import_react50.useMemo)(() => {
|
|
16847
16867
|
const normalizeProviderName = (name) => {
|
|
16848
16868
|
if (name === "x") return "twitter";
|
|
16849
16869
|
return name;
|
|
@@ -16965,7 +16985,7 @@ function ManageWalletMenu() {
|
|
|
16965
16985
|
}
|
|
16966
16986
|
);
|
|
16967
16987
|
}
|
|
16968
|
-
var import_lodash_es8, import_lucide_react44,
|
|
16988
|
+
var import_lodash_es8, import_lucide_react44, import_react50, import_jsx_runtime73, POSSIBLE_PROVIDERS, MULTI_PROVIDERS;
|
|
16969
16989
|
var init_ManageWallet = __esm({
|
|
16970
16990
|
"src/internal/components/ManageWalletMenu/ManageWallet.tsx"() {
|
|
16971
16991
|
init_useLayoutDataStore();
|
|
@@ -16974,7 +16994,7 @@ var init_ManageWallet = __esm({
|
|
|
16974
16994
|
init_i18n();
|
|
16975
16995
|
import_lodash_es8 = require("lodash-es");
|
|
16976
16996
|
import_lucide_react44 = require("lucide-react");
|
|
16977
|
-
|
|
16997
|
+
import_react50 = require("react");
|
|
16978
16998
|
init_constants();
|
|
16979
16999
|
init_telegramBrowser();
|
|
16980
17000
|
init_Expandable2();
|
|
@@ -17001,48 +17021,17 @@ var init_ManageWallet = __esm({
|
|
|
17001
17021
|
}
|
|
17002
17022
|
});
|
|
17003
17023
|
|
|
17004
|
-
// src/internal/stores/useExternalWalletStore.ts
|
|
17005
|
-
var import_zustand8, useExternalWalletStore;
|
|
17006
|
-
var init_useExternalWalletStore = __esm({
|
|
17007
|
-
"src/internal/stores/useExternalWalletStore.ts"() {
|
|
17008
|
-
import_zustand8 = require("zustand");
|
|
17009
|
-
useExternalWalletStore = (0, import_zustand8.create)((set) => ({
|
|
17010
|
-
configMode: "linked",
|
|
17011
|
-
activeMode: "linked",
|
|
17012
|
-
externalAddress: null,
|
|
17013
|
-
externalChainId: null,
|
|
17014
|
-
isExternalConnected: false,
|
|
17015
|
-
connectorName: null,
|
|
17016
|
-
setConfigMode: (mode) => set({ configMode: mode }),
|
|
17017
|
-
setActiveMode: (mode) => set({ activeMode: mode }),
|
|
17018
|
-
setExternalWallet: ({ address, chainId, connectorName }) => set({
|
|
17019
|
-
externalAddress: address,
|
|
17020
|
-
externalChainId: chainId,
|
|
17021
|
-
isExternalConnected: true,
|
|
17022
|
-
connectorName
|
|
17023
|
-
}),
|
|
17024
|
-
clearExternalWallet: () => set({
|
|
17025
|
-
externalAddress: null,
|
|
17026
|
-
externalChainId: null,
|
|
17027
|
-
isExternalConnected: false,
|
|
17028
|
-
connectorName: null
|
|
17029
|
-
}),
|
|
17030
|
-
setExternalChainId: (chainId) => set({ externalChainId: chainId })
|
|
17031
|
-
}));
|
|
17032
|
-
}
|
|
17033
|
-
});
|
|
17034
|
-
|
|
17035
17024
|
// src/internal/components/ManageWalletMenu/UnlinkProviderMenu.tsx
|
|
17036
17025
|
function UnlinkProviderMenu() {
|
|
17037
17026
|
const qc = (0, import_react_query32.useQueryClient)();
|
|
17038
17027
|
const address = useSession((st) => st.address);
|
|
17039
17028
|
const { callbacksRef } = useProviderConfig();
|
|
17040
|
-
const { disconnect: disconnectExternalWallet } = (0,
|
|
17029
|
+
const { disconnect: disconnectExternalWallet } = (0, import_wagmi2.useDisconnect)();
|
|
17041
17030
|
const isExternalConnected = useExternalWalletStore((st) => st.isExternalConnected);
|
|
17042
17031
|
const { t } = useT();
|
|
17043
17032
|
const setPage = useLayoutDataStore((st) => st.setPage);
|
|
17044
17033
|
const { confirmUnlink, setConfirmUnlink, setAlert } = useManageWalletStore();
|
|
17045
|
-
const [confirmInput, setConfirmInput] = (0,
|
|
17034
|
+
const [confirmInput, setConfirmInput] = (0, import_react51.useState)("");
|
|
17046
17035
|
const { mutate: handleUnlinkProvider, isPending: isProviderUnlinking } = (0, import_react_query32.useMutation)({
|
|
17047
17036
|
mutationFn: async () => {
|
|
17048
17037
|
if (!confirmUnlink) {
|
|
@@ -17124,7 +17113,7 @@ function UnlinkProviderMenu() {
|
|
|
17124
17113
|
] })
|
|
17125
17114
|
] });
|
|
17126
17115
|
}
|
|
17127
|
-
var import_react_query32, import_lucide_react45,
|
|
17116
|
+
var import_react_query32, import_lucide_react45, import_react51, import_wagmi2, import_jsx_runtime74;
|
|
17128
17117
|
var init_UnlinkProviderMenu = __esm({
|
|
17129
17118
|
"src/internal/components/ManageWalletMenu/UnlinkProviderMenu.tsx"() {
|
|
17130
17119
|
init_useLayoutDataStore();
|
|
@@ -17134,8 +17123,8 @@ var init_UnlinkProviderMenu = __esm({
|
|
|
17134
17123
|
init_linkedProfiles();
|
|
17135
17124
|
import_react_query32 = require("@tanstack/react-query");
|
|
17136
17125
|
import_lucide_react45 = require("lucide-react");
|
|
17137
|
-
|
|
17138
|
-
|
|
17126
|
+
import_react51 = require("react");
|
|
17127
|
+
import_wagmi2 = require("wagmi");
|
|
17139
17128
|
init_auth();
|
|
17140
17129
|
init_useExternalWalletStore();
|
|
17141
17130
|
init_button();
|
|
@@ -17293,7 +17282,7 @@ function NicknameEditForm(props) {
|
|
|
17293
17282
|
const { t } = useT();
|
|
17294
17283
|
const passportWalletAddress = useSession((st) => st.address);
|
|
17295
17284
|
const { callbacksRef } = useProviderConfig();
|
|
17296
|
-
const [isNicknameCopied, setIsNicknameCopied] = (0,
|
|
17285
|
+
const [isNicknameCopied, setIsNicknameCopied] = (0, import_react52.useState)(false);
|
|
17297
17286
|
const {
|
|
17298
17287
|
mutate: changeNickname2,
|
|
17299
17288
|
isError: isNicknameChangeError,
|
|
@@ -17325,7 +17314,7 @@ function NicknameEditForm(props) {
|
|
|
17325
17314
|
);
|
|
17326
17315
|
}
|
|
17327
17316
|
});
|
|
17328
|
-
const handleInputChange = (0,
|
|
17317
|
+
const handleInputChange = (0, import_react52.useCallback)(
|
|
17329
17318
|
(e) => {
|
|
17330
17319
|
const value = e.target.value;
|
|
17331
17320
|
setInputValue(value);
|
|
@@ -17339,7 +17328,7 @@ function NicknameEditForm(props) {
|
|
|
17339
17328
|
},
|
|
17340
17329
|
[clientError, isNicknameChangeError, isNicknameChangeSuccess, reset, t]
|
|
17341
17330
|
);
|
|
17342
|
-
const handleSubmit = (0,
|
|
17331
|
+
const handleSubmit = (0, import_react52.useCallback)(
|
|
17343
17332
|
(e) => {
|
|
17344
17333
|
if (!canChange) return;
|
|
17345
17334
|
e.preventDefault();
|
|
@@ -17403,7 +17392,7 @@ function NicknameEditForm(props) {
|
|
|
17403
17392
|
!!canChange && /* @__PURE__ */ (0, import_jsx_runtime76.jsx)("span", { className: "w-full flex items-center leadding-4 text-[10px]", children: t("passport:nicknameMenu.hint") })
|
|
17404
17393
|
] });
|
|
17405
17394
|
}
|
|
17406
|
-
var import_react_query33, import_lucide_react47,
|
|
17395
|
+
var import_react_query33, import_lucide_react47, import_react52, import_jsx_runtime76;
|
|
17407
17396
|
var init_NicknameEditForm = __esm({
|
|
17408
17397
|
"src/internal/components/NicknameMenu/NicknameEditForm.tsx"() {
|
|
17409
17398
|
init_ProviderContext();
|
|
@@ -17411,7 +17400,7 @@ var init_NicknameEditForm = __esm({
|
|
|
17411
17400
|
init_i18n();
|
|
17412
17401
|
import_react_query33 = require("@tanstack/react-query");
|
|
17413
17402
|
import_lucide_react47 = require("lucide-react");
|
|
17414
|
-
|
|
17403
|
+
import_react52 = require("react");
|
|
17415
17404
|
init_PositiveIcon();
|
|
17416
17405
|
init_nickname();
|
|
17417
17406
|
init_profile();
|
|
@@ -17427,17 +17416,17 @@ var init_NicknameEditForm = __esm({
|
|
|
17427
17416
|
|
|
17428
17417
|
// src/internal/components/NicknameMenu/useNickname.ts
|
|
17429
17418
|
function useNicknameForm(currentNickname) {
|
|
17430
|
-
const [inputValue, setInputValue] = (0,
|
|
17419
|
+
const [inputValue, setInputValue] = (0, import_react53.useState)("");
|
|
17431
17420
|
const normalizedInputValue = normalizeNickname(inputValue);
|
|
17432
17421
|
const validation = validateNickname(inputValue);
|
|
17433
17422
|
const isValidForCheck = validation.valid && normalizedInputValue.length > 0;
|
|
17434
|
-
(0,
|
|
17423
|
+
(0, import_react53.useEffect)(() => {
|
|
17435
17424
|
setInputValue(currentNickname);
|
|
17436
17425
|
}, [currentNickname]);
|
|
17437
|
-
const [queryInputValue, setQueryInputValue] = (0,
|
|
17426
|
+
const [queryInputValue, setQueryInputValue] = (0, import_react53.useState)("");
|
|
17438
17427
|
const isSameAsCurrentNickname = normalizedInputValue === currentNickname.toLowerCase();
|
|
17439
17428
|
const shouldCheckAvailability = validation.valid && !isSameAsCurrentNickname && inputValue.length > 0;
|
|
17440
|
-
(0,
|
|
17429
|
+
(0, import_react53.useEffect)(() => {
|
|
17441
17430
|
if (!isValidForCheck || !shouldCheckAvailability) {
|
|
17442
17431
|
setQueryInputValue("");
|
|
17443
17432
|
return;
|
|
@@ -17466,11 +17455,11 @@ function useNicknameForm(currentNickname) {
|
|
|
17466
17455
|
availabilityQuery: query
|
|
17467
17456
|
};
|
|
17468
17457
|
}
|
|
17469
|
-
var import_react_query34,
|
|
17458
|
+
var import_react_query34, import_react53, DEBOUNCE_MS;
|
|
17470
17459
|
var init_useNickname = __esm({
|
|
17471
17460
|
"src/internal/components/NicknameMenu/useNickname.ts"() {
|
|
17472
17461
|
import_react_query34 = require("@tanstack/react-query");
|
|
17473
|
-
|
|
17462
|
+
import_react53 = require("react");
|
|
17474
17463
|
init_nickname();
|
|
17475
17464
|
init_profile();
|
|
17476
17465
|
init_nickname_validation();
|
|
@@ -17482,7 +17471,7 @@ var init_useNickname = __esm({
|
|
|
17482
17471
|
function NicknameMenu() {
|
|
17483
17472
|
const address = useSession((st) => st.address);
|
|
17484
17473
|
const { t } = useT();
|
|
17485
|
-
const [clientError, setClientError] = (0,
|
|
17474
|
+
const [clientError, setClientError] = (0, import_react54.useState)(null);
|
|
17486
17475
|
const setPage = useLayoutDataStore((st) => st.setPage);
|
|
17487
17476
|
const maxScrollHeight = useLayoutStore((st) => st.maxScrollHeight);
|
|
17488
17477
|
const {
|
|
@@ -17569,7 +17558,7 @@ function NicknameMenu() {
|
|
|
17569
17558
|
}
|
|
17570
17559
|
);
|
|
17571
17560
|
}
|
|
17572
|
-
var import_react_query35, import_dayjs4, import_lucide_react48,
|
|
17561
|
+
var import_react_query35, import_dayjs4, import_lucide_react48, import_react54, import_jsx_runtime77;
|
|
17573
17562
|
var init_NicknameMenu = __esm({
|
|
17574
17563
|
"src/internal/components/NicknameMenu/NicknameMenu.tsx"() {
|
|
17575
17564
|
init_SessionContext();
|
|
@@ -17577,7 +17566,7 @@ var init_NicknameMenu = __esm({
|
|
|
17577
17566
|
import_react_query35 = require("@tanstack/react-query");
|
|
17578
17567
|
import_dayjs4 = __toESM(require("dayjs"), 1);
|
|
17579
17568
|
import_lucide_react48 = require("lucide-react");
|
|
17580
|
-
|
|
17569
|
+
import_react54 = require("react");
|
|
17581
17570
|
init_nickname();
|
|
17582
17571
|
init_profile();
|
|
17583
17572
|
init_useLayoutDataStore();
|
|
@@ -17604,7 +17593,7 @@ var init_NicknameMenu2 = __esm({
|
|
|
17604
17593
|
function getCachedPublicClient(chainId) {
|
|
17605
17594
|
const cachedClient = publicClientByChainId.get(chainId);
|
|
17606
17595
|
if (cachedClient) return cachedClient;
|
|
17607
|
-
const publicClient = (0,
|
|
17596
|
+
const publicClient = (0, import_read14.createPublicClientForChain)(chainId);
|
|
17608
17597
|
publicClientByChainId.set(chainId, publicClient);
|
|
17609
17598
|
return publicClient;
|
|
17610
17599
|
}
|
|
@@ -17614,11 +17603,11 @@ function useResolvedPublicClient(chainId, logScope = "useResolvedPublicClient")
|
|
|
17614
17603
|
const activeChainConfig = useSession((st) => st.chainConfig);
|
|
17615
17604
|
const resolvedChainId = chainId ?? activeChainId;
|
|
17616
17605
|
const shouldUseActiveClient = !chainId || chainId === activeChainId;
|
|
17617
|
-
const chainConfig = (0,
|
|
17606
|
+
const chainConfig = (0, import_react55.useMemo)(() => {
|
|
17618
17607
|
if (shouldUseActiveClient) return activeChainConfig;
|
|
17619
|
-
return (0,
|
|
17608
|
+
return (0, import_read14.getChainConfig)(chainId);
|
|
17620
17609
|
}, [activeChainConfig, chainId, shouldUseActiveClient]);
|
|
17621
|
-
const publicClient = (0,
|
|
17610
|
+
const publicClient = (0, import_react55.useMemo)(() => {
|
|
17622
17611
|
if (shouldUseActiveClient) return activePublicClient;
|
|
17623
17612
|
if (!chainId) return activePublicClient;
|
|
17624
17613
|
try {
|
|
@@ -17635,12 +17624,12 @@ function useResolvedPublicClient(chainId, logScope = "useResolvedPublicClient")
|
|
|
17635
17624
|
resolvedChainId
|
|
17636
17625
|
};
|
|
17637
17626
|
}
|
|
17638
|
-
var
|
|
17627
|
+
var import_read14, import_react55, publicClientByChainId;
|
|
17639
17628
|
var init_useResolvedPublicClient = __esm({
|
|
17640
17629
|
"src/internal/hooks/useResolvedPublicClient.ts"() {
|
|
17641
17630
|
init_SessionContext();
|
|
17642
|
-
|
|
17643
|
-
|
|
17631
|
+
import_read14 = require("@embarkai/core/read");
|
|
17632
|
+
import_react55 = require("react");
|
|
17644
17633
|
publicClientByChainId = /* @__PURE__ */ new Map();
|
|
17645
17634
|
}
|
|
17646
17635
|
});
|
|
@@ -17650,7 +17639,7 @@ function useWatchTokens(options) {
|
|
|
17650
17639
|
const { address, chainId, enabled = true } = options;
|
|
17651
17640
|
const { config } = useProviderConfig();
|
|
17652
17641
|
const { publicClient, resolvedChainId } = useResolvedPublicClient(chainId, "useWatchTokens");
|
|
17653
|
-
const watchTokens = (0,
|
|
17642
|
+
const watchTokens = (0, import_react56.useMemo)(() => {
|
|
17654
17643
|
const allWatchTokens = config.current.watchTokens;
|
|
17655
17644
|
const tokensForChain = resolvedChainId ? allWatchTokens?.[resolvedChainId] || [] : [];
|
|
17656
17645
|
return tokensForChain;
|
|
@@ -17732,12 +17721,12 @@ function useWatchTokens(options) {
|
|
|
17732
17721
|
refetch
|
|
17733
17722
|
};
|
|
17734
17723
|
}
|
|
17735
|
-
var import_react_query36,
|
|
17724
|
+
var import_react_query36, import_react56, import_viem6, WATCH_TOKENS_QUERY_KEY;
|
|
17736
17725
|
var init_useWatchTokens = __esm({
|
|
17737
17726
|
"src/internal/hooks/useWatchTokens.ts"() {
|
|
17738
17727
|
init_ProviderContext();
|
|
17739
17728
|
import_react_query36 = require("@tanstack/react-query");
|
|
17740
|
-
|
|
17729
|
+
import_react56 = require("react");
|
|
17741
17730
|
import_viem6 = require("viem");
|
|
17742
17731
|
init_useResolvedPublicClient();
|
|
17743
17732
|
WATCH_TOKENS_QUERY_KEY = "watch-tokens";
|
|
@@ -17875,11 +17864,11 @@ function useBlockscoutAssets(options) {
|
|
|
17875
17864
|
const customTokenBalancesQuery = portfolioConfig?.tokenBalancesQuery;
|
|
17876
17865
|
const customTokenBalancesQueryKey = portfolioConfig?.tokenBalancesQueryKey;
|
|
17877
17866
|
const blockscoutApiUrl = getBlockscoutApiUrl(chainConfig);
|
|
17878
|
-
const blockscoutClient = (0,
|
|
17867
|
+
const blockscoutClient = (0, import_react57.useMemo)(
|
|
17879
17868
|
() => blockscoutApiUrl ? (0, import_clients2.createBlockscoutClient)({ baseUrl: blockscoutApiUrl }) : null,
|
|
17880
17869
|
[blockscoutApiUrl]
|
|
17881
17870
|
);
|
|
17882
|
-
const lastRefreshRef = (0,
|
|
17871
|
+
const lastRefreshRef = (0, import_react57.useRef)(0);
|
|
17883
17872
|
const {
|
|
17884
17873
|
assets: watchTokenAssets,
|
|
17885
17874
|
isLoading: watchTokensLoading,
|
|
@@ -17948,7 +17937,7 @@ function useBlockscoutAssets(options) {
|
|
|
17948
17937
|
retry: 2,
|
|
17949
17938
|
retryDelay: 1e3
|
|
17950
17939
|
});
|
|
17951
|
-
const erc20TokenAddresses = (0,
|
|
17940
|
+
const erc20TokenAddresses = (0, import_react57.useMemo)(() => {
|
|
17952
17941
|
if (!tokenBalances) return [];
|
|
17953
17942
|
return tokenBalances.filter((tb) => tb.token.type === "ERC-20").map((tb) => tb.token.address_hash);
|
|
17954
17943
|
}, [tokenBalances]);
|
|
@@ -17992,7 +17981,7 @@ function useBlockscoutAssets(options) {
|
|
|
17992
17981
|
gcTime: BLOCKSCOUT_QUERY_GC_TIME,
|
|
17993
17982
|
retry: 1
|
|
17994
17983
|
});
|
|
17995
|
-
const assets = (0,
|
|
17984
|
+
const assets = (0, import_react57.useMemo)(() => {
|
|
17996
17985
|
const result = [];
|
|
17997
17986
|
const addedAddresses = /* @__PURE__ */ new Set();
|
|
17998
17987
|
if (nativeBalanceData) {
|
|
@@ -18038,7 +18027,7 @@ function useBlockscoutAssets(options) {
|
|
|
18038
18027
|
}
|
|
18039
18028
|
return result;
|
|
18040
18029
|
}, [nativeBalanceData, tokenBalances, nftItems, erc3643Results, watchTokenAssets, chainConfig]);
|
|
18041
|
-
const nativeBalance = (0,
|
|
18030
|
+
const nativeBalance = (0, import_react57.useMemo)(() => {
|
|
18042
18031
|
if (!nativeBalanceData) return null;
|
|
18043
18032
|
return {
|
|
18044
18033
|
value: nativeBalanceData.value,
|
|
@@ -18046,11 +18035,11 @@ function useBlockscoutAssets(options) {
|
|
|
18046
18035
|
symbol: nativeBalanceData.symbol
|
|
18047
18036
|
};
|
|
18048
18037
|
}, [nativeBalanceData]);
|
|
18049
|
-
const error = (0,
|
|
18038
|
+
const error = (0, import_react57.useMemo)(() => {
|
|
18050
18039
|
if (!tokensError) return null;
|
|
18051
18040
|
return createError(tokensError);
|
|
18052
18041
|
}, [tokensError]);
|
|
18053
|
-
const refreshBalances = (0,
|
|
18042
|
+
const refreshBalances = (0, import_react57.useCallback)(async () => {
|
|
18054
18043
|
const now = Date.now();
|
|
18055
18044
|
if (now - lastRefreshRef.current < BLOCKSCOUT_REFRESH_DEBOUNCE) {
|
|
18056
18045
|
return;
|
|
@@ -18058,7 +18047,7 @@ function useBlockscoutAssets(options) {
|
|
|
18058
18047
|
lastRefreshRef.current = now;
|
|
18059
18048
|
await Promise.all([refetchNative(), refetchTokens(), refetchNfts(), refetchWatchTokens()]);
|
|
18060
18049
|
}, [refetchNative, refetchTokens, refetchNfts, refetchWatchTokens]);
|
|
18061
|
-
const getTokenBalance = (0,
|
|
18050
|
+
const getTokenBalance = (0, import_react57.useCallback)(
|
|
18062
18051
|
(tokenAddress) => {
|
|
18063
18052
|
return assets.find((a) => a.address?.toLowerCase() === tokenAddress.toLowerCase()) || null;
|
|
18064
18053
|
},
|
|
@@ -18076,13 +18065,13 @@ function useBlockscoutAssets(options) {
|
|
|
18076
18065
|
lastUpdated: dataUpdatedAt || null
|
|
18077
18066
|
};
|
|
18078
18067
|
}
|
|
18079
|
-
var import_clients2, import_react_query37,
|
|
18068
|
+
var import_clients2, import_react_query37, import_react57, import_viem7, BLOCKSCOUT_QUERY_KEY, ERC3643_DETECTION_QUERY_KEY, ERC3643_ABI;
|
|
18080
18069
|
var init_useBlockscoutAssets = __esm({
|
|
18081
18070
|
"src/internal/hooks/useBlockscoutAssets.ts"() {
|
|
18082
18071
|
init_ProviderContext();
|
|
18083
18072
|
import_clients2 = require("@embarkai/core/clients");
|
|
18084
18073
|
import_react_query37 = require("@tanstack/react-query");
|
|
18085
|
-
|
|
18074
|
+
import_react57 = require("react");
|
|
18086
18075
|
import_viem7 = require("viem");
|
|
18087
18076
|
init_initial();
|
|
18088
18077
|
init_constants();
|
|
@@ -18199,8 +18188,8 @@ async function resolveAssetRate(symbol, address, customAssetRateQuery) {
|
|
|
18199
18188
|
}
|
|
18200
18189
|
function PortfolioItemImage(props) {
|
|
18201
18190
|
const { asset } = props;
|
|
18202
|
-
const [nftImageError, setNftImageError] = (0,
|
|
18203
|
-
const [logoError, setLogoError] = (0,
|
|
18191
|
+
const [nftImageError, setNftImageError] = (0, import_react58.useState)(false);
|
|
18192
|
+
const [logoError, setLogoError] = (0, import_react58.useState)(false);
|
|
18204
18193
|
const isNft = isNftAsset(asset);
|
|
18205
18194
|
const nftImage = getNftImage(asset);
|
|
18206
18195
|
const isSecurity = isSecurityToken(asset);
|
|
@@ -18315,14 +18304,14 @@ function PortfolioItem(props) {
|
|
|
18315
18304
|
}
|
|
18316
18305
|
);
|
|
18317
18306
|
}
|
|
18318
|
-
var import_react_query38, import_lucide_react49,
|
|
18307
|
+
var import_react_query38, import_lucide_react49, import_react58, import_viem9, import_jsx_runtime79, SKIP_SYMBOLS2, ASSETS_RATES_QUERY_KEY;
|
|
18319
18308
|
var init_PortfolioItem = __esm({
|
|
18320
18309
|
"src/internal/components/PortfolioMenu/PortfolioItem.tsx"() {
|
|
18321
18310
|
init_ProviderContext();
|
|
18322
18311
|
init_tokens();
|
|
18323
18312
|
import_react_query38 = require("@tanstack/react-query");
|
|
18324
18313
|
import_lucide_react49 = require("lucide-react");
|
|
18325
|
-
|
|
18314
|
+
import_react58 = require("react");
|
|
18326
18315
|
import_viem9 = require("viem");
|
|
18327
18316
|
init_base();
|
|
18328
18317
|
init_priceFormatter();
|
|
@@ -18354,7 +18343,7 @@ function PortfolioMenu() {
|
|
|
18354
18343
|
enabled: !!address
|
|
18355
18344
|
});
|
|
18356
18345
|
const shownProjectAssests = projectAssets.filter((asset) => !asset.hideInPortfolio);
|
|
18357
|
-
const refreshAllAssetsBalances = (0,
|
|
18346
|
+
const refreshAllAssetsBalances = (0, import_react59.useCallback)(() => {
|
|
18358
18347
|
Promise.all(shownProjectAssests.map((asset) => qc.invalidateQueries({ queryKey: asset.balanceQueryKey })));
|
|
18359
18348
|
refreshBlockscoutBalances();
|
|
18360
18349
|
}, [qc, shownProjectAssests, refreshBlockscoutBalances]);
|
|
@@ -18404,7 +18393,7 @@ function PortfolioMenu() {
|
|
|
18404
18393
|
}
|
|
18405
18394
|
);
|
|
18406
18395
|
}
|
|
18407
|
-
var import_react_query39, import_lucide_react50,
|
|
18396
|
+
var import_react_query39, import_lucide_react50, import_react59, import_jsx_runtime80;
|
|
18408
18397
|
var init_PortfolioMenu = __esm({
|
|
18409
18398
|
"src/internal/components/PortfolioMenu/PortfolioMenu.tsx"() {
|
|
18410
18399
|
init_ProviderContext();
|
|
@@ -18412,7 +18401,7 @@ var init_PortfolioMenu = __esm({
|
|
|
18412
18401
|
init_i18n();
|
|
18413
18402
|
import_react_query39 = require("@tanstack/react-query");
|
|
18414
18403
|
import_lucide_react50 = require("lucide-react");
|
|
18415
|
-
|
|
18404
|
+
import_react59 = require("react");
|
|
18416
18405
|
init_useBlockscoutAssets();
|
|
18417
18406
|
init_useLayoutDataStore();
|
|
18418
18407
|
init_useLayoutStore();
|
|
@@ -18521,10 +18510,10 @@ function ReceiveMenu() {
|
|
|
18521
18510
|
const { t } = useT();
|
|
18522
18511
|
const maxScrollHeight = useLayoutStore((st) => st.maxScrollHeight);
|
|
18523
18512
|
const open = page === "receive";
|
|
18524
|
-
const [qrCodeUrl, setQrCodeUrl] = (0,
|
|
18525
|
-
const [copied, setCopied] = (0,
|
|
18526
|
-
const [fingerprintCopied, setFingerprintCopied] = (0,
|
|
18527
|
-
const fingerprint = (0,
|
|
18513
|
+
const [qrCodeUrl, setQrCodeUrl] = (0, import_react60.useState)("");
|
|
18514
|
+
const [copied, setCopied] = (0, import_react60.useState)(false);
|
|
18515
|
+
const [fingerprintCopied, setFingerprintCopied] = (0, import_react60.useState)(false);
|
|
18516
|
+
const fingerprint = (0, import_react60.useMemo)(() => {
|
|
18528
18517
|
if (!session?.ownerAddress) return null;
|
|
18529
18518
|
try {
|
|
18530
18519
|
return generateFingerprint(session.ownerAddress);
|
|
@@ -18532,7 +18521,7 @@ function ReceiveMenu() {
|
|
|
18532
18521
|
return null;
|
|
18533
18522
|
}
|
|
18534
18523
|
}, [session?.ownerAddress]);
|
|
18535
|
-
(0,
|
|
18524
|
+
(0, import_react60.useEffect)(() => {
|
|
18536
18525
|
if (open && address) {
|
|
18537
18526
|
import_qrcode.default.toDataURL(address, {
|
|
18538
18527
|
width: 200,
|
|
@@ -18545,7 +18534,7 @@ function ReceiveMenu() {
|
|
|
18545
18534
|
});
|
|
18546
18535
|
}
|
|
18547
18536
|
}, [open, address]);
|
|
18548
|
-
const handleCopy = (0,
|
|
18537
|
+
const handleCopy = (0, import_react60.useCallback)(async () => {
|
|
18549
18538
|
if (!address) return;
|
|
18550
18539
|
try {
|
|
18551
18540
|
await navigator.clipboard.writeText(address);
|
|
@@ -18555,7 +18544,7 @@ function ReceiveMenu() {
|
|
|
18555
18544
|
console.error("Failed to copy address:", error);
|
|
18556
18545
|
}
|
|
18557
18546
|
}, [address]);
|
|
18558
|
-
const handleCopyFingerprint = (0,
|
|
18547
|
+
const handleCopyFingerprint = (0, import_react60.useCallback)(async () => {
|
|
18559
18548
|
if (!fingerprint) return;
|
|
18560
18549
|
try {
|
|
18561
18550
|
await navigator.clipboard.writeText(fingerprint);
|
|
@@ -18616,14 +18605,14 @@ function ReceiveMenu() {
|
|
|
18616
18605
|
}
|
|
18617
18606
|
);
|
|
18618
18607
|
}
|
|
18619
|
-
var import_lucide_react51, import_qrcode,
|
|
18608
|
+
var import_lucide_react51, import_qrcode, import_react60, import_jsx_runtime81;
|
|
18620
18609
|
var init_ReceiveMenu = __esm({
|
|
18621
18610
|
"src/internal/components/ReceiveMenu/ReceiveMenu.tsx"() {
|
|
18622
18611
|
init_SessionContext();
|
|
18623
18612
|
init_i18n();
|
|
18624
18613
|
import_lucide_react51 = require("lucide-react");
|
|
18625
18614
|
import_qrcode = __toESM(require("qrcode"), 1);
|
|
18626
|
-
|
|
18615
|
+
import_react60 = require("react");
|
|
18627
18616
|
init_useLayoutDataStore();
|
|
18628
18617
|
init_useLayoutStore();
|
|
18629
18618
|
init_nickname_fingerprint();
|
|
@@ -19095,9 +19084,9 @@ function SecurityMenu() {
|
|
|
19095
19084
|
const { t } = useT();
|
|
19096
19085
|
const maxScrollHeight = useLayoutStore((st) => st.maxScrollHeight);
|
|
19097
19086
|
const setPage = useLayoutDataStore((st) => st.setPage);
|
|
19098
|
-
const userId =
|
|
19099
|
-
const serverHasKeyshare =
|
|
19100
|
-
const [appToUntrust, untrustApp] = (0,
|
|
19087
|
+
const userId = import_auth23.jwtTokenManager.getUserId();
|
|
19088
|
+
const serverHasKeyshare = import_auth23.jwtTokenManager.getHasKeyshare() ?? false;
|
|
19089
|
+
const [appToUntrust, untrustApp] = (0, import_react61.useState)(null);
|
|
19101
19090
|
const { data: recoveryData, isLoading: isRecoveryLoading } = useKeyshareRecoveryStats();
|
|
19102
19091
|
const localInfo = recoveryData?.keyshareInfo || {};
|
|
19103
19092
|
const hasServerBackup = !!recoveryData?.shareRecoveryStats?.created || recoveryData?.shareRecoveryStats?.devices?.length > 0;
|
|
@@ -19173,13 +19162,13 @@ function SecurityMenu() {
|
|
|
19173
19162
|
}
|
|
19174
19163
|
);
|
|
19175
19164
|
}
|
|
19176
|
-
var import_react_query41, import_lucide_react57,
|
|
19165
|
+
var import_react_query41, import_lucide_react57, import_react61, import_jsx_runtime88;
|
|
19177
19166
|
var init_SecurityMenu = __esm({
|
|
19178
19167
|
"src/internal/components/SecurityMenu/SecurityMenu.tsx"() {
|
|
19179
19168
|
init_i18n();
|
|
19180
19169
|
import_react_query41 = require("@tanstack/react-query");
|
|
19181
19170
|
import_lucide_react57 = require("lucide-react");
|
|
19182
|
-
|
|
19171
|
+
import_react61 = require("react");
|
|
19183
19172
|
init_auth();
|
|
19184
19173
|
init_useLayoutDataStore();
|
|
19185
19174
|
init_useLayoutStore();
|
|
@@ -19217,9 +19206,9 @@ async function walletLogin(walletData) {
|
|
|
19217
19206
|
return response.json();
|
|
19218
19207
|
}
|
|
19219
19208
|
async function linkWallet(walletData) {
|
|
19220
|
-
const hasValidToken = await (0,
|
|
19209
|
+
const hasValidToken = await (0, import_auth23.ensureValidToken)();
|
|
19221
19210
|
if (!hasValidToken) throw new Error("No authentication token available");
|
|
19222
|
-
const response = await (0,
|
|
19211
|
+
const response = await (0, import_auth23.authenticatedFetch)(`${getTssUrl3()}/api/auth/link/wallet`, {
|
|
19223
19212
|
method: "POST",
|
|
19224
19213
|
body: JSON.stringify(walletData)
|
|
19225
19214
|
});
|
|
@@ -19229,9 +19218,9 @@ async function linkWallet(walletData) {
|
|
|
19229
19218
|
}
|
|
19230
19219
|
}
|
|
19231
19220
|
async function unlinkWallet(address) {
|
|
19232
|
-
const hasValidToken = await (0,
|
|
19221
|
+
const hasValidToken = await (0, import_auth23.ensureValidToken)();
|
|
19233
19222
|
if (!hasValidToken) throw new Error("No authentication token available");
|
|
19234
|
-
const response = await (0,
|
|
19223
|
+
const response = await (0, import_auth23.authenticatedFetch)(
|
|
19235
19224
|
`${getTssUrl3()}/api/auth/unlink/wallet?address=${encodeURIComponent(address)}`,
|
|
19236
19225
|
{
|
|
19237
19226
|
method: "DELETE"
|
|
@@ -19325,23 +19314,23 @@ var init_useFlowSelector = __esm({
|
|
|
19325
19314
|
});
|
|
19326
19315
|
|
|
19327
19316
|
// src/internal/components/SendMenu/hyperbridge/lib/chains.ts
|
|
19328
|
-
var
|
|
19317
|
+
var import_read15, import_chains, CHAINS_UI_META;
|
|
19329
19318
|
var init_chains = __esm({
|
|
19330
19319
|
"src/internal/components/SendMenu/hyperbridge/lib/chains.ts"() {
|
|
19331
19320
|
init_EthereumIcon();
|
|
19332
19321
|
init_LumiaIcon2();
|
|
19333
19322
|
init_BscIcon();
|
|
19334
|
-
|
|
19323
|
+
import_read15 = require("@embarkai/core/read");
|
|
19335
19324
|
import_chains = require("wagmi/chains");
|
|
19336
19325
|
CHAINS_UI_META = {
|
|
19337
19326
|
lumiaprism: {
|
|
19338
|
-
chainID:
|
|
19339
|
-
chainLabel:
|
|
19327
|
+
chainID: import_read15.lumiaMainnetChain.id,
|
|
19328
|
+
chainLabel: import_read15.lumiaMainnetChain.name,
|
|
19340
19329
|
chainName: "lumiaprism",
|
|
19341
19330
|
// exact hyperlane registry chain name
|
|
19342
19331
|
Icon: LumiaIcon2,
|
|
19343
|
-
explorerUrl:
|
|
19344
|
-
chain:
|
|
19332
|
+
explorerUrl: import_read15.lumiaMainnetChain.blockExplorers.default.url,
|
|
19333
|
+
chain: import_read15.lumiaMainnetChain
|
|
19345
19334
|
},
|
|
19346
19335
|
bsc: {
|
|
19347
19336
|
chainID: import_chains.bsc.id,
|
|
@@ -19442,16 +19431,16 @@ function SenderSelector(props) {
|
|
|
19442
19431
|
const { directWalletProfile } = props;
|
|
19443
19432
|
const { t } = useT();
|
|
19444
19433
|
const config = useProviderConfig().config;
|
|
19445
|
-
const { signMessageAsync } = (0,
|
|
19434
|
+
const { signMessageAsync } = (0, import_wagmi3.useSignMessage)();
|
|
19446
19435
|
const { openConnectModal } = (0, import_rainbowkit.useConnectModal)();
|
|
19447
19436
|
const directWalletAddress = useExternalWalletStore((st) => st.externalAddress);
|
|
19448
19437
|
const directWalletIsConnected = useExternalWalletStore((st) => st.isExternalConnected);
|
|
19449
|
-
const pendingWalletRef = (0,
|
|
19438
|
+
const pendingWalletRef = (0, import_react62.useRef)(null);
|
|
19450
19439
|
const originChain = useBridgeStore((st) => st.originChain);
|
|
19451
19440
|
const bridgeSender = useBridgeStore((st) => st.bridgeSender);
|
|
19452
19441
|
const bridgeSenders = useBridgeStore((st) => st.bridgeSenders);
|
|
19453
|
-
const [walletMessage, setWalletMessage] = (0,
|
|
19454
|
-
(0,
|
|
19442
|
+
const [walletMessage, setWalletMessage] = (0, import_react62.useState)(null);
|
|
19443
|
+
(0, import_react62.useEffect)(() => {
|
|
19455
19444
|
useFlowSelectorStore.getState().setRenderKey(`sender-selected-${Date.now()}`);
|
|
19456
19445
|
}, [walletMessage]);
|
|
19457
19446
|
const { mutate: loginDirectWallet, isPending: isDirectWalletLoggingIn } = (0, import_react_query42.useMutation)({
|
|
@@ -19507,7 +19496,7 @@ function SenderSelector(props) {
|
|
|
19507
19496
|
setWalletMessage(error instanceof Error ? error.message : "Wallet login failed. Please try again.");
|
|
19508
19497
|
}
|
|
19509
19498
|
});
|
|
19510
|
-
(0,
|
|
19499
|
+
(0, import_react62.useEffect)(() => {
|
|
19511
19500
|
const pendingProfile = pendingWalletRef.current;
|
|
19512
19501
|
if (!pendingProfile || !directWalletIsConnected || !directWalletAddress) return;
|
|
19513
19502
|
if (directWalletAddress.toLowerCase() !== pendingProfile.externalId?.toLowerCase()) return;
|
|
@@ -19582,15 +19571,15 @@ function SenderSelector(props) {
|
|
|
19582
19571
|
] })
|
|
19583
19572
|
] });
|
|
19584
19573
|
}
|
|
19585
|
-
var import_rainbowkit, import_react_query42,
|
|
19574
|
+
var import_rainbowkit, import_react_query42, import_react62, import_wagmi3, import_jsx_runtime89;
|
|
19586
19575
|
var init_SenderSelector = __esm({
|
|
19587
19576
|
"src/internal/components/SendMenu/hyperbridge/components/SenderSelector.tsx"() {
|
|
19588
19577
|
init_ProviderContext();
|
|
19589
19578
|
init_i18n();
|
|
19590
19579
|
import_rainbowkit = require("@rainbow-me/rainbowkit");
|
|
19591
19580
|
import_react_query42 = require("@tanstack/react-query");
|
|
19592
|
-
|
|
19593
|
-
|
|
19581
|
+
import_react62 = require("react");
|
|
19582
|
+
import_wagmi3 = require("wagmi");
|
|
19594
19583
|
init_wallet();
|
|
19595
19584
|
init_useLayoutDataStore();
|
|
19596
19585
|
init_useExternalWalletStore();
|
|
@@ -19702,8 +19691,8 @@ var init_wallets = __esm({
|
|
|
19702
19691
|
function useAvailableSenders() {
|
|
19703
19692
|
const address = useSession((st) => st.address);
|
|
19704
19693
|
const { profiles } = useLinkedProfiles();
|
|
19705
|
-
const lastCalcedSenders = (0,
|
|
19706
|
-
(0,
|
|
19694
|
+
const lastCalcedSenders = (0, import_react63.useRef)([]);
|
|
19695
|
+
(0, import_react63.useEffect)(() => {
|
|
19707
19696
|
const sendersAccumulator = [
|
|
19708
19697
|
{
|
|
19709
19698
|
type: "embarkai-wallet",
|
|
@@ -19735,13 +19724,13 @@ function useAvailableSenders() {
|
|
|
19735
19724
|
directWalletProfile: profiles.filter((p) => p.provider === "wallet")[0] || null
|
|
19736
19725
|
};
|
|
19737
19726
|
}
|
|
19738
|
-
var
|
|
19727
|
+
var import_react63;
|
|
19739
19728
|
var init_useAvailableSenders = __esm({
|
|
19740
19729
|
"src/internal/components/SendMenu/hyperbridge/hooks/useAvailableSenders.ts"() {
|
|
19741
19730
|
init_SessionContext();
|
|
19742
19731
|
init_tokens();
|
|
19743
19732
|
init_linkedProfiles();
|
|
19744
|
-
|
|
19733
|
+
import_react63 = require("react");
|
|
19745
19734
|
init_wallets();
|
|
19746
19735
|
init_useFlowSelector();
|
|
19747
19736
|
init_useBridgeStore();
|
|
@@ -19750,7 +19739,7 @@ var init_useAvailableSenders = __esm({
|
|
|
19750
19739
|
|
|
19751
19740
|
// src/internal/components/SendMenu/hyperbridge/api.ts
|
|
19752
19741
|
function iframe3() {
|
|
19753
|
-
const accessToken =
|
|
19742
|
+
const accessToken = import_auth23.jwtTokenManager.getAccessToken();
|
|
19754
19743
|
if (!accessToken) {
|
|
19755
19744
|
throw new Error("Access token is not available");
|
|
19756
19745
|
}
|
|
@@ -19815,7 +19804,7 @@ var init_api3 = __esm({
|
|
|
19815
19804
|
// src/clients/bundler/getUserOperationByHash.ts
|
|
19816
19805
|
async function getUserOperationByHash(userOpHash, chainId) {
|
|
19817
19806
|
const targetChainId = chainId ?? requireActiveChainId();
|
|
19818
|
-
const chainConfig = (0,
|
|
19807
|
+
const chainConfig = (0, import_read16.getChainConfig)(targetChainId);
|
|
19819
19808
|
if (!chainConfig) {
|
|
19820
19809
|
throw new Error(`Chain ${targetChainId} is not supported`);
|
|
19821
19810
|
}
|
|
@@ -19843,19 +19832,19 @@ async function getUserOperationByHash(userOpHash, chainId) {
|
|
|
19843
19832
|
return null;
|
|
19844
19833
|
}
|
|
19845
19834
|
}
|
|
19846
|
-
var import_core3,
|
|
19835
|
+
var import_core3, import_read16;
|
|
19847
19836
|
var init_getUserOperationByHash = __esm({
|
|
19848
19837
|
"src/clients/bundler/getUserOperationByHash.ts"() {
|
|
19849
19838
|
init_SessionContext();
|
|
19850
19839
|
import_core3 = require("@embarkai/core");
|
|
19851
|
-
|
|
19840
|
+
import_read16 = require("@embarkai/core/read");
|
|
19852
19841
|
}
|
|
19853
19842
|
});
|
|
19854
19843
|
|
|
19855
19844
|
// src/clients/bundler/getUserOperationReceipt.ts
|
|
19856
19845
|
async function getUserOperationReceipt(userOpHash, chainId) {
|
|
19857
19846
|
const targetChainId = chainId ?? requireActiveChainId();
|
|
19858
|
-
const chainConfig = (0,
|
|
19847
|
+
const chainConfig = (0, import_read17.getChainConfig)(targetChainId);
|
|
19859
19848
|
if (!chainConfig) {
|
|
19860
19849
|
throw new Error(`Chain ${targetChainId} is not supported`);
|
|
19861
19850
|
}
|
|
@@ -19889,12 +19878,12 @@ async function getUserOperationReceipt(userOpHash, chainId) {
|
|
|
19889
19878
|
return null;
|
|
19890
19879
|
}
|
|
19891
19880
|
}
|
|
19892
|
-
var import_core4,
|
|
19881
|
+
var import_core4, import_read17;
|
|
19893
19882
|
var init_getUserOperationReceipt = __esm({
|
|
19894
19883
|
"src/clients/bundler/getUserOperationReceipt.ts"() {
|
|
19895
19884
|
init_SessionContext();
|
|
19896
19885
|
import_core4 = require("@embarkai/core");
|
|
19897
|
-
|
|
19886
|
+
import_read17 = require("@embarkai/core/read");
|
|
19898
19887
|
}
|
|
19899
19888
|
});
|
|
19900
19889
|
|
|
@@ -20062,7 +20051,7 @@ function isOririnChainEmbarkSupported(originChain) {
|
|
|
20062
20051
|
var import_viem12;
|
|
20063
20052
|
var init_utils8 = __esm({
|
|
20064
20053
|
"src/internal/components/SendMenu/hyperbridge/utils.ts"() {
|
|
20065
|
-
|
|
20054
|
+
init_networks4();
|
|
20066
20055
|
import_viem12 = require("viem");
|
|
20067
20056
|
init_chains();
|
|
20068
20057
|
}
|
|
@@ -20084,29 +20073,29 @@ function useHyperlaneHistory() {
|
|
|
20084
20073
|
queryFn: async ({ pageParam }) => await getHyperlaneBridgeHistory({ page: pageParam, pageSize: TX_HISTORY_PAGE_SIZE })
|
|
20085
20074
|
});
|
|
20086
20075
|
const { data: txHistoryData, isLoading: isBridgeTxHistoryLoading } = query;
|
|
20087
|
-
const txList = (0,
|
|
20076
|
+
const txList = (0, import_react64.useMemo)(
|
|
20088
20077
|
() => txHistoryData?.pages?.map((p) => p.data).flat(Infinity) || [],
|
|
20089
20078
|
[txHistoryData]
|
|
20090
20079
|
);
|
|
20091
|
-
const updateExpandable = (0,
|
|
20080
|
+
const updateExpandable = (0, import_react64.useCallback)(
|
|
20092
20081
|
(0, import_lodash_es9.debounce)(() => {
|
|
20093
20082
|
useFlowSelectorStore.getState().setRenderKey(`hyperlane-history-loaded-${Date.now()}`);
|
|
20094
20083
|
}, 250),
|
|
20095
20084
|
[]
|
|
20096
20085
|
);
|
|
20097
|
-
(0,
|
|
20086
|
+
(0, import_react64.useEffect)(() => {
|
|
20098
20087
|
if (isBridgeTxHistoryLoading || txList.length === 0) return;
|
|
20099
20088
|
updateExpandable();
|
|
20100
20089
|
}, [isBridgeTxHistoryLoading, txList]);
|
|
20101
20090
|
return { query, txList };
|
|
20102
20091
|
}
|
|
20103
|
-
var import_react_query43, import_lodash_es9,
|
|
20092
|
+
var import_react_query43, import_lodash_es9, import_react64, HYPERLANE_HISTORY_QUERY_KEY, TX_HISTORY_PAGE_SIZE, TX_HISTORY_POLLING_INTERVAL;
|
|
20104
20093
|
var init_useHyperlaneHistory = __esm({
|
|
20105
20094
|
"src/internal/components/SendMenu/hyperbridge/hooks/useHyperlaneHistory.ts"() {
|
|
20106
20095
|
init_SessionContext();
|
|
20107
20096
|
import_react_query43 = require("@tanstack/react-query");
|
|
20108
20097
|
import_lodash_es9 = require("lodash-es");
|
|
20109
|
-
|
|
20098
|
+
import_react64 = require("react");
|
|
20110
20099
|
init_useLayoutDataStore();
|
|
20111
20100
|
init_useFlowSelector();
|
|
20112
20101
|
init_api3();
|
|
@@ -20136,9 +20125,9 @@ function useBridge() {
|
|
|
20136
20125
|
const qc = (0, import_react_query44.useQueryClient)();
|
|
20137
20126
|
const { t } = useT();
|
|
20138
20127
|
const address = useSession((st) => st.address);
|
|
20139
|
-
const { data: walletClient } = (0,
|
|
20140
|
-
const { switchChainAsync } = (0,
|
|
20141
|
-
const swapDirection = (0,
|
|
20128
|
+
const { data: walletClient } = (0, import_wagmi4.useWalletClient)();
|
|
20129
|
+
const { switchChainAsync } = (0, import_wagmi4.useSwitchChain)();
|
|
20130
|
+
const swapDirection = (0, import_react65.useCallback)(() => {
|
|
20142
20131
|
const {
|
|
20143
20132
|
bridgeStep,
|
|
20144
20133
|
originChain,
|
|
@@ -20190,7 +20179,7 @@ function useBridge() {
|
|
|
20190
20179
|
useFlowSelectorStore.getState().setError(error instanceof Error ? error.message : String(error));
|
|
20191
20180
|
}
|
|
20192
20181
|
});
|
|
20193
|
-
const handleQuoteEstimation = (0,
|
|
20182
|
+
const handleQuoteEstimation = (0, import_react65.useCallback)((amnt) => {
|
|
20194
20183
|
const { originChain, destinationChain, bridgeSender } = useBridgeStore.getState();
|
|
20195
20184
|
if (!amnt || !Number(amnt)) {
|
|
20196
20185
|
useBridgeStore.getState().setQuote(null);
|
|
@@ -20315,15 +20304,15 @@ function useBridge() {
|
|
|
20315
20304
|
isAssetBridging
|
|
20316
20305
|
};
|
|
20317
20306
|
}
|
|
20318
|
-
var import_react_query44,
|
|
20307
|
+
var import_react_query44, import_react65, import_wagmi4;
|
|
20319
20308
|
var init_useBridge = __esm({
|
|
20320
20309
|
"src/internal/components/SendMenu/hyperbridge/hooks/useBridge.ts"() {
|
|
20321
20310
|
init_SessionContext();
|
|
20322
20311
|
init_i18n();
|
|
20323
20312
|
init_useExternalWalletStore();
|
|
20324
20313
|
import_react_query44 = require("@tanstack/react-query");
|
|
20325
|
-
|
|
20326
|
-
|
|
20314
|
+
import_react65 = require("react");
|
|
20315
|
+
import_wagmi4 = require("wagmi");
|
|
20327
20316
|
init_useLayoutStore();
|
|
20328
20317
|
init_useFlowSelector();
|
|
20329
20318
|
init_api3();
|
|
@@ -20352,7 +20341,7 @@ function useHyperlaneRoutes() {
|
|
|
20352
20341
|
queryKey: [HYPERLANE_WARP_ROUTES_QUERY_KEY, address],
|
|
20353
20342
|
queryFn: async () => getHyperlaneWarpRoutes()
|
|
20354
20343
|
});
|
|
20355
|
-
(0,
|
|
20344
|
+
(0, import_react66.useEffect)(() => {
|
|
20356
20345
|
if (!errorWarpRoutes) return;
|
|
20357
20346
|
useFlowSelectorStore.getState().setError(errorWarpRoutes.message);
|
|
20358
20347
|
const { resetSelections, setRecipient, setOriginChain, setDestinationChain } = useBridgeStore.getState();
|
|
@@ -20361,7 +20350,7 @@ function useHyperlaneRoutes() {
|
|
|
20361
20350
|
setOriginChain(null);
|
|
20362
20351
|
setDestinationChain(null);
|
|
20363
20352
|
}, [errorWarpRoutes]);
|
|
20364
|
-
(0,
|
|
20353
|
+
(0, import_react66.useEffect)(() => {
|
|
20365
20354
|
if (!!hyperRoute || !hyperlaneWarpRoutes.length) return;
|
|
20366
20355
|
const warpRouteToAutoSelect = hyperlaneWarpRoutes.find((route) => route.routeId === hyperRoute);
|
|
20367
20356
|
if (!warpRouteToAutoSelect) return;
|
|
@@ -20380,12 +20369,12 @@ function useHyperlaneRoutes() {
|
|
|
20380
20369
|
}, [hyperRoute, hyperlaneWarpRoutes]);
|
|
20381
20370
|
return { hyperlaneWarpRoutes, isLoadingWarpRoutes };
|
|
20382
20371
|
}
|
|
20383
|
-
var import_react_query45,
|
|
20372
|
+
var import_react_query45, import_react66, HYPERLANE_WARP_ROUTES_QUERY_KEY;
|
|
20384
20373
|
var init_useHyperlaneRoutes = __esm({
|
|
20385
20374
|
"src/internal/components/SendMenu/hyperbridge/hooks/useHyperlaneRoutes.ts"() {
|
|
20386
20375
|
init_SessionContext();
|
|
20387
20376
|
import_react_query45 = require("@tanstack/react-query");
|
|
20388
|
-
|
|
20377
|
+
import_react66 = require("react");
|
|
20389
20378
|
init_useLayoutDataStore();
|
|
20390
20379
|
init_useFlowSelector();
|
|
20391
20380
|
init_api3();
|
|
@@ -20401,7 +20390,7 @@ function useMenuTitle(warpRoutes) {
|
|
|
20401
20390
|
const bridgeStep = useBridgeStore((st) => st.bridgeStep);
|
|
20402
20391
|
const hyperRoute = useBridgeStore((st) => st.hyperRoute);
|
|
20403
20392
|
const hyperRouteMeta = warpRoutes?.length ? warpRoutes.find((route) => route.routeId === hyperRoute) : null;
|
|
20404
|
-
(0,
|
|
20393
|
+
(0, import_react67.useEffect)(() => {
|
|
20405
20394
|
const updateMenuTitle = useFlowSelectorStore.getState().setMenuTitle;
|
|
20406
20395
|
switch (true) {
|
|
20407
20396
|
case bridgeStep === "sender-selector":
|
|
@@ -20429,11 +20418,11 @@ function useMenuTitle(warpRoutes) {
|
|
|
20429
20418
|
}
|
|
20430
20419
|
}, [bridgeStep, hyperRouteMeta, t]);
|
|
20431
20420
|
}
|
|
20432
|
-
var
|
|
20421
|
+
var import_react67;
|
|
20433
20422
|
var init_useMenuTitle = __esm({
|
|
20434
20423
|
"src/internal/components/SendMenu/hyperbridge/hooks/useMenuTitle.ts"() {
|
|
20435
20424
|
init_i18n();
|
|
20436
|
-
|
|
20425
|
+
import_react67 = require("react");
|
|
20437
20426
|
init_useFlowSelector();
|
|
20438
20427
|
init_useBridgeStore();
|
|
20439
20428
|
}
|
|
@@ -20460,7 +20449,7 @@ function useBridgeBalance(hyperlaneWarpRoutes) {
|
|
|
20460
20449
|
const address = useSession((st) => st.address);
|
|
20461
20450
|
const directWalletAddress = useExternalWalletStore((st) => st.externalAddress);
|
|
20462
20451
|
const directWalletChainId = useExternalWalletStore((st) => st.externalChainId);
|
|
20463
|
-
const { switchChainAsync } = (0,
|
|
20452
|
+
const { switchChainAsync } = (0, import_wagmi5.useSwitchChain)();
|
|
20464
20453
|
const hyperRoute = useBridgeStore((st) => st.hyperRoute);
|
|
20465
20454
|
const bridgeSender = useBridgeStore((st) => st.bridgeSender);
|
|
20466
20455
|
const originChain = useBridgeStore((st) => st.originChain);
|
|
@@ -20540,7 +20529,7 @@ function useBridgeBalance(hyperlaneWarpRoutes) {
|
|
|
20540
20529
|
};
|
|
20541
20530
|
}
|
|
20542
20531
|
});
|
|
20543
|
-
const refreshRouteTokenBalance = (0,
|
|
20532
|
+
const refreshRouteTokenBalance = (0, import_react68.useCallback)(
|
|
20544
20533
|
(senderWallet) => {
|
|
20545
20534
|
switch (true) {
|
|
20546
20535
|
case senderWallet === "embarkai-wallet":
|
|
@@ -20556,7 +20545,7 @@ function useBridgeBalance(hyperlaneWarpRoutes) {
|
|
|
20556
20545
|
},
|
|
20557
20546
|
[refreshBalances, qc]
|
|
20558
20547
|
);
|
|
20559
|
-
(0,
|
|
20548
|
+
(0, import_react68.useEffect)(() => {
|
|
20560
20549
|
if (!bridgeSender || !originChain) return;
|
|
20561
20550
|
switch (bridgeSender) {
|
|
20562
20551
|
case "embarkai-wallet":
|
|
@@ -20587,16 +20576,16 @@ function useBridgeBalance(hyperlaneWarpRoutes) {
|
|
|
20587
20576
|
isRouteTokenBalanceLoading: isAssetsLoading || isExternalBalanceLoading || isExternalNativeBalanceLoading
|
|
20588
20577
|
};
|
|
20589
20578
|
}
|
|
20590
|
-
var import_core6, import_react_query46,
|
|
20579
|
+
var import_core6, import_react_query46, import_react68, import_viem13, import_wagmi5, EXTERNAL_WALLET_BRIDGING_BALANCE_QUERY, EXTERNAL_WALLET_BRIDGING_NATIVE_BALANCE_QUERY;
|
|
20591
20580
|
var init_useBridgeBalance = __esm({
|
|
20592
20581
|
"src/internal/components/SendMenu/hyperbridge/hooks/useBridgeBalance.ts"() {
|
|
20593
20582
|
init_SessionContext();
|
|
20594
20583
|
init_i18n();
|
|
20595
20584
|
import_core6 = require("@embarkai/core");
|
|
20596
20585
|
import_react_query46 = require("@tanstack/react-query");
|
|
20597
|
-
|
|
20586
|
+
import_react68 = require("react");
|
|
20598
20587
|
import_viem13 = require("viem");
|
|
20599
|
-
|
|
20588
|
+
import_wagmi5 = require("wagmi");
|
|
20600
20589
|
init_useBlockscoutAssets();
|
|
20601
20590
|
init_useExternalWalletStore();
|
|
20602
20591
|
init_useFlowSelector();
|
|
@@ -20712,7 +20701,7 @@ function SelectStep(props) {
|
|
|
20712
20701
|
variant: "outline",
|
|
20713
20702
|
size: "medium",
|
|
20714
20703
|
className: "bg-[var(--ui-kit-bg)] flex items-center gap-[var(--ui-kit-gap)]",
|
|
20715
|
-
children: selectedWarpRoute.chainPair.map((chain, chIdx) => /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)(
|
|
20704
|
+
children: selectedWarpRoute.chainPair.map((chain, chIdx) => /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)(import_react69.Fragment, { children: [
|
|
20716
20705
|
chIdx > 0 && /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(import_lucide_react59.ArrowLeftRightIcon, { className: "w-4 h-4 " }),
|
|
20717
20706
|
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(ResolveChainIcon, { chainName: chain.chainName, className: "w-4 h-4" })
|
|
20718
20707
|
] }, `${selectedWarpRoute.id}-icon-${chain.chainID}-${chIdx}`))
|
|
@@ -20847,13 +20836,13 @@ function SelectStep(props) {
|
|
|
20847
20836
|
)
|
|
20848
20837
|
] });
|
|
20849
20838
|
}
|
|
20850
|
-
var import_lucide_react59,
|
|
20839
|
+
var import_lucide_react59, import_react69, import_jsx_runtime93;
|
|
20851
20840
|
var init_SelectStep = __esm({
|
|
20852
20841
|
"src/internal/components/SendMenu/hyperbridge/steps/SelectStep.tsx"() {
|
|
20853
20842
|
init_tokens();
|
|
20854
20843
|
init_i18n();
|
|
20855
20844
|
import_lucide_react59 = require("lucide-react");
|
|
20856
|
-
|
|
20845
|
+
import_react69 = require("react");
|
|
20857
20846
|
init_priceFormatter();
|
|
20858
20847
|
init_utils2();
|
|
20859
20848
|
init_badge();
|
|
@@ -20902,7 +20891,7 @@ var init_checkbox = __esm({
|
|
|
20902
20891
|
// src/internal/components/SendMenu/hyperbridge/steps/ConfirmStep.tsx
|
|
20903
20892
|
function ConfirmStep(props) {
|
|
20904
20893
|
const { isAssetBridging, bridgeAsset, hyperlaneWarpRoutes } = props;
|
|
20905
|
-
const [userConsent, setUserConsent] = (0,
|
|
20894
|
+
const [userConsent, setUserConsent] = (0, import_react70.useState)(false);
|
|
20906
20895
|
const { t } = useT();
|
|
20907
20896
|
const address = useSession((st) => st.address);
|
|
20908
20897
|
const bridgeSender = useBridgeStore((st) => st.bridgeSenders.find((s) => s.type === st.bridgeSender));
|
|
@@ -21011,13 +21000,13 @@ function ConfirmStep(props) {
|
|
|
21011
21000
|
)
|
|
21012
21001
|
] });
|
|
21013
21002
|
}
|
|
21014
|
-
var import_lucide_react61,
|
|
21003
|
+
var import_lucide_react61, import_react70, import_jsx_runtime95, P_CN;
|
|
21015
21004
|
var init_ConfirmStep = __esm({
|
|
21016
21005
|
"src/internal/components/SendMenu/hyperbridge/steps/ConfirmStep.tsx"() {
|
|
21017
21006
|
init_SessionContext();
|
|
21018
21007
|
init_i18n();
|
|
21019
21008
|
import_lucide_react61 = require("lucide-react");
|
|
21020
|
-
|
|
21009
|
+
import_react70 = require("react");
|
|
21021
21010
|
init_priceFormatter();
|
|
21022
21011
|
init_utils2();
|
|
21023
21012
|
init_button();
|
|
@@ -21392,9 +21381,9 @@ var init_HistoryStep = __esm({
|
|
|
21392
21381
|
function SelectAssetRoute(props) {
|
|
21393
21382
|
const { hyperlaneWarpRoutes } = props;
|
|
21394
21383
|
const { t } = useT();
|
|
21395
|
-
const [isTokenSymbolSelector, setIsTokenSymbolSelector] = (0,
|
|
21384
|
+
const [isTokenSymbolSelector, setIsTokenSymbolSelector] = (0, import_react71.useState)(false);
|
|
21396
21385
|
const selectedAssetSymbol = useBridgeStore((st) => st.bridgeAssetSymbol);
|
|
21397
|
-
const tokenList = (0,
|
|
21386
|
+
const tokenList = (0, import_react71.useMemo)(() => {
|
|
21398
21387
|
const tokens = hyperlaneWarpRoutes.map((route) => route.symbol);
|
|
21399
21388
|
const uniqueTokens = Array.from(new Set(tokens));
|
|
21400
21389
|
return uniqueTokens.map((symbol) => ({
|
|
@@ -21491,13 +21480,13 @@ function SelectAssetRoute(props) {
|
|
|
21491
21480
|
] })
|
|
21492
21481
|
] });
|
|
21493
21482
|
}
|
|
21494
|
-
var import_lucide_react63,
|
|
21483
|
+
var import_lucide_react63, import_react71, import_jsx_runtime98;
|
|
21495
21484
|
var init_SelectAssetRoute = __esm({
|
|
21496
21485
|
"src/internal/components/SendMenu/hyperbridge/steps/SelectAssetRoute.tsx"() {
|
|
21497
21486
|
init_tokens();
|
|
21498
21487
|
init_i18n();
|
|
21499
21488
|
import_lucide_react63 = require("lucide-react");
|
|
21500
|
-
|
|
21489
|
+
import_react71 = require("react");
|
|
21501
21490
|
init_button();
|
|
21502
21491
|
init_useFlowSelector();
|
|
21503
21492
|
init_ResolveChainIcon();
|
|
@@ -21525,7 +21514,7 @@ function HyperlaneBridge() {
|
|
|
21525
21514
|
const { hyperlaneWarpRoutes, isLoadingWarpRoutes } = useHyperlaneRoutes();
|
|
21526
21515
|
const { directWalletProfile } = useAvailableSenders();
|
|
21527
21516
|
useMenuTitle(hyperlaneWarpRoutes);
|
|
21528
|
-
(0,
|
|
21517
|
+
(0, import_react72.useEffect)(
|
|
21529
21518
|
() => () => {
|
|
21530
21519
|
useBridgeStore.getState().resetSelections();
|
|
21531
21520
|
},
|
|
@@ -21559,10 +21548,10 @@ function HyperlaneBridge() {
|
|
|
21559
21548
|
bridgeStep === "tx-history-details" && /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(HistoryDetailsStep, {})
|
|
21560
21549
|
] });
|
|
21561
21550
|
}
|
|
21562
|
-
var
|
|
21551
|
+
var import_react72, import_jsx_runtime99;
|
|
21563
21552
|
var init_HyperlaneBridge = __esm({
|
|
21564
21553
|
"src/internal/components/SendMenu/hyperbridge/HyperlaneBridge.tsx"() {
|
|
21565
|
-
|
|
21554
|
+
import_react72 = require("react");
|
|
21566
21555
|
init_SenderSelector();
|
|
21567
21556
|
init_useAvailableSenders();
|
|
21568
21557
|
init_useBridge();
|
|
@@ -21580,7 +21569,7 @@ function BridgeHistorySwitch(props) {
|
|
|
21580
21569
|
const selectorFlow = useFlowSelectorStore((st) => st.flow);
|
|
21581
21570
|
const isUiLocked = useFlowSelectorStore((st) => st.isUiLocked);
|
|
21582
21571
|
const bridgeStep = useBridgeStore((st) => st.bridgeStep);
|
|
21583
|
-
const lastBridgeStepRef = (0,
|
|
21572
|
+
const lastBridgeStepRef = (0, import_react73.useRef)(null);
|
|
21584
21573
|
if (selectorFlow !== "bridge" || bridgeStep === "confirm" || bridgeStep === "success" || bridgeStep === "sender-selector" || bridgeStep === "select-token" || bridgeStep === "tx-history-details") {
|
|
21585
21574
|
return null;
|
|
21586
21575
|
}
|
|
@@ -21599,10 +21588,10 @@ function BridgeHistorySwitch(props) {
|
|
|
21599
21588
|
}
|
|
21600
21589
|
);
|
|
21601
21590
|
}
|
|
21602
|
-
var
|
|
21591
|
+
var import_react73, import_jsx_runtime100;
|
|
21603
21592
|
var init_HistorySwitch = __esm({
|
|
21604
21593
|
"src/internal/components/SendMenu/hyperbridge/components/HistorySwitch.tsx"() {
|
|
21605
|
-
|
|
21594
|
+
import_react73 = require("react");
|
|
21606
21595
|
init_switch();
|
|
21607
21596
|
init_useFlowSelector();
|
|
21608
21597
|
init_useBridgeStore();
|
|
@@ -21628,7 +21617,7 @@ function useErc3643Compliance(options) {
|
|
|
21628
21617
|
isLoading,
|
|
21629
21618
|
error: queryError,
|
|
21630
21619
|
refetch
|
|
21631
|
-
} = (0,
|
|
21620
|
+
} = (0, import_wagmi6.useReadContract)({
|
|
21632
21621
|
address: tokenAddress,
|
|
21633
21622
|
abi: ERC3643_CAN_TRANSFER_ABI,
|
|
21634
21623
|
functionName: "canTransfer",
|
|
@@ -21665,10 +21654,10 @@ function useErc3643Compliance(options) {
|
|
|
21665
21654
|
refetch
|
|
21666
21655
|
};
|
|
21667
21656
|
}
|
|
21668
|
-
var
|
|
21657
|
+
var import_wagmi6, ERC3643_CAN_TRANSFER_ABI;
|
|
21669
21658
|
var init_useErc3643Compliance = __esm({
|
|
21670
21659
|
"src/hooks/useErc3643Compliance.ts"() {
|
|
21671
|
-
|
|
21660
|
+
import_wagmi6 = require("wagmi");
|
|
21672
21661
|
ERC3643_CAN_TRANSFER_ABI = [
|
|
21673
21662
|
{
|
|
21674
21663
|
type: "function",
|
|
@@ -21693,11 +21682,11 @@ function looksLikeNickname(input) {
|
|
|
21693
21682
|
}
|
|
21694
21683
|
function useNicknameResolve(input, options) {
|
|
21695
21684
|
const { enabled = true, chainId } = options;
|
|
21696
|
-
const [debouncedInput, setDebouncedInput] = (0,
|
|
21697
|
-
const [isDebouncing, setIsDebouncing] = (0,
|
|
21685
|
+
const [debouncedInput, setDebouncedInput] = (0, import_react74.useState)("");
|
|
21686
|
+
const [isDebouncing, setIsDebouncing] = (0, import_react74.useState)(false);
|
|
21698
21687
|
const normalized = normalizeNickname(input);
|
|
21699
21688
|
const isNicknameInput = looksLikeNickname(input) && normalized.length >= 3;
|
|
21700
|
-
(0,
|
|
21689
|
+
(0, import_react74.useEffect)(() => {
|
|
21701
21690
|
if (!isNicknameInput || !enabled) {
|
|
21702
21691
|
setDebouncedInput("");
|
|
21703
21692
|
setIsDebouncing(false);
|
|
@@ -21723,7 +21712,7 @@ function useNicknameResolve(input, options) {
|
|
|
21723
21712
|
const isNotFound = query.isError && query.error?.code === "NICKNAME_NOT_FOUND";
|
|
21724
21713
|
const isWalletNotSetup = !!query.data && query.data.resolvedTarget === null;
|
|
21725
21714
|
const isFrozen = query.data?.isFrozen ?? false;
|
|
21726
|
-
const fingerprintVerification = (0,
|
|
21715
|
+
const fingerprintVerification = (0, import_react74.useMemo)(() => {
|
|
21727
21716
|
if (!query.data?.owner || !query.data?.fingerprint) {
|
|
21728
21717
|
return null;
|
|
21729
21718
|
}
|
|
@@ -21745,11 +21734,11 @@ function useNicknameResolve(input, options) {
|
|
|
21745
21734
|
resolvedAddress
|
|
21746
21735
|
};
|
|
21747
21736
|
}
|
|
21748
|
-
var import_react_query48,
|
|
21737
|
+
var import_react_query48, import_react74, DEBOUNCE_MS2;
|
|
21749
21738
|
var init_useNicknameResolve = __esm({
|
|
21750
21739
|
"src/hooks/useNicknameResolve.ts"() {
|
|
21751
21740
|
import_react_query48 = require("@tanstack/react-query");
|
|
21752
|
-
|
|
21741
|
+
import_react74 = require("react");
|
|
21753
21742
|
init_nickname();
|
|
21754
21743
|
init_profile();
|
|
21755
21744
|
init_nickname_validation();
|
|
@@ -21762,10 +21751,10 @@ var init_useNicknameResolve = __esm({
|
|
|
21762
21751
|
function useSendTransaction() {
|
|
21763
21752
|
const session = useSession((st) => st.session);
|
|
21764
21753
|
const address = useSession((st) => st.address);
|
|
21765
|
-
const [isLoading, setIsLoading] = (0,
|
|
21766
|
-
const [error, setError] = (0,
|
|
21767
|
-
const [userOpHash, setUserOpHash] = (0,
|
|
21768
|
-
const sendTransaction = (0,
|
|
21754
|
+
const [isLoading, setIsLoading] = (0, import_react75.useState)(false);
|
|
21755
|
+
const [error, setError] = (0, import_react75.useState)(null);
|
|
21756
|
+
const [userOpHash, setUserOpHash] = (0, import_react75.useState)(null);
|
|
21757
|
+
const sendTransaction = (0, import_react75.useCallback)(
|
|
21769
21758
|
async (params) => {
|
|
21770
21759
|
if (!session || !address) {
|
|
21771
21760
|
setError("No active session");
|
|
@@ -21862,7 +21851,7 @@ function useSendTransaction() {
|
|
|
21862
21851
|
},
|
|
21863
21852
|
[session, address]
|
|
21864
21853
|
);
|
|
21865
|
-
const reset = (0,
|
|
21854
|
+
const reset = (0, import_react75.useCallback)(() => {
|
|
21866
21855
|
setError(null);
|
|
21867
21856
|
setUserOpHash(null);
|
|
21868
21857
|
setIsLoading(false);
|
|
@@ -21875,10 +21864,10 @@ function useSendTransaction() {
|
|
|
21875
21864
|
reset
|
|
21876
21865
|
};
|
|
21877
21866
|
}
|
|
21878
|
-
var
|
|
21867
|
+
var import_react75, import_viem14, ERC20_TRANSFER_ABI, ERC721_SAFE_TRANSFER_ABI, ERC1155_SAFE_TRANSFER_ABI;
|
|
21879
21868
|
var init_useSendTransaction = __esm({
|
|
21880
21869
|
"src/hooks/useSendTransaction.ts"() {
|
|
21881
|
-
|
|
21870
|
+
import_react75 = require("react");
|
|
21882
21871
|
import_viem14 = require("viem");
|
|
21883
21872
|
init_SessionContext();
|
|
21884
21873
|
init_account2();
|
|
@@ -22029,7 +22018,7 @@ var init_AssetInputIcon = __esm({
|
|
|
22029
22018
|
|
|
22030
22019
|
// src/internal/components/SendMenu/send/components/NftDisplayCard.tsx
|
|
22031
22020
|
function NftDisplayCard({ asset }) {
|
|
22032
|
-
const [imageError, setImageError] = (0,
|
|
22021
|
+
const [imageError, setImageError] = (0, import_react76.useState)(false);
|
|
22033
22022
|
const nftImage = asset.image || asset.nftMetadata?.image;
|
|
22034
22023
|
return /* @__PURE__ */ (0, import_jsx_runtime102.jsxs)("div", { className: "flex items-center gap-3 p-3 rounded-[var(--ui-kit-el-bdrs)] bg-[var(--ui-kit-bg-secondary)]", children: [
|
|
22035
22024
|
nftImage && !imageError ? /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(
|
|
@@ -22057,11 +22046,11 @@ function NftDisplayCard({ asset }) {
|
|
|
22057
22046
|
] })
|
|
22058
22047
|
] });
|
|
22059
22048
|
}
|
|
22060
|
-
var import_lucide_react65,
|
|
22049
|
+
var import_lucide_react65, import_react76, import_jsx_runtime102;
|
|
22061
22050
|
var init_NftDisplayCard = __esm({
|
|
22062
22051
|
"src/internal/components/SendMenu/send/components/NftDisplayCard.tsx"() {
|
|
22063
22052
|
import_lucide_react65 = require("lucide-react");
|
|
22064
|
-
|
|
22053
|
+
import_react76 = require("react");
|
|
22065
22054
|
import_jsx_runtime102 = require("react/jsx-runtime");
|
|
22066
22055
|
}
|
|
22067
22056
|
});
|
|
@@ -22712,10 +22701,10 @@ function SendMenu() {
|
|
|
22712
22701
|
userOpHash,
|
|
22713
22702
|
reset
|
|
22714
22703
|
} = useSendTransaction();
|
|
22715
|
-
(0,
|
|
22704
|
+
(0, import_react77.useEffect)(() => {
|
|
22716
22705
|
useFlowSelectorStore.getState().setIsUiLocked(isAssetsLoading || isTransactionPending);
|
|
22717
22706
|
}, [isAssetsLoading, isTransactionPending]);
|
|
22718
|
-
(0,
|
|
22707
|
+
(0, import_react77.useEffect)(() => {
|
|
22719
22708
|
useFlowSelectorStore.getState().setError(sendTransactionError || null);
|
|
22720
22709
|
}, [sendTransactionError]);
|
|
22721
22710
|
const {
|
|
@@ -22730,7 +22719,7 @@ function SendMenu() {
|
|
|
22730
22719
|
} = useSendStore();
|
|
22731
22720
|
const isNft = isNftAsset3(selectedAsset);
|
|
22732
22721
|
const isSecurity = isSecurityToken2(selectedAsset);
|
|
22733
|
-
(0,
|
|
22722
|
+
(0, import_react77.useEffect)(
|
|
22734
22723
|
() => () => {
|
|
22735
22724
|
setSelectedAsset(null);
|
|
22736
22725
|
setRecipient("");
|
|
@@ -22740,7 +22729,7 @@ function SendMenu() {
|
|
|
22740
22729
|
},
|
|
22741
22730
|
[]
|
|
22742
22731
|
);
|
|
22743
|
-
(0,
|
|
22732
|
+
(0, import_react77.useEffect)(() => {
|
|
22744
22733
|
const shouldSetNativeAsset = assets.length > 0 && !selectedAsset;
|
|
22745
22734
|
if (!shouldSetNativeAsset) return;
|
|
22746
22735
|
const native = assets.find((a) => a.type === "native");
|
|
@@ -22751,7 +22740,7 @@ function SendMenu() {
|
|
|
22751
22740
|
const isNicknameInput = looksLikeNickname(recipient);
|
|
22752
22741
|
const resolvedNicknameData = useNicknameResolve(recipient, { enabled: isNicknameInput, chainId: activeChainId });
|
|
22753
22742
|
const effectiveAddress = isNicknameInput ? resolvedNicknameData?.resolvedAddress : recipient;
|
|
22754
|
-
const complianceAmount = (0,
|
|
22743
|
+
const complianceAmount = (0, import_react77.useMemo)(() => {
|
|
22755
22744
|
if (!isSecurity || !amount || !selectedAsset) return void 0;
|
|
22756
22745
|
try {
|
|
22757
22746
|
return (0, import_viem18.parseUnits)(amount, selectedAsset.decimals || 18);
|
|
@@ -22766,7 +22755,7 @@ function SendMenu() {
|
|
|
22766
22755
|
enabled: isSecurity && !!effectiveAddress && !!complianceAmount,
|
|
22767
22756
|
chainId: activeChainId
|
|
22768
22757
|
});
|
|
22769
|
-
(0,
|
|
22758
|
+
(0, import_react77.useEffect)(() => {
|
|
22770
22759
|
const updateMenuTitle = useFlowSelectorStore.getState().setMenuTitle;
|
|
22771
22760
|
switch (true) {
|
|
22772
22761
|
case txStep === "select-asset":
|
|
@@ -22830,7 +22819,7 @@ function SendMenu() {
|
|
|
22830
22819
|
] })
|
|
22831
22820
|
] });
|
|
22832
22821
|
}
|
|
22833
|
-
var import_lucide_react69,
|
|
22822
|
+
var import_lucide_react69, import_react77, import_viem18, import_jsx_runtime107;
|
|
22834
22823
|
var init_SendMenu = __esm({
|
|
22835
22824
|
"src/internal/components/SendMenu/send/SendMenu.tsx"() {
|
|
22836
22825
|
init_SessionContext();
|
|
@@ -22839,7 +22828,7 @@ var init_SendMenu = __esm({
|
|
|
22839
22828
|
init_useSendTransaction();
|
|
22840
22829
|
init_useT();
|
|
22841
22830
|
import_lucide_react69 = require("lucide-react");
|
|
22842
|
-
|
|
22831
|
+
import_react77 = require("react");
|
|
22843
22832
|
import_viem18 = require("viem");
|
|
22844
22833
|
init_useBlockscoutAssets();
|
|
22845
22834
|
init_useLayoutDataStore();
|
|
@@ -22924,7 +22913,7 @@ function SendFlowSelector() {
|
|
|
22924
22913
|
const error = useFlowSelectorStore((st) => st.error);
|
|
22925
22914
|
const menuTitle = useFlowSelectorStore((st) => st.menuTitle);
|
|
22926
22915
|
const selectorFlow = useFlowSelectorStore((st) => st.flow);
|
|
22927
|
-
(0,
|
|
22916
|
+
(0, import_react78.useEffect)(
|
|
22928
22917
|
() => () => {
|
|
22929
22918
|
useFlowSelectorStore.getState().setError(null);
|
|
22930
22919
|
},
|
|
@@ -23001,12 +22990,12 @@ function SendFlowSelector() {
|
|
|
23001
22990
|
}
|
|
23002
22991
|
);
|
|
23003
22992
|
}
|
|
23004
|
-
var import_lucide_react70,
|
|
22993
|
+
var import_lucide_react70, import_react78, import_jsx_runtime108, SELECTOR_FLOW;
|
|
23005
22994
|
var init_SendFlowSelector = __esm({
|
|
23006
22995
|
"src/internal/components/SendMenu/SendFlowSelector.tsx"() {
|
|
23007
22996
|
init_i18n();
|
|
23008
22997
|
import_lucide_react70 = require("lucide-react");
|
|
23009
|
-
|
|
22998
|
+
import_react78 = require("react");
|
|
23010
22999
|
init_useLayoutDataStore();
|
|
23011
23000
|
init_useLayoutStore();
|
|
23012
23001
|
init_utils2();
|
|
@@ -23061,12 +23050,12 @@ function getServerSnapshot() {
|
|
|
23061
23050
|
return false;
|
|
23062
23051
|
}
|
|
23063
23052
|
function useProMode() {
|
|
23064
|
-
return (0,
|
|
23053
|
+
return (0, import_react79.useSyncExternalStore)(subscribe, getSnapshot, getServerSnapshot);
|
|
23065
23054
|
}
|
|
23066
|
-
var
|
|
23055
|
+
var import_react79, STORAGE_KEY, EVENT_NAME;
|
|
23067
23056
|
var init_pro_mode = __esm({
|
|
23068
23057
|
"src/internal/lib/pro-mode.ts"() {
|
|
23069
|
-
|
|
23058
|
+
import_react79 = require("react");
|
|
23070
23059
|
STORAGE_KEY = "embarkai_pro_mode";
|
|
23071
23060
|
EVENT_NAME = "embarkai-pro-mode-changed";
|
|
23072
23061
|
}
|
|
@@ -23126,7 +23115,7 @@ function useSettingsButtons() {
|
|
|
23126
23115
|
if (proMode) {
|
|
23127
23116
|
settingsButtons.push({ id: "devices" /* DEVICES */, name: "Guardians", Icon: import_lucide_react72.HardDrive });
|
|
23128
23117
|
}
|
|
23129
|
-
(0,
|
|
23118
|
+
(0, import_react80.useEffect)(() => {
|
|
23130
23119
|
const cssvEl = document.querySelector(".embarkai-ui-scope");
|
|
23131
23120
|
if (!cssvEl || !window?.getComputedStyle) {
|
|
23132
23121
|
return;
|
|
@@ -23190,7 +23179,7 @@ function SettingsMenu() {
|
|
|
23190
23179
|
}
|
|
23191
23180
|
);
|
|
23192
23181
|
}
|
|
23193
|
-
var import_react_query49, import_lucide_react72,
|
|
23182
|
+
var import_react_query49, import_lucide_react72, import_react80, import_jsx_runtime110;
|
|
23194
23183
|
var init_SettingsMenu = __esm({
|
|
23195
23184
|
"src/internal/components/SettingsMenu/SettingsMenu.tsx"() {
|
|
23196
23185
|
init_ProviderContext();
|
|
@@ -23198,7 +23187,7 @@ var init_SettingsMenu = __esm({
|
|
|
23198
23187
|
init_i18n();
|
|
23199
23188
|
import_react_query49 = require("@tanstack/react-query");
|
|
23200
23189
|
import_lucide_react72 = require("lucide-react");
|
|
23201
|
-
|
|
23190
|
+
import_react80 = require("react");
|
|
23202
23191
|
init_nickname();
|
|
23203
23192
|
init_profile();
|
|
23204
23193
|
init_useLayoutDataStore();
|
|
@@ -23313,27 +23302,27 @@ function getHistoryUrls(params) {
|
|
|
23313
23302
|
}
|
|
23314
23303
|
return getBlockscoutHistoryUrls(params);
|
|
23315
23304
|
}
|
|
23316
|
-
var
|
|
23305
|
+
var import_read18, ETHERSCAN_V2_API_URL, BLOCKSCOUT_API_URLS, CHAIN_SPECIFIC_API_URLS, ETHERSCAN_CHAINS, UNSUPPORTED_HISTORY_CHAINS, TX_HISTORY_URLS;
|
|
23317
23306
|
var init_txUrls = __esm({
|
|
23318
23307
|
"src/internal/components/TransactionsMenu/txUrls.ts"() {
|
|
23319
|
-
|
|
23308
|
+
import_read18 = require("@embarkai/core/read");
|
|
23320
23309
|
init_base();
|
|
23321
23310
|
ETHERSCAN_V2_API_URL = "https://api.etherscan.io/v2/api";
|
|
23322
23311
|
BLOCKSCOUT_API_URLS = {
|
|
23323
|
-
[
|
|
23324
|
-
[
|
|
23312
|
+
[import_read18.ARBITRUM_SEPOLIA_CHAIN_ID]: "https://arbitrum-sepolia.blockscout.com/api",
|
|
23313
|
+
[import_read18.BASE_SEPOLIA_CHAIN_ID]: "https://base-sepolia.blockscout.com/api"
|
|
23325
23314
|
};
|
|
23326
23315
|
CHAIN_SPECIFIC_API_URLS = {};
|
|
23327
23316
|
ETHERSCAN_CHAINS = /* @__PURE__ */ new Set([
|
|
23328
|
-
|
|
23329
|
-
|
|
23330
|
-
|
|
23317
|
+
import_read18.SEPOLIA_CHAIN_ID,
|
|
23318
|
+
import_read18.ARBITRUM_SEPOLIA_CHAIN_ID,
|
|
23319
|
+
import_read18.BASE_SEPOLIA_CHAIN_ID
|
|
23331
23320
|
]);
|
|
23332
23321
|
UNSUPPORTED_HISTORY_CHAINS = /* @__PURE__ */ new Set([
|
|
23333
|
-
|
|
23322
|
+
import_read18.BSC_TESTNET_CHAIN_ID
|
|
23334
23323
|
]);
|
|
23335
23324
|
TX_HISTORY_URLS = {
|
|
23336
|
-
[
|
|
23325
|
+
[import_read18.LUMIA_TESTNET_CHAIN_ID]: (p) => {
|
|
23337
23326
|
const result = getBlockscoutHistoryUrls(p);
|
|
23338
23327
|
return {
|
|
23339
23328
|
transactionsUrl: result.transactionsUrl,
|
|
@@ -23341,7 +23330,7 @@ var init_txUrls = __esm({
|
|
|
23341
23330
|
tokenTransfersUrl: result.tokenTransfersUrl
|
|
23342
23331
|
};
|
|
23343
23332
|
},
|
|
23344
|
-
[
|
|
23333
|
+
[import_read18.LUMIA_MAINNET_CHAIN_ID]: (p) => {
|
|
23345
23334
|
const result = getBlockscoutHistoryUrls(p);
|
|
23346
23335
|
return {
|
|
23347
23336
|
transactionsUrl: result.transactionsUrl,
|
|
@@ -24140,7 +24129,7 @@ function TransactionsMenu() {
|
|
|
24140
24129
|
const { t } = useT();
|
|
24141
24130
|
const setPage = useLayoutDataStore((st) => st.setPage);
|
|
24142
24131
|
const maxScrollHeight = useLayoutStore((st) => st.maxScrollHeight);
|
|
24143
|
-
const [expandedGroups, setExpandedGroups] = (0,
|
|
24132
|
+
const [expandedGroups, setExpandedGroups] = (0, import_react81.useState)({});
|
|
24144
24133
|
const historySupported = isTransactionHistorySupported(chainConfig?.id);
|
|
24145
24134
|
const {
|
|
24146
24135
|
data: txHistoryGroups = [],
|
|
@@ -24153,7 +24142,7 @@ function TransactionsMenu() {
|
|
|
24153
24142
|
queryKey: [TRANSACTIONS_HISTORY_QUERY_KEY, chainConfig.id, address],
|
|
24154
24143
|
queryFn: () => getTransactionsListQuery({ address, chainConfig })
|
|
24155
24144
|
});
|
|
24156
|
-
const refreshTxHistory = (0,
|
|
24145
|
+
const refreshTxHistory = (0, import_react81.useCallback)(
|
|
24157
24146
|
() => qc.invalidateQueries({ queryKey: [TRANSACTIONS_HISTORY_QUERY_KEY, chainConfig.id, address] }),
|
|
24158
24147
|
[qc, chainConfig.id, address]
|
|
24159
24148
|
);
|
|
@@ -24202,14 +24191,14 @@ function TransactionsMenu() {
|
|
|
24202
24191
|
}
|
|
24203
24192
|
);
|
|
24204
24193
|
}
|
|
24205
|
-
var import_react_query50, import_lucide_react75,
|
|
24194
|
+
var import_react_query50, import_lucide_react75, import_react81, import_jsx_runtime114;
|
|
24206
24195
|
var init_TransactionsMenu = __esm({
|
|
24207
24196
|
"src/internal/components/TransactionsMenu/TransactionsMenu.tsx"() {
|
|
24208
24197
|
init_SessionContext();
|
|
24209
24198
|
init_i18n();
|
|
24210
24199
|
import_react_query50 = require("@tanstack/react-query");
|
|
24211
24200
|
import_lucide_react75 = require("lucide-react");
|
|
24212
|
-
|
|
24201
|
+
import_react81 = require("react");
|
|
24213
24202
|
init_useLayoutDataStore();
|
|
24214
24203
|
init_useLayoutStore();
|
|
24215
24204
|
init_Expandable2();
|
|
@@ -24407,7 +24396,7 @@ function usePageMapper() {
|
|
|
24407
24396
|
setIsDialogOpen,
|
|
24408
24397
|
setIsDialogClosing
|
|
24409
24398
|
} = useLayoutStore();
|
|
24410
|
-
const closeDialog = (0,
|
|
24399
|
+
const closeDialog = (0, import_react82.useCallback)(() => {
|
|
24411
24400
|
setIsDialogClosing(true);
|
|
24412
24401
|
setTimeout(() => {
|
|
24413
24402
|
setDialogContent(null);
|
|
@@ -24418,7 +24407,7 @@ function usePageMapper() {
|
|
|
24418
24407
|
setIsDialogOpen(false);
|
|
24419
24408
|
}, CLEAR_DIALOG_TIMEOUT);
|
|
24420
24409
|
}, [setDialogContent, setDialogDescription, setDialogTitle, setIsDialogForced, setIsDialogOpen, setIsDialogClosing]);
|
|
24421
|
-
const openDialog = (0,
|
|
24410
|
+
const openDialog = (0, import_react82.useCallback)(
|
|
24422
24411
|
(pageItem) => {
|
|
24423
24412
|
const PageContentComponent = pageItem.component;
|
|
24424
24413
|
setDialogTitle(pageItem.title);
|
|
@@ -24428,7 +24417,7 @@ function usePageMapper() {
|
|
|
24428
24417
|
},
|
|
24429
24418
|
[setDialogContent, setDialogDescription, setDialogTitle, setIsDialogOpen]
|
|
24430
24419
|
);
|
|
24431
|
-
(0,
|
|
24420
|
+
(0, import_react82.useEffect)(() => {
|
|
24432
24421
|
if (page === null) return closeDialog();
|
|
24433
24422
|
const pageItem = PAGE_MAP[page];
|
|
24434
24423
|
if (!pageItem) {
|
|
@@ -24439,10 +24428,10 @@ function usePageMapper() {
|
|
|
24439
24428
|
openDialog(pageItem);
|
|
24440
24429
|
}, [page, closeDialog, openDialog]);
|
|
24441
24430
|
}
|
|
24442
|
-
var
|
|
24431
|
+
var import_react82, import_jsx_runtime115, CLEAR_DIALOG_TIMEOUT;
|
|
24443
24432
|
var init_usePageMapper = __esm({
|
|
24444
24433
|
"src/internal/hooks/usePageMapper.tsx"() {
|
|
24445
|
-
|
|
24434
|
+
import_react82 = require("react");
|
|
24446
24435
|
init_PageMap();
|
|
24447
24436
|
init_constants();
|
|
24448
24437
|
init_useLayoutDataStore();
|
|
@@ -24456,7 +24445,7 @@ var init_usePageMapper = __esm({
|
|
|
24456
24445
|
function useSettingsNotifications() {
|
|
24457
24446
|
const address = useSession((st) => st.address);
|
|
24458
24447
|
const setSettingsNotifications = useLayoutDataStore((st) => st.setSettingsNotifications);
|
|
24459
|
-
const providers =
|
|
24448
|
+
const providers = import_auth23.jwtTokenManager.getProviders();
|
|
24460
24449
|
const hasEmail = providers.includes("email");
|
|
24461
24450
|
const { data: userProfile = null } = (0, import_react_query51.useQuery)({
|
|
24462
24451
|
retry: false,
|
|
@@ -24464,26 +24453,26 @@ function useSettingsNotifications() {
|
|
|
24464
24453
|
queryKey: [QUERY_KEYS.userProfile, address],
|
|
24465
24454
|
queryFn: getUserProfile
|
|
24466
24455
|
});
|
|
24467
|
-
(0,
|
|
24456
|
+
(0, import_react83.useEffect)(() => {
|
|
24468
24457
|
const isKYCVerified = userProfile?.kycDetails?.kycStatus === "verified";
|
|
24469
24458
|
setSettingsNotifications({
|
|
24470
24459
|
...COMPLETE_KYC_PROGRESS,
|
|
24471
24460
|
status: isKYCVerified ? "resolved" : "active"
|
|
24472
24461
|
});
|
|
24473
24462
|
}, [userProfile, setSettingsNotifications]);
|
|
24474
|
-
(0,
|
|
24463
|
+
(0, import_react83.useEffect)(() => {
|
|
24475
24464
|
setSettingsNotifications({
|
|
24476
24465
|
...EMAIL_NOT_CONNECTED_NOTIFICATION,
|
|
24477
24466
|
status: hasEmail ? "resolved" : "active"
|
|
24478
24467
|
});
|
|
24479
24468
|
}, [hasEmail, setSettingsNotifications]);
|
|
24480
24469
|
}
|
|
24481
|
-
var import_react_query51,
|
|
24470
|
+
var import_react_query51, import_react83, EMAIL_NOT_CONNECTED_NOTIFICATION, COMPLETE_KYC_PROGRESS;
|
|
24482
24471
|
var init_useSettingsNotifications = __esm({
|
|
24483
24472
|
"src/internal/hooks/useSettingsNotifications.ts"() {
|
|
24484
24473
|
init_SessionContext();
|
|
24485
24474
|
import_react_query51 = require("@tanstack/react-query");
|
|
24486
|
-
|
|
24475
|
+
import_react83 = require("react");
|
|
24487
24476
|
init_auth();
|
|
24488
24477
|
init_profile();
|
|
24489
24478
|
init_useLayoutDataStore();
|
|
@@ -24506,7 +24495,7 @@ var init_package = __esm({
|
|
|
24506
24495
|
"package.json"() {
|
|
24507
24496
|
package_default = {
|
|
24508
24497
|
name: "@embarkai/ui-kit",
|
|
24509
|
-
version: "0.4.
|
|
24498
|
+
version: "0.4.48",
|
|
24510
24499
|
description: "React UI components and hooks for EmbarkAI authentication and Account Abstraction",
|
|
24511
24500
|
type: "module",
|
|
24512
24501
|
main: "./dist/index.cjs",
|
|
@@ -24607,25 +24596,38 @@ var init_package = __esm({
|
|
|
24607
24596
|
function Footer() {
|
|
24608
24597
|
const qc = (0, import_react_query52.useQueryClient)();
|
|
24609
24598
|
const { callbacksRef } = useProviderConfig();
|
|
24610
|
-
const { address, setSession, setAddress, setStatus, setError, setIsLoading } = useSession();
|
|
24611
|
-
const chainConfig = useSession((st) => st.chainConfig);
|
|
24612
24599
|
const { t } = useT();
|
|
24613
|
-
const
|
|
24614
|
-
const
|
|
24600
|
+
const address = useSession((st) => st.address);
|
|
24601
|
+
const chainConfig = useSession((st) => st.chainConfig);
|
|
24602
|
+
const { disconnect: wagmiDisconnect } = (0, import_wagmi7.useDisconnect)({
|
|
24603
|
+
mutation: {
|
|
24604
|
+
onSuccess: () => {
|
|
24605
|
+
useExternalWalletStore.getState().clearExternalWallet();
|
|
24606
|
+
useExternalWalletStore.getState().setExternalChainId(null);
|
|
24607
|
+
console.log("[ExternalWalletStore] Disconnected from external wallet");
|
|
24608
|
+
},
|
|
24609
|
+
onError: (err) => {
|
|
24610
|
+
console.error("[ExternalWalletStore] Error disconnecting from external wallet:", err);
|
|
24611
|
+
}
|
|
24612
|
+
}
|
|
24613
|
+
});
|
|
24615
24614
|
const { mutate: disconnect, isPending: isDisconnecting } = (0, import_react_query52.useMutation)({
|
|
24616
24615
|
mutationFn: async (disconnectAddress) => {
|
|
24617
24616
|
if (!disconnectAddress) throw new Error("No address to disconnect");
|
|
24618
|
-
|
|
24617
|
+
const { setError, setStatus, setIsLoading } = useSession.getState();
|
|
24618
|
+
useLayoutStore.getState().setIsDialogForced(true);
|
|
24619
24619
|
setError(null);
|
|
24620
24620
|
setStatus("disconnecting");
|
|
24621
24621
|
setIsLoading(true);
|
|
24622
|
-
const userId =
|
|
24622
|
+
const userId = import_auth23.jwtTokenManager.getUserId() || null;
|
|
24623
24623
|
const { logout: logout2 } = await Promise.resolve().then(() => (init_auth(), auth_exports));
|
|
24624
24624
|
await logout2();
|
|
24625
24625
|
return { disconnectedUserId: userId, disconnectAddress };
|
|
24626
24626
|
},
|
|
24627
24627
|
onSuccess: async ({ disconnectAddress, disconnectedUserId }) => {
|
|
24628
24628
|
await qc.resetQueries({ queryKey: [CHECK_BACKUP_QUERY_KEY] });
|
|
24629
|
+
if (!!useExternalWalletStore.getState().externalAddress) wagmiDisconnect();
|
|
24630
|
+
const { setError, setStatus, setIsLoading, setSession, setAddress } = useSession.getState();
|
|
24629
24631
|
setSession(null);
|
|
24630
24632
|
setAddress(null);
|
|
24631
24633
|
setError(null);
|
|
@@ -24633,15 +24635,16 @@ function Footer() {
|
|
|
24633
24635
|
setIsLoading(false);
|
|
24634
24636
|
callbacksRef.current?.onDisconnect?.({ address: disconnectAddress, userId: disconnectedUserId });
|
|
24635
24637
|
setTimeout(() => {
|
|
24636
|
-
setPage("auth" /* AUTH */);
|
|
24637
|
-
setIsDialogForced(false);
|
|
24638
|
+
useLayoutDataStore.getState().setPage("auth" /* AUTH */);
|
|
24639
|
+
useLayoutStore.getState().setIsDialogForced(false);
|
|
24638
24640
|
}, 200);
|
|
24639
24641
|
},
|
|
24640
24642
|
onError: (err) => {
|
|
24643
|
+
const { setError, setStatus, setIsLoading } = useSession.getState();
|
|
24641
24644
|
setError(err.message || "An unknown error occurred during sign out");
|
|
24642
24645
|
setStatus("idle");
|
|
24643
24646
|
setIsLoading(false);
|
|
24644
|
-
setIsDialogForced(false);
|
|
24647
|
+
useLayoutStore.getState().setIsDialogForced(false);
|
|
24645
24648
|
}
|
|
24646
24649
|
});
|
|
24647
24650
|
const ChainIcon = NETWORK_OPTIONS.find((net) => net.chainId === chainConfig.id)?.Icon || (() => /* @__PURE__ */ (0, import_jsx_runtime116.jsx)("div", { className: "flex-none w-4 h-4 rounded-full flex items-center justify-center bg-[var(--ui-kit-primary)]", children: /* @__PURE__ */ (0, import_jsx_runtime116.jsx)("span", { className: "text-[var(--ui-kit-fg-inverted)] text-xs font-bold", children: chainConfig.name.charAt(0) }) }));
|
|
@@ -24694,21 +24697,23 @@ function Footer() {
|
|
|
24694
24697
|
}
|
|
24695
24698
|
);
|
|
24696
24699
|
}
|
|
24697
|
-
var import_react_query52, import_lucide_react76, import_jsx_runtime116;
|
|
24700
|
+
var import_react_query52, import_lucide_react76, import_wagmi7, import_jsx_runtime116;
|
|
24698
24701
|
var init_Footer = __esm({
|
|
24699
24702
|
"src/internal/components/Footer/Footer.tsx"() {
|
|
24700
24703
|
init_package();
|
|
24701
|
-
|
|
24704
|
+
init_networks4();
|
|
24702
24705
|
init_ProviderContext();
|
|
24703
24706
|
init_SessionContext();
|
|
24704
24707
|
init_i18n();
|
|
24705
24708
|
import_react_query52 = require("@tanstack/react-query");
|
|
24706
24709
|
import_lucide_react76 = require("lucide-react");
|
|
24710
|
+
import_wagmi7 = require("wagmi");
|
|
24707
24711
|
init_auth();
|
|
24708
24712
|
init_base();
|
|
24709
24713
|
init_useLayoutDataStore();
|
|
24710
24714
|
init_useLayoutStore();
|
|
24711
24715
|
init_utils2();
|
|
24716
|
+
init_useExternalWalletStore();
|
|
24712
24717
|
init_constants4();
|
|
24713
24718
|
init_button();
|
|
24714
24719
|
import_jsx_runtime116 = require("react/jsx-runtime");
|
|
@@ -24733,11 +24738,11 @@ function Header() {
|
|
|
24733
24738
|
const chainConfig = useSession((st) => st.chainConfig);
|
|
24734
24739
|
const { t } = useT();
|
|
24735
24740
|
const proMode = useProMode();
|
|
24736
|
-
const [proToast, setProToast] = (0,
|
|
24737
|
-
const [copied, setCopied] = (0,
|
|
24738
|
-
const clickCountRef = (0,
|
|
24739
|
-
const clickTimerRef = (0,
|
|
24740
|
-
const handleAvatarClick = (0,
|
|
24741
|
+
const [proToast, setProToast] = (0, import_react84.useState)(false);
|
|
24742
|
+
const [copied, setCopied] = (0, import_react84.useState)(false);
|
|
24743
|
+
const clickCountRef = (0, import_react84.useRef)(0);
|
|
24744
|
+
const clickTimerRef = (0, import_react84.useRef)(null);
|
|
24745
|
+
const handleAvatarClick = (0, import_react84.useCallback)(() => {
|
|
24741
24746
|
clickCountRef.current += 1;
|
|
24742
24747
|
if (clickTimerRef.current) {
|
|
24743
24748
|
clearTimeout(clickTimerRef.current);
|
|
@@ -24761,8 +24766,8 @@ function Header() {
|
|
|
24761
24766
|
queryKey: [QUERY_KEYS.userProfile, address],
|
|
24762
24767
|
queryFn: getUserProfile
|
|
24763
24768
|
});
|
|
24764
|
-
const avatar = profile?.avatar ||
|
|
24765
|
-
const displayName = profile?.nicknameDisplay || profile?.displayName ||
|
|
24769
|
+
const avatar = profile?.avatar || import_auth23.jwtTokenManager.getAvatar();
|
|
24770
|
+
const displayName = profile?.nicknameDisplay || profile?.displayName || import_auth23.jwtTokenManager.getDisplayName();
|
|
24766
24771
|
const ChainIcon = NETWORK_OPTIONS.find((net) => net.chainId === chainConfig.id)?.Icon || (() => /* @__PURE__ */ (0, import_jsx_runtime117.jsx)("div", { className: "flex-none w-4 h-4 rounded-full flex items-center justify-center bg-[var(--ui-kit-primary)]", children: /* @__PURE__ */ (0, import_jsx_runtime117.jsx)("span", { className: "text-[var(--ui-kit-fg-inverted)] text-xs font-bold", children: chainConfig.name.charAt(0) }) }));
|
|
24767
24772
|
return /* @__PURE__ */ (0, import_jsx_runtime117.jsxs)(
|
|
24768
24773
|
"div",
|
|
@@ -24837,17 +24842,17 @@ function Header() {
|
|
|
24837
24842
|
}
|
|
24838
24843
|
);
|
|
24839
24844
|
}
|
|
24840
|
-
var import_react_query53, import_lucide_react77,
|
|
24845
|
+
var import_react_query53, import_lucide_react77, import_react84, import_jsx_runtime117;
|
|
24841
24846
|
var init_Header = __esm({
|
|
24842
24847
|
"src/internal/components/Header/Header.tsx"() {
|
|
24843
24848
|
init_LumiaIcon3();
|
|
24844
|
-
|
|
24849
|
+
init_networks4();
|
|
24845
24850
|
init_ProviderContext();
|
|
24846
24851
|
init_SessionContext();
|
|
24847
24852
|
init_useT();
|
|
24848
24853
|
import_react_query53 = require("@tanstack/react-query");
|
|
24849
24854
|
import_lucide_react77 = require("lucide-react");
|
|
24850
|
-
|
|
24855
|
+
import_react84 = require("react");
|
|
24851
24856
|
init_PositiveIcon();
|
|
24852
24857
|
init_auth();
|
|
24853
24858
|
init_profile();
|
|
@@ -24878,7 +24883,7 @@ function useDecideContentStyles() {
|
|
|
24878
24883
|
style: (0, import_lodash_es10.merge)({}, mobileStyles)
|
|
24879
24884
|
};
|
|
24880
24885
|
}
|
|
24881
|
-
var DialogPrimitive, import_lodash_es10, import_lucide_react78,
|
|
24886
|
+
var DialogPrimitive, import_lodash_es10, import_lucide_react78, import_react85, import_jsx_runtime118, Dialog, DialogPortal, DialogOverlay, CONTENT_BG_SETUP, DialogContent, DialogHeader, DialogFooter, DialogTitle, DialogDescription;
|
|
24882
24887
|
var init_dialog = __esm({
|
|
24883
24888
|
"src/internal/components/ui/dialog.tsx"() {
|
|
24884
24889
|
init_utils2();
|
|
@@ -24887,14 +24892,14 @@ var init_dialog = __esm({
|
|
|
24887
24892
|
DialogPrimitive = __toESM(require("@radix-ui/react-dialog"), 1);
|
|
24888
24893
|
import_lodash_es10 = require("lodash-es");
|
|
24889
24894
|
import_lucide_react78 = require("lucide-react");
|
|
24890
|
-
|
|
24895
|
+
import_react85 = require("react");
|
|
24891
24896
|
init_useLayoutDataStore();
|
|
24892
24897
|
init_useLayoutStore();
|
|
24893
24898
|
init_button();
|
|
24894
24899
|
import_jsx_runtime118 = require("react/jsx-runtime");
|
|
24895
24900
|
Dialog = DialogPrimitive.Root;
|
|
24896
24901
|
DialogPortal = DialogPrimitive.Portal;
|
|
24897
|
-
DialogOverlay = (0,
|
|
24902
|
+
DialogOverlay = (0, import_react85.forwardRef)(
|
|
24898
24903
|
({ className, closing, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime118.jsx)(
|
|
24899
24904
|
DialogPrimitive.Overlay,
|
|
24900
24905
|
{
|
|
@@ -24916,7 +24921,7 @@ var init_dialog = __esm({
|
|
|
24916
24921
|
border: "1px solid var(--ui-kit-bd)",
|
|
24917
24922
|
boxShadow: "var(--ui-kit-shadow, 0px 4px 10px var(--ui-kit-shadow-c, rgba(0, 0, 0, 0.1)))"
|
|
24918
24923
|
};
|
|
24919
|
-
DialogContent = (0,
|
|
24924
|
+
DialogContent = (0, import_react85.forwardRef)(
|
|
24920
24925
|
({ className, children, colorMode, ...props }, ref) => {
|
|
24921
24926
|
const { t, i18n } = useT();
|
|
24922
24927
|
const isSessionLoading = useSession((st) => st.isLoading);
|
|
@@ -25019,7 +25024,7 @@ var init_dialog = __esm({
|
|
|
25019
25024
|
DialogHeader.displayName = "DialogHeader";
|
|
25020
25025
|
DialogFooter = ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime118.jsx)("div", { className: cn("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2", className), ...props });
|
|
25021
25026
|
DialogFooter.displayName = "DialogFooter";
|
|
25022
|
-
DialogTitle = (0,
|
|
25027
|
+
DialogTitle = (0, import_react85.forwardRef)(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime118.jsx)(
|
|
25023
25028
|
DialogPrimitive.Title,
|
|
25024
25029
|
{
|
|
25025
25030
|
ref,
|
|
@@ -25028,7 +25033,7 @@ var init_dialog = __esm({
|
|
|
25028
25033
|
}
|
|
25029
25034
|
));
|
|
25030
25035
|
DialogTitle.displayName = DialogPrimitive.Title.displayName;
|
|
25031
|
-
DialogDescription = (0,
|
|
25036
|
+
DialogDescription = (0, import_react85.forwardRef)(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime118.jsx)(DialogPrimitive.Description, { ref, className: cn("text-sm text-muted-foreground", className), ...props }));
|
|
25032
25037
|
DialogDescription.displayName = DialogPrimitive.Description.displayName;
|
|
25033
25038
|
}
|
|
25034
25039
|
});
|
|
@@ -25053,7 +25058,7 @@ function Dialog2() {
|
|
|
25053
25058
|
const isWalletLinking = useLayoutDataStore((st) => st.isWalletLinking);
|
|
25054
25059
|
const setPage = useLayoutDataStore((st) => st.setPage);
|
|
25055
25060
|
const { colorMode, isDialogOpen, dialogTitle, dialogDescription, dialogContent, isDialogForced, setIsSettings } = useLayoutStore();
|
|
25056
|
-
(0,
|
|
25061
|
+
(0, import_react86.useEffect)(() => setIsSettings(!!session), [session, setIsSettings]);
|
|
25057
25062
|
usePageMapper();
|
|
25058
25063
|
useAutoConnect();
|
|
25059
25064
|
useBackupStatusChanges();
|
|
@@ -25091,13 +25096,13 @@ function Dialog2() {
|
|
|
25091
25096
|
}
|
|
25092
25097
|
);
|
|
25093
25098
|
}
|
|
25094
|
-
var import_framer_motion,
|
|
25099
|
+
var import_framer_motion, import_react86, import_jsx_runtime120;
|
|
25095
25100
|
var init_Dialog = __esm({
|
|
25096
25101
|
"src/internal/components/Dialog/Dialog.tsx"() {
|
|
25097
25102
|
init_ProviderContext();
|
|
25098
25103
|
init_SessionContext();
|
|
25099
25104
|
import_framer_motion = require("framer-motion");
|
|
25100
|
-
|
|
25105
|
+
import_react86 = require("react");
|
|
25101
25106
|
init_constants();
|
|
25102
25107
|
init_useAutoConnect();
|
|
25103
25108
|
init_useBackupStatusChanges();
|
|
@@ -25123,14 +25128,14 @@ var init_Dialog2 = __esm({
|
|
|
25123
25128
|
});
|
|
25124
25129
|
|
|
25125
25130
|
// src/internal/components/TssManager.tsx
|
|
25126
|
-
var
|
|
25131
|
+
var import_react87, TssManagerWithRef;
|
|
25127
25132
|
var init_TssManager = __esm({
|
|
25128
25133
|
"src/internal/components/TssManager.tsx"() {
|
|
25129
25134
|
init_SessionContext();
|
|
25130
|
-
|
|
25135
|
+
import_react87 = __toESM(require("react"), 1);
|
|
25131
25136
|
init_auth();
|
|
25132
25137
|
init_clients();
|
|
25133
|
-
TssManagerWithRef =
|
|
25138
|
+
TssManagerWithRef = import_react87.default.forwardRef((props, ref) => {
|
|
25134
25139
|
const { mpcPin } = props;
|
|
25135
25140
|
const usePaymaster = useSession((st) => st.usePaymaster);
|
|
25136
25141
|
const publicClient = useSession((st) => st.publicClient);
|
|
@@ -25138,14 +25143,14 @@ var init_TssManager = __esm({
|
|
|
25138
25143
|
const setStatus = useSession((st) => st.setStatus);
|
|
25139
25144
|
const setSession = useSession((st) => st.setSession);
|
|
25140
25145
|
const setAddress = useSession((st) => st.setAddress);
|
|
25141
|
-
const onSessionCreated = (0,
|
|
25146
|
+
const onSessionCreated = (0, import_react87.useCallback)(
|
|
25142
25147
|
(session, address) => {
|
|
25143
25148
|
setSession(session);
|
|
25144
25149
|
setAddress(address);
|
|
25145
25150
|
},
|
|
25146
25151
|
[setSession, setAddress]
|
|
25147
25152
|
);
|
|
25148
|
-
const createSessionWithKeyshare =
|
|
25153
|
+
const createSessionWithKeyshare = import_react87.default.useCallback(
|
|
25149
25154
|
async (userId, hasServerKeyshare, isNewUser) => {
|
|
25150
25155
|
setStatus("checking key management setup...");
|
|
25151
25156
|
await ensureKeyshare(userId, hasServerKeyshare, setStatus, isNewUser);
|
|
@@ -25170,7 +25175,7 @@ var init_TssManager = __esm({
|
|
|
25170
25175
|
},
|
|
25171
25176
|
[setStatus, usePaymaster, activeChainId, publicClient, mpcPin]
|
|
25172
25177
|
);
|
|
25173
|
-
|
|
25178
|
+
import_react87.default.useImperativeHandle(ref, () => ({ createSessionWithKeyshare }), [createSessionWithKeyshare]);
|
|
25174
25179
|
return null;
|
|
25175
25180
|
});
|
|
25176
25181
|
}
|
|
@@ -25181,10 +25186,10 @@ function WalletConnectHandler() {
|
|
|
25181
25186
|
const qc = (0, import_react_query54.useQueryClient)();
|
|
25182
25187
|
const { callbacksRef } = useProviderConfig();
|
|
25183
25188
|
const passportWalletAddress = useSession((st) => st.address);
|
|
25184
|
-
const { address: walletAddress, isConnected, chain, connector } = (0,
|
|
25189
|
+
const { address: walletAddress, isConnected, chain, connector } = (0, import_wagmi8.useAccount)();
|
|
25185
25190
|
const { openConnectModal, connectModalOpen } = (0, import_rainbowkit2.useConnectModal)();
|
|
25186
|
-
const { disconnect } = (0,
|
|
25187
|
-
const { signMessageAsync } = (0,
|
|
25191
|
+
const { disconnect } = (0, import_wagmi8.useDisconnect)();
|
|
25192
|
+
const { signMessageAsync } = (0, import_wagmi8.useSignMessage)();
|
|
25188
25193
|
const isWalletLinking = useLayoutDataStore((st) => st.isWalletLinking);
|
|
25189
25194
|
const setPage = useLayoutDataStore((st) => st.setPage);
|
|
25190
25195
|
const setIsWalletLinking = useLayoutDataStore((st) => st.setIsWalletLinking);
|
|
@@ -25198,7 +25203,7 @@ function WalletConnectHandler() {
|
|
|
25198
25203
|
const projectId = providerConfig?.projectId;
|
|
25199
25204
|
const setExternalWallet = useExternalWalletStore((st) => st.setExternalWallet);
|
|
25200
25205
|
const setPendingWalletLogin = useLayoutDataStore((st) => st.setPendingWalletLogin);
|
|
25201
|
-
const onLinkingComplete = (0,
|
|
25206
|
+
const onLinkingComplete = (0, import_react88.useCallback)(
|
|
25202
25207
|
async (success) => {
|
|
25203
25208
|
setIsWalletLinking(false);
|
|
25204
25209
|
if (!success && !passportWalletAddress) {
|
|
@@ -25227,10 +25232,10 @@ function WalletConnectHandler() {
|
|
|
25227
25232
|
},
|
|
25228
25233
|
[qc, passportWalletAddress, setProviderType, setPage, setIsWalletLinking]
|
|
25229
25234
|
);
|
|
25230
|
-
const [hasStartedLinking, setHasStartedLinking] =
|
|
25231
|
-
const [modalWasOpened, setModalWasOpened] =
|
|
25232
|
-
const [pendingModalOpen, setPendingModalOpen] =
|
|
25233
|
-
(0,
|
|
25235
|
+
const [hasStartedLinking, setHasStartedLinking] = import_react88.default.useState(false);
|
|
25236
|
+
const [modalWasOpened, setModalWasOpened] = import_react88.default.useState(false);
|
|
25237
|
+
const [pendingModalOpen, setPendingModalOpen] = import_react88.default.useState(false);
|
|
25238
|
+
(0, import_react88.useEffect)(() => {
|
|
25234
25239
|
if (isWalletLinking && !hasStartedLinking) {
|
|
25235
25240
|
console.log("[WalletConnectHandler] Starting wallet link flow:", {
|
|
25236
25241
|
isConnected,
|
|
@@ -25268,18 +25273,18 @@ function WalletConnectHandler() {
|
|
|
25268
25273
|
setProviderType,
|
|
25269
25274
|
walletMode
|
|
25270
25275
|
]);
|
|
25271
|
-
(0,
|
|
25276
|
+
(0, import_react88.useEffect)(() => {
|
|
25272
25277
|
if (pendingModalOpen && !isConnected && openConnectModal) {
|
|
25273
25278
|
setPendingModalOpen(false);
|
|
25274
25279
|
openConnectModal();
|
|
25275
25280
|
}
|
|
25276
25281
|
}, [pendingModalOpen, isConnected, openConnectModal]);
|
|
25277
|
-
(0,
|
|
25282
|
+
(0, import_react88.useEffect)(() => {
|
|
25278
25283
|
if (connectModalOpen && hasStartedLinking) {
|
|
25279
25284
|
setModalWasOpened(true);
|
|
25280
25285
|
}
|
|
25281
25286
|
}, [connectModalOpen, hasStartedLinking]);
|
|
25282
|
-
(0,
|
|
25287
|
+
(0, import_react88.useEffect)(() => {
|
|
25283
25288
|
if (modalWasOpened && !connectModalOpen && !isConnected && isWalletLinking) {
|
|
25284
25289
|
console.log("[WalletConnectHandler] Modal closed without connecting");
|
|
25285
25290
|
onLinkingComplete(false);
|
|
@@ -25287,7 +25292,7 @@ function WalletConnectHandler() {
|
|
|
25287
25292
|
setModalWasOpened(false);
|
|
25288
25293
|
}
|
|
25289
25294
|
}, [connectModalOpen, modalWasOpened, isConnected, isWalletLinking]);
|
|
25290
|
-
(0,
|
|
25295
|
+
(0, import_react88.useEffect)(() => {
|
|
25291
25296
|
if (isWalletLinking) {
|
|
25292
25297
|
const timeout = setTimeout(() => {
|
|
25293
25298
|
console.warn("[WalletConnectHandler] Wallet linking timed out, resetting state");
|
|
@@ -25407,7 +25412,7 @@ function WalletConnectHandler() {
|
|
|
25407
25412
|
setPage(passportWalletAddress ? "manage-wallet" /* MANAGE_WALLET */ : "auth" /* AUTH */);
|
|
25408
25413
|
}
|
|
25409
25414
|
});
|
|
25410
|
-
(0,
|
|
25415
|
+
(0, import_react88.useEffect)(() => {
|
|
25411
25416
|
if (!!chain?.id && isConnected && walletAddress && isWalletLinking && hasStartedLinking && modalWasOpened && !pendingModalOpen) {
|
|
25412
25417
|
console.log("[WalletConnectHandler] handleWalletSign triggered");
|
|
25413
25418
|
if (!passportWalletAddress) {
|
|
@@ -25417,7 +25422,7 @@ function WalletConnectHandler() {
|
|
|
25417
25422
|
handleWalletSign({ chainId: chain.id, signingWalletAddress: walletAddress });
|
|
25418
25423
|
}
|
|
25419
25424
|
}, [chain, isConnected, walletAddress, isWalletLinking, hasStartedLinking, modalWasOpened, pendingModalOpen]);
|
|
25420
|
-
(0,
|
|
25425
|
+
(0, import_react88.useEffect)(() => {
|
|
25421
25426
|
if (isConnected && !chain?.id && isWalletLinking && hasStartedLinking && !connectModalOpen && !isWalletSigning) {
|
|
25422
25427
|
const timeout = setTimeout(() => {
|
|
25423
25428
|
console.warn("[WalletConnectHandler] Wallet connected but chain info missing, resetting");
|
|
@@ -25439,7 +25444,7 @@ function WalletConnectHandler() {
|
|
|
25439
25444
|
]);
|
|
25440
25445
|
return null;
|
|
25441
25446
|
}
|
|
25442
|
-
var import_rainbowkit2, import_react_query54,
|
|
25447
|
+
var import_rainbowkit2, import_react_query54, import_react88, import_wagmi8;
|
|
25443
25448
|
var init_WalletConnectHandler = __esm({
|
|
25444
25449
|
"src/internal/components/WalletConnectHandler.tsx"() {
|
|
25445
25450
|
init_ProviderContext();
|
|
@@ -25447,8 +25452,8 @@ var init_WalletConnectHandler = __esm({
|
|
|
25447
25452
|
init_linkedProfiles();
|
|
25448
25453
|
import_rainbowkit2 = require("@rainbow-me/rainbowkit");
|
|
25449
25454
|
import_react_query54 = require("@tanstack/react-query");
|
|
25450
|
-
|
|
25451
|
-
|
|
25455
|
+
import_react88 = __toESM(require("react"), 1);
|
|
25456
|
+
import_wagmi8 = require("wagmi");
|
|
25452
25457
|
init_wallet();
|
|
25453
25458
|
init_AuthMenu2();
|
|
25454
25459
|
init_useLayoutDataStore();
|
|
@@ -25460,7 +25465,7 @@ var init_WalletConnectHandler = __esm({
|
|
|
25460
25465
|
// src/internal/components/DirectWalletHandler.tsx
|
|
25461
25466
|
function DirectWalletHandler() {
|
|
25462
25467
|
const walletMode = useProviderConfig().config.current?.wallet?.mode || "linked";
|
|
25463
|
-
const { address, isConnected, chain, connector } = (0,
|
|
25468
|
+
const { address, isConnected, chain, connector } = (0, import_wagmi9.useAccount)();
|
|
25464
25469
|
const isExternalConnected = useExternalWalletStore((st) => st.isExternalConnected);
|
|
25465
25470
|
const externalAddress = useExternalWalletStore((st) => st.externalAddress);
|
|
25466
25471
|
const setExternalWallet = useExternalWalletStore((st) => st.setExternalWallet);
|
|
@@ -25468,13 +25473,13 @@ function DirectWalletHandler() {
|
|
|
25468
25473
|
const setExternalChainId = useExternalWalletStore((st) => st.setExternalChainId);
|
|
25469
25474
|
const setConfigMode = useExternalWalletStore((st) => st.setConfigMode);
|
|
25470
25475
|
const setActiveMode = useExternalWalletStore((st) => st.setActiveMode);
|
|
25471
|
-
(0,
|
|
25476
|
+
(0, import_react89.useEffect)(() => {
|
|
25472
25477
|
setConfigMode(walletMode);
|
|
25473
25478
|
if (walletMode !== "both") {
|
|
25474
25479
|
setActiveMode(walletMode);
|
|
25475
25480
|
}
|
|
25476
25481
|
}, [walletMode, setConfigMode, setActiveMode]);
|
|
25477
|
-
(0,
|
|
25482
|
+
(0, import_react89.useEffect)(() => {
|
|
25478
25483
|
if (isConnected && address && !isExternalConnected && connector && chain?.id) {
|
|
25479
25484
|
setExternalWallet({
|
|
25480
25485
|
address,
|
|
@@ -25483,17 +25488,17 @@ function DirectWalletHandler() {
|
|
|
25483
25488
|
});
|
|
25484
25489
|
}
|
|
25485
25490
|
}, [isConnected, address, isExternalConnected, connector, chain?.id, setExternalWallet]);
|
|
25486
|
-
(0,
|
|
25491
|
+
(0, import_react89.useEffect)(() => {
|
|
25487
25492
|
if (isExternalConnected && !isConnected) {
|
|
25488
25493
|
clearExternalWallet();
|
|
25489
25494
|
}
|
|
25490
25495
|
}, [isConnected, isExternalConnected, clearExternalWallet]);
|
|
25491
|
-
(0,
|
|
25496
|
+
(0, import_react89.useEffect)(() => {
|
|
25492
25497
|
if (isExternalConnected && isConnected && chain?.id) {
|
|
25493
25498
|
setExternalChainId(chain.id);
|
|
25494
25499
|
}
|
|
25495
25500
|
}, [chain?.id, isConnected, isExternalConnected, setExternalChainId]);
|
|
25496
|
-
(0,
|
|
25501
|
+
(0, import_react89.useEffect)(() => {
|
|
25497
25502
|
if (isExternalConnected && isConnected && address && address !== externalAddress && connector && chain?.id) {
|
|
25498
25503
|
setExternalWallet({
|
|
25499
25504
|
address,
|
|
@@ -25504,11 +25509,11 @@ function DirectWalletHandler() {
|
|
|
25504
25509
|
}, [address, isConnected, isExternalConnected, externalAddress, chain?.id, connector, setExternalWallet]);
|
|
25505
25510
|
return null;
|
|
25506
25511
|
}
|
|
25507
|
-
var
|
|
25512
|
+
var import_react89, import_wagmi9;
|
|
25508
25513
|
var init_DirectWalletHandler = __esm({
|
|
25509
25514
|
"src/internal/components/DirectWalletHandler.tsx"() {
|
|
25510
|
-
|
|
25511
|
-
|
|
25515
|
+
import_react89 = require("react");
|
|
25516
|
+
import_wagmi9 = require("wagmi");
|
|
25512
25517
|
init_ProviderContext();
|
|
25513
25518
|
init_useExternalWalletStore();
|
|
25514
25519
|
}
|
|
@@ -25519,9 +25524,9 @@ function getChainParams(chainCfg) {
|
|
|
25519
25524
|
return {
|
|
25520
25525
|
activeChainId: chainCfg.id,
|
|
25521
25526
|
chainConfig: chainCfg,
|
|
25522
|
-
publicClient: (0,
|
|
25523
|
-
bundlerClient: (0,
|
|
25524
|
-
viemChain: (0,
|
|
25527
|
+
publicClient: (0, import_read19.createPublicClientForChain)(chainCfg.id),
|
|
25528
|
+
bundlerClient: (0, import_read19.createBundlerClientForChain)(chainCfg.id),
|
|
25529
|
+
viemChain: (0, import_read19.getViemChain)(chainCfg.id)
|
|
25525
25530
|
};
|
|
25526
25531
|
}
|
|
25527
25532
|
function waitForStoreHydration() {
|
|
@@ -25532,7 +25537,7 @@ function waitForStoreHydration() {
|
|
|
25532
25537
|
}
|
|
25533
25538
|
function SessionProvider({ children }) {
|
|
25534
25539
|
const config = useProviderConfig().config;
|
|
25535
|
-
return /* @__PURE__ */ (0, import_jsx_runtime121.jsxs)(
|
|
25540
|
+
return /* @__PURE__ */ (0, import_jsx_runtime121.jsxs)(import_react90.Fragment, { children: [
|
|
25536
25541
|
children,
|
|
25537
25542
|
config.current?.wallet?.enabled && /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(WalletConnectHandler, {}),
|
|
25538
25543
|
config.current?.wallet?.enabled && (config.current?.wallet?.mode === "direct" || config.current?.wallet?.mode === "both") && /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(DirectWalletHandler, {}),
|
|
@@ -25547,11 +25552,11 @@ function SessionProvider({ children }) {
|
|
|
25547
25552
|
/* @__PURE__ */ (0, import_jsx_runtime121.jsx)(Dialog2, {})
|
|
25548
25553
|
] });
|
|
25549
25554
|
}
|
|
25550
|
-
var
|
|
25555
|
+
var import_read19, import_react90, import_zustand13, import_middleware4, import_jsx_runtime121, useSession, requireActiveChainId;
|
|
25551
25556
|
var init_SessionContext = __esm({
|
|
25552
25557
|
"src/context/SessionContext.tsx"() {
|
|
25553
|
-
|
|
25554
|
-
|
|
25558
|
+
import_read19 = require("@embarkai/core/read");
|
|
25559
|
+
import_react90 = require("react");
|
|
25555
25560
|
import_zustand13 = require("zustand");
|
|
25556
25561
|
import_middleware4 = require("zustand/middleware");
|
|
25557
25562
|
init_BalanceFeedProvider2();
|
|
@@ -25622,7 +25627,7 @@ var init_SessionContext = __esm({
|
|
|
25622
25627
|
// Set default chainId after hydration if not persisted
|
|
25623
25628
|
onRehydrateStorage: () => (state) => {
|
|
25624
25629
|
if (!state) return;
|
|
25625
|
-
const hydartedChain = getChainParams((0,
|
|
25630
|
+
const hydartedChain = getChainParams((0, import_read19.getChainConfig)(state.activeChainId || import_read19.DEFAULT_CHAIN_ID));
|
|
25626
25631
|
state.activeChainId = hydartedChain.activeChainId;
|
|
25627
25632
|
state.publicClient = hydartedChain.publicClient;
|
|
25628
25633
|
state.bundlerClient = hydartedChain.bundlerClient;
|
|
@@ -25697,31 +25702,31 @@ function getExplorerUrl() {
|
|
|
25697
25702
|
const paramUrl = typeof window !== "undefined" ? new URLSearchParams(window.location.search).get("explorerUrl") || void 0 : void 0;
|
|
25698
25703
|
const net = getSelectedNetwork();
|
|
25699
25704
|
const chainId = requireActiveChainId();
|
|
25700
|
-
const chainConfig = (0,
|
|
25705
|
+
const chainConfig = (0, import_read20.getChainConfig)(chainId);
|
|
25701
25706
|
console.log("[getExplorerUrl] ", paramUrl, chainConfig.blockExplorerUrl);
|
|
25702
25707
|
return paramUrl || chainConfig.blockExplorerUrl;
|
|
25703
25708
|
}
|
|
25704
25709
|
function getBundlerClient() {
|
|
25705
25710
|
const chainId = requireActiveChainId();
|
|
25706
|
-
const chainConfig = (0,
|
|
25707
|
-
const viemChain = (0,
|
|
25711
|
+
const chainConfig = (0, import_read20.getChainConfig)(chainId);
|
|
25712
|
+
const viemChain = (0, import_read20.getViemChain)(chainId);
|
|
25708
25713
|
return (0, import_account_abstraction2.createBundlerClient)({
|
|
25709
25714
|
chain: viemChain,
|
|
25710
25715
|
transport: (0, import_viem19.http)(chainConfig.bundlerUrl, { timeout: 1e4, retryCount: 0, fetchOptions: { mode: "cors" } })
|
|
25711
25716
|
});
|
|
25712
25717
|
}
|
|
25713
|
-
var
|
|
25718
|
+
var import_read20, import_viem19, import_account_abstraction2, BUILD_NETWORK, lumiaBeamTestnet, lumiaPrisma, FUNDER_PK;
|
|
25714
25719
|
var init_base = __esm({
|
|
25715
25720
|
"src/internal/clients/base.ts"() {
|
|
25716
25721
|
init_initial();
|
|
25717
25722
|
init_SessionContext();
|
|
25718
|
-
|
|
25723
|
+
import_read20 = require("@embarkai/core/read");
|
|
25719
25724
|
import_viem19 = require("viem");
|
|
25720
25725
|
import_account_abstraction2 = require("viem/account-abstraction");
|
|
25721
25726
|
init_env();
|
|
25722
25727
|
BUILD_NETWORK = true ? "" : "";
|
|
25723
|
-
lumiaBeamTestnet =
|
|
25724
|
-
lumiaPrisma =
|
|
25728
|
+
lumiaBeamTestnet = import_read20.lumiaTestnetChain;
|
|
25729
|
+
lumiaPrisma = import_read20.lumiaMainnetChain;
|
|
25725
25730
|
FUNDER_PK = getEnvVar("VITE_FUNDER_PK") || "";
|
|
25726
25731
|
}
|
|
25727
25732
|
});
|
|
@@ -26441,7 +26446,7 @@ var init_vaultClient = __esm({
|
|
|
26441
26446
|
|
|
26442
26447
|
// src/internal/auth/keyshare.ts
|
|
26443
26448
|
async function checkKeyshareStatusWithSync(userId) {
|
|
26444
|
-
const serverHasKeyshare = await (0,
|
|
26449
|
+
const serverHasKeyshare = await (0, import_auth23.syncKeyshareStatus)();
|
|
26445
26450
|
return checkKeyshareStatus(userId, serverHasKeyshare);
|
|
26446
26451
|
}
|
|
26447
26452
|
async function checkKeyshareStatus(userId, serverHasKeyshare) {
|
|
@@ -26475,7 +26480,7 @@ async function ensureKeyshareForNewUser(userId, onProgress) {
|
|
|
26475
26480
|
onProgress?.("Setting up secure key management...");
|
|
26476
26481
|
const result = await ensureDkgAndGetOwner(userId);
|
|
26477
26482
|
if (!result.ownerAddress) throw new Error("DKG completed but no owner address received");
|
|
26478
|
-
await (0,
|
|
26483
|
+
await (0, import_auth23.syncKeyshareStatus)();
|
|
26479
26484
|
onProgress?.("Key management setup complete");
|
|
26480
26485
|
return { ownerAddress: result.ownerAddress };
|
|
26481
26486
|
}
|
|
@@ -26560,7 +26565,7 @@ var init_keyshare = __esm({
|
|
|
26560
26565
|
|
|
26561
26566
|
// src/internal/auth/providers/x.ts
|
|
26562
26567
|
async function linkX() {
|
|
26563
|
-
const hasValidToken = await (0,
|
|
26568
|
+
const hasValidToken = await (0, import_auth23.ensureValidToken)();
|
|
26564
26569
|
if (!hasValidToken) throw new Error("No authentication token available");
|
|
26565
26570
|
throw new Error('Use openSocialAuthPopup("x") to link X account');
|
|
26566
26571
|
}
|
|
@@ -26568,10 +26573,10 @@ async function loginWithX() {
|
|
|
26568
26573
|
throw new Error('Use openSocialAuthPopup("x") to login with X account');
|
|
26569
26574
|
}
|
|
26570
26575
|
async function unlinkX(externalId) {
|
|
26571
|
-
const hasValidToken = await (0,
|
|
26576
|
+
const hasValidToken = await (0, import_auth23.ensureValidToken)();
|
|
26572
26577
|
if (!hasValidToken) throw new Error("No authentication token available");
|
|
26573
26578
|
const url = externalId ? `${getTssUrl3()}/api/auth/unlink/x?externalId=${encodeURIComponent(externalId)}` : `${getTssUrl3()}/api/auth/unlink/x`;
|
|
26574
|
-
const response = await (0,
|
|
26579
|
+
const response = await (0, import_auth23.authenticatedFetch)(url, {
|
|
26575
26580
|
method: "DELETE"
|
|
26576
26581
|
});
|
|
26577
26582
|
if (!response.ok) {
|
|
@@ -26602,9 +26607,9 @@ var init_providers = __esm({
|
|
|
26602
26607
|
// src/internal/auth/index.ts
|
|
26603
26608
|
var auth_exports = {};
|
|
26604
26609
|
__export(auth_exports, {
|
|
26605
|
-
JwtTokenManager: () =>
|
|
26610
|
+
JwtTokenManager: () => import_auth23.JwtTokenManager,
|
|
26606
26611
|
authenticateWithPasskey: () => authenticateWithPasskey,
|
|
26607
|
-
authenticatedFetch: () =>
|
|
26612
|
+
authenticatedFetch: () => import_auth23.authenticatedFetch,
|
|
26608
26613
|
beginPasskeyAuthentication: () => beginPasskeyAuthentication,
|
|
26609
26614
|
beginPasskeyLinking: () => beginPasskeyLinking,
|
|
26610
26615
|
beginPasskeyRegistration: () => beginPasskeyRegistration,
|
|
@@ -26614,53 +26619,53 @@ __export(auth_exports, {
|
|
|
26614
26619
|
completePasskeyAuthentication: () => completePasskeyAuthentication,
|
|
26615
26620
|
completePasskeyLinking: () => completePasskeyLinking,
|
|
26616
26621
|
completePasskeyRegistration: () => completePasskeyRegistration,
|
|
26617
|
-
configureJwtModule: () =>
|
|
26622
|
+
configureJwtModule: () => import_auth23.configureJwtModule,
|
|
26618
26623
|
createInitialAuthState: () => createInitialAuthState,
|
|
26619
|
-
createJwtTokenManager: () =>
|
|
26624
|
+
createJwtTokenManager: () => import_auth23.createJwtTokenManager,
|
|
26620
26625
|
createLoginMessage: () => createLoginMessage,
|
|
26621
26626
|
createPasskeyHelpers: () => createPasskeyHelpers,
|
|
26622
26627
|
createSignatureMessage: () => createSignatureMessage,
|
|
26623
26628
|
deriveDemoPrivateKey: () => deriveDemoPrivateKey,
|
|
26624
26629
|
ensureKeyshare: () => ensureKeyshare,
|
|
26625
|
-
ensureValidToken: () =>
|
|
26630
|
+
ensureValidToken: () => import_auth23.ensureValidToken,
|
|
26626
26631
|
fetchProjectName: () => fetchProjectName,
|
|
26627
26632
|
formatDate: () => formatDate,
|
|
26628
26633
|
getKeyshareInfo: () => getKeyshareInfo,
|
|
26629
26634
|
getLinkedProviders: () => getLinkedProviders,
|
|
26630
26635
|
getProviderDisplayInfo: () => getProviderDisplayInfo,
|
|
26631
26636
|
getTssUrl: () => getTssUrl3,
|
|
26632
|
-
getValidTokens: () =>
|
|
26637
|
+
getValidTokens: () => import_auth23.getValidTokens,
|
|
26633
26638
|
hasAvailablePasskeys: () => hasAvailablePasskeys,
|
|
26634
26639
|
hideTelegramWidget: () => hideTelegramWidget,
|
|
26635
26640
|
initTelegramWidget: () => initTelegramWidget,
|
|
26636
26641
|
isWebAuthnSupported: () => isWebAuthnSupported,
|
|
26637
|
-
jwtTokenManager: () =>
|
|
26642
|
+
jwtTokenManager: () => import_auth23.jwtTokenManager,
|
|
26638
26643
|
linkPasskeyWithWebAuthn: () => linkPasskeyWithWebAuthn,
|
|
26639
26644
|
linkTelegram: () => linkTelegram,
|
|
26640
26645
|
linkWallet: () => linkWallet,
|
|
26641
26646
|
linkX: () => linkX,
|
|
26642
|
-
loginWithEmail: () =>
|
|
26643
|
-
loginWithTelegram: () =>
|
|
26644
|
-
loginWithUserId: () =>
|
|
26647
|
+
loginWithEmail: () => import_auth23.loginWithEmail,
|
|
26648
|
+
loginWithTelegram: () => import_auth23.loginWithTelegram,
|
|
26649
|
+
loginWithUserId: () => import_auth23.loginWithUserId,
|
|
26645
26650
|
loginWithX: () => loginWithX,
|
|
26646
|
-
logout: () =>
|
|
26651
|
+
logout: () => import_auth23.logout,
|
|
26647
26652
|
mountTelegramLoginWidget: () => mountTelegramLoginWidget,
|
|
26648
26653
|
registerPasskey: () => registerPasskey,
|
|
26649
26654
|
resetWebAuthnFlags: () => resetWebAuthnFlags,
|
|
26650
26655
|
sendEmailLinkCode: () => sendEmailLinkCode,
|
|
26651
26656
|
showTelegramWidget: () => showTelegramWidget,
|
|
26652
|
-
syncKeyshareStatus: () =>
|
|
26657
|
+
syncKeyshareStatus: () => import_auth23.syncKeyshareStatus,
|
|
26653
26658
|
unlinkProvider: () => unlinkProvider,
|
|
26654
26659
|
unlinkWallet: () => unlinkWallet,
|
|
26655
26660
|
unlinkX: () => unlinkX,
|
|
26656
26661
|
verifyEmailLinkCode: () => verifyEmailLinkCode,
|
|
26657
|
-
verifyToken: () =>
|
|
26662
|
+
verifyToken: () => import_auth23.verifyToken,
|
|
26658
26663
|
walletLogin: () => walletLogin
|
|
26659
26664
|
});
|
|
26660
|
-
var
|
|
26665
|
+
var import_auth23, createInitialAuthState;
|
|
26661
26666
|
var init_auth = __esm({
|
|
26662
26667
|
"src/internal/auth/index.ts"() {
|
|
26663
|
-
|
|
26668
|
+
import_auth23 = require("@embarkai/core/auth");
|
|
26664
26669
|
init_passkeyAuth();
|
|
26665
26670
|
init_telegram();
|
|
26666
26671
|
init_passkey();
|
|
@@ -27962,13 +27967,13 @@ var init_iframe_manager = __esm({
|
|
|
27962
27967
|
});
|
|
27963
27968
|
|
|
27964
27969
|
// src/config/rainbowkit.ts
|
|
27965
|
-
var
|
|
27970
|
+
var import_read21, import_rainbowkit3, import_wallets2, import_wagmi10, import_chains12, getProjectId2, WALLET_MAP, getWagmiStorageKey, buildRainbowChains, createRainbowConfig, rainbowTheme;
|
|
27966
27971
|
var init_rainbowkit = __esm({
|
|
27967
27972
|
"src/config/rainbowkit.ts"() {
|
|
27968
|
-
|
|
27973
|
+
import_read21 = require("@embarkai/core/read");
|
|
27969
27974
|
import_rainbowkit3 = require("@rainbow-me/rainbowkit");
|
|
27970
27975
|
import_wallets2 = require("@rainbow-me/rainbowkit/wallets");
|
|
27971
|
-
|
|
27976
|
+
import_wagmi10 = require("wagmi");
|
|
27972
27977
|
import_chains12 = require("wagmi/chains");
|
|
27973
27978
|
getProjectId2 = (configProjectId) => {
|
|
27974
27979
|
if (configProjectId) return configProjectId;
|
|
@@ -27992,8 +27997,8 @@ var init_rainbowkit = __esm({
|
|
|
27992
27997
|
};
|
|
27993
27998
|
buildRainbowChains = (supportedChains, preferredChainId) => {
|
|
27994
27999
|
const availableChains = [
|
|
27995
|
-
|
|
27996
|
-
|
|
28000
|
+
import_read21.lumiaMainnetChain,
|
|
28001
|
+
import_read21.lumiaTestnetChain,
|
|
27997
28002
|
import_chains12.mainnet,
|
|
27998
28003
|
import_chains12.polygon,
|
|
27999
28004
|
import_chains12.bsc,
|
|
@@ -28019,7 +28024,7 @@ var init_rainbowkit = __esm({
|
|
|
28019
28024
|
appName: "EmbarkAI Wallet",
|
|
28020
28025
|
projectId: getProjectId2(opts.projectId),
|
|
28021
28026
|
chains: buildRainbowChains(opts.supportedChains, opts.preferredChainId),
|
|
28022
|
-
storage: (0,
|
|
28027
|
+
storage: (0, import_wagmi10.createStorage)({ key: getWagmiStorageKey(opts) }),
|
|
28023
28028
|
ssr: false
|
|
28024
28029
|
};
|
|
28025
28030
|
if (opts.allowedWallets && opts.allowedWallets.length > 0) {
|
|
@@ -28220,7 +28225,7 @@ var init_rainbowkit = __esm({
|
|
|
28220
28225
|
function RainbowKitProvider({ children }) {
|
|
28221
28226
|
const config = useProviderConfig().config;
|
|
28222
28227
|
const colorMode = useLayoutStore((st) => st.colorMode);
|
|
28223
|
-
const rainbowConfig = (0,
|
|
28228
|
+
const rainbowConfig = (0, import_react91.useMemo)(
|
|
28224
28229
|
() => createRainbowConfig({
|
|
28225
28230
|
projectId: config.current?.wallet?.walletConnectProjectId,
|
|
28226
28231
|
allowedWallets: config.current?.wallet?.allowedWallets,
|
|
@@ -28234,7 +28239,7 @@ function RainbowKitProvider({ children }) {
|
|
|
28234
28239
|
config.current?.wallet?.walletConnectProjectId
|
|
28235
28240
|
]
|
|
28236
28241
|
);
|
|
28237
|
-
const customTheme = (0,
|
|
28242
|
+
const customTheme = (0, import_react91.useMemo)(() => {
|
|
28238
28243
|
if (!config.current?.wallet?.enabled) return {};
|
|
28239
28244
|
return colorMode === "dark" ? {
|
|
28240
28245
|
...(0, import_rainbowkit4.darkTheme)(),
|
|
@@ -28249,14 +28254,14 @@ function RainbowKitProvider({ children }) {
|
|
|
28249
28254
|
};
|
|
28250
28255
|
}, [colorMode]);
|
|
28251
28256
|
if (!config.current?.wallet?.enabled) return /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(import_jsx_runtime122.Fragment, { children });
|
|
28252
|
-
return /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(
|
|
28257
|
+
return /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(import_wagmi11.WagmiProvider, { config: rainbowConfig, children: /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(import_rainbowkit4.RainbowKitProvider, { theme: customTheme, modalSize: "compact", showRecentTransactions: true, children }) });
|
|
28253
28258
|
}
|
|
28254
|
-
var import_rainbowkit4,
|
|
28259
|
+
var import_rainbowkit4, import_react91, import_wagmi11, import_styles, import_jsx_runtime122;
|
|
28255
28260
|
var init_RainbowKitContext = __esm({
|
|
28256
28261
|
"src/context/RainbowKitContext.tsx"() {
|
|
28257
28262
|
import_rainbowkit4 = require("@rainbow-me/rainbowkit");
|
|
28258
|
-
|
|
28259
|
-
|
|
28263
|
+
import_react91 = require("react");
|
|
28264
|
+
import_wagmi11 = require("wagmi");
|
|
28260
28265
|
init_rainbowkit();
|
|
28261
28266
|
init_useLayoutStore();
|
|
28262
28267
|
init_ProviderContext();
|
|
@@ -28281,14 +28286,14 @@ var init_utils11 = __esm({
|
|
|
28281
28286
|
});
|
|
28282
28287
|
|
|
28283
28288
|
// src/context/WagmiContext.tsx
|
|
28284
|
-
var import_core7,
|
|
28289
|
+
var import_core7, import_wagmi12, import_jsx_runtime123, WagmiProvider2;
|
|
28285
28290
|
var init_WagmiContext = __esm({
|
|
28286
28291
|
"src/context/WagmiContext.tsx"() {
|
|
28287
28292
|
import_core7 = require("@embarkai/core");
|
|
28288
|
-
|
|
28293
|
+
import_wagmi12 = require("wagmi");
|
|
28289
28294
|
import_jsx_runtime123 = require("react/jsx-runtime");
|
|
28290
28295
|
WagmiProvider2 = ({ children }) => {
|
|
28291
|
-
return /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(
|
|
28296
|
+
return /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(import_wagmi12.WagmiProvider, { config: import_core7.wagmiConfig, children });
|
|
28292
28297
|
};
|
|
28293
28298
|
}
|
|
28294
28299
|
});
|
|
@@ -28311,10 +28316,10 @@ function clearLegacyWagmiStorage() {
|
|
|
28311
28316
|
}
|
|
28312
28317
|
function Provider(props) {
|
|
28313
28318
|
const { children, projectId, initialConfig = {}, callbacks } = props;
|
|
28314
|
-
const callbacksRef = (0,
|
|
28315
|
-
(0,
|
|
28316
|
-
const config = (0,
|
|
28317
|
-
const updateConfig = (0,
|
|
28319
|
+
const callbacksRef = (0, import_react92.useRef)(callbacks);
|
|
28320
|
+
(0, import_react92.useEffect)(() => notifyNoProjetctId(projectId), [projectId]);
|
|
28321
|
+
const config = (0, import_react92.useRef)((0, import_lodash_es11.merge)({}, DEFAULT_PROVIDER_CONFIG, { projectId }, initialConfig));
|
|
28322
|
+
const updateConfig = (0, import_react92.useCallback)((updates) => {
|
|
28318
28323
|
const prev = config.current;
|
|
28319
28324
|
const next = { ...prev };
|
|
28320
28325
|
if (updates.projectId !== void 0) next.projectId = updates.projectId;
|
|
@@ -28348,12 +28353,12 @@ function Provider(props) {
|
|
|
28348
28353
|
if (updates.translations) next.translations = { ...next.translations, ...updates.translations };
|
|
28349
28354
|
config.current = next;
|
|
28350
28355
|
}, []);
|
|
28351
|
-
const updateCallbacks = (0,
|
|
28356
|
+
const updateCallbacks = (0, import_react92.useCallback)((updates) => {
|
|
28352
28357
|
const prev = callbacksRef.current;
|
|
28353
28358
|
const next = updates ? { ...prev, ...updates } : void 0;
|
|
28354
28359
|
callbacksRef.current = next;
|
|
28355
28360
|
}, []);
|
|
28356
|
-
(0,
|
|
28361
|
+
(0, import_react92.useEffect)(() => {
|
|
28357
28362
|
if (typeof window === "undefined" || !projectId) return;
|
|
28358
28363
|
const mergedConfig = (0, import_lodash_es11.merge)(DEFAULT_PROVIDER_CONFIG, initialConfig);
|
|
28359
28364
|
updateConfig(mergedConfig);
|
|
@@ -28373,7 +28378,7 @@ function Provider(props) {
|
|
|
28373
28378
|
useSession.getState().setActiveChainId(mergedConfig.network.chainId);
|
|
28374
28379
|
}
|
|
28375
28380
|
}, [projectId, initialConfig]);
|
|
28376
|
-
(0,
|
|
28381
|
+
(0, import_react92.useEffect)(() => {
|
|
28377
28382
|
if (typeof window === "undefined" || !projectId) return;
|
|
28378
28383
|
try {
|
|
28379
28384
|
(0, import_error_tracking4.initSdkErrorTracking)();
|
|
@@ -28402,7 +28407,7 @@ function Provider(props) {
|
|
|
28402
28407
|
console.error("[PROVIDER] Error setting up iframe manager:", error);
|
|
28403
28408
|
}
|
|
28404
28409
|
}, [projectId]);
|
|
28405
|
-
const contextValue = (0,
|
|
28410
|
+
const contextValue = (0, import_react92.useMemo)(
|
|
28406
28411
|
() => ({
|
|
28407
28412
|
config,
|
|
28408
28413
|
updateConfig,
|
|
@@ -28423,12 +28428,12 @@ function Provider(props) {
|
|
|
28423
28428
|
/* @__PURE__ */ (0, import_jsx_runtime124.jsx)(WagmiProvider2, { children: /* @__PURE__ */ (0, import_jsx_runtime124.jsx)(UIContext.Provider, { value: contextValue, children: /* @__PURE__ */ (0, import_jsx_runtime124.jsx)(SessionProvider, { children }) }) })
|
|
28424
28429
|
);
|
|
28425
28430
|
}
|
|
28426
|
-
var import_error_tracking4, import_lodash_es11,
|
|
28431
|
+
var import_error_tracking4, import_lodash_es11, import_react92, import_jsx_runtime124, UIContext, useProviderConfig;
|
|
28427
28432
|
var init_ProviderContext = __esm({
|
|
28428
28433
|
"src/context/ProviderContext.tsx"() {
|
|
28429
28434
|
import_error_tracking4 = require("@embarkai/core/internal/error-tracking");
|
|
28430
28435
|
import_lodash_es11 = require("lodash-es");
|
|
28431
|
-
|
|
28436
|
+
import_react92 = require("react");
|
|
28432
28437
|
init_initial();
|
|
28433
28438
|
init_iframe_manager();
|
|
28434
28439
|
init_RainbowKitContext();
|
|
@@ -28436,9 +28441,9 @@ var init_ProviderContext = __esm({
|
|
|
28436
28441
|
init_utils11();
|
|
28437
28442
|
init_WagmiContext();
|
|
28438
28443
|
import_jsx_runtime124 = require("react/jsx-runtime");
|
|
28439
|
-
UIContext = (0,
|
|
28444
|
+
UIContext = (0, import_react92.createContext)(void 0);
|
|
28440
28445
|
useProviderConfig = () => {
|
|
28441
|
-
const ctx = (0,
|
|
28446
|
+
const ctx = (0, import_react92.useContext)(UIContext);
|
|
28442
28447
|
if (!ctx) throw new Error("useProviderConfig must be used within a Provider");
|
|
28443
28448
|
return ctx;
|
|
28444
28449
|
};
|
|
@@ -28480,9 +28485,9 @@ __export(index_exports, {
|
|
|
28480
28485
|
getUserOperationByHash: () => getUserOperationByHash,
|
|
28481
28486
|
getUserOperationReceipt: () => getUserOperationReceipt,
|
|
28482
28487
|
getUserProfile: () => getUserProfile,
|
|
28483
|
-
getValidTokens: () =>
|
|
28484
|
-
jwtTokenManager: () =>
|
|
28485
|
-
logout: () =>
|
|
28488
|
+
getValidTokens: () => import_auth23.getValidTokens,
|
|
28489
|
+
jwtTokenManager: () => import_auth23.jwtTokenManager,
|
|
28490
|
+
logout: () => import_auth23.logout,
|
|
28486
28491
|
looksLikeNickname: () => looksLikeNickname,
|
|
28487
28492
|
prepareBatchUserOperation: () => prepareBatchUserOperation,
|
|
28488
28493
|
prepareUserOperation: () => prepareUserOperation,
|
|
@@ -28637,7 +28642,7 @@ function EmbarkAiIcon(props) {
|
|
|
28637
28642
|
// src/components/ConnectWalletButton.tsx
|
|
28638
28643
|
var import_react_query55 = require("@tanstack/react-query");
|
|
28639
28644
|
var import_lucide_react79 = require("lucide-react");
|
|
28640
|
-
var
|
|
28645
|
+
var import_react93 = require("react");
|
|
28641
28646
|
init_SessionContext();
|
|
28642
28647
|
init_auth();
|
|
28643
28648
|
init_profile();
|
|
@@ -28670,18 +28675,18 @@ function ConnectWalletButton(props) {
|
|
|
28670
28675
|
const colorMode = useLayoutStore((st) => st.colorMode);
|
|
28671
28676
|
const { session, address, hasServerVault, isLoading, isIframeReady, status, setUsePaymaster } = useSession();
|
|
28672
28677
|
const connectButtonLabel = getFormattedStatus(label || "Connect", status, isIframeReady);
|
|
28673
|
-
(0,
|
|
28678
|
+
(0, import_react93.useEffect)(() => setUsePaymaster(usePaymaster), [setUsePaymaster, usePaymaster]);
|
|
28674
28679
|
const { data: profile, isLoading: isProfileLoading } = (0, import_react_query55.useQuery)({
|
|
28675
28680
|
retry: false,
|
|
28676
28681
|
enabled: !!address,
|
|
28677
28682
|
queryKey: [QUERY_KEYS.userProfile, address],
|
|
28678
28683
|
queryFn: getUserProfile
|
|
28679
28684
|
});
|
|
28680
|
-
const displayName = profile?.nicknameDisplay || profile?.displayName ||
|
|
28681
|
-
const indicators = (0,
|
|
28685
|
+
const displayName = profile?.nicknameDisplay || profile?.displayName || import_auth23.jwtTokenManager.getDisplayName();
|
|
28686
|
+
const indicators = (0, import_react93.useMemo)(() => {
|
|
28682
28687
|
const userId = session?.mpcUserId;
|
|
28683
28688
|
if (!userId) return { server: false, local: false, backup: false };
|
|
28684
|
-
const server =
|
|
28689
|
+
const server = import_auth23.jwtTokenManager.getHasKeyshare() ?? false;
|
|
28685
28690
|
const local = !!address;
|
|
28686
28691
|
return { server, local, backup: hasServerVault };
|
|
28687
28692
|
}, [session, address, hasServerVault]);
|
|
@@ -28860,7 +28865,7 @@ var useActiveChainId = () => useSession((st) => st.activeChainId);
|
|
|
28860
28865
|
var useHydrated = () => useSession((st) => st.hasHydrated);
|
|
28861
28866
|
|
|
28862
28867
|
// src/hooks/useOpenPage.ts
|
|
28863
|
-
var
|
|
28868
|
+
var import_react94 = require("react");
|
|
28864
28869
|
init_SessionContext();
|
|
28865
28870
|
init_useLayoutDataStore();
|
|
28866
28871
|
function useOpenPage() {
|
|
@@ -28868,7 +28873,7 @@ function useOpenPage() {
|
|
|
28868
28873
|
const setPage = useLayoutDataStore((st) => st.setPage);
|
|
28869
28874
|
const setPageParams = useLayoutDataStore((st) => st.setPageParams);
|
|
28870
28875
|
const address = useSession((st) => st.address);
|
|
28871
|
-
const open = (0,
|
|
28876
|
+
const open = (0, import_react94.useCallback)(
|
|
28872
28877
|
(passportPage, params) => {
|
|
28873
28878
|
if (!address) return setPage("auth" /* AUTH */);
|
|
28874
28879
|
if (!!address && passportPage === "auth" /* AUTH */) return setPage("manage-wallet" /* MANAGE_WALLET */);
|
|
@@ -28877,7 +28882,7 @@ function useOpenPage() {
|
|
|
28877
28882
|
},
|
|
28878
28883
|
[setPage, setPageParams, address]
|
|
28879
28884
|
);
|
|
28880
|
-
const close = (0,
|
|
28885
|
+
const close = (0, import_react94.useCallback)(() => setPage(null), [setPage]);
|
|
28881
28886
|
return { open, close, isOpen: page !== null };
|
|
28882
28887
|
}
|
|
28883
28888
|
|
|
@@ -29338,14 +29343,14 @@ var Hash = ({
|
|
|
29338
29343
|
};
|
|
29339
29344
|
|
|
29340
29345
|
// src/internal/components/TransactionsMenu/TransactionsList.tsx
|
|
29341
|
-
var
|
|
29346
|
+
var import_react95 = require("react");
|
|
29342
29347
|
init_base();
|
|
29343
29348
|
var import_jsx_runtime132 = require("react/jsx-runtime");
|
|
29344
29349
|
var TransactionsList = ({ address, itemsCount = 10 }) => {
|
|
29345
|
-
const [transactions, setTransactions] = (0,
|
|
29346
|
-
const [loading, setLoading] = (0,
|
|
29347
|
-
const [error, setError] = (0,
|
|
29348
|
-
(0,
|
|
29350
|
+
const [transactions, setTransactions] = (0, import_react95.useState)([]);
|
|
29351
|
+
const [loading, setLoading] = (0, import_react95.useState)(true);
|
|
29352
|
+
const [error, setError] = (0, import_react95.useState)(null);
|
|
29353
|
+
(0, import_react95.useEffect)(() => {
|
|
29349
29354
|
const fetchTransactions2 = async () => {
|
|
29350
29355
|
try {
|
|
29351
29356
|
setLoading(true);
|
|
@@ -29636,13 +29641,13 @@ function useUserOpStatus(options = {}) {
|
|
|
29636
29641
|
init_useErc3643Compliance();
|
|
29637
29642
|
|
|
29638
29643
|
// src/hooks/useWalletMode.ts
|
|
29639
|
-
var
|
|
29644
|
+
var import_react96 = require("react");
|
|
29640
29645
|
init_useExternalWalletStore();
|
|
29641
29646
|
function useWalletMode() {
|
|
29642
29647
|
const configMode = useExternalWalletStore((st) => st.configMode);
|
|
29643
29648
|
const activeMode = useExternalWalletStore((st) => st.activeMode);
|
|
29644
29649
|
const setActiveMode = useExternalWalletStore((st) => st.setActiveMode);
|
|
29645
|
-
const switchMode = (0,
|
|
29650
|
+
const switchMode = (0, import_react96.useCallback)(
|
|
29646
29651
|
(mode) => {
|
|
29647
29652
|
if (configMode !== "both") return;
|
|
29648
29653
|
setActiveMode(mode);
|
|
@@ -29658,9 +29663,9 @@ function useWalletMode() {
|
|
|
29658
29663
|
}
|
|
29659
29664
|
|
|
29660
29665
|
// src/hooks/useDirectWallet.ts
|
|
29661
|
-
var
|
|
29666
|
+
var import_react97 = require("react");
|
|
29662
29667
|
var import_rainbowkit6 = require("@rainbow-me/rainbowkit");
|
|
29663
|
-
var
|
|
29668
|
+
var import_wagmi13 = require("wagmi");
|
|
29664
29669
|
init_useExternalWalletStore();
|
|
29665
29670
|
init_useLayoutDataStore();
|
|
29666
29671
|
function useDirectWallet() {
|
|
@@ -29669,16 +29674,16 @@ function useDirectWallet() {
|
|
|
29669
29674
|
const isConnected = useExternalWalletStore((st) => st.isExternalConnected);
|
|
29670
29675
|
const connectorName = useExternalWalletStore((st) => st.connectorName);
|
|
29671
29676
|
const clearExternalWallet = useExternalWalletStore((st) => st.clearExternalWallet);
|
|
29672
|
-
const { disconnect: wagmiDisconnect } = (0,
|
|
29677
|
+
const { disconnect: wagmiDisconnect } = (0, import_wagmi13.useDisconnect)();
|
|
29673
29678
|
const { openConnectModal } = (0, import_rainbowkit6.useConnectModal)();
|
|
29674
29679
|
const setIsWalletLinking = useLayoutDataStore((st) => st.setIsWalletLinking);
|
|
29675
|
-
const connect = (0,
|
|
29680
|
+
const connect = (0, import_react97.useCallback)(() => {
|
|
29676
29681
|
setIsWalletLinking(true);
|
|
29677
29682
|
}, [setIsWalletLinking]);
|
|
29678
|
-
const reconnect = (0,
|
|
29683
|
+
const reconnect = (0, import_react97.useCallback)(() => {
|
|
29679
29684
|
if (openConnectModal) openConnectModal();
|
|
29680
29685
|
}, [openConnectModal]);
|
|
29681
|
-
const disconnect = (0,
|
|
29686
|
+
const disconnect = (0, import_react97.useCallback)(() => {
|
|
29682
29687
|
wagmiDisconnect();
|
|
29683
29688
|
clearExternalWallet();
|
|
29684
29689
|
}, [wagmiDisconnect, clearExternalWallet]);
|
|
@@ -29694,19 +29699,19 @@ function useDirectWallet() {
|
|
|
29694
29699
|
}
|
|
29695
29700
|
|
|
29696
29701
|
// src/hooks/useSendDirectTransaction.ts
|
|
29697
|
-
var
|
|
29702
|
+
var import_react98 = require("react");
|
|
29698
29703
|
var import_viem20 = require("viem");
|
|
29699
|
-
var
|
|
29704
|
+
var import_wagmi14 = require("wagmi");
|
|
29700
29705
|
init_useExternalWalletStore();
|
|
29701
29706
|
function useSendDirectTransaction() {
|
|
29702
29707
|
const isConnected = useExternalWalletStore((st) => st.isExternalConnected);
|
|
29703
29708
|
const externalChainId = useExternalWalletStore((st) => st.externalChainId);
|
|
29704
|
-
const { sendTransactionAsync } = (0,
|
|
29705
|
-
const { switchChainAsync } = (0,
|
|
29706
|
-
const [isPending, setIsPending] = (0,
|
|
29707
|
-
const [error, setError] = (0,
|
|
29708
|
-
const [txHash, setTxHash] = (0,
|
|
29709
|
-
const sendTransaction = (0,
|
|
29709
|
+
const { sendTransactionAsync } = (0, import_wagmi14.useSendTransaction)();
|
|
29710
|
+
const { switchChainAsync } = (0, import_wagmi14.useSwitchChain)();
|
|
29711
|
+
const [isPending, setIsPending] = (0, import_react98.useState)(false);
|
|
29712
|
+
const [error, setError] = (0, import_react98.useState)(null);
|
|
29713
|
+
const [txHash, setTxHash] = (0, import_react98.useState)(null);
|
|
29714
|
+
const sendTransaction = (0, import_react98.useCallback)(
|
|
29710
29715
|
async (params) => {
|
|
29711
29716
|
if (!isConnected) {
|
|
29712
29717
|
setError("No external wallet connected");
|
|
@@ -29740,7 +29745,7 @@ function useSendDirectTransaction() {
|
|
|
29740
29745
|
},
|
|
29741
29746
|
[isConnected, externalChainId, sendTransactionAsync, switchChainAsync]
|
|
29742
29747
|
);
|
|
29743
|
-
const reset = (0,
|
|
29748
|
+
const reset = (0, import_react98.useCallback)(() => {
|
|
29744
29749
|
setError(null);
|
|
29745
29750
|
setTxHash(null);
|
|
29746
29751
|
setIsPending(false);
|
|
@@ -29749,7 +29754,7 @@ function useSendDirectTransaction() {
|
|
|
29749
29754
|
}
|
|
29750
29755
|
|
|
29751
29756
|
// src/hooks/useTransferToLinkedWallet.ts
|
|
29752
|
-
var
|
|
29757
|
+
var import_react99 = require("react");
|
|
29753
29758
|
var import_viem21 = require("viem");
|
|
29754
29759
|
init_SessionContext();
|
|
29755
29760
|
init_account2();
|
|
@@ -29768,14 +29773,14 @@ var ERC20_TRANSFER_ABI2 = [
|
|
|
29768
29773
|
function useTransferToLinkedWallet() {
|
|
29769
29774
|
const session = useSession((st) => st.session);
|
|
29770
29775
|
const { profiles } = useLinkedProfiles();
|
|
29771
|
-
const [isPending, setIsPending] = (0,
|
|
29772
|
-
const [error, setError] = (0,
|
|
29773
|
-
const [userOpHash, setUserOpHash] = (0,
|
|
29774
|
-
const linkedWallets = (0,
|
|
29776
|
+
const [isPending, setIsPending] = (0, import_react99.useState)(false);
|
|
29777
|
+
const [error, setError] = (0, import_react99.useState)(null);
|
|
29778
|
+
const [userOpHash, setUserOpHash] = (0, import_react99.useState)(null);
|
|
29779
|
+
const linkedWallets = (0, import_react99.useMemo)(
|
|
29775
29780
|
() => (profiles || []).filter((p) => p.provider === "wallet" && p.externalId).map((p) => p.externalId),
|
|
29776
29781
|
[profiles]
|
|
29777
29782
|
);
|
|
29778
|
-
const transfer = (0,
|
|
29783
|
+
const transfer = (0, import_react99.useCallback)(
|
|
29779
29784
|
async (params) => {
|
|
29780
29785
|
if (!session) {
|
|
29781
29786
|
setError("No active session");
|
|
@@ -29826,7 +29831,7 @@ function useTransferToLinkedWallet() {
|
|
|
29826
29831
|
},
|
|
29827
29832
|
[session, linkedWallets]
|
|
29828
29833
|
);
|
|
29829
|
-
const reset = (0,
|
|
29834
|
+
const reset = (0, import_react99.useCallback)(() => {
|
|
29830
29835
|
setError(null);
|
|
29831
29836
|
setUserOpHash(null);
|
|
29832
29837
|
setIsPending(false);
|
|
@@ -29835,11 +29840,11 @@ function useTransferToLinkedWallet() {
|
|
|
29835
29840
|
}
|
|
29836
29841
|
|
|
29837
29842
|
// src/hooks/useNativeWalletSignature.ts
|
|
29838
|
-
var
|
|
29843
|
+
var import_wagmi15 = require("wagmi");
|
|
29839
29844
|
init_providers();
|
|
29840
29845
|
function useNativeWalletSignature() {
|
|
29841
|
-
const signMessage = (0,
|
|
29842
|
-
const signTypedMessage = (0,
|
|
29846
|
+
const signMessage = (0, import_wagmi15.useSignMessage)();
|
|
29847
|
+
const signTypedMessage = (0, import_wagmi15.useSignTypedData)();
|
|
29843
29848
|
return {
|
|
29844
29849
|
signMessage,
|
|
29845
29850
|
/** EIP-712 signature */
|
|
@@ -29849,27 +29854,43 @@ function useNativeWalletSignature() {
|
|
|
29849
29854
|
}
|
|
29850
29855
|
|
|
29851
29856
|
// src/hooks/useLogout.ts
|
|
29852
|
-
var
|
|
29853
|
-
var
|
|
29857
|
+
var import_auth25 = require("@embarkai/core/auth");
|
|
29858
|
+
var import_react100 = require("react");
|
|
29859
|
+
var import_wagmi16 = require("wagmi");
|
|
29854
29860
|
init_ProviderContext();
|
|
29855
29861
|
init_SessionContext();
|
|
29862
|
+
init_useExternalWalletStore();
|
|
29856
29863
|
function useLogout() {
|
|
29857
|
-
const { setSession, setIsLoading, setAddress, setStatus, setError, address } = useSession();
|
|
29858
29864
|
const { callbacksRef } = useProviderConfig();
|
|
29859
|
-
const
|
|
29865
|
+
const address = useSession((st) => st.address);
|
|
29866
|
+
const { disconnect: wagmiDisconnect } = (0, import_wagmi16.useDisconnect)({
|
|
29867
|
+
mutation: {
|
|
29868
|
+
onSuccess: () => {
|
|
29869
|
+
useExternalWalletStore.getState().clearExternalWallet();
|
|
29870
|
+
useExternalWalletStore.getState().setExternalChainId(null);
|
|
29871
|
+
console.log("[ExternalWalletStore] Disconnected from external wallet");
|
|
29872
|
+
},
|
|
29873
|
+
onError: (err) => {
|
|
29874
|
+
console.error("[ExternalWalletStore] Error disconnecting from external wallet:", err);
|
|
29875
|
+
}
|
|
29876
|
+
}
|
|
29877
|
+
});
|
|
29878
|
+
const logout2 = (0, import_react100.useCallback)(async () => {
|
|
29879
|
+
const { setSession, setIsLoading, setAddress, setStatus, setError } = useSession.getState();
|
|
29860
29880
|
const prevAddress = address;
|
|
29861
29881
|
let userId = null;
|
|
29862
29882
|
setIsLoading(true);
|
|
29863
29883
|
try {
|
|
29864
|
-
userId =
|
|
29884
|
+
userId = import_auth25.jwtTokenManager.getUserId() || null;
|
|
29865
29885
|
} catch (error) {
|
|
29866
29886
|
console.warn("[useLogout] Could not get userId:", error);
|
|
29867
29887
|
}
|
|
29868
29888
|
try {
|
|
29869
|
-
await (0,
|
|
29889
|
+
await (0, import_auth25.logout)();
|
|
29870
29890
|
} catch (error) {
|
|
29871
29891
|
console.warn("[useLogout] Core logout failed:", error);
|
|
29872
29892
|
}
|
|
29893
|
+
if (!!useExternalWalletStore.getState().externalAddress) wagmiDisconnect();
|
|
29873
29894
|
setSession(null);
|
|
29874
29895
|
setAddress(null);
|
|
29875
29896
|
setStatus("idle");
|
|
@@ -29883,7 +29904,7 @@ function useLogout() {
|
|
|
29883
29904
|
} catch (error) {
|
|
29884
29905
|
console.warn("[useLogout] Callback error:", error);
|
|
29885
29906
|
}
|
|
29886
|
-
}, [address
|
|
29907
|
+
}, [address]);
|
|
29887
29908
|
return { logout: logout2 };
|
|
29888
29909
|
}
|
|
29889
29910
|
|
|
@@ -29906,15 +29927,15 @@ init_useBlockscoutAssets();
|
|
|
29906
29927
|
|
|
29907
29928
|
// src/modules/transactions.ts
|
|
29908
29929
|
init_SessionContext();
|
|
29909
|
-
var
|
|
29930
|
+
var import_read22 = require("@embarkai/core/read");
|
|
29910
29931
|
var import_viem22 = require("viem");
|
|
29911
|
-
var
|
|
29932
|
+
var import_wagmi17 = require("wagmi");
|
|
29912
29933
|
function useTransactions() {
|
|
29913
29934
|
const chainId = requireActiveChainId();
|
|
29914
|
-
const viemChain = (0,
|
|
29915
|
-
const publicClient = (0,
|
|
29916
|
-
const { data: walletClient } = (0,
|
|
29917
|
-
const { address } = (0,
|
|
29935
|
+
const viemChain = (0, import_read22.getViemChain)(chainId);
|
|
29936
|
+
const publicClient = (0, import_wagmi17.usePublicClient)({ chainId });
|
|
29937
|
+
const { data: walletClient } = (0, import_wagmi17.useWalletClient)();
|
|
29938
|
+
const { address } = (0, import_wagmi17.useAccount)();
|
|
29918
29939
|
const sendTransaction = async (params) => {
|
|
29919
29940
|
if (!walletClient) {
|
|
29920
29941
|
throw new Error("Wallet not connected");
|
|
@@ -29972,9 +29993,9 @@ function useTransactions() {
|
|
|
29972
29993
|
|
|
29973
29994
|
// src/modules/assets.ts
|
|
29974
29995
|
init_SessionContext();
|
|
29975
|
-
var
|
|
29996
|
+
var import_react101 = __toESM(require("react"), 1);
|
|
29976
29997
|
var import_viem23 = require("viem");
|
|
29977
|
-
var
|
|
29998
|
+
var import_wagmi18 = require("wagmi");
|
|
29978
29999
|
var COMMON_TOKENS = [
|
|
29979
30000
|
// Add real token addresses here when available
|
|
29980
30001
|
// {
|
|
@@ -29991,7 +30012,7 @@ function useAssets(address) {
|
|
|
29991
30012
|
data: nativeBalance,
|
|
29992
30013
|
isLoading: nativeBalanceLoading,
|
|
29993
30014
|
refetch: refetchNativeBalance
|
|
29994
|
-
} = (0,
|
|
30015
|
+
} = (0, import_wagmi18.useBalance)({
|
|
29995
30016
|
address,
|
|
29996
30017
|
chainId,
|
|
29997
30018
|
query: {
|
|
@@ -30005,7 +30026,7 @@ function useAssets(address) {
|
|
|
30005
30026
|
args: [address],
|
|
30006
30027
|
chainId
|
|
30007
30028
|
}));
|
|
30008
|
-
const readContractsResult = (0,
|
|
30029
|
+
const readContractsResult = (0, import_wagmi18.useReadContracts)({
|
|
30009
30030
|
contracts: tokenContracts,
|
|
30010
30031
|
query: {
|
|
30011
30032
|
enabled: !!address && COMMON_TOKENS.length > 0
|
|
@@ -30086,7 +30107,7 @@ function useAssets(address) {
|
|
|
30086
30107
|
}
|
|
30087
30108
|
function useTokenInfo(tokenAddress) {
|
|
30088
30109
|
const chainId = requireActiveChainId();
|
|
30089
|
-
const readContractsResult = (0,
|
|
30110
|
+
const readContractsResult = (0, import_wagmi18.useReadContracts)({
|
|
30090
30111
|
contracts: [
|
|
30091
30112
|
{ address: tokenAddress, abi: import_viem23.erc20Abi, functionName: "name", chainId },
|
|
30092
30113
|
{ address: tokenAddress, abi: import_viem23.erc20Abi, functionName: "symbol", chainId },
|
|
@@ -30117,7 +30138,7 @@ function useTokenBalance(tokenAddress, userAddress) {
|
|
|
30117
30138
|
data: balance,
|
|
30118
30139
|
isLoading,
|
|
30119
30140
|
refetch
|
|
30120
|
-
} = (0,
|
|
30141
|
+
} = (0, import_wagmi18.useReadContract)({
|
|
30121
30142
|
address: tokenAddress,
|
|
30122
30143
|
abi: import_viem23.erc20Abi,
|
|
30123
30144
|
functionName: "balanceOf",
|
|
@@ -30128,7 +30149,7 @@ function useTokenBalance(tokenAddress, userAddress) {
|
|
|
30128
30149
|
}
|
|
30129
30150
|
});
|
|
30130
30151
|
const { tokenInfo } = useTokenInfo(tokenAddress);
|
|
30131
|
-
const formattedBalance =
|
|
30152
|
+
const formattedBalance = import_react101.default.useMemo(() => {
|
|
30132
30153
|
if (!balance || !tokenInfo) return "0";
|
|
30133
30154
|
return (0, import_viem23.formatUnits)(balance, tokenInfo.decimals);
|
|
30134
30155
|
}, [balance, tokenInfo]);
|